diff --git a/amigae33a/E_v3.3a/Modules.lha b/amigae33a/E_v3.3a/Modules.lha deleted file mode 100644 index 84eff47..0000000 Binary files a/amigae33a/E_v3.3a/Modules.lha and /dev/null differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/BeBox.m b/amigae33a/E_v3.3a/Modules/Modules/afc/BeBox.m new file mode 100644 index 0000000..1556de5 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/BeBox.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/Bitmapper.m b/amigae33a/E_v3.3a/Modules/Modules/afc/Bitmapper.m new file mode 100644 index 0000000..b8e1ae6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/Bitmapper.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/DirList.m b/amigae33a/E_v3.3a/Modules/Modules/afc/DirList.m new file mode 100644 index 0000000..883740a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/DirList.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/Displayer.m b/amigae33a/E_v3.3a/Modules/Modules/afc/Displayer.m new file mode 100644 index 0000000..48dcff9 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/Displayer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/IFFParser.m b/amigae33a/E_v3.3a/Modules/Modules/afc/IFFParser.m new file mode 100644 index 0000000..b819692 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/IFFParser.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/Localer.m b/amigae33a/E_v3.3a/Modules/Modules/afc/Localer.m new file mode 100644 index 0000000..8530334 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/Localer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/Mousepointer.m b/amigae33a/E_v3.3a/Modules/Modules/afc/Mousepointer.m new file mode 100644 index 0000000..ffdab0b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/Mousepointer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/NodeMaster.m b/amigae33a/E_v3.3a/Modules/Modules/afc/NodeMaster.m new file mode 100644 index 0000000..7481f4e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/NodeMaster.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/Parser.m b/amigae33a/E_v3.3a/Modules/Modules/afc/Parser.m new file mode 100644 index 0000000..0cdc9a0 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/Parser.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/ReqTooller.m b/amigae33a/E_v3.3a/Modules/Modules/afc/ReqTooller.m new file mode 100644 index 0000000..677382a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/ReqTooller.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/StringNode.m b/amigae33a/E_v3.3a/Modules/Modules/afc/StringNode.m new file mode 100644 index 0000000..2e02c17 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/StringNode.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/ToolType.m b/amigae33a/E_v3.3a/Modules/Modules/afc/ToolType.m new file mode 100644 index 0000000..5c1bea8 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/ToolType.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/Worldbuilder.m b/amigae33a/E_v3.3a/Modules/Modules/afc/Worldbuilder.m new file mode 100644 index 0000000..25168b9 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/Worldbuilder.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/explain_exception.m b/amigae33a/E_v3.3a/Modules/Modules/afc/explain_exception.m new file mode 100644 index 0000000..e598c31 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/explain_exception.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/hardsprite.m b/amigae33a/E_v3.3a/Modules/Modules/afc/hardsprite.m new file mode 100644 index 0000000..b9e3e6d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/hardsprite.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/mgui.m b/amigae33a/E_v3.3a/Modules/Modules/afc/mgui.m new file mode 100644 index 0000000..428dea9 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/mgui.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/rexxer.m b/amigae33a/E_v3.3a/Modules/Modules/afc/rexxer.m new file mode 100644 index 0000000..22003ef Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/rexxer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/super_picture.m b/amigae33a/E_v3.3a/Modules/Modules/afc/super_picture.m new file mode 100644 index 0000000..5036e89 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/super_picture.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/tasker.m b/amigae33a/E_v3.3a/Modules/Modules/afc/tasker.m new file mode 100644 index 0000000..9ecce81 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/tasker.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/afc/validPortName.m b/amigae33a/E_v3.3a/Modules/Modules/afc/validPortName.m new file mode 100644 index 0000000..f847494 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/afc/validPortName.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/amigaguide.m b/amigae33a/E_v3.3a/Modules/Modules/amigaguide.m new file mode 100644 index 0000000..9e618f6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/amigaguide.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/amigalib/Tasks.m b/amigae33a/E_v3.3a/Modules/Modules/amigalib/Tasks.m new file mode 100644 index 0000000..88de905 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/amigalib/Tasks.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/amigalib/argarray.m b/amigae33a/E_v3.3a/Modules/Modules/amigalib/argarray.m new file mode 100644 index 0000000..b90dfcb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/amigalib/argarray.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/amigalib/boopsi.m b/amigae33a/E_v3.3a/Modules/Modules/amigalib/boopsi.m new file mode 100644 index 0000000..b34f384 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/amigalib/boopsi.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/amigalib/cx.m b/amigae33a/E_v3.3a/Modules/Modules/amigalib/cx.m new file mode 100644 index 0000000..6871016 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/amigalib/cx.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/amigalib/interrupts.m b/amigae33a/E_v3.3a/Modules/Modules/amigalib/interrupts.m new file mode 100644 index 0000000..38e987d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/amigalib/interrupts.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/amigalib/io.m b/amigae33a/E_v3.3a/Modules/Modules/amigalib/io.m new file mode 100644 index 0000000..92521bb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/amigalib/io.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/amigalib/lists.m b/amigae33a/E_v3.3a/Modules/Modules/amigalib/lists.m new file mode 100644 index 0000000..07e369d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/amigalib/lists.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/amigalib/ports.m b/amigae33a/E_v3.3a/Modules/Modules/amigalib/ports.m new file mode 100644 index 0000000..c88ab3e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/amigalib/ports.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/amigalib/random.m b/amigae33a/E_v3.3a/Modules/Modules/amigalib/random.m new file mode 100644 index 0000000..9d19f4e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/amigalib/random.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/amigalib/time.m b/amigae33a/E_v3.3a/Modules/Modules/amigalib/time.m new file mode 100644 index 0000000..6bffc4b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/amigalib/time.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/asl.m b/amigae33a/E_v3.3a/Modules/Modules/asl.m new file mode 100644 index 0000000..cd17f1d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/asl.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/bgui.m b/amigae33a/E_v3.3a/Modules/Modules/bgui.m new file mode 100644 index 0000000..6accdbb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/bgui.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/bullet.m b/amigae33a/E_v3.3a/Modules/Modules/bullet.m new file mode 100644 index 0000000..7be545a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/bullet.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/class/hash.m b/amigae33a/E_v3.3a/Modules/Modules/class/hash.m new file mode 100644 index 0000000..0e7ed00 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/class/hash.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/class/sc.m b/amigae33a/E_v3.3a/Modules/Modules/class/sc.m new file mode 100644 index 0000000..1698127 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/class/sc.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/class/sctext.m b/amigae33a/E_v3.3a/Modules/Modules/class/sctext.m new file mode 100644 index 0000000..30ccc61 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/class/sctext.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/class/stack.m b/amigae33a/E_v3.3a/Modules/Modules/class/stack.m new file mode 100644 index 0000000..ab5a6de Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/class/stack.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/colorwheel.m b/amigae33a/E_v3.3a/Modules/Modules/colorwheel.m new file mode 100644 index 0000000..e9388fe Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/colorwheel.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/commodities.m b/amigae33a/E_v3.3a/Modules/Modules/commodities.m new file mode 100644 index 0000000..dee9003 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/commodities.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/console.m b/amigae33a/E_v3.3a/Modules/Modules/console.m new file mode 100644 index 0000000..cb1a2c4 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/console.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/cybergraphics.m b/amigae33a/E_v3.3a/Modules/Modules/cybergraphics.m new file mode 100644 index 0000000..a7083fd Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/cybergraphics.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/datatypes.m b/amigae33a/E_v3.3a/Modules/Modules/datatypes.m new file mode 100644 index 0000000..abf79d8 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/datatypes.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/datatypes/animationclass.m b/amigae33a/E_v3.3a/Modules/Modules/datatypes/animationclass.m new file mode 100644 index 0000000..382d564 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/datatypes/animationclass.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/datatypes/datatypes.m b/amigae33a/E_v3.3a/Modules/Modules/datatypes/datatypes.m new file mode 100644 index 0000000..53e0d4e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/datatypes/datatypes.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/datatypes/datatypesclass.m b/amigae33a/E_v3.3a/Modules/Modules/datatypes/datatypesclass.m new file mode 100644 index 0000000..3ae1162 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/datatypes/datatypesclass.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/datatypes/pictureclass.m b/amigae33a/E_v3.3a/Modules/Modules/datatypes/pictureclass.m new file mode 100644 index 0000000..b6341d4 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/datatypes/pictureclass.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/datatypes/soundclass.m b/amigae33a/E_v3.3a/Modules/Modules/datatypes/soundclass.m new file mode 100644 index 0000000..96ece7b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/datatypes/soundclass.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/datatypes/textclass.m b/amigae33a/E_v3.3a/Modules/Modules/datatypes/textclass.m new file mode 100644 index 0000000..fa288ed Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/datatypes/textclass.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/audio.m b/amigae33a/E_v3.3a/Modules/Modules/devices/audio.m new file mode 100644 index 0000000..35cd1b7 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/audio.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/bootblock.m b/amigae33a/E_v3.3a/Modules/Modules/devices/bootblock.m new file mode 100644 index 0000000..60961e2 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/bootblock.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/cd.m b/amigae33a/E_v3.3a/Modules/Modules/devices/cd.m new file mode 100644 index 0000000..c5f5980 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/cd.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/clipboard.m b/amigae33a/E_v3.3a/Modules/Modules/devices/clipboard.m new file mode 100644 index 0000000..a00ab09 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/clipboard.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/console.m b/amigae33a/E_v3.3a/Modules/Modules/devices/console.m new file mode 100644 index 0000000..52d1747 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/console.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/conunit.m b/amigae33a/E_v3.3a/Modules/Modules/devices/conunit.m new file mode 100644 index 0000000..d2d2d6d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/conunit.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/gameport.m b/amigae33a/E_v3.3a/Modules/Modules/devices/gameport.m new file mode 100644 index 0000000..0dbf984 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/gameport.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/hardblocks.m b/amigae33a/E_v3.3a/Modules/Modules/devices/hardblocks.m new file mode 100644 index 0000000..318216a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/hardblocks.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/input.m b/amigae33a/E_v3.3a/Modules/Modules/devices/input.m new file mode 100644 index 0000000..1c64de6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/input.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/inputevent.m b/amigae33a/E_v3.3a/Modules/Modules/devices/inputevent.m new file mode 100644 index 0000000..5ac6f79 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/inputevent.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/keyboard.m b/amigae33a/E_v3.3a/Modules/Modules/devices/keyboard.m new file mode 100644 index 0000000..836fb44 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/keyboard.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/keymap.m b/amigae33a/E_v3.3a/Modules/Modules/devices/keymap.m new file mode 100644 index 0000000..c45d97a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/keymap.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/narrator.m b/amigae33a/E_v3.3a/Modules/Modules/devices/narrator.m new file mode 100644 index 0000000..cc42711 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/narrator.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/parallel.m b/amigae33a/E_v3.3a/Modules/Modules/devices/parallel.m new file mode 100644 index 0000000..6d2fb2d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/parallel.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/printer.m b/amigae33a/E_v3.3a/Modules/Modules/devices/printer.m new file mode 100644 index 0000000..d7d8ec5 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/printer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/prtbase.m b/amigae33a/E_v3.3a/Modules/Modules/devices/prtbase.m new file mode 100644 index 0000000..a991964 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/prtbase.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/prtgfx.m b/amigae33a/E_v3.3a/Modules/Modules/devices/prtgfx.m new file mode 100644 index 0000000..d67420c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/prtgfx.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/scsidisk.m b/amigae33a/E_v3.3a/Modules/Modules/devices/scsidisk.m new file mode 100644 index 0000000..47f5b4c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/scsidisk.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/serial.m b/amigae33a/E_v3.3a/Modules/Modules/devices/serial.m new file mode 100644 index 0000000..3dc9892 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/serial.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/timer.m b/amigae33a/E_v3.3a/Modules/Modules/devices/timer.m new file mode 100644 index 0000000..adb2537 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/timer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/devices/trackdisk.m b/amigae33a/E_v3.3a/Modules/Modules/devices/trackdisk.m new file mode 100644 index 0000000..83bd8ee Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/devices/trackdisk.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/diskfont.m b/amigae33a/E_v3.3a/Modules/Modules/diskfont.m new file mode 100644 index 0000000..00a2e60 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/diskfont.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/diskfont/diskfont.m b/amigae33a/E_v3.3a/Modules/Modules/diskfont/diskfont.m new file mode 100644 index 0000000..80e2755 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/diskfont/diskfont.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/diskfont/diskfonttag.m b/amigae33a/E_v3.3a/Modules/Modules/diskfont/diskfonttag.m new file mode 100644 index 0000000..7414b55 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/diskfont/diskfonttag.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/diskfont/glyph.m b/amigae33a/E_v3.3a/Modules/Modules/diskfont/glyph.m new file mode 100644 index 0000000..fad2473 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/diskfont/glyph.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/diskfont/oterrors.m b/amigae33a/E_v3.3a/Modules/Modules/diskfont/oterrors.m new file mode 100644 index 0000000..95dbeb4 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/diskfont/oterrors.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos.m b/amigae33a/E_v3.3a/Modules/Modules/dos.m new file mode 100644 index 0000000..a7c6bba Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/datetime.m b/amigae33a/E_v3.3a/Modules/Modules/dos/datetime.m new file mode 100644 index 0000000..093a018 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/datetime.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/dos.m b/amigae33a/E_v3.3a/Modules/Modules/dos/dos.m new file mode 100644 index 0000000..362084b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/dos.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/dos_lib.m b/amigae33a/E_v3.3a/Modules/Modules/dos/dos_lib.m new file mode 100644 index 0000000..16db133 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/dos_lib.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/dosasl.m b/amigae33a/E_v3.3a/Modules/Modules/dos/dosasl.m new file mode 100644 index 0000000..ca5f7b8 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/dosasl.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/dosextens.m b/amigae33a/E_v3.3a/Modules/Modules/dos/dosextens.m new file mode 100644 index 0000000..7101204 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/dosextens.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/doshunks.m b/amigae33a/E_v3.3a/Modules/Modules/dos/doshunks.m new file mode 100644 index 0000000..2ac6864 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/doshunks.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/dostags.m b/amigae33a/E_v3.3a/Modules/Modules/dos/dostags.m new file mode 100644 index 0000000..152aa42 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/dostags.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/exall.m b/amigae33a/E_v3.3a/Modules/Modules/dos/exall.m new file mode 100644 index 0000000..605a56a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/exall.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/filehandler.m b/amigae33a/E_v3.3a/Modules/Modules/dos/filehandler.m new file mode 100644 index 0000000..79c3c12 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/filehandler.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/notify.m b/amigae33a/E_v3.3a/Modules/Modules/dos/notify.m new file mode 100644 index 0000000..578b092 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/notify.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/rdargs.m b/amigae33a/E_v3.3a/Modules/Modules/dos/rdargs.m new file mode 100644 index 0000000..166ab55 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/rdargs.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/record.m b/amigae33a/E_v3.3a/Modules/Modules/dos/record.m new file mode 100644 index 0000000..8aeb353 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/record.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/stdio.m b/amigae33a/E_v3.3a/Modules/Modules/dos/stdio.m new file mode 100644 index 0000000..d821529 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/stdio.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dos/var.m b/amigae33a/E_v3.3a/Modules/Modules/dos/var.m new file mode 100644 index 0000000..94cd09c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dos/var.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/dtclass.m b/amigae33a/E_v3.3a/Modules/Modules/dtclass.m new file mode 100644 index 0000000..6da82ea Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/dtclass.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec.m b/amigae33a/E_v3.3a/Modules/Modules/exec.m new file mode 100644 index 0000000..130699c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/alerts.m b/amigae33a/E_v3.3a/Modules/Modules/exec/alerts.m new file mode 100644 index 0000000..ece6003 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/alerts.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/devices.m b/amigae33a/E_v3.3a/Modules/Modules/exec/devices.m new file mode 100644 index 0000000..2f6273c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/devices.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/errors.m b/amigae33a/E_v3.3a/Modules/Modules/exec/errors.m new file mode 100644 index 0000000..99d2b92 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/errors.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/execbase.m b/amigae33a/E_v3.3a/Modules/Modules/exec/execbase.m new file mode 100644 index 0000000..21a055b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/execbase.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/interrupts.m b/amigae33a/E_v3.3a/Modules/Modules/exec/interrupts.m new file mode 100644 index 0000000..7419b82 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/interrupts.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/io.m b/amigae33a/E_v3.3a/Modules/Modules/exec/io.m new file mode 100644 index 0000000..797592a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/io.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/libraries.m b/amigae33a/E_v3.3a/Modules/Modules/exec/libraries.m new file mode 100644 index 0000000..658b3af Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/libraries.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/lists.m b/amigae33a/E_v3.3a/Modules/Modules/exec/lists.m new file mode 100644 index 0000000..042483d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/lists.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/memory.m b/amigae33a/E_v3.3a/Modules/Modules/exec/memory.m new file mode 100644 index 0000000..fa5ca82 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/memory.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/nodes.m b/amigae33a/E_v3.3a/Modules/Modules/exec/nodes.m new file mode 100644 index 0000000..8a781af Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/nodes.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/ports.m b/amigae33a/E_v3.3a/Modules/Modules/exec/ports.m new file mode 100644 index 0000000..9396688 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/ports.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/resident.m b/amigae33a/E_v3.3a/Modules/Modules/exec/resident.m new file mode 100644 index 0000000..2dfdfe0 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/resident.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/semaphores.m b/amigae33a/E_v3.3a/Modules/Modules/exec/semaphores.m new file mode 100644 index 0000000..bc44812 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/semaphores.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/strings.m b/amigae33a/E_v3.3a/Modules/Modules/exec/strings.m new file mode 100644 index 0000000..bb9bf3f Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/strings.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/tasks.m b/amigae33a/E_v3.3a/Modules/Modules/exec/tasks.m new file mode 100644 index 0000000..9e59985 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/tasks.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/exec/types.m b/amigae33a/E_v3.3a/Modules/Modules/exec/types.m new file mode 100644 index 0000000..e3f7d3e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/exec/types.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/expansion.m b/amigae33a/E_v3.3a/Modules/Modules/expansion.m new file mode 100644 index 0000000..620a5ed Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/expansion.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/gadgets/button.m b/amigae33a/E_v3.3a/Modules/Modules/gadgets/button.m new file mode 100644 index 0000000..fe09847 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/gadgets/button.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/gadgets/calendar.m b/amigae33a/E_v3.3a/Modules/Modules/gadgets/calendar.m new file mode 100644 index 0000000..8b108ba Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/gadgets/calendar.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/gadgets/colorwheel.m b/amigae33a/E_v3.3a/Modules/Modules/gadgets/colorwheel.m new file mode 100644 index 0000000..ccdf19d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/gadgets/colorwheel.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/gadgets/gradientslider.m b/amigae33a/E_v3.3a/Modules/Modules/gadgets/gradientslider.m new file mode 100644 index 0000000..a5e30fb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/gadgets/gradientslider.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/gadgets/tabs.m b/amigae33a/E_v3.3a/Modules/Modules/gadgets/tabs.m new file mode 100644 index 0000000..e7d3121 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/gadgets/tabs.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/gadgets/tapedeck.m b/amigae33a/E_v3.3a/Modules/Modules/gadgets/tapedeck.m new file mode 100644 index 0000000..266f511 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/gadgets/tapedeck.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/gadtools.m b/amigae33a/E_v3.3a/Modules/Modules/gadtools.m new file mode 100644 index 0000000..9649df1 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/gadtools.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics.m b/amigae33a/E_v3.3a/Modules/Modules/graphics.m new file mode 100644 index 0000000..a94741d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/clip.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/clip.m new file mode 100644 index 0000000..efc9034 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/clip.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/coerce.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/coerce.m new file mode 100644 index 0000000..1b5eb10 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/coerce.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/collide.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/collide.m new file mode 100644 index 0000000..a0b315a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/collide.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/copper.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/copper.m new file mode 100644 index 0000000..3ca1512 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/copper.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/display.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/display.m new file mode 100644 index 0000000..3d222a4 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/display.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/displayinfo.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/displayinfo.m new file mode 100644 index 0000000..5933948 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/displayinfo.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/gels.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/gels.m new file mode 100644 index 0000000..2418c7b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/gels.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/gfx.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/gfx.m new file mode 100644 index 0000000..dec5235 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/gfx.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/gfxbase.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/gfxbase.m new file mode 100644 index 0000000..ecbbcc0 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/gfxbase.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/gfxmacros.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/gfxmacros.m new file mode 100644 index 0000000..6870c0b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/gfxmacros.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/gfxnodes.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/gfxnodes.m new file mode 100644 index 0000000..825fed8 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/gfxnodes.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/graphint.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/graphint.m new file mode 100644 index 0000000..f6618f5 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/graphint.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/layers.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/layers.m new file mode 100644 index 0000000..680e3ee Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/layers.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/modeid.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/modeid.m new file mode 100644 index 0000000..6aa3461 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/modeid.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/monitor.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/monitor.m new file mode 100644 index 0000000..8c917d3 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/monitor.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/rastport.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/rastport.m new file mode 100644 index 0000000..e7bcfcf Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/rastport.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/regions.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/regions.m new file mode 100644 index 0000000..f3a651d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/regions.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/rpattr.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/rpattr.m new file mode 100644 index 0000000..cfe751a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/rpattr.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/scale.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/scale.m new file mode 100644 index 0000000..f0b4531 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/scale.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/sprite.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/sprite.m new file mode 100644 index 0000000..ea29aad Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/sprite.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/text.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/text.m new file mode 100644 index 0000000..e0f8ab0 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/text.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/videocontrol.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/videocontrol.m new file mode 100644 index 0000000..165f324 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/videocontrol.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/graphics/view.m b/amigae33a/E_v3.3a/Modules/Modules/graphics/view.m new file mode 100644 index 0000000..0ede18b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/graphics/view.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/gtx.m b/amigae33a/E_v3.3a/Modules/Modules/gtx.m new file mode 100644 index 0000000..b8db51e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/gtx.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/hardware/adkbits.m b/amigae33a/E_v3.3a/Modules/Modules/hardware/adkbits.m new file mode 100644 index 0000000..9a1acf2 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/hardware/adkbits.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/hardware/blit.m b/amigae33a/E_v3.3a/Modules/Modules/hardware/blit.m new file mode 100644 index 0000000..d08b961 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/hardware/blit.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/hardware/cia.m b/amigae33a/E_v3.3a/Modules/Modules/hardware/cia.m new file mode 100644 index 0000000..7d45e31 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/hardware/cia.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/hardware/custom.m b/amigae33a/E_v3.3a/Modules/Modules/hardware/custom.m new file mode 100644 index 0000000..d968c38 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/hardware/custom.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/hardware/dmabits.m b/amigae33a/E_v3.3a/Modules/Modules/hardware/dmabits.m new file mode 100644 index 0000000..82e5dbb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/hardware/dmabits.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/hardware/intbits.m b/amigae33a/E_v3.3a/Modules/Modules/hardware/intbits.m new file mode 100644 index 0000000..74bf73f Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/hardware/intbits.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/icon.m b/amigae33a/E_v3.3a/Modules/Modules/icon.m new file mode 100644 index 0000000..e68fd7f Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/icon.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/iff.m b/amigae33a/E_v3.3a/Modules/Modules/iff.m new file mode 100644 index 0000000..a67ca1b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/iff.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/iffparse.m b/amigae33a/E_v3.3a/Modules/Modules/iffparse.m new file mode 100644 index 0000000..e23952d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/iffparse.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/images/led.m b/amigae33a/E_v3.3a/Modules/Modules/images/led.m new file mode 100644 index 0000000..22f8e0b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/images/led.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/input.m b/amigae33a/E_v3.3a/Modules/Modules/input.m new file mode 100644 index 0000000..561071c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/input.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition.m b/amigae33a/E_v3.3a/Modules/Modules/intuition.m new file mode 100644 index 0000000..fb8cff9 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/cghooks.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/cghooks.m new file mode 100644 index 0000000..1adef9b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/cghooks.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/classes.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/classes.m new file mode 100644 index 0000000..19b1030 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/classes.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/classusr.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/classusr.m new file mode 100644 index 0000000..c82e4d8 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/classusr.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/gadgetclass.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/gadgetclass.m new file mode 100644 index 0000000..d9867c5 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/gadgetclass.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/icclass.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/icclass.m new file mode 100644 index 0000000..a2046db Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/icclass.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/imageclass.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/imageclass.m new file mode 100644 index 0000000..88b1a0c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/imageclass.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/intuition.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/intuition.m new file mode 100644 index 0000000..bf241fc Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/intuition.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/intuitionbase.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/intuitionbase.m new file mode 100644 index 0000000..2d059d4 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/intuitionbase.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/iobsolete.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/iobsolete.m new file mode 100644 index 0000000..79ea00b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/iobsolete.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/pointerclass.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/pointerclass.m new file mode 100644 index 0000000..c6f0683 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/pointerclass.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/preferences.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/preferences.m new file mode 100644 index 0000000..d813ee7 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/preferences.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/screens.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/screens.m new file mode 100644 index 0000000..947e1ca Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/screens.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/intuition/sghooks.m b/amigae33a/E_v3.3a/Modules/Modules/intuition/sghooks.m new file mode 100644 index 0000000..3f11aa0 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/intuition/sghooks.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/keymap.m b/amigae33a/E_v3.3a/Modules/Modules/keymap.m new file mode 100644 index 0000000..bf21eb6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/keymap.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/layers.m b/amigae33a/E_v3.3a/Modules/Modules/layers.m new file mode 100644 index 0000000..f4628f0 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/layers.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/amigaguide.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/amigaguide.m new file mode 100644 index 0000000..81efb49 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/amigaguide.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/asl.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/asl.m new file mode 100644 index 0000000..09ff6f5 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/asl.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/bgui.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/bgui.m new file mode 100644 index 0000000..01e586f Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/bgui.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/bgui_macros.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/bgui_macros.m new file mode 100644 index 0000000..4f91745 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/bgui_macros.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/commodities.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/commodities.m new file mode 100644 index 0000000..f741341 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/commodities.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/configregs.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/configregs.m new file mode 100644 index 0000000..96c3e86 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/configregs.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/configvars.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/configvars.m new file mode 100644 index 0000000..de8d30d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/configvars.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/cybergraphics.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/cybergraphics.m new file mode 100644 index 0000000..ca48920 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/cybergraphics.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/diskfont.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/diskfont.m new file mode 100644 index 0000000..80e2755 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/diskfont.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/expansion.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/expansion.m new file mode 100644 index 0000000..8526e86 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/expansion.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/expansionbase.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/expansionbase.m new file mode 100644 index 0000000..2a3d152 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/expansionbase.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/gadtools.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/gadtools.m new file mode 100644 index 0000000..b4c4547 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/gadtools.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/iff.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/iff.m new file mode 100644 index 0000000..217b45e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/iff.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/iffparse.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/iffparse.m new file mode 100644 index 0000000..531c4a6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/iffparse.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/locale.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/locale.m new file mode 100644 index 0000000..5f0f764 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/locale.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/lowlevel.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/lowlevel.m new file mode 100644 index 0000000..8a96529 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/lowlevel.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/mathieeesp.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/mathieeesp.m new file mode 100644 index 0000000..4fefa98 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/mathieeesp.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/mathlibrary.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/mathlibrary.m new file mode 100644 index 0000000..15b1903 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/mathlibrary.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/mathresource.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/mathresource.m new file mode 100644 index 0000000..22581dd Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/mathresource.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/midi.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/midi.m new file mode 100644 index 0000000..e48273f Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/midi.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/muibuilder.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/muibuilder.m new file mode 100644 index 0000000..57b99b8 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/muibuilder.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/nofrag.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/nofrag.m new file mode 100644 index 0000000..5c7fcb9 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/nofrag.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/nonvolatile.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/nonvolatile.m new file mode 100644 index 0000000..df2ffbc Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/nonvolatile.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/ppbase.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/ppbase.m new file mode 100644 index 0000000..0658e36 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/ppbase.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/realtime.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/realtime.m new file mode 100644 index 0000000..10d9123 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/realtime.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/reqbase.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/reqbase.m new file mode 100644 index 0000000..1360992 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/reqbase.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/reqtools.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/reqtools.m new file mode 100644 index 0000000..6f9d56a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/reqtools.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/translator.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/translator.m new file mode 100644 index 0000000..090d52d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/translator.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/triton.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/triton.m new file mode 100644 index 0000000..50efa2e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/triton.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/triton_macros.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/triton_macros.m new file mode 100644 index 0000000..9c37192 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/triton_macros.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/vmem.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/vmem.m new file mode 100644 index 0000000..dee9e83 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/vmem.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/libraries/wizard.m b/amigae33a/E_v3.3a/Modules/Modules/libraries/wizard.m new file mode 100644 index 0000000..53d0828 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/libraries/wizard.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/locale.m b/amigae33a/E_v3.3a/Modules/Modules/locale.m new file mode 100644 index 0000000..ea72ca8 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/locale.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/lowlevel.m b/amigae33a/E_v3.3a/Modules/Modules/lowlevel.m new file mode 100644 index 0000000..aabdd00 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/lowlevel.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/mathffp.m b/amigae33a/E_v3.3a/Modules/Modules/mathffp.m new file mode 100644 index 0000000..14f216f Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/mathffp.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/mathieeedoubbas.m b/amigae33a/E_v3.3a/Modules/Modules/mathieeedoubbas.m new file mode 100644 index 0000000..6e4e688 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/mathieeedoubbas.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/mathieeedoubtrans.m b/amigae33a/E_v3.3a/Modules/Modules/mathieeedoubtrans.m new file mode 100644 index 0000000..814316d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/mathieeedoubtrans.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/mathieeesingbas.m b/amigae33a/E_v3.3a/Modules/Modules/mathieeesingbas.m new file mode 100644 index 0000000..6ec6de3 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/mathieeesingbas.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/mathieeesingtrans.m b/amigae33a/E_v3.3a/Modules/Modules/mathieeesingtrans.m new file mode 100644 index 0000000..c8fec05 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/mathieeesingtrans.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/mathtrans.m b/amigae33a/E_v3.3a/Modules/Modules/mathtrans.m new file mode 100644 index 0000000..d15ff2d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/mathtrans.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/midi.m b/amigae33a/E_v3.3a/Modules/Modules/midi.m new file mode 100644 index 0000000..5eb1374 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/midi.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/nofrag.m b/amigae33a/E_v3.3a/Modules/Modules/nofrag.m new file mode 100644 index 0000000..f4fe744 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/nofrag.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/nonvolatile.m b/amigae33a/E_v3.3a/Modules/Modules/nonvolatile.m new file mode 100644 index 0000000..e45e23f Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/nonvolatile.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/commodity.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/commodity.m new file mode 100644 index 0000000..e33f970 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/commodity.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/coordinate.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/coordinate.m new file mode 100644 index 0000000..4cdc34e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/coordinate.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/coordinate/line.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/coordinate/line.m new file mode 100644 index 0000000..9220795 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/coordinate/line.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/coordinate/polyline.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/coordinate/polyline.m new file mode 100644 index 0000000..f254eb3 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/coordinate/polyline.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library.m new file mode 100644 index 0000000..7617860 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/asl.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/asl.m new file mode 100644 index 0000000..10fd699 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/asl.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/commodities.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/commodities.m new file mode 100644 index 0000000..0a02dfd Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/commodities.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device.m new file mode 100644 index 0000000..8a78617 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device/keyboard.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device/keyboard.m new file mode 100644 index 0000000..559b808 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device/keyboard.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device/printer.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device/printer.m new file mode 100644 index 0000000..c7f939b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device/printer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device/trackdisk.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device/trackdisk.m new file mode 100644 index 0000000..ceb4793 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/device/trackdisk.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/exec/port.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/exec/port.m new file mode 100644 index 0000000..cdfd6b6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/exec/port.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/exec/port/arexxport.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/exec/port/arexxport.m new file mode 100644 index 0000000..423b639 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/exec/port/arexxport.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/exec/port/portlist.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/exec/port/portlist.m new file mode 100644 index 0000000..11d239a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/exec/port/portlist.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/gadtools.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/gadtools.m new file mode 100644 index 0000000..66ddf6d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/gadtools.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/locale.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/locale.m new file mode 100644 index 0000000..1a7a2c4 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/locale.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/locale/cataloglist.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/locale/cataloglist.m new file mode 100644 index 0000000..c5db952 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/locale/cataloglist.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/reqtools.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/reqtools.m new file mode 100644 index 0000000..2ff48ba Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/library/reqtools.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/associativearray.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/associativearray.m new file mode 100644 index 0000000..ca460fb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/associativearray.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/associativearray/associativestringarray.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/associativearray/associativestringarray.m new file mode 100644 index 0000000..fefddbf Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/associativearray/associativestringarray.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/doublylinked.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/doublylinked.m new file mode 100644 index 0000000..256eab8 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/doublylinked.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/elist.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/elist.m new file mode 100644 index 0000000..33eb910 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/elist.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/execlist.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/execlist.m new file mode 100644 index 0000000..b1700af Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/execlist.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/queuestack.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/queuestack.m new file mode 100644 index 0000000..d87b580 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/queuestack.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/stringlist/stringlist.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/stringlist/stringlist.m new file mode 100644 index 0000000..651599c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/list/stringlist/stringlist.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/object.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/object.m new file mode 100644 index 0000000..08b48c9 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/object.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort.m new file mode 100644 index 0000000..17626cd Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/address.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/address.m new file mode 100644 index 0000000..4daa763 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/address.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers.m new file mode 100644 index 0000000..beb2055 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/float.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/float.m new file mode 100644 index 0000000..19c1470 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/float.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/fraction.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/fraction.m new file mode 100644 index 0000000..b57242a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/fraction.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/integer.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/integer.m new file mode 100644 index 0000000..bcc00e6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/integer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/twonumbers.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/twonumbers.m new file mode 100644 index 0000000..846af13 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/numbers/twonumbers.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/string.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/string.m new file mode 100644 index 0000000..a15cda1 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/string.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/string/rawstring.m b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/string/rawstring.m new file mode 100644 index 0000000..5dc36b6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/oomodules/sort/string/rawstring.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/battclock.m b/amigae33a/E_v3.3a/Modules/Modules/other/battclock.m new file mode 100644 index 0000000..ad566f6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/battclock.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/battmem.m b/amigae33a/E_v3.3a/Modules/Modules/other/battmem.m new file mode 100644 index 0000000..ed021c9 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/battmem.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/bitfield.m b/amigae33a/E_v3.3a/Modules/Modules/other/bitfield.m new file mode 100644 index 0000000..c9e1a41 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/bitfield.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/bits.m b/amigae33a/E_v3.3a/Modules/Modules/other/bits.m new file mode 100644 index 0000000..2e9f3af Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/bits.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/cia.m b/amigae33a/E_v3.3a/Modules/Modules/other/cia.m new file mode 100644 index 0000000..a1ba380 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/cia.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/clearlist.m b/amigae33a/E_v3.3a/Modules/Modules/other/clearlist.m new file mode 100644 index 0000000..dea4f89 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/clearlist.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/cloneworkbench.m b/amigae33a/E_v3.3a/Modules/Modules/other/cloneworkbench.m new file mode 100644 index 0000000..b9e9232 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/cloneworkbench.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/disk.m b/amigae33a/E_v3.3a/Modules/Modules/other/disk.m new file mode 100644 index 0000000..cf02a9d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/disk.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/dislib.m b/amigae33a/E_v3.3a/Modules/Modules/other/dislib.m new file mode 100644 index 0000000..fa46ffb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/dislib.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/dispose.m b/amigae33a/E_v3.3a/Modules/Modules/other/dispose.m new file mode 100644 index 0000000..8a01bbf Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/dispose.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/disposeelinkedlist.m b/amigae33a/E_v3.3a/Modules/Modules/other/disposeelinkedlist.m new file mode 100644 index 0000000..636bbc0 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/disposeelinkedlist.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/disposelink.m b/amigae33a/E_v3.3a/Modules/Modules/other/disposelink.m new file mode 100644 index 0000000..c38b571 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/disposelink.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/dll.m b/amigae33a/E_v3.3a/Modules/Modules/other/dll.m new file mode 100644 index 0000000..c6c4755 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/dll.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/ecode.m b/amigae33a/E_v3.3a/Modules/Modules/other/ecode.m new file mode 100644 index 0000000..c29075d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/ecode.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/fastinsert.m b/amigae33a/E_v3.3a/Modules/Modules/other/fastinsert.m new file mode 100644 index 0000000..ede18b7 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/fastinsert.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/initlist.m b/amigae33a/E_v3.3a/Modules/Modules/other/initlist.m new file mode 100644 index 0000000..af86f77 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/initlist.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/isdigit.m b/amigae33a/E_v3.3a/Modules/Modules/other/isdigit.m new file mode 100644 index 0000000..f869920 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/isdigit.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/isidentifier.m b/amigae33a/E_v3.3a/Modules/Modules/other/isidentifier.m new file mode 100644 index 0000000..5e71fd6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/isidentifier.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/lowerchar.m b/amigae33a/E_v3.3a/Modules/Modules/other/lowerchar.m new file mode 100644 index 0000000..096898d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/lowerchar.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/misc.m b/amigae33a/E_v3.3a/Modules/Modules/other/misc.m new file mode 100644 index 0000000..196ae6a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/misc.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/mod.m b/amigae33a/E_v3.3a/Modules/Modules/other/mod.m new file mode 100644 index 0000000..4b0cd82 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/mod.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/potgo.m b/amigae33a/E_v3.3a/Modules/Modules/other/potgo.m new file mode 100644 index 0000000..149afc7 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/potgo.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/qualifieditemaddress.m b/amigae33a/E_v3.3a/Modules/Modules/other/qualifieditemaddress.m new file mode 100644 index 0000000..f5fd035 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/qualifieditemaddress.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/readstr.m b/amigae33a/E_v3.3a/Modules/Modules/other/readstr.m new file mode 100644 index 0000000..3c8884b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/readstr.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/sendexplorer.m b/amigae33a/E_v3.3a/Modules/Modules/other/sendexplorer.m new file mode 100644 index 0000000..e0977d6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/sendexplorer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/sendrexx.m b/amigae33a/E_v3.3a/Modules/Modules/other/sendrexx.m new file mode 100644 index 0000000..96662f6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/sendrexx.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/setprogname.m b/amigae33a/E_v3.3a/Modules/Modules/other/setprogname.m new file mode 100644 index 0000000..f6b7ccd Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/setprogname.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/skipnonwhite.m b/amigae33a/E_v3.3a/Modules/Modules/other/skipnonwhite.m new file mode 100644 index 0000000..b76af07 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/skipnonwhite.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/skiptochar.m b/amigae33a/E_v3.3a/Modules/Modules/other/skiptochar.m new file mode 100644 index 0000000..019e2eb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/skiptochar.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/skiptoedelim.m b/amigae33a/E_v3.3a/Modules/Modules/other/skiptoedelim.m new file mode 100644 index 0000000..311e624 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/skiptoedelim.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/skipwhite.m b/amigae33a/E_v3.3a/Modules/Modules/other/skipwhite.m new file mode 100644 index 0000000..f61a139 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/skipwhite.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/split.m b/amigae33a/E_v3.3a/Modules/Modules/other/split.m new file mode 100644 index 0000000..7b747ac Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/split.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/stack.m b/amigae33a/E_v3.3a/Modules/Modules/other/stack.m new file mode 100644 index 0000000..6da6695 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/stack.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/strcopy.m b/amigae33a/E_v3.3a/Modules/Modules/other/strcopy.m new file mode 100644 index 0000000..b81a541 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/strcopy.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/other/upperchar.m b/amigae33a/E_v3.3a/Modules/Modules/other/upperchar.m new file mode 100644 index 0000000..11a866e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/other/upperchar.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/animcontrol.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/animcontrol.m new file mode 100644 index 0000000..ab1d3b8 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/animcontrol.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/button.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/button.m new file mode 100644 index 0000000..d6160aa Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/button.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/calendar.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/calendar.m new file mode 100644 index 0000000..6e1ac49 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/calendar.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/colorwheel.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/colorwheel.m new file mode 100644 index 0000000..f2de451 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/colorwheel.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/gradient.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/gradient.m new file mode 100644 index 0000000..6a75822 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/gradient.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/iconify.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/iconify.m new file mode 100644 index 0000000..6a3bf65 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/iconify.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/imagebutton.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/imagebutton.m new file mode 100644 index 0000000..859e970 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/imagebutton.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/led.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/led.m new file mode 100644 index 0000000..bd0a6d9 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/led.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/password.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/password.m new file mode 100644 index 0000000..9d64548 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/password.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/tabs.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/tabs.m new file mode 100644 index 0000000..8528579 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/tabs.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/tapedeck.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/tapedeck.m new file mode 100644 index 0000000..2b77dcd Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/tapedeck.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/text_plug.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/text_plug.m new file mode 100644 index 0000000..21696d2 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/text_plug.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/ticker.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/ticker.m new file mode 100644 index 0000000..5a0dd97 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/ticker.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/plugins/toolify.m b/amigae33a/E_v3.3a/Modules/Modules/plugins/toolify.m new file mode 100644 index 0000000..411db9e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/plugins/toolify.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/pointer.m b/amigae33a/E_v3.3a/Modules/Modules/pointer.m new file mode 100644 index 0000000..ff30062 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/pointer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/powerpacker.m b/amigae33a/E_v3.3a/Modules/Modules/powerpacker.m new file mode 100644 index 0000000..11707c1 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/powerpacker.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/font.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/font.m new file mode 100644 index 0000000..5c34da7 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/font.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/icontrol.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/icontrol.m new file mode 100644 index 0000000..a3be153 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/icontrol.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/input.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/input.m new file mode 100644 index 0000000..1e8b2d3 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/input.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/locale.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/locale.m new file mode 100644 index 0000000..6b05461 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/locale.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/overscan.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/overscan.m new file mode 100644 index 0000000..b14edd3 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/overscan.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/palette.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/palette.m new file mode 100644 index 0000000..4f0d5d4 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/palette.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/pointer.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/pointer.m new file mode 100644 index 0000000..02dfda5 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/pointer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/prefhdr.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/prefhdr.m new file mode 100644 index 0000000..0fbf1e7 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/prefhdr.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/printergfx.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/printergfx.m new file mode 100644 index 0000000..9000fbe Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/printergfx.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/printerps.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/printerps.m new file mode 100644 index 0000000..1dc6ae4 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/printerps.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/printertxt.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/printertxt.m new file mode 100644 index 0000000..6eb4606 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/printertxt.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/screenmode.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/screenmode.m new file mode 100644 index 0000000..62bddd8 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/screenmode.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/serial.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/serial.m new file mode 100644 index 0000000..1bd773e Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/serial.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/sound.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/sound.m new file mode 100644 index 0000000..94a6876 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/sound.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/prefs/wbpattern.m b/amigae33a/E_v3.3a/Modules/Modules/prefs/wbpattern.m new file mode 100644 index 0000000..4e2712b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/prefs/wbpattern.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/ramdrive.m b/amigae33a/E_v3.3a/Modules/Modules/ramdrive.m new file mode 100644 index 0000000..d869239 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/ramdrive.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/realtime.m b/amigae33a/E_v3.3a/Modules/Modules/realtime.m new file mode 100644 index 0000000..94aef3c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/realtime.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/req.m b/amigae33a/E_v3.3a/Modules/Modules/req.m new file mode 100644 index 0000000..4198fda Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/req.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/reqtools.m b/amigae33a/E_v3.3a/Modules/Modules/reqtools.m new file mode 100644 index 0000000..ca994bd Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/reqtools.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/resources/battclock.m b/amigae33a/E_v3.3a/Modules/Modules/resources/battclock.m new file mode 100644 index 0000000..e08d4f7 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/resources/battclock.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/resources/battmem.m b/amigae33a/E_v3.3a/Modules/Modules/resources/battmem.m new file mode 100644 index 0000000..b634db9 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/resources/battmem.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/resources/battmembitsamiga.m b/amigae33a/E_v3.3a/Modules/Modules/resources/battmembitsamiga.m new file mode 100644 index 0000000..04d4b26 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/resources/battmembitsamiga.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/resources/battmembitsshared.m b/amigae33a/E_v3.3a/Modules/Modules/resources/battmembitsshared.m new file mode 100644 index 0000000..20a1bd0 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/resources/battmembitsshared.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/resources/card.m b/amigae33a/E_v3.3a/Modules/Modules/resources/card.m new file mode 100644 index 0000000..9ca40ca Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/resources/card.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/resources/cia.m b/amigae33a/E_v3.3a/Modules/Modules/resources/cia.m new file mode 100644 index 0000000..c2d72f8 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/resources/cia.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/resources/disk.m b/amigae33a/E_v3.3a/Modules/Modules/resources/disk.m new file mode 100644 index 0000000..b799c0c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/resources/disk.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/resources/filesysres.m b/amigae33a/E_v3.3a/Modules/Modules/resources/filesysres.m new file mode 100644 index 0000000..8edd2f9 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/resources/filesysres.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/resources/mathresource.m b/amigae33a/E_v3.3a/Modules/Modules/resources/mathresource.m new file mode 100644 index 0000000..7ca7cd2 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/resources/mathresource.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/resources/misc.m b/amigae33a/E_v3.3a/Modules/Modules/resources/misc.m new file mode 100644 index 0000000..a303a97 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/resources/misc.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/resources/potgo.m b/amigae33a/E_v3.3a/Modules/Modules/resources/potgo.m new file mode 100644 index 0000000..5cf4c6d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/resources/potgo.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/rexx/errors.m b/amigae33a/E_v3.3a/Modules/Modules/rexx/errors.m new file mode 100644 index 0000000..232d981 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/rexx/errors.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/rexx/rexxio.m b/amigae33a/E_v3.3a/Modules/Modules/rexx/rexxio.m new file mode 100644 index 0000000..ad9b74b Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/rexx/rexxio.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/rexx/rxslib.m b/amigae33a/E_v3.3a/Modules/Modules/rexx/rxslib.m new file mode 100644 index 0000000..ebe1944 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/rexx/rxslib.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/rexx/storage.m b/amigae33a/E_v3.3a/Modules/Modules/rexx/storage.m new file mode 100644 index 0000000..fbef790 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/rexx/storage.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/rexxsyslib.m b/amigae33a/E_v3.3a/Modules/Modules/rexxsyslib.m new file mode 100644 index 0000000..2cfe050 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/rexxsyslib.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/timer.m b/amigae33a/E_v3.3a/Modules/Modules/timer.m new file mode 100644 index 0000000..873c615 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/timer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/Boopsi.m b/amigae33a/E_v3.3a/Modules/Modules/tools/Boopsi.m new file mode 100644 index 0000000..0112c67 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/Boopsi.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI.m b/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI.m new file mode 100644 index 0000000..8a430af Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI_debug.m b/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI_debug.m new file mode 100644 index 0000000..efb98be Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI_debug.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI_lite.m b/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI_lite.m new file mode 100644 index 0000000..b7e28bb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI_lite.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI_notag.m b/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI_notag.m new file mode 100644 index 0000000..ee4efc4 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/EasyGUI_notag.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/Vector.m b/amigae33a/E_v3.3a/Modules/Modules/tools/Vector.m new file mode 100644 index 0000000..7600d03 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/Vector.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/arexx.m b/amigae33a/E_v3.3a/Modules/Modules/tools/arexx.m new file mode 100644 index 0000000..2a4ee93 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/arexx.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/async.m b/amigae33a/E_v3.3a/Modules/Modules/tools/async.m new file mode 100644 index 0000000..f2b59fb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/async.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/clonescreen.m b/amigae33a/E_v3.3a/Modules/Modules/tools/clonescreen.m new file mode 100644 index 0000000..36494cc Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/clonescreen.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/constructors.m b/amigae33a/E_v3.3a/Modules/Modules/tools/constructors.m new file mode 100644 index 0000000..c102194 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/constructors.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/cookrawkey.m b/amigae33a/E_v3.3a/Modules/Modules/tools/cookrawkey.m new file mode 100644 index 0000000..50416c1 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/cookrawkey.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/copylist.m b/amigae33a/E_v3.3a/Modules/Modules/tools/copylist.m new file mode 100644 index 0000000..ce6b9d9 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/copylist.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/ctype.m b/amigae33a/E_v3.3a/Modules/Modules/tools/ctype.m new file mode 100644 index 0000000..660b647 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/ctype.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/exceptions.m b/amigae33a/E_v3.3a/Modules/Modules/tools/exceptions.m new file mode 100644 index 0000000..dae2b0a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/exceptions.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/file.m b/amigae33a/E_v3.3a/Modules/Modules/tools/file.m new file mode 100644 index 0000000..e82b05a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/file.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/filledvdefs.m b/amigae33a/E_v3.3a/Modules/Modules/tools/filledvdefs.m new file mode 100644 index 0000000..e62f95c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/filledvdefs.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/filledvector.m b/amigae33a/E_v3.3a/Modules/Modules/tools/filledvector.m new file mode 100644 index 0000000..8f191ce Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/filledvector.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/ghost.m b/amigae33a/E_v3.3a/Modules/Modules/tools/ghost.m new file mode 100644 index 0000000..ed6fd78 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/ghost.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/ilbm.m b/amigae33a/E_v3.3a/Modules/Modules/tools/ilbm.m new file mode 100644 index 0000000..1bbfaeb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/ilbm.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/ilbmdefs.m b/amigae33a/E_v3.3a/Modules/Modules/tools/ilbmdefs.m new file mode 100644 index 0000000..57e12e4 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/ilbmdefs.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/inithook.m b/amigae33a/E_v3.3a/Modules/Modules/tools/inithook.m new file mode 100644 index 0000000..05361cb Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/inithook.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/installhook.m b/amigae33a/E_v3.3a/Modules/Modules/tools/installhook.m new file mode 100644 index 0000000..eb4df2a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/installhook.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/iterators.m b/amigae33a/E_v3.3a/Modules/Modules/tools/iterators.m new file mode 100644 index 0000000..cc366ce Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/iterators.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/lisp.m b/amigae33a/E_v3.3a/Modules/Modules/tools/lisp.m new file mode 100644 index 0000000..34486df Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/lisp.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/longreal.m b/amigae33a/E_v3.3a/Modules/Modules/tools/longreal.m new file mode 100644 index 0000000..24f2a82 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/longreal.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/longrealtiny.m b/amigae33a/E_v3.3a/Modules/Modules/tools/longrealtiny.m new file mode 100644 index 0000000..a05a249 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/longrealtiny.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/macros.m b/amigae33a/E_v3.3a/Modules/Modules/tools/macros.m new file mode 100644 index 0000000..df666f6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/macros.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/muicustomclass.m b/amigae33a/E_v3.3a/Modules/Modules/tools/muicustomclass.m new file mode 100644 index 0000000..d6f27f0 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/muicustomclass.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/pt.m b/amigae33a/E_v3.3a/Modules/Modules/tools/pt.m new file mode 100644 index 0000000..02e2a9a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/pt.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/scrbuffer.m b/amigae33a/E_v3.3a/Modules/Modules/tools/scrbuffer.m new file mode 100644 index 0000000..ed183bc Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/scrbuffer.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/simplelex.m b/amigae33a/E_v3.3a/Modules/Modules/tools/simplelex.m new file mode 100644 index 0000000..28cc337 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/simplelex.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/stack.m b/amigae33a/E_v3.3a/Modules/Modules/tools/stack.m new file mode 100644 index 0000000..52ec776 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/stack.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/textlen.m b/amigae33a/E_v3.3a/Modules/Modules/tools/textlen.m new file mode 100644 index 0000000..e4f872c Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/textlen.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/tools/trapguru.m b/amigae33a/E_v3.3a/Modules/Modules/tools/trapguru.m new file mode 100644 index 0000000..d096bad Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/tools/trapguru.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/translator.m b/amigae33a/E_v3.3a/Modules/Modules/translator.m new file mode 100644 index 0000000..447b91d Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/translator.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/triton.m b/amigae33a/E_v3.3a/Modules/Modules/triton.m new file mode 100644 index 0000000..873d556 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/triton.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/utility.m b/amigae33a/E_v3.3a/Modules/Modules/utility.m new file mode 100644 index 0000000..68cbb23 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/utility.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/utility/date.m b/amigae33a/E_v3.3a/Modules/Modules/utility/date.m new file mode 100644 index 0000000..44440bd Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/utility/date.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/utility/hooks.m b/amigae33a/E_v3.3a/Modules/Modules/utility/hooks.m new file mode 100644 index 0000000..b4af043 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/utility/hooks.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/utility/name.m b/amigae33a/E_v3.3a/Modules/Modules/utility/name.m new file mode 100644 index 0000000..7b3e690 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/utility/name.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/utility/pack.m b/amigae33a/E_v3.3a/Modules/Modules/utility/pack.m new file mode 100644 index 0000000..c3cb322 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/utility/pack.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/utility/tagitem.m b/amigae33a/E_v3.3a/Modules/Modules/utility/tagitem.m new file mode 100644 index 0000000..034557a Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/utility/tagitem.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/utility/utility.m b/amigae33a/E_v3.3a/Modules/Modules/utility/utility.m new file mode 100644 index 0000000..a938231 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/utility/utility.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/vector.m b/amigae33a/E_v3.3a/Modules/Modules/vector.m new file mode 100644 index 0000000..0547eee Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/vector.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/vmem.m b/amigae33a/E_v3.3a/Modules/Modules/vmem.m new file mode 100644 index 0000000..75227c5 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/vmem.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/wb.m b/amigae33a/E_v3.3a/Modules/Modules/wb.m new file mode 100644 index 0000000..f4ab1d6 Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/wb.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/wizard.m b/amigae33a/E_v3.3a/Modules/Modules/wizard.m new file mode 100644 index 0000000..f1855de Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/wizard.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/workbench/startup.m b/amigae33a/E_v3.3a/Modules/Modules/workbench/startup.m new file mode 100644 index 0000000..23a4c2f Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/workbench/startup.m differ diff --git a/amigae33a/E_v3.3a/Modules/Modules/workbench/workbench.m b/amigae33a/E_v3.3a/Modules/Modules/workbench/workbench.m new file mode 100644 index 0000000..2fb69db Binary files /dev/null and b/amigae33a/E_v3.3a/Modules/Modules/workbench/workbench.m differ diff --git a/amigae33a/E_v3.3a/Src.lha b/amigae33a/E_v3.3a/Src.lha deleted file mode 100644 index 6390389..0000000 Binary files a/amigae33a/E_v3.3a/Src.lha and /dev/null differ diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/BeBox_Example1.e b/amigae33a/E_v3.3a/Src/Src/Afc/BeBox_Example1.e new file mode 100644 index 0000000..c3dddb8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/BeBox_Example1.e @@ -0,0 +1,125 @@ +/* + + $VER: BeBox Example 1 - (C)Copyright Amiga Foundation Classes + + Written By: Fabio Rotondo + + This example just shows some features of the BeBox class. + + Please, note the "mydraw" function. + +*/ + +MODULE 'afc/explain_exception', 'afc/bebox', + 'intuition/intuition', 'intuition/screens' + +PROC main() HANDLE + DEF bb=NIL:PTR TO bebox + DEF scr=NIL:PTR TO screen + DEF win=NIL:PTR TO window + + NEW bb.bebox() -> Class initialization + + + + IF (scr:=LockPubScreen('Workbench'))=NIL THEN Raise("scr") + + IF (win:=OpenWindowTagList(NIL, + [WA_LEFT, 0, + WA_TOP, 0, + WA_WIDTH, scr.width, + WA_HEIGHT, scr.height, + WA_FLAGS, WFLG_BORDERLESS OR WFLG_BACKDROP OR WFLG_NOCAREREFRESH, +-> WA_CUSTOMSCREEN, scr, + 0,0]))=NIL THEN Raise("win") + + + bb.setattrs([BB_POSX, 10, + BB_POSY, 10, + BB_WIDTH, 100, + BB_HEIGHT, 100, + BB_RPORT, scr.rastport, + BB_MAXX, scr.width-1, + BB_MAXY, scr.height-1, + BB_USEREL, TRUE, + BB_DRAW, {mydraw}, + 0,0]) + + + + + bb.draw() -> The first draw on the window. + + LOOP + + REPEAT + Delay(3) + IF Mouse()=2 THEN Raise("HALT") + UNTIL (Mouse()=1 AND bb.check(MouseX(win), MouseY(win))) + + WHILE (Mouse()=1) + bb.setattrs([BB_POSX, MouseX(win), BB_POSY, MouseY(win), 0,0]) + bb.draw() + ENDWHILE + + ENDLOOP + + bb.draw(FALSE) + +/* + bb.setattrs([BB_MAXX, 100, + BB_MAXY, 100, + BB_WIDTH, 80, + BB_HEIGHT, 10, + BB_POSX, 50, + BB_POSY, 0, + NIL, NIL]) +*/ + +EXCEPT DO + END bb + + IF win THEN CloseWindow(win) + IF scr THEN UnlockPubScreen (NIL, scr) + + IF exception<>"HALT" THEN explain_exception() +ENDPROC + +PROC mydraw(data:PTR TO bebox_data, mode) + SetDrMd(data.rp, 2) + + IF mode THEN IF (data.oldx=data.x) AND (data.oldy = data.y) THEN RETURN + + IF data.oldx<>-1 + Move(data.rp, data.oldx, data.oldy) + SetAPen(data.rp, data.oldcol) + + Draw(data.rp, data.oldx + data.oldw, data.oldy) + Draw(data.rp, data.oldx + data.oldw, data.oldy + data.oldh) + Draw(data.rp, data.oldx, data.oldy + data.oldh) + Draw(data.rp, data.oldx, data.oldy) + + Draw(data.rp, data.oldx + data.oldw, data.oldy + data.oldh) + Move(data.rp, data.oldx + data.oldw, data.oldy) + Draw(data.rp, data.oldx, data.oldy + data.oldh) + data.oldx:=-1 + ENDIF + + IF mode + Move(data.rp, data.x, data.y) + SetAPen(data.rp, data.col) + Draw(data.rp, data.x + data.w, data.y) + Draw(data.rp, data.x + data.w, data.y + data.h) + Draw(data.rp, data.x, data.y + data.h) + Draw(data.rp, data.x, data.y) + + Draw(data.rp, data.x + data.w, data.y + data.h) + Move(data.rp, data.x + data.w, data.y) + Draw(data.rp, data.x, data.y + data.h) + + ENDIF + + SetDrMd(data.rp, 0) + +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Change_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/Change_Example.e new file mode 100644 index 0000000..8c60eb4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Change_Example.e @@ -0,0 +1,56 @@ +/* +** StringNode Example-5 +** +** add(), search(), clear() AND change() methods. +** +** (C)Copyright 1996/97 Amiga Foundation Classes +** +** See: http://www.intercom.it/~fsoft/afc.html +** +** FOR more info about AFC AND more modules +*/ + +MODULE 'afc/StringNode', -> Our MAGIC MODULE + 'afc/explain_exception' + +PROC main() HANDLE + DEF n:PTR TO stringnode -> This is our OBJECT instance + + NEW n.stringnode() -> OBJECT initialization + + n.add('Zorro') -> Here we add some items... + n.add('Batman') + n.add('Superman') + n.add('Gold Drake') + n.add('Mandrake') + n.add('MOMMY') + + shwall(n) -> Here we see them + + n.search('momm') -> The search is CASE insensitive AND match the first one ;) + WriteF('Current:\s\n', n.obj()) -> Here we are! + + n.change('My Mommy') -> Wow! Now MOMMY is My Mommy!!! + shwall(n) + + n.clear() -> Empty StringNode! + shwall(n) + +EXCEPT DO + explain_exception() + END n -> Remember ALWAYS TO end an OBJECT + CleanUp(0) +ENDPROC + +PROC shwall(n:PTR TO stringnode) + WriteF('------- \d ----------\n', n.numitems()) + + IF n.first() -> Here we go TO the first node item + REPEAT + WriteF('Node:\s\n', n.obj()) -> Node STRING... + UNTIL n.succ() = FALSE -> LOOP UNTIL the end + ELSE + WriteF('No Nodes in LIST...\n') + ENDIF +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Displayer_Example1.e b/amigae33a/E_v3.3a/Src/Src/Afc/Displayer_Example1.e new file mode 100644 index 0000000..505f6c8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Displayer_Example1.e @@ -0,0 +1,69 @@ +/* + + $VER: Displayer Example 1 - (C)Amiga Foundation Classes + + Written By: Andrea Galimberti + + This code is Public Domain + +*/ + + +MODULE 'AFC/displayer','afc/explain_exception', + 'graphics/modeid' + + +PROC main() HANDLE + DEF myview=NIL:PTR TO displayer + DEF vp1, vp2 + DEF rp1=NIL, rp2=NIL + + NEW myview.displayer() -> create the OBJECT + + myview.add([VPORT_TOP,0, -> add viewports + VPORT_LEFT,0, + VPORT_WIDTH,640, + VPORT_HEIGHT,128, + VPORT_DEPTH,3, + VPORT_MODE,HIRES_KEY, + NIL]) + + myview.add([VPORT_TOP,140, + VPORT_LEFT,0, + VPORT_WIDTH,320, + VPORT_HEIGHT,100, + VPORT_DEPTH,3, + VPORT_MODE,LORES_KEY, + NIL]) + + myview.setup(DEFAULT_MONITOR_ID) -> build system structures + + myview.show() -> show NEW view (automatically stores the old view) + + rp1:=myview.rastport(0) -> get PTR TO rastport AND viewport system + rp2:=myview.rastport(1) -> structures OF the two viewports. + vp1:=myview.viewport(0) -> Indices refer TO the order in which the two + vp2:=myview.viewport(1) -> viewports have been added. + + SetRast(rp1,3) + SetRast(rp2,4) + + SetRGB4(vp1,2,15,15,15) + SetAPen(rp1,2) + Move(rp1,10,10) + Text(rp1,'First (Hires) ViewPort',22) + SetRGB4(vp2,2,0,0,15) + SetAPen(rp2,2) + Move(rp2,10,10) + Text(rp2,'Second (Lowres) ViewPort',24) + + REPEAT + Delay(5) + UNTIL Mouse() + myview.showOldView() -> restore old view + +EXCEPT DO + END myview + explain_exception() +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Displayer_Example2.e b/amigae33a/E_v3.3a/Src/Src/Afc/Displayer_Example2.e new file mode 100644 index 0000000..01b227c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Displayer_Example2.e @@ -0,0 +1,147 @@ + +/* + $VER: Displayer_Example 2 - (C)Copyright Amiga Foundation Classes + + Written By: Andrea Galimberti + + This IS a complete example that exploits the following modules belonging + TO the Amiga Foundation Classes: Displayer, Mousepointer (AND so Hardsprite). + + See how the mouse pointer automatically rescales its movements TO fit + the changing resolution; the pointer sprite IS bounded TO the + dimensions OF the viewports it moves into. + + You can scroll the topmost bitmap because it's bigger than the viewport + it's displayed in. +*/ + +MODULE 'graphics/modeid', + 'intuition/intuition', + 'AFC/displayer', + 'AFC/mousepointer', + 'AFC/explain_exception' + + +PROC main() HANDLE + DEF myview=NIL:PTR TO displayer + DEF vp1=NIL, vp2=NIL + DEF rp1=NIL, rp2=NIL + DEF win=NIL:PTR TO window, poi:PTR TO INT + DEF topo:PTR TO mousepointer, vp + DEF rx=0 + + NEW topo.mousepointer(2) + + topo.image(11,[$0080,$0080, + $0080,$0080, + $0080,$0080, + $0080,$0080, + $0080,$0080, + $1F7C,$1F7C, + $0080,$0080, + $0080,$0080, + $0080,$0080, + $0080,$0080, + $0080,$0080]:INT) + + topo.hotspot(18,6) -> the mouse starts from the topmost viewport, so + -> its hotspot it's SET in high resolution: the + -> auto() method OF mousepointer rescales it TO adapt TO + -> the changing resolution. + + NEW myview.displayer() + + myview.add([VPORT_TOP,0, + VPORT_LEFT,0, + VPORT_WIDTH,640, + VPORT_HEIGHT,100, + VPORT_DEPTH,3, + VPORT_MODE,HIRES_KEY, + VPORT_BMWIDTH,800, -> bitmap IS wider than viewport + VPORT_SPRITES,TRUE, + NIL]) + + myview.add([VPORT_TOP,110, + VPORT_LEFT,0, + VPORT_WIDTH,320, + VPORT_HEIGHT,50, + VPORT_DEPTH,3, + VPORT_MODE,LORES_KEY, + VPORT_SPRITES,TRUE, + NIL]) + + myview.add([VPORT_TOP,170, + VPORT_LEFT,0, + VPORT_WIDTH,640, + VPORT_HEIGHT,80, + VPORT_DEPTH,3, + VPORT_MODE,HIRES_KEY, + VPORT_SPRITES,TRUE, + NIL]) + + myview.setup(DEFAULT_MONITOR_ID) -> choose your monitor database + +-> this window IS opened only TO clear the standard mouse sprite + win:=OpenWindowTagList(NIL,[WA_LEFT,0, + WA_TOP,0, + WA_WIDTH,320, + WA_HEIGHT,128, + WA_TITLE,'Wow', + WA_FLAGS,WFLG_DRAGBAR OR WFLG_CLOSEGADGET OR WFLG_ACTIVATE OR WFLG_SIMPLE_REFRESH, + WA_IDCMP,IDCMP_CLOSEWINDOW OR IDCMP_ACTIVEWINDOW, + NIL,NIL]) + IF win=NIL THEN Raise("win") + poi:=[0,0]:INT + SetPointer(win,poi,1,1,0,0) + +-> here begins the show + Forbid() -> forbid task switching + myview.show() + + rp1:=myview.rastport(0) + rp2:=myview.rastport(1) + vp1:=myview.viewport(0) + vp2:=myview.viewport(1) + + SetRast(rp1,3) + SetRast(rp2,4) + SetRast(myview.rastport(2),2) + + SetRGB4(vp1,2,15,15,15) + SetAPen(rp1,2) + Move(rp1,10,10) + Text(rp1,'First (Hires) ViewPort',22) + SetRGB4(vp2,2,0,0,15) + SetAPen(rp2,2) + Move(rp2,10,10) + Text(rp2,'Second (Lowres) ViewPort',24) + + vp:=vp1 + topo.changeImage(vp1) -> install NEW image + topo.move(vp1,100,50) -> start from topmost viewport + REPEAT + topo.auto(myview) -> auto move + IF topo.vp()=0 -> IF topmost viewport + IF topo.x()>=640 -> IF mouse hits the boundaries THEN scroll + rx:=rx+1 + IF rx>80 THEN rx:=80 + myview.scroll(0,rx,0) + ENDIF + IF topo.x()<=0 + rx:=rx-1 + IF rx<0 THEN rx:=0 + myview.scroll(0,rx,0) + ENDIF + ENDIF + UNTIL Mouse() + + Permit() -> permit task switching + myview.showOldView() -> restore old view + +EXCEPT DO + END topo + END myview + IF win THEN CloseWindow(win) + explain_exception() +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/AFC.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/AFC.guide new file mode 100644 index 0000000..9a58568 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/AFC.guide @@ -0,0 +1,381 @@ +@database AFC_WhitePaper + +@$VER: Amiga Foundation Classes White Paper V1.50 + +@node main "Amiga Foundation Classes" + +Amiga Foundation Classes + +A FreeWare and Public Domain library of Object Classes devoted to the +software development on the Amiga and on future Amiga compatible machines. + +! Note: new / modified lines are signed with a "!" as the first char of the +! line. + + +1. Index + + 2.0 - Introduction + @{" 2.1 - What are the Amiga Foundation Classes " LINK "Intro_1"} + @{" 2.2 - What are the Amiga Foundation Classes for " LINK "Intro_2"} +! @{" 2.3 - Who will use the Amiga Foundation Classes " LINK "Intro_3"} + @{" 2.4 - Future of the Amiga Foundation Classes " LINK "Intro_4"} + @{" 2.5 - Interfacing with new Amiga OS Compatibles " LINK "Intro_5"} + + 3.0 - Implementation + @{" 3.1 - How to write a Class for the Amiga Foundation Classes " LINK "Impl_1"} +! @{" 3.1.1 - Class name " LINK "Impl_1_1"} +! @{" 3.1.2 - Methods' names " LINK "Impl_1_2"} +! @{" 3.1.3 - Object Inheritance " LINK "Impl_1_3"} +! @{" 3.1.4 - Object Initialization and Object Destruction " LINK "Impl_1_4"} + @{" 3.1.5 - Libraries and lowest OS version " LINK "Impl_1_5"} + @{" 3.1.6 - Tags " LINK "Impl_1_6"} + + @{" 3.2 - Definition of error codes " LINK "Impl_2"} + @{" 3.2.1 - When to report an error code " LINK "Impl_2_1"} +! @{" 3.2.2 - How to report an error code " LINK "Impl_2_2"} + @{" 3.2.3 - Classification of error codes " LINK "Impl_2_3"} + + 4.0 - Porting of Classes + @{" 4.1 - Porting features " LINK "Port_1"} + @{" 4.2 - Porting limits " LINK "Port_2"} + + 5.0 - Distribution + @{" 5.1 - Compiled Classes " LINK "Distr_1"} + @{" 5.2 - Classes' source code " LINK "Distr_2"} +! @{" 5.3 - Availability " LINK "Distr_3"} +! @{" 5.4 - Info and WEB sites " LINK "Distr_4"} + +@endnode + +@node "Intro_1" "What are the Amiga Foundation Classes" +2.1 - What are the Amiga Foundation Classes + +"Amiga Foundation Classes" (AFC from now on) is the name of a library of +Object Classes designed to manage the several features of Amiga. Each +Class will constitute an interface between the programmer and a particular +aspect of the Amiga Operating System, trying to make the design and the +coding of a program for the Amiga OS computers easier. The AFC have been +also designed to assure a quicker porting of the Amiga programs on the +future Amiga-Compatible Operating Systems. See @{" section 2.4 " LINK "Intro_4"} for more info. +@endnode + +@node "Intro_2" "What are the Amiga Foundation Classes for" +2.2 - What are the Amiga Foundation Classes for + +We have designed the AFC for different reasons: first of all the necessity +of fully exploiting the object oriented programming (OOP), that allows to +"recycle" code using it in other Classes or in other programs. The +recompilation of the AFC on future computers with an Amiga-Compatible OS +will allow a quicker porting of software products. See @{" section 2.4 " LINK "Intro_4"} for more +info. +@endnode + +@node "Intro_3" "Who will use the Amiga Foundation Classes" +2.3 - Who will use the Amiga Foundation Classes + +The AFC will be available to all programmers using a language supporting +the OOP. The AFC can be used freely in FreeWare, ShareWare, PD or +Commercial programs without paying any royalty. + +! If you use the AFC, please, quote somewhere in the "About..." requester +! and also in the documentation that your program uses the Amiga Foundation +! Classes and provide also the official URL: +! +! http://www.intercom.it/~fsoft/afc.html +! +! Note that you are just _invited_ to do so, no obbligation is given in +! any way. + +@endnode + +@node "Intro_4" "Future of the Amiga Foundation Classes" +2.4 - Future of the Amiga Foundation Classes + +The AFC have been designed to warrant a reliable base of Objects to be used +in the future Amiga-Compatible machines: by recompiling the AFC source +code will be possible to obtain an excellent library of Classes with which +one can easily build applications for the new computers. The advantage of +using Classes of objects over the Operating System calls is due to the fact +that such Classes work as an "interface" between the OS and the programmer: +people that programmed on the Amiga using the AFC will bring their code on +the new machines by simply recompiling the sources and using the AFC +version implemented on the new computer on which they are working. Thank +to the AFC, programmers will save a lot of time (otherwise spent in +learning the new OS) and will keep on using the same Classes with the same +sintax and the same behaviour. This implies, at least in our intentions, +that the software will be developed better and in a shorter time. The risk +that every new Operating System has to face, when it first comes to life, +is the lack of professional software. Thank to the AFC it will be possible +to provide in brief time professional products for these new OS. +@endnode + +@node "Intro_5" "Interfacing with new Amiga OS Compatibles" +2.5 - Interfacing with new Amiga OS Compatibles + +It's our intention to freely supply developers of Amiga-Compatible OS with +the source code of the AFC, be they Phase5, VisCorp, Be Inc., AROS, p-OS, +PIOS, etc. Indeed, we are persuaded that the future of a new machine, +possibly not depending on Microsoft, is to be found in the possibility of +having in a short time software products of a professional quality. Thus +the AFC sources will be provided to every OS developer that will ask for +them. Then the particular implementation will be examined by the +supervisors of AFC that will give their approval and allow the +distribution. See section 5.0 for more infos. +@endnode + +@node "Impl_1" "How to write a Class for the Amiga Foundation Classes" +3.1 - How to write a Class for the Amiga Foundation Classes + + @{" Class Name " LINK "Impl_1_1"} + @{" Methods' Names " LINK "Impl_1_2"} + @{" Object Inheritance " LINK "Impl_1_3"} + @{" Object Initialization and Destruction " LINK "Impl_1_4"} + @{" Libraries And lowest OS Versions " LINK "Impl_1_5"} + @{" Tags " LINK "Impl_1_6"} +@endnode + +@node "Impl_1_1" "Class name" +3.1.1 - Class name + + - The Class must have a unique and understandable name. + - The class name must be lowercase. + - The class name must be in English. + - The class name must NOT be the name of an Amiga system structure. + +! Please, note that the "_obj" naming convention has been discarted. +! Use just unique names that don't collide against Amiga system structures +! names + + + - If in doubt, you can always add to the name of the class the suffix + "_obj". +@endnode + +@node "Impl_1_2" "Methods' names" +3.1.2 - Methods' names + + - The name of a method must be as shortest and clear as possible. E.g., + in a class designed to manage a list of nodes the method that adds a + node must NOT be called "addnode", but simply "add". +! - The name of a method must start in lowercase. + +! From V1.50 of AFC white paper, you can create names with UPPERCASE chars +! to easy method naming: +! +! ie. "addviewtocopperlist" now can become: +! "addViewToCopperList" or similar. +! +! please, note that the first chars *MUST* be lowercase anyway. +! +! This way of naming is more close to Sun's Java language, another +! place where we are planning to port AFC to. + + + - The name of a method must be in English. +@endnode + +@node "Impl_1_3" "Object Inheritance" +3.1.3 - Object Inheritance + +The Object Inheritance tipical of the OOP must be used as little as you +can. This because the Object Inheritance is implemented differently in the +various languages. The AFC sources must be understandable to allow for an +easier porting and readability. Thus it is FORBIDDEN the use of particular +syntax rules characteristic of a particular language. E.g., are not +allowed structures of the "friend" type or the Multiple Inheritance of the +C++ language. + +! It's advisable to substitute the Object Inheritance with the creation of a +! copy of the Class to be "reused" in the new Class. E.g., if you have to +! inherit the Class "bitmapper" in the Class "picture" (notice the name +! lowercase and in English) it's advisable to copy the "bitmapper" Class in +! the "picture" Class. +@endnode + +@node "Impl_1_4" "Object Initialization and Object Destruction" +3.1.4 - Object Initialization and Object Destruction + +The initialization and destruction of a Class must be always performed by +means of two particular Methods: the Initialization method and the +Destruction one. + +The Initialization method must have the same name as the Class. E.g., the +Initialization method of the "picture" Class must be called "picture()" +(with parameters between the brackets, if needed). + +The Destruction method of a class must be named "end()" and must NOT +require any parameter. + +! In the C++ version of AFC classes the destruction method can also +! be called with the standard C++ notation of the "~" char. +! So the Destruction method of the "picture" class in the example +! could also be: ~picture() with NO parameters, anyway. + +These two methods must be called EXPLICITLY by the program that exploits +the Class: you must not rely only on the Initialization and Destruction +routines contained in the language you use. + +! If a Class uses another one, then it has to call in its own Initialization +! method the Initialization method of the other Class. E.g., the "picture" +! Class that contains the "bitmapper" Class has to call, within the +! "picture()" method, the "bitmapper" method associated with the +! "bitmapper" Class. +@endnode + +@node "Impl_1_5" "Libraries and lowest OS version" +3.1.5 - Libraries and lowest OS version + +Classes have to rely almost exclusively on the standard AmigaOS libraries. + +E.g., a "picture" Class that uses the "iff.library" won't be included in +AFC because you can load an image also using the "iffparse.library" and +then write the ByteRun-decoding routine. + +Besides, the use of third party libraries damages the AFC, because these +libraries might not be implemented on new Operating Systems. + +The lowest OS version supported by AFC is 2.04. We can also take into +account the compatibility with OS1.3, but it's not a fundamental feature. + +If a Class requires a newer OS version to work correctly, then this must be +documented. +@endnode + +@node "Impl_1_6" "Tags" +3.1.6 - Tags + +When possible the behaviour of the Class must be changed using tags, a +characteristic of the AmigaOS. The standard methods involving tags must be +called: + + - "setattrs(tags)" to set the tags. + - "getattr(tag)" to get a single return value (with the corresponding + tag as parameter). + - "getattrs(tags)" if you want to receive different values with the same + call. +@endnode + +@node "Impl_2" "Definition of error codes" +3.2 - Definition of error codes + + @{" When to report an error code " LINK "Impl_2_1"} + @{" How to report an error code " LINK "Impl_2_2"} + @{" Classification of error codes " LINK "impl_2_3"} +@endnode + +@node "Impl_2_1" "When to report an error code" +3.2.1 - When to report an error code + +The AFC must promptly react at all possible errors: they must be "idiot +proof". If the user makes a mistake in calling a method, or he calls it +before having initialized the Class, and so on, the Class must be able to +trap and report the error (possibly trying to continue). Thus it's +important to classify and report to the user the largest number of errors, +trying to be understandable (when possible) to make the debug session +easier. +@endnode + +@node "Impl_2_2" "How to report an error code" +3.2.2 - How to report an error code + +! To report an error it's preferable to use the (software) "Exceptions", when +! they are supported by the language; if they are not supported it's +! the called methdo can return the value of the exception as the return code. +! Anyway, it is _your_ task to provide a simple and good way to let the user +! handle exceptions and errors. + +@endnode + +@node "Impl_2_3" "Classification of error codes" +3.2.3 - Classification of error codes + +The error code of a Class is contained in a 32Bit variable (long). The +High word (2 bytes) contains the "identification number" of the Class: +this identification number is unique and it's assigned by AFC to the Class +when it is first created. This value must be stored in the source code of +the Class in a constant named as the Class itself (written UPPERCASE) with +the "_BASE" suffix. E.g., the picture Class has the identification value +named "PICTURE_BASE". The Low word (2 bytes) contains the error code: in +each Class it starts from $0000 and goes up to $FFFF (supposing that a +Class can return 65535 different error messages!). The $0000 error it's +always "No Memory". The table that associates to every error code its +description must be included in the documentation. +@endnode + +@node "Port_1" "Porting features" +4.1 - Porting features + +The AFC can (and must) be ported on the largest number of languages as +possible. The porting must take into account all the characteristics +listed in sections 2 and 3. It's forbidden to modify a Class during the +porting, but the Class has to be "adapted" if some operations are not +translatable into the language used (e.g., returning multiple values with a +single method call). +@endnode + +@node "Port_2" "Porting limits" +4.2 - Porting limits + +A Class ported by a programmer CANNOT be distributed before approval by the +AFC supervisors. This to assure the correct working of the Class after the +porting. We of AFC won't exclude any language, but the programmers that +won't accept these conditions won't receive any other Class to convert and +their Classes will be marked on the AFC WEB pages as "Not Supported". +@endnode + +@node "Distr_1" "Compiled Classes" +5.1 - Compiled Classes + +The compiled classes (e.g., the ".obj" files of C++ or the ".m" files of +AmigaE) may be freely distributed and have to be inserted in a directory +called "AFC" (obviously). + +In the ".lha" archive must be present, together with the compiled code, the +documentation in AmigaGuide format and some example sources. +@endnode + +@node "Distr_2" "Classes' source code" +5.2 - Classes' source code + +The source of the Classes is NOT public domain an so it's NOT distributed +along with the compiled code. Nevertheless, it will be always available to +programmers that ask us to do the porting of a particular Class. The +supervisors of AFC will always have all the sources and are free to decide +whether to give the source of the required Class to a particular programmer +or not. +@endnode + +@node "Distr_3" "Availability" +5.3 - Availability + +The compiled versions of AFC can be found at these sites: + + FTP: + ftp.intercom.it/pub/afc - Official site of Amiga Foundation Classes + +! HTTP: +! www.intercom.it/~fsoft/afc.html - Official WEB site of AFC + + +! The E version of the AFC classes will be also shipped with the language itself. +! But some of them will result to be unuseful without the registered version of +! the compiler. :-) + +@endnode + +@node "Distr_4" "Info and WEB sites" +5.4 - Info and WEB sites + +If you want more infos (or upgrades) you can connect to: + + http://www.intercom.it/~fsoft/afc.html + + the official page of AFC. + +Or you can subscribe to the mailing list by sending a message to: + + afc-list@intercom.it + +with (in the SUBJECT): subscribe +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Bitmapper.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Bitmapper.guide new file mode 100644 index 0000000..34e9d20 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Bitmapper.guide @@ -0,0 +1,393 @@ +@database Bitmapper.guide + +@$VER: BitMapper V2.60 - By Fabio Rotondo (C)Amiga Foundation Classes + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node Main "Amiga Foundation Classes: bitmapper" + + + + ** BitMapper - Original By Fabio Rotondo ** + + * Part of the Amiga Foundation Classes * + + @{" Introduction " link "BitMapper_introduction"} @{" Author's Info " link "author"} @{" Amiga Foundation Classes " LINK "AFC.Guide/main"} + + Requires: + + Class Base: $00040000 + + NEW COMMANDS BRIEF DESCRIPTION + ------------------------------------------------------------------------- + @{" bitmapper() " link "BitMapper_bitmapper"} Initailizes the class. + @{" allocbitmap(w,h,d, lay=F, rp=F) " link "BitMapper_allocbitmap"} Creates a bitmap. + @{" assign(bmp,w=-1,h=-1,lay=F,r=F) " link "BitMapper_assign"} Copies a bitmap. + @{" bitmap() " link "BitMapper_bitmap"} Returns a pointer to bitmap. + @{" clear() " link "BitMapper_clear"} Free all bitmap's resources. + @{" clearrastport() " link "BitMapper_clearrastport"} Frees bitmap's rastport. + @{" clearlayers() " link "BitMapper_clearlayers"} Frees bitmap's layers. + @{" cludge(mem) " link "BitMapper_cludge"} Converts a memory area into a bitmap. + @{" createlayers(w=-1, h=-1) " link "BitMapper_createlayers"} Creates bitmap layers. + @{" createrastport() " link "BitMapper_createrastport"} Creates bitmap rastport. + @{" depth() " link "BitMapper_width"} Returns bitmap's depth. + @{" dump(fname) " link "BitMapper_dump"} Dumps a bitmap into a file. + @{" freebitmap() " link "BitMapper_freebitmap"} Free the bitmap. + @{" height() " link "BitMapper_width"} Returns bitmap's height. + @{" image() " link "BitMapper_image"} Returns the Image structure of the bitmap. + @{" loadraw() " link "BitMapper_loadraw"} Loads up a raw data bitmap. + @{" rastport() " link "BitMapper_rastport"} Scans a Directory. + @{" version() " link "BitMapper_version"} Returns bitmapper version. + @{" width() " link "BitMapper_width"} Returns bitmap's width. + + @{" Error Table " LINK bitmapper_ErrorTable} +@endnode + +@node "BitMapper_Introduction" "Introduction" + + BitMapper is an E object I have created to easyly manage bitmaps. + + Main features are: + + * Different OS2.0 and OS3.0 allocbitmap() method. + + * Methods to handle bitmap's rastport and layers. + +@endnode + +@node "author" "Author's Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) + +@endnode + +@node bitmapper_ErrorTable "BitMapper / Error Table " + +VALUE | DESCRIPTION +----------------+---------------------------------- +$0000 | No Memory. +$0001 | Could not open layer library +$0002 | Could not create the layer +$0003 | Could not create behind layer +$0004 | File not found +$0005 | Could not create file +@endnode + +@node "BitMapper_bitmapper" "Amiga Foundation Classes: bitmapper/bitmapper()" + NAME: bitmapper() + + DESCRIPTION: Use this method to initailize the object. + + INPUT: NONE. + + RESULTS: NONE. + + SEE ALSO: +@endnode + +@node "BitMapper_clear" "Amiga Foundation Classes: bitmapper/clear()" + NAME: clear() + + DESCRIPTION: This method frees all memory allocated by the class. + + INPUT: NONE. + + RESULTS: NONE. + + RAISE: + + SEE ALSO: @{" allocbitmap() " LINK bitmapper_alloc} + @{" freebitmap() " LINK bitmapper_freebitmap} +@endnode + +@node "BitMapper_allocbitmap" "Amiga Foundation Classes: bitmapper/allocbitmap()" + NAME: allocbitmap(width, height, depth, layers=FALSE, rastport=FALSE) + + DESCRIPTION: This method allocates a bitmap and a rastport for it. + It also frees all datas previously allocated on the same + object. + + INPUT: width - Bitmap width (in pixels) + height - Bitmap height (in pixels) + depth - Bitmap depth (1...8) + layers - (Optional) if TRUE, a layer structure + will be created. Default is FALSE. + rastport - (Optional) if TRUE, a rastport will be + created. Default is FALSE. + + RESULTS: + + SEE ALSO: @{" freebitmap() " LINK bitmapper_freebitmap} + @{" createlayers() " LINK bitmapper_createlayers} + @{" createrastport() " LINK bitmapper_createrastport} +@endnode + +@node "BitMapper_createlayers" "Amiga Foundation Classes: bitmapper/createlayers()" + NAME: createlayers(w=-1, h=-1) + + DESCRIPTION: This method creates a layers structure for the bitmap. + + INPUT: w, h - (Optional) Layer's width and height. If these + params are omitted, layers' size will be the same + of the bitmap. + + RESULTS: TRUE - creation successfull. + FALSE - creation failed. (Maybe no bitmap allocated) + + SEE ALSO: @{" clearlayers() " LINK bitmapper_clearlayers} + @{" createrastport() " LINK bitmapper_createrastport} +@endnode + +@node "BitMapper_createrastport" "Amiga Foundation Classes: bitmapper/createrastport()" + NAME: createrastport() + + DESCRIPTION: This method creates a rastport for the bitmap present in the + class. + + INPUT: NONE + + RESULTS: TRUE - creation successfull. + FALSE - creation failed. (Maybe no bitmap allocated) + + SEE ALSO: @{" clearrastport() " LINK bitmapper_clearrastport} + @{" createlayers() " LINK bitmapper_createlayers} +@endnode + +@node "BitMapper_clearrastport" "Amiga Foundation Classes: bitmapper/clearrastport()" + NAME: clearrastport() + + DESCRIPTION: This method will free bitmap's rastport. + + INPUT: NONE. + + RESULTS: rastport is freed from the memory. + + SEE ALSO: @{" createrastport() " LINK bitmapper_createrastport} + +@endnode + +@node "BitMapper_clearlayers" "Amiga Foundation Classes: bitmapper/clearlayers()" + NAME: clearlayers() + + DESCRIPTION: This method frees bitmap's layers. + + INPUT: NONE. + + RESULTS: Layer's memory is freed. + + NOTE: By freeing the layers you'll free also the rastport!!! + + SEE ALSO: @{" createlayers() " LINK bitmapper_createlayers} + @{" createrastport() " LINK bitmapper_createrastport} +@endnode + +@node "BitMapper_freebitmap" "Amiga Foundation Classes: bitmapper/freebitmap" + NAME: freebitmap() + + DESCRIPTION: This method frees the bitmap and, eventually, also + the rastport and layers. + + INPUT: NONE. + + RESULTS: NONE. + + SEE ALSO: @{" allocbitmap() " LINK bitmapper_alloc} + @{" freelayers() " LINK bitmapper_freelayers} + @{" freerastport() " LINK bitmapper_freerastport} +@endnode + +@node "BitMapper_assign" "Amiga Foundation Classes: bitmapper/assign" + NAME: assign(bitmap:PTR TO bitmap, w=-1, h=-1, layers=FALSE, rport=FALSE) + + DESCRIPTION: Use this method to "change" on the fly the bitmap + with a new one. Note that all datas of the previous + bitmap will be lost. + + INPUT: bitmap - (PTR TO bitmap) a new bitmap to handle. + w,h - (Optional) Bitmap's width and height + to copy. You can set width and height to + a different (usally minor) size of the original + bitmap, to copy just a part of it. + + layers - (Optional) if TRUE a layer structure will be + created. + + rastport - (Optional) if TRUE a rastport structure will be + created. + + RESULTS: NONE. + + NOTES: this method calls @{" allocbitmap() " LINK bitmapper_allocbitmap}. + + this method may use the blitter. + + SEE ALSO: @{" allocbitmap() " LINK bitmapper_allocbitmap}. +@endnode + +@node "BitMapper_rastport" "Amiga Foundation Classes: bitmapper/rastport" + NAME: rastport() + + DESCRIPTION: This method returns the 8Bit bitmap's rastport. + + INPUT: NONE. + + RESULTS: a ptr to a rastport. It may be NIL. + + SEE ALSO: @{" createrastport() " LINK bitmapper_createrastport} + @{" allocbitmap() " LINK bitmapper_alloc} + + +@endnode + +@node "BitMapper_bitmap" "Amiga Foundation Classes: bitmapper/bitmap()" + NAME: bitmap() + + DESCRIPTION: This method returns a PTR TO bitmap + + INPUT: NONE. + + RESULTS: a PTR TO bitmap. It may be NIL. + + SEE ALSO: @{" allocbitmap() " LINK bitmapper_allocbitmap} +@endnode + +@node "BitMapper_version" "Amiga Foundation Classes: bitmapper/version()" + NAME: version() + + DESCRIPTION: This method returns class version and revision. + + INPUT: NONE. + + RESULTS: This method returns TWO values, Version and Revision. + + SEE ALSO: +@endnode + +@node "BitMapper_cludge" "Amiga Foundation Classes: bitmapper/cludge()" + NAME: cludge(mem:PTR TO LONG) + + DESCRIPTION: This method converts a memory area into a bitmap + + INPUT: mem - Memory address. + + RESULTS: This method returns THREE values: width, height and depth + of the cludged bitmap. + + NOTE: The bitmap MUST be created using @{" dump() " LINK bitmapper_dump} method! + + SEE ALSO: @{" dump() " LINK "BitMapper_dump"} + @{" loadraw() " LINK "BitMapper_loadraw"} +@endnode + +@node "BitMapper_loadraw" "Amiga Foundation Classes: bitmapper/loadraw()" + NAME: loadraw(fname:PTR TO CHAR) + + DESCRIPTION: This method loads up a file containing a previously dump()ed + bitmap. + + INPUT: fname - File name to load. + + RESULTS: This method returns THREE values: width, height and depth + of the loaded raw data. + + NOTE: The bitmap MUST be created using @{" dump() " LINK bitmapper_dump} method! + + SEE ALSO: @{" dump() " LINK "BitMapper_dump"} + @{" cludge() " LINK "BitMapper_cludge"} +@endnode + +@node "BitMapper_dump" "Amiga Foundation Classes: bitmapper/dump()" + NAME: dump(fname:PTR TO CHAR) + + DESCRIPTION: This method dumps a bitmap inbt a raw data format file. + + INPUT: fname - File name where to dump the bitmap. + + RESULTS: NONE + + SEE ALSO: @{" loadraw() " LINK "BitMapper_loadraw"} +@endnode + +@node "BitMapper_width" "Amiga Foundation Classes: bitmapper/width()" + NAME: width() + + DESCRIPTION: This method returns bitmap's width. + + INPUT: NONE. + + RESULTS: Bitmap's width. + + SEE ALSO: @{" height() " LINK "BitMapper_height"} + @{" depth() " LINK "BitMapper_depth"} +@endnode + +@node "BitMapper_height" "Amiga Foundation Classes: bitmapper/height()" + NAME: height() + + DESCRIPTION: This method returns bitmap's height. + + INPUT: NONE. + + RESULTS: Bitmap's height. + + SEE ALSO: @{" width() " LINK "BitMapper_width"} + @{" depth() " LINK "BitMapper_depth"} +@endnode + +@node "BitMapper_depth" "Amiga Foundation Classes: bitmapper/depth()" + NAME: depth() + + DESCRIPTION: This method returns bitmap's depth. + + INPUT: NONE. + + RESULTS: Bitmap's depth. + + SEE ALSO: @{" height() " LINK "BitMapper_height"} + @{" width() " LINK "BitMapper_width"} +@endnode + +@node "bitmapper_image" "Amiga Foundation Classes: Bitmapper/image()" + + NAME: image() + + DESCRIPTION: Sometimes, it is usefull to obtain picture Image structure, the one + used by Ituition gadgets. Using this method, you can obtain this + Image structure. + + INPUT: NONE + + RESULTS: a pointer to a valid Image structure. + + NOTE: This method is *slow* the first time you call it, because it has + to create the Image structure and picture. Then, it will be + fastlighting, until you don't load another picture in the class. + + SEE ALSO: + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/DirList.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/DirList.guide new file mode 100644 index 0000000..c26e676 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/DirList.guide @@ -0,0 +1,235 @@ +@database DirList.guide + +@$VER: DirList_oo V3.00 - By Fabio Rotondo (C)Brighting Brain Brothers + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node "Main" "Amiga Foundation Classes Module: DirList" + + + + ** DirList_OO - Original By Fabio Rotondo ** + + * Part of Amiga Foundation Classes * + + @{" Introduction " link "DirList_introduction" } @{" Author's Infos " link "author" } @{" Amiga Foundation Classes " LINK "afc.guide/main"} + + + Requires: @{" NodeMaster " LINK "NodeMaster.guide/main"}, @{" StringNode " LINK "StringNode.guide/main"} + + Base: $0003 + + + NOTE: DirList inherits completely @{" StringNode " LINK "stringnode.guide/main"} so, please, refer + to this class for further documentation. + + NEW COMMANDS BRIEF DESCRIPTION + ------------------------------------------------------------------------- + @{" DirList() " link "DirList_DirList" } Initailizes the object + @{" dirname() " link "DirList_dirname" } Returns current dir name + @{" read(dirs, files, match) " link "DirList_read" } Scans a Directory + @{" setattrs(tags) " link "DirList_setmode" } Set objects behaviours + @{" setdir(path) " link "DirList_setdir" } Set Directory to read + @{" version() " link "DirList_version"} Returns class version and revision + + @{" Tags Table " link "DirList_Tags" } Possible DirList's Tags + + @{" Errors Table " LINK "DirList_ErrorTable"} Error Table +@endnode + +@node "DirList_Introduction" "Introduction" + + DirList Object is something I created for my own needs. + + Now it is grown to a powerful and stable object, so I decided to share it +with all the rest of Amiga Foundation Classes community. + + Main features are: + + * Accept AmigaDOS Pattern Matching. + + * Very fast scanning algorithms. + + * Easy to use. + + * Relys on StringNode Object. (See StringNode_oo) + + +NEW V2.10 Features: + + * Added a new method called tagset(): + With this method you will be able to change some DirList + behaviours via tags (at the moment, just two different tags + are implemented, but many others will do as time goes by) + + * Now dirname() returns also the "/" when needed. + + * Example program now working ;) + + * New examples added. + +NEW V3.00 Features: + + * Restructured code. + + * Part of the Amiga Foundation Classes +@endnode + +@node author "Author(s) Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) +@endnode + +@node DirList_Tags "Amiga Foundation Classes Modules: DirList/Tag Table" + + + TAG NAME | VALUES (DEFAULT)| DESCRIPTION ++-------------------+-----------------+----------------------------------- + TAGDIR_MARKDIR |TRUE/FALSE(TRUE) | If TRUE, DirList will add the + | | leading "(DIR) " prefix to dir names. + | | +TAGDIR_COMPLETEPATH |TRUE/FALSE(FALSE)| If TRUE, DirList will add complete path + | | to the dirs and files read. + | | + +Please, see also @{" StringNode/Tags Table" LINK "StringNode.guide/StringNode_TagsTable"} +@endnode + +@node DirList_ErrorTable "Amiga Foundation Classes Modules: DirList / Error Table " +ERROR VALUE | DESCRIPTION +--------------------+------------------------------------------------------ + $0000 | No memory. + $0001 | Initialization failed. + $0002 | Could not lock desired dir (ie. dir not found) + $0003 | You are trying to use a class which failed to init. + $0004 | You are trying to read "nothing" (ie: you haven't set a valid dir) + $0005 | Examine() call failed. + +Please, see also @{" StringNode/Error Table" LINK "StringNode.guide/StringNode_ErrorTable"} + +@endnode + +@node "DirList_DirList" "Amiga Foundation Classes Modules: DirList/dirlist()" + NAME: dirlist() + + DESCRIPTION: Use this command to initailize the object. + + INPUT: NONE. + + RESULTS: NONE. + + SEE ALSO: @{" StringNode/stringnode() " LINK "StringNode.guide/StringNode_stringnode"} +@endnode + +@node "DirList_setdir" "Amiga Foundation Classes Modules: DirList/setdir()" + NAME: setdir(path:PTR TO CHAR) + + DESCRIPTION: Use this command to select directory to scan. + + INPUT: path - PTR TO CHAR. Directory name, FULL PATH! + + RESULTS: NONE. + + SEE ALSO: @{" dirname() " LINK "DirList_dirname"} + @{" read() " LINK "DirList_read"} +@endnode + +@node DirList_dirname "Amiga Foundation Classes Modules: DirList/dirname()" + NAME: dirname() + + DESCRIPTION: This command returns the current dir name. + + INPUT: NONE. + + RESULTS: name - A PTR TO CHAR containing current dir name. + + SEE ALSO: @{" setdir() " LINK "DirList_setdir"} +@endnode + +@node DirList_read "Amiga Foundation Classes Modules: DirList/read()" + NAME: read(dirs=TRUE, files=TRUE, match=NIL:PTR TO CHAR) + + DESCRIPTION: This command scans selected dir. + + INPUT: dirs - (TRUE) If this flag is set to TRUE, DirList + will memorize any directory it will encounter + while scanning. + + files - (TRUE) Same as dirs flag, only with files. + + match - (NIL) This is a _VALID_ search pattern. This + pattern will be CASE INSENSITIVE and it is a + _STANDARD_ AmigaDOS pattern matching. (By the + way, DirList *USES* AmigaDOS pattern matching, + so it is FAST and you already should know how + to use it!) + + Ex. "#?sequ#?" is a valid pattern matching + string. + + RESULTS: NONE + + SEE ALSO: @{" setdir() " LINK "DirList_setdir"} +@endnode + +@node "DirList_setattrs" "Amiga Foundation Classes Modules: DirList/setattrs()" + NAME: setmode(tags:PTR TO LONG) + + DESCRIPTION: Use this command to change some of object's behaviours. + This method will grow as time goes by. It is implemented + in a very comfy way: taglists. + + INPUT: tags - PTR TO LONG. Tags and their value. + See @{" Tags Table " LINK "DirList_Tags"} + + RESULTS: NONE. + + NOTE: REMEMBER to ALWAYS end taglist with 0,0, otherwise + strange things WILL happen. + + You can pass to this method also StringNode's tags. + They will be handled correctly. + + SEE ALSO: @{" dirname() " LINK "DirList_dirname"} + @{" read() " LINK "DirList_read"} + + @{" StringNode/setattrs " LINK "StringNode.guide/StringNode_setattrs"} +@endnode + +@node "DirList_version" "Amiga Foundation Classes Modules: DirList/version()" + NAME: version() + + DESCRIPTION: This method returns class version and revision. + + INPUT: NONE + + RESULTS: this method return TWO values: version and revision. + + SEE ALSO: + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Displayer.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Displayer.guide new file mode 100644 index 0000000..eefd202 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Displayer.guide @@ -0,0 +1,610 @@ +@database Displayer.guide + +@$VER: Displayer V1.01 - by Andrea Galimberti - (C) Brighting Brain Brothers + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node main "AFC module: Displayer / Main" + + + ** Displayer V1.01 - Original By Andrea Galimberti ** + + Part of Amiga Foundation Classes + + + + + @{" Introduction " LINK obj_intro} @{" Author(s) Info " LINK author} + + + Requires: @{" Bitmapper " LINK "Bitmapper.guide/Main"}, @{" NodeMaster " LINK "nodemaster.guide/Main"} + + Base: $8000 + + COMMANDS BRIEF DESCRIPTION + ----------------------------------------------------------------------- + displayer methods: + + @{" displayer() " LINK displayer} Initialises the object + @{" add() " LINK view_add} Adds a ViewPort + @{" del() " LINK view_del} Removes a ViewPort + @{" setup() " LINK view_setup} Builds your display + @{" show() " LINK view_show} Shows the View + @{" showOldView() " LINK view_showold} Restores the old View + @{" address() " LINK view_address} Address of View structure + @{" viewport() " LINK view_vp} Address of a viewport + @{" rastport() " LINK view_rastport} Rastport of a viewport + @{" bitmap() " LINK view_bitmap} Bitmap of a viewport + @{" vpobj() " LINK view_vpobj} Pointer to a viewport_obj + @{" width() " LINK view_width} Width of a viewport + @{" height() " LINK view_height} Height of a viewport + @{" depth() " LINK view_depth} Depth of a viewport + @{" mode() " LINK view_mode} Display mode of a viewport + @{" scroll() " LINK view_scroll} Scrolls a BitMap + @{" swap() " LINK view_swap} Swaps BitMaps in a double buffered ViewPort + @{" vWait() " LINK view_vwait} Waits for the VBlank + @{" version() " LINK view_version} Gets version number + + viewport_obj methods: + + @{" viewport_obj() " LINK viewport_obj} Initialises the object + @{" address() " LINK vp_address} Address of ViewPort + @{" rastport() " LINK vp_rastport} RastPort of ViewPort + @{" bitmap() " LINK vp_bitmap} BitMap of ViewPort + @{" width() " LINK vp_width} Width of ViewPort + @{" height() " LINK vp_height} Height of ViewPort + @{" depth() " LINK vp_depth} Depth of ViewPort + @{" mode() " LINK vp_mode} Display mode of ViewPort + + @{" ERROR TABLE " LINK Error_Table} + +@endnode + +@node author "Author(s) Info" + + Original By: Andrea Galimberti + + E Version By: Andrea Galimberti + + + +@endnode + +@node obj_intro "Displayer / Introduction" + + Displayer. + + This module allows you to easily build, in a completely system-friendly +way, a display made of a view containing some viewports. Any viewport can +have its own resolution and depth, must have a bitmap associated with it, +and you can draw in such a bitmap just as you usually do in a simple +screen: by addressing it through its rastport. + There are two objects contained in the module: the displayer and the +viewport_obj. To create a display you first intialise (NEW +myview.displayer()) your displayer object, and then add to it how many +viewport you like using the add() method: when you are finished you call +the setup() and show() methods to admire your display. + If you want to, you can also access any single viewport_obj contained in +the displayer with a call to vpobj(number). + In addition the module allows double-buffered viewports and scrolling of +the bitmaps displayed through the viewports. + +@endnode + +@node Error_Table "Displayer / Error Table" + +Val (Hex) | Description +-----------+------------------------------------------------------ + $0000 | No memory + $0001 | Cannot allocate ViewExtra structure + $0002 | OpenMonitor() failed + $0003 | Cannot allocate ViewPortExtra structure + $0004 | GetDisplayInfoData() failed + $0005 | FindDisplayInfo() failed + $0006 | Cannot allocate ColorMap structure + $0007 | VideoControl() failed to attach structures + $0008 | Illegal ViewPort parameters (maybe NIL?) + $0009 | Failed to create ViewPort (MakeVPort()) + $000A | Failed to merge copper instructions + $000B | Illegal display parameters (maybe NIL?) + +@endnode + +@node displayer "AFC Module: displayer / displayer()" + + NAME: displayer() + + DESCRIPTION: initialises your displayer object. + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node view_add "AFC module: displayer / add()" + + NAME: add(tags:PTR TO LONG) + + DESCRIPTION: adds a viewport_obj to the list contained in your displayer. + When you have finished adding viewports you build the + system structures associated to the display by calling the + @{"setup()" LINK view_setup} method. This command doesn't check if the viewports + overlap. + + INPUTS: A NIL terminated taglist. The command understands the + following tags: + + VPORT_TOP: y coordinate of the viewport top-left corner + + VPORT_LEFT: x coordinate of the viewport top-left corner + + VPORT_WIDTH: viewport width + + VPORT_HEIGHT: viewport height + + VPORT_DEPTH: viewport depth + + VPORT_MODE: viewport display mode (see the modeid.m system + module for a list of all available modes) + + VPORT_SPRITES: TRUE if you want to use sprites on the + viewport (default is FALSE) + + VPORT_BITMAP: pointer to an already initialized + @{"bitmap_obj" LINK "bitmap_obj.guide/Main"}. If this tag is present, no + bitmap_obj will be allocated for the + viewport. The bitmap passed is displayed + when the viewport is opened. It's your duty + to free the memory associated to such a + bitmap_obj. The dimensions of the bitmap are + assumed to be equal to the viewport ones, if + not differently specified with the following + tags. + + + If you want to display through the ViewPort a BitMap with + dimensions different from the ViewPort ones (e.g., to + @{"scroll" LINK view_scroll} it) you use: + + VPORT_BMWIDTH: bitmap width + + VPORT_BMHEIGHT: bitmap height + + VPORT_BMDEPTH: bitmap depth + + VPORT_DBUFFER: specifies that the ViewPort is double + buffered, that is to say two BitMaps with + equal features are allocated for the same + ViewPort: you can draw in the hidden one and + then @{"swap" LINK view_swap} the two. + + + RESULTS: NONE + + SEE ALSO: @{" setup() " LINK view_setup} + +@endnode + +@node view_del "AFC module: displayer / del()" + + NAME: del(num) + + DESCRIPTION: removes ViewPort number num from the View. Never call + this method while the View is displayed: this function + immediately deallocates all memory associated to the + ViewPort to be deleted. + You have to call the @{"setup()" LINK view_setup} method to see the results + of your changes. + + INPUTS: number of ViewPort to be killed: this ranges from 0 to + (number of viewports)-1 + + RESULTS: FALSE if num is outside the valid range, + otherwise TRUE. + + SEE ALSO: @{" add() " LINK view_add} + +@endnode + +@node view_setup "AFC module: displayer / setup()" + + NAME: setup(modeid) + + DESCRIPTION: allocates the memory and the system structures needed to + render your display. This method scans the viewports you + linked with the @{"add()" LINK view_add} method. + Never call this function while the view is displayed: it + will deallocate all memory associated to the view to + rebuild system structures from scratch. + + INPUTS: the monitor id, e.g., DEFAULT_MONITOR_ID, (see the + modeid.m system module for a full list of all modes + available) + + RESULTS: raises a lot of exceptions if something goes wrong (see the + @{"Error Table" LINK Error_Table} for more info). + + SEE ALSO: @{" add() " LINK view_add} + +@endnode + +@node view_show "AFC module: displayer / show()" + + NAME: show() + + DESCRIPTION: shows the display created with setup(). Automatically + remembers the previous display: you have to restore it with + a call to showOldView() before exiting the program. + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: @{" showOldView() " LINK view_showold} + @{" setup() " LINK view_setup} + +@endnode + +@node view_showold "AFC module: displayer / showOldView()" + + NAME: showOldView() + + DESCRIPTION: restores the previous display. + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: @{" show() " LINK view_show} + +@endnode + +@node view_vwait "AFC module: displayer / vWait()" + + NAME: vWait() + + DESCRIPTION: waits for the vertical blanking period. + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node view_scroll "AFC module: displayer / scroll()" + + NAME: scroll(number,x,y) + + DESCRIPTION: scrolls the BitMap currently displayed through ViewPort + at position "number" in the list by positioning the pixel + (x,y) at the top left-hand corner of the ViewPort. If you + want to synchronize the scrolling with the video beam you + have to call the @{"vWait" LINK view_vwait} method to wait for the vertical + blanking period. + + INPUTS: number of ViewPort + x position of BitMap + y position of BitMap + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node view_swap "AFC module: displayer / swap()" + + NAME: swap(number) + + DESCRIPTION: exchanges the two BitMaps of a double buffered ViewPort + (the ViewPort at position "number" in the list). If you + want to synchronize the swapping with the video beam you + have to call the @{"vWait" LINK view_vwait} method to wait for the vertical + blanking period. + + INPUTS: number of ViewPort + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node view_address "AFC module: displayer / address()" + + NAME: address() + + DESCRIPTION: returns the address of the View structure allocated by the + system (see your Includes/graphics/view.h) + + INPUTS: NONE + + RESULTS: address of View structure + + SEE ALSO: + +@endnode + +@node view_rastport "AFC module: displayer / rastport()" + + NAME: rastport(number, alt=0) + + DESCRIPTION: returns the address of the RastPort structure belonging to + the chosen ViewPort. (See @{"viewport()" LINK view_vp} for more info.) + A ViewPort has a RastPort associated to the BitMap that is + currently displayed through it. + If alt<>0 it returns the address of the RastPort of the + alternate BitMap (only if the ViewPort is double buffered, + otherwise NIL). The alternate BitMap is the one that is + hidden when the View shows up the first time. + + INPUTS: number of ViewPort + alt: if <>0 selects the alternate BitMap + + RESULTS: address of RastPort + + SEE ALSO: viewport_obj: @{" rastport() " LINK vp_rastport} + +@endnode + +@node view_vp "AFC module: displayer / viewport()" + + NAME: viewport(number) + + DESCRIPTION: returns the address of the selected ViewPort structure + allocated by the system. The argument "number" goes from 0 + to the number of ViewPorts you linked to your View with the + @{"add()" LINK view_add} command: the order is the same in + which the ViewPorts have been linked. + + INPUTS: number of ViewPort + + RESULTS: address of ViewPort + + SEE ALSO: viewport_obj: @{" address() " LINK vp_address} + +@endnode + +@node view_vpobj "AFC module: displayer / vpobj()" + + NAME: vpobj(number) + + DESCRIPTION: returns the address of the viewport_obj object at position + "number" in the list linked to the displayer with the + @{"add" LINK view_add} command. With the returned pointer you + can call all the viewport_obj methods. + + INPUTS: number of ViewPort + + RESULTS: address of viewport_obj object + + SEE ALSO: + +@endnode + +@node view_bitmap "AFC module: displayer / bitmap()" + + NAME: bitmap(number, alt=0) + + DESCRIPTION: returns the address of the BitMap structure currently + displayed through the chosen ViewPort. (See @{"viewport()" LINK view_vp} + for more info.) + A BitMap is automatically allocated for each ViewPort when + @{"setup()" LINK view_setup} is called. + If alt<>0 it returns the address of the alternate BitMap + (only if the ViewPort is double buffered, otherwise NIL). + The alternate BitMap is the one that is hidden when the + View shows up the first time. + + INPUTS: number of ViewPort + alt: if <>0 selects the alternate BitMap + + RESULTS: address of BitMap + + SEE ALSO: viewport_obj: @{" bitmap() " LINK vp_bitmap} + @{" bitmap_obj / bitmap() " LINK "bitmap_obj.guide/bitmap_bitmap"} + +@endnode + +@node view_width "AFC module: displayer / width()" + + NAME: width(number) + + DESCRIPTION: returns the width of the ViewPort at position "number" in + the list. + + INPUTS: number of ViewPort + + RESULTS: width of ViewPort + + SEE ALSO: viewport_obj: @{" width() " LINK vp_width} + +@endnode + +@node view_height "AFC module: displayer / height()" + + NAME: height(number) + + DESCRIPTION: retuns the height of the ViewPort at position "number" in + the list. + + INPUTS: number of ViewPort + + RESULTS: height of ViewPort + + SEE ALSO: viewport_obj: @{" height() " LINK vp_height} + +@endnode + +@node view_depth "AFC module: displayer / depth()" + + NAME: depth(number) + + DESCRIPTION: retuns the depth of the ViewPort at position "number" in + the list. + + INPUTS: number of ViewPort + + RESULTS: depth of ViewPort + + SEE ALSO: viewport_obj: @{" depth() " LINK vp_depth} + +@endnode + +@node view_mode "AFC module: displayer / mode()" + + NAME: mode(number) + + DESCRIPTION: returns the display mode of the ViewPort at position + "number" in the list. + + INPUTS: number of ViewPort + + RESULTS: display mode (resolution) of ViewPort + + SEE ALSO: viewport_obj: @{" mode() " LINK vp_mode} + +@endnode + +@node view_version "AFC module: displayer / version()" + + NAME: version() + + DESCRIPTION: gets version number of Displayer module + + INPUTS: NONE + + RESULTS: displayer version, displayer revision + + SEE ALSO: + +@endnode + +@node viewport_obj "viewport_obj / viewport_obj()" + + NAME: viewport_obj() + + DESCRIPTION: initialises a viewport_obj object + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node vp_rastport "viewport_obj / rastport()" + + NAME: rastport(alt=0) + + DESCRIPTION: returns the address of the RastPort of the BitMap currently + displayed through the ViewPort. + If alt<>0 it returns the address of the RastPort of the + alternate BitMap (only if the ViewPort is double buffered, + otherwise NIL). The alternate BitMap is the one that is + hidden when the View shows up the first time. + + INPUTS: alt: if <>0 it selects the alternate BitMap + + RESULTS: address of RastPort + + SEE ALSO: displayer: @{" rastport() " LINK view_rastport} + +@endnode + +@node vp_address "viewport_obj / address()" + + NAME: address() + + DESCRIPTION: returns the address of the ViewPort structure allocated by + the system + + INPUTS: NONE + + RESULTS: address of ViewPort + + SEE ALSO: displayer: @{" viewport() " LINK view_vp} + +@endnode + +@node vp_bitmap "viewport_obj / bitmap()" + + NAME: bitmap(alt=0) + + DESCRIPTION: returns the address of the BitMap structure currently + displayed through the ViewPort + If alt<>0 it returns the address of the alternate BitMap + (only if the ViewPort is double buffered, otherwise NIL). + The alternate BitMap is the one that is hidden when the + View shows up the first time. + + INPUTS: alt: if <>0 it selects the alternate BitMap + + RESULTS: address of BitMap + + SEE ALSO: displayer: @{" bitmap() " LINK view_bitmap} + +@endnode + +@node vp_width "viewport_obj / width()" + + NAME: width() + + DESCRIPTION: returns the width of the ViewPort + + INPUTS: NONE + + RESULTS: width of ViewPort + + SEE ALSO: displayer: @{" width() " LINK view_width} + +@endnode + +@node vp_height "viewport_obj / height()" + + NAME: height() + + DESCRIPTION: returns the height of the ViewPort + + INPUTS: NONE + + RESULTS: height of ViewPort + + SEE ALSO: displayer: @{" height() " LINK view_height} + +@endnode + +@node vp_depth "viewport_obj / depth()" + + NAME: depth() + + DESCRIPTION: returns the depth of the ViewPort + + INPUTS: NONE + + RESULTS: depth of ViewPort + + SEE ALSO: displayer: @{" depth() " LINK view_depth} + +@endnode + +@node vp_mode "viewport_obj / mode()" + + NAME: mode() + + DESCRIPTION: returns the display mode of the ViewPort + + INPUTS: NONE + + RESULTS: display mode of ViewPort + + SEE ALSO: displayer: @{" mode() " LINK view_mode} + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Hardsprite.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Hardsprite.guide new file mode 100644 index 0000000..eeaaa33 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Hardsprite.guide @@ -0,0 +1,169 @@ +@database Hardsprite.guide + +@$VER: Hardsprite V1.00 - by Andrea Galimberti - (C) Brighting Brain Brothers + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node main "AFC Module: hardsprite / Main" + + + ** Hardsprite V1.00 - Original By Andrea Galimberti ** + + Part of Amiga Foundation Classes + + + + + @{" Introduction " LINK obj_intro} @{" Author(s) Info " LINK author} + + + Requires: + + Base: $8001 + + COMMANDS BRIEF DESCRIPTION + ----------------------------------------------------------------------- + @{" hardsprite() " LINK hardsprite} Initialises the Object + @{" image() " LINK sprite_image} Stores the sprite image + @{" changeImage() " LINK sprite_changeimage} Changes the sprite image + @{" move() " LINK sprite_move} Moves the sprite + @{" version() " LINK sprite_version} Gets object version + + @{" ERROR TABLE " LINK Error_Table} + +@endnode + +@node author "Author(s) Info" + + Original By: Andrea Galimberti + + E Version By: Andrea Galimberti + + +@endnode + +@node obj_intro "Hardsprite / Introduction" + + Hardsprite. + + + This object allows to easily access and manipulate the so called Simple +Sprites, that is to say Hardware Sprites. You can use each of the 8 +sprites and move it to a location relative to a viewport or to the whole +view (be it the Intuition one or a custom one you created by hand). +Obviously, you can change the image of the sprites (but it cannot be more +than 16 pixels wide, 4 colours). + +@endnode + +@node Error_Table "Hardsprite / Error Table" + +Val (Hex) | Description +-----------+------------------------------------------------------ + $0000 | No Memory + +@endnode + +@node hardsprite "AFC module: hardsprite / hardsprite()" + + NAME: hardsprite(number=-1) + + DESCRIPTION: Builds a hardsprite object + + INPUTS: number of hardware sprite to use (from 0 to 7). If the + requested sprite is not available this function will return + FALSE. The default value of -1 means that it will be + allocated the first sprite available. + + RESULTS: TRUE if all went ok. + FALSE if the reqired sprite is already in use and so it + couldn't be allocated. + + SEE ALSO: + +@endnode + +@node sprite_image "AFC module: hardsprite / image()" + + NAME: image(height, list:PTR TO INT) + + DESCRIPTION: this method stores the image to be used with the sprite. + Whenever this method is called, it will discard the + previous image. + + INPUTS: height (in lines) of the image, + a typed list (it MUST be typed to INT) in the following + form: + + [ $0000, $0000, + $0000, $0000, + ... ]:INT + + ^ ^ + | | + | second bitplane (16 bits wide) + | + first bitplane (16 bits wide) + + This way you can select one of 4 colours for each pixel of + the sprite's image. + + RESULTS: returns FALSE if: sprite non allocated (with hardsprite()), + height<=0, + pointer to list =NIL. + Raise "No Memory" if it cannot allocate the (CHIP) memory + for the image. + + SEE ALSO: + +@endnode + +@node sprite_changeimage "AFC module: hardsprite / changeImage()" + + NAME: changeImage(viewport) + + DESCRIPTION: changes the sprite image to the stored one. + + INPUTS: pointer to a viewport structure. If this pointer is <>NIL + then the change will affect only the chosen viewport; if + pointer=NIL then the change is relative to the current + view. + + RESULTS: FALSE if viewport<0 or sprite not allocated. + Otherwise TRUE. + + SEE ALSO: @{" image() " LINK sprite_image} + +@endnode + +@node sprite_move "AFC module: hardsprite / move()" + + NAME: move(viewport, x, y) + + DESCRIPTION: moves the sprite to the selected location (x,y) on a + viewport. + + INPUTS: viewport: pointer to a viewport structure; if this pointer + is NIL then the coordinates are relative to the current + view. + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node sprite_version "AFC module: hardsprite / version()" + + NAME: version() + + DESCRIPTION: gets version number of the Sprite module + + INPUTS: NONE + + RESULTS: hardsprite version, hardsprite revision + + SEE ALSO: + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/IffParser.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/IffParser.guide new file mode 100644 index 0000000..a071f8f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/IffParser.guide @@ -0,0 +1,471 @@ +@database IffParser.guide + +@$VER: IFFParser V1.20 - By Fabio Rotondo (C)Amiga Foundation Classes + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node "Main" "IFFParser Guide" + + ** IFFParser - Written By Fabio Rotondo ** + + * Part of the Amiga Foundation Classes * + + + @{" Introduction " link "Introduction"} @{" Author's Info " link "Author"} @{" Amiga Foundation Classes " link "AFC.guide/Main"} + + @{" SAS/C and StormC Notes " LINK "IFFParser_CNotes"} @{" C-Only Functions " LINK "IFFParser_COnly"} + + Requires: Nothing. + + Class Base: $00080000 + + COMMANDS BRIEF DESCRIPTION + -------------------------------------------------------------------------- - + @{" iffparser() " link "IFFParser_iffparser"} Inits the iffparser object. + @{" addr() " link "IFFParser_addr"} Returns current data position in mem. + @{" close() " link "IFFParser_close"} Closes currently IFF session. + @{" closechunk() " link "IFFParser_closechunk"} Closes last created chunk. + @{" createchunk(type, id, size) " link "IFFParser_createchunk"} Inits a new chunk to write. + @{" error() " link "IFFParser_error"} Returns last error raised. + @{" exit(type, id) " link "IFFParser_exit"} Defines when scan() must stop. + @{" first(type, id) " link "IFFParser_first"} Prepares data examination. + @{" getheader(string, filename) " link "IFFParser_getheader"} Returns header of a file. + @{" load(filename) " link "IFFParser_load"} Inits an IFF Load session. + @{" save(filename) " link "IFFParser_save"} Inits an IFF SAVE session. + @{" scan() " link "IFFParser_scan"} Begins scanning an IFF file. + @{" setscan(type, id) " link "IFFParser_setscan"} Defines type of chunk to scan for. + @{" succ() " link "IFFParser_succ"} Gets next memory data location. + @{" size() " link "IFFParser_size"} Returns current data size. + @{" writechunk(datas, datalen) " link "IFFParser_writechunk"} Writes some datas to a chunk. + @{" version() " link "IFFParser_version"} Returns IFFParser class version and revision. + + + @{" Error Table " link "IFFParser_ErrorTable"} +@endnode + +@node "IFFParser_CNotes" "SAS/C and StormC Notes" + + SAS/C and StormC Notes + + We provide ".o" files for both SAS/C and StormC compilers. + + + NOTE: + The StormC compiler we are using is a _demo_ version, so we cannot create + optimized version of the class. + + We have asked to Haage & Partner a FREE version of StormC, but we receive + no answer at all. We are still waiting. + We are not going to buy it because we usually write code using AmigaE and + furthermore, we have already bought SAS/C compiler. + + StormC supports exceptions, while SAS/C doesn't. So we have been forced to + find a "work around" for SAS/C compiler. + + We have introduced the error() method which will return the last error + encountered during program execution. + + So keep in mind this: when an error occurs, StormC version will raise an + exception, while SAS/C version will return an error code or NULL and you + will have to check error() status. + + +@endnode + +@node "IFFParser_COnly" "IFFParser C-Only Functions" + + C-Only Functions + + We have created this function: + + NAME: id(idname) + + SYNOPSIS: ULONG id(STRPTR idname) + + DESCRIPTION: This function is a short cut to allow you to easily create "chunks" name. + As you may now, chunks name are ULONG values. Usually you have to use + the MAKE_ID() macro, but the id() function is faster. + + INPUT: idname - a string, for example "ILBM", "BODY".... + + RETURNS: the corrisponding ULONG value. + + + We hope you'll find it useful + +@endnode + +@node "Introduction" "Introduction " + + + IFFParser is an Object to easily read/write IFF files. + + It is not so powerful as IFFParse.library: it misses some features, but I +have written it to match all my needs, and it does. I hope you will enjoy +using. Look at the examples for working programs. + + +@endnode + +@node "Author" "Author's Info" + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + C++ Version By: Massimo Tantignone (tanti@intercom.it) + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) + + +@endnode + +@node "IFFParser_ErrorTable" "Amiga Foundation Classes Module: IFFParser / Error Table" + VALUE | DESCRIPTION +-----------------+-------------------------------------------------------- + $0000 | No Memory. + $0001 | Could not open iffparse.library. + $0002 | Could not AllocIFF(). + $0003 | Could not create filename with Open(fname, MODE_NEWFILE). + $0004 | Could not OpenIFF(). + $0005 | IFFParser object not initialized with load() or save(). + $0006 | Could not Push current chunk. + $0007 | WriteChunkBytes() failed. + $0008 | Could not Pop current chunk. + $0009 | Could not Open() file for reading. + $000A | Could not do a CollectionChunk() call. + $000B | Could not assign StopOnExit. +@endnode + +@node "IFFParser_iffparser" "Amiga Foundation Classes Module: IFFParser / iffparser() " + + NAME: iffparser() + + SYNOPSIS: iffparser(void) + + DESCRIPTION: This method will initialize the iffparser object. + + INPUT: NONE. + + RESULTS: NONE. + + SEE ALSO: +@endnode + +@node "IFFParser_close" "Amiga Foundation Classes Module: IFFParser / close() " + + NAME: close() + + SYNOPSIS: void close(void) + + DESCRIPTION: This method will close curent IFF session. + + INPUT: NONE. + + RESULTS: NONE. + + SEE ALSO: @{" load() " link "IFFParser_load"} + @{" save() " link "IFFParser_save"} +@endnode + +@node "IFFParser_save" "Amiga Foundation Classes Module: IFFParser / save(filename) " + + NAME: save(filename:PTR TO CHAR) + + SYNOPSIS: LONG save(STRPTR fname) + + DESCRIPTION: Use This method to create a new IFF file and to begin + a IFF save session. + + INPUT: filename - Name of the file to open / load. + + RESULTS: NONE. + + + SEE ALSO: @{" createchunk() " link "IFFParser_createchunk"} + @{" writechunk() " link "IFFParser_writechunk"} + @{" closechunk() " link "IFFParser_closechunk"} + @{" close() " link "IFFParser_close"} +@endnode + +@node "IFFParser_createchunk" "Amiga Foundation Classes Module: IFFParser / createchunk(type, id, size) " + + NAME: createchunk(type, id, size=IFFSIZE_UNKNOWN) + + SYNOPSIS: LONG createchunk(ULONG type, ULONG id, ULONG size = IFFSIZE_UNKNOWN) + + DESCRIPTION: This method will create a new chunk where to write in. + + INPUT: type - (LONG) type of the chunk. (ex. "ILBM") + id - (LONG) id of the chunk. (ex. "FORM") + + RESULTS: NONE. + + + SEE ALSO: @{" closechunk() " link "IFFParser_closechunk"} + @{" writechunk() " link "IFFParser_writechunk"} + @{" save() " link "IFFParser_save"} +@endnode + +@node "IFFParser_writechunk" "Amiga Foundation Classes Module: IFFParser / writechunk(datas, datalen) " + + NAME: writechunk(data, datalen) + + SYNOPSIS: LONG writechunk(STRPTR data, ULONG datalen) + + DESCRIPTION: Use This method to write some data into a chunk. + + INPUT: data - (PTR TO LONG) memory location of your datas. + datalen - (LONG) length in bytes of your data. + + RESULTS: NONE. + + + SEE ALSO: @{" save() " link "IFFParser_save"} + @{" createchunk() " link "IFFParser_createchunk"} + @{" closechunk() " link "IFFParser_closechunk"} +@endnode + +@node "IFFParser_closechunk" "Amiga Foundation Classes Module: IFFParser / closechunk() " + + NAME: closechunk() + + SYNOPSIS: LONG closechunk(void) + + DESCRIPTION: This method will close current chunk. + + INPUT: NONE. + + RESULTS: NONE. + + + SEE ALSO: @{" createchunk() " link "IFFParser_createchunk"} + @{" writechunk() " link "IFFParser_writechunk"} + @{" save() " link "IFFParser_save"} +@endnode + +@node "IFFParser_load" "Amiga Foundation Classes Module: IFFParser / load(filename) " + + NAME: load(filename:PTR TO CHAR) + + SYNOPSIS: LONG load(STRPTR filename) + + DESCRIPTION: Use This method to open an already existing IFF file and + to begin a IFF load session. + + INPUT: filename - Name of the file to open / load. + + RESULTS: NONE. + + + SEE ALSO: @{" setscan() " link "IFFParser_setscan"} + @{" scan() " link "IFFParser_scan"} + @{" close() " link "IFFParser_close"} +@endnode + +@node "IFFParser_setscan" "Amiga Foundation Classes Module: IFFParser / setscan(type, id) " + + NAME: setscan(type, id) + + SYNOPSIS: LONG setscan(ULONG type, ULONG id) + + DESCRIPTION: Use This method to set chunk that will be loaded by + scan(). + + INPUT: type - (LONG) type of chunk. (ex. "ILBM") + id - (LONG) id of chunk. (ex. "FORM") + + RESULTS: NONE. + + + NOTES: You can do more than a single setscan() before scan()ing the + IFF file. This is the biggie ;) + In this way you can load up in memory all you need in a single + file access. + + SEE ALSO: @{" scan() " link "IFFParser_scan"} + @{" load() " link "IFFParser_load"} +@endnode + +@node "IFFParser_first" "Amiga Foundation Classes Module: IFFParser / first(type, id) " + + NAME: first(type, id) + + SYNOPSIS: APTR first(ULONG type, ULONG id) + + DESCRIPTION: Use This method to position IFFParser object to the FIRST + memory data location of a specific kind. + + INPUT: type - (LONG) type of the chunk. (ex. "ILBM") + id - (LONG) id of the chunk. (ex. "FORM") + + RESULTS: a PTR TO LONG memory location of the data (may be NIL) + + + SEE ALSO: @{" load() " link "IFFParser_load"} + @{" scan() " link "IFFParser_scan"} + @{" setscan() " link "IFFParser_setscan"} + @{" succ() " link "IFFParser_succ"} +@endnode + +@node "IFFParser_addr" "Amiga Foundation Classes Module: IFFParser / addr() " + + NAME: addr() + + SYNOPSIS: APTR addr(void) + + DESCRIPTION: This method will return current memory data address. + + INPUT: NONE. + + RESULTS: a PTR TO LONG specifying memory data address (may be NIL) + + SEE ALSO: @{" size() " link "IFFParser_size"} + @{" first() " link "IFFParser_first"} + @{" succ() " link "IFFParser_succ"} +@endnode + +@node "IFFParser_size" "Amiga Foundation Classes Module: IFFParser / size() " + + NAME: size() + + SYNOPSIS: LONG size(void) + + DESCRIPTION: Use This method to get size of current memory data. + + INPUT: NONE. + + RESULTS: size - (LONG) size of the memory data. (May be NIL) + + + SEE ALSO: @{" first() " link "IFFParser_first"} + @{" succ() " link "IFFParser_succ"} +@endnode + +@node "IFFParser_succ" "Amiga Foundation Classes Module: IFFParser / succ() " + + NAME: succ() + + SYNOPSIS: APTR succ(void) + + DESCRIPTION: Use This method to position to the next memory data. + + INPUT: NONE. + + RESULTS: a PTR TO LONG to the new location of memory data. (May be NIL) + + + SEE ALSO: @{" load() " link "IFFParser_load"} + @{" first() " link "IFFParser_first"} +@endnode + +@node "IFFParser_scan" "Amiga Foundation Classes Module: IFFParser / scan() " + + NAME: scan() + + SYNOPSIS: LONG scan(void) + + DESCRIPTION: Use This method to begin scanning an IFF file. + + INPUT: NONE. + + RESULTS: NONE. + + + SEE ALSO: @{" setscan() " link "IFFParser_setscan"} + @{" load() " link "IFFParser_load"} +@endnode + +@node "IFFParser_getheader" "Amiga Foundation Classes Module: IFFParser / getheader(string, filename) " + + NAME: getheader(string:PTR TO CHAR, filename:PTR TO CHAR) + + SYNOPSIS: LONG getheader(STRPTR s, STRPTR filename) + + DESCRIPTION: Use This method to determinate the kind of a file. + + INPUT: string - A _VALID_ Estring already initialized. + filename - Name of the file to examine. + + RESULTS: string - your _VALID_ Estring will be filled with the + file header (ex. "ILBM") + + NOTE: This method returns a STRING not a LONG! + + + SEE ALSO: +@endnode + +@node "IFFParser_exit" "Amiga Foundation Classes Module: IFFParser / exit(type, id) " + + NAME: exit(type, id) + + SYNOPSIS: LONG exit(ULONG type, ULONG id) + + DESCRIPTION: Use This method to determinate WHEN scan() should stop. + + INPUT: type - (LONG) type of the chunk. (ex. "ILBM") + id - (LONG) id of the chunk. (ex. "FORM") + + RESULTS: NONE. + + + SEE ALSO: @{" load() " link "IFFParser_load"} + @{" scan() " link "IFFParser_scan"} + @{" setscan()" link "IFFParser_setscan"} +@endnode + +@node "IFFParser_version" "Amiga Foundation Classes Module: IFFParser / version() " + + NAME: version() + + SYNOPSIS: LONG version(BOOL rev = FALSE) + + DESCRIPTION: This method returns version and revision of the class. + + INPUT: NONE. + + RESULTS: this method will return TWO values: version and revision. + + PORTING NOTES: The C++ class version behaves differently, since C++ cannot + return two values at the same time. + + So, if you call just version(), you'll get the VERSION value, + while calling version(TRUE), you'll get the REVISION value. + This is just a quick and dirty workaround... + + SEE ALSO: +@endnode + +@node "IFFParser_error" "Amiga Foundation Classes Module: IFFParser / error() " + + NAME: error() + + SYNOPSIS: ULONG error(void) + + DESCRIPTION: This method returns the last error raised. + + INPUT: NONE. + + RESULTS: this method will return the last error code raised. + + SEE ALSO: +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Localer.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Localer.guide new file mode 100644 index 0000000..2d8961a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Localer.guide @@ -0,0 +1,188 @@ +@database Localer.guide + +@$VER: Localer V1.10 - Original by Fabio Rotondo + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node main "Amiga Foundation Classes Modules: Localer/Main" + + + ** Localer - Original By Fabio Rotondo ** + + Part of Amiga Foundation Classes + + @{" Introduction " LINK localer_intro} @{" Author(s) Info " LINK author} @{" Amiga Foundation Classes " LINK "afc.guide/main"} @{" History " LINK "Localer_History"} + + Requires: NOTHING + + Base: $0000D000 + + COMMANDS BRIEF DESCRIPTION + ----------------------------------------------------------------------- + @{" localer() " LINK Localer_localer} Class constructor + @{" clear() " LINK Localer_clear} Clears all resources + @{" get(num, default=NIL) " LINK Localer_get} Gets a message string + @{" language() " LINK Localer_language} Returns the current language + @{" load(cat, v=0, built=NIL) " LINK Localer_load} Loads a catalog file +@endnode + +@node localer_intro "Amiga Foundation Classes Modules: Localer/ Intro" + + INTRO + + Localer is a very simple class, which works as an interface between locale.library + and the program you are writing. + Using this class, you can easily add localization properties to your program + without worrying about the AmigaOS your program will roun on. + Infact, if the AmigaOS isn't able to handle locale.library, Localer will simply + return default strings as program strings. + +@endnode + +@node author "Author's Info" + + + Original By: Fabio Rotondo + + E Version By: Fabio Rotondo (fsoft@intercom.it) + + C++ Version By: Inyaki Galdeano (i.amanita.s@mx3.redestb.es) + +@endnode + +@node Localer_History "Amiga Foundation Classes: Localer / History" + + HISTORY + + V1.00 - Initial release + + V1.10 - Added language() method + +@endnode + +@node localer_localer "Localer / Localer()" + + NAME: localer() + + SYNOPSIS: localer() + + DESCRIPTION: This is the class constructor. + + INPUTS: NONE + + RESULTS: NONE + + NOTES: This method will _never_ fail. It has been created to handle + correctly all OSes, starting from AmigaOS V1.2+, so, if it isn't + able to open locale.library, it simply ignores it. + + SEE ALSO: + +@endnode + +@node localer_load "Localer / Load()" + + NAME: load(catalogname, version=0, builtin=NIL) + + SYNOPSIS: struct Catalog * load(STRPTR catalogname, long version = 0, STRPTR builtin = NULL) + + DESCRIPTION: This method loads a locale's catalog. + + INPUTS: catalogname - The name of the catalog file to load. + Usually, it is the program name with the + suffix ".catalog" + + version - Catalog version. Default is 0, which means + "any catalog you'll find..." + + builtin - Built in language. (Eg. "english") + + RESULTS: The method returs a pointer to a valid catalog handle or NIL. + + SEE ALSO: @{" get() " LINK localer_get} + @{" clear() " LINK localer_clear} + +@endnode + +@node Localer_get "Localer / get() " + + NAME: get(message_number, defstring=NIL) + + SYNOPSIS: STRPTR get(int message_number, STRPTR defstr = NULL) + + DESCRIPTION: This method gets a message string from an opened catalog and + returns it. + + INPUTS: message_number - Number of the message string in the catalog. + + defstring - Message string to return if any error occurs. + (Default is NIL) + + RESULTS: a message string or NIL. + + SEE ALSO: @{" load() " LINK Localer_load} + +@endnode + +@node localer_clear "Localer / clear() " + + NAME: clear() + + SYNOPSIS: void clear() + + DESCRIPTION: This method clears a catalog file from the memory. + After this method is invoked, you'll never be able to + access messages strings contained inside your catalog, + unless you open it again. + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: @{" load() " LINK Localer_load} + +@endnode + +@node localer_language "Localer / language() " + + NAME: language() + + SYNOPSIS: STRPTR language() + + DESCRIPTION: This method returns the name of the current language used by the + user. + + INPUTS: NONE + + RESULTS: a PTR TO CHAR (STRPTR) containing the name of the current language. + + NOTE: The name of the language is always ended with ".language" extension. + So, for ex., "italiano" is "italiano.language" + + SEE ALSO: + +@endnode + +@node localer_version "Localer / version() " + + NAME: version() + + SYNOPSIS: long version(rev=FALSE) + + DESCRIPTION: This method returns class version and revision. + + INPUTS: NONE + + RESULTS: Class version and revision. + + NOTE: This method returns TWO values. + + The C++ method has been translated in this way: + invoking version() without any parameter, will return + the class VERSION; calling it with TRUE as parameter + will return class REVISION. + + SEE ALSO: + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Mousepointer.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Mousepointer.guide new file mode 100644 index 0000000..d8c5089 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Mousepointer.guide @@ -0,0 +1,289 @@ +@database Mousepointer.guide + +@$VER: Mousepointer V1.00 - by Andrea Galimberti - (C) Brighting Brain Brothers + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node main "AFC Module: mousepointer / Main" + + + ** Mousepointer V1.00 - Original By Andrea Galiberti ** + + Part of Amiga Foundation Classes + + + + + @{" Introduction " LINK obj_intro} @{" Author(s) Info " LINK author} + + + Requires: @{" Hardsprite " LINK "hardsprite.guide/Main"}, @{" Displayer " LINK "displayer.guide/Main"}, @{" nodemaster " LINK "Nodemaster.guide/Main"} + + Base: $8002 + + COMMANDS BRIEF DESCRIPTION + ----------------------------------------------------------------------- + @{" mousepointer() " LINK mousepointer} Initialises the mousepointer object + @{" image() " LINK mouse_image} Stores the mouse image + @{" changeImage() " LINK mouse_changeimage} Changes the mouse image + @{" hotspot() " LINK mouse_hotspot} Sets the hotspot + @{" move() " LINK mouse_move} Moves the mouse + @{" x() " LINK mouse_x} Returns x coordinate + @{" y() " LINK mouse_y} Returns y coordinate + @{" update() " LINK mouse_update} Updates mouse position + @{" auto() " LINK mouse_auto} Auto updates mouse position + @{" vp() " LINK mouse_vp} Returns mouse viewport + @{" version() " LINK mouse_version} Gets mousepointer version + + @{" ERROR TABLE " LINK Error_Table} + +@endnode + +@node author "Author(s) Info" + + Original By: Andrea Galimberti + + E Version By: Andrea Galimberti + +@endnode + +@node obj_intro "Mousepointer / Introduction" + + Mousepointer. + + + This MODULE exploits the Hardsprite MODULE TO move a pointer around a +viewport. You can move the pointer sprite by hand, or allow the module do +it for you by reading the mouse hardware registers (update() method). The +mouse sprite can be automatically clipped to a chosen viewport. If you use +this module in conjunction with the Displayer module, you can have your +mouse sprite automatically pass from one viewport to another taking care of +the changing resolution of the different viewports (auto() method). Of +course the mouse sprite image can be changed at your will. + +@endnode + +@node Error_Table "Mousepointer / Error Table" + +Val (Hex) | Description +-----------+------------------------------------------------------ + none | + +@endnode + +@node mousepointer "AFC module: mousepointer / mousepointer()" + + NAME: mousepointer(number=-1) + + DESCRIPTION: Initialises a mousepointer object. + + INPUTS: number of the (hardware) sprite (from 0 to 7) to be used to + represent the pointer on the screen. The default value of + -1 means that it will be allocated the first sprite + available. + + RESULTS: FALSE if the requested sprite is already in use and so it + couldn't be allocated. + TRUE otherwise. + + SEE ALSO: @{" hardsprite / hardsprite() " LINK "hardsprite.guide/hardsprite"} + +@endnode + +@node mouse_image "AFC module: mousepointer / image()" + + NAME: image(height, list:PTR TO INT) + + DESCRIPTION: this method stores the image to be used with the mouse + sprite. Whenever this method is called, it will discard + the previous image. + + INPUTS: height (in lines) of the image, + a typed list (it MUST be typed to INT) in the following + form: + + [ $0000, $0000, + $0000, $0000, + ... ]:INT + + ^ ^ + | | + | second bitplane (16 bits wide) + | + first bitplane (16 bits wide) + + This way you can select one of 4 colours for each pixel of + the sprite's image. + + RESULTS: returns FALSE if: sprite non allocated (with mousepointer()), + height<=0, + pointer to list =NIL. + The hardsprite will raise "No Memory" if it cannot allocate + the (CHIP) memory for the image. + + SEE ALSO: @{" hardsprite / image() " LINK "hardsprite.guide/sprite_image"} + +@endnode + +@node mouse_changeimage "AFC module: mousepointer / changeImage()" + + NAME: changeImage(viewport) + + DESCRIPTION: changes the mouse sprite image to the stored one. + + INPUTS: pointer to a viewport structure. If this pointer is <>NIL + then the change will affect only the chosen viewport; if + pointer=NIL then the change is relative to the current + view. + + RESULTS: FALSE if viewport<0 or mouse not allocated. + Otherwise TRUE. + + SEE ALSO: @{" image() " LINK mouse_image} + @{" hardsprite / changeImage() " LINK "hardsprite.guide/sprite_changeimage"} +@endnode + +@node mouse_hotspot "AFC module: mousepointer / hotspot()" + + NAME: hotspot(x,y) + + DESCRIPTION: sets the mouse hotspot + + INPUTS: x and y coordinates of the mouse hotspot: these coordinates + are relative to the top-left hand corner of the mouse + image. (Negative values are allowed.) + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node mouse_update "AFC module: mousepointer / update()" + + NAME: update(viewport, hclip=TRUE, vclip=TRUE) + + DESCRIPTION: when called, this method moves the pointer hotspot to the + new mouse coordinates relative to the top-left hand corner + of the chosen viewport. + + INPUTS: viewport: pointer to a viewport structure; if this pointer + is NIL then the pointer movements are relative to the + current view. + + hclip: TRUE= pointer hotspot cannot exceed the horizontal + dimensions of the viewport (this flag is switched + automatically to FALSE if viewport=NIL, because in this + case there aren't any bounds to check for). + + vclip: same as hclip, but for the vertical direction. + + RESULTS: NONE + + SEE ALSO: @{" auto() " LINK mouse_auto} + +@endnode + +@node mouse_move "AFC module: mousepointer / move()" + + NAME: move(viewport, x,y) + + DESCRIPTION: moves the mouse image to the desired location on a + viewport (either Intuition or hand made), taking care of + the hotspot position. + + INPUTS: viewport: pointer to a viewport structure, + x and y coordinates of the site where to move the mouse + hotspot. + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node mouse_x "AFC module: mousepointer / x()" + + NAME: x() + + DESCRIPTION: returns the x coordinate of the mouse hotspot + + INPUTS: NONE + + RESULTS: x coordinate of mouse hotspot + + SEE ALSO: @{" y() " LINK mouse_y} + +@endnode + +@node mouse_y "AFC module: mousepointer / y()" + + NAME: y() + + DESCRIPTION: returns the y coordinate of the mouse hotspot. + + INPUTS: NONE + + RESULTS: y coordinate of mouse hotspot + + SEE ALSO: @{" x() " LINK mouse_x} + +@endnode + +@node mouse_auto "AFC module: mousepointer / auto()" + + NAME: auto(vo:PTR TO displayer, hclip=TRUE) + + DESCRIPTION: when called, moves the pointer hotspot to the new + coordinates, taking care of changing viewport if necessary + and automatically switching to the new resolution. One + thing you must be aware of: when you position the mouse + sprite in the first viewport you have also to set the + correct mouse hotspot for that resolution; the auto() + method then takes care of rescaling the hotspot coordinates + when the resolution changes. + + INPUTS: vo: pointer to a displayer (see the BuildView module + documentation); this pointer contains all the information + concerning dimensions and resolutions of all the viewports + displayed in the current view. + + hclip: TRUE= pointer hotspot cannot exceed the horizontal + dimensions of the current viewport. + + RESULTS: NONE + + SEE ALSO: @{" update() " LINK mouse_update} + +@endnode + +@node mouse_vp "AFC module: mousepointer / vp()" + + NAME: vp() + + DESCRIPTION: returns the number (starting from 0) of the viewport the + mouse sprite is in. This value is meaningful only if you + are using the auto() method to move the mouse. + + INPUTS: NONE + + RESULTS: number of viewport the mouse is in + + SEE ALSO: @{" auto() " LINK mouse_auto} + +@endnode + +@node mouse_version "AFC module: mousepointer / version()" + + NAME: version() + + DESCRIPTION: returns the version number of the Mouse module. + + INPUTS: NONE + + RESULTS: version, revision of mousepointer + + SEE ALSO: + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/NodeMaster.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/NodeMaster.guide new file mode 100644 index 0000000..8788b83 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/NodeMaster.guide @@ -0,0 +1,855 @@ +@database NodeMaster.guide + +@$VER: NodeMaster V3.40 - (C)Amiga Foundation Classes + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node "Main" "Amiga-E Module: NodeMaster" + + + + ** NodeMaster - Original By Fabio Rotondo ** + + ** This Object is part of the Amiga Foundation Classes ** + + ** DOCUMENTATION GUIDE ** + + @{" Introduction " link "NodeMaster_introduction" 0} @{" Author Info " LINK "author"} @{" History " link "NodeMaster_history" 0} @{" Amiga Foundation Classes " LINK "afc.guide/main"} + + Requires: Nothing. + + Base: $0001 + + COMMANDS BRIEF DESCRIPTION + ------------------------------------------------------------------------- + @{" nodemaster() " link "NodeMaster_NodeMaster" 0} Initializes the NodeMaster object + @{" add(object, mode=NM_ADD_TAIL) " link "NodeMaster_add" 0} Add obejct to the list + @{" addr() " link "NodeMaster_addr" 0} Get the pointer to the Exec list + @{" change(object) " link "NodeMaster_change" 0} Change current node object + @{" changenum(newnum) " link "NodeMaster_changenum" 0} Change current node ordinal number + @{" changepos(node) " link "NodeMaster_changepos" 0} Change current node position + @{" clear() " link "NodeMaster_clear" 0} Clear ALL list + @{" clearstack() " link "NodeMaster_clearstack" 0} Clears all push()ed items + @{" del() " link "NodeMaster_del" 0} Delete the current node + @{" empty() " link "NodeMaster_empty" 0} Check if there are nodes in list + @{" error() " link "NodeMaster_error" 0} Returns last error code + @{" first() " link "NodeMaster_first" 0} Jump to the first node + @{" get() " link "NodeMaster_get" 0} Get the pointer to the current node + @{" insert(object) " link "NodeMaster_insert" 0} Insert an object AFTER the current one + @{" isfirst() " link "NodeMaster_isfirst" 0} Checks if the current item is the first + @{" islast() " link "NodeMaster_isfirst" 0} Checks if the current item is the last + @{" item(numitem) " link "NodeMaster_item" 0} Jump to the specific item + @{" last() " link "NodeMaster_last" 0} Jump to the last node + @{" obj() " link "NodeMaster_obj" 0} Get the PTR of the current object + @{" numitems() " link "NodeMaster_numitems" 0} Return number of nodes in memory + @{" numpos() " link "NodeMaster_numpos" 0} Returns current ordinal position + @{" pop(pos=TRUE) " link "NodeMaster_pop" 0} Get a node from the stack + @{" prev() " link "NodeMaster_prev" 0} Go to the previous node + @{" push() " link "NodeMaster_push" 0} Push a node on the stack + @{" sort(sortroutine, info=NIL) " link "NodeMaster_sort" 0} Sort a list of items + @{" succ() " link "NodeMaster_succ" 0} Go to the next node + @{" version() " link "NodeMaster_version" 0} Returns class version AND revision + + @{" Error Table " LINK "NodeMaster_ErrorTable"} + +@endnode + +@node author "Author(s) Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + C++ Version By: Massimo Tantignone (tanti@intercom.it) + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) + --------------------------------------------------------------------------- + + Massimo Tantignone + + ITALY + + e-mail: tanti@intercom.it + + Web: http://www.intercom.it/~amigaws +@endnode + +@node "NodeMaster_history" "History" + +Legend: NEW - New feature + ADV - Advanced feature + FIX - Bug fix + +V3.40 - NEW: Added error() method. + - NEW: Added isfirst() method. + - NEW: Added islast() method. + +V3.30 - FIX: Fixed a minor bug in the clear() method. + - ADV: Clear routine optimized. + - ADV: Better docs. + - NEW: Added islast() method. + - NEW: Added isfirst() method. + - NEW: Added version() method. + - ADV: List constructors are INSIDE NodeMaster source for better porting. + +V3.20 - ADV: Optimized code. + - ADV: Now nodemaster() calls clearstack() instead of freeing stack's memory by itself. + - ADV: Now clear() calls clearstack() instead of freeing stack's memory by itself. + - ADV: clearstack() is faster. + - ADV: add() now is faster (and shorter!) + - ADV: removed all internal self.empty() calls and replaced with the (faster) + IsListEmpty() macro. + - ADV: Now item() patches positions <0 + +V3.10 - ADV: clear() modified: now the LIST IS correctly initialized. + - FIX: now frees the LIST pointer correctly. + + +V3.00 - ADV: General Optimizations + - ADV: Now first(), prev(), succ(), last(), change(), item(), insert(), add() + return the item address (instead of TRUE) and FALSE when there are + no more items. + - ADV: Now stacked push() and pop() have 8 stack levels!! + - ADV: Now pop() has an optional parameter (pos=TRUE): set it to FALSE if + you want just to free a stacked push() + - NEW: method clearstack() to free all push()ed positions. + - FIX: empty() used to crash when used after a del() with no items. + - NEW: sort() method. Incredibly fast and general-purpose sort algo + written by Andrea Galimberti. + - ADV: optimized prev() and succ() methods. Now about 20% faster. + - ADV: changepos() modified: now checks agaings no items, and return the + data inside the item or NIL. + - ADV: del() modified: now returns the pointer to the data inside the + next active node. + - FIX: pos() has been renamed numpos() + - FIX: now SN_ADD_TAIL, SN_ADD_HERE, SN_ADD_HEAD are called: + NM_ADD_TAIL, NM_ADD_HERE, NM_ADD_HEAD (short: change the SN_ + with NM_) + - ADV: change() method is now smarter and returns PTR TO obj data or + FALSE. + - ADV: better docs and examples. +@endnode + +@node "NodeMaster_introduction" "Introduction" + +INTRODUCTION + +NodeMaster is a generic object handling module which will allow you to easily +create lists of whatever you want. Its generic structure is ideal for +polimorphism and inheritance in other objects. This object just take care of +creating Exec Lists and Nodes of something you pass to it (we will call it +"object") and then it has great power in Lists manipulation. You can easily +add/del nodes from the list, go to a specific item by its ordinal number and so +on... + +I have worked out this module structuring it on Amiga Exec's Nodes. This means +that everything you will add/remove to a NodeMaster will be done on a System +List Node. + +This code is very Exec List-based, so you can do whatever you want. + +Main features are: + + * Push/Pop commands to save/restore a special node position. + + * Insert command to add a object AFTER another (usually it is added as Last + node) + + * Search command to scan trought the list looking for a string. + + * Item command to go to a specific item by its ordinal number. + +NEW V2.0 Version features: + + * New method pos() which returns the actual ordinal node position! + + * Enhanced item() method: now it does not scans from first() item to + selected, but just +/- delta objects from the starting point. + + * Internal sniff-snuff ;) + + * NO MORE ENFORCER'S HITS! ;) + + * Returns Raise() errors instead of return codes!! + + * More examples! + +NEW V2.10 Version features: + + * New changenum() method to force NodeMaster to change the + internal ordinal number of current node. + + * More code sniff-snuff ;) + +NEW V3.00 Version features: + + * General improvements in speed. + + * NEW! Low-Level tree-algo sort (FAST!!) + + * Now push() and pop() has 8 levels of stack!!! + + * Now NodeMaster is part of the @{" Amiga Foundation Classes " LINK "afc.guide/main"} + +@endnode + +@node "author" "Author's Infos " + + Original Object by: Fabio Rotondo (fsoft@intercom.it) + + E Module by: Fabio Rotondo (fsoft@intercom.it) +@endnode + +@node "example" "Example Program" + + With NodeMaster two examples are provided: + + The first one is a _GREAT_ example, which opens as many EasyGUIs as + you want (memory limiting...) and handle events from all of them ;) + + The second is just a demo of pos() and item() command based upon strings. + + PLEASE, refer to StringNode.lha archive for a demo of NodeMaster and + StringNode objects (this one inherits all methods of NodeMaster ;) + + + Thank You! +@endnode + +@node NodeMaster_ErrorTable "NodeMaster / Error Table" +ERROR VALUE | DESCRIPTION +----------------+------------------------------------- + $0000 | No Memory + +@endnode + +@node "NodeMaster_NodeMaster" "Amiga Foundation Classes Module: NodeMaster/NodeMaster()" + + NAME: NodeMaster() + + SYNOPSIS: nodemaster(void) + + DESCRIPTION: Use this command to inizialize a NodeMaster object. + + INPUT: NONE. + + RESULTS: NONE. + + SEE ALSO: +@endnode + +@node "NodeMaster_add" "Amiga Foundation Classes Module: NodeMaster/add()" + + NAME: add(object:PTR TO LONG, mode=SN_ADD_TAIL) + + SYNOPSIS: APTR add(APTR s, ULONG mode = NM_ADD_TAIL) + + DESCRIPTION: Use this command to add an object to the list. + + INPUT: object - PTR TO LONG. This is the object to add. + mode - (OPTIONAL) This flag is very useful to + choose _where_ a new node will be added. + Default is as last one, but you can + add it as the first line or in the middle + of the list (same as insert() command). + + Possible values are: + + NM_ADD_HEAD - Use this one to add the node + as the first in list. + + NM_ADD_HERE - Use this one to add the node + AFTER the current one. + (Same as insert() method) + + NM_ADD_TAIL - (Default) Use this one to add + the node as the last in list. + + + RESULTS: PTR TO obj - PTR TO add()ed obj: everything went fine. + + Raise() - An exception in case of problems. + + NOTE: Starting from V3.00, NodeMaster will return the PTR TO obj + you have just add()ed, if successfull. + + Note also that constants SN_ADD_* are now called NM_ADD_*. + + Please, be careful and *NOT* use NM_ADD_HERE if you do not + know for sure that your list is not empty: empty list can + cause problems. If you want to do things in a safe way + use the insert() method, instead of add(). + + SEE ALSO: @{" insert() " link NodeMaster_insert} + @{" del() " link "NodeMaster_del" 0} + @{" name() " link "NodeMaster_name" 0} + @{" item() " link "NodeMaster_item" 0} +@endnode + +@node "NodeMaster_get" "Amiga Foundation Classes Module: NodeMaster/get()" + + NAME: get() + + SYNOPSIS: Node *get(void) + + DESCRIPTION: Use this command to get a pointer to the current Exec List + node. + + INPUT: NONE. + + RESULTS: A PTR TO ln (An Exec List Node) + + SEE ALSO: @{" addr() " link "NodeMaster_addr" 0} +@endnode + +@node "NodeMaster_addr" "Amiga Foundation Classes Module: NodeMaster/addr() " + + NAME: addr() + + SYNOPSIS: List *addr(void) + + DESCRIPTION: Use this command to get the addr of the Exec List. + + INPUT: NONE. + + RESULTS: A PTR TO lh (an Exec List Header). + + NOTE: This command is useful expecially with ListView gadgets + which requires a PTR TO an Exec List Header. All you have + to do is: + Gt_SetGadgetAttrsA(listgad, win, req, + [GTLV_LABELS, NodeMasterobj.addr(), 0,0]) + + And the ListView will show your new list. + Please refer to RMKM and autodocs for more infos regarding + Gadtools and ListViews. + + SEE ALSO: @{" get() " link "NodeMaster_get" 0} +@endnode + +@node "NodeMaster_push" "Amiga Foundation Classes Module: NodeMaster/push()" + + NAME: push() + + SYNOPSIS: BOOL push(void); + + DESCRIPTION: Use this command to memorize the current node position. + + INPUT: NONE. + + RESULTS: TRUE - push()ing successful. + + FALSE - push()ing failed (out of stack space, or no items) + + NOTE: * From V2.00 it does not restore the internal ordinal number. + See @{" item() " LINK "NodeMaster_item" 0} for a better + explanation. + + * Starting from V3.00 now push() and pop() have 8 stack levels. + + SEE ALSO: @{" pop() " link "NodeMaster_pop" 0} + @{" first() " link "NodeMaster_first" 0} + @{" last() " link "NodeMaster_last" 0} + @{" changepos() " link "NodeMaster_changepos" 0} + @{" changenum() " link "NodeMaster_changenum" 0} +@endnode + +@node "NodeMaster_pop" "Amiga Foundation Classes Module: NodeMaster/pop()" + + NAME: pop(pos=TRUE) + + SYNOPSIS: APTR pop(BOOL autopos = TRUE) + + DESCRIPTION: Use this command to restore current node to the one + previously Push()ed. + + INPUT: pos - (default TRUE) this is a boolean flag. + + TRUE, restores the previously push()ed + node in list. + + FALSE, just removes the push()ed node from + the stack. + + RESULTS: PTR TO obj - if pop() succeded and pos=TRUE. + + FALSE - not pop()ed or pos=FALSE. + + NOTE: * If no node was Push()ed the current node won't change. + + * From V2.00 it does not restore the internal ordinal number. + See @{" item() " LINK "NodeMaster_item" 0} for a better + explanation. + + * Starting from V3.00, push() and pop() have 8 stack levels. + + SEE ALSO: @{" push() " link "NodeMaster_push" 0} + @{" changepos() " link "NodeMaster_changepos" 0} + @{" changenum() " link "NodeMaster_changenum" 0} +@endnode + +@node "NodeMaster_obj" "Amiga Foundation Classes Module: NodeMaster/obj()" + + NAME: obj() + + SYNOPSIS: APTR obj(void); + + DESCRIPTION: Use this command to get the current node's PTR TO object. + + INPUT: NONE. + + RESULTS: PTR TO obj data to the current node object. + + SEE ALSO: @{" add() " link "NodeMaster_add" 0} +@endnode + +@node "NodeMaster_del" "Amiga Foundation Classes Module: NodeMaster/del()" + + NAME: del() + + SYNOPSIS: APTR del(void) + + DESCRIPTION: Use this command to delete the current node. + After deletion the CURRENT NODE will be the next one. + If the node you deleted was the last one, then the next + will be the previous one. + + INPUT: NONE. + + RESULTS: PTR TO next obj data. Starting from V3.00 del() method + returns the pointer to the next actual obj data, or NIL + if it was the last object avaible in list (ie. list empty) + + SEE ALSO: @{" clear() " link "NodeMaster_clear" 0} + @{" add() " link "NodeMaster_add" 0} + +@endnode + +@node NodeMaster_clearstack "Amiga Foundation Classes Module: NodeMaster/clearstack()" + + NAME: clearstack() + + SYNOPSIS: void clearstack(void) + + DESCRIPTION: Use this method to clear all push()ed nodes in stack. + + INPUT: NONE. + + RESULTS: push() stack will be cleared. + + SEE ALSO: @{" push() " link "NodeMaster_push" 0} + @{" pop() " link "NodeMaster_pop" 0} +@endnode + +@node "NodeMaster_numitems" "Amiga Foundation Classes Module: NodeMaster/numitems" + + NAME: numitems() + + SYNOPSIS: ULONG numitems(void) + + DESCRIPTION: Use this command to know how many items are added to the + list. + + INPUT: NONE. + + RESULTS: items - LONG. Number of items. + + SEE ALSO: @{" add() " link "NodeMaster_add" 0} + @{" del() " link "NodeMaster_del" 0} +@endnode + +@node NodeMaster_empty "Amiga Foundation Classes Module: NodeMaster/empty()" + + NAME: empty() + + SYNOPSIS: BOOL empty(void) + + DESCRIPTION: Use this command to check whether the list is empty or not. + + INPUT: NONE. + + RESULTS: TRUE - List is empty + FALSE - At least one item is present. + + SEE ALSO: +@endnode + +@node "NodeMaster_first" "Amiga Foundation Classes Module: NodeMaster/first()" + + NAME: first() + + SYNOPSIS: APTR first(void) + + DESCRIPTION: Use this command to jump to the first object in the list. + + INPUT: NONE. + + RESULTS: PTR TO first obj - Position correct. + FALSE - Cannot go to the first (maybe list empty). + + NOTE: Before V3.00 first() used to return TRUE when positioning + correctly to the first item, now it returns directly the + obj data, so you don't have to call the "obj()" method. + + SEE ALSO: @{" last() " link "NodeMaster_last" 0} + @{" del() " link "NodeMaster_del" 0} + @{" obj() " link "NodeMaster_obj" 0} + @{" search() " link "NodeMaster_search" 0} +@endnode + +@node "NodeMaster_last" "Amiga Foundation Classes Module: NodeMaster/last()" + + NAME: last() + + SYNOPSIS: APTR last(void) + + DESCRIPTION: Use this command to position current node to the last one. + + INPUT: NONE. + + RESULTS: PTR TO obj data - Operation successfull. + + FALSE - No items. + + NOTE: V3.00 - Now last() returns directly the obj data, so you + do not have to do a "obj()" anymore. + + SEE ALSO: @{" first() " link "NodeMaster_first" 0} + @{" item() " link "NodeMaster_item" 0} +@endnode + +@node "NodeMaster_succ" "Amiga Foundation Classes Module: NodeMaster/succ()" + + NAME: succ() + + SYNOPSIS: APTR succ(void) + + DESCRIPTION: Use this command to position current node to the next one in + list. + + INPUT: NONE. + + RESULTS: PTR TO obj - PTR TO obj data: positioning successful. + FALSE - No next items. + + NOTE: It is a structural problem linked TO this method. If you + add to NodeMaster some numbers (eg. 1, 2, 3, 4,...,n) + the class could give you a wrong result, when it encounters + a number "0", because it will return a "0" and you could assume + that it is a FALSE (no next items) value. + You should check using the @{" islast() " LINK "NodeMaster_islast"} method. + + SEE ALSO: @{" prev() " link "NodeMaster_prev" 0} + @{" islast() " link "NodeMaster_islast"} + @{" last() " link "NodeMaster_last"} +@endnode + +@node "NodeMaster_prev" "Amiga Foundation Classes Module: NodeMaster/prev()" + + NAME: prev() + + SYNOPSIS: APTR prev(void) + + DESCRIPTION: Use this command to go to the previous string in the list. + + INPUT: NONE. + + RESULTS: PTR TO obj - PTR TO obj data: positioning successful. + FALSE - No previous items. + + NOTE: see note in @{" succ() " LINK NodeMaster_succ} + + SEE ALSO: @{" succ() " link "NodeMaster_succ" 0} + @{" first() " link "NodeMaster_first" 0} + @{" last() " link "NodeMaster_last" 0} +@endnode + +@node "NodeMaster_insert" "Amiga Foundation Classes Module: NodeMaster/insert()" + + NAME: insert(object:PTR TO LONG) + + SYNOPSIS: APTR insert(APTR s) + + DESCRIPTION: Use this command to add an object AFTER the current node. + + INPUT: object - PTR TO CHAR. Object you want to add. + + RESULTS: PTR TO object data. + + NOTE: The current node WILL NOT change!!! + + SEE ALSO: @{" add() " link "NodeMaster_add" 0} + @{" name() " link "NodeMaster_name" 0} + @{" del() " link "NodeMaster_del" 0} + @{" item() " link "NodeMaster_item" 0} +@endnode + +@node "NodeMaster_item" "Amiga Foundation Classes Module: NodeMaster/item()" + + NAME: item(numitem) + + SYNOPSIS: APTR item(ULONG n) + + DESCRIPTION: Use this command to position current node to the ordinal + numitem node. + + INPUT: numitem - LONG. Ordinal value of node position. + + RESULTS: PTR TO obj data - Position correct. + + FALSE - List is empty. + + NOTES: V3.00 - Now this method() returns directly obj data when + called successfully, so you don't have to do an obj() anymore. + + From V2.00 this method changes a bit. Now it scans prev() or + succ() item starting from the current position. So it is + faster, but you have to be careful. + If you use the method changepos(), the internal ordinal + position is not changed. So you have to do a first() method + before calling item(). + + In any case, if you think that something in your source could + behaves differently, just do a first() method call and + everything will behaves as always. + + Also pop() and push() do not update internal ordinal position. + Do a first() also before an item() after them. + + SEE ALSO: @{" numitems() " link "NodeMaster_numitems" 0} + @{" changepos() " link "NodeMaster_changepos" 0} + @{" changenum() " link "NodeMaster_changenum" 0} +@endnode + +@node "NodeMaster_change" "Amiga Foundation Classes Module: NodeMaster/change()" + + NAME: change(data:PTR TO LONG) + + SYNOPSIS: PTR change(APTR s) + + DESCRIPTION: Use this command to change the PTR to the data field of + current object. + + INPUT: data - PTR TO LONG. New data to change the old one with. + + RESULTS: PTR TO obj data - Changin successful. + + FALSE - No change (maybe list empty) + + SEE ALSO: +@endnode + +@node NodeMaster_clear "Amiga Foundation Classes Module: NodeMaster/clear()" + + NAME: clear() + + SYNOPSIS BOOL clear(void) + + DESCRIPTION: Use this command to clear all items in the list. + + INPUT: NONE. + + RESULTS: The list will be completely empty. + + SEE ALSO: @{" del() " link NodeMaster_del} +@endnode + +@node NodeMaster_changepos "Amiga Foundation Classes Module: NodeMaster/changepos()" + + NAME: changepos(node:PTR TO ln) + + SYNOPSIS: APTR cngepos(Node *node) + + DESCRIPTION: Use this command to change current node position to another. + + INPUT: node - (PTR TO ln) new list node to change position to. + + NOTE: You *MUST* know exactly what you are doing. Passing a wrong + node as parameter could get to Software Failures and so on. + This command is designed only for "professional" user who + intend build new object inheriting this one. + + From V2.00 note also that it does not update internal ordinal + number. See @{" item() " LINK "NodeMaster_item" 0} + + RESULTS: The current node position will be changed. + + SEE ALSO: @{" first() " link "NodeMaster_first" 0} + @{" last() " link "NodeMaster_last" 0} + @{" item() " link "NodeMaster_item" 0} + +@endnode + +@node NodeMaster_numpos "Amiga Foundation Classes Module: NodeMaster/pos()" + + NAME: numpos() + + SYNOPSIS: LONG numpos(void) + + DESCRIPTION: Use this command to know the ordinal object position inside + the list. + + INPUT: NONE. + + RESULTS: The current ordinal node position is returned. + + SEE ALSO: @{" first() " link "NodeMaster_first" 0} + @{" last() " link "NodeMaster_last" 0} + @{" item() " link "NodeMaster_item" 0} +@endnode + +@node NodeMaster_changenum "Amiga Foundation Classes Module: NodeMaster/changenum()" + + NAME: changenum(newval) + + SYNOPSIS: void chaenum(ULONG newnum) + + DESCRIPTION: Use this command to change current node ordinal position + number. + + INPUT: newval - (LONG) new ordinal number to assign to the current + node. + + NOTE: You *MUST* know exactly what you are doing. Passing a wrong + value as parameter could get to Software Failures and so on. + This command is designed only for "professional" user who + intend build new object inheriting this one. + + RESULTS: The current node ordinal number will be changed. + + SEE ALSO: @{" first() " link "NodeMaster_first" 0} + @{" last() " link "NodeMaster_last" 0} + @{" item() " link "NodeMaster_item" 0} + @{" changepos() " link "NodeMaster_changepos" 0} +@endnode + +@node NodeMaster_sort "Amiga Foundation Classes Module: NodeMaster/sort()" + + NAME: sort(sortingroutine, info=NIL:PTR TO LONG) + + SYNOPSIS: APTR sort(LONG (*comp)(APTR, APTR, APTR APTR info = NULL) + + DESCRIPTION: Use this method to sort the list. + + INPUT: sortingroutine - You MUST provide a comparison routine, + which will be used to sort your list. + The comp routine should accept three + params: item1, item2 and info. + Item1 and item2 are the two items you + should compare; while info is an + optional param containing to whatever + you want. + Your comp routine MUST return a value: + + >1 - Item1 > Item2 + =0 - Item1 = Item2 + <0 - Item1 < Item2 + + Then items will be sorted accordingly + by the sort() method. + + info - (DEFAULT NIL) This is an optional param + that will be passed to your comp routine. + It can contain everything you like. + + RESULTS: PTR TO first obj data - list has been sorted. + + FALSE - sort() failed (maybe list empty) + + NOTE: After a sort(): + + + Stack will be cleared. + + Current item will be the first one. + + SEE ALSO: @{" push() " link "NodeMaster_push" 0} + @{" pop() " link "NodeMaster_pop" 0} + @{" clearstack() " link "NodeMaster_clearstack" 0} + @{" first() " link "NodeMaster_first" 0} +@endnode + +@node NodeMaster_version "Amiga Foundation Classes Module: NodeMaster/version()" + + NAME: version() + + SYNOPSIS: ULONG version(BOOL rev = FALSE) + + DESCRIPTION: Returns class version and revision. + + INPUT: NONE + + RESULTS: This method returns TWO values: class version and revision. + + PORTING NOTES: Because in C++ a function cannot return two values, we have + arranged the version/revision return values in this way: + by calling version() method with rev=FALSE you will be + returned the Class VERSION. If you set rev=TRUE, then you'll + get the Class REVISION. + + SEE ALSO: +@endnode + +@node "NodeMaster_islast" "Amiga Foundation Classes Module: NodeMaster/islast()" + + NAME: islast() + + SYNOPSIS: BOOL islast(void) + + DESCRIPTION: This method checks if the current item is the last one. + + INPUT: NONE. + + RESULTS: TRUE - The item is the last. + FALSE - The item is not the last. + + SEE ALSO: @{" isfirst() " link "NodeMaster_isfirst" 0} +@endnode + +@node "NodeMaster_isfirst" "Amiga Foundation Classes Module: NodeMaster/isfirst()" + + NAME: isfirst() + + SYNOPSIS: BOOL isfirst(void) + + DESCRIPTION: This method checks if the current item is the first one. + + INPUT: NONE. + + RESULTS: TRUE - The item is the first. + FALSE - The item is not the first. + + SEE ALSO: @{" islast() " link "NodeMaster_islast" 0} +@endnode + +@node "NodeMaster_error" "Amiga Foundation Classes Module: NodeMaster/error()" + + NAME: error() + + SYNOPSIS: ULONG error(void) + + DESCRIPTION: This method checks if the current item is the first one. + + INPUT: NONE. + + RESULTS: last error code. 0 means "no errors". + + SEE ALSO: +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/ReqTooller.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/ReqTooller.guide new file mode 100644 index 0000000..b76c1a7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/ReqTooller.guide @@ -0,0 +1,380 @@ +@database ReqTooller.guide + +@$VER: ReqTooller V1.01 - (C)Amiga Foundation Classes + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node Main "Amiga Foundation Classes: ReqTooller" + + + + ** ReqTooller - Original By Fabio Rotondo ** + + * Part of the Amiga Foundation Classes * + + @{" Introduction " link "ReqTooller_introduction"} @{" Author's Info " link "author"} @{" Amiga Foundation Classes " LINK "AFC.Guide/main"} + + Requires: + + Class Base: $000A0000 + + NEW COMMANDS BRIEF DESCRIPTION + ------------------------------------------------------------------------- + @{" reqtooller(libver=0) " link "ReqTooller_reqtooller"} Initailizes the class. + @{" setattrs(tags) " link "ReqTooller_SetAttrs"} Sets class attributes. + @{" get(tag) " link "ReqTooller_Get"} Gets class attributes. + @{" req(mode, tags=0) " link "ReqTooller_Req"} Opens a requester. + @{" version() " link "ReqTooller_version"} Returns class version. + + @{" Error Table " LINK ReqTooller_ErrorTable} +@endnode + +@node "ReqTooller_Introduction" "Introduction" + + INTRODUCTION + + This class handles reqtools requesters. + It is incredibly easy to use and it is completely tags-driven. + With this class you can create professional requester without having to + worry about how to allocate and deallocate reqtools structures: it minds + all about it. + + +@endnode + +@node "author" "Author's Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) + +@endnode + +@node ReqTooller_ErrorTable "ReqTooller / Error Table " + +VALUE | DESCRIPTION +----------------+---------------------------------- +$0000 | No Memory + + +@endnode + +@node "ReqTooller_reqtooller" "Amiga Foundation Classes: ReqTooller / reqtooller()" + + NAME: reqtooller(libver=0) + + DESCRIPTION: This method initializes the class. + + INPUT: libver - (Optional) Pass this param if you want a specific + version of reqtools.library to open. Default is 0 + which means "any version". + + RESULTS: NONE. + + SEE ALSO: +@endnode + +@node "ReqTooller_setattrs" "Amiga Foundation Classes: ReqTooller / setattrs()" + + NAME: setattrs(tags:PTR TO LONG) + + DESCRIPTION: This method is used to set class behaviours. + + INPUT: tags - a taglist. Avaible tags are: + + COMMON TAGS: + + RT_TITLE - Requester title. + + RT_WIN - Window where to open the requester on. + Pass a *valid* window pointer expecially if + you are using a custom screen and you don't + want the requester to open on the Workbench + screen. + + RT_LOCK - Set this tag to TRUE if you want the window + (set by RT_WIN) to be locked when the + requester appears. + + RT_UCHAR - Use this tag to define the "Underscore Char". + Default char is "_". + + FILE REQUESTER TAGS: + + RT_PATH - File Requester default path. + + RT_FILENAME - File Requester default file name. + + RT_PATTERN - File Requester default pattern. + + RT_OKGAD - String (max 4 chars) for the "OK" gadget + in the File Requester. You can, for example, + set "Load" or "Save" as "OK" gadget. + + RT_FULLNAME - Set this flag to TRUE if you want the full + path returned along with the file name. + + EASY, STRING and NUMBER REQUESTERS TAGS: + + RT_TEXT - You can specify a text inside the requester using + this tag. If you are opening an Easy requester, then + you can specify some "params", like strings and + numbers to be "dinamically" linked using the RT_ARGS + tags (see below). To specify strings use the usual + "\s" chars for E programs and "%s" for C++ programs. + Example: + + ... + RT_TEXT, "Your Name is: \s\nYou are \d years old.", + RT_ARGS, [name, age], + ... + + + + RT_GADS - You can specify all the gads to appear with this + tag. The string you pass *must* contain all the + gads divided by a "|" char. The last gad is + always the "Cancel" gadget. Example: + + "Ok|Great|No way!" + + Will show three gads: "Ok", "Great" and "No way!" + + If you pass a null string, will be just shown an + "Ok" gadget. + + RT_ARGS - Here you can specify a list of arguments to + pass to the Easy Requester. + NOTE: This tags only works with EASY requester. + + RT_INVISIBLE - Set this tag to TRUE if you want the text being + hidden (shadowed). + + RT_CHOICE - Default gadget that will be selected if the user + just presses RETURN key. If you want the default + gadget to be the "Cancel" button, then pass 0 as + value. The other gads are ordinally numbered + from 1 to n, from left to right. + + STRING REQUESTER TAGS: + + RT_MAXCHARS - Max chars that can be typed by the user. + + RT_DEFSTR - Default string requester string. + + NUMBER REQUESTER TAGS: + + RT_MINVAL - Minumum value the user can insert. + + RT_MAXVAL - Maximum value the user can insert. + + RT_NUM - Default number (please, use RT_DEFVAL). + + RT_DEFVAL - Default value in the Number requester. + + FONT REQUESTER TAGS: + + RT_FONTNAME - Default font name. + + RT_FONTSIZE - Default font size. + + RT_FONTFLAGS - Flags for the font requester. See reqtools.library + documentation for further info. + + RT_FONTSTYLE - Font style requester flags. See reqtools.library + documentation for further info. + + SCREEN MODE REQUESTER TAGS: + + RT_SCRID - Default Screen ID. + + RT_SCRWIDTH - Default Screen width. + + RT_SCRHEIGHT - Default Screen height. + + RT_SCRDEPTH - Default Screen depth. + + RT_SCROSCAN - Default Screen Overscan flag (TRUE/FALSE). + + RT_SCRASCROLL - Default Screen AutoScroll flag (TRUE/FALSE). + + PALETTE REQUESTER TAGS: + + RT_COLOR - Default selected color. + + NOTE: all these tags can be set also when you invoke a @{" req() " LINK "ReqTooller_req"} method. + + RESULTS: + + SEE ALSO: @{" get() " LINK "ReqTooller_get"} + @{" req() " LINK "ReqTooller_req"} +@endnode + +@node "ReqTooller_get" "Amiga Foundation Classes: ReqTooller / get()" + + NAME: get(tagname) + + DESCRIPTION: Use this method to get avaible values from the class. + + INPUT: tagname - Tag indicating the value you want. + Avaible value are: + + COMMOND TAGS: + + RT_TITLE - Returns default title. + + + FILE REQUESTER TAGS: + + RT_PATH - Returns actual path. + + RT_FILENAME - Return actual file name. + + + MULTIFILE REQUESTER TAGS: + + RT_MULTIFIRST - First file name selected by the user. + + RT_MULTINEXT - Next file name selected by the user. + + + FONT REQUESTER TAGS: + + RT_FONTNAME - Font name choosen by the user. + + RT_FONTSIZE - Font size choosen by the user. + + RT_FONTSTYLE - Font style choosen by the user. + + RT_FONTFLAGS - Font flags choosen by the user. + + + SCREEN REQUESTER TAGS: + + RT_SCRID - Screen Display ID value. + + RT_SCRWIDTH - Screen width. + + RT_SCRHEIGHT - Screen height. + + RT_SCRDEPTH - Screen depth. + + RT_SCROSCAN - Screen overscan value. + + RT_SCRASCROLL - Screen auto scroll. + + + STRING REQUESTER TAGS: + + RT_STRING - User inserted string. + + + NUMBER REQUESTER TAGS: + + RT_NUM - User inserted value. + + + PALETTE REQUESTER TAGS: + + RT_COLOR - User selected color. + + + RESULTS: the requested value is returned. + + SEE ALSO: @{" setattrs() " LINK "ReqTooller_SetAttrs"} + @{" req() " LINK "ReqTooller_Req"} + +@endnode + +@node "ReqTooller_req" "Amiga Foundation Classes: ReqTooller / req()" + + NAME: req(type, tags=NIL:PTR TO LONG) + + DESCRIPTION: This method opens a requester. + + INPUT: type - Type of requester. Avaible values: + + RTREQ_FILE - File requester. + + RTREQ_SAVE - Save file requester. + + RTREQ_PATH - Path requester. + + RTREQ_VOLUMES - Volumes requester. + + RTREQ_MULTI - Multi file requester. + + RTREQ_FONT - Font requester. + + RTREQ_COLFONT - Color font requester. + + RTREQ_SCREEN - Screen requester. + + RTREQ_ALLSCREEN - Screen requester showing ALL avaible screens + (also HAM and EHB modes). + + RTREQ_STRING - String requester. + + RTREQ_NUMBER - Number requester. + + RTREQ_EASY - Easy Requester. + + RTREQ_PALETTE - Palette requester. + + RTREQ_MESSAGE - Message requester. This is a very special + requester. It does not have *any* gadget: + you have to mind about opening and closing it. + This is just like an Easy requester, but with + no gadgets, so all the Easy requester tags will + work. + To close this requester, open a RTREQ_MESSAGE + with no text. + Example: + + req(RTREQ_MESSAGE, [RT_TEXT, 'Hi world!',0,0]) + Delay(100) + req(RTREQ_MESSAGE, [RT_TEXT, '',0,0]) + + RESULTS: this method returns the same thing that the corresponding + reqtools' requester should return. So, for example, the EasyRequester + returns the ordinal number of the pressed gadget. + + SEE ALSO: @{" setattrs() " LINK "ReqTooller_setattrs"} + @{" get() " LINK "ReqTooller_get"} +@endnode + +@node "ReqTooller_version" "Amiga Foundation Classes: ReqTooller / version()" + + NAME: version() + + DESCRIPTION: This method returns class version AND revision. + + INPUT: NONE. + + RESULTS: This method returns *two* values: version and revision. + + SEE ALSO: +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/StringNode.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/StringNode.guide new file mode 100644 index 0000000..80374bd --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/StringNode.guide @@ -0,0 +1,520 @@ +@database StringNode.guide + +@$VER: StringNode V3.10 - By Fabio Rotondo (C)Brighting Brain Brothers + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node "Main" "Amiga Foundation Classes Module: StringNode" + + + + ** StringNode_OO V3.0 - Original By Fabio Rotondo ** + + Part of The Amiga Foundation Classes + + @{" Introduction " link "StringNode_introduction" } @{" Author's Infos " link "author" } @{" Amiga Foundation Classes " LINK "afc.guide/main"} + + + Requires: @{" NodeMaster_oo " LINK "NodeMaster.guide/main"} + + Base: $0002 + + NEW COMMANDS BRIEF DESCRIPTION + ------------------------------------------------------------------------- + @{" stringnode() " link "StringNode_StringNode" } Initailizes the object + @{" add(string, mode) " link "StringNode_add" } Add a new string to the list + @{" addr() " link "StringNode_addr"} Returns memory address of the list + @{" change(string) " link "StringNode_change" } Changes the current object string + @{" clear() " link "StringNode_clear"} Free all strings in list + @{" del() " link "StringNode_del"} Deletes a string from the list + @{" empty() " link "StringNode_empty"} Checks for empty list + @{" first() " link "StringNode_first"} Pos on the first string in the list + @{" insert(string) " link "StringNode_insert" } Inserts a new string AFTER the current one + @{" item(num) " link "StringNode_item"} Pos on a specific item + @{" last() " link "StringNode_last"} Pos on the last String in the list + @{" numitems() " link "StringNode_numitems"} Returns the number of strings in the list + @{" obj() " link "StringNode_obj" } Returns the current string. + @{" pop(pos=TRUE) " link "StringNode_pop"} Pops to the current stacked string + @{" pos() " link "StringNode_pos"} Returns numeric position of a string in the list + @{" prev() " link "StringNode_prev"} Pos on the previous string in the list + @{" push() " link "StringNode_push"} Pushes current string in the stack + @{" search(string, fromhere=FALSE) " link "StringNode_search" } Search for a specific string + @{" setattrs(taglist) " link "StringNode_setattrs" } Change StringNode's behaviours + @{" sort(nocase=FALSE, inverted=FALSE) " link "StringNode_sort" } Sort All Items By Name + @{" succ() " link "StringNode_succ"} Pos on the next string in the list + @{" version() " link "StringNode_version"} Returns Class version + + @{" Tags Table " LINK "StringNode_tagstable" } + + @{" Error Table " LINK "StringNode_errortable"} + +@endnode + +@node "stringnode_introduction" "StringNode Introduction" + + StringNode is a object to handle lists of strings. + + These lists are standard Exec lists and all handling functions are +inherited by the ROOTCLASS NodeMaster_oo. But StringNode has some unique +features to handle correctly strings without memory loss or something like +that. You will also have the method "addr()" to get a pointer to the List so +you can easily add a list of items to a ListView gadget! + + Main features are: + + * Very Fast String Sorting Algorithm. + + * Very Flexible String Sorting Algo: + + - case (in)sensitive + - from a...z or z...a + + * Search routines use AmigaDOS MatchNoPattern() functions! + + - You can do searches with patterns like: + + "#?.IN#?" or "~(#?.INFO)" !!! + + * Return Raise() errors! + +NEW V2.10 features: + + * Enhanced search() method: now it updates also numeric pos! + + * Enhanced sort() method: now it is 60% faster than the original! + + * Enhanced change() method: now allows less memory fragmentation. + + * Added a new (and expandible) method: setattrs(). + + NOTE: a very big THANK YOU must go to Andrea Galimberti aka Kronos + for helping me in creating a new and fast sort() method!!! + +V3.00 features: + + * Restructured code. + + * Implemented new NodeMaster sort() method + + * Optimized code + + * Now StringNode is part of Amiga Foundation Classes + +@endnode + +@node "StringNode_tagstable" "Amiga Foundation Classes Modules: StringNode/TAGS TABLE" + TAG NAME | VALUES(DEFAULT) | DESCRIPTION +-----------------+---------------------+------------------------------------- +TAGSTR_MAXCHARS | 0..32768 (128) | Max number of chars to leave unused. +@endnode + +@node "StringNode_ErrorTable" "Amiga Foundation Classes Modules: StringNode/Error Table" +ERROR CODE | DESCRIPTION +-----------------+----------------------------------------------------------- + $0000 | No Memory +@endnode + +@node author "Author(s) Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) +@endnode + +@node "stringnode_stringnode" "StringNode_oo/stringnode()" + NAME: stringnode() + + DESCRIPTION: Use this command to initialize the object. + + INPUT: NONE + + RESULTS: NONE. + + NOTE: Starting from V2.10 TAGSTR_MAXCHARS value is set to 128. + Please, refer to @{" change() " LINK "StringNode_change" } and @{" setattrs() " LINK "StringNode_setattrs" } methods. + + SEE ALSO: @{" change() " LINK "StringNode_change" } + @{" setattrs() " LINK "StringNode_setattrs" } + + @{" NodeMaster/change() " LINK "NodeMaster.guide/NodeMaster_change"} +@endnode + +@node StringNode_add "Amiga Foundation Classes Modules: StringNode/add()" + NAME: add(string:PTR TO CHAR) + + DESCRIPTION: Use this command to add a string to the list. + + INPUT: string - PTR TO CHAR, the string you wish to add. + + RESULTS: a PTR to String - No errors. + a Raise()d exception - Possible problems. + + SEE ALSO: @{" NodeMaster/add() " LINK "NodeMaster.guide/NodeMaster_add"} +@endnode + +@node StringNode_insert "Amiga Foundation Classes Modules: StringNode/insert()" + NAME: insert(string:PTR TO CHAR) + + DESCRIPTION: Use this command to add a string AFTER the current one. + + INPUT: string - PTR TO CHAR. String to insert. + + RESULTS: a PTR to String - No Errors. + a Raise()d exception - Problems. + + SEE ALSO: @{" NodeMaster/insert() " LINK "NodeMaster.guide/NodeMaster_insert"} +@endnode + +@node StringNode_obj "Amiga Foundation Classes Modules: StringNode/obj()" + NAME: obj() + + DESCRIPTION: This command returns the current node string. + + INPUT: NONE. + + RESULTS: A PTR TO CHAR to the current node string. + + SEE ALSO: @{" NodeMaster/obj() " LINK "NodeMaster.guide/NodeMaster_obj"} +@endnode + +@node "StringNode_first" "Amiga Foundation Classes Modules: StringNode/first()" + NAME: first() + + DESCRIPTION: This method pos the class to the first String in the list. + + INPUT: NONE + + RESULTS: a PTR to String - first() succeded. + + NIL - first() failed. (Maybe list is empty) + + SEE ALSO: @{" NodeMaster/first() " LINK "NodeMaster.guide/NodeMaster_first"} + +@endnode + +@node "StringNode_succ" "Amiga Foundation Classes Modules: StringNode/succ()" + NAME: succ() + + DESCRIPTION: This method pos the class to the next String in the list. + + INPUT: NONE + + RESULTS: a PTR to String - succ() succeded. + + NIL - succ() failed. (We are on the last item) + + SEE ALSO: @{" NodeMaster/succ() " LINK "NodeMaster.guide/NodeMaster_succ"} + +@endnode + +@node "StringNode_prev" "Amiga Foundation Classes Modules: StringNode/prev()" + NAME: prev() + + DESCRIPTION: This method pos the class to the previous String in the list. + + INPUT: NONE + + RESULTS: a PTR to String - prev() succeded. + + NIL - prev() failed. (We are on the first item.) + + SEE ALSO: @{" NodeMaster/prev() " LINK "NodeMaster.guide/NodeMaster_prev"} + +@endnode + +@node "StringNode_push" "Amiga Foundation Classes Modules: StringNode/push()" + NAME: push() + + DESCRIPTION: This method pushes current string on the stack. + + INPUT: NONE + + RESULTS: TRUE - push() succeded. + + FALSE - push() failed. (Stack is full) + + SEE ALSO: @{" pop() " LINK "StringNode_pop"} + + @{" NodeMaster/push() " LINK "NodeMaster.guide/NodeMaster_push"} +@endnode + +@node "StringNode_pop" "Amiga Foundation Classes Modules: StringNode/pop()" + NAME: pop(pos=TRUE) + + DESCRIPTION: This method pops a stacked String. + + INPUT: pos - (default = TRUE) if pos is set to TRUE, the StringNode + class focuses on the pop()ed string, if it is set to + FALSE, then the current stack String is just freed. + + RESULTS: a PTR to String - pop() succeded. + + NIL - pop() failed or pos=FALSE. + + SEE ALSO: @{" push() " LINK "StringNode_push"} + + @{" NodeMaster/pop() " LINK "NodeMaster.guide/NodeMaster_pop"} + +@endnode + +@node "StringNode_addr" "Amiga Foundation Classes Modules: StringNode/addr()" + NAME: addr() + + DESCRIPTION: This method returns a PTR to the list allocated by StringNode. + + INPUT: NONE + + RESULTS: a PTR to an Exec List. + + NOTE: This function CANNOT fail: you should not be able to do an addr() + if the list isn't allocated because the object should raise an + exception during initialization. + + SEE ALSO: @{" NodeMaster/addr() " LINK "NodeMaster.guide/NodeMaster_addr"} + +@endnode + +@node "StringNode_del" "Amiga Foundation Classes Modules: StringNode/del()" + NAME: del() + + DESCRIPTION: This method deletes current String in the list. + + INPUT: NONE + + RESULTS: a PTR to next avaible string or NIL if list is empty. + + NOTE: This method "moves" inside the list in a particular way: + if you are deleting a string which is NOT the last, then + StringNode will pos to the next item, if it was the last, + it tries to move to the previous String, if nothing is + avaible, then it returns NIL. + + SEE ALSO: @{" NodeMaster/del() " LINK "NodeMaster.guide/NodeMaster_del"} + +@endnode + +@node "StringNode_empty" "Amiga Foundation Classes Modules: StringNode/empty()" + NAME: empty() + + DESCRIPTION: This method checks whether the list is empty or not. + + INPUT: NONE + + RESULTS: TRUE - List is empty + FALSE - At least one item is present + + SEE ALSO: @{" NodeMaster/empty() " LINK "NodeMaster.guide/NodeMaster_empty"} + +@endnode + +@node StringNode_change "Amiga Foundation Classes Modules: StringNode/change()" + NAME: change(string:PTR TO CHAR) + + DESCRIPTION: Use this command to change the current node string. + + INPUT: string - PTR TO CHAR, the new string you wish to replace + the existing one. + + RESULTS: a PTR to String - No Errors + a Raise()d exception - Memory problems. + + NOTE: Starting from V2.10, this method behaves quite differently + than before, to allow better control towards memory + fragmentation's problems. Now, before DisposeLink() + and do a new String(), change() checks whether or not the + new string passed to it would fit inside the current memory + area and how many bytes should be left unused. If they are + less than TAGSTR_MAXCHARS (Default is 128), the string is not + Disposed() and created again. Of course, if the new string is + bigger than the original, a new string is created. + + + SEE ALSO: @{" NodeMaster/change() " LINK "NodeMaster.guide/NodeMaster_change"} + @{" setattrs() " LINK "StringNode_setattrs" } +@endnode + +@node "StringNode_clear" "Amiga Foundation Classes Modules: StringNode/clear()" + NAME: clear() + + DESCRIPTION: This method clear all Strings in the list. + + INPUT: NONE + + RESULTS: the StringNode will be freed. + + SEE ALSO: @{" NodeMaster/clear() " LINK "NodeMaster.guide/NodeMaster_clear"} + +@endnode + +@node "StringNode_numitems" "Amiga Foundation Classes Modules: StringNode/numitems()" + NAME: numitems() + + DESCRIPTION: This method returns the number of Strings inside the list. + + INPUT: NONE + + RESULTS: a LONG containing the number of Strings in the list. + + NOTE: if the list is empty, this method returns 0. + + SEE ALSO: @{" NodeMaster/numitems() " LINK "NodeMaster.guide/NodeMaster_numitems"} + +@endnode + +@node "StringNode_item" "Amiga Foundation Classes Modules: StringNode/item()" + NAME: item(num) + + DESCRIPTION: This method to pos StringNode to the specific ordinal + String in the list. + + INPUT: num - LONG. Ordinal value of String position in the list. + + RESULTS: a PTR to CHAR - item() succeded. + + NIL - item() failed. + + NOTE: If num is greater than current items in the list, StringNode + will pos on the last item. + + SEE ALSO: @{" numitems() " LINK "StringNode_numitems"} + + @{" NodeMaster/item() " LINK "NodeMaster.guide/NodeMaster_item"} +@endnode + +@node "StringNode_last" "Amiga Foundation Classes Modules: StringNode/last()" + NAME: last() + + DESCRIPTION: This method pos StringNode on the last String in the list. + + INPUT: NONE. + + RESULTS: a PTR to CHAR - last() succeded. + + NIL - list is empty. + + SEE ALSO: @{" first() " LINK "StringNode_first"} + @{" item() " LINK "StringNode_item"} + + @{" NodeMaster/last() " LINK "NodeMaster.guide/NodeMaster_last"} + +@endnode + +@node "StringNode_pos" "Amiga Foundation Classes Modules: StringNode/pos()" + NAME: pos() + + DESCRIPTION: This method returns the numberic (ordinal) position + of the String in the list. + + INPUT: NONE + + RESULTS: a LONG value containing the ordinal position of the String + in the list. + + NOTE: If the StringNode is empty, this method returns 0. + + SEE ALSO: @{" item() " LINK "StringNode_item"} + + @{" NodeMaster/numpos() " LINK "NodeMaster.guide/NodeMaster_numpos"} + +@endnode + +@node "StringNode_search" "Amiga Foundation Classes Modules: StringNode/search()" + NAME: search(string:PTR TO CHAR, fromhere=FALSE) + + DESCRIPTION: Use this command to scan the list looking for a specific + string inside the node. + + INPUT: string - PTR TO CHAR. Pattern string to search. + (Standard AmigaDOS match patterns) + + fromhere - A BOOL value. + TRUE = Scan starting from current node. + FALSE = Scan starting from the first node. + + RESULTS: a PTR to String - Searching successful. + FALSE - Nothing found. + + + NOTES: * Search is NOT case sensitive. + + * Search support AmigaDOS MatchNoCase() functions. + So you can create Pattern String such as: + + "#?.INFO" or "~(#?.info)" and so on. + + * Search will position the current node to a valid value + IF Search() fails, the current node will not change. + + SEE ALSO: +@endnode + +@node "StringNode_setattrs" "Amiga Foundation Classes Modules: StringNode/setattrs()" + NAME: setattrs(tags:PTR TO LONG) + + DESCRIPTION: Use this command to change the way stringnode works. + At the moment just ONE single tag has been implemented, + but they'll grow as soon as new needs will raise. + + INPUT: setattrs - This is a list of tags. + Please, refer to @{" TAGS TABLE " LINK "StringNode_TagsTable" } + to know what tags are implemented. + + RESULTS: NONE. + + NOTE: REMEMBER TO END THE LIST WITH TAG_END or 0!!! + + SEE ALSO: @{" change() " LINK "StringNode_change" } + @{" Tags Table " LINK "StringNode_tagstable" } +@endnode + +@node StringNode_sort "Amiga Foundation Classes Modules: StringNode/sort()" + NAME: sort(nocase=FALSE, inverted=FALSE) + + DESCRIPTION: Use this command to sort by name all items in a object. + + INPUT: nocase - (OPTIONAL) if you set this to TRUE, the sort will + be done without case sense (but it is slower...) + + inverted - (OPTIONAL) if you set this to TRUE, the sort will + be done hight to low and not low-2-high as + default. + + RESULTS: The list will be completely sorted up. + + SEE ALSO: @{" NodeMaster/sort() " LINK "NodeMaster.guide/NodeMaster_sort"} +@endnode + +@node "StringNode_version" "Amiga Foundation Classes Modules: StringNode/version()" + NAME: version() + + DESCRIPTION: This method returns StringNode version and revision values. + + INPUT: NONE + + RESULTS: this method returns TWO values, version and revision. + + SEE ALSO: +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Tasker.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Tasker.guide new file mode 100644 index 0000000..59f8633 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Tasker.guide @@ -0,0 +1,452 @@ +@database Tasker.guide + +@$VER: Tasker V1.02 - by Andrea Galimberti - (C) Brighting Brain Brothers + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node main "AFC Module: tasker/Main" + + + ** Tasker V1.02 - Original By Andrea Galimberti ** + + Part of Amiga Foundation Classes + + + + + @{" Introduction " LINK task_intro} @{" Author(s) Info " LINK author} + + + Requires: + + Base: $8004 + + COMMANDS BRIEF DESCRIPTION + ----------------------------------------------------------------------- + @{" tasker() " LINK tasker} Initialises the object + @{" code() " LINK task_code} Selects the task code + @{" stack() " LINK task_stack} Sets the task stack dimension + @{" start() " LINK task_start} Starts a TASK + @{" stop() " LINK task_stop} Stops a task or a process + @{" process() " LINK task_process} Starts a PROCESS + @{" buildport() " LINK task_buildport} Creates a port for the TASK + @{" endport() " LINK task_endport} Kills the task message port + @{" port() " LINK task_port} Returns the task port + @{" dosport() " LINK task_dosport} Returns the process DOS port + @{" send() " LINK task_send} Sends a message to the task + @{" dossend() " LINK task_dossend} Sends a message to the process' DOS port + @{" version() " LINK task_version} Returns tasker version + + Procedures: + + @{" storea4() " LINK t_storea4} Stores the E global data pointer + @{" geta4() " LINK t_geta4} Gets the E global data pointer + @{" buildPort() " LINK t_buildport} Creates a message port + @{" endPort() " LINK t_endport} Kills a message port + @{" setupMsg() " LINK t_setupmsg} Prepares a message to be sent + @{" sendMsg() " LINK t_sendmsg} Safely sends a message to a port + + + @{" ERROR TABLE " LINK Error_Table} + +@endnode + +@node author "Author(s) Info" + + Original By: Andrea Galimberti + + E Version By: Andrea Galimberti + + +@endnode + +@node task_intro "Tasker / Introduction" + + Tasker. + + + This module allows you to transform a procedure in an independent task +that runs asynchronously to the main program. You can choose if you want +to start a task or a process, and how big the task's stack must be, and so +on... A task can also be terminated by the main program. Instructions are +also supplied to create message ports to communicate between the main +program and the tasks. + + Remember: a TASK cannot access disks and, in general, all resources +managed by the dos.library, while a PROCESS can. Tasks and processes share +with the main program only variables that have been defined as global. + +@endnode + +@node Error_Table "Tasker / Error Table" + +Val (Hex) | Description +-----------+------------------------------------------------------ + $0000 | No Memory + $0001 | Cannot get E code for the task + $0002 | Cannot start the task + $0003 | Cannot start the process + $0004 | Cannot create the message port + +@endnode + +@node t_storea4 "procedure / storea4()" + + NAME: storea4() + + DESCRIPTION: memorizes the E global data pointer. You MUST call this + procedure (only once) at the beginning of your main program + before you start any process or task. Then, in the task body, + you MUST call the @{"geta4()" LINK t_geta4} procedure before accessing any + global variable or calling a procedure. + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: @{" geta4() " LINK t_geta4} + +@endnode + +@node t_geta4 "procedure / geta4()" + + NAME: geta4() + + DESCRIPTION: gets the E global data pointer. You MUST call this + procedure in the body of your process or task before you + access any global variable or call a procedure. + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: @{" storea4() " LINK t_storea4} + +@endnode + +@node tasker "AFC module: tasker / tasker()" + + NAME: tasker(name, kill=TRUE) + + DESCRIPTION: this method creates a task object: name is the name + (possibly unique) the task will have when started. Some + values are set to their defaults: the stack allocated for + the task will be of 4000 bytes if not specified with the + @{"stack()" LINK task_stack} method. + If the kill flag is TRUE then the task (or process) will + be stopped and its port (if it has been created with + @{"buildport()" LINK task_buildport}) will be closed when the tasker object + is disposed; if the kill flag is FALSE then it's your duty + to close the port (with @{"endport()" LINK task_endport}) and @{"stop()" LINK task_stop} the task + before disposing of the object. + + INPUTS: name: name of the task. + kill: if TRUE the task and its port are killed before + disposing the object + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node task_code "AFC module: tasker / code()" + + NAME: code(procedure) + + DESCRIPTION: chooses the code that will be executed when the task is + started. + + INPUTS: procedure is the ADDRESS of the procedure you want to start + as a separate task. + + RESULTS: NONE + + SEE ALSO: @{" start() " LINK task_start} + +@endnode + +@node task_stack "AFC module: tasker / stack()" + + NAME: stack(bytes) + + DESCRIPTION: with this method you enter the dimension of the stack (in + bytes) to be allocated when the task is started. + + INPUTS: the dimension in bytes of the task's stack: this defaults + to the value of 4000 bytes. + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node task_start "AFC module: tasker / start()" + + NAME: start(priority=0) + + DESCRIPTION: starts a TASK. The task ends if stopped with the @{"stop()" LINK task_stop} + method, or if the task object is ENDed, or if the task code + terminates its job. + + INPUTS: the priority of the task: default is 0 (normal priority). + + RESULTS: raises an exception if it's not been able to create the + task. (see @{"Error Table" LINK Error_Table}) + + SEE ALSO: @{" stop() " LINK task_stop} + +@endnode + +@node task_process "AFC module: tasker / process()" + + NAME: process(priority=0) + + DESCRIPTION: starts a PROCESS: remember that a process is a task that + can access the Dos resources (e.g., drives) because it is + managed by the dos.library. The process' code and stack are + entered with the same methods used with tasks. + The process ends when it has finished its job (just as + any other program does), or when it is stopped with the + @{"stop()" LINK task_stop} method, or when the tasker associated with it is + ENDed. + + INPUTS: priority of the process: default is 0. + + RESULTS: raises an exception if it cannot create the process. + (see @{"Error Table" LINK Error_Table}) + + SEE ALSO: @{" code() " LINK task_code} + @{" stack() " LINK task_stack} + @{" stop() " LINK task_stop} + + Important: see @{" storea4() " LINK t_storea4} + @{" geta4() " LINK t_geta4} + +@endnode + +@node task_stop "AFC module: tasker / stop()" + + NAME: stop() + + DESCRIPTION: terminates the TASK: Exec will remove the task from its + list and will automatically deallocate the task's stack. + Remember that you have to free yourself all resources you + have allocated for this task. The task object is not + modified, so you can start again the same task by calling + the @{"start()" LINK task_start} method once again. + This works also with a process (only you call the + @{"process()" LINK task_process} method to restart it). + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: @{" start() " LINK task_start} + +@endnode + +@node task_buildport "AFC module: tasker / buildport()" + + NAME: buildport(name=NIL, priority=0) + + DESCRIPTION: this method creates a message port associated with the + task. Important: the port is associated to the task that + created it, so make sure that this method is called by the + procedure that constitutes the task, not by the main + program. + If you supply a name the port will be made public, and in + such a case you can even choose the priority of your public + port. + + INPUTS: name: <>NIL if you want the port to be public + priority: only needed if the port is a public port. + + RESULTS: raises an exception if unable to create the port + (see @{"Error Table" LINK Error_Table}) + + SEE ALSO: @{" endport() " LINK task_endport} + +@endnode + +@node task_endport "AFC module: tasker / endport()" + + NAME: endport() + + DESCRIPTION: removes the task's message port created with @{"buildport()" LINK task_buildport}. + Remember to get all the messages (and to reply) before + ending the port (if you are sure that the port is empty you + needn't do this). The method cannot do it for you because + it can't know if the task that sent the message is still + present or not (replying to an unexisting task will cause a + guru). + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: @{" buildport() " LINK task_buildport} + +@endnode + +@node task_port "AFC module: tasker / port()" + + NAME: port() + + DESCRIPTION: returns the address of the port created by @{"buildport()" LINK task_buildport}, + or NIL if the port doesn't exist. + + INPUTS: NONE + + RESULTS: the port address. + + SEE ALSO: @{" buildport() " LINK task_buildport} + +@endnode + +@node task_dosport "AFC module: tasker / dosport()" + + NAME: dosport() + + DESCRIPTION: returns the address of the port associated to the process: + this port is created by AmigaDOS when the process is + started and is reserved to exclusive use of AmigaDOS, so + you are invited to create your own port with the + @{"buildport()" LINK task_buildport} method if you need one. + + INPUTS: NONE + + RESULTS: the port address, or NIL if the task is not a process. + + SEE ALSO: @{" buildport() " LINK task_buildport} + +@endnode + +@node task_send "AFC module: tasker / send()" + + NAME: send(message) + + DESCRIPTION: sends an Exec message to the port created with the + @{"buildport()" LINK task_buildport} method. + + INPUTS: the message address. + + RESULTS: TRUE if message sent, otherwise FALSE. + + SEE ALSO: @{" buildport() " LINK task_buildport} + @{" port() " LINK task_port} + +@endnode + +@node task_dossend "AFC module: tasker / dossend()" + + NAME: dossend(message) + + DESCRIPTION: sends an Exec message to the port associated with the + process (the one created by and reserved to AmigaDOS). + + INPUTS: the message address. + + RESULTS: TRUE if message sent, otherwise FALSE. + + SEE ALSO: @{" dosport() " LINK task_dosport} + +@endnode + +@node task_version "AFC module: tasker / version()" + + NAME: version() + + DESCRIPTION: returns version and revision of tasker code. + + INPUTS: NONE + + RESULTS: version, revision + + SEE ALSO: + +@endnode + +@node t_buildPort "procedure / buildPort()" + + NAME: buildPort(name=NIL, priority=0) + + DESCRIPTION: creates a message port: this port will be associated to the + task that creates it. The port will be made public if you + supply a name for it. + + INPUTS: name: if <>NIL the port will be made public. + priority: only needed if the port is a public port. + + RESULTS: address of the port or NIL if failure. + + SEE ALSO: @{" endPort() " LINK t_endport} + +@endnode + +@node t_endport "procedure / endPort()" + + NAME: endPort(port) + + DESCRIPTION: kills a message port. Remember to get and reply to all + messages contained in the port before destroying it. + + INPUTS: port address + + RESULTS: NONE + + SEE ALSO: @{" buildPort() " LINK t_buildport} + +@endnode + +@node t_setupmsg "procedure / setupMsg()" + + NAME: setupMsg(message, sizeof, replyport=NIL) + + DESCRIPTION: after you have allocated the memory needed for your + message, you pass the message pointer to this procedure + specifying its size and the address of the port to which + the message must be replyed. The MessageNode part will be + filled; then, it's up to you to fill the extra information + you want to send within this message. Always remember to + free the memory allocated for the message before ending the + program. + Your message structure must be defined as follows: + + OBJECT mymessage + mnode:mn + . + . -> extra fields (your private datas) + . + ENDOBJECT + + INPUTS: message: pointer to message memory + sizeof: size of the message (e.g., SIZEOF mymessage) + replyport: port to which the message is to be replyed, or + NIL if an answer is not needed. + + RESULTS: the message pointer (the same you passed as first + parameter) or NIL if something went wrong. + + SEE ALSO: + +@endnode + +@node t_sendmsg "procedure / sendMsg()" + + NAME: sendMsg(message, port) + + DESCRIPTION: sends message to the port specified; if such a port is + public then the procedure checks if the port is still + present before sending anything + + INPUTS: message: pointer to the message to be sent + port: destination port + + RESULTS: TRUE if successful, otherwise FALSE + + SEE ALSO: @{" send() " LINK task_send} + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/ToolType.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/ToolType.guide new file mode 100644 index 0000000..edf66a0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/ToolType.guide @@ -0,0 +1,161 @@ +@database ToolType.guide + +@$VER: ToolType V1.00 - (C)Copyright Amiga Foundation Classes + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node Main "Amiga Foundation Classes: tooltype" + + + + ** ToolType - Original By Fabio Rotondo ** + + * Part of the Amiga Foundation Classes * + + @{" Introduction " link "ToolType_introduction"} @{" Author's Info " link "author"} @{" Amiga Foundation Classes " LINK "AFC.Guide/main"} + + Requires: + + Class Base: $000E0000 + + NEW COMMANDS BRIEF DESCRIPTION + ------------------------------------------------------------------------- + @{" tooltype() " link "ToolType_tooltype"} Initailizes the class. + @{" file(programname) " link "ToolType_file"} Grabs an icon from a given file. + @{" get(tooltypename) " link "ToolType_get"} Gets a specific ToolType from the icon. + @{" match(tooltypename, value) " link "ToolType_match"} Compares a ToolType with the given value. + @{" version() " link "ToolType_version"} Returns tooltype version. + + @{" Error Table " LINK tooltype_ErrorTable} +@endnode + +@node "ToolType_Introduction" "Introduction" + + ToolType is a class to easyly manage icons tooltypes. + It is extremely easy to use and flexible: enjoy it! + +@endnode + +@node "author" "Author's Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) + +@endnode + +@node tooltype_ErrorTable "ToolType / Error Table " + +VALUE | DESCRIPTION +----------------+---------------------------------------------------- +$0000 | No Memory. +$0001 | Failed TO open "icon.library" (maybe wrong version) +$0002 | No valid WB Message +$0003 | File not found (the icon you are requiring does not exists) +$0004 | No Disk Icon (current program has no icon) +$0005 | Not a valid tool array structure + +@endnode + +@node "ToolType_tooltype" "Amiga Foundation Classes: tooltype/tooltype()" + + NAME: tooltype(grab=FALSE) + + DESCRIPTION: Use this method to initailize the object. + + INPUT: grab - If it is TRUE, tooltype will try to get + tooltypes from the icon the user clicked + to start the program. + + RESULTS: if any error, it can raise exceptions. + + SEE ALSO: +@endnode + +@node "ToolType_file" "Amiga Foundation Classes: tooltype/file()" + + NAME: file(programname:PTR TO CHAR) + + DESCRIPTION: Use this method to 'grab' tooltypes from a file. + + INPUT: file - the name of the program you wish to + read ToolTypes. + + RESULTS: if any error, it can raise exceptions. + + SEE ALSO: +@endnode + +@node "ToolType_get" "Amiga Foundation Classes: tooltype/get()" + + NAME: get(tooltypename:PTR TO CHAR) + + DESCRIPTION: Use this method to read the value of a specific + tooltype. + + INPUT: tooltypename - the name of the tooltype you want to + examine. + + RESULTS: a ptr to the returned value. + + FALSE means "ToolType" not found. + + SEE ALSO: @{" match() " LINK tooltype_match} +@endnode + +@node tooltype_match "Amiga Foundation Classes: tooltype/match()" + + NAME: match(tooltypename:PTR TO CHAR, value:PTR TO CHAR) + + DESCRIPTION: Use this method to check if a particular ToolType is + set to a specific value. + + INPUT: tooltypename - Name of the ToolType to examine. + + value - Value to match with. + + + RESULTS: TRUE - Matching successfull + + FALSE - Otherwise. + + EXAMPLE: match('CYBERGRAPHX', 'TRUE') + + SEE ALSO: @{" get() " LINK tooltype_get} +@endnode + +@node "ToolType_version" "Amiga Foundation Classes: tooltype/version()" + + NAME: version() + + DESCRIPTION: This method returns class version and revision. + + INPUT: NONE. + + RESULTS: This method returns TWO values, Version and Revision. + + SEE ALSO: +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Worldbuilder.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Worldbuilder.guide new file mode 100644 index 0000000..479a5ff --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/Worldbuilder.guide @@ -0,0 +1,1457 @@ +@database Worldbuilder.guide + +@$VER: Worldbuilder V1.00 - by Andrea Galimberti - (C) Brighting Brain Brothers + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node main "AFC Module: Worldbuilder / Main" + + + ** Worldbuilder V1.00 - Original By Andrea Galimberti ** + + Part of Amiga Foundation Classes + + + @{" Introduction " LINK world_intro} Important: don't skip this as usual. + @{" Author(s) Info " LINK author} + + + Requires: @{" nodemaster " LINK "nodemaster.guide/Main"} + + Base: $8005 + + Sections: @{" Worldbuilder methods " LINK world_methods} + @{" Object_obj methods " LINK world_o_methods} + @{" Procedures " LINK world_procedures} + + + @{" ERROR TABLE " LINK Error_Table} +@endnode + +@node world_methods "AFC module: Worldbuilder methods" + + Worldbuilder methods: + + COMMANDS BRIEF DESCRIPTION + ----------------------------------------------------------------------- + + @{" worldbuilder() " LINK worldbuilder} Initializes a world + + @{" addobj() " LINK world_addobj} Create and add an object + @{" setobj() " LINK world_setobj} Only add an existing object + @{" getobj() " LINK world_getobj} Get a specified object + @{" delobj() " LINK world_delobj} Delete object + @{" unlinkobj() " LINK world_unlinkobj} Remove an object + @{" clearobj() " LINK world_clearobj} Clear an object + + @{" setvertex() " LINK world_setvertex} Add vertex to object + @{" getvertex() " LINK world_getvertex} Get vertex of object + @{" fastsetvert() " LINK world_fastsetvert} Fast add vertex + @{" delvertex() " LINK world_delvertex} Delete vertex from object + + @{" setline() " LINK world_setline} Add line to object + @{" getline() " LINK world_getline} Get line from object + @{" fastsetline() " LINK world_fastsetline} Fast add line + @{" delline() " LINK world_delline} Delete line from object + + @{" setsurface() " LINK world_setsurface} Add surface to object + @{" getsurface() " LINK world_getsurface} Get surface from object + @{" delsurface() " LINK world_delsurface} Delete surface from object + + @{" visible() " LINK world_visible} Switch on and off an object + @{" position() " LINK world_position} Move local axes of an object + @{" scale() " LINK world_scale} Scale an object + @{" applyobj() " LINK world_applyobj} Apply transformations to an object + + @{" projection() " LINK world_projection} 3D -> 2D conversion + @{" getpoint() " LINK world_getpoint} Get projected pixel + @{" draw() " LINK world_draw} Draw wireframe (or points) + @{" init3D() " LINK world_init3d} Initialise filled vectors + @{" drawfill() " LINK world_drawfill} Draw filled vectors + + @{" copyobj() " LINK world_copyobj} Copy two objects + @{" cloneobj() " LINK world_cloneobj} Duplicate an object + + @{" setobserver() " LINK world_setobserver} Position observer + @{" setscale() " LINK world_setscale} Scale all objects + @{" settrasl() " LINK world_settrasl} Traslate all objects + @{" setrot() " LINK world_setrot} Rotate all objects + @{" setafterscale() " LINK world_setafterscale} Scale to fit screen + @{" setaftertrasl() " LINK world_setaftertrasl} Traslate origin of axes + @{" setdisplay() " LINK world_setdisplay} Set display features + + @{" version() " LINK world_version} Version of Worldbuilder + +@endnode + +@node world_o_methods "AFC module: Object_obj methods" + + Object_obj methods: + + COMMANDS BRIEF DESCRIPTION + ----------------------------------------------------------------------- + + @{" object_obj() " LINK object_obj} Initializes an object + @{" clear() " LINK object_clear} Clear object + + @{" name() " LINK object_name} Return object name + + @{" setvertex() " LINK object_setvertex} Add vertex + @{" getvertex() " LINK object_getvertex} Get vertex + @{" fastsetvert() " LINK object_fastsetvert} Fast add vertex + @{" delvertex() " LINK object_delvertex} Delete vertex + + @{" setline() " LINK object_setline} Add line + @{" getline() " LINK object_getline} Get line + @{" fastsetline() " LINK object_fastsetline} Fast add line + @{" delline() " LINK object_delline} Delete line + + @{" setsurface() " LINK object_setsurface} Add surface + @{" getsurface() " LINK object_getsurface} Get surface + @{" delsurface() " LINK object_delsurface} Delete surface + + @{" position() " LINK object_position} Move local axes + @{" scale() " LINK object_scale} Scale object + @{" apply() " LINK object_apply} Apply transformations + + @{" projection() " LINK object_projection} Project single object + @{" getpoint() " LINK object_getpoint} Get projected pixel + + @{" copy() " LINK object_copy} Copy object + @{" clone() " LINK object_clone} Duplicate object + +@endnode + +@node world_procedures "AFC module: Procedures" + + Procedures: + + COMMANDS BRIEF DESCRIPTION + ----------------------------------------------------------------------- + + @{" fillSinTable() " LINK world_fillsintable} Initialize table of sines + @{" limitangle() " LINK world_limitangle} Bound angle (0 - 360 degrees) + @{" crossprod() " LINK world_crossprod} Vector product + @{" dotprod() " LINK world_dotprod} Scalar product + +@endnode + +@node author "Author(s) Info" + + Original By: Andrea Galimberti + + E Version By: Andrea Galimberti + +@endnode + +@node world_intro "AFC module: Worldbuilder / Introduction" + + + Worldbuilder + ------------ + + This Class contains instructions to create, manipulate and draw three +dimensional objects: they can be rotated, scaled and drawn in a wireframe +and in a filled vector mode; at any time you can add, remove or modify +vertices, lines and surfaces, the system keeping track automatically of +your changes. + + + @{" The objects " LINK world_i_objects} + @{" Lines and surfaces " LINK world_i_lines} + @{" The coordinate system " LINK world_i_coords} + +@endnode + +@node world_i_objects "AFC module: Introduction / objects" + + Two are the objects contained in this class: worldbuilder and object_obj. +The latter represents a single 3D object containing its description in +terms of position of vertices, lines and/or surfaces. The former +represents the world in which to insert the objects before they are +rendered. You have to keep in mind this: objects can be manipulated and +drawn on the screen only when they are in a worldbuilder, because it's the +worldbuilder that contains notions as rotation, traslation, scaling and +observer position. + + The methods are accordingly divided in two sets: one pertaining to the +worldbuilder and one to the object_obj. Most of the methods of the two sets +share the same name, because they do exactly the same thing: the method of +worldbuilder acts on objects already linked to that world, while the +corresponding method of object_obj acts on the single object. + But why this division can be useful? I must say that you're invited to +use only the methods of worldbuilder (because otherwise, as I said before, +objects cannot be rendered), but perhaps you may want to keep your own +database of objects and link them to a worldbuilder only when needed, and this +is where the methods of object_obj come into play. + +@endnode + +@node world_i_lines "AFC module: Introduction / lines and surfaces" + + An object_obj contains vertices, lines and surfaces. No doubt you have +to define vertices before defining anything else, but you haven't to define +lines before surfaces: these two structures are independent but, anyway, +they aren't mutually exclusive. You need lines if you render the world in +wireframe; otherwise, if you use the filled vector mode you need only +surfaces. + +@endnode + +@node world_i_coords "AFC module: Introduction / coordinate system" + + There's always a weird (for physicists) peculiarity in the coordinate +system of a computer world: unfortunately it's left-handed. The three +axes are directed as follows: + + y + ^ _ z + | /| + | / + | / + |/ + |-----------> x + 0 + +(obviuosly, negative coordinate values are allowed). + +@endnode + +@node Error_Table "AFC module: worldbuilder / Error Table" + +Val (Hex) | Description +-----------+------------------------------------------------------ + $0000 | No Memory + $0001 | AreaInfo not available in init3D() + $0002 | TempRas not available in init3D() + $0003 | Vector buffer not available in init3D() + $0004 | Extra bitplane not available in init3D() + +@endnode + +@node object_obj "AFC module: object_obj / object_obj()" + + NAME: object_obj(name) + + DESCRIPTION: creates an object_obj with name 'name'. The name + parameter is necessary because all objects in a worldbuilder + are addressed with their names. + Objects cannot be rendered independently outside a world; + the object_obj methods are supplied to manipulate single + objects e.g. for storing purposes: you can, for example, + create a database of objects and then link to an + initialized worldbuilder only the ones you actually need. + To link an already existing object to a worldbuilder you use + the @{"worldbuilder / setobj()" LINK world_setobj} method; alternatively you can + directly create and add an object to a world in one step by + calling the @{"worldbuilder / addobj()" LINK world_addobj} method. + + INPUTS: name of the object to be crated (max 30 chars). + + RESULTS: NONE + + SEE ALSO: @{" worldbuilder / addobj() " LINK world_addobj} + @{" worldbuilder / setobj() " LINK world_setobj} + +@endnode + +@node object_clear "AFC module: object_obj / clear()" + + NAME: clear() + + DESCRIPTION: clears all object's contents (except its name). + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: @{" worldbuilder / clearobj() " LINK world_clearobj} + +@endnode + +@node object_setvertex "AFC module: object_obj / setvertex()" + + NAME: setvertex(num, x, y, z) + + DESCRIPTION: if 'num' is greater than the number of vertices of the + object, then a new vertex is added to the object at the + last position (independently of its number); so you cannot + leave holes e.g. by adding vertex 4 and then vertex 10: + in this case vertex 10 enters in position number 5. + + This underlines one thing you have to care about: + vertices have NOT a fixed number; their number it's their + position in the list (for speed reasons). Usually the + module takes care of this automatically, but you must + remember it when you delete a vertex. + + If 'num' is an already attached vertex, then this + instruction modifies the coordinates of that vertex. + + Vertex numbers start from 0 (just like array elements). + + INPUTS: num: number of the vertex + x, y, z: coordinates of the vertex. + + RESULTS: FALSE if num<0, otherwise the number of vertices currently + in object. + + SEE ALSO: @{" fastsetvert() " LINK object_fastsetvert} + @{" worldbuilder / setvertex() " LINK world_setvertex} + +@endnode + +@node object_getvertex "AFC module: object_obj / getvertex()" + + NAME: getvertex(num) + + DESCRIPTION: if num is a valid vertex number (that is to say in the + range [0 - ((number of vertices of the object)-1)]), this + call returns a pointer to a vertex_obj. + A vertex_obj contains three fields: x, y and z, + representing the three coordinates of the vertex. After + you got the pointer to a vertex_obj you can access its + coordinates by the usual way: vertex_obj.x, vertex_obj.y + and vertex_obj.z. I left this structure public because it + can be of some use for you. + + INPUTS: number of (an existing) vertex; remember: vertex numbers + start from 0 (and go to (number of vertices in object)-1). + + RESULTS: pointer to a vertex_obj + FALSE if num is an illegal number (e.g., num<0) + + SEE ALSO: @{" setvertex() " LINK object_setvertex} + @{" worldbuilder / getvertex() " LINK world_getvertex} + +@endnode + +@node object_fastsetvert "AFC module: object_obj / fastsetvert()" + + NAME: fastsetvert(vertex_list) + + DESCRIPTION: adds vertices to the object according to the content of + vertex_list. Vertex_list is a TYPED list of type + vertex_obj with the following form: + + [x1,y1,z1, x2,y2,z2, ... ]:vertex_obj + + This command is equivalent to the following code + + FOR k:=0 to (number of vertices)-1 + o.setvertex(k, x[k], y[k], z[k]) + ENDFOR + + but it's quicker. + + INPUTS: vertex_list: list of vertices to be added. + + RESULTS: NONE + + SEE ALSO: @{" setvertex() " LINK object_setvertex} + @{" worldbuilder / fastsetvert() " LINK world_fastsetvert} + +@endnode + +@node object_delvertex "AFC module: object_obj / delvertex()" + + NAME: delvertex(num) + + DESCRIPTION: removes a vertex from the object. Removes all references + to that vertex by deleting all lines and/or surfaces + attached to the vertex. + All vertex numbers will be scaled down one step to fill + in the hole leaved by the deletion. + + INPUTS: number of vertex to be killed. + + RESULTS: FALSE if num is not the number of an existing vertex (e.g., + num<0), otherwise TRUE. + + SEE ALSO: @{" setvertex() " LINK object_setvertex} + @{" worldbuilder / delvertex() " LINK world_delvertex} + +@endnode + +@node object_setline "AFC module: object_obj / setline()" + + NAME: setline(num, startv, endv, colour) + + DESCRIPTION: adds or modifies line number 'num' in object 'name': the + line starts from vertex number 'startv', ends in vertex + number 'endv' and has colour 'colour'. + If num is greater than the number of lines contained in + the object_obj, then the new line will be added as last + item; if num points to an existing line, then the new datas + will replace the old line definition. + + This underlines one thing you have to care about: + lines have NOT a fixed number; their number it's their + position in the list (for speed reasons). Usually the + module takes care of this automatically, but you must + remember it when you delete a line. + + Line numbers start from 0. + + INPUTS: num: line number, + startv: starting line vertex, + endv: ending line vertex, + colour: line colour. + + RESULTS: FALSE if num<0 or startv and/or endv outside the range of + existing vertices of the object, + otherwise the number of lines currently in object. + + SEE ALSO: @{" worldbuilder / setline() " LINK world_setline} + +@endnode + +@node object_getline "AFC module: object_obj / getline()" + + NAME: getline(num) + + DESCRIPTION: returns a description of line number 'num' in the form of a + pointer to a line_obj. An object of type line_obj contains + three fields named 'startv', 'endv' and 'colour'; after + having received the pointer you access those fields in the + usual way: line_obj.startv, line_obj.endv and + line_obj.colour. + I left the line_obj object description public because it + can be of use to you. + + INPUTS: number of line to be inquired. + + RESULTS: FALSE if num is outside the valid range of existing line + numbers (going from 0 to (number of lines)-1), + otherwise a pointer to a line_obj. + + SEE ALSO: @{" setline() " LINK object_setline} + @{" worldbuilder / getline() " LINK world_getline} + +@endnode + +@node object_fastsetline "AFC module: object_obj / fastsetline()" + + NAME: fastsetline(line_list) + + DESCRIPTION: adds the line descriptions contained in line_list to the + object. Line_list is a TYPED list of type line_obj of the + following form: + + [startv1,endv1,colour1, startv2,endv2,colour2, ...]:line_obj + + This command is equivalent to the following code + + FOR k:=0 to (number of lines)-1 + o.setline(k, startv[k], endv[k], colour[k]) + ENDFOR + + but it's quicker. + + If a startv or endv exceeds the range of existing vertex + numbers for the object, then it is automatically set to + vertex number 0. + + INPUTS: list of lines to be added. + + RESULTS: NONE + + SEE ALSO: @{" setline() " LINK object_setline} + @{" worldbuilder / fastsetline() " LINK world_fastsetline} + +@endnode + +@node object_delline "AFC module: object_obj / delline()" + + NAME: delline(num) + + DESCRIPTION: removes line number 'num' from the object. + All line numbers will be scaled down one step to fill in + the hole leaved by the deletion. + + INPUTS: number of line to be killed. + + RESULTS: FALSE if num is outside the valid range for the object. + + SEE ALSO: @{" setline() " LINK object_setline} + @{" worldbuilder / delline() " LINK world_delline} + +@endnode + +@node object_setsurface "AFC module: object_obj / setsurface()" + + NAME: setsurface(num, vertex_list, colour) + + DESCRIPTION: adds (or modifies) a surface. If num is greater than the + number of surfaces contained in the object, then the new + surface will be added at the end of the list; if num points + to an existing surface, then the contents of that surface + will be replaced by the new datas. + The vertex_list is a list of vertex NUMBERS belonging to + the surface, in the following order: you rotate the object + until the surface is visible and then enumerate the + vertices in a clockwise direction. + + I want to underline one thing you have to care about: + surfaces have NOT a fixed number; their number it's their + position in the list (for speed reasons). Usually the + module takes care of this automatically, but you must + remember it when you delete a surface. + + Surface numbers start from 0. + + If a vertex number in the list is outside the range of + existing vertices, then it is arbitrarily set to vertex + number 0. + + If you modify a surface it doesn't matter if the new + vertex_list is shorter or longer than the previous one. + + INPUTS: num: number of surface, + vertex_list: list of vertex numbers, + colour: surface colour register. + + RESULTS: FALSE if num<0, + otherwise the total number of surfaces in the object. + + SEE ALSO: @{" worldbuilder / setsurface() " LINK world_setsurface} + +@endnode + +@node object_getsurface "AFC module: object_obj / getsurface()" + + NAME: getsurface(snum, vnum) + + DESCRIPTION: returns the vertex number contained in position vnum of + surface snum. + + INPUTS: snum: number of surface to be inquired, + vnum: position of vertex in the surface's list. + + RESULTS: vertex number contained in position vnum, + FALSE if snum outside the valid range or vnum outside the + valid range for the object. + + SEE ALSO: @{" setsurface() " LINK object_setsurface} + @{" worldbuilder / getsurface() " LINK world_getsurface} + +@endnode + +@node object_delsurface "AFC module: object_obj / delsurface()" + + NAME: delsurface(num) + + DESCRIPTION: removes surface number 'num' from the object. All surface + numbers will be scaled down by one step to fill in the hole + leaved by the deletion. + + INPUTS: number of the surface to be killed. + + RESULTS: FALSE if num is outside the valid range for the object, + otherwise TRUE. + + SEE ALSO: @{" setsurface() " LINK object_setsurface} + @{" worldbuilder / delsurface() " LINK world_delsurface} + +@endnode + +@node object_projection "AFC module: object_obj / projection()" + + NAME: projection(x, y, z) + + DESCRIPTION: reduces the 3D coordinates of the object in a 2D + representation, according to the position of the observer + (specified with the x, y and z parameters). Local axes are + not supplied, so you cannot rotate objects individually; + besides, you cannot draw objects individually. To perform + rotations and drawing you have to link the object to a + worldbuilder. + + INPUTS: position of the observer. + + RESULTS: NONE + + SEE ALSO: @{" worldbuilder / projection() " LINK world_projection} + +@endnode + +@node object_getpoint "AFC module: object_obj / getpoint()" + + NAME: getpoint(vertex) + + DESCRIPTION: returns the coordinates of a projected vertex in the form + of a pointer to a screen_pixel object. Such an object is + made of two fields named 'x' and 'y' (guess what they + mean!); after having got the pointer you access the two + coordinates by the usual way: screen_pixel.x, + screen_pixel.y. + + INPUTS: number of the vertex to be inquired. + + RESULTS: pointer to a screen_pixel object, + FALSE if vertex is outside the valid range for the object. + + SEE ALSO: @{" projection() " LINK object_projection} + @{" worldbuilder / getpoint() " LINK world_getpoint} + +@endnode + +@node object_position "AFC module: object_obj / position()" + + NAME: position(x, y, z) + + DESCRIPTION: moves the origin of the object's local axes to the + position specified. This means you can always enter the + object's coordinates relative to the object's local origin + and then move the object around in the worldbuilder. + This method only sets the origin coordinates to the new + values, and the traslation is performed every time the + object is @{"project()" LINK world_projection}ed within a worldbuilder: this behaviour + obviuosly slows down the projection routine. If you want + to make the changes permanent (calculated once for ever) + you call the @{"apply()" LINK object_apply} method. + + To traslate the whole worldbuilder you can use the + @{"settrasl()" LINK world_settrasl} method. + + INPUTS: coordinates of the local origin. + + RESULTS: NONE + + SEE ALSO: @{" apply() " LINK object_apply} + @{" worldbuilder / position() " LINK world_position} +@endnode + +@node object_scale "AFC module: object_obj / scale()" + + NAME: scale(x, y, z) + + DESCRIPTION: scales the object. + This method only sets the scaling factors to the new + values, and the scaling is performed every time the object + is @{"project()" LINK world_projection}ed within a worldbuilder: this behaviour + obviuosly slows down the projection routine. If you want + to make the changes permanent (calculated once for ever) + you call the @{"apply()" LINK object_apply} method. + The scaling factors are entered as a percentage: 100 + means original dimensions, 50 means a half, and so on... + + To scale the whole worldbuilder you can use the + @{"setscale()" LINK world_setscale} method. + + INPUTS: scaling factors. + + RESULTS: NONE + + SEE ALSO: @{" apply() " LINK object_apply} + @{" worldbuilder / scale() " LINK world_scale} + +@endnode + +@node object_copy "AFC module: object_obj / copy()" + + NAME: copy(dest:PTR TO object_obj) + + DESCRIPTION: copies all the contents of an object (except its name) to + the destination object: the latter will be @{"clear()" LINK object_clear}ed + before being modified. + + INPUTS: pointer to an already initialized object_obj. + + RESULTS: FALSE if dest=NIL, otherwise TRUE. + It may raise exceptions (see the @{"Error Table" LINK Error_Table}). + + SEE ALSO: @{" clone() " LINK object_clone} + @{" worldbuilder / copyobj() " LINK world_copyobj} + +@endnode + +@node object_clone "AFC module: object_obj / clone()" + + NAME: clone(newname=NIL) + + DESCRIPTION: creates a new object_obj and copies the contents of the + current object to the new one. The newname parameter will + be the name of the newborn object_obj (if it is not + supplied the new name will be something like + 'Copy_of_oldname'). + + INPUTS: name of the object to be created. + + RESULTS: pointer to the new object_obj. + + SEE ALSO: @{" copy() " LINK object_copy} + @{" worldbuilder / cloneobj() " LINK world_cloneobj} + +@endnode + +@node object_name "AFC module: object_obj / name()" + + NAME: name() + + DESCRIPTION: returns the object's name. + + INPUTS: NONE + + RESULTS: object's name. + + SEE ALSO: + +@endnode + +@node object_apply "AFC module: object_obj / apply()" + + NAME: apply() + + DESCRIPTION: makes the changes on an object permanent (calculated once + for ever). Changes such as @{"position()" LINK object_position} or @{"scale()" LINK object_scale} of an + object_obj are affected: this increases the speed of the + @{"projection()" LINK world_projection} routine, because permanent transformations + are skipped. + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: @{" position() " LINK object_position} + @{" scale() " LINK object_scale} + @{" worldbuilder / applyobj() " LINK world_applyobj} + +@endnode + +@node worldbuilder "AFC module: worldbuilder / worldbuilder()" + + NAME: worldbuilder() + + DESCRIPTION: builds a worldbuilder object (constructor). + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node world_addobj "AFC module: worldbuilder / addobj()" + + NAME: addobj(name) + + DESCRIPTION: creates an object_obj called 'name' and adds it to the + worldbuilder. The name parameter is necessary because all + objects in a world are recognized by their names. + + INPUTS: the name of the object to be created (max 30 chars). + + RESULTS: NONE + + SEE ALSO: @{" object_obj() " LINK object_obj} + @{" setobj() " LINK world_setobj} + +@endnode + +@node world_setobj "AFC module: worldbuilder / setobj()" + + NAME: setobj(object) + + DESCRIPTION: links an existing object_obj to the worldbuilder. + + INPUTS: 'object' is the pointer to an object_obj. + + RESULTS: NONE + + SEE ALSO: @{" addobj() " LINK world_addobj} + @{" getobj() " LINK world_getobj} + +@endnode + +@node world_getobj "AFC module: worldbuilder / getobj()" + + NAME: getobj(name) + + DESCRIPTION: returns the pointer to the object_obj named 'name'. + + INPUTS: name of the object. + + RESULTS: pointer to an object_obj. + + SEE ALSO: @{" setobj() " LINK world_setobj} + @{" addobj() " LINK world_addobj} + +@endnode + +@node world_delobj "AFC module: worldbuilder / delobj()" + + NAME: delobj(name) + + DESCRIPTION: unlinks from the worldbuilder and deletes (freeing all memory + associated with it) the object 'name'. If such an object + doesn't exist, it does nothing. + + INPUTS: name of the object to be killed. + + RESULTS: NONE + + SEE ALSO: @{" addobj() " LINK world_addobj} + @{" unlinkobj() " LINK world_unlinkobj} + +@endnode + +@node world_unlinkobj "AFC module: worldbuilder / unlinkobj()" + + NAME: unlinkobj(name) + + DESCRIPTION: removes the object 'name' from the worldbuilder, without + freeing its memory. It returns a pointer to an object_obj, + that you must remember to END yourself before exiting the + program. + + INPUTS: name of the object to unlink. + + RESULTS: pointer to an object_obj, or FALSE if 'name' not found. + + SEE ALSO: @{" delobj() " LINK world_delobj} + +@endnode + +@node world_setvertex "AFC module: worldbuilder / setvertex()" + + NAME: setvertex(name, num, x, y, z) + + DESCRIPTION: same as @{"object_obj / setvertex()" LINK object_setvertex} + + INPUTS: name of the object_obj to be modified + num: vertex number + x, y, z: vertex coordinates + + RESULTS: FALSE if object not found, + otherwise the number of vertices currently in object. + + SEE ALSO: @{" fastsetvert() " LINK world_fastsetvert} + @{" object_obj / setvertex() " LINK object_setvertex} + +@endnode + +@node world_getvertex "AFC module: worldbuilder / getvertex()" + + NAME: getvertex(name, num) + + DESCRIPTION: same as @{"object_obj / getvertex()" LINK object_getvertex} + + INPUTS: name of the object to be inquired + num: number of vertex + + RESULTS: FALSE if object not found, or num outside a valid range, + pointer to vertex_obj if successful. + + SEE ALSO: @{" setvertex() " LINK world_setvertex} + @{" object_obj / getvertex() " LINK object_getvertex} + +@endnode + +@node world_fastsetvert "AFC module: worldbuilder / fastsetvert()" + + NAME: fastsetvert(name, vertex_list) + + DESCRIPTION: same as @{"object_obj / fastsetvert()" LINK object_fastsetvert} + + INPUTS: name of the object to be modified + vertex_list of vertices to be added. + + RESULTS: FALSE if object not found. + + SEE ALSO: @{" setvertex() " LINK world_setvertex} + @{" object_obj / fastsetvert() " LINK object_fastsetvert} + +@endnode + +@node world_delvertex "AFC module: worldbuilder / delvertex()" + + NAME: delvertex(name, num) + + DESCRIPTION: same as @{"object_obj / delvertex()" LINK object_delvertex} + + INPUTS: name of the object to be modified + num: number of vertex to be killed. + + RESULTS: FALSE if object not found, or num outside a valid range, + otherwise TRUE. + + SEE ALSO: @{" setvertex() " LINK world_setvertex} + @{" object_obj / delvertex() " LINK object_delvertex} + +@endnode + +@node world_setline "AFC module: worldbuilder / setline()" + + NAME: setline(name, num, startv, endv, colour) + + DESCRIPTION: same as @{"object_obj / setline()" LINK object_setline} + + INPUTS: name of the object to be modified, + num: number of line, + startv: line starting vertex, + endv: line ending vertex, + colour: line colour register. + + RESULTS: FALSE if object not found, + FALSE if num<0 or startv and/or endv outside the range of + existing vertices of the object, + otherwise the number of lines currently in the object. + + SEE ALSO: @{" fastsetline() " LINK world_fastsetline} + @{" object_obj / setline() " LINK object_setline} + +@endnode + +@node world_getline "AFC module: worldbuilder / getline()" + + NAME: getline(name, num) + + DESCRIPTION: same as @{"object_obj / getline()" LINK object_getline} + + INPUTS: name of the object, + num: line number. + + RESULTS: FALSE if object not found, or num outside the range of + existing line numbers. + + SEE ALSO: @{" setline() " LINK world_setline} + @{" object_obj / getline() " LINK object_getline} + +@endnode + +@node world_fastsetline "AFC module: worldbuilder / fastsetline()" + + NAME: fastsetline(name, line_list) + + DESCRIPTION: same as @{"object_obj / fastsetline()" LINK object_fastsetline} + + INPUTS: name of the object to be modified, + line_list: typed list of objects line_obj. + + RESULTS: FALSE if object not found, otherwise TRUE + + SEE ALSO: @{" setline() " LINK world_setline} + @{" object_obj / fastsetline() " LINK object_fastsetline} + +@endnode + +@node world_delline "AFC module: worldbuilder / delline()" + + NAME: delline(name, num) + + DESCRIPTION: same as @{"object_obj / delline()" LINK object_delline} + + INPUTS: name of the object to be modified, + num: number of line to be killed. + + RESULTS: FALSE if object not found, or num outside the valid line + numbers range for the object. + + SEE ALSO: @{" setline() " LINK world_setline} + @{" object_obj / delline() " LINK object_delline} + +@endnode + +@node world_setsurface "AFC module: worldbuilder / setsurface()" + + NAME: setsurface(name, num, vertex_list, colour) + + DESCRIPTION: same as @{"object_obj / setsurface()" LINK object_setsurface} + + INPUTS: name of the object to be modified, + num: number of surface, + vertex_list: list of vertex numbers defining the surface, + colour: surface colour register. + + RESULTS: FALSE if object not found, or num<0 + + SEE ALSO: @{" object_obj / setsurface() " LINK object_setsurface} + +@endnode + +@node world_getsurface "AFC module: worldbuilder / getsurface()" + + NAME: getsurface(name, snum, vnum) + + DESCRIPTION: same as @{"object_obj / getsurface()" LINK object_getsurface} + + INPUTS: name of the object, + snum: number of surface to be inquired, + vnum: number of vertex + + RESULTS: FALSE if object not found or snum outside the valid range + or vnum outside the valid range for the object, + otherwise the vertex number in position vnum. + + SEE ALSO: @{" setsurface() " LINK world_setsurface} + @{" object_obj / getsurface() " LINK object_getsurface} + +@endnode + +@node world_delsurface "AFC module: worldbuilder / delsurface()" + + NAME: delsurface(name, num) + + DESCRIPTION: same as @{"object_obj / delsurface()" LINK object_delsurface} + + INPUTS: name of the object to be modified, + num: number of surface to be killed. + + RESULTS: FALSE if object not found or num outside the valid surface + number range for the object, + otherwise TRUE. + + SEE ALSO: @{" setsurface() " LINK world_setsurface} + @{" object_obj / delsurface() " LINK object_delsurface} + +@endnode + +@node world_getpoint "AFC module: worldbuilder / getpoint()" + + NAME: getpoint(name, vertex) + + DESCRIPTION: same as @{"object_obj / getpoint()" LINK object_getpoint} + + INPUTS: name of the object, + vertex number to be inquired. + + RESULTS: FALSE if object not found or vertex number outside the + valid range for the object, + otherwise the pointer to a screen_pixel object. + + SEE ALSO: @{" object_obj / getpoint() " LINK object_getpoint} + +@endnode + +@node world_visible "AFC module: worldbuilder / visible()" + + NAME: visible(name [,v]) + + DESCRIPTION: an object is by default visible, that is to say it will be + drawn on the scene. If v=FALSE then the object won't + appear on the scene any more, until v is reset to TRUE. If + v is omitted then the function returns the state of the + object. + + INPUTS: name of the object to be modified, + v: TRUE if visible, FALSE if not + + RESULTS: FALSE if object not found, otherwise TRUE; if v is omitted + then the result is the state of the object. + + SEE ALSO: + +@endnode + +@node world_position "AFC module: worldbuilder / position()" + + NAME: position(name, x,y,z) + + DESCRIPTION: same as @{"object_obj / position()" LINK object_position}. + + INPUTS: name of the object ot be modified, + coordinates of the local origin. + + RESULTS: FALSE if object not found. + + SEE ALSO: @{" applyobj() " LINK world_applyobj} + @{" object_obj / position() " LINK object_position} + +@endnode + +@node world_scale "AFC module: worldbuilder / scale()" + + NAME: scale(name, x,y,z) + + DESCRIPTION: same as @{"object_obj / scale()" LINK object_scale}. + + INPUTS: name of the object to be modified, + scaling factors. + + RESULTS: FALSE if object not found. + + SEE ALSO: @{" applyobj() " LINK world_applyobj} + @{" object_obj / scale() " LINK object_scale} + +@endnode + +@node world_clearobj "AFC module: worldbuilder / clearobj()" + + NAME: clearobj(name) + + DESCRIPTION: same as @{"object_obj / clear()" LINK object_clear}. + + INPUTS: name of the object to be cleared. + + RESULTS: FALSE if object not found, otherwise TRUE. + + SEE ALSO: @{" object_obj / clear() " LINK object_clear} + +@endnode + +@node world_copyobj "AFC module: worldbuilder / copyobj()" + + NAME: copyobj(source_name, dest_name) + + DESCRIPTION: copies the contents of source_name object to dest_name + object (except names). + + INPUTS: name of two object_obj's. + + RESULTS: FALSE if either of the objects has not been found. + + SEE ALSO: @{" cloneobj() " LINK world_cloneobj} + @{" object_obj / copy() " LINK object_copy} + +@endnode + +@node world_cloneobj "AFC module: worldbuilder / cloneobj()" + + NAME: cloneobj(name, new_name=NIL) + + DESCRIPTION: creates a new object of name new_name (if supplied), + copies the contents of the object_obj 'name' in the newborn + object, and then links the latter to the worldbuilder. + + INPUTS: name of the object to be cloned, + new_name: name of the new object (if not supplied the + default is 'Copy_of_name'). + + RESULTS: FALSE if object 'name' not found. + + SEE ALSO: @{" copyobj() " LINK world_copyobj} + @{" object_obj / clone() " LINK object_clone} + +@endnode + +@node world_applyobj "AFC module: worldbuilder / applyobj()" + + NAME: applyobj(name) + + DESCRIPTION: same as @{"object_obj / apply()" LINK object_apply}. + + INPUTS: name of the object to be modified. + + RESULTS: FALSE if object not found. + + SEE ALSO: @{" position() " LINK world_position} + @{" scale() " LINK world_scale} + @{" object_obj / apply() " LINK object_apply} + +@endnode + +@node world_projection "AFC module: worldbuilder / projection()" + + NAME: projection() + + DESCRIPTION: transforms the 3D representation of the world in a 2D + representation, according with the chosen values of + rotantion angles (@{"setrot()" LINK world_setrot} method) and observer position + (@{"setobserver()" LINK world_setobserver} method). + You have to call this instruction before the drawing + routine, if you have performed some changes on the + worldbuilder. + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: @{" object_obj / projection() " LINK object_projection} + +@endnode + +@node world_draw "AFC module: worldbuilder / draw()" + + NAME: draw(rastport) + + DESCRIPTION: draws the worldbuilder in a wireframe fashion. If an object + has at least one line, then only its lines are drawn; if an + object has no lines, then its vertices are drawn. Rastport + is the address of a valid rastport in which to draw the + graphics. + The drawing is then traslated and scaled according to the + values entered with the @{"setaftertrasl()" LINK world_setaftertrasl} and + @{"setafterscale()" LINK world_setafterscale} methods. + Remember to @{"projection()" LINK world_projection} the worldbuilder before drawing + it (you needn't do this if it's not the first time and + you've made no changes). + + INPUTS: address of a rastport. + + RESULTS: NONE + + SEE ALSO: @{" drawfill() " LINK world_drawfill} + @{" projection() " LINK world_projection} + +@endnode + +@node world_drawfill "AFC module: worldbuilder / drawfill()" + + NAME: drawfill(rastport, onlylines=FALSE) + + DESCRIPTION: draws the projected worldbuilder with filled vectors. + The drawing is then traslated and scaled according to the + values entered with the @{"setaftertrasl()" LINK world_setaftertrasl} and + @{"setafterscale()" LINK world_setafterscale} methods. + Clipping is made according to the dimensions of the + screen area entered with the @{"setdisplay()" LINK world_setdisplay} method. + If the onlylines parameter is set to TRUE, then also + objects without surfaces are drawn. + + Remember to @{"projection()" LINK world_projection} the worldbuilder before drawing + it (you needn't do this if it's not the first time and + you've made no changes). + You must call the @{"init3D()" LINK world_init3d} routine at least one time + before drawing any filled graphics. + + INPUTS: address of a rastport in which to draw the graphics. + + RESULTS: NONE + + SEE ALSO: Important: @{" init3D() " LINK world_init3d} + @{" projection() " LINK world_projection} + +@endnode + +@node world_setobserver "AFC module: worldbuilder / setobserver()" + + NAME: setobserver(x, y, z) + + DESCRIPTION: sets the observer position. + + INPUTS: coordinates of the observer. + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node world_setscale "AFC module: worldbuilder / setscale()" + + NAME: setscale(x, y, z) + + DESCRIPTION: the three scale factors will be applied to the whole + worldbuilder before projecting it. They are entered as a + percentage: 100 means original dimensions, 50 means a + half, and so on... + This is a 3D operation: compare it with + @{"setafterscale()" LINK world_setafterscale} + + INPUTS: scaling factors in the three directions. + + RESULTS: NONE + + SEE ALSO: @{" setafterscale() " LINK world_setafterscale} + +@endnode + +@node world_settrasl "AFC module: worldbuilder / settrasl()" + + NAME: settrasl(tx, ty, tz) + + DESCRIPTION: traslates the whole worldbuilder by the specified amounts + before projecting it. + This is a 3D operation: compare it with + @{"setaftertrasl()" LINK world_setaftertrasl} + + The traslation is done before any rotation is performed. + + INPUTS: traslation amounts in the three directions. + + RESULTS: NONE + + SEE ALSO: @{" setaftertrasl() " LINK world_setaftertrasl} + +@endnode + +@node world_setrot "AFC module: worldbuilder / setrot()" + + NAME: setrot(x, y, z) + + DESCRIPTION: rotates the whole worldbuilder around the three axes by the + specified amounts. + + INPUTS: angles of rotation around the three axes (degrees). + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node world_setafterscale "AFC module: worldbuilder / setafterscale()" + + NAME: setafterscale(x, y) + + DESCRIPTION: scales the projected world while drawing it to adapt it to + the screen area. The scaling factors are entered as a + percentage: 100 means original dimensions, 50 means a + half, and so on... + This is a 2D operation: compare it with @{"setscale()" LINK world_setscale} + + INPUTS: scaling factors in the two directions. + + RESULTS: NONE + + SEE ALSO: @{" setscale() " LINK world_setscale} + +@endnode + +@node world_setaftertrasl "AFC module: worldbuilder / setaftertrasl()" + + NAME: setaftertrasl(x, y) + + DESCRIPTION: translates the origin of the screen coordinate system + (default: top left-hand corner, as usual). + This is a 2D operation: compare it with @{"settrasl()" LINK world_settrasl} + + INPUTS: traslation factors in the two directions. + + RESULTS: NONE + + SEE ALSO: @{" settrasl() " LINK world_settrasl} + +@endnode + +@node world_setdisplay "AFC module: worldbuilder / setdisplay()" + + NAME: setdisplay(width, height) + + DESCRIPTION: used to enter the screen area dimensions. These are used + in the allocation of the extra bitplane in the @{"init3D()" LINK world_init3d} + routine, and in the clipping of graphics in the + @{"drawfill()" LINK world_drawfill} method. + + INPUTS: width and height of the drawing area (defaults are: + width=320, height=256). + + RESULTS: NONE + + SEE ALSO: + +@endnode + +@node world_init3d "AFC module: worldbuilder / init3D()" + + NAME: init3D(bufon=TRUE, dispon=TRUE) + + DESCRIPTION: allocates the resources needed by the @{"drawfill()" LINK world_drawfill} method + to draw filled vectors: you must call this routine before + any call to drawfill() is made. + It allocates a buffer needed by the operating system to + store the vectors before they are drawn, and an extra + bitplane to allow the drawing of filled areas. If, in a + second time, you change the dimensions of the screen area, + you have to recall this routine to update the dimensions of + the extra bitplane; in the same manner, if you add lots of + surfaces to your world, you have to call this routine to + adapt the buffer dimensions to the new situation (otherwise + you can get only partial rendering). + You needn't do both the operations every time you call + the init3D method, infact the two flags mean: + + bufon =TRUE -> resize the buffer + dispon=TRUE -> resize the extra bitplane. + + The dimensions of the screen area are entered with the + @{"setdisplay()" LINK world_setdisplay} method, and they are used also for graphic + clipping purposes. + + INPUTS: flags described above. + + RESULTS: raises some exceptions if memory allocation fails (see the + @{"Error Table" LINK Error_Table}). + + SEE ALSO: @{" drawfill() " LINK world_drawfill} + +@endnode + +@node world_version "AFC module: worldbuilder / version()" + + NAME: version() + + DESCRIPTION: returns version and revision of worldbuilder module + + INPUTS: NONE + + RESULTS: version, revision + + SEE ALSO: + +@endnode + +@node world_limitangle "AFC module: procedure / limitangle()" + + NAME: limitangle(angle) + + DESCRIPTION: bounds the angle in range [0-359] degrees. + + INPUTS: angle to be wrapped. + + RESULTS: angle in the range [0-359] degrees + + SEE ALSO: + +@endnode + +@node world_crossprod "AFC module: procedure / crossprod()" + + NAME: crossprod(a:PTR TO vertex_obj, b:PTR TO vertex_obj) + + DESCRIPTION: this is the vector product between the two vectors 'a' and + 'b'. The two arguments are defined as vertex_obj because + points in three-space and three-dimensional vectors share + the same structure (remember: points can be represented as + vectors from the origin). + The vectors have three fields: a.x, a.y and a.z; you + fill in these fields and call the routine: it returns the + three components of the resulting vector. + + INPUTS: two (pointers to) vectors. + + RESULTS: three return values, representing the three components of + the resulting vector, in the order: x, y, z. + + SEE ALSO: @{" dotprod() " LINK world_dotprod} + +@endnode + +@node world_dotprod "AFC module: procedure / dotprod()" + + NAME: dotprod(a:PTR TO vertex_obj, b:PTR TO vertex_obj) + + DESCRIPTION: this is the scalar product between the two vectors 'a' and + 'b'. See the observations about points and vectors in the + @{"crossprod()" LINK world_crossprod} procedure. + + INPUTS: two (pointers to) vectors. + + RESULTS: scalar product of the two vectors. + + SEE ALSO: @{" crossprod() " LINK world_crossprod} + +@endnode + +@node world_fillsintable "AFC module: procedure / fillSinTable()" + + NAME: fillSinTable() + + DESCRIPTION: this is used to fill in a pointer to the table of sines: + of course, sines for rotations are not calculated realtime, + but peeked from this table. The table is automatically + filled when you create the first worldbuilder object, so, in + general, you have not to do this task by hand. On the + other hand, if you don't fill the table before accessing it + you can crash your machine. + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/bebox.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/bebox.guide new file mode 100644 index 0000000..206f1f0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/bebox.guide @@ -0,0 +1,305 @@ +@database bebox.guide + +@$VER: BeBox V1.10 - (C)Copyright Amiga Foundation Classes + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node Main "Amiga Foundation Classes: BeBox" + + + + ** BeBox - Original By Fabio Rotondo ** + + * Part of the Amiga Foundation Classes * + + @{" Introduction " link "BeBox_introduction"} @{" Author's Info " link "author"} @{" Amiga Foundation Classes " LINK "AFC.Guide/main"} + + Requires: Nothing. + + Class Base: $000C0000 + + NEW COMMANDS BRIEF DESCRIPTION + ------------------------------------------------------------------------- + @{" bebox(x=0,y=0,w=0,h=0) " link "BeBox_BeBox"} Initailizes the class. + @{" check(x,y) " link "BeBox_Check"} Checks if coords hit the box. + @{" draw(mode=TRUE) " link "BeBox_Draw"} Draws the box. + @{" error() " link "BeBox_Error"} Returns last error raised. + @{" get(tag) " link "BeBox_Get"} Gets class values. + @{" setattrs(tags) " link "BeBox_SetAttrs"} Sets class attributes. + @{" version() " link "BeBox_version"} Returns BeBox version. + + @{" BeBox Structure " link "BeBox_Structure"} + + @{" Error Table " LINK BeBox_ErrorTable} +@endnode + +@node "BeBox_Introduction" "Introduction" + + BeBox is a class to handle a "sensible" area on the screen. + It is as simple as powerful: you can hook a procedure to add to the BeBox a + drawing routine, or to teach it how to move on the screen. + + It can return relative mouse coordinates and so on. + + This class is _very_ useful. You'll learn how to use it. + +@endnode + +@node "author" "Author's Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + C++ Version By: Massimo Tantignone (tanti@intercom.it) + + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) + +@endnode + +@node BeBox_ErrorTable "BeBox / Error Table " + +VALUE | DESCRIPTION +----------------+---------------------------------- +$0000 | No Memory. +@endnode + +@node BeBox_Structure "BeBox Structure" + + BeBox Structure + + Here there is a very quick explanation of the BeBox Structure. + Please, remember that these fields are *READ ONLY*: use tags + to modify them! + + OBJECT bebox_data + oldx :INT -> Old X Pos + oldy :INT -> Old Y Pos + oldw :INT -> Old width value + oldh :INT -> Old height value + oldcol:INT -> Old color used + + x :INT -> Actual X Position + y :INT -> Actual Y Position + w :INT -> Width and Height + h :INT + relx:INT -> Last Relative Mouse Click inside the Box + rely:INT + + minx:INT -> min x,y bounds + miny:INT + maxx:INT -> max x,y bounds + maxy:INT + + rp :PTR TO rastport -> Rastport where to draw on. + + col :INT -> Color to use + + userel:CHAR -> This is a flag: TRUE means auto relative coords + user :PTR TO LONG -> Pointer to anything + ENDOBJECT + +@endnode + +@node "BeBox_bebox" "Amiga Foundation Classes: BeBox/bebox()" + + NAME: bebox(x=0, y=0, w=0, h=0) + + SYNOPSIS: bebox(ULONG x = 0, ULONG y = 0, ULONG w = 0, ULONG h = 0) + + DESCRIPTION: This is the class constructor. If you want, you can + pass the box dimensions and positions, while creating + the object. + + INPUT: x, y - (Optional) Box left and top position. + + w, h - (Optional) Box width and height. + + + RESULTS: + + SEE ALSO: +@endnode + +@node "BeBox_setattrs" "Amiga Foundation Classes: BeBox/setattrs()" + + NAME: setattrs(tags:PTR TO LONG) + + SYNOPSIS: setattrs(struct TagItem *tags) + + DESCRIPTION: This method is used to change Box attributes, such + as dimensions, positions and so on. + It is *the only way* to access to BeBox class structure. + + INPUT: tags - (PTR TO LONG) taglist. Avaible tags are: + + + SIZE: + + BB_WIDTH - Box's Width + BB_HEIGHT - Box's Height + BB_ENDX - Box's end X coord (instead of specify the Width, you + just specify box's end x position: BeBox will + compute automagically the width for you). + BB_ENDY - Box's end Y coord. + + COORDS: + + BB_POSX - Box's X Position + + BB_POSY - Box's Y Position + + BB_RELX - Box's Relative X coord. You can specify an "offset" + that will be added to the box's X coord. + BB_RELY - Box's Relative Y coord. + + BB_OLDX - Box's last x position. (-1 = erase last value) + + BB_OLDY - Box's last y position. (-1 = erase last value) + + BOUNDS: + + You can "bound" the box inside a rectangle. With the following + tags you can set the coords of that rectangle. + Please note that MAXX and MAXY refer to box's x+width. + + + BB_MINX - Box's Min X coord. + BB_MINY - Box's Min Y coord. + BB_MAXX - Box's Max X coord. + BB_MAXY - Box's Max Y coord. + + GRAPHIC: + + You can set rastport, draw color and other values. + Here come the tags... + + BB_RPORT - Box's rastport to draw on. + + BB_COL - Box's drawing color. + + BB_USEREL - This is a flag: if set to TRUE, box will compute + new coords by checking mouse coords inside the box. + + BB_DRAW - You can assign a pointer to a function right here. + The destination function *must* accept the following + parameters, in this order: + + drawingproc(data:PTR TO bebox_data, mode) + + where data is a PTR TO a @{" bebox_data " LINK bebox_structure} + structure. + + Mode is a flag: TRUE means "draw", while FALSE means + "delete obj from the screen". + + USER: + + BB_USER - Box's user tag. Place here whatever you want. + + RESULTS: + + SEE ALSO: @{" get() " LINK bebox_get} +@endnode + +@node "BeBox_get" "Amiga Foundation Classes: BeBox/get()" + + NAME: get(tagname) + + SYNOPSIS: APTR get(ULONG tag) + + DESCRIPTION: This method returns the current value of the specified + tag. Please refer to @{" setattrs() " LINK bebox_setattrs} for a + complete list of tags. + + INPUT: tagname - Tag to query the value. + + RESULTS: a LONG value containing the result + + SEE ALSO: @{" setattrs() " LINK bebox_setattrs} +@endnode + +@node "BeBox_check" "Amiga Foundation Classes: BeBox/check()" + + NAME: check(x, y) + + SYNOPSIS: BOOL check(ULONG x, ULONG y) + + DESCRIPTION: This method checks the given coords and returns + whether they are inside or outside the bebox. + + INPUT: x,y - Corrdinates to check. + + RESULTS: TRUE - The coords are inside the box. + + FALSE - Coords are outside the box. + + SEE ALSO: +@endnode + +@node "BeBox_draw" "Amiga Foundation Classes: BeBox/draw()" + + NAME: draw(mode = TRUE) + + SYNOPSIS: void draw(BOOL mode = TRUE) + + DESCRIPTION: This method invokes the drawing routine. + + INPUT: mode - (Optional) If TRUE then the box will be drawn on the + screen. If FALSE the box will be erased from the screen. + Default: TRUE. + + RESULTS: + + SEE ALSO: +@endnode + +@node "BeBox_version" "Amiga Foundation Classes: BeBox/version()" + + NAME: version() + + SYNOPSIS: ULONG version(BOOL revision = FALSE) + + DESCRIPTION: This method returns class version and revision. + + INPUT: NONE. + + RESULTS: this method returns TWO values: VERSION and REVISION. + + SEE ALSO: +@endnode + +@node "BeBox_error" "Amiga Foundation Classes: BeBox/error()" + + NAME: error() + + SYNOPSIS: ULONG error(void) + + DESCRIPTION: This method returns the last error raised. + + INPUT: NONE. + + RESULTS: the last error raised by this class. + + SEE ALSO: +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/explain_exception.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/explain_exception.guide new file mode 100644 index 0000000..acc92de --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/explain_exception.guide @@ -0,0 +1,78 @@ +@database explain_exception.guide + +@$VER: explain_exception V1.20 + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node Main "Amiga Foundation Classes: explain_exception" + + + + ** Explain_Exception - Original By Fabio Rotondo ** + + * Part of the Amiga Foundation Classes * + + @{" Author's Info " link "author"} @{" Amiga Foundation Classes " LINK "AFC.Guide/main"} @{" History " LINK "explain_exception_History"} + + REQUIRES: AmigaE version needs "tools/exceptions" + + + + NAME: explain_exception(v=0) + + SYNOPSIS: VOID explain_exception(LONG v=0) + + DESCRIPTION: This function helps you to debug your program. + Using this program you can "translate" the error Raise()d + by a method inside an AFC class into a message sent to the + consolle. + It is incredibly easy and handy to use. + + + INPUT: v - (Optional) Exception value. + If it is omitted, it will return the + current exception. + + + RESULTS: NONE. + + + SEE ALSO: + +@endnode + +@node "author" "Author's Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) + +@endnode + +@node explain_exception_history "Amiga Foundation Classes: explain_exception / HISTORY" + + HISTORY + + V1.20 - Initial Release +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/mgui.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/mgui.guide new file mode 100644 index 0000000..c0b97af --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/mgui.guide @@ -0,0 +1,576 @@ +@database mgui.guide + +@$VER: MGui V2.30 - By Fabio Rotondo (C)Amiga Foundation Classes + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node main "Amiga Foundation Classes: mgui_oo/Main" + + + ** Mgui- Original By Fabio Rotondo ** + + Part of Amiga Foundation Classes + + + + + @{" Introduction " LINK mgui_intro} @{" Author(s) Info " LINK author} @{" Amiga Foundation Classes " LINK "afc.guide/main"} + + + Requires: @{" NodeMaster " LINK "NodeMaster.guide/Main"}, EasyGUI + + Base: $000C + + COMMANDS BRIEF DESCRIPTION + ----------------------------------------------------------------------- + @{" mgui() " LINK mgui_mgui} Init the object. + @{" addA(wtitle, gui, tags) " LINK mgui_addA} Add a new GUI. + @{" clear() " LINK mgui_clear} Close all GUIs. + @{" del() " LINK mgui_del} Delete a GUI. + @{" empty() " LINK mgui_empty} Check if mgui has no GUIs. + @{" first() " LINK mgui_first} Pos on first GUI. + @{" freeguis() " LINK mgui_INTERNAL} * INTERNAL USE ONLY * + @{" gui() " LINK mgui_gui} Actual GUI pointer. + @{" lock(mode=TRUE) " LINK mgui_lock} Lock/Unlock GUI. + @{" message() " LINK mgui_message} Parse a message. + @{" nm() " LINK mgui_nm} Returns related NodeMaster object. + @{" numgui() " LINK mgui_numgui} Number of avail GUIs. + @{" pop(pos=TRUE) " LINK mgui_pop} Pop a GUI from the stack. + @{" pos(v, m=NAME, here=FALSE) " LINK mgui_pos} Search for a GUI. + @{" push() " LINK mgui_push} Push a GUI into the stack. + @{" setattrs(tags) " LINK mgui_setattrs} Set various attributes. + @{" succ() " LINK mgui_succ} Pos on next GUI. + @{" version() " LINK mgui_version} Returns object's version and revision. + + @{" ERROR TABLE " LINK Error_Table} + +@endnode + +@node author "Author(s) Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) +@endnode + +@node mgui_intro "mgui / Introduction" + + MGUI + + Mgui is a class that helps Amiga E programmers to write multi-gui programs + very easily. + + It rely heavily on EasyGUI, so it is very hard that it will be ported to + any other language. Anyway, I decided to include it in AFC because it is + extremily useful. + + Note: you must to know how to use EasyGUI to use mgui. + + I have nothing more to add. Just try this class and enjoy yourself. + + Cheers, + + Fabio Rotondo + +@endnode + +@node Error_Table "mgui / Error Table" + +At the moment, this class does not define any error. + +@endnode + +@node mgui_mgui "mgui / mgui()" + + NAME: mgui() + + DESCRIPTION: mgui class constructor. + + INPUTS: NONE + + RESULTS: NONE + + SEE ALSO: @{" NodeMaster/nodemaster() " LINK "NodeMaster.guide/NodeMaster_nodemaster"} + +@endnode + +@node mgui_first "mgui / first()" + + NAME: first() + + DESCRIPTION: Set position to the first GUI in the mgui object. + + INPUTS: NONE + + RESULTS: a PTR to GUI - First() succeded. + + NIL - First() failed. + + SEE ALSO: @{" NodeMaster/first() " LINK "NodeMaster.guide/NodeMaster_first"} + +@endnode + +@node mgui_succ "mgui / succ()" + + NAME: succ() + + DESCRIPTION: Set position to the next GUI in the mgui object. + + INPUTS: NONE + + RESULTS: a PTR to GUI - succ() succeded. + + NIL - succ() failed. + + SEE ALSO: @{" NodeMaster/succ() " LINK "NodeMaster.guide/NodeMaster_succ"} + +@endnode + +@node mgui_empty "mgui / empty()" + + NAME: empty() + + DESCRIPTION: Checks if mgui object is empty or not. + + INPUTS: NONE + + RESULTS: TRUE - mgui object is empty. + + FALSE - at least one GUI is present. + + SEE ALSO: @{" NodeMaster/empty() " LINK "NodeMaster.guide/NodeMaster_empty"} + +@endnode + +@node mgui_gui "mgui / gui()" + + NAME: gui() + + DESCRIPTION: Get actual GUI pointer. + + INPUTS: NONE + + RESULTS: a PTR to a GUI - gui() succeded. + + NIL - gui() failed. (mgui is empty) + + SEE ALSO: @{" NodeMaster/obj() " LINK "NodeMaster.guide/NodeMaster_obj"} + +@endnode + +@node mgui_numgui "mgui / numgui()" + + NAME: numgui() + + DESCRIPTION: Get the number of GUIs opened at the moment. + + INPUTS: NONE + + RESULTS: a LONG containing the number of GUIs opened. + + SEE ALSO: @{" NodeMaster/numitems() " LINK "NodeMaster.guide/NodeMaster_numitems"} + +@endnode + +@node mgui_push "mgui / push()" + + NAME: push() + + DESCRIPTION: Push a GUI into the stack. + + INPUTS: NONE + + RESULTS: TRUE - GUI pushed into the stack. + + FALSE - push() failed. (Stack is full) + + SEE ALSO: @{" NodeMaster/push() " LINK "NodeMaster.guide/NodeMaster_push"} + +@endnode + +@node mgui_pop "mgui / pop()" + + NAME: pop(pos=TRUE) + + DESCRIPTION: Pop a GUI from the stack. + + INPUTS: pos - Should be TRUE or FALSE: + + TRUE - (default) a GUI is pop()ed from the stack + and the mgui object is positioned on it. + + FALSE - a GUI is pop()ed from the stack, but mgui + IS NOT positioned on it (ie. just clear a + push()ed GUI) + + RESULTS: a PTR to GUI - pop() succeded. + + NIL - pop() failed (stack is empty or pos=FALSE) + + SEE ALSO: @{" NodeMaster/pop() " LINK "NodeMaster.guide/NodeMaster_pop"} + +@endnode + +@node mgui_clear "mgui / clear()" + + NAME: clear() + + DESCRIPTION: Close all GUIs. + + INPUTS: NONE + + RESULTS: all GUIs are closed. + + SEE ALSO: @{" NodeMaster/clear() " LINK "NodeMaster.guide/NodeMaster_clear"} + +@endnode + +@node mgui_addA "mgui / addA()" + + NAME: addA(wtitle:PTR TO CHAR, gui, tags=NIL:PTR TO LONG) + + DESCRIPTION: Add a new GUI to mgui object using tag-list. + + INPUTS: wtitle - Title of the GUI window. + + gui - GUI description (see EasyGUI) + + tags - Tag List. You can happily mix EasyGUI tags + with Mgui tags in the same list. + + RESULTS: a PTR to a gui_obj - The GUI has been added. + + NOTES: - This method may raise exceptions coming from NodeMaster() and + EasyGUI. + + - Starting from EasyGUI V3.3a, new tags have been added to + allow better multiple GUIs handling. + Please, note that: + + -->> you MUST NOT use the EG_CLEAN tag <<-- + + Use the MGUI_FREEPROC method instead. + + - Don't use EG_INFO. Use MGUI_INFO instead. + + - This method actually returns TWO values: + + gui - a pointer to a valid gui_obj + gh - pointer to the gui handle + + SEE ALSO: @{" setattrs() " LINK Mgui_setattrs} + + EasyGUI/easyguiA() + + @{" NodeMaster/add() " LINK "NodeMaster.guide/NodeMaster_add"} + + +@endnode + +@node mgui_message "mgui / message()" + + NAME: message() + + DESCRIPTION: Waits for a new message from the user. + This is one of the coolest methods of the object: + you just do not have to do anything: everything is + handled by this method, which minds also for + inputs coming from external signals. + + INPUTS: NONE + + RESULTS: This method returns THREE values at a time: + + parsed - TRUE if signal arrived has been + correctly parsed. + + sig - Signal arrived at Wait(). + + res - result returned by guimessage(). + + SEE ALSO: EasyGUI/guimessage() + +@endnode + +@node mgui_setattrs "mgui / setattrs()" + + NAME: setattrs(tags) + + DESCRIPTION: This method is used to change some current GUI's attributes + and also to change mgui object's attributes. + This is the only way to modify mgui behaviours. + + INPUTS: There are two kind of tags, those working on the current GUI + and the others working on mgui itself. We'll list them + separately. + + GUI Tags, these are the tags acting on the current GUI: + + MGUI_MAIN - Tells mgui whether the current GUI is the main one + or not. When the main GUI is closed, all the + others GUI will be closed at the same time. + Possible values, TRUE / FALSE. + + MGUI_FREEPROC - Tells mgui what procedure(s) to call when + the current GUI'll be closed. This is very + useful, because you can create very complex + GUI with a lot of dinamycally allocated + objects and structures, that have to be freed + on GUI closing. This command needs a list + (or a structure) containing: PTR to proc and + arguments to pass to the procedure. Example: + + [MGUI_FREEPROC, [{freeobj}, obj, + {freesig}, sig, + NIL, NIL], + NIL, NIL] + + MGUI_NAME - This is not just a name, it is more like an + "handle". Name value can be of 4 bytes (4 CHARS) + just like the errors you usually Raise(). + Possible values, anything 4 bytes long. + Example: "MAIN" + + MGUI_USER - This is a field you should fill with anything you + want. It is just a PTR to something. + Possible values, everything. + Example: myobj. + + MGUI_INFO - This is the MGui replacement FOR EG_INFO. + + MGUI_LOCK - You can lock/unlock a GUI with this tag, so you + can receive user's inputs or just ignore them. + Possible values: TRUE (locks GUI), FALSE (unlock GUI) + + MGUI_FREEGUI - You can tell to Mgui class whether to free a GUI + or not. Usually, Mgui will mind GUI deallocation + after closing the GUI, so you don't have to + worry about it, but sometimes, it is better if + YOU do it by yourself. For example, in a + multi-gui list. This TAG will allow you to do + whatever you want with your GUI definition. + Possible values: TRUE (default) free the gui + definition. FALSE do not free gui definition. + NOTE: by default the gui definition WILL BE + freed. And you have to set this tag to FALSE + for every GUI you do not want to free. + + MGUI Tags, these are tags action on the mgui object as a whole: + + MGUI_ADDSIGMASK - With this tag you can add to mgui Wait() + signal some external signals you want mgui to + hear about. When the Wait() is trigged by + one of these sigs, the message isn't parsed + and the message() method will return it to + your control: you should be able to handle + this message correctly. + + MGUI_REMSIGMASK - With this tag you can remove an external + signal previously added with MGUI_ADDSIGMASK. + From now on, Wait() will not wait for it + anymore. + + MGUI_ADDEXTERNAL - This is a tag very similar to + MGUI_ADDSIGMASK, but this time, you have to + provide to mgui also a procedure to call + whenever the Wait() is trigged by the sig + you want. This is very useful, for example, + to wait for Commodity or ARexx events and + then to have mgui to handle all these stuff + for you. + The syntax is the following: + [MGUI_ADDEXTERNAL, [{procedure}, signal, + proc_params], + NIL, NIL] + + procedure - proc to call when Wait() is + trigged. + + signal - External signal to check. + + proc_params - Paramteres to pass to the + procedure. If you want to + pass more than one single + value, enclose them inside + []. Example: + [param1, param2, param3] + + MGUI_REMEXTERNAL - This tag removes a signal set with + MGUI_ADDEXTERNAL. From now on, Wait() will + not wait for external exents anymore. + Possible values: signal to remove. + Example: + [MGUI_REMEXTERNAL, signal, NIL, NIL] + + MGUI_LOCKALL - This tag will enable you to lock/unlock + ALL GUIs in one single shot. + Possible values: TRUE (locks GUIs), FALSE + (unlock GUIs) + + + NOTES: - Don't use EG_INFO in your program. Use MGUI_INFO instead. + + - Don't use EG_CLEAN in your program. Use MGUI_FREEPROC instead (it is + also more comfy than EG_CLEAN) + + RESULTS: NONE + + SEE ALSO: @{" message() " LINK mgui_message} + @{" action() " LINK mgui_action} + +@endnode + +@node mgui_lock "mgui / lock()" + + NAME: lock(mode=TRUE) + + DESCRIPTION: This method locks or unlocks current GUI. + + INPUTS: mode - TRUE locks the GUI (default), + + FALSE unlocks the GUI. + + RESULTS: NONE + + SEE ALSO: @{" setattrs() " LINK mgui_setattrs} + + EasyGUI/blockwin() + EasyGUI/unblockwin() +@endnode + +@node mgui_del "mgui / del()" + + NAME: del() + + DESCRIPTION: This method close current GUI. + The current GUI is closed and the proc set using + MGUI_FREEPROC tag is called to free resources. + + INPUTS: NONE + + RESULTS: PTR to next avaible GUI or NIL if it was the last GUI. + + + SEE ALSO: @{" add() " LINK mgui_add} + + @{" NodeMaster/del() " LINK "NodeMaster.guide/NodeMaster_del"} + +@endnode + +@node mgui_pos "mgui / pos() " + + NAME: pos(value, mode=MGUI_SEARCH_NAME, fromhere=FALSE) + + DESCRIPTION: This method will scan all GUIs to find the one matching the + value required. Value may vary and it is influenced by the + mode value. + + INPUTS: value - Value to search. + + mode - Search mode. Avaible modes are: + + MGUI_SEARCH_NAME - Compare value with GUI's name + field. + + MGUI_SEACH_GUIHANDLE - Compare value with GUI's + guihandle. + + MGUI_SEARCH_MAIN - Will search for the first + GUI with the main flag set. + + fromhere - Tells mgui whether to scan from the beginning + of the list of GUIs or just from the current + position. Default is FALSE: the list is scanned + from the first position. + + + RESULTS: a PTR to GUI - pos() succeded. + + NIL - pos() failed. + + NOTE: When the pos() has mode set to MGUI_SEARCH_MAIN, value is + ignored. + + SEE ALSO: + +@endnode + +@node mgui_nm "mgui / nm() " + + NAME: nm() + + DESCRIPTION: This method returns the PTR to the embedded + NodeMaster object. + + INPUTS: NONE + + RESULTS: a PTR to NodeMaster object. + + SEE ALSO: @{" NodeMaster " LINK "NodeMaster.guide/main"} +@endnode + +@node mgui_action "mgui / action() " + + NAME: action(actions) + + DESCRIPTION: This method is used to trig some actions on current GUI. + + INPUTS: actions - Action to perform on current GUI. + Current defined actions are: + + MGUI_ACTION_TOFRONT - Brings GUI window to front. + + MGUI_ACTION_TOBACK - Brings GUI window to back. + + MGUI_ACTION_ACTIVATE - Activate GUI window. + + These actions can be ORed together. Example: + + action(MGUI_ACTION_TOFRONT OR MGUI_ACTION_ACTIVATE) + + RESULTS: TRUE - Actions performed. + + FALSE - action() failed (maybe no GUI is avaible) + + + SEE ALSO: @{" setattrs() " LINK mgui_setattrs} + +@endnode + +@node mgui_version "mgui / version() " + + NAME: version() + + DESCRIPTION: This method returns current version and revision of the + mgui class currently in use. + + INPUTS: NONE + + RESULTS: This method returns TWO values: version and revision. + + SEE ALSO: + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/parser.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/parser.guide new file mode 100644 index 0000000..1c08bbc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/parser.guide @@ -0,0 +1,161 @@ +@database parser.guide + +@$VER: Parser V1.30 - By Fabio Rotondo (C)Brighting Brain Brothers + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node Main "Amiga Foundation Classes: Parser" + + + + ** Parser - Original By Fabio Rotondo ** + + Part of the Amiga Foundation Classes + + @{" Introduction " link "Parser_introduction"} @{" Author's Info " link "author"} @{" Amiga Foundation Classes " LINK "AFC.Guide/main"} @{" History " LINK "Parser_History"} + + Requires: Nothing. + + Class Base: $00090000 + + NEW COMMANDS BRIEF DESCRIPTION + ------------------------------------------------------------------------- + @{" parser(numelems=25) " link "Parser_Parser"} Initailizes the class. + @{" arg(n) " Link "Parser_Arg"} Returns n.th argument. + @{" parse(template, string) " Link "Parser_Parse"} Parses a string. + @{" version() " link "Parser_version"} Returns Parser version. + + @{" Error Table " LINK Parser_ErrorTable} +@endnode + +@node "Parser_Introduction" "Introduction" + + INTRODUCTION + + Parser is a class which relies on AmigaDOS ReadArgs() method to parse strings. + This is a very smart approach to, for example, ARexx argument parsing and can + lead to great results and incredibly flexible implementations. + + With Parser class you can use all standard AmigaDOS templates to parse a string. + + +@endnode + +@node "author" "Author's Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + C++ Version By: Massimo Tantignone (tanti@intercom.it) + + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) + +@endnode + +@node Parser_ErrorTable "Parser / Error Table " + +VALUE | DESCRIPTION +----------------+---------------------------------- +$0000 | No Memory. +@endnode + +@node "Parser_Parser" "Amiga Foundation Classes: Parser/Parser()" + + NAME: parser(numelems=25) + + SYNOPSIS: VOID parser(ULONG numelems=25) + + DESCRIPTION: This is the class constructor. + You should pass the maximum number of elements to parse + at every call. Default value is 25 elements which should be + enought for everyday use. + + INPUT: numelems - (Optional) Number of elements to parse. + + RESULTS: + + SEE ALSO: +@endnode + +@node "Parser_Parse" "Amiga Foundation Classes: Parser/Parse()" + + NAME: parser(template:PTR TO CHAR, str:PTR TO CHAR) + + SYNOPSIS: RDArgs * parse(STRPTR template, STRPTR str) + + DESCRIPTION: This method parses a string using the provided template. + Templates are standard AmigaDOS templates, such as: + + "FILE/A,NAME/K,DELETE/S" + + INPUT: template - String parsing template. + + str - String to parse. + + RESULTS: a pointer to the resulting RDArgs structure. + Just check it against NIL (or NULL) which means "error". + + NOTE: The template string CANNOT contain white spaces. + + SEE ALSO: @{" arg() " LINK "Parser_arg"} +@endnode + +@node "Parser_arg" "Amiga Foundation Classes: Parser/arg()" + + NAME: arg(ULONG elem) + + SYNOPSIS: APTR arg(ULONG elem) + + DESCRIPTION: This method returns the argument 'elem'. + You MUST have parsed something to get reliable results. + + INPUT: elem - The (ordinal) number of the argument you wish to get. + The number starts from 0 and increments until the last + argument present in the template you provided to + @{" parse() " LINK "Parser_parse"} method. + Ex: + + "FILE/A,NAME/K,DELETE/S" + + 0 1 2 + + RESULTS: the pointer to the argument selected. + + SEE ALSO: @{" parse() " LINK "Parser_parse"} +@endnode + +@node "Parser_version" "Amiga Foundation Classes: Parser/version()" + + NAME: version() + + SYNOPSIS: ULONG version(BOOL revision = FALSE) + + DESCRIPTION: This method returns class version and revision. + + INPUT: NONE. + + RESULTS: this method returns TWO values: VERSION and REVISION. + + SEE ALSO: +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/rexxer.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/rexxer.guide new file mode 100644 index 0000000..81a9f92 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/rexxer.guide @@ -0,0 +1,354 @@ +@database rexxer.guide + +@$VER: Rexxer V1.10 - (C)Copyright Amiga Foundation Classes + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node Main "Amiga Foundation Classes: Rexxer" + + + + ** Rexxer - Original By Fabio Rotondo and Andrea Galimberti ** + + * Part of the Amiga Foundation Classes * + + @{" Introduction " link "Rexxer_introduction"} @{" Author's Info " link "author"} @{" Amiga Foundation Classes " LINK "AFC.Guide/main"} @{" History " LINK "rexxer_history"} + + Requires: @{" validPortName " LINK "validPortName.guide/main"} + + Class Base: $000D0000 + + NEW COMMANDS BRIEF DESCRIPTION + ------------------------------------------------------------------------- + @{" rexxer(portname, start) " link "Rexxer_Rexxer"} Initailizes the class. + @{" get(parserproc) " link "Rexxer_Get"} Gets an ARexx message. + @{" getanswer() " link "Rexxer_GetAnswer"} Gets an ARexx reply string from a host. + @{" name() " link "Rexxer_Name"} Returns the port name. + @{" port() " link "Rexxer_port"} Returns class port. + @{" rc() " link "Rexxer_rc"} Gets message RC. + @{" reply(mes, rc=0, resultstr=NIL) " link "Rexxer_reply"} Replies TO an ARexx message. + @{" result() " link "Rexxer_result"} Gets message result. + @{" send(hostname, command) " link "Rexxer_send"} Sends an ARexx message TO a program. + @{" sigbit() " link "Rexxer_sigbit"} Gets the signal bitmask of the class. + @{" version() " link "Rexxer_version"} Returns Rexxer version. + + + + @{" Error Table " LINK Rexxer_ErrorTable} +@endnode + +@node Rexxer_History "Amiga Foundation Classes: Rexxer / History" + + HISTORY + + v1.10 - Added the "validPortName" AFC function to allow better performances in + looking for the right ARexx Port name. + + v1.00 - First AFC release. + + Thanks to Wouter who fixed a very nasty problem in the send() method. + +@endNode + +@node "Rexxer_Introduction" "Introduction" + + INTRODUCTION + + Rexxer is a class to create and handle ARexx ports and messages. + Using this class, you'll be able to send messages to other programs, + to receive messages to external programs and to share data with them. + + This class has been designed to be extremely easy to use. + + We hope you'll like it. + +@endnode + +@node "author" "Author's Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + Andrea Galimberti + + E Version By: Fabio Rotondo + Andrea Galimberti + + Addresses: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) + + + + Andrea Galimberti + Via E.Villoresi 279 + Turbigo (MI) + ITALY + + Phone: (ITA) - (0)331 - 871009 (home) + +@endnode + +@node Rexxer_ErrorTable "Rexxer / Error Table " + +VALUE | DESCRIPTION +----------------+-------------------------------------------------------------------- +$0000 | No Memory. +$0001 | "Double Port": you are trying to create a port that already exists. +$0002 | Error during port creation. +$0003 | Cannot find "rexxsyslib.library" +$0004 | Error creating the message using CreateRexxMsg() call. +@endnode + +@node "Rexxer_Rexxer" "Amiga Foundation Classes: Rexxer/Rexxer()" + + NAME: rexxer(portname:PTR TO CHAR, start = 1) + + SYNOPSIS: rexxer(STRPTR portname, CHAR start = 1) + + DESCRIPTION: This is the class constructor. + During class initialization, the port of the Rexx handler + will be created, so you have to provide the port name as + a parameter. + + + INPUT: portname - Name of the port, ex. "AREXX_TEST" + NOTE: to follow Commodore's Style Guide, + you should provide a complete + UPPERCASE port name, without spaces. + + start - (Optional) The portname number. + Ex. in 'DOPUS.1' the ".1" is the number. + + NOTES: - The portname you should provide is just the basename. + + * DO NOT PROVIDE COMPLETE NAMES, SUCH AS 'DOPUS.1' * + * BUT JUST 'DOPUS' * + + - The ARexx Port name may differ from the original + basename + number you'll provide. + Use the @{" name() " LINK "Rexxer_name"} method to + know the _right_ name of your ARexx Port. + RESULTS: + + SEE ALSO: @{" name() " LINK "Rexxer_name"} + + @{" validPortName " LINK "validPortName.guide/main"} +@endnode + +@node "Rexxer_get" "Amiga Foundation Classes: Rexxer/get()" + + NAME: get(parseproc) + + SYNOPSIS: get((VOID *) parserproc (STRPTR)) + + DESCRIPTION: This method looks for queued ARexx messages and + pass them to the 'parseproc' you should provide. + The parseproc MUST return three values: + + quit - If TRUE, it means that the application should quit. + rc - RC result value + result - An (optional) result string. You can provide it ONLY + when RC is 0. + + INPUT: parseproc - Parsing procedure to be called. + + RESULTS: this method returns THREE values: + + quit + rc + result + + see above for their discussion. + + NOTES: The ARexx message received will be automatically replied with + rc and result parameters you will provide, using the + @{" reply() " LINK "Rexxer_reply"} method. + So remember: YOU SHOULD NOT REPLY TO A MESSAGE ARRIVED TO YOUR + PORT. + + SEE ALSO: @{" send() " LINK "Rexxer_send"} + @{" reply() " LINK "Rexxer_reply"} +@endnode + +@node "Rexxer_reply" "Amiga Foundation Classes: Rexxer/reply()" + + NAME: reply(mes:PTR TO rexxmsg, rc=0, resultstring = NIL) + + SYNOPSIS: void reply(struct RexxMsg * mes, LONG rc=0, STRPTR resultstr=NULL) + + DESCRIPTION: this method reply to a previosly received ARexx message. + If you use the @{" get() " LINK "Rexxer_get"} method + you should not worry about this method to reply to messages, + because they will be automatically replied. + + INPUT: mes - Original ARexx message + + rc - RC to return + + resultstring - Result String to return + + RESULTS: + + SEE ALSO: @{" get() " LINK "Rexxer_get"} +@endnode + +@node "Rexxer_send" "Amiga Foundation Classes: Rexxer/send()" + + NAME: send(hostname:PTR TO CHAR, command:PTR TO CHAR) + + SYNOPSIS: BOOL send(STRPTR hostname, STRPTR command) + + DESCRIPTION: this method sends an ARexx message to another program. + + INPUT: hostname - This is the port name of the program you wish + to contact (ex. 'DOPUS.1' for Directory Opus) + + command - The string you wish to send to the program you + are contacting. + + RESULTS: This method returns THREE values: + + success - TRUE means "Message sent successfully" + + FALSE "Something went wrong" (usually: port not found) + + rc - The RC code returned by the ARexx host contacted. + + result - The RESULT string returned by the ARexx host contacted. + + NOTE: It is safe to address the RESULT string with just a char pointer because + the RESULT string is stored internally in Rexxer class. + Of course, the RESULT string will not change until you'll create and send + a new ARexx message. + If you want to store the RESULT string for further uses, please consider + StrCopy()ing it inside a variable you own. + + SEE ALSO: @{" get() " LINK "Rexxer_get"} + @{" getanswer() " LINK "Rexxer_getanswer"} + @{" rc() " LINK "Rexxer_rc"} + @{" result() " LINK "Rexxer_result"} +@endnode + +@node "Rexxer_getanswer" "Amiga Foundation Classes: Rexxer/getanswer()" + + NAME: getanswer() + + SYNOPSIS: void getanswer( void ) + + DESCRIPTION: this method forces the Rexxer class to wait for an answer + from an hosts it has contacted. + + * This is a very LOW LEVEL function and you should never * + * use it for everyday applications, because it could hang * + * up your machine. Be carefull!!! * + + + INPUT: NONE + + RESULTS: This method returns TWO values: + + rc - The last RC arrived + + result - The last RESULT arrived + + SEE ALSO: @{" rc() " LINK "Rexxer_rc"} + @{" result() " LINK "Rexxer_result"} +@endnode + +@node "Rexxer_rc" "Amiga Foundation Classes: Rexxer/rc()" + + NAME: rc() + + SYNOPSIS: LONG rc( VOID ) + + DESCRIPTION: This method returns the last RC received by + @{" getanswer() " LINK "Rexxer_getanswer"} OR @{" send() " LINK Rexxer_send} + + INPUT: NONE + + RESULTS: a LONG value containing the last RC received. + + SEE ALSO: @{" send() " LINK "Rexxer_send"} + @{" getanswer() " LINK "Rexxer_getanswer"} + @{" result() " LINK "Rexxer_result"} +@endnode + +@node "Rexxer_result" "Amiga Foundation Classes: Rexxer/result()" + + NAME: result() + + SYNOPSIS: STRPTR result( VOID ) + + DESCRIPTION: This method returns the last result received by + @{" getanswer() " LINK "Rexxer_getanswer"} OR @{" send() " LINK Rexxer_send} + + INPUT: NONE + + RESULTS: a PTR TO CHAT (STRPTR) value containing the last result received. + + SEE ALSO: @{" send() " LINK "Rexxer_send"} + @{" getanswer() " LINK "Rexxer_getanswer"} + @{" rc() " LINK "Rexxer_rc"} +@endnode + +@node "Rexxer_name" "Amiga Foundation Classes: Rexxer/name()" + + NAME: name() + + SYNOPSIS: STRPTR name( VOID ) + + DESCRIPTION: This method returns the ARexx Port name. + + INPUT: NONE + + RESULTS: a PTR TO CHAT (STRPTR) value containing the ARexx Port Name. + + SEE ALSO: @{" validPortName() " LINK "validPortName.guide/main"} +@endnode + +@node "Rexxer_port" "Amiga Foundation Classes: Rexxer/port()" + + NAME: port() + + SYNOPSIS: MsgPort * port( VOID ) + + DESCRIPTION: This method returns a pointer TO the message port of the class. + + INPUT: NONE + + RESULTS: a MsgPort * value relative TO the Port of the class. + + SEE ALSO: +@endnode + +@node "Rexxer_sigbit" "Amiga Foundation Classes: Rexxer/sigbit()" + + NAME: sigbit() + + SYNOPSIS: ULONG sigbit( VOID ) + + DESCRIPTION: This method returns the signal bit mask FOR the Wait() + command. + + INPUT: NONE + + RESULTS: a LONG containing the signal bitmask. + + SEE ALSO: +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/super_picture.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/super_picture.guide new file mode 100644 index 0000000..c0a882f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/super_picture.guide @@ -0,0 +1,523 @@ +@database super_picture.guide + +@$VER: Super_Picture V1.50 - (C)Copyright Amiga Foundation Classes + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node "Main" "Amiga-E MODULE: Super_Picture" + + + + ** Super_Picture - Original By Fabio Rotondo ** + + ** This Object is part of the Amiga Foundation Classes ** + + ** DOCUMENTATION GUIDE ** + + @{" Introduction " link "Super_Picture_introduction" 0} @{" Author Info " LINK "author"} @{" Amiga Foundation Classes " LINK "afc.guide/main"} @{" History " LINK "Super_Picture_History"} + + Requires: @{" IFFParser " LINK "IFFParser.guide/main"}, @{" Bitmapper " LINK "bitmapper.guide/main"} + + Base: $0007000 + + COMMANDS BRIEF DESCRIPTION + ------------------------------------------------------------------------- + @{" super_picture(pal=TRUE) " link "Super_Picture_Super_Picture" 0} Class Constructor. + @{" bitmap() " LINK "Super_Picture_bitmap"} Returns picture's bitmap. + @{" bmhd() " LINK "Super_Picture_bmhd"} Returns the BitmapHeader. + @{" bmobj() " LINK "Super_Picture_bmobj"} Returns embedded bitmapper. + @{" check(filename) " link "Super_Picture_check"} Checks if the file is a valid ILBM. + @{" clear() " link "Super_Picture_clear"} Frees all memory. + @{" cludge() " LINK "Super_Picture_cludge"} Converts a memory area into a picture. + @{" depth() " LINK "Super_Picture_depth"} Returns picture's depth. + @{" dtload(fname, layers, rport, scr) " LINK "Super_Picture_dtload"} Loads a picture using DataTypes only. + @{" dump() " LINK "Super_Picture_dump"} Dumps a picture inside a file in raw format. + @{" height() " LINK "Super_Picture_height"} Returns picture's height. + @{" image() " LINK "Super_Picture_image"} Creates and returns picture's image structure. + @{" load(fname, layers, rport, trap) " link "Super_Picture_load"} Loads up a picture. + @{" loadraw(filename) " LINK "Super_Picture_loadraw"} Loads a dumped file into memory. + @{" modeid() " LINK "Super_Picture_modeid"} Returns picture's ModeID. + @{" numcols() " LINK "Super_Picture_numcols"} Returns number of colours. + @{" palette() " LINK "Super_Picture_palette"} Returns the picture's palette. + @{" paltoscr(screen) " link "Super_picture_paltoscr"} Set the screen palette. + @{" width() " LINK "Super_Picture_width"} Returns picture's width. + @{" version() " link "Super_Picture_version" 0} Returns class version AND revision. + + @{" Error Table " LINK "Super_Picture_ErrorTable"} + +@endnode + +@node Super_Picture_History "Amiga Foundation Classes: Super_Picture / History" + + HISTORY + + V1.50 - Add: @{" dtload() " LINK Super_Picture_dtload} method + + Enh: now datatype loading supports remapping + + Enh: Added an optional parameter to the @{" load() " LINK Super_Picture_load} method. + + V1.40 - Add: image() method + + V1.30 - Add: dump() method + + V1.20 - Fix: small bug in decodebody() method + + V1.10 - Add: cludge() method + + V1.00 - Inital release + +@endnode + +@node author "Author(s) Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) +@endnode + +@node "Super_Picture_introduction" "Introduction" + + Super Picture Class - Introduction + + This is a very useful class which interfaces the programmer with OS2.0 and OS3.0 + features in loading pictures. + This class allows you to load any kind of picture (via DataTypes) without worrying + about interfacing with datatypes.library, because it does it all by itself. + + The great thing is that is the class itself which knows if DataTypes are avaible + or not and, if not, the class will just handle standard ILBM IFF files, using a + very fast ILBM decoding routine built in: no need of iff.library or any other + "non-standard Amiga" libraries. + + I hope you will enjoy this class. + + Fabio Rotondo + + + NOTE: many thanks to Alfred P. Schwarz, who elped me in writing the image() method. +@endnode + +@node Super_Picture_ErrorTable "Super_Picture / Error Table" + +ERROR VALUE | DESCRIPTION +----------------+------------------------------------- + $0000 | No Memory + $0001 | Could not open 'datatypes.library' + $0002 | Could not create datatype OBJECT + $0003 | DoMethod() call failed + $0004 | Could not save file + $0005 | Could not open file FOR saving + $0006 | BitMapHeader Chunk not found + $0007 | ColorMap chunk not found + $0008 | Body Chunk not found +@endnode + +@node "Super_Picture_Super_Picture" "Amiga Foundation Classes: Super_Picture/Super_Picture()" + NAME: super_picture(pal=TRUE) + + DESCRIPTION: This is the class constructor. + + INPUT: pal - (DEFAULT: TRUE) this is a flag and it is used to tell + the class whether you want to store also a palette along + with picture data or not. + NOTE: if you set it to TRUE, additional 256*3 bytes of memory + will be allocated during construction. + + + RESULTS: NONE. + + SEE ALSO: +@endnode + +@node "Super_Picture_clear" "Amiga Foundation Classes: Super_Picture/clear()" + + NAME: clear() + + DESCRIPTION: This method will free all allocated resources inside a + super_picture class. + + INPUT: NONE. + + RESULTS: Memory will be freed. + + NOTE: It is safe to call this method also if the class has not been + used yet. + + SEE ALSO: @{" bitmapper / clear() " LINK "bitmapper.guide/bitmapper_clear"} +@endnode + +@node "Super_Picture_load" "Amiga Foundation Classes: Super_Picture/load()" + + NAME: load(fname: PTR TO CHAR, layers=FALSE, rastport=FALSE, trap=FALSE, scr=NIL) + + DESCRIPTION: This is the biggy. This method will try to load a picture in + memory. If the user has OS3.0+, also all picture formats + supported by datatypes can be loaded. Under OS2.0+ only ILBM + IFF files will be supported. + + INPUT: fname - The file name of the picture you wish to load. + + layers - (DEFAULT: FALSE) If you want to create a layer + related to the picture you are loading, + set this to TRUE. + + rastport - (DEFAULT: FALSE) If you want to create a + rastport to the picture you are loading, + set this to TRUE. + + trap - (DEFAULT: TRUE) If the picture does not + exists (i.e. "File not found"), then the + class WILL NOT return raise any error, + but you will get the error number as + a return code (you can also ignore it, + if you want.) + If it is set to FALSE, then the class + will raise an exception. + + scr - (DEFAULT: NIL) You can provide a screen + from where the palette will be used to + remap the picture during loading. + This remap works only on DataTypes pictures + at the moment. + + RESULTS: if trap is TRUE and an error occurred, you will have as a + result the error value. + + SEE ALSO: @{" dtload() " LINK "Super_picture_dtload"} + @{" Bitmapper / allocbitmap() " LINK "bitmapper.guide/bitmapper_allocbitmap"} + @{" IFFParser / load() " LINK "iffparser.guide/iffparser_load"} +@endnode + +@node "Super_Picture_check" "Amiga Foundation Classes: Super_Picture/check()" + + NAME: check(filename : PTR TO CHAR) + + DESCRIPTION: This method checks the given file and says if it is a valid + IFF ILBM file or not. + + INPUT: filename - Name of the file to check + + RESULTS: TRUE - It is a valid IFF ILBM file + + FALSE - It is not a valid IFF ILBM file + + NOTE: Usually, you should not use this method, because the + @{" load() " LINK "Super_Picture_load"} method will do this check for you. + + SEE ALSO: @{" IFFParser / getheader() " LINK "IFFParser.guide/IFFParser_getheader"} +@endnode + +@node "Super_Picture_paltoscr" "Amiga Foundation Classes: Super_Picture/paltoscr()" + + NAME: paltoscr(scr:PTR TO screen) + + DESCRIPTION: This method set up the palette of a screen accordingly to the + picture palette. + + INPUT: scr - A *valid* screen pointer. + + RESULTS: NONE. + + SEE ALSO: +@endnode + +@node "Super_Picture_bmhd" "Amiga Foundation Classes: Super_Picture/bmhd()" + + NAME: bmhd() + + DESCRIPTION: This method returns the current BitMapHeader. + + INPUT: NONE. + + RESULTS: A pointer to a valid BitMapHeader structure. + + SEE ALSO: +@endnode + +@node "Super_Picture_bitmap" "Amiga Foundation Classes: Super_Picture/bitmap()" + + NAME: bitmap() + + DESCRIPTION: This method returns a pointer to the current bitmap structure. + + INPUT: NONE. + + RESULTS: a pointer to a Bitmap structure. It may be NIL. + + SEE ALSO: @{" bitmapper / bitmap() " LINK "bitmapper.guide/bitmapper_bitmap"} +@endnode + +@node "Super_Picture_numcols" "Amiga Foundation Classes: Super_Picture/numcols()" + + NAME: numcols() + + DESCRIPTION: This method returns the number of colours of the loaded picture. + + INPUT: NONE. + + RESULTS: number of colours of the picture. It may be 0. + + SEE ALSO: +@endnode + +@node "Super_Picture_modeid" "Amiga Foundation Classes: Super_Picture/modeid()" + + NAME: modeid() + + DESCRIPTION: This method returns the default modeid of the picture. + The ModeID is the standard monitor value for displaying the + picture. + + INPUT: NONE. + + RESULTS: a LONG value, containing the ModeID. + + SEE ALSO: +@endnode + +@node "Super_Picture_width" "Amiga Foundation Classes: Super_Picture/width()" + + NAME: width() + + DESCRIPTION: This method returns picture's width. + + INPUT: NONE. + + RESULTS: a INT containing picture's width. It may be 0. + + SEE ALSO: @{" height() " LINK "Super_Picture_height"} + @{" depth() " LINK "Super_Picture_depth"} +@endnode + +@node "Super_Picture_height" "Amiga Foundation Classes: Super_Picture/height()" + + NAME: height() + + DESCRIPTION: This method return picture's height. + + INPUT: NONE. + + RESULTS: a INT value containing the picture's height. It may be 0. + + SEE ALSO: @{" width() " LINK "Super_Picture_width"} + @{" depth() " LINK "Super_Picture_depth"} +@endnode + +@node "Super_Picture_depth" "Amiga Foundation Classes: Super_Picture/depth()" + + NAME: depth() + + DESCRIPTION: This method returns the picture's depth. + + INPUT: NONE. + + RESULTS: a BYTE value containing the picture depth. It may be 0. + + SEE ALSO: @{" width() " LINK "Super_Picture_width"} + @{" height() " LINK "Super_Picture_height"} +@endnode + +@node "Super_Picture_Super_Picture" "Amiga Foundation Classes: Super_Picture/Super_Picture()" + + NAME: rastport() + + DESCRIPTION: This method returns a pointer to the picture's rastport. + + INPUT: NONE + + RESULTS: a ptr to the picture's rastport. It may be NIL. + + SEE ALSO: @{" bitmapper / rastport() " LINK "bitmapper.guide/bitmapper_rastport"} +@endnode + +@node "Super_Picture_bmobj" "Amiga Foundation Classes: Super_Picture/bmobj()()" + + NAME: bmobj() + + DESCRIPTION: This method returns a pointer to the embedded bitmapper class. + + INPUT: NONE. + + RESULTS: a ptr to the embedded bitmapper class: USE IT AT YOUR OWN RISK! + + SEE ALSO: @{" bitmapper " LINK "bitmapper.guide/main"} +@endnode + +@node "Super_Picture_palette" "Amiga Foundation Classes: Super_Picture/palette()" + + NAME: palette() + + DESCRIPTION: This method returns picture's palette. + + INPUT: NONE. + + RESULTS: it returns a pointer to picture's palette. Please note, it behaves + differently under OS2.0 and OS3.0: + + OS2.0 - It is just a 8 bit palette + + OS3.0+ - It is a 32Bit palette. + + Please, note also that this method returns TWO values: the pointer + to the palette and palette bits involved. + + I.e. under OS2.0 it may return: $10293102, 8 + under OS3.0+ it may return: $10293102, 32 + + SEE ALSO: +@endnode + +@node "Super_Picture_version" "Amiga Foundation Classes: Super_Picture/version()" + + NAME: version() + + DESCRIPTION: This method returns class version and revision. + + INPUT: NONE. + + RESULTS: This method returns TWO values, version and revision. + + SEE ALSO: +@endnode + +@node "Super_Picture_cludge" "Amiga Foundation Classes: Super_Picture/cludge()" + + NAME: cludge(mem:PTR TO CHAR) + + DESCRIPTION: This method converts a memory area into a bitmap. + + INPUT: mem - PTR to the starting memory area. + + RESULTS: + + NOTE: this MUST be a _valid_ memory area created using the + @{" dump() " LINK "Super_Picture_dump"} method. + + SEE ALSO: @{" dump() " LINK "Super_Picture_dump"} + @{" bitmapper / cludge() " LINK "bitmapper.guide/bitmapper_cludge"} + +@endnode + +@node "Super_Picture_dump" "Amiga Foundation Classes: Super_Picture/Super_Picture()" + + NAME: dump(filename) + + DESCRIPTION: This method dumps the current picture into a file in raw format. + + INPUT: filename - Name of the file where to dump the picture. + + RESULTS: NONE. + + NOTE: Current version of this method does not save the palette. + + SEE ALSO: @{" cludge() " LINK "Super_Picture_cludge"} + @{" bitmapper / dump() " LINK "bitmapper.guide/bitmapper_dump"} +@endnode + +@node "Super_Picture_loadraw" "Amiga Foundation Classes: Super_Picture/loadraw()" + + NAME: loadraw(filename) + + DESCRIPTION: This method loads a file created with @{" dump() " LINK "Super_Picture_dump"} method + and creates a picture. + + INPUT: filename - Name of the raw data file to load. + + RESULTS: The picture will be loaded inside the object. + + NOTE: All data in the object will be lost. + + SEE ALSO: @{" clear() " LINK "Super_Picture_clear"} + @{" dump() " LINK "Super_Picture_dump"} + @{" bitmapper / loadraw() " LINK "bitmapper.guide/bitmapper_loadraw"} +@endnode + +@node "Super_Picture_image" "Amiga Foundation Classes: Super_Picture/image()" + + NAME: image() + + DESCRIPTION: Sometimes, it is usefull to obtain picture Image structure, the one + used by Ituition gadgets. Using this method, you can obtain this + Image structure. + + INPUT: NONE + + RESULTS: a pointer to a valid Image structure. + + NOTE: This method is *slow* the first time you call it, because it has + to create the Image structure and picture. Then, it will be + fastlighting, until you don't load another picture in the class. + + SEE ALSO: @{" Bitmapper / image() " LINK "Bitmapper.guide/Bitmapper_image"} + +@endnode + +@node "Super_Picture_dtload" "Amiga Foundation Classes: Super_Picture/dtload()" + + NAME: dtload(fname: PTR TO CHAR, layers=FALSE, rastport=FALSE, scr=NIL:PTR TO screen) + + DESCRIPTION: This is a lower level method than the @{" load() " LINK "Super_Picture_Load"} one. + Using this method you will load a picture using DataTypes ONLY. + This means that you can use this only on OS3.0+. + + This method is faster than the @{" load() " LINK "Super_Picture_Load"} one because + it does not perform the usual "format checking" before trying to load the + picture. + + + + This is the biggy. This method will try to dtload a picture in + memory. If the user has OS3.0+, also all picture formats + supported by datatypes can be dtloaded. Under OS2.0+ only ILBM + IFF files will be supported. + + INPUT: fname - The file name of the picture you wish to dtload. + + layers - (DEFAULT: FALSE) If you want to create a layer + related to the picture you are dtloading, + set this to TRUE. + + rastport - (DEFAULT: FALSE) If you want to create a + rastport to the picture you are dtloading, + set this to TRUE. + + scr - (DEFAULT: NIL) You can provide a pointer to + a screen as the last parameter. + If a screen pointer is passed, then the picture + will be remapped accordingly to the palette + attatched to the provided screen. + + NOTE: This method CANNOT be trapped. If an error occurred, it will raise + an error. + + RESULTS: NOTHING. + + + SEE ALSO: @{" load() " LINK "Super_Picture_Load"} + @{" Bitmapper / allocbitmap() " LINK "bitmapper.guide/bitmapper_allocbitmap"} + @{" IFFParser / dtload() " LINK "iffparser.guide/iffparser_dtload"} +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Docs/validPortName.guide b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/validPortName.guide new file mode 100644 index 0000000..4edd6fb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Docs/validPortName.guide @@ -0,0 +1,102 @@ +@database validPortName.guide + +@$VER: validPortName V1.00 - (C)Copyright Amiga Foundation Classes + +This guide file has been created using AutoGuide V1.05 - By Fabio Rotondo (fsoft@intercom.it). + +@node Main "Amiga Foundation Classes: validPortName" + + + + ** validPortName - Original By Fabio Rotondo ** + + * Part of the Amiga Foundation Classes * + + @{" Introduction " link "validPort_introduction"} @{" Author's Info " link "author"} @{" Amiga Foundation Classes " LINK "AFC.Guide/main"} @{" History " LINK "validPort_History"} + + + + NAME: validPortName(basename:PTR TO CHAR, count=1) + + SYNOPSIS: STRPTR validPortName(STRPTR basename, CHAR count=1) + + DESCRIPTION: This function helps you TO find an unique Message Port name. + The messahe port will be created in the standard format: + + basename.number + + For example: + + 'DOPUS.1', 'IMAGEFX.2' ... + + Where 'basename' is 'DOPUS' and 'IMAGEFX' and number is 1 and 2. + + + INPUT: basename - It must be a *valid* string pointer + that _MUST_ be large enough to handle the + resulting Message Port name. + + count - (Optional) Starting number value. + Default is 1. + + + + RESULTS: portname - A valid (unique) port name. + + NOTE: The portname will be copied in basename, so be sure that the + the string you pass as parameter is large enough to handle + the portname correctly. + + SEE ALSO: + +@endnode + +@node "validPort_Introduction" "Introduction" + + + INTRODUCTION + + validPortName is a function that will help you TO find an unique + Message Port name. + + It is extremely easy TO use AND, even IF it isn't really a class, + it will be included inside the standard AFC distribution because it + is used by various classes. + +@endnode + +@node "author" "Author's Info" + + Original By: Fabio Rotondo (fsoft@intercom.it) + + E Version By: Fabio Rotondo + + Address: + + Fabio Rotondo + C.so Vercelli 9 + 28100 Novara + ITALY + + e-mail: fsoft@intercom.it + Fabio.Rotondo@deagostini.it + + Phone: (ITA) - (0)321 - 459676 (home) + (ITA) - (0)2 - 38086520 (office) + (ITA) - (0)338 - 7336477 (GSM Phone) + + Fax: (ITA) - (0)2 - 38086278 + + Web: http://www.intercom.it/~fsoft (my home page) + + http://www.intercom.it/~fsoft/ablast.html (Amiga Blast Home Page) + +@endnode + +@node validport_history "Amiga Foundation Classes: validPortName / HISTORY" + + HISTORY + + V1.00 - Initial Release +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/EasyGUI_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/EasyGUI_Example.e new file mode 100644 index 0000000..9b1a9af --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/EasyGUI_Example.e @@ -0,0 +1,101 @@ +/* +** NodeMaster_EGui.e +** +** (C)1996/97 Amiga Foundation Classes +** +** This code is placed in the Public Domain. +** It is intended FOR demostration of NodeMaster only. +** +** Feel free of examine, modify AND DO whatever you want! +** +*/ + +/* +** DESCRIPTION: +** +** NodeMaster can HANDLE Exec Lists of everything. +** +** Just TO show its power, you'll see a way of creating +** multiwindows application relying on Wouter's EasyGUI AND +** my NodeMaster. This application is quite complicated AND I'll try TO +** explain it in the better way I can. ;) +*/ +OPT OSVERSION = 37 + +MODULE 'afc/nodemaster', -> This is OUR MODULE + 'afc/explain_exception', + 'tools/easygui' -> 'tools/easygui'... GUESS! + +DEF nm:PTR TO nodemaster -> This is an hinstance of our NodeMaster + +PROC main() HANDLE -> Please, note: HANDLE keyword FOR EXCEPTIONS handling + NEW nm.nodemaster() -> Here we setup our OBJECT. + + dogui() -> we MUST have at least one gui! + + REPEAT -> We will hear FOR GUI events + multiwait() -> (Of multiple windows ;) ... + UNTIL FALSE + +EXCEPT DO -> In CASE of some problems... (OR just TO quit) + explain_exception() + closeall() + END nm -> Remeber ALWAYS TO END a OBJECT!!! + CleanUp(0) -> Let's keep things clean... +ENDPROC + +PROC dogui() HANDLE -> This PROC creates a GUI on the WB screen + DEF gh=NIL:PTR TO guihandle -> a guihandle (NOTE: It is LOCAL! ;) + + gh:=guiinitA('NEW EasyGUI Window!', + [EQROWS, + [SBUTTON, {dogui}, 'Create!'], -> This button just call dogui() again! + [BAR], + [SBUTTON, {do_quit},'Quit!'] -> This will quit ALL! + ]) + + nm.add(gh) -> Here we add this GUI_handle TO our NodeMaster OBJECT + Wait(gh.sig) -> AND wait FOR this window's first signal + +EXCEPT -> In CASE of any error + remgui(gh) -> we remove THIS window from thje Windows LIST + ReThrow() -> AND rethrow() error one level up! +ENDPROC + +PROC multiwait() -> This is one of the most important PROCS! + DEF gh:PTR TO guihandle -> Another LOCAL gui_handle var! + DEF res -> Here we store Window event value... + + IF nm.first() -> Let's start from the first GUI_handler we have stored... + REPEAT + gh:=nm.obj() -> Here we set our gh TO original GUI_handler + res:=guimessage(gh) -> We get one message + IF res>=0 -> AND eventually close this GUI window + remgui(gh) + ENDIF + UNTIL nm.succ() = FALSE -> Now we JUMP TO the next one + ENDIF +ENDPROC + +PROC do_quit() IS Raise("END!") + +PROC closeall() -> This PROC just close ALL opened windows + + IF nm.first() -> We start from the first + REPEAT + cleangui(nm.obj()) -> we clear things up + UNTIL nm.succ() = FALSE -> AND get the next + ENDIF +ENDPROC + +PROC remgui(gh:PTR TO guihandle) -> This PROC remove just one desired gui + IF nm.first() -> Here we scan LIST from the first + REPEAT + IF gh = nm.obj() -> IF the current item is exactly the one we want + nm.del() -> We remove the item from the LIST + cleangui(gh) -> AND clear the interface + RETURN -> THEN exit without ending the LOOP + ENDIF + UNTIL nm.succ() = FALSE -> Here we look FOR the next item... + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/First_Del_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/First_Del_Example.e new file mode 100644 index 0000000..03cdcf9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/First_Del_Example.e @@ -0,0 +1,60 @@ +/* +** StringNode Example-2 +** +** add(), del(), first(), succ() AND last() methods. +** +** (C)Copyright 1996/97 Amiga Foundation Classes +** +** See: http://www.intercom.it/~fsoft/afc.html +** +** FOR more info about AFC AND more modules +*/ + +MODULE 'afc/StringNode', -> Our MAGIC MODULE + 'afc/Explain_Exception' + +PROC main() HANDLE + DEF n:PTR TO stringnode -> This is our OBJECT instance + + NEW n.stringnode() -> OBJECT initialization + + n.add('Zorro') -> Here we add some items... + n.add('Batman') + n.add('Superman') + n.add('Gold Drake') + n.add('Mandrake') + n.add('MOMMY') + + shwall(n) -> Here we see them + + n.first() -> This method should be checked agains FALSE... + n.del() -> It is DEAD! + shwall(n) -> Show Results + + n.succ() -> Two items later... (The first killed...) + n.del() -> Another Kill! + shwall(n) -> Show Results + + n.last() -> The last item + n.del() -> Is DEAD too! + WriteF('Last:\s\n', n.obj()) -> Now this is the last + shwall(n) + +EXCEPT DO + explain_exception() + END n -> Remember ALWAYS TO end an OBJECT + CleanUp(0) +ENDPROC + +PROC shwall(n:PTR TO stringnode) + WriteF('------- \d ----------\n', n.numitems()) + + IF n.first() -> Here we go TO the first node item + REPEAT + WriteF('Node:\s\n', n.obj()) -> Node STRING... + UNTIL n.succ() = FALSE -> LOOP UNTIL the end + ELSE + WriteF('No Nodes in LIST...\n') + ENDIF +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Hardsprite_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/Hardsprite_Example.e new file mode 100644 index 0000000..0c8284f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Hardsprite_Example.e @@ -0,0 +1,72 @@ +/* + + $VER: HardSprite Example 1 - (C)Copyright Amiga Foundation Classes + + Written By: Andrea Galimberti + + This code is Public Domain + + + +*/ + +MODULE 'AFC/hardsprite', + 'AFC/explain_exception', + 'intuition/screens' + + + +PROC main() HANDLE + DEF scr=NIL:PTR TO screen + DEF vp, spr:PTR TO hardsprite + DEF x,y,dx,dy + + NEW spr.hardsprite(2) -> allocate sprite number 2 (IF available) + + spr.image(15,[$0180,$0000, + $03C0,$0000, + $07E0,$0000, + $0FF0,$0000, + $1FF8,$0180, + $3FFC,$03C0, + $7FFE,$07E0, + $FFFF,$0FF0, + $7FFE,$07E0, + $3FFC,$03C0, + $1FF8,$0180, + $0FF0,$0000, + $07E0,$0000, + $03C0,$0000, + $0180,$0000]:INT) -> the LIST must be OF INT type + + + scr:=OpenScreenTagList(NIL,[SA_TOP,0, + SA_LEFT,0, + SA_WIDTH,320, + SA_HEIGHT,256, + SA_DEPTH,5, + SA_TITLE,'Sprite Test', + NIL,NIL] + ) + IF scr=NIL THEN Raise("scr") + vp:=scr.viewport + + x:=36; y:=0 + dx:=1; dy:=1 + + spr.changeImage(vp) + spr.move(vp,x,y) + REPEAT + x:=x+dx; y:=y+dy + IF (x=304) OR (x=0) THEN dx:=-dx + IF (y=240) OR (y=0) THEN dy:=-dy + spr.move(vp,x,y) + WaitTOF() + UNTIL Mouse() + +EXCEPT DO + END spr + IF scr THEN CloseScreen(scr) + explain_exception() +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/IFFParser_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/IFFParser_Example.e new file mode 100644 index 0000000..8a06ae0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/IFFParser_Example.e @@ -0,0 +1,85 @@ +/* +** IFFParser_oo Example 1 +** +** Here you will see how to +** write some chunks and then read them again! +** +** This code is meant for demostration only. +** +** Feel free of examine, modify or rip it! +** +** (C)Copyright 1997 Amiga Foundation Classes. +** +** PD Source Code. +** +*/ + +MODULE 'afc/IFFParser', -> Our MAGIC MODULE! + 'afc/explain_exception' + +PROC main() HANDLE -> NOTE: Exception handling! + DEF iff:PTR TO iffparser -> OBJECT instance + DEF buf[128]:STRING -> a STRING ;) + DEF s:PTR TO CHAR + + NEW iff.iffparser() -> Let's create it! + + iff.save('Ram:Test.IFF') -> First Of ALL let's save an ugly IFF file + iff.createchunk("DEMO","FORM") -> This is the FORM chunk! + + iff.createchunk("DEMO","FTXT") -> This is a FTXT (not exactly 8) chunk! + StrCopy(buf, 'DO you like my object?') -> Here we fill our STRING... + iff.writechunk(buf, StrLen(buf)+1) -> AND write it into the chunk! + iff.closechunk() -> AND THEN we close the chunk... + + iff.createchunk("DEMO","FTXT") -> Another chunk! + StrCopy(buf, 'Is not that easy TO create IFF files with this object?') + iff.writechunk(buf, StrLen(buf)+1) + iff.closechunk() + + iff.createchunk("DEMO","FTXT") -> AND the last FTXT chunk! + StrCopy(buf, 'What a kind of magic!') + iff.writechunk(buf, StrLen(buf)+1) + iff.closechunk() + + iff.createchunk("DEMO","INFO") -> Whaaaat?!?! a nek kind of chunk! + StrCopy(buf, 'Hello ALL, I\qm the INFO chunk!') + iff.writechunk(buf, StrLen(buf)+1) + iff.closechunk() + + iff.closechunk() -> Here we close DEMO FORM chunk! + iff.close() -> AND here we close IFF save file session. + + iff.getheader(buf,'Ram:Test.IFF') -> What kind of file we created? + WriteF('\s\n', buf) + + + iff.load('Ram:Test.IFF') + iff.setscan("DEMO","FTXT") -> Let's load ALL FTXT chunks! + iff.setscan("DEMO","INFO") -> Let's load ALL INFO chunks also! + iff.exit("DEMO","FORM") -> We will stop when FORM ends! + + iff.scan() -> Here comes the sun! + + IF (s:=iff.first("DEMO","INFO")) -> Here we pos TO the first INFO chunk + REPEAT + WriteF('INFO txt:\s\n', s) -> We WriteF() it + UNTIL (s:=iff.succ()) = FALSE -> AND get the next one + ENDIF + + IF (s:=iff.first("DEMO","FTXT")) -> Here we pos TO the first FTXT chunk + REPEAT + WriteF('FTXT txt:\s\n', s) -> We WriteF() it + UNTIL (s:=iff.succ()) = FALSE -> AND get the next one + ENDIF + + iff.close() -> Here we close ALL resources + + +EXCEPT DO + WriteF('Here we die!\n') + explain_exception() + END iff -> ALWAYS END the OBJECT before exiting!!!! + CleanUp(0) +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/IFFParser_Example2.e b/amigae33a/E_v3.3a/Src/Src/Afc/IFFParser_Example2.e new file mode 100644 index 0000000..1da741d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/IFFParser_Example2.e @@ -0,0 +1,58 @@ +/* +** IFFParser_oo Example 2 +** +** This code shows how to load/save +** a very simple IFF preferences file. +** +** (C)Copyright 1997 Amiga Foundation Classes. +** +** This code is placed in the PD +** and may be intended for explanation only. +** +*/ + +MODULE 'afc/iffparser', -> Our MAGIC MODULE! + 'afc/explain_exception' + +OBJECT testprefs -> This is our little prefs structure + x + y + w + h +ENDOBJECT + +PROC main() HANDLE + DEF iff:PTR TO iffparser -> This is our object instance + DEF t:testprefs -> Here there is our prefs var + DEF n=NIL:PTR TO testprefs -> And just a ptr to it + + NEW iff.iffparser() -> First of all we have to INIT the object + + t.x := 1 -> Here we set some dummy values inside + t.y := 2 -> Our prefs var + t.w := 3 + t.h := 4 + + iff.save('ENV:Test.prefs') -> Here we begin to write our prefs file + iff.createchunk("PREF","FORM") -> This is the FORM chunk + iff.createchunk("PREF","PRHD") -> And inside this one + iff.writechunk(t, SIZEOF testprefs) -> We will store the prefs var + iff.closechunk() -> And close it + iff.closechunk() -> Here we close the FORM chunk + iff.close() -> End of IFF save session. + + iff.load('ENV:Test.prefs') -> Now we have to try to read it again! + iff.setscan("PREF","PRHD") -> We look for PRHD inside PREF + iff.exit("PREF","FORM") -> The search will stop at the end of FORM + iff.scan() -> Scan! + IF (n:=iff.first("PREF","PRHD")) -> If there is at least one item... + WriteF('x:\d - y:\d\nw:\d - h:\d\n', n.x, n.y, n.w, n.h) -> Show it! + ENDIF + iff.close() -> End of IFF load session + +EXCEPT DO + explain_exception() -> Just to know exception name + WriteF('Cleaning Up... \n') + END iff -> ALWAYS END THE OBJECT BEFORE EXITING!!! + CleanUp(0) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Localer_Example1.e b/amigae33a/E_v3.3a/Src/Src/Afc/Localer_Example1.e new file mode 100644 index 0000000..a258615 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Localer_Example1.e @@ -0,0 +1,35 @@ +/* + + Localer Example 1 - (C)Copyright Amiga Foundation Classes + + Written By: Fabio Rotondo + + Public Domain Source + +*/ + +MODULE 'afc/localer' + +PROC main() + DEF loc:PTR TO localer + + NEW loc.localer() + + WriteF('System Language:\s\n', loc.language()) + +/* + + Since we don't have any ".catalog" provided with this + example, the loading will fail AND the get() method + will RETURN DEFAULT messages + +*/ + + loc.load('test.catalog') + + + WriteF('\s - \s\n', loc.get(0, 'Test'), loc.get(1, 'Message!')) + + END loc +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/MGUI_Example1.e b/amigae33a/E_v3.3a/Src/Src/Afc/MGUI_Example1.e new file mode 100644 index 0000000..ca3af47 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/MGUI_Example1.e @@ -0,0 +1,92 @@ +OPT OSVERSION=37 +OPT LARGE + +MODULE 'afc/mgui', + 'afc/explain_exception', + 'tools/easyGUI', + 'exec/ports', + 'intuition/intuition' + +DEF times=0 + +PROC main() HANDLE + DEF mg=NIL:PTR TO mgui + DEF win=NIL:PTR TO window + DEF sig + + NEW mg.mgui() + + mg.addA('MGUI Main', [ROWS, + [SBUTTON, {kill_all}, 'Kill ALL'], + [SBUTTON, {newgui}, 'NEW!'], + [SBUTTON, {hideall}, 'Hide'], + [SBUTTON, {showall}, 'Show'] + ], + [MGUI_MAIN, TRUE, + NIL, NIL] + ) + + test(mg) + test(mg) + test(mg) + + IF (win:=OpenWindowTagList(NIL, [WA_WIDTH, 200, + WA_HEIGHT, 100, + WA_TITLE, 'Click Inside!', + WA_IDCMP, IDCMP_MOUSEBUTTONS, + NIL, NIL]))=NIL THEN Raise("win") + + sig:=win.userport::mp.sigbit + sig:=Shl(1, sig) + + mg.setattrs([MGUI_ADDEXTERNAL, [{click}, sig, [win, win.userport, mg, sig, {win}]], + 0,0]) + + WHILE (mg.empty() = FALSE) + mg.message() + ENDWHILE + +EXCEPT DO + IF win THEN CloseWindow(win) + WriteF('Exiting...\n') + explain_exception() + + END mg + CleanUp(0) +ENDPROC + +PROC hideall(gui:PTR TO gui_obj) + gui.mg.setattrs([MGUI_HIDEALL, TRUE, NIL, NIL]) + gui.mg.first() + gui.mg.hide(FALSE) +ENDPROC + +PROC showall(gui:PTR TO gui_obj) IS gui.mg.setattrs([MGUI_HIDEALL, FALSE, NIL, NIL]) + +PROC newgui(gui:PTR TO gui_obj) IS test(gui.mg) + +PROC kill_all(gui:PTR TO gui_obj) IS gui.mg.clearguis() + +PROC msg() IS WriteF('Message!\n') + + +PROC test(mg:PTR TO mgui) + DEF gui:PTR TO LONG + + gui:=NEW [ROWS, + NEW [SBUTTON, {msg}, 'Msg'], + NEW [SBUTTON, 1, 'End'] + ] + + mg.addA('MGui Power!', gui) + +ENDPROC + +PROC click(t:PTR TO LONG) + DEF x:PTR TO LONG + + x:=GetMsg(t[1]) + ReplyMsg(x) + WriteF('Win Clicked: \d Times!\n', times++) +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Mousepointer_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/Mousepointer_Example.e new file mode 100644 index 0000000..6ae40d8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Mousepointer_Example.e @@ -0,0 +1,59 @@ +/* + + $VER: MousePointer Example 1 - (C)Amiga Foundation Classes + + Written By: Andrea Galimberti + + This code is Public Domain + +*/ + +MODULE 'AFC/mousepointer', 'AFC/explain_exception', + 'intuition/screens' + + +PROC main() HANDLE + DEF scr=NIL:PTR TO screen + DEF vp + DEF topo:PTR TO mousepointer + + NEW topo.mousepointer(2) -> try TO get hold OF sprite number 2 + + topo.image(11,[$0080,$0080, + $0080,$0080, + $0080,$0080, + $0080,$0080, + $0080,$0080, + $1F7C,$1F7C, + $0080,$0080, + $0080,$0080, + $0080,$0080, + $0080,$0080, + $0080,$0080]:INT) -> the LIST must be OF INT type + + topo.hotspot(9,6) -> we SET the hotspot + + scr:=OpenScreenTagList(NIL,[SA_TOP,0, + SA_LEFT,0, + SA_WIDTH,320, + SA_HEIGHT,256, + SA_DEPTH,5, + SA_TITLE,'Mouse Test', + NIL,NIL] + ) + IF scr=NIL THEN Raise("scr") + vp:=scr.viewport + + topo.changeImage(vp) -> the NEW image IS bound TO the viewport + topo.move(vp,10,10) + REPEAT + topo.update(vp) -> read mouse movements from hardware registers + WaitTOF() + UNTIL Mouse() + +EXCEPT DO + END topo + IF scr THEN CloseScreen(scr) + explain_exception() +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Parser_Example1.e b/amigae33a/E_v3.3a/Src/Src/Afc/Parser_Example1.e new file mode 100644 index 0000000..4f7e9da --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Parser_Example1.e @@ -0,0 +1,29 @@ +/* + + $VER: Parser Example 1 - (C)Copyright Amiga Foundation Classes + + Written By: Fabio Rotondo + + This code is Public Domain + +*/ + +MODULE 'afc/parser', 'afc/explain_exception' + +PROC main() HANDLE + DEF par=NIL:PTR TO parser + + NEW par.parser() + + WriteF('Template: FILE/A,COLOR/K,NAME/K\n') + WriteF('STRING: NAME="Amiga Foundation Classes" COLOR="Blue" Parser.e\n') + + par.parse('FILE/A,COLOR/K,NAME/K', 'NAME="Amiga Foundation Classes" COLOR="Blue" Parser.e') + + WriteF('Results:\nArg 0 (File) - \s\nArg 1 (Color) - \s\nArg 2 (Name) - \s\n', par.arg(0), par.arg(1), par.arg(2)) + +EXCEPT DO + explain_exception() + END par +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/PatternMatch_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/PatternMatch_Example.e new file mode 100644 index 0000000..d402b24 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/PatternMatch_Example.e @@ -0,0 +1,47 @@ +/* +** DirList_Example 2 +** +** Methods: setdir(), read(), sort(), first(), obj() +** succ() +** +** This code shows an example of parsing with pattern matching +** +** This code is placed in Public Domain +** +** (C)Copyright 1996/97 Amiga Foundation Classes +** +** See: http://www.intercom.it/~fsoft/afc.html +** +** FOR more info about AFC AND modules. +** +*/ + + +MODULE 'afc/DirList', -> Our MAGIC MODULE! + 'afc/explain_exception' + +PROC main() HANDLE + DEF dl:PTR TO dirlist + + NEW dl.dirlist() -> Here we init the dirlist obj + + dl.setdir('ram:') -> This is the working dir + WriteF('Reading...\n') + dl.read(FALSE, TRUE, '#?.info')-> Read FILES only, matching #?.info + WriteF('Sorting!\n') + dl.sort() -> NOTE: This sort is CASE sensitive + + WriteF('Done!\n--------------\n') + + IF dl.first() -> Here we pos TO the first item + REPEAT + WriteF('\s\n',dl.obj()) -> Here we show the name + UNTIL dl.succ()=FALSE -> AND get the succ() + ENDIF + +EXCEPT DO + END dl + explain_exception() + CleanUp(0) +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Push_Pop_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/Push_Pop_Example.e new file mode 100644 index 0000000..0d713da --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Push_Pop_Example.e @@ -0,0 +1,61 @@ +/* +** StringNode Example-3 +** +** add(), item(), push() AND pop() methods. +** +** (C)Copyright 1996/97 Amiga Foundation Classes +** +** See: http://www.intercom.it/~fsoft/afc.html +** +** FOR more info about AFC AND more modules +*/ + +MODULE 'afc/StringNode', -> Our MAGIC MODULE + 'afc/explain_exception' + +PROC main() HANDLE + DEF n:PTR TO stringnode -> This is our OBJECT instance + + NEW n.stringnode() -> OBJECT initialization + + n.add('Zorro') -> Here we add some items... + n.add('Batman') + n.add('Superman') + n.add('Gold Drake') + n.add('Mandrake') + n.add('MOMMY') + + shwall(n) -> Here we see them + + n.item(2) -> Let's pos us on item 2 + WriteF('Current:\s\n', n.obj()) + + n.push() -> Here we memorize our position + + n.item(5) -> Let's pos us on item 5 + WriteF('Current:\s\n', n.obj()) + + n.pop() -> Here we RETURN TO item 2!!! + WriteF('Current:\s\n', n.obj()) + + n.item(99) -> What??!?!?! This item DOES NOT EXISTS!!! + WriteF('Current:\s\n', n.obj()) -> Is it safe enought?? + +EXCEPT DO + explain_exception() + END n -> Remember ALWAYS TO end an OBJECT + CleanUp(0) +ENDPROC + +PROC shwall(n:PTR TO stringnode) + WriteF('------- \d ----------\n', n.numitems()) + + IF n.first() -> Here we go TO the first node item + REPEAT + WriteF('Node:\s\n', n.obj()) -> Node STRING... + UNTIL n.succ() = FALSE -> LOOP UNTIL the end + ELSE + WriteF('No Nodes in LIST...\n') + ENDIF +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/RamScan_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/RamScan_Example.e new file mode 100644 index 0000000..2ab2a86 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/RamScan_Example.e @@ -0,0 +1,52 @@ +/* + + DirList Example + + RamScan + + + (C)Copyright 1996/97 Amiga Foundation Classes + + See: http://www.intercom.it/~fsoft/afc.html + + FOR more info about AFC AND more modules + +*/ + +MODULE 'afc/dirlist', + 'afc/explain_exception' + +PROC main() HANDLE + DEF dl:PTR TO dirlist + + NEW dl.dirlist() + + + dl.setattrs([DIRTAG_COMPLETEPATH, TRUE, + DIRTAG_MARKDIR, TRUE, + 0,0 + ]) + + + + dl.setdir('ram:') + WriteF('Reading...\n') + dl.read(TRUE, TRUE) + WriteF('Sorting...') + dl.sort(TRUE) + + WriteF('Done!\n') + + IF dl.first() + REPEAT + WriteF('\s\n',dl.obj()) + UNTIL dl.succ()=FALSE + ENDIF + + WriteF('Dir Name:"\s"\n', dl.dirname()) + +EXCEPT DO + explain_exception() + END dl +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/ReqTooller_Example1.e b/amigae33a/E_v3.3a/Src/Src/Afc/ReqTooller_Example1.e new file mode 100644 index 0000000..d2d94ad --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/ReqTooller_Example1.e @@ -0,0 +1,113 @@ +/* + + $VER: ReqTooller Example 1 - (C)Copyright Amiga Foundation Classes + + Written By: Fabio Rotondo + + This code is Public Domain + + +*/ + +MODULE 'afc/reqtooller', 'afc/explain_exception' + +PROC main() HANDLE + DEF rt=NIL:PTR TO reqtooller + DEF s:PTR TO CHAR + + NEW rt.reqtooller() -> First of all, we init the class. + + -> Here we set the default title and path + rt.setattrs([RT_TITLE, 'reqtooller Example', + RT_PATH, 'Ram:', + NIL, NIL]) + + + + /* + Here we open a SAVE requester + Please, note the RT_FULLNAME set to TRUE: + when we'll do a get(RT_FILENAME) the filename returned will contain + also the path. + */ + rt.req(RTREQ_SAVE, [RT_OKGAD, '_Save', RT_FULLNAME, TRUE, NIL]) + WriteF('Path:\s\n', rt.get(RT_PATH)) + WriteF('FullName:\s\n', rt.get(RT_FILENAME)) + + + -> Hey! Here there is a path requester! + -> (Here we change the OK gadget, because it would remain "Save"...) + rt.req(RTREQ_PATH, [RT_OKGAD, 'Ok', NIL, NIL]) + WriteF('NEW Path:\s\n', rt.get(RT_PATH)) + + + -> And here a Volumes requester! + rt.req(RTREQ_VOLUMES, NIL) + + + -> And what about a MultiFile requester? + rt.req(RTREQ_MULTI, NIL) + + /* + This is the right routine to scan throught all + the files selected. + Please, note that we have still the RT_FULLNAME flag set. + So the names returned will contain full path. + */ + WHILE (s:=rt.get(RT_MULTINEXT)) + WriteF('Name:\s\n', s) + ENDWHILE + + + -> Wow a font requester + rt.req(RTREQ_FONT, NIL) + + + -> And a font requester supporting color fonts :-) + rt.req(RTREQ_COLFONT, [RT_FONTNAME, 'XHelvetica.font', NIL]) + WriteF('FontName:\s\n', rt.get(RT_FONTNAME)) + + -> Look: the EasyReq returns a value, we get it! + WriteF('EasyReq result:\d\n', rt.req(RTREQ_EASY, [RT_TEXT, 'Do You Like This Requester?', + RT_GADS, 'Yes!|Hmmm...|No', + RT_CHOICE, 2, + NIL, NIL])) + + + -> A Standard Screen Requester + rt.req(RTREQ_SCREEN) + WriteF('ModeID:\h\n', rt.get(RT_SCRID)) + + -> And a ALL resolutions screen requester + rt.req(RTREQ_ALLSCREEN) + + -> A String Requester (also this requester returns a value... + WriteF('STRING Result:\d\n', rt.req(RTREQ_STRING, [RT_DEFSTR, 'Hello!', + RT_MAXCHARS, 10, + RT_TEXT, 'Insert Your Name', + RT_GADS, 'This is|I do not want', + NIL])) + + -> A number requester + rt.req(RTREQ_NUMBER, [RT_MINVAL, 10, RT_MAXVAL, 20, RT_DEFVAL, 11, NIL]) + + + -> An example of EasyRequester with arguments. + rt.req(RTREQ_EASY, [RT_TEXT, 'My name is:\s \s.', + RT_ARGS, ['Fabio', 'Rotondo'], + RT_GADS, 'Ok', + NIL]) + + -> A Message requester... + rt.req(RTREQ_MESSAGE, NIL) + + -> That will be there for 1 second. + Delay(50) + +EXCEPT DO + + explain_exception() + END rt + CleanUp(0) +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Rexxer_Receiver.e b/amigae33a/E_v3.3a/Src/Src/Afc/Rexxer_Receiver.e new file mode 100644 index 0000000..e7be2a5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Rexxer_Receiver.e @@ -0,0 +1,44 @@ +/* + + $VER: Rexxer Receiver Example 1.0 + + Written By Fabio Rotondo + + (C)Copyright Amiga Foundation Classes + + NOTES: Run this program BEFORE Rexxer Sender. + + The Rexxer Receiver will handle messages + arriving from Rexxer Sender. + + Even if it is possible to run multiple instances + of this program, only the 'RECEIVE.1' port will + be addressed by Rexxer Sender, so be careful! + +*/ + +MODULE 'afc/rexxer', 'afc/explain_exception' + +PROC main() HANDLE + DEF rx=NIL:PTR TO rexxer + + NEW rx.rexxer('RECEIVE') + + REPEAT + Wait(rx.sigbit()) + UNTIL rx.get({parse}) + + WriteF('Rexxer Receiver is terminating...\n') + +EXCEPT DO + explain_exception() + END rx + CleanUp(0) +ENDPROC + +PROC parse(s, mes=NIL) + WriteF('Message arrived:\s\n', s) + + mes:=NIL +ENDPROC StrCmp('QUIT', s), 0, 'Hello World!' + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Rexxer_Sender.e b/amigae33a/E_v3.3a/Src/Src/Afc/Rexxer_Sender.e new file mode 100644 index 0000000..0b4df72 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Rexxer_Sender.e @@ -0,0 +1,35 @@ +/* + + $VER: Rexxer Sender Example 1.0 + + Written By Fabio Rotondo + + (C)Copyright Amiga Foundation Classes + + NOTES: Run this program AFTER you have run 'Rexxer Receiver'. + + This program will communicate using ARexx with 'RECEIVE.1'. + If the "RECEIVE.1" port is not found, the program will raise + an exception. + +*/ + +MODULE 'afc/rexxer', 'afc/explain_exception' + +PROC main() HANDLE + DEF rx=NIL:PTR TO rexxer + + + IF FindPort('RECEIVE.1')=NIL THEN Raise("recv") + NEW rx.rexxer('SENDER') + + rx.send('RECEIVE.1', 'QUIT') + + WriteF('RC:\d - Result:\s\n', rx.rc(), rx.result()) + WriteF('ARexx Sender port terminating...\n') +EXCEPT DO + explain_exception() + END rx + CleanUp(0) +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Search_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/Search_Example.e new file mode 100644 index 0000000..dd38b8c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Search_Example.e @@ -0,0 +1,55 @@ +/* +** StringNode Example-4 +** +** add(), search() AND insert() methods. +** +** (C)Copyright 1996/97 Amiga Foundation Classes +** +** See: http://www.intercom.it/~fsoft/afc.html +** +** FOR more info about AFC AND more modules +*/ + +MODULE 'afc/StringNode', -> Our MAGIC MODULE + 'afc/explain_exception' + +PROC main() HANDLE + DEF n:PTR TO stringnode -> This is our OBJECT instance + + NEW n.stringnode() -> OBJECT initialization + + n.add('Zorro') -> Here we add some items... + n.add('Batman') + n.add('Superman') + n.add('Gold Drake') + n.add('Mandrake') + n.add('MOMMY') + + shwall(n) -> Here we see them + + n.search('bat#?') -> The search is CASE insensitive AND match the first one ;) + -> Note we use STANDARD AmigaDOS match pattern strings! + + WriteF('Current:\s\n', n.obj()) -> Here we are! + + n.insert('Spiderman') -> Wow! Another super-hero after Batman! + shwall(n) + +EXCEPT DO + IF exception THEN WriteF('Exception: \z\h[8]\n', exception) + END n -> Remember ALWAYS TO end an OBJECT + CleanUp(0) +ENDPROC + +PROC shwall(n:PTR TO stringnode) + WriteF('------- \d ----------\n', n.numitems()) + + IF n.first() -> Here we go TO the first node item + REPEAT + WriteF('Node:\s\n', n.obj()) -> Node STRING... + UNTIL n.succ() = FALSE -> LOOP UNTIL the end + ELSE + WriteF('No Nodes in LIST...\n') + ENDIF +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/SetAttrs_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/SetAttrs_Example.e new file mode 100644 index 0000000..501fe55 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/SetAttrs_Example.e @@ -0,0 +1,51 @@ +/* +** DirList_Example 3 +** +** Methods: setdir(), read(), sort(), first(), obj() +** succ(), dirname(), setattrs() +** +** +** This code is placed in Public Domain +** +** (C)Copyright 1996 Fabio Rotondo +** +*/ + + +MODULE 'afc/DirList', -> Our MAGIC MODULE! + 'afc/explain_exception' + +PROC main() HANDLE + DEF dl:PTR TO dirlist + + NEW dl.dirlist() + + + dl.setattrs([DIRTAG_COMPLETEPATH, TRUE, -> We want TO store the complete path + DIRTAG_MARKDIR, TRUE, -> AND we want DirList TO mark dirs + 0,0 + ]) + + + + dl.setdir('ram:') -> We'll scan RAM: + WriteF('Reading...\n') + dl.read(TRUE, TRUE) -> Here we read it + WriteF('Sorting...') + dl.sort(TRUE) -> AND here we sort it + + WriteF('Done!\n') + + IF dl.first() -> Let's show! + REPEAT + WriteF('\s\n',dl.obj()) + UNTIL dl.succ()=FALSE + ENDIF + + WriteF('DIR:\s\n', dl.dirname()) -> Actual dir name is this + +EXCEPT DO + explain_exception() + END dl +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Sort_Example.e b/amigae33a/E_v3.3a/Src/Src/Afc/Sort_Example.e new file mode 100644 index 0000000..adaa759 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Sort_Example.e @@ -0,0 +1,97 @@ +/* + NodeMaster_Sort.e - V1.00 + + Written By Andrea Galimberti + + This source demonstates how to create + sort a list of "objects". In this case + our "object" will be called "stuff" and + will contain just one field called "avg". + + Our comparison routine will take as parameters + two "Stuff" items and the info param (which will be + ignored). + + This source shows also the version() method. + + + This source is Public Domain. + + NodeMaster is part of the Amiga Foundation Classes + See: + http://www.intercom.it/~fsoft/afc.html + + for more info and more modules. +*/ + +MODULE 'afc/nodemaster', + 'afc/explain_exception' + +CONST MAX_ELEM = 50 -> Change this value TO increase/decrease no. of items TO sort + +OBJECT stuff + avg +ENDOBJECT + +/* + This is our comparison routine. + look: + + a and b are two "stuff" objects. + + Their ".avt" field just contains a number: + by sub a.avg-b.avg will have a value < or > or = to 0 + That we'll return as result. + + This is a simple example, but you can create better + and more complex ones. +*/ +PROC cpstuff(a:PTR TO stuff,b:PTR TO stuff, info) IS a.avg - b.avg + + +PROC main() HANDLE + DEF k + DEF num:PTR TO nodemaster, l:PTR TO stuff + DEF v,r + + NEW num.nodemaster() + + -> Here we fill the list with random numbers + Rnd(-RndQ($FFA354B2)) + FOR k:=0 TO MAX_ELEM-1 + NEW l + l.avg:=Rnd(1000) + num.add(l) + ENDFOR + + WriteF('Now sorting...') + + -> and here we sort it!!! + num.sort({cpstuff}) + + WriteF('Done!\n') + + -> Let's see the result + l:=num.first() + REPEAT + WriteF('\d\n',l.avg) + UNTIL (l:=num.succ())=FALSE + + + -> Good: which version of NodeMaster is this? + v,r := num.version() + + WriteF('NodeMaster V\d.\d \n', v,r) + +EXCEPT DO + explain_exception() + + IF (l:=num.first())<>FALSE + REPEAT + Dispose(l) + UNTIL (l:=num.succ())=FALSE + ENDIF + END num + CleanUp(0) +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/SuperPic_Example1.e b/amigae33a/E_v3.3a/Src/Src/Afc/SuperPic_Example1.e new file mode 100644 index 0000000..6026fe7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/SuperPic_Example1.e @@ -0,0 +1,81 @@ +/* + + $VER: Super Picture Example no. 1 (V1.00) - By Fabio Rotondo + + (C)Copyright Amiga Foundation Classes + + This example is Public Domain. + +*/ + +MODULE 'afc/super_picture', 'afc/explain_exception', + 'dos/rdargs', + 'intuition/screens' + +PROC main() HANDLE + DEF myargs:PTR TO LONG, rda=NIL + DEF pic=NIL:PTR TO super_picture -> The SuperPic OBJECT + DEF scr=NIL:PTR TO screen, w, h, sw, sh + + WriteF('PView V1.00 - By Fabio Rotondo.\n') + + myargs:=[0,0,0,0,0,0]:LONG + IF (rda:=ReadArgs('PICNAME/A,VERBOSE/S', myargs, NIL))=NIL THEN Raise("args") + + NEW pic.super_picture() -> Here we init the class + + pic.load(myargs[0]) -> Just a load command (Supports DataTypes!) 8-) + + w:=pic.width() -> Here we obtain pic's width and height + h:=pic.height() + + IF w<320 THEN sw:=320 ELSE sw:=w -> And here we compute screen sizes + IF h<256 THEN sh:=256 ELSE sh:=h + + -> If the user set the VERBOSE flag in the Shell parameters, we just show + -> some more info about the picture before displaying it. + IF myargs[1] + WriteF('Picture:\s\nWidth: \d\nHeight: \d\nDepth:\d\nModeID: $\h\n', + myargs[0], + w,h,pic.depth(), + pic.modeid()) + ENDIF + + -> Here we open a screen + IF (scr:=OpenScreenTagList(NIL, + [SA_WIDTH, sw, + SA_HEIGHT, sh, + SA_DEPTH, pic.depth(), + SA_DISPLAYID, pic.modeid(), + 0,0]))=NIL THEN Raise("scr") + + pic.paltoscr(scr) -> Just to set the right palette + + + -> We blit it all! + BltBitMapRastPort(pic.bitmap(), 0,0, scr.rastport, 0,0, w, h, $C0) + + + -> Waiting for a mouse click... + REPEAT + Delay(5) + UNTIL Mouse() + +EXCEPT DO + SELECT exception + CASE "args" + WriteF('Bad args!\n') + CASE "scr" + WriteF('Could not open screen!\n') + DEFAULT + explain_exception() + ENDSELECT + + IF scr THEN CloseScreen(scr) -> Close the screen + + IF rda THEN FreeArgs(rda) -> Free ReadArgs structure + + END pic -> Close the object + + CleanUp(0) -> General cleaning up... +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Tasker_Example1.e b/amigae33a/E_v3.3a/Src/Src/Afc/Tasker_Example1.e new file mode 100644 index 0000000..e43e04f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Tasker_Example1.e @@ -0,0 +1,30 @@ + +MODULE 'AFC/tasker', 'afc/explain_exception' + +-> tasks can only access global variables +DEF sharedvar + +PROC simpletask() + WHILE sharedvar<$8000000 DO sharedvar++ + Wait(NIL) -> that IS TO say: wait TO be killed +ENDPROC + + +PROC main() HANDLE + DEF myt:PTR TO tasker + + NEW myt.tasker('simpletask') -> name OF the task + + myt.code({simpletask}) -> what code TO use + WriteF('starting task...(press RETURN TO end)\n') + myt.start() -> starting task + + Inp(IF stdin THEN stdin ELSE stdout) + WriteF('The shared variable now equals \d\n', sharedvar) + +EXCEPT DO + END myt -> killing task (you can stop() it IF you don't need TO END + -> the whole OBJECT (maybe TO restart it again later)) + explain_exception() +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Tasker_Example2.e b/amigae33a/E_v3.3a/Src/Src/Afc/Tasker_Example2.e new file mode 100644 index 0000000..812e2cb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Tasker_Example2.e @@ -0,0 +1,94 @@ + +MODULE 'AFC/tasker', 'AFC/explain_exception', + 'exec/ports','exec/memory','exec/nodes' + + +-> a complex message +OBJECT complex + mnode:mn ->BE CAREFUL: This IS the structure, NOT the pointer + wow:LONG +ENDOBJECT + +-> the tasker structure IS DEFined global because we use it also in the +-> process' body. +DEF myp:PTR TO tasker + +PROC thread() + DEF message:PTR TO complex + +-> get the global data pointer, previously stored by the main process. +-> IMPORTANT: DO this before using global variables OR functioncalls. + geta4() + +/* + IF you DEF'd your tasker ('myp' in this CASE) as a global variable, + you can access its port by the dosport() method. IF you need TO make it a + local variable THEN, TO get the port associated TO the process, you + follow the standard way: + + DEF thisthread:PTR TO process + thisthread:=FindTask(0) + dosport:=thisthread.msgport + + Warning: the use OF this port IS reserved TO AmigaDOS, so create your + own port IF you need one. +*/ + + -> create a port associated TO the process (this method must be called + -> from the task that needs the port, not by the main program). + myp.buildport() + + WaitPort(myp.port()) + message:=GetMsg(myp.port()) + + PrintF('Hello, I''m a NEW thread. Wow IS:\d\n', message.wow) + Delay(50) + +-> make sure there IS no taskswitching after we replied the message + Forbid() + ReplyMsg(message) + myp.endport() -> remember TO close the port before ending. +ENDPROC + +PROC main() HANDLE + DEF mainp=NIL, mess=NIL:PTR TO complex + +-> Store the global data pointer: DO this BEFORE any process IS started. +-> Remember TO geta4() in the process before using any global variable OR +-> functioncall! + storea4() + + NEW myp.tasker('simpleprocess') -> name AND initialization + myp.code({thread}) -> the code TO be used + + IF (mainp:=buildPort()) -> we need a port in the main() process TO + -> communicate with thread() + + WriteF('Starting the process...\n') + myp.process() -> starting the process + + mess:=NewM(SIZEOF complex, MEMF_PUBLIC OR MEMF_CLEAR) -> alloc AND + setupMsg(mess, SIZEOF complex, mainp) -> setup the message + mess.wow:=10 -> fill in your additional fields + + WriteF('Sending the message...\n') + REPEAT -> wait FOR the process TO create its own port + Delay(5) -> before sending anything TO it. + UNTIL myp.port() + + myp.send(mess) -> send the message TO thread() + + WaitPort(mainp) -> wait FOR an answer. +-> IF process doesn't reply we can't Dispose the message memory 'cause +-> the thread may be still using it. + ELSE + WriteF('well, no port!\n') + ENDIF + +EXCEPT DO + IF mess THEN Dispose(mess) -> remember TO free the memory + IF mainp THEN endPort(mainp) + END myp + explain_exception() +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/ToolType_Example1.e b/amigae33a/E_v3.3a/Src/Src/Afc/ToolType_Example1.e new file mode 100644 index 0000000..1cc7fbb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/ToolType_Example1.e @@ -0,0 +1,37 @@ +/* + + ToolType Example 1 - (C)Copyright Amiga Foundation Classes + + Written By: Fabio Rotondo + + Public Domain Source + + + NOTE: This program will happily fail, raising an exception + if you don't provide a _valid_ icon for it and don't + modify the tooltypes... see docs! + +*/ + +MODULE 'afc/tooltype', 'afc/explain_exception' + +PROC main() HANDLE + DEF ttype:PTR TO tooltype + DEF s + + WriteF('This is a little try of tooltype\n') + + NEW ttype.tooltype(TRUE) + + WriteF('Everything Is Fine\n') + s:=ttype.get('MYTRY') + IF s THEN WriteF('Get() Result:\s\n', s) + + s:=ttype.match('MYTRY','FABIO') + WriteF('Match Result:\d\n', s) + +EXCEPT DO + explain_exception() + END ttype +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Worldbuilder_Example1.e b/amigae33a/E_v3.3a/Src/Src/Afc/Worldbuilder_Example1.e new file mode 100644 index 0000000..5ef372b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Worldbuilder_Example1.e @@ -0,0 +1,224 @@ +/* + worldbuilder example. + + Needs: 'bitmap_obj' AND 'explain_exception' from AFC. + + Instructions: left - right arrow: move observer x + up - down arrow: move observer y + Del - Help : move observer z + q - w : rotate around x + a - s : rotate around y + z - x : rotate around z + space : reset TO defaults + Esc : quit +*/ + +MODULE 'AFC/worldbuilder', + 'AFC/bitmapper', + 'AFC/explain_exception', + 'intuition/intuition', + 'intuition/screens', + 'graphics/view', + 'exec/ports' + + +PROC main() HANDLE + DEF scene:PTR TO worldbuilder + DEF scr=NIL:PTR TO screen, rp, vp:PTR TO viewport + DEF win=NIL:PTR TO window, port:PTR TO mp + DEF msg:PTR TO intuimessage, class, code + DEF oox,ooy,ooz, rrx,rry,rrz + DEF bm2:PTR TO bitmapper, rp2, bitmap2, ri:PTR TO rasinfo + DEF usebm=0, scrbm + + -> fillSinTable() IS done automatically by the following: + NEW scene.worldbuilder() + + -> we add three objects + scene.addobj('cube') + scene.addobj('axis') + scene.addobj('pyramid') + + -> vertices, lines AND surfaces FOR the 'cube' object_obj: + -> name x1,y1, z1, x2,y2, z2, ... + scene.fastsetvert('cube',[-50,50,-50, 50,50,-50, 50,-50,-50, -50,-50,-50, + -50,50,50, 50,50,50, 50,-50,50, -50,-50,50]:vertex_obj) + -> MUST be a typed LIST: ^^^^^^^^^^ + + -> name startv1, endv1, colour1, ... + scene.fastsetline('cube',[0, 1, 2, 1,2,2, 2,3,2, 3,0,2, + 4,5,2, 5,6,2, 6,7,2, 7,4,2, + 0,4,2, 1,5,2, 2,6,2, 3,7,2]:line_obj) + + -> name,num,vertices,colour + scene.setsurface('cube',0,[0,1,2,3],2) + scene.setsurface('cube',1,[0,4,5,1],3) + scene.setsurface('cube',2,[7,6,5,4],4) + scene.setsurface('cube',3,[3,2,6,7],5) + scene.setsurface('cube',4,[0,3,7,4],6) + scene.setsurface('cube',5,[1,5,6,2],7) + + -> definition OF the three axes + scene.fastsetvert('axis',[0,0,0, 100,0,0, 0,100,0, 0,0,100]:vertex_obj) + + scene.fastsetline('axis',[0,1,3, 0,2,4, 0,3,5]:line_obj) + + -> AND now there comes the 'pyramid' object_obj + scene.fastsetvert('pyramid',[0,60,-50, 50,60,-50, 50,60,50, + 0,60,50, 25,120,0]:vertex_obj) + + scene.fastsetline('pyramid',[0,1,6, 1,2,6, 2,3,6, 3,0,6, + 0,4,6, 1,4,6, 2,4,6, 3,4,6]:line_obj) + + scene.setsurface('pyramid',0,[0,1,2,3],3) + scene.setsurface('pyramid',1,[0,4,1],2) + scene.setsurface('pyramid',2,[3,4,0],4) + scene.setsurface('pyramid',3,[2,4,3],5) + scene.setsurface('pyramid',4,[1,4,2],6) + + + scene.setdisplay(320,256) -> display dimensions + scene.init3D() -> build system structures FOR filled vectors + + scene.setaftertrasl(160,128) -> origin OF the screen axes. + scene.setafterscale(200,200) -> scaling AFTER projection (TO fit in + -> the screen): 200 = double. + scene.setobserver(0,0,-200) -> position OF the observer + + -> we open a screen + scr:=OpenScreenTagList(NIL,[SA_TOP,0, + SA_LEFT,0, + SA_WIDTH,320, + SA_HEIGHT,256, + SA_DEPTH,3, + SA_TITLE,'Routines3D', + SA_SHOWTITLE,FALSE, + 0,0]) + IF scr=NIL THEN Raise("SCR") + vp:=scr.viewport + ri:=vp.rasinfo -> we get the rasinfo structure FOR double buffering + scrbm:=ri.bitmap + + -> a trivial palette + SetRGB4(vp,3,15,0,0) + SetRGB4(vp,4,0,15,0) + SetRGB4(vp,5,0,0,15) + SetRGB4(vp,7,12,12,0) + + -> we allocate a second bitmap FOR the double buffering + NEW bm2.bitmapper() + bm2.allocbitmap(320,256,3,TRUE) + rp2:=bm2.rastport() + bitmap2:=bm2.bitmap() + + -> the window IS needed TO get keypresses + win:=OpenWindowTagList(NIL,[WA_TOP,0, + WA_LEFT,0, + WA_WIDTH,320, + WA_HEIGHT,256, + WA_TITLE,'Routines3D', + WA_FLAGS,WFLG_ACTIVATE OR WFLG_SMART_REFRESH OR WFLG_BACKDROP OR WFLG_BORDERLESS, + WA_IDCMP,IDCMP_RAWKEY, + WA_CUSTOMSCREEN,scr, + 0,0]) + IF win=NIL THEN Raise("WIN") + rp:=win.rport + port:=win.userport + + oox:=0 ; ooy:=0 ; ooz:=-200 -> observer initial position + rrx:=0 ; rry:=0 ; rrz:=0 -> angles OF rotation + + scene.projection() -> project + scene.drawfill(rp) -> AND draw the scene + usebm:=1-usebm + + LOOP + Wait(Shl(1,port.sigbit)) + REPEAT + IF (msg:=GetMsg(port))<>NIL + class:=msg.class + code:=msg.code + ReplyMsg(msg) + SELECT class + CASE IDCMP_RAWKEY -> IF user presses a key... + SELECT code + CASE $4C -> up arrow + ooy:=ooy+1 + scene.setobserver(oox,ooy,ooz) -> change observer position + CASE $4D -> down arrow + ooy:=ooy-1 + scene.setobserver(oox,ooy,ooz) + CASE $4E -> right arrow + oox:=oox+1 + scene.setobserver(oox,ooy,ooz) + CASE $4F -> left arrow + oox:=oox-1 + scene.setobserver(oox,ooy,ooz) + CASE $46 -> del + ooz:=ooz-1 + scene.setobserver(oox,ooy,ooz) + CASE $5F -> help + ooz:=ooz+1 + scene.setobserver(oox,ooy,ooz) + CASE $10 -> q + rrx:=rrx-1 + scene.setrot(rrx,rry,rrz) -> SET NEW rotation angles + CASE $11 -> w + rrx:=rrx+1 + scene.setrot(rrx,rry,rrz) + CASE $20 -> a + rry:=rry-1 + scene.setrot(rrx,rry,rrz) + CASE $21 -> s + rry:=rry+1 + scene.setrot(rrx,rry,rrz) + CASE $31 -> z + rrz:=rrz-1 + scene.setrot(rrx,rry,rrz) + CASE $32 -> x + rrz:=rrz+1 + scene.setrot(rrx,rry,rrz) + CASE $40 -> space + oox:=0 ; ooy:=0 ; ooz:=-200 + rrx:=0 ; rry:=0 ; rrz:=0 + scene.setobserver(oox,ooy,ooz) + scene.setrot(rrx,rry,rrz) + CASE $45 -> esc + REPEAT + IF (msg:=GetMsg(port))<>NIL THEN ReplyMsg(msg) + UNTIL msg=NIL + Raise("end") -> quit + ENDSELECT + ENDSELECT + ENDIF + UNTIL msg=NIL + scene.projection() -> project the scene + + SetAPen(IF usebm=0 THEN rp ELSE rp2, 0) + RectFill(IF usebm=0 THEN rp ELSE rp2, 0,0,320,256) -> clear the screen + + scene.drawfill(IF usebm=0 THEN rp ELSE rp2) -> eventually draw + -> ^^^^^^^^: change this in 'draw' IF you want TO see wireframe objects + + IF usebm=0 -> handmade double buffering (in a screen) + ri.bitmap:=scrbm + ELSE -> swap the two bitmaps + ri.bitmap:=bitmap2 + ENDIF + WaitTOF() + ScrollVPort(vp) -> update copperlist TO NEW pointers + usebm:=1-usebm + ENDLOOP + +EXCEPT DO + IF win THEN CloseWindow(win) + IF scr + ri.bitmap:=scrbm + CloseScreen(scr) + ENDIF + END scene -> remember TO free ALL memory + END bm2 + IF exception<>"end" THEN explain_exception() + CleanUp(0) +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Afc/Worldbuilder_Example2.e b/amigae33a/E_v3.3a/Src/Src/Afc/Worldbuilder_Example2.e new file mode 100644 index 0000000..f7d84be --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Afc/Worldbuilder_Example2.e @@ -0,0 +1,174 @@ + +MODULE 'AFC/worldbuilder', + 'AFC/bitmapper', + 'AFC/explain_exception', + 'intuition/intuition', + 'intuition/screens', + 'graphics/view', + 'exec/ports' + + +PROC main() HANDLE + DEF scene:PTR TO worldbuilder, scr:PTR TO screen, win:PTR TO window + DEF vp:PTR TO viewport, ri:PTR TO rasinfo, scrbm, bm2:PTR TO bitmapper + DEF rp2, bitmap2, port:PTR TO mp, usebm=0, rp + DEF rrx, rry, rrz, oox, ooy, ooz + + NEW scene.worldbuilder() + + scene.addobj('A') + scene.addobj('N') + scene.addobj('D') + scene.addobj('R') + scene.addobj('E') + scene.addobj('A2') + + + scene.fastsetvert('A',[-10,0,0, -20,0,0, -20,60,0, 20,60,0, 20,0,0, + 10,0,0, 10,30,0, -10,30,0, -10,50,0, 10,50,0, + 10,40,0, -10,40,0]:vertex_obj) + + scene.setsurface('A',0,[0,1,2,3,4,5,6,7],3) + scene.setsurface('A',1,[8,9,10,11],0) + scene.setsurface('A',2,[7,6,5,4,3,2,1,0],3) + scene.setsurface('A',3,[11,10,9,8],0) + + scene.fastsetvert('N',[-20,0,0, -20,60,0, -10,60,0, 10,10,0, 10,60,0, + 20,60,0, 20,0,0, 10,0,0, -10,50,0, -10,0,0]:vertex_obj) + + scene.setsurface('N',0,[0,1,2,3,4,5,6,7,8,9],3) + scene.setsurface('N',1,[9,8,7,6,5,4,3,2,1,0],3) + + + scene.fastsetvert('D',[-20,0,0, -20,60,0, 10,60,0, 20,50,0, 20,10,0, + 10,0,0, -10,10,0, -10,50,0, 0,50,0, 10,40,0, + 10,20,0, 0,10,0]:vertex_obj) + + scene.setsurface('D',0,[0,1,2,3,4,5],3) + scene.setsurface('D',1,[6,7,8,9,10,11],0) + scene.setsurface('D',2,[5,4,3,2,1,0],3) + scene.setsurface('D',3,[11,10,9,8,7,6],0) + + + scene.fastsetvert('R',[-20,0,0, -20,60,0, 10,60,0, 20,50,0, 20,40,0, + 10,30,0, 20,0,0, 10,0,0, 0,30,0, -10,30,0, + -10,0,0, -10,40,0, -10,50,0, 0,50,0, 0,40,0]:vertex_obj) + + scene.setsurface('R',0,[0,1,2,3,4,5,6,7,8,9,10],3) + scene.setsurface('R',1,[11,12,13,14],0) + scene.setsurface('R',2,[10,9,8,7,6,5,4,3,2,1,0],3) + scene.setsurface('R',3,[14,13,12,11],0) + + + scene.fastsetvert('E',[-20,0,0, -20,60,0, 20,60,0, 20,50,0, -10,50,0, + -10,40,0, 0,40,0, 0,30,0, -10,30,0, -10,10,0, + 20,10,0, 20,0,0]:vertex_obj) + + scene.setsurface('E',0,[0,1,2,3,4,5,6,7,8,9,10,11],3) + scene.setsurface('E',1,[11,10,9,8,7,6,5,4,3,2,1,0],3) + + scene.copyobj('A','A2') + + scene.position('A',-140,-30,0) + scene.position('N',-90,-30,0) + scene.position('D',-40,-30,0) + scene.position('R',10,-30,0) + scene.position('E',60,-30,0) + scene.position('A2',110,-30,0) + + scene.applyobj('A') + scene.applyobj('N') + scene.applyobj('D') + scene.applyobj('R') + scene.applyobj('E') + scene.applyobj('A2') + + scene.setdisplay(320,256) -> display dimensions + scene.init3D() -> build system structures FOR filled vectors + + scene.setaftertrasl(160,128) -> origin OF the screen axes. +-> scene.setafterscale(200,200) -> scaling AFTER projection (TO fit in + -> the screen): 200 = double. + scene.setobserver(0,0,-200) -> position OF the observer + + -> we open a screen + scr:=OpenScreenTagList(NIL,[SA_TOP,0, + SA_LEFT,0, + SA_WIDTH,320, + SA_HEIGHT,256, + SA_DEPTH,3, + SA_TITLE,'Routines3D', + SA_SHOWTITLE,FALSE, + 0,0]) + IF scr=NIL THEN Raise("SCR") + vp:=scr.viewport + ri:=vp.rasinfo -> we get the rasinfo structure FOR double buffering + scrbm:=ri.bitmap + + -> a trivial palette + SetRGB4(vp,3,15,0,0) + SetRGB4(vp,4,0,15,0) + SetRGB4(vp,5,0,0,15) + SetRGB4(vp,7,12,12,0) + + -> we allocate a second bitmap FOR the double buffering + NEW bm2.bitmapper() + bm2.allocbitmap(320,256,3,TRUE) + rp2:=bm2.rastport() + bitmap2:=bm2.bitmap() + + -> the window IS needed TO get keypresses + win:=OpenWindowTagList(NIL,[WA_TOP,0, + WA_LEFT,0, + WA_WIDTH,320, + WA_HEIGHT,256, + WA_TITLE,'Routines3D', + WA_FLAGS,WFLG_ACTIVATE OR WFLG_SMART_REFRESH OR WFLG_BACKDROP OR WFLG_BORDERLESS, + WA_IDCMP,IDCMP_RAWKEY, + WA_CUSTOMSCREEN,scr, + 0,0]) + IF win=NIL THEN Raise("WIN") + rp:=win.rport + port:=win.userport + + oox:=0 ; ooy:=0 ; ooz:=-200 -> observer initial position + rrx:=0 ; rry:=0 ; rrz:=0 -> angles OF rotation + + ClearScreen(rp) + scene.projection() -> project + scene.drawfill(rp) -> AND draw the scene + usebm:=1-usebm + + FOR rry:=0 TO 359 + scene.setrot(0,rry,0) + scene.projection() + SetAPen(IF usebm=0 THEN rp ELSE rp2, 0) + RectFill(IF usebm=0 THEN rp ELSE rp2, 0,30,320,200) + scene.drawfill(IF usebm=0 THEN rp ELSE rp2) + + IF usebm=0 + ri.bitmap:=scrbm + ELSE + ri.bitmap:=bitmap2 + ENDIF + WaitTOF() + ScrollVPort(vp) + usebm:=1-usebm + ENDFOR + + REPEAT + Delay(5) + UNTIL Mouse() + +EXCEPT DO + IF win THEN CloseWindow(win) + IF scr + ri.bitmap:=scrbm + CloseScreen(scr) + ENDIF + IF scene THEN END scene -> remember TO free ALL memory + IF bm2 THEN END bm2 + explain_exception() + CleanUp(0) +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Args/GetArgs.e b/amigae33a/E_v3.3a/Src/Src/Args/GetArgs.e new file mode 100644 index 0000000..300682d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Args/GetArgs.e @@ -0,0 +1,5 @@ +/* get command line args. note that `arg' is a predefined E-var */ + +PROC main() + WriteF(IF arg[]=0 THEN 'No Args!\n' ELSE 'You wrote: \s\n',arg) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Args/ReadArgs.e b/amigae33a/E_v3.3a/Src/Src/Args/ReadArgs.e new file mode 100644 index 0000000..b8caae1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Args/ReadArgs.e @@ -0,0 +1,17 @@ +/* Use readargs() to get parameters instead of using the string 'arg'. + This is more convenient if more than one arg is needed. Uses kick 2.0 */ + +OPT OSVERSION=37 + +PROC main() + DEF myargs:PTR TO LONG,rdargs + myargs:=[0,0,0] + IF rdargs:=ReadArgs('UNIT/N,DISK/A,NEW/S',myargs,NIL) + WriteF('UNIT=\d\n',Long(myargs[0])) /* integer */ + WriteF('DISK=\s\n',myargs[1]) /* string */ + WriteF('NEW=\d\n',myargs[2]) /* boolean */ + FreeArgs(rdargs) + ELSE + WriteF('Bad Args!\n') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Args/WbArg.e b/amigae33a/E_v3.3a/Src/Src/Args/WbArg.e new file mode 100644 index 0000000..b88f6e7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Args/WbArg.e @@ -0,0 +1,15 @@ +/* reading the arguments when started from wb. + give this program a .info file, and shift-select some icons with it. */ + +MODULE 'workbench/startup' + +PROC main() + DEF wb:PTR TO wbstartup, args:PTR TO wbarg, a + IF wbmessage=NIL /* we got from cli */ + WriteF('args = "\s"\n',arg) + ELSE /* from wb */ + wb:=wbmessage + args:=wb.arglist + FOR a:=1 TO wb.numargs DO WriteF('wbarg #\d = "\s"\n',a,args[].name++) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Class/BinTree/bintree b/amigae33a/E_v3.3a/Src/Src/Class/BinTree/bintree new file mode 100644 index 0000000..b87ff3f Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Class/BinTree/bintree differ diff --git a/amigae33a/E_v3.3a/Src/Src/Class/BinTree/bintree.e b/amigae33a/E_v3.3a/Src/Src/Class/BinTree/bintree.e new file mode 100644 index 0000000..97bcf0e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Class/BinTree/bintree.e @@ -0,0 +1,60 @@ +-> binary tree implementation in E + +OBJECT bintree PRIVATE + left:PTR TO bintree + right:PTR TO bintree +ENDOBJECT -> subclasses can add data here + +PROC is_bigger(other:PTR TO bintree) OF bintree IS EMPTY +PROC is_equal(other:PTR TO bintree) OF bintree IS EMPTY + +PROC bintree(l,r) OF bintree + self.left:=l + self.right:=r +ENDPROC + +-> folds value v with proc through the tree. + +PROC traverse(proc,v) OF bintree + v:=proc(self,v) + IF self.left THEN v:=self.left.traverse(proc,v) + IF self.right THEN v:=self.right.traverse(proc,v) +ENDPROC v + +/*-------------------------------------------------------*/ + +-> integer tree + +OBJECT intbintree OF bintree + i:LONG +ENDOBJECT + +PROC intbintree(l,r,i) OF intbintree + self.bintree(l,r) -> call super constructor + self.i:=i +ENDPROC + +PROC is_bigger(other:PTR TO intbintree) OF intbintree IS self.i>other.i +PROC is_equal(other:PTR TO intbintree) OF intbintree IS self.i=other.i + +PROC total() OF intbintree IS self.traverse({sum},0) +PROC sum(t:PTR TO intbintree,v) IS t.i+v + +/*-------------------------------------------------------*/ + +-> string tree + +OBJECT strbintree OF bintree + s:PTR TO CHAR +ENDOBJECT + +PROC is_bigger(other:PTR TO strbintree) OF strbintree IS EMPTY ->??? +PROC is_equal(other:PTR TO strbintree) OF strbintree IS StrCmp(self.s,other.s) + +/*-------------------------------------------------------*/ + +PROC main() + DEF p:PTR TO intbintree,p1:PTR TO intbintree,p2:PTR TO intbintree + NEW p.intbintree(NEW p1.intbintree(NIL,NIL,2),NEW p2.intbintree(NIL,NIL,3),40) + WriteF('total=\d\n',p.total()) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Class/Hash/hash.doc b/amigae33a/E_v3.3a/Src/Src/Class/Hash/hash.doc new file mode 100644 index 0000000..dd853f0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Class/Hash/hash.doc @@ -0,0 +1,175 @@ +HASH.M: flexible and fast hashing functions. + +note: if you have no clue what hashing is, you might want to read a little + explanation I gave at the end of this doc first. + +why use these hashing functions? +-------------------------------- +simple: one does not need to know anything about how hashing to make + good use of this module. +flexible: the functions do not make _any_ assumptions upon the nature + of the data, the size of it, or anything else. you may therefore + use it to hash strings, graphical data, etc. +fast: not only does this module use a high performance hashing function, + but also the most time-consuming function, hash_find() has been + written in optimised inline assembly. + +the object +---------- + +OBJECT hashtable + hashtable(tablesize) + end() + find(ptr,len) + add(link,hashvalue,ptr,len) + iterate(do_proc) + calc_hash_spread() +ENDOBJECT + +methods +------- + + hastable(tablesize) + +This constructor initialises an empty hashtable. tablesize is the size of +the hashtable, predifined are some usefull values: + + tablesize size in kb +HASH_NORMAL 211* 1 +HASH_MEDIUM 941 4 +HASH_HEAVY 3911 16 +HASH_HEAVIER 16267 64 + +(*) the tablesizes above are primes close to 2 to the power + of 8,10,12,14,16 (for performance reasons) + +The larger the table, the faster the search. +instead of these constanst, you can also use your own size, +if you wish. the size should however be between 2 and 65535, +and a prime for best performance. + +example: + +DEF t:PTR TO hashtable +NEW t.hashtable(HASH_HEAVY) + +may raise: "MEM" + + + end() + +frees table. memory is also deallocated automatically at the end of +the program. example: + +END t + + + hashlink,hashvalue:=t.find(data,len) + +Tries to find data with length len in hash table. When data is not present +in the table, hashlink will NIL. You'll need to store hashvalue only if you +wish to call add() next, and hashlink only if you wish to access the data +related to whatever you hashed next (see below). + + + add(link:PTR TO hashlink,hashvalue,data,len) + + +adds data to table. you'll need to call find() before this one, +not only to know the hashvalue this function needs, but also to be +sure data isn't already in the table. link must be a subclass of +'hashlink': + +OBJECT hashlink +ENDOBJECT /* SIZEOF=12 */ + +the hashtable uses this object to store data in the table. if you wish +to associate data with whatever you're hashing, make a subclass: + +OBJECT mylink OF hashlink + type:INT -> extra field +ENDOBJECT + +these objects are also the ones return by find if data is already present in +table. example: + +t.add(NEW linkptr,hashv,ptr,len) + +ptr and len are the same ones you passed to find(). note that add() does +not copy the 'ptr'. + + + total,num:=t.iterate(proc) + +walks through the whole hashtable, calling proc for every link. +proc must be something like: + +PROC it(link:PTR TO hashlink,depth) + +depth is how deep the link hangs in a chain, i.e. minimally 1. +returned from iterate() is the sum of all returnvalues from +calling proc, and the number of links visited. + + calc_hash_spread() + +makes use of iterate() to calculate the average number of StrCmp's +needed to find some data in this table. see hashtest.e for example use. + + +example use +----------- + +Imagine we're programming a compiler, like EC. To keep things simple, +we only do global variables. first, set up the table: + +DEF t:PTR TO hashtable, identinfo:PTR TO mylink -> see above +NEW t.hashtable(HASH_MEDIUM) + +now the following piece of code would be entered when we've read +an identifier. in 'ident' and 'len' we have the identifier, +and 'status' says wether we are currently in the scope of a DEF or not: + +-> see if ident is already there +identinfo,hashvalue:=t.find(ident,len:=EstrLen(ident)) + +IF identinfo + IF status=DEFINITION THEN Raise('double declaration!') + -> do something with identinfo.type here, for example +ELSE + IF status=USE THEN Raise('unknown variable!') + t.add(NEW identinfo,hashvalue,ident,len) + -> assign here to identinfo.type, for example +ENDIF + + +for those who don't know: what is hashing? +------------------------------------------ +Assume the task of having to store identifiers like the ones used +for variables in E, and later finding them again (this could be any +kind of data, but for now just strings). We could put all these strings +in a linked list, and when a new identifier arrives, simply walk down +the list and see if it's there. While this may seem a nice and easy +way of doing it, this becomes unacceptably slow when storing, say, +2000 identifiers: we would, on average, perform 1000 StrCmp()s just +to find one identifier! + +then comes hashing, which is a simple and fast technique to dramatically +reduce search times: + +take a table of n entries (say, n=256), and take a function which for +every ident can compute a number 0..n-1 (this is called the hashvalue, +and such a function might be: add all ascii values MOD n). when you +now put the idents in n linked list hanging from the n entries in the +table, you only have to compute the hashvalue to theorethically wipe +out 255 of each 256 possibilities. searchtime for our example becomes +2000/256/2 => 4 StrCmp, without any costly computations. +and imagine what happens if you take a larger n, say 4096, then for most +compilations, you reduce to 1 StrCmp (!). + +This is an ideal situation, since strangely enough, in reality lot's of +strings end up in the same entry. To make a good distribution of strings +over entries, this module uses several techniques, among them a better +hashing function, primes for n, and others. While in reality you may +end up doing 8 StrCmp()s instead of 4 as in the ideal case, this is +still a huge improvement over the 1000 we started with. + diff --git a/amigae33a/E_v3.3a/Src/Src/Class/Hash/hash.e b/amigae33a/E_v3.3a/Src/Src/Class/Hash/hash.e new file mode 100644 index 0000000..a7cd933 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Class/Hash/hash.e @@ -0,0 +1,117 @@ +-> hashing module + +OPT MODULE + +EXPORT CONST HASH_NORMAL = 211, + HASH_MEDIUM = 941, + HASH_HEAVY = 3911, + HASH_HEAVIER = 16267 + +EXPORT OBJECT hashtable PRIVATE + size,entries:PTR TO LONG +ENDOBJECT + +EXPORT OBJECT hashlink PRIVATE + next +PUBLIC + data, len +ENDOBJECT + +PROC hashtable(tablesize) OF hashtable -> constructor + DEF table:PTR TO LONG + self.entries:=NEW table[tablesize] + self.size:=tablesize +ENDPROC + +PROC end() OF hashtable -> destructor + DEF p:PTR TO LONG + p:=self.entries + END p[self.size] +ENDPROC + +PROC end_links(sizeof) OF hashtable -> destruct all links if desired + DEF a,p:PTR TO hashlink, o:PTR TO hashlink + FOR a:=0 TO self.size-1 + p:=self.entries[a] + WHILE o:=p; p:=p.next; FastDispose(o,sizeof); ENDWHILE + ENDFOR +ENDPROC + +/* hashes data, then tries to find entry. + returns hashlink, hashvalue */ + +PROC find(data,len) OF hashtable + DEF e,s + e:=self.entries + s:=self.size + MOVEM.L D3-D7,-(A7) + MOVE.L data,D6 -> D6=data + MOVE.L e,A1 -> A1=table + MOVE.L s,D3 -> D3=tablesize + MOVEQ #0,D1 -> D1=hashvalue + MOVEQ #0,D0 -> D0=hashlink + MOVE.L len,D4 -> D4=len + BEQ.S done + MOVE.L D4,D5 + MOVE.L D6,A2 + SUBQ.L #1,D5 +loop: + LSL.W #4,D1 + ADD.B (A2)+,D1 + DBRA D5,loop + DIVU D3,D1 + SWAP D1 + EXT.L D1 + MOVE.L A1,A2 -> now find entry + MOVE.L D1,D5 + LSL.L #2,D5 + ADD.L D5,A2 -> A2 points to spot in table +findd: + MOVE.L (A2),D5 -> pick next + BEQ.S done + MOVE.L D5,A2 + CMP.L 8(A2),D4 -> if lengths are unequal, don't bother + BNE.S findd + MOVE.L 4(A2),A0 -> get pointers to both areas + MOVE.L D6,A3 + MOVE.L D4,D5 + SUBQ.L #1,D5 +compare: -> bytewise compare + CMPM.B (A0)+,(A3)+ + BNE.S findd + DBRA D5,compare + MOVE.L A2,D0 -> found entry +done: + MOVEM.L (A7)+,D3-D7 +ENDPROC D0 + +-> add a new hashlink + +PROC add(link:PTR TO hashlink,hashvalue,data,len) OF hashtable + link.next:=self.entries[hashvalue] + link.data:=data + link.len:=len + self.entries[hashvalue]:=link +ENDPROC + +PROC iterate(do_proc) OF hashtable + DEF a,n,p:PTR TO hashlink, depth, r=0, num=0, table:PTR TO LONG + n:=self.size + table:=self.entries + FOR a:=1 TO n + p:=table[]++ + depth:=1 + WHILE p + r:=r+do_proc(p, depth++) + num++ + p:=p.next + ENDWHILE + ENDFOR +ENDPROC r,num + +PROC calc_hash_spread() OF hashtable + DEF idepth,num + idepth,num:=self.iterate({calcspread}) +ENDPROC IF num THEN !idepth/num ELSE 0.0 + +PROC calcspread(h,depth) IS depth diff --git a/amigae33a/E_v3.3a/Src/Src/Class/Hash/hashtest.e b/amigae33a/E_v3.3a/Src/Src/Class/Hash/hashtest.e new file mode 100644 index 0000000..cfcdbf3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Class/Hash/hashtest.e @@ -0,0 +1,58 @@ +/* test hashing functions + +identifiers are generated in amounts of 10,100,1000, which are +then hashed with tables of size 1, 211, 941, 3911 and 16267. +Displayed are the average number of StrCmp()'s needed to find +any of these identifiers. + +*/ + +MODULE 'class/hash' + +RAISE "MEM" IF String()=NIL + +PROC main() + DEF heavy:PTR TO LONG,a,b,l,num:PTR TO LONG,t=NIL:PTR TO hashtable, + c,ll,n,h,link:PTR TO hashlink,rs[10]:STRING + heavy:=[1,HASH_NORMAL,HASH_MEDIUM,HASH_HEAVY,HASH_HEAVIER] + num:=[10,100,1000] + l:=genidents(1000) + WriteF('numidents:') + FOR b:=0 TO 2 DO WriteF('\t\d\t',num[b]) + WriteF('\ntablesize:\n') + FOR a:=0 TO 4 + WriteF('[\d]\t\t',heavy[a]) + FOR b:=0 TO 2 + NEW t.hashtable(heavy[a]) + ll:=l + FOR c:=1 TO num[b] + n,h:=t.find(ll,EstrLen(ll)) + t.add(NEW link,h,ll,EstrLen(ll)) + ll:=Next(ll) + ENDFOR + WriteF('\s[8]\t',RealF(rs,t.calc_hash_spread(),4)) + END t + ENDFOR + WriteF('\n') + ENDFOR +ENDPROC + +-> generate some random identifiers + +PROC genidents(n) + DEF l=NIL,a,s[100]:STRING,x:PTR TO LONG,len,prt,b,y + x:=['bla','burp','e_','pom','ti','dom','aap','noot','mies'] + len:=ListLen(x) + FOR a:=1 TO n + StrCopy(s,'') + StrAdd(s,(y:=Rnd(26)+"A") BUT {y}+3,1) + StrAdd(s,(y:=Rnd(26)+"a") BUT {y}+3,1) + StrAdd(s,(y:=Rnd(26)+"A") BUT {y}+3,1) + prt:=Rnd(3)+1 + FOR b:=1 TO prt DO StrAdd(s,x[Rnd(len)]) + StrAdd(s,(y:=Rnd(26)+"A") BUT {y}+3,1) + StrAdd(s,(y:=Rnd(26)+"a") BUT {y}+3,1) + StrAdd(s,(y:=Rnd(26)+"A") BUT {y}+3,1) + l:=Link(StrCopy(String(EstrLen(s)),s),l) + ENDFOR +ENDPROC l diff --git a/amigae33a/E_v3.3a/Src/Src/Class/README b/amigae33a/E_v3.3a/Src/Src/Class/README new file mode 100644 index 0000000..38aa331 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Class/README @@ -0,0 +1,6 @@ +Gathered here are some class bits'n pieces. + +In the future, the emodules:class dir should be filled with +useful classes, but I'm sorry to say I haven't got to really +building a class-library. Hash and Stack though are quite +practical. diff --git a/amigae33a/E_v3.3a/Src/Src/Class/ScrollWin/sc.doc b/amigae33a/E_v3.3a/Src/Src/Class/ScrollWin/sc.doc new file mode 100644 index 0000000..6243fc1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Class/ScrollWin/sc.doc @@ -0,0 +1,109 @@ +sc.m and sctext.m: scrolling windows. [see also: textview.e] + +The object `scrollwin' contained in sc.m is a general purpose window with +scrollbars that will display any items of information. `scrolltext' in the +module sctext.m inherits from scrollwin and implements a scrolling window with +text. It is very easy (and encouraged) to inherit from either of these +objects and implement your own scrolling windows (EDBG, for example, uses two +further objects that inherit from scrolltext and display memory/registers). + +members and methods of OBJECT scrollwin: + + NEW scrollwinptr.open(title,x,y,sx,sy,screen=NIL,ownidcmp=0,ownhandle=NIL) + +The constructor is called with some obvious arguments. With ownidcmp you can +for example attach menus to the window. ownhandle is a callback PROC with one +arg (the intuimessage). Will raise "scrl" if it can't get what if wants +(window etc.). + + quit:=handle() + +will handle messages to the window. May call your callback or some of the +extra_ methods below. If quit=TRUE the user clicked the close gadget. + + END scrollwinptr + +closes the window. + + refreshwindow() + +refresh the window manually if you change something about the data +represented. normally this is done by the window automatically. + +The extra_ methods are the ones you are supposed to override to implement the +display of the actual data (if you just want to use scrolltext, skip these): + + extra_init(screen) + +called from open(). Do any initialisations here if you wish. + + extra_exit() + +same for end(). + + px,py:=extra_unit() + +called by the object when it wants to know how big the items being displayed +are (i.e. (1,1) for pixels, (fontwidth,fontheight) for text etc.). The +default method returns (1,1). + + ux,uy:=extra_max() + +called by the object to ask the number of objects being displayed. this +should be somewhere between (1,1) and (32767,32767). + + extra_refresh(x,y,xsize,ysize,xoff,yoff,win:PTR TO window) + +The core. This method is called when the area of your data denoted by +(x,y,xsize,ysize) is currently visible (problably because the user scrolled it +there), and needs to be rendered. Note that these four numbers are in units +of your data, not pixels! You can use `win' to render the data, from (pixel) +offsets (xoff,yoff) in the window. + +As an example, say you're displaying a text with a font of 8x8 pixels, the +text has 100 lines and 80 columns. The user has resized the window such that +it has space for 10 lines of text and 40 columns, and scolled to the middle of +it. The call will then look like (for example): + +extra_refresh(20,45,40,10,12,4,win) + +the area to be rendered is thus (320,80) in size. Of course you can optimize +refreshing by using scrolling instead of re-rendering, you should implement +this yourself though (scrolltext does that). + + ux,uy:=where(px,py) + +finds the element denoted by those (pixel) coordinates, as you might receive +them in an intuimessage on a mouse click. The returned 2 coordinates take +care of position of the scrollers and unit size. + + settop(newtop=0,dorefresh=TRUE) + +manually sets the top of the area being displayed. do not use too often +as it might confuse the user. + + window:PTR TO window + +the only instance variable. careful when using this. + +The scrolltext object inherits from scrollwin. You should call open / handle +/ end etc. on it as usual. scrollwin redefines the extra_ methods of +scrollwin to implement text-specific scrolling. Following methods are added: + + settext(textlist,width) + +The constructor for this object. textlist should be an E list of +nil-terminated strings. width is the maximum width to display, i.e. usually +the maximum width of these strings. Call open() as the first method after +this one. + + active(cur,dorefresh=TRUE) + +Will set the current active line. This will be graphically marked by inverting the +line. If this method is never called there will be no active line display. + + uy:=getactive() + +asks what the currently active line is. + +as an example of all this, please see the extremely simple textview.e diff --git a/amigae33a/E_v3.3a/Src/Src/Class/ScrollWin/textview.e b/amigae33a/E_v3.3a/Src/Src/Class/ScrollWin/textview.e new file mode 100644 index 0000000..04675a8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Class/ScrollWin/textview.e @@ -0,0 +1,15 @@ +-> show a textfile in a nice juicy scrolling window + +MODULE 'tools/file', 'tools/exceptions', 'class/sctext' + +PROC main() HANDLE + DEF m,l,n,list,sc=NIL:PTR TO scrolltext + m,l:=readfile(arg) + list:=stringsinfile(m,l,n:=countstrings(m,l)) + NEW sc.settext(list,100) + sc.open('TextView v0.1',20,20,300,150) + WHILE sc.handle()=FALSE DO Wait(-1) +EXCEPT DO + END sc + report_exception() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Class/Stack/stack.e b/amigae33a/E_v3.3a/Src/Src/Class/Stack/stack.e new file mode 100644 index 0000000..21d3148 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Class/Stack/stack.e @@ -0,0 +1,35 @@ +-> Jaaaa, a true STACK in E! :-) + +OPT MODULE + +EXPORT OBJECT stack + PRIVATE d:PTR TO LONG +ENDOBJECT + +PROC stack() OF stack -> constructor + self.d:=NIL +ENDPROC + +PROC is_empty() OF stack IS self.d=NIL + +PROC push(x) OF stack + self.d:=NEW [self.d,x]:LONG +ENDPROC + +PROC pop() OF stack + DEF a:PTR TO LONG,b + IF a:=self.d + self.d:=a[]; b:=a[1] + END a[2] + ELSE + Raise("estk") + ENDIF +ENDPROC b + +PROC end() OF stack -> destructor + DEF a:PTR TO LONG,b:PTR TO LONG + a:=self.d + WHILE a + b:=a; a:=a[]; END b[2] + ENDWHILE +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Class/Stack/stackuse.e b/amigae33a/E_v3.3a/Src/Src/Class/Stack/stackuse.e new file mode 100644 index 0000000..db55c4e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Class/Stack/stackuse.e @@ -0,0 +1,13 @@ +-> lets use a STACK! + +MODULE 'class/stack' + +PROC main() HANDLE + DEF s=NIL:PTR TO stack,a + NEW s.stack() -> amaaazing! :-) + FOR a:=1 TO 10 DO s.push(a) + FOR a:=1 TO 11 DO WriteF('element = \d\n',s.pop()) +EXCEPT DO + END s + IF exception="estk" THEN WriteF('You underflowed the stack!\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Dos/Shell.e b/amigae33a/E_v3.3a/Src/Src/Dos/Shell.e new file mode 100644 index 0000000..e0f99bc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Dos/Shell.e @@ -0,0 +1,15 @@ +-> Silly Shell Example + +PROC main() + DEF inputstring[80]:STRING, con + IF con:=Open('con:10/10/400/100/MySillyShell v0.1',NEWFILE) + Write(con,'Shell by $#%! in 1991. "BYE" to stop.\n',STRLEN) + WHILE StrCmp(inputstring,'BYE')=FALSE + Execute(inputstring,0,con) + Write(con,'MyPrompt> ',STRLEN) + ReadStr(con,inputstring) + UpperStr(inputstring) + ENDWHILE + Close(con) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Dos/date.e b/amigae33a/E_v3.3a/Src/Src/Dos/date.e new file mode 100644 index 0000000..8cd058f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Dos/date.e @@ -0,0 +1,28 @@ +/* example of usage for DateStamp() and DateToStr() functions */ + +MODULE 'dos/datetime', 'dos/dos' + +DEF dt:datetime,ds:PTR TO datestamp + +/* these are filled by DateToStr() */ +DEF day[50]:ARRAY,date[50]:ARRAY,time[50]:ARRAY + +PROC main() + + /* get stamp in part of datetime structure */ + ds:=DateStamp(dt.stamp) + + WriteF('days=\d, minutes=\d, ticks=\d\n',ds.days,ds.minute,ds.tick) + + /* fill datetime structure */ + dt.format:=FORMAT_DOS + dt.flags:=DTF_SUBST + dt.strday:=day + dt.strdate:=date + dt.strtime:=time + + IF DateToStr(dt) + WriteF('day=\s, date=\s, time=\s\n',day,date,time) + ENDIF + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Dos/readtext.e b/amigae33a/E_v3.3a/Src/Src/Dos/readtext.e new file mode 100644 index 0000000..ee87558 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Dos/readtext.e @@ -0,0 +1,27 @@ +/* read a text file example. note that the program has no + hardcoded limit on the lenght of the file */ + +CONST MAXLINELEN=1000 + +PROC main() + DEF fh,buf[MAXLINELEN]:ARRAY,n=0,last=NIL,s,first=NIL + IF fh:=Open(arg,OLDFILE) + WHILE Fgets(fh,buf,MAXLINELEN) + IF (s:=String(StrLen(buf)))=NIL THEN Raise("MEM") + StrCopy(s,buf,ALL) + IF last THEN Link(last,s) ELSE first:=s + last:=s + INC n + ENDWHILE + Close(fh) + WriteF('FILE: "\s", \d lines.\n\n',arg,n) + s:=first + WHILE s + PutStr(s) + s:=Next(s) + ENDWHILE + DisposeLink(first) + ELSE + WriteF('no file: "\s"\n',arg) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Explorer/Explorer.doc b/amigae33a/E_v3.3a/Src/Src/Explorer/Explorer.doc new file mode 100644 index 0000000..f97d795 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Explorer/Explorer.doc @@ -0,0 +1,224 @@ +Short: Amazing System Browser and Debugger +Type: dev/e +Author: jason@fsel.com (Jason R. Hulance) + +Explorer 2.1j +============= +Allows you to browse around memory as E objects (which are like C structs). + +Basic Function +-------------- +You enter an address and then select the object which is (supposed to be?) +at that address. You can then see the value that each element of the +object takes, and follow pointers etc. by double-clicking on the element (a +single click changes the address to the element's address, which is an +offset from the address you specified for the object). + +A double-click may therefore change the object being browsed, so there is a +way of returning to the original object via the "Back Up" button. As you +double-click and select new objects your choices are recorded. The current +depth of this path is shown as the 'Depth:' text. The action of the "Back +Up" button is duplicated by the "Back Up" menu item on the "Selections" +menu. There is also an option to clear the current path on this menu. + +The list of objects may be created in several ways (these are found on the +"Project" menu): + + 1) "Open" Opens a previously saved config file, containing any number of + objects. By default, when Explorer starts it tries to load + objects from "explorer.config" in the current directory, and + then "s:explorer.config" if that fails. The supplied + "explorer.config" file contains all the standard Amiga OS + objects. (This file was created by using "Load Modules" on the + "Emodules:" directory and then saving the config using the next + option.) + 2) "Save" Saves the current list of objects as an Explorer config file. + 3) "Load Modules" Scan the selected module or all the modules in the + selected directory and its sub-directories. The found objects + will replace any current list of objects. This operation can + take a long time, especially if you try to load all the modules + in "Emodules:". You can interrupt it at any time by closing the + status window. + 4) "Merge Modules" Same as 3) but any objects found are added to the + current list of objects rather than replacing them. + 5) "Load Cache" Same as 3) but the current E module cache is scanned. + This is most useful when Explorer is used to help debug your + programs. + +The address and object can also be specified via ARexx, making Explorer an +extremely useful debugging tool as well as a system browser! In fact, EDBG +v3.3a+ makes use of Explorer to analyse typed variables. (A module is +supplied to show how easy it is to integrate the appropriate ARexx call +into your program.) + +Object Layout +------------- +The elements of the selected object are listed in order. If you choose to +see the value of element it will be displayed in hex in parenthesis after +the element, and if you choose to see the element address (an offset from +the object address) it will be displayed after an '@'. (Use the +"Selections" menu to decide which, if any, you want to see.) + +Where to Start +-------------- +Explorer starts off with the address of an internal hail and copyright +string. The items on the "Presets" menu give some other, interesting +starting points: + + 1) "Dos" Views the address stored in the 'dosbase' global variable as a + 'doslibrary' object. The dos.library is one of the fundamental + Amiga system libraries, and 'dosbase' is its corresponding + library base object. + 2) "Exec" Same as 1) but for the 'execbase' variable and object for the + exec.library (the most fundamental Amiga system library). + 3) "Graphics" Same as 1) but for the 'gfxbase' variable and object for the + graphics.library. + 4) "Intuition." Same as 1) but for the 'intuitionbase' variable and + object for the intuition.library. + 5) "This Process." Views the 'process' object for the running Explorer + program! + +For a typical Explorer session, you would probably start at one of these +points and then double-click on elements and use the "Back Up" button to +browse around. You never really need to set the address explicitly on the +GUI (at worst you'd do it by ARexx), but the option is there if you really +want to... + +Simple Types +------------ +The "CHAR", "INT" and "LONG" buttons view the contents of the address as if +it were a pointer to the corresponding type, and fills in the 'Hex:', +'Decimal:' and 'String:' texts with the value(s) being pointed at. + +"BSTR" is similar to "CHAR" but it first converts the address from a BCPL +pointer and then skips over the length byte. "BADDR" just converts the +address to a BCPL pointer. + +"--" and "++" treat the address as if it were pointing to an array of the +type last requested (i.e., an object or simple type). "--" moves the +address back to the previous element in the array, and "++" moves it on to +the next. The size of the last requested type is shown as the 'Size:' +text. (Note: "--" can be activated also by the "p" key and "++" by the "n" +key.) + +Display Beeps! +-------------- +The screen will flash (or you'll get a beep or whatever your Workbench is +set up to do) if you do one of the following: + + 1) Select something when the address is NIL (zero). A NIL address is not + valid (although Explorer will behave as if it were). + 2) Select an element which is a NIL pointer or a LONG that is NIL. + 3) Select an element with object or PTR TO object type, where the object + is not in the current list of objects. + 4) Backup past a depth of zero. + +Command Line Options +-------------------- +The command line template is: + + OBJECT,ADDR,ALL/S,CACHE/S,NONE/S,CONFIG/K,SCREEN/K,NOAUTOREPLY/S + + 1) OBJECT Specify an initial object to be displayed (to be useful, the + appropriate module must also be loaded using 'ALL' or 'CACHE'). + 2) ADDR Specify an initial address to be displayed (NIL is ignored!). + 3) ALL Load all objects from the modules in Emodules: and its + sub-directories (overrides 'CACHE' and 'CONFIG'). + 4) CACHE Load all objects from the modules in the current E module cache + (overrides 'CONFIG'). + 5) NONE Start with no objects (overrides 'ALL', 'CACHE' and 'CONFIG'). + 6) CONFIG Specify the config file to load. If this load fails then + Explorer will try "s:explorer.config". + 7) SCREEN Specify the public screen to open on. Normally Explorer will + open on the default public screen. + 8) NOAUTOREPLY Specifies that the "Auto Reply" option (described below) + should start as off rather than on. + +By default, Explorer will try to load the "explorer.config" in the current +directory (as if you'd used the CONFIG option -- so if will fall back to +trying "s:explorer.config"). The starting address will be that of an +internal hail and copyright string (which will be displayed as the +'String:' text). + +ARexx +----- +The "Reply" menu item on the "ARexx" menu manually replies to an ARexx +message that may have been received. You can also let Explorer +automatically reply to these messages by checking the "Auto Reply" option, +but the manual method is best since you can be sure that the pointers +remain valid while you browse (since the calling program is halted). Once +you've replied to a message the calling program is free to scribble all +over the memory at the address it just gave you... + +A module 'sendexplorer' is supplied to simplify the debugging facilities of +Explorer. It defines a single function, 'sendExplorer': + + PROC sendExplorer(addr,obj=NIL,repPort=NIL,message=NIL,quiet=FALSE) + + 'addr' is the address you wish to use. + 'obj' is the name of the object you are interested in. + 'repPort' is a message port for replies. If you don't supply this then a + temporary port is created for the duration of the function call. + (The purpose of this parameter is to allow you to re-use the + same port during your program if you call 'sendExplorer' a lot.) + 'message' is a short string to be displayed in the 'Message:' part of + Explorer. Use this to communicate some information about the + address and object (EDBG uses this to give the name, type and + scope of the variable being explored). + 'quiet' is a boolean to say whether Explorer should complain if the + object is not loaded. + +An example call is: + + sendExplorer(packet, 'dospacket') + +To browse using your own objects you'd separate them out into modules and +load these modules in your program. Compiling your program would add these +to the E module cache, which can then be used to set-up Explorer (using the +"Load Cache" menu item). Alternatively, you could "Load" or "Merge" the +appropriate module directly, or use a config file if the objects don't +change very often. + +Altering Data +------------- +By popular demand, if you hold down the shift key when you click on an +element of an object or on the 'CHAR', 'INT' or 'LONG' buttons, then a +small window pops up which allows you to edit the appropriate value. It's +not very safe to randomly edit data (especially system data), so use of +this feature is discouraged unless you really know what you're doing... + +Example Program +--------------- +To show how useful Explorer can be, there is a modified version of the +'empty' handler supplied. This uses the above call to 'sendExplorer' to +communicate the value of the packet currently being processed. Since the +handler is not a full process (it's just a task) there would normally be no +simple way of debugging it or examining the packets as they arrive (none of +the DOS functions, such as printing text, are available to simple tasks). +However, the handler can send messages to ARexx and thus to Explorer. + +To try it out: + + 1) Make sure ARexx is up (by running RexxMast, if necessary). + 2) Start up Explorer using, + run explorer all + 3) Now copy the 'empty-handler' to L:, + copy empty-handler L: + 4) Mount it using, + mount empty: from empty.mountlist + 5) Use the handler, + type empty:10 + 6) Look at Explorer. It will be displaying the first packet. Browse + around it, remembering that most elements will be BCPL strings. + 7) Select "Reply" from the ARexx menu (or press RAmiga-R) to reply to this + message. + 8) Another packet arrives and the message is sent to Explorer. + 9) Repeat 6)-8) until the 'type' command finishes and you get the Shell + prompt back. + +EDBG +---- +EDBG v3.3a+ communicates data about a variable if you hold down the shift +key and double-click on a variable that's within the current scope (EDBG +also adds it to the list of watched variables, if necessary). + diff --git a/amigae33a/E_v3.3a/Src/Src/Explorer/empty-handler.e b/amigae33a/E_v3.3a/Src/Src/Explorer/empty-handler.e new file mode 100644 index 0000000..84a4246 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Explorer/empty-handler.e @@ -0,0 +1,103 @@ +/*** + Returns the number of X's specified as filename: + "Copy Empty:100 Ram:test" will create a file "test" in Ram: + containing 100 X's +***/ + +OPT OSVERSION=37, PREPROCESS + +MODULE 'dos/dos', + 'dos/dosextens', + 'dos/filehandler', + 'exec/ports', + 'exec/nodes', + 'rexx/rxslib', + 'rexxsyslib', + 'amigalib/ports', + 'other/sendexplorer' + +ENUM ERR_NONE, ERR_LIB + +RAISE ERR_LIB IF OpenLibrary()=NIL + +PROC getpacket (p:PTR TO process) + DEF port:PTR TO mp, msg:PTR TO mn + port:=p.msgport -> The port of our process + WaitPort(port) -> Wait for a message + msg:=GetMsg(port) +ENDPROC msg.ln.name + +PROC main() HANDLE + DEF myrep=NIL:PTR TO mp + rexxsysbase:=OpenLibrary(RXSNAME, 0) + IF NIL=(myrep:=createPort(NIL,0)) THEN Raise("PORT") + handler(myrep) +EXCEPT DO + IF myrep THEN deletePort(myrep) + IF rexxsysbase THEN CloseLibrary(rexxsysbase) +ENDPROC + +PROC initialpacket(myrep) + DEF proc:PTR TO process, packet:PTR TO dospacket, ln:PTR TO ln, + dev:PTR TO devicenode + proc:=FindTask(NIL) + ln:=wbmessage + packet:=ln.name + wbmessage:=NIL + dev:=BADDR(packet.arg3) + dev.task:=proc.msgport + sendExplorer(packet, 'dospacket', myrep) + ReplyPkt(packet, DOSTRUE, 0) +ENDPROC proc, dev + +PROC handler(myrep) + DEF proc, packet:PTR TO dospacket, dev:PTR TO devicenode, + fh:PTR TO filehandle, running=TRUE, opencount=0, + readlen, c, s, filename[64]:STRING, type + proc,dev:=initialpacket(myrep) + WHILE running + packet:=getpacket(proc) + sendExplorer(packet, 'dospacket', myrep) + type:=packet.type + SELECT type + CASE ACTION_FINDINPUT + s:=BADDR(packet.arg3) + c:=0 + WHILE c":") DO INC s + IF s[]=":" THEN INC s + c:=Val(s) + INC opencount + fh:=BADDR(packet.arg1) + fh.interactive:=0 -> Non-interactive file + fh.args:=fh + fh.arg2:=c + ReplyPkt(packet, DOSTRUE, 0) + CASE ACTION_READ + fh:=packet.arg1 + s:=packet.arg2 + readlen:=Min(fh.arg2, packet.arg3) + c:=0 + WHILE c0 + ReplyPkt(packet, DOSTRUE, 0) + DEFAULT + ReplyPkt(packet, DOSFALSE, ERROR_ACTION_NOT_KNOWN) + ENDSELECT + ENDWHILE + dev.task:=FALSE +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Explorer/empty.mountlist b/amigae33a/E_v3.3a/Src/Src/Explorer/empty.mountlist new file mode 100644 index 0000000..0715db2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Explorer/empty.mountlist @@ -0,0 +1,5 @@ +EMPTY: Handler = l:empty-handler + Stacksize = 4096 + Priority = 5 + GlobVec = -1 +# diff --git a/amigae33a/E_v3.3a/Src/Src/Explorer/explorer.config b/amigae33a/E_v3.3a/Src/Src/Explorer/explorer.config new file mode 100644 index 0000000..181d931 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Explorer/explorer.config differ diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/24bitColourDemo.e b/amigae33a/E_v3.3a/Src/Src/Gfx/24bitColourDemo.e new file mode 100644 index 0000000..2432de9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/24bitColourDemo.e @@ -0,0 +1,46 @@ +/* 24bit color demo. works only on AGA machines with kick3 + +A small demo demonstrating the new 24bit palette of the newer AA +Amigas. You'll need such an amiga and kick3 to run this demo, ofcourse. +The demo will draw lines in 256 tints and less on the screen, and then +lets you manipulate the colour-registers by pressing the leftMB on some +(x,y) spot on the screen. These coordinates will serve as RGB values. +To quit, press the rightMB. + +*/ + +OPT OSVERSION=39 + +CONST X=319, Y=255 + +PROC main() + DEF s,win,x,y,z + IF s:=OpenS(X+1,Y+1,8,0,'bla') + IF win:=OpenW(0,0,X+1,Y+1,0,0,'bla',s,15,0) + FOR x:=0 TO 255 DO SetColour(s,x,x,x,x) + FOR y:=0 TO Y DO Line(0,y,63,y,y AND $FF) + FOR y:=0 TO Y DO Line(64,y,127,y,y AND $FE) + FOR y:=0 TO Y DO Line(128,y,191,y,y AND $FC) + FOR y:=0 TO Y DO Line(192,y,255,y,y AND $F8) + FOR y:=0 TO Y DO Line(256,y,319,y,y AND $F0) + SetDrMd(stdrast,0) + SetTopaz(8) + TextF(0,30,' Press leftMB on some (x,y) spot') + TextF(0,40,' Press (0,0) to leave.') + TextF(0,50,' #of colours:') + TextF(0,60,' 256 128 64 32 16 ') + TextF(0,70,' #bits colour:') + TextF(0,80,' 24 21 18 15 12 ') + TextF(0,90,' AGA AGA AGA AGA ECS ') + WHILE TRUE + WaitLeftMouse(win) + y:=MouseX(win)*4/5 + z:=MouseY(win) + EXIT y+z<4 + FOR x:=0 TO 255 DO SetColour(s,x,y,x,z) + ENDWHILE + CloseW(win) + ENDIF + CloseS(s) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/TEXTUREMAP_ROAD.br.chunky b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/TEXTUREMAP_ROAD.br.chunky new file mode 100644 index 0000000..9c4c8fd Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/TEXTUREMAP_ROAD.br.chunky differ diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/c2p4.m b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/c2p4.m new file mode 100644 index 0000000..a8db0f2 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/c2p4.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/ls.e b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/ls.e new file mode 100644 index 0000000..9fea03c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/ls.e @@ -0,0 +1,143 @@ +-> landscape test + +OPT OSVERSION=39 + +CONST CWIDTH=256,CHEIGHT=128,CWSHIFT=8 +CONST SCHEIGHT=CHEIGHT+20 +CONST TEMPBUFS=CWIDTH*CHEIGHT/2,BUFS=CWIDTH*CHEIGHT,BUFM=$7FFF +CONST SXOFF=50,SYOFF=80 + +MODULE '*c2p4', '*screenmodereq_db', 'tools/exceptions', 'tools/scrbuffer', + 'intuition/screens', 'graphics/rastport', 'graphics/gfx', + 'intuition/intuition' + +PROC main() HANDLE + DEF dbs,scr=NIL:PTR TO screen,bm:PTR TO bitmap,win=NIL:PTR TO window, + tbuf2,tbuf3,tbuf2b,tbuf3b,cbuf,dbuf,dbuf2,lsbuf,sigbit,sig,safe=TRUE,a,x=0,y=0, + imsg:PTR TO intuimessage,temp + IF (dbs:=openreqscreen(CWIDTH,SCHEIGHT,4,'bla'))=NIL THEN Raise() + scr:=sb_GetScreen(dbs) + IF (win:=OpenW(0,0,CWIDTH-1,SCHEIGHT-1, + IDCMP_MOUSEBUTTONS OR IDCMP_MOUSEMOVE, + WFLG_REPORTMOUSE OR WFLG_BORDERLESS OR WFLG_SIMPLE_REFRESH OR WFLG_BACKDROP OR WFLG_ACTIVATE, + '',scr,15,NIL))=NIL THEN Raise("WIN") + tbuf2:=NewM(TEMPBUFS+TEMPBUFS,2) + tbuf3:=tbuf2+TEMPBUFS + tbuf2b:=NewM(TEMPBUFS+TEMPBUFS,2) + tbuf3b:=tbuf2b+TEMPBUFS + NEW cbuf[BUFS] + NEW dbuf[BUFS] + NEW dbuf2[BUFS] + NEW lsbuf[BUFS] + FOR a:=0 TO BUFS-1 + dbuf[a]:=-1 + dbuf2[a]:=-1 + ENDFOR + FOR a:=0 TO 15 DO SetColour(scr,15-a,a*16,a*16,a*16) + mountain(cbuf) + CopyMem(cbuf,lsbuf,BUFS) + SetRast(scr.rastport,0) + IF (sigbit:=AllocSignal(-1))<>-1 + sig:=Shl(1,sigbit) + REPEAT + render(cbuf,lsbuf,CWIDTH*y+x,80,80) + x:=x+2 + y:=y+3 + IF safe=FALSE + Wait(sig) + safe:=TRUE + ENDIF + bm:=sb_NextBuffer(dbs) + ->SetColour(scr,15,f:=255-f,f,f) + c2p4(tbuf3,tbuf2,cbuf,dbuf,bm.planes,FindTask(NIL),sig,gfxbase) + temp:=dbuf; dbuf:=dbuf2; dbuf2:=temp + temp:=tbuf2; tbuf2:=tbuf2b; tbuf2b:=temp + temp:=tbuf3; tbuf3:=tbuf3b; tbuf3b:=temp + IF imsg:=GetMsg(win.userport) + x:=0-imsg.mousex + y:=0-imsg.mousey + ReplyMsg(imsg) + ENDIF + safe:=FALSE + UNTIL Mouse() + IF safe=FALSE THEN Wait(sig) + FreeSignal(sigbit) + ENDIF +EXCEPT DO + IF win THEN CloseWindow(win) + closereqscreen(dbs) + SELECT exception + CASE "SCR"; WriteF('no screen!\n') + CASE "REQ"; WriteF('Error: Could not allocate ASL request\n') + CASE "ASL"; WriteF('Error: Could not open ASL library\n') + ENDSELECT + report_exception() +ENDPROC + +PROC mountain(buf) + DEF a,x,y + FOR a:=0 TO BUFS-1 + y:=a/CWIDTH; x:=Mod(a,CWIDTH) + buf[a]:=Bounds( + ((x-128)*(x-128))+((y-64)*(y-64))/300, + ->x*y/300, + ->!(!Fsin(x!/10.0)*3.0+3.0)+(!Fsin(y!/10.0)*3.0+3.0)!, + ->!Fsin(x!/10.0)*6.0*Fsin(y!/10.0)+5.0!, + 0,15) + ENDFOR +ENDPROC + +PROC render(destbuf,lsbuf,offs,xs,ys) + DEF a,t1,t2 + clearmem(destbuf,BUFS) + t1:=ys-1*CWIDTH-1+offs + t2:=xs-1+offs + FOR a:=1 TO xs DO line(a,t1+a AND BUFM,a+SXOFF,a/2+SYOFF,destbuf,lsbuf) + FOR a:=ys-1 TO 1 STEP -1 DO line(a,a-1*CWIDTH+t2 AND BUFM,xs*2+SXOFF-a,a/2+SYOFF,destbuf,lsbuf) +ENDPROC + +PROC clearmem(mem,size) + DEF e:REG,a:REG,b:REG,c:REG,d:REG + e:=size/16-1 + a:=b:=c:=d:=$04040404 + MOVE.L mem,A0 + ADD.L size,A0 +clloop: + MOVEM.L a/b/c/d,-(A0) + DBRA e,clloop +ENDPROC + +PROC line(num,start,sx,sy,destbuf,lsbuf) + DEF a:REG,y,t:REG,c=0:REG,xoff:REG,yoff:REG + xoff:=sx+destbuf + yoff:=sy-25-num+1 + y:=sy*CWIDTH+xoff + a:=num-1+yoff + MOVE.L start,D2 -> D2=start + MOVEA.L lsbuf,A3 -> A3=lsbuf + MOVE.L y,A2 -> A2=y + MOVE.L #CWIDTH,D1 -> D1=CWIDTH + MOVE.L #BUFM,D0 -> D0=BUFM + MOVE.L #CWIDTH+1,A1 -> A1=CWIDTH+1 +bloop: -> this loop eats almost all cpu-time. + MOVE.B 0(A3,D2.L),c + MOVE.L a,t + ADD.L c,t + LSL.L #CWSHIFT,t + ADD.L xoff,t + CMP.L A2,t + BGE.S skip + BRA.S loop +begi: + SUBA.L D1,A2 + MOVE.B c,(A2) +loop: + CMP.L A2,t + BMI.S begi +skip: + SUB.L A1,D2 + AND.L D0,D2 + SUBQ.L #1,a + CMP.L yoff,a + BPL.S bloop +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/ls_sculpt.e b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/ls_sculpt.e new file mode 100644 index 0000000..9f22d74 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/ls_sculpt.e @@ -0,0 +1,205 @@ +/* ++---------------------------------------------------------------+ +| RealTime 2.5d Landscape Sculpting ! | ++---------------------------------------------------------------+ + +usage: run it, preferably selecting lowres from the requester, +the sculpt with leftmouse, quit with rightmouse. + +sculpting is done as follows: two halfs of the screen (left-right) +influence the height of the two sides of the landscape. You'll need +to experiment a bit to get an idea what you can accomplish this way. + +for further fun: try and recompile with a different #define for +`trans()' further down the source. + +The code is pretty OS friendly (using intuition double-buffering +etc.), I hope it also works on gfx-cards (don't know about the +chunky code though). + +The sculpting bit is only a demo for the underlying engine, which +could display _any_ animated 3d landscape in realtime [it +should be fast enough on anything from an A1200+fast upwards] + +*/ + +OPT OSVERSION=39, PREPROCESS + +CONST CWIDTH=256,CHEIGHT=128,CWSHIFT=8 +CONST SCHEIGHT=CHEIGHT+20 +CONST TEMPBUFS=CWIDTH*CHEIGHT/2,BUFS=CWIDTH*CHEIGHT,BUFM=$7FFF +CONST SXOFF=50,SYOFF=80 +CONST XY3D=80 + +MODULE '*c2p4', '*screenmodereq_db', 'tools/exceptions', 'tools/scrbuffer', + 'intuition/screens', 'graphics/rastport', 'graphics/gfx', + 'intuition/intuition', 'devices/inputevent' + +DEF sideh[XY3D]:ARRAY OF LONG, both[XY3D]:ARRAY OF LONG + +PROC main() HANDLE + DEF dbs,scr=NIL:PTR TO screen,bm:PTR TO bitmap,win=NIL:PTR TO window, + tbuf2,tbuf3,tbuf2b,tbuf3b,cbuf,dbuf,dbuf2,lsbuf,sigbit,sig,safe=TRUE,a,x=0,y=0, + imsg:PTR TO intuimessage,temp,lastx=-1,lasty=-1,quit=FALSE + IF (dbs:=openreqscreen(CWIDTH,SCHEIGHT,4,'2.5d'))=NIL THEN Raise() + scr:=sb_GetScreen(dbs) + IF (win:=OpenW(0,0,CWIDTH-1,SCHEIGHT-1, + IDCMP_MOUSEBUTTONS OR IDCMP_MOUSEMOVE, + WFLG_REPORTMOUSE OR WFLG_BORDERLESS OR WFLG_SIMPLE_REFRESH OR WFLG_BACKDROP OR WFLG_ACTIVATE OR WFLG_RMBTRAP, + '',scr,15,NIL))=NIL THEN Raise("WIN") + tbuf2:=NewM(TEMPBUFS+TEMPBUFS,2) + tbuf3:=tbuf2+TEMPBUFS + tbuf2b:=NewM(TEMPBUFS+TEMPBUFS,2) + tbuf3b:=tbuf2b+TEMPBUFS + NEW cbuf[BUFS] + NEW dbuf[BUFS] + NEW dbuf2[BUFS] + NEW lsbuf[BUFS] + FOR a:=0 TO BUFS-1 + dbuf[a]:=-1 + dbuf2[a]:=-1 + ENDFOR + FOR a:=0 TO XY3D-1 + sideh[a]:=15 + both[a]:=15 + ENDFOR + ->FOR a:=0 TO 15 DO SetColour(scr,15-a,a*16,(15-a)*16,240) + FOR a:=0 TO 15 DO SetColour(scr,15-a,a*16,a*16,a*16) + FOR a:=0 TO BUFS-1 DO cbuf[a]:=15 + CopyMem(cbuf,lsbuf,BUFS) + SetRast(scr.rastport,0) + IF (sigbit:=AllocSignal(-1))<>-1 + sig:=Shl(1,sigbit) + REPEAT + render(cbuf,lsbuf,0,XY3D,XY3D) + IF safe=FALSE + Wait(sig) + safe:=TRUE + ENDIF + bm:=sb_NextBuffer(dbs) + c2p4(tbuf3,tbuf2,cbuf,dbuf,bm.planes,FindTask(NIL),sig,gfxbase) + temp:=dbuf; dbuf:=dbuf2; dbuf2:=temp + temp:=tbuf2; tbuf2:=tbuf2b; tbuf2b:=temp + temp:=tbuf3; tbuf3:=tbuf3b; tbuf3b:=temp + WHILE imsg:=GetMsg(win.userport) + x:=imsg.mousex; y:=imsg.mousey + IF imsg.qualifier AND IEQUALIFIER_RBUTTON THEN quit:=TRUE + IF (imsg.class=IDCMP_MOUSEBUTTONS) AND (imsg.code=SELECTUP) + lastx:=-1; lasty:=-1 + ENDIF + IF imsg.qualifier AND IEQUALIFIER_LEFTBUTTON + IF lastx>=0 + WHILE lastx<>x + IF lastx>x THEN lastx-- ELSE lastx++ + press(lastx,y,lsbuf) + ENDWHILE + ELSE + press(lastx:=x,lasty:=y,lsbuf) + ENDIF + ENDIF + ReplyMsg(imsg) + ENDWHILE + safe:=FALSE + UNTIL quit + IF safe=FALSE THEN Wait(sig) + FreeSignal(sigbit) + ENDIF +EXCEPT DO + IF win THEN CloseWindow(win) + closereqscreen(dbs) + SELECT exception + CASE "SCR"; WriteF('no screen!\n') + CASE "REQ"; WriteF('Error: Could not allocate ASL request\n') + CASE "ASL"; WriteF('Error: Could not open ASL library\n') + ENDSELECT + report_exception() +ENDPROC + +PROC press(mx,my,buf) + DEF height,xc,lr + mx:=Bounds(mx,0,CWIDTH-1) + my:=Bounds(my,0,SCHEIGHT-1) + height:=my*16/SCHEIGHT + xc,lr:=Mod(mx,CWIDTH/2) + xc:=xc*XY3D*2/CWIDTH + IF lr THEN side_sculpt(XY3D-1-xc,buf,height) ELSE bot_sculpt(xc,buf,height) +ENDPROC + +#define trans(a,b) a + b / 2 +->#define trans(a,b) Eor(a,b) +->#define trans(a,b) Max(a,b) +->#define trans(a,b) Min(a,b) + +PROC bot_sculpt(off,buf,h) + DEF p,a,sh:PTR TO LONG + p:=off+buf + both[off]:=h + sh:=sideh + FOR a:=0 TO XY3D-1 + p[]:=trans(sh[]++,h) + p:=p+CWIDTH + ENDFOR +ENDPROC + +PROC side_sculpt(off,buf,h) + DEF p,a,bh:PTR TO LONG + p:=off*CWIDTH+buf + sideh[off]:=h + bh:=both + FOR a:=0 TO XY3D-1 DO p[]++:=trans(bh[]++,h) +ENDPROC + +PROC render(destbuf,lsbuf,offs,xs,ys) + DEF a,t1,t2 + clearmem(destbuf,BUFS) + t1:=ys-1*CWIDTH-1+offs + t2:=xs-1+offs + FOR a:=1 TO xs DO line(a,t1+a AND BUFM,a+SXOFF,a/2+SYOFF,destbuf,lsbuf) + FOR a:=ys-1 TO 1 STEP -1 DO line(a,a-1*CWIDTH+t2 AND BUFM,xs*2+SXOFF-a,a/2+SYOFF,destbuf,lsbuf) +ENDPROC + +PROC clearmem(mem,size) + DEF e:REG,a:REG,b:REG,c:REG,d:REG + e:=size/16-1 + a:=b:=c:=d:=$04040404 + MOVE.L mem,A0 + ADD.L size,A0 +clloop: + MOVEM.L a/b/c/d,-(A0) + DBRA e,clloop +ENDPROC + +PROC line(num,start,sx,sy,destbuf,lsbuf) + DEF a:REG,y,t:REG,c=0:REG,xoff:REG,yoff:REG + xoff:=sx+destbuf + yoff:=sy-25-num+1 + y:=sy*CWIDTH+xoff + a:=num-1+yoff + MOVE.L start,D2 -> D2=start + MOVEA.L lsbuf,A3 -> A3=lsbuf + MOVE.L y,A2 -> A2=y + MOVE.L #CWIDTH,D1 -> D1=CWIDTH + MOVE.L #BUFM,D0 -> D0=BUFM + MOVE.L #CWIDTH+1,A1 -> A1=CWIDTH+1 +bloop: -> this loop eats most cpu-time. + MOVE.B 0(A3,D2.L),c + MOVE.L a,t + ADD.L c,t + LSL.L #CWSHIFT,t + ADD.L xoff,t + CMP.L A2,t + BGE.S skip + BRA.S loop +begi: + SUBA.L D1,A2 + MOVE.B c,(A2) +loop: + CMP.L A2,t + BMI.S begi +skip: + SUB.L A1,D2 + AND.L D0,D2 + SUBQ.L #1,a + CMP.L yoff,a + BPL.S bloop +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/rr.e b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/rr.e new file mode 100644 index 0000000..c562097 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/rr.e @@ -0,0 +1,226 @@ +-> "Rude Racing" or "Wreckless Driving" or "The Need For Traffic Jams" +-> see main() below for the controls. + +OPT OSVERSION=39, PREPROCESS + +CONST CWIDTH=256,CHEIGHT=128 +CONST SCHEIGHT=CHEIGHT+20 +CONST TEMPBUFS=CWIDTH*CHEIGHT/2,BUFS=CWIDTH*CHEIGHT + +MODULE '*c2p4', '*screenmodereq_db', 'tools/exceptions', 'tools/scrbuffer', + 'intuition/screens', 'graphics/rastport', 'graphics/gfx', + 'intuition/intuition' + +/*------------------------------------------------------------------------*/ + +OBJECT rseg + bend:INT -> in degrees, often between -10 and +10, 0=straight + steepness:INT -> in degrees, often between -40 and +40, 0=flat +ENDOBJECT + +CONST SEGX=256,SEGY=64, -> in pixels + LOOKAWAY=3, + SPEED=3, + WIDTHSTEP=5, + HORIZON=21 + +DEF road:PTR TO rseg, + roadlen, -> #of segments + cp=0, -> current pos in segments*pixels + turn=0, -> in degrees + rpos=0, -> in pixels, -128..127 + sintab[271]:ARRAY OF INT, + tmap + +-> both in range -90 to 90 + +#define sin(x) sintab[(x)+90] +#define cos(x) sintab[(x)+180] + +PROC ahead() IS cp:=cp+(SEGY/SPEED) +PROC back() IS cp:=Bounds(cp-(SEGY/SPEED),0,1000000) +PROC tleft() IS turn:=Bounds(turn-3,-60,60) +PROC tright() IS turn:=Bounds(turn+3,-60,60) +PROC pleft() IS rpos:=Bounds(rpos+3,-128,127) +PROC pright() IS rpos:=Bounds(rpos-3,-128,127) +PROC center() IS (turn:=0) BUT (rpos:=0) + +PROC render(cbuf) + DEF cpos,cpospix -> in segments, pixels in cur segment + DEF cangle,width=550,middle,ypos,pixstep=100,vp,vpos,vpospix,cbend=0,ccbend,lvpos,lvpospix,cmiddle + DEF omiddle,nval=0,nposr=0,posadj,te=0,tt=0 + clearmem(cbuf,CWIDTH*HORIZON,$0E0E0E0E) + clearmem(cbuf+(CWIDTH*HORIZON),BUFS-(CWIDTH*HORIZON),$0F0F0F0F) + cpospix,cpos:=Mod(cp,SEGY); cpos:=Mod(cpos,roadlen) + cangle:=road[cpos].steepness + middle:=CWIDTH/2+(rpos*2) + ypos:=CHEIGHT-1 + vp:=cp+(LOOKAWAY*SEGY) + lvpospix,lvpos:=Mod(vp,SEGY); lvpos:=Mod(lvpos,roadlen) + WHILE width>15 + vpospix,vpos:=Mod(vp,SEGY); vpos:=Mod(vpos,roadlen) + IF lvpos<>vpos + cbend:=cbend+(road[lvpos].bend*256) + IF tt++=0 THEN cbend:=cbend*(SEGY-lvpospix-1)/SEGY + ENDIF + ccbend:=cbend+(road[vpos].bend*256*(SEGY-vpospix-1)/SEGY) + nval,omiddle:=Mod(sin(Bounds(ccbend/256,-90,90))+nval,20000/(vp-cp)) + nposr,posadj:=Mod(WIDTHSTEP*rpos+nposr,256) + middle:=middle+omiddle-posadj + cmiddle:=middle+(sin(-turn)*32/ypos) + rline(cbuf,width,cmiddle,ypos,vpos,vpospix*CWIDTH+tmap) + ypos-- + + width:=width-WIDTHSTEP + vp:=vp+(pixstep/256) + + ->fake hills + ->width:=width-WIDTHSTEP+(road[vpos].steepness/10) + ->vp:=vp+Div(Mul((pixstep/256),100),(100-road[vpos].steepness)) + + pixstep:=pixstep/20+pixstep + lvpos:=vpos + ENDWHILE +ENDPROC + +PROC rline(cbuf,width,middle,ypos,vpos,tm) + DEF x,pstep,pcur=0,end + x:=middle-(width/2) + IF (x>=CWIDTH) OR (x+width<=0) THEN RETURN + cbuf:=ypos*CWIDTH+cbuf + pstep:=256*1024/width + IF x<0 + pcur:=-x*pstep + x:=0 + ENDIF + end:=Min(CWIDTH-x,256*1024-pcur/pstep)+cbuf+x + MOVE.L tm,A0 + MOVE.L cbuf,A1 + ADDA.L x,A1 + MOVE.L end,A2 + MOVE.L pcur,D1 + MOVE.L pstep,D2 + MOVEQ #10,D3 +tmloop: + MOVE.L D1,D0 + LSR.L D3,D0 + MOVE.B 0(A0,D0.L),(A1)+ + ADD.L D2,D1 + CMPA.L A2,A1 + BMI.S tmloop +ENDPROC + +PROC init() + DEF a + road:=[0,0,0,0,0,0,0,0,0,0,0,0, + 2,0,4,0, + 6,0,8,0,10,0,12,0,15,0,15,0,15,0,15,0,12,0,10,0,8,0,6,0, + 4,0,2,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + -2,0,-4,0, + -6,0,-8,0,-10,0,-10,0,-8,0,-6,0, + -4,0,-2,0, + 0,0,0,0,0,0,0,0,0,0,0,0, + 0,10,0,15,0,20,0,30,0,20,0,15,0,10, + 0,0, + 0,0,0,15,0,20,0,-20,0,-15,0,0,0,0,0,0 + ]:rseg + roadlen:=ListLen(road)/2 -> rseg elems + FOR a:=-90 TO 180 DO sintab[a+90]:=!Fsin(a!/180.0*3.14159)*255.0! + tmap:={tmaplab} +ENDPROC + +tmaplab: INCBIN 'e:rr/TEXTUREMAP_ROAD.br.chunky' + +/*------------------------------------------------------------------------*/ + +PROC main() HANDLE + DEF dbs,scr=NIL:PTR TO screen,bm:PTR TO bitmap,win=NIL:PTR TO window, + tbuf2,tbuf3,tbuf2b,tbuf3b,cbuf,dbuf,dbuf2,sigbit,sig,safe=TRUE,a,temp, + imsg:PTR TO intuimessage,key,frames=0,dframes,fsec,ssec,smic,esec,emic + IF (dbs:=openreqscreen(CWIDTH,SCHEIGHT,4,'bla'))=NIL THEN Raise() + scr:=sb_GetScreen(dbs) + IF (win:=OpenW(0,0,CWIDTH-1,SCHEIGHT-1, + IDCMP_MOUSEBUTTONS OR IDCMP_VANILLAKEY, + WFLG_REPORTMOUSE OR WFLG_BORDERLESS OR WFLG_SIMPLE_REFRESH OR WFLG_BACKDROP OR WFLG_ACTIVATE, + '',scr,15,NIL))=NIL THEN Raise("WIN") + tbuf2:=NewM(TEMPBUFS+TEMPBUFS,2) + tbuf3:=tbuf2+TEMPBUFS + tbuf2b:=NewM(TEMPBUFS+TEMPBUFS,2) + tbuf3b:=tbuf2b+TEMPBUFS + NEW cbuf[BUFS] + NEW dbuf[BUFS] + NEW dbuf2[BUFS] + FOR a:=0 TO BUFS-1 + dbuf[a]:=-1 + dbuf2[a]:=-1 + ENDFOR + FOR a:=1 TO 13 DO SetColour(scr,15-a-1,a*19,a*19,a*14) + SetColour(scr,0,212,0,9) + SetColour(scr,14,171,203,255) + SetColour(scr,15,156,194,0) + SetRast(scr.rastport,13) + bm:=sb_NextBuffer(dbs) + SetRast(scr.rastport,13) + init() + IF (sigbit:=AllocSignal(-1))<>-1 + sig:=Shl(1,sigbit) + CurrentTime({ssec},{smic}) + REPEAT + render(cbuf) + IF safe=FALSE + Wait(sig) + safe:=TRUE + ENDIF + bm:=sb_NextBuffer(dbs) + c2p4(tbuf3,tbuf2,cbuf,dbuf,bm.planes,FindTask(NIL),sig,gfxbase) + frames++ + temp:=dbuf; dbuf:=dbuf2; dbuf2:=temp + temp:=tbuf2; tbuf2:=tbuf2b; tbuf2b:=temp + temp:=tbuf3; tbuf3:=tbuf3b; tbuf3b:=temp + IF imsg:=GetMsg(win.userport) + IF imsg.class=IDCMP_VANILLAKEY + key:=imsg.code + SELECT key + CASE "a"; ahead() + CASE "b"; back() + CASE "z"; tleft() + CASE "x"; tright() + CASE "n"; pleft() + CASE "m"; pright() + CASE "c"; center() + -> "q" quits + ENDSELECT + ENDIF + ReplyMsg(imsg) + ENDIF + safe:=FALSE + UNTIL key="q" + CurrentTime({esec},{emic}) + IF safe=FALSE THEN Wait(sig) + FreeSignal(sigbit) + ENDIF +EXCEPT DO + IF win THEN CloseWindow(win) + closereqscreen(dbs) + dframes:=esec-ssec*100+(emic-smic/10000) + fsec:=frames*10000/dframes + IF frames THEN WriteF('calculated \d pictures \d.\z\d[2] seconds, giving \d.\z\d[2] f/s\n',frames,Div(dframes,100),Mod(dframes,100),Div(fsec,100),Mod(fsec,100)) + SELECT exception + CASE "SCR"; WriteF('no screen!\n') + CASE "REQ"; WriteF('Error: Could not allocate ASL request\n') + CASE "ASL"; WriteF('Error: Could not open ASL library\n') + ENDSELECT + report_exception() +ENDPROC + +PROC clearmem(mem,size,pat) + DEF e:REG,a:REG,b:REG,c:REG,d:REG + e:=size/16-1 + a:=b:=c:=d:=pat + MOVE.L mem,A0 + ADD.L size,A0 +clloop: + MOVEM.L a/b/c/d,-(A0) + DBRA e,clloop +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/screenmodereq_db.m b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/screenmodereq_db.m new file mode 100644 index 0000000..cbd9738 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Gfx/Chunky3d/screenmodereq_db.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/ColourScreen.e b/amigae33a/E_v3.3a/Src/Src/Gfx/ColourScreen.e new file mode 100644 index 0000000..7031897 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/ColourScreen.e @@ -0,0 +1,14 @@ +/* _Very_ simple customscreen-demo */ + +PROC main() + DEF screen,sx,sy + IF screen:=OpenS(321,257,5,0,'My Screen') + REPEAT + FOR sx:=0 TO 320 + FOR sy:=0 TO 256 DO Plot(sx,sy,sx*sy+1) + EXIT Mouse()=1 + ENDFOR + UNTIL Mouse()=1 + CloseS(screen) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/IfsFern.e b/amigae33a/E_v3.3a/Src/Src/Gfx/IfsFern.e new file mode 100644 index 0000000..de84d7b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/IfsFern.e @@ -0,0 +1,56 @@ +/* iterated affine transformations + + gets you a leaf on the screen in a rather special way. + be patient: it may take some time for you to actually see something. + +*/ + +OPT OSVERSION=39 /* oh, and we need a 640*512*256 screen */ + +CONST SCRX=740, SCRY=580, PLANES=8 + +OBJECT trans + a,b,c,d,ox,oy,prob +ENDOBJECT + +DEF win,scr + +PROC main() + DEF a + scr:=OpenS(SCRX,SCRY,PLANES,$8004,'Fern') + IF scr=NIL + WriteF('Could not open screen!\n') + ELSE + win:=OpenW(0,0,SCRX-1,SCRY-1,$200,$F,'Fern',scr,15,NIL) + IF win=NIL + WriteF('Could not open window!\n') + ELSE + FOR a:=0 TO 255 DO SetColour(scr,a,a,a,a) + do([[ .0, .0, .0, .16,.0, .0, 1 ]:trans, -> back to the root! + [ .2, .23,(-.26),.22,.0,1.6, 7 ]:trans, -> right leaf + [(-.15), .26, .28, .24,.0, .44,7 ]:trans, -> left leaf + [ .85,(-.04), .04, .85,.0,1.6, 85]:trans]) -> body + ->WaitIMessage(win) + CloseW(win) + ENDIF + CloseS(scr) + ENDIF +ENDPROC + +PROC do(t:PTR TO LONG) + DEF x=1.,y=1.,r,n,a,tr:PTR TO trans,xn,yn,sx,sy,d + REPEAT + r:=Rnd(100) + n:=0 + FOR a:=1 TO ListLen(t) + tr:=t[a-1] + EXIT (r>=n) AND (tr.prob+n>r) + n:=n+tr.prob + ENDFOR + sx:=!(xn:=!(!tr.a*x)+(!tr.c*y)+tr.ox)*60.!+(SCRX/2) + sy:=SCRY-(!(yn:=!(!tr.b*x)+(!tr.d*y)+tr.oy)*50.!) + d:=Bounds(ReadPixel(stdrast,sx,sy)+20,64,255) + Plot(sx,sy,d) + x:=xn; y:=yn + UNTIL LeftMouse(win) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/IntMandel.e b/amigae33a/E_v3.3a/Src/Src/Gfx/IntMandel.e new file mode 100644 index 0000000..71550fa --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/IntMandel.e @@ -0,0 +1,56 @@ +-> Yet Another Mandel, translated from Oberon. integer this time. + +OPT OSVERSION=37, REG=5 + +MODULE 'tools/clonescreen' + +CONST DEPTH=4,COLOURS=16 -> related :-) +CONST ITERDEPTH=25 + +PROC main() HANDLE + + DEF zr,zi,ar,ai,dr,di,sr,si,st,x,y,i, + screen=NIL,font=NIL,win=NIL,xsize,ysize,depth + + screen,font:=openclonescreen('Workbench','YAM',DEPTH) + win:=backdropwindow(screen) + depth,xsize,ysize:=getcloneinfo(screen) + + x:=256/COLOURS*2 + FOR i:=0 TO COLOURS-1 DO SetColour(screen,i,0,i*x,i*x) + + sr:=$400000/xsize -> shrink horiz + si:=$300000/ysize -> shrink vert + st:=$140000*-2 -> move side + zi:=$160000 -> move up + + FOR y:=ysize-1 TO 0 STEP -1 + IF CtrlC() THEN Raise("^C") + zi:=zi-si + zr:=st + FOR x:=0 TO xsize-1 + i:=0; ar:=zr; ai:=zi + REPEAT + dr:=Shr(ar,10); di:=Shr(ai,10) + ai:=dr*2*di+zi + dr:=dr*dr; di:=di*di + ar:=dr-di+zr + i++ + UNTIL (i>ITERDEPTH) OR (dr+di>$400000) + Plot(x,y,Mod(i,COLOURS)) + zr:=zr+sr + ENDFOR + ENDFOR + + EasyRequestArgs(NIL,[20,0,'Wake Up!','I''m finished!','Ok!'],0,NIL) + +EXCEPT DO + + closeclonescreen(screen,font,win) + + SELECT exception + CASE "SCR"; WriteF('no screen!\n') + CASE "WIN"; WriteF('no window!\n') + ENDSELECT + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/Kohonen.e b/amigae33a/E_v3.3a/Src/Src/Gfx/Kohonen.e new file mode 100644 index 0000000..4cbaf0d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/Kohonen.e @@ -0,0 +1,97 @@ +/* Kohonen Feature Maps in E, implemented with integers + +Kohonen feature maps are special types of neural nets, and +this implementation shows graphically how they organise themselves +after a while. Apologies for the primitive gfx display. + +*/ + +CONST ONE=1024*16, KSHIFT=14, KSIZE=7, MAXTIME=500, DELAY=0 +CONST KSTEP=ONE/KSIZE, KNODES=KSIZE+1, ARSIZE=KSIZE*KSIZE +CONST XRED=64, YRED=128, XOFF=10, YOFF=20 + +MODULE 'intuition/intuition', 'tools/exceptions' + +PROC main() HANDLE + DEF map,t,input,x,y,w=NIL + IF w:=OpenW(20,11,400,200,$200,$F,'Kohonen Feature Map Simulation',0,1,0) + map:=kohonen_init(KSIZE,KSIZE,2) + FOR t:=0 TO MAXTIME-1 + input:=[Rnd(KNODES)*KSTEP,Rnd(KNODES)*KSTEP] + x,y:=kohonen_BMU(map,input) + kohonen_plot(map,w,x,y) + kohonen_learn(map,x,y,MAXTIME-t*(ONE/MAXTIME),input) + ENDFOR + ELSE + Raise("WIN") + ENDIF + RefreshWindowFrame(w) + WaitIMessage(w) +EXCEPT DO + report_exception() + IF w THEN CloseW(w) +ENDPROC + +PROC kohonen_plot(map,wnd:PTR TO window,bx,by) + DEF x,y,n:PTR TO LONG,cx,cy,i,ii, + sx[ARSIZE]:ARRAY OF LONG,sy[ARSIZE]:ARRAY OF LONG + SetRast(wnd.rport,1) + FOR x:=0 TO KSIZE-1 + FOR y:=0 TO KSIZE-1 + n:=kohonen_node(map,x,y); i:=x*KSIZE+y; ii:=x-1*KSIZE+y + sx[i]:=cx:=s(n[0]/XRED+XOFF); sy[i]:=cy:=s(n[1]/YRED+YOFF) + IF x>0 THEN Line(sx[ii],sy[ii],cx,cy,2) + IF y>0 THEN Line(sx[i-1],sy[i-1],cx,cy,2) + ENDFOR + ENDFOR + n:=kohonen_node(map,bx,by) + Plot(s(n[0]/XRED+XOFF),s(n[1]/YRED+YOFF),2) + Delay(DELAY) +ENDPROC + +PROC s(c) IS IF c<0 THEN 0 ELSE IF c>1000 THEN 1000 ELSE c + +PROC kohonen_BMU(map,i:PTR TO LONG) + DEF x,y,act,bestx,besty,bestact=$FFFFFFF,n:PTR TO LONG,len,a + len:=ListLen(i)-1 + FOR x:=0 TO KSIZE-1 + FOR y:=0 TO KSIZE-1 + n:=kohonen_node(map,x,y) + act:=0 + FOR a:=0 TO len DO act:=Abs(n[a]-i[a])+act + IF act cityblock + IF d>0 + FOR a:=0 TO len DO n[a]:=n[a]+Shr(i[a]-n[a]*d,KSHIFT) + ENDIF + ENDFOR + ENDFOR +ENDPROC + +PROC kohonen_node(map:PTR TO LONG,x,y) + DEF r:PTR TO LONG + r:=map[x] +ENDPROC r[y] + +PROC kohonen_init(numx,numy,numw) + DEF m:PTR TO LONG,r:PTR TO LONG,w:PTR TO LONG,a,b,c + NEW m[numx] + FOR a:=0 TO numx-1 + m[a]:=NEW r[numy] + FOR b:=0 TO numy-1 + r[b]:=NEW w[numw] + FOR c:=0 TO numw-1 DO w[c]:=ONE/2 + ENDFOR + ENDFOR +ENDPROC m diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/Mandel.e b/amigae33a/E_v3.3a/Src/Src/Gfx/Mandel.e new file mode 100644 index 0000000..54e88fc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/Mandel.e @@ -0,0 +1,24 @@ +-> mini fractal + +CONST CALCW=200,HEIGHT=100, DEPTH=25 + +PROC main() + DEF w,xmax,ymax,x,y,xr,width=3.5,height=2.8,left,top + IF w:=OpenW(20,11,240,130,$200,$E,'MiniFrac!',NIL,1,NIL) + top:=!0.0-1.6; left:=!0.0-2.0; xmax:=CALCW!; ymax:=HEIGHT-1! + FOR x:=0 TO CALCW-1 + xr:=x!/xmax*width+left + FOR y:=0 TO HEIGHT-1 DO Plot(x+20,y+20,calc(xr,y!/ymax*height+top)) + ENDFOR + WaitIMessage(w) + CloseW(w) + ENDIF +ENDPROC + +PROC calc(x,y) + DEF xtemp,it=0,xc,yc + xc:=x; yc:=y + WHILE (it++1 + FOR a:=x1+1 TO x2-1 DO plotxy(a,y1) + IF HEIGHT-1=y2 THEN FOR a:=x1+1 TO x2-1 DO plotxy(a,y2) + ENDIF + IF y2-y1>1 + FOR a:=y1+1 TO y2-1 DO plotxy(x1,a) + IF WIDTH-1=x2 THEN FOR a:=y1+1 TO y2-1 DO plotxy(x2,a) + ENDIF + ELSE + xm:=x1+x2/2 + ym:=y1+y2/2 + recmandel(x1,y1,xm,ym) + recmandel(xm,y1,x2,ym) + recmandel(x1,ym,xm,y2) + recmandel(xm,ym,x2,y2) + ENDIF + ENDIF +ENDPROC + +PROC calcxy(x,y) + DEF xr,yr + xr:=x!/xmax*width+left + yr:=y!/ymax*height+top +ENDPROC calc(256/FAC,xr,yr)*FAC + +PROC plotxy(x,y) + Plot(x,y,calcxy(x,y)) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/MandelCalc881.m b/amigae33a/E_v3.3a/Src/Src/Gfx/MandelCalc881.m new file mode 100644 index 0000000..4881eb9 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Gfx/MandelCalc881.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/PPV.e b/amigae33a/E_v3.3a/Src/Src/Gfx/PPV.e new file mode 100644 index 0000000..1354dc8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/PPV.e @@ -0,0 +1,32 @@ +/* 256 greyscale preview of POVRAY files + + Quickly preview POV-ray's 24-bit output files on a 256 greyscale + AGA screen. No fancy implementation. + +*/ + +MODULE 'tools/file', 'tools/exceptions' + +PROC main() HANDLE + DEF scr=NIL,win=NIL,a,p,name,xs,ys,x,y + name:=IF arg[] THEN arg ELSE 'data.dis' + p:=readfile(name) + xs:=p[0]+(p[1]*256); ys:=p[2]+(p[3]*256); p:=p+4 + WriteF('POV-Ray Quick 256 Greyscale PreView, $#%!\n' + + 'file: "\s", (\dx\d) [mouse to quit]\n',name,xs,ys) + IF scr:=OpenS(xs,ys,8,$0,'') + IF win:=OpenW(0,0,xs,ys,$8,0,'',scr,15,0) + FOR a:=0 TO 255 DO SetColour(scr,a,a,a,a) + FOR y:=0 TO ys-1 + p:=p+2 + FOR x:=0 TO xs-1 DO Plot(x,y,p[x]+p[x+xs]+p[x+xs+xs]/3) + p:=xs*3+p + ENDFOR + WaitIMessage(win) + ENDIF + ENDIF +EXCEPT DO + CloseW(win) + CloseS(scr) + report_exception() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/RewriteGfx.e b/amigae33a/E_v3.3a/Src/Src/Gfx/RewriteGfx.e new file mode 100644 index 0000000..9bffbb9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/RewriteGfx.e @@ -0,0 +1,169 @@ +/* Using a (forth-featured) rewrite-grammar to plot + recursive (turtle) graphics + + a graphics plotting system that uses rewrite-grammars. the idea is + that the description of an image (much like some fractals i know) + is denoted in a grammar, which is then used to plot the gfx. + the system uses turtlegraphics for plotting, and some forth-heritage + for additional power. the program is not meant to actually "used"; + change to different graphics with the CONST in the sources, to + see what the grammars do. + + next to normal context-free grammars like S->ASA, + following (forth-lookalike) turtle commands may be used: + + up pen up + down pen down + set set absolute position + move move relative to last coordinates, distance + in direction , draw line if pen is down + degr set initial angle + rol rotate relative counter-clockwise (left) + rol rotate relative clockwise (right) + col set colour to plot with + push save x/y/angle/pen status at this point on stack + pop restore status + dup duplicate last item on stack + add add two integers + sub substract two integers (first-second) + mul multiply two integers + div divide two integers + eq see if two integers are equal + uneq see if two integers are unequal + if end conditional statement */ + +CONST CURGR=9 /* SET THIS ONE TO 0-11 TO GET A DIFFERENT GRAMMAR */ + +ENUM S=1000, A,B,C,D,E,F,G, Z +CONST R=20 + +DEF gr[20]:ARRAY OF LONG,win,stack[5000]:ARRAY OF LONG,sp=NIL:PTR TO LONG, + penf=TRUE,x=50.0,y=60.0,col=2,degr=0.0 + +/* don't build your own grammars if you don't know *exactly* what + you're doing. there are no error checks. */ + +PROC initgrammar() + + gr[0]:=[[S, A,A,A], /* lotsa triangles */ + [A, 25,"ror",D,D,D,D,D,D,"up",50,"move","down"], + [D, F,G,F,G,F,G,E], + [E, "up",R,"move",30,"rol",5,"move",30,"rol","down"], + [F, R,"move"], + [G, 120,"rol"]] + + gr[1]:=[[S, 100,20,"set",30,A], /* shell */ + [A, "dup","move",1,"sub","dup",0,"uneq","if",B,"end"], + [B, "dup","dup",90,"ror","move",180,"ror","up","move", + 90,"ror","down",20,"ror",A]] /* some figure */ + + gr[2]:=[[S, B,B,B,B,B,B,B,B,B,B,B,B,B,B,B], + [B, A,A,A,A,A,A,A,A,-10,"move"], + [A, "down",80,"move",183,"rol"]] + + + gr[4]:=[[S, 160,188,"set",90,"degr",30,A,1,"col",1,"move"], /* 45 tree */ + [A, "dup","dup","move","if","dup",115,"mul",150,"div","dup",45, + "rol",A,90,"ror",A,45,"rol","end",180,"rol","move",180,"rol"]] + + gr[5]:=[[S, 160,188,"set",90,"degr",60,A,1,"col",1,"move"], /* thin tree */ + [A, "dup","dup","move","if","dup",100,"mul",150,"div","dup",40, + "rol",A,69,"ror",196,"mul",191,"div",A,29,"rol","end",180, + "rol","move",180,"rol"]] + + gr[6]:=[[S, 160,188,"set",91,"degr",36,A,1,"col",1,"move"], /* slow tree */ + [A, "dup","dup","move","if","dup",120,"mul",150,"div","dup",20, + "rol",A,40,"ror",170,"mul",166,"div",A,20,"rol","end",180, + "rol","move",180,"rol"]] + + gr[7]:=[[S, 200,160,"set",90,"degr",30,A,1,"col",1,"move"],/* swirl tree */ + [A, "dup","dup","move","if","dup",135,"mul",150,"div","dup",29, + "rol",A,50,"ror",21,"mul",30,"div",A,21,"rol","end",180, + "rol","move",180,"rol"]] + + gr[8]:=[[S, 160,160,"set",90,"degr",36,A,1,"col",1,"move"], /* frond */ + [A, "dup","dup","move","if","dup",112,"mul",150,"div","dup",35, + "rol",A,120,"ror",A,85,"rol","end",180,"rol","move",180,"rol"]] + + gr[9]:=[[S, 160,188,"set",90,"degr",32,A,1,"col",1,"move"], /* nice tree */ + [A, "dup","dup","move","if","dup",85,"mul",150,"div","dup","dup", + 25,"rol",A,25,"ror",150,"mul",100,"div",A, + 25,"ror",A,25,"rol","end",180,"rol","move",180,"rol"]] + + gr[10]:=[[S, 160,188,"set",90,"degr",60,A,1,"col",1,"move"],/* sahara */ + [A, "dup","dup","move","if","dup",95,"mul",150,"div","dup",15, + "rol",A,30,"ror",A,15,"rol","end",180,"rol","move",180,"rol"]] + + gr[11]:=[[S, 134,188,"set",90,"degr",44,A, + 184,174,"set",94,"degr",36,A, + 158,191,"set",88,"degr",48,A, + 206,168,"set",90,"degr",14,A], /* sea oats */ + [A, "dup","dup","move","if","dup",60,"mul",150,"div","dup", + 114,"rol",A,2,"mul",100,"ror",A,14,"ror","end",180,"rol", + "move",180,"rol"]] + + +ENDPROC + +PROC main() + win:=OpenW(20,20,600,200,$200,$F,'Rewrite Graphics',NIL,1,NIL) + IF win=NIL + WriteF('Could not open window!\n') + ELSE + initgrammar() + sp:=stack+400 /* temp */ + dorewrite(S) + IF sp<>(stack+400) THEN WriteF('WARNING: stack not clean\n') + WaitIMessage(win) + CloseW(win) + ENDIF +ENDPROC + +PROC dorewrite(startsym) + DEF i:PTR TO LONG + ForAll({i},gr[CURGR],`IF i[0]=startsym THEN dolist(i) ELSE 0) +ENDPROC + +PROC dolist(list:PTR TO LONG) + DEF r=1,sym,rada,cosa,sina,xd,yd,xo,yo,a + WHILE rZ + SELECT sym + CASE "down"; penf:=TRUE + CASE "up"; penf:=FALSE + CASE "set"; y:=sp[]--!; x:=sp[]--! + CASE "col"; col:=sp[]-- + CASE "rol"; degr:=sp[]--!+degr + CASE "ror"; degr:=-sp[]--!+degr + CASE "degr"; degr:=sp[]--! + CASE "push"; sp[]++:=x; sp[]++:=y; sp[]++:=degr; sp[]++:=penf + CASE "pop"; sp[]--:=penf; sp[]--:=degr; sp[]--:=y; sp[]--:=x + CASE "dup"; a:=sp[]--; sp[]++:=a; sp[]++:=a + CASE "add"; sp[]++:=sp[]--+sp[]-- + CASE "sub"; a:=sp[]--; sp[]++:=sp[]---a + CASE "mul"; sp[]++:=sp[]--*sp[]-- + CASE "div"; a:=sp[]--; sp[]++:=sp[]--/a + CASE "eq"; sp[]++:=sp[]--=sp[]-- + CASE "uneq"; sp[]++:=sp[]--<>sp[]-- + CASE "end"; NOP + CASE "if"; IF sp[]--=FALSE THEN WHILE list[r++]<>"end" DO NOP + CASE "move" + xo:=x; yo:=y; x:=sp[]--!+x + rada:=!degr/180.0*3.14159 + cosa:=Fcos(rada); sina:=Fsin(rada) + xd:=!x-xo; yd:=!y-yo + x:=!xo+(!xd*cosa)-(!yd*sina) + y:=!yo+(!yd*cosa)-(!xd*sina) + IF penf THEN Line(!xo!*2,!yo!,!x!*2,!y!,col) + DEFAULT; WriteF('WARNING: unknown opcode\n') + ENDSELECT + ELSE + dorewrite(sym) + ENDIF + ENDIF + ENDWHILE +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/README b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/README new file mode 100644 index 0000000..560f15a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/README @@ -0,0 +1,46 @@ +texturemapping in E (and assembly :) +------------------------------------ + +This source code here is provided solely for educational +purposes, it is not solid enough code to base your project +on. I have a faster and more advanced version of this +engine available, but it is rather bulky and keeps +crashing. the version here is an older test version +which hopefully is more stable but is not guaranteed +to work on your machine either. + +Compile the example with "ec tmaptest" +Run the example on your favourite low res screenmode +(the program will present you with a requester). +The test program uses a builtin c2p routine optimized +for 030 and above AGA machines, and is unlikely to run +on graphic boards or other non standard screenmodes. + +assuming you get the program to run, you can use these keys +to influence the camera: + +n,m,d,c turn left,right,up,down resp. +v,b bank/tilt left,right resp. +s,x,a,z,w,e move down,up,forward,backward,right,left resp. +r,t lens zoom or wide angle +q quit + +About the engine: +The texturemapper is fully free-form, but not perspective +correct (use more polygons!), i.e. unlike Doom, more like +Descent. As you can see from the test it allows all six +degrees of freedom for the camera, and there are no restrictions +on the polygons either. + +The intersting bits to look at in the source code would +be in texturemapper.e. The 5 instructions between "inner:" +and "DBRA" is where the texturemapper spends 90% of its +time. + +The projection routine in geom.e implements a proper +fisheye projection (most engines use a flat approximation). + +Credits: +Mikael Kalms for his excellent CPU3BLIT1 c2p I used. +Jyrki O Saarinen for the tips he gave me on further + optimizing the inner texturemapping loop. diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/c2p_cpu3blit1.m b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/c2p_cpu3blit1.m new file mode 100644 index 0000000..39b509e Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/c2p_cpu3blit1.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/car64x64x8.iff.cmchunky b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/car64x64x8.iff.cmchunky new file mode 100644 index 0000000..2b46976 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/car64x64x8.iff.cmchunky differ diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/geom.e b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/geom.e new file mode 100644 index 0000000..d766801 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/geom.e @@ -0,0 +1,37 @@ +-> 3d geometry stuff + +OPT MODULE + +EXPORT OBJECT point + x,y,z +ENDOBJECT + +EXPORT OBJECT opoint OF point -> point with orientation e.g. a camera + turn,up,tilt +ENDOBJECT + +PROC sin(x,f) IS !Fsin(x!/1800.0*3.14159)*(f!)! -> replace by tables! +PROC cos(x,f) IS !Fcos(x!/1800.0*3.14159)*(f!)! +PROC atan(x,unit) IS !Fatan(x!/(unit!))/3.14159*1800.0! +PROC atanf(x,u) IS IF u>0 THEN atan(x,u) ELSE (IF u=0 THEN (IF x>0 THEN 900 ELSE -900) ELSE 1800-atan(x,-u)) + +EXPORT PROC project3d(camera:PTR TO opoint,p:PTR TO point,midx,midy,persp) + DEF x,y,z,t,old,sx,sy + x:=p.x-camera.x + y:=p.y-camera.y + z:=camera.z-p.z + IF t:=camera.turn*10 + x:=cos(t,old:=x)-sin(t,y) + y:=sin(t,old)+cos(t,y) + ENDIF + IF t:=camera.up*10 + z:=cos(t,old:=z)-sin(t,y) + y:=sin(t,old)+cos(t,y) + ENDIF + IF t:=camera.tilt*10 + x:=cos(t,old:=x)-sin(t,z) + z:=sin(t,old)+cos(t,z) + ENDIF + sx:=atanf(x,y)*(midx*2)/persp/10+midx + sy:=atanf(z,y)*(midy*2)/persp/10+midy +ENDPROC sx,sy diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/geom.m b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/geom.m new file mode 100644 index 0000000..c5d6891 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/geom.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/screenmodereq_db.e b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/screenmodereq_db.e new file mode 100644 index 0000000..84d6a1b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/screenmodereq_db.e @@ -0,0 +1,34 @@ +-> asl screenmode module for db + +OPT OSVERSION=38, MODULE +OPT EXPORT + +MODULE 'asl', 'libraries/asl', 'intuition/screens', 'tools/scrbuffer' + +PROC openreqscreen(xs,ys,depth,title) HANDLE + DEF fr:PTR TO screenmoderequester,scr:PTR TO screen + IF (aslbase:=OpenLibrary('asl.library',37))=NIL THEN Raise("ASL") + IF (fr:=AllocAslRequest(ASL_SCREENMODEREQUEST,NIL))=NIL THEN Raise("REQ") + IF AslRequest(fr, NIL) + IF (scr:=sb_OpenScreen( + [SA_WIDTH, xs, + SA_HEIGHT, ys, + SA_DEPTH, depth, + SA_TYPE, CUSTOMSCREEN, + SA_QUIET, TRUE, + SA_OVERSCAN, OSCAN_TEXT, + SA_AUTOSCROLL, TRUE, + SA_DISPLAYID, fr.displayid, + SA_TITLE, title, + NIL],0))=NIL THEN Raise("SCR") + RETURN scr + ENDIF +EXCEPT DO + IF fr THEN FreeAslRequest(fr) + IF aslbase THEN CloseLibrary(aslbase) + ReThrow() +ENDPROC NIL + +PROC closereqscreen(scr) + IF scr THEN sb_CloseScreen(scr) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/screenmodereq_db.m b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/screenmodereq_db.m new file mode 100644 index 0000000..a6b1e50 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/screenmodereq_db.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/texturemapper.e b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/texturemapper.e new file mode 100644 index 0000000..e0d58b5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/texturemapper.e @@ -0,0 +1,81 @@ +-> texturemapper + +OPT MODULE + +CONST FP=256,FPS=8,MAXROUND=2500 + +PROC scanline(x1,x2,tx1,tx2,ty1,ty2,thisy,cbuf,maxx,tmap) + DEF p,numpix,c:REG,stx:REG,sty:REG,cx:REG,cy,misx=0 + IF (x1>=maxx) OR (x2<0) THEN RETURN + numpix:=x2-x1+1 + IF x1<0 THEN (misx:=0-x1) BUT x1:=0 + IF x2>=maxx THEN x2:=maxx-1 + p:=thisy*maxx+x1+cbuf + ->IF numpix=0 THEN Raise("nump") + stx:=tx2-tx1*FP/numpix + sty:=ty2-ty1*FP/numpix + cx:=tx1*FP+(misx*stx) + cy:=ty1*FP+(misx*sty) + c:=x2-x1 + MOVE.L p,A0 + MOVE.L tmap,A1 + ROR.W #8,cx + ROR.W #8,stx + SUB.B stx,cx + ADD.W stx,cx + MOVE.L cy,A2 -> A2 is copy of cy +inner: + MOVE.L A2,D0 -> p[]++:=tmap[(cy/FP)*tmaxx+(cx/FP)] + ADD.L sty,A2 -> cy:=cy+sty + MOVE.B cx,D0 -> assumes FPS and tmaxx are 256 + ADDX.W stx,cx -> cx:=cx+stx + MOVE.B 0(A1,D0.L),(A0)+ + DBRA c,inner +ENDPROC + +EXPORT PROC tmap(coords:PTR TO LONG,cbuf,maxx,maxy,tmap,tmaxx=256,tmaxy=256) + DEF rx[MAXROUND]:ARRAY OF LONG,ry[MAXROUND]:ARRAY OF LONG,trx[MAXROUND]:ARRAY OF LONG, + try[MAXROUND]:ARRAY OF LONG,curr=0,a,b,dist,q, + x1,y1,x2,y2,tmx,tmy,f,stx,sty,outm1,outm2,outmi1=10000,outmi2=-10000,sides=0 + FOR a:=0 TO 6 STEP 2 -> for all 4 sides of the square + y1:=coords[a+1] + y2:=coords[a+3 AND 7] + IF dist:=Abs(y1-y2) + sides++ + x1:=coords[a] + x2:=coords[a+2 AND 7] + IF Abs(x1-x2)+dist>2000 THEN RETURN -> temp check + tmx:=IF a AND 2 THEN 0 ELSE tmaxx + tmy:=IF a AND 2 THEN tmaxy ELSE 0 + f:=IF a>=4 THEN -1 ELSE 1 + stx:=IF a+2 AND 4 THEN tmaxx ELSE 0 + sty:=IF a>=4 THEN tmaxy ELSE 0 + ->IF dist=0 THEN Raise("dist") + FOR q:=1 TO dist -> for each y pixel of a side + rx[curr]:=x2-x1*q/dist+x1 + ry[curr]:=y1+(q*Sign(y2-y1)) + trx[curr]:=stx+(q*tmx/dist*f) + try[curr]:=sty+(q*tmy/dist*f) + curr++ + ENDFOR + IF y2outm2 THEN (outm2:=y2) BUT outmi2:=curr-1 + ENDIF + ENDFOR + IF sides<1 THEN RETURN + IF outmi1>outmi2 + a:=outmi2 + outmi2:=outmi1 + outmi1:=a + ENDIF + FOR a:=outmi1 TO outmi2 -> for each scanline found + b:=IF a-outmi1<=outmi1 THEN outmi1-(a-outmi1) ELSE outmi2-(a-outmi2) + IF (ry[a]>=0) AND (ry[a]rx[a] + scanline(rx[a],rx[b],trx[a],trx[b],try[a],try[b],ry[a],cbuf,maxx,tmap) + ELSE + scanline(rx[b],rx[a],trx[b],trx[a],try[b],try[a],ry[a],cbuf,maxx,tmap) + ENDIF + ENDIF + ENDFOR +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/texturemapper.m b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/texturemapper.m new file mode 100644 index 0000000..e6a2a32 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/texturemapper.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/tmaptest.e b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/tmaptest.e new file mode 100644 index 0000000..d3dd2d6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/TextureMapping/tmaptest.e @@ -0,0 +1,121 @@ +-> tmap experiment + +OPT OSVERSION=39, LARGE, PREPROCESS + +CONST CWIDTH=320 -> in units of 64 seems best... +CONST CHEIGHT=240,SCOFF=8 +CONST SCHEIGHT=SCOFF*2+CHEIGHT,SCDEPTH=8 +CONST BUFS=CWIDTH*CHEIGHT + +MODULE '*geom', '*c2p_cpu3blit1', '*texturemapper', '*screenmodereq_db', + 'tools/exceptions', 'tools/scrbuffer', + 'intuition/screens', 'intuition/intuition', + 'graphics/rastport', 'graphics/gfx' + +PROC addc(p:PTR TO point,c,l,fishy) + DEF a,b + a,b:=project3d(c,p,CWIDTH/2,CHEIGHT/2,fishy) + ListAdd(l,[a,b]) +ENDPROC + +PROC render(cbuf,c:PTR TO opoint,fishy,pic) + DEF l[8]:LIST + clearmem(cbuf,CWIDTH*CHEIGHT,-1) + addc([100,100,0]:point,c,l,fishy) + addc([-100,100,0]:point,c,l,fishy) + addc([-100,-100,0]:point,c,l,fishy) + addc([100,-100,0]:point,c,l,fishy) + tmap(l,cbuf,CWIDTH,CHEIGHT,pic,64,64) + SetList(l,0) + addc([-100,-100,0]:point,c,l,fishy) + addc([100,-100,0]:point,c,l,fishy) + addc([100,-100,-200]:point,c,l,fishy) + addc([-100,-100,-200]:point,c,l,fishy) + tmap(l,cbuf,CWIDTH,CHEIGHT,pic,64,64) + SetList(l,0) + addc([100,-100,0]:point,c,l,fishy) + addc([100,100,0]:point,c,l,fishy) + addc([100,100,-200]:point,c,l,fishy) + addc([100,-100,-200]:point,c,l,fishy) + tmap(l,cbuf,CWIDTH,CHEIGHT,pic,64,64) +ENDPROC + +tmaplab: INCBIN 'car64x64x8.iff.cmchunky' + +PROC clearmem(mem,size,pat) + DEF e:REG,a:REG,b:REG,c:REG,d:REG + e:=size/16-1 + a:=b:=c:=d:=pat + MOVE.L mem,A0 + ADD.L size,A0 +clloop: + MOVEM.L a/b/c/d,-(A0) + DBRA e,clloop +ENDPROC + +PROC main() HANDLE + DEF dbs,scr=NIL:PTR TO screen,bm:PTR TO bitmap,win=NIL:PTR TO window,cam:PTR TO opoint, + cbuf,imsg:PTR TO intuimessage,key,frames=0,dframes,fsec,ssec,smic,esec,emic,fishy=60, + a,pic,tpic[17000]:ARRAY OF CHAR + cam:=[200,-200,150,-45,45,10]:opoint + pic:={tmaplab} + IF (dbs:=openreqscreen(CWIDTH,SCHEIGHT,SCDEPTH,'bla'))=NIL THEN Raise() -> OpenScreen + scr:=sb_GetScreen(dbs) + IF (win:=OpenW(0,0,CWIDTH-1,SCHEIGHT-1, + IDCMP_MOUSEBUTTONS OR IDCMP_VANILLAKEY, + WFLG_BORDERLESS OR WFLG_SIMPLE_REFRESH OR WFLG_BACKDROP OR WFLG_ACTIVATE OR WFLG_RMBTRAP, + '',scr,15,NIL))=NIL THEN Raise("WIN") + NEW cbuf[BUFS] + FOR a:=0 TO 255 DO SetColour(scr,a,pic[]++,pic[]++,pic[]++) + FOR a:=0 TO 64 DO CopyMem(a*64+pic,a*256+tpic,64) + SetRast(scr.rastport,255) + bm:=sb_NextBuffer(dbs) + SetRast(scr.rastport,255) + c2p_setup(gfxbase,CWIDTH,CHEIGHT,SCOFF,0 /* dummy */,NewM(CWIDTH*CHEIGHT,2)) + CurrentTime({ssec},{smic}) + REPEAT + render(cbuf,cam,fishy,tpic) + Colour(0,255) + ->TextF(0,SCHEIGHT-5,'x=\d y=\d z=\d turn=\d up=\d tilt=\d, wide=\d',cam.x,cam.y,cam.z,cam.turn,cam.up,cam.tilt,fishy) + bm:=sb_NextBuffer(dbs) + c2p(cbuf,bm.planes) + frames++ + IF imsg:=GetMsg(win.userport) + IF imsg.class=IDCMP_VANILLAKEY + key:=imsg.code + SELECT key + CASE "n"; cam.turn:=cam.turn+10 -> turnleft + CASE "m"; cam.turn:=cam.turn-10 -> turnright + CASE "d"; cam.up:=cam.up-10 -> lookdown + CASE "c"; cam.up:=cam.up+10 -> lookup + CASE "v"; cam.tilt:=cam.tilt-10 -> bankleft + CASE "b"; cam.tilt:=cam.tilt+10 -> bankright + CASE "s"; cam.z:=cam.z+10 -> down + CASE "x"; cam.z:=cam.z-10 -> up + CASE "a"; cam.y:=cam.y+10 -> yforward + CASE "z"; cam.y:=cam.y-10 -> ybackward + CASE "w"; cam.x:=cam.x+10 -> xright + CASE "e"; cam.x:=cam.x-10 -> xleft + CASE "r"; fishy:=fishy+10 -> zoom + CASE "t"; IF fishy>15 THEN fishy:=fishy-10 -> wide angle + -> "q" quits + ENDSELECT + ELSEIF imsg.class=IDCMP_MOUSEBUTTONS + ENDIF + ReplyMsg(imsg) + ENDIF + UNTIL key="q" + CurrentTime({esec},{emic}) + dframes:=Mul(esec-ssec,100)+Div(emic-smic,10000) + fsec:=Div(Mul(frames,10000),dframes) + IF frames THEN WriteF('calculated \d frames in \d.\z\d[2] seconds, giving \d.\z\d[2] f/s\n',frames,Div(dframes,100),Mod(dframes,100),Div(fsec,100),Mod(fsec,100)) +EXCEPT DO + IF win THEN CloseWindow(win) + closereqscreen(dbs) + SELECT exception + CASE "SCR"; WriteF('no screen!\n') + CASE "REQ"; WriteF('Error: Could not allocate ASL request\n') + CASE "ASL"; WriteF('Error: Could not open ASL library\n') + ENDSELECT + report_exception() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/Trace.e b/amigae33a/E_v3.3a/Src/Src/Gfx/Trace.e new file mode 100644 index 0000000..555e00a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/Trace.e @@ -0,0 +1,65 @@ +/* This does something that looks like raytracing. + does absolutely nothing fancy. vary the positions of + the ball objects below to see the effect */ + +OBJECT ball + next,type,x,y,z,r,col +ENDOBJECT + +CONST S=100,T_BALL=1,SP=1,MI=$7FFFFFF0 + +DEF first:PTR TO ball,scr=NIL,last,next + +PROC main() + scr:=OpenS(320,256,4,0,'Tracing...') + IF scr + last:=[NIL,T_BALL,6500,5500,5000,500,3]:ball + next:=[last,T_BALL,5000,5500,6000,1500,4]:ball + first:=[next,T_BALL,4000,5500,5000,1000,1]:ball + traceall() + WHILE Mouse()<>1 DO NOP + leave(NIL) + ELSE + leave('Could not open screen!') + ENDIF +ENDPROC + +PROC traceall() + DEF x,y + FOR x:=1000 TO 9000 + FOR y:=1000 TO 9000 + Plot(x/S+20*SP,y/S+20*SP,tracepixel(5000,5000,1000,x,y,9000)) + y:=y+S + IF Mouse()=1 THEN RETURN + ENDFOR + x:=x+S + ENDFOR +ENDPROC + +PROC tracepixel(x,y,z,x2,y2,z2) /* traces beam, returns rgb */ + DEF fx,fy,f,bx,by,dx,dy,obj:PTR TO ball,o,fbest=MI + obj:=first; o:=first + REPEAT + f:=(obj.z-z*256)/(z2-z) + fx:=x2-x*f/256 /* get factor */ + fy:=y2-y*f/256 + bx:=obj.x-fx /* new scaled ball position */ + by:=obj.y-fy + dx:=bx-x /* distance ball <--> line */ + dy:=by-y + IF (fMI THEN obj.col ELSE 2 + +PROC leave(erstr) + IF scr THEN CloseS(scr) + IF erstr THEN WriteF('\s\n',erstr) + CleanUp(0) +ENDPROC + +PROC sqrt(x) IS !Fsqrt(x!)! diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/nice.e b/amigae33a/E_v3.3a/Src/Src/Gfx/nice.e new file mode 100644 index 0000000..3598883 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/nice.e @@ -0,0 +1,196 @@ +/* Evolutionary "nice" pictures. + + breed bitmaps. A fitness function will assign numbers according to + all sorts of perception criteria. mutation, the usual. + +possible "niceness" criteria: +- amount of surrounding pixels having a similar color -> smoothness +- amount of different colors used in total -> diversity +- longer stretching lines (hard to detect) +- symmetry / repetition / parallelism +- find longest path (fill-alg) + +*/ + +OPT OSVERSION=37, PREPROCESS, REG=5 + +-> fixed parameters + +DEF bmx=10,bmy=30, -> bitmap size + bmnum=3, -> #of bitmaps to breed at once + evrate=2, -> kill/birth rate of evolution. number of mutations each time + numrate=100 -> how many to rate + +#define MIRROR + +DEF bmt, -> total bytes per bitmap + hinum=0, -> best sofar + bmp=NIL:PTR TO LONG, + bmscore=NIL:PTR TO LONG, + bmcalc=NIL:PTR TO CHAR + +MODULE 'tools/easygui', 'tools/exceptions', 'tools/clonescreen', + 'intuition/screens' + +DEF scr=NIL:PTR TO screen,font + +DEF fmt,keepshowing=TRUE,iterations + +PROC main() HANDLE + DEF r + fmt:='%2ld' + LOOP + r:=easygui('Nice Pix', + [EQROWS, + [SLIDE,{setbmx},'bitmap x size: ',FALSE,3,99,bmx,10,fmt], + [SLIDE,{setbmy},'bitmap y size: ',FALSE,3,99,bmy,10,fmt], + [SLIDE,{setbmn},'#of bitmaps: ',FALSE,2,99,bmnum,10,fmt], + [SLIDE,{setevr},'kill/birth: ',FALSE,1,99,evrate,10,fmt], + [SLIDE,{setmut},'mutations: ',FALSE,1,99,nummut,10,fmt], + [SLIDE,{setrat},'rating: ',FALSE,1,999,numrate,10,fmt], + [BAR], + [COLS,[BUTTON,1,'Start'],[SPACEH],[BUTTON,0,'Cancel']] + ] + ) + evrate:=Bounds(evrate,1,bmnum-1) + IF r=0 THEN Raise() + actionreq() + ENDLOOP +EXCEPT + IF scr THEN closeclonescreen(scr,font) + report_exception() +ENDPROC + +PROC setbmx(i,n) IS bmx:=n +PROC setbmy(i,n) IS bmy:=n +PROC setbmn(i,n) IS bmnum:=n +PROC setevr(i,n) IS evrate:=n +PROC setmut(i,n) IS nummut:=n +PROC setrat(i,n) IS numrate:=n + +PROC actionreq() HANDLE + DEF gh=NIL:PTR TO guihandle,res=-1,count=0,a + gh:=guiinit('Nice Pix Action: BUSY', + [EQROWS, + [CHECK,{togglekeep},'keep showing picture:',keepshowing,TRUE], + [SLIDE,{setw1},'weight: ',FALSE,0,99,50,10,fmt], + [BAR], + [COLS,[BUTTON,{showpic},'Show Picture'],[SPACEH],[BUTTON,0,'Stop']] + ] + ) + setupsim() + IF scr THEN SetRast(scr.rastport,0) + WHILE res<0 + ->Wait(gh.sig) + res:=guimessage(gh) + FOR a:=1 TO 3 DO dosim() + IF keepshowing THEN IF count++ AND $F = 0 THEN showpic(0) + ENDWHILE +EXCEPT DO + deallocsim() + cleangui(gh) + IF exception THEN ReThrow() +ENDPROC res + +PROC setw1(i,n) IS n +PROC togglekeep(i,n) IS keepshowing:=n + +CONST XO=40,YO=40,XZ=2,YZ=2,COL=16,DEPTH=4 +CONST XO1=XO+XZ-1,YO1=YO+YZ-1,XZ2=XZ*2,YZ2=YZ*2 + +PROC showpic(i) + DEF x,y,bm + bm:=bmp[hinum] + IF scr=NIL + scr,font:=openclonescreen('Workbench','Nice!',DEPTH) + ENDIF + SetStdRast(scr.rastport) + Colour(2,0) + TextF(XO,YO-10,'hi = \d, it = \d ',bmscore[hinum],iterations) + FOR y:=YZ TO bmy*YZ STEP YZ + FOR x:=XZ TO bmx*XZ STEP XZ + #ifdef MIRROR + Box(bmx*XZ2-x+XO,y+YO,bmx*XZ2-x+XO1,y+YO1,bm[]) + Box(bmx*XZ2-x+XO,bmy*YZ2-y+YO,bmx*XZ2-x+XO1,bmy*YZ2-y+YO1,bm[]) + Box(x+XO,bmy*YZ2-y+YO,x+XO1,bmy*YZ2-y+YO1,bm[]) + #endif + Box(x+XO,y+YO,x+XO1,y+YO1,bm[]++) + ENDFOR + ENDFOR +ENDPROC + +PROC setupsim() + DEF a,bm,b + bmt:=bmx*bmy + hinum:=0 + iterations:=0 + NEW bmp[bmnum] + NEW bmcalc[bmnum] + NEW bmscore[bmnum] + FOR a:=0 TO bmnum-1 + bmp[a]:=bm:=FastNew(bmt) + FOR b:=0 TO bmt-1 DO bm[]++:=Rnd(COL) + ENDFOR +ENDPROC + +PROC deallocsim() + DEF a + IF bmp THEN FOR a:=0 TO bmnum-1 DO IF bmp[a] THEN FastDispose(bmp[a],bmt) + END bmp[bmnum] + END bmcalc[bmnum] + END bmscore[bmnum] +ENDPROC + +CONST MINSTART=$7FFFFFFF + +PROC dosim() + DEF a,b,min,minnum + iterations++ + FOR a:=0 TO bmnum-1 -> make sure all are rated + IF bmcalc[a]=FALSE + mutate(bmp[a]) + bmscore[a]:=rate(bmp[a]) -> mutate and rerate if necessary + IF bmscore[a]>bmscore[hinum] THEN hinum:=a -> keep track of best + bmcalc[a]:=TRUE + ENDIF + ENDFOR + FOR a:=1 TO evrate -> pick n victims + min:=MINSTART + FOR b:=0 TO bmnum-1 + IF (bmcalc[b]) AND b<>hinum + IF bmscore[b] calc worst + min:=bmscore[b] + minnum:=b + ENDIF + ENDIF + ENDFOR + IF min=MINSTART THEN Raise("prob") + bmcalc[minnum]:=FALSE + CopyMem(bmp[hinum],bmp[minnum],bmt) -> copy from best + ENDFOR +ENDPROC + +PROC mutate(bm) + DEF a + FOR a:=1 TO nummut DO bm[Rnd(bmt)]:=Rnd(COL) +ENDPROC + +PROC rate(bma) -> B: mixed environ + DEF a,c=0,tc,nc,bm + bm:=bma + FOR a:=0 TO bmt-1 + tc:=bm[] + nc:=0 + IF bm[-1]=tc THEN nc++ + IF bm[1]=tc THEN nc++ + IF bm[bmx]=tc THEN nc++ + IF bm[bmx-1]=tc THEN nc++ + IF bm[bmx+1]=tc THEN nc++ + IF bm[-bmx]=tc THEN nc++ + IF bm[-bmx-1]=tc THEN nc++ + IF bm[-bmx+1]=tc THEN nc++ + c:=c+(6-Abs(nc-2)) + bm++ + ENDFOR +ENDPROC c diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/paint.e b/amigae33a/E_v3.3a/Src/Src/Gfx/paint.e new file mode 100644 index 0000000..df63105 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/paint.e @@ -0,0 +1,23 @@ +/* example of using built-in font for images. 'paint.m' converted + from font-file with font2obj (aminet?) and o2m +*/ + +OPT OSVERSION=37 + +MODULE 'tools/clonescreen', '*paint', 'libraries/diskfont' + +PROC main() HANDLE + DEF screen=NIL,font=NIL,win=NIL,tf:PTR TO diskfontheader + tf:={paintf}; tf:=tf.tf + screen,font:=openclonescreen('Workbench','bla') + win:=backdropwindow(screen) + SetFont(stdrast:=screen+84,tf) + TextF(200,40,'A B C D E F G H ') + EasyRequestArgs(win,[20,0,'um','uhhh','zure'],0,NIL) +EXCEPT DO + closeclonescreen(screen,font,win) + SELECT exception + CASE "SCR"; WriteF('no screen!\n') + CASE "WIN"; WriteF('no window!\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/paint.m b/amigae33a/E_v3.3a/Src/Src/Gfx/paint.m new file mode 100644 index 0000000..d05ed2e Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Gfx/paint.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Gfx/sim_flock.e b/amigae33a/E_v3.3a/Src/Src/Gfx/sim_flock.e new file mode 100644 index 0000000..0e422b3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Gfx/sim_flock.e @@ -0,0 +1,112 @@ +-> silly little simulation + +OPT REG=5 + +MODULE 'intuition/intuition', 'exec/nodes', 'exec/lists', 'tools/constructors' + +OBJECT creature OF mln + x,y + loc:PTR TO LONG +ENDOBJECT + +DEF creatures=NIL:PTR TO LONG,creaturelist=NIL:PTR TO mlh,num_creatures=100 + +CONST SPACE_XS=64, + SPACE_YS=64, + SPACE_X=13, + SPACE_Y=28, + XBL=2, + YBL=2, + AND_X=$3f, + AND_Y=$3f + +CONST XSI=XBL*SPACE_XS, + YSI=YBL*SPACE_YS + +PROC main() HANDLE + DEF w=NIL:PTR TO window,m:PTR TO intuimessage,c=0,a,cc=0 + IF (a:=Val(arg))>1 THEN num_creatures:=a + IF w:=OpenW(20,20,XSI+42,YSI+42,IDCMP_CLOSEWINDOW OR IDCMP_MOUSEBUTTONS,$F, + arg,->'BacteriaMania', + NIL,1,NIL) + Box(SPACE_X-1,SPACE_Y-1,SPACE_XS*XBL+1+SPACE_X,SPACE_YS*YBL+1+SPACE_Y,1) + Box(SPACE_X,SPACE_Y,SPACE_XS*XBL+SPACE_X,SPACE_YS*YBL+SPACE_Y,0) + FOR a:=1 TO num_creatures DO new_creature() + REPEAT + move_creatures() + WHILE m:=GetMsg(w.userport) + IF (c:=m.class)=IDCMP_MOUSEBUTTONS + ENDIF + ENDWHILE + UNTIL c=IDCMP_CLOSEWINDOW + ENDIF +EXCEPT DO + CloseW(w) +ENDPROC + +PROC move_creatures() + DEF cr:PTR TO creature,d:PTR TO LONG,x,y,a,b,c,e,aa,bb,nbl=NIL:PTR TO LONG,nb:PTR TO creature,numnb + cr:=creaturelist.head + WHILE cr.succ + a:=0 -> check were to move + numnb:=0 + c:=-1 + FOR a:=-1 TO 1 + FOR b:=-1 TO 1 + aa:=a+cr.x; bb:=b+cr.y + d:=addrxy(aa,bb) + IF (d[]=NIL) AND (d[]<>cr) + IF (e:=countcrowd(aa,bb))>=c + ->IF (e:=countcrowd(d))>=c + IF IF e=c THEN Rnd(3)=0 ELSE TRUE + c:=e; x:=aa; y:=bb + ENDIF + ENDIF + ENDIF + ENDFOR + ENDFOR + d:=IF c>=0 THEN addrxy(x,y) ELSE 1 + IF d[]=NIL -> if possible, move + d[]:=cr + cr.loc[]:=NIL + cr.loc:=d + plotxy(x,y,2) + plotxy(cr.x,cr.y,0) + cr.x:=x + cr.y:=y + ENDIF + cr:=cr.succ + ENDWHILE +ENDPROC + +PROC countcrowd(x,y) + DEF n=0,a,b,d:PTR TO LONG + FOR a:=-1 TO 1 DO FOR b:=-1 TO 1 DO IF (d:=addrxy(x+a,y+b)) BUT d[] THEN n++ +ENDPROC n + +PROC new_creature() + DEF d:PTR TO LONG,a,x,y,cr:PTR TO creature + IF creatures=NIL + NEW creatures[SPACE_YS] + FOR a:=0 TO SPACE_YS-1 DO creatures[a]:=NEW d[SPACE_XS] + creaturelist:=newlist() + ENDIF + REPEAT + d:=addrxy(x:=Rnd(SPACE_XS),y:=Rnd(SPACE_YS)) + UNTIL d[]=NIL + d[]:=NEW cr + AddHead(creaturelist,cr) + cr.loc:=d + cr.x:=x + cr.y:=y + plotxy(x,y,3) +ENDPROC + +PROC addrxy(x,y) IS x AND AND_X*SIZEOF LONG+creatures[y AND AND_Y] + +PROC plotxy(x,y,c) + DEF xx,yy + xx:=x AND AND_X*XBL+SPACE_X + yy:=y AND AND_Y*YBL+SPACE_Y + IF XBL+YBL=2 THEN Plot(xx,yy,c) ELSE Box(xx,yy,XBL-1+xx,YBL-1+yy,c) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/address.e b/amigae33a/E_v3.3a/Src/Src/Guide/address.e new file mode 100644 index 0000000..a421d4b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/address.e @@ -0,0 +1,13 @@ +DEF x + +PROC main() + fred(2) +ENDPROC + +PROC fred(y) + DEF z + WriteF('x is at address \d\n', {x}) + WriteF('y is at address \d\n', {y}) + WriteF('z is at address \d\n', {z}) + WriteF('fred is at address \d\n', {fred}) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/args.e b/amigae33a/E_v3.3a/Src/Src/Guide/args.e new file mode 100644 index 0000000..d7eb4e0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/args.e @@ -0,0 +1,28 @@ +MODULE 'workbench/startup' + +PROC main() + DEF startup:PTR TO wbstartup, args:PTR TO wbarg, i, oldlock, len + IF (startup:=wbmessage)=NIL + WriteF('Started from Shell/CLI\n Arguments: "\s"\n', arg) + ELSE + WriteF('Started from Workbench\n') + args:=startup.arglist + FOR i:=1 TO startup.numargs /* Loop through the arguments */ + IF args[].lock=NIL + WriteF(' Argument \d: "\s" (no lock)\n', i, args[].name) + ELSE + oldlock:=CurrentDir(args[].lock) + len:=FileLength(args[].name) /* Do something with file */ + IF len=-1 + WriteF(' Argument \d: "\s" (file does not exist)\n', + i, args[].name) + ELSE + WriteF(' Argument \d: "\s", file length is \d bytes\n', + i, args[].name, len) + ENDIF + CurrentDir(oldlock) /* Important: restore current dir */ + ENDIF + args++ + ENDFOR + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/args.info b/amigae33a/E_v3.3a/Src/Src/Guide/args.info new file mode 100644 index 0000000..3d83a9b Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Guide/args.info differ diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/args20.e b/amigae33a/E_v3.3a/Src/Src/Guide/args20.e new file mode 100644 index 0000000..d431201 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/args20.e @@ -0,0 +1,20 @@ +OPT OSVERSION=37 + +PROC main() + DEF templ, rdargs, args=NIL:PTR TO LONG, i + IF wbmessage=NIL + WriteF('Started from Shell/CLI\n') + templ:='FILE/M' + rdargs:=ReadArgs(templ,{args},NIL) + IF rdargs + IF args + i:=0 + WHILE args[i] /* Loop through arguments */ + WriteF(' Argument \d: "\s"\n', i, args[i]) + i++ + ENDWHILE + ENDIF + FreeArgs(rdargs) + ENDIF + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/bintree.e b/amigae33a/E_v3.3a/Src/Src/Guide/bintree.e new file mode 100644 index 0000000..c63222e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/bintree.e @@ -0,0 +1,48 @@ +OBJECT tree + data + left:PTR TO tree, right:PTR TO tree +ENDOBJECT + +PROC new_set(int) + DEF root:PTR TO tree + NEW root + root.data:=int +ENDPROC root + +PROC add(i, set:PTR TO tree) + IF set=NIL + RETURN new_set(i) + ELSE + IF iset.data + set.right:=add(i, set.right) + ENDIF + RETURN set + ENDIF +ENDPROC + +PROC show(set:PTR TO tree) + IF set<>NIL + show(set.left) + WriteF('\d ', set.data) + show(set.right) + ENDIF +ENDPROC + +PROC main() HANDLE + DEF s, i, j + Rnd(-999999) /* Initialise seed */ + s:=new_set(10) /* Initialise set s to contain the number 10 */ + WriteF('Input:\n') + FOR i:=1 TO 50 /* Generate 50 random numbers and add them to set s */ + j:=Rnd(100) + add(j, s) + WriteF('\d ',j) + ENDFOR + WriteF('\nOutput:\n') + show(s) /* Show the contents of the (sorted) set s */ + WriteF('\n') +EXCEPT + IF exception="NEW" THEN WriteF('Ran out of memory\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/csv-buff.e b/amigae33a/E_v3.3a/Src/Src/Guide/csv-buff.e new file mode 100644 index 0000000..4e1eac1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/csv-buff.e @@ -0,0 +1,68 @@ +PROC main() + DEF buffer, filehandle, len, filename + filename:='datafile' + /* Get the length of data in the file */ + IF 0<(len:=FileLength(filename)) + /* Allocate just enough room for the data + a terminating NIL */ + IF buffer:=New(len+1) + IF filehandle:=Open(filename, OLDFILE) + /* Read whole file, checking amount read */ + IF len=Read(filehandle, buffer, len) + /* Terminate buffer with a NIL just in case... */ + buffer[len]:=NIL + process_buffer(buffer, len) + ELSE + WriteF('Error: File reading error\n') + ENDIF + /* If Open() succeeded then we must Close() the file */ + Close(filehandle) + ELSE + WriteF('Error: Failed to open "\s"\n', filename) + ENDIF + /* Deallocate buffer (not really necessary in this example) */ + Dispose(buffer) + ELSE + WriteF('Error: Insufficient memory to load file\n') + ENDIF + ELSE + WriteF('Error: "\s" is an empty file\n', filename) + ENDIF +ENDPROC + +/* buffer is like a normal string since it's NIL-terminated */ +PROC process_buffer(buffer, len) + DEF start=0, end + REPEAT + /* Find the index of a linefeed after the start index */ + end:=InStr(buffer, '\n', start) + /* If a linefeed was found then terminate with a NIL */ + IF end<>-1 THEN buffer[end]:=NIL + process_record(buffer+start) + start:=end+1 + /* We've finished if at the end or no more linefeeds */ + UNTIL (start>=len) OR (end=-1) +ENDPROC + +PROC process_record(line) + DEF i=1, start=0, end, s + /* Show the whole line being processed */ + WriteF('Processing record: "\s"\n', line) + REPEAT + /* Find the index of a comma after the start index */ + end:=InStr(line, ',', start) + /* If a comma was found then terminate with a NIL */ + IF end<>-1 THEN line[end]:=NIL + /* Point to the start of the field */ + s:=line+start + IF s[] + /* At this point we could do something useful... */ + WriteF('\t\d) "\s"\n', i, s) + ELSE + WriteF('\t\d) Empty Field\n', i) + ENDIF + /* The new start is after the end we found */ + start:=end+1 + INC i + /* Once a comma is not found we've finished */ + UNTIL end=-1 +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/csv-estr.e b/amigae33a/E_v3.3a/Src/Src/Guide/csv-estr.e new file mode 100644 index 0000000..fa534f1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/csv-estr.e @@ -0,0 +1,50 @@ +/* A suitably large size for the record buffer */ +CONST BUFFERSIZE=512 + +PROC main() + DEF filehandle, status, buffer[BUFFERSIZE]:STRING, filename + filename:='datafile' + IF filehandle:=Open(filename, OLDFILE) + REPEAT + status:=ReadStr(filehandle, buffer) + /* This is the way to check ReadStr() actually read something */ + IF buffer[] OR (status<>-1) THEN process_record(buffer) + UNTIL status=-1 + /* If Open() succeeded then we must Close() the file */ + Close(filehandle) + ELSE + WriteF('Error: Failed to open "\s"\n', filename) + ENDIF +ENDPROC + +PROC process_record(line) + DEF i=1, start=0, end, len, s + /* Show the whole line being processed */ + WriteF('Processing record: "\s"\n', line) + REPEAT + /* Find the index of a comma after the start index */ + end:=InStr(line, ',', start) + /* Length is end index minus start index */ + len:=(IF end<>-1 THEN end ELSE EstrLen(line))-start + IF len>0 + /* Allocate an E-string of the correct length */ + IF s:=String(len) + /* Copy the portion of the line to the E-string s */ + MidStr(s, line, start, len) + /* At this point we could do something useful... */ + WriteF('\t\d) "\s"\n', i, s) + /* We've finished with the E-string so deallocate it */ + DisposeLink(s) + ELSE + /* It's a non-fatal error if the String() call fails */ + WriteF('\t\d) Memory exhausted! (len=\d)\n', len) + ENDIF + ELSE + WriteF('\t\d) Empty Field\n', i) + ENDIF + /* The new start is after the end we found */ + start:=end+1 + INC i + /* Once a comma is not found we've finished */ + UNTIL end=-1 +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/csv-norm.e b/amigae33a/E_v3.3a/Src/Src/Guide/csv-norm.e new file mode 100644 index 0000000..717fbdc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/csv-norm.e @@ -0,0 +1,42 @@ +/* A suitably large size for the record buffer */ +CONST BUFFERSIZE=512 + +PROC main() + DEF filehandle, status, buffer[BUFFERSIZE]:STRING, filename + filename:='datafile' + IF filehandle:=Open(filename, OLDFILE) + REPEAT + status:=ReadStr(filehandle, buffer) + /* This is the way to check ReadStr() actually read something */ + IF buffer[] OR (status<>-1) THEN process_record(buffer) + UNTIL status=-1 + /* If Open() succeeded then we must Close() the file */ + Close(filehandle) + ELSE + WriteF('Error: Failed to open "\s"\n', filename) + ENDIF +ENDPROC + +PROC process_record(line) + DEF i=1, start=0, end, s + /* Show the whole line being processed */ + WriteF('Processing record: "\s"\n', line) + REPEAT + /* Find the index of a comma after the start index */ + end:=InStr(line, ',', start) + /* If a comma was found then terminate with a NIL */ + IF end<>-1 THEN line[end]:=NIL + /* Point to the start of the field */ + s:=line+start + IF s[] + /* At this point we could do something useful... */ + WriteF('\t\d) "\s"\n', i, s) + ELSE + WriteF('\t\d) Empty Field\n', i) + ENDIF + /* The new start is after the end we found */ + start:=end+1 + INC i + /* Once a comma is not found we've finished */ + UNTIL end=-1 +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/csv.e b/amigae33a/E_v3.3a/Src/Src/Guide/csv.e new file mode 100644 index 0000000..ddf505e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/csv.e @@ -0,0 +1,72 @@ +/* Some constants for exceptions (ERR_NONE is zero: no error) */ +ENUM ERR_NONE, ERR_LEN, ERR_NEW, ERR_OPEN, ERR_READ + +/* Make some exceptions automatic */ +RAISE ERR_LEN IF FileLength()<=0, + ERR_NEW IF New()=NIL, + ERR_OPEN IF Open()=NIL + +PROC main() HANDLE + /* Note the careful initialisation of buffer and filehandle */ + DEF buffer=NIL, filehandle=NIL, len, filename + filename:='datafile' + /* Get the length of data in the file */ + len:=FileLength(filename) + /* Allocate just enough room for the data + a terminating NIL */ + buffer:=New(len+1) + filehandle:=Open(filename, OLDFILE) + /* Read whole file, checking amount read */ + IF len<>Read(filehandle, buffer, len) THEN Raise(ERR_READ) + /* Terminate buffer with a NIL just in case... */ + buffer[len]:=NIL + process_buffer(buffer, len) +EXCEPT DO + /* Both of these are safe thanks to the initialisations */ + IF buffer THEN Dispose(buffer) + IF filehandle THEN Close(filehandle) + /* Report error (if there was one) */ + SELECT exception + CASE ERR_LEN; WriteF('Error: "\s" is an empty file\n', filename) + CASE ERR_NEW; WriteF('Error: Insufficient memory to load file\n') + CASE ERR_OPEN; WriteF('Error: Failed to open "\s"\n', filename) + CASE ERR_READ; WriteF('Error: File reading error\n') + ENDSELECT +ENDPROC + +/* buffer is like a normal string since it's NIL-terminated */ +PROC process_buffer(buffer, len) + DEF start=0, end + REPEAT + /* Find the index of a linefeed after the start index */ + end:=InStr(buffer, '\n', start) + /* If a linefeed was found then terminate with a NIL */ + IF end<>-1 THEN buffer[end]:=NIL + process_record(buffer+start) + start:=end+1 + /* We've finished if at the end or no more linefeeds */ + UNTIL (start>=len) OR (end=-1) +ENDPROC + +PROC process_record(line) + DEF i=1, start=0, end, s + /* Show the whole line being processed */ + WriteF('Processing record: "\s"\n', line) + REPEAT + /* Find the index of a comma after the start index */ + end:=InStr(line, ',', start) + /* If a comma was found then terminate with a NIL */ + IF end<>-1 THEN line[end]:=NIL + /* Point to the start of the field */ + s:=line+start + IF s[] + /* At this point we could do something useful... */ + WriteF('\t\d) "\s"\n', i, s) + ELSE + WriteF('\t\d) Empty Field\n', i) + ENDIF + /* The new start is after the end we found */ + start:=end+1 + INC i + /* Once a comma is not found we've finished */ + UNTIL end=-1 +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/datafile b/amigae33a/E_v3.3a/Src/Src/Guide/datafile new file mode 100644 index 0000000..2a0841c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/datafile @@ -0,0 +1,6 @@ +datafile,for,CSV,programs +Field1,Field2,Field3 +10,19,-3 +fred,barney,wilma +,,last +first,, diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/dragon.e b/amigae33a/E_v3.3a/Src/Src/Guide/dragon.e new file mode 100644 index 0000000..00e3deb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/dragon.e @@ -0,0 +1,113 @@ +MODULE 'intuition/intuition', 'graphics/view' + +/* Screen size, use SIZEY=512 for a PAL screen */ +CONST SIZEX=640, SIZEY=400 + +/* Exception values */ +ENUM WIN=1, SCRN, STK, BRK + +/* Directions (DIRECTIONS gives number of directions) */ +ENUM NORTH, EAST, SOUTH, WEST, DIRECTIONS + +RAISE WIN IF OpenW()=NIL, + SCRN IF OpenS()=NIL + +/* Start off pointing WEST */ +DEF state=WEST, x, y, t + +/* Face left */ +PROC left() + state:=Mod(state-1+DIRECTIONS, DIRECTIONS) +ENDPROC + +/* Move right, changing the state */ +PROC right() + state:=Mod(state+1, DIRECTIONS) +ENDPROC + +/* Move in the direction we're facing */ +PROC move() + SELECT state + CASE NORTH; draw(0,t) + CASE EAST; draw(t,0) + CASE SOUTH; draw(0,-t) + CASE WEST; draw(-t,0) + ENDSELECT +ENDPROC + +/* Draw and move to specified relative position */ +PROC draw(dx, dy) + /* Check the line will be drawn within the window bounds */ + IF (x>=Abs(dx)) AND (x<=SIZEX-Abs(dx)) AND + (y>=Abs(dy)) AND (y<=SIZEY-10-Abs(dy)) + Line(x, y, x+dx, y+dy, 2) + ENDIF + x:=x+dx + y:=y+dy +ENDPROC + +PROC main() HANDLE + DEF sptr=NIL, wptr=NIL, i, m + /* Read arguments: [m [t [x [y]]]] */ + /* so you can say: dragon 16 */ + /* or: dragon 16 1 */ + /* or: dragon 16 1 450 */ + /* or: dragon 16 1 450 100 */ + /* m is depth of dragon, t is length of lines */ + /* (x,y) is the start position */ + m:=Val(arg, {i}) + t:=Val(arg:=arg+i, {i}) + x:=Val(arg:=arg+i, {i}) + y:=Val(arg:=arg+i, {i}) + /* If m or t is zero use a more sensible default */ + IF m=0 THEN m:=5 + IF t=0 THEN t:=5 + sptr:=OpenS(SIZEX,SIZEY,4,V_HIRES OR V_LACE,'Dragon Curve Screen') + wptr:=OpenW(0,10,SIZEX,SIZEY-10, + IDCMP_CLOSEWINDOW,WFLG_CLOSEGADGET, + 'Dragon Curve Window',sptr,$F,NIL) + /* Draw the dragon curve */ + dragon(m) + WHILE WaitIMessage(wptr)<>IDCMP_CLOSEWINDOW + ENDWHILE +EXCEPT DO + IF wptr THEN CloseW(wptr) + IF sptr THEN CloseS(sptr) + SELECT exception + CASE 0 + WriteF('Program finished successfully\n') + CASE WIN + WriteF('Could not open window\n') + CASE SCRN + WriteF('Could not open screen\n') + CASE STK + WriteF('Ran out of stack in recursion\n') + CASE BRK + WriteF('User aborted\n') + ENDSELECT +ENDPROC + +/* Draw the dragon curve (with left) */ +PROC dragon(m) + /* Check stack and ctrl-C before recursing */ + IF FreeStack()<1000 THEN Raise(STK) + IF CtrlC() THEN Raise(BRK) + IF m>0 + dragon(m-1) + left() + nogard(m-1) + ELSE + move() + ENDIF +ENDPROC + +/* Draw the dragon curve (with right) */ +PROC nogard(m) + IF m>0 + dragon(m-1) + right() + nogard(m-1) + ELSE + move() + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/except.e b/amigae33a/E_v3.3a/Src/Src/Guide/except.e new file mode 100644 index 0000000..fa08f7c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/except.e @@ -0,0 +1,22 @@ +ENUM FRED, BARNEY + +PROC main() + WriteF('Hello from main\n') + fred() + barney() + WriteF('Goodbye from main\n') +ENDPROC + +PROC fred() HANDLE + WriteF(' Hello from fred\n') + Raise(FRED) + WriteF(' Goodbye from fred\n') +EXCEPT + WriteF(' Handler fred: \d\n', exception) +ENDPROC + +PROC barney() + WriteF(' Hello from barney\n') + Raise(BARNEY) + WriteF(' Goodbye from barney\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/except2.e b/amigae33a/E_v3.3a/Src/Src/Guide/except2.e new file mode 100644 index 0000000..b602b47 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/except2.e @@ -0,0 +1,22 @@ +ENUM FRED, BARNEY + +PROC main() + WriteF('Hello from main\n') + fred() + WriteF('Goodbye from main\n') +ENDPROC + +PROC fred() HANDLE + WriteF(' Hello from fred\n') + barney() + Raise(FRED) + WriteF(' Goodbye from fred\n') +EXCEPT + WriteF(' Handler fred: \d\n', exception) +ENDPROC + +PROC barney() + WriteF(' Hello from barney\n') + Raise(BARNEY) + WriteF(' Goodbye from barney\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/float.e b/amigae33a/E_v3.3a/Src/Src/Guide/float.e new file mode 100644 index 0000000..3b76054 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/float.e @@ -0,0 +1,59 @@ +DEF f, i, s[20]:STRING + +PROC print_float() + WriteF('\tf is \s\n', RealF(s, !f, 8)) +ENDPROC + +PROC print_both() + WriteF('\ti is \d, ', i) + print_float() +ENDPROC + +/* Square a float */ +PROC square_float(f) IS !f*f + +/* Square an integer */ +PROC square_integer(i) IS i*i + +/* Converts a float to an integer */ +PROC convert_to_integer(f) IS Val(RealF(s, !f, 0)) + +/* Converts an integer to a float */ +PROC convert_to_float(i) IS RealVal(StringF(s, '\d', i)) + +/* This should be the same as Ftan */ +PROC my_tan(f) IS !Fsin(!f)/Fcos(!f) + +/* This should show float inaccuracies */ +PROC inaccurate(f) IS Fexp(Flog(!f)) + +PROC main() + WriteF('Next 2 lines should be the same\n') + f:=2.75; i:=!f! + print_both() + f:=2.75; i:=convert_to_integer(!f) + print_both() + + WriteF('Next 2 lines should be the same\n') + i:=10; f:=i! + print_both() + i:=10; f:=convert_to_float(i) + print_both() + + WriteF('f and i should be the same\n') + i:=square_integer(i) + f:=square_float(f) + print_both() + + WriteF('Next 2 lines should be the same\n') + f:=Ftan(.8) + print_float() + f:=my_tan(.8) + print_float() + + WriteF('Next 2 lines should be the same\n') + f:=.35 + print_float() + f:=inaccurate(f) + print_float() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/gadgets.e b/amigae33a/E_v3.3a/Src/Src/Guide/gadgets.e new file mode 100644 index 0000000..e5c3bb4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/gadgets.e @@ -0,0 +1,19 @@ +MODULE 'intuition/intuition' + +CONST GADGETBUFSIZE = 4 * GADGETSIZE + +PROC main() + DEF buf[GADGETBUFSIZE]:ARRAY, next, wptr + next:=Gadget(buf, NIL, 1, 0, 10, 30, 50, 'Hello') + next:=Gadget(next, buf, 2, 3, 70, 30, 50, 'World') + next:=Gadget(next, buf, 3, 1, 10, 50, 50, 'from') + next:=Gadget(next, buf, 4, 0, 70, 50, 70, 'gadgets') + wptr:=OpenW(20,50,200,100, 0, WFLG_ACTIVATE, + 'Gadgets in a window',NIL,1,buf) + IF wptr /* Check to see we opened a window */ + Delay(500) /* Wait a bit */ + CloseW(wptr) /* Close the window */ + ELSE + WriteF('Error -- could not open window!') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/graphics.e b/amigae33a/E_v3.3a/Src/Src/Guide/graphics.e new file mode 100644 index 0000000..09da6d2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/graphics.e @@ -0,0 +1,25 @@ +MODULE 'intuition/intuition' + +PROC main() + DEF wptr, i + wptr:=OpenW(20,50,200,100,IDCMP_CLOSEWINDOW, + WFLG_CLOSEGADGET OR WFLG_ACTIVATE, + 'Graphics demo window',NIL,1,NIL) + IF wptr /* Check to see we opened a window */ + Colour(1,3) + TextF(20,30,'Hello World') + SetTopaz(11) + TextF(20,60,'Hello World') + FOR i:=10 TO 150 STEP 8 /* Plot a few points */ + Plot(i,40,2) + ENDFOR + Line(160,40,160,70,3) + Line(160,70,170,40,2) + Box(10,75,160,85,1) + WHILE WaitIMessage(wptr)<>IDCMP_CLOSEWINDOW + ENDWHILE + CloseW(wptr) + ELSE + WriteF('Error -- could not open window!\n') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/idcmp.e b/amigae33a/E_v3.3a/Src/Src/Guide/idcmp.e new file mode 100644 index 0000000..aa7ada0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/idcmp.e @@ -0,0 +1,24 @@ +MODULE 'intuition/intuition' + +CONST GADGETBUFSIZE = GADGETSIZE, OURGADGET = 1 + +PROC main() + DEF buf[GADGETBUFSIZE]:ARRAY, wptr, class, gad:PTR TO gadget + Gadget(buf, NIL, OURGADGET, 1, 10, 30, 100, 'Press Me') + wptr:=OpenW(20,50,200,100, + IDCMP_CLOSEWINDOW OR IDCMP_GADGETUP, + WFLG_CLOSEGADGET OR WFLG_ACTIVATE, + 'Gadget message window',NIL,1,buf) + IF wptr /* Check to see we opened a window */ + WHILE (class:=WaitIMessage(wptr))<>IDCMP_CLOSEWINDOW + gad:=MsgIaddr() /* Our gadget clicked? */ + IF (class=IDCMP_GADGETUP) AND (gad.userdata=OURGADGET) + TextF(10,60, + IF gad.flags=0 THEN 'Gadget off ' ELSE 'Gadget on ') + ENDIF + ENDWHILE + CloseW(wptr) /* Close the window */ + ELSE + WriteF('Error -- could not open window!') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/screens.e b/amigae33a/E_v3.3a/Src/Src/Guide/screens.e new file mode 100644 index 0000000..6077273 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/screens.e @@ -0,0 +1,28 @@ +MODULE 'intuition/intuition', 'graphics/view' + +PROC main() + DEF sptr=NIL, wptr=NIL, i + sptr:=OpenS(640,200,4,V_HIRES,'Screen demo') + IF sptr + wptr:=OpenW(0,20,640,180,IDCMP_CLOSEWINDOW, + WFLG_CLOSEGADGET OR WFLG_ACTIVATE, + 'Graphics demo window',sptr,$F,NIL) + IF wptr + TextF(20,20,'Hello World') + FOR i:=0 TO 15 /* Draw a line and box in each colour */ + Line(20,30,620,30+(7*i),i) + Box(10+(40*i),140,30+(40*i),170,1) + Box(11+(40*i),141,29+(40*i),169,i) + ENDFOR + WHILE WaitIMessage(wptr)<>IDCMP_CLOSEWINDOW + ENDWHILE + WriteF('Program finished successfully\n') + ELSE + WriteF('Could not open window\n') + ENDIF + ELSE + WriteF('Could not open screen\n') + ENDIF + IF wptr THEN CloseW(wptr) + IF sptr THEN CloseS(sptr) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/screens2.e b/amigae33a/E_v3.3a/Src/Src/Guide/screens2.e new file mode 100644 index 0000000..0444cae --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/screens2.e @@ -0,0 +1,33 @@ +MODULE 'intuition/intuition', 'graphics/view' + +ENUM WIN=1, SCRN + +RAISE WIN IF OpenW()=NIL, + SCRN IF OpenS()=NIL + +PROC main() HANDLE + DEF sptr=NIL, wptr=NIL, i + sptr:=OpenS(640,200,4,V_HIRES,'Screen demo') + wptr:=OpenW(0,20,640,180,IDCMP_CLOSEWINDOW, + WFLG_CLOSEGADGET OR WFLG_ACTIVATE, + 'Graphics demo window',sptr,$F,NIL) + TextF(20,20,'Hello World') + FOR i:=0 TO 15 /* Draw a line and box in each colour */ + Line(20,30,620,30+(7*i),i) + Box(10+(40*i),140,30+(40*i),170,1) + Box(11+(40*i),141,29+(40*i),169,i) + ENDFOR + WHILE WaitIMessage(wptr)<>IDCMP_CLOSEWINDOW + ENDWHILE +EXCEPT DO + IF wptr THEN CloseW(wptr) + IF sptr THEN CloseS(sptr) + SELECT exception + CASE 0 + WriteF('Program finished successfully\n') + CASE WIN + WriteF('Could not open window\n') + CASE SCRN + WriteF('Could not open screen\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/set-use.e b/amigae33a/E_v3.3a/Src/Src/Guide/set-use.e new file mode 100644 index 0000000..c140713 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/set-use.e @@ -0,0 +1,24 @@ +MODULE '*set' + +PROC main() HANDLE + DEF s=NIL:PTR TO set + NEW s.create(20) + s.add(1) + s.add(-13) + s.add(91) + s.add(42) + s.add(-76) + IF s.member(1) THEN WriteF('1 is a member\n') + IF s.member(11) THEN WriteF('11 is a member\n') + WriteF('s = ') + s.print() + WriteF('\n') +EXCEPT DO + END s + SELECT exception + CASE "NEW" + WriteF('Out of memory\n') + CASE "full" + WriteF('Set is full\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/set.e b/amigae33a/E_v3.3a/Src/Src/Guide/set.e new file mode 100644 index 0000000..01dbdbd --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/set.e @@ -0,0 +1,80 @@ +OPT MODULE -> Define class 'set' in a module +OPT EXPORT -> Export everything + +/* The data for the class */ +OBJECT set PRIVATE -> Make all the data private + elements:PTR TO LONG + maxsize, size +ENDOBJECT + +/* Creation constructor */ +/* Minimum size of 1, maximum 100000, default 100 */ +PROC create(sz=100) OF set + DEF p:PTR TO LONG + IF (sz>0) AND (sz<100000) -> Check size + self.maxsize:=sz + ELSE + self.maxsize:=100 + ENDIF + self.elements:=NEW p[self.maxsize] +ENDPROC + +/* Copy constructor */ +PROC copy(oldset:PTR TO set) OF set + DEF i + self.create(oldset.maxsize) -> Call create method! + FOR i:=0 TO oldset.size-1 -> Copy elements + self.elements[i]:=oldset.elements[i] + ENDFOR + self.size:=oldset.size +ENDPROC + +/* Destructor */ +PROC end() OF set + DEF p:PTR TO LONG + IF self.maxsize<>0 -> Check that it was allocated + p:=self.elements + END p[self.maxsize] + ENDIF +ENDPROC + +/* Add an element */ +PROC add(x) OF set + IF self.member(x)=FALSE -> Is it new? (Call member method!) + IF self.size=self.maxsize + Raise("full") -> The set is already full + ELSE + self.elements[self.size]:=x + self.size:=self.size+1 + ENDIF + ENDIF +ENDPROC + +/* Test for membership */ +PROC member(x) OF set + DEF i + FOR i:=0 TO self.size-1 + IF self.elements[i]=x THEN RETURN TRUE + ENDFOR +ENDPROC FALSE + +/* Test for emptiness */ +PROC empty() OF set IS self.size=0 + +/* Union (add) another set */ +PROC union(other:PTR TO set) OF set + DEF i + FOR i:=0 TO other.size-1 + self.add(other.elements[i]) -> Call add method! + ENDFOR +ENDPROC + +/* Print out the contents */ +PROC print() OF set + DEF i + WriteF('{ ') + FOR i:=0 TO self.size-1 + WriteF('\d ', self.elements[i]) + ENDFOR + WriteF('}') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/simple.e b/amigae33a/E_v3.3a/Src/Src/Guide/simple.e new file mode 100644 index 0000000..1983c62 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/simple.e @@ -0,0 +1,3 @@ +PROC main() + WriteF('My first program') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/static.e b/amigae33a/E_v3.3a/Src/Src/Guide/static.e new file mode 100644 index 0000000..c95cd89 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/static.e @@ -0,0 +1,12 @@ +PROC main() + DEF i, a[10]:ARRAY OF LONG, p:PTR TO LONG + FOR i:=0 TO 9 + a[i]:=[1, i, i*i] + /* This assignment is probably not what you want! */ + ENDFOR + FOR i:=0 TO 9 + p:=a[i] + WriteF('a[\d] is an array at address \d\n', i, p) + WriteF(' and the second element is \d\n', p[1]) + ENDFOR +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/static2.e b/amigae33a/E_v3.3a/Src/Src/Guide/static2.e new file mode 100644 index 0000000..409a52d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/static2.e @@ -0,0 +1,17 @@ +PROC main() + DEF i, a[10]:ARRAY OF LONG, p:PTR TO LONG + FOR i:=0 TO 9 + a[i]:=List(3) + /* Must check that the allocation succeeded before copying */ + IF a[i]<>NIL THEN ListCopy(a[i], [1, i, i*i], ALL) + ENDFOR + FOR i:=0 TO 9 + p:=a[i] + IF p=NIL + WriteF('Could not allocate memory for a[\d]\n', i) + ELSE + WriteF('a[\d] is an array at address \d\n', i, p) + WriteF(' and the second element is \d\n', p[1]) + ENDIF + ENDFOR +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/static3.e b/amigae33a/E_v3.3a/Src/Src/Guide/static3.e new file mode 100644 index 0000000..e4dff03 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/static3.e @@ -0,0 +1,12 @@ +PROC main() + DEF i, a[10]:ARRAY OF LONG, p:PTR TO LONG + FOR i:=0 TO 9 + a[i]:=NEW [1, i, i*i] + /* a[i] is now dynamically allocated */ + ENDFOR + FOR i:=0 TO 9 + p:=a[i] + WriteF('a[\d] is an array at address \d\n', i, p) + WriteF(' and the second element is \d\n', p[1]) + ENDFOR +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/timing.e b/amigae33a/E_v3.3a/Src/Src/Guide/timing.e new file mode 100644 index 0000000..641db68 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/timing.e @@ -0,0 +1,60 @@ +OPT LARGE + +MODULE 'dos/dos' + +CONST TICKS_PER_MINUTE=TICKS_PER_SECOND*60, LOTS_OF_TIMES=500000 + +DEF x, y, offset + +PROC fred(n) + DEF i + i:=n+x +ENDPROC + +/* Repeat evaluation of an expression */ +PROC repeat(exp) + DEF i + FOR i:=0 TO LOTS_OF_TIMES + Eval(exp) /* Evaluate the expresssion */ + ENDFOR +ENDPROC + +/* Time an expression, and set-up offset if not done already */ +PROC test(exp, message) + DEF t + IF offset=0 THEN offset:=time(`0) /* Calculate offset */ + t:=time(exp) + WriteF('\s:\t\d ticks\n', message, t-offset) +ENDPROC + +/* Time the repeated calls, and calculate number of ticks */ +PROC time(x) + DEF ds1:datestamp, ds2:datestamp + Forbid() + DateStamp(ds1) + repeat(x) + DateStamp(ds2) + Permit() + IF CtrlC() THEN CleanUp(1) +ENDPROC ((ds2.minute-ds1.minute)*TICKS_PER_MINUTE)+ds2.tick-ds1.tick + +PROC main() + x:=9999 + y:=1717 + test(`x+y, 'Addition') + test(`y-x, 'Subtraction') + test(`x*y, 'Multiplication') + test(`x/y, 'Division') + test(`x OR y, 'Bitwise OR') + test(`x AND y, 'Bitwise AND') + test(`x=y, 'Equality') + test(`x Make a module of these classes +OPT EXPORT -> Export everything + +/* ------------------------------- */ +/* The (abstract) base class, tree */ +/* ------------------------------- */ + +OBJECT tree PRIVATE -> All data is private + left:PTR TO tree, right:PTR TO tree +ENDOBJECT + +/* Count nodes */ +PROC nodes() OF tree + DEF tot=1 + IF self.left THEN tot:=tot+self.left.nodes() + IF self.right THEN tot:=tot+self.right.nodes() +ENDPROC tot + +/* Count leaves, and optionally show them */ +PROC leaves(show=FALSE) OF tree + DEF tot=0 + IF self.left + tot:=tot+self.left.leaves(show) + ENDIF + IF self.right + tot:=tot+self.right.leaves(show) + ELSEIF self.left=NIL -> Both NIL, so a leaf + IF show THEN self.print_node() + tot++ + ENDIF +ENDPROC tot + +/* Abstract method, add */ +PROC add(x) OF tree IS EMPTY + +/* Abstract method, print_node */ +PROC print_node() OF tree IS EMPTY + +/* Print the tree in order, left to right */ +PROC print() OF tree + IF self.left THEN self.left.print() + self.print_node() + IF self.right THEN self.right.print() +ENDPROC + + +/* ---------------------- */ +/* The integer_tree class */ +/* ---------------------- */ + +/* Inherit tree */ +OBJECT integer_tree OF tree PRIVATE -> All data is private + int +ENDOBJECT + +/* Constructor, start with one integer */ +PROC create(i) OF integer_tree + self.int:=i +ENDPROC + +/* Add an integer */ +PROC add(i) OF integer_tree + DEF p:PTR TO integer_tree + IF i < self.int + IF self.left + self.left.add(i) + ELSE + self.left:=NEW p.create(i) + ENDIF + ELSEIF i > self.int + IF self.right + self.right.add(i) + ELSE + self.right:=NEW p.create(i) + ENDIF + ENDIF +ENDPROC + +/* Print a node */ +PROC print_node() OF integer_tree + WriteF('\d ', self.int) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Guide/while.e b/amigae33a/E_v3.3a/Src/Src/Guide/while.e new file mode 100644 index 0000000..d18bce6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Guide/while.e @@ -0,0 +1,10 @@ +PROC main() + DEF x,y + x:=1 + y:=2 + WHILE (x<10) AND (y<10) + WriteF('x is \d and y is \d\n', x, y) + x:=x+2 + y:=y+2 + ENDWHILE +ENDPROC \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/HelloWorld.e b/amigae33a/E_v3.3a/Src/Src/HelloWorld.e new file mode 100644 index 0000000..c55d09d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/HelloWorld.e @@ -0,0 +1,5 @@ +/* nominated for Most Boring Example */ + +PROC main() + WriteF('Hello, World!\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/HelloWorld.e.info b/amigae33a/E_v3.3a/Src/Src/HelloWorld.e.info new file mode 100644 index 0000000..1eee0e7 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/HelloWorld.e.info differ diff --git a/amigae33a/E_v3.3a/Src/Src/Intui/AppMenuItem.e b/amigae33a/E_v3.3a/Src/Src/Intui/AppMenuItem.e new file mode 100644 index 0000000..8feedb5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Intui/AppMenuItem.e @@ -0,0 +1,23 @@ +/* AppMenuItem.e, loosely adapted from RKRM libraries 3rd ed. */ + +OPT OSVERSION=37 + +MODULE 'wb' + +DEF myport,appitem,appmsg + +PROC main() + IF workbenchbase:=OpenLibrary('workbench.library',37) + IF myport:=CreateMsgPort() + IF appitem:=AddAppMenuItemA(0,0,'DisplayBeep()',myport,NIL) + WriteF('Come on, go and see whats in the Tools menu ...\n') + WaitPort(myport) + DisplayBeep(NIL) + WriteF('Wow, you found it!\n') + RemoveAppMenuItem(appitem) + WHILE appmsg:=GetMsg(myport) DO ReplyMsg(appmsg) + ENDIF + DeleteMsgPort(myport) + ENDIF + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Intui/Public.e b/amigae33a/E_v3.3a/Src/Src/Intui/Public.e new file mode 100644 index 0000000..ea770d1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Intui/Public.e @@ -0,0 +1,35 @@ +-> Opening our public screen with a shell on it ... [nothing fancy] + +OPT OSVERSION=37 + +MODULE 'intuition/screens' + +ENUM OKAY,NOSCREEN,NOSIG + +PROC main() HANDLE + DEF s=NIL,sig=-1,name + IF (s:=OpenScreenTagList(0, /* get ourselves a public screen */ + [SA_DEPTH,4, + SA_DISPLAYID,$8000, + SA_PUBNAME,name:='PublicShell', + SA_TITLE,name, + SA_PUBSIG,IF (sig:=AllocSignal(-1))=NIL THEN Raise(NOSIG) ELSE sig, + SA_PUBTASK,NIL, + 0,0]))=NIL THEN Raise(NOSCREEN) + PubScreenStatus(s,0) /* make it available */ + SetDefaultPubScreen(name) + SetPubScreenModes(SHANGHAI) + Execute('NewShell WINDOW CON:10/20/400/100/bla',NIL,NIL) + /* other applications can use our screen also. + if we just want our shell on it, turn it private again */ + Wait(Shl(1,sig)) /* wait until all windows closed */ + SetDefaultPubScreen(NIL) /* workbench is default again */ +EXCEPT DO + IF s THEN CloseS(s) + IF sig>=0 THEN FreeSignal(sig) + IF exception=NOSCREEN + WriteF('Could not open screen!\n') + ELSEIF exception=NOSIG + WriteF('No signal available!\n') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Intui/ScrollerWindow.e b/amigae33a/E_v3.3a/Src/Src/Intui/ScrollerWindow.e new file mode 100644 index 0000000..e8b7810 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Intui/ScrollerWindow.e @@ -0,0 +1,308 @@ +/* ScrollerWindow.e + + Translated by Wouter from excellent example scrollerwindow.c + by Christoph Feck, TowerSystems (feck@informatik.uni-kl.de) + + needs E v2.1b / v39 emodules with fixed icclass.m to compile + +*/ + +MODULE 'exec/memory', 'exec/libraries', 'utility', 'utility/tagitem', + 'intuition/intuition', 'intuition/imageclass', 'intuition/screens', + 'intuition/classes', 'intuition/icclass', 'intuition/gadgetclass', + 'intuition/imageclass', + 'graphics/gfx', 'graphics/text', 'graphics/rastport' + +DEF screen:PTR TO screen,dri:PTR TO drawinfo,v39,bitmap:PTR TO bitmap + +DEF horizgadget:PTR TO object,vertgadget:PTR TO object, + leftgadget:PTR TO object,rightgadget:PTR TO object, + upgadget:PTR TO object,downgadget:PTR TO object + +ENUM HORIZ_GID=1,VERT_GID,LEFT_GID,RIGHT_GID,UP_GID,DOWN_GID + +DEF window:PTR TO window + +-> these are actually PTR TO object too + +DEF sizeimage:PTR TO image,leftimage:PTR TO image,rightimage:PTR TO image, + upimage:PTR TO image,downimage:PTR TO image + +DEF htotal,vtotal,hvisible,vvisible + +PROC max(x,y) IS IF x>y THEN x ELSE y +PROC min(x,y) IS IF x1), + TAG_MORE,taglist]) + +PROC newbuttonobject(image:PTR TO object,taglist) IS + NewObjectA(NIL,'buttongclass', + [ICA_TARGET,ICTARGET_IDCMP,GA_IMAGE,image,TAG_MORE,taglist]) + +PROC openscrollerwindow(taglist) + DEF resolution,topborder,sf:PTR TO textattr,w,h,bw,bh,rw,rh,gw,gh,gap + resolution:=sysisize() + sf:=screen.font + topborder:=screen.wbortop+sf.ysize+1 + w:=sizeimage.width + h:=sizeimage.height + bw:=IF resolution=SYSISIZE_LOWRES THEN 1 ELSE 2 + bh:=IF resolution=SYSISIZE_HIRES THEN 2 ELSE 1 + rw:=IF resolution=SYSISIZE_HIRES THEN 3 ELSE 2 + rh:=IF resolution=SYSISIZE_HIRES THEN 2 ELSE 1 + gh:=max(leftimage.height,h) + gh:=max(rightimage.height,gh) + gw:=max(upimage.width,w) + gw:=max(downimage.width,gw) + gap:=1 + horizgadget:=newpropobject(FREEHORIZ, + [GA_LEFT,rw+gap, + GA_RELBOTTOM,bh-gh+2, + GA_RELWIDTH,(-gw)-gap-leftimage.width-rightimage.width-rw-rw, + GA_HEIGHT,gh-bh-bh-2, + GA_BOTTOMBORDER,TRUE, + GA_ID,HORIZ_GID, + PGA_TOTAL,htotal, + PGA_VISIBLE,hvisible, + NIL]) + vertgadget:=newpropobject(FREEVERT, + [GA_RELRIGHT,bw-gw+3, + GA_TOP,topborder+rh, + GA_WIDTH,gw-bw-bw-4, + GA_RELHEIGHT,(-topborder)-h-upimage.height-downimage.height-rh-rh, + GA_RIGHTBORDER,TRUE, + GA_PREVIOUS,horizgadget, + GA_ID,VERT_GID, + PGA_TOTAL,vtotal, + PGA_VISIBLE,vvisible, + NIL]) + leftgadget:=newbuttonobject(leftimage, + [GA_RELRIGHT,(1)-leftimage.width-rightimage.width-gw, + GA_RELBOTTOM,(1)-leftimage.height, + GA_BOTTOMBORDER,TRUE, + GA_PREVIOUS,vertgadget, + GA_ID,LEFT_GID, + NIL]) + rightgadget:=newbuttonobject(rightimage, + [GA_RELRIGHT,(1)-rightimage.width-gw, + GA_RELBOTTOM,(1)-rightimage.height, + GA_BOTTOMBORDER,TRUE, + GA_PREVIOUS,leftgadget, + GA_ID,RIGHT_GID, + NIL]) + upgadget:=newbuttonobject(upimage, + [GA_RELRIGHT,(1)-upimage.width, + GA_RELBOTTOM,(1)-upimage.height-downimage.height-h, + GA_RIGHTBORDER,TRUE, + GA_PREVIOUS,rightgadget, + GA_ID,UP_GID, + NIL]) + downgadget:=newbuttonobject(downimage, + [GA_RELRIGHT,(1)-downimage.width, + GA_RELBOTTOM,(1)-downimage.height-h, + GA_RIGHTBORDER,TRUE, + GA_PREVIOUS,upgadget, + GA_ID,DOWN_GID, + NIL]) + IF downgadget + window:=OpenWindowTagList(NIL, + [WA_GADGETS,horizgadget, + WA_MINWIDTH,max(80,gw+gap+leftimage.width+rightimage.width+rw+rw+KNOBHMIN), + WA_MINHEIGHT,max(50,topborder+h+upimage.height+downimage.height+rh+rh+KNOBVMIN), + TAG_MORE,taglist]) + ENDIF +ENDPROC + +PROC closescrollerwindow() + IF window THEN CloseWindow(window) + DisposeObject(horizgadget) + DisposeObject(vertgadget) + DisposeObject(leftgadget) + DisposeObject(rightgadget) + DisposeObject(upgadget) + DisposeObject(downgadget) +ENDPROC + +PROC recalchvisible() IS window.width-window.borderleft-window.borderright +PROC recalcvvisible() IS window.height-window.bordertop-window.borderbottom + +PROC updateprop(gadget:PTR TO object,attr,value) + SetGadgetAttrsA(gadget,window,NIL,[attr,value,NIL]) +ENDPROC + +PROC copybitmap() + DEF srcx,srcy + GetAttr(PGA_TOP,horizgadget,{srcx}) + GetAttr(PGA_TOP,vertgadget,{srcy}) + BltBitMapRastPort(bitmap,srcx,srcy,window.rport,window.borderleft, + window.bordertop,min(htotal,hvisible),min(vtotal,vvisible),$C0) +ENDPROC + +PROC updatescrollerwindow() + hvisible:=recalchvisible() + updateprop(horizgadget,PGA_VISIBLE,hvisible) + vvisible:=recalcvvisible() + updateprop(vertgadget,PGA_VISIBLE,vvisible) + copybitmap() +ENDPROC + +PROC handlescrollerwindow() + DEF imsg:PTR TO intuimessage,quit=FALSE,oldtop,cl,v + WHILE quit=FALSE + WHILE (quit=FALSE) AND (imsg:=GetMsg(window.userport)) + cl:=imsg.class + SELECT cl + CASE IDCMP_CLOSEWINDOW + quit:=TRUE + CASE IDCMP_NEWSIZE + updatescrollerwindow() + CASE IDCMP_REFRESHWINDOW + BeginRefresh(window) + copybitmap() + EndRefresh(window,TRUE) + CASE IDCMP_IDCMPUPDATE + v:=GetTagData(GA_ID,0,imsg.iaddress) + SELECT v + CASE HORIZ_GID + copybitmap() + CASE VERT_GID + copybitmap() + CASE LEFT_GID + GetAttr(PGA_TOP,horizgadget,{oldtop}) + IF oldtop>0 + updateprop(horizgadget,PGA_TOP,oldtop-1) + copybitmap() + ENDIF + CASE RIGHT_GID + GetAttr(PGA_TOP,horizgadget,{oldtop}) + IF oldtop<(htotal-hvisible) + updateprop(horizgadget,PGA_TOP,oldtop+1) + copybitmap() + ENDIF + CASE UP_GID + GetAttr(PGA_TOP,vertgadget,{oldtop}) + IF oldtop>0 + updateprop(vertgadget,PGA_TOP,oldtop-1) + copybitmap() + ENDIF + CASE DOWN_GID + GetAttr(PGA_TOP,vertgadget,{oldtop}) + IF oldtop<(vtotal-vvisible) + updateprop(vertgadget,PGA_TOP,oldtop+1) + copybitmap() + ENDIF + ENDSELECT + ENDSELECT + ReplyMsg(imsg) + ENDWHILE + IF quit=FALSE THEN WaitPort(window.userport) + ENDWHILE +ENDPROC + +PROC doscrollerwindow() + DEF r:PTR TO rastport + IF screen:=LockPubScreen(NIL) + hvisible:=htotal:=screen.width + vvisible:=vtotal:=screen.height + r:=screen.rastport + IF bitmap:=createbitmap(htotal,vtotal,bitmapdepth(r.bitmap),0,r.bitmap) + BltBitMap(r.bitmap,0,0,bitmap,0,0,htotal,vtotal,$C0,-1,NIL) + IF dri:=GetScreenDrawInfo(screen) + sizeimage:=newimageobject(SIZEIMAGE) + leftimage:=newimageobject(LEFTIMAGE) + rightimage:=newimageobject(RIGHTIMAGE) + upimage:=newimageobject(UPIMAGE) + downimage:=newimageobject(DOWNIMAGE) + IF (sizeimage<>0) AND (leftimage<>0) AND (rightimage<>0) AND (upimage<>0) AND (downimage<>0) + openscrollerwindow([WA_PUBSCREEN,screen, + WA_TITLE,'ScrollerWindow', + WA_FLAGS,WFLG_CLOSEGADGET OR WFLG_SIZEGADGET OR WFLG_DRAGBAR OR WFLG_DEPTHGADGET OR WFLG_SIMPLE_REFRESH OR WFLG_ACTIVATE OR WFLG_NEWLOOKMENUS, + WA_IDCMP,IDCMP_CLOSEWINDOW OR IDCMP_NEWSIZE OR IDCMP_REFRESHWINDOW OR IDCMP_IDCMPUPDATE, + WA_INNERWIDTH,htotal, + WA_INNERHEIGHT,vtotal, + WA_MAXWIDTH,-1, + WA_MAXHEIGHT,-1, + NIL]) + IF window + updatescrollerwindow() + handlescrollerwindow() + ELSE + WriteF('no window!\n') + ENDIF + closescrollerwindow() + ELSE + WriteF('no images!\n') + ENDIF + DisposeObject(sizeimage) + DisposeObject(leftimage) + DisposeObject(rightimage) + DisposeObject(upimage) + DisposeObject(downimage) + FreeScreenDrawInfo(screen,dri) + ELSE + WriteF('no draw infos!\n') + ENDIF + WaitBlit() + deletebitmap(bitmap) + ELSE + WriteF('no bitmap!\n') + ENDIF + UnlockPubScreen(NIL,screen) + ELSE + WriteF('no pub screen!\n') + ENDIF +ENDPROC + +PROC main() + v39:=KickVersion(39) + IF utilitybase:=OpenLibrary('utility.library',37) + doscrollerwindow() + CloseLibrary(utilitybase) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Intui/Talk2Boopsi.e b/amigae33a/E_v3.3a/Src/Src/Intui/Talk2Boopsi.e new file mode 100644 index 0000000..32f3159 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Intui/Talk2Boopsi.e @@ -0,0 +1,29 @@ +/* Talk2Boopsi.e - free translation of Talk2Boopsi.c from RKRM libraries */ + +MODULE 'intuition/intuition', 'intuition/gadgetclass', 'intuition/icclass' + +DEF w:PTR TO window, prop:PTR TO gadget, integer:PTR TO gadget + +PROC main() + IF w:=OpenWindowTagList(NIL,[WA_FLAGS,$E,WA_IDCMP,$200,WA_WIDTH,120, + WA_HEIGHT,150,0]) + IF prop:=NewObjectA(NIL,'propgclass',[GA_ID,1,GA_TOP,w.bordertop+5, + GA_LEFT,w.borderleft+5,GA_WIDTH,10,GA_HEIGHT,80,ICA_MAP,[PGA_TOP, + STRINGA_LONGVAL,0],PGA_TOTAL,100,PGA_TOP,25,PGA_VISIBLE,10, + PGA_NEWLOOK,TRUE,0]) + IF integer:=NewObjectA(NIL,'strgclass',[GA_ID,2,GA_TOP,w.bordertop+5, + GA_LEFT,w.borderleft+30,GA_WIDTH,40,GA_HEIGHT,18,ICA_MAP, + [STRINGA_LONGVAL,PGA_TOP,0],ICA_TARGET,prop,GA_PREVIOUS,prop, + STRINGA_LONGVAL,25,STRINGA_MAXCHARS,3,0]) + SetGadgetAttrsA(prop,w,NIL,[ICA_TARGET,integer,0]) + AddGList(w,prop,-1,-1,NIL) + RefreshGList(prop,w,NIL,-1) + WaitIMessage(w) + RemoveGList(w,prop,-1) + DisposeObject(integer) + ENDIF + DisposeObject(prop) + ENDIF + CloseWindow(w) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Intui/gradient.e b/amigae33a/E_v3.3a/Src/Src/Intui/gradient.e new file mode 100644 index 0000000..b126951 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Intui/gradient.e @@ -0,0 +1,32 @@ +-> gradientslider in E! + +MODULE 'intuition/intuition', 'intuition/gadgetclass', 'intuition/icclass', + 'gadgets/gradientslider' + +DEF w:PTR TO window, grad:PTR TO gadget, gradbase, class, val + +PROC main() + IF w:=OpenWindowTagList(NIL,[WA_FLAGS,$E,WA_IDCMP,$268,WA_WIDTH,400,WA_HEIGHT,80,WA_TITLE,'Gradients in E!',0]) + SetStdRast(w.rport) + IF gradbase:=OpenLibrary('gadgets/gradientslider.gadget',39) + IF grad:=NewObjectA(NIL,'gradientslider.gadget',[GA_TOP,20,GA_LEFT,20,GA_WIDTH,350,GA_HEIGHT,30,GA_ID,1,GRAD_PENARRAY,[0,7,-1]:INT,GRAD_KNOBPIXELS,20,0]) + AddGList(w,grad,-1,-1,NIL) + RefreshGList(grad,w,NIL,-1) + WHILE (class:=WaitIMessage(w))<>IDCMP_CLOSEWINDOW + GetAttr(GRAD_CURVAL,grad,{val}) + TextF(20,60,'gradient value = \z$\h[4]',val) + ENDWHILE + RemoveGList(w,grad,-1) + DisposeObject(grad) + ELSE + WriteF('Could not create GradientSlider!\n') + ENDIF + CloseLibrary(gradbase) + ELSE + WriteF('Could not open "gradientslider.gadget"\n') + ENDIF + CloseWindow(w) + ELSE + WriteF('No Window!\n') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/EYacc/bcalc.y b/amigae33a/E_v3.3a/Src/Src/Lang/EYacc/bcalc.y new file mode 100644 index 0000000..bd7fcfb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/EYacc/bcalc.y @@ -0,0 +1,70 @@ +%{ + +/* calculator in E using E-Yacc: + + binary operators: + - * / % & | (precedence in this order) + unary operators: - ~ + grouping: ( ) + assignment: var = exp (vars 'a' .. 'f') + values: intnum var + exit: Q + +*/ + +DEF vars:PTR TO LONG + +%} + +%start stmt + +%token DIGIT LETTER QUIT + +%left '|' +%left '&' +%left '+' '-' +%left '*' '/' '%' +%left UMINUS '~' + +%% + +stmt : expr { PrintF('result: \d\n> ',$1); Flush(stdout) } + | LETTER '=' expr { IF vars=NIL THEN NEW vars[26]; vars[$1]:=$3; PrintF('> '); Flush(stdout) } + | QUIT { CleanUp(0) } + ; + +expr : '(' expr ')' { $$:=$2 } + | expr '+' expr { $$:=$1+$3 } + | expr '-' expr { $$:=$1-$3 } + | expr '*' expr { $$:=$1*$3 } + | expr '/' expr { $$:=$1/$3 } + | expr '%' expr { $$:=Mod($1,$3) } + | expr '|' expr { $$:=$1 OR $3 } + | expr '&' expr { $$:=$1 AND $3 } + | '~' expr { $$:=Not($2) } + | '-' expr %prec UMINUS { $$:=-$2 } + | LETTER { $$:=vars[$1] } + | number + ; + +number : DIGIT { $$:=$1 } + | number DIGIT { $$:=10*$1+$2 } + ; + +%% + +PROC yylex() + DEF c + WHILE (c:=FgetC(stdin))=" " DO NOP + IF c="\n" THEN RETURN 0 + IF (c="Q") OR (c=-1) THEN RETURN QUIT + IF (c>="a") AND (c<="z") THEN RETURN LETTER,c-"a" + IF (c>="0") AND (c<="9") THEN RETURN DIGIT,c-"0" +ENDPROC c + +PROC yyerror(n) + IF n=YYERRSTACK + PrintF('parse stack overflow!\n> ') + ELSEIF n=YYERRPARSE + PrintF('parse error!\n> ') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/EYacc/calcmain.e b/amigae33a/E_v3.3a/Src/Src/Lang/EYacc/calcmain.e new file mode 100644 index 0000000..1aa165e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/EYacc/calcmain.e @@ -0,0 +1,10 @@ +MODULE '*yyparse' + +PROC main() + Flush(stdin) + PutStr('E-Yacc Calc\n> ') + Flush(stdout) + LOOP + yyparse() + ENDLOOP +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/Elex.e b/amigae33a/E_v3.3a/Src/Src/Lang/Elex.e new file mode 100644 index 0000000..af68121 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/Elex.e @@ -0,0 +1,193 @@ +-> Tiny E Lexical Analyzer. Of little use sofar, but nice example + +OPT REG=5 + +MODULE 'tools/ctype', 'tools/file', 'class/hash' + +DEF src_begin=NIL, src_size, src_end, p:PTR TO CHAR, curline=1, x=" ",y, + keyhash:PTR TO hashtable,keylist:PTR TO LONG + +ENUM NONE,ER_GARBAGE,ER_STRING,ER_COMMENT + +OBJECT keylink OF hashlink + token:INT +ENDOBJECT + +PROC main() HANDLE + WriteF('Tiny E Lexical Analyzer (c) 1994 Wouter\n') + src_begin,src_size:=readfile(arg) + src_end:=(p:=src_begin)+src_size + lex_keys() + WHILE x<>256 + IF x<256 + WriteF('\c ',x) + ELSEIF x>512 + WriteF('\s ',{x}+2) + ELSEIF x>=300 + WriteF('{\s} ',keylist[x-300]) + ELSEIF x=260 + WriteF('"\s" ',y) + ELSE + WriteF('\d ',x-256) + ENDIF + x,y:=lex() + ENDWHILE + WriteF('\n') +EXCEPT DO + IF src_begin THEN freefile(src_begin) + SELECT exception + CASE NONE; WriteF('no errors.\n') + CASE "OPEN"; WriteF('no file!\n') + CASE "MEM"; WriteF('no mem!\n') + DEFAULT; printerr(exception) + ENDSELECT +ENDPROC + +PROC printerr(n) + DEF ers[200]:STRING,pos,a,b,e + b:=e:=p + WHILE b[]--<>"\n" DO NOP + b++ + WHILE e[]<>"\n" DO e++ + StrCopy(ers,b,e-b) + pos:=p-b-1 + WriteF('\nERROR: \s\nLINE: \d\n\s\n', + ListItem([ + '', + 'garbage in line', + 'unmatched \a or \q', + 'unmatched */', + '', + '', + '' + ],n),curline,ers) + IF pos>0 THEN FOR a:=1 TO pos DO WriteF(' ') + WriteF('^\n') +ENDPROC + +/*----------------------------LEX-----------------------------------*/ + +ENUM LEX_EOF=256, + LEX_EOL, + LEX_INTEGER, + LEX_FLOAT, + LEX_IDENT, + LEX_STRINGA, + LEX_STRINGQ + + +-> ; , := + - * / = > < >= <= <> ( ) : { } [ ] ^ . ` ! | ++ -- <=> :: /* */ -> + + +PROC lex() + DEF a,b,c,d,l:PTR TO keylink + LOOP + SELECT 256 OF c:=p[]++ + CASE ",","*","=","(",")","{","}","[","]","^",".","`","!","|" + RETURN c + CASE "+" + RETURN IF p[]="+" THEN p++ BUT "++" ELSE "+" + CASE "-" + IF (c:=p[])=">" + WHILE p[]++<>"\n" + ENDWHILE + curline++ + ELSEIF c="-" + p++ + RETURN "--" + ELSE + RETURN "-" + ENDIF + CASE "/" + IF p[]<>"*" THEN RETURN "/" + p++ + a:=1 + b:=p; d:=curline + REPEAT + IF (c:=b[]++)="/" + IF b[]="*" THEN b++ BUT a++ + ELSEIF c="*" + IF b[]="/" THEN b++ BUT a-- + ELSEIF c="\n" + IF b>src_end THEN Raise(ER_COMMENT) + d++ + ENDIF + UNTIL a=0 + p:=b + curline:=d + CASE ">" + RETURN IF p[]="=" THEN p++ BUT ">=" ELSE ">" + CASE "<" + IF (c:=p[])="=" + p++ + RETURN IF p[]=">" THEN p++ BUT "<=>" ELSE "<=" + ELSEIF c=">" + p++ + RETURN "<>" + ELSE + RETURN "<" + ENDIF + CASE ":" + RETURN IF (c:=p[])=":" THEN p++ BUT "::" ELSE IF c="=" THEN p++ BUT ":=" ELSE ":" + CASE ";","\n" + IF p>src_end THEN RETURN (p:=src_end) BUT LEX_EOF + curline++ + WriteF('\n[\d] ',curline) + RETURN LEX_EOL -> conditional + CASE " ", "\t" + /* whitespace, do nothing */ + CASE "0" TO "9", "$", "%" + a,b:=Val(p-1) + IF b=0 THEN RETURN c + p:=p+b-1 + RETURN LEX_INTEGER, a + CASE "a" TO "z", "A" TO "Z", "_" + a:=p-1; c:=p[] + WHILE isalnum(c) OR (c="_") DO p++ BUT c:=p[] + IF l:=keyhash.find(a,p-a) THEN RETURN l.token + NEW b[c:=p-a+1] + AstrCopy(b,a,c) + RETURN LEX_IDENT,b + CASE "\q", "\a" + a:=p + WHILE (a[]<>c) AND (a[]<>"\n") DO a++ + IF a[]="\n" THEN Raise(ER_STRING) + b:=p + p:=a+1 + RETURN IF c="\a" THEN LEX_STRINGQ ELSE LEX_STRINGA, b + DEFAULT + Raise(ER_GARBAGE) + ENDSELECT + ENDLOOP +ENDPROC + +ENUM K_PROC=300,K_ENDPROC,K_IF,K_ENDIF,K_VOID,K_WHILE,K_ENDWHILE,K_FOR, + K_ENDFOR,K_SELECT,K_CASE,K_DEFAULT,K_ENDSELECT,K_REPEAT,K_UNTIL, + K_JUMP,K_DEF,K_ELSE,K_INCBIN,K_LONG,K_INT,K_CHAR,K_INC,K_DEC,K_THEN, + K_LOOP,K_ENDLOOP,K_DO,K_AND,K_OR,K_CONST,K_OPT,K_MODULE,K_STACK, + K_EXIT,K_LARGE,K_ASM,K_NOWARN,K_TO,K_STEP,K_ARRAY,K_STRING,K_DIR, + K_PTR,K_OF,K_ELSEIF,K_LIST,K_OBJECT,K_ENDOBJECT,K_SIZEOF,K_RETURN, + K_OSVERSION,K_ENUM,K_SET,K_BUT,K_HANDLE,K_EXCEPT,K_RAISE,K_EXPORT, + K_REG,K_END,K_IS,K_NEW,K_PUBLIC,K_PRIVATE,K_SUPER + +PROC lex_keys() + DEF a,b,h,kl:PTR TO keylink,dat,datl + NEW keyhash.hashtable(HASH_NORMAL) + keylist:=[ + 'PROC','ENDPROC','IF','ENDIF','VOID','WHILE','ENDWHILE','FOR', + 'ENDFOR','SELECT','CASE','DEFAULT','ENDSELECT','REPEAT','UNTIL', + 'JUMP','DEF','ELSE','INCBIN','LONG','INT','CHAR','INC','DEC','THEN', + 'LOOP','ENDLOOP','DO','AND','OR','CONST','OPT','MODULE','STACK', + 'EXIT','LARGE','ASM','NOWARN','TO','STEP','ARRAY','STRING','DIR', + 'PTR','OF','ELSEIF','LIST','OBJECT','ENDOBJECT','SIZEOF','RETURN', + 'OSVERSION','ENUM','SET','BUT','HANDLE','EXCEPT','RAISE','EXPORT', + 'REG','END','IS','NEW','PUBLIC','PRIVATE','SUPER' + ] + FOR a:=0 TO ListLen(keylist)-1 + datl:=StrLen(dat:=keylist[a]) + b,h:=keyhash.find(dat,datl) + NEW kl + kl.token:=a+K_PROC + keyhash.add(kl,h,dat,datl) + ENDFOR +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/Forth.e b/amigae33a/E_v3.3a/Src/Src/Lang/Forth.e new file mode 100644 index 0000000..7db69e9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/Forth.e @@ -0,0 +1,125 @@ +/* TinyForth, a subset Forth interpreter + no functions *yet*, so may be used as funny calculator + with stack. exits on QUIT or */ + +CONST MAXSTACK=1000,MAXRSTACK=200 +ENUM NO_MES,OK,ER_UNDERFLOW,ER_OVERFLOW,ER_SYM + +DEF con=NIL,stop=FALSE,error=OK,crflag=TRUE, + inp[100]:STRING, + item[50]:STRING, item2[50]:STRING, + stack[MAXSTACK]:ARRAY OF LONG, rstack[MAXRSTACK]:ARRAY OF LONG, + sp:PTR TO LONG, rsp:PTR TO LONG + +RAISE "^C" IF CtrlC()=TRUE + +PROC main() HANDLE + con:=Open('CON:0/11/640/100/TinyForth',1005) + IF con + stdout:=con + WriteF('TinyForth interpreter v0.1 (c) 1992 by $#%!\n') + sp:=stack; rsp:=rstack + REPEAT + IF crflag=FALSE THEN WriteF('\n') + SELECT error + CASE OK; WriteF('Ok.\n') + CASE ER_UNDERFLOW; WriteF('STACK UNDERFLOW.\n') + CASE ER_OVERFLOW; WriteF('STACK OVERFLOW.\n') + CASE ER_SYM; WriteF('\s?\n',item) + ENDSELECT + WriteF('>') + ReadStr(con,inp) + CtrlC() + error:=OK; crflag:=TRUE + eval(inp) + UNTIL stop + ENDIF +EXCEPT DO + IF con THEN Close(con) +ENDPROC + +PROC eval(c) + DEF pos,end,symlong,p,i,j,k + pos:=c; end:=c+EstrLen(c) + WHILE (posR "; rpush(pop()) + CASE "R> "; push(rpop()) + CASE "R@ "; i:=rpop(); push(i); rpush(i) + + CASE "< "; push(Not(pop()<=pop())) + CASE "= "; push(pop()=pop()) + CASE "> "; push(Not(pop()>=pop())) + CASE "0< "; push(pop()<0) + CASE "0= "; push(0=pop()) + CASE "0> "; push(pop()>0) + CASE "D< "; push(Not(pop()<=pop())) + CASE "U< "; push(Not(pop()<=pop())) + CASE "NOT "; push(Not(pop())) + + CASE ". "; WriteF('\d ',pop()); crflag:=FALSE + CASE "CR "; WriteF('\n'); crflag:=TRUE + CASE "EMIT"; WriteF('\c',pop()); crflag:=FALSE + CASE "TYPE"; i:=pop(); j:=pop(); FOR k:=1 TO i DO WriteF('\c',j[]++) + CASE "SPAC"; IF Long(item2+4)="E " THEN i:=1 ELSE i:=pop(); FOR j:=1 TO i DO WriteF(' '); crflag:=FALSE + + CASE "+ "; push(pop()+pop()) + CASE "- "; i:=pop(); push(pop()-i) + CASE "* "; push(Mul(pop(),pop())) + CASE "/ "; i:=pop(); push(Div(pop(),i)) + + CASE "ABOR"; sp:=stack + CASE "QUIT"; stop:=TRUE + DEFAULT + IF Int(item)=$2E22 /* ." construction */ + crflag:=FALSE + Write(stdout,item+2,EstrLen(item)-3) + ELSE + IF item[0]="-" THEN p:=item+1 ELSE p:=item + i:=Val(p,{j}) + IF (j=0) THEN error:=ER_SYM + IF p<>item THEN i:=Mul(i,-1) + push(i) + ENDIF + ENDSELECT + ENDWHILE +ENDPROC + +PROC pop() RETURN IF sp<=stack THEN error:=ER_UNDERFLOW ELSE sp[]-- +PROC rpop() RETURN IF rsp<=rstack THEN error:=ER_UNDERFLOW ELSE rsp[]-- +PROC push(val); IF MAXSTACK*4+stack<=sp THEN error:=ER_OVERFLOW ELSE sp[]++:=val; ENDPROC +PROC rpush(val); IF MAXRSTACK*4+rstack<=rsp THEN error:=ER_OVERFLOW ELSE rsp[]++:=val; ENDPROC + +PROC getsym(p) + DEF p2 + p:=TrimStr(p) + IF p[0]="(" + p2:=InStr(p,')',0) + IF p2=-1 THEN p2:=1000 + p:=TrimStr(p+p2+1) + ENDIF + IF p[0]="." AND p[1]=34 + p2:=InStr(p,'"',2) + IF p2=-1 THEN p2:=1000 ELSE INC p2 + StrCopy(item,p,p2) + ELSE + p2:=InStr(p,' ',0) + IF p2=-1 THEN p2:=1000 + StrCopy(item,p,p2) + ENDIF +ENDPROC p+p2+1 diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/Lambda.e b/amigae33a/E_v3.3a/Src/Src/Lang/Lambda.e new file mode 100644 index 0000000..f39deaf --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/Lambda.e @@ -0,0 +1,74 @@ +/* lambda calc evaluator in E, makes heavy use of unification */ + +DEF nchar="a" + +ENUM ATOM,LAMBDA,APP + +PROC ev(exp) + DEF par,body,fun,arg + IF exp <=> [APP,fun,arg] + funval(fun) <=> [LAMBDA,par,body] + RETURN ev(replace(body,par,arg)) + ELSE + RETURN exp + ENDIF +ENDPROC + +PROC funval(exp) + DEF x,y + IF exp <=> [APP,x,y] + RETURN funval(ev(exp)) + ELSEIF exp <=> [ATOM,x] + RETURN funval(getdef(x)) + ELSE + RETURN exp + ENDIF +ENDPROC + +PROC replace(exp,old,new) + DEF fun,arg,par,body,a,n + IF exp <=> [APP,fun,arg] + RETURN NEW [APP,replace(fun,old,new),replace(arg,old,new)] + ELSEIF exp <=> [ATOM,a] + RETURN IF a=old THEN new ELSE exp + ELSEIF exp <=> [LAMBDA,par,body] + new <=> [ATOM,a] + IF par=a + RETURN NEW [LAMBDA,n,replace(replace(body,par,NEW [ATOM,nchar++]),old,new)] + ELSE + RETURN NEW [LAMBDA,par,replace(body,old,new)] + ENDIF + ENDIF +ENDPROC + +PROC pretty(exp) + DEF x,y + IF exp <=> [APP,x,y] + pretty(x) + PutStr(' (') + pretty(y) + PutStr(')') + ELSEIF exp <=> [LAMBDA,x,y] + PrintF('\\\c.',x) + pretty(y) + ELSEIF exp <=> [ATOM,x] + PrintF('\c',x) + ENDIF +ENDPROC + +PROC getdef(a) + SELECT a + CASE "t"; RETURN [LAMBDA,"x",[LAMBDA,"y",[ATOM,"x"]]] + CASE "f"; RETURN [LAMBDA,"x",[LAMBDA,"y",[ATOM,"y"]]] + DEFAULT; Raise() + ENDSELECT +ENDPROC + +PROC main() + DEF exp + exp:=[APP,[APP,[ATOM,"t"],[ATOM,"t"]],[ATOM,"f"]] + pretty(exp) + PutStr(' results in ') + pretty(ev(exp)) -> prints: 't (t) (f) results in t' + PutStr('\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/NGRC.e b/amigae33a/E_v3.3a/Src/Src/Lang/NGRC.e new file mode 100644 index 0000000..05797a6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/NGRC.e @@ -0,0 +1,742 @@ +/* Noise Compiler v1.0 + +Short: The noise compiler is a program that translates source files in + a type of "music programming language" into Noise/ProTracker (tm) + compatible files. + +The noise compiler reads ascii source files containing a description +of a musical piece, and then starts generating a sequence of notes by +recursively walking down your definition. finally, it will load all +samples and write all data to a ProTracker (tm) file. + +A noise grammar program (extension ".ngr") consist of one to unlimited +number of so called "rules" (it really helps if you already know something +about context free grammars). Each rule looks like: + + "->" ";" + +example: + +beat -> drum [C#,1] /* a C-flat */ + { [D,2] | [D#,2] | [Db,2] } /* D, D-sharp, D-flat */ + ( boomboom 1 ); /* index=1 */ + +every token may be separated by a whitespace, which denotes any number of +spaces/tabs/linefeeds, and comments which start with "/*" and end +with "*/", and may be nested infinitely. + +a is one or more s. an can be: + + + +will be recursively replaced by the definition of . + is optional and explained later +example: drum + + "(" ")" + +as , only an optional (default=500, range 0-1000) specifies +the chance of getting rewritten, with 0=no chance at all. +example: + +(beat) (250 beat) + +decide while generating if the defintion for "beat" gets played or +not, resp. 50% and 25% chance. + + "{" "|" ..... "}" + +any number of s may be between the {}, separated by a bar |. + is again optional, and again between 0-1000, only now +the default =1. With no weights, simply one of the s is +picked. examples: + +{ beat | boomboom | [Gb+,4] } /* chances: each 33% */ +{ 3 beat | 7 boomboom } /* chances: 30%,70% resp. */ + + + +an AmigaDos path to a sample, is an optional integer, range 0-64 +example: "samples:guitar.iff" + + "[" "," "]" + +a note specification, see below. + + + +a special effects spec., see below. + +Notes. +a is a character like: C D E F G A B +it may be followed by any number of modifiers, where: + +"#" = sharp +"b" = flat +"+" = octave up +"-" = octave down + +in general, you can get only one octave up/down, and the parser will +give an error if you write something like "E+++" +Any number of "#" and "b" are allowed, only in general you would +write "D" for "C##", or "F" for "E#" etc. Note that the current +version of the noise compiler only allows for C-major. Examples: + +C C (the one in the middle of a piano) +C#+ C-sharp one octave up +Dbb- C one octave down + +for those who are not at all familiar with classical notes, a note +may also be specified as an integer ranging from -12 to 23, with +0 being the middle C again, and negative numbers lower notes. + +the is an integer specifying the time in units spent +on playing the note, before starting the new one, range = 1-100 +A unit is about a quarter of a normal note, so a whole note should +be written "4" etc. examples: + +[C,1] +[F#,4] /* an F-sharp for one second */ + + +Sound Effects. +various souneffects may be used as an hexadecimal integer. +Such an effect only works with the next following note. +Example: + +mainpart -> $E01 drums solo drums + +puts hardware audio filter off before play. See protracker documentation +for a summary of effects. + +Indexing. +while () and {|||} are nice ways to either generate totally random music, or +just make your pieces sound more natural due to some variation, one often +wishes to have the random choices made repeated: for example, if +you design a symbol "beat" that you wish to re-use in certain parts of +your program, and the definition contains some random-variation, you +may want to have the random choices fixed for the second time you use it, +because it would sound totally random otherwise. for example, considering +the pseudo-definition of "beat" above: + +beats -> beat boomboom beat boomboom; + +this looks like a normal rhytm, but "beat" is replaced by two different +sequences of notes. with: + +beats -> beat1 boomboom2 beat1 boomboom2; + +you specify that with the first "beat", the random choices are recorded +and all others that are similar indexed will have their notes generated +according to the first. note that this doesn't work for samples, i.e: + +beats -> "bass.iff" beat1 "hihat.iff" beat1; + +will generate two exactly the same sequences, only played by different +instruments. + + +Symbols and Channels. +A symbol consists of any number of lowercase characters. As the +Amiga plays four channels simulanously, there's not one start +symbol for the grammar, but four, called: "one", "two", "three", +"four". Atleast one of these has to be defined in a grammar. +Example: + +one -> "dat:noiz/Dguitar" 20 aa1; +two -> "dat:noiz/drumz/bassdrum" aa1; + +aa -> a $E00 a $E01 a a; + +a -> { c d c c d d | d d | c d c d | c c }; + +c -> [C,1] [C#,3]; +d -> [D,2] [D,3]; + +plays the sequence "aa" simultanously over two channels, by two +different instruments, with volumes 20 and 64. the sequence "aa" +consists of several instances of "a", while switching filter +on/off. "a" consist of 4 possible sequences, which in turn +consist of notes to be played. (NOTE: don't try these examples, +they no pieces of real music, just "examples") + + +Designing Tunes. +For example, for a small guitar tune, we would start with +a defintion of some notes, a and b + +a -> [D,1] [E,3]; +b -> [D,1] [D#,7]; + +Then, we would combine them into a sequence: + +c -> a a a b; + +Finally, we play those over channel one, and define a sample: + +one -> guitar c c c a [C,16]; /* just one channel */ + +/* our set of instruments */ +guitar -> "dat:noiz/Dguitar"; + +note that notes get played by a certain instrument from the point it +is encountered in the grammar. + + +Using Randomness. +You may use randomness to bring subtle variations into your music, +for example, with: + +mynote -> { 10 [D,2] | 1 [D#,2] | 1 [Db,2] }; + +we define a note that is played like a "D" most of the time, but +occasionally flat or sharp. We can easily do the same thing with +the duration, or even with the order a certain sequence gets played. + +*/ + +OBJECT sym /* primairy structure of rewrite symbols */ + next,type,name,rptr +ENDOBJECT + +OBJECT rlist /* linked list structure for grammar */ + next,type,index,info +ENDOBJECT + +OBJECT optset /* structure for storing { | | } exp. */ + next,rptr,weight +ENDOBJECT + +OBJECT sample /* all data about a given sample */ + path,len,adr,vol +ENDOBJECT + +OBJECT i /* indexing of rewritten trees */ + start,len,isym +ENDOBJECT + +ENUM SYM,OPTSET,OPTION,NOTE,SAMPLE,SFX /* rlist.type */ +ENUM NOTYPE,REWRITE /* sym.type */ +ENUM NOMEM,NOFILE,NOFORM,NOGRAM,STACKFLOW, /* errors */ + BADSTRUCTURE,BREAK,WRITEMOD,READSAMPLE + +CONST MAXINDEX=1000,MAXROWS=64*4*64,MAXDURATION=100 +CONST MAXDATA=MAXROWS*4,MAXSAMPLE=31,MAXNOTE=23,MINNOTE=-12 +CONST PARSE_ER=100,GEN_ER=200,MASK=$0FFF0FFF + +RAISE NOMEM IF New()=NIL, /* define exceptions */ + NOMEM IF String()=NIL, + STACKFLOW IF FreeStack()<1000, + BREAK IF CtrlC()=TRUE + +DEF buf,flen,p,tokeninfo,symlist=NIL:PTR TO sym,ltoken=-1,numsample=0, + notes,np:PTR TO LONG,maxrows=0,cursample=0,cursfx=0,curglob=0,end, + timings:PTR TO INT,fh=NIL,notevals:PTR TO LONG + +DEF sdata[32]:ARRAY OF sample, + itab[MAXINDEX]:ARRAY OF i, + channel[4]:ARRAY OF i, + infile[100]:STRING,outfile[100]:STRING + +PROC main() HANDLE + WriteF('Noise Compiler v1.0\n') + WriteF('Translates NoiseGrammar programs into ProTracker modules!\n') + readgrammar() + WriteF('grammar "\s" loaded. Parsing...\n',infile) + parsegrammar() + WriteF('Grammar parsed succesfully. Generating...\n') + generate() + WriteF('Noise generated. Now loading samples...\n') + loadsamples() + WriteF('Now saving to file "\s".\n',outfile) + writemodule() + WriteF('done.\n') +EXCEPT + IF fh THEN Close(fh) /* lowest level exception handler: */ + WriteF('Terminating: ') /* general error report */ + SELECT exception + CASE NOFILE; WriteF('Could not load "\s" grammar file!\n',infile) + CASE NOMEM; WriteF('Not enough memory!\n') + CASE NOFORM; WriteF('Grammar format error!\n') + CASE STACKFLOW; WriteF('Stack overflow! (too heavy recursion?)\n') + CASE BADSTRUCTURE; WriteF('Problems while generating.\n') + CASE NOGRAM; WriteF('No rules rewritten!\n') + CASE BREAK; WriteF('Stopped by user\n') + CASE WRITEMOD; WriteF('Unable to write PT module "\s"!\n',outfile) + CASE READSAMPLE; WriteF('Unable to read sample(s)!\n') + ENDSELECT + DeleteFile(outfile) +ENDPROC + +PROC readgrammar() + StrCopy(infile,arg,ALL) + StrAdd(infile,'.ngr',ALL) /* '#?.ngr' = NoizGRammar */ + StrCopy(outfile,arg,ALL) /* '#?.mod' = ProTracker format */ + StrAdd(outfile,'.mod',ALL) + IF (flen:=FileLength(infile))<1 THEN Raise(NOFILE) + IF (fh:=Open(infile,OLDFILE))=NIL THEN Raise(NOFILE) + IF Read(fh,buf:=New(flen+1),flen)<>flen THEN Raise(NOFILE) + Close(fh) + fh:=NIL + buf[flen]:=";" /* for parser */ +ENDPROC + +/* this is the parser part. we use a simple but powerfull top-down + parser, and build our syntax tree here. */ + +ENUM ER_UNTOKEN=PARSE_ER,ER_UNEXPECTED,ER_QUOTE,ER_SYMEXP,ER_DOUBLE, + ER_ARROWEXP,ER_RPARENTHEXP,ER_RBRACEEXP,ER_EMPTY,ER_EOLEXP,ER_RANGE, + ER_COMMENT,ER_UNDEF,ER_RBRACKETEXP,ER_MAXSAMPLE,ER_NOSAMPLE, + ER_INTEGEREXP,ER_COMMAEXP,ER_NOTEEXP + +ENUM EOF,EOL,ARROW,BAR,COMMA, /* ; -> | , */ + RSYM,INTEGER,HEXINTEGER, /* sym 100 $E01 */ + ISTRING,NOTEVAL, /* "" C#+ */ + LBRACE,RBRACE,LPARENTH, /* { } ( */ + RPARENTH,LBRACKET,RBRACKET /* ) [ ] */ + +PROC parsegrammar() HANDLE + DEF end,spot,sl:PTR TO sym,s,i + notevals:=[9,11,0,2,4,5,7] + p:=buf + WHILE parserule() DO NOP + p:=NIL + IF (sl:=symlist)=NIL THEN Raise(NOGRAM) + IF numsample=0 THEN Raise(ER_NOSAMPLE) + REPEAT + IF sl.type=NOTYPE /* check for undefined symbols */ + s:=sl.name + Raise(ER_UNDEF) + ENDIF + UNTIL (sl:=sl.next)=NIL +EXCEPT /* re-throw if unknown exception */ + IF exception>=PARSE_ER THEN WriteF('ERROR: ') ELSE Raise(exception) + WriteF(ListItem(['Unexpected lexical item\n', + 'Unexpected characters in line!\n', + 'Unmatched quote "\n', + 'Symbol expected\n', + 'Double definition of symbol\n', /* language errors */ + '"->" expected\n', + '")" expected\n', + '"}" expected\n', + 'Empty rewrite-list\n', + 'End of rule expected\n', + 'Integer/Note value out of range\n', + 'Incorrectly nested comment(s)\n', + 'No rule defined for symbol "\s"\n', + '"]" expected\n', + 'Maximum of 32 samples exceeded\n', + 'Grammar needs atleast one sample\n', + 'Integer expected\n', + '"," expected\n', + 'Note expected'],exception-PARSE_ER),s) + IF p /* display very nice error indication */ + IF p[-1]=";" THEN DEC p + spot:=p + WHILE (p[]--<>";") AND (p[]<>10) AND (p<>buf) DO NOP + INC p + spot:=spot-p+5 + end:=p + WHILE (end[]<>";") AND (end[]++<>10) DO NOP + end[]--:=0 + WriteF('LINE: \s\n',p) + FOR i:=1 TO spot DO WriteF(' ') + WriteF('^\n') + ENDIF + Raise(NOFORM) +ENDPROC + +PROC parserule() + DEF token,csym:PTR TO sym + IF (token:=gettoken())=EOF + RETURN FALSE + ELSEIF token=RSYM + csym:=tokeninfo + IF csym.type<>NOTYPE THEN Raise(ER_DOUBLE) + IF gettoken()<>ARROW THEN Raise(ER_ARROWEXP) + csym.rptr:=parseitemlist() + csym.type:=REWRITE + IF gettoken()<>EOL THEN Raise(ER_EOLEXP) + ELSE + Raise(ER_SYMEXP) + ENDIF +ENDPROC TRUE + +PROC parseitemlist() + DEF item:PTR TO rlist,prev:PTR TO rlist,ilist=NIL + prev:={ilist} + WHILE (item:=parseitem())<>NIL + prev.next:=item + prev:=item + ENDWHILE + IF ilist=NIL THEN Raise(ER_EMPTY) +ENDPROC ilist + +PROC parseitem() + DEF token,item:PTR TO rlist,t2,prev:PTR TO optset, + curr:PTR TO optset,olist,totalw=0 + token:=gettoken() + IF token=RSYM + item:=New(SIZEOF rlist) + item.type:=SYM + item.info:=tokeninfo + IF (t2:=gettoken())=INTEGER + item.index:=checkinfo(1,MAXINDEX-1) + ELSE + putback(t2) + item.index:=0 + ENDIF + ELSEIF token=ISTRING + item:=New(SIZEOF rlist) + item.type:=SAMPLE + sdata[numsample].path:=tokeninfo + IF (t2:=gettoken())=INTEGER + sdata[numsample].vol:=checkinfo(0,64) + ELSE + putback(t2) + sdata[numsample].vol:=64 + ENDIF + item.info:=numsample++ + IF numsample=MAXSAMPLE THEN Raise(ER_MAXSAMPLE) + ELSEIF token=LBRACE /* parse { | | ... } */ + item:=New(SIZEOF rlist) + item.type:=OPTSET + prev:={olist} + REPEAT + curr:=New(SIZEOF optset) + IF (token:=gettoken())=INTEGER /* check for weight */ + curr.weight:=checkinfo(0,1000) + ELSE + curr.weight:=1 + putback(token) + ENDIF + totalw:=totalw+curr.weight + curr.rptr:=parseitemlist() + prev.next:=curr + prev:=curr + UNTIL (token:=gettoken())<>BAR + IF token<>RBRACE THEN Raise(ER_RBRACEEXP) + item.info:=olist + item.index:=totalw /* we store weight here */ + ELSEIF token=LPARENTH + item:=New(SIZEOF rlist) /* parse ( ) */ + item.type:=OPTION + IF (token:=gettoken())=INTEGER /* check for weight */ + item.index:=checkinfo(0,1000) + ELSE + item.index:=500 + putback(token) + ENDIF + item.info:=parseitemlist() + IF gettoken()<>RPARENTH THEN Raise(ER_RPARENTHEXP) + ELSEIF token=LBRACKET + item:=New(SIZEOF rlist) /* parse [note,duration] */ + item.type:=NOTE + token:=gettoken() + IF (token<>INTEGER) AND (token<>NOTEVAL) THEN Raise(ER_NOTEEXP) + item.info:=checkinfo(MINNOTE,MAXNOTE) + IF gettoken()<>COMMA THEN Raise(ER_COMMAEXP) + IF gettoken()<>INTEGER THEN Raise(ER_INTEGEREXP) + item.index:=checkinfo(1,MAXDURATION) + IF gettoken()<>RBRACKET THEN Raise(ER_RBRACKETEXP) + ELSEIF token=HEXINTEGER + item:=New(SIZEOF rlist) /* parse $SFX */ + item.type:=SFX + item.info:=checkinfo(0,$FFF) + ELSEIF (token=EOL) OR (token=RBRACE) OR (token=RPARENTH) OR (token=BAR) + putback(token) + RETURN NIL + ELSE + Raise(ER_UNTOKEN) + ENDIF +ENDPROC item + +/* the lexical analyser: called by the parser each time it + needs a token. attribute values are in "tokeninfo". allows + for one symbol lookahead, with putback() function */ + +PROC gettoken() + DEF c,x,start,len,syml:PTR TO sym,s,depth + FreeStack(); CtrlC() + IF ltoken<>-1 + x:=ltoken + ltoken:=-1 + RETURN x + ENDIF + tokeninfo:=0 + parse: + c:=p[]++ + SELECT c + CASE ";"; RETURN IF buf+flen

p++ + IF (p[0]="/") AND (p[1]="*") + INC depth + INC p + ENDIF + IF (p[0]="*") AND (p[1]="/") + DEC depth + INC p + ENDIF + IF depth=0 + INC p + BRA parse + ENDIF + ENDWHILE + p:=x + Raise(ER_COMMENT) + ENDIF + Raise(ER_UNEXPECTED) + CASE 34 + start:=p + WHILE (p[]<>";") AND (p[]<>10) AND (p[]++<>34) DO NOP + IF p[-1]=";" THEN p-- BUT Raise(ER_QUOTE) + len:=p-start-1 + tokeninfo:=String(len) + StrCopy(tokeninfo,start,len) + RETURN ISTRING + DEFAULT + IF (c>="a") AND (c<="z") + start:=p-- + WHILE (p[]>="a") AND (p[]++<="z") DO NOP + len:=p---start + s:=String(len) + StrCopy(s,start,len) + syml:=symlist + WHILE syml + IF StrCmp(s,syml.name,ALL) THEN BRA found + syml:=syml.next + ENDWHILE + syml:=New(SIZEOF sym) + syml.next:=symlist + syml.name:=s + syml.type:=NOTYPE + symlist:=tokeninfo:=syml + RETURN RSYM + found: + tokeninfo:=syml + RETURN RSYM + ELSEIF (c>="A") AND (c<="G") + tokeninfo:=notevals[c-"A"] + LOOP + x:=p[]++ + SELECT x + CASE "+"; tokeninfo:=tokeninfo+12 /* octave up */ + CASE "-"; tokeninfo:=tokeninfo-12 /* octave down */ + CASE "#"; tokeninfo:=tokeninfo+1 /* sharp */ + CASE "b"; tokeninfo:=tokeninfo-1 /* flat */ + DEFAULT + DEC p + RETURN NOTEVAL + ENDSELECT + ENDLOOP + ELSEIF ((c>="0") AND (c<="9")) OR (c="-") OR (c="$") + tokeninfo,x:=Val(p--) + p:=p+x + RETURN IF c="$" THEN HEXINTEGER ELSE INTEGER + ENDIF + IF c>32 THEN Raise(ER_UNEXPECTED) ELSE BRA parse + ENDSELECT +ENDPROC + +PROC putback(token) + ltoken:=token +ENDPROC + +PROC checkinfo(min,max) RETURN IF (tokeninfomax) THEN + Raise(ER_RANGE) ELSE tokeninfo + +ENUM NOCHANNEL=GEN_ER,LARGESONG,CROSSINDEX + +PROC generate() HANDLE + DEF x,ci:PTR TO i,syms:PTR TO LONG,numc=0 + Rnd(-Shl(VbeamPos(),14)) /* initialise seed */ + ci:=itab + FOR x:=0 TO MAXINDEX-1 DO ci[].start++:=NIL + ci:=channel + timings:=[856,808,762,720,678,640,604,570,538,508,480,453, + 428,404,381,360,339,320,302,285,269,254,240,226, + 214,202,190,180,170,160,151,143,135,127,120,113]:INT + /* C- C#- D- D#- E- F- F#- G- G#- A- A#- B- + C C# D D# E F F# G G# A A# B + C+ C#+ D+ D#+ E+ F+ F#+ G+ G#+ A+ A#+ B+ */ + WriteF('s\d\n',MAXDURATION*4+100+MAXDATA) + np:=notes:=New(MAXDURATION*4+100+MAXDATA) + end:=np+MAXDATA + syms:=['one','two','three','four'] + FOR x:=0 TO 3 + ci[x].start:=np + IF findsym(syms[x]) + ci[x].len:=np-ci[x].start + IF ci[x].len>maxrows THEN maxrows:=ci[x].len + INC numc + ELSE + ci[x].start:=NIL + ENDIF + ENDFOR + IF numc=0 THEN Raise(NOCHANNEL) + IF maxrows=0 THEN Raise(NOGRAM) + IF maxrows>MAXROWS THEN Raise(LARGESONG) +EXCEPT + IF exception>=GEN_ER THEN WriteF('ERROR: ') + SELECT exception + CASE NOCHANNEL; WriteF('Atleast one channel must be defined\n') + CASE LARGESONG; WriteF('Song too large!\n') + CASE CROSSINDEX; WriteF('No cross-symbol indexing allowed\n') + DEFAULT; Raise(exception) /* re-throw if unknown */ + ENDSELECT + Raise(BADSTRUCTURE) /* terminate */ +ENDPROC + +PROC findsym(name) + DEF s:PTR TO sym + s:=symlist + WHILE s + IF StrCmp(s.name,name,ALL) THEN BRA.S continue + s:=s.next + ENDWHILE + RETURN FALSE + continue: + rewritelist(s.rptr) +ENDPROC TRUE + +PROC rewritelist(list:PTR TO rlist) + WHILE list + rewritesym(list) + list:=list.next + ENDWHILE +ENDPROC + +PROC rewritesym(rsym:PTR TO rlist) + DEF t,sl:PTR TO sym,rnd,c1,c2,ol:PTR TO optset,x,i,st:PTR TO LONG,l,n + FreeStack(); CtrlC() + t:=rsym.type + SELECT t + CASE SYM + sl:=rsym.info + IF i:=rsym.index + st:=itab[i].start + l:=itab[i].len + IF st + IF np+l>=end THEN Raise(LARGESONG) + IF sl<>itab[i].isym THEN Raise(CROSSINDEX) + l:=Shr(l,2) + IF l THEN FOR x:=1 TO l DO np[]++:=IF n:=st[]++ THEN + n AND MASK OR curglob ELSE 0 + ELSE + st:=np + rewritelist(sl.rptr) + itab[i].len:=np-st + itab[i].start:=st + itab[i].isym:=sl + ENDIF + ELSE + rewritelist(sl.rptr) + ENDIF + CASE OPTION + IF Rnd(1001)=c1) AND (rnd1 THEN FOR x:=2 TO rsym.index DO np[]++:=0 + IF np>=end THEN Raise(LARGESONG) + cursfx:=0 + CASE SAMPLE + cursample:=rsym.info + curglob:=Shl(cursample+1 AND $F,12) OR Shl(cursample+1 AND $F0,24) + CASE SFX + cursfx:=rsym.info + ENDSELECT +ENDPROC + +PROC loadsamples() HANDLE + DEF s:PTR TO sample,i,l,r,f:PTR TO LONG + s:=sdata + FOR i:=1 TO numsample + IF (l:=FileLength(s.path))<10 THEN Raise(0) + s.len:=l + s.adr:=New(l) + IF (fh:=Open(s.path,OLDFILE))=NIL THEN Raise(0) + r:=Read(fh,s.adr,l) + Close(fh) + fh:=NIL + IF r<10 THEN Raise(0) + f:=s.adr + IF f[]="FORM" + WHILE f[]++<>"BODY" DO IF s.adr+l=numsample + Write(fh,[0,0,0,0,0,0,0,0],30) + ELSE + Write(fh,sdata[x].path,21) + Out(fh,0) + Write(fh,[wl,sdata[x].vol,0,1]:INT,8) /* or [,,wl,] */ + ENDIF + ENDFOR + IF (pnum:=maxrows/256)*256<>maxrows THEN INC pnum + Out(fh,pnum) + Out(fh,120) /* 127 */ + FOR x:=0 TO pnum-1 DO Out(fh,x) + FOR x:=pnum TO 127 DO Out(fh,0) + Write(fh,["M.K."],4) + nument:=pnum*64-1 + FOR x:=0 TO nument + FOR n:=0 TO 3 + ch:=channel[n].start + IF ch + len:=channel[n].len + IF len + dat[n]:=ch[]++ + channel[n].start:=ch + channel[n].len:=len-4 + ELSE + dat[n]:=0 + ENDIF + ELSE + dat[n]:=0 + ENDIF + ENDFOR + Write(fh,dat,16) + ENDFOR + FOR x:=0 TO numsample-1 + Write(fh,sdata[x].adr,sdata[x].len) + ENDFOR + Close(fh) + fh:=NIL +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/Yax/QuickSort.yax b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/QuickSort.yax new file mode 100644 index 0000000..189c8f9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/QuickSort.yax @@ -0,0 +1,83 @@ +/* quick sort in yax, by Ben Schaeffer Nov 1993 */ +(write 'Enter array size: ''') +(set size (readint)) +(array original size) +(array test size) +(set pivot 0) + +/* guess at stack size*/ +(array stack (/ (+ 1 size) 2)) +(set sp 0) + +/* set up original values */ +(for i 0 (- size 1) + (set (original i) (rnd 1000)) +) + +/* set up test values */ +(for i 0 (- size 1) + (set (test i) (original i)) +) + +/* quick sort functions defined here */ + +/* this function must only change pivot */ +(defun partition (low high) + (when (? pivot low) + (set temp (test low)) + (set (test low) (test pivot)) + (set (test pivot) temp) + ) + (set pivot low) + (inc low) + /* now organize data such that all values greater than pivot will be */ + /* gathered on the higher end of the array and all values less than */ + /* pivot will be on the lower end of the array */ + (while (not (> low high)) + (if (not (> (test low) (test pivot))) + (inc low) + (if (> (test high) (test pivot)) + (dec high) + (do + (set temp (test low)) + (set (test low) (test high)) + (set (test high) temp) + ) + ) + ) + ) + /* this repositions pivot so that it is truly in its ordered location */ + (when (? high pivot) + (set temp (test high)) + (set (test high) (test pivot)) + (set (test pivot) temp) + ) + (set pivot high) +) + + +(defun quicksort (lo hi) + (when (< lo hi) + (set pivot (/ (+ lo hi) 2)) + (partition lo hi) + (when (< lo pivot) + (quicksort lo (- pivot 1)) + ) + (when (> hi pivot) + (quicksort (+ pivot 1) hi) + ) + ) +) + +(write 'beginning quick sort') +(quicksort 0 (- size 1)) +(write 'ended quick sort')(readint) + +(write 'checking order') +/* show sorted array */ +(for i 1 (- size 1) + (when (< (test 1) (test 0)) + (write (test i)' _ ' i) + ) +) +(write 'done') \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/Yax/Yax.e b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/Yax.e new file mode 100644 index 0000000..623052b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/Yax.e @@ -0,0 +1,742 @@ +/* YAX (Yet Another Instruction Code Set) Interpreter v1.2 + simple procedural/(functional) language with lisp-lookalike syntax. + eats sources with extension .yax for dinner. */ + +-> note: code is a little oldfashioned by now + +OPT STACK=25000 /* we do heavy recursion */ + +OBJECT var /* this is where we store our runtime values */ + type:LONG + name:LONG + value:LONG +ENDOBJECT + +/* intermediate codes */ +ENUM ENDSOURCE,VALUE,ISTRING,IDENT,LBRACKET,RBRACKET + +/* keywords */ +ENUM FWRITE=100,FADD,FEQ,FUNEQ,FSUB,FMUL,FDIV,FAND,FORX,FNOT,FIF,FDO, + FSELECT,FSET,FFOR,FWHILE,FUNTIL,FDEFUN,FLAMBDA,FAPPLY,FREADINT, + FARRAY,FGREATER,FSMALLER,FLOCATE,FCLS,FDUMP,FWINDOW,FTELL,FTOLD, + FSEE,FSEEN,FSTRING,FREAD,FGET,FPUT,FFILELEN,FLINE,FPLOT,FBOX, + FMOUSEX,FMOUSEY,FMOUSE,FTEXT,FABS,FMOD,FEOR,FSWAP,FPOWER,FREQ, + FINC,FDEC,FRND,FRNDQ,FKICK,FWHEN,FELSE,FWIN,FSCREEN,FMESSAGE, + FGADGET,FGADNUM,FHEX,FEXIT,LAST + +CONST KEYWORDSIZE=8, + NRKEYWORDS=LAST-99, + IDENTNAMESPACE=30000, + VARSTACKSPACE=50000, + MAXARGS=5, + ERLEN=60 + +/* errors */ +ENUM ER_WORKSPACE=1,ER_BUF,ER_GARBAGE,ER_SYNTAX,ER_EXPKEYWORD,ER_EXPRBRACKET, + ER_EXPEXP,ER_QUOTE,ER_COMMENT,ER_INFILE,ER_SOURCEMEM,ER_EXPIDENT, + ER_ARGS,ER_TYPE,ER_EXPLBRACKET,ER_STACK,ER_ALLOC,ER_ARRAY,ER_FILE, + ER_GFXWIN,ER_VALUES,ER_KICK + +/* variable types */ +ENUM TINTEGER=1,TSTRING,TFUNC,TARRAY + +DEF source,slen,erpos=NIL, + ilen,ibuf,ipos:PTR TO INT,p:PTR TO INT,idents, + name[100]:STRING,wfile, + inputbuf[100]:STRING,winspec[100]:STRING, + vartop,varbottom,vars,rec,globvar, + infile,outfile,oldout,oldin,ownstdin, + gfxwindow=NIL,curwindow=NIL,curscreen=NIL,gadnum=-1 + +PROC main() + WriteF(''); ownstdin:=stdout + loadsource() + ilen:=Mul(slen,4)+1000 /* guess the needed workspace */ + ibuf:=New(ilen+10) + idents:=String(IDENTNAMESPACE) + vars:=New(VARSTACKSPACE) + vartop:=vars; varbottom:=vars + IF (ibuf=NIL) OR (idents=NIL) OR (vars=NIL) + error(ER_WORKSPACE) + ELSE + lexanalyse() /* translate to intermediate format */ + p:=ibuf + WHILE p[]<>ENDSOURCE DO eval() /* run the code */ + ENDIF + error(0) +ENDPROC + +PROC lexanalyse() + DEF pos,end,c,count,ident[50]:STRING,pos2,keypos,a,nr,ident2[50]:STRING + pos:=source; end:=pos+slen; ipos:=ibuf; erpos:=pos + StrCopy(idents,' ',1) + loop: + c:=pos[]++ + IF c>96 /* an identifier */ + pos2:=pos-1 + WHILE pos[]++>96 DO NOP; DEC pos + StrCopy(ident,pos2,pos-pos2) + StrCopy(ident2,ident,ALL) + StrAdd(ident,'..............',ALL) + keypos:={keywords} + nr:=0 + FOR a:=1 TO NRKEYWORDS /* lookup keywords */ + IF StrCmp(ident,keypos,KEYWORDSIZE) + nr:=99+a + JUMP found + ENDIF + keypos:=keypos+KEYWORDSIZE + ENDFOR + found: + IF nr>0 /* keyword */ + iword(nr) + ELSE /* own identifier */ + iword(IDENT) + StrCopy(ident,' ',1) + StrAdd(ident,ident2,ALL) + StrAdd(ident,' ',1) + pos2:=InStr(idents,ident,0) + IF pos2=-1 + ilong(EstrLen(idents)+idents) + StrAdd(idents,ident2,ALL) + StrAdd(idents,' ',1) + IF EstrLen(idents)=StrMax(idents) THEN error(ER_WORKSPACE) + ELSE + ilong(pos2+idents+1) + ENDIF + ENDIF + ELSE + SELECT c /* anything else */ + CASE " " + IF pos"*" + iword(FDIV) + ELSE /* comment (like this one) */ + INC pos + WHILE pos-1" + iword(FGREATER) + CASE "<" + iword(FSMALLER) + CASE "?" + iword(FUNEQ) + CASE "'" /* string constant */ + iword(ISTRING) + count:=0; pos2:=pos + WHILE pos[]++<>"'" + INC count + IF pos=end THEN error(ER_QUOTE) + ENDWHILE + iword(count) + ilong(pos2) /* char adress */ + CASE 10 + IF posTARRAY THEN error(ER_TYPE) + x:=adr.value + a:=eval() + IF (a<0) OR (a>x[]) THEN error(ER_ARRAY) + r:=x[a+1] + ENDIF + ELSE + IF ins<100 THEN error(ER_EXPKEYWORD) + SELECT ins + CASE FWRITE /* output string constants + expressions */ + x:=TRUE + WHILE p[]<>RBRACKET + IF p[]=ISTRING + Write(stdout,Long(p+4),p[1]) + IF (p[1]=0) AND (p[4]=RBRACKET) THEN x:=FALSE + p:=p+8 + ELSEIF p[]=IDENT + IF (Int(findvar(Long(p+2)))=TSTRING) + WriteF('\s',eatstring()) + ELSE + WriteF('\d',eval()) + ENDIF + ELSE + WriteF('\d',eval()) + ENDIF + ENDWHILE + IF x THEN WriteF('\n') + CASE FEQ + r:=TRUE + x:=eval() + WHILE p[]<>RBRACKET DO IF x<>eval() THEN r:=FALSE + CASE FUNEQ; r:=eval()<>eval() + CASE FGREATER; r:=eval()>eval() + CASE FSMALLER; r:=eval()RBRACKET DO r:=r+eval() + CASE FSUB; r:=eval(); WHILE p[]<>RBRACKET DO r:=r-eval() + CASE FMUL; r:=eval(); WHILE p[]<>RBRACKET DO r:=Mul(r,eval()) + CASE FDIV; r:=eval(); WHILE p[]<>RBRACKET DO r:=r/eval() + CASE FAND; r:=eval(); WHILE p[]<>RBRACKET DO r:=r AND eval() + CASE FORX; r:=eval(); WHILE p[]<>RBRACKET DO r:=r OR eval() + CASE FEOR; r:=eval(); WHILE p[]<>RBRACKET DO r:=Eor(r,eval()) + CASE FNOT; r:=Not(eval()) + CASE FABS; r:=Abs(eval()) + CASE FRND; r:=Rnd(eval()) + CASE FRNDQ; r:=RndQ(eval()) + CASE FKICK; r:=KickVersion(eval()) + CASE FMOD; r:=Mod(eval(),eval()) + CASE FWHEN + IF eval() + WHILE (p[]<>FELSE) AND (p[]<>RBRACKET) DO r:=eval() + IF p[]=FELSE + p++ + WHILE (p[]<>RBRACKET) DO skip() + ENDIF + ELSE + WHILE (p[]<>FELSE) AND (p[]<>RBRACKET) DO skip() + IF p[]=FELSE + p++ + WHILE (p[]<>RBRACKET) DO r:=eval() + ENDIF + ENDIF + CASE FIF + IF eval() + r:=eval() + IF p[]<>RBRACKET THEN skip() + ELSE + skip() + IF p[]<>RBRACKET THEN r:=eval() + ENDIF + CASE FDO; WHILE p[]<>RBRACKET DO r:=eval() + CASE FSELECT + x:=eval() + WHILE p[]<>RBRACKET DO IF x=eval() THEN r:=eval() ELSE skip() + CASE FSET + IF p[]=LBRACKET + p:=p+2 + erpos:=^p++ + x:=varvalue(eatident(),TARRAY) + a:=eval() + IF (a<0) OR (a>x[0]) THEN error(ER_ARRAY) + IF p[]++<>RBRACKET THEN error(ER_EXPRBRACKET) + x[a+1]:=eval() + ELSE + x:=eatident() + IF (p[]=LBRACKET) AND (p[3]=FLAMBDA) + p:=p+8 + adr:=findvar(x) + letvar(adr,p,TFUNC) + WHILE p[]<>RBRACKET DO skip() + p:=p+2 + ELSEIF p[]=ISTRING + r:=eatstring() + x:=findvar(x) + letvar(x,r,TSTRING) + ELSE + r:=eval() + x:=findvar(x) + letvar(x,r,TINTEGER) + ENDIF + ENDIF + CASE FINC + x:=eatident() + r:=varvalue(x,TINTEGER) + x:=findvar(x) + letvar(x,r+1,TINTEGER) + CASE FDEC + x:=eatident() + r:=varvalue(x,TINTEGER) + x:=findvar(x) + letvar(x,r-1,TINTEGER) + CASE FSWAP + x:=eatident() + r:=varvalue(x,TINTEGER) + x:=findvar(x) + adr:=eatident() + a:=varvalue(adr,TINTEGER) + adr:=findvar(adr) + letvar(x,a,TINTEGER) + letvar(adr,r,TINTEGER) + r:=0 + CASE FPOWER + r:=adr:=eval() + x:=eval() + IF x>1 THEN FOR a:=2 TO x DO r:=r*adr + CASE FFOR + x:=eatident() + r:=eval() + adr:=findvar(x) + x:=eval() + p2:=p + IF r>x /* downto */ + FOR a:=r TO x STEP -1 + p:=p2 + letvar(adr,a,TINTEGER) + WHILE p[]<>RBRACKET DO eval() + ENDFOR + ELSE + FOR a:=r TO x + p:=p2 + letvar(adr,a,TINTEGER) + WHILE p[]<>RBRACKET DO eval() + ENDFOR + ENDIF + r:=0 + CASE FWHILE + p2:=p + WHILE eval() + WHILE p[]<>RBRACKET DO eval() + p:=p2 + ENDWHILE + WHILE p[]<>RBRACKET DO skip() + r:=0 + CASE FUNTIL + p2:=p + WHILE eval()=FALSE + WHILE p[]<>RBRACKET DO eval() + p:=p2 + ENDWHILE + WHILE p[]<>RBRACKET DO skip() + r:=0 + CASE FDEFUN + x:=eatident() + adr:=findvar(x) + letvar(adr,p,TFUNC) + WHILE p[]<>RBRACKET DO skip() + CASE FLAMBDA; error(ER_SYNTAX) + CASE FAPPLY + IF p[]<>IDENT + IF (p[]<>LBRACKET) OR (p[3]<>FLAMBDA) THEN error(ER_EXPIDENT) + p:=p+8; adr:=p + WHILE p[]<>RBRACKET DO skip() + p:=p+2 + r:=dofunc(adr) + ELSE + p:=p+2 + r:=dofunc(varvalue(^p++,TFUNC)) + ENDIF + CASE FREADINT + IF ReadStr(ownstdin,inputbuf)=-1 + r:=0 + ELSE + r:=Val(inputbuf) + ENDIF + CASE FARRAY + adr:=findvar(eatident()) + a:=eval() + x:=New(Mul(a,4)+8) + IF x=NIL THEN error(ER_ALLOC) + letvar(adr,x,TARRAY) + x[]++:=a + WHILE (p[]++=VALUE) + IF a-->=0 THEN x[]++:=^p++ ELSE p:=p+4 + ENDWHILE + p-- + CASE FLOCATE; WriteF('\e[\d;\dH',eval(),eval()) + CASE FCLS; Out(stdout,12) + CASE FDUMP + adr:=varbottom + WriteF('\n') + WHILE adr" " DO INC x + Write(stdout,a,x-a) + x:=adr.type + SELECT x + CASE TINTEGER; WriteF(' = \d (int)\n',adr.value) + CASE TSTRING; WriteF(' = "\s" (string)\n',adr.value) + CASE TFUNC; WriteF(' (function)\n') + CASE TARRAY; WriteF('[\d] (array)\n',Long(adr.value)) + ENDSELECT + adr:=adr+SIZEOF var + ENDWHILE + WriteF('\n') + CASE FWINDOW + StringF(winspec,'CON:\d/\d/\d/\d/',eval(),eval(),eval(),eval()) + x:=eatstring() + StrAdd(winspec,x,ALL) + wfile:=Open(winspec,1006) + IF wfile=NIL THEN error(ER_FILE) + IF conout<>NIL THEN Close(conout) + stdout:=wfile + conout:=stdout + ownstdin:=stdout + adr:=OpenWorkBench() + Forbid() + a:=NIL + IF adr<>NIL + adr:=Long(adr+4) + WHILE (adr<>NIL) AND (a=NIL) + IF StrCmp(x,Long(adr+32),ALL) THEN a:=adr + adr:=^adr + ENDWHILE + ENDIF + Permit() + IF a THEN gfxwindow:=a + CASE FREQ + IF KickVersion(37)=FALSE THEN error(ER_KICK) + r:=EasyRequestArgs(IF curwindow THEN curwindow ELSE NIL, + [20,0,eatstring(),eatstring(),eatstring()],0,NIL) + CASE FTELL + IF outfile<>NIL THEN Close(outfile) + outfile:=NIL + outfile:=Open(eatstring(),1006) + IF outfile=NIL THEN error(ER_FILE) + oldout:=stdout + stdout:=outfile + CASE FTOLD + IF outfile<>NIL THEN Close(outfile) + outfile:=NIL + stdout:=oldout + CASE FSEE + IF infile<>NIL THEN Close(infile) + infile:=NIL + infile:=Open(eatstring(),1005) + IF infile=NIL THEN error(ER_FILE) + oldin:=ownstdin + ownstdin:=infile + CASE FSEEN + IF infile<>NIL THEN Close(infile) + infile:=NIL + ownstdin:=oldin + CASE FSTRING + adr:=String(250) + IF adr=NIL THEN error(ER_ALLOC) + letvar(findvar(eatident()),adr,TSTRING) + CASE FREAD + x:=varvalue(eatident(),TSTRING) + r:=ReadStr(ownstdin,x) + CASE FGET; r:=Inp(ownstdin) + CASE FPUT; r:=eval(); IF r<>-1 THEN Out(stdout,r) + CASE FFILELEN + r:=FileLength(eatstring()) + IF r=-1 THEN r:=0 + CASE FLINE; getrast(); Line(eval(),eval(),eval(),eval(),eval()) + CASE FPLOT; getrast(); Plot(eval(),eval(),eval()) + CASE FBOX + getrast() + a:=eval(); x:=eval(); p2:=eval(); r:=eval() + IF a>p2 + adr:=a; a:=p2; p2:=adr + ENDIF + IF x>r + adr:=x; x:=r; r:=adr + ENDIF + IF (a<0) OR (x<0) OR (p2>10000) OR (r>10000) THEN error(ER_VALUES) + Box(a,x,p2,r,eval()) + r:=0 + CASE FMOUSEX; r:=MouseX(getwin()) + CASE FMOUSEY; r:=MouseY(getwin()) + CASE FMOUSE; r:=Mouse() + CASE FTEXT + adr:=getrast() + a:=eval(); x:=eval() + Colour(eval(),eval()) + TextF(a,x,eatstring()) + r:=0 + CASE FMESSAGE + r:=WaitIMessage(getwin()) + gadnum:=IF (r=$20) OR (r=$40) THEN Long(MsgIaddr()+40) ELSE -1 + CASE FGADNUM + r:=gadnum + CASE FGADGET + IF (adr:=New(GADGETSIZE))=NIL THEN error(ER_ALLOC) + Gadget(adr,NIL,eval(),0,eval(),eval(),eval(),eatstring()) + AddGadget(getwin(),adr,-1) + RefreshGList(adr,getwin(),NIL,1) + CASE FSCREEN + CloseS(curscreen) + curscreen:=NIL + curscreen:=OpenS(eval(),eval(),eval(),eval(),eatstring()) + CASE FWIN + CloseW(curwindow) + curwindow:=NIL + gfxwindow:=NIL + curwindow:=OpenW(eval(),eval(),eval(),eval(), + eval(),eval(),eatstring(), + IF curscreen THEN curscreen ELSE NIL, + IF curscreen THEN 15 ELSE 1,NIL) + gfxwindow:=curwindow + CASE FHEX + WriteF('$\z\h[8]',eval()) + CASE FEXIT + error(0) + ENDSELECT + ENDIF + IF p[]++<>RBRACKET THEN error(ER_EXPRBRACKET) + DEFAULT + IF (i=RBRACKET) OR (i=ISTRING) THEN error(ER_EXPEXP) ELSE error(ER_SYNTAX) + ENDSELECT +ENDPROC r + +PROC getwin() + IF gfxwindow=NIL THEN error(ER_GFXWIN) +ENDPROC gfxwindow + +PROC getrast() + DEF r + IF curwindow=NIL + IF curscreen=NIL + IF gfxwindow=NIL THEN error(ER_GFXWIN) + r:=Long(gfxwindow+50) + ELSE + r:=curscreen+84 + ENDIF + ELSE + r:=Long(curwindow+50) + ENDIF + SetStdRast(r) +ENDPROC r + +PROC eatstring() + DEF adr,x + IF p[]=ISTRING + p:=p+2; x:=p[]++; adr:=^p++ + adr[x]:=0 + ELSE + adr:=varvalue(eatident(),TSTRING) + ENDIF +ENDPROC adr + +PROC eatident() + IF p[]++<>IDENT THEN error(ER_EXPIDENT) +ENDPROC ^p++ + +PROC dofunc(lcode) + DEF args[MAXARGS]:ARRAY OF LONG,a=0,oldvarb,oldvart,oldp,x,r=0,olderpos + checkstop() + WHILE p[]<>RBRACKET + IF a=MAXARGS THEN error(ER_ARGS) + args[a]:=eval() + INC a + ENDWHILE + IF rec=0 THEN globvar:=vartop + oldvarb:=varbottom; varbottom:=vartop; oldvart:=vartop; + oldp:=p; p:=lcode; olderpos:=erpos; INC rec + IF p[]++<>LBRACKET THEN error(ER_EXPLBRACKET) + erpos:=^p++ + WHILE p[]<>RBRACKET + IF a=0 THEN error(ER_ARGS) + x:=findvar(eatident()) + letvar(x,args[]++,TINTEGER) + DEC a + ENDWHILE + IF a<>0 THEN error(ER_ARGS) + p:=p+2 + WHILE p[]<>RBRACKET DO r:=eval() + varbottom:=oldvarb; vartop:=oldvart; p:=oldp; erpos:=olderpos; DEC rec +ENDPROC r + +PROC findvar(id) + DEF loc=0:PTR TO var,a:PTR TO var + IF vartop<>varbottom + a:=varbottom /* check existing local vars */ + WHILE (a0) AND (globvar>vars) /* check global vars */ + a:=vars + WHILE (atype) AND (adr.type<>TINTEGER) THEN error(ER_TYPE) + checkstop() + adr.type:=type + adr.value:=value +ENDPROC + +PROC varvalue(id,type) + DEF adr:PTR TO var + checkstop() + adr:=findvar(id) + IF adr.type<>type THEN error(ER_TYPE) +ENDPROC adr.value + +PROC skip() /* skip *one* expression */ + DEF deep=0,i + REPEAT + i:=p[]++ + IF (i=VALUE) OR (i=LBRACKET) OR (i=IDENT) THEN p:=p+4 + IF i=ISTRING THEN p:=p+6 + IF i=LBRACKET THEN INC deep + IF i=RBRACKET THEN IF deep=0 THEN error(ER_EXPEXP) ELSE DEC deep + IF i=ENDSOURCE THEN error(ER_EXPRBRACKET) + UNTIL deep=0 +ENDPROC + +PROC iword(x) + IF ibuf+ilen>ipos THEN ipos[]++:=x ELSE error(ER_BUF) +ENDPROC + +PROC ilong(x) + IF ibuf+ilen>ipos THEN ^ipos++:=x ELSE error(ER_BUF) +ENDPROC + +PROC loadsource() + DEF suxxes=FALSE,handle,read + IF StrCmp(arg,'?',ALL) OR StrCmp(arg,'',ALL) + WriteF('USAGE: Yax (default ext. ".yax")\n') + error(0) + ELSE + StrCopy(name,arg,ALL) + StrAdd(name,'.yax',4) + slen:=FileLength(name) + handle:=Open(name,1005) + IF (handle=NIL) OR (slen=-1) + error(ER_INFILE) + ELSE + source:=New(slen+10) + IF source=NIL + error(ER_SOURCEMEM) + ELSE + read:=Read(handle,source,slen) + Close(handle) + IF read=slen + suxxes:=TRUE + source[slen]:=0 + ELSE + error(ER_INFILE) + ENDIF + ENDIF + ENDIF + ENDIF +ENDPROC + +PROC error(nr) + DEF erstr[ERLEN]:STRING,a + IF outfile + IF stdout=outfile THEN stdout:=oldout + Close(outfile) + ENDIF + IF infile + IF ownstdin=infile THEN ownstdin:=oldin + Close(infile) + ENDIF + CloseW(curwindow) + CloseS(curscreen) + WriteF('\n') + IF nr>0 + WriteF('ERROR: ') + SELECT nr + CASE ER_WORKSPACE; WriteF('Could not allocate workspace!\n') + CASE ER_BUF; WriteF('Buffer overflow!\n') + CASE ER_GARBAGE; WriteF('Garbage in line\n') + CASE ER_SYNTAX; WriteF('Your syntax sucks\n') + CASE ER_EXPKEYWORD; WriteF('Keyword identifier expected\n') + CASE ER_EXPRBRACKET; WriteF('Right bracket expected\n') + CASE ER_EXPEXP; WriteF('Evaluateable expression expected\n') + CASE ER_QUOTE; WriteF('Missing quote \a\n') + CASE ER_COMMENT; WriteF('Missing "*/"\n') + CASE ER_SOURCEMEM; WriteF('No Memory for source!\n') + CASE ER_INFILE; WriteF('Could not open file "\s".\n',name) + CASE ER_EXPIDENT; WriteF('Identifier expected\n') + CASE ER_ARGS; WriteF('Illegal #of arguments\n') + CASE ER_TYPE; WriteF('Wrong type of variable/expression\n') + CASE ER_EXPLBRACKET; WriteF('Left bracket expected\n') + CASE ER_STACK; WriteF('Nearly stack overflow: \d deep\n',rec) + CASE ER_ALLOC; WriteF('Dynamic allocation failed!\n') + CASE ER_ARRAY; WriteF('Array index out of bounds\n') + CASE ER_FILE; WriteF('File error\n') + CASE ER_GFXWIN; WriteF('No User-window for graphics\n') + CASE ER_VALUES; WriteF('Illegal value(s)\n') + CASE ER_KICK; WriteF('You need OS 37+ for this function\n') + ENDSELECT + IF erpos<>NIL + StrCopy(erstr,erpos,ALL) + FOR a:=0 TO ERLEN-1 DO IF erstr[a]=10 THEN erstr[a]:=32 + WriteF('NEARBY: \s\n',erstr) + ENDIF + ELSEIF nr=-1 + WriteF('*** Program halted.\n') + ENDIF + IF conout<>NIL THEN WriteF('Press to continue ...\n') + CleanUp(0) +ENDPROC + +keywords: +CHAR 'write...', 'add.....', 'eq......', 'uneq....', 'sub.....', + 'mul.....', 'div.....', 'and.....', 'or......', 'not.....', + 'if......', 'do......', 'select..', 'set.....', 'for.....', + 'while...', 'until...', 'defun...', 'lambda..', 'apply...', + 'readint.', 'array...', 'greater.', 'smaller.', 'locate..', + 'cls.....', 'dump....', 'window..', 'tell....', 'told....', + 'see.....', 'seen....', 'string..', 'read....', 'get.....', + 'put.....', 'filelen.', 'line....', 'plot....', 'box.....', + 'mousex..', 'mousey..', 'mouse...', 'text....', 'abs.....', + 'mod.....', 'eor.....', 'swap....', 'power...', 'req.....', + 'inc.....', 'dec.....', 'rnd.....', 'rndq....', 'kick....', + 'when....', 'else....', 'win.....', 'screen..', 'message.', + 'gadget..', 'gadid...', 'hex.....', 'exit....' + diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/Yax/fac.yax b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/fac.yax new file mode 100644 index 0000000..86cfba9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/fac.yax @@ -0,0 +1,2 @@ +(defun fac (n) (if (eq n 1) 1 (* (fac (sub n 1)) n))) +(write 'compute factorial of: ' (fac (readint))) diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/Yax/pi.yax b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/pi.yax new file mode 100644 index 0000000..1e40a0b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/pi.yax @@ -0,0 +1,42 @@ +(defun pi (nr) + (set max (* nr 4)) + (array a max) + (set m nr) + (for i 0 max (set (a i) 0)) + (set k (- (/ (* m 3321) 1000) 1) ) + (for n k 1 + (set (a 0) (+ (a 0) 2)) + (set p (+ 1 (* 2 n))) + (set c 0) + (for i 0 m + (set c (+ (* 10 c) (* n (a i)))) + (set (a i) (/ c p)) + (set c (- c (* (a i) p))) + ) + (locate 5 20) + (write n ' ' '') + ) + (for i m 1 + (if (greater (a i) 9) + (do + (set (a i) (- (a i) 10) ) + (set (a (- i 1)) (+ (a (- i 1)) 1)) + ) + ) + ) + (cls) + (write) + (write 'pi=3.' '') + (for i 1 m + (write (a i) '') + ) + (write) +) + + +(window 0 11 400 150 'PI calc') +(write '#of decimals: ' '') +(set deci (readint)) +(write 'busy ....') +(pi deci) +(write) diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/Yax/sincosdemo.yax b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/sincosdemo.yax new file mode 100644 index 0000000..2f13aff --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/sincosdemo.yax @@ -0,0 +1,66 @@ +/* SinCosDemo.yax freeware v0.4 @ Ben Schaeffer1993 +Sine and cosine arrays in degrees, 0 to 360 inclusive. */ + +/* modified by wouter */ + +(array sin 361 + 0 4 9 13 18 22 27 31 36 40 44 49 53 58 62 66 71 75 79 83 88 92 96 100 104 108 + 112 116 120 124 128 132 136 139 143 147 150 154 158 161 165 168 171 175 178 + 181 184 187 190 193 196 199 202 204 207 210 212 215 217 219 222 224 226 228 + 230 232 234 236 237 239 241 242 243 245 246 247 248 249 250 251 252 253 254 + 254 255 255 255 256 256 256 256 256 256 256 255 255 255 254 254 253 252 251 + 250 249 248 247 246 245 243 242 241 239 237 236 234 232 230 228 226 224 222 + 219 217 215 212 210 207 204 202 199 196 193 190 187 184 181 178 175 171 168 + 165 161 158 154 150 147 143 139 136 132 128 124 120 116 112 108 104 100 96 + 92 88 83 79 75 71 66 62 58 53 49 44 40 36 31 27 22 18 13 9 4 0 + -4 -9 -13 -18 -22 -27 -31 -36 -40 -44 -49 -53 -58 -62 -66 -71 -75 -79 -83 + -88 -92 -96 -100 -104 -108 -112 -116 -120 -124 -128 -132 -136 -139 -143 -147 + -150 -154 -158 -161 -165 -168 -171 -175 -178 -181 -184 -187 -190 -193 -196 + -199 -202 -204 -207 -210 -212 -215 -217 -219 -222 -224 -226 -228 -230 -232 + -234 -236 -237 -239 -241 -242 -243 -245 -246 -247 -248 -249 -250 -251 -252 + -253 -254 -254 -255 -255 -255 -256 -256 -256 -256 -256 -256 -256 -255 -255 + -255 -254 -254 -253 -252 -251 -250 -249 -248 -247 -246 -245 -243 -242 -241 + -239 -237 -236 -234 -232 -230 -228 -226 -224 -222 -219 -217 -215 -212 -210 + -207 -204 -202 -199 -196 -193 -190 -187 -184 -181 -178 -175 -171 -168 -165 + -161 -158 -154 -150 -147 -143 -139 -136 -132 -128 -124 -120 -116 -112 -108 + -104 -100 -96 -92 -88 -83 -79 -75 -71 -66 -62 -58 -53 -49 -44 -40 -36 -31 -27 + -22 -18 -13 -9 -4 0 +) + +(defun cos (a) (sin (if (> a 270) (- a 270) (+ a 90)))) +(defun wait () (while (uneq (mouse) 0))) + +(window 0 0 600 180 'circle') + +(for n 0 360 + (line (+ 300 (/ (* 160 (cos n)) 256)) + (+ 95 (/ (* 75 (sin n)) 256)) + (+ 300 (/ (* 80 (cos n)) 256)) + (+ 95 (/ (* 37 (sin n)) 256)) n) +) + +(for n 0 360 + (plot (+ 300 (/ (* 40 (cos n)) 256)) (+ 95 (/ (* 19 (sin n)) 256)) n) +) + +(write 'click to continue') +(wait) +(while (eq (mouse) 0)) +(cls) +(set m 181) +(wait) +(while (eq (mouse) 0) + (for n 0 360 + (line (+ 300 (/ (* 160 (cos n)) 256)) + (+ 95 (/ (* 75 (sin (- 360 n))) 256)) + (+ 300 (/ (* 80 (cos n)) 256)) + (+ 95 (/ (* 37 (sin n)) 256)) 2) + (line (+ 300 (/ (* 160 (cos m)) 256)) + (+ 95 (/ (* 75 (sin (- 360 m))) 256)) + (+ 300 (/ (* 80 (cos m)) 256)) + (+ 95 (/ (* 37 (sin m)) 256)) 1) + (set m (+ m 1)) + (if (eq m 361) (set m 0)) + (if (uneq (mouse) 0) (exit)) + ) +) diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/Yax/xpaint.yax b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/xpaint.yax new file mode 100644 index 0000000..4e48b71 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/xpaint.yax @@ -0,0 +1,75 @@ +/* paint program using the new intuition functions */ + +(when (not (kick 37)) (write 'I need v37+!') (exit)) + +(string title) +(set title 'Xpaint++ v0.1 by $#%!') +(set maxx 320) (set maxy 200) +(set col 1) (set tool 0) (set ox -1) (set oy -1) +(set f 0) (set mode 0) (set off 30) + +(set depth (+ (req title 'number of colours?' '4|8|16|2') 1)) +(set flags (* (req title 'mode?' 'hires|lowres') $8000)) +(set flags (+ flags (* (req title 'lace?' 'yes|no') 4))) +(set maxy (+ maxy (* (req title 'pal?' 'yes|no') 56))) +(if (> flags $7FFF) (set maxx (* maxx 2))) +(if (and flags 4) (set maxy (* maxy 2))) + +(screen maxx maxy depth flags title) +(win 0 1 maxx (- maxy 1) $268 $100E title) +(line 0 (- off 1) maxx (- off 1) 1) +(gadget 1 5 15 55 'colour') +(gadget 2 65 15 55 'tools') +(gadget 3 125 15 55 'mode') +(gadget 4 185 15 55 'clear') +(gadget 5 245 15 55 'about') +(set noquit 1) + +(defun ymouse () (if (or (< (set d (mousey)) off) (> d maxy)) off d)) + +(defun dogad () + (select (gadid) + 1 (set col (req title 'pick colour:' '1|2|3|4|5|6|7|0')) + 2 (do + (set tool (req title 'use tool:' 'poly|line|box|dot|free')) + (set ox -1) (set oy -1) (set f 0) + ) + 3 (set mode (req title 'mode:' 'cycle|mirror|norm')) + 4 (box 0 off maxx maxy 0) + 5 (req title 'Xpaint++ written in YAX!' 'ok') + ) +) + +(defun dotool (x y) + (if (eq ox -1) (set ox x)) + (if (eq oy -1) (set oy y)) + (select mode + 1 (set col (if (eq col 15) 1 (+ col 1))) + 2 (set tool 4) + ) + (select tool + 0 (do + (while (eq (mouse) 1) + (set ox x) (set oy y) + (line ox oy (set x (mousex)) (set y (ymouse)) col) + ) + ) + 1 (line ox oy x y col) + 2 (do (if f (line ox oy x y col)) (set f (- 1 f))) + 3 (do (if f (box ox oy x y col)) (set f (- 1 f))) + 4 (do + (box x y (+ x 2) (+ y 2) col) + (if (eq mode 2) (box (- maxx x) y (+ (- maxx x) 2) (+ y 2) col)) + ) + ) + (set ox x) (set oy y) +) + +(while noquit + (select (message) + $200 (set noquit 0) + $040 (dogad) + $020 (dogad) + $008 (dotool (mousex) (ymouse)) + ) +) diff --git a/amigae33a/E_v3.3a/Src/Src/Lang/Yax/yax.doc b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/yax.doc new file mode 100644 index 0000000..46d1bcf --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Lang/Yax/yax.doc @@ -0,0 +1,224 @@ + + +---------------------------------------+ + | | + | Amiga YAX Interpreter v1.1 | + | | + | (c) 1992/93 $#%! | + | M A N U A L | + | | + +---------------------------------------+ + +/* v1.2 now includes as mass of new functions! look at end of this doc. */ + + 1. Introduction + 2. The Language + 3. Built-in Functions + + +---------------------------------------+ + | 1. Introduction | + +---------------------------------------+ + +update from v0.x/1.0 to 1.1: +bug fixes: +- negative number division failed! +- box accepted illegal values + +update from v1.1 to 1.2: +- new functions, see below. + +YAX stands for "Yet Another Instruction Code Set", as the author couldn't +think of better name. YAX is a procedural language with LISP-syntax and +evaluation, as well as somewhat lambda function application. + +In this manual it is assumed the reader possesses knowledge of other +languages, as all 'obvious' explanations are left out. Readers for whom +YAX would be their first programming language are advised to read +a standard text on the subject 8-). + + +---------------------------------------+ + | 2. The Language | + +---------------------------------------+ + +Structure. +The basic building block of a YAX program is called a term. +Examples of terms are: + +integer constants: 1 2 100 -1 +string constants: 'a' 'hi folks!' +variables: a count +function calls: (+ 1 2) (* 3 (- 4 5)) + +a function call is a list '()' with as first item the name of the +function to be applied, followed by its arguments. With few execeptions, +arguments to functions are again terms, so expressions may be built +to infinite complexity. The main task of the interpreter is to +evaluate these terms recursively. + +Format. +between any two lexical elements, any number of spaces, tabs and linefeeds +may be placed. Comments start with '/*' and end with '*/', may extend +over several lines, and may be nested. following two statements are equal: + +(if(eq a 1)(for b 1 10(write'blabla'))) /* ugly */ + +(if (eq a 1) + (for b 1 10 (write 'blabla')) /* better */ +) + + + +---------------------------------------+ + | 3. Built-in Functions | + +---------------------------------------+ + +If not explicitly stated, functions return 0. type of arguments: + + any term + term that evaluates to integer + term that evaluates to string + term that is a variable + term that is a string variable + term that evaluates to a function +... any number of terms of the same type may follow + + --> INTEGER MATH <-- + +(add ...) or (+ ...) +(sub ...) or (- ...) +(mul ...) or (* ...) +(div ...) or (/ ...) + +(and ...) +(or ...) +(not ) + +(eq ...) +(uneq ) +(smaller ) +(greater ) + +These functions perform the functions you'd expect them to do. +All boolean logic functions return true (-1) or false (0). and/or/not +work as logical as well as bitwise operators. +except for the last three, all functions handle any number of arguments, +i.e. (eq 10 (+ 1 2 3 4) (* 2 5)) is a valid term. + + --> PROGRAM STRUCTURE <-- + +(for ...) +(if ) + /* also returns value of term */ +(do ...) +(select ...) + /* is matched agains even items of s, and + corresponding odd is executed */ +(while ...) +(until ...) +(set ) + +(defun ( ...) ...) +(lambda (var ...) ...) + /* returns function as value (may only be used in (set) and (apply) */ +(apply ...) + +(array ) +(string ) + + + --> INPUT OUTPUT <-- + +(write ...) +(locate ) +(cls) +(window ) + +(tell ) open a file for writing +(told) close file +(see ) open a file for reading +(seen) close file +(filelen ) get filelength + +(readint) read an integer +(read ) read a string +(get) read one character +(put ) write one character + +(dump) show all variables + + + --> GRAPHICS <-- + +(line ) +(plot ) +(box ) +(text ) +(mousex), (mousey) intuition +(mouse) non-intuition + + + +NEW IN VERSION 1.2: +- changes to existing functions: + (>) as equivalent for (greater) + (<) as equivalent for (smaller) + (array ...) /* inits array with s (opt) */ + (set ) +- additional functions: + math etc.: + (abs ) + (mod ) /* (mod 20 3) => 2 */ + (eor ...) + (swap ) /* currently vars only */ + (power ) /* (power 2 5) => 32 */ + (inc ) + (dec ) + system: + (kick ) /* (if (kick 37) ... ) */ + (exit) + control: + (when ... /* (if (do ...) */ + else ...) /* (do ...)) */ + input/output: + (hex ) /* writes num in hexadecimal */ + intuition: + (req ) /* (req 'YAX req' 'choose:' 'a|b|c') */ + (screen w h d flags title) /* opens screen */ + (win x y w h IDCMP flags title) /* opens gfx-only window and closes + any previous w. if (screen) was + used, (win) opens on it */ + (gadget id x y width title) /* makes gadget on cur. window */ + (message) /* Wait()s and returns IDCMP */ + (gadid) /* returns gadnum in event */ + + NOTE: - now that there's (win) and (screen), graphics and intuition + functions should not be used on windows opened with (window) + (these are for stdio only), it will be possible however to use + graphics functions on them for backward compatability with 1.1. + - (req) is 2.04+, all others are 1.2+ + + +POSSIBLE ENHANCEMENTS: +- true lambda's for function calls +- (cond) + +ben: +- string commands +- run another yax prog from yax code +- (see) twice --> problems? better file support. +- yax compiler (to E) +- (/) moet weer 32bit. + check div by zero. +- !! select break mogelijkheid!! + +BUGS: +- array uitlezen een index te weinig + + +ETC: check ben's correspondentie, 24 april '93 + +>> YAX divide algorithm using YAXv1.0's unsigned 32 bit division: +>> if (denominator) +>> answer = (abs(numerator)/abs(denominator)) +>> if (numerator eor denominator < 0) +>> answer = -answer +>> otherwise +>> ERROR_DIV_BY_ZERO + diff --git a/amigae33a/E_v3.3a/Src/Src/Library/Pgs/gio.m b/amigae33a/E_v3.3a/Src/Src/Library/Pgs/gio.m new file mode 100644 index 0000000..d499053 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Library/Pgs/gio.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Library/Pgs/noisy.e b/amigae33a/E_v3.3a/Src/Src/Library/Pgs/noisy.e new file mode 100644 index 0000000..4d53538 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Library/Pgs/noisy.e @@ -0,0 +1,54 @@ +/* noisy.e: compiles to noisy.gio for use as Photogenics loader + based roughly on noise.c supplied with photogenics v1.2 + [note: the `z' is a hack because currently EC assigns registers itself] */ + +LIBRARY 'Noisy.gio',1,1,'E example gio' IS + gioInfo, gioExamine, gioRead, gioWrite, gioSavePrefs, + gioCleanUp, gioAbout, gioStartup, gioShutDown, gioLoadPrefs + +MODULE '*pgs', '*gio' + +PROC gioInfo() IS GIOF_LOADER24 +PROC gioCleanUp(g:PTR TO giodata,z) IS EMPTY +PROC gioSavePrefs(g:PTR TO giodata,z) IS EMPTY +PROC gioLoadPrefs(g:PTR TO giodata,z) IS EMPTY +PROC gioAbout(g:PTR TO giodata,z) IS EMPTY +PROC gioStartup() IS EMPTY +PROC gioShutDown() IS EMPTY +PROC main() IS EMPTY + +PROC gioExamine(g:PTR TO giodata,z) + DEF width=100, height=100 + pgsbase:=g.pgsbase + g.flags:=gioInfo() + IF GetDimensions('Size of new Noisy image',{width},{height})<>1 + g.error:=LOAD_ABORTED + ELSE + g.width:=width + g.height:=height + g.depth:=24 + g.error:=LOAD_OK + ENDIF +ENDPROC g.error + +PROC gioRead(g:PTR TO giodata,z) + DEF x,y,p:PTR TO CHAR,d + pgsbase:=g.pgsbase + SetProgress('Creating Noisy image...',0); + FOR y:=0 TO g.height-1 + IF y AND $F = 0 + IF SetProgress(0,y*100/g.height)<>1 + g.error:=LOAD_ABORTED + RETURN g.error + ENDIF + ENDIF + p:=GetLine(g,y) + FOR x:=0 TO g.width-1 DO FOR d:=1 TO 3 DO p[]++:=d*16+x*y ->Rnd(256) + ReleaseLine(g,y) + ENDFOR + g.error:=NIL +ENDPROC g.error + +PROC gioWrite(g:PTR TO giodata,z) + g.error:=LOAD_WRONGTYPE +ENDPROC g.error diff --git a/amigae33a/E_v3.3a/Src/Src/Library/Pgs/pgs.m b/amigae33a/E_v3.3a/Src/Src/Library/Pgs/pgs.m new file mode 100644 index 0000000..831adcb Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Library/Pgs/pgs.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Library/README b/amigae33a/E_v3.3a/Src/Src/Library/README new file mode 100644 index 0000000..51a055b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Library/README @@ -0,0 +1,5 @@ +This directory contains some examples of libraries. Both show clearly how to +interface with other languages/systems: the stack.library allows C to call +methods from an E class, and noisy.gio is a library that can be used from the +Photogenics (tm) image processing software (of which the main program is also +written in E!). diff --git a/amigae33a/E_v3.3a/Src/Src/Library/Stack/stack_pragmas.h b/amigae33a/E_v3.3a/Src/Src/Library/Stack/stack_pragmas.h new file mode 100644 index 0000000..47d74df --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Library/Stack/stack_pragmas.h @@ -0,0 +1,5 @@ +#pragma libcall stackbase Stack 1e 0 +#pragma libcall stackbase End 24 001 +#pragma libcall stackbase Push 2a 0802 +#pragma libcall stackbase Pop 30 001 +#pragma libcall stackbase Isempty 36 001 diff --git a/amigae33a/E_v3.3a/Src/Src/Library/Stack/stacklib.e b/amigae33a/E_v3.3a/Src/Src/Library/Stack/stacklib.e new file mode 100644 index 0000000..e8f7d8f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Library/Stack/stacklib.e @@ -0,0 +1,26 @@ +/* A stack library. uses the stack class. */ + +LIBRARY 'stack.library',1,1,'bla' IS stack,end,push,pop,isempty + +MODULE 'class/stack' + +PROC stack() HANDLE + DEF x=NIL:PTR TO stack + NEW x.stack() +EXCEPT DO -> prevent "NEW" exceptions being thrown out of the library +ENDPROC x + +PROC end(st:PTR TO stack) + END st +ENDPROC + +PROC push(st:PTR TO stack,v) HANDLE + st.push(v) +EXCEPT DO +ENDPROC + +PROC pop(st:PTR TO stack) IS st.pop() +PROC isempty(st:PTR TO stack) IS st.is_empty() + +PROC main() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Library/Stack/stackuse.c b/amigae33a/E_v3.3a/Src/Src/Library/Stack/stackuse.c new file mode 100644 index 0000000..9149395 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Library/Stack/stackuse.c @@ -0,0 +1,21 @@ +/* This uses an E stack-class from C + the pragmas were generated from the .fd file outputted by + `ShowModule -c stack.m' + (finally true OO programming for C! ;-) +*/ + +#include "stack_pragmas.h" +#include + +int main() { + int s,a,stackbase; + if(stackbase=OpenLibrary("stack.library",0)) { + if(s=Stack()) { + for(a=1;a<=12;a++) Push(s,a); + while(!Isempty(s)) printf("element = %ld\n",Pop(s)); + End(s); + }; + CloseLibrary(stackbase); + }; + return 0; +}; diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/animationclass.e b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/animationclass.e new file mode 100644 index 0000000..e688265 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/animationclass.e @@ -0,0 +1,81 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'graphics/gfx', + 'graphics/view' + +#define ANIMATIONDTCLASS 'animation.datatype' + +CONST ADTA_DUMMY=$80001258, + ADTA_MODEID=$800010C8, + ADTA_KEYFRAME=$800010CA, + ADTA_COLORREGISTERS=$800010CB, + ADTA_CREGS=$800010CC, + ADTA_GREGS=$800010CD, + ADTA_COLORTABLE=$800010CE, + ADTA_COLORTABLE2=$800010CF, + ADTA_ALLOCATED=$800010D0, + ADTA_NUMCOLORS=$800010D1, + ADTA_NUMALLOC=$800010D2, + ADTA_REMAP=$800010D3, + ADTA_SCREEN=$800010D4, + ADTA_NUMSPARSE=$800010D9, -> Data for this tag is unsigned INT + ADTA_SPARSETABLE=$800010DA, + ADTA_WIDTH=$80001259, + ADTA_HEIGHT=$8000125A, + ADTA_DEPTH=$8000125B, + ADTA_FRAMES=$8000125C, + ADTA_FRAME=$8000125D, + ADTA_FRAMESPERSECOND=$8000125E, + ADTA_FRAMEINCREMENT=$8000125F, + ADTA_SAMPLE=$800011F6, + ADTA_SAMPLELENGTH=$800011F7, + ADTA_PERIOD=$800011F8, + ADTA_VOLUME=$800011F9, + ADTA_CYCLES=$800011FA, + ID_ANIM="ANIM", + ID_ANHD="ANHD", + ID_DLTA="DLTA" + +OBJECT animheader + operation:CHAR + mask:CHAR + width:INT -> This is unsigned + height:INT -> This is unsigned + left:INT + top:INT + abstime:LONG + reltime:LONG + interleave:CHAR + pad0:CHAR + flags:LONG + pad[16]:ARRAY +ENDOBJECT + +CONST ADTM_DUMMY=$700, + ADTM_LOADFRAME=$701, + ADTM_UNLOADFRAME=$702, + ADTM_START=$703, + ADTM_PAUSE=$704, + ADTM_STOP=$705, + ADTM_LOCATE=$706 + +OBJECT adtframe + methodid:LONG + timestamp:LONG + frame:LONG + duration:LONG + bitmap:PTR TO bitmap + cmap:PTR TO colormap + sample:PTR TO CHAR + samplelength:LONG + period:LONG + userdata:LONG +ENDOBJECT + +OBJECT adtstart + methodid:LONG + frame:LONG +ENDOBJECT diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/datatypes.e b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/datatypes.e new file mode 100644 index 0000000..4d2faa7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/datatypes.e @@ -0,0 +1,107 @@ +OPT MODULE +OPT EXPORT + +MODULE 'dos/dos', + 'exec/libraries', + 'exec/lists', + 'exec/nodes', + 'libraries/iffparse', + 'utility/tagitem' + +CONST ID_DTYP=$44545950, + ID_DTHD=$44544844 + +OBJECT datatypeheader + name:PTR TO CHAR + basename:PTR TO CHAR + pattern:PTR TO CHAR + mask:PTR TO INT + groupid:LONG + id:LONG + masklen:INT + pad:INT + flags:INT -> This is unsigned + priority:INT -> This is unsigned +ENDOBJECT /* SIZEOF=32 */ + +CONST DTF_TYPE_MASK=15, + DTF_BINARY=0, + DTF_ASCII=1, + DTF_IFF=2, + DTF_MISC=3, + DTF_CASE=16, + DTF_SYSTEM1=$1000, + GID_SYSTEM=$73797374, + GID_TEXT=$74657874, + GID_DOCUMENT=$646F6375, + GID_SOUND=$736F756E, + GID_INSTRUMENT=$696E7374, + GID_MUSIC=$6D757369, + GID_PICTURE=$70696374, + GID_ANIMATION=$616E696D, + GID_MOVIE=$6D6F7669, + ID_CODE=$44544344, + DTHSIZE=32 + +OBJECT dthookcontext + sysbase:PTR TO lib + dosbase:PTR TO lib + iffparsebase:PTR TO lib + utilitybase:PTR TO lib + lock:LONG + fib:PTR TO fileinfoblock + filehandle:LONG + iff:PTR TO iffhandle + buffer:PTR TO CHAR + bufferlength:LONG +ENDOBJECT /* SIZEOF=40 */ + +CONST ID_TOOL=$4454544C + +OBJECT tool + which:INT -> This is unsigned + flags:INT -> This is unsigned + program:PTR TO CHAR +ENDOBJECT /* SIZEOF=8 */ + +CONST TW_INFO=1, + TW_BROWSE=2, + TW_EDIT=3, + TW_PRINT=4, + TW_MAIL=5, + TF_LAUNCH_MASK=15, + TF_SHELL=1, + TF_WORKBENCH=2, + TF_RX=3, + ID_TAGS=$44545447 + +OBJECT datatype + node1:ln + node2:ln + header:PTR TO datatypeheader + toollist:lh + functionname:PTR TO CHAR + attrlist:PTR TO tagitem + length:LONG +ENDOBJECT /* SIZEOF=58 */ + +OBJECT toolnode + node:ln + tool:tool + length:LONG +ENDOBJECT /* SIZEOF=26 */ + +CONST ID_NAME=$4E414D45, + DTERROR_UNKNOWN_DATATYPE=$7D0, + DTERROR_COULDNT_SAVE=$7D1, + DTERROR_COULDNT_OPEN=$7D2, + DTERROR_COULDNT_SEND_MESSAGE=$7D3, + DTERROR_COULDNT_OPEN_CLIPBOARD=$7D4, + DTERROR_RESERVED=$7D5, + DTERROR_UNKNOWN_COMPRESSION=$7D6, + DTERROR_NOT_ENOUGH_DATA=$7D7, + DTERROR_INVALID_DATA=$7D8, + DTMSG_TYPE_OFFSET=$834, + DTNSIZE=58, + TNSIZE=26 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/datatypesclass.e b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/datatypesclass.e new file mode 100644 index 0000000..84933b9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/datatypesclass.e @@ -0,0 +1,234 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +#define DATATYPESCLASS 'datatypesclass' + +MODULE 'exec/io', + 'exec/semaphores', + 'graphics/gfx', + 'graphics/rastport', + 'graphics/view', + 'intuition/cghooks', + 'intuition/screens', + 'utility/tagitem' + +CONST DTA_DUMMY=$80001000, + DTA_TEXTATTR=$8000100A, + DTA_TOPVERT=$8000100B, + DTA_VISIBLEVERT=$8000100C, + DTA_TOTALVERT=$8000100D, + DTA_VERTUNIT=$8000100E, + DTA_TOPHORIZ=$8000100F, + DTA_VISIBLEHORIZ=$80001010, + DTA_TOTALHORIZ=$80001011, + DTA_HORIZUNIT=$80001012, + DTA_NODENAME=$80001013, + DTA_TITLE=$80001014, + DTA_TRIGGERMETHODS=$80001015, + DTA_DATA=$80001016, + DTA_TEXTFONT=$80001017, + DTA_METHODS=$80001018, + DTA_PRINTERSTATUS=$80001019, + DTA_PRINTERPROC=$8000101A, + DTA_LAYOUTPROC=$8000101B, + DTA_BUSY=$8000101C, + DTA_SYNC=$8000101D, + DTA_BASENAME=$8000101E, + DTA_GROUPID=$8000101F, + DTA_ERRORLEVEL=$80001020, + DTA_ERRORNUMBER=$80001021, + DTA_ERRORSTRING=$80001022, + DTA_CONDUCTOR=$80001023, + DTA_CONTROLPANEL=$80001024, + DTA_IMMEDIATE=$80001025, + DTA_REPEAT=$80001026, + DTA_NAME=$80001064, + DTA_SOURCETYPE=$80001065, + DTA_HANDLE=$80001066, + DTA_DATATYPE=$80001067, + DTA_DOMAIN=$80001068, + DTA_LEFT=$80001069, + DTA_TOP=$8000106A, + DTA_WIDTH=$8000106B, + DTA_HEIGHT=$8000106C, + DTA_OBJNAME=$8000106D, + DTA_OBJAUTHOR=$8000106E, + DTA_OBJANNOTATION=$8000106F, + DTA_OBJCOPYRIGHT=$80001070, + DTA_OBJVERSION=$80001071, + DTA_OBJECTID=$80001072, + DTA_USERDATA=$80001073, + DTA_FRAMEINFO=$80001074, + DTA_RELRIGHT=$80001075, + DTA_RELBOTTOM=$80001076, + DTA_RELWIDTH=$80001077, + DTA_RELHEIGHT=$80001078, + DTA_SELECTDOMAIN=$80001079, + DTA_TOTALPVERT=$8000107A, + DTA_TOTALPHORIZ=$8000107B, + DTA_NOMINALVERT=$8000107C, + DTA_NOMINALHORIZ=$8000107D, + DTA_DESTCOLS=$80001190, + DTA_DESTROWS=$80001191, + DTA_SPECIAL=$80001192, -> Data for this tag is unsigned INT + DTA_RASTPORT=$80001193, + DTA_AREXXPORTNAME=$80001194, + DTST_RAM=1, + DTST_FILE=2, + DTST_CLIPBOARD=3, + DTST_HOTLINK=4 + + +OBJECT dtspecialinfo + lock:ss + flags:LONG + topvert:LONG + visvert:LONG + totvert:LONG + otopvert:LONG + vertunit:LONG + tophoriz:LONG + vishoriz:LONG + tothoriz:LONG + otophoriz:LONG + horizunit:LONG +ENDOBJECT /* SIZEOF=90 */ + +CONST DTSIF_LAYOUT=1, + DTSIF_NEWSIZE=2, + DTSIF_DRAGGING=4, + DTSIF_DRAGSELECT=8, + DTSIF_HIGHLIGHT=16, + DTSIF_PRINTING=$20, + DTSIF_LAYOUTPROC=$40 + +OBJECT dtmethod + label:PTR TO CHAR + command:PTR TO CHAR + method:LONG +ENDOBJECT /* SIZEOF=12 */ + +CONST DTM_FRAMEBOX=$601, + DTM_PROCLAYOUT=$602, + DTM_ASYNCLAYOUT=$603, + DTM_REMOVEDTOBJECT=$604, + DTM_SELECT=$605, + DTM_CLEARSELECTED=$606, + DTM_COPY=$607, + DTM_PRINT=$608, + DTM_ABORTPRINT=$609, + DTM_NEWMEMBER=$610, + DTM_DISPOSEMEMBER=$611, + DTM_GOTO=$630, + DTM_TRIGGER=$631, + DTM_OBTAINDRAWINFO=$640, + DTM_DRAW=$641, + DTM_RELEASEDRAWINFO=$642, + DTM_WRITE=$650 + +OBJECT frameinfo + propertyflags:LONG + resolution:tpoint + redbits:CHAR + greenbits:CHAR + bluebits:CHAR + width:LONG + height:LONG + depth:LONG + screen:PTR TO screen + colormap:PTR TO colormap + flags:LONG +ENDOBJECT /* SIZEOF=35 */ + +CONST FIF_SCALABLE=1, + FIF_SCROLLABLE=2, + FIF_REMAPPABLE=4 + +OBJECT dtgeneral + methodid:LONG + ginfo:PTR TO gadgetinfo +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT dtselect + methodid:LONG + ginfo:PTR TO gadgetinfo + select:rectangle +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT dtframebox + methodid:LONG + ginfo:PTR TO gadgetinfo + contentsinfo:PTR TO frameinfo + frameinfo:PTR TO frameinfo + sizeframeinfo:LONG + frameflags:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST FRAMEF_SPECIFY=1 + +OBJECT dtgoto + methodid:LONG + ginfo:PTR TO gadgetinfo + nodename:PTR TO CHAR + attrlist:PTR TO tagitem +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT dttrigger + methodid:LONG + ginfo:PTR TO gadgetinfo + function:LONG + data:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST STM_PAUSE=1, + STM_PLAY=2, + STM_CONTENTS=3, + STM_INDEX=4, + STM_RETRACE=5, + STM_BROWSE_PREV=6, + STM_BROWSE_NEXT=7, + STM_NEXT_FIELD=8, + STM_PREV_FIELD=9, + STM_ACTIVATE_FIELD=10, + STM_COMMAND=11, + STM_REWIND=12, + STM_FASTFORWARD=13, + STM_STOP=14, + STM_RESUME=15, + STM_LOCATE=16 + +-> Um, this object was missing +OBJECT dtprint + methodid:LONG + ginfo:PTR TO gadgetinfo +-> a) next is unioned with "iodrp:PTR TO iodrpreq" +-> b) next is unioned with "iopc:PTR TO ioprtcmdreq"" + ios:PTR TO iostd + attrlist:PTR TO tagitem +ENDOBJECT + +OBJECT dtdraw + methodid:LONG + rport:PTR TO rastport + left:LONG + top:LONG + width:LONG + height:LONG + tophoriz:LONG + topvert:LONG + attrlist:PTR TO tagitem +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT dtwrite + methodid:LONG + ginfo:PTR TO gadgetinfo + filehandle:LONG + mode:LONG + attrlist:PTR TO tagitem +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST DTWM_IFF=0, + DTWM_RAW=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/pictureclass.e b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/pictureclass.e new file mode 100644 index 0000000..1479fb6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/pictureclass.e @@ -0,0 +1,67 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +CONST PDTA_MODEID=$800010C8, + PDTA_BITMAPHEADER=$800010C9, + PDTA_BITMAP=$800010CA, + PDTA_COLORREGISTERS=$800010CB, + PDTA_CREGS=$800010CC, + PDTA_GREGS=$800010CD, + PDTA_COLORTABLE=$800010CE, + PDTA_COLORTABLE2=$800010CF, + PDTA_ALLOCATED=$800010D0, + PDTA_NUMCOLORS=$800010D1, + PDTA_NUMALLOC=$800010D2, + PDTA_REMAP=$800010D3, + PDTA_SCREEN=$800010D4, + PDTA_FREESOURCEBITMAP=$800010D5, + PDTA_GRAB=$800010D6, + PDTA_DESTBITMAP=$800010D7, + PDTA_CLASSBITMAP=$800010D8, + PDTA_NUMSPARSE=$800010D9, -> Data for this tag is unsigned INT + PDTA_SPARSETABLE=$800010DA, + MSKNONE=0, + MSKHASMASK=1, + MSKHASTRANSPARENTCOLOR=2, + MSKLASSO=3, + MSKHASALPHA=4, + CMPNONE=0, + CMPBYTERUN1=1, + CMPBYTERUN2=2 + +#define PICTUREDTCLASS 'picture.datatype' + +OBJECT bitmapheader + width:INT -> This is unsigned + height:INT -> This is unsigned + left:INT + top:INT + depth:CHAR + masking:CHAR + compression:CHAR + pad:CHAR + transparent:INT -> This is unsigned + xaspect:CHAR + yaspect:CHAR + pagewidth:INT + pageheight:INT +ENDOBJECT /* SIZEOF=20 */ + +OBJECT colorregister + red:CHAR + green:CHAR + blue:CHAR +ENDOBJECT /* SIZEOF=3 */ + +CONST ID_ILBM=$494C424D, + ID_BMHD=$424D4844, + ID_BODY=$424F4459, + ID_CMAP=$434D4150, + ID_CRNG=$43524E47, + ID_GRAB=$47524142, + ID_SPRT=$53505254, + ID_DEST=$44455354, + ID_CAMG=$43414D47 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/soundclass.e b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/soundclass.e new file mode 100644 index 0000000..bc8d624 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/soundclass.e @@ -0,0 +1,34 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +CONST SDTA_DUMMY=$800011F4, + SDTA_VOICEHEADER=$800011F5, + SDTA_SAMPLE=$800011F6, + SDTA_SAMPLELENGTH=$800011F7, + SDTA_PERIOD=$800011F8, -> Data for this tag is unsigned INT + SDTA_VOLUME=$800011F9, -> Data for this tag is unsigned INT + SDTA_CYCLES=$800011FA, + SDTA_SIGNALTASK=$800011FB, + SDTA_SIGNALBIT=$800011FC, + SDTA_CONTINUOUS=$800011FD + +#define SOUNDDTCLASS 'sound.datatype' + +OBJECT voiceheader + oneshothisamples:LONG + repeathisamples:LONG + samplesperhicycle:LONG + samplespersec:INT -> This is unsigned + octaves:CHAR + compression:CHAR + volume:LONG +ENDOBJECT /* SIZEOF=20 */ + +CONST CMP_NONE=0, + CMP_FIBDELTA=1, + ID_8SVX=$38535658, + ID_VHDR=$56484452, + ID_BODY=$424F4459 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/textclass.e b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/textclass.e new file mode 100644 index 0000000..df5e15e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/datatypes/textclass.e @@ -0,0 +1,38 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/nodes' + +CONST TDTA_BUFFER=$8000112C, + TDTA_BUFFERLEN=$8000112D, + TDTA_LINELIST=$8000112E, + TDTA_WORDSELECT=$8000112F, + TDTA_WORDDELIM=$80001130, + TDTA_WORDWRAP=$80001131 + +#define TEXTDTCLASS 'text.datatype' + +OBJECT line + link:mln + text:PTR TO CHAR + textlen:LONG + xoffset:INT -> This is unsigned + yoffset:INT -> This is unsigned + width:INT -> This is unsigned + height:INT -> This is unsigned + flags:INT -> This is unsigned + fgpen:CHAR -> This is signed + bgpen:CHAR -> This is signed + style:LONG + data:LONG +ENDOBJECT /* SIZEOF=36 */ + +CONST LNF_LF=1, + LNF_LINK=2, + LNF_OBJECT=4, + LNF_SELECTED=8, + ID_FTXT=$46545854, + ID_CHRS=$43485253 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/audio.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/audio.e new file mode 100644 index 0000000..cb7f64c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/audio.e @@ -0,0 +1,43 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/io', + 'exec/ports' + +#define AUDIONAME 'audio.device' + +CONST ADHARD_CHANNELS=4, + ADALLOC_MINPREC=$FFFFFF80, + ADALLOC_MAXPREC=$7F, + ADCMD_FREE=9, + ADCMD_SETPREC=10, + ADCMD_FINISH=11, + ADCMD_PERVOL=12, + ADCMD_LOCK=13, + ADCMD_WAITCYCLE=14, + ADCMD_ALLOCATE=$20, + ADIOB_PERVOL=4, + ADIOF_PERVOL=16, + ADIOB_SYNCCYCLE=5, + ADIOF_SYNCCYCLE=$20, + ADIOB_NOWAIT=6, + ADIOF_NOWAIT=$40, + ADIOB_WRITEMESSAGE=7, + ADIOF_WRITEMESSAGE=$80, + ADIOERR_NOALLOCATION=-10, + ADIOERR_ALLOCFAILED=-11, + ADIOERR_CHANNELSTOLEN=-12 + +OBJECT ioaudio + io:io + allockey:INT + data:PTR TO CHAR + length:LONG + period:INT -> This is unsigned + volume:INT -> This is unsigned + cycles:INT -> This is unsigned + writemsg:mn +ENDOBJECT /* SIZEOF=68 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/bootblock.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/bootblock.e new file mode 100644 index 0000000..d29bb21 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/bootblock.e @@ -0,0 +1,12 @@ +OPT MODULE +OPT EXPORT + +OBJECT bb + id[4]:ARRAY + chksum:LONG + dosblock:LONG +ENDOBJECT /* SIZEOF=12 */ + +CONST BOOTSECTS=2, + BBNAME_DOS=$444F5300, + BBNAME_KICK=$4B49434B diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/cd.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/cd.e new file mode 100644 index 0000000..4a7df38 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/cd.e @@ -0,0 +1,172 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes' + +CONST CD_RESET=1, + CD_READ=2, + CD_WRITE=3, + CD_UPDATE=4, + CD_CLEAR=5, + CD_STOP=6, + CD_START=7, + CD_FLUSH=8, + CD_MOTOR=9, + CD_SEEK=10, + CD_FORMAT=11, + CD_REMOVE=12, + CD_CHANGENUM=13, + CD_CHANGESTATE=14, + CD_PROTSTATUS=15, + CD_GETDRIVETYPE=18, + CD_GETNUMTRACKS=19, + CD_ADDCHANGEINT=20, + CD_REMCHANGEINT=21, + CD_GETGEOMETRY=22, + CD_EJECT=23, + CD_INFO=32, + CD_CONFIG=33, + CD_TOCMSF=34, + CD_TOCLSN=35, + CD_READXL=36, + CD_PLAYTRACK=37, + CD_PLAYMSF=38, + CD_PLAYLSN=39, + CD_PAUSE=40, + CD_SEARCH=41, + CD_QCODEMSF=42, + CD_QCODELSN=43, + CD_ATTENUATE=44, + CD_ADDFRAMEINT=45, + CD_REMFRAMEINT=46, + CDERR_OPENFAIL=-1, + CDERR_ABORTED=-2, + CDERR_NOCMD=-3, + CDERR_BADLENGTH=-4, + CDERR_BADADDRESS=-5, + CDERR_UNITBUSY=-6, + CDERR_SELFTEST=-7, + CDERR_NOTSPECIFIED=20, + CDERR_NOSECHDR=21, + CDERR_BADSECPREAMBLE=22, + CDERR_BADSECID=23, + CDERR_BADHDRSUM=24, + CDERR_BADSECSUM=25, + CDERR_TOOFEWSECS=26, + CDERR_BADSECHDR=27, + CDERR_WRITEPROT=28, + CDERR_NODISK=29, + CDERR_SEEKERROR=30, + CDERR_NOMEM=31, + CDERR_BADUNITNUM=32, + CDERR_BADDRIVETYPE=33, + CDERR_DRIVEINUSE=34, + CDERR_POSTRESET=35, + CDERR_BADDATATYPE=36, + CDERR_INVALIDSTATE=37, + CDERR_PHASE=42, + CDERR_NOBOARD=50, + TAGCD_PLAYSPEED=1, + TAGCD_READSPEED=2, + TAGCD_READXLSPEED=3, + TAGCD_SECTORSIZE=4, + TAGCD_XLECC=5, + TAGCD_EJECTRESET=6 + +OBJECT cdinfo + playspeed:INT -> This is unsigned + readspeed:INT -> This is unsigned + readxlspeed:INT -> This is unsigned + sectorsize:INT -> This is unsigned + xlecc:INT -> This is unsigned + ejectreset:INT -> This is unsigned + reserved1[4]:ARRAY OF INT -> Array is unsigned + maxspeed:INT -> This is unsigned + audioprecision:INT -> This is unsigned + status:INT -> This is unsigned + reserved2[4]:ARRAY OF INT -> Array is unsigned +ENDOBJECT + +CONST CDSTSB_CLOSED=0, + CDSTSB_DISK=1, + CDSTSB_SPIN=2, + CDSTSB_TOC=3, + CDSTSB_CDROM=4, + CDSTSB_PLAYING=5, + CDSTSB_PAUSED=6, + CDSTSB_SEARCH=7, + CDSTSB_DIRECTION=8, + CDSTSF_CLOSED=1, + CDSTSF_DISK=2, + CDSTSF_SPIN=4, + CDSTSF_TOC=8, + CDSTSF_CDROM=$10, + CDSTSF_PLAYING=$20, + CDSTSF_PAUSED=$40, + CDSTSF_SEARCH=$80, + CDSTSF_DIRECTION=$100, + CDMODE_NORMAL=0, + CDMODE_FFWD=1, + CDMODE_FREV=2 + +OBJECT rmsf + reserved:CHAR + minute:CHAR + second:CHAR + frame:CHAR +ENDOBJECT + +OBJECT lsnmsf +-> a) next is unioned with "lsn:LONG" + msf:rmsf +ENDOBJECT + +OBJECT cdxl + node:mln + buffer:PTR TO CHAR + length:LONG + actual:LONG + intdata:LONG + intcode:LONG +ENDOBJECT + +OBJECT tocsummary + firsttrack:CHAR + lasttrack:CHAR + leadout:lsnmsf +ENDOBJECT + +OBJECT tocentry + ctladr:CHAR + track:CHAR + position:lsnmsf +ENDOBJECT + +OBJECT cdtoc +-> a) next is unioned with "summary:tocsummary" + entry:tocentry +ENDOBJECT + +OBJECT qcode + ctladr:CHAR + track:CHAR + index:CHAR + zero:CHAR + trackposition:lsnmsf + diskposition:lsnmsf +ENDOBJECT + +CONST CTLADR_CTLMASK=$F0, + CTL_CTLMASK=$D0, + CTL_2AUD=0, + CTL_2AUDEMPH=$10, + CTL_4AUD=$80, + CTL_4AUDEMPH=$90, + CTL_DATA=$40, + CTL_COPYMASK=$20, + CTL_COPY=$20, + CTLADR_ADRMASK=$F, + ADR_POSITION=1, + ADR_UPC=2, + ADR_ISRC=3, + ADR_HYBRID=5 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/clipboard.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/clipboard.e new file mode 100644 index 0000000..12db9fd --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/clipboard.e @@ -0,0 +1,47 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/devices', + 'exec/nodes', + 'exec/ports' + +CONST DEVICES_CLIPBOARD_I=1, + CBD_POST=9, + CBD_CURRENTREADID=10, + CBD_CURRENTWRITEID=11, + CBD_CHANGEHOOK=12, + CBERR_OBSOLETEID=1 + +OBJECT clipboardunitpartial + node:ln + unitnum:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT ioclipreq + message:mn + device:PTR TO dd + unit:PTR TO clipboardunitpartial + command:INT -> This is unsigned + flags:CHAR + error:CHAR -> This is signed + actual:LONG + length:LONG + data:PTR TO CHAR + offset:LONG + clipid:LONG +ENDOBJECT /* SIZEOF=52 */ + +CONST PRIMARY_CLIP=0 + +OBJECT satisfymsg + msg:mn + unit:INT -> This is unsigned + clipid:LONG +ENDOBJECT /* SIZEOF=26 */ + +OBJECT cliphookmsg + type:LONG + changecmd:LONG + clipid:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/console.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/console.e new file mode 100644 index 0000000..9bad7a9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/console.e @@ -0,0 +1,62 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +CONST CD_ASKKEYMAP=9, + CD_SETKEYMAP=10, + CD_ASKDEFAULTKEYMAP=11, + CD_SETDEFAULTKEYMAP=12, + SGR_PRIMARY=0, + SGR_BOLD=1, + SGR_ITALIC=3, + SGR_UNDERSCORE=4, + SGR_NEGATIVE=7, + SGR_NORMAL=22, + SGR_NOTITALIC=23, + SGR_NOTUNDERSCORE=24, + SGR_POSITIVE=27, + SGR_BLACK=30, + SGR_RED=31, + SGR_GREEN=$20, + SGR_YELLOW=$21, + SGR_BLUE=$22, + SGR_MAGENTA=$23, + SGR_CYAN=$24, + SGR_WHITE=$25, + SGR_DEFAULT=$27, + SGR_BLACKBG=$28, + SGR_REDBG=$29, + SGR_GREENBG=$2A, + SGR_YELLOWBG=$2B, + SGR_BLUEBG=$2C, + SGR_MAGENTABG=$2D, + SGR_CYANBG=$2E, + SGR_WHITEBG=$2F, + SGR_DEFAULTBG=$31, + SGR_CLR0=30, + SGR_CLR1=31, + SGR_CLR2=$20, + SGR_CLR3=$21, + SGR_CLR4=$22, + SGR_CLR5=$23, + SGR_CLR6=$24, + SGR_CLR7=$25, + SGR_CLR0BG=$28, + SGR_CLR1BG=$29, + SGR_CLR2BG=$2A, + SGR_CLR3BG=$2B, + SGR_CLR4BG=$2C, + SGR_CLR5BG=$2D, + SGR_CLR6BG=$2E, + SGR_CLR7BG=$2F, + DSR_CPR=6, + CTC_HSETTAB=0, + CTC_HCLRTAB=2, + CTC_HCLRTABSALL=5, + TBC_HCLRTAB=0, + TBC_HCLRTABSALL=3, + M_LNM=20 + +#define M_ASM '>1' +#define M_AWM '?7' diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/conunit.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/conunit.e new file mode 100644 index 0000000..46e2f72 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/conunit.e @@ -0,0 +1,57 @@ +OPT MODULE +OPT EXPORT + +MODULE 'devices/keymap', + 'exec/ports', + 'graphics/text', + 'intuition/intuition' + +CONST CONU_LIBRARY=-1, + CONU_STANDARD=0, + CONU_CHARMAP=1, + CONU_SNIPMAP=3, + CONFLAG_DEFAULT=0, + CONFLAG_NODRAW_ON_NEWSIZE=1, + PMB_ASM=21, + PMB_AWM=22, + MAXTABS=$50 + +OBJECT conunit + mp:mp + window:PTR TO window + xcp:INT + ycp:INT + xmax:INT + ymax:INT + xrsize:INT + yrsize:INT + xrorigin:INT + yrorigin:INT + xrextant:INT + yrextant:INT + xminshrink:INT + yminshrink:INT + xccp:INT + yccp:INT + keymapstruct:keymap + tabstops[$50]:ARRAY OF INT -> Array is unsigned + mask:CHAR -> This is signed + fgpen:CHAR -> This is signed + bgpen:CHAR -> This is signed + aolpen:CHAR -> This is signed + drawmode:CHAR -> This is signed + obsolete1:CHAR + obsolete2:LONG + minterms[8]:ARRAY + font:PTR TO textfont + algostyle:CHAR + txflags:CHAR + txheight:INT -> This is unsigned + txwidth:INT -> This is unsigned + txbaseline:INT -> This is unsigned + txspacing:INT + modes[3]:ARRAY +-> Um, have to fiddle alignment in .m file + rawevents[3]:ARRAY +ENDOBJECT /* SIZEOF=296 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/gameport.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/gameport.e new file mode 100644 index 0000000..ed23a0a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/gameport.e @@ -0,0 +1,27 @@ +OPT MODULE +OPT EXPORT + +CONST GPD_READEVENT=9, + GPD_ASKCTYPE=10, + GPD_SETCTYPE=11, + GPD_ASKTRIGGER=12, + GPD_SETTRIGGER=13, + GPTB_DOWNKEYS=0, + GPTF_DOWNKEYS=1, + GPTB_UPKEYS=1, + GPTF_UPKEYS=2 + +OBJECT gameporttrigger + keys:INT -> This is unsigned + timeout:INT -> This is unsigned + xdelta:INT -> This is unsigned + ydelta:INT -> This is unsigned +ENDOBJECT /* SIZEOF=8 */ + +CONST GPCT_ALLOCATED=-1, + GPCT_NOCONTROLLER=0, + GPCT_MOUSE=1, + GPCT_RELJOYSTICK=2, + GPCT_ABSJOYSTICK=3, + GPDERR_SETCTYPE=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/hardblocks.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/hardblocks.e new file mode 100644 index 0000000..7119321 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/hardblocks.e @@ -0,0 +1,134 @@ +OPT MODULE +OPT EXPORT + +OBJECT rigiddiskblock + id:LONG + summedlongs:LONG + chksum:LONG + hostid:LONG + blockbytes:LONG + flags:LONG + badblocklist:LONG + partitionlist:LONG + filesysheaderlist:LONG + driveinit:LONG + reserved1[6]:ARRAY OF LONG + cylinders:LONG + sectors:LONG + heads:LONG + interleave:LONG + park:LONG + reserved2[3]:ARRAY OF LONG + writeprecomp:LONG + reducedwrite:LONG + steprate:LONG + reserved3[5]:ARRAY OF LONG + rdbblockslo:LONG + rdbblockshi:LONG + locylinder:LONG + hicylinder:LONG + cylblocks:LONG + autoparkseconds:LONG + highrdskblock:LONG + reserved4:LONG + diskvendor[8]:ARRAY + diskproduct[16]:ARRAY + diskrevision[4]:ARRAY + controllervendor[8]:ARRAY + controllerproduct[16]:ARRAY + controllerrevision[4]:ARRAY + reserved5[10]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=256 */ + +CONST IDNAME_RIGIDDISK=$5244534B, + RDB_LOCATION_LIMIT=16, + RDBFB_LAST=0, + RDBFF_LAST=1, + RDBFB_LASTLUN=1, + RDBFF_LASTLUN=2, + RDBFB_LASTTID=2, + RDBFF_LASTTID=4, + RDBFB_NORESELECT=3, + RDBFF_NORESELECT=8, + RDBFB_DISKID=4, + RDBFF_DISKID=16, + RDBFB_CTRLRID=5, + RDBFF_CTRLRID=$20, + RDBFB_SYNCH=6, + RDBFF_SYNCH=$40 + +OBJECT badblockentry + badblock:LONG + goodblock:LONG +ENDOBJECT /* SIZEOF=8 */ + +OBJECT badblockblock + id:LONG + summedlongs:LONG + chksum:LONG + hostid:LONG + next:LONG + reserved:LONG + blockpairs[61]:ARRAY OF badblockentry +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST IDNAME_BADBLOCK=$42414442 + +OBJECT partitionblock + id:LONG + summedlongs:LONG + chksum:LONG + hostid:LONG + next:LONG + flags:LONG + reserved1[2]:ARRAY OF LONG + devflags:LONG + drivename[32]:ARRAY + reserved2[15]:ARRAY OF LONG + environment[17]:ARRAY OF LONG + ereserved[15]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=256 */ + +CONST IDNAME_PARTITION=$50415254, + PBFF_BOOTABLE=0, + PBFF_BOOTABLE=1, + PBFF_NOMOUNT=1, + PBFF_NOMOUNT=2 + +OBJECT filesysheaderblock + id:LONG + summedlongs:LONG + chksum:LONG + hostid:LONG + next:LONG + flags:LONG + reserved1[2]:ARRAY OF LONG + dostype:LONG + version:LONG + patchflags:LONG + type:LONG + task:LONG + lock:LONG + handler:LONG + stacksize:LONG + priority:LONG + startup:LONG + seglistblocks:LONG + globalvec:LONG + reserved2[23]:ARRAY OF LONG + reserved3[21]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=256 */ + +CONST IDNAME_FILESYSHEADER=$46534844 + +OBJECT loadsegblock + id:LONG + summedlongs:LONG + chksum:LONG + hostid:LONG + next:LONG + loaddata[123]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST IDNAME_LOADSEG=$4C534547 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/input.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/input.e new file mode 100644 index 0000000..61ff5d3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/input.e @@ -0,0 +1,12 @@ +OPT MODULE +OPT EXPORT + +CONST IND_ADDHANDLER=9, + IND_REMHANDLER=10, + IND_WRITEEVENT=11, + IND_SETTHRESH=12, + IND_SETPERIOD=13, + IND_SETMPORT=14, + IND_SETMTYPE=15, + IND_SETMTRIG=16 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/inputevent.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/inputevent.e new file mode 100644 index 0000000..39d2cd2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/inputevent.e @@ -0,0 +1,135 @@ +OPT MODULE +OPT EXPORT + +MODULE 'devices/timer', + 'intuition/screens', + 'utility/hooks', + 'utility/tagitem' + +CONST IECLASS_NULL=0, + IECLASS_RAWKEY=1, + IECLASS_RAWMOUSE=2, + IECLASS_EVENT=3, + IECLASS_POINTERPOS=4, + IECLASS_TIMER=6, + IECLASS_GADGETDOWN=7, + IECLASS_GADGETUP=8, + IECLASS_REQUESTER=9, + IECLASS_MENULIST=10, + IECLASS_CLOSEWINDOW=11, + IECLASS_SIZEWINDOW=12, + IECLASS_REFRESHWINDOW=13, + IECLASS_NEWPREFS=14, + IECLASS_DISKREMOVED=15, + IECLASS_DISKINSERTED=16, + IECLASS_ACTIVEWINDOW=17, + IECLASS_INACTIVEWINDOW=18, + IECLASS_NEWPOINTERPOS=19, + IECLASS_MENUHELP=20, + IECLASS_CHANGEWINDOW=21, + IECLASS_MAX=21, + IESUBCLASS_COMPATIBLE=0, + IESUBCLASS_PIXEL=1, + IESUBCLASS_TABLET=2, + IESUBCLASS_NEWTABLET=3 + +OBJECT iepointerpixel + screen:PTR TO screen + positionx:INT + positiony:INT +ENDOBJECT /* SIZEOF=8 */ + +OBJECT iepointertablet + rangex:INT -> This is unsigned + rangey:INT -> This is unsigned + valuex:INT -> This is unsigned + valuey:INT -> This is unsigned + pressure:INT +ENDOBJECT /* SIZEOF=10 */ + +OBJECT ienewtablet + callback:PTR TO hook + scaledx:INT -> This is unsigned + scaledy:INT -> This is unsigned + scaledxfraction:INT -> This is unsigned + scaledyfraction:INT -> This is unsigned + tabletx:LONG + tablety:LONG + rangex:LONG + rangey:LONG + taglist:PTR TO tagitem +ENDOBJECT /* SIZEOF=32 */ + +CONST IECODE_UP_PREFIX=$80, + IECODEB_UP_PREFIX=7, + IECODE_KEY_CODE_FIRST=0, + IECODE_KEY_CODE_LAST=$77, + IECODE_COMM_CODE_FIRST=$78, + IECODE_COMM_CODE_LAST=$7F, + IECODE_C0_FIRST=0, + IECODE_C0_LAST=31, + IECODE_ASCII_FIRST=$20, + IECODE_ASCII_LAST=$7E, + IECODE_ASCII_DEL=$7F, + IECODE_C1_FIRST=$80, + IECODE_C1_LAST=$9F, + IECODE_LATIN1_FIRST=$A0, + IECODE_LATIN1_LAST=$FF, + IECODE_LBUTTON=$68, + IECODE_RBUTTON=$69, + IECODE_MBUTTON=$6A, + IECODE_NOBUTTON=$FF, + IECODE_NEWACTIVE=1, + IECODE_NEWSIZE=2, + IECODE_REFRESH=3, + IECODE_REQSET=1, + IECODE_REQCLEAR=0, + IEQUALIFIER_LSHIFT=1, + IEQUALIFIER_RSHIFT=2, + IEQUALIFIER_CAPSLOCK=4, + IEQUALIFIER_CONTROL=8, + IEQUALIFIER_LALT=16, + IEQUALIFIER_RALT=$20, + IEQUALIFIER_LCOMMAND=$40, + IEQUALIFIER_RCOMMAND=$80, + IEQUALIFIER_NUMERICPAD=$100, + IEQUALIFIER_REPEAT=$200, + IEQUALIFIER_INTERRUPT=$400, + IEQUALIFIER_MULTIBROADCAST=$800, + IEQUALIFIER_MIDBUTTON=$1000, + IEQUALIFIER_RBUTTON=$2000, + IEQUALIFIER_LEFTBUTTON=$4000, + IEQUALIFIER_RELATIVEMOUSE=$8000, + IEQUALIFIERB_LSHIFT=0, + IEQUALIFIERB_RSHIFT=1, + IEQUALIFIERB_CAPSLOCK=2, + IEQUALIFIERB_CONTROL=3, + IEQUALIFIERB_LALT=4, + IEQUALIFIERB_RALT=5, + IEQUALIFIERB_LCOMMAND=6, + IEQUALIFIERB_RCOMMAND=7, + IEQUALIFIERB_NUMERICPAD=8, + IEQUALIFIERB_REPEAT=9, + IEQUALIFIERB_INTERRUPT=10, + IEQUALIFIERB_MULTIBROADCAST=11, + IEQUALIFIERB_MIDBUTTON=12, + IEQUALIFIERB_RBUTTON=13, + IEQUALIFIERB_LEFTBUTTON=14, + IEQUALIFIERB_RELATIVEMOUSE=15 + +OBJECT inputevent + nextevent:PTR TO inputevent + class:CHAR + subclass:CHAR + code:INT -> This is unsigned + qualifier:INT -> This is unsigned +-> a) next four CHARs are unioned as "eventaddress:LONG" +-> b) next two CHARs are unioned as "x:INT" + prev1downcode:CHAR + prev1downqual:CHAR +-> b) next two CHARs are unioned "y:INT" + prev2downcode:CHAR + prev2downqual:CHAR + timestamp:timeval +ENDOBJECT /* SIZEOF=22 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/keyboard.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/keyboard.e new file mode 100644 index 0000000..f02388f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/keyboard.e @@ -0,0 +1,9 @@ +OPT MODULE +OPT EXPORT + +CONST KBD_READEVENT=9, + KBD_READMATRIX=10, + KBD_ADDRESETHANDLER=11, + KBD_REMRESETHANDLER=12, + KBD_RESETHANDLERDONE=13 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/keymap.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/keymap.e new file mode 100644 index 0000000..3f5a301 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/keymap.e @@ -0,0 +1,49 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/lists', + 'exec/nodes' + +OBJECT keymap + lokeymaptypes:PTR TO CHAR + lokeymap:PTR TO LONG + locapsable:PTR TO CHAR + lorepeatable:PTR TO CHAR + hikeymaptypes:PTR TO CHAR + hikeymap:PTR TO LONG + hicapsable:PTR TO CHAR + hirepeatable:PTR TO CHAR +ENDOBJECT /* SIZEOF=32 */ + +OBJECT keymapnode + node:ln + keymap:keymap +ENDOBJECT /* SIZEOF=46 */ + +OBJECT keymapresource + node:ln + list:lh +ENDOBJECT /* SIZEOF=28 */ + +CONST KCB_NOP=7, + KCF_NOP=$80, + KC_NOQUAL=0, + KC_VANILLA=7, + KCB_SHIFT=0, + KCF_SHIFT=1, + KCB_ALT=1, + KCF_ALT=2, + KCB_CONTROL=2, + KCF_CONTROL=4, + KCB_DOWNUP=3, + KCF_DOWNUP=8, + KCB_DEAD=5, + KCF_DEAD=$20, + KCB_STRING=6, + KCF_STRING=$40, + DPB_MOD=0, + DPF_MOD=1, + DPB_DEAD=3, + DPF_DEAD=8, + DP_2DINDEXMASK=15, + DP_2DFACSHIFT=4 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/narrator.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/narrator.e new file mode 100644 index 0000000..c90fc6a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/narrator.e @@ -0,0 +1,95 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/io' + +CONST DEFPITCH=$6E, + DEFRATE=$96, + DEFVOL=$40, + DEFFREQ=$56B8, + NATURALF0=0, + ROBOTICF0=1, + MANUALF0=2, + MALE=0, + FEMALE=1, + DEFSEX=0, + DEFMODE=0, + DEFARTIC=$64, + DEFCENTRAL=0, + DEFF0PERT=0, + DEFF0ENTHUS=$20, + DEFPRIORITY=$64, + MINRATE=$28, + MAXRATE=$190, + MINPITCH=$41, + MAXPITCH=$140, + MINFREQ=$1388, + MAXFREQ=$6D60, + MINVOL=0, + MAXVOL=$40, + MINCENT=0, + MAXCENT=$64, + ND_NOTUSED=-1, + ND_NOMEM=-2, + ND_NOAUDLIB=-3, + ND_MAKEBAD=-4, + ND_UNITERR=-5, + ND_CANTALLOC=-6, + ND_UNIMPL=-7, + ND_NOWRITE=-8, + ND_EXPUNGED=-9, + ND_PHONERR=-20, + ND_RATEERR=-21, + ND_PITCHERR=-22, + ND_SEXERR=-23, + ND_MODEERR=-24, + ND_FREQERR=-25, + ND_VOLERR=-26, + ND_DCENTERR=-27, + ND_CENTPHONERR=-28, + NDB_NEWIORB=0, + NDB_WORDSYNC=1, + NDB_SYLSYNC=2, + NDF_NEWIORB=1, + NDF_WORDSYNC=2, + NDF_SYLSYNC=4 + +OBJECT ndi + iostd:iostd + rate:INT -> This is unsigned + pitch:INT -> This is unsigned + mode:INT -> This is unsigned + sex:INT -> This is unsigned + chmasks:PTR TO CHAR + nummasks:INT -> This is unsigned + volume:INT -> This is unsigned + sampfreq:INT -> This is unsigned + mouths:CHAR + chanmask:CHAR + numchan:CHAR + flags:CHAR + f0enthusiasm:CHAR + f0perturb:CHAR + f1adj:CHAR -> This is signed + f2adj:CHAR -> This is signed + f3adj:CHAR -> This is signed + a1adj:CHAR -> This is signed + a2adj:CHAR -> This is signed + a3adj:CHAR -> This is signed + articulate:CHAR + centralize:CHAR + centphon:PTR TO CHAR + avbias:CHAR -> This is signed + afbias:CHAR -> This is signed + priority:CHAR -> This is signed + pad1:CHAR +ENDOBJECT /* SIZEOF=88 */ + +OBJECT mrb + ndi:ndi + width:CHAR + height:CHAR + shape:CHAR + sync:CHAR +ENDOBJECT /* SIZEOF=92 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/parallel.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/parallel.e new file mode 100644 index 0000000..133c5c3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/parallel.e @@ -0,0 +1,59 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/io' + +CONST PARERR_DEVBUSY=1, + PARERR_BUFTOOBIG=2, + PARERR_INVPARAM=3, + PARERR_LINEERR=4, + PARERR_NOTOPEN=5, + PARERR_PORTRESET=6, + PARERR_INITERR=7, + PDCMD_QUERY=9, + PDCMD_SETPARAMS=10, + PAR_DEVFINISH=10, + PARB_SHARED=5, + PARF_SHARED=$20, + PARB_SLOWMODE=4, + PARF_SLOWMODE=16, + PARB_FASTMODE=3, + PARF_FASTMODE=8, + PARB_RAD_BOOGIE=3, + PARF_RAD_BOOGIE=8, + PARB_ACKMODE=2, + PARF_ACKMODE=4, + PARB_EOFMODE=1, + PARF_EOFMODE=2, + IOPARB_QUEUED=6, + IOPARF_QUEUED=$40, + IOPARB_ABORT=5, + IOPARF_ABORT=$20, + IOPARB_ACTIVE=4, + IOPARF_ACTIVE=16, + IOPTB_RWDIR=3, + IOPTF_RWDIR=8, + IOPTB_PARSEL=2, + IOPTF_PARSEL=4, + IOPTB_PAPEROUT=1, + IOPTF_PAPEROUT=2, + IOPTB_PARBUSY=0, + IOPTF_PARBUSY=1 + +#define PARALLELNAME 'parallel.device' + +OBJECT ioparray +-> Um, names were wrong and illegal + ptermarray0:LONG + ptermarray1:LONG +ENDOBJECT /* SIZEOF=8 */ + +OBJECT ioextpar + iostd:iostd + pextflags:LONG + parstatus:CHAR + parflags:CHAR + ptermarray:ioparray +ENDOBJECT /* SIZEOF=62 */ diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/printer.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/printer.e new file mode 100644 index 0000000..ad18f7d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/printer.e @@ -0,0 +1,143 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/io', + 'graphics/rastport', + 'graphics/view' + +CONST DEVICES_PRINTER_I=1, + PRD_RAWWRITE=9, + PRD_PRTCOMMAND=10, + PRD_DUMPRPORT=11, + PRD_QUERY=12, + ARIS=0, + ARIN=1, + AIND=2, + ANEL=3, + ARI=4, + ASGR0=5, + ASGR3=6, + ASGR23=7, + ASGR4=8, + ASGR24=9, + ASGR1=10, + ASGR22=11, + ASFC=12, + ASBC=13, + ASHORP0=14, + ASHORP2=15, + ASHORP1=16, + ASHORP4=17, + ASHORP3=18, + ASHORP6=19, + ASHORP5=20, + ADEN6=21, + ADEN5=22, + ADEN4=23, + ADEN3=24, + ADEN2=25, + ADEN1=26, + ASUS2=27, + ASUS1=28, + ASUS4=29, + ASUS3=30, + ASUS0=31, + APLU=$20, + APLD=$21, + AFNT0=$22, + AFNT1=$23, + AFNT2=$24, + AFNT3=$25, + AFNT4=$26, + AFNT5=$27, + AFNT6=$28, + AFNT7=$29, + AFNT8=$2A, + AFNT9=$2B, + AFNT10=$2C, + APROP2=$2D, + APROP1=$2E, + APROP0=$2F, + ATSS=$30, + AJFY5=$31, + AJFY7=$32, + AJFY6=$33, + AJFY0=$34, + AJFY2=$35, + AJFY3=$36, + AVERP0=$37, + AVERP1=$38, + ASLPP=$39, + APERF=$3A, + APERF0=$3B, + ALMS=$3C, + ARMS=$3D, + ATMS=$3E, + ABMS=$3F, + ASTBM=$40, + ASLRM=$41, + ACAM=$42, + AHTS=$43, + AVTS=$44, + ATBC0=$45, + ATBC3=$46, + ATBC1=$47, + ATBC4=$48, + ATBCALL=$49, + ATBSALL=$4A, + AEXTEND=$4B, + ARAW=$4C + +OBJECT ioprtcmdreq + io:io + prtcommand:INT -> This is unsigned + parm0:CHAR + parm1:CHAR + parm2:CHAR + parm3:CHAR +ENDOBJECT /* SIZEOF=38 */ + +OBJECT iodrpreq + io:io + rastport:PTR TO rastport + colormap:PTR TO colormap + modes:LONG + srcx:INT -> This is unsigned + srcy:INT -> This is unsigned + srcwidth:INT -> This is unsigned + srcheight:INT -> This is unsigned + destcols:LONG + destrows:LONG + special:INT -> This is unsigned +ENDOBJECT /* SIZEOF=62 */ + +CONST SPECIAL_MILCOLS=1, + SPECIAL_MILROWS=2, + SPECIAL_FULLCOLS=4, + SPECIAL_FULLROWS=8, + SPECIAL_FRACCOLS=16, + SPECIAL_FRACROWS=$20, + SPECIAL_CENTER=$40, + SPECIAL_ASPECT=$80, + SPECIAL_DENSITY1=$100, + SPECIAL_DENSITY2=$200, + SPECIAL_DENSITY3=$300, + SPECIAL_DENSITY4=$400, + SPECIAL_DENSITY5=$500, + SPECIAL_DENSITY6=$600, + SPECIAL_DENSITY7=$700, + SPECIAL_NOFORMFEED=$800, + SPECIAL_TRUSTME=$1000, + SPECIAL_NOPRINT=$2000, + PDERR_NOERR=0, + PDERR_CANCEL=1, + PDERR_NOTGRAPHICS=2, + PDERR_INVERTHAM=3, + PDERR_BADDIMENSION=4, + PDERR_DIMENSIONOVFLOW=5, + PDERR_INTERNALMEMORY=6, + PDERR_BUFFERMEMORY=7, + PDERR_TOOKCONTROL=8, + SPECIAL_DENSITYMASK=$700, + SPECIAL_DIMENSIONSMASK=$bf + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/prtbase.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/prtbase.e new file mode 100644 index 0000000..4a9ffdc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/prtbase.e @@ -0,0 +1,116 @@ +OPT MODULE +OPT EXPORT + +MODULE 'devices/serial', + 'devices/timer', + 'exec/libraries', + 'exec/ports', + 'exec/tasks', + 'intuition/preferences' + +CONST DEVICES_PRTBASE_I=1 + +OBJECT devicedata + lib:lib + segment:LONG + execbase:LONG + cmdvectors:LONG + cmdbytes:PTR TO CHAR + numcommands:INT -> This is unsigned +ENDOBJECT /* SIZEOF=52 */ + +CONST DU_FLAGS=9, + IOF_QUEUED=16, + IOF_CURRENT=$20, + IOF_SERVICING=$40, + IOF_DONE=$80, + DUF_STOPPED=1, + P_PRIORITY=0, + P_OLDSTKSIZE=$800, + P_STKSIZE=$1000, + P_BUFSIZE=$100, + P_SAFESIZE=$80, + PF_IOR0=1, + PF_IOR1=2, + PF_EXPUNGED=$80 + +OBJECT printerdata + dd:devicedata + unit:mp + printersegment:LONG + printertype:INT -> This is unsigned + segmentdata:PTR TO printersegment + printbuf:PTR TO CHAR + pwrite:LONG + pbothready:LONG +-> Um, these were both wrong +-> a) next is unioned with "p0:ioextpar" + s0:ioextser +-> a) next is unioned with "p1:ioextpar" + s1:ioextser + tior:timerequest + iorport:mp + tc:tc + oldstk[$800]:ARRAY + flags:CHAR + pad:CHAR + preferences:preferences + pwaitenabled:CHAR + pad1:CHAR + stk[$1000]:ARRAY +ENDOBJECT /* SIZEOF=6778 */ + +CONST PPCB_GFX=0, + PPCF_GFX=1, + PPCB_COLOR=1, + PPCF_COLOR=2, + PPC_BWALPHA=0, + PPC_BWGFX=1, + PPC_COLORALPHA=2, + PPC_COLORGFX=3, + PCC_BW=1, + PCC_YMC=2, + PCC_YMC_BW=3, + PCC_YMCB=4, + PCC_4COLOR=4, + PCC_ADDITIVE=8, + PCC_WB=9, + PCC_BGR=10, + PCC_BGR_WB=11, + PCC_BGRW=12, + PCC_MULTI_PASS=16 + +OBJECT printerextendeddata + printername:PTR TO CHAR + init:LONG + expunge:LONG + open:LONG + close:LONG + printerclass:CHAR + colorclass:CHAR + maxcolumns:CHAR + numcharsets:CHAR + numrows:INT -> This is unsigned + maxxdots:LONG + maxydots:LONG + xdotsinch:INT -> This is unsigned + ydotsinch:INT -> This is unsigned + commands:PTR TO LONG + dospecial:LONG + render:LONG + timeoutsecs:LONG +-> Um, this had an illegal name + x8bitchars:PTR TO LONG + printmode:LONG + convfunv:LONG +ENDOBJECT /* SIZEOF=66 */ + +OBJECT printersegment + nextsegment:LONG + runalert:LONG + version:INT -> This is unsigned + revision:INT -> This is unsigned +-> Um, this was missing + ped:printerextendeddata +ENDOBJECT /* SIZEOF=NONE !!! */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/prtgfx.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/prtgfx.e new file mode 100644 index 0000000..235e3f5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/prtgfx.e @@ -0,0 +1,62 @@ +OPT MODULE +OPT EXPORT + +MODULE 'graphics/rastport' + +CONST PCMYELLOW=0, + PCMMAGENTA=1, + PCMCYAN=2, + PCMBLACK=3, + PCMBLUE=0, + PCMGREEN=1, + PCMRED=2, + PCMWHITE=3 + +OBJECT colorentry +-> a) next four CHARs are unioned as "colorlong:LONG" +-> b) also unioned as "colorsbyte[4]:ARRAY", which is signed CHARs + colorbyte[4]:ARRAY +ENDOBJECT /* SIZEOF=4 */ + +OBJECT prtinfo + render:LONG + rp:PTR TO rastport + temprp:PTR TO rastport + rowbuf:PTR TO INT -> Target is unsigned + hambuf:PTR TO INT -> Target is unsigned + colormap:PTR TO colorentry + colorint:PTR TO colorentry + hamint:PTR TO colorentry + dest1int:PTR TO colorentry + dest2int:PTR TO colorentry + scalex:PTR TO INT -> Target is unsigned + scalexalt:PTR TO INT -> Target is unsigned + dmatrix:PTR TO CHAR + topbuf:PTR TO INT -> Target is unsigned + botbuf:PTR TO INT -> Target is unsigned + rowbufsize:INT -> This is unsigned + hambufsize:INT -> This is unsigned + colormapsize:INT -> This is unsigned + colorintsize:INT -> This is unsigned + hamintsize:INT -> This is unsigned + dest1intsize:INT -> This is unsigned + dest2intsize:INT -> This is unsigned + scalexsize:INT -> This is unsigned + scalexaltsize:INT -> This is unsigned + prefsflags:INT -> This is unsigned + special:LONG + xstart:INT -> This is unsigned + ystart:INT -> This is unsigned + width:INT -> This is unsigned + height:INT -> This is unsigned + pc:LONG + pr:LONG + ymult:INT -> This is unsigned + ymod:INT -> This is unsigned + ety:INT + xpos:INT -> This is unsigned + threshold:INT -> This is unsigned + tempwidth:INT -> This is unsigned + flags:INT -> This is unsigned +ENDOBJECT /* SIZEOF=114 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/scsidisk.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/scsidisk.e new file mode 100644 index 0000000..f5124e1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/scsidisk.e @@ -0,0 +1,36 @@ +OPT MODULE +OPT EXPORT + +CONST DEVICES_SCSIDISK_I=1, + HD_SCSICMD=28 + +OBJECT scsicmd + data:PTR TO INT -> Target is unsigned + length:LONG + actual:LONG + command:PTR TO CHAR + cmdlength:INT -> This is unsigned + cmdactual:INT -> This is unsigned + flags:CHAR + status:CHAR + sensedata:PTR TO CHAR + senselength:INT -> This is unsigned + senseactual:INT -> This is unsigned +ENDOBJECT /* SIZEOF=30 */ + +CONST SCSIF_WRITE=0, + SCSIF_READ=1, + SCSIB_READ_WRITE=0, + SCSIF_NOSENSE=0, + SCSIF_AUTOSENSE=2, + SCSIF_OLDAUTOSENSE=6, + SCSIB_AUTOSENSE=1, + SCSIB_OLDAUTOSENSE=2, + HFERR_SELFUNIT=$28, + HFERR_DMA=$29, + HFERR_PHASE=$2A, + HFERR_PARITY=$2B, + HFERR_SELTIMEOUT=$2C, + HFERR_BADSTATUS=$2D, + HFERR_NOBOARD=$32 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/serial.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/serial.e new file mode 100644 index 0000000..641ed3b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/serial.e @@ -0,0 +1,75 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/io' + +CONST SER_DEFAULT_CTLCHAR=$11130000, + SDCMD_QUERY=9, + SDCMD_BREAK=10, + SDCMD_SETPARAMS=11, + SER_DEVFINISH=11, + SERB_XDISABLED=7, + SERF_XDISABLED=$80, + SERB_EOFMODE=6, + SERF_EOFMODE=$40, + SERB_SHARED=5, + SERF_SHARED=$20, + SERB_RAD_BOOGIE=4, + SERF_RAD_BOOGIE=16, + SERB_QUEUEDBRK=3, + SERF_QUEUEDBRK=8, + SERB_7WIRE=2, + SERF_7WIRE=4, + SERB_PARTY_ODD=1, + SERF_PARTY_ODD=2, + SERB_PARTY_ON=0, + SERF_PARTY_ON=1, + IOSTB_XOFFREAD=4, + IOSTF_XOFFREAD=16, + IOSTB_XOFFWRITE=3, + IOSTF_XOFFWRITE=8, + IOSTB_READBREAK=2, + IOSTF_READBREAK=4, + IOSTB_WROTEBREAK=1, + IOSTF_WROTEBREAK=2, + IOSTB_OVERRUN=0, + IOSTF_OVERRUN=1, + SEXTB_MSPON=1, + SEXTF_MSPON=2, + SEXTB_MARK=0, + SEXTF_MARK=1 + +OBJECT termarray + ta0:LONG + ta1:LONG +ENDOBJECT /* SIZEOF=8 */ + +OBJECT ioextser + iostd:iostd + ctlchar:LONG + rbuflen:LONG + extflags:LONG + baud:LONG + brktime:LONG + termarray:termarray + readlen:CHAR + writelen:CHAR + stopbits:CHAR + serflags:CHAR + status:INT -> This is unsigned +ENDOBJECT /* SIZEOF=82 */ + +CONST SERERR_DEVBUSY=1, + SERERR_BAUDMISMATCH=2, + SERERR_BUFERR=4, + SERERR_INVPARAM=5, + SERERR_LINEERR=6, + SERERR_PARITYERR=9, + SERERR_TIMERERR=11, + SERERR_BUFOVERFLOW=12, + SERERR_NODSR=13, + SERERR_DETECTEDBREAK=15 + +#define SERIALNAME 'serial.device' diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/timer.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/timer.e new file mode 100644 index 0000000..4783ae6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/timer.e @@ -0,0 +1,34 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/io' + +CONST UNIT_MICROHZ=0, + UNIT_VBLANK=1, + UNIT_ECLOCK=2, + UNIT_WAITUNTIL=3, + UNIT_WAITECLOCK=4 + +#define TIMERNAME 'timer.device' + +OBJECT timeval + secs:LONG + micro:LONG +ENDOBJECT /* SIZEOF=8 */ + +OBJECT eclockval + hi:LONG + lo:LONG +ENDOBJECT /* SIZEOF=8 */ + +OBJECT timerequest + io:io + time:timeval +ENDOBJECT /* SIZEOF=40 */ + +CONST TR_ADDREQUEST=9, + TR_GETSYSTIME=10, + TR_SETSYSTIME=11 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/devices/trackdisk.e b/amigae33a/E_v3.3a/Src/Src/Modules/devices/trackdisk.e new file mode 100644 index 0000000..800623a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/devices/trackdisk.e @@ -0,0 +1,116 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/devices', + 'exec/io' + +CONST NUMSECS=11, + NUMUNITS=4, + TD_SECTOR=$200, + TD_SECSHIFT=9, + TDF_EXTCOM=$8000, + TD_MOTOR=9, + TD_SEEK=10, + TD_FORMAT=11, + TD_REMOVE=12, + TD_CHANGENUM=13, + TD_CHANGESTATE=14, + TD_PROTSTATUS=15, + TD_RAWREAD=16, + TD_RAWWRITE=17, + TD_GETDRIVETYPE=18, + TD_GETNUMTRACKS=19, + TD_ADDCHANGEINT=20, + TD_REMCHANGEINT=21, + TD_GETGEOMETRY=22, + TD_EJECT=23, + TD_LASTCOMM=24, + ETD_WRITE=$8003, + ETD_READ=$8002, + ETD_MOTOR=$8009, + ETD_SEEK=$800A, + ETD_FORMAT=$800B, + ETD_UPDATE=$8004, + ETD_CLEAR=$8005, + ETD_RAWREAD=$8010, + ETD_RAWWRITE=$8011 + +#define TD_NAME 'trackdisk.device' + +OBJECT ioexttd + iostd:iostd + count:LONG + seclabel:LONG +ENDOBJECT /* SIZEOF=56 */ + +OBJECT drivegeometry + sectorsize:LONG + totalsectors:LONG + cylinders:LONG + cylsectors:LONG + heads:LONG + tracksectors:LONG + bufmemtype:LONG + devicetype:CHAR + flags:CHAR + reserved:INT +ENDOBJECT /* SIZEOF=32 */ + +CONST DG_DIRECT_ACCESS=0, + DG_SEQUENTIAL_ACCESS=1, + DG_PRINTER=2, + DG_PROCESSOR=3, + DG_WORM=4, + DG_CDROM=5, + DG_SCANNER=6, + DG_OPTICAL_DISK=7, + DG_MEDIUM_CHANGER=8, + DG_COMMUNICATION=9, + DG_UNKNOWN=31, + DGB_REMOVABLE=0, + DGF_REMOVABLE=1, + IOTDB_INDEXSYNC=4, + IOTDF_INDEXSYNC=16, + IOTDB_WORDSYNC=5, + IOTDF_WORDSYNC=$20, + TD_LABELSIZE=16, + TDB_ALLOW_NON_3_5=0, + TDF_ALLOW_NON_3_5=1, + DRIVE3_5=1, + DRIVE5_25=2, + DRIVE3_5_150RPM=3, + TDERR_NOTSPECIFIED=20, + TDERR_NOSECHDR=21, + TDERR_BADSECPREAMBLE=22, + TDERR_BADSECID=23, + TDERR_BADHDRSUM=24, + TDERR_BADSECSUM=25, + TDERR_TOOFEWSECS=26, + TDERR_BADSECHDR=27, + TDERR_WRITEPROT=28, + TDERR_DISKCHANGED=29, + TDERR_SEEKERROR=30, + TDERR_NOMEM=31, + TDERR_BADUNITNUM=$20, + TDERR_BADDRIVETYPE=$21, + TDERR_DRIVEINUSE=$22, + TDERR_POSTRESET=$23 + +OBJECT publicunit + unit:unit + comp01track:INT -> This is unsigned + comp10track:INT -> This is unsigned + comp11track:INT -> This is unsigned + stepdelay:LONG + settledelay:LONG + retrycnt:CHAR + pubflags:CHAR + currtrk:INT -> This is unsigned + calibratedelay:LONG + counter:LONG +ENDOBJECT /* SIZEOF=64 */ + +CONST TDPB_NOCLICK=0, + TDPF_NOCLICK=1 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/diskfont.e b/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/diskfont.e new file mode 100644 index 0000000..5d10156 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/diskfont.e @@ -0,0 +1,71 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes', + 'graphics/text' + +CONST MAXFONTPATH=$100 + +OBJECT fc + filename[$100]:ARRAY + ysize:INT -> This is unsigned + style:CHAR + flags:CHAR +ENDOBJECT /* SIZEOF=260 */ + +OBJECT tfc + filename[$fe]:ARRAY + tagcount:INT -> This is unsigned + ysize:INT -> This is unsigned + style:CHAR + flags:CHAR +ENDOBJECT /* SIZEOF=260 */ + +CONST FCH_ID=$F00, + TFCH_ID=$F02, + OFCH_ID=$F03 + +OBJECT fch + fileid:INT -> This is unsigned + numentries:INT -> This is unsigned +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST DFH_ID=$F80, + MAXFONTNAME=$20 + +OBJECT diskfontheader + df:ln + fileid:INT -> This is unsigned + revision:INT -> This is unsigned + segment:LONG + name[$20]:ARRAY + tf:textfont +ENDOBJECT /* SIZEOF=106 */ + +CONST DFH_TAGLIST=18, + AFB_MEMORY=0, + AFF_MEMORY=1, + AFB_DISK=1, + AFF_DISK=2, + AFB_SCALED=2, + AFF_SCALED=4, + AFB_BITMAP=3, + AFF_BITMAP=8, + AFB_TAGGED=16, + AFF_TAGGED=$10000, + AFF_TTATTR=$10000 + +OBJECT af + type:INT -> This is unsigned + attr:textattr +ENDOBJECT /* SIZEOF=10 */ + +OBJECT taf + type:INT -> This is unsigned + attr:ttextattr +ENDOBJECT /* SIZEOF=14 */ + +OBJECT afh + numentries:INT -> This is unsigned +ENDOBJECT /* SIZEOF=NONE !!! */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/diskfonttag.e b/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/diskfonttag.e new file mode 100644 index 0000000..ceec845 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/diskfonttag.e @@ -0,0 +1,89 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +#define OTSUFFIX '.otag' +#define OTE_BULLET 'bullet' + +CONST OT_LEVEL0=$80000000, + OT_LEVEL1=$80001000, + OT_LEVEL2=$80002000, + OT_LEVEL3=$80003000, + OT_INDIRECT=$8000, + OT_DEVICEDPI=$80000001, + OT_DOTSIZE=$80000002, + OT_POINTHEIGHT=$80000008, + OT_SETFACTOR=$80000009, + OT_SHEARSIN=$8000000A, + OT_SHEARCOS=$8000000B, + OT_ROTATESIN=$8000000C, + OT_ROTATECOS=$8000000D, + OT_EMBOLDENX=$8000000E, + OT_EMBOLDENY=$8000000F, + OT_POINTSIZE=$80000010, + OT_GLYPHCODE=$80000011, + OT_GLYPHCODE2=$80000012, + OT_GLYPHWIDTH=$80000013, + OT_OTAGPATH=$80008014, + OT_OTAGLIST=$80008015, + OT_GLYPHMAP=$80008020, + OT_WIDTHLIST=$80008021, + OT_TEXTKERNPAIR=$80008022, + OT_DESIGNKERNPAIR=$80008023, + OT_UNDERLINED=$80000024, -> Data for this tag is unsigned INT + OTUL_NONE=0, + OTUL_SOLID=1, + OTUL_BROKEN=2, + OTUL_DOUBLESOLID=3, + OUTL_DOUBLEBROKEN=4, + OT_STRIKETHROUGH=$80000025, + OT_FILEIDENT=$80001001, + OT_ENGINE=$80009002, + OT_FAMILY=$80009003, + OT_BNAME=$8000A005, + OT_INAME=$8000A006, + OT_BINAME=$8000A007, + OT_SYMBOLSET=$80001010, + OT_YSIZEFACTOR=$80001011, + OT_SPACEWIDTH=$80002012, + OT_ISFIXED=$80002013, + OT_SERIFFLAG=$80001014, + OT_STEMWEIGHT=$80001015, + OTS_ULTRATHIN=8, + OTS_EXTRATHIN=24, + OTS_THIN=$28, + OTS_EXTRALIGHT=$38, + OTS_LIGHT=$48, + OTS_DEMILIGHT=$58, + OTS_SEMILIGHT=$68, + OTS_BOOK=$78, + OTS_MEDIUM=$88, + OTS_SEMIBOLD=$98, + OTS_DEMIBOLD=$A8, + OTS_BOLD=$B8, + OTS_EXTRABOLD=$C8, + OTS_BLACK=$D8, + OTS_EXTRABLACK=$E8, + OTS_ULTRABLACK=$F8, + OT_SLANTSTYLE=$80001016, + OTS_UPRIGHT=0, + OTS_ITALIC=1, + OTS_LEFTITALIC=2, + OT_HORIZSTYLE=$80001017, + OTH_ULTRACOMPRESSED=16, + OTH_EXTRACOMPRESSED=$30, + OTH_COMPRESSED=$50, + OTH_CONDENSED=$70, + OTH_NORMAL=$90, + OTH_SEMIEXPANDED=$B0, + OTH_EXPANDED=$D0, + OTH_EXTRAEXPANDED=$F0, + OT_SPACEFACTOR=$80002018, + OT_INHIBITALGOSTYLE=$80002019, + OT_AVAILSIZES=$80009020, + OT_MAXAVAILSIZES=20, + OT_SPECCOUNT=$80001100, + OT_SPEC=$80001100, + OT_SPEC1=$80001101 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/glyph.e b/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/glyph.e new file mode 100644 index 0000000..910db2d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/glyph.e @@ -0,0 +1,36 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/libraries', + 'exec/nodes' + +CONST DISKFONT_GLYPH_I=1 + +OBJECT glyphengine + library:PTR TO lib + name:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT glyphmap + bmmodulo:INT -> This is unsigned + bmrows:INT -> This is unsigned + blackleft:INT -> This is unsigned + blacktop:INT -> This is unsigned + blackwidth:INT -> This is unsigned + blackheight:INT -> This is unsigned + xorigin:LONG + yorigin:LONG + x0:INT + y0:INT + x1:INT + y1:INT + width:LONG + bitmap:PTR TO CHAR +ENDOBJECT /* SIZEOF=36 */ + +OBJECT glyphwidthentry + node:mln + code:INT -> This is unsigned + width:LONG +ENDOBJECT /* SIZEOF=14 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/oterrors.e b/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/oterrors.e new file mode 100644 index 0000000..d8db1d3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/diskfont/oterrors.e @@ -0,0 +1,18 @@ +OPT MODULE +OPT EXPORT + +CONST OTERR_FAILURE=-1, + OTERR_SUCCESS=0, + OTERR_BADTAG=1, + OTERR_UNKNOWNTAG=2, + OTERR_BADDATA=3, + OTERR_NOMEMORY=4, + OTERR_NOFACE=5, + OTERR_BADFACE=6, + OTERR_NOGLYPH=7, + OTERR_BADGLYPH=8, + OTERR_NOSHEAR=9, + OTERR_NOROTATE=10, + OTERR_TOOSMALL=11, + OTERR_UNKNOWNGLYPH=12 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/datetime.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/datetime.e new file mode 100644 index 0000000..89a5de9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/datetime.e @@ -0,0 +1,25 @@ +OPT MODULE +OPT EXPORT + +MODULE 'dos/dos' + +OBJECT datetime + stamp:datestamp + format:CHAR + flags:CHAR + strday:PTR TO CHAR + strdate:PTR TO CHAR + strtime:PTR TO CHAR +ENDOBJECT /* SIZEOF=26 */ + +CONST LEN_DATSTRING=16, + DTB_SUBST=0, + DTF_SUBST=1, + DTB_FUTURE=1, + DTF_FUTURE=2, + FORMAT_DOS=0, + FORMAT_INT=1, + FORMAT_USA=2, + FORMAT_CDN=3, + FORMAT_MAX=3 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/dos.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/dos.e new file mode 100644 index 0000000..29c6257 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/dos.e @@ -0,0 +1,187 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +#define DOSNAME 'dos.library' +#define BADDR(x) (Shl((x),2)) +#define MKBADDR(x) (Shr((x),2)) + +CONST DOSTRUE=-1, + DOSFALSE=0, + MODE_OLDFILE=$3ED, + MODE_NEWFILE=$3EE, + MODE_READWRITE=$3EC, + OFFSET_BEGINNING=-1, + OFFSET_CURRENT=0, + OFFSET_END=1, + OFFSET_BEGINING=-1, + BITSPERBYTE=8, + BYTESPERLONG=4, + BITSPERLONG=$20, + MAXINT=$7FFFFFFF, + MININT=$80000000, + SHARED_LOCK=-2, + ACCESS_READ=-2, + EXCLUSIVE_LOCK=-1, + ACCESS_WRITE=-1 + +OBJECT datestamp + days:LONG + minute:LONG + tick:LONG +ENDOBJECT /* SIZEOF=12 */ + +CONST TICKS_PER_SECOND=$32 + +OBJECT fileinfoblock + diskkey:LONG + direntrytype:LONG + filename[108]:ARRAY + protection:LONG + entrytype:LONG + size:LONG + numblocks:LONG + datestamp:datestamp + comment[80]:ARRAY + owneruid:INT -> This is unsigned + ownergid:INT -> This is unsigned + reserved[32]:ARRAY +ENDOBJECT /* SIZEOF=260 */ + +CONST FIBB_OTR_READ=15, + FIBB_OTR_WRITE=14, + FIBB_OTR_EXECUTE=13, + FIBB_OTR_DELETE=12, + FIBB_GRP_READ=11, + FIBB_GRP_WRITE=10, + FIBB_GRP_EXECUTE=9, + FIBB_GRP_DELETE=8, + FIBB_SCRIPT=6, + FIBB_PURE=5, + FIBB_ARCHIVE=4, + FIBB_READ=3, + FIBB_WRITE=2, + FIBB_EXECUTE=1, + FIBB_DELETE=0, + FIBF_OTR_READ=$8000, + FIBF_OTR_WRITE=$4000, + FIBF_OTR_EXECUTE=$2000, + FIBF_OTR_DELETE=$1000, + FIBF_GRP_READ=$800, + FIBF_GRP_WRITE=$400, + FIBF_GRP_EXECUTE=$200, + FIBF_GRP_DELETE=$100, + FIBF_SCRIPT=$40, + FIBF_PURE=$20, + FIBF_ARCHIVE=16, + FIBF_READ=8, + FIBF_WRITE=4, + FIBF_EXECUTE=2, + FIBF_DELETE=1, + FAULT_MAX=$52 + + +OBJECT infodata + numsofterrors:LONG + unitnumber:LONG + diskstate:LONG + numblocks:LONG + numblocksused:LONG + bytesperblock:LONG + disktype:LONG + volumenode:LONG + inuse:LONG +ENDOBJECT /* SIZEOF=36 */ + +CONST ID_WRITE_PROTECTED=$50, + ID_VALIDATING=$51, + ID_VALIDATED=$52, + ID_NO_DISK_PRESENT=-1, + ID_UNREADABLE_DISK=$42414400, + ID_NOT_REALLY_DOS=$4E444F53, + ID_DOS_DISK=$444F5300, + ID_FFS_DISK=$444F5301, + ID_INTER_DOS_DISK=$444F5302, + ID_INTER_FFS_DISK=$444F5303, + ID_FASTDIR_DOS_DISK=$444F5304, + ID_FASTDIR_FFS_DISK=$444F5305, + ID_KICKSTART_DISK=$4B49434B, + ID_MSDOS_DISK=$4D534400, + ERROR_NO_FREE_STORE=$67, + ERROR_TASK_TABLE_FULL=$69, + ERROR_BAD_TEMPLATE=$72, + ERROR_BAD_NUMBER=$73, + ERROR_REQUIRED_ARG_MISSING=$74, + ERROR_KEY_NEEDS_ARG=$75, + ERROR_TOO_MANY_ARGS=$76, + ERROR_UNMATCHED_QUOTES=$77, + ERROR_LINE_TOO_LONG=$78, + ERROR_FILE_NOT_OBJECT=$79, + ERROR_INVALID_RESIDENT_LIBRARY=$7A, + ERROR_NO_DEFAULT_DIR=$C9, + ERROR_OBJECT_IN_USE=$CA, + ERROR_OBJECT_EXISTS=$CB, + ERROR_DIR_NOT_FOUND=$CC, + ERROR_OBJECT_NOT_FOUND=$CD, + ERROR_BAD_STREAM_NAME=$CE, + ERROR_OBJECT_TOO_LARGE=$CF, + ERROR_ACTION_NOT_KNOWN=$D1, + ERROR_INVALID_COMPONENT_NAME=$D2, + ERROR_INVALID_LOCK=$D3, + ERROR_OBJECT_WRONG_TYPE=$D4, + ERROR_DISK_NOT_VALIDATED=$D5, + ERROR_DISK_WRITE_PROTECTED=$D6, + ERROR_RENAME_ACROSS_DEVICES=$D7, + ERROR_DIRECTORY_NOT_EMPTY=$D8, + ERROR_TOO_MANY_LEVELS=$D9, + ERROR_DEVICE_NOT_MOUNTED=$DA, + ERROR_SEEK_ERROR=$DB, + ERROR_COMMENT_TOO_BIG=$DC, + ERROR_DISK_FULL=$DD, + ERROR_DELETE_PROTECTED=$DE, + ERROR_WRITE_PROTECTED=$DF, + ERROR_READ_PROTECTED=$E0, + ERROR_NOT_A_DOS_DISK=$E1, + ERROR_NO_DISK=$E2, + ERROR_NO_MORE_ENTRIES=$E8, + ERROR_IS_SOFT_LINK=$E9, + ERROR_OBJECT_LINKED=$EA, + ERROR_BAD_HUNK=$EB, + ERROR_NOT_IMPLEMENTED=$EC, + ERROR_RECORD_NOT_LOCKED=$F0, + ERROR_LOCK_COLLISION=$F1, + ERROR_LOCK_TIMEOUT=$F2, + ERROR_UNLOCK_ERROR=$F3, + RETURN_OK=0, + RETURN_WARN=5, + RETURN_ERROR=10, + RETURN_FAIL=20, + SIGBREAKF_CTRL_C=$1000, + SIGBREAKF_CTRL_D=$2000, + SIGBREAKF_CTRL_E=$4000, + SIGBREAKF_CTRL_F=$8000, + SIGBREAKB_CTRL_C=12, + SIGBREAKB_CTRL_D=13, + SIGBREAKB_CTRL_E=14, + SIGBREAKB_CTRL_F=15, + LOCK_DIFFERENT=-1, + LOCK_SAME=0, + LOCK_SAME_VOLUME=1, + LOCK_SAME_HANDLER=1, + CHANGE_LOCK=0, + CHANGE_FH=1, + LINK_HARD=0, + LINK_SOFT=1, + ITEM_EQUAL=-2, + ITEM_ERROR=-1, + ITEM_NOTHING=0, + ITEM_UNQUOTED=1, + ITEM_QUOTED=2, + DOS_FILEHANDLE=0, + DOS_EXALLCONTROL=1, + DOS_FIB=2, + DOS_STDPKT=3, + DOS_CLI=4, + DOS_RDARGS=5 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/dos_lib.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/dos_lib.e new file mode 100644 index 0000000..527a93c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/dos_lib.e @@ -0,0 +1,6 @@ +OPT MODULE +OPT EXPORT + +CONST RESERVE=4, + VSIZE=6 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/dosasl.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/dosasl.e new file mode 100644 index 0000000..7f41e68 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/dosasl.e @@ -0,0 +1,71 @@ +OPT MODULE +OPT EXPORT + +MODULE 'dos/dos' + +OBJECT anchorpath + base:PTR TO achain + last:PTR TO achain + breakbits:LONG + foundbreak:LONG + flags:CHAR -> This is signed + reserved:CHAR + strlen:INT + info:fileinfoblock +-> Um, what about 'buf[1]:ARRAY'? +ENDOBJECT /* SIZEOF=280 */ + +CONST APB_DOWILD=0, + APF_DOWILD=1, + APB_ITSWILD=1, + APF_ITSWILD=2, + APB_DODIR=2, + APF_DODIR=4, + APB_DIDDIR=3, + APF_DIDDIR=8, + APB_NOMEMERR=4, + APF_NOMEMERR=16, + APB_DODOT=5, + APF_DODOT=$20, + APB_DIRCHANGED=6, + APF_DIRCHANGED=$40, + APB_FOLLOWHLINKS=7, + APF_FOLLOWHLINKS=$80 + +OBJECT achain + child:PTR TO achain + parent:PTR TO achain + lock:LONG + info:fileinfoblock + flags:CHAR -> This is signed +-> Um, what about 'string[1]:ARRAY'? +ENDOBJECT /* SIZEOF=273 */ + +CONST DDB_PATTERNBIT=0, + DDF_PATTERNBIT=1, + DDB_EXAMINEDBIT=1, + DDF_EXAMINEDBIT=2, + DDB_COMPLETED=2, + DDF_COMPLETED=4, + DDB_ALLBIT=3, + DDF_ALLBIT=8, + DDB_SINGLE=4, + DDF_SINGLE=16, + P_ANY=$80, + P_SINGLE=$81, + P_ORSTART=$82, + P_ORNEXT=$83, + P_OREND=$84, + P_NOT=$85, + P_NOTEND=$86, + P_NOTCLASS=$87, + P_CLASS=$88, + P_REPBEG=$89, + P_REPEND=$8A, + P_STOP=$8B, + COMPLEX_BIT=1, + EXAMINE_BIT=2, + ERROR_BUFFER_OVERFLOW=$12F, + ERROR_BREAK=$130, + ERROR_NOT_EXECUTABLE=$131 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/dosextens.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/dosextens.e new file mode 100644 index 0000000..e8160cc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/dosextens.e @@ -0,0 +1,349 @@ +OPT MODULE +OPT EXPORT + +MODULE 'devices/timer', + 'dos/dos', + 'exec/libraries', + 'exec/lists', + 'exec/nodes', + 'exec/ports', + 'exec/semaphores', + 'exec/tasks' + +OBJECT process + task:tc + msgport:mp + pad:INT + seglist:LONG + stacksize:LONG + globvec:LONG + tasknum:LONG + stackbase:LONG + result2:LONG + currentdir:LONG + cis:LONG + cos:LONG + consoletask:LONG + filesystemtask:LONG + cli:LONG + returnaddr:LONG + pktwait:LONG + windowptr:LONG + homedir:LONG + flags:LONG + exitcode:LONG + exitdata:LONG + arguments:PTR TO CHAR + localvars:mlh + shellprivate:LONG + ces:LONG +ENDOBJECT /* SIZEOF=228 */ + +CONST PRB_FREESEGLIST=0, + PRF_FREESEGLIST=1, + PRB_FREECURRDIR=1, + PRF_FREECURRDIR=2, + PRB_FREECLI=2, + PRF_FREECLI=4, + PRB_CLOSEINPUT=3, + PRF_CLOSEINPUT=8, + PRB_CLOSEOUTPUT=4, + PRF_CLOSEOUTPUT=16, + PRB_FREEARGS=5, + PRF_FREEARGS=$20 + +OBJECT filehandle + link:PTR TO mn + interactive:PTR TO mp + type:PTR TO mp + buf:LONG + pos:LONG + end:LONG + funcs:LONG + func2:LONG + func3:LONG + args:LONG + arg2:LONG +ENDOBJECT /* SIZEOF=44 */ + +OBJECT dospacket + link:PTR TO mn + port:PTR TO mp +-> a) next is unioned with "action:LONG" + type:LONG +-> a) next is unioned with "status:LONG" + res1:LONG +-> a) next is unioned with "status2:LONG" + res2:LONG +-> a) next is unioned with "bufaddr:LONG" + arg1:LONG + arg2:LONG + arg3:LONG + arg4:LONG + arg5:LONG + arg6:LONG + arg7:LONG +ENDOBJECT /* SIZEOF=48 */ + +OBJECT standardpacket + msg:mn + pkt:dospacket +ENDOBJECT /* SIZEOF=68 */ + +CONST ACTION_NIL=0, + ACTION_STARTUP=0, + ACTION_GET_BLOCK=2, + ACTION_SET_MAP=4, + ACTION_DIE=5, + ACTION_EVENT=6, + ACTION_CURRENT_VOLUME=7, + ACTION_LOCATE_OBJECT=8, + ACTION_RENAME_DISK=9, + ACTION_WRITE=$57, + ACTION_READ=$52, + ACTION_FREE_LOCK=15, + ACTION_DELETE_OBJECT=16, + ACTION_RENAME_OBJECT=17, + ACTION_MORE_CACHE=18, + ACTION_COPY_DIR=19, + ACTION_WAIT_CHAR=20, + ACTION_SET_PROTECT=21, + ACTION_CREATE_DIR=22, + ACTION_EXAMINE_OBJECT=23, + ACTION_EXAMINE_NEXT=24, + ACTION_DISK_INFO=25, + ACTION_INFO=26, + ACTION_FLUSH=27, + ACTION_SET_COMMENT=28, + ACTION_PARENT=29, + ACTION_TIMER=30, + ACTION_INHIBIT=31, + ACTION_DISK_TYPE=$20, + ACTION_DISK_CHANGE=$21, + ACTION_SET_DATE=$22, + ACTION_SCREEN_MODE=$3E2, + ACTION_READ_RETURN=$3E9, + ACTION_WRITE_RETURN=$3EA, + ACTION_SEEK=$3F0, + ACTION_FINDUPDATE=$3EC, + ACTION_FINDINPUT=$3ED, + ACTION_FINDOUTPUT=$3EE, + ACTION_END=$3EF, + ACTION_SET_FILE_SIZE=$3FE, + ACTION_WRITE_PROTECT=$3FF, + ACTION_SAME_LOCK=$28, + ACTION_CHANGE_SIGNAL=$3E3, + ACTION_FORMAT=$3FC, + ACTION_MAKE_LINK=$3FD, + ACTION_READ_LINK=$400, + ACTION_FH_FROM_LOCK=$402, + ACTION_IS_FILESYSTEM=$403, + ACTION_CHANGE_MODE=$404, + ACTION_COPY_DIR_FH=$406, + ACTION_PARENT_FH=$407, + ACTION_EXAMINE_ALL=$409, + ACTION_EXAMINE_FH=$40A, + ACTION_LOCK_RECORD=$7D8, + ACTION_FREE_RECORD=$7D9, + ACTION_ADD_NOTIFY=$1001, + ACTION_REMOVE_NOTIFY=$1002, + ACTION_EXAMINE_ALL_END=$40B, + ACTION_SET_OWNER=$40C, + ACTION_SERIALIZE_DISK=$1068 + +OBJECT errorstring + nums:PTR TO LONG + strings:PTR TO CHAR +ENDOBJECT /* SIZEOF=8 */ + +OBJECT doslibrary + lib:lib + root:PTR TO rootnode + gv:LONG + a2:LONG + a5:LONG + a6:LONG + errors:PTR TO errorstring + timereq:PTR TO timerequest + utilitybase:PTR TO lib + intuitionbase:PTR TO lib +ENDOBJECT /* SIZEOF=70 */ + +OBJECT rootnode + taskarray:LONG + consolesegment:LONG + time:datestamp + restartseg:LONG + info:LONG + filehandlersegment:LONG + clilist:mlh + bootproc:PTR TO mp + shellsegment:LONG + flags:LONG +ENDOBJECT /* SIZEOF=56 */ + +CONST RNB_WILDSTAR=24, + RNF_WILDSTAR=$1000000, + RNB_PRIVATE1=1, + RNF_PRIVATE1=2 + +OBJECT cliproclist + node:mln + first:LONG +-> Um, this is really PTR TO PTR TO mp + array:PTR TO LONG +ENDOBJECT /* SIZEOF=16 */ + +OBJECT dosinfo + mcname:LONG + devinfo:LONG + devices:LONG + handlers:LONG + nethand:LONG + devlock:ss + entrylock:ss + deletelock:ss +ENDOBJECT /* SIZEOF=158 */ + +OBJECT segment + next:LONG + uc:LONG + seg:LONG + name[4]:ARRAY +ENDOBJECT /* SIZEOF=16 */ + +CONST CMD_SYSTEM=-1, + CMD_INTERNAL=-2, + CMD_DISABLED=$FFFFFC19 + +OBJECT commandlineinterface + result2:LONG + setname:PTR TO CHAR + commanddir:LONG + returncode:LONG + commandname:PTR TO CHAR + faillevel:LONG + prompt:PTR TO CHAR + standardinput:LONG + currentinput:LONG + commandfile:PTR TO CHAR + interactive:LONG + background:LONG + currentoutput:LONG + defaultstack:LONG + standardoutput:LONG + module:LONG +ENDOBJECT /* SIZEOF=64 */ + +OBJECT devlist + next:LONG + type:LONG + task:PTR TO mp + lock:LONG + volumedate:datestamp + locklist:LONG + disktype:LONG + unused:LONG + name:PTR TO CHAR +ENDOBJECT /* SIZEOF=44 */ + +OBJECT devinfo + next:LONG + type:LONG + task:LONG + lock:LONG + handler:PTR TO CHAR + stacksize:LONG + priority:LONG + startup:LONG + seglist:LONG + globvec:LONG + name:PTR TO CHAR +ENDOBJECT /* SIZEOF=44 */ + +OBJECT doslist + next:LONG + type:LONG + task:PTR TO mp + lock:LONG + +-> a) next 3 LONGs are unioned with "volumedate:datestamp" +-> b) next LONG is unioned with "handler:PTR TO CHAR" + assignname:PTR TO CHAR +-> b) next LONG is unioned with "stacksize:LONG" + list:PTR TO assignlist + priority:LONG +-> a) next LONG is unioned with "locklist:LONG" + startup:LONG +-> a) next LONG is unioned with "disktype:LONG" + seglist:LONG + globvec:LONG + name:PTR TO CHAR +ENDOBJECT /* SIZEOF=44 */ + +-> Um, this object was missing +OBJECT assignlist + next:PTR TO assignlist + lock:LONG +ENDOBJECT + +CONST DLT_DEVICE=0, + DLT_DIRECTORY=1, + DLT_VOLUME=2, + DLT_LATE=3, + DLT_NONBINDING=4, + DLT_PRIVATE=-1 + +OBJECT devproc + port:PTR TO mp + lock:LONG + flags:LONG + devnode:PTR TO doslist +ENDOBJECT /* SIZEOF=16 */ + +CONST DVPB_UNLOCK=0, + DVPF_UNLOCK=1, + DVPB_ASSIGN=1, + DVPF_ASSIGN=2, + LDB_DEVICES=2, + LDF_DEVICES=4, + LDB_VOLUMES=3, + LDF_VOLUMES=8, + LDB_ASSIGNS=4, + LDF_ASSIGNS=16, + LDB_ENTRY=5, + LDF_ENTRY=$20, + LDB_DELETE=6, + LDF_DELETE=$40, + LDB_READ=0, + LDF_READ=1, + LDB_WRITE=1, + LDF_WRITE=2, + LDF_ALL=28 + +OBJECT filelock + link:LONG + key:LONG + access:LONG + task:PTR TO mp + volume:LONG +ENDOBJECT /* SIZEOF=20 */ + +CONST REPORT_STREAM=0, + REPORT_TASK=1, + REPORT_LOCK=2, + REPORT_VOLUME=3, + REPORT_INSERT=4, + ABORT_DISK_ERROR=$128, + ABORT_BUSY=$120, + RUN_EXECUTE=-1, + RUN_SYSTEM=-2, + RUN_SYSTEM_ASYNCH=-3, + ST_ROOT=1, + ST_USERDIR=2, + ST_SOFTLINK=3, + ST_LINKDIR=4, + ST_FILE=-3, + ST_LINKFILE=-4, + ST_PIPEFILE=-5 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/doshunks.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/doshunks.e new file mode 100644 index 0000000..96ae4e3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/doshunks.e @@ -0,0 +1,53 @@ +OPT MODULE +OPT EXPORT + +CONST HUNK_UNIT=$3E7, + HUNK_NAME=$3E8, + HUNK_CODE=$3E9, + HUNK_DATA=$3EA, + HUNK_BSS=$3EB, + HUNK_RELOC32=$3EC, + HUNK_ABSRELOC32=$3EC, + HUNK_RELOC16=$3ED, + HUNK_RELRELOC16=$3ED, + HUNK_RELOC8=$3EE, + HUNK_RELRELOC8=$3EE, + HUNK_EXT=$3EF, + HUNK_SYMBOL=$3F0, + HUNK_DEBUG=$3F1, + HUNK_END=$3F2, + HUNK_HEADER=$3F3, + HUNK_OVERLAY=$3F5, + HUNK_BREAK=$3F6, + HUNK_DREL32=$3F7, + HUNK_DREL16=$3F8, + HUNK_DREL8=$3F9, + HUNK_LIB=$3FA, + HUNK_INDEX=$3FB, + HUNK_RELOC32SHORT=$3FC, + HUNK_RELRELOC32=$3FD, + HUNK_ABSRELOC16=$3FE, + HUNKF_ADVISORY=$20000000, + HUNKF_CHIP=$40000000, + HUNKF_FAST=$80000000, + EXT_SYMB=0, + EXT_DEF=1, + EXT_ABS=2, + EXT_RES=3, + EXT_COMMONDEF=4, + EXT_REF32=$81, + EXT_ABSREF32=$81, + EXT_COMMON=$82, + EXT_ABSCOMMON=$82, + EXT_REF16=$83, + EXT_RELREF16=$83, + EXT_REF8=$84, + EXT_RELREF8=$84, + EXT_DEXT32=$85, + EXT_DEXT16=$86, + EXT_DEXT8=$87, + EXT_RELREF32=$88, + EXT_RELCOMMON=$89, + EXT_ABSREF16=$8A, + EXT_ABSREF8=$8B + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/dostags.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/dostags.e new file mode 100644 index 0000000..99e2361 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/dostags.e @@ -0,0 +1,41 @@ +OPT MODULE +OPT EXPORT + +CONST SYS_DUMMY=$80000020, + SYS_INPUT=$80000021, + SYS_OUTPUT=$80000022, + SYS_ASYNCH=$80000023, + SYS_USERSHELL=$80000024, + SYS_CUSTOMSHELL=$80000025, + NP_DUMMY=$800003E8, + NP_SEGLIST=$800003E9, + NP_FREESEGLIST=$800003EA, + NP_ENTRY=$800003EB, + NP_INPUT=$800003EC, + NP_OUTPUT=$800003ED, + NP_CLOSEINPUT=$800003EE, + NP_CLOSEOUTPUT=$800003EF, + NP_ERROR=$800003F0, + NP_CLOSEERROR=$800003F1, + NP_CURRENTDIR=$800003F2, + NP_STACKSIZE=$800003F3, + NP_NAME=$800003F4, + NP_PRIORITY=$800003F5, + NP_CONSOLETASK=$800003F6, + NP_WINDOWPTR=$800003F7, + NP_HOMEDIR=$800003F8, + NP_COPYVARS=$800003F9, + NP_CLI=$800003FA, + NP_PATH=$800003FB, + NP_COMMANDNAME=$800003FC, + NP_ARGUMENTS=$800003FD, + NP_NOTIFYONDEATH=$800003FE, + NP_SYNCHRONOUS=$800003FF, + NP_EXITCODE=$80000400, + NP_EXITDATA=$80000401, + ADO_DUMMY=$800007D0, + ADO_FH_MODE=$800007D1, + ADO_DIRLEN=$800007D2, + ADO_COMMNAMELEN=$800007D3, + ADO_COMMFILELEN=$800007D4, + ADO_PROMPTLEN=$800007D5 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/exall.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/exall.e new file mode 100644 index 0000000..2c7b2df --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/exall.e @@ -0,0 +1,34 @@ +OPT MODULE +OPT EXPORT + +MODULE 'utility/hooks' + +CONST ED_NAME=1, + ED_TYPE=2, + ED_SIZE=3, + ED_PROTECTION=4, + ED_DATE=5, + ED_COMMENT=6, + ED_OWNER=7 + +OBJECT exalldata + next:PTR TO exalldata + name:PTR TO CHAR + type:LONG + size:LONG + prot:LONG + days:LONG + mins:LONG + ticks:LONG + comment:PTR TO CHAR + owneruid:INT -> This is unsigned + ownergid:INT -> This is unsigned +ENDOBJECT /* SIZEOF=40 */ + +OBJECT exallcontrol + entries:LONG + lastkey:LONG + matchstring:PTR TO CHAR + matchfunc:PTR TO hook +ENDOBJECT /* SIZEOF=16 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/filehandler.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/filehandler.e new file mode 100644 index 0000000..dfbb59d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/filehandler.e @@ -0,0 +1,70 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/ports' + +OBJECT dosenvec + tablesize:LONG + sizeblock:LONG + secorg:LONG + surfaces:LONG + sectorperblock:LONG + blockspertrack:LONG + reserved:LONG + prealloc:LONG + interleave:LONG + lowcyl:LONG + highcyl:LONG + numbuffers:LONG + bufmemtype:LONG + maxtransfer:LONG + mask:LONG + bootpri:LONG + dostype:LONG + baud:LONG + control:LONG + bootblocks:LONG +ENDOBJECT /* SIZEOF=80 */ + +CONST DE_TABLESIZE=0, + DE_SIZEBLOCK=1, + DE_SECORG=2, + DE_NUMHEADS=3, + DE_SECSPERBLK=4, + DE_BLKSPERTRACK=5, + DE_RESERVEDBLKS=6, + DE_PREFAC=7, + DE_INTERLEAVE=8, + DE_LOWCYL=9, + DE_UPPERCYL=10, + DE_NUMBUFFERS=11, + DE_MEMBUFTYPE=12, + DE_BUFMEMTYPE=12, + DE_MAXTRANSFER=13, + DE_MASK=14, + DE_BOOTPRI=15, + DE_DOSTYPE=16, + DE_BAUD=17, + DE_CONTROL=18, + DE_BOOTBLOCKS=19 + +OBJECT filesysstartupmsg + unit:LONG + device:PTR TO CHAR + environ:LONG + flags:LONG +ENDOBJECT /* SIZEOF=16 */ + +OBJECT devicenode + next:PTR TO CHAR + type:LONG + task:PTR TO mp + lock:LONG + handler:PTR TO CHAR + stacksize:LONG + priority:LONG + startup:LONG + seglist:LONG + globalvec:LONG + name:PTR TO CHAR +ENDOBJECT /* SIZEOF=44 */ diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/notify.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/notify.e new file mode 100644 index 0000000..984be21 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/notify.e @@ -0,0 +1,45 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/ports', + 'exec/tasks' + +CONST NOTIFY_CLASS=$40000000, + NOTIFY_CODE=$1234 + +OBJECT notifymessage + execmessage:mn + class:LONG + code:INT -> This is unsigned + nreq:PTR TO notifyrequest + donottouch:LONG + donottouch2:LONG +ENDOBJECT /* SIZEOF=38 */ + +OBJECT notifyrequest + name:PTR TO CHAR + fullname:PTR TO CHAR + userdata:LONG + flags:LONG +-> a) next LONG is unioned with "task:PTR TO tc" + port:PTR TO mp + signalnum:CHAR + pada:CHAR + padb[2]:ARRAY + reserved[4]:ARRAY OF LONG + msgcount:LONG + handler:PTR TO mp +ENDOBJECT /* SIZEOF=48 */ + +CONST NRF_SEND_MESSAGE=1, + NRF_SEND_SIGNAL=2, + NRF_WAIT_REPLY=8, + NRF_NOTIFY_INITIAL=16, + NRF_MAGIC=$80000000, + NRB_SEND_MESSAGE=0, + NRB_SEND_SIGNAL=1, + NRB_WAIT_REPLY=3, + NRB_NOTIFY_INITIAL=4, + NRB_MAGIC=31, + NR_HANDLER_FLAGS=$FFFF0000 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/rdargs.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/rdargs.e new file mode 100644 index 0000000..edfc0d8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/rdargs.e @@ -0,0 +1,27 @@ +OPT MODULE +OPT EXPORT + +OBJECT csource + buffer:PTR TO CHAR + length:LONG + curchr:LONG +ENDOBJECT /* SIZEOF=12 */ + +OBJECT rdargs + source:csource + dalist:LONG + buffer:PTR TO CHAR + bufsiz:LONG + exthelp:PTR TO CHAR + flags:LONG +ENDOBJECT /* SIZEOF=32 */ + +CONST RDAB_STDIN=0, + RDAF_STDIN=1, + RDAB_NOALLOC=1, + RDAF_NOALLOC=2, + RDAB_NOPROMPT=2, + RDAF_NOPROMPT=4, + MAX_TEMPLATE_ITEMS=$64, + MAX_MULTIARGS=$80 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/record.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/record.e new file mode 100644 index 0000000..e50972a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/record.e @@ -0,0 +1,15 @@ +OPT MODULE +OPT EXPORT + +CONST REC_EXCLUSIVE=0, + REC_EXCLUSIVE_IMMED=1, + REC_SHARED=2, + REC_SHARED_IMMED=3 + +OBJECT recordlock + fh:LONG + offset:LONG + length:LONG + mode:LONG +ENDOBJECT /* SIZEOF=16 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/stdio.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/stdio.e new file mode 100644 index 0000000..45c2b88 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/stdio.e @@ -0,0 +1,20 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +CONST DOS_STDIO_I=1, + BUF_LINE=0, + BUF_FULL=1, + BUF_NONE=2, + ENDSTREAMCH=-1 + +/* Wouter said he was going to fix macros so ReadChar() would be allowed... */ +#define ReadChar FgetC(Input()) +#define WriteChar(c) FputC(Output(),(c)) +#define UnReadChar(c) UnGetC(Input(),(c)) +/* next one is inefficient */ +#define ReadChars(buf,num) Fread(Input(),(buf),1,(num)) +#define ReadLn(buf,len) Fgets(Input(),(buf),(len)) +#define WriteStr(s) Fputs(Output(),(s)) +#define Vwritef(format,argv) VfWritef(Output(),(format),(argv)) diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/dos/var.e b/amigae33a/E_v3.3a/Src/Src/Modules/dos/var.e new file mode 100644 index 0000000..ef3f9d9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/dos/var.e @@ -0,0 +1,26 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes' + +OBJECT localvar + node:ln + flags:INT -> This is unsigned + value:PTR TO CHAR + len:LONG +ENDOBJECT /* SIZEOF=24 */ + +CONST LV_VAR=0, + LV_ALIAS=1, + LVB_IGNORE=7, + LVF_IGNORE=$80, + GVB_GLOBAL_ONLY=8, + GVF_GLOBAL_ONLY=$100, + GVB_LOCAL_ONLY=9, + GVF_LOCAL_ONLY=$200, + GVB_BINARY_VAR=10, + GVF_BINARY_VAR=$400, + GVB_DONT_NULL_TERM=11, + GVF_DONT_NULL_TERM=$800, + GVB_SAVE_VAR=12, + GVF_SAVE_VAR=$1000 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/alerts.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/alerts.e new file mode 100644 index 0000000..ccb253d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/alerts.e @@ -0,0 +1,163 @@ +OPT MODULE +OPT EXPORT + +CONST ACPU_BUSERR=$80000002, + ACPU_ADDRESSERR=$80000003, + ACPU_INSTERR=$80000004, + ACPU_DIVZERO=$80000005, + ACPU_CHK=$80000006, + ACPU_TRAPV=$80000007, + ACPU_PRIVERR=$80000008, + ACPU_TRACE=$80000009, + ACPU_LINEA=$8000000A, + ACPU_LINEF=$8000000B, + ACPU_FORMAT=$8000000E, + ACPU_SPURIOUS=$80000018, + ACPU_AUTOVEC1=$80000019, + ACPU_AUTOVEC2=$8000001A, + ACPU_AUTOVEC3=$8000001B, + ACPU_AUTOVEC4=$8000001C, + ACPU_AUTOVEC5=$8000001D, + ACPU_AUTOVEC6=$8000001E, + ACPU_AUTOVEC7=$8000001F, + AT_DEADEND=$80000000, + AT_RECOVERY=0, + AG_NOMEMORY=$10000, + AG_MAKELIB=$20000, + AG_OPENLIB=$30000, + AG_OPENDEV=$40000, + AG_OPENRES=$50000, + AG_IOERROR=$60000, + AG_NOSIGNAL=$70000, + AG_BADPARM=$80000, + AG_CLOSELIB=$90000, + AG_CLOSEDEV=$A0000, + AG_PROCCREATE=$B0000, + AO_EXECLIB=$8001, + AO_GRAPHICSLIB=$8002, + AO_LAYERSLIB=$8003, + AO_INTUITION=$8004, + AO_MATHLIB=$8005, + AO_DOSLIB=$8007, + AO_RAMLIB=$8008, + AO_ICONLIB=$8009, + AO_EXPANSIONLIB=$800A, + AO_DISKFONTLIB=$800B, + AO_UTILITYLIB=$800C, + AO_KEYMAPLIB=$800D, + AO_AUDIODEV=$8010, + AO_CONSOLEDEV=$8011, + AO_GAMEPORTDEV=$8012, + AO_KEYBOARDDEV=$8013, + AO_TRACKDISKDEV=$8014, + AO_TIMERDEV=$8015, + AO_CIARSRC=$8020, + AO_DISKRSRC=$8021, + AO_MISCRSRC=$8022, + AO_BOOTSTRAP=$8030, + AO_WORKBENCH=$8031, + AO_DISKCOPY=$8032, + AO_GADTOOLS=$8033, + AO_UNKNOWN=$8035, + AN_EXECLIB=$1000000, + AN_EXCPTVECT=$1000001, + AN_BASECHKSUM=$1000002, + AN_LIBCHKSUM=$1000003, + AN_MEMCORRUPT=$81000005, + AN_INTRMEM=$81000006, + AN_INITAPTR=$1000007, + AN_SEMCORRUPT=$1000008, + AN_FREETWICE=$1000009, + AN_BOGUSEXCPT=$8100000A, + AN_BADQUICKINT=$810000FF, + AN_IOUSEDTWICE=$100000B, + AN_MEMORYINSANE=$100000C, + AN_IOAFTERCLOSE=$100000D, + AN_STACKPROBE=$100000E, + AN_BADFREEADDR=$100000F, + AN_BADSEMAPHORE=$1000010, + AN_GRAPHICSLIB=$2000000, + AN_GFXNOMEM=$82010000, + AN_GFXNOMEMMSPC=$82010001, + AN_LONGFRAME=$82010006, + AN_SHORTFRAME=$82010007, + AN_TEXTTMPRAS=$2010009, + AN_BLTBITMAP=$8201000A, + AN_REGIONMEMORY=$8201000B, + AN_MAKEVPORT=$82010030, + AN_GFXNEWERROR=$200000C, + AN_GFXFREEERROR=$200000D, + AN_GFXNOLCM=$82011234, + AN_OBSOLETEFONT=$2000401, + AN_LAYERSLIB=$3000000, + AN_LAYERSNOMEM=$83010000, + AN_INTUITION=$4000000, + AN_GADGETTYPE=$84000001, + AN_BADGADGET=$4000001, + AN_CREATEPORT=$84010002, + AN_ITEMALLOC=$4010003, + AN_SUBALLOC=$4010004, + AN_PLANEALLOC=$84010005, + AN_ITEMBOXTOP=$84000006, + AN_OPENSCREEN=$84010007, + AN_OPENSCRNRAST=$84010008, + AN_SYSSCRNTYPE=$84000009, + AN_ADDSWGADGET=$8401000A, + AN_OPENWINDOW=$8401000B, + AN_BADSTATE=$8400000C, + AN_BADMESSAGE=$8400000D, + AN_WEIRDECHO=$8400000E, + AN_NOCONSOLE=$8400000F, + AN_NOISEM=$4000010, + AN_ISEMORDER=$4000011, + AN_MATHLIB=$5000000, + AN_DOSLIB=$7000000, + AN_STARTMEM=$7010001, + AN_ENDTASK=$7000002, + AN_QPKTFAIL=$7000003, + AN_ASYNCPKT=$7000004, + AN_FREEVEC=$7000005, + AN_DISKBLKSEQ=$7000006, + AN_BITMAP=$7000007, + AN_KEYFREE=$7000008, + AN_BADCHKSUM=$7000009, + AN_DISKERROR=$700000A, + AN_KEYRANGE=$700000B, + AN_BADOVERLAY=$700000C, + AN_BADINITFUNC=$700000D, + AN_FILERECLOSED=$700000E, + AN_RAMLIB=$8000000, + AN_BADSEGLIST=$8000001, + AN_ICONLIB=$9000000, + AN_EXPANSIONLIB=$A000000, + AN_BADEXPANSIONFREE=$A000001, + AN_DISKFONTLIB=$B000000, + AN_AUDIODEV=$10000000, + AN_CONSOLEDEV=$11000000, + AN_NOWINDOW=$11000001, + AN_GAMEPORTDEV=$12000000, + AN_KEYBOARDDEV=$13000000, + AN_TRACKDISKDEV=$14000000, + AN_TDCALIBSEEK=$14000001, + AN_TDDELAY=$14000002, + AN_TIMERDEV=$15000000, + AN_TMBADREQ=$15000001, + AN_TMBADSUPPLY=$15000002, + AN_CIARSRC=$20000000, + AN_DISKRSRC=$21000000, + AN_DRHASDISK=$21000001, + AN_DRINTNOACT=$21000002, + AN_MISCRSRC=$22000000, + AN_BOOTSTRAP=$30000000, + AN_BOOTERROR=$30000001, + AN_WORKBENCH=$31000000, + AN_NOFONTS=$B1000001, + AN_WBBADSTARTUPMSG1=$31000001, + AN_WBBADSTARTUPMSG2=$31000002, + AN_WBBADIOMSG=$31000003, + AN_WBRELAYOUTTOOLMENU=$B1010009, + AN_DISKCOPY=$32000000, + AN_GADTOOLS=$33000000, + AN_UTILITYLIB=$34000000, + AN_UNKNOWN=$35000000 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/devices.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/devices.e new file mode 100644 index 0000000..ba0149c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/devices.e @@ -0,0 +1,20 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/libraries', + 'exec/ports' + +OBJECT dd + lib:lib +ENDOBJECT /* SIZEOF=34 */ + +OBJECT unit + mp:mp + flags:CHAR + pad:CHAR + opencnt:INT -> This is unsigned +ENDOBJECT /* SIZEOF=38 */ + +CONST UNITF_ACTIVE=1, + UNITF_INTASK=2 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/errors.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/errors.e new file mode 100644 index 0000000..84c8872 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/errors.e @@ -0,0 +1,13 @@ +OPT MODULE +OPT EXPORT + + +CONST IOERR_OPENFAIL=-1, + IOERR_ABORTED=-2, + IOERR_NOCMD=-3, + IOERR_BADLENGTH=-4, + IOERR_BADADDRESS=-5, + IOERR_UNITBUSY=-6, + IOERR_SELFTEST=-7, + ERR_OPENDEVICE=-1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/execbase.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/execbase.e new file mode 100644 index 0000000..24469f4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/execbase.e @@ -0,0 +1,116 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/lists', + 'exec/libraries', + 'exec/interrupts', + 'exec/tasks' + +OBJECT execbase + lib:lib + softver:INT -> This is unsigned + lowmemchksum:INT + chkbase:LONG + coldcapture:LONG + coolcapture:LONG + warmcapture:LONG + sysstkupper:LONG + sysstklower:LONG + maxlocmem:LONG + debugentry:LONG + debugdata:LONG + alertdata:LONG + maxextmem:LONG + chksum:INT -> This is unsigned + ivtbe:iv + ivdskblk:iv + ivsoftint:iv + ivports:iv + ivcoper:iv + ivvertb:iv + ivblit:iv + ivaud0:iv + ivaud1:iv + ivaud2:iv + ivaud3:iv + ivrbf:iv + ivdsksync:iv + ivexter:iv + ivinten:iv + ivnmi:iv + thistask:PTR TO tc + idlecount:LONG + dispcount:LONG + quantum:INT -> This is unsigned + elapsed:INT -> This is unsigned + sysflags:INT -> This is unsigned + idnestcnt:CHAR -> This is signed + tdnestcnt:CHAR -> This is signed + attnflags:INT -> This is unsigned + attnresched:INT -> This is unsigned + resmodules:LONG + tasktrapcode:LONG + taskexceptcode:LONG + taskexitcode:LONG + tasksigalloc:LONG + tasktrapalloc:INT -> This is unsigned + memlist:lh + resourcelist:lh + devicelist:lh + intrlist:lh + liblist:lh + portlist:lh + taskready:lh + taskwait:lh + softints[5]:ARRAY OF sh + lastalert[4]:ARRAY OF LONG + vblankfrequency:CHAR + powersupplyfrequency:CHAR + semaphorelist:lh + kickmemptr:LONG + kicktagptr:LONG + kickchecksum:LONG + pad0:INT + launchpoint:LONG + ramlibprivate:LONG + eclockfrequency:LONG + cachecontrol:LONG + taskid:LONG + reserved1[5]:ARRAY OF LONG + mmulock:LONG + reserved2[3]:ARRAY OF LONG + memhandlers:mlh + memhandler:LONG +ENDOBJECT /* SIZEOF=632 */ + +CONST AFB_68010=0, + AFB_68020=1, + AFB_68030=2, + AFB_68040=3, + AFB_68881=4, + AFB_68882=5, + AFB_FPU40=6, + AFB_PRIVATE=15, + AFF_68010=1, + AFF_68020=2, + AFF_68030=4, + AFF_68040=8, + AFF_68881=16, + AFF_68882=$20, + AFF_FPU40=$40, + AFF_PRIVATE=$8000, + CACRF_ENABLEI=1, + CACRF_FREEZEI=2, + CACRF_CLEARI=8, + CACRF_IBE=16, + CACRF_ENABLED=$100, + CACRF_FREEZED=$200, + CACRF_CLEARD=$800, + CACRF_DBE=$1000, + CACRF_WRITEALLOCATE=$2000, + CACRF_ENABLEE=$40000000, + CACRF_COPYBACK=$80000000, + DMAF_CONTINUE=2, + DMAF_NOMODIFY=4, + DMAF_READFROMRAM=8 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/interrupts.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/interrupts.e new file mode 100644 index 0000000..52281dd --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/interrupts.e @@ -0,0 +1,32 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/lists', + 'exec/nodes' + +OBJECT is + ln:ln + data:LONG + code:LONG +ENDOBJECT /* SIZEOF=22 */ + +OBJECT iv + data:LONG + code:LONG + node:PTR TO ln +ENDOBJECT /* SIZEOF=12 */ + +CONST SF_SAR=$8000, + SF_TQE=$4000, + SF_SINT=$2000 + +OBJECT sh + lh:lh + pad:INT +ENDOBJECT /* SIZEOF=16 */ + +CONST SIH_PRIMASK=$F0, + SIH_QUEUES=5, + INTB_NMI=15, + INTF_NMI=$8000 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/io.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/io.e new file mode 100644 index 0000000..18bfee0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/io.e @@ -0,0 +1,43 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/ports', + 'exec/devices' + +OBJECT io + mn:mn + device:PTR TO dd + unit:PTR TO unit + command:INT -> This is unsigned + flags:CHAR + error:CHAR -> This is signed +ENDOBJECT /* SIZEOF=32 */ + +OBJECT iostd + mn:mn + device:PTR TO dd + unit:PTR TO unit + command:INT -> This is unsigned + flags:CHAR + error:CHAR -> This is signed + actual:LONG + length:LONG + data:LONG + offset:LONG +ENDOBJECT /* SIZEOF=48 */ + +CONST IOB_QUICK=0, + IOF_QUICK=1, + CMD_INVALID=0, + CMD_RESET=1, + CMD_READ=2, + CMD_WRITE=3, + CMD_UPDATE=4, + CMD_CLEAR=5, + CMD_STOP=6, + CMD_START=7, + CMD_FLUSH=8, + CMD_NONSTD=9, + DEV_BEGINIO=-30, + DEV_ABORTIO=-36 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/libraries.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/libraries.e new file mode 100644 index 0000000..bce057b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/libraries.e @@ -0,0 +1,34 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes' + +CONST LIB_VECTSIZE=6, + LIB_RESERVED=4, + LIB_BASE=-6, + LIB_USERDEF=-30, + LIB_NONSTD=-30, + LIB_OPEN=-6, + LIB_CLOSE=-12, + LIB_EXPUNGE=-18, + LIB_EXTFUNC=-24 + +OBJECT lib + ln:ln + flags:CHAR + pad:CHAR + negsize:INT -> This is unsigned + possize:INT -> This is unsigned + version:INT -> This is unsigned + revision:INT -> This is unsigned + idstring:PTR TO CHAR + sum:LONG + opencnt:INT -> This is unsigned +ENDOBJECT /* SIZEOF=34 */ + +CONST LIBF_SUMMING=1, + LIBF_CHANGED=2, + LIBF_SUMUSED=4, + LIBF_DELEXP=8, + LIBF_EXP0CNT=16 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/lists.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/lists.e new file mode 100644 index 0000000..4ba2c83 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/lists.e @@ -0,0 +1,24 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/nodes' + +#define IsListEmpty(x) (x::mlh.tailpred = (x)) +#define IsMsgPortEmpty(x) (x::mp.ln.tailpred = x::mp.ln) + +OBJECT lh + head:PTR TO ln + tail:PTR TO ln + tailpred:PTR TO ln + type:CHAR + pad:CHAR +ENDOBJECT /* SIZEOF=14 */ + +OBJECT mlh + head:PTR TO mln + tail:PTR TO mln + tailpred:PTR TO mln +ENDOBJECT /* SIZEOF=12 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/memory.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/memory.e new file mode 100644 index 0000000..f2da0d6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/memory.e @@ -0,0 +1,58 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes' + +OBJECT ml + ln:ln + numentries:INT -> This is unsigned +-> Um, what about 'me[1]:ARRAY OF me' +ENDOBJECT /* SIZEOF=16 */ + +OBJECT me +-> a) next LONG is unioned with "reqs:LONG" + addr:LONG + length:LONG +ENDOBJECT /* SIZEOF=8 */ + +CONST MEMF_ANY=0, + MEMF_PUBLIC=1, + MEMF_CHIP=2, + MEMF_FAST=4, + MEMF_LOCAL=$100, + MEMF_24BITDMA=$200, + MEMF_KICK=$400, + MEMF_CLEAR=$10000, + MEMF_LARGEST=$20000, + MEMF_REVERSE=$40000, + MEMF_TOTAL=$80000, + MEMF_NO_EXPUNGE=$80000000, + MEM_BLOCKSIZE=8, + MEM_BLOCKMASK=7 + +OBJECT memhandlerdata + requestsize:LONG + requestflags:LONG + flags:LONG +ENDOBJECT /* SIZEOF=12 */ + +CONST MEMHF_RECYCLE=1, + MEM_DID_NOTHING=0, + MEM_ALL_DONE=-1, + MEM_TRY_AGAIN=1 + +OBJECT mh + ln:ln + attributes:INT -> This is unsigned + first:PTR TO mc + lower:LONG + upper:LONG + free:LONG +ENDOBJECT /* SIZEOF=32 */ + +OBJECT mc + next:PTR TO mc + bytes:LONG +-> Um, 'size:LONG' was an error +ENDOBJECT /* SIZEOF=NONE !!! */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/nodes.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/nodes.e new file mode 100644 index 0000000..28ff685 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/nodes.e @@ -0,0 +1,39 @@ +OPT MODULE +OPT EXPORT + +OBJECT ln + succ:PTR TO ln + pred:PTR TO ln + type:CHAR + pri:CHAR -> This is signed + name:PTR TO CHAR +ENDOBJECT /* SIZEOF=14 */ + +OBJECT mln + succ:PTR TO mln + pred:PTR TO mln +ENDOBJECT /* SIZEOF=8 */ + +CONST NT_UNKNOWN=0, + NT_TASK=1, + NT_INTERRUPT=2, + NT_DEVICE=3, + NT_MSGPORT=4, + NT_MESSAGE=5, + NT_FREEMSG=6, + NT_REPLYMSG=7, + NT_RESOURCE=8, + NT_LIBRARY=9, + NT_MEMORY=10, + NT_SOFTINT=11, + NT_FONT=12, + NT_PROCESS=13, + NT_SEMAPHORE=14, + NT_SIGNALSEM=15, + NT_BOOTNODE=16, + NT_KICKMEM=17, + NT_GRAPHICS=18, + NT_DEATHMESSAGE=19, + NT_USER=$FE, + NT_EXTENDED=$FF + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/ports.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/ports.e new file mode 100644 index 0000000..cfdc61d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/ports.e @@ -0,0 +1,26 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/lists', + 'exec/nodes' + +OBJECT mp + ln:ln + flags:CHAR + sigbit:CHAR + sigtask:LONG + msglist:lh +ENDOBJECT /* SIZEOF=34 */ + +CONST MP_SOFTINT=16, + PF_ACTION=3, + PA_SIGNAL=0, + PA_SOFTINT=1, + PA_IGNORE=2 + +OBJECT mn + ln:ln + replyport:PTR TO mp + length:INT -> This is unsigned +ENDOBJECT /* SIZEOF=20 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/resident.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/resident.e new file mode 100644 index 0000000..6d3be93 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/resident.e @@ -0,0 +1,24 @@ +OPT MODULE +OPT EXPORT + +OBJECT rt + matchword:INT -> This is unsigned + matchtag:PTR TO rt + endskip:LONG + flags:CHAR + version:CHAR + type:CHAR + pri:CHAR -> This is signed + name:PTR TO CHAR + idstring:PTR TO CHAR + init:LONG +ENDOBJECT /* SIZEOF=26 */ + +CONST RTC_MATCHWORD=$4AFC, + RTF_COLDSTART=1, + RTF_SINGLETASK=2, + RTF_AFTERDOS=4, + RTF_AUTOINIT=$80, + RTW_NEVER=0, + RTW_COLDSTART=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/semaphores.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/semaphores.e new file mode 100644 index 0000000..23b6685 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/semaphores.e @@ -0,0 +1,37 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/lists', + 'exec/nodes', + 'exec/ports', + 'exec/tasks' + +OBJECT ssr + mln:mln + waiter:PTR TO tc +ENDOBJECT /* SIZEOF=12 */ + +OBJECT ss + ln:ln + nestcount:INT + waitqueue:mlh + multiplelink:ssr + owner:PTR TO tc + queuecount:INT +ENDOBJECT /* SIZEOF=46 */ + +OBJECT semaphoremessage + mn:mn + semaphore:PTR TO ss +ENDOBJECT /* SIZEOF=24 */ + +OBJECT sm + mp:mp + bids:INT +ENDOBJECT /* SIZEOF=36 */ + +CONST SM_LOCKMSG=16, + SM_SHARED=1, + SM_EXCLUSIVE=0 + + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/strings.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/strings.e new file mode 100644 index 0000000..8f283a7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/strings.e @@ -0,0 +1,11 @@ +OPT MODULE +OPT EXPORT + +CONST EOS=0, + BELL=7, + LF=10, + CR=13, + BS=8, + DEL=$7F, + NL=10 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/tasks.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/tasks.e new file mode 100644 index 0000000..5ae7de9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/tasks.e @@ -0,0 +1,92 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/lists', + 'exec/nodes', + 'exec/ports' + +OBJECT tc + ln:ln + flags:CHAR + state:CHAR + idnestcnt:CHAR -> This is signed + tdnestcnt:CHAR -> This is signed + sigalloc:LONG + sigwait:LONG + sigrecvd:LONG + sigexcept:LONG +-> a) next two INTS unioned "etask:PTR TO etask" + trapalloc:INT -> This is unsigned + trapable:INT -> This is unsigned + exceptdata:LONG + exceptcode:LONG + trapdata:LONG + trapcode:LONG + spreg:LONG + splower:LONG + spupper:LONG + switch:LONG + launch:LONG + mementry:lh + userdata:LONG +ENDOBJECT /* SIZEOF=92 */ + +OBJECT etask + mn:mn + parent:PTR TO tc + uniqueid:LONG + children:mlh + trapalloc:INT -> This is unsigned + trapable:INT -> This is unsigned + result1:LONG + result2:LONG + taskmsgport:mp +ENDOBJECT /* SIZEOF=86 */ + +CONST CHILD_NOTNEW=1, + CHILD_NOTFOUND=2, + CHILD_EXITED=3, + CHILD_ACTIVE=4 + +OBJECT stackswapstruct + lower:LONG + upper:LONG + pointer:LONG +ENDOBJECT /* SIZEOF=12 */ + +CONST TB_PROCTIME=0, + TB_ETASK=3, + TB_STACKCHK=4, + TB_EXCEPT=5, + TB_SWITCH=6, + TB_LAUNCH=7, + TF_PROCTIME=1, + TF_ETASK=8, + TF_STACKCHK=16, + TF_EXCEPT=$20, + TF_SWITCH=$40, + TF_LAUNCH=$80, + TS_INVALID=0, + TS_ADDED=1, + TS_RUN=2, + TS_READY=3, + TS_WAIT=4, + TS_EXCEPT=5, + TS_REMOVED=6, + SIGB_ABORT=0, + SIGB_CHILD=1, + SIGB_BLIT=4, + SIGB_SINGLE=4, + SIGB_INTUITION=5, + SIGB_NET=7, + SIGB_DOS=8, + SIGF_ABORT=1, + SIGF_CHILD=2, + SIGF_BLIT=16, + SIGF_SINGLE=16, + SIGF_INTUITION=$20, + SIGF_NET=$80, + SIGF_DOS=$100, + SYS_SIGALLOC=$FFFF, + SYS_TRAPALLOC=$8000 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/exec/types.e b/amigae33a/E_v3.3a/Src/Src/Modules/exec/types.e new file mode 100644 index 0000000..2164f65 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/exec/types.e @@ -0,0 +1,7 @@ +OPT MODULE +OPT EXPORT + +CONST INCLUDE_VERSION=40, + LIBRARY_MINIMUM=$21, + BYTEMASK=$ff + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/button.e b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/button.e new file mode 100644 index 0000000..1c43d8c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/button.e @@ -0,0 +1,15 @@ +OPT MODULE +OPT EXPORT + +MODULE 'utility/tagitem' + +CONST BUTTON_DUMMY=TAG_USER+$4000000 + +CONST BUTTON_PUSHBUTTON=BUTTON_DUMMY+1, + BUTTON_GLYPH=BUTTON_DUMMY+2, + BUTTON_ARRAY=BUTTON_DUMMY+3, + BUTTON_TEXTPEN=BUTTON_DUMMY+5, + BUTTON_FILLPEN=BUTTON_DUMMY+6, + BUTTON_FILLTEXTPEN=BUTTON_DUMMY+7, + BUTTON_BACKGROUNDPEN=BUTTON_DUMMY+8, + BUTTON_CURRENT=BUTTON_DUMMY+9 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/calendar.e b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/calendar.e new file mode 100644 index 0000000..ff93a7a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/calendar.e @@ -0,0 +1,25 @@ +OPT MODULE +OPT EXPORT + +MODULE 'utility/tagitem' + +ENUM DL_TEXTPEN, DL_BACKGROUNDPEN, DL_FILLTEXTPEN, DL_FILLPEN, MAX_DL_PENS + +OBJECT daylabel + label:PTR TO CHAR + pen1:INT, pen2:INT, pen3:INT, pen4:INT + attrs:PTR TO tagitem + flags:LONG +ENDOBJECT + +SET DLF_SELECTED, DLF_DISABLED + +CONST CALENDAR_DUMMY=TAG_USER+$4000000 + +CONST CALENDAR_DAY=CALENDAR_DUMMY+1, + CALENDAR_CLOCKDATA=CALENDAR_DUMMY+2, + CALENDAR_FIRSTWEEKDAY=CALENDAR_DUMMY+3, + CALENDAR_DAYS=CALENDAR_DUMMY+4, + CALENDAR_MULTISELECT=CALENDAR_DUMMY+5, + CALENDAR_LABELS=CALENDAR_DUMMY+6, + CALENDAR_LABEL=CALENDAR_DUMMY+7 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/colorwheel.e b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/colorwheel.e new file mode 100644 index 0000000..8eb65d4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/colorwheel.e @@ -0,0 +1,31 @@ +OPT MODULE +OPT EXPORT + +OBJECT colorwheelhsb + hue:LONG + saturation:LONG + brightness:LONG +ENDOBJECT /* SIZEOF=12 */ + +OBJECT colorwheelrgb + red:LONG + green:LONG + blue:LONG +ENDOBJECT /* SIZEOF=12 */ + +CONST WHEEL_DUMMY=$84000000, + WHEEL_HUE=$84000001, + WHEEL_SATURATION=$84000002, + WHEEL_BRIGHTNESS=$84000003, + WHEEL_HSB=$84000004, + WHEEL_RED=$84000005, + WHEEL_GREEN=$84000006, + WHEEL_BLUE=$84000007, + WHEEL_RGB=$84000008, + WHEEL_SCREEN=$84000009, + WHEEL_ABBRV=$8400000A, + WHEEL_DONATION=$8400000B, + WHEEL_BEVELBOX=$8400000C, + WHEEL_GRADIENTSLIDER=$8400000D, + WHEEL_MAXPENS=$8400000E + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/gradientslider.e b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/gradientslider.e new file mode 100644 index 0000000..921c523 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/gradientslider.e @@ -0,0 +1,10 @@ +OPT MODULE +OPT EXPORT + +CONST GRAD_DUMMY=$85000000, + GRAD_MAXVAL=$85000001, + GRAD_CURVAL=$85000002, + GRAD_SKIPVAL=$85000003, + GRAD_KNOBPIXELS=$85000004, + GRAD_PENARRAY=$85000005 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/tabs.e b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/tabs.e new file mode 100644 index 0000000..0d94906 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/tabs.e @@ -0,0 +1,17 @@ +OPT MODULE +OPT EXPORT + +MODULE 'utility/tagitem' + +ENUM TL_TEXTPEN, TL_BACKGROUNDPEN, TL_FILLTEXTPEN, TL_FILLPEN, MAX_TL_PENS + +OBJECT tablabel + label:PTR TO CHAR + pen1:INT, pen2:INT, pen3:INT, pen4:INT + attrs:PTR TO tagitem +ENDOBJECT + +CONST TABS_DUMMY=TAG_USER+$4000000 + +CONST TABS_LABELS=TABS_DUMMY+1, + TABS_CURRENT=TABS_DUMMY+2 \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/tapedeck.e b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/tapedeck.e new file mode 100644 index 0000000..904e34d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/gadgets/tapedeck.e @@ -0,0 +1,17 @@ +OPT MODULE +OPT EXPORT + +CONST TDECK_DUMMY=$85000000, + TDECK_MODE=$85000001, + TDECK_PAUSED=$85000002, + TDECK_TAPE=$85000003, + TDECK_FRAMES=$8500000B, + TDECK_CURRENTFRAME=$8500000C, + BUT_REWIND=0, + BUT_PLAY=1, + BUT_FORWARD=2, + BUT_STOP=3, + BUT_PAUSE=4, + BUT_BEGIN=5, + BUT_FRAME=6, + BUT_END=7 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/clip.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/clip.e new file mode 100644 index 0000000..11ed119 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/clip.e @@ -0,0 +1,73 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/semaphores', + 'graphics/gfx', + 'graphics/layers', + 'graphics/rastport', + 'graphics/regions', + 'utility/hooks' + +CONST NEWLOCKS=1 + +OBJECT layer + front:PTR TO layer + back:PTR TO layer + cliprect:PTR TO cliprect + rp:PTR TO rastport + minx:INT + miny:INT + maxx:INT + maxy:INT + reserved[4]:ARRAY + priority:INT -> This is unsigned + flags:INT -> This is unsigned + superbitmap:PTR TO bitmap + supercliprect:PTR TO cliprect + window:LONG + scroll_x:INT + scroll_y:INT + cr:PTR TO cliprect + cr2:PTR TO cliprect + crnew:PTR TO cliprect + supersavercliprects:PTR TO cliprect +-> Um, this had an illegal name + cliprects_:PTR TO cliprect + layerinfo:PTR TO layer_info + lock:ss + backfill:PTR TO hook + reserved1:LONG + clipregion:PTR TO region + savecliprects:PTR TO region + reserved2[22]:ARRAY + damagelist:PTR TO region +ENDOBJECT /* SIZEOF=160 */ + +OBJECT cliprect + next:PTR TO cliprect + prev:PTR TO cliprect + lobs:PTR TO layer + bitmap:PTR TO bitmap + minx:INT + miny:INT + maxx:INT + maxy:INT +-> Um, these had illegal names + p1_:LONG + p2_:LONG + reserved:LONG + flags:LONG +ENDOBJECT /* SIZEOF=40 */ + +CONST CR_NEEDS_NO_CONCEALED_RASTERS=1, + CR_NEEDS_NO_LAYERBLIT_DAMAGE=2, + ISLESSX=1, + ISLESSY=2, + ISGRTRX=4, + ISGRTRY=8, + LR_FRONT=0, + LR_BACK=4, + LR_RASTPORT=12, + CR_PREV=4, + CR_LOBS=8 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/coerce.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/coerce.e new file mode 100644 index 0000000..9ad1695 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/coerce.e @@ -0,0 +1,8 @@ +OPT MODULE +OPT EXPORT + +CONST PRESERVE_COLORS=1, + AVOID_FLICKER=2, + IGNORE_MCOMPAT=4, + BIDTAG_COERCE=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/collide.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/collide.e new file mode 100644 index 0000000..a1cc346 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/collide.e @@ -0,0 +1,8 @@ +OPT MODULE +OPT EXPORT + +CONST BORDERHIT=0, + TOPHIT=1, + BOTTOMHIT=2, + LEFTHIT=4, + RIGHTHIT=8 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/copper.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/copper.e new file mode 100644 index 0000000..a7fb11b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/copper.e @@ -0,0 +1,79 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'graphics/view' + +CONST COPPER_MOVE=0, + COPPER_WAIT=1, + CPRNXTBUF=2, + CPR_NT_LOF=$8000, + CPR_NT_SHT=$4000, + CPR_NT_SYS=$2000 + +OBJECT copins + opcode:INT +-> a) next two INTs are unioned with "nxtlist:PTR TO coplist" +-> b) next INT is unioned with "destaddr:INT" + vwaitpos:INT +-> b) next INT is unioned with "destdata:INT" + hwaitpos:INT +ENDOBJECT /* SIZEOF=6 */ + +#define VWAITPOS vwaitpos +#define DESTADDR vwaitpos +#define HWAITPOS hwaitpos +#define DESTDATA hwaitpos + +OBJECT cprlist + next:PTR TO cprlist + start:PTR TO INT -> Target is unsigned + maxcount:INT +ENDOBJECT /* SIZEOF=10 */ + +OBJECT coplist + next:PTR TO coplist +-> Um, these had illegal names + coplist_:PTR TO coplist + viewport_:PTR TO viewport + copins:PTR TO copins + copptr:PTR TO copins + coplstart:PTR TO INT -> Target is unsigned + copsstart:PTR TO INT -> Target is unsigned + count:INT + maxcount:INT + dyoffset:INT +-> Um, if V1_3 only? +-> cop2start:PTR TO INT +-> cop3start:PTR TO INT +-> cop4start:PTR TO INT +-> cop5start:PTR TO INT + slrepeat:INT -> This is unsigned + flags:INT -> This is unsigned +ENDOBJECT /* SIZEOF=50 */ + +CONST EXACT_LINE=1, + HALF_LINE=2 + +OBJECT ucoplist + next:PTR TO ucoplist + firstcoplist:PTR TO coplist + coplist:PTR TO coplist +ENDOBJECT /* SIZEOF=12 */ + +OBJECT copinit + vsync_hblank[2]:ARRAY OF INT -> Array is unsigned + diagstrt[12]:ARRAY OF INT -> Array is unsigned + fm0[2]:ARRAY OF INT -> Array is unsigned + diwstart[10]:ARRAY OF INT -> Array is unsigned + bplcon2[2]:ARRAY OF INT -> Array is unsigned + sprfix[16]:ARRAY OF INT -> Array is unsigned + sprstrtup[32]:ARRAY OF INT -> Array is unsigned + wait14[2]:ARRAY OF INT -> Array is unsigned + norm_hblank[2]:ARRAY OF INT -> Array is unsigned + jump[2]:ARRAY OF INT -> Array is unsigned + wait_forever[6]:ARRAY OF INT -> Array is unsigned + sprstop[8]:ARRAY OF INT -> Array is unsigned +ENDOBJECT /* SIZEOF=192 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/display.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/display.e new file mode 100644 index 0000000..346523b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/display.e @@ -0,0 +1,20 @@ +OPT MODULE +OPT EXPORT + +CONST MODE_640=$8000, + PLNCNTMSK=7, + PLNCNTSHFT=12, + PF2PRI=$40, + COLORON=$200, + DBLPF=$400, + HOLDNMODIFY=$800, + INTERLACE=4, + PFA_FINE_SCROLL=15, + PFB_FINE_SCROLL_SHIFT=4, + PF_FINE_SCROLL_MASK=15, + DIW_HORIZ_POS=$7F, + DIW_VRTCL_POS=$1FF, + DIW_VRTCL_POS_SHIFT=7, + DFTCH_MASK=$FF, + VPOSRLOF=$8000 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/displayinfo.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/displayinfo.e new file mode 100644 index 0000000..29bfa6e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/displayinfo.e @@ -0,0 +1,117 @@ +OPT MODULE +OPT EXPORT + +MODULE 'graphics/gfx', + 'graphics/monitor' + +CONST DTAG_DISP=$80000000, + DTAG_DIMS=$80001000, + DTAG_MNTR=$80002000, + DTAG_NAME=$80003000, + DTAG_VEC=$80004000 + +OBJECT qh + structid:LONG + displayid:LONG + skipid:LONG + length:LONG +ENDOBJECT /* SIZEOF=16 */ + +OBJECT displayinfo + qh:qh + notavailable:INT -> This is unsigned + propertyflags:LONG + resolution:tpoint + pixelspeed:INT -> This is unsigned + numstdsprites:INT -> This is unsigned + paletterange:INT -> This is unsigned + spriteresolution:tpoint + pad[4]:ARRAY + redbits:CHAR + greenbits:CHAR + bluebits:CHAR + pad2a:CHAR + pad2b[4]:ARRAY + reserved[2]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=56 */ + +CONST DI_AVAIL_NOCHIPS=1, + DI_AVAIL_NOMONITOR=2, + DI_AVAIL_NOTWITHGENLOCK=4, + DIPF_IS_LACE=1, + DIPF_IS_DUALPF=2, + DIPF_IS_PF2PRI=4, + DIPF_IS_HAM=8, + DIPF_IS_ECS=16, + DIPF_IS_AA=$10000, + DIPF_IS_PAL=$20, + DIPF_IS_SPRITES=$40, + DIPF_IS_GENLOCK=$80, + DIPF_IS_WB=$100, + DIPF_IS_DRAGGABLE=$200, + DIPF_IS_PANELLED=$400, + DIPF_IS_BEAMSYNC=$800, + DIPF_IS_EXTRAHALFBRITE=$1000, + DIPF_IS_SPRITES_ATT=$2000, + DIPF_IS_SPRITES_CHNG_RES=$4000, + DIPF_IS_SPRITES_BORDER=$8000, + DIPF_IS_SCANDBL=$20000, + DIPF_IS_SPRITES_CHNG_BASE=$40000, + DIPF_IS_SPRITES_CHNG_PRI=$80000, + DIPF_IS_DBUFFER=$100000, + DIPF_IS_PROGBEAM=$200000, + DIPF_IS_FOREIGN=$80000000 + +OBJECT dimensioninfo + qh:qh + maxdepth:INT -> This is unsigned + minrasterwidth:INT -> This is unsigned + minrasterheight:INT -> This is unsigned + maxrasterwidth:INT -> This is unsigned + maxrasterheight:INT -> This is unsigned + nominal:rectangle + maxoscan:rectangle + videooscan:rectangle + txtoscan:rectangle + stdoscan:rectangle + pad[14]:ARRAY + reserved[2]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=88 */ + +OBJECT monitorinfo + qh:qh + mspc:PTR TO monitorspec + viewposition:tpoint + viewresolution:tpoint + viewpositionrange:rectangle + totalrows:INT -> This is unsigned + totalcolorclocks:INT -> This is unsigned + minrow:INT -> This is unsigned + compatibility:INT + pad[32]:ARRAY + mousetick:tpoint + defaultviewposition:tpoint + preferredmodeid:LONG + reserved[2]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=96 */ + +CONST MCOMPAT_MIXED=0, + MCOMPAT_SELF=1, + MCOMPAT_NOBODY=-1, + DISPLAYNAMELEN=$20 + +OBJECT nameinfo + qh:qh + name[32]:ARRAY + reserved[2]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=56 */ + +OBJECT vecinfo + qh:qh + vec:LONG + data:LONG + type:INT -> This is unsigned + pad[3]:ARRAY OF INT -> Array is unsigned + reserved[2]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=40 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gels.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gels.e new file mode 100644 index 0000000..5c7be58 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gels.e @@ -0,0 +1,118 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +CONST SUSERFLAGS=$FF, + VSF_VSPRITE=1, + VSF_SAVEBACK=2, + VSF_OVERLAY=4, + VSF_MUSTDRAW=8, + VSF_BACKSAVED=$100, + VSF_BOBUPDATE=$200, + VSF_GELGONE=$400, + VSF_VSOVERFLOW=$800, + BUSERFLAGS=$FF, + BF_SAVEBOB=1, + BF_BOBISCOMP=2, + BF_BWAITING=$100, + BF_BDRAWN=$200, + BF_BOBSAWAY=$400, + BF_BOBNIX=$800, + BF_SAVEPRESERVE=$1000, + BF_OUTSTEP=$2000, + ANFRACSIZE=6, + ANIMHALF=$20, + RINGTRIGGER=1 + +OBJECT vs + nextvsprite:PTR TO vs + prevvsprite:PTR TO vs + drawpath:PTR TO vs + clearpath:PTR TO vs + oldy:INT + oldx:INT + vsflags:INT + y:INT + x:INT + height:INT + width:INT + depth:INT + memask:INT + hitmask:INT + imagedata:PTR TO INT + borderline:PTR TO INT + collmask:PTR TO INT + sprcolors:PTR TO INT + vsbob:PTR TO bob + planepick:CHAR -> This is signed + planeonoff:CHAR -> This is signed + vuserext:LONG +ENDOBJECT /* SIZEOF=58 */ + +OBJECT bob + bobflags:INT + savebuffer:PTR TO INT + imageshadow:PTR TO INT + before:PTR TO bob + after:PTR TO bob + bobvsprite:PTR TO vs + bobcomp:PTR TO ac + dbuffer:PTR TO dbp + buserext:LONG +ENDOBJECT /* SIZEOF=30 */ + +OBJECT ac + compflags:INT + timer:INT + timeset:INT + nextcomp:PTR TO ac + prevcomp:PTR TO ac + nextseq:PTR TO ac + prevseq:PTR TO ac + animcroutine:LONG + ytrans:INT + xtrans:INT + headob:PTR TO ao + animbob:PTR TO bob +ENDOBJECT /* SIZEOF=38 */ + +OBJECT ao + nextob:PTR TO ao + prevob:PTR TO ao + clock:LONG + anoldy:INT + anoldx:INT + any:INT + anx:INT + yvel:INT + xvel:INT + yaccel:INT + xaccel:INT + ringytrans:INT + ringxtrans:INT + animoroutine:LONG + headcomp:PTR TO ac + auserext:LONG +ENDOBJECT /* SIZEOF=40 */ + +OBJECT dbp + bufy:INT + bufx:INT + bufpath:PTR TO vs + bufbuffer:PTR TO INT +-> Um, 'bufplanes' not in .h file + bufplanes:PTR TO LONG +ENDOBJECT /* SIZEOF=16 */ + +#define InitAnimate(animKey) PutLong(animKey,NIL) +#define RemBob(b) PutInt(b, Int(b) OR BF_BOBSAWAY) + +CONST B2NORM=0, + B2SWAP=1, + B2BOBBER=2 + +-> Um, this was in 'graphics/view' +OBJECT colltable + collptrs[16]:ARRAY OF LONG +ENDOBJECT diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfx.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfx.e new file mode 100644 index 0000000..4f0bb44 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfx.e @@ -0,0 +1,55 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +#define RASSIZE(w,h) (Mul((h),Shr((w)+15,3) AND $FFFE)) + +CONST BITSET=$8000, + BITCLR=0, + AGNUS=1, + DENISE=1 + +OBJECT bitmap + bytesperrow:INT -> This is unsigned + rows:INT -> This is unsigned + flags:CHAR + depth:CHAR + pad:INT + planes[8]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=40 */ + +OBJECT rectangle + minx:INT + miny:INT + maxx:INT + maxy:INT +ENDOBJECT /* SIZEOF=8 */ + +OBJECT rect32 + minx:LONG + miny:LONG + maxx:LONG + maxy:LONG +ENDOBJECT /* SIZEOF=16 */ + +OBJECT tpoint + x:INT + y:INT +ENDOBJECT /* SIZEOF=4 */ + +CONST BMB_CLEAR=0, + BMB_DISPLAYABLE=1, + BMB_INTERLEAVED=2, + BMB_STANDARD=3, + BMB_MINPLANES=4, + BMF_CLEAR=1, + BMF_DISPLAYABLE=2, + BMF_INTERLEAVED=4, + BMF_STANDARD=8, + BMF_MINPLANES=16, + BMA_HEIGHT=0, + BMA_DEPTH=4, + BMA_WIDTH=8, + BMA_FLAGS=12 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfxbase.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfxbase.e new file mode 100644 index 0000000..ad37247 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfxbase.e @@ -0,0 +1,170 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/interrupts', + 'exec/libraries', + 'exec/lists', + 'exec/semaphores', + 'exec/tasks', + 'graphics/copper', + 'graphics/monitor', + 'graphics/sprite', + 'graphics/text', + 'graphics/view', + 'hardware/blit' + +OBJECT gfxbase +-> Um, this was missing + lib:lib + actiview:PTR TO view + copinit:PTR TO copinit + cia:PTR TO LONG + blitter:PTR TO LONG + loflist:PTR TO INT -> Target is unsigned + shflist:PTR TO INT -> Target is unsigned + blthd:PTR TO bltnode + blttl:PTR TO bltnode + bsblthd:PTR TO bltnode + bsblttl:PTR TO bltnode + vbsrv:is + timsrv:is + bltsrv:is + textfonts:lh + defaultfont:PTR TO textfont + modes:INT -> This is unsigned + vblank:CHAR -> This is signed + debug:CHAR -> This is signed + beamsync:INT + system_bplcon0:INT + spritereserved:CHAR + bytereserved:CHAR + flags:INT -> This is unsigned + blitlock:INT + blitnest:INT + blitwaitq:lh + blitowner:PTR TO tc + tof_waitq:lh + displayflags:INT -> This is unsigned +-> This is really PTR TO PTR TO simplesprite + simplesprites:PTR TO LONG + maxdisplayrow:INT -> This is unsigned + maxdisplaycolumn:INT -> This is unsigned + normaldisplayrows:INT -> This is unsigned + normaldisplaycolumns:INT -> This is unsigned + normaldpmx:INT -> This is unsigned + normaldpmy:INT -> This is unsigned + lastchancememory:PTR TO ss + lcmptr:PTR TO INT -> Target is unsigned + microsperline:INT -> This is unsigned + mindisplaycolumn:INT -> This is unsigned + chiprevbits0:CHAR + memtype:CHAR + crb_reserved[4]:ARRAY + monitor_id:INT -> This is unsigned + hedley[8]:ARRAY OF LONG + hedley_sprites[8]:ARRAY OF LONG + hedley_sprites1[8]:ARRAY OF LONG + hedley_count:INT + hedley_flags:INT -> This is unsigned + hedley_tmp:INT + hash_table:PTR TO LONG + current_tot_rows:INT -> This is unsigned + current_tot_cclks:INT -> This is unsigned + hedley_hint:CHAR + hedley_hint2:CHAR + nreserved[4]:ARRAY OF LONG + a2024_sync_raster:PTR TO LONG + control_delta_pal:INT -> This is unsigned + control_delta_ntsc:INT -> This is unsigned + current_monitor:PTR TO monitorspec + monitorlist:lh + default_monitor:PTR TO monitorspec + monitorlistsemaphore:PTR TO ss + displayinfodatabase:LONG + topline:INT -> This is unsigned + activiewcprsemaphore:PTR TO ss + utilbase:PTR TO LONG + execbase:PTR TO LONG + bwshifts:PTR TO CHAR + strtfetchmasks:PTR TO INT -> Target is unsigned + stopfetchmasks:PTR TO INT -> Target is unsigned + overrun:PTR TO INT -> Target is unsigned + realstops:PTR TO INT + spritewidth:INT -> This is unsigned + spritefmode:INT -> This is unsigned + softsprites:CHAR -> This is signed + arraywidth:CHAR -> This is signed + defaultspritewidth:INT -> This is unsigned + sprmovedisable:CHAR -> This is signed + wantchips:CHAR + boardmemtype:CHAR + bugs:CHAR + layersbase:PTR TO LONG + colormask:LONG + ivector:LONG + idata:LONG + specialcounter:LONG + dblist:LONG + monitorflags:INT -> This is unsigned + scandoubledsprites:CHAR + bp3bits:CHAR + monitorvblank:analogsignalinterval + natural_monitor:PTR TO monitorspec + progdata:LONG + extsprites:CHAR + pad3:CHAR + gfxflags:INT -> This is unsigned + vbcounter:LONG + hashtablesemaphore:PTR TO ss + hwemul[9]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=497 */ + +#define chunkytoplanarptr hwemul[0] + +CONST OWNBLITTERN=0, + QBOWNERN=1, + BLITMSG_FAULTN=2, + BLITMSG_FAULT=4, + QBOWNER=2, + GBFLAGSF_TIMER=$40, + GBFLAGSF_LASTBLIT=$80, + GFXB_BIG_BLITS=0, + GFXB_HR_AGNUS=0, + GFXB_HR_DENISE=1, + GFXB_AA_ALICE=2, + GFXB_AA_LISA=3, + GFXB_AA_MLISA=4, + GFXF_BIG_BLITS=1, + GFXF_HR_AGNUS=1, + GFXF_HR_DENISE=2, + GFXF_AA_ALICE=4, + GFXF_AA_LISA=8, + GFXF_AA_MLISA=16, + SETCHIPREV_A=1, + SETCHIPREV_ECS=3, + SETCHIPREV_AA=15, + SETCHIPREV_BEST=-1, + BUS_16=0, + NML_CAS=0, + BUS_32=1, + DBL_CAS=2, + BANDWIDTH_1X=0, + BANDWIDTH_2XNML=1, + BANDWIDTH_2XDBL=2, + BANDWIDTH_4X=3, + NEW_DATABASE=1, + NTSCN=0, + NTSC=1, + GENLOCN=1, + GENLOC=2, + PALN=2, + PAL=4, + TODA_SAFEN=3, + TODA_SAFE=8, + REALLY_PALN=4, + REALLY_PAL=16, + LPEN_SWAP_FRAMES=32 + +#define GRAPHICSNAME 'graphics.library' diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfxmacros.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfxmacros.e new file mode 100644 index 0000000..97630e8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfxmacros.e @@ -0,0 +1,44 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +-> These need 'graphics/gfx', 'hardware/custom', 'hardware/dmabits' +#define ON_DISPLAY PutInt(CUSTOMADDR+DMACON,BITSET OR DMAF_RASTER) +#define OFF_DISPLAY PutInt(CUSTOMADDR+DMACON,BITCLR OR DMAF_RASTER) +#define ON_SPRITE PutInt(CUSTOMADDR+DMACON,BITSET OR DMAF_SPRITE) +#define OFF_SPRITE PutInt(CUSTOMADDR+DMACON,BITCLR OR DMAF_SPRITE) + +-> Same, but 'hardware/intbits' instead of 'hardware/dmabits' +#define ON_VBLANK PutInt(CUSTOMADDR+INTENA,BITSET OR INTF_VERTB) +#define OFF_VBLANK PutInt(CUSTOMADDR+INTENA,BITCLR OR INTF_VERTB) + +#define SetDrPt(w,p) (PutInt((w)+RP_LINEPTRN,(p)) BUT \ + PutInt((w)+RP_FLAGS,Int((w)+RP_FLAGS) OR FRST_DOT) BUT \ + PutChar((w)+RP_LINPATCNT,15)) +#define SetAfPt(w,p,n) (PutLong((w)+RP_AREAPTRN,(p)) BUT \ + PutChar((w)+RP_AREAPTSZ,(n))) + +#define SetOPen(w,c) (PutChar((w)+RP_AOLPEN,(c)) BUT \ + PutInt((w)+RP_FLAGS,Int((w)+RP_FLAGS) OR RPF_AREAOUTLINE)) +#define SetWrMsk(w,m) PutChar((w)+RP_MASK,(m)) + +#define SafeSetOutlinePen(w,c) (IF KickVersion(39) THEN SetOutlinePen((w),(c)) \ + ELSE SetOPen(w,c)) +#define SafeSetWriteMask(w,m) (IF KickVersion(39) THEN SetWriteMask((w),(m)) \ + ELSE SetWrMsk(w,m)) + +#define GetOutlinePen(rp) GetOPen((rp)) + +#define BNDRYOFF(w) PutInt((w)+RP_FLAGS,Int((w)+RP_FLAGS) AND Not(RPF_AREAOUTLINE)) + +#define CINIT(c,n) UcopperListInit((c),(n)) +#define CMOVE(c,a,b) (Cmove((c),{a},(b)) BUT Cbump((c))) +-> CMOVE is a little hard to use due to {a}. CMOVEA() is the same except it +-> expects the address, so it may be easier to use... +#define CMOVEA(c,d,b) (Cmove((c),(d),(b)) BUT Cbump((c))) +#define CWAIT(c,a,b) (Cwait((c),(a),(b)) BUT Cbump((c))) +#define CEND(c) CWAIT((c),10000,255) + +#define DrawCircle(rp,cx,cy,r) DrawEllipse((rp),(cx),(cy),(r),(r)) +#define AreaCircle(rp,cx,cy,r) AreaEllipse((rp),(cx),(cy),(r),(r)) diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfxnodes.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfxnodes.e new file mode 100644 index 0000000..592258b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/gfxnodes.e @@ -0,0 +1,23 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes' + +OBJECT xln + succ:PTR TO ln + pred:PTR TO ln + type:CHAR + pri:CHAR -> This is signed + name:PTR TO CHAR + subsystem:CHAR + subtype:CHAR + library:LONG + init:LONG +ENDOBJECT /* SIZEOF=24 */ + +CONST SS_GRAPHICS=2, + VIEW_EXTRA_TYPE=1, + VIEWPORT_EXTRA_TYPE=2, + SPECIAL_MONITOR_TYPE=3, + MONITOR_SPEC_TYPE=4 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/graphint.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/graphint.e new file mode 100644 index 0000000..1a4871a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/graphint.e @@ -0,0 +1,12 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes' + +OBJECT isrvstr + ln:ln + iptr:PTR TO isrvstr + code:LONG + ccode:LONG + carg:LONG +ENDOBJECT diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/layers.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/layers.e new file mode 100644 index 0000000..e60ffb7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/layers.e @@ -0,0 +1,41 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/lists', + 'exec/semaphores', + 'graphics/clip' + +CONST LAYERSIMPLE=1, + LAYERSMART=2, + LAYERSUPER=4, + LAYERUPDATING=16, + LAYERBACKDROP=$40, + LAYERREFRESH=$80, + LAYERIREFRESH=$200, + LAYERIREFRESH2=$400, + LAYER_CLIPRECTS_LOST=$100 + +OBJECT layer_info + top_layer:PTR TO layer + check_lp:PTR TO layer + obs:PTR TO cliprect + freecliprects:PTR TO cliprect + privatereserve1:LONG + privatereserve2:LONG + lock:ss + gs_head:mlh + privatereserve3:INT + privatereserve4:LONG + flags:INT -> This is unsigned + fatten_count:CHAR + locklayerscount:CHAR + privatereserve5:INT + blankhook:LONG + layerinfo_extra:LONG +ENDOBJECT /* SIZEOF=102 */ + +CONST NEWLAYERINFO_CALLED=1, + ALERTLAYERSNOMEM=$83010000, + LAYERS_NOBACKFILL=1, + LAYERS_BACKFILL=0 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/modeid.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/modeid.e new file mode 100644 index 0000000..50f7f56 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/modeid.e @@ -0,0 +1,253 @@ +OPT MODULE +OPT EXPORT + +CONST INVALID_ID=-1, + MONITOR_ID_MASK=$FFFF1000, + DEFAULT_MONITOR_ID=0, + NTSC_MONITOR_ID=$11000, + PAL_MONITOR_ID=$21000, + LORES_KEY=0, + HIRES_KEY=$8000, + SUPER_KEY=$8020, + HAM_KEY=$800, + LORESLACE_KEY=4, + HIRESLACE_KEY=$8004, + SUPERLACE_KEY=$8024, + HAMLACE_KEY=$804, + LORESDPF_KEY=$400, + HIRESDPF_KEY=$8400, + SUPERDPF_KEY=$8420, + LORESLACEDPF_KEY=$404, + HIRESLACEDPF_KEY=$8404, + SUPERLACEDPF_KEY=$8424, + LORESDPF2_KEY=$440, + HIRESDPF2_KEY=$8440, + SUPERDPF2_KEY=$8460, + LORESLACEDPF2_KEY=$444, + HIRESLACEDPF2_KEY=$8444, + SUPERLACEDPF2_KEY=$8464, + EXTRAHALFBRITE_KEY=$80, + EXTRAHALFBRITELACE_KEY=$84, + HIRESHAM_KEY=$8800, + SUPERHAM_KEY=$8820, + HIRESEHB_KEY=$8080, + SUPEREHB_KEY=$80A0, + HIRESHAMLACE_KEY=$8804, + SUPERHAMLACE_KEY=$8824, + HIRESEHBLACE_KEY=$8084, + SUPEREHBLACE_KEY=$80A4, + LORESSDBL_KEY=8, + LORESHAMSDBL_KEY=$808, + LORESEHBSDBL_KEY=$88, + HIRESHAMSDBL_KEY=$8808, + VGA_MONITOR_ID=$31000, + VGAEXTRALORES_KEY=$31004, + VGALORES_KEY=$39004, + VGAPRODUCT_KEY=$39024, + VGAHAM_KEY=$31804, + VGAEXTRALORESLACE_KEY=$31005, + VGALORESLACE_KEY=$39005, + VGAPRODUCTLACE_KEY=$39025, + VGAHAMLACE_KEY=$31805, + VGAEXTRALORESDPF_KEY=$31404, + VGALORESDPF_KEY=$39404, + VGAPRODUCTDPF_KEY=$39424, + VGAEXTRALORESLACEDPF_KEY=$31405, + VGALORESLACEDPF_KEY=$39405, + VGAPRODUCTLACEDPF_KEY=$39425, + VGAEXTRALORESDPF2_KEY=$31444, + VGALORESDPF2_KEY=$39444, + VGAPRODUCTDPF2_KEY=$39464, + VGAEXTRALORESLACEDPF2_KEY=$31445, + VGALORESLACEDPF2_KEY=$39445, + VGAPRODUCTLACEDPF2_KEY=$39465, + VGAEXTRAHALFBRITE_KEY=$31084, + VGAEXTRAHALFBRITELACE_KEY=$31085, + VGAPRODUCTHAM_KEY=$39824, + VGALORESHAM_KEY=$39804, + VGAEXTRALORESHAM_KEY=$31804, + VGAPRODUCTHAMLACE_KEY=$39825, + VGALORESHAMLACE_KEY=$39805, + VGAEXTRALORESHAMLACE_KEY=$31805, + VGAEXTRALORESEHB_KEY=$31084, + VGAEXTRALORESEHBLACE_KEY=$31085, + VGALORESEHB_KEY=$39084, + VGALORESEHBLACE_KEY=$39085, + VGAEHB_KEY=$390A4, + VGAEHBLACE_KEY=$390A5, + VGAEXTRALORESDBL_KEY=$31000, + VGALORESDBL_KEY=$39000, + VGAPRODUCTDBL_KEY=$39020, + VGAEXTRALORESHAMDBL_KEY=$31800, + VGALORESHAMDBL_KEY=$39800, + VGAPRODUCTHAMDBL_KEY=$39820, + VGAEXTRALORESEHBDBL_KEY=$31080, + VGALORESEHBDBL_KEY=$39080, + VGAPRODUCTEHBDBL_KEY=$390A0, + A2024_MONITOR_ID=$41000, + A2024TENHERTZ_KEY=$41000, + A2024FIFTEENHERTZ_KEY=$49000, + PROTO_MONITOR_ID=$51000, + EURO72_MONITOR_ID=$61000, + EURO72EXTRALORES_KEY=$61004, + EURO72LORES_KEY=$69004, + EURO72PRODUCT_KEY=$69024, + EURO72HAM_KEY=$61804, + EURO72EXTRALORESLACE_KEY=$61005, + EURO72LORESLACE_KEY=$69005, + EURO72PRODUCTLACE_KEY=$69025, + EURO72HAMLACE_KEY=$61805, + EURO72EXTRALORESDPF_KEY=$61404, + EURO72LORESDPF_KEY=$69404, + EURO72PRODUCTDPF_KEY=$69424, + EURO72EXTRALORESLACEDPF_KEY=$61405, + EURO72LORESLACEDPF_KEY=$69405, + EURO72PRODUCTLACEDPF_KEY=$69425, + EURO72EXTRALORESDPF2_KEY=$61444, + EURO72LORESDPF2_KEY=$69444, + EURO72PRODUCTDPF2_KEY=$69464, + EURO72EXTRALORESLACEDPF2_KEY=$61445, + EURO72LORESLACEDPF2_KEY=$69445, + EURO72PRODUCTLACEDPF2_KEY=$69465, + EURO72EXTRAHALFBRITE_KEY=$61084, + EURO72EXTRAHALFBRITELACE_KEY=$61085, + EURO72PRODUCTHAM_KEY=$69824, + EURO72PRODUCTHAMLACE_KEY=$69825, + EURO72LORESHAM_KEY=$69804, + EURO72LORESHAMLACE_KEY=$69805, + EURO72EXTRALORESHAM_KEY=$61804, + EURO72EXTRALORESHAMLACE_KEY=$61805, + EURO72EXTRALORESEHB_KEY=$61084, + EURO72EXTRALORESEHBLACE_KEY=$61085, + EURO72LORESEHB_KEY=$69084, + EURO72LORESEHBLACE_KEY=$69085, + EURO72EHB_KEY=$690A4, + EURO72EHBLACE_KEY=$690A5, + EURO72EXTRALORESDBL_KEY=$61000, + EURO72LORESDBL_KEY=$69000, + EURO72PRODUCTDBL_KEY=$69020, + EURO72EXTRALORESHAMDBL_KEY=$61800, + EURO72LORESHAMDBL_KEY=$69800, + EURO72PRODUCTHAMDBL_KEY=$69820, + EURO72EXTRALORESEHBDBL_KEY=$61080, + EURO72LORESEHBDBL_KEY=$69080, + EURO72PRODUCTEHBDBL_KEY=$690A0, + EURO36_MONITOR_ID=$71000, + SUPER72_MONITOR_ID=$81000, + SUPER72LORESDBL_KEY=$81008, + SUPER72HIRESDBL_KEY=$89008, + SUPER72SUPERDBL_KEY=$89028, + SUPER72LORESHAMDBL_KEY=$81808, + SUPER72HIRESHAMDBL_KEY=$89808, + SUPER72SUPERHAMDBL_KEY=$89828, + SUPER72LORESEHBDBL_KEY=$81088, + SUPER72HIRESEHBDBL_KEY=$89088, + SUPER72SUPEREHBDBL_KEY=$890A8, + DBLNTSC_MONITOR_ID=$91000, + DBLNTSCLORES_KEY=$91000, + DBLNTSCLORESFF_KEY=$91004, + DBLNTSCLORESHAM_KEY=$91800, + DBLNTSCLORESHAMFF_KEY=$91804, + DBLNTSCLORESEHB_KEY=$91080, + DBLNTSCLORESEHBFF_KEY=$91084, + DBLNTSCLORESLACE_KEY=$91005, + DBLNTSCLORESHAMLACE_KEY=$91805, + DBLNTSCLORESEHBLACE_KEY=$91085, + DBLNTSCLORESDPF_KEY=$91400, + DBLNTSCLORESDPFFF_KEY=$91404, + DBLNTSCLORESDPFLACE_KEY=$91405, + DBLNTSCLORESDPF2_KEY=$91440, + DBLNTSCLORESDPF2FF_KEY=$91444, + DBLNTSCLORESDPF2LACE_KEY=$91445, + DBLNTSCHIRES_KEY=$99000, + DBLNTSCHIRESFF_KEY=$99004, + DBLNTSCHIRESHAM_KEY=$99800, + DBLNTSCHIRESHAMFF_KEY=$99804, + DBLNTSCHIRESLACE_KEY=$99005, + DBLNTSCHIRESHAMLACE_KEY=$99805, + DBLNTSCHIRESEHB_KEY=$99080, + DBLNTSCHIRESEHBFF_KEY=$99084, + DBLNTSCHIRESEHBLACE_KEY=$99085, + DBLNTSCHIRESDPF_KEY=$99400, + DBLNTSCHIRESDPFFF_KEY=$99404, + DBLNTSCHIRESDPFLACE_KEY=$99405, + DBLNTSCHIRESDPF2_KEY=$99440, + DBLNTSCHIRESDPF2FF_KEY=$99444, + DBLNTSCHIRESDPF2LACE_KEY=$99445, + DBLNTSCEXTRALORES_KEY=$91200, + DBLNTSCEXTRALORESHAM_KEY=$91A00, + DBLNTSCEXTRALORESEHB_KEY=$91280, + DBLNTSCEXTRALORESDPF_KEY=$91600, + DBLNTSCEXTRALORESDPF2_KEY=$91640, + DBLNTSCEXTRALORESFF_KEY=$91204, + DBLNTSCEXTRALORESHAMFF_KEY=$91A04, + DBLNTSCEXTRALORESEHBFF_KEY=$91284, + DBLNTSCEXTRALORESDPFFF_KEY=$91604, + DBLNTSCEXTRALORESDPF2FF_KEY=$91644, + DBLNTSCEXTRALORESLACE_KEY=$91205, + DBLNTSCEXTRALORESHAMLACE_KEY=$91A05, + DBLNTSCEXTRALORESEHBLACE_KEY=$91285, + DBLNTSCEXTRALORESDPFLACE_KEY=$91605, + DBLNTSCEXTRALORESDPF2LACE_KEY=$91645, + DBLPAL_MONITOR_ID=$A1000, + DBLPALLORES_KEY=$A1000, + DBLPALLORESFF_KEY=$A1004, + DBLPALLORESHAM_KEY=$A1800, + DBLPALLORESHAMFF_KEY=$A1804, + DBLPALLORESEHB_KEY=$A1080, + DBLPALLORESEHBFF_KEY=$A1084, + DBLPALLORESLACE_KEY=$A1005, + DBLPALLORESHAMLACE_KEY=$A1805, + DBLPALLORESEHBLACE_KEY=$A1085, + DBLPALLORESDPF_KEY=$A1400, + DBLPALLORESDPFFF_KEY=$A1404, + DBLPALLORESDPFLACE_KEY=$A1405, + DBLPALLORESDPF2_KEY=$A1440, + DBLPALLORESDPF2FF_KEY=$A1444, + DBLPALLORESDPF2LACE_KEY=$A1445, + DBLPALHIRES_KEY=$A9000, + DBLPALHIRESFF_KEY=$A9004, + DBLPALHIRESHAM_KEY=$A9800, + DBLPALHIRESHAMFF_KEY=$A9804, + DBLPALHIRESLACE_KEY=$A9005, + DBLPALHIRESHAMLACE_KEY=$A9805, + DBLPALHIRESEHB_KEY=$A9080, + DBLPALHIRESEHBFF_KEY=$A9084, + DBLPALHIRESEHBLACE_KEY=$A9085, + DBLPALHIRESDPF_KEY=$A9400, + DBLPALHIRESDPFFF_KEY=$A9404, + DBLPALHIRESDPFLACE_KEY=$A9405, + DBLPALHIRESDPF2_KEY=$A9440, + DBLPALHIRESDPF2FF_KEY=$A9444, + DBLPALHIRESDPF2LACE_KEY=$A9445, + DBLPALEXTRALORES_KEY=$A1200, + DBLPALEXTRALORESHAM_KEY=$A1A00, + DBLPALEXTRALORESEHB_KEY=$A1280, + DBLPALEXTRALORESDPF_KEY=$A1600, + DBLPALEXTRALORESDPF2_KEY=$A1640, + DBLPALEXTRALORESFF_KEY=$A1204, + DBLPALEXTRALORESHAMFF_KEY=$A1A04, + DBLPALEXTRALORESEHBFF_KEY=$A1284, + DBLPALEXTRALORESDPFFF_KEY=$A1604, + DBLPALEXTRALORESDPF2FF_KEY=$A1644, + DBLPALEXTRALORESLACE_KEY=$A1205, + DBLPALEXTRALORESHAMLACE_KEY=$A1A05, + DBLPALEXTRALORESEHBLACE_KEY=$A1285, + DBLPALEXTRALORESDPFLACE_KEY=$A1605, + DBLPALEXTRALORESDPF2LACE_KEY=$A1645, + MUST_FLAGS=$100E, + SPECIAL_FLAGS=$100E, + BIDTAG_DIPFMUSTHAVE=$80000001, + BIDTAG_DIPFMUSTNOTHAVE=$80000002, + BIDTAG_VIEWPORT=$80000003, + BIDTAG_NOMINALWIDTH=$80000004, + BIDTAG_NOMINALHEIGHT=$80000005, + BIDTAG_DESIREDWIDTH=$80000006, + BIDTAG_DESIREDHEIGHT=$80000007, + BIDTAG_DEPTH=$80000008, + BIDTAG_MONITORID=$80000009, + BIDTAG_SOURCEID=$8000000A, + BIDTAG_REDBITS=$8000000B, + BIDTAG_BLUEBITS=$8000000C, + BIDTAG_GREENBITS=$8000000D, + BIDTAG_GFXPRIVATE=$8000000E diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/monitor.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/monitor.e new file mode 100644 index 0000000..32b46b7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/monitor.e @@ -0,0 +1,126 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/lists', + 'exec/semaphores', + 'graphics/gfx', + 'graphics/gfxnodes' + +OBJECT analogsignalinterval + start:INT -> This is unsigned + stop:INT -> This is unsigned +ENDOBJECT /* SIZEOF=4 */ + +OBJECT specialmonitor + xln:xln + flags:INT -> This is unsigned + do_monitor:LONG + reserved1:LONG + reserved2:LONG + reserved3:LONG + hblank:analogsignalinterval + vblank:analogsignalinterval + hsync:analogsignalinterval + vsync:analogsignalinterval +ENDOBJECT /* SIZEOF=58 */ + +OBJECT monitorspec + xln:xln + flags:INT -> This is unsigned + ratioh:LONG + ratiov:LONG + total_rows:INT -> This is unsigned + total_colorclocks:INT -> This is unsigned + denisemaxdisplaycolumn:INT -> This is unsigned + beamcon0:INT -> This is unsigned + min_row:INT -> This is unsigned + special:PTR TO specialmonitor + opencount:INT -> This is unsigned + transform:LONG + translate:LONG + scale:LONG + xoffset:INT -> This is unsigned + yoffset:INT -> This is unsigned + legalview:rectangle + maxoscan:LONG + videoscan:LONG + denisemindisplaycolumn:INT -> This is unsigned + displaycompatible:LONG + displayinfodatabase:lh + didbsemaphore:ss + mrgcop:LONG + loadview:LONG + killview:LONG +ENDOBJECT /* SIZEOF=160 */ + +CONST MSB_REQUEST_NTSC=0, + MSB_REQUEST_PAL=1, + MSB_REQUEST_SPECIAL=2, + MSB_REQUEST_A2024=3, + MSB_DOUBLE_SPRITES=4, + MSF_REQUEST_NTSC=1, + MSF_REQUEST_PAL=2, + MSF_REQUEST_SPECIAL=4, + MSF_REQUEST_A2024=8, + MSF_DOUBLE_SPRITES=16, + STANDARD_VIEW_X=$81, + STANDARD_VIEW_Y=$2C, + TO_MONITOR=0, + FROM_MONITOR=1, + STANDARD_XOFFSET=9, + STANDARD_YOFFSET=0, + REQUEST_NTSC=1, + REQUEST_PAL=2, + REQUEST_SPECIAL=4, + REQUEST_A2024=8, + STANDARD_MONITOR_MASK=3, + STANDARD_NTSC_ROWS=262, + STANDARD_PAL_ROWS=312, + STANDARD_COLORCLOCKS=226, + STANDARD_DENISE_MAX=455, + STANDARD_DENISE_MIN=93, + STANDARD_NTSC_BEAMCON=0, + STANDARD_PAL_BEAMCON=$20, + SPECIAL_BEAMCON=$1b8a, + MIN_NTSC_ROW=21, + MIN_PAL_ROW=29, + STANDARD_VIEW_X=$81, + STANDARD_VIEW_Y=$2C, + STANDARD_HBSTRT=$6, + STANDARD_HSSTRT=$B, + STANDARD_HSSTOP=$1C, + STANDARD_HBSTOP=$2C, + STANDARD_VBSTRT=$122, + STANDARD_VSSTRT=$2A6, + STANDARD_VSSTOP=$3AA, + STANDARD_VBSTOP=$1066, + VGA_COLORCLOCKS=113, + VGA_TOTAL_ROWS=131, + VGA_DENISE_MIN=59, + MIN_VGA_ROW=29, + VGA_HBSTRT=$8, + VGA_HSSTRT=$0E, + VGA_HSSTOP=$1C, + VGA_HBSTOP=$1E, + VGA_VBSTRT=0, + VGA_VSSTRT=$153, + VGA_VSSTOP=$235, + VGA_VBSTOP=$CCD, + BROADCAST_HBSTRT=$1, + BROADCAST_HSSTRT=$6, + BROADCAST_HSSTOP=$17, + BROADCAST_HBSTOP=$27, + BROADCAST_VBSTRT=0, + BROADCAST_VSSTRT=$2A6, + BROADCAST_VSSTOP=$054C, + BROADCAST_VBSTOP=$1C40, + BROADCAST_BEAMCON=$808, + RATIO_FIXEDPART=4, + RATIO_UNITY=16 + +#define DEFAULT_MONITOR_NAME 'default.monitor' +#define NTSC_MONITOR_NAME 'ntsc.monitor' +#define PAL_MONITOR_NAME 'pal.monitor' +#define VGA_MONITOR_NAME 'vga.monitor' diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/rastport.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/rastport.e new file mode 100644 index 0000000..db1c198 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/rastport.e @@ -0,0 +1,101 @@ +OPT MODULE +OPT EXPORT + +MODULE 'graphics/clip', + 'graphics/gels', + 'graphics/gfx', + 'graphics/text', + 'graphics/view' + +OBJECT tmpras + rasptr:PTR TO CHAR + size:LONG +ENDOBJECT /* SIZEOF=8 */ + +OBJECT gelsinfo + sprrsrvd:CHAR -> This is signed + flags:CHAR + gelhead:PTR TO vs + geltail:PTR TO vs + nextline:PTR TO INT +-> This is actually PTR TO PTR TO INT + lastcolor:PTR TO LONG + collhandler:PTR TO colltable + leftmost:INT + rightmost:INT + topmost:INT + bottommost:INT + firstblissobj:LONG + lastblissobj:LONG +ENDOBJECT /* SIZEOF=38 */ + +CONST RPF_FRST_DOT=1, + RPF_ONE_DOT=2, + RPF_DBUFFER=4, + RPF_AREAOUTLINE=8, + RPF_NOCROSSFILL=$20, + RP_JAM1=0, + RP_JAM2=1, + RP_COMPLEMENT=2, + RP_INVERSVID=4, + RPF_TXSCALE=1 + +CONST RP_AREAPTRN=8, + RP_MASK=24, + RP_AOLPEN=27, + RP_AREAPTSZ=29, + RP_LINPATCNT=30, + RP_FLAGS=32, + RP_LINEPTRN=34 + +OBJECT rastport + layer:PTR TO layer + bitmap:PTR TO bitmap + areaptrn:PTR TO INT -> Target is unsigned + tmpras:PTR TO tmpras + areainfo:PTR TO areainfo + gelsinfo:PTR TO gelsinfo + mask:CHAR + fgpen:CHAR -> This is signed + bgpen:CHAR -> This is signed + aolpen:CHAR -> This is signed + drawmode:CHAR -> This is signed + areaptsz:CHAR -> This is signed + linpatcnt:CHAR -> This is signed + dummy:CHAR + flags:INT -> This is unsigned + lineptrn:INT -> This is unsigned + cp_x:INT + cp_y:INT + minterms[8]:ARRAY + penwidth:INT + penheight:INT + font:PTR TO textfont + algostyle:CHAR + txflags:CHAR + txheight:INT -> This is unsigned + txwidth:INT -> This is unsigned + txbaseline:INT -> This is unsigned + txspacing:INT + rp_user:PTR TO LONG + longreserved[2]:ARRAY OF LONG + wordreserved[7]:ARRAY OF INT -> Array is unsigned + reserved[8]:ARRAY +ENDOBJECT /* SIZEOF=100 */ + +OBJECT areainfo + vctrtbl:PTR TO INT + vctrptr:PTR TO INT + flagtbl:PTR TO CHAR -> Target is signed + flagptr:PTR TO CHAR -> Target is signed + count:INT + maxcount:INT + firstx:INT + firsty:INT +ENDOBJECT /* SIZEOF=24 */ + +CONST ONE_DOTN=1, + ONE_DOT=2, + FRST_DOTN=0, + FRST_DOT=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/regions.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/regions.e new file mode 100644 index 0000000..49bff02 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/regions.e @@ -0,0 +1,16 @@ +OPT MODULE +OPT EXPORT + +MODULE 'graphics/gfx' + +OBJECT region + bounds:rectangle + regionrectangle:PTR TO regionrectangle +ENDOBJECT /* SIZEOF=12 */ + +OBJECT regionrectangle + next:PTR TO regionrectangle + prev:PTR TO regionrectangle + bounds:rectangle +ENDOBJECT /* SIZEOF=16 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/rpattr.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/rpattr.e new file mode 100644 index 0000000..5043a34 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/rpattr.e @@ -0,0 +1,12 @@ +OPT MODULE +OPT EXPORT + +CONST RPTAG_FONT=$80000000, + RPTAG_APEN=$80000002, + RPTAG_BPEN=$80000003, + RPTAG_DRMD=$80000004, + RPTAG_OUTLINEPEN=$80000005, + RPTAG_WRITEMASK=$80000006, + RPTAG_MAXPEN=$80000007, + RPTAG_DRAWBOUNDS=$80000008 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/scale.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/scale.e new file mode 100644 index 0000000..7a41c73 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/scale.e @@ -0,0 +1,27 @@ +OPT MODULE +OPT EXPORT + +MODULE 'graphics/gfx' + +OBJECT bitscaleargs + srcx:INT -> This is unsigned + srcy:INT -> This is unsigned + srcwidth:INT -> This is unsigned + srcheight:INT -> This is unsigned + xsrcfactor:INT -> This is unsigned + ysrcfactor:INT -> This is unsigned + destx:INT -> This is unsigned + desty:INT -> This is unsigned + destwidth:INT -> This is unsigned + destheight:INT -> This is unsigned + xdestfactor:INT -> This is unsigned + ydestfactor:INT -> This is unsigned + srcbitmap:PTR TO bitmap + destbitmap:PTR TO bitmap + flags:LONG + xdda:INT -> This is unsigned + ydda:INT -> This is unsigned + reserved1:LONG + reserved2:LONG +ENDOBJECT /* SIZEOF=48 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/sprite.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/sprite.e new file mode 100644 index 0000000..1636a68 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/sprite.e @@ -0,0 +1,28 @@ +OPT MODULE +OPT EXPORT + +OBJECT simplesprite + posctldata:PTR TO INT -> Target is unsigned + height:INT -> This is unsigned + x:INT -> This is unsigned + y:INT -> This is unsigned + num:INT -> This is unsigned +ENDOBJECT /* SIZEOF=12 */ + +OBJECT extsprite + simplesprite:simplesprite + wordwidth:INT -> This is unsigned + flags:INT -> This is unsigned +ENDOBJECT /* SIZEOF=16 */ + +CONST SPRITEA_WIDTH=$81000000, + SPRITEA_XREPLICATION=$81000002, + SPRITEA_YREPLICATION=$81000004, + SPRITEA_OUTPUTHEIGHT=$81000006, + SPRITEA_ATTACHED=$81000008, + SPRITEA_OLDDATAFORMAT=$8100000A, + GSTAG_SPRITE_NUM=$82000020, + GSTAG_ATTACHED=$82000022, + GSTAG_SOFTSPRITE=$82000024, + GSTAG_SCANDOUBLED=$83000000 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/text.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/text.e new file mode 100644 index 0000000..0a9d041 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/text.e @@ -0,0 +1,119 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/ports', + 'graphics/gfx', + 'utility/tagitem' + +CONST FS_NORMAL=0, + FSB_UNDERLINED=0, + FSF_UNDERLINED=1, + FSB_BOLD=1, + FSF_BOLD=2, + FSB_ITALIC=2, + FSF_ITALIC=4, + FSB_EXTENDED=3, + FSF_EXTENDED=8, + FSB_COLORFONT=6, + FSF_COLORFONT=$40, + FSB_TAGGED=7, + FSF_TAGGED=$80, + FPB_ROMFONT=0, + FPF_ROMFONT=1, + FPB_DISKFONT=1, + FPF_DISKFONT=2, + FPB_REVPATH=2, + FPF_REVPATH=4, + FPB_TALLDOT=3, + FPF_TALLDOT=8, + FPB_WIDEDOT=4, + FPF_WIDEDOT=16, + FPB_PROPORTIONAL=5, + FPF_PROPORTIONAL=$20, + FPB_DESIGNED=6, + FPF_DESIGNED=$40, + FPB_REMOVED=7, + FPF_REMOVED=$80 + +OBJECT textattr + name:LONG + ysize:INT -> This is unsigned + style:CHAR + flags:CHAR +ENDOBJECT /* SIZEOF=8 */ + +OBJECT ttextattr + name:LONG + ysize:INT -> This is unsigned + style:CHAR + flags:CHAR + tags:PTR TO tagitem +ENDOBJECT /* SIZEOF=12 */ + +CONST TA_DEVICEDPI=$80000001, + MAXFONTMATCHWEIGHT=$7FFF + +OBJECT textfont + mn:mn + ysize:INT -> This is unsigned + style:CHAR + flags:CHAR + xsize:INT -> This is unsigned + baseline:INT -> This is unsigned + boldsmear:INT -> This is unsigned + accessors:INT -> This is unsigned + lochar:CHAR + hichar:CHAR + chardata:PTR TO CHAR + modulo:INT -> This is unsigned + charloc:PTR TO INT + charspace:PTR TO INT + charkern:PTR TO INT +ENDOBJECT /* SIZEOF=52 */ + +CONST TE0B_NOREMFONT=0, + TE0F_NOREMFONT=1 + +OBJECT textfontextension + matchword:INT -> This is unsigned + flags0:CHAR + flags1:CHAR + backptr:PTR TO textfont + origreplyport:PTR TO mp + tags:PTR TO tagitem + ofontpatchs:PTR TO INT -> Target is unsigned + ofontpatchk:PTR TO INT -> Target is unsigned +ENDOBJECT /* SIZEOF=24 */ + +CONST CT_COLORFONT=1, + CT_GREYFONT=2, + CT_ANTIALIAS=4, + CTB_MAPCOLOR=0, + CTF_MAPCOLOR=1, + CT_COLORMASK=$f + +OBJECT colorfontcolors + reserved:INT + count:INT -> This is unsigned + colortable:PTR TO INT -> Target is unsigned +ENDOBJECT /* SIZEOF=8 */ + +OBJECT colortextfont + textfont:textfont + flags:INT -> This is unsigned + depth:CHAR + fgcolor:CHAR + low:CHAR + high:CHAR + planepick:CHAR + planeonoff:CHAR + colorfontcolors:PTR TO colorfontcolors + chardata[8]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=96 */ + +OBJECT textextent + width:INT -> This is unsigned + height:INT -> This is unsigned + extent:rectangle +ENDOBJECT /* SIZEOF=12 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/videocontrol.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/videocontrol.e new file mode 100644 index 0000000..194da8c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/videocontrol.e @@ -0,0 +1,71 @@ +OPT MODULE +OPT EXPORT + +CONST VTAG_END_CM=0, + VTAG_CHROMAKEY_CLR=$80000000, + VTAG_CHROMAKEY_SET=$80000001, + VTAG_BITPLANEKEY_CLR=$80000002, + VTAG_BITPLANEKEY_SET=$80000003, + VTAG_BORDERBLANK_CLR=$80000004, + VTAG_BORDERBLANK_SET=$80000005, + VTAG_BORDERNOTRANS_CLR=$80000006, + VTAG_BORDERNOTRANS_SET=$80000007, + VTAG_CHROMA_PEN_CLR=$80000008, + VTAG_CHROMA_PEN_SET=$80000009, + VTAG_CHROMA_PLANE_SET=$8000000A, + VTAG_ATTACH_CM_SET=$8000000B, + VTAG_NEXTBUF_CM=$8000000C, + VTAG_BATCH_CM_CLR=$8000000D, + VTAG_BATCH_CM_SET=$8000000E, + VTAG_NORMAL_DISP_GET=$8000000F, + VTAG_NORMAL_DISP_SET=$80000010, + VTAG_COERCE_DISP_GET=$80000011, + VTAG_COERCE_DISP_SET=$80000012, + VTAG_VIEWPORTEXTRA_GET=$80000013, + VTAG_VIEWPORTEXTRA_SET=$80000014, + VTAG_CHROMAKEY_GET=$80000015, + VTAG_BITPLANEKEY_GET=$80000016, + VTAG_BORDERBLANK_GET=$80000017, + VTAG_BORDERNOTRANS_GET=$80000018, + VTAG_CHROMA_PEN_GET=$80000019, + VTAG_CHROMA_PLANE_GET=$8000001A, + VTAG_ATTACH_CM_GET=$8000001B, + VTAG_BATCH_CM_GET=$8000001C, + VTAG_BATCH_ITEMS_GET=$8000001D, + VTAG_BATCH_ITEMS_SET=$8000001E, + VTAG_BATCH_ITEMS_ADD=$8000001F, + VTAG_VPMODEID_GET=$80000020, + VTAG_VPMODEID_SET=$80000021, + VTAG_VPMODEID_CLR=$80000022, + VTAG_USERCLIP_GET=$80000023, + VTAG_USERCLIP_SET=$80000024, + VTAG_USERCLIP_CLR=$80000025, + VTAG_PF1_BASE_GET=$80000026, + VTAG_PF2_BASE_GET=$80000027, + VTAG_SPEVEN_BASE_GET=$80000028, + VTAG_SPODD_BASE_GET=$80000029, + VTAG_PF1_BASE_SET=$8000002A, + VTAG_PF2_BASE_SET=$8000002B, + VTAG_SPEVEN_BASE_SET=$8000002C, + VTAG_SPODD_BASE_SET=$8000002D, + VTAG_BORDERSPRITE_GET=$8000002E, + VTAG_BORDERSPRITE_SET=$8000002F, + VTAG_BORDERSPRITE_CLR=$80000030, + VTAG_SPRITERESN_SET=$80000031, + VTAG_SPRITERESN_GET=$80000032, + VTAG_PF1_TO_SPRITEPRI_SET=$80000033, + VTAG_PF1_TO_SPRITEPRI_GET=$80000034, + VTAG_PF2_TO_SPRITEPRI_SET=$80000035, + VTAG_PF2_TO_SPRITEPRI_GET=$80000036, + VTAG_IMMEDIATE=$80000037, + VTAG_FULLPALETTE_SET=$80000038, + VTAG_FULLPALETTE_GET=$80000039, + VTAG_FULLPALETTE_CLR=$8000003A, + VTAG_DEFSPRITERESN_SET=$8000003B, + VTAG_DEFSPRITERESN_GET=$8000003C, + VC_INTERMEDIATECLUPDATE=$80000080, + VC_INTERMEDIATECLUPDATE_QUERY=$80000081, + VC_NOCOLORPALETTELOAD=$80000082, + VC_NOCOLORPALETTELOAD_QUERY=$80000083, + VC_DUALPF_DISABLE=$80000084, + VC_DUALPF_DISABLE_QUERY=$80000085 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/graphics/view.e b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/view.e new file mode 100644 index 0000000..dba6812 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/graphics/view.e @@ -0,0 +1,202 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/ports', + 'exec/semaphores', + 'graphics/copper', + 'graphics/gfx', + 'graphics/gfxnodes', + 'graphics/monitor', + 'utility/tagitem' + +CONST GENLOCK_VIDEO=2, + V_LACE=4, + V_DOUBLESCAN=8, + V_SUPERHIRES=$20, + V_PFBA=$40, + V_EXTRA_HALFBRITE=$80, + GENLOCK_AUDIO=$100, + V_DUALPF=$400, + V_HAM=$800, + V_EXTENDED_MODE=$1000, + V_VP_HIDE=$2000, + V_SPRITES=$4000, + V_HIRES=$8000, + EXTEND_VSTRUCT=$1000, + VPF_A2024=$40, + VPF_TENHZ=16, + VPB_A2024=6, + VPB_TENHZ=4 + +OBJECT colormap + flags:CHAR + type:CHAR + count:INT -> This is unsigned + colortable:LONG + vpe:PTR TO viewportextra + lowcolorbits:LONG + transparencyplane:CHAR + spriteresolution:CHAR + spriteresdefault:CHAR + auxflags:CHAR + vp:PTR TO viewport + normaldisplayinfo:LONG + coercedisplayinfo:LONG + batch_items:PTR TO tagitem + vpmodeid:LONG + palextra:PTR TO paletteextra + spritebase_even:INT -> This is unsigned + spritebase_odd:INT -> This is unsigned + bp_0_base:INT -> This is unsigned + bp_1_base:INT -> This is unsigned +ENDOBJECT /* SIZEOF=52 */ + +CONST CM_TRANSPARENYPLANE=16, + COLORMAP_TYPE_V1_2=0, + COLORMAP_TYPE_V1_4=1, + COLORMAP_TYPE_V36=1, + COLORMAP_TYPE_V39=2, + COLORMAP_TRANSPARENCY=1, + COLORPLANE_TRANSPARENCY=2, + BORDER_BLANKING=4, + BORDER_NOTRANSPARENCY=8, + VIDEOCONTROL_BATCH=16, + USER_COPPER_CLIP=$20, + BORDER_SPRITES=$40, + CMF_CMTRANS=1, + CMF_CPTRANS=2, + CMF_BRDRBLNK=4, + CMF_BRDNTRAN=8, + CMF_BRDRSPRT=$40, + CMB_CMTRANS=0, + CMB_CPTRANS=1, + CMB_BRDRBLNK=2, + CMB_BRDNTRAN=3, + CMB_BRDRSPRT=6, + SPRITERESN_ECS=0, + SPRITERESN_140NS=1, + SPRITERESN_70NS=2, + SPRITERESN_35NS=3, + SPRITERESN_DEFAULT=-1, + CMAF_FULLPALETTE=1, + CMAB_FULLPALETTE=0, + CMAF_NO_INTERMED_UPDATE=2, + CMAB_NO_INTERMED_UPDATE=1, + CMAF_NO_COLOR_LOAD=4, + CMAB_NO_COLOR_LOAD=2, + CMAF_DUALPF_DISABLE=3, + CMAB_DUALPF_DISABLE=8 + +OBJECT paletteextra + semaphore:ss + firstfree:INT -> This is unsigned + nfree:INT -> This is unsigned + firstshared:INT -> This is unsigned + nshared:INT -> This is unsigned + refcnt:LONG + alloclist:LONG + viewport:PTR TO viewport + sharablecolors:INT -> This is unsigned +ENDOBJECT /* SIZEOF=68 */ + +CONST PRECISION_EXACT=-1, + PRECISION_IMAGE=0, + PRECISION_ICON=16, + PRECISION_GUI=$20, + OBP_PRECISION=$84000000, + OBP_FAILIFBAD=$84000001, + PEN_EXCLUSIVE=1, + PEN_NO_SETCOLOR=2, + PENF_EXCLUSIVE=1, + PENF_NO_SETCOLOR=2, + PENB_EXCLUSIVE=0, + PENB_NO_SETCOLOR=1 + +OBJECT viewport + next:PTR TO viewport + colormap:PTR TO colormap + dspins:PTR TO coplist + sprins:PTR TO coplist + clrins:PTR TO coplist + ucopins:PTR TO ucoplist + dwidth:INT + dheight:INT + dxoffset:INT + dyoffset:INT + modes:INT -> This is unsigned + spritepriorities:CHAR + extendedmodes:CHAR + rasinfo:PTR TO rasinfo +ENDOBJECT /* SIZEOF=40 */ + +OBJECT view + viewport:PTR TO viewport + lofcprlist:PTR TO cprlist + shfcprlist:PTR TO cprlist + dyoffset:INT + dxoffset:INT + modes:INT -> This is unsigned +ENDOBJECT /* SIZEOF=18 */ + +OBJECT viewextra + xln:xln + view:PTR TO view + monitor:PTR TO monitorspec + topline:INT -> This is unsigned +ENDOBJECT /* SIZEOF=34 */ + +OBJECT viewportextra + xln:xln + viewport:PTR TO viewport + displayclip:rectangle + vectable:LONG + driverdata[2]:ARRAY OF LONG + flags:INT -> This is unsigned + origin[2]:ARRAY OF tpoint + cop1ptr:LONG + cop2ptr:LONG +ENDOBJECT /* SIZEOF=58 */ + +CONST VPXB_FREE_ME=0, + VPXF_FREE_ME=1, + VPXB_VP_LAST=1, + VPXF_VP_LAST=2, + VPXB_STRADDLES_256=4, + VPXF_STRADDLES_256=16, + VPXB_STRADDLES_512=5, + VPXF_STRADDLES_512=$20 + +OBJECT rasinfo + next:PTR TO rasinfo + bitmap:PTR TO bitmap + rxoffset:INT + ryoffset:INT +ENDOBJECT /* SIZEOF=12 */ + +CONST MVP_OK=0, + MVP_NO_MEM=1, + MVP_NO_VPE=2, + MVP_NO_DSPINS=3, + MVP_NO_DISPLAY=4, + MVP_OFF_BOTTOM=5, + MCOP_OK=0, + MCOP_NO_MEM=1, + MCOP_NOP=2 + +OBJECT dbufinfo + link1:LONG + count1:LONG + safemessage:mn + userdata1:LONG + link2:LONG + count2:LONG + dispmessage:mn + userdata2:LONG + matchlong:LONG + copptr1:LONG + copptr2:LONG + copptr3:LONG + beampos1:INT -> This is unsigned + beampos2:INT -> This is unsigned +ENDOBJECT /* SIZEOF=84 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/hardware/adkbits.e b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/adkbits.e new file mode 100644 index 0000000..6999454 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/adkbits.e @@ -0,0 +1,40 @@ +OPT MODULE +OPT EXPORT + +CONST ADKB_SETCLR=15, + ADKB_PRECOMP1=14, + ADKB_PRECOMP0=13, + ADKB_MFMPREC=12, + ADKB_UARTBRK=11, + ADKB_WORDSYNC=10, + ADKB_MSBSYNC=9, + ADKB_FAST=8, + ADKB_USE3PN=7, + ADKB_USE2P3=6, + ADKB_USE1P2=5, + ADKB_USE0P1=4, + ADKB_USE3VN=3, + ADKB_USE2V3=2, + ADKB_USE1V2=1, + ADKB_USE0V1=0, + ADKF_SETCLR=$8000, + ADKF_PRECOMP1=$4000, + ADKF_PRECOMP0=$2000, + ADKF_MFMPREC=$1000, + ADKF_UARTBRK=$800, + ADKF_WORDSYNC=$400, + ADKF_MSBSYNC=$200, + ADKF_FAST=$100, + ADKF_USE3PN=$80, + ADKF_USE2P3=$40, + ADKF_USE1P2=$20, + ADKF_USE0P1=16, + ADKF_USE3VN=8, + ADKF_USE2V3=4, + ADKF_USE1V2=2, + ADKF_USE0V1=1, + ADKF_PRE000NS=0, + ADKF_PRE140NS=$2000, + ADKF_PRE280NS=$4000, + ADKF_PRE560NS=$6000 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/hardware/blit.e b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/blit.e new file mode 100644 index 0000000..0ff107f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/blit.e @@ -0,0 +1,70 @@ +OPT MODULE +OPT EXPORT + +OBJECT bltnode + n:PTR TO bltnode + function:LONG + stat:CHAR + dummy:CHAR + blitsize:INT + beamsync:INT + cleanup:LONG +ENDOBJECT /* SIZEOF=18 */ + +CONST CLEANMEN=6, + CLEANME=$40, + CLEANUP=$40, + HSIZEBITS=6, + VSIZEBITS=10, + HSIZEMASK=$3F, + VSIZEMASK=$3FF, + MAXBYTESPERROW=$1000, + MINBYTESPERROW=$80, + MAXBYTESPERROW=$1000, + ABC=$80, + ABNC=$40, + ANBC=$20, + ANBNC=16, + NABC=8, + NABNC=4, + NANBC=2, + NANBNC=1, + BC0B_DEST=8, + BC0B_SRCC=9, + BC0B_SRCB=10, + BC0B_SRCA=11, + BC0F_DEST=$100, + BC0F_SRCC=$200, + BC0F_SRCB=$400, + BC0F_SRCA=$800, + BC1F_DESC=2, + DEST=$100, + SRCC=$200, + SRCB=$400, + SRCA=$800, + ASHIFTSHIFT=12, + BSHIFTSHIFT=12, + LINEMODE=1, + FILL_OR=8, + FILL_XOR=16, + FILL_CARRYIN=4, + ONEDOT=2, + OVFLAG=$20, + SIGNFLAG=$40, + BLITREVERSE=2, + SUD=16, + SUL=8, + AUL=4, + OCTANT8=24, + OCTANT7=4, + OCTANT6=12, + OCTANT5=28, + OCTANT4=20, + OCTANT3=8, + OCTANT2=0, + OCTANT1=16 + +CONST A_OR_B=ABC OR ANBC OR NABC OR ABNC OR ANBNC OR NABNC, + A_OR_C=ABC OR NABC OR ABNC OR ANBC OR NANBC OR ANBNC, + A_XOR_C=NABC OR ABNC OR NANBC OR ANBNC, + A_TO_D=ABC OR ANBC OR ABNC OR ANBNC diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/hardware/cia.e b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/cia.e new file mode 100644 index 0000000..3e92355 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/cia.e @@ -0,0 +1,169 @@ +OPT MODULE +OPT EXPORT + +CONST CIAA_ADDR=$bfe001, + CIAB_ADDR=$bfd000 + +OBJECT cia + ciapra:CHAR + pad0a:CHAR + pad0b[$fe]:ARRAY + ciaprb:CHAR + pad1a:CHAR + pad1b[$fe]:ARRAY + ciaddra:CHAR + pad2a:CHAR + pad2b[$fe]:ARRAY + ciaddrb:CHAR + pad3a:CHAR + pad3b[$fe]:ARRAY + ciatalo:CHAR + pad4a:CHAR + pad4b[$fe]:ARRAY + ciatahi:CHAR + pad5a:CHAR + pad5b[$fe]:ARRAY + ciatblo:CHAR + pad6a:CHAR + pad6b[$fe]:ARRAY + ciatbhi:CHAR + pad7a:CHAR + pad7b[$fe]:ARRAY + ciatodlow:CHAR + pad8a:CHAR + pad8b[$fe]:ARRAY + ciatodmid:CHAR + pad9a:CHAR + pad9b[$fe]:ARRAY + ciatodhi:CHAR + pad10a:CHAR + pad10b[$fe]:ARRAY + unusedreg:CHAR + pad11a:CHAR + pad11b[$fe]:ARRAY + ciasdr:CHAR + pad12a:CHAR + pad12b[$fe]:ARRAY + ciaicr:CHAR + pad13a:CHAR + pad13b[$fe]:ARRAY + ciacra:CHAR + pad14a:CHAR + pad14b[$fe]:ARRAY + ciacrb:CHAR +ENDOBJECT + +CONST CIAPRA=0, + CIAPRB=$100, + CIADDRA=$200, + CIADDRB=$300, + CIATALO=$400, + CIATAHI=$500, + CIATBLO=$600, + CIATBHI=$700, + CIATODLOW=$800, + CIATODMID=$900, + CIATODHI=$A00, + CIASDR=$C00, + CIAICR=$D00, + CIACRA=$E00, + CIACRB=$F00, + CIAICRB_TA=0, + CIAICRB_TB=1, + CIAICRB_ALRM=2, + CIAICRB_SP=3, + CIAICRB_FLG=4, + CIAICRB_IR=7, + CIAICRB_SETCLR=7, + CIACRAB_START=0, + CIACRAB_PBON=1, + CIACRAB_OUTMODE=2, + CIACRAB_RUNMODE=3, + CIACRAB_LOAD=4, + CIACRAB_INMODE=5, + CIACRAB_SPMODE=6, + CIACRAB_TODIN=7, + CIACRBB_START=0, + CIACRBB_PBON=1, + CIACRBB_OUTMODE=2, + CIACRBB_RUNMODE=3, + CIACRBB_LOAD=4, + CIACRBB_INMODE0=5, + CIACRBB_INMODE1=6, + CIACRBB_ALARM=7, + CIAICRF_TA=1, + CIAICRF_TB=2, + CIAICRF_ALRM=4, + CIAICRF_SP=8, + CIAICRF_FLG=16, + CIAICRF_IR=$80, + CIAICRF_SETCLR=$80, + CIACRAF_START=1, + CIACRAF_PBON=2, + CIACRAF_OUTMODE=4, + CIACRAF_RUNMODE=8, + CIACRAF_LOAD=16, + CIACRAF_INMODE=$20, + CIACRAF_SPMODE=$40, + CIACRAF_TODIN=$80, + CIACRBF_START=1, + CIACRBF_PBON=2, + CIACRBF_OUTMODE=4, + CIACRBF_RUNMODE=8, + CIACRBF_LOAD=16, + CIACRBF_INMODE0=$20, + CIACRBF_INMODE1=$40, + CIACRBF_ALARM=$80, + CIACRBF_IN_PHI2=0, + CIACRBF_IN_CNT=$20, + CIACRBF_IN_TA=$40, + CIACRBF_IN_CNT_TA=$60, + CIAB_GAMEPORT1=7, + CIAB_GAMEPORT0=6, + CIAB_DSKRDY=5, + CIAB_DSKTRACK0=4, + CIAB_DSKPROT=3, + CIAB_DSKCHANGE=2, + CIAB_LED=1, + CIAB_OVERLAY=0, + CIAB_COMDTR=7, + CIAB_COMRTS=6, + CIAB_COMCD=5, + CIAB_COMCTS=4, + CIAB_COMDSR=3, + CIAB_PRTRSEL=2, + CIAB_PRTRPOUT=1, + CIAB_PRTRBUSY=0, + CIAB_DSKMOTOR=7, + CIAB_DSKSEL3=6, + CIAB_DSKSEL2=5, + CIAB_DSKSEL1=4, + CIAB_DSKSEL0=3, + CIAB_DSKSIDE=2, + CIAB_DSKDIREC=1, + CIAB_DSKSTEP=0, + CIAF_GAMEPORT1=$80, + CIAF_GAMEPORT0=$40, + CIAF_DSKRDY=$20, + CIAF_DSKTRACK0=16, + CIAF_DSKPROT=8, + CIAF_DSKCHANGE=4, + CIAF_LED=2, + CIAF_OVERLAY=1, + CIAF_COMDTR=$80, + CIAF_COMRTS=$40, + CIAF_COMCD=$20, + CIAF_COMCTS=16, + CIAF_COMDSR=8, + CIAF_PRTRSEL=4, + CIAF_PRTRPOUT=2, + CIAF_PRTRBUSY=1, + CIAF_DSKMOTOR=$80, + CIAF_DSKSEL3=$40, + CIAF_DSKSEL2=$20, + CIAF_DSKSEL1=16, + CIAF_DSKSEL0=8, + CIAF_DSKSIDE=4, + CIAF_DSKDIREC=2, + CIAF_DSKSTEP=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/hardware/custom.e b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/custom.e new file mode 100644 index 0000000..5df7111 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/custom.e @@ -0,0 +1,269 @@ +OPT MODULE +OPT EXPORT + +CONST CUSTOMADDR=$DFF000 + +OBJECT audchannel + ptr:PTR TO INT -> Target is unsigned + len:INT -> This is unsigned + per:INT -> This is unsigned + vol:INT -> This is unsigned + dat:INT -> This is unsigned + pad[2]:ARRAY OF INT +ENDOBJECT + +OBJECT spritedef + pos:INT -> This is unsigned + ctl:INT -> This is unsigned + dataa:INT -> This is unsigned + datab:INT -> This is unsigned +ENDOBJECT + +OBJECT custom + bltdat:INT -> This is unsigned + dmaconr:INT -> This is unsigned + vposr:INT -> This is unsigned + vhposr:INT -> This is unsigned + dskdatr:INT -> This is unsigned + joy0dat:INT -> This is unsigned + joy1dat:INT -> This is unsigned + clxdat:INT -> This is unsigned + adkconr:INT -> This is unsigned + pot0dat:INT -> This is unsigned + pot1dat:INT -> This is unsigned + potinp:INT -> This is unsigned + serdatr:INT -> This is unsigned + dskbytr:INT -> This is unsigned + intenar:INT -> This is unsigned + intreqr:INT -> This is unsigned + dskpt:LONG + dsklen:INT -> This is unsigned + dskdat:INT -> This is unsigned + refptr:INT -> This is unsigned + vposw:INT -> This is unsigned + vhposw:INT -> This is unsigned + copcon:INT -> This is unsigned + serdat:INT -> This is unsigned + serper:INT -> This is unsigned + potgo:INT -> This is unsigned + joytest:INT -> This is unsigned + strequ:INT -> This is unsigned + strvbl:INT -> This is unsigned + strhor:INT -> This is unsigned + strlong:INT -> This is unsigned + bltcon0:INT -> This is unsigned + bltcon1:INT -> This is unsigned + bltafwm:INT -> This is unsigned + bltalwm:INT -> This is unsigned + bltcpt:LONG + bltbpt:LONG + bltapt:LONG + bltdpt:LONG + bltsize:INT -> This is unsigned + pad2d:CHAR + bltcon0l:CHAR + bltsizv:INT -> This is unsigned + bltsizh:INT -> This is unsigned + bltcmod:INT -> This is unsigned + bltbmod:INT -> This is unsigned + bltamod:INT -> This is unsigned + bltdmod:INT -> This is unsigned + pad34[4]:ARRAY OF INT + bltcdat:INT -> This is unsigned + bltbdat:INT -> This is unsigned + bltadat:INT -> This is unsigned + pad3b[3]:ARRAY OF INT + deniseid:INT -> This is unsigned + dsksync:INT -> This is unsigned + cop1lc:LONG + cop2lc:LONG + copjmp1:INT -> This is unsigned + copjmp2:INT -> This is unsigned + copins:INT -> This is unsigned + diwstrt:INT -> This is unsigned + diwstop:INT -> This is unsigned + ddfstrt:INT -> This is unsigned + ddfstop:INT -> This is unsigned + dmacon:INT -> This is unsigned + clxcon:INT -> This is unsigned + intena:INT -> This is unsigned + intreq:INT -> This is unsigned + adkcon:INT -> This is unsigned + aud[4]:ARRAY OF audchannel + bplpt[8]:ARRAY OF LONG + bplcon0:INT -> This is unsigned + bplcon1:INT -> This is unsigned + bplcon2:INT -> This is unsigned + bplcon3:INT -> This is unsigned + bpl1mod:INT -> This is unsigned + bpl2mod:INT -> This is unsigned + bplcon4:INT -> This is unsigned + clxcon2:INT -> This is unsigned + bpldat[8]:ARRAY OF INT -> Array is unsigned + sprpt[8]:ARRAY OF LONG + spr[8]:ARRAY OF spritedef + color[32]:ARRAY OF INT -> Array is unsigned + htotal:INT -> This is unsigned + hsstop:INT -> This is unsigned + hbstrt:INT -> This is unsigned + hbstop:INT -> This is unsigned + vtotal:INT -> This is unsigned + vsstop:INT -> This is unsigned + vbstrt:INT -> This is unsigned + vbstop:INT -> This is unsigned + sprhstrt:INT -> This is unsigned + sprhstop:INT -> This is unsigned + bplhstrt:INT -> This is unsigned + bplhstop:INT -> This is unsigned + hhposw:INT -> This is unsigned + hhposr:INT -> This is unsigned + beamcon0:INT -> This is unsigned + hsstrt:INT -> This is unsigned + vsstrt:INT -> This is unsigned + hcenter:INT -> This is unsigned + diwhigh:INT -> This is unsigned + padf3[11]:ARRAY OF INT + fmode:INT -> This is unsigned +ENDOBJECT + +CONST VARVBLANK=$1000, + LOLDIS=$800, + CSCBLANKEN=$400, + VARVSYNC=$200, + VARHSYNC=$100, + VARBEAM=$80, + DISPLAYDUAL=$40, + DISPLAYPAL=$20, + VARCSYNC=$10, + CSBLANK=8, + CSYNCTRUE=4, + VSYNCTRUE=2, + HSYNCTRUE=1, + USE_BPLCON3=1, + BPLCON2_ZDCTEN=$400, + BPLCON2_ZDBPEN=$800, + BPLCON2_ZDBPSEL0=$1000, + BPLCON2_ZDBPSEL1=$2000, + BPLCON2_ZDBPSEL2=$4000, + BPLCON3_EXTBLNKEN=1, + BPLCON3_EXTBLKZD=2, + BPLCON3_ZDCLKEN=4, + BPLCON3_BRDNTRAN=$10, + BPLCON3_BRDNBLNK=$20 + +CONST BLTDDAT=0, + DMACONR=2, + VPOSR=4, + VHPOSR=6, + DSKDATR=8, + JOY0DAT=10, + JOY1DAT=12, + CLXDAT=14, + ADKCONR=16, + POT0DAT=18, + POT1DAT=20, + POTINP=22, + SERDATR=24, + DSKBYTR=26, + INTENAR=28, + INTREQR=30, + DSKPT=$20, + DSKLEN=$24, + DSKDAT=$26, + REFPTR=$28, + VPOSW=$2A, + VHPOSW=$2C, + COPCON=$2E, + SERDAT=$30, + SERPER=$32, + POTGO=$34, + JOYTEST=$36, + STREQU=$38, + STRVBL=$3A, + STRHOR=$3C, + STRLONG=$3E, + BLTCON0=$40, + BLTCON1=$42, + BLTAFWM=$44, + BLTALWM=$46, + BLTCPT=$48, + BLTBPT=$4C, + BLTAPT=$50, + BLTDPT=$54, + BLTSIZE=$58, + BLTCON0L=$5B, + BLTSIZV=$5C, + BLTSIZH=$5E, + BLTCMOD=$60, + BLTBMOD=$62, + BLTAMOD=$64, + BLTDMOD=$66, + BLTCDAT=$70, + BLTBDAT=$72, + BLTADAT=$74, + DENISEID=$7C, + DSKSYNC=$7E, + COP1LC=$80, + COP2LC=$84, + COPJMP1=$88, + COPJMP2=$8A, + COPINS=$8C, + DIWSTRT=$8E, + DIWSTOP=$90, + DDFSTRT=$92, + DDFSTOP=$94, + DMACON=$96, + CLXCON=$98, + INTENA=$9A, + INTREQ=$9C, + ADKCON=$9E, + AUD=$A0, + AUD0=$A0, + AUD1=$B0, + AUD2=$C0, + AUD3=$D0, + AC_PTR=0, + AC_LEN=4, + AC_PER=6, + AC_VOL=8, + AC_DAT=10, + AC_SIZEOF=16, + BPLPT=$E0, + BPLCON0=$100, + BPLCON1=$102, + BPLCON2=$104, + BPLCON3=$106, + BPL1MOD=$108, + BPL2MOD=$10A, + BPLCON4=$10C, + CLXCON2=$10E, + BPLDAT=$110, + SPRPT=$120, + SPR=$140, + SD_POS=0, + SD_CTL=2, + SD_DATAA=4, + SD_DATAB=6, + SD_SIZEOF=8, + COLOR=$180, + HTOTAL=$1C0, + HSSTOP=$1C2, + HBSTRT=$1C4, + HBSTOP=$1C6, + VTOTAL=$1C8, + VSSTOP=$1CA, + VBSTRT=$1CC, + VBSTOP=$1CE, + SPRHSTRT=$1D0, + SPRHSTOP=$1D2, + BPLHSTRT=$1D4, + BPLHSTOP=$1D6, + HHPOSW=$1D8, + HHPOSR=$1DA, + BEAMCON0=$1DC, + HSSTRT=$1DE, + VSSTRT=$1E0, + HCENTER=$1E2, + DIWHIGH=$1E4, + FMODE=$1FC + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/hardware/dmabits.e b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/dmabits.e new file mode 100644 index 0000000..8a5fa0b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/dmabits.e @@ -0,0 +1,34 @@ +OPT MODULE +OPT EXPORT + +CONST DMAF_SETCLR=$8000, + DMAF_AUDIO=15, + DMAF_AUD0=1, + DMAF_AUD1=2, + DMAF_AUD2=4, + DMAF_AUD3=8, + DMAF_DISK=16, + DMAF_SPRITE=$20, + DMAF_BLITTER=$40, + DMAF_COPPER=$80, + DMAF_RASTER=$100, + DMAF_MASTER=$200, + DMAF_BLITHOG=$400, + DMAF_ALL=$1FF, + DMAF_BLTDONE=$4000, + DMAF_BLTNZERO=$2000, + DMAB_SETCLR=15, + DMAB_AUD0=0, + DMAB_AUD1=1, + DMAB_AUD2=2, + DMAB_AUD3=3, + DMAB_DISK=4, + DMAB_SPRITE=5, + DMAB_BLITTER=6, + DMAB_COPPER=7, + DMAB_RASTER=8, + DMAB_MASTER=9, + DMAB_BLITHOG=10, + DMAB_BLTDONE=14, + DMAB_BLTNZERO=13 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/hardware/intbits.e b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/intbits.e new file mode 100644 index 0000000..9b9a007 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/hardware/intbits.e @@ -0,0 +1,36 @@ +OPT MODULE +OPT EXPORT + +CONST INTB_SETCLR=15, + INTB_INTEN=14, + INTB_EXTER=13, + INTB_DSKSYNC=12, + INTB_RBF=11, + INTB_AUD3=10, + INTB_AUD2=9, + INTB_AUD1=8, + INTB_AUD0=7, + INTB_BLIT=6, + INTB_VERTB=5, + INTB_COPER=4, + INTB_PORTS=3, + INTB_SOFTINT=2, + INTB_DSKBLK=1, + INTB_TBE=0, + INTF_SETCLR=$8000, + INTF_INTEN=$4000, + INTF_EXTER=$2000, + INTF_DSKSYNC=$1000, + INTF_RBF=$800, + INTF_AUD3=$400, + INTF_AUD2=$200, + INTF_AUD1=$100, + INTF_AUD0=$80, + INTF_BLIT=$40, + INTF_VERTB=$20, + INTF_COPER=16, + INTF_PORTS=8, + INTF_SOFTINT=4, + INTF_DSKBLK=2, + INTF_TBE=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/images/led.e b/amigae33a/E_v3.3a/Src/Src/Modules/images/led.e new file mode 100644 index 0000000..282035a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/images/led.e @@ -0,0 +1,12 @@ +OPT MODULE +OPT EXPORT + +MODULE 'utility/tagitem' + +CONST LED_DUMMY=TAG_USER+$04000000 + +CONST LED_PAIRS=LED_DUMMY+1, + LED_VALUES=LED_DUMMY+2, + LED_COLON=LED_DUMMY+3, + LED_NEGATIVE=LED_DUMMY+4, + LED_SIGNED=LED_DUMMY+5 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/cghooks.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/cghooks.e new file mode 100644 index 0000000..2c817d7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/cghooks.e @@ -0,0 +1,29 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'graphics/clip', + 'graphics/rastport', + 'intuition/intuition', + 'intuition/screens' + +#define CUSTOM_HOOK(g) (g::gadget.mutualexclude) + +OBJECT gadgetinfo + screen:PTR TO screen + window:PTR TO window + requester:PTR TO requester + rastport:PTR TO rastport + layer:PTR TO layer + domain:ibox + detailpen:CHAR + blockpen:CHAR + drinfo:PTR TO drawinfo +ENDOBJECT /* SIZEOF=NONE !!! */ + +-> Um, this object was missing +OBJECT pgx + container:ibox + newknob:ibox +ENDOBJECT diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/classes.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/classes.e new file mode 100644 index 0000000..85e5e28 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/classes.e @@ -0,0 +1,47 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/libraries', + 'exec/nodes', + 'intuition/classusr', + 'utility/hooks' + +OBJECT iclass + dispatcher:hook + reserved:LONG + super:PTR TO iclass + id:LONG + instoffset:INT -> This is unsigned + instsize:INT -> This is unsigned + userdata:LONG + subclasscount:LONG + objectcount:LONG + flags:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST CLB_INLIST=0, + CLF_INLIST=1 + +-> instoffset and instsize are unsigned so AND with $FFFF +#define INST_DATA(cl, o) ((o)+(cl::iclass.instoffset AND $FFFF)) +#define SIZEOF_INSTANCE(cl) ((cl::iclass.instoffset AND $FFFF)+(cl::iclass.instsize AND $FFFF)+SIZEOF object) + +CONST OJ_CLASS=8 + +OBJECT object + node:mln + class:PTR TO iclass +ENDOBJECT /* SIZEOF=12 */ + +#define _OBJ(o) (o) +#define BASEOBJECT(_obj) ((_obj)+SIZEOF object) +#define _OBJECT(o) ((o)-SIZEOF object) +#define OCLASS(o) (Long(_OBJECT(o)+OJ_CLASS)) + +OBJECT classlibrary + lib:lib + pad:INT + class:PTR TO iclass +ENDOBJECT diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/classusr.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/classusr.e new file mode 100644 index 0000000..a840157 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/classusr.e @@ -0,0 +1,94 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/lists', + 'intuition/cghooks', + 'utility/tagitem' + +OBJECT msg + methodid:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +#define ROOTCLASS 'rootclass' +#define IMAGECLASS 'imageclass' +#define FRAMEICLASS 'frameiclass' +#define SYSICLASS 'sysiclass' +#define FILLRECTCLASS 'fillrectclass' +#define GADGETCLASS 'gadgetclass' +#define PROPGCLASS 'propgclass' +#define STRGCLASS 'strgclass' +#define BUTTONGCLASS 'buttongclass' +#define FRBUTTONCLASS 'frbuttonclass' +#define GROUPGCLASS 'groupgclass' +#define ICCLASS 'icclass' +#define MODELCLASS 'modelclass' +#define ITEXTICLASS 'itexticlass' +#define POINTERCLASS 'pointerclass' + +CONST OM_NEW=$101, + OM_DISPOSE=$102, + OM_SET=$103, + OM_GET=$104, + OM_ADDTAIL=$105, + OM_REMOVE=$106, + OM_NOTIFY=$107, + OM_UPDATE=$108, + OM_ADDMEMBER=$109, + OM_REMMEMBER=$10A + +OBJECT opnew + methodid:LONG + attrlist:PTR TO tagitem + ginfo:PTR TO gadgetinfo -> Always NIL +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT opset + methodid:LONG + attrlist:PTR TO tagitem + ginfo:PTR TO gadgetinfo +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT opupdate + methodid:LONG + attrlist:PTR TO tagitem + ginfo:PTR TO gadgetinfo + flags:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT opnotify + methodid:LONG + attrlist:PTR TO tagitem + ginfo:PTR TO gadgetinfo + flags:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST OPUB_INTERIM=0, + OPUF_INTERIM=1 + +OBJECT opget + methodid:LONG + attrid:LONG + storage:PTR TO LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT opaddtail + methodid:LONG + list:PTR TO lh +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT opmember + methodid:LONG + object:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT opaddmember + methodid:LONG + object:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT opremmember + methodid:LONG + object:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/gadgetclass.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/gadgetclass.e new file mode 100644 index 0000000..46da255 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/gadgetclass.e @@ -0,0 +1,192 @@ +OPT MODULE +OPT EXPORT + +MODULE 'devices/inputevent', + 'graphics/rastport', + 'intuition/cghooks', + 'intuition/intuition', + 'utility/tagitem' + +CONST GA_DUMMY=$80030000, + GA_LEFT=$80030001, + GA_RELRIGHT=$80030002, + GA_TOP=$80030003, + GA_RELBOTTOM=$80030004, + GA_WIDTH=$80030005, + GA_RELWIDTH=$80030006, + GA_HEIGHT=$80030007, + GA_RELHEIGHT=$80030008, + GA_TEXT=$80030009, + GA_IMAGE=$8003000A, + GA_BORDER=$8003000B, + GA_SELECTRENDER=$8003000C, + GA_HIGHLIGHT=$8003000D, + GA_DISABLED=$8003000E, + GA_GZZGADGET=$8003000F, + GA_ID=$80030010, + GA_USERDATA=$80030011, + GA_SPECIALINFO=$80030012, + GA_SELECTED=$80030013, + GA_ENDGADGET=$80030014, + GA_IMMEDIATE=$80030015, + GA_RELVERIFY=$80030016, + GA_FOLLOWMOUSE=$80030017, + GA_RIGHTBORDER=$80030018, + GA_LEFTBORDER=$80030019, + GA_TOPBORDER=$8003001A, + GA_BOTTOMBORDER=$8003001B, + GA_TOGGLESELECT=$8003001C, + GA_SYSGADGET=$8003001D, + GA_SYSGTYPE=$8003001E, + GA_PREVIOUS=$8003001F, + GA_NEXT=$80030020, + GA_DRAWINFO=$80030021, + GA_INTUITEXT=$80030022, + GA_LABELIMAGE=$80030023, + GA_TABCYCLE=$80030024, + GA_GADGETHELP=$80030025, + GA_BOUNDS=$80030026, + GA_RELSPECIAL=$80030027, + GA_TEXTATTR=$80030028, + GA_READONLY=$80030029, + PGA_DUMMY=$80031000, + PGA_FREEDOM=$80031001, + PGA_BORDERLESS=$80031002, + PGA_HORIZPOT=$80031003, + PGA_HORIZBODY=$80031004, + PGA_VERTPOT=$80031005, + PGA_VERTBODY=$80031006, + PGA_TOTAL=$80031007, + PGA_VISIBLE=$80031008, + PGA_TOP=$80031009, + PGA_NEWLOOK=$8003100A, + STRINGA_DUMMY=$80032000, + STRINGA_MAXCHARS=$80032001, + STRINGA_BUFFER=$80032002, + STRINGA_UNDOBUFFER=$80032003, + STRINGA_WORKBUFFER=$80032004, + STRINGA_BUFFERPOS=$80032005, + STRINGA_DISPPOS=$80032006, + STRINGA_ALTKEYMAP=$80032007, + STRINGA_FONT=$80032008, + STRINGA_PENS=$80032009, + STRINGA_ACTIVEPENS=$8003200A, + STRINGA_EDITHOOK=$8003200B, + STRINGA_EDITMODES=$8003200C, + STRINGA_REPLACEMODE=$8003200D, + STRINGA_FIXEDFIELDMODE=$8003200E, + STRINGA_NOFILTERMODE=$8003200F, + STRINGA_JUSTIFICATION=$80032010, + STRINGA_LONGVAL=$80032011, + STRINGA_TEXTVAL=$80032012, + STRINGA_EXITHELP=$80032013, + SG_DEFAULTMAXCHARS=$80, + LAYOUTA_DUMMY=$80038000, + LAYOUTA_LAYOUTOBJ=$80038001, + LAYOUTA_SPACING=$80038002, + LAYOUTA_ORIENTATION=$80038003, + LAYOUTA_CHILDMAXWIDTH=$80038004, + LAYOUTA_CHILDMAXHEIGHT=$80038005, + LORIENT_NONE=0, + LORIENT_HORIZ=1, + LORIENT_VERT=2, + GM_HITTEST=0, + GM_RENDER=1, + GM_GOACTIVE=2, + GM_HANDLEINPUT=3, + GM_GOINACTIVE=4, + GM_HELPTEST=5, + GM_LAYOUT=6, + GM_DOMAIN=7 + +OBJECT gphittest + methodid:LONG + ginfo:PTR TO gadgetinfo + mousex:INT + mousey:INT +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT gphelptest + methodid:LONG + ginfo:PTR TO gadgetinfo + mousex:INT + mousey:INT +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST GMR_GADGETHIT=4, + GMR_NOHELPHIT=0, + GMR_HELPHIT=-1, + GMR_HELPCODE=$10000 + +OBJECT gprender + methodid:LONG + ginfo:PTR TO gadgetinfo + rport:PTR TO rastport + redraw:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST GREDRAW_UPDATE=2, + GREDRAW_REDRAW=1, + GREDRAW_TOGGLE=0 + +OBJECT gpinput + methodid:LONG + ginfo:PTR TO gadgetinfo + ievent:PTR TO inputevent + termination:PTR TO LONG + mousex:INT + mousey:INT + tabletdata:PTR TO tabletdata +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT gpgoactive + methodid:LONG + ginfo:PTR TO gadgetinfo + ievent:PTR TO inputevent + termination:PTR TO LONG + mousex:INT + mousey:INT + tabletdata:PTR TO tabletdata +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST GMR_MEACTIVE=0, + GMR_NOREUSE=2, + GMR_REUSE=4, + GMR_VERIFY=8, + GMR_NEXTACTIVE=16, + GMR_PREVACTIVE=$20, + GMRB_NOREUSE=1, + GMRB_REUSE=2, + GMRB_VERIFY=3, + GMRB_NEXTACTIVE=4, + GMRB_PREVACTIVE=5, + GMRF_NOREUSE=2, + GMRF_REUSE=4, + GMRF_VERIFY=8, + GMRF_NEXTACTIVE=16, + GMRF_PREVACTIVE=$20 + +OBJECT gpgoinactive + methodid:LONG + ginfo:PTR TO gadgetinfo + abort:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT gplayout + methodid:LONG + ginfo:PTR TO gadgetinfo + initial:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT gpdomain + methodid:LONG + ginfo:PTR TO gadgetinfo + rport:PTR TO rastport + which:LONG + domain:ibox + attrs:PTR TO tagitem +ENDOBJECT + +CONST GDOMAIN_MINIMUM=0, + GDOMAIN_NOMINAL=1, + GDOMAIN_MAXIMUM=2 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/icclass.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/icclass.e new file mode 100644 index 0000000..251d234 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/icclass.e @@ -0,0 +1,12 @@ +OPT MODULE +OPT EXPORT + +CONST ICM_SETLOOP=$402, + ICM_CLEARLOOP=$403, + ICM_CHECKLOOP=$404, + ICA_DUMMY=$80040000, + ICA_TARGET=$80040001, + ICA_MAP=$80040002, + ICSPECIAL_CODE=$80040003, + ICTARGET_IDCMP=-1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/imageclass.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/imageclass.e new file mode 100644 index 0000000..7990e96 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/imageclass.e @@ -0,0 +1,148 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'graphics/rastport', + 'intuition/intuition', + 'intuition/screens' + +#define GADGET_BOX(g) ((g)+GD_LEFTEDGE) +#define IM_BOX(im) ((im)+IG_LEFTEDGE) +#define IM_FGPEN(im) (im::image.planepick) +#define IM_BGPEN(im) (im::image.planeonoff) + +CONST CUSTOMIMAGEDEPTH=-1, + IMAGE_ATTRIBUTES=$80020000, + IA_LEFT=$80020001, + IA_TOP=$80020002, + IA_WIDTH=$80020003, + IA_HEIGHT=$80020004, + IA_FGPEN=$80020005, + IA_BGPEN=$80020006, + IA_DATA=$80020007, + IA_LINEWIDTH=$80020008, + IA_PENS=$8002000E, + IA_RESOLUTION=$8002000F, + IA_APATTERN=$80020010, + IA_APATSIZE=$80020011, + IA_MODE=$80020012, + IA_FONT=$80020013, + IA_OUTLINE=$80020014, + IA_RECESSED=$80020015, + IA_DOUBLEEMBOSS=$80020016, + IA_EDGESONLY=$80020017, + SYSIA_SIZE=$8002000B, + SYSIA_DEPTH=$8002000C, + SYSIA_WHICH=$8002000D, + SYSIA_DRAWINFO=$80020018, + SYSIA_PENS=$8002000E, + IA_SHADOWPEN=$80020009, + IA_HIGHLIGHTPEN=$8002000A, + SYSIA_REFERENCEFONT=$80020019, + IA_SUPPORTSDISABLE=$8002001A, + IA_FRAMETYPE=$8002001B, + SYSISIZE_MEDRES=0, + SYSISIZE_LOWRES=1, + SYSISIZE_HIRES=2, + DEPTHIMAGE=0, + ZOOMIMAGE=1, + SIZEIMAGE=2, + CLOSEIMAGE=3, + SDEPTHIMAGE=5, + LEFTIMAGE=10, + UPIMAGE=11, + RIGHTIMAGE=12, + DOWNIMAGE=13, + CHECKIMAGE=14, + MXIMAGE=15, + MENUCHECK=16, + AMIGAKEY=17, + FRAME_DEFAULT=0, + FRAME_BUTTON=1, + FRAME_RIDGE=2, + FRAME_ICONDROPBOX=3, + IM_DRAW=$202, + IM_HITTEST=$203, + IM_ERASE=$204, + IM_MOVE=$205, + IM_DRAWFRAME=$206, + IM_FRAMEBOX=$207, + IM_HITFRAME=$208, + IM_ERASEFRAME=$209, + IDS_NORMAL=0, + IDS_SELECTED=1, + IDS_DISABLED=2, + IDS_BUSY=3, + IDS_INDETERMINATE=4, + IDS_INACTIVENORMAL=5, + IDS_INACTIVESELECTED=6, + IDS_INACTIVEDISABLED=7, + IDS_INDETERMINANT=4 + +OBJECT impframebox + methodid:LONG + contentsbox:PTR TO ibox + framebox:PTR TO ibox + drinfo:PTR TO drawinfo + frameflags:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST FRAMEB_SPECIFY=0, + FRAMEF_SPECIFY=1 + +OBJECT impdraw + methodid:LONG + rport:PTR TO rastport + offsetx:INT + offsety:INT + state:LONG + drinfo:PTR TO drawinfo + dimensionswidth:INT + dimensionsheight:INT +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT impdrawframe + methodid:LONG + rport:PTR TO rastport + offsetx:INT + offsety:INT + state:LONG + drinfo:PTR TO drawinfo + dimensionswidth:INT + dimensionsheight:INT +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT imperase + methodid:LONG + rport:PTR TO rastport + offsetx:INT + offsety:INT + dimensionswidth:INT + dimensionsheight:INT +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT imperaseframe + methodid:LONG + rport:PTR TO rastport + offsetx:INT + offsety:INT + dimensionswidth:INT + dimensionsheight:INT +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT imphittest + methodid:LONG + pointx:INT + pointy:INT + dimensionswidth:INT + dimensionsheight:INT +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT imphitframe + methodid:LONG + pointx:INT + pointy:INT + dimensionswidth:INT + dimensionsheight:INT +ENDOBJECT /* SIZEOF=NONE !!! */ diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/intuition.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/intuition.e new file mode 100644 index 0000000..dafe114 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/intuition.e @@ -0,0 +1,649 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'devices/keymap', + 'exec/ports', + 'graphics/clip', + 'graphics/gfx', + 'graphics/rastport', + 'graphics/text', + 'intuition/screens', + 'intuition/sghooks', + 'utility/tagitem' + +OBJECT menu + nextmenu:PTR TO menu + leftedge:INT + topedge:INT + width:INT + height:INT + flags:INT -> This is unsigned + menuname:PTR TO CHAR + firstitem:PTR TO menuitem + jazzx:INT + jazzy:INT + beatx:INT + beaty:INT +ENDOBJECT /* SIZEOF=30 */ + +CONST MENUENABLED=1, + MIDRAWN=$100 + +OBJECT menuitem + nextitem:PTR TO menuitem + leftedge:INT + topedge:INT + width:INT + height:INT + flags:INT -> This is unsigned + mutualexclude:LONG + itemfill:LONG + selectfill:LONG + command:CHAR + subitem:PTR TO menuitem + nextselect:INT -> This is unsigned +ENDOBJECT /* SIZEOF=34 */ + +CONST CHECKIT=1, + ITEMTEXT=2, + COMMSEQ=4, + MENUTOGGLE=8, + ITEMENABLED=16, + HIGHFLAGS=$C0, + HIGHIMAGE=0, + HIGHCOMP=$40, + HIGHBOX=$80, + HIGHNONE=$C0, + CHECKED=$100, + ISDRAWN=$1000, + HIGHITEM=$2000, + MENUTOGGLED=$4000 + +OBJECT requester + olderrequest:PTR TO requester + leftedge:INT + topedge:INT + width:INT + height:INT + relleft:INT + reltop:INT + reqgadget:PTR TO gadget + reqborder:PTR TO border + reqtext:PTR TO intuitext + flags:INT -> This is unsigned + backfill:CHAR + reqlayer:PTR TO layer + reqpad1[32]:ARRAY + imagebmap:PTR TO bitmap + rwindow:PTR TO window + reqimage:PTR TO image + reqpad2[32]:ARRAY +ENDOBJECT /* SIZEOF=112 */ + +CONST POINTREL=1, + PREDRAWN=2, + NOISYREQ=4, + SIMPLEREQ=16, + USEREQIMAGE=$20, + NOREQBACKFILL=$40, + REQOFFWINDOW=$1000, + REQACTIVE=$2000, + SYSREQUEST=$4000, + DEFERREFRESH=$8000 + +CONST GD_LEFTEDGE=4 + +OBJECT gadget + nextgadget:PTR TO gadget + leftedge:INT + topedge:INT + width:INT + height:INT + flags:INT -> This is unsigned + activation:INT -> This is unsigned + gadgettype:INT -> This is unsigned + gadgetrender:LONG + selectrender:LONG + gadgettext:PTR TO intuitext + mutualexclude:LONG + specialinfo:LONG + gadgetid:INT -> This is unsigned + userdata:LONG +ENDOBJECT /* SIZEOF=44 */ + +OBJECT extgadget + nextgadget:PTR TO extgadget + leftedge:INT + topedge:INT + width:INT + height:INT + flags:INT -> This is unsigned + activation:INT -> This is unsigned + gadgettype:INT -> This is unsigned + gadgetrender:LONG + selectrender:LONG + gadgettext:PTR TO intuitext + mutualexclude:LONG + specialinfo:LONG + gadgetid:INT -> This is unsigned + userdata:LONG + moreflags:LONG + boundsleftedge:INT + boundstopedge:INT + boundswidth:INT + boundsheight:INT +ENDOBJECT /* SIZEOF=56 */ + +CONST GFLG_GADGHIGHBITS=3, + GFLG_GADGHCOMP=0, + GFLG_GADGHBOX=1, + GFLG_GADGHIMAGE=2, + GFLG_GADGHNONE=3, + GFLG_GADGIMAGE=4, + GFLG_RELBOTTOM=8, + GFLG_RELRIGHT=16, + GFLG_RELWIDTH=$20, + GFLG_RELHEIGHT=$40, + GFLG_RELSPECIAL=$4000, + GFLG_SELECTED=$80, + GFLG_DISABLED=$100, + GFLG_LABELMASK=$3000, + GFLG_LABELITEXT=0, + GFLG_LABELSTRING=$1000, + GFLG_LABELIMAGE=$2000, + GFLG_TABCYCLE=$200, + GFLG_STRINGEXTEND=$400, + GFLG_IMAGEDISABLE=$800, + GFLG_EXTENDED=$8000, + GACT_RELVERIFY=1, + GACT_IMMEDIATE=2, + GACT_ENDGADGET=4, + GACT_FOLLOWMOUSE=8, + GACT_RIGHTBORDER=16, + GACT_LEFTBORDER=$20, + GACT_TOPBORDER=$40, + GACT_BOTTOMBORDER=$80, + GACT_BORDERSNIFF=$8000, + GACT_TOGGLESELECT=$100, + GACT_BOOLEXTEND=$2000, + GACT_STRINGLEFT=0, + GACT_STRINGCENTER=$200, + GACT_STRINGRIGHT=$400, + GACT_LONGINT=$800, + GACT_ALTKEYMAP=$1000, + GACT_STRINGEXTEND=$2000, + GACT_ACTIVEGADGET=$4000, + GTYP_GADGETTYPE=$FC00, + GTYP_SYSGADGET=$8000, + GTYP_SCRGADGET=$4000, + GTYP_GZZGADGET=$2000, + GTYP_REQGADGET=$1000, + GTYP_SIZING=16, + GTYP_WDRAGGING=$20, + GTYP_SDRAGGING=$30, + GTYP_WUPFRONT=$40, + GTYP_SUPFRONT=$50, + GTYP_WDOWNBACK=$60, + GTYP_SDOWNBACK=$70, + GTYP_CLOSE=$80, + GTYP_BOOLGADGET=1, + GTYP_GADGET0002=2, + GTYP_PROPGADGET=3, + GTYP_STRGADGET=4, + GTYP_CUSTOMGADGET=5, + GTYP_GTYPEMASK=7, + GTYP_SYSTYPEMASK=$F0, + GTYP_WDEPTH=$40, + GTYP_SDEPTH=$50, + GTYP_WZOOM=$60, + GTYP_SUNUSED=$70, + GMORE_BOUNDS=1, + GMORE_GADGETHELP=2, + GMORE_SCROLLRASTER=4 + +OBJECT boolinfo + flags:INT -> This is unsigned + mask:PTR TO INT -> Target is unsigned + reserved:LONG +ENDOBJECT /* SIZEOF=10 */ + +CONST BOOLMASK=1 + +OBJECT propinfo + flags:INT -> This is unsigned + horizpot:INT -> This is unsigned + vertpot:INT -> This is unsigned + horizbody:INT -> This is unsigned + vertbody:INT -> This is unsigned + cwidth:INT -> This is unsigned + cheight:INT -> This is unsigned + hpotres:INT -> This is unsigned + vpotres:INT -> This is unsigned + leftborder:INT -> This is unsigned + topborder:INT -> This is unsigned +ENDOBJECT /* SIZEOF=22 */ + +CONST AUTOKNOB=1, + FREEHORIZ=2, + FREEVERT=4, + PROPBORDERLESS=8, + KNOBHIT=$100, + PROPNEWLOOK=16, + KNOBHMIN=6, + KNOBVMIN=4, + MAXBODY=$FFFF, + MAXPOT=$FFFF + +OBJECT stringinfo + buffer:PTR TO CHAR + undobuffer:PTR TO CHAR + bufferpos:INT + maxchars:INT + disppos:INT + undopos:INT + numchars:INT + dispcount:INT + cleft:INT + ctop:INT + extension:PTR TO stringextend + longint:LONG + altkeymap:PTR TO keymap +ENDOBJECT /* SIZEOF=36 */ + +OBJECT intuitext + frontpen:CHAR + backpen:CHAR + drawmode:CHAR + leftedge:INT + topedge:INT + itextfont:PTR TO textattr + itext:PTR TO CHAR + nexttext:PTR TO intuitext +ENDOBJECT /* SIZEOF=20 */ + +OBJECT border + leftedge:INT + topedge:INT + frontpen:CHAR + backpen:CHAR + drawmode:CHAR + count:CHAR -> This is signed + xy:PTR TO INT + nextborder:PTR TO border +ENDOBJECT /* SIZEOF=16 */ + +CONST IG_LEFTEDGE=0 + +OBJECT image + leftedge:INT + topedge:INT + width:INT + height:INT + depth:INT + imagedata:PTR TO INT -> Target is unsigned + planepick:CHAR + planeonoff:CHAR + nextimage:PTR TO image +ENDOBJECT /* SIZEOF=20 */ + +OBJECT intuimessage + execmessage:mn + class:LONG + code:INT -> This is unsigned + qualifier:INT -> This is unsigned + iaddress:LONG + mousex:INT + mousey:INT + seconds:LONG + micros:LONG + idcmpwindow:PTR TO window + speciallink:PTR TO intuimessage +ENDOBJECT /* SIZEOF=52 */ + +OBJECT extintuimessage + intuimessage:intuimessage + tabletdata:PTR TO tabletdata +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST IDCMP_SIZEVERIFY=1, + IDCMP_NEWSIZE=2, + IDCMP_REFRESHWINDOW=4, + IDCMP_MOUSEBUTTONS=8, + IDCMP_MOUSEMOVE=16, + IDCMP_GADGETDOWN=$20, + IDCMP_GADGETUP=$40, + IDCMP_REQSET=$80, + IDCMP_MENUPICK=$100, + IDCMP_CLOSEWINDOW=$200, + IDCMP_RAWKEY=$400, + IDCMP_REQVERIFY=$800, + IDCMP_REQCLEAR=$1000, + IDCMP_MENUVERIFY=$2000, + IDCMP_NEWPREFS=$4000, + IDCMP_DISKINSERTED=$8000, + IDCMP_DISKREMOVED=$10000, + IDCMP_WBENCHMESSAGE=$20000, + IDCMP_ACTIVEWINDOW=$40000, + IDCMP_INACTIVEWINDOW=$80000, + IDCMP_DELTAMOVE=$100000, + IDCMP_VANILLAKEY=$200000, + IDCMP_INTUITICKS=$400000, + IDCMP_IDCMPUPDATE=$800000, + IDCMP_MENUHELP=$1000000, + IDCMP_CHANGEWINDOW=$2000000, + IDCMP_GADGETHELP=$4000000, + IDCMP_LONELYMESSAGE=$80000000, + CWCODE_MOVESIZE=0, + CWCODE_DEPTH=1, + MENUHOT=1, + MENUCANCEL=2, + MENUWAITING=3, + OKOK=1, + OKABORT=4, + OKCANCEL=2, + WBENCHOPEN=1, + WBENCHCLOSE=2 + +OBJECT ibox + left:INT + top:INT + width:INT + height:INT +ENDOBJECT /* SIZEOF=8 */ + +OBJECT window + nextwindow:PTR TO window + leftedge:INT + topedge:INT + width:INT + height:INT + mousey:INT + mousex:INT + minwidth:INT + minheight:INT + maxwidth:INT -> This is unsigned + maxheight:INT -> This is unsigned + flags:LONG + menustrip:PTR TO menu + title:PTR TO CHAR + firstrequest:PTR TO requester + dmrequest:PTR TO requester + reqcount:INT + wscreen:PTR TO screen + rport:PTR TO rastport + borderleft:CHAR -> This is signed + bordertop:CHAR -> This is signed + borderright:CHAR -> This is signed + borderbottom:CHAR -> This is signed + borderrport:PTR TO rastport + firstgadget:PTR TO gadget + parent:PTR TO window + descendant:PTR TO window + pointer:PTR TO INT -> Target is unsigned + ptrheight:CHAR -> This is signed + ptrwidth:CHAR -> This is signed + xoffset:CHAR -> This is signed + yoffset:CHAR -> This is signed + idcmpflags:LONG + userport:PTR TO mp + windowport:PTR TO mp + messagekey:PTR TO intuimessage + detailpen:CHAR + blockpen:CHAR + checkmark:PTR TO image + screentitle:PTR TO CHAR + gzzmousex:INT + gzzmousey:INT + gzzwidth:INT + gzzheight:INT + extdata:PTR TO CHAR + userdata:PTR TO CHAR + wlayer:PTR TO layer + ifont:PTR TO textfont + moreflags:LONG +ENDOBJECT /* SIZEOF=136 */ + +CONST WFLG_SIZEGADGET=1, + WFLG_DRAGBAR=2, + WFLG_DEPTHGADGET=4, + WFLG_CLOSEGADGET=8, + WFLG_SIZEBRIGHT=16, + WFLG_SIZEBBOTTOM=$20, + WFLG_REFRESHBITS=$C0, + WFLG_SMART_REFRESH=0, + WFLG_SIMPLE_REFRESH=$40, + WFLG_SUPER_BITMAP=$80, + WFLG_OTHER_REFRESH=$C0, + WFLG_BACKDROP=$100, + WFLG_REPORTMOUSE=$200, + WFLG_GIMMEZEROZERO=$400, + WFLG_BORDERLESS=$800, + WFLG_ACTIVATE=$1000, + WFLG_RMBTRAP=$10000, + WFLG_NOCAREREFRESH=$20000, + WFLG_NW_EXTENDED=$40000, + WFLG_NEWLOOKMENUS=$200000, + WFLG_WINDOWACTIVE=$2000, + WFLG_INREQUEST=$4000, + WFLG_MENUSTATE=$8000, + WFLG_WINDOWREFRESH=$1000000, + WFLG_WBENCHWINDOW=$2000000, + WFLG_WINDOWTICKED=$4000000, + WFLG_VISITOR=$8000000, + WFLG_ZOOMED=$10000000, + WFLG_HASZOOM=$20000000, + SUPER_UNUSED=$FCFC0000, + DEFAULTMOUSEQUEUE=5 + +OBJECT nw + leftedge:INT + topedge:INT + width:INT + height:INT + detailpen:CHAR + blockpen:CHAR + idcmpflags:LONG + flags:LONG + firstgadget:PTR TO gadget + checkmark:PTR TO image + title:PTR TO CHAR + screen:PTR TO screen + bitmap:PTR TO bitmap + minwidth:INT + minheight:INT + maxwidth:INT -> This is unsigned + maxheight:INT -> This is unsigned + type:INT -> This is unsigned +ENDOBJECT /* SIZEOF=48 */ + +OBJECT extnewwindow + leftedge:INT + topedge:INT + width:INT + height:INT + detailpen:CHAR + blockpen:CHAR + idcmpflags:LONG + flags:LONG + firstgadget:PTR TO gadget + checkmark:PTR TO image + title:PTR TO CHAR + screen:PTR TO screen + bitmap:PTR TO bitmap + minwidth:INT + minheight:INT + maxwidth:INT -> This is unsigned + maxheight:INT -> This is unsigned + type:INT -> This is unsigned + extension:PTR TO tagitem +ENDOBJECT /* SIZEOF=52 */ + +CONST WA_LEFT=$80000064, + WA_TOP=$80000065, + WA_WIDTH=$80000066, + WA_HEIGHT=$80000067, + WA_DETAILPEN=$80000068, + WA_BLOCKPEN=$80000069, + WA_IDCMP=$8000006A, + WA_FLAGS=$8000006B, + WA_GADGETS=$8000006C, + WA_CHECKMARK=$8000006D, + WA_TITLE=$8000006E, + WA_SCREENTITLE=$8000006F, + WA_CUSTOMSCREEN=$80000070, + WA_SUPERBITMAP=$80000071, + WA_MINWIDTH=$80000072, + WA_MINHEIGHT=$80000073, + WA_MAXWIDTH=$80000074, + WA_MAXHEIGHT=$80000075, + WA_INNERWIDTH=$80000076, + WA_INNERHEIGHT=$80000077, + WA_PUBSCREENNAME=$80000078, + WA_PUBSCREEN=$80000079, + WA_PUBSCREENFALLBACK=$8000007A, + WA_WINDOWNAME=$8000007B, + WA_COLORS=$8000007C, + WA_ZOOM=$8000007D, + WA_MOUSEQUEUE=$8000007E, + WA_BACKFILL=$8000007F, + WA_RPTQUEUE=$80000080, + WA_SIZEGADGET=$80000081, + WA_DRAGBAR=$80000082, + WA_DEPTHGADGET=$80000083, + WA_CLOSEGADGET=$80000084, + WA_BACKDROP=$80000085, + WA_REPORTMOUSE=$80000086, + WA_NOCAREREFRESH=$80000087, + WA_BORDERLESS=$80000088, + WA_ACTIVATE=$80000089, + WA_RMBTRAP=$8000008A, + WA_WBENCHWINDOW=$8000008B, + WA_SIMPLEREFRESH=$8000008C, + WA_SMARTREFRESH=$8000008D, + WA_SIZEBRIGHT=$8000008E, + WA_SIZEBBOTTOM=$8000008F, + WA_AUTOADJUST=$80000090, + WA_GIMMEZEROZERO=$80000091, + WA_MENUHELP=$80000092, + WA_NEWLOOKMENUS=$80000093, + WA_AMIGAKEY=$80000094, + WA_NOTIFYDEPTH=$80000095, + WA_OBSOLETE=$80000096, + WA_POINTER=$80000097, + WA_BUSYPOINTER=$80000098, + WA_POINTERDELAY=$80000099, + WA_TABLETMESSAGES=$8000009A, + WA_HELPGROUP=$8000009B, + WA_HELPGROUPWINDOW=$8000009C, + HC_GADGETHELP=1 + +OBJECT remember + nextremember:PTR TO remember + remembersize:LONG + memory:PTR TO CHAR +ENDOBJECT /* SIZEOF=12 */ + +OBJECT colorspec + colorindex:INT + red:INT -> This is unsigned + green:INT -> This is unsigned + blue:INT -> This is unsigned +ENDOBJECT /* SIZEOF=8 */ + +OBJECT easystruct + structsize:LONG + flags:LONG + title:PTR TO CHAR + textformat:PTR TO CHAR + gadgetformat:PTR TO CHAR +ENDOBJECT /* SIZEOF=20 */ + +#define MENUNUM(n) ((n) AND $1F) +#define ITEMNUM(n) (Shr((n),5) AND $3F) +#define SUBNUM(n) (Shr((n),11) AND $1F) + +#define SHIFTMENU(n) ((n) AND $1F) +#define SHIFTITEM(n) (Shl((n) AND $3F,5)) +#define SHIFTSUB(n) (Shl((n) AND $1F,11)) + +#define FULLMENUNUM(menu,item,sub) (SHIFTSUB(sub) OR SHIFTITEM(item) OR \ + SHIFTMENU(menu)) + +#define SRBNUM(n) (8-Shr((n),4)) +#define SWBNUM(n) (8-((n) AND $F)) +#define SSBNUM(n) (1+Shr((n),4)) +#define SPARNUM(n) (Shr((n),4)) +#define SHAKNUM(n) ((n) AND $F) + +CONST NOMENU=31, + NOITEM=$3F, + NOSUB=31, + MENUNULL=$FFFF, + CHECKWIDTH=19, + COMMWIDTH=27, + LOWCHECKWIDTH=13, + LOWCOMMWIDTH=16, + ALERT_TYPE=$80000000, + RECOVERY_ALERT=0, + DEADEND_ALERT=$80000000, + AUTOFRONTPEN=0, + AUTOBACKPEN=1, + AUTODRAWMODE=1, + AUTOLEFTEDGE=6, + AUTOTOPEDGE=3, + AUTOITEXTFONT=0, + AUTONEXTTEXT=0, + SELECTUP=$E8, + SELECTDOWN=$68, + MENUUP=$E9, + MENUDOWN=$69, + MIDDLEUP=$EA, + MIDDLEDOWN=$6A, + ALTLEFT=16, + ALTRIGHT=$20, + AMIGALEFT=$40, + AMIGARIGHT=$80, + AMIGAKEYS=$C0, + CURSORUP=$4C, + CURSORLEFT=$4F, + CURSORRIGHT=$4E, + CURSORDOWN=$4D, + KEYCODE_Q=16, + KEYCODE_Z=$31, + KEYCODE_X=$32, + KEYCODE_V=$34, + KEYCODE_B=$35, + KEYCODE_N=$36, + KEYCODE_M=$37, + KEYCODE_LESS=$38, + KEYCODE_GREATER=$39, + TABLETA_DUMMY=$8003A000, + TABLETA_TABLETZ=$8003A001, -> Data for this tag is unsigned INT + TABLETA_RANGEZ=$8003A002, + TABLETA_ANGLEX=$8003A003, + TABLETA_ANGLEY=$8003A004, + TABLETA_ANGLEZ=$8003A005, + TABLETA_PRESSURE=$8003A006, + TABLETA_BUTTONBITS=$8003A007, + TABLETA_INPROXIMITY=$8003A008, + TABLETA_RESOLUTIONX=$8003A009, + TABLETA_RESOLUTIONY=$8003A00A + +OBJECT tabletdata + xfraction:INT -> This is unsigned + yfraction:INT -> This is unsigned + tabletx:LONG + tablety:LONG + rangex:LONG + rangey:LONG + taglist:PTR TO tagitem +ENDOBJECT /* SIZEOF=24 */ + +OBJECT tablethookdata + screen:PTR TO screen + width:LONG + height:LONG + screenchanged:LONG +ENDOBJECT /* SIZEOF=16 */ diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/intuitionbase.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/intuitionbase.e new file mode 100644 index 0000000..89a6270 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/intuitionbase.e @@ -0,0 +1,38 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/libraries', + 'graphics/view', + 'intuition/intuition', + 'intuition/screens' + +CONST DMODECOUNT=2, + HIRESPICK=0, + LOWRESPICK=1, + EVENTMAX=10, + RESCOUNT=2, + HIRESGADGET=0, + LOWRESGADGET=1, + GADGETCOUNT=8, + UPFRONTGADGET=0, + DOWNBACKGADGET=1, + SIZEGADGET=2, + CLOSEGADGET=3, + DRAGGADGET=4, + SUPFRONTGADGET=5, + SDOWNBACKGADGET=6, + SDRAGGADGET=7 + +OBJECT intuitionbase + libnode:lib + viewlord:view + activewindow:PTR TO window + activescreen:PTR TO screen + firstscreen:PTR TO screen + flags:LONG + mousey:INT + mousex:INT + seconds:LONG + micros:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/iobsolete.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/iobsolete.e new file mode 100644 index 0000000..e83f05e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/iobsolete.e @@ -0,0 +1,188 @@ +OPT MODULE +OPT EXPORT + +CONST GADGHIGHBITS=3, + GADGHCOMP=0, + GADGHBOX=1, + GADGHIMAGE=2, + GADGHNONE=3, + GADGIMAGE=4, + GRELBOTTOM=8, + GRELRIGHT=16, + GRELWIDTH=$20, + GRELHEIGHT=$40, + SELECTED=$80, + GADGDISABLED=$100, + LABELMASK=$3000, + LABELITEXT=0, + LABELSTRING=$1000, + LABELIMAGE=$2000, + RELVERIFY=1, + GADGIMMEDIATE=2, + ENDGADGET=4, + FOLLOWMOUSE=8, + RIGHTBORDER=16, + LEFTBORDER=$20, + TOPBORDER=$40, + BOTTOMBORDER=$80, + BORDERSNIFF=$8000, + TOGGLESELECT=$100, + BOOLEXTEND=$2000, + STRINGLEFT=0, + STRINGCENTER=$200, + STRINGRIGHT=$400, + LONGINT=$800, + ALTKEYMAP=$1000, + STRINGEXTEND=$2000, + ACTIVEGADGET=$4000, + GADGETTYPE=$FC00, + SYSGADGET=$8000, + SCRGADGET=$4000, + GZZGADGET=$2000, + REQGADGET=$1000, + SIZING=16, + WDRAGGING=$20, + SDRAGGING=$30, + WUPFRONT=$40, + SUPFRONT=$50, + WDOWNBACK=$60, + SDOWNBACK=$70, + CLOSE=$80, + BOOLGADGET=1, + GADGET0002=2, + PROPGADGET=3, + STRGADGET=4, + CUSTOMGADGET=5, + GTYPEMASK=7, + SIZEVERIFY=1, + NEWSIZE=2, + REFRESHWINDOW=4, + MOUSEBUTTONS=8, + MOUSEMOVE=16, + GADGETDOWN=$20, + GADGETUP=$40, + REQSET=$80, + MENUPICK=$100, + CLOSEWINDOW=$200, + RAWKEY=$400, + REQVERIFY=$800, + REQCLEAR=$1000, + MENUVERIFY=$2000, + NEWPREFS=$4000, + DISKINSERTED=$8000, + DISKREMOVED=$10000, + WBENCHMESSAGE=$20000, + ACTIVEWINDOW=$40000, + INACTIVEWINDOW=$80000, + DELTAMOVE=$100000, + VANILLAKEY=$200000, + INTUITICKS=$400000, + IDCMPUPDATE=$800000, + MENUHELP=$1000000, + CHANGEWINDOW=$2000000, + LONELYMESSAGE=$80000000, + WINDOWSIZING=1, + WINDOWDRAG=2, + WINDOWDEPTH=4, + WINDOWCLOSE=8, + SIZEBRIGHT=16, + SIZEBBOTTOM=$20, + REFRESHBITS=$C0, + SMART_REFRESH=0, + SIMPLE_REFRESH=$40, + SUPER_BITMAP=$80, + OTHER_REFRESH=$C0, + BACKDROP=$100, + REPORTMOUSE=$200, + GIMMEZEROZERO=$400, + BORDERLESS=$800, + ACTIVATE=$1000, + WINDOWACTIVE=$2000, + INREQUEST=$4000, + MENUSTATE=$8000, + RMBTRAP=$10000, + NOCAREREFRESH=$20000, + WINDOWREFRESH=$1000000, + WBENCHWINDOW=$2000000, + WINDOWTICKED=$4000000, + NW_EXTENDED=$40000, + VISITOR=$8000000, + ZOOMED=$10000000, + HASZOOM=$20000000, + GA_LEFT=$80030001, + GA_RELRIGHT=$80030002, + GA_TOP=$80030003, + GA_RELBOTTOM=$80030004, + GA_WIDTH=$80030005, + GA_RELWIDTH=$80030006, + GA_HEIGHT=$80030007, + GA_RELHEIGHT=$80030008, + GA_TEXT=$80030009, + GA_IMAGE=$8003000A, + GA_BORDER=$8003000B, + GA_SELECTRENDER=$8003000C, + GA_HIGHLIGHT=$8003000D, + GA_DISABLED=$8003000E, + GA_GZZGADGET=$8003000F, + GA_USERDATA=$80030011, + GA_SPECIALINFO=$80030012, + GA_SELECTED=$80030013, + GA_ENDGADGET=$80030014, + GA_IMMEDIATE=$80030015, + GA_RELVERIFY=$80030016, + GA_FOLLOWMOUSE=$80030017, + GA_RIGHTBORDER=$80030018, + GA_LEFTBORDER=$80030019, + GA_TOPBORDER=$8003001A, + GA_BOTTOMBORDER=$8003001B, + GA_TOGGLESELECT=$8003001C, + GA_SYSGADGET=$8003001D, + GA_SYSGTYPE=$8003001E, + GA_PREVIOUS=$8003001F, + GA_NEXT=$80030020, + GA_DRAWINFO=$80030021, + GA_INTUITEXT=$80030022, + GA_LABELIMAGE=$80030023, + PGA_FREEDOM=$80031001, + PGA_BORDERLESS=$80031002, + PGA_HORIZPOT=$80031003, + PGA_HORIZBODY=$80031004, + PGA_VERTPOT=$80031005, + PGA_VERTBODY=$80031006, + PGA_TOTAL=$80031007, + PGA_VISIBLE=$80031008, + PGA_TOP=$80031009, + LAYOUTA_LAYOUTOBJ=$80038001, + LAYOUTA_SPACING=$80038002, + LAYOUTA_ORIENTATION=$80038003, + IA_LEFT=$80020001, + IA_TOP=$80020002, + IA_WIDTH=$80020003, + IA_HEIGHT=$80020004, + IA_FGPEN=$80020005, + IA_BGPEN=$80020006, + IA_DATA=$80020007, + IA_LINEWIDTH=$80020008, + IA_PENS=$8002000E, + IA_RESOLUTION=$8002000F, + IA_APATTERN=$80020010, + IA_APATSIZE=$80020011, + IA_MODE=$80020012, + IA_FONT=$80020013, + IA_OUTLINE=$80020014, + IA_RECESSED=$80020015, + IA_DOUBLEEMBOSS=$80020016, + IA_EDGESONLY=$80020017, + IA_SHADOWPEN=$80020009, + IA_HIGHLIGHTPEN=$8002000A, + DETAILPEN=0, + BLOCKPEN=1, + TEXTPEN=2, + SHINEPEN=3, + SHADOWPEN=4, + HIFILLPEN=5, + HIFILLTEXTPEN=6, + BACKGROUNDPEN=7, + HILIGHTTEXTPEN=8, + NUMDRIPENS=12 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/pointerclass.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/pointerclass.e new file mode 100644 index 0000000..f89674d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/pointerclass.e @@ -0,0 +1,23 @@ +OPT MODULE +OPT EXPORT + +CONST POINTERA_DUMMY=$80039000, + POINTERA_BITMAP=$80039001, + POINTERA_XOFFSET=$80039002, + POINTERA_YOFFSET=$80039003, + POINTERA_WORDWIDTH=$80039004, + POINTERA_XRESOLUTION=$80039005, + POINTERA_YRESOLUTION=$80039006, + POINTERXRESN_DEFAULT=0, + POINTERXRESN_140NS=1, + POINTERXRESN_70NS=2, + POINTERXRESN_35NS=3, + POINTERXRESN_SCREENRES=4, + POINTERXRESN_LORES=5, + POINTERXRESN_HIRES=6, + POINTERYRESN_DEFAULT=0, + POINTERYRESN_HIGH=2, + POINTERYRESN_HIGHASPECT=3, + POINTERYRESN_SCREENRES=4, + POINTERYRESN_SCREENRESASPECT=5 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/preferences.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/preferences.e new file mode 100644 index 0000000..443df91 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/preferences.e @@ -0,0 +1,165 @@ +OPT MODULE +OPT EXPORT + +MODULE 'devices/timer' + +CONST FILENAME_SIZE=30, + DEVNAME_SIZE=16, + POINTERSIZE=$24, + TOPAZ_EIGHTY=8, + TOPAZ_SIXTY=9 + +OBJECT preferences + fontheight:CHAR -> This is signed + printerport:CHAR + baudrate:INT -> This is unsigned + keyrptspeed:timeval + keyrptdelay:timeval + doubleclick:timeval + pointermatrix[$24]:ARRAY OF INT -> Array is unsigned + xoffset:CHAR -> This is signed + yoffset:CHAR -> This is signed + color17:INT -> This is unsigned + color18:INT -> This is unsigned + color19:INT -> This is unsigned + pointerticks:INT -> This is unsigned + color0:INT -> This is unsigned + color1:INT -> This is unsigned + color2:INT -> This is unsigned + color3:INT -> This is unsigned + viewxoffset:CHAR -> This is signed + viewyoffset:CHAR -> This is signed + viewinitx:INT + viewinity:INT + enablecli:INT + printertype:INT -> This is unsigned + printerfilename[30]:ARRAY + printpitch:INT -> This is unsigned + printquality:INT -> This is unsigned + printspacing:INT -> This is unsigned + printleftmargin:INT -> This is unsigned + printrightmargin:INT -> This is unsigned + printimage:INT -> This is unsigned + printaspect:INT -> This is unsigned + printshade:INT -> This is unsigned + printthreshold:INT + papersize:INT -> This is unsigned + paperlength:INT -> This is unsigned + papertype:INT -> This is unsigned + serrwbits:CHAR + serstopbuf:CHAR + serparshk:CHAR + lacewb:CHAR + pad[12]:ARRAY + prtdevname[16]:ARRAY + defaultprtunit:CHAR + defaultserunit:CHAR + rowsizechange:CHAR -> This is signed + columnsizechange:CHAR -> This is signed + printflags:INT -> This is unsigned + printmaxwidth:INT -> This is unsigned + printmaxheight:INT -> This is unsigned + printdensity:CHAR + printxoffset:CHAR + wb_width:INT -> This is unsigned + wb_height:INT -> This is unsigned + wb_depth:CHAR + ext_size:CHAR +ENDOBJECT /* SIZEOF=232 */ + +CONST LACEWB=1, + LW_RESERVED=1, + SCREEN_DRAG=$4000, + MOUSE_ACCEL=$8000, + PARALLEL_PRINTER=0, + SERIAL_PRINTER=1, + BAUD_110=0, + BAUD_300=1, + BAUD_1200=2, + BAUD_2400=3, + BAUD_4800=4, + BAUD_9600=5, + BAUD_19200=6, + BAUD_MIDI=7, + FANFOLD=0, + SINGLE=$80, + PICA=0, + ELITE=$400, + FINE=$800, + DRAFT=0, + LETTER=$100, + SIX_LPI=0, + EIGHT_LPI=$200, + IMAGE_POSITIVE=0, + IMAGE_NEGATIVE=1, + ASPECT_HORIZ=0, + ASPECT_VERT=1, + SHADE_BW=0, + SHADE_GREYSCALE=1, + SHADE_COLOR=2, + US_LETTER=0, + US_LEGAL=16, + N_TRACTOR=$20, + W_TRACTOR=$30, + CUSTOM=$40, + EURO_A0=$50, + EURO_A1=$60, + EURO_A2=$70, + EURO_A3=$80, + EURO_A4=$90, + EURO_A5=$A0, + EURO_A6=$B0, + EURO_A7=$C0, + EURO_A8=$D0, + CUSTOM_NAME=0, + ALPHA_P_101=1, + BROTHER_15XL=2, + CBM_MPS1000=3, + DIAB_630=4, + DIAB_ADV_D25=5, + DIAB_C_150=6, + EPSON=7, + EPSON_JX_80=8, + OKIMATE_20=9, + QUME_LP_20=10, + HP_LASERJET=11, + HP_LASERJET_PLUS=12, + SBUF_512=0, + SBUF_1024=1, + SBUF_2048=2, + SBUF_4096=3, + SBUF_8000=4, + SBUF_16000=5, + SREAD_BITS=$F0, + SWRITE_BITS=15, + SSTOP_BITS=$F0, + SBUFSIZE_BITS=15, + SPARITY_BITS=$F0, + SHSHAKE_BITS=15, + SPARITY_NONE=0, + SPARITY_EVEN=1, + SPARITY_ODD=2, + SPARITY_MARK=3, + SPARITY_SPACE=4, + SHSHAKE_XON=0, + SHSHAKE_RTS=1, + SHSHAKE_NONE=2, + CORRECT_RED=1, + CORRECT_GREEN=2, + CORRECT_BLUE=4, + CENTER_IMAGE=8, + IGNORE_DIMENSIONS=0, + BOUNDED_DIMENSIONS=16, + ABSOLUTE_DIMENSIONS=$20, + PIXEL_DIMENSIONS=$40, + MULTIPLY_DIMENSIONS=$80, + INTEGER_SCALING=$100, + ORDERED_DITHERING=0, + HALFTONE_DITHERING=$200, + FLOYD_DITHERING=$400, + ANTI_ALIAS=$800, + GREY_SCALE2=$1000, + CORRECT_RGB_MASK=7, + DIMENSIONS_MASK=$F0, + DITHERING_MASK=$600 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/screens.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/screens.e new file mode 100644 index 0000000..03b6ac0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/screens.e @@ -0,0 +1,222 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes', + 'exec/tasks', + 'graphics/clip', + 'graphics/gfx', + 'graphics/layers', + 'graphics/rastport', + 'graphics/text', + 'graphics/view', + 'intuition/intuition', + 'utility/tagitem' + +CONST DRI_VERSION=2 + +OBJECT drawinfo + version:INT -> This is unsigned + numpens:INT -> This is unsigned + pens:PTR TO INT -> Target is unsigned + font:PTR TO textfont + depth:INT -> This is unsigned + resolutionx:INT -> This is unsigned + resolutiony:INT -> This is unsigned + flags:LONG + checkmark:PTR TO image + amigakey:PTR TO image + longreserved[5]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST DRIF_NEWLOOK=1, + DRIB_NEWLOOK=0, + DETAILPEN=0, + BLOCKPEN=1, + TEXTPEN=2, + SHINEPEN=3, + SHADOWPEN=4, + FILLPEN=5, + FILLTEXTPEN=6, + BACKGROUNDPEN=7, + HIGHLIGHTTEXTPEN=8, + BARDETAILPEN=9, + BARBLOCKPEN=10, + BARTRIMPEN=11, + NUMDRIPENS=12, + PEN_C3=$FEFC, + PEN_C2=$FEFD, + PEN_C1=$FEFE, + PEN_C0=$FEFF + +OBJECT screen + nextscreen:PTR TO screen + firstwindow:PTR TO window + leftedge:INT + topedge:INT + width:INT + height:INT + mousey:INT + mousex:INT + flags:INT -> This is unsigned + title:PTR TO CHAR + defaulttitle:PTR TO CHAR + barheight:CHAR -> This is signed + barvborder:CHAR -> This is signed + barhborder:CHAR -> This is signed + menuvborder:CHAR -> This is signed + menuhborder:CHAR -> This is signed + wbortop:CHAR -> This is signed + wborleft:CHAR -> This is signed + wborright:CHAR -> This is signed + wborbottom:CHAR -> This is signed + font:PTR TO textattr + viewport:viewport + rastport:rastport + bitmap:bitmap + layerinfo:layer_info + firstgadget:PTR TO gadget + detailpen:CHAR + blockpen:CHAR + savecolor0:INT -> This is unsigned + barlayer:PTR TO layer + extdata:PTR TO CHAR + userdata:PTR TO CHAR +ENDOBJECT /* SIZEOF=346 */ + +CONST SCREENTYPE=15, + WBENCHSCREEN=1, + PUBLICSCREEN=2, + CUSTOMSCREEN=15, + SHOWTITLE=16, + BEEPING=$20, + CUSTOMBITMAP=$40, + SCREENBEHIND=$80, + SCREENQUIET=$100, + SCREENHIRES=$200, + STDSCREENHEIGHT=-1, + STDSCREENWIDTH=-1, + NS_EXTENDED=$1000, + AUTOSCROLL=$4000, + PENSHARED=$400, + SA_DUMMY=$80000020, + SA_LEFT=$80000021, + SA_TOP=$80000022, + SA_WIDTH=$80000023, + SA_HEIGHT=$80000024, + SA_DEPTH=$80000025, + SA_DETAILPEN=$80000026, + SA_BLOCKPEN=$80000027, + SA_TITLE=$80000028, + SA_COLORS=$80000029, + SA_ERRORCODE=$8000002A, + SA_FONT=$8000002B, + SA_SYSFONT=$8000002C, + SA_TYPE=$8000002D, + SA_BITMAP=$8000002E, + SA_PUBNAME=$8000002F, + SA_PUBSIG=$80000030, + SA_PUBTASK=$80000031, + SA_DISPLAYID=$80000032, + SA_DCLIP=$80000033, + SA_OVERSCAN=$80000034, + SA_OBSOLETE1=$80000035, + SA_SHOWTITLE=$80000036, + SA_BEHIND=$80000037, + SA_QUIET=$80000038, + SA_AUTOSCROLL=$80000039, + SA_PENS=$8000003A, + SA_FULLPALETTE=$8000003B, + SA_COLORMAPENTRIES=$8000003C, + SA_PARENT=$8000003D, + SA_DRAGGABLE=$8000003E, + SA_EXCLUSIVE=$8000003F, + SA_SHAREPENS=$80000040, + SA_BACKFILL=$80000041, + SA_INTERLEAVED=$80000042, + SA_COLORS32=$80000043, + SA_VIDEOCONTROL=$80000044, + SA_FRONTCHILD=$80000045, + SA_BACKCHILD=$80000046, + SA_LIKEWORKBENCH=$80000047, + SA_RESERVED=$80000048, + SA_MINIMIZEISG=$80000049, + OSERR_NOMONITOR=1, + OSERR_NOCHIPS=2, + OSERR_NOMEM=3, + OSERR_NOCHIPMEM=4, + OSERR_PUBNOTUNIQUE=5, + OSERR_UNKNOWNMODE=6, + OSERR_TOODEEP=7, + OSERR_ATTACHFAIL=8, + OSERR_NOTAVAILABLE=9 + +OBJECT ns + leftedge:INT + topedge:INT + width:INT + height:INT + depth:INT + detailpen:CHAR + blockpen:CHAR + viewmodes:INT -> This is unsigned + type:INT -> This is unsigned + font:PTR TO textattr + defaulttitle:PTR TO CHAR + gadgets:PTR TO gadget + custombitmap:PTR TO bitmap +ENDOBJECT /* SIZEOF=32 */ + +OBJECT extnewscreen + leftedge:INT + topedge:INT + width:INT + height:INT + depth:INT + detailpen:CHAR + blockpen:CHAR + viewmodes:INT -> This is unsigned + type:INT -> This is unsigned + font:PTR TO textattr + defaulttitle:PTR TO CHAR + gadgets:PTR TO gadget + custombitmap:PTR TO bitmap + extension:PTR TO tagitem +ENDOBJECT /* SIZEOF=36 */ + +CONST OSCAN_TEXT=1, + OSCAN_STANDARD=2, + OSCAN_MAX=3, + OSCAN_VIDEO=4 + +OBJECT pubscreennode + ln:ln + screen:PTR TO screen + flags:INT -> This is unsigned + size:INT + visitorcount:INT + sigtask:PTR TO tc + sigbit:CHAR + pad1:CHAR +ENDOBJECT /* SIZEOF=30 */ + +CONST PSNF_PRIVATE=1, + MAXPUBSCREENNAME=$8B, + SHANGHAI=1, + POPPUBSCREEN=2, + SDEPTH_TOFRONT=0, + SDEPTH_TOBACK=1, + SDEPTH_INFAMILY=2, + SDEPTH_CHILDONLY=2, + SPOS_RELATIVE=0, + SPOS_ABSOLUTE=1, + SPOS_MAKEVISIBLE=2, + SPOS_FORCEDRAG=4 + +OBJECT screenbuffer + bitmap:PTR TO bitmap + dbufinfo:PTR TO dbufinfo +ENDOBJECT /* SIZEOF=8 */ + +CONST SB_SCREEN_BITMAP=1, + SB_COPY_BITMAP=2 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/intuition/sghooks.e b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/sghooks.e new file mode 100644 index 0000000..1611d20 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/intuition/sghooks.e @@ -0,0 +1,84 @@ +OPT MODULE +OPT EXPORT + +MODULE 'devices/inputevent', + 'graphics/text', + 'intuition/cghooks', + 'intuition/intuition', + 'utility/hooks' + +OBJECT stringextend + font:PTR TO textfont + pens[2]:ARRAY + activepens[2]:ARRAY + initialmodes:LONG + edithook:PTR TO hook + workbuffer:PTR TO CHAR + reserved[4]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=36 */ + +OBJECT sgwork + gadget:PTR TO gadget + stringinfo:PTR TO stringinfo + workbuffer:PTR TO CHAR + prevbuffer:PTR TO CHAR + modes:LONG + ievent:PTR TO inputevent + code:INT -> This is unsigned + bufferpos:INT + numchars:INT + actions:LONG + longint:LONG + gadgetinfo:PTR TO gadgetinfo + editop:INT -> This is unsigned +ENDOBJECT /* SIZEOF=44 */ + +CONST EO_NOOP=1, + EO_DELBACKWARD=2, + EO_DELFORWARD=3, + EO_MOVECURSOR=4, + EO_ENTER=5, + EO_RESET=6, + EO_REPLACECHAR=7, + EO_INSERTCHAR=8, + EO_BADFORMAT=9, + EO_BIGCHANGE=10, + EO_UNDO=11, + EO_CLEAR=12, + EO_SPECIAL=13, + SGM_REPLACE=1, + SGMB_REPLACE=0, + SGMF_REPLACE=1, + SGM_FIXEDFIELD=2, + SGMB_FIXEDFIELD=1, + SGMF_FIXEDFIELD=2, + SGM_NOFILTER=4, + SGMB_NOFILTER=2, + SGMF_NOFILTER=4, + SGM_EXITHELP=$80, + SGMB_EXITHELP=7, + SGMF_EXITHELP=$80, + SGA_USE=1, + SGAB_USE=0, + SGAF_USE=1, + SGA_END=2, + SGAB_END=1, + SGAF_END=2, + SGA_BEEP=4, + SGAB_BEEP=2, + SGAF_BEEP=4, + SGA_REUSE=8, + SGAB_REUSE=3, + SGAF_REUSE=8, + SGA_REDISPLAY=16, + SGAB_REDISPLAY=4, + SGAF_REDISPLAY=16, + SGA_NEXTACTIVE=$20, + SGAB_NEXTACTIVE=5, + SGAF_NEXTACTIVE=$20, + SGA_PREVACTIVE=$40, + SGAB_PREVACTIVE=6, + SGAF_PREVACTIVE=$40, + SGH_KEY=1, + SGH_CLICK=2 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/amigaguide.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/amigaguide.e new file mode 100644 index 0000000..f229dda --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/amigaguide.e @@ -0,0 +1,156 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes', + 'exec/ports', + 'intuition/screens', + 'utility/hooks', + 'utility/tagitem' + +CONST APSH_TOOL_ID=$2AF8, + STARTUPMSGID=$2AF9, + LOGINTOOLID=$2AFA, + LOGOUTTOOLID=$2AFB, + SHUTDOWNMSGID=$2AFC, + ACTIVATETOOLID=$2AFD, + DEACTIVATETOOLID=$2AFE, + ACTIVETOOLID=$2AFF, + INACTIVETOOLID=$2B00, + TOOLSTATUSID=$2B01, + TOOLCMDID=$2B02, + TOOLCMDREPLYID=$2B03, + SHUTDOWNTOOLID=$2B04, + AGA_DUMMY=$80000000, + AGA_PATH=$80000001, + AGA_XREFLIST=$80000002, + AGA_ACTIVATE=$80000003, + AGA_CONTEXT=$80000004, + AGA_HELPGROUP=$80000005, + AGA_RESERVED1=$80000006, + AGA_RESERVED2=$80000007, + AGA_RESERVED3=$80000008, + AGA_AREXXPORT=$80000009, + AGA_AREXXPORTNAME=$8000000A, + AGA_WORKPATH=$8000000B, + AGA_WORKNODE=$8000000C + +OBJECT amigaguidemsg + msg:mn + type:LONG + data:LONG + dsize:LONG + dtype:LONG + pri_ret:LONG + sec_ret:LONG + system1:LONG + system2:LONG +ENDOBJECT /* SIZEOF=52 */ + +OBJECT newamigaguide + lock:LONG + name:PTR TO CHAR + screen:PTR TO screen + pubscreen:PTR TO CHAR + hostport:PTR TO CHAR + clientport:PTR TO CHAR + basename:PTR TO CHAR + flags:LONG + context:PTR TO LONG + node:PTR TO CHAR + line:LONG + extens:PTR TO tagitem + client:LONG +ENDOBJECT /* SIZEOF=52 */ + +CONST HTF_LOAD_INDEX=1, + HTF_LOAD_ALL=2, + HTF_CACHE_NODE=4, + HTF_CACHE_DB=8, + HTF_UNIQUE=16, + HTF_NOACTIVATE=$20, + HTFC_SYSGADS=$80000000, + HTH_OPEN=0, + HTH_CLOSE=1, + HTERR_NOT_ENOUGH_MEMORY=$64, + HTERR_CANT_OPEN_DATABASE=$65, + HTERR_CANT_FIND_NODE=$66, + HTERR_CANT_OPEN_NODE=$67, + HTERR_CANT_OPEN_WINDOW=$68, + HTERR_INVALID_COMMAND=$69, + HTERR_CANT_COMPLETE=$6A, + HTERR_PORT_CLOSED=$6B, + HTERR_CANT_CREATE_PORT=$6C, + HTERR_KEYWORD_NOT_FOUND=$71 + +OBJECT xref + node:ln + pad:INT -> This is unsigned +-> Umm, should be 'PTR TO docfile', but 'docfile' not defined + df:LONG + file:PTR TO CHAR + name:PTR TO CHAR + line:LONG +ENDOBJECT /* SIZEOF=32 */ + +CONST XR_GENERIC=0, + XR_FUNCTION=1, + XR_COMMAND=2, + XR_INCLUDE=3, + XR_MACRO=4, + XR_STRUCT=5, + XR_FIELD=6, + XR_TYPEDEF=7, + XR_DEFINE=8 + +OBJECT amigaguidehost + dispatcher:hook + reserved:LONG + flags:LONG + usecnt:LONG + systemdata:LONG + userdata:LONG +ENDOBJECT /* SIZEOF=40 */ + +CONST HM_FINDNODE=1, + HM_OPENNODE=2, + HM_CLOSENODE=3, + HM_EXPUNGE=10 + +-> Um, methodid's were all missing +OBJECT opfindhost + methodid:LONG + attrs:PTR TO tagitem + node:PTR TO CHAR + toc:PTR TO CHAR + title:PTR TO CHAR + next:PTR TO CHAR + prev:PTR TO CHAR +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT opnodeio + methodid:LONG + attrs:PTR TO tagitem + node:PTR TO CHAR + filename:PTR TO CHAR + docbuffer:PTR TO CHAR + bufflen:LONG + flags:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST HTNF_KEEP=1, + HTNF_RESERVED1=2, + HTNF_RESERVED2=4, + HTNF_ASCII=8, + HTNF_RESERVED3=16, + HTNF_CLEAN=$20, + HTNF_DONE=$40, + HTNA_DUMMY=$80000000, + HTNA_SCREEN=$80000001, + HTNA_PENS=$80000002, + HTNA_RECTANGLE=$80000003, + HTNA_HELPGROUP=$80000005 + +OBJECT opexpungenode + methodid:LONG + attrs:PTR TO tagitem +ENDOBJECT /* SIZEOF=NONE !!! */ diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/asl.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/asl.e new file mode 100644 index 0000000..83f1116 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/asl.e @@ -0,0 +1,302 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/lists', + 'exec/nodes', + 'graphics/displayinfo', + 'graphics/text', + 'workbench/startup' + +#define ASLNAME 'asl.library' + +CONST ASL_TB=$80080000, + ASL_FILEREQUEST=0, + ASL_FONTREQUEST=1, + ASL_SCREENMODEREQUEST=2 + +OBJECT filerequester + reserved0[4]:ARRAY + file:LONG + drawer:LONG + reserved1[10]:ARRAY + leftedge:INT + topedge:INT + width:INT + height:INT + reserved2[2]:ARRAY + numargs:LONG + arglist:PTR TO wbarg + userdata:LONG + reserved3[8]:ARRAY + pattern:PTR TO CHAR +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST ASLFR_WINDOW=$80080002, + ASLFR_SCREEN=$80080028, + ASLFR_PUBSCREENNAME=$80080029, + ASLFR_PRIVATEIDCMP=$8008002A, + ASLFR_INTUIMSGFUNC=$80080046, + ASLFR_SLEEPWINDOW=$8008002B, + ASLFR_USERDATA=$80080034, + ASLFR_TEXTATTR=$80080033, + ASLFR_LOCALE=$80080032, + ASLFR_TITLETEXT=$80080001, + ASLFR_POSITIVETEXT=$80080012, + ASLFR_NEGATIVETEXT=$80080013, + ASLFR_INITIALLEFTEDGE=$80080003, + ASLFR_INITIALTOPEDGE=$80080004, + ASLFR_INITIALWIDTH=$80080005, + ASLFR_INITIALHEIGHT=$80080006, + ASLFR_INITIALFILE=$80080008, + ASLFR_INITIALDRAWER=$80080009, + ASLFR_INITIALPATTERN=$8008000A, + ASLFR_FLAGS1=$80080014, + ASLFR_FLAGS2=$80080016, + ASLFR_DOSAVEMODE=$8008002C, + ASLFR_DOMULTISELECT=$8008002D, + ASLFR_DOPATTERNS=$8008002E, + ASLFR_DRAWERSONLY=$8008002F, + ASLFR_FILTERFUNC=$80080031, + ASLFR_REJECTICONS=$8008003C, + ASLFR_REJECTPATTERN=$8008003D, + ASLFR_ACCEPTPATTERN=$8008003E, + ASLFR_FILTERDRAWERS=$8008003F, + ASLFR_HOOKFUNC=$80080007, + FRF_DOWILDFUNC=$80, -> Obsolete + FRB_FILTERFUNC=7, + FRF_FILTERFUNC=$80, + FRF_DOMSGFUNC=$40, -> Obsolete + FRB_INTUIFUNC=6, + FRF_INTUIFUNC=$40, + FRB_DOSAVEMODE=5, + FRF_DOSAVEMODE=$20, + FRB_PRIVATEIDCMP=4, + FRF_PRIVATEIDCMP=16, + FRB_DOMULTISELECT=3, + FRF_DOMULTISELECT=8, + FRB_DOPATTERNS=0, + FRF_DOPATTERNS=1, + FRB_DRAWERSONLY=0, + FRF_DRAWERSONLY=1, + FRB_FILTERDRAWERS=1, + FRF_FILTERDRAWERS=2, + FRB_REJECTICONS=2, + FRF_REJECTICONS=4 + +OBJECT fontrequester + reserved0[8]:ARRAY + attr:textattr + frontpen:CHAR + backpen:CHAR + drawmode:CHAR + reserved1:CHAR + userdata:LONG + leftedge:INT + topedge:INT + width:INT + height:INT + tattr:ttextattr +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST ASLFO_WINDOW=$80080002, + ASLFO_SCREEN=$80080028, + ASLFO_PUBSCREENNAME=$80080029, + ASLFO_PRIVATEIDCMP=$8008002A, + ASLFO_INTUIMSGFUNC=$80080046, + ASLFO_SLEEPWINDOW=$8008002B, + ASLFO_USERDATA=$80080034, + ASLFO_TEXTATTR=$80080033, + ASLFO_LOCALE=$80080032, + ASLFO_TITLETEXT=$80080001, + ASLFO_POSITIVETEXT=$80080012, + ASLFO_NEGATIVETEXT=$80080013, + ASLFO_INITIALLEFTEDGE=$80080003, + ASLFO_INITIALTOPEDGE=$80080004, + ASLFO_INITIALWIDTH=$80080005, + ASLFO_INITIALHEIGHT=$80080006, + ASLFO_INITIALNAME=$8008000A, + ASLFO_INITIALSIZE=$8008000B, + ASLFO_INITIALSTYLE=$8008000C, + ASLFO_INITIALFLAGS=$8008000D, + ASLFO_INITIALFRONTPEN=$8008000E, + ASLFO_INITIALBACKPEN=$8008000F, + ASLFO_INITIALDRAWMODE=$8008003B, + ASLFO_FLAGS=$80080014, + ASLFO_DOFRONTPEN=$8008002C, + ASLFO_DOBACKPEN=$8008002D, + ASLFO_DOSTYLE=$8008002E, + ASLFO_DODRAWMODE=$8008002F, + ASLFO_FIXEDWIDTHONLY=$80080030, + ASLFO_MINHEIGHT=$80080010, + ASLFO_MAXHEIGHT=$80080011, + ASLFO_FILTERFUNC=$80080031, + ASLFO_HOOKFUNC=$80080007, + ASLFO_MODELIST=$80080015, + ASLFO_FRONTPENS=$80080040, + ASLFO_BACKPENS=$80080041, + ASLFO_MAXFRONTPEN=$80080042, + ASLFO_MAXBACKPEN=$80080043, + FOB_DOFRONTPEN=0, + FOB_DOBACKPEN=1, + FOB_DOFONTSTYLE=2, + FOB_DODRAWMODE=3, + FOB_FIXEDWIDTHONLY=4, + FOB_PRIVATEIDCMP=5, + FOB_INTUIFUNC=6, + FOB_FILTERFUNC=7, + FOF_DOFRONTPEN=1, + FOF_DOBACKPEN=2, + FOF_DOFONTSTYLE=4, + FOF_DODRAWMODE=8, + FOF_FIXEDWIDTHONLY=16, + FOF_PRIVATE=$20, -> Obsolete + FOF_PRIVATEIDCMP=$20, + FOF_DOMSGFUNC=$40, -> Obsolete + FOF_INTUIFUNC=$40, + FOF_DOWILDFUNC=$80, -> Obsolete + FOF_FILTERFUNC=$80 + +OBJECT screenmoderequester + displayid:LONG + displaywidth:LONG + displayheight:LONG + displaydepth:INT -> This is unsigned + overscantype:INT -> This is unsigned + autoscroll:INT + bitmapwidth:LONG + bitmapheight:LONG + leftedge:INT + topedge:INT + width:INT + height:INT + infoopened:INT + infoleftedge:INT + infotopedge:INT + infowidth:INT + infoheight:INT + userdata:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT displaymode + ln:ln + dimensioninfo:dimensioninfo + propertyflags:LONG +ENDOBJECT /* SIZEOF=106 */ + +CONST ASLSM_WINDOW=$80080002, + ASLSM_SCREEN=$80080028, + ASLSM_PUBSCREENNAME=$80080029, + ASLSM_PRIVATEIDCMP=$8008002A, + ASLSM_INTUIMSGFUNC=$80080046, + ASLSM_SLEEPWINDOW=$8008002B, + ASLSM_USERDATA=$80080034, + ASLSM_TEXTATTR=$80080033, + ASLSM_LOCALE=$80080032, + ASLSM_TITLETEXT=$80080001, + ASLSM_POSITIVETEXT=$80080012, + ASLSM_NEGATIVETEXT=$80080013, + ASLSM_INITIALLEFTEDGE=$80080003, + ASLSM_INITIALTOPEDGE=$80080004, + ASLSM_INITIALWIDTH=$80080005, + ASLSM_INITIALHEIGHT=$80080006, + ASLSM_INITIALDISPLAYID=$80080064, + ASLSM_INITIALDISPLAYWIDTH=$80080065, + ASLSM_INITIALDISPLAYHEIGHT=$80080066, + ASLSM_INITIALDISPLAYDEPTH=$80080067, + ASLSM_INITIALOVERSCANTYPE=$80080068, + ASLSM_INITIALAUTOSCROLL=$80080069, + ASLSM_INITIALINFOOPENED=$8008006A, + ASLSM_INITIALINFOLEFTEDGE=$8008006B, + ASLSM_INITIALINFOTOPEDGE=$8008006C, + ASLSM_DOWIDTH=$8008006D, + ASLSM_DOHEIGHT=$8008006E, + ASLSM_DODEPTH=$8008006F, + ASLSM_DOOVERSCANTYPE=$80080070, + ASLSM_DOAUTOSCROLL=$80080071, + ASLSM_PROPERTYFLAGS=$80080072, + ASLSM_PROPERTYMASK=$80080073, + ASLSM_MINWIDTH=$80080074, + ASLSM_MAXWIDTH=$80080075, + ASLSM_MINHEIGHT=$80080076, + ASLSM_MAXHEIGHT=$80080077, + ASLSM_MINDEPTH=$80080078, + ASLSM_MAXDEPTH=$80080079, + ASLSM_FILTERFUNC=$8008007A, + ASLSM_CUSTOMSMLIST=$8008007B + + -> Obsolete +CONST RF_FILE=4, + RF_DIR=8, + RF_LEFTEDGE=22, + RF_TOPEDGE=24, + RF_WIDTH=26, + RF_HEIGHT=28, + RF_NUMARGS=$20, + RF_ARGLIST=$24, + RF_USERDATA=$28, + RF_PAT=$34, + ASL_DUMMY=$80080000, + ASL_HAIL=$80080001, + ASL_WINDOW=$80080002, + ASL_LEFTEDGE=$80080003, + ASL_TOPEDGE=$80080004, + ASL_WIDTH=$80080005, + ASL_HEIGHT=$80080006, + ASL_HOOKFUNC=$80080007, + ASL_FILE=$80080008, + ASL_DIR=$80080009, + ASL_PATTERN=$8008000A, + ASL_FONTNAME=$8008000A, + ASL_FONTHEIGHT=$8008000B, + ASL_FONTSTYLES=$8008000C, + ASL_FONTFLAGS=$8008000D, + ASL_FRONTPEN=$8008000E, + ASL_BACKPEN=$8008000F, + ASL_MINHEIGHT=$80080010, + ASL_MAXHEIGHT=$80080011, + ASL_OKTEXT=$80080012, + ASL_CANCELTEXT=$80080013, + ASL_FUNCFLAGS=$80080014, + ASL_MODELIST=$80080015, + ASL_EXTFLAGS1=$80080016, + FILB_PATGAD=0, + FILB_MULTISELECT=3, + FILB_NEWIDCMP=4, + FILB_SAVE=5, + FILB_DOMSGFUNC=6, + FILB_DOWILDFUNC=7, + FILF_PATGAD=1, + FILF_MULTISELECT=8, + FILF_NEWIDCMP=16, + FILF_SAVE=$20, + FILF_DOMSGFUNC=$40, + FILF_DOWILDFUNC=$80, + FIL1B_NOFILES=0, + FIL1B_MATCHDIRS=1, + FIL1F_NOFILES=1, + FIL1F_MATCHDIRS=2, + RFF_DOWILDFUNC=$80, + RFF_DOMSGFUNC=$40, + RFF_DOCOLOR=$20, + RFF_NEWIDCMP=16, + RFF_MULTISELECT=8, + RFF_PATGAD=1, + FONB_FRONTCOLOR=0, + FONB_BACKCOLOR=1, + FONB_STYLES=2, + FONB_DRAWMODE=3, + FONB_FIXEDWIDTH=4, + FONB_NEWIDCMP=5, + FONB_DOMSGFUNC=6, + FONB_DOWILDFUNC=7, + FONF_FRONTCOLOR=1, + FONF_BACKCOLOR=2, + FONF_STYLES=4, + FONF_DRAWMODE=8, + FONF_FIXEDWIDTH=16, + FONF_NEWIDCMP=$20, + FONF_DOMSGFUNC=$40, + FONF_DOWILDFUNC=$80 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/commodities.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/commodities.e new file mode 100644 index 0000000..b7fb96e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/commodities.e @@ -0,0 +1,85 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/ports' + +#define CxFilter(d) CreateCxObj(CX_FILTER, (d), 0) +#define CxSender(port, id) CreateCxObj(CX_SEND, (port), (id)) +#define CxSignal(task, sig) CreateCxObj(CX_SIGNAL, (task), (sig)) +#define CxTranslate(ie) CreateCxObj(CX_TRANSLATE, (ie), 0) +#define CxDebug(id) CreateCxObj(CX_DEBUG, (id), 0) +#define CxCustom(action, id) CreateCxObj(CX_CUSTOM, (action), id) + +OBJECT newbroker + version:CHAR + reserve1:CHAR + name:PTR TO CHAR + title:PTR TO CHAR + descr:PTR TO CHAR + unique:INT + flags:INT + pri:CHAR -> This is signed + reserve2:CHAR + port:PTR TO mp + reservedchannel:INT +ENDOBJECT /* SIZEOF=26 */ + +CONST NB_VERSION=5, + CBD_NAMELEN=24, + CBD_TITLELEN=$28, + CBD_DESCRLEN=$28, + NBU_DUPLICATE=0, + NBU_UNIQUE=1, + NBU_NOTIFY=2, + COF_SHOW_HIDE=4, + CX_INVALID=0, + CX_FILTER=1, + CX_TYPEFILTER=2, + CX_SEND=3, + CX_SIGNAL=4, + CX_TRANSLATE=5, + CX_BROKER=6, + CX_DEBUG=7, + CX_CUSTOM=8, + CX_ZERO=9, + CXM_IEVENT=$20, + CXM_COMMAND=$40, + CXCMD_DISABLE=15, + CXCMD_ENABLE=17, + CXCMD_APPEAR=19, + CXCMD_DISAPPEAR=21, + CXCMD_KILL=23, + CXCMD_LIST_CHG=27, + CXCMD_UNIQUE=25 + +OBJECT inputxpression + version:CHAR + class:CHAR + code:INT -> This is unsigned + codemask:INT -> This is unsigned + qualifier:INT -> This is unsigned + qualmask:INT -> This is unsigned + qualsame:INT -> This is unsigned +ENDOBJECT /* SIZEOF=12 */ + +#define NULL_IX(ix) (ix::inputxpression.class=IECLASS_NULL) + +CONST IX_VERSION=2, + IXSYM_SHIFT=1, + IXSYM_CAPS=2, + IXSYM_ALT=4, + IXSYM_SHIFTMASK=3, + IXSYM_CAPSMASK=7, + IXSYM_ALTMASK=$30, + IX_NORMALQUALS=$7FFF, + CBERR_OK=0, + CBERR_SYSERR=1, + CBERR_DUP=2, + CBERR_VERSION=3, + COERR_ISNULL=1, + COERR_NULLATTACH=2, + COERR_BADFILTER=4, + COERR_BADTYPE=8 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/configregs.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/configregs.e new file mode 100644 index 0000000..ad99a3f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/configregs.e @@ -0,0 +1,114 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +OBJECT expansionrom + type:CHAR + product:CHAR + flags:CHAR + reserved03:CHAR + manufacturer:INT -> This is unsigned + serialnumber:LONG + initdiagvec:INT -> This is unsigned + reserved0c:CHAR + reserved0d:CHAR + reserved0e:CHAR + reserved0f:CHAR +ENDOBJECT /* SIZEOF=16 */ + +OBJECT expansioncontrol + interrupt:CHAR + z3_highbase:CHAR + baseaddress:CHAR + shutup:CHAR + reserved14:CHAR + reserved15:CHAR + reserved16:CHAR + reserved17:CHAR + reserved18:CHAR + reserved19:CHAR + reserved1a:CHAR + reserved1b:CHAR + reserved1c:CHAR + reserved1d:CHAR + reserved1e:CHAR + reserved1f:CHAR +ENDOBJECT /* SIZEOF=16 */ + +CONST E_SLOTSIZE=$10000, + E_SLOTMASK=$FFFF, + E_SLOTSHIFT=16, + E_EXPANSIONBASE=$E80000, + EZ3_EXPANSIONBASE=$FF000000, + E_EXPANSIONSIZE=$80000, + E_EXPANSIONSLOTS=8, + E_MEMORYBASE=$200000, + E_MEMORYSIZE=$800000, + E_MEMORYSLOTS=$80, + EZ3_CONFIGAREA=$40000000, + EZ3_CONFIGAREAEND=$7FFFFFFF, + EZ3_SIZEGRANULARITY=$80000, + ERT_TYPEMASK=$C0, + ERT_TYPEBIT=6, + ERT_TYPESIZE=2, + ERT_NEWBOARD=$C0, + ERT_ZORROII=$C0, + ERT_ZORROIII=$80, + ERTB_MEMLIST=5, + ERTB_DIAGVALID=4, + ERTB_CHAINEDCONFIG=3, + ERTF_MEMLIST=$20, + ERTF_DIAGVALID=16, + ERTF_CHAINEDCONFIG=8, + ERT_MEMMASK=7, + ERT_MEMBIT=0, + ERT_MEMSIZE=3, + ERFB_MEMSPACE=7, + ERFB_NOSHUTUP=6, + ERFB_EXTENDED=5, + ERFB_ZORRO_III=4, + ERFF_MEMSPACE=$80, + ERFF_NOSHUTUP=$40, + ERFF_EXTENDED=$20, + ERFF_ZORRO_III=16, + ERT_Z3_SSMASK=15, + ERT_Z3_SSBIT=0, + ERT_Z3_SSSIZE=4, + ECIB_INTENA=1, + ECIB_RESET=3, + ECIB_INT2PEND=4, + ECIB_INT6PEND=5, + ECIB_INT7PEND=6, + ECIB_INTERRUPTING=7, + ECIF_INTENA=2, + ECIF_RESET=8, + ECIF_INT2PEND=16, + ECIF_INT6PEND=$20, + ECIF_INT7PEND=$40, + ECIF_INTERRUPTING=$80 + +#define ERT_MEMNEEDED(t) (IF (t) AND ERT_MEMMASK THEN Shl($10000, ((t) AND ERT_MEMMASK)-1) ELSE $800000) +#define ERT_SLOTSNEEDED(t) (IF (t) AND ERT_MEMMASK THEN Shl(1, ((t) AND ERT_MEMMASK)-1) ELSE $80) +#define EC_MEMADDR(slot) (Shl((slot), E_SLOTSHIFT)) + +OBJECT diagarea + config:CHAR + flags:CHAR + size:INT -> This is unsigned + diagpoint:INT -> This is unsigned + bootpoint:INT -> This is unsigned + name:INT -> This is unsigned + reserved01:INT + reserved02:INT +ENDOBJECT /* SIZEOF=14 */ + +CONST DAC_BUSWIDTH=$C0, + DAC_NIBBLEWIDE=0, + DAC_BYTEWIDE=$40, + DAC_WORDWIDE=$80, + DAC_BOOTTIME=$30, + DAC_NEVER=0, + DAC_CONFIGTIME=16, + DAC_BINDTIME=$20 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/configvars.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/configvars.e new file mode 100644 index 0000000..8079db2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/configvars.e @@ -0,0 +1,36 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes', + 'libraries/configregs' + +OBJECT configdev + node:ln + flags:CHAR + pad:CHAR + rom:expansionrom + boardaddr:LONG + boardsize:LONG + slotaddr:INT -> This is unsigned + slotsize:INT -> This is unsigned + driver:LONG + nextcd:PTR TO configdev + unused[4]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=68 */ + +CONST CDB_SHUTUP=0, + CDB_CONFIGME=1, + CDB_BADMEMORY=2, + CDB_PROCESSED=3, + CDF_SHUTUP=1, + CDF_CONFIGME=2, + CDF_BADMEMORY=4, + CDF_PROCESSED=8 + +OBJECT currentbinding + configdev:PTR TO configdev + filename:PTR TO CHAR + productstring:PTR TO CHAR + tooltypes:PTR TO LONG +ENDOBJECT /* SIZEOF=16 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/diskfont.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/diskfont.e new file mode 100644 index 0000000..5d10156 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/diskfont.e @@ -0,0 +1,71 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes', + 'graphics/text' + +CONST MAXFONTPATH=$100 + +OBJECT fc + filename[$100]:ARRAY + ysize:INT -> This is unsigned + style:CHAR + flags:CHAR +ENDOBJECT /* SIZEOF=260 */ + +OBJECT tfc + filename[$fe]:ARRAY + tagcount:INT -> This is unsigned + ysize:INT -> This is unsigned + style:CHAR + flags:CHAR +ENDOBJECT /* SIZEOF=260 */ + +CONST FCH_ID=$F00, + TFCH_ID=$F02, + OFCH_ID=$F03 + +OBJECT fch + fileid:INT -> This is unsigned + numentries:INT -> This is unsigned +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST DFH_ID=$F80, + MAXFONTNAME=$20 + +OBJECT diskfontheader + df:ln + fileid:INT -> This is unsigned + revision:INT -> This is unsigned + segment:LONG + name[$20]:ARRAY + tf:textfont +ENDOBJECT /* SIZEOF=106 */ + +CONST DFH_TAGLIST=18, + AFB_MEMORY=0, + AFF_MEMORY=1, + AFB_DISK=1, + AFF_DISK=2, + AFB_SCALED=2, + AFF_SCALED=4, + AFB_BITMAP=3, + AFF_BITMAP=8, + AFB_TAGGED=16, + AFF_TAGGED=$10000, + AFF_TTATTR=$10000 + +OBJECT af + type:INT -> This is unsigned + attr:textattr +ENDOBJECT /* SIZEOF=10 */ + +OBJECT taf + type:INT -> This is unsigned + attr:ttextattr +ENDOBJECT /* SIZEOF=14 */ + +OBJECT afh + numentries:INT -> This is unsigned +ENDOBJECT /* SIZEOF=NONE !!! */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/expansion.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/expansion.e new file mode 100644 index 0000000..5d83b3b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/expansion.e @@ -0,0 +1,10 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +#define EXPANSIONNAME 'expansion.library' + +CONST ADNB_STARTPROC=0, + ADNF_STARTPROC=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/expansionbase.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/expansionbase.e new file mode 100644 index 0000000..5a36da0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/expansionbase.e @@ -0,0 +1,48 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/libraries', + 'exec/lists', + 'exec/nodes', + 'libraries/configvars' + +OBJECT bootnode + ln:ln + flags:INT + devicenode:LONG +ENDOBJECT /* SIZEOF=20 */ + +OBJECT expansionbase + lib:lib + flags:CHAR + private01:CHAR + private02:LONG + private03:LONG + private04:currentbinding + private05:lh + mountlist:lh +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST EE_OK=0, + EE_LASTBOARD=$28, + EE_NOEXPANSION=$29, + EE_NOMEMORY=$2A, + EE_NOBOARD=$2B, + EE_BADMEM=$2C, + EBB_CLOGGED=0, + EBF_CLOGGED=1, + EBB_SHORTMEM=1, + EBF_SHORTMEM=2, + EBB_BADMEM=2, + EBF_BADMEM=4, + EBB_DOSFLAG=3, + EBF_DOSFLAG=8, + EBB_KICKBACK33=4, + EBF_KICKBACK33=16, + EBB_KICKBACK36=5, + EBF_KICKBACK36=$20, + EBB_SILENTSTART=6, + EBF_SILENTSTART=$40, + EBB_START_CC0=7, + EBF_START_CC0=$80 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/gadtools.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/gadtools.e new file mode 100644 index 0000000..e402b6b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/gadtools.e @@ -0,0 +1,201 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'graphics/gfx', + 'graphics/rastport', + 'graphics/text', + 'intuition/screens' + +CONST GENERIC_KIND=0, + BUTTON_KIND=1, + CHECKBOX_KIND=2, + INTEGER_KIND=3, + LISTVIEW_KIND=4, + MX_KIND=5, + NUMBER_KIND=6, + CYCLE_KIND=7, + PALETTE_KIND=8, + SCROLLER_KIND=9, + SLIDER_KIND=11, + STRING_KIND=12, + TEXT_KIND=13, + NUM_KINDS=14, + ARROWIDCMP=$400068, + BUTTONIDCMP=$40, + CHECKBOXIDCMP=$40, + INTEGERIDCMP=$40, + LISTVIEWIDCMP=$400078, + MXIDCMP=$20, + NUMBERIDCMP=0, + CYCLEIDCMP=$40, + PALETTEIDCMP=$40, + SCROLLERIDCMP=$70, + SLIDERIDCMP=$70, + STRINGIDCMP=$40, + TEXTIDCMP=0 + +OBJECT newgadget + leftedge:INT + topedge:INT + width:INT + height:INT + gadgettext:PTR TO CHAR + textattr:PTR TO textattr + gadgetid:INT -> This is unsigned + flags:LONG + visualinfo:LONG + userdata:LONG +ENDOBJECT /* SIZEOF=30 */ + +CONST PLACETEXT_LEFT=1, + PLACETEXT_RIGHT=2, + PLACETEXT_ABOVE=4, + PLACETEXT_BELOW=8, + PLACETEXT_IN=16, + NG_HIGHLABEL=$20 + +OBJECT newmenu + type:CHAR + pad:CHAR + label:PTR TO CHAR + commkey:PTR TO CHAR + flags:INT -> This is unsigned + mutualexclude:LONG + userdata:LONG +ENDOBJECT /* SIZEOF=20 */ + +#define GTMENU_USERDATA(m) (Long((m)+SIZEOF menu)) +#define GTMENUITEM_USERDATA(mi) (Long((mi)+SIZEOF menuitem)) +#define MENU_USERDATA(mi) (GTMENUITEM_USERDATA(mi)) + +CONST MENU_IMAGE=$80, + NM_TITLE=1, + NM_ITEM=2, + NM_SUB=3, + IM_ITEM=$82, + IM_SUB=$83, + NM_END=0, + NM_IGNORE=$40, + NM_BARLABEL=-1, + NM_MENUDISABLED=1, + NM_ITEMDISABLED=16, + NM_COMMANDSTRING=4, + NM_FLAGMASK=$FFFFFF39, + NM_FLAGMASK_V39=$FFFFFF3D, + GTMENU_TRIMMED=1, + GTMENU_INVALID=2, + GTMENU_NOMEM=3, + MX_WIDTH=17, + MX_HEIGHT=9, + CHECKBOX_WIDTH=26, + CHECKBOX_HEIGHT=11, + GT_TAGBASE=$80080000, + GTVI_NEWWINDOW=$80080001, + GTVI_NWTAGS=$80080002, + GT_PRIVATE0=$80080003, + GTCB_CHECKED=$80080004, + GTLV_TOP=$80080005, + GTLV_LABELS=$80080006, + GTLV_READONLY=$80080007, + GTLV_SCROLLWIDTH=$80080008, + GTMX_LABELS=$80080009, + GTMX_ACTIVE=$8008000A, + GTTX_TEXT=$8008000B, + GTTX_COPYTEXT=$8008000C, + GTNM_NUMBER=$8008000D, + GTCY_LABELS=$8008000E, + GTCY_ACTIVE=$8008000F, + GTPA_DEPTH=$80080010, + GTPA_COLOR=$80080011, + GTPA_COLOROFFSET=$80080012, + GTPA_INDICATORWIDTH=$80080013, + GTPA_INDICATORHEIGHT=$80080014, + GTSC_TOP=$80080015, + GTSC_TOTAL=$80080016, + GTSC_VISIBLE=$80080017, + GTSC_OVERLAP=$80080018, + GTSL_MIN=$80080026, + GTSL_MAX=$80080027, + GTSL_LEVEL=$80080028, + GTSL_MAXLEVELLEN=$80080029, + GTSL_LEVELFORMAT=$8008002A, + GTSL_LEVELPLACE=$8008002B, + GTSL_DISPFUNC=$8008002C, + GTST_STRING=$8008002D, + GTST_MAXCHARS=$8008002E, + GTIN_NUMBER=$8008002F, + GTIN_MAXCHARS=$80080030, + GTMN_TEXTATTR=$80080031, + GTMN_FRONTPEN=$80080032, + GTBB_RECESSED=$80080033, + GT_VISUALINFO=$80080034, + GTLV_SHOWSELECTED=$80080035, + GTLV_SELECTED=$80080036, + GT_RESERVED1=$80080038, + GTTX_BORDER=$80080039, + GTNM_BORDER=$8008003A, + GTSC_ARROWS=$8008003B, + GTMN_MENU=$8008003C, + GTMX_SPACING=$8008003D, + GTMN_FULLMENU=$8008003E, + GTMN_SECONDARYERROR=$8008003F, + GT_UNDERSCORE=$80080040, + GTST_EDITHOOK=$80080037, + GTIN_EDITHOOK=$80080037, + GTMN_CHECKMARK=$80080041, + GTMN_AMIGAKEY=$80080042, + GTMN_NEWLOOKMENUS=$80080043, + GTCB_SCALED=$80080044, + GTMX_SCALED=$80080045, + GTPA_NUMCOLORS=$80080046, + GTMX_TITLEPLACE=$80080047, + GTTX_FRONTPEN=$80080048, + GTTX_BACKPEN=$80080049, + GTTX_JUSTIFICATION=$8008004A, + GTNM_FRONTPEN=$80080048, + GTNM_BACKPEN=$80080049, + GTNM_JUSTIFICATION=$8008004A, + GTNM_FORMAT=$8008004B, + GTNM_MAXNUMBERLEN=$8008004C, + GTBB_FRAMETYPE=$8008004D, + GTLV_MAKEVISIBLE=$8008004E, + GTLV_ITEMHEIGHT=$8008004F, + GTSL_MAXPIXELLEN=$80080050, + GTSL_JUSTIFICATION=$80080051, + GTPA_COLORTABLE=$80080052, + GTLV_CALLBACK=$80080053, + GTLV_MAXPEN=$80080054, + GTTX_CLIPPED=$80080055, + GTNM_CLIPPED=$80080055, + GT_RESERVED0=$80080037, + GTJ_LEFT=0, + GTJ_RIGHT=1, + GTJ_CENTER=2, + BBFT_BUTTON=1, + BBFT_RIDGE=2, + BBFT_ICONDROPBOX=3, + INTERWIDTH=8, + INTERHEIGHT=4, + NWAY_KIND=7, + NWAYIDCMP=$40, + GTNW_LABELS=$8008000E, + GTNW_ACTIVE=$8008000F, + GADTOOLBIT=$8000, + GADTOOLMASK=$FFFF7FFF, + LV_DRAW=$202, + LVCB_OK=0, + LVCB_UNKNOWN=1, + LVR_NORMAL=0, + LVR_SELECTED=1, + LVR_NORMALDISABLED=2, + LVR_SELECTEDDISABLED=8 + +OBJECT lvdrawmsg + methodid:LONG + rastport:PTR TO rastport + drawinfo:PTR TO drawinfo + bounds:rectangle + state:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/iffparse.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/iffparse.e new file mode 100644 index 0000000..4ed3ed4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/iffparse.e @@ -0,0 +1,100 @@ +OPT MODULE +OPT EXPORT + +MODULE 'devices/clipboard', + 'exec/nodes', + 'exec/ports' + +OBJECT iffhandle + stream:LONG + flags:LONG + depth:LONG +ENDOBJECT /* SIZEOF=12 */ + +CONST IFFF_READ=0, + IFFF_WRITE=1, + IFFF_RWBITS=1, + IFFF_FSEEK=2, + IFFF_RSEEK=4, + IFFF_RESERVED=$FFFF0000 + +OBJECT iffstreamcmd + command:LONG + buf:PTR TO CHAR + nbytes:LONG +ENDOBJECT /* SIZEOF=12 */ + +OBJECT contextnode + mln:mln + id:LONG + type:LONG + size:LONG + scan:LONG +ENDOBJECT /* SIZEOF=24 */ + +OBJECT localcontextitem + mln:mln + id:LONG + type:LONG + ident:LONG +ENDOBJECT /* SIZEOF=20 */ + +OBJECT storedproperty + size:LONG + data:LONG +ENDOBJECT /* SIZEOF=8 */ + +OBJECT collectionitem + next:PTR TO collectionitem + size:LONG + data:LONG +ENDOBJECT /* SIZEOF=12 */ + +OBJECT clipboardhandle + iocr:ioclipreq + cbport:mp + satisfyport:mp +ENDOBJECT /* SIZEOF=120 */ + +CONST IFFERR_EOF=-1, + IFFERR_EOC=-2, + IFFERR_NOSCOPE=-3, + IFFERR_NOMEM=-4, + IFFERR_READ=-5, + IFFERR_WRITE=-6, + IFFERR_SEEK=-7, + IFFERR_MANGLED=-8, + IFFERR_SYNTAX=-9, + IFFERR_NOTIFF=-10, + IFFERR_NOHOOK=-11, + IFF_RETURN2CLIENT=-12, + ID_FORM=$464F524D, + ID_LIST=$4C495354, + ID_CAT=$43415420, + ID_PROP=$50524F50, + ID_NULL=$20202020, + IFFLCI_PROP=$70726F70, + IFFLCI_COLLECTION=$636F6C6C, + IFFLCI_ENTRYHANDLER=$656E6864, + IFFLCI_EXITHANDLER=$65786864, + IFFPARSE_SCAN=0, + IFFPARSE_STEP=1, + IFFPARSE_RAWSTEP=2, + IFFSLI_ROOT=1, + IFFSLI_TOP=2, + IFFSLI_PROP=3, + IFFSIZE_UNKNOWN=-1, + IFFCMD_INIT=0, + IFFCMD_CLEANUP=1, + IFFCMD_READ=2, + IFFCMD_WRITE=3, + IFFCMD_SEEK=4, + IFFCMD_ENTRY=5, + IFFCMD_EXIT=6, + IFFCMD_PURGELCI=7, + IFFSCC_INIT=0, + IFFSCC_CLEANUP=1, + IFFSCC_READ=2, + IFFSCC_WRITE=3, + IFFSCC_SEEK=4 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/locale.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/locale.e new file mode 100644 index 0000000..d6b6149 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/locale.e @@ -0,0 +1,147 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/libraries', + 'exec/nodes' + +CONST DAY_1=1, + DAY_2=2, + DAY_3=3, + DAY_4=4, + DAY_5=5, + DAY_6=6, + DAY_7=7, + ABDAY_1=8, + ABDAY_2=9, + ABDAY_3=10, + ABDAY_4=11, + ABDAY_5=12, + ABDAY_6=13, + ABDAY_7=14, + MON_1=15, + MON_2=16, + MON_3=17, + MON_4=18, + MON_5=19, + MON_6=20, + MON_7=21, + MON_8=22, + MON_9=23, + MON_10=24, + MON_11=25, + MON_12=26, + ABMON_1=27, + ABMON_2=28, + ABMON_3=29, + ABMON_4=30, + ABMON_5=31, + ABMON_6=$20, + ABMON_7=$21, + ABMON_8=$22, + ABMON_9=$23, + ABMON_10=$24, + ABMON_11=$25, + ABMON_12=$26, + YESSTR=$27, + NOSTR=$28, + AM_STR=$29, + PM_STR=$2A, + SOFTHYPHEN=$2B, + HARDHYPHEN=$2C, + OPENQUOTE=$2D, + CLOSEQUOTE=$2E, + YESTERDAYSTR=$2F, + TODAYSTR=$30, + TOMORROWSTR=$31, + FUTURESTR=$32, + MAXSTRMSG=$33 + +OBJECT localebase + lib:lib + syspatches:INT +ENDOBJECT /* SIZEOF=NONE !!! */ + +OBJECT locale + localename:PTR TO CHAR + languagename:PTR TO CHAR + preflanguages[10]:ARRAY OF LONG + flags:LONG + codeset:LONG + countrycode:LONG + telephonecode:LONG + gmtoffset:LONG + measuringsystem:CHAR + calendartype:CHAR + reserved0[2]:ARRAY + datetimeformat:PTR TO CHAR + dateformat:PTR TO CHAR + timeformat:PTR TO CHAR + shortdatetimeformat:PTR TO CHAR + shortdateformat:PTR TO CHAR + shorttimeformat:PTR TO CHAR + decimalpoint:PTR TO CHAR + groupseparator:PTR TO CHAR + fracgroupseparator:PTR TO CHAR + grouping:PTR TO CHAR + fracgrouping:PTR TO CHAR + mondecimalpoint:PTR TO CHAR + mongroupseparator:PTR TO CHAR + monfracgroupseparator:PTR TO CHAR + mongrouping:PTR TO CHAR + monfracgrouping:PTR TO CHAR + monfracdigits:CHAR + monintfracdigits:CHAR + reserved1[2]:ARRAY + moncs:PTR TO CHAR + monsmallcs:PTR TO CHAR + monintcs:PTR TO CHAR + monpositivesign:PTR TO CHAR + monpositivespacesep:CHAR + monpositivesignpos:CHAR + monpositivecspos:CHAR + reserved2:CHAR + monnegativesign:PTR TO CHAR + monnegativespacesep:CHAR + monnegativesignpos:CHAR + monnegativecspos:CHAR + reserved3:CHAR +ENDOBJECT /* SIZEOF=168 */ + +CONST MS_ISO=0, + MS_AMERICAN=1, + MS_IMPERIAL=2, + MS_BRITISH=3, + CT_7SUN=0, + CT_7MON=1, + CT_7TUE=2, + CT_7WED=3, + CT_7THU=4, + CT_7FRI=5, + CT_7SAT=6, + SS_NOSPACE=0, + SS_SPACE=1, + SP_PARENS=0, + SP_PREC_ALL=1, + SP_SUCC_ALL=2, + SP_PREC_CURR=3, + SP_SUCC_CURR=4, + CSP_PRECEDES=0, + CSP_SUCCEEDS=1, + OC_TAGBASE=$80090000, + OC_BUILTINLANGUAGE=$80090001, + OC_BUILTINCODESET=$80090002, + OC_VERSION=$80090003, + OC_LANGUAGE=$80090004, + SC_ASCII=0, + SC_COLLATE1=1, + SC_COLLATE2=2 + +OBJECT catalog + ln:ln + pad:INT + language:PTR TO CHAR + codeset:LONG + version:INT -> This is unsigned + revision:INT -> This is unsigned +ENDOBJECT /* SIZEOF=28 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/lowlevel.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/lowlevel.e new file mode 100644 index 0000000..1e627fa --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/lowlevel.e @@ -0,0 +1,161 @@ +OPT MODULE +OPT EXPORT + +OBJECT keyquery + keycode:INT -> This is unsigned + pressed:INT -> This is unsigned +ENDOBJECT + +CONST LLKF_LSHIFT=$10000, + LLKF_RSHIFT=$20000, + LLKF_CAPSLOCK=$40000, + LLKF_CONTROL=$80000, + LLKF_LALT=$100000, + LLKF_RALT=$200000, + LLKF_LAMIGA=$400000, + LLKF_RAMIGA=$800000, + LLKB_LSHIFT=16, + LLKB_RSHIFT=17, + LLKB_CAPSLOCK=18, + LLKB_CONTROL=19, + LLKB_LALT=20, + LLKB_RALT=21, + LLKB_LAMIGA=22, + LLKB_RAMIGA=23, + SJA_DUMMY=$80C00100, + SJA_TYPE=$80C00101, + SJA_REINITIALIZE=$80C00102, + SJA_TYPE_AUTOSENSE=0, + SJA_TYPE_GAMECTLR=1, + SJA_TYPE_MOUSE=2, + SJA_TYPE_JOYSTK=3, + JP_TYPE_NOTAVAIL=0, + JP_TYPE_GAMECTLR=$10000000, + JP_TYPE_MOUSE=$20000000, + JP_TYPE_JOYSTK=$30000000, + JP_TYPE_UNKNOWN=$40000000, + JP_TYPE_MASK=$F0000000, + JPF_BUTTON_BLUE=$800000, + JPF_BUTTON_RED=$400000, + JPF_BUTTON_YELLOW=$200000, + JPF_BUTTON_GREEN=$100000, + JPF_BUTTON_FORWARD=$80000, + JPF_BUTTON_REVERSE=$40000, + JPF_BUTTON_PLAY=$20000, + JPB_BUTTON_BLUE=23, + JPB_BUTTON_RED=22, + JPB_BUTTON_YELLOW=21, + JPB_BUTTON_GREEN=20, + JPB_BUTTON_FORWARD=19, + JPB_BUTTON_REVERSE=18, + JPB_BUTTON_PLAY=17, + JP_BUTTON_MASK=$FE0000, + JPF_JOY_UP=8, + JPF_JOY_DOWN=4, + JPF_JOY_LEFT=2, + JPF_JOY_RIGHT=1, + JPB_JOY_UP=3, + JPB_JOY_DOWN=2, + JPB_JOY_LEFT=1, + JPB_JOY_RIGHT=0, + JP_DIRECTION_MASK=15, + JP_MHORZ_MASK=$FF, + JP_MVERT_MASK=$FF00, + JP_MOUSE_MASK=$FFFF, + JPB_BTN1=23, + JPF_BTN1=$800000, + JPB_BTN2=22, + JPF_BTN2=$400000, + JPB_BTN3=21, + JPF_BTN3=$200000, + JPB_BTN4=20, + JPF_BTN4=$100000, + JPB_BTN5=19, + JPF_BTN5=$80000, + JPB_BTN6=18, + JPF_BTN6=$40000, + JPB_BTN7=17, + JPF_BTN7=$20000, + JPB_UP=3, + JPF_UP=8, + JPB_DOWN=2, + JPF_DOWN=4, + JPB_LEFT=1, + JPF_LEFT=2, + JPB_RIGHT=0, + JPF_RIGHT=1, + SCON_DUMMY=$80C00000, + SCON_DUMMY=$80C00000, + SCON_TAKEOVERSYS=$80C00000, + SCON_KILLREQ=$80C00001, + SCON_CDREBOOT=$80C00002, + SCON_STOPINPUT=$80C00003, + SCON_ADDCREATEKEYS=$80C00004, + SCON_REMCREATEKEYS=$80C00005, + CDREBOOT_ON=1, + CDREBOOT_OFF=0, + CDREBOOT_DEFAULT=2, + RAWKEY_PORT0_BUTTON_BLUE=$72, + RAWKEY_PORT0_BUTTON_RED=$78, + RAWKEY_PORT0_BUTTON_YELLOW=$77, + RAWKEY_PORT0_BUTTON_GREEN=$76, + RAWKEY_PORT0_BUTTON_FORWARD=$75, + RAWKEY_PORT0_BUTTON_REVERSE=$74, + RAWKEY_PORT0_BUTTON_PLAY=$73, + RAWKEY_PORT0_JOY_UP=$79, + RAWKEY_PORT0_JOY_DOWN=$7A, + RAWKEY_PORT0_JOY_LEFT=$7C, + RAWKEY_PORT0_JOY_RIGHT=$7B, + RAWKEY_PORT1_BUTTON_BLUE=$172, + RAWKEY_PORT1_BUTTON_RED=$178, + RAWKEY_PORT1_BUTTON_YELLOW=$177, + RAWKEY_PORT1_BUTTON_GREEN=$176, + RAWKEY_PORT1_BUTTON_FORWARD=$175, + RAWKEY_PORT1_BUTTON_REVERSE=$174, + RAWKEY_PORT1_BUTTON_PLAY=$173, + RAWKEY_PORT1_JOY_UP=$179, + RAWKEY_PORT1_JOY_DOWN=$17A, + RAWKEY_PORT1_JOY_LEFT=$17C, + RAWKEY_PORT1_JOY_RIGHT=$17B, + RAWKEY_PORT2_BUTTON_BLUE=$272, + RAWKEY_PORT2_BUTTON_RED=$278, + RAWKEY_PORT2_BUTTON_YELLOW=$277, + RAWKEY_PORT2_BUTTON_GREEN=$276, + RAWKEY_PORT2_BUTTON_FORWARD=$275, + RAWKEY_PORT2_BUTTON_REVERSE=$274, + RAWKEY_PORT2_BUTTON_PLAY=$273, + RAWKEY_PORT2_JOY_UP=$279, + RAWKEY_PORT2_JOY_DOWN=$27A, + RAWKEY_PORT2_JOY_LEFT=$27C, + RAWKEY_PORT2_JOY_RIGHT=$27B, + RAWKEY_PORT3_BUTTON_BLUE=$372, + RAWKEY_PORT3_BUTTON_RED=$378, + RAWKEY_PORT3_BUTTON_YELLOW=$377, + RAWKEY_PORT3_BUTTON_GREEN=$376, + RAWKEY_PORT3_BUTTON_FORWARD=$375, + RAWKEY_PORT3_BUTTON_REVERSE=$374, + RAWKEY_PORT3_BUTTON_PLAY=$373, + RAWKEY_PORT3_JOY_UP=$379, + RAWKEY_PORT3_JOY_DOWN=$37A, + RAWKEY_PORT3_JOY_LEFT=$37C, + RAWKEY_PORT3_JOY_RIGHT=$37B, + LANG_UNKNOWN=0, + LANG_AMERICAN=1, + LANG_ENGLISH=2, + LANG_GERMAN=3, + LANG_FRENCH=4, + LANG_SPANISH=5, + LANG_ITALIAN=6, + LANG_PORTUGUESE=7, + LANG_DANISH=8, + LANG_DUTCH=9, + LANG_NORWEGIAN=10, + LANG_FINNISH=11, + LANG_SWEDISH=12, + LANG_JAPANESE=13, + LANG_CHINESE=14, + LANG_ARABIC=15, + LANG_GREEK=16, + LANG_HEBREW=17, + LANG_KOREAN=18 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/mathieeesp.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/mathieeesp.e new file mode 100644 index 0000000..ca0b384 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/mathieeesp.e @@ -0,0 +1,21 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +#define PI (3.14159265) +#define TWO_PI (!2*PI) +#define PI2 (!PI/2) +#define PI4 (!PI/4) + +#define E (2.71828183) + +#define LOG10 (2.30258509) +#define FPTEN (10.0) +#define FPONE (1.0) +#define FPHALF (0.5) +#define FPZERO (0.0) + +#define Trunc(x) (Ffloor(x)) +#define Round(x) (!(x)!) +#define ItoF(i) ((x)!) diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/mathlibrary.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/mathlibrary.e new file mode 100644 index 0000000..fcce0cd --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/mathlibrary.e @@ -0,0 +1,12 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/libraries' + +OBJECT mathieeebase + libnode:lib + reserved[18]:ARRAY + taskopenlib:LONG + taskcloselib:LONG +ENDOBJECT /* SIZEOF=60 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/mathresource.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/mathresource.e new file mode 100644 index 0000000..c0511cb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/mathresource.e @@ -0,0 +1,24 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes' + +OBJECT mathieeeresource + node:ln + flags:INT -> This is unsigned + baseaddr:PTR TO INT -> The target is unsigned + dblbasinit:LONG + dbltransinit:LONG + sglbasinit:LONG + sgltransinit:LONG + extbasinit:LONG + exttransinit:LONG +ENDOBJECT /* SIZEOF=44 */ + +CONST MATHIEEERESOURCEF_DBLBAS=1, + MATHIEEERESOURCEF_DBLTRANS=2, + MATHIEEERESOURCEF_SGLBAS=4, + MATHIEEERESOURCEF_SGLTRANS=8, + MATHIEEERESOURCEF_EXTBAS=16, + MATHIEEERESOURCEF_EXTTRANS=$20 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/nonvolatile.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/nonvolatile.e new file mode 100644 index 0000000..56d867b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/nonvolatile.e @@ -0,0 +1,30 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/nodes' + +OBJECT nvinfo + maxstorage:LONG + freestorage:LONG +ENDOBJECT + +OBJECT nventry + node:mln + name:PTR TO CHAR + size:LONG + protection:LONG +ENDOBJECT + +#define SizeNVData(dataptr) (Long((dataptr)-4)-4) + +CONST NVEB_DELETE=0, + NVEF_DELETE=1, + NVEB_APPNAME=31, + NVEF_APPNAME=$80000000, + NVERR_BADNAME=1, + NVERR_WRITEPROT=2, + NVERR_FAIL=3, + NVERR_FATAL=4 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/realtime.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/realtime.e new file mode 100644 index 0000000..c3f654e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/realtime.e @@ -0,0 +1,114 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/libraries', + 'exec/lists', + 'exec/nodes', + 'exec/tasks', + 'utility/hooks' + +CONST TICK_FREQ=$4B0 + +OBJECT conductor + ln:ln + reserved0:INT + players:mlh + clocktime:LONG + starttime:LONG + externaltime:LONG + maxexternaltime:LONG + metronome:LONG + reserved1:INT + flags:INT -> This is unsigned + state:CHAR +ENDOBJECT + +CONST CONDUCTF_EXTERNAL=1, + CONDUCTF_GOTTICK=2, + CONDUCTF_METROSET=4, + CONDUCTF_PRIVATE=8, + CONDUCTB_EXTERNAL=0, + CONDUCTB_GOTTICK=1, + CONDUCTB_METROSET=2, + CONDUCTB_PRIVATE=3, + CONDSTATE_STOPPED=0, + CONDSTATE_PAUSED=1, + CONDSTATE_LOCATE=2, + CONDSTATE_RUNNING=3, + CONDSTATE_METRIC=-1, + CONDSTATE_SHUTTLE=-2, + CONDSTATE_LOCATE_SET=-3 + +OBJECT player + ln:ln + reserved0:CHAR + reserved1:CHAR + hook:PTR TO hook + source:PTR TO conductor + task:PTR TO tc + metrictime:LONG + alarmtime:LONG + userdata:LONG + playerid:INT -> This is unsigned + flags:INT -> This is unsigned +ENDOBJECT + +CONST PLAYERF_READY=1, + PLAYERF_ALARMSET=2, + PLAYERF_QUIET=4, + PLAYERF_CONDUCTED=8, + PLAYERF_EXTSYNC=16, + PLAYERB_READY=0, + PLAYERB_ALARMSET=1, + PLAYERB_QUIET=2, + PLAYERB_CONDUCTED=3, + PLAYERB_EXTSYNC=4, + PLAYER_BASE=$80000040, + PLAYER_HOOK=$80000041, + PLAYER_NAME=$80000042, + PLAYER_PRIORITY=$80000043, + PLAYER_CONDUCTOR=$80000044, + PLAYER_READY=$80000045, + PLAYER_ALARMTIME=$8000004c, + PLAYER_ALARM=$8000004d, + PLAYER_ALARMSIGTASK=$80000046, + PLAYER_ALARMSIGBIT=$80000048, + PLAYER_CONDUCTED=$80000047, + PLAYER_QUIET=$80000049, + PLAYER_USERDATA=$8000004A, + PLAYER_ID=$8000004B, + PLAYER_EXTSYNC=$8000004E, + PLAYER_ERRORCODE=$8000004F, + PM_TICK=0, + PM_STATE=1, + PM_POSITION=2, + PM_SHUTTLE=3 + +OBJECT pmtime + method:LONG + time:LONG +ENDOBJECT + +OBJECT pmstate + method:LONG + oldstate:LONG +ENDOBJECT + +CONST RT_CONDUCTORS=0, + RTE_NOMEMORY=$321, + RTE_NOCONDUCTOR=$322, + RTE_NOTIMER=$323, + RTE_PLAYING=$324 + +OBJECT realtimebase + lib:lib + reserved0[2]:ARRAY + time:LONG + timefrac:LONG + reserved1:INT + tickerr:INT +ENDOBJECT + +CONST REALTIME_TICKERR_MIN=-$2C1, + REALTIME_TICKERR_MAX=$2C1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/libraries/translator.e b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/translator.e new file mode 100644 index 0000000..6e8a3b4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/libraries/translator.e @@ -0,0 +1,7 @@ +OPT MODULE +OPT EXPORT + +CONST TR_NOTUSED=-1, + TR_NOMEM=-2, + TR_MAKEBAD=-4 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/font.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/font.e new file mode 100644 index 0000000..34f5376 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/font.e @@ -0,0 +1,23 @@ +OPT MODULE +OPT EXPORT + +MODULE 'graphics/text' + +CONST ID_FONT=$464F4E54, + FONTNAMESIZE=$80 + +OBJECT fontprefs + reserved[3]:ARRAY OF LONG + reserved2:INT + type:INT -> This is unsigned + frontpen:CHAR + backpen:CHAR + drawmode:CHAR + textattr:textattr + name[$80]:ARRAY +ENDOBJECT /* SIZEOF=155 */ + +CONST FP_WBFONT=0, + FP_SYSFONT=1, + FP_SCREENFONT=2 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/icontrol.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/icontrol.e new file mode 100644 index 0000000..8d885ef --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/icontrol.e @@ -0,0 +1,27 @@ +OPT MODULE +OPT EXPORT + +CONST ID_ICTL=$4943544C + +OBJECT icontrolprefs + reserved[4]:ARRAY OF LONG + timeout:INT -> This is unsigned + metadrag:INT + flags:LONG + wbtofront:CHAR + fronttoback:CHAR + reqtrue:CHAR + reqfalse:CHAR +ENDOBJECT /* SIZEOF=28 */ + +CONST ICB_COERCE_COLORS=0, + ICB_COERCE_LACE=1, + ICB_STRGAD_FILTER=2, + ICB_MENUSNAP=3, + ICB_MODEPROMOTE=4, + ICF_COERCE_COLORS=1, + ICF_COERCE_LACE=2, + ICF_STRGAD_FILTER=4, + ICF_MENUSNAP=8, + ICF_MODEPROMOTE=16 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/input.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/input.e new file mode 100644 index 0000000..4bf8fa7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/input.e @@ -0,0 +1,16 @@ +OPT MODULE +OPT EXPORT + +MODULE 'devices/timer' + +CONST ID_INPT=$494E5054 + +OBJECT inputprefs + keymap[16]:ARRAY + pointerticks:INT -> This is unsigned + doubleclick:timeval + keyrptdelay:timeval + keyrptspeed:timeval + mouseaccel:INT +ENDOBJECT /* SIZEOF=44 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/locale.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/locale.e new file mode 100644 index 0000000..ab5c294 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/locale.e @@ -0,0 +1,53 @@ +OPT MODULE +OPT EXPORT + +CONST ID_LCLE=$4C434C45, + ID_CTRY=$43545259 + +OBJECT countryprefs + reserved[4]:ARRAY OF LONG + countrycode:LONG + telephonecode:LONG + measuringsystem:CHAR +-> Um, have to fiddle alignment in .m file + datetimeformat[80]:ARRAY + dateformat[40]:ARRAY + timeformat[40]:ARRAY + shortdatetimeformat[80]:ARRAY + shortdateformat[40]:ARRAY + shorttimeformat[40]:ARRAY + decimalpoint[10]:ARRAY + groupseparator[10]:ARRAY + fracgroupseparator[10]:ARRAY + grouping[10]:ARRAY + fracgrouping[10]:ARRAY + mondecimalpoint[10]:ARRAY + mongroupseparator[10]:ARRAY + monfracgroupseparator[10]:ARRAY + mongrouping[10]:ARRAY + monfracgrouping[10]:ARRAY + monfracdigits:CHAR + monintfracdigits:CHAR + moncs[10]:ARRAY + monsmallcs[10]:ARRAY + monintcs[10]:ARRAY + monpositivesign[10]:ARRAY + monpositivespacesep:CHAR + monpositivesignpos:CHAR + monpositivecspos:CHAR +-> Um, have to fiddle alignment in .m file + monnegativesign[10]:ARRAY + monnegativespacesep:CHAR + monnegativesignpos:CHAR + monnegativecspos:CHAR + calendartype:CHAR +ENDOBJECT /* SIZEOF=504 */ + +OBJECT localeprefs + reserved[4]:ARRAY OF LONG + countryname[32]:ARRAY + preferredlanguages[300]:ARRAY + gmtoffset:LONG + flags:LONG + countrydata:countryprefs +ENDOBJECT /* SIZEOF=860 */ diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/overscan.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/overscan.e new file mode 100644 index 0000000..6159e62 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/overscan.e @@ -0,0 +1,21 @@ +OPT MODULE +OPT EXPORT + +MODULE 'graphics/gfx' + +CONST ID_OSCN=$4F53434E, + OSCAN_MAGIC=$FEDCBA89 + +OBJECT overscanprefs + reserved:LONG + magic:LONG + hstart:INT -> This is unsigned + hstop:INT -> This is unsigned + vstart:INT -> This is unsigned + vstop:INT -> This is unsigned + displayid:LONG + viewpos:tpoint + text:tpoint + standard:rectangle +ENDOBJECT /* SIZEOF=36 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/palette.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/palette.e new file mode 100644 index 0000000..a8707ec --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/palette.e @@ -0,0 +1,15 @@ +OPT MODULE +OPT EXPORT + +MODULE 'intuition/intuition' + +CONST ID_PALT=$50414C54 + +OBJECT paletteprefs + reserved[4]:ARRAY OF LONG +-> Um, these had illegal names + x4colorpens[32]:ARRAY OF INT + x8colorpens[32]:ARRAY OF INT + colors[32]:ARRAY OF colorspec +ENDOBJECT /* SIZEOF=400 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/pointer.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/pointer.e new file mode 100644 index 0000000..54891d7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/pointer.e @@ -0,0 +1,25 @@ +OPT MODULE +OPT EXPORT + +CONST ID_PNTR=$504E5452 + +OBJECT pointerprefs +-> Um, this was wrong + reserved[4]:ARRAY OF LONG + which:INT -> This is unsigned + size:INT -> This is unsigned + width:INT -> This is unsigned + ieight:INT -> This is unsigned + depth:INT -> This is unsigned + ysize:INT -> This is unsigned + x:INT -> This is unsigned +ENDOBJECT /* SIZEOF=18 */ + +CONST WBP_NORMAL=0, + WBP_BUSY=1 + +OBJECT rgbtable + red:CHAR + green:CHAR + blue:CHAR +ENDOBJECT /* SIZEOF=3 */ diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/prefhdr.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/prefhdr.e new file mode 100644 index 0000000..23a9e5b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/prefhdr.e @@ -0,0 +1,12 @@ +OPT MODULE +OPT EXPORT + +CONST ID_PREF=$50524546, + ID_PRHD=$50524844 + +OBJECT prefheader + version:CHAR + type:CHAR + flags:LONG +ENDOBJECT /* SIZEOF=6 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/printergfx.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/printergfx.e new file mode 100644 index 0000000..e18e08e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/printergfx.e @@ -0,0 +1,50 @@ +OPT MODULE +OPT EXPORT + +CONST ID_PGFX=$50474658 + +OBJECT printergfxprefs + reserved[4]:ARRAY OF LONG + aspect:INT -> This is unsigned + shade:INT -> This is unsigned + image:INT -> This is unsigned + threshold:INT + colorcorrect:CHAR + dimensions:CHAR + dithering:CHAR + graphicflags:INT -> This is unsigned + printdensity:CHAR + printmaxwidth:INT -> This is unsigned + printmaxheight:INT -> This is unsigned + printxoffset:CHAR + printyoffset:CHAR +ENDOBJECT /* SIZEOF=36 */ + +CONST PA_HORIZONTAL=0, + PA_VERTICAL=1, + PS_BW=0, + PS_GREYSCALE=1, + PS_COLOR=2, + PS_GREY_SCALE2=3, + PI_POSITIVE=0, + PI_NEGATIVE=1, + PCCB_RED=0, + PCCB_GREEN=1, + PCCB_BLUE=2, + PCCF_RED=1, + PCCF_GREEN=2, + PCCF_BLUE=4, + PD_IGNORE=0, + PD_BOUNDED=1, + PD_ABSOLUTE=2, + PD_PIXEL=3, + PD_MULTIPLY=4, + PD_ORDERED=0, + PD_HALFTONE=1, + PD_FLOYD=2, + PGFB_CENTER_IMAGE=0, + PGFB_INTEGER_SCALING=1, + PGFB_ANTI_ALIAS=2, + PGFF_CENTER_IMAGE=1, + PGFF_INTEGER_SCALING=2, + PGFF_ANTI_ALIAS=4 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/printerps.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/printerps.e new file mode 100644 index 0000000..5c664d5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/printerps.e @@ -0,0 +1,92 @@ +OPT MODULE +OPT EXPORT + +CONST ID_POST=$50535044 + +OBJECT printerpsprefs + reserved[4]:ARRAY OF LONG + drivermode:CHAR + paperformat:CHAR + reserved1[2]:ARRAY + copies:LONG + paperwidth:LONG + paperheight:LONG + horizontaldpi:LONG + verticaldpi:LONG + font:CHAR + pitch:CHAR + orientation:CHAR + tab:CHAR + reserved2[8]:ARRAY + leftmargin:LONG + rightmargin:LONG + topmargin:LONG + bottommargin:LONG + fontpointsize:LONG + leading:LONG + reserved3[8]:ARRAY + leftedge:LONG + topedge:LONG + width:LONG + height:LONG + image:CHAR + shading:CHAR + dithering:CHAR + reserved4a:CHAR + reserved4[8]:ARRAY + aspect:CHAR + scalingtype:CHAR + reserved5:CHAR + centering:CHAR + reserved6[8]:ARRAY +ENDOBJECT /* SIZEOF=124 */ + +CONST DM_POSTSCRIPT=0, + DM_PASSTHROUGH=1, + PF_USLETTER=0, + PF_USLEGAL=1, + PF_A4=2, + PF_CUSTOM=3, + FONT_COURIER=0, + FONT_TIMES=1, + FONT_HELVETICA=2, + FONT_HELV_NARROW=3, + FONT_AVANTGARDE=4, + FONT_BOOKMAN=5, + FONT_NEWCENT=6, + FONT_PALATINO=7, + FONT_ZAPFCHANCERY=8, + PITCH_NORMAL=0, + PITCH_COMPRESSED=1, + PITCH_EXPANDED=2, + ORIENT_PORTRAIT=0, + ORIENT_LANDSCAPE=1, + TAB_4=0, + TAB_8=1, + TAB_QUART=2, + TAB_HALF=3, + TAB_INCH=4, + IM_POSITIVE=0, + IM_NEGATIVE=1, + SHAD_BW=0, + SHAD_GREYSCALE=1, + SHAD_COLOR=2, + DITH_DEFAULT=0, + DITH_DOTTY=1, + DITH_VERT=2, + DITH_HORIZ=3, + DITH_DIAG=4, + ASP_HORIZ=0, + ASP_VERT=1, + ST_ASPECT_ASIS=0, + ST_ASPECT_WIDE=1, + ST_ASPECT_TALL=2, + ST_ASPECT_BOTH=3, + ST_FITS_WIDE=4, + ST_FITS_TALL=5, + ST_FITS_BOTH=6, + CENT_NONE=0, + CENT_HORIZ=1, + CENT_VERT=2, + CENT_BOTH=3 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/printertxt.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/printertxt.e new file mode 100644 index 0000000..42d20d6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/printertxt.e @@ -0,0 +1,56 @@ +OPT MODULE +OPT EXPORT + +CONST ID_PTXT=$50545854, + ID_PUNT=$50554E54, + DRIVERNAMESIZE=30, + DEVICENAMESIZE=$20 + +OBJECT printertxtprefs + reserved[4]:ARRAY OF LONG + driver[30]:ARRAY + port:CHAR + papertype:INT -> This is unsigned + papersize:INT -> This is unsigned + paperlength:INT -> This is unsigned + pitch:INT -> This is unsigned + spacing:INT -> This is unsigned + leftmargin:INT -> This is unsigned + rightmargin:INT -> This is unsigned + quality:INT -> This is unsigned +ENDOBJECT /* SIZEOF=63 */ + +CONST PP_PARALLEL=0, + PP_SERIAL=1, + PT_FANFOLD=0, + PT_SINGLE=1, + PS_US_LETTER=0, + PS_US_LEGAL=1, + PS_N_TRACTOR=2, + PS_W_TRACTOR=3, + PS_CUSTOM=4, + PS_EURO_A0=5, + PS_EURO_A1=6, + PS_EURO_A2=7, + PS_EURO_A3=8, + PS_EURO_A4=9, + PS_EURO_A5=10, + PS_EURO_A6=11, + PS_EURO_A7=12, + PS_EURO_A8=13, + PP_PICA=0, + PP_ELITE=1, + PP_FINE=2, + PS_SIX_LPI=0, + PS_EIGHT_LPI=1, + PQ_DRAFT=0, + PQ_LETTER=1 + +OBJECT printerunitprefs +-> Um, this was wrong + reserved[4]:ARRAY OF LONG + unitnum:LONG + opendeviceflags:LONG + devicename[$20]:ARRAY +ENDOBJECT /* SIZEOF=44 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/screenmode.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/screenmode.e new file mode 100644 index 0000000..d42e83d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/screenmode.e @@ -0,0 +1,17 @@ +OPT MODULE +OPT EXPORT + +CONST ID_SCRM=$5343524D + +OBJECT screenmodeprefs + reserved[4]:ARRAY OF LONG + displayid:LONG + width:INT -> This is unsigned + height:INT -> This is unsigned + depth:INT -> This is unsigned + control:INT -> This is unsigned +ENDOBJECT /* SIZEOF=28 */ + +CONST SMB_AUTOSCROLL=0, + SMF_AUTOSCROLL=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/serial.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/serial.e new file mode 100644 index 0000000..52a4bef --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/serial.e @@ -0,0 +1,27 @@ +OPT MODULE +OPT EXPORT + +CONST ID_SERL=$5345524C + +OBJECT serialprefs + reserved[3]:ARRAY OF LONG + unit0map:LONG + baudrate:LONG + inputbuffer:LONG + outputbuffer:LONG + inputhandshake:CHAR + outputhandshake:CHAR + parity:CHAR + bitsperchar:CHAR + stopbits:CHAR +ENDOBJECT /* SIZEOF=33 */ + +CONST PARITY_NONE=0, + PARITY_EVEN=1, + PARITY_ODD=2, + PARITY_MARK=3, + PARITY_SPACE=4, + HSHAKE_XON=0, + HSHAKE_RTS=1, + HSHAKE_NONE=2 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/sound.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/sound.e new file mode 100644 index 0000000..c7970d0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/sound.e @@ -0,0 +1,19 @@ +OPT MODULE +OPT EXPORT + +CONST ID_SOND=$534F4E44 + +OBJECT soundprefs + reserved[4]:ARRAY OF LONG + displayqueue:INT + audioqueue:INT + audiotype:INT -> This is unsigned + audiovolume:INT -> This is unsigned + audioperiod:INT -> This is unsigned + audioduration:INT -> This is unsigned + audiofilename[256]:ARRAY +ENDOBJECT /* SIZEOF=284 */ + +CONST SPTYPE_BEEP=0, + SPTYPE_SAMPLE=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/prefs/wbpattern.e b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/wbpattern.e new file mode 100644 index 0000000..5da2097 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/prefs/wbpattern.e @@ -0,0 +1,24 @@ +OPT MODULE +OPT EXPORT + +CONST ID_PTRN=$5054524E + +OBJECT wbpatternprefs + reserved[4]:ARRAY OF LONG + which:INT -> This is unsigned + flags:INT -> This is unsigned + revision:CHAR + depth:CHAR + datalength:INT -> This is unsigned +ENDOBJECT /* SIZEOF=24 */ + +CONST WBP_ROOT=0, + WBP_DRAWER=1, + WBP_SCREEN=2, + WBPF_PATTERN=1, + WBPF_NOREMAP=16, + MAXDEPTH=3, + DEFPATDEPTH=2, + PAT_WIDTH=16, + PAT_HEIGHT=16 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/resources/battclock.e b/amigae33a/E_v3.3a/Src/Src/Modules/resources/battclock.e new file mode 100644 index 0000000..04c566b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/resources/battclock.e @@ -0,0 +1,6 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +#define BATTCLOCKNAME 'battclock.resource' diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/resources/battmem.e b/amigae33a/E_v3.3a/Src/Src/Modules/resources/battmem.e new file mode 100644 index 0000000..0d4ee6d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/resources/battmem.e @@ -0,0 +1,6 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +#define BATTMEMNAME 'battmem.resource' diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/resources/battmembitsamiga.e b/amigae33a/E_v3.3a/Src/Src/Modules/resources/battmembitsamiga.e new file mode 100644 index 0000000..35ec375 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/resources/battmembitsamiga.e @@ -0,0 +1,10 @@ +OPT MODULE +OPT EXPORT + +CONST BATTMEM_AMIGA_AMNESIA_ADDR=0, + BATTMEM_AMIGA_AMNESIA_LEN=1, + BATTMEM_SCSI_TIMEOUT_ADDR=1, + BATTMEM_SCSI_TIMEOUT_LEN=1, + BATTMEM_SCSI_LUNS_ADDR=2, + BATTMEM_SCSI_LUNS_LEN=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/resources/battmembitsshared.e b/amigae33a/E_v3.3a/Src/Src/Modules/resources/battmembitsshared.e new file mode 100644 index 0000000..5ee5942 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/resources/battmembitsshared.e @@ -0,0 +1,14 @@ +OPT MODULE +OPT EXPORT + +CONST BATTMEM_SHARED_AMNESIA_ADDR=$40, + BATTMEM_SHARED_AMNESIA_LEN=1, + BATTMEM_SCSI_HOST_ID_ADDR=$41, + BATTMEM_SCSI_HOST_ID_LEN=3, + BATTMEM_SCSI_SYNC_XFER_ADDR=$44, + BATTMEM_SCSI_SYNC_XFER_LEN=1, + BATTMEM_SCSI_FAST_SYNC_ADDR=$45, + BATTMEM_SCSI_FAST_SYNC_LEN=1, + BATTMEM_SCSI_TAG_QUEUES_ADDR=$46, + BATTMEM_SCSI_TAG_QUEUES_LEN=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/resources/card.e b/amigae33a/E_v3.3a/Src/Src/Modules/resources/card.e new file mode 100644 index 0000000..8ddf10b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/resources/card.e @@ -0,0 +1,96 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/interrupts', + 'exec/nodes' + +#define CARDRESNAME 'card.resource' + +OBJECT cardhandle + cardnode:ln + cardremoved:PTR TO is + cardinserted:PTR TO is + cardstatus:PTR TO is + cardflags:CHAR +ENDOBJECT /* SIZEOF=27 */ + +OBJECT devicetdata + dtsize:LONG + dtspeed:LONG + dttype:CHAR + dtflags:CHAR +ENDOBJECT /* SIZEOF=10 */ + +OBJECT cardmemorymap + commonmemory:PTR TO CHAR + attributememory:PTR TO CHAR + iomemory:PTR TO CHAR + commonmemsize:LONG + attributememsize:LONG + iomemsize:LONG +ENDOBJECT /* SIZEOF=12 */ + +CONST CARDB_RESETREMOVE=0, + CARDF_RESETREMOVE=1, + CARDB_IFAVAILABLE=1, + CARDF_IFAVAILABLE=2, + CARDB_DELAYOWNERSHIP=2, + CARDF_DELAYOWNERSHIP=4, + CARDB_POSTSTATUS=3, + CARDF_POSTSTATUS=8, + CARDB_REMOVEHANDLE=0, + CARDF_REMOVEHANDLE=1, + CARD_STATUSB_CCDET=6, + CARD_STATUSF_CCDET=$40, + CARD_STATUSB_BVD1=5, + CARD_STATUSF_BVD1=$20, + CARD_STATUSB_SC=5, + CARD_STATUSF_SC=$20, + CARD_STATUSB_BVD2=4, + CARD_STATUSF_BVD2=16, + CARD_STATUSB_DA=4, + CARD_STATUSF_DA=16, + CARD_STATUSB_WR=3, + CARD_STATUSF_WR=8, + CARD_STATUSB_BSY=2, + CARD_STATUSF_BSY=4, + CARD_STATUSB_IRQ=2, + CARD_STATUSF_IRQ=4, + CARD_VOLTAGE_0V=0, + CARD_VOLTAGE_5V=1, + CARD_VOLTAGE_12V=2, + CARD_ENABLEB_DIGAUDIO=1, + CARD_ENABLEF_DIGAUDIO=2, + CARD_DISABLEB_WP=3, + CARD_DISABLEF_WP=8, + CARD_INTERFACE_AMIGA_0=0, + CARD_INTB_SETCLR=7, + CARD_INTF_SETCLR=128, + CARD_INTB_BVD1=5, + CARD_INTF_BVD1=32, + CARD_INTB_SC=5, + CARD_INTF_SC=32, + CARD_INTB_BVD2=4, + CARD_INTF_BVD2=16, + CARD_INTB_DA=4, + CARD_INTF_DA=16, + CARD_INTB_BSY=2, + CARD_INTF_BSY=4, + CARD_INTB_IRQ=2, + CARD_INTF_IRQ=4, + CISTPL_AMIGAXIP=$91 + +OBJECT amigaxip +-> Um, this was all wrong + code:CHAR + link:CHAR + xiploc[4]:ARRAY + xipflags:CHAR + xipresrv:CHAR +ENDOBJECT /* SIZEOF=8 */ + +CONST XIPFLAGB_AUTORUN=0, + XIPFLAGF_AUTORUN=1 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/resources/cia.e b/amigae33a/E_v3.3a/Src/Src/Modules/resources/cia.e new file mode 100644 index 0000000..0191e55 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/resources/cia.e @@ -0,0 +1,7 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +#define CIAANAME 'ciaa.resource' +#define CIABNAME 'ciab.resource' diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/resources/disk.e b/amigae33a/E_v3.3a/Src/Src/Modules/resources/disk.e new file mode 100644 index 0000000..0007153 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/resources/disk.e @@ -0,0 +1,57 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/interrupts', + 'exec/libraries', + 'exec/lists', + 'exec/ports', + 'exec/tasks' + +OBJECT discresourceunit + mn:mn + discblock:is + discsync:is + index:is +ENDOBJECT /* SIZEOF=86 */ + +OBJECT discresource + lib:lib + current:PTR TO discresourceunit + flags:CHAR + pad:CHAR + syslib:PTR TO lib + ciaresource:PTR TO lib + unitid[4]:ARRAY OF LONG + waiting:lh + discblock:is + discsync:is + index:is + currtask:PTR TO tc +ENDOBJECT /* SIZEOF=148 */ + +#define DISKNAME 'disk.resource' + +CONST DRB_ALLOC0=0, + DRB_ALLOC1=1, + DRB_ALLOC2=2, + DRB_ALLOC3=3, + DRB_ACTIVE=7, + DRF_ALLOC0=1, + DRF_ALLOC1=2, + DRF_ALLOC2=4, + DRF_ALLOC3=8, + DRF_ACTIVE=$80, + DSKDMAOFF=$4000, + DR_ALLOCUNIT=-6, + DR_FREEUNIT=-$c, + DR_GETUNIT=-$12, + DR_GIVEUNIT=-$18, + DR_GETUNITID=-$1e, + DR_READUNITID=-$24, + DR_LASTCOMM=$FFFFFFDC, + DRT_AMIGA=0, + DRT_37422D2S=$55555555, + DRT_EMPTY=-1, + DRT_150RPM=$AAAAAAAA diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/resources/filesysres.e b/amigae33a/E_v3.3a/Src/Src/Modules/resources/filesysres.e new file mode 100644 index 0000000..c00a4df --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/resources/filesysres.e @@ -0,0 +1,32 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/lists', + 'exec/nodes', + 'exec/tasks' + +OBJECT filesysresource + ln:ln + creator:PTR TO CHAR + filesysentries:lh +ENDOBJECT /* SIZEOF=32 */ + +OBJECT filesysentry + ln:ln + dostype:LONG + version:LONG + patchflags:LONG + type:LONG + task:PTR TO tc + lock:LONG + handler:PTR TO CHAR + stacksize:LONG + priority:LONG + startup:LONG + seglist:LONG + globalvec:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +#define FSRNAME 'FileSystem.resource' diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/resources/mathresource.e b/amigae33a/E_v3.3a/Src/Src/Modules/resources/mathresource.e new file mode 100644 index 0000000..89b84b6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/resources/mathresource.e @@ -0,0 +1,24 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes' + +OBJECT mathieeeresourceresource + node:ln + flags:INT -> This is unsigned + baseaddr:PTR TO INT -> The target is unsigned + dblbasinit:LONG + dbltransinit:LONG + sglbasinit:LONG + sgltransinit:LONG + extbasinit:LONG + exttransinit:LONG +ENDOBJECT /* SIZEOF=44 */ + +CONST MATHIEEERESOURCEF_DBLBAS=1, + MATHIEEERESOURCEF_DBLTRANS=2, + MATHIEEERESOURCEF_SGLBAS=4, + MATHIEEERESOURCEF_SGLTRANS=8, + MATHIEEERESOURCEF_EXTBAS=16, + MATHIEEERESOURCEF_EXTTRANS=$20 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/resources/misc.e b/amigae33a/E_v3.3a/Src/Src/Modules/resources/misc.e new file mode 100644 index 0000000..6a96ae7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/resources/misc.e @@ -0,0 +1,13 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +CONST MR_SERIALPORT=0, + MR_SERIALBITS=1, + MR_PARALLELPORT=2, + MR_PARALLELBITS=3, + MR_ALLOCMISCRESOURCE=-6, + MR_FREEMISCRESOURCE=-$c + +#define MISCNAME 'misc.resource' diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/resources/potgo.e b/amigae33a/E_v3.3a/Src/Src/Modules/resources/potgo.e new file mode 100644 index 0000000..519ae3b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/resources/potgo.e @@ -0,0 +1,8 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +CONST RESOURCES_POTGO_I=1 + +#define POTGONAME 'potgo.resource' diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/rexx/errors.e b/amigae33a/E_v3.3a/Src/Src/Modules/rexx/errors.e new file mode 100644 index 0000000..d19b988 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/rexx/errors.e @@ -0,0 +1,55 @@ +OPT MODULE +OPT EXPORT + +CONST ERRC_MSG=0, + ERR10_001=1, + ERR10_002=2, + ERR10_003=3, + ERR10_005=5, + ERR10_006=6, + ERR10_008=8, + ERR10_009=9, + ERR10_010=10, + ERR10_011=11, + ERR10_012=12, + ERR10_013=13, + ERR10_014=14, + ERR10_015=15, + ERR10_016=16, + ERR10_017=17, + ERR10_018=18, + ERR10_019=19, + ERR10_020=20, + ERR10_021=21, + ERR10_022=22, + ERR10_023=23, + ERR10_024=24, + ERR10_025=25, + ERR10_026=26, + ERR10_027=27, + ERR10_028=28, + ERR10_029=29, + ERR10_030=30, + ERR10_031=31, + ERR10_032=$20, + ERR10_033=$21, + ERR10_034=$22, + ERR10_035=$23, + ERR10_036=$24, + ERR10_037=$25, + ERR10_039=$27, + ERR10_040=$28, + ERR10_041=$29, + ERR10_042=$2A, + ERR10_043=$2B, + ERR10_044=$2C, + ERR10_045=$2D, + ERR10_046=$2E, + ERR10_047=$2F, + ERR10_048=$30, + RC_FAIL=-1, + RC_OK=0, + RC_WARN=5, + RC_ERROR=10, + RC_FATAL=20 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/rexx/rexxio.e b/amigae33a/E_v3.3a/Src/Src/Modules/rexx/rexxio.e new file mode 100644 index 0000000..2bfc06e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/rexx/rexxio.e @@ -0,0 +1,52 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/lists', + 'exec/ports', + 'rexx/storage' + +CONST RXBUFFSZ=$CC + +OBJECT iobuff +-> Um, this was all wrong + node:rexxrsrc + rpt:LONG + rct:LONG + dfh:LONG + lock:LONG + bct:LONG + area[$CC]:ARRAY +ENDOBJECT /* SIZEOF=256 */ + +CONST IOBNAME=10, + IOBMODE=24, + IOBEOF=25, + IOBPOS=28, + RXIO_EXIST=-1, + RXIO_STRF=0, + RXIO_READ=1, + RXIO_WRITE=2, + RXIO_APPEND=3, + RXIO_BEGIN=-1, + RXIO_CURR=0, + RXIO_END=1 + +#define LLOFFSET(rrp) (rrp::rexxrsrc.arg1) +#define LLVERS(rrp) (rrp::rexxrsrc.arg2) +#define CLVALUE(rrp) (rrp::rexxrsrc.arg1) + +OBJECT rexxmsgport +-> Um, this was all wrong + rrsizeof:rexxrsrc + port:mp + replylist:lh +ENDOBJECT /* SIZEOF=80 */ + +CONST DT_DEV=0, + DT_DIR=1, + DT_VOL=2, + ACTION_STACK=$7D2, + ACTION_QUEUE=$7D3 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/rexx/rxslib.e b/amigae33a/E_v3.3a/Src/Src/Modules/rexx/rxslib.e new file mode 100644 index 0000000..fd54ae4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/rexx/rxslib.e @@ -0,0 +1,85 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/libraries', + 'exec/lists', + 'exec/ports', + 'rexx/storage' + +#define RXSNAME 'rexxsyslib.library' +#define RXSDIR 'REXX' +#define RXSTNAME 'ARexx' + +OBJECT rxslib + lib:lib + flags:CHAR + shadow:CHAR + sysbase:LONG + dosbase:LONG + ieeedpbase:LONG + seglist:LONG + nil:LONG + chunk:LONG + maxnest:LONG + null:PTR TO nexxstr + false:PTR TO nexxstr + true:PTR TO nexxstr + rexx:PTR TO nexxstr + command:PTR TO nexxstr + stdin:PTR TO nexxstr + stdout:PTR TO nexxstr + stderr:PTR TO nexxstr + version:PTR TO CHAR + taskname:PTR TO CHAR + taskpri:LONG + taskseg:LONG + stacksize:LONG + rexxdir:PTR TO CHAR + ctable:PTR TO CHAR + notice:PTR TO CHAR + rexxport:mp + readlock:INT -> This is unsigned + tracefh:LONG + tasklist:lh + numtask:INT + liblist:lh + numlib:INT + cliplist:lh + numclip:INT + msglist:lh + nummsg:INT + pgmlist:lh + numpgm:INT + tracecnt:INT -> This is unsigned + avail:INT +ENDOBJECT /* SIZEOF=252 */ + +CONST RLFB_TRACE=0, + RLFB_HALT=1, + RLFB_SUSP=2, + RLFB_STOP=6, + RLFB_CLOSE=7, + RLFMASK=7, + RXSCHUNK=$400, + RXSNEST=$20, + RXSTPRI=0, + RXSSTACK=$1000, + CTB_SPACE=0, + CTB_DIGIT=1, + CTB_ALPHA=2, + CTB_REXXSYM=3, + CTB_REXXOPR=4, + CTB_REXXSPC=5, + CTB_UPPER=6, + CTB_LOWER=7, + CTF_SPACE=1, + CTF_DIGIT=2, + CTF_ALPHA=4, + CTF_REXXSYM=8, + CTF_REXXOPR=16, + CTF_REXXSPC=$20, + CTF_UPPER=$40, + CTF_LOWER=$80 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/rexx/storage.e b/amigae33a/E_v3.3a/Src/Src/Modules/rexx/storage.e new file mode 100644 index 0000000..1d7278f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/rexx/storage.e @@ -0,0 +1,160 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/lists', + 'exec/nodes', + 'exec/ports' + +OBJECT nexxstr + ivalue:LONG + length:INT -> This is unsigned + flags:CHAR + hash:CHAR + buff[8]:ARRAY +ENDOBJECT /* SIZEOF=16 */ + +#define IVALUE(nsptr) (nsptr::nexxstr.ivalue) + +CONST NXADDLEN=9, + NSB_KEEP=0, + NSB_STRING=1, + NSB_NOTNUM=2, + NSB_NUMBER=3, + NSB_BINARY=4, + NSB_FLOAT=5, + NSB_EXT=6, + NSB_SOURCE=7, + NSF_KEEP=1, + NSF_STRING=2, + NSF_NOTNUM=4, + NSF_NUMBER=8, + NSF_BINARY=16, + NSF_FLOAT=$20, + NSF_EXT=$40, + NSF_SOURCE=$80, + NSF_INTNUM=26, + NSF_DPNUM=$28, + NSF_ALPHA=6, + NSF_OWNED=$C1, + KEEPSTR=$86, + KEEPNUM=$9A + +OBJECT rexxarg + size:LONG + length:INT -> This is unsigned + flags:CHAR + hash:CHAR + buff[8]:ARRAY +ENDOBJECT /* SIZEOF=16 */ + +OBJECT rexxmsg + mn:mn + taskblock:LONG + libbase:LONG + action:LONG + result1:LONG + result2:LONG + args[16]:ARRAY OF LONG + passport:PTR TO mp + commaddr:PTR TO CHAR + fileext:PTR TO CHAR + stdin:LONG + stdout:LONG + avail:LONG +ENDOBJECT /* SIZEOF=128 */ + +#define ARG0(rmp) (rmp::rexxmsg.args[0]) +#define ARG1(rmp) (rmp::rexxmsg.args[1]) +#define ARG2(rmp) (rmp::rexxmsg.args[2]) + +CONST ACTION=28, + RESULT1=$20, + RESULT2=$24, + MAXRMARG=15, + RXCOMM=$1000000, + RXFUNC=$2000000, + RXCLOSE=$3000000, + RXQUERY=$4000000, + RXADDFH=$7000000, + RXADDLIB=$8000000, + RXREMLIB=$9000000, + RXADDCON=$A000000, + RXREMCON=$B000000, + RXTCOPN=$C000000, + RXTCCLS=$D000000, + RXFB_NOIO=16, + RXFB_RESULT=17, + RXFB_STRING=18, + RXFB_TOKEN=19, + RXFB_NONRET=20, + RXFF_RESULT=$20000, + RXFF_STRING=$40000, + RXFF_TOKEN=$80000, + RXFF_NONRET=$100000, + RXCODEMASK=$FF000000, + RXARGMASK=15 + +OBJECT rexxrsrc + ln:ln + func:INT + base:LONG + size:LONG + arg1:PTR TO CHAR + arg2:LONG +ENDOBJECT /* SIZEOF=32 */ + +CONST RRTYPE=8, + RRNAME=10, + RRSIZE=20, + RRT_ANY=0, + RRT_LIB=1, + RRT_PORT=2, + RRT_FILE=3, + RRT_HOST=4, + RRT_CLIP=5, + GLOBALSZ=$C8 + +OBJECT rexxtask + global[$C8]:ARRAY + msgport:mp + flags:CHAR + sigbit:CHAR -> This is signed + clientid:LONG + msgpkt:LONG + taskid:LONG + port:LONG + errtrap:LONG + stackptr:LONG + header1:lh + header2:lh + header3:lh + header4:lh + header5:lh +ENDOBJECT /* SIZEOF=330 */ + +CONST ENVLIST=$104, + FREELIST=$112, + MEMLIST=$120, + FILELIST=$12E, + PORTLIST=$13C, + NUMLISTS=5, + RTFB_TRACE=0, + RTFB_HALT=1, + RTFB_SUSP=2, + RTFB_TCUSE=3, + RTFB_WAIT=6, + RTFB_CLOSE=7, + MEMQUANT=16, + MEMMASK=-16, + MEMQUICK=1, + MEMCLEAR=$10000 + +OBJECT srcnode + succ:PTR TO srcnode + pred:PTR TO srcnode + ptr:LONG + size:LONG +ENDOBJECT /* SIZEOF=16 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/utility/date.e b/amigae33a/E_v3.3a/Src/Src/Modules/utility/date.e new file mode 100644 index 0000000..76b4f4a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/utility/date.e @@ -0,0 +1,13 @@ +OPT MODULE +OPT EXPORT + +OBJECT clockdata + sec:INT -> This is unsigned + min:INT -> This is unsigned + hour:INT -> This is unsigned + mday:INT -> This is unsigned + month:INT -> This is unsigned + year:INT -> This is unsigned + wday:INT -> This is unsigned +ENDOBJECT /* SIZEOF=14 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/utility/hooks.e b/amigae33a/E_v3.3a/Src/Src/Modules/utility/hooks.e new file mode 100644 index 0000000..3075e6c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/utility/hooks.e @@ -0,0 +1,12 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/nodes' + +OBJECT hook + mln:mln + entry:LONG + subentry:LONG + data:LONG +ENDOBJECT /* SIZEOF=20 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/utility/name.e b/amigae33a/E_v3.3a/Src/Src/Modules/utility/name.e new file mode 100644 index 0000000..125d258 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/utility/name.e @@ -0,0 +1,18 @@ +OPT MODULE +OPT EXPORT + +CONST UTILITY_NAME_I=1 + +OBJECT namedobject + object:LONG +ENDOBJECT /* SIZEOF=NONE !!! */ + +CONST ANO_NAMESPACE=$FA0, + ANO_USERSPACE=$FA1, + ANO_PRIORITY=$FA2, + ANO_FLAGS=$FA3, + NSB_NODUPS=0, + NSB_CASE=1, + NSF_NODUPS=1, + NSF_CASE=2 + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/utility/pack.e b/amigae33a/E_v3.3a/Src/Src/Modules/utility/pack.e new file mode 100644 index 0000000..58a9703 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/utility/pack.e @@ -0,0 +1,23 @@ +OPT MODULE +OPT EXPORT + +CONST UTILITY_PACK_I=1, + PSTB_SIGNED=31, + PSTB_UNPACK=30, + PSTB_PACK=29, + PSTB_EXISTS=26, + PSTF_SIGNED=$80000000, + PSTF_UNPACK=$40000000, + PSTF_PACK=$20000000, + PSTF_EXISTS=$4000000, + PKCTRL_PACKUNPACK=0, + PKCTRL_PACKONLY=$40000000, + PKCTRL_UNPACKONLY=$20000000, + PKCTRL_BYTE=$80000000, + PKCTRL_WORD=$88000000, + PKCTRL_LONG=$90000000, + PKCTRL_UBYTE=0, + PKCTRL_UWORD=$8000000, + PKCTRL_ULONG=$10000000, + PKCTRL_BIT=$18000000, + PKCTRL_FLIPBIT=$98000000 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/utility/tagitem.e b/amigae33a/E_v3.3a/Src/Src/Modules/utility/tagitem.e new file mode 100644 index 0000000..1a80ee4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/utility/tagitem.e @@ -0,0 +1,18 @@ +OPT MODULE +OPT EXPORT + +OBJECT tagitem + tag:LONG + data:LONG +ENDOBJECT /* SIZEOF=8 */ + +CONST TAG_DONE=0, + TAG_END=0, + TAG_IGNORE=1, + TAG_MORE=2, + TAG_SKIP=3, + TAG_USER=$80000000, + TAGFILTER_AND=0, + TAGFILTER_NOT=1, + MAP_REMOVE_NOT_FOUND=0, + MAP_KEEP_NOT_FOUND=1 diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/utility/utility.e b/amigae33a/E_v3.3a/Src/Src/Modules/utility/utility.e new file mode 100644 index 0000000..6b96049 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/utility/utility.e @@ -0,0 +1,15 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/libraries' + +#define UTILITYNAME 'utility.library' + +OBJECT utilitybase + lib:lib + language:CHAR + reserved:CHAR +ENDOBJECT /* SIZEOF=NONE !!! */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/workbench/startup.e b/amigae33a/E_v3.3a/Src/Src/Modules/workbench/startup.e new file mode 100644 index 0000000..29bb6f0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/workbench/startup.e @@ -0,0 +1,21 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/ports' + +CONST WORKBENCH_STARTUP_I=1 + +OBJECT wbstartup + message:mn + process:PTR TO mp + segment:LONG + numargs:LONG + toolwindow:PTR TO CHAR + arglist:PTR TO wbarg +ENDOBJECT /* SIZEOF=40 */ + +OBJECT wbarg + lock:LONG + name:PTR TO CHAR +ENDOBJECT /* SIZEOF=8 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Modules/workbench/workbench.e b/amigae33a/E_v3.3a/Src/Src/Modules/workbench/workbench.e new file mode 100644 index 0000000..58248f2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Modules/workbench/workbench.e @@ -0,0 +1,102 @@ +OPT MODULE +OPT EXPORT + +OPT PREPROCESS + +MODULE 'exec/lists', + 'exec/ports', + 'intuition/intuition', + 'workbench/startup' + +CONST WORKBENCH_WORKBENCH_I=1, + WBDISK=1, + WBDRAWER=2, + WBTOOL=3, + WBPROJECT=4, + WBGARBAGE=5, + WBDEVICE=6, + WBKICK=7, + WBAPPICON=8 + +-> Um, this object was missing +OBJECT olddrawerdata + newwindow:nw + currentx:LONG + currenty:LONG +ENDOBJECT + +CONST OLDDRAWERDATAFILESIZE=$38 + +OBJECT drawerdata + newwindow:nw + currentx:LONG + currenty:LONG + flags:LONG + viewmodes:INT -> This is unsigned +ENDOBJECT /* SIZEOF=62 */ + +CONST DRAWERDATAFILESIZE=$3E + +OBJECT diskobject + magic:INT -> This is unsigned + version:INT -> This is unsigned + gadget:gadget + type:CHAR + pad_byte:CHAR + defaulttool:PTR TO CHAR + tooltypes:PTR TO LONG + currentx:LONG + currenty:LONG + drawerdata:PTR TO drawerdata + toolwindow:PTR TO CHAR + stacksize:LONG +ENDOBJECT /* SIZEOF=78 */ + +CONST WB_DISKMAGIC=$E310, + WB_DISKVERSION=1, + WB_DISKREVISION=1, + WB_DISKREVISIONMASK=$FF + +OBJECT freelist + numfree:INT + memlist:lh +ENDOBJECT /* SIZEOF=16 */ + +CONST GFLG_GADGBACKFILL=1, + GADGBACKFILL=1, + NO_ICON_POSITION=$80000000, + AM_VERSION=1, + AMTYPE_APPWINDOW=7, + AMTYPE_APPICON=8, + AMTYPE_APPMENUITEM=9 + +#define WORKBENCH_NAME 'workbench.library' + +OBJECT appmessage + message:mn + type:INT -> This is unsigned + userdata:LONG + id:LONG + numargs:LONG + arglist:PTR TO wbarg + version:INT -> This is unsigned + class:INT -> This is unsigned + mousex:INT + mousey:INT + seconds:LONG + micros:LONG + reserved[8]:ARRAY OF LONG +ENDOBJECT /* SIZEOF=62 */ + +OBJECT appwindow + private:LONG +ENDOBJECT /* SIZEOF=0 */ + +OBJECT appicon + private:LONG +ENDOBJECT /* SIZEOF=0 */ + +OBJECT appmenuitem + private:LONG +ENDOBJECT /* SIZEOF=0 */ + diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/er.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/er.e new file mode 100644 index 0000000..9803fac --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/er.e @@ -0,0 +1,72 @@ +/* + +Just opens a tiny window and rotates a line. Use it to see if your +kite's still running :) + +*/ + +OPT PREPROCESS + +MODULE 'oomodules/coordinate/line', 'oomodules/coordinate', 'intuition/intuition', + 'oomodules/sort/numbers/float' + +#define NULL_X (30) +#define NULL_Y (15) + +DEF hauptwin:PTR TO window, /* Hauptfenster */ + meineintmessage:PTR TO intuimessage /* Kopie der intmsg */ + + + +PROC main() +DEF coo:PTR TO coordinate,co2:PTR TO coordinate, + line:PTR TO line,flt:PTR TO float + + NEW coo.new(["set",0.0,0.0,0.0]) + NEW co2.new(["set",30.0,30.0,0.0]) + + NEW flt.new() + flt.set(2.0) + + NEW line.new() + + line.setStart(coo) + + line.setEnd(coo) + line.end.shift(co2) + + co2.x.neg() + co2.y.neg() + co2.z.neg() + line.shift(co2) + + hauptwin := OpenWindowTagList(NIL, + [WA_TITLE,'ER', + WA_IDCMP,IDCMP_RAWKEY OR IDCMP_CLOSEWINDOW OR IDCMP_MOUSEMOVE OR IDCMP_GADGETUP OR IDCMP_GADGETDOWN OR IDCMP_MOUSEBUTTONS OR IDCMP_MENUPICK OR IDCMP_REFRESHWINDOW, + WA_FLAGS,WFLG_ACTIVATE+WFLG_CLOSEGADGET+WFLG_DRAGBAR+WFLG_DEPTHGADGET, + WA_INNERWIDTH, 90, WA_INNERHEIGHT, 50, + WA_REPORTMOUSE,TRUE,WA_GIMMEZEROZERO,TRUE,NIL]) + + SetStdRast(hauptwin.rport) + + REPEAT + meineintmessage := GetMsg(hauptwin.userport) + + line.rotateZ(3.0) + + line.x.add(flt) +-> line.y.substract(flt) + + Line(NULL_X+(!line.getX()!/2),NULL_Y+(!line.getY()!/4), + NULL_X+(!line.end.getX()!/2) ,NULL_Y+(!line.end.getY()!/4)) + WaitTOF() + Line(NULL_X+(!line.getX()!/2),NULL_Y+(!line.getY()!/4), + NULL_X+(!line.end.getX()!/2) ,NULL_Y+(!line.end.getY()!/4),0) + + UNTIL (meineintmessage.class = IDCMP_CLOSEWINDOW) + + CloseWindow(hauptwin) + + CleanUp(0) + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/line.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/line.e new file mode 100644 index 0000000..36fedf3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/line.e @@ -0,0 +1,100 @@ +/* + +This is a 'reducing' way to implement the Line: the attributes x, y and z +are used as starting values, they may be used. Therefore, start is removed + +Look at the rotate procs and see the powerful way of coding oo :) +*/ + +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/coordinate','oomodules/sort/numbers/float' + +OBJECT line OF coordinate + end:PTR TO coordinate +ENDOBJECT + +PROC name() OF line IS 'Line' + +PROC init() OF line +DEF coo:PTR TO coordinate, + float_x:PTR TO float, + float_y:PTR TO float, + float_z:PTR TO float + + NEW float_x.new() + self.x := float_x + + NEW float_y.new() + self.y := float_y + + NEW float_z.new() + self.z := float_z + + NEW coo.new() + self.end := coo + +ENDPROC + +PROC end() OF line +DEF coo:PTR TO coordinate,flt:PTR TO float + + flt := self.x + END flt + + flt := self.y + END flt + + flt := self.z + END flt + + coo := self.end + END coo + +ENDPROC + + +PROC select(optionlist,index) OF line +/* + +TODO: error check: len-o'-list! + + +DEF item, value + + item := ListItem(optionlist, index) + + SELECT item + CASE "set" + + INC index + ENDSELECT +*/ +ENDPROC index + + +PROC setStart(coo:PTR TO coordinate) OF line + + self.setX( coo.getX() ) + self.setY( coo.getY() ) + self.setZ( coo.getZ() ) + +ENDPROC + +PROC setEnd(coo:PTR TO coordinate) OF line IS coo.copy(self.end) + +PROC rotateZ(angle, at=NIL:PTR TO coordinate) OF line + self.end.rotateZ(angle,at) + SUPER self.rotateZ(angle,at) +ENDPROC + +PROC rotateY(angle, at=NIL:PTR TO coordinate) OF line + self.end.rotateY(angle,at) + SUPER self.rotateY(angle,at) +ENDPROC + +PROC rotateX(angle, at=NIL:PTR TO coordinate) OF line + self.end.rotateX(angle,at) + SUPER self.rotateX(angle,at) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/polyline.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/polyline.e new file mode 100644 index 0000000..43df477 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/polyline.e @@ -0,0 +1,34 @@ +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/coordinate', + 'other/queuestack' + +OBJECT polyline OF coordinate + coordinates:PTR TO queuestack +ENDOBJECT + +PROC init() OF polyline +DEF q:PTR TO queuestack + + NEW q.new() + + self.coordinates := q + +ENDPROC + +PROC end() OF polyline +DEF q:PTR TO queuestack + + q:=self.coordinates + + END q +ENDPROC + +PROC name() OF polyline IS 'Polyline' + +PROC add(coo:PTR TO coordinate) OF polyline + + self.coordinates.addLast(coo) + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/polylinewin.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/polylinewin.e new file mode 100644 index 0000000..ec1be37 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/Coordinate/polylinewin.e @@ -0,0 +1,94 @@ +/* + +Just draws some circle. Remove the Delay() and the second Plot() to +see its speed :) + +*/ + +OPT PREPROCESS + +MODULE 'oomodules/coordinate', 'oomodules/coordinate/polyline' + +#define NULL_X (200) +#define NULL_Y (100) + +DEF lastx=0,lasty=0,firstelement,polycolour + +PROC main() +DEF win, coo:PTR TO coordinate,count,co2:PTR TO coordinate, + polyline:PTR TO polyline, co3:PTR TO coordinate, + co4:PTR TO coordinate + + NEW coo.new(["set",50.0,50.0,0.0]) + NEW co2.new(["set",0.0,-50.0,25.0]) + NEW co3.new(["set",-35.0,35.0,0.0]) + NEW co4.new(["set",50.0,50.0,0.0]) + + NEW polyline.new() + + polyline.add(coo) + polyline.add(co2) + polyline.add(co3) + polyline.add(co4) + + win := OpenW(0,0,400,200,0,$F,'ui',0,1,0,0) + + + Line(NULL_X-100, NULL_Y, NULL_X+100, NULL_Y) + Line(NULL_X, NULL_Y-50, NULL_X, NULL_Y+50) + + + FOR count:=0 TO 180*5 + + firstelement:=TRUE + + polycolour:=1 + polyline.coordinates.do({draw}) -> draw it + + Delay(1) + WaitTOF() + polycolour:=0 + polyline.coordinates.do({draw}) -> delete it + + polyline.coordinates.do({rotate}) -> rotate it + ENDFOR + + Delay(150) + + CloseW(win) + +ENDPROC + +PROC drawline (x,y,x2,y2,colour=1) + + Line(NULL_X+(x/2),NULL_Y+(y/4), + NULL_X+(x2/2) ,NULL_Y+(y2/4),colour) + +ENDPROC + + +PROC draw(obj:PTR TO coordinate) +DEF nux,nuy + + nux:=!obj.getX()! + nuy:=!obj.getY()! + + /* + * The flag is deleted when we process the first element. Since each + * line begins where the last line ended we can't draw the first one... + */ + + IF firstelement=TRUE + firstelement := FALSE + ELSE + drawline(lastx,lasty, nux, nuy,polycolour) + ENDIF + + lastx:=nux + lasty:=nuy +ENDPROC + +PROC rotate(obj:PTR TO coordinate) + + obj.rotateY(2.0) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/README b/amigae33a/E_v3.3a/Src/Src/OOmodules/README new file mode 100644 index 0000000..61f660e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/README @@ -0,0 +1,15 @@ +This is a small but still useable part of the object oriented e project +(ooep). The programs in this archive demonstrate some features of the objects +that are included. To get an idea of the ooep go to the oodoc/ directory and +read the files in the guides/ folder. To browse through the examples, use +Multiview or Amigaguide on the Examples file there. + +The ooep needs you to grow. Ask me how you can contribute (my address can +be found in the registration site section of e.guide). + +Gregor Goldbach, April 1997 + +[Note: I moved everything but the modules to the Src/ hierarchy. for +some test programs this may mean editing the MODULE declarations +from '*mod' to 'oomodules/../mod'. This may also have broken some +amigaguide links -- Wouter] diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/application.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/application.e new file mode 100644 index 0000000..f142de9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/application.e @@ -0,0 +1,66 @@ +OPT MODULE + +/* + +Application object. Features: arexx port, commodity + + NAME + application + + PURPOSE + A basic application object. By now it's totally undefined what will + find it's way in here. Any ideas are welcome. Here's a list of things + That could be part of this object in the future: + + - locale support + - arexx support + - commodity + - gui engine (easygui and/or MUI via compiler switch) + +*/ + +MODULE 'oomodules/object', + 'oomodules/commodity', + 'oomodules/library/exec/port/arexxport', + 'oomodules/library/exec/port/portlist' + +OBJECT application OF object + commodity:PTR TO commodity + ports:PTR TO portList +ENDOBJECT + +PROC init() OF application + + NEW ports.new() + +ENDPROC + +PROC select(opts,i) OF application +DEF item, + arexx:PTR TO arexxPort, + cx:PTR TO commodity + + item:=ListItem(opts,i) + + + SELECT item + + CASE "rexx" + + INC i + NEW arexx.new(ListItem(opts,i)) + self.ports.add(arexx,"rexx") + + CASE "cx" + + NEW cx.new(ListItem(opts,i)) + self.commodity := cx + + ENDSELECT + +ENDPROC i + +/*EE folds +-1 +32 3 35 22 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/commodity.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/commodity.e new file mode 100644 index 0000000..9dc7487 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/commodity.e @@ -0,0 +1,466 @@ +OPT MODULE +OPT OSVERSION=37 + +MODULE 'oomodules/library/commodities', + 'oomodules/object', + + 'commodities', + 'libraries/commodities', + 'exec/ports' + + +DEF nb:PTR TO newbroker, + hotkey, hotkeyID, + + cxlib:PTR TO commodities + +EXPORT OBJECT commodity OF object +/****** object/commodity ****************************** + + NAME + commodity of object -- Commodity object. Installs a commodity in the + system. + + PURPOSE + Add commodity facilities to your application. + + ATTRIBUTES + broker:LONG -- Pointer to broker structure as returned and used + by the commodities.library + + messagePort:PTR TO mp -- Message port of the commodity. Messages + arrive here when we press the hotkey, enable the commodity and + so on. + + openGUIProc:LONG -- Address of the proc to call when the commodity is + told to open the gui (via hotkey or exchange program). No + arguments. + + closeGUIProc:LONG -- The opposite of the open gui proc. + + killProc:LONG -- Address of proc to call when the commodity is told + to quit. If left NIL a standard proc is called that removes the + commodity from the system, frees the message port and other + allocated resources. That standard proc is removeFromSystem(). + You may put your own proc here and call removeFromSystem() when + you're finished. See autodoc of that proc. + + NOTES + A quick & dirty implementation from one of my old sources. I'm sure it + isn't finished. + + SEE ALSO + object + +********/ + broker + messagePort:PTR TO mp + openGUIProc + closeGUIProc + killProc +ENDOBJECT + +PROC init() OF commodity +/****** commodity/init ****************************** + + NAME + init() of commodity -- Initialization of the object. + + SYNOPSIS + commodity.init() + + FUNCTION + Opens commodities library if needed and creates message port. Some + flags are set. The commodity is set to be unique. + + SEE ALSO + commodity + +********/ + + NEW cxlib.new() + + self.messagePort := CreateMsgPort() + NEW nb + + nb.unique := NBU_UNIQUE OR NBU_NOTIFY + nb.flags := COF_SHOW_HIDE + nb.port := self.messagePort + + hotkeyID := 1 + + SUPER self.init() + +ENDPROC + +PROC select(opts,i) OF commodity +/****** commodity/select ****************************** + + NAME + select() of commodity -- Selection of action. + + SYNOPSIS + commodity.select(LONG, LONG) + + commodity.select(opts, i) + + FUNCTION + The following tags are recognized: + "name" -- Name of cx. + + "title" -- Title of cx. Some simple line that says who did it. + + "desc" -- Short description line ('OS3 version', 'Testversion') + + "vers" -- Version byte + + "hotk" -- Hotkey string, e.g. 'control alt d' + + "open" -- Pointer to proc that will be called if the cx is told + to open the gui. No arguments are passed. + + "clos" -- Pointer to proc that will be called if the cx is told + to close the gui. No arguments are passed. + + "kill" -- Pointer to proc that will be called if the cx is told + to kill the gui. No arguments are passed. If you use this tag + be sure to call removeFromSystem(). + + "now" -- If this tag is found in the list the cx is added to the + system at once. Do *NOT* provide any more tags, this one has + to be the last one in the list. If you do, behaviour is + undefined. + + The tags "name", "titl", "desc" and "hotkey" have to be provided. + However, this is not checked. If you forget one, behaviour is + undefined. + + INPUTS + opts:LONG -- Option list. + + i:LONG -- Index of optionlist. + + RESULT + LONG -- Current index we are at. + + EXAMPLE + NEW cx.new(["name", 'DevEnv', + "titl", 'DevEnv 0.5ß © 1995,6 Gregor Goldbach', + "desc", 'E Development Environment', + "vers", 5, + "hotk", 'control alt d', + "open", {showMainWindow}, + "now"]) + SEE ALSO + commodity + +********/ +DEF item + + item:=ListItem(opts,i) + + + SELECT item + + CASE "name" + + INC i + nb.name := ListItem(opts,i) + + CASE "titl" + + INC i + nb.title := ListItem(opts,i) + + CASE "desc" + + INC i + nb.descr := ListItem(opts,i) + + CASE "hotk" + + INC i + hotkey := ListItem(opts,i) + + CASE "vers" + + INC i + nb.version := ListItem(opts,i) + + CASE "now" + + self.addToSystem() + END nb + + CASE "open" + + INC i + self.openGUIProc := ListItem(opts,i) + + CASE "clos" + + INC i + self.closeGUIProc := ListItem(opts,i) + + CASE "kill" + + INC i + self.killProc := ListItem(opts,i) + + ENDSELECT + +ENDPROC i + +EXPORT PROC addToSystem() OF commodity +/****** commodity/addToSystem ****************************** + + NAME + addToSystem() of commodity -- Adds commodity to the system. + + SYNOPSIS + commodity.addToSystem() + + FUNCTION + The commodity is installed by the commodities library, arguments set + in select() will be used. Check self.broker to know if the creation + was successful or not. There may be an exception for this in the + future. + + SEE ALSO + commodity + +********/ +DEF filter, sender, translate + + IF nb + + self.broker:=CxBroker(nb,0) -> Create broker with the filled nb structure + + IF self.broker + + + /* Create a filter which checks * + * input events for our hotkey. */ + IF filter:=CreateCxObj(CX_FILTER,hotkey,0) + /* We have to attach the filter to * + * our broker. */ + AttachCxObj(self.broker,filter) + /* Create a sender which sends us * + * hotkey/data info to our port */ + IF sender:=CreateCxObj(CX_SEND,self.messagePort,hotkeyID) + /* Attach the sender to the filter */ + AttachCxObj(filter,sender) + /* Create a translator which 'eats' * + * the input event if it was ours. */ + IF translate:=CreateCxObj(CX_TRANSLATE,0,0) + /* Attach also the translator to the filter */ + AttachCxObj(filter,translate) + /* Global error-check on our filter */ + IF (CxObjError(filter)=0) + /* No errors. Let's go! */ + ActivateCxObj(self.broker,TRUE) + /* We use a subroutine now * + * (only to have a cleaner source) */ + ENDIF + ENDIF + ENDIF + ENDIF + ENDIF + ENDIF + +ENDPROC + +PROC removeFromSystem() OF commodity +/****** commodity/removeFromSystem ****************************** + + NAME + removeFromSystem() of commodity -- + + SYNOPSIS + commodity.removeFromSystem() + + FUNCTION + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + commodity + +********/ + + DeleteCxObjAll(self.broker) + DeleteMsgPort(self.messagePort) + + END cxlib + +ENDPROC + +EXPORT PROC handleInputs() OF commodity +/****** commodity/handleInputs ****************************** + + NAME + handleInputs() of commodity -- + + SYNOPSIS + commodity.handleInputs() + + FUNCTION + Handles general inputs for the commodity. These are the things + you can do with Exchange or any clone of that program. When you + tell the cx to pop up (via hotkey or the Exchange button) the + proc you provided at init() is called. + + When the cx is told to commit suicide the 'close GUI' proc is called + (if provided) and then the cx is removed from the system. Note that + this is the case only if you didn't provide your own kill proc. + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + commodity + +********/ +DEF msg,msgid,msgtype,rcode, + proc + + REPEAT + rcode:=0 /* reset main LOOP RETURN code */ + + /* Wait for any message at our port */ + + WaitPort(self.messagePort) + + + /* Get the message :) */ + + IF msg:=GetMsg(self.messagePort) + + /* Get more data from message for CX */ + + msgid:=CxMsgID(msg) + msgtype:=CxMsgType(msg) + + /* Reply (here OR later but important!) */ + + ReplyMsg(msg) + + /* Check for CXM_IEVENT (Hotkey) */ + + IF msgtype=CXM_IEVENT + + /* Was it our hotkey? */ + + IF msgid=hotkeyID + + /*** Here the hotkey action takes place! ***/ + + proc := self.openGUIProc + IF proc THEN proc() + + ENDIF + + /* Check for CXM_COMMAND (Exchange, ...) */ + + ELSEIF msgtype=CXM_COMMAND + + /* Exchange command Disable */ + + IF msgid=CXCMD_DISABLE + + /*** Remove patches / stop cx-action here ***/ + + ActivateCxObj(self.broker,FALSE) + + /* Exchange command Enable */ + + ELSEIF msgid=CXCMD_ENABLE + + /*** Install patches / start our cx-action here ***/ + + ActivateCxObj(self.broker,TRUE) + + /* Exchange command Show (if COF_SHOW_HIDE flag is SET) */ + + ELSEIF msgid=CXCMD_APPEAR + + /*** Open our GUI/window here ***/ + + proc := self.openGUIProc + IF proc THEN proc() + + /* Exchange command Hide (see CMD_APPEAR) */ + + ELSEIF msgid=CXCMD_DISAPPEAR + + /*** Close our GUI/window here ***/ + + + /* We were started again by a stupid user, * + * so we tell him and ask to quit. * + * (CXCMD_UNIQUE if nb.unique filled) * + * rcode becomes 1 if user wants to quit */ + + proc := self.closeGUIProc + IF proc THEN proc() + + ELSEIF msgid=CXCMD_UNIQUE + + rcode:=EasyRequestArgs(0,[20,0,'CX 37.0','CX already works.\nQuit it now?','Quit|Cancel'],0,0) + + /* Exchange Killer command */ + + ELSEIF msgid=CXCMD_KILL + + proc := self.killProc + IF proc + + proc() + + ELSE + + proc := self.closeGUIProc + IF proc THEN proc() + + + ENDIF + + rcode:=1 + + /* COMMAND check end */ + + ENDIF + + /* COMMAND & IEVENT check end */ + + ENDIF + + /* message scanned & replied */ + + ENDIF + + /* get the next message from our master */ + + UNTIL rcode + +ENDPROC + +/*EE folds +-1 +17 44 19 30 22 115 25 56 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/coordinate.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/coordinate.e new file mode 100644 index 0000000..a74505f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/coordinate.e @@ -0,0 +1,734 @@ +/* + +rotating + +seems to work +*/ + +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/sort/numbers/float','oomodules/object' + +OBJECT coordinate OF object +/****** coordinate/--coordinate-- ****************************************** + + NAME + coordinate of object + + PURPOSE + Unfinished object for three dimensional coordinates. + +****************************************************************************** + +History + + +*/ + x:PTR TO float, + y:PTR TO float, + z:PTR TO float +ENDOBJECT + +PROC name() OF coordinate IS 'coordinate' +/****** coordinate/name ****************************************** + + NAME + name() -- Get name of object. + + SYNOPSIS + coordinate.name() + + FUNCTION + Returns 'Coordinate' + + RESULTS + see above +****************************************************************************** + +History + + +*/ + +PROC init() OF coordinate +/****** coordinate/init ****************************************** + + NAME + init() -- Initialization of the object. + + SYNOPSIS + coordinate.init() + + FUNCTION + Initializes the floats in the object. + + SEE ALSO + float/new() +****************************************************************************** + +History + + +*/ +DEF float_x:PTR TO float, + float_y:PTR TO float, + float_z:PTR TO float + + NEW float_x.new() + self.x := float_x + + NEW float_y.new() + self.y := float_y + + NEW float_z.new() + self.z := float_z + +ENDPROC + + +PROC end() OF coordinate +/****** coordinate/end ****************************************** + + NAME + end() -- Destructor. + + SYNOPSIS + coordinate.end() + + FUNCTION + ENDs the Floats. + + SEE ALSO + float/end() +****************************************************************************** + +History + + +*/ +DEF float:PTR TO float + + float := self.x + END float + + float := self.y + END float + + float := self.y + END float + +ENDPROC + + +PROC getX() OF coordinate IS self.x.get() +/****** coordinate/getX ****************************************** + + NAME + getX() -- Get x part of coordinate. + + SYNOPSIS + coordinate.getX() + + FUNCTION + Returns the value of the x Float of the coordinate. + + RESULT + see float/get() +****************************************************************************** + +History + + +*/ +PROC getY() OF coordinate IS self.y.get() +/****** coordinate/getY ****************************************** + + NAME + getY() -- Get y part of coordinate. + + SYNOPSIS + coordinate.getY() + + FUNCTION + Returns the value of the y Float of the coordinate. + + RESULT + see float/get() +**************************************************************************** +History + + +*/ +PROC getZ() OF coordinate IS self.z.get() +/****** coordinate/getZ ****************************************** + + NAME + getZ() -- Get z part of coordinate. + + SYNOPSIS + coordinate.getZ() + + FUNCTION + Returns the value of the z Float of the coordinate. + + RESULT + see float/get() +****************************************************************************** + +History + + +*/ + +PROC setX(v) OF coordinate IS self.x.set(v) +/****** coordinate/setX ****************************************** + + NAME + setX() -- Set x part of coordinate. + + SYNOPSIS + coordinate.setX(v) + + FUNCTION + Sets the value of the x Float of the coordinate. + + INPUTS + parameter for float/set() +****************************************************************************** + +History + + +*/ + +PROC setY(v) OF coordinate IS self.y.set(v) +/****** coordinate/setY ****************************************** + + NAME + setY() -- Set y part of coordinate. + + SYNOPSIS + coordinate.setY(v) + + FUNCTION + Sets the value of the y Float of the coordinate. + + INPUTS + parameter for float/set() +****************************************************************************** + +History + + +*/ +PROC setZ(v) OF coordinate IS self.z.set(v) +/****** coordinate/setZ ****************************************** + + NAME + setZ() -- Set z part of coordinate. + + SYNOPSIS + coordinate.setZ(v) + + FUNCTION + Sets the value of the z Float of the coordinate. + + INPUTS + parameter for float/set() +****************************************************************************** + +History + + +*/ + + + +/* returns an array with a normal compare to all three dims? +PROC cmp(item:PTR TO integer) OF integer + IF self.number < item.number THEN RETURN -1 + RETURN IF self.number > item.number THEN 1 ELSE 0 +ENDPROC + +*/ + +PROC select(optionlist,index) OF coordinate +/****** coordinate/select ****************************************** + + NAME + select() -- Selection of action on initialization. + + SYNOPSIS + coordinate.select(optionlist, index) + + FUNCTION + Recognizes the following items: + "set" -- The following three items have to be of the type + that set() expects. + + INPUTS + optionlist -- The optionlist + + index -- the index of the optionlist + + SEE ALSO + object/select() +****************************************************************************** + +History + + +*/ +/* + +TODO: error check: len-o'-list! + +*/ +DEF item, value + + item := ListItem(optionlist, index) + + SELECT item + CASE "set" + INC index + self.x.set(ListItem(optionlist,index)) + + INC index + self.y.set(ListItem(optionlist,index)) + + INC index + self.z.set( ListItem(optionlist,index)) + + ENDSELECT + +ENDPROC index + + +PROC write() OF coordinate +/****** coordinate/write ****************************************** + + NAME + write() -- Get string with printable coordinate. + + SYNOPSIS + coordinate.write() + + FUNCTION + Returns a string with the printable coordinate. It looks like this: + + [ ; ; ] + + RESULT + String above. + + NOTES + The string has a maximum legth of 100 characters. + +****************************************************************************** + +History + + +*/ +DEF out + + out:=String(100) + + StrAdd(out,'[ ') + StrAdd(out, self.x.write()) + StrAdd(out,' ; ') + StrAdd(out, self.y.write()) + StrAdd(out,' ; ') + StrAdd(out, self.z.write()) + StrAdd(out,' ]') + + RETURN out +ENDPROC + + +PROC copy(to=NIL:PTR TO coordinate) OF coordinate +/****** coordinate/copy ****************************************** + + NAME + copy() -- Copy a coordinate + + SYNOPSIS + coordinate.copy(destination=NIL) + + FUNCTION + Copies a coordinate. + + INPUTS + destination=NIL:PTR TO coordinate -- Coordinate that is the + destination of the copy. IF NIL, a new coordinate will be + created. + + RESULT + PTR TO coordinate -- If the incoming coordinate object was + NIL a freshly created coordinated will be returned. + + NOTES + May raise extension on NEWing the coordinate when the incoming object + is NIL. + +****************************************************************************** + +History + + +*/ +DEF destination:PTR TO coordinate + + IF to=NIL THEN NEW destination.new() ELSE destination := to + + self.x.copy( destination.x ) + self.y.copy( destination.y ) + self.z.copy( destination.z ) + +ENDPROC destination + + +PROC shift(by:PTR TO coordinate) OF coordinate +/****** coordinate/shift ****************************************** + + NAME + shift() -- Shift a coordinate. + + SYNOPSIS + coordinate.shift(PTR TO coordinate) + + FUNCTION + Shifts a coordinate by another. + + INPUTS + PTR TO coordinate -- Coordinate to shift by. + + EXAMPLE + Be baseCoordinate [ 1.0 ; 0.0 ; 2.0 ] + Be secondCoordinate [ 0.0 ; 1.0 ; 1.0 ] + + baseCoordinate.shift(secondCoordinate) would result in + baseCoordinate being [ 1.0 ; 1.0 ; 3.0 ] + +****************************************************************************** + +History + + +*/ + + self.x.add(by.x) + self.y.add(by.y) + self.z.add(by.z) + +ENDPROC + + +-> turns 0-360 to 0-2*pi +PROC angle2radians(angle) OF coordinate +/****** coordinate/angle2radians ****************************************** + + NAME + angle2radians() -- Turn angle to radians. + + SYNOPSIS + coordinate.angle2radians(angle) + + FUNCTION + Turns an angle into it's radians equivalent. 360 degree would result + in 2*PI. + + INPUTS + angle -- Normal angle between 0 and 360 degree. HAS to be an e-float! + + RESULT + radians -- The according radians + +****************************************************************************** + +History + + +*/ +/* + +Seems to work only with angles>0 +NOTE: only float angles, please! + +*/ +DEF out[80]:STRING + + IF angle<0 THEN angle := angle+360 + + angle := angle/180.0 + angle := angle*3.14159265 + +-> RealF(out,angle,8) +-> WriteF('\s\n', out) + + RETURN angle +ENDPROC + + +PROC rotateZ(angle,coordinate=NIL:PTR TO coordinate) OF coordinate +/****** coordinate/rotateZ ****************************************** + + NAME + rotateZ() -- Rotate around the z axis. + + SYNOPSIS + coordinate.rotateZ(e-float,PTR TO coordinate) + + FUNCTION + If the second parameter is NIL the coordinate is rotated around the + z axis by the given angle. If a coordinate is specified, however, + the object will be rotated around the z axis that goes through that + point. + + INPUTS + angle -- Angle to rotate by. HAS to be an e-float! + + coordinate=NIL:PTR TO coordinate -- If provided the object won't be + rotated around [ 0.0 ; 0.0 ; 0.0 ] but around this coordinate. + + SEE ALSO + rotateY(), rotateX() +****************************************************************************** + +History + + +*/ +/* + +This method rotates the point by the given angle around the given coordinate. +If no coordinate is specified, we rotate aroung 0;0;0 + +*/ + +DEF fltangle, nux, nuy, out[80]:STRING, + fltx,flty, resulta, resultb + + /* + * To rotate around a point we do this: substract the coordinate's values, + * i.e. shift it to 0;0;0, rotate it, and add the coordinate's values + * to the result. + */ + + IF coordinate + self.x.substract(coordinate.x) + self.y.substract(coordinate.y) + self.z.substract(coordinate.z) + ENDIF + + + fltangle := self.angle2radians(angle) + + fltx := self.x.get() + flty := self.y.get() + + resulta := !fltx * Fcos(fltangle) + resultb := !flty * Fsin(fltangle) + + nux := !resulta - resultb + + resulta := !fltx * Fsin(fltangle) + resultb := !flty * Fcos(fltangle) + + nuy := !resulta + resultb + + /* + * Now let's shift it back to where it came from (see above) + */ + + self.x.set(nux) + self.y.set(nuy) + + IF coordinate + self.x.add(coordinate.x) + self.y.add(coordinate.y) + self.z.add(coordinate.z) + ENDIF + +ENDPROC + + +PROC rotateY(angle,coordinate=NIL:PTR TO coordinate) OF coordinate +/****** coordinate/rotateY ****************************************** + + NAME + rotateY() -- Rotate around the y axis. + + SYNOPSIS + coordinate.rotateY(e-float,PTR TO coordinate) + + FUNCTION + If the second parameter is NIL the coordinate is rotated around the + y axis by the given angle. If a coordinate is specified, however, + the object will be rotated around the y axis that goes through that + point. + + INPUTS + angle -- Angle to rotate by. HAS to be an e-float! + + coordinate=NIL:PTR TO coordinate -- If provided the object won't be + rotated around [ 0.0 ; 0.0 ; 0.0 ] but around this coordinate. + + SEE ALSO + rotateZ(), rotateX() +****************************************************************************** + +History + + +*/ +/* + + note: + + to rotate 90 degree (mathematical) one has to provide -90 + (wrong formula?) +*/ + +DEF fltangle, nux, nuz, out[80]:STRING, + fltx,fltz, resulta, resultb + + + IF coordinate + self.x.substract(coordinate.x) + self.y.substract(coordinate.y) + self.z.substract(coordinate.z) + ENDIF + + + fltangle := self.angle2radians(angle) + + fltx := self.x.get() + fltz := self.z.get() + + resulta := !fltz * Fcos(fltangle) + resultb := !fltx * Fsin(fltangle) + + nuz := !resulta - resultb + + resulta := !fltz * Fsin(fltangle) + resultb := !fltx * Fcos(fltangle) + + nux := !resulta + resultb + + self.x.set(nux) + self.z.set(nuz) + + IF coordinate + self.x.add(coordinate.x) + self.y.add(coordinate.y) + self.z.add(coordinate.z) + ENDIF + +ENDPROC + + +PROC rotateX(angle,coordinate=NIL:PTR TO coordinate) OF coordinate +/****** coordinate/rotateX ****************************************** + + NAME + rotateX() -- Rotate around the x axis. + + SYNOPSIS + coordinate.rotateX(e-float,PTR TO coordinate) + + FUNCTION + If the second parameter is NIL the coordinate is rotated around the + x axis by the given angle. If a coordinate is specified, however, + the object will be rotated around the x axis that goes through that + point. + + INPUTS + angle -- Angle to rotate by. HAS to be an e-float! + + coordinate=NIL:PTR TO coordinate -- If provided the object won't be + rotated around [ 0.0 ; 0.0 ; 0.0 ] but around this coordinate. + + SEE ALSO + rotateY(), rotateZ() +****************************************************************************** + +History + + +*/ +/* + + note: + + to rotate 90 degree (mathematical) one has to provide -90 + (wrong formula?) +*/ + +DEF fltangle, nuy, nuz, out[80]:STRING, + fltz,flty, resulta, resultb + + IF coordinate + self.x.substract(coordinate.x) + self.y.substract(coordinate.y) + self.z.substract(coordinate.z) + ENDIF + + + fltangle := self.angle2radians(angle) + + fltz := self.z.get() + flty := self.y.get() + + resulta := !flty * Fcos(fltangle) + resultb := !fltz * Fsin(fltangle) + + nuy := !resulta - resultb + + resulta := !flty * Fsin(fltangle) + resultb := !fltz * Fcos(fltangle) + + nuz := !resulta + resultb + + self.y.set(nuy) + self.z.set(nuz) + + IF coordinate + self.x.add(coordinate.x) + self.y.add(coordinate.y) + self.z.add(coordinate.z) + ENDIF + +ENDPROC + + +PROC neg() OF coordinate +/****** cordinate/neg ****************************************** + + NAME + neg() -- Negate cordinate. + + SYNOPSIS + coordinate.neg() + + FUNCTION + Negates the x, y and z value of the coordinate. + + SEE ALSO + float/neg() +****************************************************************************** + +History + + +*/ + self.x.neg() + self.y.neg() + self.z.neg() +ENDPROC + +/*EE folds +1 +54 34 56 32 190 50 192 40 194 40 196 34 199 43 201 81 203 73 205 72 207 24 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library.e new file mode 100644 index 0000000..492ae6b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library.e @@ -0,0 +1,183 @@ +/****** library/--background-- ****************************************** + + PURPOSE + Basic implementation of the Library object. + + CREATION + back in Februaray of 1995 by Gregor Goldbach + + HISTORY + Joseph E. van Riper III overworked everything a bit. + + SEE ALSO + library/device + +****************************************************************************** + +History + + +*/ +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/object' + +OBJECT library OF object +/****** library/--library-- ****************************************** + + NAME + library + + ATTRIBUTES + libName -- the name of the library + + version -- version of the library. 33 is v1.2 of the AmigaOS, + 37 is OS2.04, 39 is OS3.0, 40 is OS3.1 + + CREATION + back in February of 1995 by Gregor Goldbach + + HISTORY + JEVR3 changes; removed 'base', included 'name' and 'version', + now included in the 'oomodules' hierarchy. +****************************************************************************** + +History + + +*/ + identifier + version +ENDOBJECT + +PROC select(opts,i) OF library +/****** library/select ****************************************** + + NAME + select -- selection of actions via taglist + + SYNOPSIS + library.select() + + FUNCTION + Select an action for this object upon initialization. See + documentation of Object's new() and select. + + These items are recognized: + "name" -- next item is library name. Note that the identifier + is set to the string of characters you pass -- it is NOT + copied, so you have to keep the string. + + "ver" -- next item is library version to open. + + INPUTS + opts -- Optionslist + + i -- index of optionlist + + EXAMPLE + + /* + * create an instance of the library class and open gadtools + * version 37. + */ + + NEW library.new(["name", 'gadtools.library', "ver",37]) + +****************************************************************************** + +History + + +*/ +DEF item + + item:=ListItem(opts,i) + + SELECT item + + CASE "name" + + INC i + self.identifier:=ListItem(opts,i) + + CASE "ver" + + INC i + self.version:=ListItem(opts,i) + + ENDSELECT + +ENDPROC i + +PROC open() OF library IS self.derivedClassResponse() +/****** library/open ****************************************** + + NAME + open() -- Open the library + + SYNOPSIS + library.open() + + FUNCTION + + Open the library. Not functional in this basic object, the + derived objects have to take care of that. + +****************************************************************************** + +History + + +*/ + +PROC close() OF library IS self.derivedClassResponse() +/****** library/close ****************************************** + + NAME + close() -- Close the library + + SYNOPSIS + library.close() + + FUNCTION + Close the library. Not functional in this basic object, the + derived objects have to take care of that. + +****************************************************************************** + +History + + +*/ + +PROC end() OF library +/****** library/end ****************************************** + + NAME + end() -- Free resources. + + SYNOPSIS + library.end() + + FUNCTION + Frees all resources used by this object. Automatically called + when ENDing the object. + + NOTES + JEVR3 addition; seemed logical to make 'end()' close() the library. + +****************************************************************************** + +History + + +*/ + + self.close() +ENDPROC +/*EE folds +-1 +154 23 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/Examples new file mode 100644 index 0000000..78d9cdb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/Examples @@ -0,0 +1,39 @@ +@database library_example + +@node main "Introduction to Library" + +The library is an essential object in the Amiga system. Basically it's a +collection of functions. Refer to standard Amiga documentation (ROM Kernel +Reference Manuals or the Guru Book) for a more detailed explanation. + +The library object of the oomodules/ hierarchy doesn't enhance the usage +of libraries very much - at least not at this basic level. There are +derived objects that use this object as a 'foundation'. + + + + +The library object template @{" anylibrary " alink EMODULES:oomodules/library/anylibrary.e/main} may serve as an example for +own libraries. + +There is an @{" autodoc " link EMODULES:oomodules/oodoc/guides/library/main} file available or this object. + +@endnode + +@node initilisation "Allocation and initilisation of ..." + +Select takes some arguments. + +@endnode + +@node where "Where to use this object" + +Anywhere you want to use a library. + +@endnode + +@node see_also "See also" + +Library derived objects. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/anylibrary.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/anylibrary.e new file mode 100644 index 0000000..5d9b6d1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/anylibrary.e @@ -0,0 +1,142 @@ +/* + +Library template for any library. This object can be used to open other +libraries. See it as an example how to build own library derived objects. + +*/ + +OPT MODULE + + + +/* + +Export everything defined in here. + +*/ +OPT EXPORT + + + +/* + +Include the basic library object and normal E modules of the library to +implement. + +*/ + +MODULE 'oomodules/library', 'anylibrary', 'libraries/anylibrary' + + + +OBJECT anylibrary OF library +/****** anylibrary/--background-- ****************************************** + + NAME + anylibrary of library + + PURPOSE + Basic implementation of a simple library module. + + ATTRIBUTES + No special attributes since it's used for demonstration. + + CREATION + September 9 1996 Gregor Goldbach + +****************************************************************************** + +History + + +*/ +ENDOBJECT + + + +PROC init() OF anylibrary +/****** anylibrary/init ****************************************** + + NAME + init() -- Initialization of the object. + + SYNOPSIS + anylibrary.init() + + FUNCTION + Sets the library's name and the version to 0. After that the library + is opened. + + This menas that any version found be opened if the version isn't + changed in select(). + + SEE ALSO + open() +****************************************************************************** + +The object attributes identifier and version are set to initial values. +The version attribute may very well be changed by the "vers" tag of select() +if you want to open a specific version of the library. + +*/ + self.identifier:='anylibrary.library' + self.version:=0 + self.open() +ENDPROC + + + +PROC open() OF anylibrary +/****** anylibrary/open ****************************************** + + NAME + open() -- Open anylibrary.library + + SYNOPSIS + anylibrary.open() + + FUNCTION + Opens the anylibrary.library and sets the global library base to + the value returned by OpenLibrary(). + + EXCEPTIONS + "lib",{anylibOpen} will be raised if the opening fails. You should + provide at least one exception handler to receive the exception and + act on it. + +****************************************************************************** + +History + + +*/ + IF (anylibrarybase:=OpenLibrary(self.identifier,self.version)) = NIL THEN Throw("lib",{reqtoolOpen}) +ENDPROC + + +PROC close() OF anylibrary +/****** anylibrary/close ****************************************** + + NAME + close() -- Close the library. + + SYNOPSIS + anylibrary.close() + + FUNCTION + Closes the library. + + SEE ALSO + open() +****************************************************************************** + +History + + +*/ + CloseLibrary(anylibrarybase) +ENDPROC + + +anylibOpen: + CHAR 'Unable to open anylibrary.library.',0 diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/asl.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/asl.e new file mode 100644 index 0000000..65fa014 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/asl.e @@ -0,0 +1,309 @@ +OPT MODULE + +MODULE 'oomodules/library', + + 'asl', + 'libraries/asl', + + 'other/ecode', + 'dos/dos', + 'dos/dosasl', + 'utility/hooks' + +CONST MAXPATTERNLENGTH=80, + MAXFILELENGTH=30, + MAXDIRLENGTH=255 + +DEF patbuffer, + +/* + * The patbuffer variable is used in hookFunc and getFileWithPattern. It holds + * the pattern the files should match. + */ + + temporaryBuffer:PTR TO CHAR -> contains temporary data + +/* + * the temporary buffer contains the absolute file name of the file name + * that was chosen in the last requester. + */ + +EXPORT OBJECT asl OF library +/****** asl/asl ****************************** + + NAME + asl of library + + PURPOSE + Object for handling the asl.library. + + ATTRIBUTES + patbuffer[MAXPATTERNLENGTH]:ARRAY OF CHAR -- buffer to store the file + pattern in. + + lastFileChosen[MAXFILELENGTH]:ARRAY OF CHAR -- buffer to store the name + of the file that was chosen in the last requester. + + lastDirChosen[MAXDIRLENGTH]:ARRAY OF CHAR -- buffer to store the name + of the directory that was chosen in the last requester. + + NOTES + Not all functions of the asl.library are implemented. + + SEE ALSO + library + +********/ + patbuffer[MAXPATTERNLENGTH]:ARRAY OF CHAR, + lastFileChosen[MAXFILELENGTH]:ARRAY OF CHAR + lastDirChosen[MAXDIRLENGTH]:ARRAY OF CHAR +ENDOBJECT + +PROC init() OF asl +/****** reqtools/init ****************************************** + + NAME + init() -- Initialization of the object. + + SYNOPSIS + asl.init() + + FUNCTION + Copies 'SYS:' to the lastDirChosen attribute. + Sets the library's name and the version to 0. After that the library + is opened. + + SEE ALSO + open() +****************************************************************************** + +History + + +*/ + temporaryBuffer := String(255) + + AstrCopy(self.lastDirChosen, 'SYS:') + + self.identifier:='asl.library' + self.version:=0 + self.open() +ENDPROC + +EXPORT PROC open() OF asl +/****** asl/open ****************************** + + NAME + open() of asl -- Open the asl.library. + + SYNOPSIS + asl.open() + + FUNCTION + Open the asl.library. The version to open can be specified in the + option list you pass to new(). + + EXCEPTION + As with all libraries, the exception "lib" is raised when the opening + failed. The exceptioninfo contains a string that tells this. + + NOTES + The string may be localized in the future. + + SEE ALSO + asl + +********/ + + IF (aslbase:=OpenLibrary(self.identifier,self.version)) = NIL THEN Throw("lib",{aslOpen}) + +ENDPROC + +EXPORT PROC close() OF asl +/****** asl/close ****************************** + + NAME + close() of asl -- Close the library. + + SYNOPSIS + asl.close() + + FUNCTION + Closes the library if it is open. + + SEE ALSO + asl + +********/ + + IF aslbase THEN CloseLibrary(aslbase) + +ENDPROC + +PROC end() OF asl +/****** asl/end ****************************** + + NAME + end() of asl -- Global destructor. + + SYNOPSIS + asl.end() + + FUNCTION + Frees allocated resources and closes the library. + + SEE ALSO + asl + +********/ + + DisposeLink(temporaryBuffer) + self.close() + +ENDPROC + +PROC hookFunc(type, obj:PTR TO anchorpath, fr) +/****** /hookFunc ****************************** + + NAME + hookFunc() -- Hook function for requesters. + + SYNOPSIS + hookFunc(LONG, PTR TO anchorpath, LONG) + + hookFunc(type, obj, fr) + + FUNCTION + Used when displaying the file requesters. + + NOTES + Stolen from JRH's rkrm examples. Dunno how it works, so this autodoc + lacks the input description :-( + + SEE ALSO + getFileWithPattern(), rkrm examples +********/ + DEF returnvalue + SELECT type + CASE FILF_DOMSGFUNC + -> We got a message meant for the window + RETURN obj + CASE FILF_DOWILDFUNC + -> We got an AnchorPath structure, should the requester display this file? + + -> MatchPattern() is a dos.library function that compares a matching + -> pattern (parsed by the ParsePattern() DOS function) to a string and + -> returns TRUE if they match. + returnvalue:=MatchPattern(patbuffer, obj.info.filename) + + -> We have to negate MatchPattern()'s return value because the file + -> requester expects a zero for a match not a TRUE value + RETURN returnvalue=FALSE + ENDSELECT +ENDPROC + +EXPORT PROC getFileWithPattern(pattern:PTR TO CHAR, taglist=NIL) OF asl +/****** asl/getFileWithPattern ****************************** + + NAME + getFileWithPattern() of asl -- Get a file that matches the pattern. + + SYNOPSIS + asl.getFileWithPattern(PTR TO CHAR, LONG=NIL) + + asl.getFileWithPattern(pattern, taglist) + + FUNCTION + Opens a file requester that displays the files that match the pattern + provided. + + INPUTS + pattern:PTR TO CHAR -- The pattern of the files that should appear in + the file list. The usual dos.library wildcards are allowed. + + taglist:LONG -- asl tags. See CBM's asl.doc for those. + + RESULT + PTR TO CHAR -- The chosen file or NIL if the user aborted. + + NOTES + The attributes lastFileChosen and lastDirChosen are set by this proc. + + Stolen from JRH's rkrm examples. + + KNOWN BUGS + Tries to add a file name even if no file was chosen. Fixed this bug + (May 26 1996 Gregor Goldbach). + + SEE ALSO + asl/asl, CBM's asl.doc, JRH's rkrm examples + +********/ +DEF fr:PTR TO filerequester, + myFunc, + nulist + + ParsePattern(pattern, self.patbuffer, MAXPATTERNLENGTH) + + patbuffer := self.patbuffer + + fr:=AllocFileRequest() + -> E-Note: eCodeASLHook() sets up an E PROC for use as an ASL hook function + myFunc:=eCodeASLHook({hookFunc}) + + IF myFunc + + /* + * now we have myFunc. we're able to set up the tag list + */ + + nulist := List(255) + ListCopy(nulist, taglist) + ListAdd(nulist, [ASL_HOOKFUNC, myFunc, ASL_FUNCFLAGS, FILF_DOWILDFUNC OR FILF_DOMSGFUNC OR FILF_SAVE]) + + +/* + IF AslRequest(fr, [ASL_DIR, 'SYS:Utilities', +-> ASL_WINDOW, window, + ASL_TOPEDGE, 0, + ASL_HEIGHT, 200, + ASL_HAIL, 'Pick an icon, select save', + -> E-Note: use the value returned from aslhook() + ASL_HOOKFUNC, myFunc, + ASL_FUNCFLAGS, FILF_DOWILDFUNC OR FILF_DOMSGFUNC + ASL_OKTEXT, 'Save', + NIL]) +*/ + + IF AslRequest(fr, nulist) + + AstrCopy(self.lastDirChosen,fr.drawer, IF StrLen(fr.drawer) the size of the biggest device block + LONGEST_NAME=40 + +-> JEVR3 modification; moved 'name' to object 'library'. + + +OBJECT device OF library +/****** device/--device-- ****************************************** + + NAME + device + + ATTRIBUTES + unit -- The unit of the device you want to use. If you don't know + of a special unit to specify when you work with a device, set + it to 0. Otherwise, as with the trackdisk.device for example, + set it to the unit you want to operate on. Think of a unit as + a 'sub-system' of that device. + + io -- Pointer to the io request structure used for this device. + + flags -- Special flags you set. + + lasterror -- You for convenience, this entry contains the last + error as in io.error. + +****************************************************************************** + +History + + +*/ + unit + io:PTR TO io + flags + lasterror +ENDOBJECT + +-> JEVR3 addition; select() handles 'unit' and 'flag' options. + +PROC select(opts,i) OF device +/****** device/select ****************************************** + + NAME + select() -- Select action via taglist + + SYNOPSIS + device.select() + + FUNCTION + Select an action upon initialization of the object. See + object/new() and object/select() for more information. + + Recognizes these items: + "unit" -- set unit of device + + "flag" -- set flags of device + + INPUTS + opts -- Optionlist + + i -- index of optionlist + + SEE ALSO + object/select() +****************************************************************************** + +History + + +*/ + +DEF item + + item:=ListItem(opts,i) + + SELECT item + + CASE "unit" + INC i + self.unit := ListItem(opts,i) + + CASE "flag" + INC i + self.flags := ListItem(opts,i) + + DEFAULT + i:=SUPER self.select(opts,i) + + ENDSELECT +ENDPROC i + +-> JEVR3 modification; no more options (new() handles that). Changed the +-> error handling a little bit. + +PROC open() OF device HANDLE +/****** device/open ****************************************** + + NAME + open() -- Open a device with given attributes. + + SYNOPSIS + device.open() + + FUNCTION + Open a device with the attributes set. + + RETURNS + TRUE if the device could be opened. + + EXCEPTIONS + May raise "dev" with exceptioninfo + + {msgportfail} - CreateMsgPort() failed + {ioreqfail} - CreateIORequest() failed + {opendev} - OpenDevice() failed + + SEE ALSO + close(), select() +****************************************************************************** + +History + + +*/ +DEF ioreq=0:PTR TO io, + meinport:PTR TO mp, + fehler=0 + + IF self.io THEN RETURN TRUE -> JEVR3 modification.. reduce redundancy + +->try to open a no-name message port + + meinport := CreateMsgPort() + IF (meinport = NIL) THEN Throw("dev",{msgportfail}) + +->try to create an iorequest + + ioreq := CreateIORequest(meinport, SIZE_OF_BIGGEST_DEVICE_BLOCK) + IF (ioreq = NIL) THEN Throw("dev",{ioreqfail}) + +->try to open the device + + fehler := OpenDevice(self.identifier,self.unit,ioreq,self.flags) + IF(fehler) + Throw("dev",{opendev}) + ELSE + self.io := ioreq + RETURN TRUE + ENDIF + +-> EXCEPT handling by JEVR3 + +EXCEPT DO + IF ioreq THEN DeleteIORequest(ioreq) + IF meinport THEN DeleteMsgPort(meinport) + ReThrow() +ENDPROC FALSE + +-> JEVR3 modification; added IF statement + +PROC close() OF device +/****** device/close ****************************************** + + NAME + close() -- Close a device if open. + + SYNOPSIS + device.close() + + FUNCTION + Closes the device and frees allocated resources. + + SEE ALSO + open() +****************************************************************************** + +History + + +*/ + IF self.io + CloseDevice(self.io) + DeleteIORequest(self.io) + DeleteMsgPort(self.io.mn::mn.replyport) + ENDIF +ENDPROC + +PROC end() OF device +/****** device/end ***************************************** + + NAME + end() -- Frees allocated resources. + + SYNOPSIS + device.end() + + FUNCTION + Frees allocated resources of the object, that includes closing it. + Automatically called when ENDing the object. + +****************************************************************************** + +History + + +*/ + self.close() +ENDPROC + +PROC doio() OF device +/****** device/doio ****************************************** + + NAME + doio() -- Perform a DoIO(). + + SYNOPSIS + device.doio() + + FUNCTION + Perform exec.library's DoIO() on the io request. + + SEE ALSO + exec/DoIO() +****************************************************************************** + +History + + +*/ + IF self.io THEN DoIO(self.io) +ENDPROC + +PROC sendio() OF device +/****** device/sendio ****************************************** + + NAME + sendio() -- Perform a SendIO(). + + SYNOPSIS + device.sendio() + + FUNCTION + Perform exec.library's SendIO() on the io request. + + SEE ALSO + exec/SendIO() +****************************************************************************** + +History + + +*/ + IF self.io THEN SendIO(self.io) +ENDPROC + +PROC abortio() OF device +/****** device/abortio ****************************************** + + NAME + abortio() -- Perform a AbortIO(). + + SYNOPSIS + device.abortio() + + FUNCTION + Perform exec.library's AbortIO() on the io request. + + SEE ALSO + exec/AbortIO() +****************************************************************************** + +History + + +*/ + IF self.io THEN AbortIO(self.io) +ENDPROC + +PROC reset() OF device +/****** device/reset ****************************************** + + NAME + reset() -- Reset the device. + + SYNOPSIS + device.reset() + + FUNCTION + reset the device by sending the according command. + +****************************************************************************** + +History + + +*/ + IF self.io + self.io::iostd.command := CMD_RESET + DoIO(self.io) + ENDIF +ENDPROC + +-> JEVR3 addition: strings for error messages. These should change +-> in the future whenever we develop a fairly comprehensive locale +-> handling object for all our devices. Sorry it's English for now. + +msgportfail: + CHAR 'Couldn''t create message port.',0 +ioreqfail: + CHAR 'Couldn''t create i/o request.',0 +opendev: + CHAR 'Couldn''t open the device.',0 +/*EE folds +-1 +41 30 45 49 117 24 120 19 123 20 126 20 129 20 132 21 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/keyboard.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/keyboard.e new file mode 100644 index 0000000..f88d2a9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/keyboard.e @@ -0,0 +1,48 @@ +/* + +A first version of the keyboard object. By now only one command is +available: read(). Is reads from the keyboard. The pressed key(s) can +be read out of ivent:inputevent. + + V2.0 12.4.95 made it fit to 'Object' + should work +*/ + +OPT OSVERSION=37 +OPT MODULE +OPT EXPORT + +MODULE 'devices/keyboard','exec/io', 'devices/inputevent', + 'oomodules/library/device' + +OBJECT keyboard OF device + ievent:inputevent +ENDOBJECT + +PROC name() OF keyboard IS 'Keyboard' + +PROC init() OF keyboard + self.name := 'keyboard.device' +ENDPROC + +PROC read() OF keyboard + + IF self.io = NIL THEN self.open('keyboard.device',0,0) + + self.io::iostd.data := self.ievent + self.io::iostd.length := SIZEOF inputevent + self.io::iostd.command := KBD_READEVENT + + DoIO(self.io) + +ENDPROC + +PROC end() OF keyboard + self.close() +ENDPROC + +PROC openIfClosed() OF keyboard + + IF self.io = NIL THEN self.new(["name",'keyboard.device']) + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/printer.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/printer.e new file mode 100644 index 0000000..61894f0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/printer.e @@ -0,0 +1,238 @@ +OPT MODULE +OPT OSVERSION=37 +OPT EXPORT + +-> NOTE: some modifications to this by JEVR3 +-> All 'self.open()' statements changed to reflect use of 'new()' + +MODULE 'devices/printer', 'exec/devices', 'exec/io', 'exec/nodes', + 'exec/ports','exec/devices', + 'oomodules/library/device' + +OBJECT printer OF device +/****** printer/--printer-- ****************************************** + + NAME + printer of device + + PURPOSE + To provide basic means to control every printer. + + CREATION + Back in February of 1995 by Gregor Goldbach + + HISTORY + some minor modifications by Trey +****************************************************************************** + +History + + +*/ +ENDOBJECT + +-> JEVR3 addition: init() sets default name and unit for printer.device. + +PROC init() OF printer +/****** printer/init ****************************************** + + NAME + init() -- Initialization of the object. + + SYNOPSIS + printer.init() + + FUNCTION + Set default name and unit. +****************************************************************************** + +History + + +*/ + self.identifier:={defaultPrinter} + self.unit:=0 +ENDPROC + +PROC rawwrite(zkette,laenge) OF printer +/****** printer/rawwrite ****************************************** + + NAME + rawwrite() -- Printing chars without esc substitution. + SYNOPSIS + printer.rawwrite(PTR TO CHAR, LONG) + + FUNCTION + Sends the characters to the printer. Esc-sequences will not be + substituted. Opens the printer.device if necessary. + + INPUTS + PTR TO CHAR -- The characters to print + + LONG -- The number of characters to print + +****************************************************************************** + +History + + +*/ + +-> JEVR3 modification; removed surrounding IF/ENDIF; now in open() itself +-> Also tests to insure device opened. + + IF self.open() + + self.io::iostd.data := zkette + self.io::iostd.length := laenge + self.io::iostd.command := PRD_RAWWRITE + + self.doio() + + self.lasterror := self.io.error + ENDIF +ENDPROC + +PROC write(zkette,laenge) OF printer +/****** printer/write ****************************************** + + NAME + write() -- Printing chars with esc substitution. + SYNOPSIS + printer.write(PTR TO CHAR, LONG) + + FUNCTION + Sends the characters to the printer. Esc-sequences will be + substituted. Opens the printer.device if necessary. + + INPUTS + PTR TO CHAR -- The characters to print + + LONG -- The number of characters to print + +****************************************************************************** + +History + + +*/ +-> JEVR3 modification; removed surrounding IF/ENDIF; now in open() itself +-> Added test to see if it actually opened. + + IF self.open() + + + self.io::iostd.data := zkette + self.io::iostd.length := laenge + + self.io::iostd.command := CMD_WRITE + + self.doio() + + self.lasterror := self.io.error + ENDIF +ENDPROC + +PROC xcommand(kommando,p0=NIL,p1=NIL,p2=NIL,p3=NIL) OF printer +/****** printer/xcommand ****************************************** + + NAME + xcommand() -- execute printer command. + + SYNOPSIS + printer.xcommand(LONG, LONG=NIL, LONG=NIL, LONG=NIL, LONG=NIL) + + FUNCTION + Executes a printer command with the given parameters such as setting + left and right border, justification etc. + Opens the printer.device if necessary. + + INPUTS + command:LONG -- the printer command to be executed + param0-3:LONG -- command parameters + +****************************************************************************** + +History + +DESCRIPTION + + +*/ + +-> JEVR3 modification; removed surrounding IF/ENDIF; now in open() itself +-> Added test to see if it actually opened. + + IF self.open() + + self.io::ioprtcmdreq.prtcommand := kommando + self.io::ioprtcmdreq.parm0 := p0 + self.io::ioprtcmdreq.parm1 := p1 + self.io::ioprtcmdreq.parm2 := p2 + self.io::ioprtcmdreq.parm3 := p3 + self.io.command := PRD_PRTCOMMAND + self.doio() + + ENDIF + +ENDPROC + +PROC graphicdump(rport,cmap,vmodes,srcx,srcy,srcwidth,srcheight,destcols,destrows,special) OF printer +/****** printer/graphicdump ****************************************** + + NAME + graphicdump() -- Print a part of a rastport. + + SYNOPSIS + printer.graphicdump(10 LONGs) + + FUNCTION + It prints a part of a rastport. + + INPUTS + rport -- the RastPort containing the image to print + cmap -- screen's ColorMap + vmodes -- ViewModes of the screen + srcx,srcy, + srcwidth, + srcheight -- source dimensions: start point & width & height + destcols, + destrows - dimensions on the printer in points + Special - special flags + +****************************************************************************** + +History + + +*/ + +-> JEVR3 modification; removed surrounding IF/ENDIF; now in open() itself +-> Added test to make sure device was opened. + + IF self.open() + self.io::iodrpreq.rastport := rport + self.io::iodrpreq.colormap := cmap + self.io::iodrpreq.modes := vmodes + self.io::iodrpreq.srcx := srcx + self.io::iodrpreq.srcy := srcy + self.io::iodrpreq.srcwidth := srcwidth + self.io::iodrpreq.srcheight := srcheight + self.io::iodrpreq.destcols := destcols + self.io::iodrpreq.destrows := destrows + self.io::iodrpreq.special := special + + self.io.command := PRD_DUMPRPORT + self.doio() + ENDIF + +ENDPROC + +-> JEVR3 addition: strings for the default printer. + +defaultPrinter: + CHAR 'printer.device',0 +/*EE folds +-1 +12 20 16 18 19 36 22 37 25 41 28 48 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/printer/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/printer/test.e new file mode 100644 index 0000000..62ea145 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/printer/test.e @@ -0,0 +1,11 @@ +MODULE 'oomodules/library/device/printer/printer' + +PROC main() +DEF drucker:PTR TO printer + + NEW drucker.new() + drucker.write('Hallo',5) + + END drucker + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/printer/test2.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/printer/test2.e new file mode 100644 index 0000000..2285c7c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/printer/test2.e @@ -0,0 +1,44 @@ +/* + * this tests the printer object. NOTE: those vars are only needed + * for the graphic dump :) + */ + +-> NOTE: one modification to reflect enhancement by JEVR3 + +OPT OSVERSION=37 + +MODULE 'oomodules/library/device','exec/io','devices/printer', + 'oomodules/library/device/printer', + 'intuition/intuition', 'intuition/intuitionbase','graphics/gfxbase','graphics/view', + 'graphics/rastport' + +PROC main() +DEF drucker:PTR TO printer, + ibase:PTR TO intuitionbase, + gbase:PTR TO gfxbase, + vp:PTR TO viewport, + rp:PTR TO rastport + + ibase:=intuitionbase + gbase:=gfxbase + rp := ibase.activewindow::window.rport + vp := gbase.actiview::view.viewport + +-> JEVR3: added new() to set defaults. + + NEW drucker.new() + + drucker.graphicdump( rp, + vp.colormap, + vp.modes, + 0,0,100,100,100,100,0) + + drucker.rawwrite('Hallo', 5) + drucker.xcommand(27) -> superscript on + drucker.write('Hallo', 5) + + WriteF('Fehler:\d\n',drucker.io.error) + + + END drucker +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/trackdisk.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/trackdisk.e new file mode 100644 index 0000000..2e69aad --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/trackdisk.e @@ -0,0 +1,117 @@ +/* + +Second module for the trackdisk.device. Uses my E-PROCs from 1993 which were +adapted to use the device object. + +Gregor Goldbach 1st April 1995 + +VISION: + + - procs to read/write non-dos tracks + - open device if not opened already + + V2.0 12.4.95 made it fit to 'Object' + works +*/ + + +OPT MODULE +OPT OSVERSION=37 +OPT EXPORT + +MODULE 'exec/devices', 'exec/io', 'exec/nodes', + 'exec/ports','exec/devices', 'devices/trackdisk', + 'oomodules/library/device' + +OBJECT trackdisk OF device + label[16]:ARRAY OF CHAR + buffer[512]:ARRAY OF CHAR +ENDOBJECT + +PROC name() OF trackdisk IS 'Trackdisk' + +PROC init() OF trackdisk + self.name := 'trackdisk.device' +ENDPROC + +PROC motor(flag=FALSE,drive=0) OF trackdisk +DEF wert + + IF self.io = NIL THEN self.open('trackdisk.device',drive) + + IF flag THEN wert := 1 ELSE wert := 0 + /* ior.iostd.length := 1 -> Motor an */ + /* ior.iostd.length := 0 -> Motor aus */ + + self.io::iostd.length := wert + self.io::iostd.command := TD_MOTOR + self.doio() + +ENDPROC + +PROC getchangenum() OF trackdisk + + IF self.io = NIL THEN self.open('trackdisk.device') + + self.io::iostd.command := TD_CHANGENUM + self.doio() + RETURN self.io::iostd.actual /* ior.iostd.actual hier steht nach DoIO die Nummer drin */ +ENDPROC + +PROC readblock(nummer,drive=0) OF trackdisk + + IF self.io=NIL THEN self.open('trackdisk.device', drive, 0) + + self.io::ioexttd.count := self.getchangenum() + self.io::iostd.offset := nummer*512 -> der Offset wird in Bytes angegeben, ein Block = 512 Bytes + self.io::iostd.data := self.buffer + self.io::iostd.length := TD_SECTOR + self.io::ioexttd.seclabel := self.label -> vor jedem Block stehen noch 16 Bytes, sog. Label + self.io::iostd.command := ETD_READ + self.doio() + +ENDPROC self.io::iostd.error + +PROC writeblock(nummer,drive=0) OF trackdisk +DEF laufvar + + IF self.io=NIL THEN self.open('trackdisk.device',drive) + + -> set the block's label to 0 + FOR laufvar := 0 TO 15 DO self.label[laufvar]:=0 + + self.io::ioexttd.count := self.getchangenum() + self.io::iostd.offset := nummer*512 + self.io::iostd.data := self.buffer + self.io::iostd.length := TD_SECTOR + self.io::ioexttd.seclabel := self.label + self.io::iostd.command := ETD_WRITE + self.doio() + self.io::iostd.command := ETD_UPDATE ->nicht nur in den internen Puffer schreiben, sondern sofort abspeichern + self.doio() + +ENDPROC self.io::iostd.error + +PROC diskindrive(drive=0) OF trackdisk +-> disk in drive? + + IF self.io=NIL THEN self.open('trackdisk.device', drive) + + self.io::iostd.command := TD_CHANGESTATE + self.doio() + IF(self.io::iostd.actual = 0) THEN RETURN(TRUE) ELSE RETURN(FALSE) + /* wenn eine Diskette drin ist, ist ioreq.iostd.actual == 0! */ + +ENDPROC + + +PROC diskprotected(drive=0) OF trackdisk +-> disk write protected? + + IF self.io=NIL THEN self.open('trackdisk.device', drive) + + self.io::iostd.command := TD_PROTSTATUS + self.doio() + RETURN(self.io::iostd.actual) + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/trackdisk/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/trackdisk/test.e new file mode 100644 index 0000000..5fd0ed5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/device/trackdisk/test.e @@ -0,0 +1,23 @@ +MODULE 'oomodules/library/device/trackdisk/trackdisk' + +PROC main() +DEF diskette:PTR TO trackdisk, count + + NEW diskette.new() + + IF diskette.diskindrive() + + diskette.readblock(0) + + FOR count := 0 TO 15 DO WriteF(' \z\h[2] ', diskette.buffer[count]) + WriteF('\n') + FOR count := 0 TO 15 DO IF diskette.buffer[count] THEN WriteF(' \c ', diskette.buffer[count]) ELSE WriteF(' ') + WriteF('\n') + IF diskette.diskprotected() THEN WriteF('The disk is write protected.\n') + ELSE + WriteF('Please insert a disk in drive zero.\n') + ENDIF + diskette.motor(FALSE) + + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec.e new file mode 100644 index 0000000..b7251a2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec.e @@ -0,0 +1,14 @@ +OPT MODULE + +MODULE 'oomodules/library' + +OBJECT exec OF library +ENDOBJECT + +PROC name() OF exec IS 'Exec' + +PROC open(no_1=NIL,no_2=NIL,no_3=NIL) OF exec IS NIL + +PROC close() OF exec IS NIL + +PROC end() OF exec IS NIL diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/Examples new file mode 100644 index 0000000..7ca3d58 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/Examples @@ -0,0 +1,8 @@ +@database exec_example + +@node main "Introduction to Exec" + +This object does nothing and is a basic object. Not all objects in this +directory inherit from it, though. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port.e new file mode 100644 index 0000000..45e3b8e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port.e @@ -0,0 +1,433 @@ +OPT MODULE + +MODULE 'oomodules/object', + + 'exec/ports', + 'exec/nodes', + + 'gadtools' + +EXPORT OBJECT port OF object +/****** object/port ****************************** + + NAME + port of object -- Message port object. + + FUNCTION + + ATTRIBUTES + mp:PTR TO mp -- Pointer to message port. Ready to use after new(). + + lastMessage:PTR TO mn -- Pointer to last message received. The usual + restrictions about messages apply here, too -- don't access it + when you've replied. + + SEE ALSO + object, exec.library system documentation + +********/ + mp:PTR TO mp + lastMessage:PTR TO mn +ENDOBJECT + +PROC init() OF port +/****** port/init ****************************** + + NAME + init() of port -- Initialization of the object. + + SYNOPSIS + port.init() + + FUNCTION + Creates an unnamed message port. Note that the name can be + set with the "name" tag in select(). + + EXCEPTIONS + Raises "port", text when creation failed. + + EXAMPLE + + /* + * Add a port named 'testport' to the system + */ + + NEW port.new(["name", 'testport', "add"]) + + + + SEE ALSO + port + +********/ + + self.mp := CreateMsgPort() + + IF self.mp = NIL THEN Throw("port",'Unable to create message port.') + +ENDPROC + +PROC select(opts,i) OF port +/****** port/select ****************************** + + NAME + select() of port -- Selection of action upon initialization. + + SYNOPSIS + port.select(LONG, LONG) + + port.select(opts, i) + + FUNCTION + Recognized tags are: + "name" -- set port's name + "add" -- add the port to the system + + INPUTS + opts:LONG -- List of options + + i:LONG -- Index of option list + + SEE ALSO + port + +********/ +DEF item + + item:=ListItem(opts,i) + + + SELECT item + + CASE "name" + + INC i + self.mp::ln.name := ListItem(opts,i) + + CASE "add" + + self.addToSystem() + + ENDSELECT + +ENDPROC i + +PROC getSignalMask() OF port IS Shl(1,self.mp.sigbit) +/****** port/getSignalMask ****************************** + + NAME + getSignalMask() of port -- Get signal mask for Wait() + + SYNOPSIS + port.getSignalMask() + + FUNCTION + Gets the signal mask from an existing port. This mask is used + in Wait(). + + RESULT + LONG -- Signal mask of the port. + + EXAMPLE + + /* + * Wait for a message to arrive + */ + + mask := port.getSignalMask() + port.waitForSignalMask() + + SEE ALSO + port, exec/Wait(), waitForSignalMask() + +********/ + +PROC getMsg(mode="exec") OF port +/****** port/getMsg ****************************** + + NAME + getMsg() of port -- Get message from port. + + SYNOPSIS + port.getMsg(LONG="exec") + + port.getMsg(mode) + + FUNCTION + Get a message from the port. This message can either be one of + exec's or a gadtools message, the only argument sets this mode. + + INPUTS + mode:LONG -- "exec" for exec, "gadt" for gadtools message. Default + is "exec" + + RESULT + PTR TO mn -- Message pointer or NIL if no message was at the port. + + EXAMPLE + + /* + * Wait for a message to arrive at exec's port. + */ + + mask := port.getSignalMask() + IF (port.waitForSignalMask() AND mask) + + /* + * Get it. + */ + + message := port.getMsg() + + ENDIF + + SEE ALSO + port, getSignalMask(), exec/Wait() + +********/ + + SELECT mode + + CASE "gadt" + + IF gadtoolsbase + + self.lastMessage := Gt_GetIMsg(self.mp) + RETURN self.lastMessage + + ENDIF + + DEFAULT + + self.lastMessage := GetMsg(self.mp) + RETURN self.lastMessage + + ENDSELECT + +ENDPROC + +PROC replyMsg(mode="exec") OF port +/****** port/replyMsg ****************************** + + NAME + replyMsg() of port -- Reply a message. + + SYNOPSIS + port.replyMsg(LONG="exec") + + port.replyMsg(mode) + + FUNCTION + Reply a message that was received at the port. For multi-tasking + reasons this has to be done as soon as possible after receiving it. + + INPUTS + mode:LONG -- "exec" for exec message or "gadt" for gadtools. + + EXAMPLE + + /* + * Wait for a message to arrive at exec's port. + */ + + mask := port.getSignalMask() + IF (port.waitForSignalMask() AND mask) + + + + /* + * Get it. + */ + + message := port.getMsg() + + + + /* + * Copy the important data so we can reply at once. + */ + + port.replyMsg() + + ENDIF + + + SEE ALSO + port, exec/Wait(), exec.library system documentation about messages + +********/ + + IF self.lastMessage = NIL THEN RETURN + + SELECT mode + + CASE "gadt" + + IF gadtoolsbase THEN Gt_ReplyIMsg(self.lastMessage) + + DEFAULT + + ReplyMsg(self.lastMessage) + + ENDSELECT + +ENDPROC + +PROC waitForSignalMask(mask) OF port IS Wait(mask) +/****** port/waitForSignalMask ****************************** + + NAME + waitForSignalMask() of port -- Wait for signal mask. + + SYNOPSIS + port.waitForSignalMask(LONG) + + port.waitForSignalMask(mask) + + FUNCTION + Wait until a signal according to the mask is sent to the port. + + INPUTS + mask:LONG -- Mask to wait for. The should be the one from + getSignalMask(). + + RESULT + LONG -- Signal mask received. + + SEE ALSO + port, getSignalMask() + +********/ + +PROC wait() OF port IS Wait(self.getSignalMask()) +/****** port/wait ****************************** + + NAME + wait() of port -- Wait for a message to arrive. + + SYNOPSIS + port.wait() + + FUNCTION + Waits until a message arrives at the port. Use this function when + there is only one port in your program. + + RESULT + LONG -- Signal mask received. + + NOTES + See portList for waiting on any number of ports. + + SEE ALSO + port, portList + +********/ + +PROC end() OF port +/****** port/end ****************************** + + NAME + end() of port -- Global destructor. + + SYNOPSIS + port.end() + + FUNCTION + Removes the message port from the system and deletes it. Be sure you + have received all your messages. + + SEE ALSO + port + +********/ + + IF self.mp = NIL THEN RETURN + + self.removeFromSystem() + DeleteMsgPort(self.mp) + +ENDPROC + +PROC addToSystem() OF port +/****** port/addToSystem ****************************** + + NAME + addToSystem() of port -- Add port to the system. + + SYNOPSIS + port.addToSystem() + + FUNCTION + Adds the port to the system, i. e. you can receive messages from + other programs if they know the name of your port. Provide the + "add" tag when newing the port object and it will be added when + it's initialized. + + SEE ALSO + port + +********/ + + AddPort(self.mp) + +ENDPROC + +PROC removeFromSystem() OF port +/****** port/removeFromSystem ****************************** + + NAME + removeFromSystem() of port -- Remove port. + + SYNOPSIS + port.removeFromSystem() + + FUNCTION + Removes the port from the system. No other task will be able to send + you messages any more. Called in END automatically, DO NOT call it + unless you know what you do. + + SEE ALSO + port + +********/ + + RemPort(self.mp) + +ENDPROC + +EXPORT PROC wrapPort(p:PTR TO mp) +/****** port/wrapPort ****************************** + + NAME + wrapPort() -- Wrap a port system structure in an object. + + SYNOPSIS + wrapPort(PTR TO mp) + + wrapPort(p) + + FUNCTION + Wraps the system structure port in an object of that type. When + you have a port from, say, a window this can be quite useful. The + window port can then be used as if it was a normal port object. + + INPUTS + p:PTR TO mp -- Port to wrap. + + RESULT + PTR TO port -- Port object that was just created. + + SEE ALSO + portList + +********/ +DEF port:PTR TO port + + NEW port.new() + DeleteMsgPort(port.mp) + port.mp := p + + RETURN port + +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/Examples new file mode 100644 index 0000000..f8f5b10 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/Examples @@ -0,0 +1,24 @@ +@database port_example + +@node main "Introduction to Port" + +Port is another 'wrapper' object for a system structure - exec.library's +message port. This is used in inter-task communication such as intuition +or arexx. + +There is an @{" autodoc " link EMODULES:oomodules/oodoc/guides/port/main} file available or this object. + +To know more about message ports read the RKRM or take a look at the @{" AEE " link "AEE:exec/message ports.guide/main"} guide about it. +@endnode + +@node where "Where to use this object" + +Wherever you need a port. + +@endnode + +@node see_also "See also" + +Port derived objects and Amiga system documentation about message ports. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/arexxPort/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/arexxPort/test.e new file mode 100644 index 0000000..d003566 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/arexxPort/test.e @@ -0,0 +1,31 @@ +/* + +Open ARexx port and get messages. Print the text that was sent to stdout. +Exit on message 'QUIT' + +*/ + +MODULE 'oomodules/library/exec/port/arexxport' + +PROC main() +DEF a:PTR TO arexxPort, + quit=FALSE + + NEW a.new(["name", 'gregor', "add"]) + + REPEAT + + a.wait() + a.getMsg() + + WriteF('\s\n', a.getArgStr(0)) + + IF OstrCmp(a.getArgStr(0), 'QUIT')=0 THEN quit := TRUE + + a.replyMsg() + + UNTIL quit + + END a + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/arexxport.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/arexxport.e new file mode 100644 index 0000000..00be495 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/arexxport.e @@ -0,0 +1,168 @@ +OPT MODULE + +MODULE 'oomodules/library/exec/port', + + 'exec/ports', + 'exec/nodes', + + 'rexx/storage', + + 'rexxsyslib', + 'gadtools' + +EXPORT OBJECT arexxPort OF port +/****** port/arexxPort ****************************** + + NAME + arexxPort() of port -- + + SYNOPSIS + port.arexxPort(LONG, LONG) + + port.arexxPort(result1, result2) + + FUNCTION + + INPUTS + result1:LONG -- + + result2:LONG -- + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + port + +********/ + result1 + result2 +ENDOBJECT + +PROC replyMsg(mode="exec") OF arexxPort +/****** arexxPort/replyMsg ****************************** + + NAME + replyMsg() of arexxPort -- + + SYNOPSIS + arexxPort.replyMsg(LONG="exec") + + arexxPort.replyMsg(mode) + + FUNCTION + + INPUTS + mode:LONG -- + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + arexxPort + +********/ +DEF msg:PTR TO rexxmsg + + IF self.lastMessage = NIL THEN RETURN + + msg := self.lastMessage + + msg.result1:= self.result1 + msg.result2:= self.result2 + + IF msg.action AND RXFF_RESULT AND (self.result1=0) AND (self.result2<>NIL) + msg.result2:=CreateArgstring(self.result2,StrLen(self.result2)) + ENDIF + + ReplyMsg(msg) + +ENDPROC + +PROC setResults(result1, result2) OF arexxPort +/****** arexxPort/setResults ****************************** + + NAME + setResults() of arexxPort -- + + SYNOPSIS + arexxPort.setResults(LONG, LONG) + + arexxPort.setResults(result1, result2) + + FUNCTION + + INPUTS + result1:LONG -- + + result2:LONG -- + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + arexxPort + +********/ + + self.result1 := result1 + self.result2 := result2 + +ENDPROC + +PROC getArgStr(number) OF arexxPort +/****** arexxPort/getArgStr ****************************** + + NAME + getArgStr() of arexxPort -- + + SYNOPSIS + arexxPort.getArgStr(LONG) + + arexxPort.getArgStr(number) + + FUNCTION + + INPUTS + number:LONG -- + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + arexxPort + +********/ + + RETURN self.lastMessage::rexxmsg.args[number] + +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/portList/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/portList/test.e new file mode 100644 index 0000000..500d3b6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/portList/test.e @@ -0,0 +1,309 @@ +/* + +Old program that builds a frame for own programs that use more than one +window. + +Created back in 1993 where 2.1b was the available version of EC :) + +The REPEAT...UNTIL loop in the *huge* main proc shows the usage of portList +and port procs. + +es, the program looks ugly. I just browsed through my sources looking for +a program that works with multiple windows and that was easy to modify... + +*/ + +/* + * Windowgrundgerüst.e + * + * Ein kleines Proggy, das ein Haupt- und Nebenfenster öffnet und in das + * Hauptfenster ein Menü hängt. Samt Abfrage der Inputevents. Flagge für + * gedrückte linke Maustaste. IntuiMessage wird kopiert in + * ·meineintmessage· und dann sofort zurückgegeben. Bei Betätigung des + * Close-Gadgets werden im Hafen liegende Nachrichten abgeholt, jedoch + * nicht bearbeitet. + * + * V1.3 von Gregor Goldbach. 'Placed in the Public Domain.' + * compilierbar mit v2.1b/v3.0a/v3.0b + */ + + +MODULE 'intuition/intuition','intuition/screens','gadtools', + 'libraries/gadtools', 'graphics/text','exec/ports','graphics/scale', + 'graphics/rastport','graphics/gfx','exec/memory', 'exec/nodes', + 'exec/lists', + + 'oomodules/library/exec/port/portList', + 'oomodules/library/exec/port' + + +ENUM FEHLER_NOGADTOOLS,FEHLER_NOVISUAL,FEHLER_NOMENUS, FEHLER_GADGET, FEHLER_CONTEXT + +DEF hauptwin:PTR TO window, /* Hauptfenster */ + nebenwin:PTR TO window, /* Nebenfenster */ + uport:PTR TO mp, /* UserPort: für Signal */ + pscreen:PTR TO screen, /* für LockPubScreen() */ + lmbdown=FALSE, /* Flagge: gesetzt, wenn linke Maustaste gedrückt */ + intmsg:PTR TO intuimessage, /* von GetMsg() */ + meineintmessage:PTR TO intuimessage, /* Kopie der intmsg */ + zahl1,zahl2, + zkette_x[80]:STRING, adresse_x, + + vinfo=NIL, /* VisualInfo, muß 0 sein */ + menu=NIL, /* für LayoutMenus(), muß 0 sein */ + + listv:PTR TO LONG, + gadgetliste=NIL, + g:PTR TO gadget + +PROC main() HANDLE + +DEF meineklasse,meincode,x,y,x2,y2,laufvar, + + ports:PTR TO portList, + port:PTR TO port, + portKey + + NEW ports.new() + + IF(meineintmessage := AllocMem(SIZEOF intuimessage, MEMF_CLEAR OR MEMF_PUBLIC))=NIL + WriteF('Kein Speicher (\d Bytes) für Kopie der intuimessage!\n', SIZEOF intuimessage) + CleanUp(20) + ENDIF + + gadtoolsbase := OpenLibrary('gadtools.library', 37) + IF gadtoolsbase=NIL THEN Raise(FEHLER_NOGADTOOLS+4) + + pscreen := LockPubScreen(NIL) + IF(vinfo := GetVisualInfoA(pscreen, NIL)) = NIL THEN Raise(FEHLER_NOVISUAL) + IF(g:=CreateContext( {gadgetliste} ))=NIL THEN Raise(FEHLER_CONTEXT) + + listv:=[0,0,0,0]; listv[0]:=listv+4; listv[2]:=listv /* listenheader?*/ + AddTail(listv,[0,0,0,0,'eins']:ln) + AddTail(listv,[0,0,0,0,'zwei']:ln) + AddTail(listv,[0,0,0,0,'drei']:ln) + AddTail(listv,[0,0,0,0,'vier']:ln) + AddTail(listv,[0,0,0,0,'fünf']:ln) + + IF (g:=CreateGadgetA(LISTVIEW_KIND,g, + [8,4,155,40,NIL,NIL,2,0,vinfo,0]:newgadget, + [GTLV_LABELS,listv, + GTLV_SHOWSELECTED,0, + 0,0]))=NIL THEN Raise(FEHLER_GADGET) + + hauptwin := OpenWindowTagList(NIL, + [WA_TITLE,'Hauptfenster', + WA_IDCMP,IDCMP_RAWKEY OR IDCMP_CLOSEWINDOW OR IDCMP_MOUSEMOVE OR IDCMP_GADGETUP OR IDCMP_GADGETDOWN OR IDCMP_MOUSEBUTTONS OR IDCMP_MENUPICK OR IDCMP_REFRESHWINDOW, + WA_FLAGS,WFLG_ACTIVATE+WFLG_CLOSEGADGET, + WA_GADGETS, gadgetliste, + WA_INNERHEIGHT,120, WA_DEPTHGADGET, TRUE, + WA_DRAGBAR, TRUE, + WA_REPORTMOUSE,TRUE,WA_GIMMEZEROZERO,TRUE,NIL]) + + Gt_RefreshWindow(hauptwin,NIL) + + SetAPen(hauptwin.rport,1) + SetBPen(hauptwin.rport,0) + SetDrMd(hauptwin.rport,RP_JAM2) + + nebenwin := OpenWindowTagList(NIL, + [WA_TITLE,'Nebenfenster',WA_IDCMP,IDCMP_RAWKEY+IDCMP_CLOSEWINDOW+IDCMP_MOUSEMOVE+IDCMP_GADGETUP+IDCMP_MOUSEBUTTONS+IDCMP_MENUPICK OR IDCMP_REFRESHWINDOW, + WA_FLAGS,WFLG_ACTIVATE+WFLG_CLOSEGADGET, + WA_TOP,120, + WA_INNERHEIGHT,60,WA_DEPTHGADGET,TRUE, + WA_DRAGBAR, TRUE, + WA_REPORTMOUSE,TRUE,WA_GIMMEZEROZERO,TRUE,NIL]) + + + /* + * Add port to the list and use window pointers as keys. We get the + * according key when a message arrives at that port. + */ + + ports.add(hauptwin.userport, hauptwin) + ports.add(nebenwin.userport, nebenwin) + + + + REPEAT + + /* + * Get message, port key and port from the list. + */ + + intmsg, portKey, port := ports.waitAndGet("gadt") + + + /* + * Check portKey for matching window pointer + */ + + IF(portKey = hauptwin) + REPEAT + + kopiere_intmessage(intmsg,meineintmessage) + + port.replyMsg("gadt") + + meineklasse := meineintmessage.class + meincode := meineintmessage.code + + SELECT meineklasse + CASE IDCMP_CLOSEWINDOW + /* + * Nach Betätigung des Close-Gadgets werden alle eingelaufenen + * Nachrichten entfernt. + */ + WHILE(intmsg := port.getMsg("gadt")) DO port.replyMsg("gadt") + + CASE IDCMP_MENUPICK + handle_menus(meincode) + CASE IDCMP_MOUSEBUTTONS + IF meincode = 104 + lmbdown:=TRUE + tete(hauptwin,'Hi! and Welcome', 12,10,40,10) + tete(hauptwin,'The Amiga E Encyclopedia', 12,20,40,10) + + ELSEIF meincode = 232 + lmbdown:=FALSE + ENDIF + CASE IDCMP_GADGETUP + StringF(zkette_x, 'Eintrag Nummer \d.', meincode) + Move(hauptwin.rport, 100, 100) + Text(hauptwin.rport, zkette_x, StrLen(zkette_x)) + + CASE IDCMP_REFRESHWINDOW + Gt_BeginRefresh(hauptwin) + Gt_EndRefresh(hauptwin, TRUE) + + ENDSELECT + UNTIL (intmsg := port.getMsg("gadt")=NIL) + + ELSEIF(portKey = nebenwin) + + /* + * Here we have the more 'traditional' way of message processing. + */ + + WHILE(intmsg := Gt_GetIMsg(nebenwin.userport)) + kopiere_intmessage(intmsg,meineintmessage) + Gt_ReplyIMsg(intmsg) + + meineklasse := meineintmessage.class + meincode := meineintmessage.code + + SELECT meineklasse + CASE IDCMP_CLOSEWINDOW + /* + * Nach Betätigung des Close-Gadgets werden alle eingelaufenen + * Nachrichten entfernt. + */ + WHILE(intmsg := GetMsg(hauptwin.userport)) DO ReplyMsg(intmsg) + + CASE IDCMP_MOUSEBUTTONS + IF meincode = 104 + lmbdown:=TRUE + + ELSEIF meincode = 232 + lmbdown:=FALSE + ENDIF + + CASE IDCMP_REFRESHWINDOW + Gt_BeginRefresh(hauptwin) + Gt_EndRefresh(hauptwin, TRUE) + + ENDSELECT + ENDWHILE + ENDIF + + UNTIL ((meineklasse=IDCMP_CLOSEWINDOW) AND (portKey AND hauptwin)) + + ClearMenuStrip(hauptwin) + FreeMenus(menu) + CloseWindow(hauptwin) + IF nebenwin THEN CloseWindow(nebenwin) + IF gadgetliste THEN FreeGadgets(gadgetliste) + FreeVisualInfo(vinfo) + UnlockPubScreen(NIL,pscreen) + IF gadtoolsbase THEN CloseLibrary(gadtoolsbase) + FreeMem(meineintmessage, SIZEOF intuimessage) + WriteF('Einen schönen Tag noch!\n') + CleanUp(0) +EXCEPT + IF hauptwin THEN ClearMenuStrip(hauptwin) + IF menu THEN FreeMenus(menu) + IF vinfo THEN FreeVisualInfo(vinfo) + IF(hauptwin) THEN CloseWindow(hauptwin) + IF nebenwin THEN CloseWindow(nebenwin) + IF gadgetliste THEN FreeGadgets(gadgetliste) + IF gadtoolsbase THEN CloseLibrary(gadtoolsbase) + WriteF('Fehler Nummer \d\n',exception) + CleanUp(20) + +ENDPROC + + +PROC handle_menus(code) +DEF titel,item,subitem,gadnummer,zkette[50]:STRING,fenster:PTR TO window, + laufvar + + titel := (code AND %11111) /* Bits 0-4 */ + item := ((code/32) AND %111111) /* Bits 5-11 */ + subitem := ((code/2048) AND %11111) /* Bits 11-15 */ + + IF (code < 65535) + SELECT titel + CASE 1 + SELECT item + CASE 0 + NOP + CASE 1 + NOP + CASE 2 + NOP + CASE 3 + NOP + ENDSELECT + ENDSELECT + ENDIF +ENDPROC + + +PROC kopiere_intmessage(i1,i2) +/* kopiert die inhalte von i1 nach i2 */ +DEF int1:PTR TO intuimessage,int2:PTR TO intuimessage + + int1 := i1 + int2 := i2 + +/* + int2.execmessage := int1.execmessage +*/ + int2.class := int1.class + int2.code := int1.code + int2.class := int1.class + int2.qualifier := int1.qualifier + int2.iaddress := int1.iaddress + int2.mousex := int1.mousex + int2.mousey := int1.mousey + int2.seconds := int1.seconds + int2.micros := int1.micros + int2.idcmpwindow := int1.idcmpwindow + int2.speciallink := int1.speciallink + +ENDPROC + +PROC tete(win:PTR TO window, zkette, x_start,y_start, x_end,y_end) +DEF zaehler + + FOR zaehler := x_start TO x_end + Move(win.rport,zaehler,y_start) + SetAPen(win.rport,1) + Text(win.rport,zkette, StrLen(zkette)) + WaitTOF() + SetAPen(win.rport,0) + Text(win.rport,zkette, StrLen(zkette)) + ENDFOR + +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/portlist.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/portlist.e new file mode 100644 index 0000000..4255739 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/exec/port/portlist.e @@ -0,0 +1,196 @@ +OPT MODULE + +MODULE 'oomodules/list/associativeArray', + 'oomodules/library/exec/port', + + 'exec/ports' + +EXPORT OBJECT portList OF associativeArray +/****** associativeArray/portList ****************************** + + NAME + portList() of associativeArray -- + + SYNOPSIS + associativeArray.portList(LONG) + + associativeArray.portList(signalMask) + + FUNCTION + + INPUTS + signalMask:LONG -- + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + associativeArray + +********/ + signalMask +ENDOBJECT + +PROC add(p:PTR TO mp,key) OF portList +/****** portList/add ****************************** + + NAME + add() of portList -- + + SYNOPSIS + portList.add(PTR TO mp, LONG) + + portList.add(p, key) + + FUNCTION + + INPUTS + p:PTR TO mp -- + + key:LONG -- + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + portList + +********/ +DEF port:PTR TO port + + port := wrapPort(p) + + SUPER self.set(key, port) + self.signalMask := self.signalMask OR port.getSignalMask() + +ENDPROC + +PROC delete(port:PTR TO port) OF portList +/****** portList/delete ****************************** + + NAME + delete() of portList -- + + SYNOPSIS + portList.delete(PTR TO port) + + portList.delete(port) + + FUNCTION + + INPUTS + port:PTR TO port -- + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + portList + +********/ + + IF port = NIL THEN RETURN + + self.remove(port) + END port + +ENDPROC + +PROC wait() OF portList IS Wait(self.signalMask) +/****** portList/wait ****************************** + + NAME + wait() of portList -- + + SYNOPSIS + portList.wait() + + FUNCTION + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + portList + +********/ + +PROC waitAndGet(mode="exec") OF portList +/****** portList/waitAndGet ****************************** + + NAME + waitAndGet() of portList -- + + SYNOPSIS + portList.waitAndGet(LONG="exec") + + portList.waitAndGet(mode) + + FUNCTION + + INPUTS + mode:LONG -- + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + portList + +********/ +DEF signal, + port:PTR TO port, + index=-1 + + IF self.tail = 0 THEN RETURN + + signal := self.wait() + + REPEAT + + INC index + port := self.val[index] + + UNTIL (signal AND port.getSignalMask()) + +-> WriteF('Message arrived at port \d.\n', port) + + RETURN port.getMsg(mode), self.key[index], port + +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/gadtools.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/gadtools.e new file mode 100644 index 0000000..30c7d5d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/gadtools.e @@ -0,0 +1,94 @@ +OPT MODULE + +MODULE 'oomodules/library', + 'oomodules/object', + + 'gadtools', + 'libraries/gadtools' + +EXPORT OBJECT gadtools OF library +ENDOBJECT + +EXPORT PROC init() OF gadtools + + self.version:=0 + self.open() + +ENDPROC + +PROC open() OF gadtools + + IF gadtoolsbase THEN RETURN + + IF (gadtoolsbase := OpenLibrary('gadtools.library', self.version))=NIL THEN Throw("lib", 'Unable to open gadtools.library') + +ENDPROC + +PROC close() OF gadtools +/****** locale/close ****************************** + + NAME + close() of locale -- + + SYNOPSIS + locale.close() + + FUNCTION + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + locale + +********/ + + IF gadtoolsbase THEN CloseLibrary(gadtoolsbase) + +ENDPROC + + +PROC end() OF gadtools +/****** locale/end ****************************** + + NAME + end() of locale -- + + SYNOPSIS + locale.end() + + FUNCTION + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + locale + +********/ + + self.close() + +ENDPROC + + + +PROC name() OF gadtools IS 'Gadtools' +/*EE folds +-1 +12 4 15 5 18 27 22 27 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale.e new file mode 100644 index 0000000..e110757 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale.e @@ -0,0 +1,392 @@ +OPT MODULE + +MODULE 'oomodules/library', + 'oomodules/object', + 'oomodules/sort/string', + + 'locale', + 'libraries/locale' + +EXPORT OBJECT locale OF library +/****** library/locale ****************************** + + NAME + locale of library + + PURPOSE + Object wrapper for the locale.library + + ATTRIBUTES + catalog:LONG -- Catalog as returned from OpenCatalog() + + builtinLanguage:LONG -- String that says which language we want. + NIL is for english. + + SEE ALSO + library + +********/ + catalog -> the current catalog + builtinLanguage -> if NIL it's english +ENDOBJECT + +EXPORT PROC init() OF locale +/****** locale/init ****************************** + + NAME + init() of locale -- Initilization of the object. + + SYNOPSIS + locale.init() + + FUNCTION + Opens any version of the library. + + SEE ALSO + locale + +********/ + + self.version:=0 + self.open() + +ENDPROC + +PROC open() OF locale +/****** locale/open ****************************** + + NAME + open() of locale -- Open locale. + + SYNOPSIS + locale.open() + + FUNCTION + Opens the locale.library and throws an exceptions if opening failed. + + SEE ALSO + locale, library/open + +********/ + + IF localebase THEN RETURN + + IF (localebase := OpenLibrary('locale.library', self.version))=NIL THEN Throw("lib", 'Unable to open locale.library') + +ENDPROC + +PROC close() OF locale +/****** locale/close ****************************** + + NAME + close() of locale -- Close locale.library + + SYNOPSIS + locale.close() + + FUNCTION + Closes the library if it was open. + + SEE ALSO + locale, library/close + +********/ + + IF localebase THEN CloseLibrary(localebase) + +ENDPROC + +PROC openCatalog(locale, name:PTR TO CHAR, builtinLanguage=NIL:PTR TO CHAR) OF locale +/****** locale/openCatalog ****************************** + + NAME + openCatalog() of locale -- Open catalog. + + SYNOPSIS + locale.openCatalog(LONG, PTR TO CHAR, PTR TO CHAR=NIL:PTR TO CHAR) + + locale.openCatalog(locale, name, builtinLanguage) + + FUNCTION + Opens the specified catalog. If the catalog of this object is open + when you call this function it is closed first. + + INPUTS + locale:LONG -- Pointer to locale structure, normally left NIL. + + name:PTR TO CHAR -- Name o catalog to open. + + builtinLanguage:PTR TO CHAR -- 'Native' language of your program. + Used if the desired catalog couldn't be opened. If NIL, your + program speaks english. + + RESULT + LONG -- Opended catalog or NIL if opening failed. + + EXAMPLE + /* + * Try to open term's catalog. + */ + + NEW locale.new(["ctlg", 'term.catalog']) + + + + /* + * Success? + */ + + IF locale.catalog + + /* + * do anything with it + */ + + ENDIF + + + + /* + * Try to open the Prefs catalog. If term.catalog is still open, + * it will be closed first. + */ + + locale.openCatalog(NIL, 'prefs.catalog', NIL) + + /* + * do anything with it + */ + + SEE ALSO + locale + +********/ + + IF self.catalog -> if there's a catalog open + + self.closeCatalog(self.catalog) + + self.catalog := NIL + + ENDIF + + self.builtinLanguage := builtinLanguage + + self.catalog := OpenCatalogA(locale,name, IF self.builtinLanguage=NIL THEN 'english' ELSE self.builtinLanguage) + + RETURN self.catalog + +ENDPROC + +PROC closeCatalog(catalog) OF locale +/****** locale/closeCatalog ****************************** + + NAME + closeCatalog() of locale -- Close catalog. + + SYNOPSIS + locale.closeCatalog(LONG) + + locale.closeCatalog(catalog) + + FUNCTION + Closes a catalog that was opened with openCatalog(). + + INPUTS + catalog:LONG -- Catalog to close. + + SEE ALSO + locale + +********/ + + IF catalog THEN CloseCatalog(catalog) + +ENDPROC + +PROC getString(number, default=NIL:PTR TO CHAR) OF locale +/****** locale/getString ****************************** + + NAME + getString() of locale -- Get string from open catalog. + + SYNOPSIS + locale.getString(LONG, PTR TO CHAR=NIL:PTR TO CHAR) + + locale.getString(number, default) + + FUNCTION + Gets a string from an opened catalog and returns it. If it fails, + the passed default string will be returned. + + INPUTS + number:LONG -- Number of string to get from the catalog. + + default:PTR TO CHAR -- Default string to return on failure. + + RESULT + PTR TO CHAR -- string from catalog or default string. + LONG -- "NoCa" if no catalog is open. + + SEE ALSO + locale + +********/ +-> gets a string from the current catalog +-> if no catalog is open returns "NoCa" (no catalog) + + IF self.catalog THEN RETURN GetCatalogStr(self.catalog,number,default) ELSE RETURN "NoCa" + +ENDPROC + +PROC end() OF locale +/****** locale/end ****************************** + + NAME + end() of locale -- Global destructor. + + SYNOPSIS + locale.end() + + FUNCTION + Closes open catalog and locale.library. + + SEE ALSO + locale + +********/ + + self.closeCatalog(self.catalog) + + self.close() + +ENDPROC + +PROC select(optionlist, index) OF locale +/****** locale/select ****************************** + + NAME + select() of locale -- Selection of action upon initialisation. + + SYNOPSIS + locale.select(LONG, LONG) + + locale.select(optionlist, index) + + FUNCTION + The following tags are recognized: + "ctlg" -- Name of catalog to open. The catalog will be opened + at once via openCatalog(). + "lang" -- Sets the builtin language. Any string or NIL for + 'english' + + INPUTS + optionlist:LONG -- List of options. + + index:LONG -- Index of optionlist. + + SEE ALSO + locale + +********/ +DEF item + + item:=ListItem(optionlist,index) + + SELECT item + + CASE "ctlg" -> open catalog + + INC index + self.openCatalog(NIL, ListItem(optionlist,index), self.builtinLanguage) + + CASE "lang" -> set builtin language + + INC index + self.builtinLanguage := ListItem(optionlist,index) + + ENDSELECT + +ENDPROC index + +PROC getObjectString(object:PTR TO object, container:PTR TO string,number, default=NIL:PTR TO CHAR) OF locale +/****** locale/getObjectString ****************************************** + + NAME + getLocalizedObjectString() -- Get string from object catalog + + SYNOPSIS + locale.getObjectString(PTR TO object, PTR TO string, LONG, PTR TO CHAR=NIL:PTR TO CHAR) + + locale.getObjectString(object, container, number, default) + + FUNCTION + Gets a string from the object's catalog. + + INPUTS + object:PTR TO object -- Object to get the string for + + container:PTR TO string -- String object to store the string in + + number:LONG -- Number of string to get + + default=NIL:PTR TOF CHAR -- The default string to return if there is no string + of that number. + + RESULT + "NoCa" if the locale.library couldn't be opened. + The default string if there's no entry of that number in the catalog, + otherwise the requested string. + + NOTES + The returned string from the catalog is READ-ONLY. + +******************************************************************************/ + +DEF string:PTR TO string, + oldCatalog, + stringToReturn:PTR TO CHAR + + END container + NEW container.new() + + NEW string.new() + string.cat('oomodules/') + string.cat(object.name()) + string.cat('.catalog') + + /* + * 'save' the old catalog + */ + + oldCatalog := self.catalog + + /* + * Set it to NIL so self.openCatalog() won't close it + */ + + self.catalog:=NIL + + /* + * Open the object's catalog + */ + + self.openCatalog(NIL, string.write(), self.builtinLanguage) + + stringToReturn := self.getString(number,default) + container.cat(stringToReturn) + + self.closeCatalog(self.catalog) + + /* + * Restore the old catalog + */ + + self.catalog := oldCatalog + + END string + +ENDPROC + + +PROC name() OF locale IS 'Locale' diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/Examples new file mode 100644 index 0000000..7d4441e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/Examples @@ -0,0 +1,19 @@ +@database locale_example + +@node main "Introduction to locale" + +Locale is the wrapping object for the locale library, the library that +'localizes' programs, i.e. more than one language is available. + +The locale object of the oomodules/ hierarchy doesn't enhance the usage +of libraries very much - at least not at this basic level. There are +derived objects that use this object as a 'foundation', e.g. the catalogList +object. + + +There are two examples, the first @{" example " link EMODULES:oomodules/library/locale/test.e/main} shows the basic functions +and the @{" second " link EMODULES:oomodules/library/locale/testObjectString.e/main} gets strings from one of ooep's object catalogs. + +There is an @{" autodoc " link EMODULES:oomodules/oodoc/guides/locale/main} file available or this object. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/catalogList.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/catalogList.e new file mode 100644 index 0000000..d6d57e9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/catalogList.e @@ -0,0 +1,375 @@ +OPT MODULE + +MODULE 'oomodules/sort/string', + 'oomodules/list/associativeArray', + 'oomodules/library/locale' + +OBJECT nuArray OF associativeArray +/****** nuArray/nuArray ****************************** + + NAME + nuArray() of associativeArray + + PURPOSE + Just to override the testKey() method. This array has strings as + keys. The strings are the names of the catalogs. When ENDing this + object the values (catalogs) are disposed (closed) automatically. + + ATTRIBUTES + cl:PTR TO catalogList -- The catalogList I am in. Just for + convenience with disposeVal(). + + SEE ALSO + associativeArray + +********/ + cl:PTR TO catalogList +ENDOBJECT + + + +EXPORT OBJECT catalogList OF locale +/****** catalogList/catalogList ****************************** + + NAME + catalogList of locale + + PURPOSE + This object holds any number of catalogs at the same time. Use it + to make your application use more than one catalog. + + catalogList is needed for the localization of the ooep: each object + has it's own catalog. Therefore it is necessary to hold any number + of objects open simultaneously. + + ATTRIBUTES + catalogArray:PTR TO nuArray -- a slightly modified associativeArray. + The keys aren't numbers but the names of the catalogs. + + SEE ALSO + associativeArray/associativeArray + +********/ + catalogArray:PTR TO nuArray +ENDOBJECT + + + + +/****************** + + methods of nuArray + +******************/ + +PROC testKey(string1, string2) OF nuArray IS OstrCmp(string1, string2) +/****** nuArray/testKey ****************************** + + NAME + testKey() of nuArray -- Compare two keys. + + SYNOPSIS + nuArray.testKey(LONG, LONG) + + nuArray.testKey(string1, string2) + + FUNCTION + Compares two keys. See associativeArray/testKey(). + In this object the keys are strings. Comparing is done with E's + builtin OstrCmp(). + + INPUTS + string1:LONG -- First string to compare. + + string2:LONG -- Second string to compare. + + RESULT + See E.doc/OstrCmp() for the return values. + + SEE ALSO + nuArray + +********/ + +PROC disposeVal(catalog) OF nuArray +/****** nuArray/disposeVal ****************************** + + NAME + disposeVal() of nuArray -- Dispose the value. + + SYNOPSIS + nuArray.disposeVal(LONG) + + nuArray.disposeVal(catalog) + + FUNCTION + Disposes the value stored in the nuArray. This is a catalog, the + disposing means that it's closed. + + INPUTS + catalog:LONG -- Catalog to be closed. + + SEE ALSO + nuArray/nuArray, associativeArray/associativeArray + +********/ +DEF cl:PTR TO catalogList + + cl := self.cl + cl.closeCatalog(catalog) + +ENDPROC + + + +/****************** + + methods of catalogList + +******************/ + + + +PROC init() OF catalogList +/****** catalogList/init ****************************** + + NAME + init() of catalogList -- Initialization of the object. + + SYNOPSIS + catalogList.init() + + FUNCTION + The nuArray is NEWed and SUPER init() is called. + + SEE ALSO + catalogList/catalogList + +********/ + + NEW self.catalogArray.new() + + self.catalogArray.cl := self + + SUPER self.init() -> locale.init() + +ENDPROC + +PROC setCurrentCatalog(locale, name:PTR TO CHAR, builtinLanguage=NIL:PTR TO CHAR) OF catalogList HANDLE +/****** catalogList/setCurrentCatalog ****************************** + + NAME + setCurrentCatalog() of catalogList -- Set the catalog to work with + + SYNOPSIS + catalogList.setCurrentCatalog(LONG, PTR TO CHAR, PTR TO CHAR=NIL) + + catalogList.setCurrentCatalog(locale, name, builtinLanguage) + + FUNCTION + Sets the 'current' catalog, i.e. all procs that work with a catalog + will work with this one. If the catalog isn't open it will be opened. + + INPUTS + locale:LONG -- locale structure as needed by the locale.library. + Usually this can be left NIL. + + name:PTR TO CHAR -- name of the catalog. + + builtinLanguage=NIL:PTR TO CHAR -- the language the strings in the + source are written in. NIL means that English is builtin. + + RESULT + the catalog + + EXAMPLE + cl.setCurrentCatalog(NIL,'oomodules/object') + + SEE ALSO + catalogList + +********/ +DEF catalog + +-> WriteF('Setting the new catalog .\s.\n',name) + + catalog := self.catalogArray.get(name) + + self.catalog := catalog + RETURN catalog + +EXCEPT + +-> WriteF('have to open it.\n\n') + + catalog := self.openCatalog(locale,name,builtinLanguage) + + IF catalog + + self.catalogArray.set(name, catalog) + + self.catalog := catalog + + ENDIF + + RETURN catalog + +ENDPROC + +PROC removeCurrentCatalog() OF catalogList HANDLE +/****** catalogList/removeCurrentCatalog ****************************** + + NAME + removeCurrentCatalog() of catalogList -- Remove catalog from list. + + SYNOPSIS + catalogList.removeCurrentCatalog() + + FUNCTION + Removes the current catalog from the internal list. It is *not* + closed, you have to do that. + + RESULT + the current catalog + + SEE ALSO + catalogList + +********/ + + IF self.catalog THEN self.catalogArray.remove(self.catalog) + RETURN self.catalog + +EXCEPT + +ENDPROC + +PROC end() OF catalogList +/****** catalogList/end ****************************** + + NAME + end() of catalogList -- Global destructor. + + SYNOPSIS + catalogList.end() + + FUNCTION + ENDs the nuArray and calls SUPER end(). + + SEE ALSO + catalogList, locale/end() + +********/ + + END self.catalogArray + + SUPER self.end() + +ENDPROC + +PROC select(optionlist, index) OF catalogList +/****** catalogList/select ****************************** + + NAME + select() of catalogList -- Selection of action. + + SYNOPSIS + catalogList.select(LONG, LONG) + + catalogList.select(optionlist, index) + + FUNCTION + Supports the following tags: + + "ctlg" -- Name of catalog to open at once. + + "lang" -- Bultin language to set. NIL means English. Set this + before you open any catalog. + + INPUTS + optionlist:LONG -- elist of options + + index:LONG -- index of option list + + RESULT + index after processing one tag. + + SEE ALSO + catalogList, object/select() + +********/ +DEF item + + item:=ListItem(optionlist,index) + + SELECT item + + CASE "ctlg" -> open catalog + + INC index + self.setCurrentCatalog(NIL, ListItem(optionlist,index), self.builtinLanguage) + + CASE "lang" -> set builtin language + + INC index + self.builtinLanguage := ListItem(optionlist,index) + + ENDSELECT + +ENDPROC index + + + +PROC name() OF catalogList IS 'CatalogList' +/****** catalogList/name ****************************** + + NAME + name() of catalogList -- Return object's name. + + SYNOPSIS + catalogList.name() + + FUNCTION + Returns the name of the object. + + RESULT + 'CatalogList' + + SEE ALSO + catalogList + +********/ + +PROC length() OF catalogList IS self.catalogArray.tail-1 +/****** catalogList/length ****************************** + + NAME + length() of catalogList -- Get number of catalogs open. + + SYNOPSIS + catalogList.length() + + FUNCTION + Gets you the number of catalogs open. + + RESULT + LONG -- tail entry of nuArray minus 1. + + SEE ALSO + catalogList, nuArray/nuArray + +********/ + +/* +PROC write(index) OF catalogList + WriteF('key\d=\d val\d=$\h\n', index, self.catalogArray.key[index], index, self.catalogArray.val[index]) + +ENDPROC + +*/ + + +/*EE folds +-1 +133 22 136 58 139 25 142 20 145 48 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/catalogList/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/catalogList/Examples new file mode 100644 index 0000000..acaac06 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/catalogList/Examples @@ -0,0 +1,26 @@ +@database catalogList_example + +@node main "Introduction to catalogList" + +The catalogList object is exactly what its name suggests - a list of +catalogs. It was developed for internal use of the oomodules hierarchy. +Since each object can have it's own catalog and an application can use +many objects there has to be a way to deal with any number of catalogs +open at any time. + +This is were the catalogList object comes in handy. By using the +setCurrentCatalog() method one can switch between catalogs. It doesn't +matter if this catalog is open or not, if this function returns non-NIL +access is granted. + +There is an @{" example " link EMODULES:oomodules/library/locale/catalogList/test.e/main} available + +There is an @{" autodoc " link EMODULES:oomodules/oodoc/guides/catalogList/main} file available or this object. + + + +Again, this object was developed for internal use. Yes, you can use it +in your applications, but normally there should be no need for it for +an application has only one catalog. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/catalogList/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/catalogList/test.e new file mode 100644 index 0000000..c57d5d5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/catalogList/test.e @@ -0,0 +1,72 @@ +/* + +Example program for the catalogList object. + +*/ + + + +MODULE 'oomodules/library/locale/catalogList' + +PROC main() +DEF cl:PTR TO catalogList, index + + /* + * Open the catalogs with builtin language english + */ + + NEW cl.new(["ctlg", 'term.catalog', "ctlg", 'oomodules/object.catalog']) + WriteF('number of catalogs open: \d\n', cl.length()) + + + + /* + * Set the current catalog. If the catalog attribute is non-NIL the + * setting was successful. + */ + + cl.setCurrentCatalog(NIL,'term.catalog') + IF cl.catalog + + WriteF('\s\n\s\n\s\n', cl.getString(1,'bla'), + cl.getString(2,'bla'), + cl.getString(3,'bla')) + + ENDIF + + + + /* + * Switch to the other catalog. Note that if we hadn't opened the + * object.catalog yet this proc would open it now. + */ + + cl.setCurrentCatalog(NIL,'oomodules/object.catalog') + IF cl.catalog + + WriteF('\s\n\s\n\s\n', cl.getString(1,'bla'), + cl.getString(2,'bla'), + cl.getString(3,'bla')) + + ENDIF + + + + /* + * Switch back to term + */ + + cl.setCurrentCatalog(NIL,'term.catalog') + IF cl.catalog + + WriteF('\s\n\s\n\s\n', cl.getString(1,'bla'), + cl.getString(2,'bla'), + cl.getString(3,'bla')) + + ENDIF + + + + END cl + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/cataloglist.m b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/cataloglist.m new file mode 100644 index 0000000..c5db952 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/cataloglist.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/test.e new file mode 100644 index 0000000..d31d11d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/test.e @@ -0,0 +1,37 @@ +/* + +Example program for the locale object. Very simple, really. It opens an +existing catalog and displays a message. + +*/ + + + +MODULE 'oomodules/library/locale' + +PROC main() +DEF locale:PTR TO locale + + /* + * Open the term catalog with builtin language english + */ + + NEW locale.new(["ctlg", 'term.catalog']) + + + + /* + * If it's open get some strings and write the result. + */ + + IF locale.catalog + + WriteF('\s\n\s\n\s\n', locale.getString(1,'bla'), + locale.getString(2,'bla'), + locale.getString(3,'bla')) + + ENDIF + + + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/testObjectString.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/testObjectString.e new file mode 100644 index 0000000..a2dac7d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/locale/testObjectString.e @@ -0,0 +1,86 @@ +/* + +Short sample program for the locale object. + +*/ + + + +MODULE 'oomodules/library/locale', + 'oomodules/object', + 'oomodules/sort/string' + + + +PROC main() +DEF locale:PTR TO locale, + object:PTR TO object, + string:PTR TO string + + + /* + * Allocate objects. The string object is needed in getObjectString() + */ + + NEW string.new() + NEW object.new() + + + + /* + * Open the term catalog with builtin language english + */ + + NEW locale.new(["ctlg", 'term.catalog']) + IF locale.catalog + + + + /* + * Get the frist three strings and print them. + */ + + WriteF('Here are some strings from term\as catalog:\n\n') + WriteF('\s\n\s\n\s\n', locale.getString(1,'bla'), + locale.getString(2,'bla'), + locale.getString(3,'bla')) + + + + ELSE + + RETURN + + ENDIF + + + + WriteF('\n\n') + WriteF('Now you\all get a string from the object\as catalog:\n\n') + + + + /* + * Get a string from the object's catalog and set the string object to it. + * Currently that string is retrieved from the catalog + * oomodules/object.catalog. + */ + + locale.getObjectString(object,string, 1,'bla') + WriteF('\s\n', string.write()) + + + + /* + * Get back to term's catalog. + */ + + WriteF('\n\n') + WriteF('Here are some strings from term\as catalog again:\n\n') + WriteF('\s\n\s\n\s\n', locale.getString(1,'bla'), + locale.getString(2,'bla'), + locale.getString(3,'bla')) + + + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/reqtools.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/reqtools.e new file mode 100644 index 0000000..f7126d3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/reqtools.e @@ -0,0 +1,274 @@ +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/library', 'reqtools', 'libraries/reqtools' + +CONST FILEREQ=0 + +-> NOTE: some modifications by JEVR3 here and there. + +OBJECT reqtools OF library +/****** library/--library-- ****************************************** + + NAME + library of object + + PURPOSE + Basic implementation of a simple library module. + + ATTRIBUTES + stringbuf -- Address of the buffer for the last character input. + + filebuf -- Address of the buffer for the last file choice. + + dirbuf -- Address of the buffer for the last directory choice. + + number -- Address of the variable that contains the last number + entered. + + CREATION + Back in February of 1995 by Gregor Goldbach + + HISTORY + +****************************************************************************** + +History + + +*/ + stringbuf + filebuf + dirbuf + number +ENDOBJECT + +-> JEVR3 addition: init() sets 'reqtools.library' and no version. + +PROC init() OF reqtools +/****** reqtools/init ****************************************** + + NAME + init() -- Initialization of the object. + + SYNOPSIS + reqtools.init() + + FUNCTION + Sets the library's name and the version to 0. After that the library + is opened. + + SEE ALSO + open() +****************************************************************************** + +History + + +*/ + self.identifier:='reqtools.library' + self.version:=0 + self.open() +ENDPROC + +-> JEVR3 modification: made it one-line (I'm demented) + +PROC open() OF reqtools +/****** reqtools/open ****************************************** + + NAME + open() -- Open reqtools.library + + SYNOPSIS + reqtools.open() + + FUNCTION + Opens the reqtools.library. + + EXCEPTIONS + "lib",{reqtoolOpen} will be raised if the opening fails. + +****************************************************************************** + +History + + +*/ + IF (reqtoolsbase:=OpenLibrary(self.identifier,self.version)) = NIL THEN Throw("lib",{reqtoolOpen}) +ENDPROC + +PROC ez(body,gadgets,dunno=NIL,arglist=NIL,taglist=NIL) OF reqtools +/****** reqtools/ez ****************************************** + + NAME + ez() -- Display an eazy requester. + + SYNOPSIS + reqtools.ez(LONG,LONG,LONG=NIL,LONG=NIL,LONG=NIL) + + FUNCTION + Displays one of those nice ez requesters. Refer to the reqtools + documentation for input details. + +****************************************************************************** + +History + + +*/ + + IF reqtoolsbase + RETURN RtEZRequestA(body,gadgets,dunno,arglist,taglist) + ENDIF +ENDPROC + +-> JEVR3 modification; string() returns stringbuf, New() now String() + +PROC string(title=NIL,maxlen=200,dunno=NIL,dunno2=NIL) OF reqtools +/****** reqtools/string ****************************************** + + NAME + string() -- Asks for a character input. + + SYNOPSIS + reqtools.string(LONG=NIL,LONG=NIL,LONG=NIL,LONG=NIL) + + FUNCTION + Asks for a string input. For further documentation refer to the + reqtools document. + + RESULT + PTR TO CHAR -- Address of the string entered. + +****************************************************************************** + +History + + +*/ + IF self.stringbuf THEN Dispose(self.stringbuf) + self.stringbuf := String(maxlen) + + RtGetStringA(self.stringbuf,maxlen,title,dunno,dunno2) +ENDPROC self.stringbuf + +-> JEVR3 modification; changed 'end()' to 'close()'. 'end()' still works, +-> since it calls 'self.close()' + +PROC close() OF reqtools +/****** reqtools/close ****************************************** + + NAME + close() -- Close the library. + + SYNOPSIS + reqtools.close() + + FUNCTION + Closes the library. + + SEE ALSO + open() +****************************************************************************** + +History + + +*/ + IF self.stringbuf THEN DisposeLink(self.stringbuf) + CloseLibrary(reqtoolsbase) +ENDPROC + +PROC palette(title,dunno=NIL,dunno2=NIL) OF reqtools +/****** reqtools/palette ****************************************** + + NAME + palette() -- Pop up palette requester. + + SYNOPSIS + reqtools.palette(LONG,LONG=NIL,LONG=NIL) + + FUNCTION + Display reqtools' palette requester. + + RESULT + number of colour chosen. + +****************************************************************************** + +History + + +*/ + self.number := RtPaletteRequestA(title,dunno,dunno2) +ENDPROC self.number + +PROC long(title,number=NIL,dunno=NIL,dunno2=NIL) OF reqtools +/****** reqtools/long ****************************************** + + NAME + long() -- Pop up long integer requester. + + SYNOPSIS + reqtools.long(LONG,LONG=NIL,LONG=NIL,LONG=NIL) + + FUNCTION + Display a requester that asks for a long integer to be entered. + For more documentation refer to the reqtools manual. + +****************************************************************************** + +History + + +*/ + RtGetLongA({number}, title, dunno, dunno2) + self.number := number +ENDPROC self.number + +PROC file(title,maxlen=200,tags=NIL) OF reqtools HANDLE +/****** reqtools/file ****************************************** + + NAME + file() -- Get file via requester. + + SYNOPSIS + reqtools.file(PTR TO CHAR,LONG) + + RESULT + TRUE if a file was selected, FALSE otherwise. See reqtools.doc + for more info. + + FUNCTION + Select a file via file requester. The file and directory choices + are copied to the according attributes. + +****************************************************************************** + +History + + +*/ +DEF req:PTR TO rtfilerequester, + result + + IF req:=RtAllocRequestA(FILEREQ,0) + + IF self.filebuf THEN Dispose(self.filebuf) + IF self.dirbuf THEN Dispose(self.dirbuf) + self.filebuf := NewR(maxlen) + self.dirbuf := NewR(maxlen) + + result := RtFileRequestA(req,self.filebuf,title,tags) + AstrCopy(self.dirbuf,req.dir,maxlen) + RtFreeRequest(req) + ENDIF + + RETURN result + +EXCEPT + NOP +ENDPROC + +reqtoolOpen: + CHAR 'Unable to open reqtools.library.',0 diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/reqtools/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/reqtools/test.e new file mode 100644 index 0000000..0378cb8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/reqtools/test.e @@ -0,0 +1,28 @@ +MODULE 'oomodules/library/reqtools', + 'reqtools','libraries/reqtools' + +PROC main() HANDLE +DEF req:PTR TO reqtools + + NEW req.new(["name",'reqtools.library',"vers",37]) + + req.ez('Nice to see ya!','Ah.|So what?',0,0,[RTEZ_REQTITLE,'Just a test',RT_REQPOS,REQPOS_POINTER]) + req.string('Just enter a string:') + WriteF('\s\n',req.stringbuf) + req.string('Just enter a string:') + WriteF('\s\n',req.stringbuf) + + req.long('just enter a number:') + WriteF('\d\n', req.number) + + req.palette('just choose a colour:') + WriteF('\d\n', req.number) + + req.file('FILE?') + WriteF('\s\n', req.filebuf) + WriteF('\s\n', req.dirbuf) + + +EXCEPT + WriteF('no lib, sorry (base=\d).\n',reqtoolsbase) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/library/reqtools_test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/reqtools_test.e new file mode 100644 index 0000000..91633e7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/library/reqtools_test.e @@ -0,0 +1,33 @@ +MODULE '*reqtools','libraries/reqtools' + +-> Only need 'libraries/reqtools' for the CONST now. + +-> NOTE: Some modifications by JEVR3 to reflect enhancements + +PROC main() +DEF req:PTR TO reqtools + +-> JEVR3: Now uses 'new()' to set up library. + + NEW req.new() + +-> JEVR3: uncommented this part. + + req.ez('Nice to see ya!','Ah.|So what?',0,0,[RTEZ_REQTITLE,'Just a test',RT_REQPOS,REQPOS_POINTER,0]) + +-> JEVR3: compressed some lines a little bit. + + WriteF('\s\n',req.string('Just enter a string:')) + WriteF('\s\n',req.string('Just enter a string:')) + + WriteF('\d\n', req.long('Just enter a number:')) + + + WriteF('\d\n', req.palette('just choose a colour:')) + + req.file('FILE?') + WriteF('\s\n', req.filebuf) + WriteF('\s\n', req.dirbuf) + END req + -> automatically closes the library! +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/Examples new file mode 100644 index 0000000..578c059 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/Examples @@ -0,0 +1,12 @@ +@database list_example + +@node main "Introduction to list" + +list is the place where you can find all the objects that fiddle around +with lists. + +There are objects for E's own lists (the object is called @{" elist " link EMODULES:oomodules/list/elist/Examples/main}), lists +of the exec.library (@{" execlist " link EMODULES:oomodules/list/execlist/Examples/main}) and some more advanced lists like the +@{" associative array " link EMODULES:oomodules/list/associativeArray/Examples/main}. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray.e new file mode 100644 index 0000000..a1a7eae --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray.e @@ -0,0 +1,566 @@ +OPT MODULE +OPT REG=5, + PREPROCESS + +MODULE 'oomodules/object' + +-> #define NO_SAFE_STACK 1 -> Uncomment if you don't want to watch the stack. +#define PIVOT(l,u) ((l)+(Div(((u)-(l)),(2)))) + +/* + * Exceptions. + * + * ASAR_EXCEPTION identifies this module as the origin of the exception. The + * remaining constants identify the reason for an exception raised by this + * module, eg: + * + * Throw(ASAR_EXCEPTION, ASAR_KEYNOTFOUND) + */ +EXPORT CONST ASAR_EXCEPTION="AsAr" +EXPORT CONST ASAR_KEYNOTFOUND="key", + ASAR_STACKOVERFLOW="stak" + +CONST DEFAULT_LENGTH=64 + +EXPORT OBJECT associativeArray OF object +/****** object/associativeArray ****************************** + + NAME + associativeArray of object -- Dynamic, one-dimensional, ordered + array + + PURPOSE + Dynamic, one-dimensional, ordered array for storing things whose + indices fit any of these criteria: 1) are non-numeric (most + popular index type is a string), 2) are not consecutive and/or + have big gaps between values (commonly known as sparse arrays), + 3) order cannot be simply determined by builtin E arithmetic + operators (=<>). Basically any index type that is not the typical + positive integer from 0 to MAXLONG. + + ATTRIBUTES + len:LONG -- current max length of the array + + tail:LONG -- first empty place after the last element + + key:PTR TO LONG -- array stores the keys in ordered sequence + + val:PTR TO LONG -- array stores the values associated with each key + in array key + + EXCEPTIONS + ASAR_EXCEPTION identifies this module as the origin of the exception. + The remaining constants identify the reason for an exception raised + by this module. These are: + + ASAR_KEYNOTFOUND -- there is no such key in the array + + ASAR_STACKOVERFLOW -- stack overflow. Should not be raised if the + stack watch is enabled. + + NOTES + disposeKey(key) + disposeVal(val) + + These are the default actions for disposal of keys and vals of type + LONG, which is "do nothing", since they require no special cleanup. + Override them if key and/or val requires cleanup, (ie, dynamically + allocated, else your storage WILL NOT be freed when you set() or end()!!!) + + EXAMPLE: + + PROC disposeVal(val) OF myAsAr IS DisposeLink(val) + + Storage for new elements is automatically allocated, increased by 32 + each time the array's limits are exceeded. + + No duplicate keys will ever exist, values are simply overwritten. + + Inserting and removing from the front of the array is SLOW with large + arrays. This can't be helped, however it's often worth the sacrifice + for the efficient lookup of binary searches and the handiness of + sparse, non-numeric indexed arrays. + + The binary search function uses recursion and has a FreeStack() check. + 4096 should be plenty for most applications since the algorithm is + amazingly efficient. + + Changing any of the PUBLIC (READ-ONLY) values in the object isn't + recommended, but hey, who's to stop ya besides the guru? :) + + SEE ALSO + object + +********/ + len: LONG + tail: LONG + key: PTR TO LONG + val: PTR TO LONG +ENDOBJECT + + +/* Local. */ +CONST LT=-1, + EQ=0, + GT=1 + +/*===========================================================================*/ +/*=== Con/Destructors =======================================================*/ +/*===========================================================================*/ + +/* + * original new() contents: + * self.end() + * self.key:=NewR(Mul(length, 4)) + * self.val:=NewR(Mul(length, 4)) + * self.len:=length + * self.tail:=0 + * + * length is the initial number of empty elements in the array + */ + +PROC init() OF associativeArray +/****** associativeArray/init ****************************** + + NAME + init() of associativeArray -- Initialization of the object. + + SYNOPSIS + associativeArray.init() + + FUNCTION + Initializes the object. The list will initially contain + DEFAULT_LENGTH elements. + + EXCEPTION + May raise "MEM". + + SEE ALSO + associativeArray + +********/ + + self.key:=NewR(Mul(DEFAULT_LENGTH, 4)) + self.val:=NewR(Mul(DEFAULT_LENGTH, 4)) + self.len:=DEFAULT_LENGTH + self.tail:=0 + +ENDPROC + + +PROC end() OF associativeArray +/****** associativeArray/end ****************************** + + NAME + end() of associativeArray -- Global destructor. + + SYNOPSIS + associativeArray.end() + + FUNCTION + Cleans up keys and values using methods disposeKey() and disposeVal(), + so if your keys and values are dynamically allocated, you must + override these if you want this method to free them. NOTE: this + method was written to be very safe! It may be called directly at any + time (even multiple times) to free resources. 'myobj.end()' doesn't + free the object, only its contents. Just don't be so silly as to + call -any- methods after an 'END myobj'. :) + + SEE ALSO + associativeArray + +********/ + DEF i, last, ar:PTR TO LONG + last:=self.tail-1 + IF ar:=self.key + FOR i:=0 TO last DO self.disposeKey(ar[i]) + Dispose(ar) + self.key:=NIL + ENDIF + IF ar:=self.val + FOR i:=0 TO last DO self.disposeVal(ar[i]) + Dispose(ar) + self.val:=NIL + ENDIF + self.tail:=0 +ENDPROC + +/*===========================================================================*/ +/*=== Tell-me-about-myself Methods ==========================================*/ +/*===========================================================================*/ + +PROC disposeKey(key) OF associativeArray IS EMPTY +/****** associativeArray/disposeKey ****************************** + + NAME + disposeKey() of associativeArray -- Call destructor of key. + + SYNOPSIS + associativeArray.disposeKey(LONG) + + associativeArray.disposeKey(key) + + FUNCTION + Empty method. Special action to take when calling the destructor for + an array whose keys are dynamically allocated. Default for type LONG + is NO ACTION. + + INPUTS + key:LONG -- Pointer to key. + + SEE ALSO + associativeArray, disposeVal() + +********/ + +PROC disposeVal(val) OF associativeArray IS EMPTY +/****** associativeArray/disposeVal ****************************** + + NAME + disposeVal() of associativeArray -- Call destructor of value. + + SYNOPSIS + associativeArray.disposeVal(LONG) + + associativeArray.disposeVal(val) + + FUNCTION + Empty method. Special action to take when calling the destructor, + or overwriting a value for a key that already exists, for an array + whose keys are dynamically allocated. Default for type LONG is + NO ACTION. + + INPUTS + val:LONG -- Pointer to value. + + SEE ALSO + associativeArray, disposeKey() + +********/ + +PROC testKey(left, right) OF associativeArray IS IF (right>left) THEN 1 ELSE (right0 + pos:=binarySearch(self, 0, self.tail-1, key, PIVOT(0,self.tail-1)) + rel:=self.testKey(self.key[pos], key) + ENDIF + IF rel=EQ + self.disposeVal(self.val[pos]) + ELSE + IF rel=GT THEN INC pos + makeRoom(self, pos) + self.tail:=self.tail+1 + ENDIF + self.key[pos]:=key + self.val[pos]:=val +ENDPROC + +PROC get(searchKey) OF associativeArray +/****** associativeArray/get ****************************** + + NAME + get() of associativeArray -- + + SYNOPSIS + associativeArray.get(LONG) + + associativeArray.get(searchKey) + + FUNCTION + Perform binary search for matching key and return its associated + value. + + INPUTS + searchKey:LONG -- the associated key used to identify a value + + RESULT + val:LONG -- value associated with key + + pos:LONG -- the position of the element in the array. + + EXCEPTIONS + Throws ASAR_EXCEPTION, ASAR_KEYNOTFOUND or + ASAR_EXCEPTION, ASAR_STACKOVERFLOW + + SEE ALSO + associativeArray + +********/ + DEF pos + pos:=binarySearch(self, 0, self.tail-1, searchKey, PIVOT(0,self.tail-1)) + IF self.testKey(self.key[pos], searchKey) THEN Throw(ASAR_EXCEPTION, ASAR_KEYNOTFOUND) +ENDPROC self.val[pos],pos + +PROC remove(searchKey) OF associativeArray +/****** associativeArray/remove ****************************** + + NAME + remove() of associativeArray -- + + SYNOPSIS + associativeArray.remove(LONG) + + associativeArray.remove(searchKey) + + FUNCTION + Remove the key and value from the array and return them. + + INPUTS + searchKey:LONG -- the key of the element to be removed + + RESULT + key:LONG -- the key you passed + + val:LONG -- value associated with key + + EXCEPTIONS + Throws ASAR_EXCEPTION, ASAR_KEYNOTFOUND or + ASAR_EXCEPTION, ASAR_STACKOVERFLOW + + SEE ALSO + associativeArray + +********/ + DEF pos, last, i, k:PTR TO LONG, v:PTR TO LONG, key, val + pos:=binarySearch(self, 0, self.tail-1, searchKey, PIVOT(0,self.tail-1)) + IF self.testKey(self.key[pos], searchKey) THEN Throw(ASAR_EXCEPTION, ASAR_KEYNOTFOUND) + last:=self.tail-1 + k:=self.key + v:=self.val + key:=k[pos] + val:=v[pos] + FOR i:=pos TO last + k[i]:=k[i+1] + v[i]:=v[i+1] + ENDFOR + k[i]:=0 + v[i]:=0 + self.tail:=self.tail-1 +ENDPROC key,val + +/*===========================================================================*/ +/*=== Private Support Functions =============================================*/ +/*===========================================================================*/ + +PROC binarySearch(ar:PTR TO associativeArray, l, u, key, pivot) +/****** /binarySearch ****************************** + + NAME + binarySearch() -- + + SYNOPSIS + binarySearch(PTR TO associativeArray, LONG, LONG, LONG, LONG) + + binarySearch(ar, l, u, key, pivot) + + FUNCTION + Recursive binary search of array ar.key. Returns pos when + ar.key[pos] equals key, or when l=u. + + INPUTS + ar:PTR TO associativeArray -- array to work on + + l:LONG -- + + u:LONG -- + + key:LONG -- + + pivot:LONG -- + + RESULT + LONG -- index + + EXCEPTION + Throws ASAR_EXCEPTION, ASAR_STACKOVERFLOW + +********/ + DEF rel +#ifndef NO_SAFE_STACK + IF FreeStack()<1000 THEN Throw(ASAR_EXCEPTION, ASAR_STACKOVERFLOW) +#endif + IF l=u THEN RETURN pivot + rel:=ar.testKey(ar.key[pivot], key) + IF rel=GT + IF l=pivot THEN RETURN pivot+1 + l:=pivot + ELSEIF rel=LT + u:=pivot + ELSE + RETURN pivot + ENDIF +ENDPROC binarySearch(ar, l, u, key, PIVOT(l,u)) + +PROC makeRoom(ar:PTR TO associativeArray, pos) HANDLE +/****** /makeRoom ****************************** + + NAME + makeRoom() -- Make room for an element. + + SYNOPSIS + makeRoom(PTR TO associativeArray, LONG) + + makeRoom(ar, pos) + + FUNCTION + Make a blank element at position pos (for an insert operation). + Expand the length of the array by 32 elements if necessary. + + INPUTS + ar:PTR TO associativeArray -- array to work on + + pos:LONG -- position to insert an element + +********/ + DEF toKey=NIL:PTR TO LONG, toVal=NIL:PTR TO LONG + DEF fromKey:PTR TO LONG, fromVal:PTR TO LONG, i, last + fromKey:=ar.key + fromVal:=ar.val + /* Expand array if necessary and copy elements BEFORE pos, setup so that + * upper half of array is copied. Else setup so that upper half of array + * is shifted right. **/ + IF ar.tail=ar.len + toKey:=NewR(ar.len+32*4) + toVal:=NewR(ar.len+32*4) + last:=pos-1 + FOR i:=0 TO last + toKey[i]:=fromKey[i] + toVal[i]:=fromVal[i] + ENDFOR + ELSE + toKey:=fromKey + toVal:=fromVal + ENDIF + /* Shift upper half of array one position to the right. */ + INC pos + last:=ar.tail + FOR i:=last TO pos STEP -1 + toKey[i]:=fromKey[i-1] + toVal[i]:=fromVal[i-1] + ENDFOR + /* Cleanup if the array was expanded. */ + IF toKey<>fromKey + Dispose(fromKey) + Dispose(fromVal) + ar.key:=toKey + ar.val:=toVal + ar.len:=ar.len+32 + ENDIF +EXCEPT + /* The only recovery required is if toVal:=NewR(ar.len+32*4) raises "MEM". */ + IF toKey THEN Dispose(toKey) + ReThrow() +ENDPROC + +PROC asList() OF associativeArray +DEF valueList:PTR TO LONG, + keyList:PTR TO LONG, + index, + numberOfItems + + numberOfItems := self.tail + + valueList := List(numberOfItems) + keyList := List(numberOfItems) + + IF (valueList AND keyList) + + FOR index := 0 TO numberOfItems-1 + + valueList[index] := self.val[index] + keyList[index] := self.key[index] + +-> WriteF('key: \d, value: $\h\n',self.key[index],self.val[index]) +-> WriteF('key: \d, value: $\h\n\n',keyList[index],valueList[index]) + ENDFOR +-> WriteF('\n') + + SetList(keyList,numberOfItems) + SetList(valueList,numberOfItems) + ENDIF + + RETURN keyList,valueList + +ENDPROC +/*EE folds +-1 +151 34 247 52 250 33 253 44 260 46 263 58 266 28 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/Examples new file mode 100644 index 0000000..f8a6e39 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/Examples @@ -0,0 +1,21 @@ +@database associativeArray_example + +@node main "Introduction to associativeArray" + +Dynamic, one-dimensional, ordered array for storing things whose indices +fit any of these criteria: 1) are non-numeric (most popular index type is +a string), 2) are not consecutive and/or have big gaps between values +(commonly known as sparse arrays), 3) order cannot be simply determined by +builtin E arithmetic operators (=<>). Basically any index type that is not +the typical positive integer from 0 to MAXLONG. + +There is are three examples, they are practically like those provided by +Barry Wills. + + @{" ar " link EMODULES:oomodules/list/associativeArray/ar.e/main} + @{" ar2 " link EMODULES:oomodules/list/associativeArray/ar2.e/main} + @{" listTest " link EMODULES:oomodules/list/associativeArray/listTest.e/main} + +There is an @{" autodoc " link EMODULES:oomodules/oodoc/guides/associativeArray/main} file available or this object. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/ar.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/ar.e new file mode 100644 index 0000000..73e59f7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/ar.e @@ -0,0 +1,147 @@ +/* + * ar.e - yer very basic test suite to make sure numbers go in the right place + * when inserted/removed in various orders. + * + * December 24 1995 Gregor Goldbach + * This is the original test program by Barry with these exceptions: I removed + * the initial size argument from new() and added NEW end END to each test. + * + */ + +OPT REG=5, + PREPROCESS + +MODULE 'oomodules/list/associativeArray' + +#define TEST1 +#define TEST2 +#define TEST3 +#define TEST4 +#define TEST5 +#define TEST6 +#define TEST7 +#define TEST8 + +OBJECT aa OF associativeArray +ENDOBJECT + +PROC printAll() OF aa + DEF i, last + last:=self.tail-1 + FOR i:=0 TO last DO self.print(i) + WriteF('\n') +ENDPROC + /* printAll */ + +PROC print(i) OF aa + WriteF('key\d=\d val\d=$\h\n', i, self.key[i], i, self.val[i]) +ENDPROC + /* print */ + +PROC main() HANDLE + DEF ar:PTR TO aa, i + NEW ar.new() +/*---------------------------------------------------------------------------*/ +/*--- test order of insert --------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ +#ifdef TEST1 + WriteF('/*** TEST 1 ***/\n') + ar.set(1, $1111); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(3, $3333); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(5, $5555); ar.printAll() + END ar +#endif +#ifdef TEST2 + NEW ar.new() + WriteF('/*** TEST 2 ***/\n') + ar.set(5, $5555); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(3, $3333); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(1, $1111); ar.printAll() + END ar +#endif +#ifdef TEST3 + NEW ar.new() + WriteF('/*** TEST 3 ***/\n') + ar.set(5, $5555); ar.printAll() + ar.set(1, $1111); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(3, $3333); ar.printAll() + END ar + +#endif +#ifdef TEST4 + NEW ar.new() + WriteF('/*** TEST 4 ***/\n') + ar.set(3, $3333); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(5, $5555); ar.printAll() + ar.set(1, $1111); ar.printAll() + END ar +#endif +#ifdef TEST5 + NEW ar.new() + WriteF('/*** TEST 5 ***/\n') + ar.set(1, $1111); ar.printAll() + ar.set(5, $5555); ar.printAll() + ar.set(3, $3333); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(4, $4444); ar.printAll() + END ar +#endif + +/*---------------------------------------------------------------------------*/ +/*--- test overwrite --------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ +#ifdef TEST6 + NEW ar.new() + WriteF('/*** TEST 6 ***/\n') + ar.set(1, $1111); ar.printAll() + ar.set(5, $5555); ar.printAll() + ar.set(3, $3333); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(2, $2222); ar.printAll() + + ar.set(1, $5555); ar.printAll() + ar.set(2, $4444); ar.printAll() + ar.set(3, $3333); ar.printAll() + ar.set(4, $2222); ar.printAll() + ar.set(5, $1111); ar.printAll() + END ar +#endif +/*---------------------------------------------------------------------------*/ +/*--- test get() and remove() -----------------------------------------------*/ +/*---------------------------------------------------------------------------*/ +#ifdef TEST7 + NEW ar.new() + WriteF('/*** TEST 7 ***/\n') + ar.set(3, $3333); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(1, $1111); ar.printAll() + ar.set(5, $5555); ar.printAll() + + FOR i:=1 TO 5 DO WriteF('get(\d)=$\h\n', i, ar.get(i)) + WriteF('\n') + + ar.remove(3); ar.printAll() + ar.remove(1); ar.printAll() + ar.remove(5); ar.printAll() + ar.remove(4); ar.printAll() + ar.remove(2); ar.printAll() + END ar +#endif +#ifdef TEST8 + NEW ar.new() + WriteF('/*** TEST 8 (should raise exception) ***/\n') + ar.remove("blah") ->should raise exception +#endif +EXCEPT DO + IF exception THEN WriteF('BOOM!\n') + CleanUp() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/ar2.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/ar2.e new file mode 100644 index 0000000..3529638 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/ar2.e @@ -0,0 +1,163 @@ +/* + * ar2.e - yer very basic dumb program that reads a text file and counts the + * number of times each unique word occurs. Words are used as the array index + * (key) in an associative array. This is not -really- an E parser, so it's + * easier to follow if you use it on plain text, else you'll see some weird + * "words" and have to THINK to figure out where they're coming from. :) + * + * December 24 1995 Gregor Goldbach + * This is the original test program by Barry. I just removed the initial size + * value from the call to new(). + * I ran it over my guided dos autodoc (nearly 205Kb). It swallows nearly + * 800Kb :) + */ + +MODULE 'exec/strings' +MODULE 'oomodules/list/associativeArray' + +RAISE "OPEN" IF Open()=NIL, + "MEM" IF String()=NIL, + "^C" IF CtrlC()=TRUE + +CONST SPACE=" ", + TAB=9 + +/* + * Derived class. + */ + +OBJECT myAsAr OF associativeArray + /* key will store pointers to strings */ + /* val will store a count of the string's occurence */ +ENDOBJECT + /* myAsAr */ + +PROC disposeKey(key) OF myAsAr IS DisposeLink(key) +PROC testKey(string1, string2) OF myAsAr IS OstrCmp(string1, string2) + +/*---------------------------------------------------------------------------*/ + +/* + * TEST FUNCTIONS. + */ + +PROC isWhite(c) + SELECT c + CASE SPACE; RETURN TRUE + CASE TAB; RETURN TRUE + CASE LF; RETURN TRUE + ENDSELECT +ENDPROC FALSE + /* isWhite */ + +PROC isPunct(c) IS (-1<>InStr('.,;:()/?-''"!@#$%^&*=+\\|[]{}<>`~', [c,0]:CHAR)) + /* note: left out "_" for my test since identifiers can have them */ + +PROC skipSeparator(s) + DEF c + WHILE (isWhite(c:=s[]) OR isPunct(c)) DO INC s +ENDPROC s + /* skipSeparator */ + +/*---------------------------------------------------------------------------*/ + +/* + * Add word to array and tally. + */ +PROC tallyWord(ar:PTR TO myAsAr, key) HANDLE + DEF val=0 + val:=ar.get(key) +EXCEPT DO + val:=val+1 + ar.set(key, val) +ENDPROC + /* tallyWord */ + +/* + * Make key from word. + */ +PROC makeKey(w) + DEF key + key:=String(EstrLen(w)) + StrCopy(key, w) +ENDPROC key + /* makeKey */ + +/* + * Pickup a word. + */ +PROC getWord(ar, s, w) + DEF key + SetStr(w, 0) + WHILE (isWhite(s[]) OR isPunct(s[])=FALSE) AND (s[]<>EOS) + StrAdd(w, s, 1) + INC s + ENDWHILE + IF EstrLen(w) + key:=makeKey(w) + tallyWord(ar, key) + ENDIF +ENDPROC s + /* getWord */ + +/* + * Pickup all words in a line. + */ +PROC getWords(ar:PTR TO myAsAr, s, w) + LOOP + s:=skipSeparator(s) + IF s[]=EOS THEN RETURN + s:=getWord(ar, s, w) + ENDLOOP +ENDPROC + /* getWords */ + +/*---------------------------------------------------------------------------*/ + +/* + * Print entire contents of array. + */ +PROC printEmAll(ar:PTR TO myAsAr) + DEF i, last, key:PTR TO LONG, val:PTR TO LONG + key:=ar.key + val:=ar.val + last:=ar.tail-1 + FOR i:=0 TO last DO WriteF(' \s == \d\n', key[i], val[i]) +ENDPROC + /* printEmAll */ + +/*---------------------------------------------------------------------------*/ + +/* + * MAIN. + */ +PROC main() HANDLE + DEF ar=NIL:PTR TO myAsAr + DEF fh=NIL, s=NIL, w=NIL + IF arg[]=EOS THEN Raise("ARGS") + fh:=Open(arg, OLDFILE) + s:=String(100) + w:=String(100) + NEW ar.new() + /* process the whole file, tallying word occurences into ar */ + WHILE Fgets(fh, s, 100) DO getWords(ar, s, w) + /* print out the entire array */ + printEmAll(ar) +EXCEPT DO + IF fh THEN Close(fh) + SELECT exception + CASE ASAR_EXCEPTION + SELECT exceptioninfo + CASE ASAR_KEYNOTFOUND; WriteF('bad key request\n') + CASE ASAR_STACKOVERFLOW; WriteF('stack overflow\n') + ENDSELECT + CASE "MEM"; WriteF('out of mem\n') + CASE "ARGS"; WriteF('examine which file?\n') + CASE "OPEN"; WriteF('can''t open file\n') + CASE "^C"; WriteF('interrupted\n') + CASE 0; + DEFAULT; WriteF('unknow exception \d/\d\n', exception, exceptioninfo) + ENDSELECT + CleanUp() +ENDPROC + /* main */ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/associativeStringArray.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/associativeStringArray.e new file mode 100644 index 0000000..94f10c7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/associativeStringArray.e @@ -0,0 +1,10 @@ +OPT MODULE + +MODULE 'oomodules/list/associativeArray' + +EXPORT OBJECT associativeStringArray OF associativeArray + /* key will store pointers to strings */ +ENDOBJECT + +-> crashes sometimes PROC disposeKey(key) OF associativeStringArray IS DisposeLink(key) +PROC testKey(string1, string2) OF associativeStringArray IS OstrCmp(string1, string2) diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/associativestringarray.m b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/associativestringarray.m new file mode 100644 index 0000000..fefddbf Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/associativestringarray.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/listTest.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/listTest.e new file mode 100644 index 0000000..f99f5a9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/associativeArray/listTest.e @@ -0,0 +1,149 @@ +/* + +This is nearly the same test program like the one that was written by Barry. +The only difference is the function printAll(): it creates elists of +keys and values with the method asList(). + + January 28 1996 Gregor Goldbach + +*/ + +OPT REG=5, + PREPROCESS + +MODULE 'oomodules/list/associativeArray' + +#define TEST1 +#define TEST2 +#define TEST3 +#define TEST4 +#define TEST5 +#define TEST6 +#define TEST7 +#define TEST8 + +OBJECT aa OF associativeArray +ENDOBJECT + +PROC printAll() OF aa +DEF values:PTR TO LONG, + keys:PTR TO LONG, + index, + numberOfItems + + keys, values := self.asList() + numberOfItems := ListLen(keys) + + FOR index:=0 TO numberOfItems-1 DO WriteF('key\d=\d \tval\d=$\h\n', index, keys[index], index, values[index]) + + WriteF('\n') + +ENDPROC + +PROC main() HANDLE + DEF ar:PTR TO aa, i + NEW ar.new() +/*---------------------------------------------------------------------------*/ +/*--- test order of insert --------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ +#ifdef TEST1 + WriteF('/*** TEST 1 ***/\n') + ar.set(1, $1111); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(3, $3333); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(5, $5555); ar.printAll() + END ar +#endif +#ifdef TEST2 + NEW ar.new() + WriteF('/*** TEST 2 ***/\n') + ar.set(5, $5555); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(3, $3333); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(1, $1111); ar.printAll() + END ar +#endif +#ifdef TEST3 + NEW ar.new() + WriteF('/*** TEST 3 ***/\n') + ar.set(5, $5555); ar.printAll() + ar.set(1, $1111); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(3, $3333); ar.printAll() + END ar + +#endif +#ifdef TEST4 + NEW ar.new() + WriteF('/*** TEST 4 ***/\n') + ar.set(3, $3333); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(5, $5555); ar.printAll() + ar.set(1, $1111); ar.printAll() + END ar +#endif +#ifdef TEST5 + NEW ar.new() + WriteF('/*** TEST 5 ***/\n') + ar.set(1, $1111); ar.printAll() + ar.set(5, $5555); ar.printAll() + ar.set(3, $3333); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(4, $4444); ar.printAll() + END ar +#endif + +/*---------------------------------------------------------------------------*/ +/*--- test overwrite --------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ +#ifdef TEST6 + NEW ar.new() + WriteF('/*** TEST 6 ***/\n') + ar.set(1, $1111); ar.printAll() + ar.set(5, $5555); ar.printAll() + ar.set(3, $3333); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(2, $2222); ar.printAll() + + ar.set(1, $5555); ar.printAll() + ar.set(2, $4444); ar.printAll() + ar.set(3, $3333); ar.printAll() + ar.set(4, $2222); ar.printAll() + ar.set(5, $1111); ar.printAll() + END ar +#endif +/*---------------------------------------------------------------------------*/ +/*--- test get() and remove() -----------------------------------------------*/ +/*---------------------------------------------------------------------------*/ +#ifdef TEST7 + NEW ar.new() + WriteF('/*** TEST 7 ***/\n') + ar.set(3, $3333); ar.printAll() + ar.set(2, $2222); ar.printAll() + ar.set(4, $4444); ar.printAll() + ar.set(1, $1111); ar.printAll() + ar.set(5, $5555); ar.printAll() + + FOR i:=1 TO 5 DO WriteF('get(\d)=$\h\n', i, ar.get(i)) + WriteF('\n') + + ar.remove(3); ar.printAll() + ar.remove(1); ar.printAll() + ar.remove(5); ar.printAll() + ar.remove(4); ar.printAll() + ar.remove(2); ar.printAll() + END ar +#endif +#ifdef TEST8 + NEW ar.new() + WriteF('/*** TEST 8 (should raise exception) ***/\n') + ar.remove("blah") ->should raise exception +#endif +EXCEPT DO + IF exception THEN WriteF('BOOM!\n') + CleanUp() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked.e new file mode 100644 index 0000000..73c0b81 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked.e @@ -0,0 +1,666 @@ +/****** doublylinked/--background-- ****************************************** + + PURPOSE + no hassle, flexible, doubly-linked list base class + + NOTES + + 1. head and tail are dummy nodes which are part of the list header. + They cannot be removed, nor can your data be stored in them! + Crashes will occur if you attempt to circumvent the methods. All + your data nodes are stored AFTER list.head and BEFORE list.tail. + This is to simplify the algorithms. + + 2. The following macros are provided for speed and work precisely + the same as their OO counterparts, except they require the argument + 'list': LISTISEMPTY(list), FIRSTNODE(list), LASTNODE(list). + + 3. (Gregor Goldbach) Ported the module to the OOEP of the AEE. + Thus I had to add the methods select(), init() and end(). Made a + minor change to the dllh object, the attributes are now pointers. + + For additional information about modification read the doc of every + proc. + + CREATION + early September 1995 Gregor Goldbach + + HISTORY + September 10 1995 Gregor Goldbach + Added length() to dllh. + +****************************************************************************** + +History + + +*/ + new() + - constructor. ALWAYS call it when NEWing the object! + + isEmpty() + - test if list is empty + + firstNode() + - return first node, list.tail if list is empty + + lastNode() + - return last node, list.head if list is empty + + insert(node:PTR TO dlln, listNode:PTR TO dlln) + - insert node after listnode + + addHead(node:PTR TO dlln) + - add node to front of list + + addTail(node:PTR TO dlln) + - add node to end of list + + remove(node:PTR TO dlln) + - remove node from list, return node + + remHead() + - remove first node from list, return node + + remTail() + - remove last node from list, return node + + end() + + - automatically called when you END the object. Frees alls resources + allocated. + + +*----------------------------------------------------------------------------*/ + +OPT MODULE +OPT EXPORT, + REG=5, + PREPROCESS + +MODULE 'oomodules/object' + +OBJECT dlln OF object +/****** dlln/--dlln-- ****************************************** + + NAME + dlln -- doubly linked list node + + ATTRIBUTES + pred:PTR TO dlln -- Predecessor + + succ:PTR TO dlln -- Successor + + SEE ALSO + doublylinked/--dllh-- +****************************************************************************** + +History + + +*/ + pred:PTR TO dlln + succ:PTR TO dlln +ENDOBJECT + +PROC name() OF dlln IS 'doubly linked list node' +/****** dlln/name ****************************************** + + NAME + name() -- Return 'doubly linked list node' + + SYNOPSIS + dlln.name() + + FUNCTION + Returns name of object. + +****************************************************************************** + +History + + +*/ +PROC size() OF dlln IS 12 +/****** dlln/size ****************************************** + + NAME + size() -- Return size of dlln + + SYNOPSIS + dlln.size() + + FUNCTION + Gets you the size of the object. + +****************************************************************************** + +History + + +*/ + +PROC select(optionlist,index) OF dlln +/****** dlln/select ****************************************** + + NAME + select() -- Selection of action on initialization + + SYNOPSIS + dlln.select(otionslist,index) + + FUNCTION + Recognizes the following items: + "pred" -- next item is predecessor + + "succ" -- next item is successor + + INPUTS + optionlist -- optionlist + + index -- index of optionlist + + SEE ALSO + object/select() +****************************************************************************** + +History + + +*/ +-> TODO: error check: len-o'-list! +DEF item, value + + item := ListItem(optionlist, index) + + SELECT item + CASE "pred" + INC index + self.pred := ListItem(optionlist,index) + + CASE "succ" + INC index + self.succ := ListItem(optionlist,index) + + ENDSELECT + +ENDPROC index + +OBJECT dllh OF object +/****** dllh/--dllh-- ****************************************** + + NAME + dllh -- doubly linked list header + + ATTRIBUTES + head:PTR TO dlln -- The head of the list + + tail:PTR TO dlln -- The tail of the list + + SEE ALSO + doublylinked/--dlln-- +****************************************************************************** + +History + + +*/ + head:PTR TO dlln + tail:PTR TO dlln +ENDOBJECT + +PROC name() OF dllh IS 'doubly linked list header' +/****** dllh/name ****************************************** + + NAME + name() -- Return 'doubly linked list header' + + SYNOPSIS + dllh.name() + + FUNCTION + Returns the name of the object. + +****************************************************************************** + +History + + +*/ +PROC size() OF dllh IS 28 ->12+12+4 +/****** dllh/size ****************************************** + + NAME + size() -- Get size of object + + SYNOPSIS + dllh.size() + + FUNCTION + Gets you the size of the object. + +****************************************************************************** + +History + + +*/ + +PROC select(optionlist,index) OF dllh +/****** dllh/select ****************************************** + + NAME + select() -- Select actionon initialization. + + SYNOPSIS + dllh.select() + + FUNCTION + Recognizes no items. + +****************************************************************************** + +History + + +*/ +-> TODO: error check: len-o'-list! +DEF item, value + +-> item := ListItem(optionlist, index) + +ENDPROC index + +PROC init() OF dllh +/****** dllh/init ****************************************** + + NAME + init() -- Initialization of object. + + SYNOPSIS + dllh.init() + + FUNCTION + Initializes the object that way that an empty list is created. +****************************************************************************** + +History + + +*/ +DEF n:PTR TO dlln + + NEW n.new() + self.head := n + + NEW n.new() + self.tail := n + + self.head.succ:=self.tail + self.tail.pred:=self.head + self.head.pred:=NIL + self.tail.succ:=NIL +ENDPROC + +PROC end() OF dllh +/****** dllh/end ****************************************** + + NAME + end() -- Global destructor. + + SYNOPSIS + dllh.end() + + FUNCTION + Frees allocated resources. This does NOT mean that the list is + automatically cleared. + +****************************************************************************** + +History + + +*/ +DEF n + + n := self.tail + Dispose(n) + + n := self.head + Dispose(n) + +ENDPROC + + +#define LISTISEMPTY(list) (list::dllh.head.succ=list::dllh.tail) +/****** dllh/LISTISEMPTY ****************************************** + + NAME + LISTISEMPTY + + SYNOPSIS + LISTISEMPTY(list:PTR TO dllh) + + FUNCTION + Test if the list is empty. + + INPUTS + list:PTR TO dllh -- The list to test + + RESULT + TRUE if the list is empty, FALSE otherwise + +****************************************************************************** + +History + + +*/ +#define FIRSTNODE(list) (list::dllh.head.succ) +/****** dllh/FIRSTNODE ****************************************** + + NAME + FIRSTNODE -- Get first node of list. + + SYNOPSIS + FIRSTNODE(list:PTR TO dllh) + + FUNCTION + Get the first node of the list. + + INPUTS + list:PTR TO dllh -- The list to get the first node of. + + RESULT + PTR TO dlln -- The first node of the list + +****************************************************************************** + +History + + +*/ +#define LASTNODE(list) (list::dllh.tail.pred) +/****** dllh/LASTNODE ****************************************** + + NAME + LASTNODE -- Get first node of list. + + SYNOPSIS + LASTNODE(list:PTR TO dllh) + + FUNCTION + Get the last node of the list. + + INPUTS + list:PTR TO dllh -- The list to get the last node of. + + RESULT + PTR TO dlln -- The last node of the list + +****************************************************************************** + +History + + +*/ + +PROC isEmpty() OF dllh IS self.head.succ=self.tail +/****** dllh/isEmpty ****************************************** + + NAME + isEmpty() -- Is the list empty? + + SYNOPSIS + dllh.isEmpty() + + FUNCTION + Test if the list is empty. + + RESULT + TRUE if the list is empty, FALSE otherwise + +****************************************************************************** + +History + + +*/ +PROC firstNode() OF dllh IS self.head.succ +/****** dllh/firstNode ****************************************** + + NAME + firstNode() -- Get first node of list. + + SYNOPSIS + dllh.firstNode() + + FUNCTION + Get the first node of the list. + + RESULT + PTR TO dlln -- The first node of the list + +****************************************************************************** + +History + + +*/ +PROC lastNode() OF dllh IS self.tail.pred +/****** dllh/lastNode ****************************************** + + NAME + lastNode() -- Get first node of list. + + SYNOPSIS + dllh.lastNode() + + FUNCTION + Get the last node of the list. + + RESULT + PTR TO dlln -- The last node of the list + +****************************************************************************** + +History + + +*/ + +PROC insert(node:PTR TO dlln, listNode:PTR TO dlln) OF dllh +/****** dllh/insert ****************************************** + + NAME + insert() -- Insert node in list. + + SYNOPSIS + dllh.insert(node:PTR TO dlln, listNode:PTR TO dlln) + + FUNCTION + Inserts a node after another. + + INPUTS + node:PTR TO dlln -- Node to insert. + + listNode:PTR TO dlln -- Node after which the first node will be + inserted. + +****************************************************************************** + +History + + +*/ + node.pred:=listNode + node.succ:=listNode.succ + listNode.succ:=node + listNode:=node.succ + listNode.pred:=node +ENDPROC + +PROC addHead(node:PTR TO dlln) OF dllh +/****** dllh/addHead ****************************************** + + NAME + addHead() -- Insert node at the head of the list. + + SYNOPSIS + dllh.addHead(node:PTR TO dlln) + + FUNCTION + Inserts a node at the head of the list. + + INPUTS + node:PTR TO dlln -- Node to insert. + +****************************************************************************** + +History + + +*/ + self.insert(node, self.head) +ENDPROC + +PROC addTail(node:PTR TO dlln) OF dllh +/****** dllh/addTail ****************************************** + + NAME + addTail() -- Insert a node at the tail of the list. + + SYNOPSIS + dllh.addTail(node:PTR TO dlln) + + FUNCTION + Inserts a node at the tail of the list. + + INPUTS + node:PTR TO dlln -- Node to insert. + +****************************************************************************** + +History + + +*/ + self.insert(node, self.tail.pred) +ENDPROC + +PROC remove(node:PTR TO dlln) OF dllh +/****** dllh/remove ****************************************** + + NAME + remove() -- Removes a node from the list. + + SYNOPSIS + dllh.remove(node:PTR TO dlln) + + FUNCTION + Removes a node from the list it's in. + + INPUTS + node:PTR TO dlln -- Node to remove. + + RESULT + PTR TO dlln -- The node that was removed. + +****************************************************************************** + +History + + +*/ + IF self.head.succ=self.tail THEN RETURN NIL + node.pred.succ:=node.succ + node.succ.pred:=node.pred + node.succ:=NIL + node.pred:=NIL +ENDPROC node + +PROC remHead() OF dllh IS self.remove(self.head.succ) +/****** dllh/remHead ****************************************** + + NAME + remHead() -- Remove the head of the list. + + SYNOPSIS + dllh.remHead() + + FUNCTION + Removes it's head. + + RESULTS + PTR TO dlln -- The ex-head. + +****************************************************************************** + +History + + +*/ + +PROC remTail() OF dllh IS self.remove(self.tail.succ) +/****** dllh/remTail ****************************************** + + NAME + remTail() -- Remove the tail of the list. + + SYNOPSIS + dllh.remTail() + + FUNCTION + Removes it's tail. + + RESULT + PTR TO dlln -- The ex-tail. + +****************************************************************************** + +History + + +*/ + +PROC length() OF dllh +/****** dllh/length ****************************************** + + NAME + length() -- Get the length of the list. + + SYNOPSIS + dllh.length() + + FUNCTION + Gets the number of nodes in this list. 0 means the list is empty. + + RESULT + The number of nodes in this list. + +****************************************************************************** + +History + + +*/ +DEF actualNode:PTR TO dlln, + lastNode:PTR TO dlln, + count=1 + + IF self.isEmpty() THEN RETURN 0 + + actualNode := self.firstNode() + lastNode := self.lastNode() + + + WHILE (actualNode<>lastNode) + actualNode := actualNode.succ + count++ + ENDWHILE + +ENDPROC count +/*EE folds +-1 +83 21 122 43 125 21 164 22 167 28 170 26 311 28 314 21 317 21 320 28 367 35 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/Examples new file mode 100644 index 0000000..0e53a0a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/Examples @@ -0,0 +1,16 @@ +@database doublylinked_example + +@node main "Introduction to doublylinked" + +The doublylinked object provides a doubly linked list object. Each item +of such a list has a link to its successor and predecessor. The object +can be seen as an example for exec's list. + +This object was designed by Barry Wills and ported to the ooep by Gregor +Goldbach. + +There is an @{" example " link EMODULES:oomodules/list/doublylinked/test.e/main} available. + +There is an @{" autodoc " link EMODULES:oomodules/oodoc/guides/doublylinked/main} file available or this object. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist.e new file mode 100644 index 0000000..b7c4d2a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist.e @@ -0,0 +1,214 @@ +/* + +This module contains the code of the original example program of Barry's +doubly linked list module. + +Gregor Goldbach September 10 1995 + + +Just added a new method. It takes an elist and builds a alpha sorted string +list from it. The elist's entries are copied. Named the proc after queuestack's +asQueuestack() asStringList(). + +Gregor Goldbach September 29 1995 + + + April 10 1996 Gregor Goldbach + Removed the method asExecList for we have the execList object to convert + an elist. To get an execList from a stringList do this: + + /* + * A stringList has already been built, set elist to stringList' + * contents: + */ + + elist.set(stringList.asList()) + + + /* + * Get execList from elist: + */ + + NEW execList.new(["list", elist.list]) + + + Renamed asStringList() to fromList(). + +*/ + +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/list/doublylinked' + +OBJECT stringNode OF dlln + string +ENDOBJECT + +OBJECT stringList OF dllh +ENDOBJECT + + +PROC select(optionlist,index) OF stringNode +-> TODO: error check: len-o'-list! +DEF item, value, + len + + item := ListItem(optionlist, index) + + SELECT item + CASE "set" + INC index + + self.string:=StrCopy(String(len:=StrLen(ListItem(optionlist,index))), ListItem(optionlist,index), len) + + ENDSELECT + +ENDPROC index + +PROC end() OF stringNode + DisposeLink(self.string) +ENDPROC + +PROC clear() OF stringList + DEF node:PTR TO stringNode + WHILE self.isEmpty()=FALSE + node:=self.remHead() + END node + ENDWHILE +ENDPROC + +PROC insertAlphaSorted(node:PTR TO stringNode) OF stringList + DEF listnode:PTR TO stringNode, done=FALSE + listnode:=self.firstNode() ->returns lastnode or tail + REPEAT + IF listnode=self.tail + done:=TRUE + ELSEIF OstrCmp(node.string, listnode.string)>=0 + done:=TRUE + ELSE + listnode:=listnode.succ + ENDIF + UNTIL done + self.insert(node, listnode.pred) +ENDPROC + +PROC printAll() OF stringList + DEF node:PTR TO stringNode + IF self.isEmpty() + WriteF('*** List is empty\n') + RETURN + ENDIF + node:=self.firstNode() + WHILE node<>self.tail + WriteF('\s\n', node.string) + node:=node.succ + ENDWHILE +ENDPROC + + +PROC asList() OF stringList +/* + + NAME + + asList() of stringList + + FUNCTION + + Returns an elist with the names as items. + +*/ + +DEF index, + list:PTR TO LONG, + len, + actualNode:PTR TO stringNode + + len := self.length() + IF len=0 THEN RETURN + IF (list := List(len)) = NIL THEN RETURN + + + actualNode := self.firstNode() + + + FOR index := 0 TO len-1 + list[index] := actualNode.string + actualNode := actualNode.succ + ENDFOR + + SetList(list,len) + + RETURN list + +ENDPROC + +EXPORT PROC fromList(list) OF stringList +DEF n:PTR TO stringNode, + index + + FOR index := 0 TO ListLen(list)-1 + + self.insertAlphaSorted(NEW n.new(["set",ListItem(list,index)])) + + ENDFOR + +ENDPROC + +/* + +the following method asExecList() is removed from this object because of +the execList object. To get an execList from a stringList one has to do +this: + + /* a stringList has already been built */ + + elist.set(stringList.asList()) + NEW execList.new(["list", elist.list]) + + + +PROC asExecList() OF stringList +/* + + NAME + + asExecList() of stringList + + FUNCTION + + Returns an execlist with the names as items. Note that the + names are NOT copied. + +*/ + +DEF index, + list:PTR TO LONG, + len, + actualNode:PTR TO stringNode, + + execlist:PTR TO lh, + execnode:PTR TO ln + + execlist := newlist() + + len := self.length() + IF len=0 THEN RETURN + IF (list := List(len)) = NIL THEN RETURN + + + actualNode := self.firstNode() + + + FOR index := 0 TO len-1 + execnode := newnode(NIL, actualNode.string) + AddTail(execlist,execnode) + actualNode := actualNode.succ + ENDFOR + + RETURN execlist + +ENDPROC + +*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist/Examples new file mode 100644 index 0000000..058041d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist/Examples @@ -0,0 +1,18 @@ +@database stringList_example + +@node main "Introduction to stringList" + +stringList is an extension of the doublylinked list object by Barry Wills. +It handles strings in such a list, you can insert alphanumerically-sorted. + +There are methods to export the sorted list to other objects (elist). + +This object was designed by Barry Wills and ported to the ooep by Gregor +Goldbach. + +There are two examples, the @{" first example " link EMODULES:oomodules/list/doublylinked/stringList/test.e/main} just inserts some items, +the @{" second " link EMODULES:oomodules/list/doublylinked/stringList/execTest.e/main} converts a list between stringList, @{" elist " link EMODULES:oomodules/list/elist/Examples/Main} and @{" execList " link EMODULES:oomodules/list/execList/Examples/main}. + +There is an @{" autodoc " link EMODULES:oomodules/oodoc/guides/stringList/main} file available or this object. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist/test.e new file mode 100644 index 0000000..8d1dc66 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist/test.e @@ -0,0 +1,61 @@ +/* + +Small test program for the stringList object. + +Allocate a stringList, insert some strings alpha-sorted and print it. + +*/ + +MODULE 'oomodules/list/doublylinked/stringlist' + +PROC main() + +/* + * These are the vars we need: the stringList object, a var to hold the + * list we want to have and the index counter for the list. + */ + +DEF stringList:PTR TO stringList, + sortedList, + index + + + /* + * Allocate and initialize the object + */ + + NEW stringList.new() + + + + /* + * Insert some words and get an list. The elist will contain pointers + * to the alpha-sorted strings. + */ + + stringList.fromList(['fire','walk','with','me']) + sortedList := stringList.asList() + + + + /* + * Dump the list. + */ + + FOR index := 0 TO ListLen(sortedList)-1 + + WriteF('\s\n', ListItem(sortedList,index)) + + ENDFOR + + + + /* + * We have to dispose the sorted list we got from asList() since that + * method allocated it. E's runtime system would free that memory at the + * end of the program but it is good style... + */ + + Dispose(sortedList) + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist/testExec.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist/testExec.e new file mode 100644 index 0000000..61fe9c7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/stringlist/testExec.e @@ -0,0 +1,46 @@ +MODULE 'oomodules/list/doublylinked/stringlist', + 'oomodules/list/execList', + 'oomodules/list/eList', + 'exec/lists', + 'exec/nodes' + + + +PROC main() +DEF stringList:PTR TO stringList, + sortedList, + index, + execlist:PTR TO execlist, + elist:PTR TO elist + + + NEW stringList.new() + + stringList.fromList(['fire','walk','with','me']) + + NEW elist.new() + + elist.set(stringList.asList()) + NEW execlist.new(["list", elist.list]) + + dumpExeclist(execlist.list) + +ENDPROC + +PROC dumpExeclist(list:PTR TO lh) +DEF node:PTR TO ln, + nextnode:PTR TO ln + + node := list.head + + WHILE node.succ + + WriteF('\s\n', node.name) + + nextnode := node.succ + + node := nextnode + + ENDWHILE + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/test.e new file mode 100644 index 0000000..134699c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/doublylinked/test.e @@ -0,0 +1,87 @@ +/* + +This is the original example program of the module that is now +oomodules/list/doublylinked. I didn't change a single byte. + +Gregor Goldbach 95/7/3 + +Added WriteF() of length. + +Gregor Goldbach 95/9/10 + +*/ + +/*=== EXAMPLE PROGRAM ===*/ + +MODULE 'oomodules/list/doublylinked' + +OBJECT mynode OF dlln + string +ENDOBJECT + +OBJECT mylist OF dllh +ENDOBJECT + +PROC new(string) OF mynode + DEF len + self.string:=StrCopy(String(len:=StrLen(string)), string, len) +ENDPROC + +PROC end() OF mynode + DisposeLink(self.string) +ENDPROC + +PROC clear() OF mylist + DEF node:PTR TO mynode + WHILE self.isEmpty()=FALSE + node:=self.remHead() + END node + ENDWHILE +ENDPROC + +PROC insertAlphaSorted(node:PTR TO mynode) OF mylist + DEF listnode:PTR TO mynode, done=FALSE + listnode:=self.firstNode() ->returns lastnode or tail + REPEAT + IF listnode=self.tail + done:=TRUE + ELSEIF OstrCmp(node.string, listnode.string)>=0 + done:=TRUE + ELSE + listnode:=listnode.succ + ENDIF + UNTIL done + self.insert(node, listnode.pred) +ENDPROC + +PROC printAll() OF mylist + DEF node:PTR TO mynode + IF self.isEmpty() + WriteF('*** List is empty\n') + RETURN + ENDIF + node:=self.firstNode() + WHILE node<>self.tail + WriteF('\s\n', node.string) + node:=node.succ + ENDWHILE +ENDPROC + + +PROC main() HANDLE + DEF l:PTR TO mylist, n:PTR TO mynode + NEW l.new() + l.insertAlphaSorted(NEW n.new('AC/DC')) + l.insertAlphaSorted(NEW n.new('Megadeth')) + l.insertAlphaSorted(NEW n.new('Alice in Chains')) + l.insertAlphaSorted(NEW n.new('Metallica')) + +EXCEPT DO + IF exception THEN WriteF('Error occurred during initialization\n') + IF l + l.printAll() + WriteF('\nThe list contains \d items.\n', l.length()) + l.clear() + END l + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/elist.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/elist.e new file mode 100644 index 0000000..0453d3f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/elist.e @@ -0,0 +1,513 @@ +OPT MODULE + +MODULE 'oomodules/object' + +EXPORT OBJECT elist OF object +/****** elist/elist ****************************** + + NAME + elist of object + + PURPOSE + Handles E's own lists in a more dynamic manner. When the limit of + items is reached the list is simply expanded. + + ATTRIBUTES + list:PTR TO LONG -- Normal E list. + + itemCount:LONG -- How many items actually are in the list. Note that + this is NOT the length of the list. This attribute points at the + next free slot to put a value in. + + hunkSize:LONG -- The number of items the list is expanded by if + necessary. + + SEE ALSO + object/object +********/ + list:PTR TO LONG + itemCount + hunkSize +ENDOBJECT + +PROC init() OF elist +/****** elist/init ****************************** + + NAME + init() of elist -- Initialization of the object. + + SYNOPSIS + elist.init() + + FUNCTION + Sets the hunk size to the initial value (currently this is 16, that + may change) and allocates a list that can holg that much items. + + SEE ALSO + elist + +********/ + + self.hunkSize := 16 + self.list := List(self.hunkSize) + SetList(self.list, self.hunkSize) + +ENDPROC + +PROC select(optionlist, index) OF elist +/****** elist/select ****************************** + + NAME + select() of elist -- Selection of action via tag list. + + SYNOPSIS + elist.select(LONG, LONG) + + elist.select(optionlist, index) + + FUNCTION + Recognized tags are: + "set" -- next item is a normal E list. The object is set to + hold that list. See elist/set(). + + INPUTS + optionlist:LONG -- list of options + + index:LONG -- index of option list + + EXAMPLE + see object/select for an example of how select() works in general. + + SEE ALSO + elist/set() + +********/ +DEF item + + item:=ListItem(optionlist,index) + + SELECT item + + CASE "set" + + INC index + self.set(ListItem(optionlist,index)) + + ENDSELECT + +ENDPROC index + +PROC set(elist) OF elist +/****** elist/set ****************************** + + NAME + set() of elist -- Sets the contents of the list. + + SYNOPSIS + elist.set(LONG) + + elist.set(elist) + + FUNCTION + The object is set to point to the list that is given to the function. + By calling this function you hand the list over to the object. That + means that you may not free it unless you remove it from the object + first. Note that the list is automatically freed when ENDing this + object. + + If the object already holds a list that one is freed first. So if + you want to remove a list from the object safely after you have passed + it you may call this function with NIL. + + INPUTS + elist:LONG -- normal E list. May be NIL. + + EXAMPLE + + -> First allocate it + + NEW elist.new() + + -> set it + + elist.set([1,2,3,42]) + + -> now free it + elist.set(NIL) + + NOTES + This function is called when you provide the tag "list" in the option + list for method new() + + SEE ALSO + elist, new() + +********/ + + IF self.list THEN DisposeLink(self.list) + self.list := elist + IF elist THEN self.itemCount := ListLen(self.list) ELSE self.itemCount := 0 + +ENDPROC + +PROC get() OF elist IS self.list, IF self.list THEN ListLen(self.list) ELSE -1 +/****** elist/get ****************************** + + NAME + get() of elist -- Get the list and it's length. + + SYNOPSIS + elist.get() + + FUNCTION + Gets you the actual E list and it's length. The list may not have all + it's items set if it was expanded. + + RESULT + PTR TO LONG -- The E list. NIL if no list is there. + + LONG -- The length of the E list. -1 if no list is there. + + SEE ALSO + elist + +********/ + +PROC grow() OF elist +/****** elist/grow ****************************** + + NAME + grow() of elist -- Expand a list. + + SYNOPSIS + elist.grow() + + FUNCTION + Expands the list by the number of items that is put in the hunkSize + attribute. + + RESULT + LONG -- -1 if the list could not be expanded. The current list stays + valid. + + EXAMPLE + + NEW list.new() + + WriteF('Actual lenght of the list is \d.\n', ListLen(list.list)) + list.grow() + WriteF('Actual lenght of the list is \d.\n', ListLen(list.list)) + + SEE ALSO + elist, add() + +********/ +DEF tempList:PTR TO LONG, + nuSize + + nuSize := ListLen(self.list)+self.hunkSize + tempList := List(nuSize) + + IF tempList = NIL THEN RETURN -1 + + ListCopy(tempList, self.list, ALL) + DisposeLink(self.list) + self.list := tempList + SetList(self.list,nuSize) + +ENDPROC + +PROC add(item) OF elist +/****** elist/add ****************************** + + NAME + add() of elist -- Add an item to the list. + + SYNOPSIS + elist.add(LONG) + + elist.add(item) + + FUNCTION + Adds an item to the list and expands the list if necessary. + + INPUTS + item:LONG -- Item to add to the list. + + RESULT + LONG -- -1 if expansion of the list failed. The current list stays + valid. + + SEE ALSO + elist, grow() + +********/ +DEF list:PTR TO LONG, + res + + list := self.list + + res := Mod(self.itemCount+1, self.hunkSize) +-> WriteF('-- \d\n', res) + IF (res = 0) + +-> WriteF('hafta grow at \d\n', self.itemCount) + IF self.grow()=-1 THEN RETURN -1 +-> WriteF('grown at \n', self.itemCount) + list := self.list + ENDIF + + list[self.itemCount] := item + self.itemCount := self.itemCount+1 + +ENDPROC + +PROC putAt(item,position) OF elist HANDLE +/****** elist/putAt ****************************** + + NAME + putAt() of elist -- Puts an item at a specific position in the list. + + SYNOPSIS + elist.putAt(LONG, LONG) + + elist.putAt(item, position) + + FUNCTION + Puts an item in the list at a certain position. Any value that is at + that position will be overwritten. The list is expanded if necessary. + + INPUTS + item:LONG -- Item to put in the list. + + position:LONG -- Position to put it at. + + RESULT + LONG -- -1 if the list could not be expanded. The current list stays + valid. + + SEE ALSO + elist, grow() + +********/ + + WHILE (position>=ListLen(self.list)) -> while position is out of range + + IF (self.grow()=-1) THEN Raise("MEM") -> exit if no memory + + ENDWHILE + + self.list[position] := item + +-> WriteF('put \d at \d.\n', item, position) + + +EXCEPT + + RETURN -1 + +ENDPROC + +PROC getFrom(position) OF elist +/****** elist/getFrom ****************************** + + NAME + getFrom() of elist -- Get item from a specific position. + + SYNOPSIS + elist.getFrom(LONG) + + elist.getFrom(position) + + FUNCTION + Gets the item that's at position in the list. + + INPUTS + position:LONG -- Position to get the item from. + + RESULT + LONG, LONG -- 0, "rnge" if the position was out of range, i.e. if it + exceeded the list's length. + + SEE ALSO + elist + +********/ + + IF position >= ListLen(self.list) THEN RETURN 0,"rnge" + + RETURN self.list[position] + +ENDPROC + +PROC end() OF elist +/****** elist/end ****************************** + + NAME + end() of elist -- Global destructor. + + SYNOPSIS + elist.end() + + FUNCTION + Disposes the list. + + SEE ALSO + elist + +********/ + + IF self.list THEN DisposeLink(self.list) + +ENDPROC + +PROC kill() OF elist +/****** elist/kill ****************************** + + NAME + kill() of elist -- END all items and the object. + + SYNOPSIS + elist.kill() + + FUNCTION + Goes through the list and does an END on each if the item is not NIL. + After that the object itself is ENDed. + + NOTES + Only call this function when you really know what is in the list. + + SEE ALSO + elist + +********/ +DEF index, + item + + IF self.list = NIL THEN RETURN + + FOR index := 0 TO self.itemCount + + item := self.list[index] + IF item THEN END item + + ENDFOR + + END self + +ENDPROC + +PROC strip() OF elist +/****** elist/strip ****************************** + + NAME + strip() of elist -- Strip existing list from object. + + SYNOPSIS + elist.strip() + + FUNCTION + Gets you the existing list and initializes the object. The list you + get can be used ater the object was ENDed. Useful in procs + when you want to work with the elist object but don't want to return + this object. + + EXAMPLE + + PROC passMeAList(passedList) + DEF elist:PTR TO elist, + list, + anyVar + + NEW elist.new() + + ForAll({anyVar}, passedList, 'IF anyVar=42 THEN elist.add('blue-footed boobie')) + + /* + * We strip the list from the object for outside of this proc + * nobody should know what object we'rr working with :) + */ + + list := elist.strip() + END elist + + ENDPROC list + + SEE ALSO + elist, init() + +********/ +DEF list + + list := self.list + SetList(list, self.itemCount) + + self.list := NIL + self.itemCount := 0 + + self.init() + + RETURN list + +ENDPROC + +PROC find(item) OF elist +DEF index=-1 + + REPEAT + + INC index + + UNTIL (self.list[index]=item) OR (index=self.itemCount) + + /* WriteF('found at \d.\n', index) */ + IF index = self.itemCount THEN Throw("elis",'item not found') ELSE RETURN index + +ENDPROC + +PROC removeFrom(number) OF elist + + IF self.list = NIL THEN RETURN + + IF self.itemCount + + self.list[number] := self.list[self.itemCount-1] + self.list[self.itemCount-1] := NIL + + self.itemCount := self.itemCount-1 + + ELSE + + self.list[0] := NIL + self.itemCount := 0 + + ENDIF + +ENDPROC + +PROC remove(item) OF elist HANDLE + + self.removeFrom(self.find(item)) + +EXCEPT + + /* WriteF('Unable to remove item - not in list.\n')*/ +ENDPROC + +PROC setNextFreeSlotAt(position) OF elist HANDLE + + WHILE (position>=ListLen(self.list)) -> while position is out of range + + IF (self.grow()=-1) THEN Raise("MEM") -> exit if no memory + + ENDWHILE + + self.itemCount := position + +EXCEPT + +ENDPROC +/*EE folds +-1 +5 26 7 21 10 40 13 50 39 41 42 42 91 29 94 18 97 33 100 51 103 11 106 17 109 6 112 11 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/elist/examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/elist/examples new file mode 100644 index 0000000..047f3bf --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/elist/examples @@ -0,0 +1,48 @@ +@database elist_example + +@node main "Introduction to elist" + +The elist object is some kind of 'object oriented object wrapper' for E's +lists. Is as easy to use as the normal lists but provides some powerful +features, for example it increases the size of the list automatically +when this is necessary. + +The list attribute of elist holds the currently active list. Currently +active means that this list may not be valid in the future. + +This is because of the dynamic handling of lists implemented in this object. +The list can't be full as normal E lists can. (Actually it can, but only if +there's no memory left). You can add items to the list and the object +expands itself if necessary. + + + +Currently there's only @{" one example " link EMODULES:oomodules/list/elist/test.e/main} that fiddles around with the elist +features. + +There is an @{" autodoc " link EMODULES:oomodules/oodoc/guides/elist/main} file available or this object. + +@endnode + +@node initilisation "Allocation and initilisation of elist" + +Only one argument can be passed to new - "set". The following tag is a list. +The list attribute is set to this list. If you get a normal E list and you +want to use the advantages of the elist object simply pass the list to NEW. + +@endnode + +@node where "Where to use this object" + +The elist can be used when you have an unknown number of item you want to +collect in a list. When allocating one of E's lists the size is fixed. The +kill() method may come in handy, too. + +@endnode + +@node see_also "See also" + +Associated objects are the objects of the list hierarchy - queuestack +(big but useful), execlist (doubly linked system list) and the others. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/elist/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/elist/test.e new file mode 100644 index 0000000..58683db --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/elist/test.e @@ -0,0 +1,116 @@ +/* + +Small example to test the elist features. + +*/ + +MODULE 'oomodules/list/elist' + +PROC main() +DEF l:PTR TO elist, + index + + + /* + * Allocate the object and initialize it. + */ + + NEW l.new() + + + + /* + * Dump some information on the list. It should have the size of the + * initial hunk size that is defined as a constant in the elist module. + */ + + WriteF('Created an elist; ') + WriteF('list at \d, ', l.list) + WriteF('hunk size is \d\n', l.hunkSize) + + WriteF('list size is \d\n', ListLen(l.list)) + WriteF('count is \d\n', l.itemCount) + + + + /* + * Add twenty items and set it to anything (in this case the number of + * the element. The add() method takes anything and put it in the list. + */ + + WriteF('\nAdding twenty items.\n') + FOR index := 0 TO 20 + l.add(index) + ENDFOR + + + + /* + * If the hunk size is smaller than twenty the list should be grown now. + */ + + WriteF('list size is \d\n', ListLen(l.list)) + + + + /* + * Play around with the items. The itemCount attribute points to the next + * free slot of the list, i.e. when we want to get rid of the last 10 + * elements of the list we can set this attribute to itemCount-10. The + * items will be overwritten. + */ + + WriteF('\nPut 26 at slot 24.\n') + l.putAt(26,24) + WriteF('count is \d\n', l.itemCount) + l.setNextFreeSlotAt(25) + WriteF('count is \d\n', l.itemCount) + + WriteF('list size is \d\n', ListLen(l.list)) + + + + /* + * Dump the contents of the list. + */ + + WriteF('\nDump all items.\n') + FOR index := 0 TO l.itemCount-1 + WriteF('\d\n', l.getFrom(index)) + ENDFOR + + + + /* + * Remove some items. + */ + + WriteF('\nRemove items 10 and 19.\n') + l.remove(10) + l.remove(19) + + WriteF('list size is \d\n', ListLen(l.list)) + WriteF('count is \d\n', l.itemCount) + + + + /* + * Dump it again to see if removing was successful. + */ + + WriteF('\nDump all items.\n') + FOR index := 0 TO l.itemCount-1 + WriteF('\d\n', l.getFrom(index)) + ENDFOR + + + /* + * END the object and free allocated resources. This does *not* include + * the elements in the list. If you collect allocated objects in such a + * list you would have to call the kill() method to END them as well. + * This END does only free the list, not it's contents. + */ + + END l + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/execlist.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/execlist.e new file mode 100644 index 0000000..def8d41 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/execlist.e @@ -0,0 +1,176 @@ +OPT MODULE + +MODULE 'oomodules/object', + + 'tools/constructors', + + 'exec/lists', + 'exec/nodes' + +EXPORT OBJECT execlist OF object +/****** object/execlist ****************************** + + NAME + execlist of object -- List as used in the exec.library + + PURPOSE + Just a quick and small implementation of exec's list. Only useable + for converting from an elist (for listviews etc.) + + ATTRIBUTES + list:PTR TO lh -- exec's list header + + len:LONG -- number of nodes in the list + + SEE ALSO + object, exec + +********/ + list:PTR TO lh, + len +ENDOBJECT + +PROC init() OF execlist IS EMPTY +/****** execlist/init ****************************** + + NAME + init() of execlist -- Initialization of the object. + + SYNOPSIS + execlist.init() + + FUNCTION + Empty by now. + + SEE ALSO + execlist + +********/ + +PROC select(optionlist, index) OF execlist +/****** execlist/select ****************************** + + NAME + select() of execlist -- Selection of action. + + SYNOPSIS + execlist.select(LONG, LONG) + + execlist.select(optionlist, index) + + FUNCTION + Recognized tags are: + "list" -- take items as node names. See fromList(). + INPUTS + optionlist:LONG -- list of options + + index:LONG -- index of option list + + SEE ALSO + execlist, fromList() + +********/ +DEF item + + item:=ListItem(optionlist,index) + + SELECT item + + CASE "list" + + INC index + self.fromList(ListItem(optionlist,index)) + + ENDSELECT + +ENDPROC index + +PROC fromList(list:PTR TO LONG) OF execlist +/****** execlist/fromList ****************************** + + NAME + fromList() of execlist -- Take items of elist as node names. + + SYNOPSIS + execlist.fromList(LONG) + + execlist.fromList(list) + + FUNCTION + Creates a list. The items of the passed elist are taken as names of + the nodes. Therefore you may free the elist but not the items. + + INPUTS + list:LONG -- E list of strings. + + SEE ALSO + execlist + +********/ +DEF execlist:PTR TO lh, + execnode:PTR TO ln, + nextNode:PTR TO ln, + str, + item, + index + + IF list=NIL THEN RETURN + + self.list := newlist() + + FOR index := 0 TO ListLen(list)-1 + + execnode := newnode(NIL, ListItem(list,index)) + AddTail(self.list,execnode) + + ENDFOR + + self.len := ListLen(list) + +ENDPROC + +PROC end() OF execlist +/****** execlist/end ****************************** + + NAME + end() of execlist -- Global destructor. + + SYNOPSIS + execlist.end() + + FUNCTION + Disposes all nodes and the list. If the nodes have names you have to + dispose them. + + SEE ALSO + execlist + +********/ +DEF execnode:PTR TO ln, + index, + nextNode:PTR TO ln + + execnode := self.list.head + + WriteF('ending exec list with \d nodes.\n', self.len) + + FOR index:=1 TO self.len + + nextNode := execnode.succ + WriteF('ending node at \d, next node is \d.\n', execnode, nextNode) + Dispose(execnode) + execnode := nextNode + + ENDFOR + + WriteF('ending list header at \d.\n') + Dispose(self.list) + + WriteF('all resources of object freed, returning.\n') + +ENDPROC + +/*EE folds +-1 +10 21 29 35 32 41 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/execlist/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/execlist/Examples new file mode 100644 index 0000000..a9262f1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/execlist/Examples @@ -0,0 +1,35 @@ +@database execlist_example + +@node main "Introduction to execlist" + +The execlist object is some kind of 'object oriented object wrapper' for +exec.library's lists. Those lists are used in listview gadgets for example +and in many other places of the Amiga OS. + +Currently there's only @{" one example " link EMODULES:oomodules/list/execlist/test.e/main} that fiddles around with the execlist +features. + +There is an @{" autodoc " link EMODULES:oomodules/oodoc/guides/execlist/main} file available or this object. + +@endnode + +@node initilisation "Allocation and initilisation of execlist" + +The most important argument that can be passed to new is "list". The +following tag is an E list the object is set to. Listviews and other +system objects can be initialised quickly using this feature. + +@endnode + +@node where "Where to use this object" + +Anywhere you want to use exec lists. + +@endnode + +@node see_also "See also" + +Associated objects are the objects of the list hierarchy - queuestack +(big but useful), elist (object wrapper of E's list) and the others. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/execlist/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/execlist/test.e new file mode 100644 index 0000000..3caa6ac --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/execlist/test.e @@ -0,0 +1,64 @@ +/* + +Sample program for the execlist object. It allocates an execlist and +displays its contents in a Listview gadgets via EasyGUI. + +*/ + +MODULE 'oomodules/list/execlist', + 'tools/easygui' + +PROC main() HANDLE + + /* + * Call the proc that opens a windows with the title 'huhu' + */ + + showList(NIL,'huhu') + + + + /* + * If something went wrong we are here + */ + +EXCEPT + WriteF('exception raised\n') +ENDPROC + + + +PROC showList(list, title) +DEF execlist:PTR TO execlist + + /* + * Allocate the object and set the list two the four entries. + * Since the "list" tag takes any E list we could use the elist + * object when we want to have a dynamic list (see there). + */ + + NEW execlist.new(["list", ['1','two','tres','vier']]) + + + + /* + * Tell EasyGUI to open a window with a listview gadget. A listview + * gadget takes the entries to display from an exec list - each node + * of the list is an entry. That exec list can be retrieved from the + * execlist object be specifying the list attribute. + */ + + easygui(title, + [EQROWS, + [LISTV,NIL,NIL,30,10,execlist.list,0,0,0], + [BUTTON,NIL,'None'] + ]) + + + /* + * Be friendly and END the object. + */ + + END execlist + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/list/queuestack.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/queuestack.e new file mode 100644 index 0000000..9be25a7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/list/queuestack.e @@ -0,0 +1,381 @@ +OPT MODULE + +MODULE 'oomodules/object' + +EXPORT OBJECT qsnode OF object + right:PTR TO qsnode + left:PTR TO qsnode + item +ENDOBJECT + +EXPORT OBJECT queuestack OF object + baditem + mysize + last:PTR TO qsnode + first:PTR TO qsnode +ENDOBJECT + +DEF tmp:PTR TO qsnode,moo:PTR TO LONG +EXPORT DEF ctrlc + +EXPORT PROC name() OF qsnode IS 'QSNode' + +EXPORT PROC size() OF qsnode IS 16 + +EXPORT PROC select(opts,i) OF qsnode + DEF item + item:=ListItem(opts,i) + SELECT item + CASE "set" + INC i + self.item:=ListItem(opts,i) + ENDSELECT +ENDPROC i + +EXPORT PROC inject(proc,item) OF qsnode + self.item:=proc(self.item,item) + IF ctrlc AND CtrlC() THEN Raise("^C") + IF self.right THEN self.right.inject(proc,self.item) +ENDPROC + +EXPORT PROC injectBackwards(proc,item) OF qsnode + self.item:=proc(self.item,item) + IF ctrlc AND CtrlC() THEN Raise("^C") + IF self.left THEN self.left.injectBackwards(proc,self.item) +ENDPROC + +EXPORT PROC do(proc) OF qsnode + proc(self.item) + IF ctrlc AND CtrlC() THEN Raise("^C") + IF self.right THEN self.right.do(proc) +ENDPROC + +EXPORT PROC doBackwards(proc) OF qsnode + proc(self.item) + IF ctrlc AND CtrlC() THEN Raise("^C") + IF self.left THEN self.left.doBackwards(proc) +ENDPROC + +EXPORT PROC collect(proc,add:PTR TO queuestack) OF qsnode + add.addLast(proc(self.item)) + IF ctrlc AND CtrlC() THEN Raise("^C") + IF self.right THEN self.right.collect(proc,add) +ENDPROC + +EXPORT PROC collectBackwards(proc,add:PTR TO queuestack) OF qsnode + add.addLast(proc(self.item)) + IF ctrlc AND CtrlC() THEN Raise("^C") + IF self.left THEN self.left.collectBackwards(proc,add) +ENDPROC + +EXPORT PROC conform(proc) OF qsnode + IF ctrlc AND CtrlC() THEN Raise("^C") + RETURN IF self.right THEN self.right.conform(proc) AND proc(self.item) ELSE proc(self.item) +ENDPROC + +EXPORT PROC detect(proc,baditem) OF qsnode + IF ctrlc AND CtrlC() THEN Raise("^C") + RETURN IF proc(self.item) THEN self.item ELSE IF self.right THEN self.right.detect(proc,baditem) ELSE baditem +ENDPROC + +EXPORT PROC detectBackwards(proc,baditem) OF qsnode + IF ctrlc AND CtrlC() THEN Raise("^C") + RETURN IF proc(self.item) THEN self.item ELSE IF self.left THEN self.left.detectBackwards(proc,baditem) ELSE baditem +ENDPROC + +EXPORT PROC reject(proc,add:PTR TO queuestack) OF qsnode + IF ctrlc AND CtrlC() THEN Raise("^C") + IF proc(self.item)<>TRUE + add.addLast(self.item) + ENDIF + IF self.right THEN self.right.reject(proc,add) +ENDPROC + +EXPORT PROC rejectBackwards(proc,add:PTR TO queuestack) OF qsnode + IF ctrlc AND CtrlC() THEN Raise("^C") + IF proc(self.item)<>TRUE + add.addLast(self.item) + ENDIF + IF self.left THEN self.left.rejectBackwards(proc,add) +ENDPROC + +EXPORT PROC choose(proc,add:PTR TO queuestack) OF qsnode + IF ctrlc AND CtrlC() THEN Raise("^C") + IF proc(self.item) + add.addLast(self.item) + ENDIF + IF self.right THEN self.right.choose(proc,add) +ENDPROC + +EXPORT PROC chooseBackwards(proc,add:PTR TO queuestack) OF qsnode + IF ctrlc AND CtrlC() THEN Raise("^C") + IF proc(self.item) + add.addLast(self.item) + ENDIF + IF self.left THEN self.left.choose(proc,add) +ENDPROC + +EXPORT PROC end() OF qsnode + tmp:=self.right + IF tmp THEN END tmp +ENDPROC + +EXPORT PROC size() OF queuestack IS 20 + +EXPORT PROC name() OF queuestack IS 'QueueStack' + +EXPORT PROC select(opts,i) OF queuestack + DEF item + item:=ListItem(opts,i) + SELECT item + CASE "bad" + INC i + self.baditem:=ListItem(opts,i) + CASE "set" + INC i + self.set(ListItem(opts,i)) + ENDSELECT +ENDPROC i + +EXPORT PROC set(item) OF queuestack + IF (item = self.baditem) AND (self.first = NIL) THEN RETURN + IF self.first = NIL + self.first := NEW tmp.new(["set",item]) + self.mysize := 1 + self.last:=self.first + ELSE + tmp:=self.first + END tmp + self.first:=0 + self.last:=0 + ENDIF +ENDPROC + +EXPORT PROC addFirst(item) OF queuestack + IF item = self.baditem THEN RETURN self.error({baditem}) + self.mysize:=self.mysize+1 + IF self.first = NIL + self.first:=NEW tmp.new(["set",item]) + self.last:=self.first + ELSE + self.first.left := NEW tmp.new(["set",item]) + self.first.left.right:=self.first + self.first := self.first.left + ENDIF +ENDPROC + +EXPORT PROC addLast(item) OF queuestack + IF item = self.baditem THEN RETURN self.error({baditem}) + self.mysize:=self.mysize+1 + IF self.first = NIL + self.first:=NEW tmp.new(["set",item]) + self.last:=self.first + ELSE + self.last.right := NEW tmp.new(["set",item]) + self.last.right.left:=self.last + self.last := self.last.right + ENDIF +ENDPROC + +EXPORT PROC getFirst() OF queuestack + DEF out=0 + IF self.mysize + self.mysize:=self.mysize-1 + out:=self.first.item + tmp:=self.first + self.first:=self.first.right + tmp.right:=0 + END tmp + IF self.mysize = NIL + self.first:=NIL + self.last:=NIL + ENDIF + ELSE + out:=FALSE + Raise("qstk") + ENDIF +ENDPROC out + +EXPORT PROC getLast() OF queuestack + DEF out=0 + IF self.mysize + self.mysize:=self.mysize-1 + out:=self.last.item + tmp:=self.last + self.last:=self.last.left + tmp.right := 0 + END tmp + IF self.mysize = NIL + self.first:=NIL + self.last:=NIL + ENDIF + ELSE + out:=FALSE + Raise("qstk") + ENDIF +ENDPROC out + +EXPORT PROC length() OF queuestack IS self.mysize + +EXPORT PROC addFirstQS(in:PTR TO queuestack) OF queuestack + IF in.first + self.first.left:=in.last + in.last.right:=self.first + self.mysize := self.mysize + in.mysize + self.first := in.first + in.mysize := 0 + in.first := NIL;in.last := NIL + ENDIF +ENDPROC + +EXPORT PROC addLastQS(in:PTR TO queuestack) OF queuestack + IF in.first + self.last.right:=in.first + in.first.left:=self.last + self.last := in.last + self.mysize := self.mysize + in.mysize + in.mysize := 0 + in.first := NIL; in.last := NIL + ENDIF +ENDPROC + +EXPORT PROC inject(proc,item=0) OF queuestack + IF self.first THEN RETURN self.first.inject(proc,item) +ENDPROC + +EXPORT PROC injectBackwards(proc,item=0) OF queuestack + IF self.last THEN RETURN self.last.injectBackwards(proc,item) +ENDPROC + +EXPORT PROC do(proc) OF queuestack + IF self.first THEN self.first.do(proc) +ENDPROC + +EXPORT PROC doBackwards(proc) OF queuestack + IF self.last THEN self.last.doBackwards(proc) +ENDPROC + +EXPORT PROC collect(proc) OF queuestack + DEF add:PTR TO queuestack + NEW add.new(["bad",[self.baditem]]) + IF self.first THEN self.first.collect(proc,add) + RETURN add +ENDPROC + +EXPORT PROC collectBackwards(proc) OF queuestack + DEF add:PTR TO queuestack + NEW add.new(["bad",[self.baditem]]) + IF self.last THEN self.last.collectBackwards(proc,add) + RETURN add +ENDPROC + +EXPORT PROC conform(proc) OF queuestack + RETURN IF self.first THEN self.first.conform(proc) ELSE FALSE +ENDPROC + +EXPORT PROC detect(proc) OF queuestack + RETURN IF self.first THEN self.first.detect(proc,self.baditem) ELSE self.baditem +ENDPROC + +EXPORT PROC detectBackwards(proc) OF queuestack + RETURN IF self.last THEN self.last.detectBackwards(proc,self.baditem) ELSE self.baditem +ENDPROC + +EXPORT PROC reject(proc) OF queuestack + DEF add:PTR TO queuestack + NEW add + IF self.first THEN self.first.reject(proc,add) + RETURN add +ENDPROC + +EXPORT PROC rejectBackwards(proc) OF queuestack + DEF add:PTR TO queuestack + NEW add + IF self.last THEN self.last.rejectBackwards(proc,add) + RETURN add +ENDPROC + +EXPORT PROC choose(proc) OF queuestack + DEF add:PTR TO queuestack + NEW add + IF self.first THEN self.first.choose(proc,add) + RETURN add +ENDPROC + +EXPORT PROC chooseBackwards(proc) OF queuestack + DEF add:PTR TO queuestack + NEW add + IF self.last THEN self.last.chooseBackwards(proc,add) + RETURN add +ENDPROC + +EXPORT PROC asList() OF queuestack + moo:=List(self.length()) + self.do({makeList}) +ENDPROC moo + +EXPORT PROC asListBackwards() OF queuestack + moo:=List(self.length()) + self.doBackwards({makeList}) +ENDPROC + +EXPORT PROC asQueueStack(in) OF queuestack + DEF i,mytmp + mytmp:=in + WHILE mytmp + FOR i:=0 TO ListLen(mytmp)-1 + IF ListItem(mytmp,i)<>self.baditem THEN self.addLast(ListItem(mytmp,i)) ELSE RETURN self.error({baditem}) + ENDFOR + mytmp:=Next(mytmp) + ENDWHILE +ENDPROC + +EXPORT PROC asQueueStackBackwards(in) OF queuestack + DEF i,mytmp + mytmp:=in + WHILE mytmp + FOR i:=0 TO ListLen(mytmp)-1 + IF ListItem(mytmp,i)<>self.baditem THEN self.addFirst(ListItem(mytmp,i)) ELSE RETURN self.error({baditem}) + ENDFOR + mytmp:=Next(mytmp) + ENDWHILE +ENDPROC + +EXPORT PROC error(text=0,opt=0) OF queuestack + SELECT text + CASE 0 + RETURN FALSE + CASE {baditem} + RETURN text + CASE {queuestackempty} + RETURN text + DEFAULT + RETURN SUPER self.error(text,opt) + ENDSELECT +ENDPROC + +EXPORT PROC kill() OF queuestack + self.do({murder}) + self.end() + self.first:=0 + self.last:=0 + self.mysize:=0 +ENDPROC + +EXPORT PROC end() OF queuestack + tmp:=self.first + END tmp +ENDPROC + +PROC murder(i) + END i +ENDPROC + +PROC makeList(i) + ListAdd(moo,[i,0],1) +ENDPROC + +baditem: + CHAR 'Bad item\n',0 +queuestackempty: + CHAR 'Empty\n',0 diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/object.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/object.e new file mode 100644 index 0000000..d3ed5f2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/object.e @@ -0,0 +1,491 @@ +/****** object/--background-- ****************************************** + + PURPOSE + The base object for everything in the oomodules/ hierarchy. + + CREATION + in early 1995 by Trey van Riper + + HISTORY + +****************************************************************************** + +History + + +*/ + +OPT MODULE +OPT EXPORT,PREPROCESS + +#define LOCALE_SUPPORT 1 + + +/* MODULE 'other/stderr' */ + +#ifdef LOCALE_SUPPORT + +MODULE 'oomodules/library/locale/catalogList', + 'oomodules/old' + +EXPORT DEF catalogList:PTR TO catalogList + +#endif + + +OBJECT object +/****** object/--object-- ****************************************** + + NAME + object + + NOTES + The Object object (hmm.. sounds redundant) has no attributes, and + tons of methods. + + We may decide to create one or two very important global variables + in the future. These variables will hold information on various + system settings which will allow a smoother halt() and some other + handy functions. At the moment, though, no global variables exist + in the Object module. + +****************************************************************************** + +History + + +*/ +ENDOBJECT + +PROC new(opts=0) OF object +/****** object/new ****************************************** + + NAME + new() -- Create a new instance of an object. + + SYNOPSIS + object.new(opts=0) + + FUNCTION + This allows new instances of objects to be created. It takes as + an argument an Amiga E list ['such','as','this'] which is then + parsed by the opts() method, which places a call to the select() + method. My might want to read up on those. + + In general, you will only want to create new select() statements + for your objects... new() most likely can be left alone. + + INPUTS + opts=0 -- The optionlist + + EXAMPLE + When folks go to use objects, they ought to do something like the + following: + + NEW object.new() + + or if there are options to parse... + + NEW object.new(["boo",'SCREAM']) + + SEE ALSO + select(), init() +****************************************************************************** + +History + + +*/ + /* + * NEW the global catalog list. Don't do it in init() for it could be needed + * in there... + */ + +#ifdef LOCALE_SUPPORT + + IF catalogList = NIL THEN NEW catalogList.new() + +#endif + + + self.init() + self.opts(opts) + +ENDPROC + +PROC init() OF object IS EMPTY +/****** object/init ****************************************** + + NAME + init() -- Initialize an object. + + SYNOPSIS + object.init() + + FUNCTION + Initializes an object to default startup values. You very likely + will want to create your own init() method in your derived objects, + in order to properly initialize your attributes. This init() + method does nothing. If you're not concerned about the internal + attributes during initialization, then this method can be left + alone. + + SEE ALSO + new(), select() +****************************************************************************** + +History + + +*/ + + +PROC size() OF object IS 4 +/****** object/size ****************************************** + + NAME + size() -- Get the size of the object in bytes + + SYNOPSIS + object.size() + + FUNCTION + This returns the SIZEOF the current object. Most likely, this is + a superfluous method, and might need to be reconsidered. In the + meantime, if you want this method to have any meaning at all, you + need to calculate the 'SIZEOF' your object either by adding up all + the attributes and adding four more bytes (for the pointer to its + methods), or by compiling the object and using ShowModule to see + the SIZEOF it comes up with. + + RESULT + The size in bytes + +****************************************************************************** + +History + + +*/ + +PROC opts(opts) OF object +/****** object/opts ****************************************** + + NAME + opts() -- Parse options. + + SYNOPSIS + object.opts(optionlist) + + FUNCTION + This runs a FOR/ENDFOR loop that calls select(). It's most + unlikely that you'll need to modify this method. This method + may disappear in the future (it might be absorbed by new()). + + INPUTS + optionlist -- The optionlist to parse. + + SEE ALSO + select(), new() +****************************************************************************** + +History + + +*/ + DEF i,next + IF opts=0 THEN RETURN + next:=opts +-> REPEAT + FOR i:=0 TO ListLen(next)-1 + i:=self.select(next,i) + ENDFOR +-> next:=Next(next) +-> UNTIL next=NIL +ENDPROC + +PROC select(opt,i) OF object IS i +/****** object/select ****************************************** + + NAME + select() -- Selection of action on initialization. + + SYNOPSIS + object.select(optionlist,index) + + FUNCTION + You'll definately want to create a 'select' statement if you want + new() to have options enabled. All select statements should have + this general format: + + PROC select(optionlist,index) OF myBlowOutObject + DEF item + item:=ListItem(optionlist,index) + SELECT item + -> various cases and perhaps a default.. could look like this: + CASE "boo" + INC index + self.boo(ListItem(optionlist,index)) + ENDSELECT + ENDPROC i + + NOTE THE LAST LINE! If you fail to return i, you could wind up + with an endless loop! This would be a bad thing. + + INPUTS + optionlist -- An elist with tags (or options) that define object + specific actions. + + index -- Position of item we process next in the list. + + SEE ALSO + new(), init() +****************************************************************************** + +History + + +*/ + +PROC error(string,number) OF object +/****** object/error ****************************************** + + NAME + error() -- Report error to stderr + + SYNOPSIS + object.error(string,number) + + FUNCTION + This calles err_WriteF(a,b) as it stands, and returns NIL. You may + want to overload this behavior to do something else, or perhaps + call this from within your own error() routine via SUPER. The + err_WriteF() procedure was written by Joseph E. Van Riper III as + an easy kind of standard error port for Amiga E... it should be + found in the emodules:other directory of your structure. If you + don't have it, you can get it from aminet:dev/e. + + If err_WriteF() is ever called, the programmer must end hir main() + program with 'err_Dispose()' before exiting. This is due to + certain housekeeping matters in Van Riper's StdErr port. + + INPUTS + string -- String to report. + +****************************************************************************** + +History + + +*/ + /* err_WriteF(string,[number]) */ + RETURN NIL +ENDPROC + +PROC name() OF object IS 'Object' +/****** object/name ****************************************** + + NAME + name() -- Get the name of the object. + + SYNOPSIS + object.name() + + FUNCTION + This method should be overloaded for each new class. It should + return a short string of the name of the object. In the object + Object, it's called 'Object'. This is useful for trying to track + down certain internal things in the system (particularly some of + the really funky stuff in the Numbers hierarchy). + + RESULT + A string with the name of the object. + +****************************************************************************** + +History + + +*/ + +PROC end() OF object IS EMPTY +/****** object/end ****************************************** + + NAME + end() -- Global destructor. + + SYNOPSIS + object.end() + + FUNCTION + This is the automatic deallocator. Whenever an object is ENDed, + this will be called. While the Object's end() statement does + nothing, other objects in the hierarchy may be doing some kind + of housekeeping before deallocating the object. If you do not + know whether or not your parent object needs to do some kind of + housekeeping, do a SUPER self.end() somewhere within your own + end() statement (if you even need an end() statement). + + SEE ALSO + new() +****************************************************************************** + +History + + +*/ + +PROC derivedClassResponse() OF object +/****** object/derivedClassResponse ****************************************** + + NAME + derivedClassResponse() -- Standard proc for derived responsibility. + + SYNOPSIS + object.derivedClassResponse() + + FUNCTION + Call this proc in a method that is non-functional by now, but is + functional in objects that derive from this. It writes a message + to stdout that tells that this method isn't implemented. + +****************************************************************************** + +History + + +*/ +DEF msg:PTR TO CHAR + +#ifdef LOCALE_SUPPORT + + IF catalogList + + catalogList.setCurrentCatalog(NIL,OLDC_OBJECT, OLDL_ENGLISH) + msg := catalogList.getString(OLDM_OBJECT_DERIVED_RESPONSE, 'Method not implemented for this derived class') + + ELSE +#endif + msg := 'Method not implemented for this derived class' +#ifdef LOCALE_SUPPORT + ENDIF +#endif + + + WriteF('\s:\s\n',self.name(), msg) + +ENDPROC + +PROC halt(i) OF object +/****** object/halt ****************************************** + + NAME + halt() -- Stop program execution immediately. + + SYNOPSIS + object.halt(i) + + FUNCTION + This is intended to stop the entire program dead in its tracks. + Use this with extreme prejudice, as it doesn't bother to + deallocate anything (yet), and will likely leave filehandles + open or memory allocated or any of a hundred other horrible + system-unfriendly things (it calls CleanUp()). + + In the future, this statement will likely be used to Raise() an + exception rather than die. + + INPUTS + i -- Anything you like. Passed to CleanUp(). + +****************************************************************************** + +History + + +*/ + CleanUp(i) +ENDPROC + +PROC sameAs(a:PTR TO object) OF object IS IF a.name() = self.name() THEN TRUE ELSE FALSE +/****** object/sameAs ****************************************** + + NAME + sameAs() -- Compare to another object. + + SYNOPSIS + object.sameAs(obj:PTR TO object) + + FUNCTION + This method determines whether or not the current object is the + same kind of object as the parameter object. obj is assumed to + be in the Object heirarchy at some point. Basically, this simply + compares self.name() to a.name() to see if it's the same value. + + INPUTS + obj:PTR TO object -- Pointer to any object in the oomodules/ + hierarchy. + + RESULT + TRUE if both objects are the same, FALSE if not. + +****************************************************************************** + +History + + +*/ + +PROC differentFrom(a) OF object IS self.derivedClassResponse() +/****** object/differentFrom ****************************************** + + NAME + differentFrom() -- Are the objects not of the same kind? + + SYNOPSIS + object.differentFrom(obj) + + FUNCTION + This method determines whether or not the current object is a + different kind of object from the parameter object. obj is + assumed to be in the Object heirarchy at some point. + + INPUTS + obj -- Pointer to any object in the oomodules/ hierarchy. + + RESULT + TRUE if objects are different, FALSE if the same. + + NOTES + Doesn't do anything by now, derived objects have to handle this. + +****************************************************************************** + +History + + +*/ + +PROC update(a=0) OF object IS self.derivedClassResponse() +/****** object/update ****************************************** + + NAME + update() -- Update the object. + + SYNOPSIS + object.update(a) + + FUNCTION + This method currently does nothing, but the idea behind this method + is to cause the object to update itself (freshen its current + information, perhaps). + + INPUTS + a -- Use it as you want. + +****************************************************************************** + +History + + +*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/authors/gg.guide b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/authors/gg.guide new file mode 100644 index 0000000..070ffc0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/authors/gg.guide @@ -0,0 +1,71 @@ +@database gregorGoldbach + +@node main "Gregor Goldbach" + + @{" OO and me " link oo_and_me} + @{" The ooep " link ooep} + +@endnode + +@node oo_and_me "OO and me" + +OO came to me via E. I started with E in late 1993 when I found Ev2.1b on a +Fish disk (I think it was 848). E was - and still is - easy to learn, easy to +use and EC compiles fast. And there are a lot of exotic features. Still I +avoided to use unification successfully :) + +When Ev3 was released I tried to use objects and methods rather than +structures and procs. Unluckily I failed for back then I was coding on my +old A500. After the code generation bug was fixed I tried to figure out what +OO was. I don't think I know it by now but I use some features in my sources. + +Encapsulation and polymorphism are just to good to miss... + +@endnode + +@node ooep "The ooep" + +About one and a half years ago Trey mentioned the ooep. Almost instantly I +wanted to contribute to it. Well, I did contribute a lot. Right now (June +1996) I am the only one who works on it. Trey is busy with his job and the +people I mailed about the ooep are quiet. + +If you read this in June '96 you're probably linked either to Aminet/dev/e +or the E mailing list. I'm launching the project to the public for the above +reasons. I've put too much work in it to let it go down. + +The whole archive is provided as found on my hard disk. That leads to these +consequences: + + - Some objects may not work correctly. The reason for this is very simple: + I'm all alone. I coded the objects and tested them. That's not how it + should be. The programmer is not a good tester for his own program. + + - The documentation may be somewhat weird. I don't know if the docs are any + good or just crap. Also they differ in style since my doc-writing style + evolved over the months. + + - Test programs are missing. Often I designed an object to be able to design + another. The test program of the first object mutated to an inheriting + object. + +I didn't launch the archive earlier for this very reasons. + +I hope the whole archive is still useable. In fact I use these objects very +often: + + - elist + - execlist + - associative array + - string list + - GUI/requester/standard + - file/textfile/programsource/* + +The last things I worked on were exec/port/* and commodity before I returned +to my database objects. + +You may have wondered what this guy did who had the idea of the Amiga E +Encyclopedia. Well, now you know what I fiddled around with :) + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/authors/jevr.guide b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/authors/jevr.guide new file mode 100644 index 0000000..a57a75c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/authors/jevr.guide @@ -0,0 +1,202 @@ +@DATABASE "jevr.doc" + +@NODE MAIN "jevr.doc" + +I, Joseph Edwards Van Riper III, as of this writing, am busy +writing music and developing object technologies for the +public domain community, with the hopes of getting things +going in these areas. The technology is too good to allow +the industrial sector to abuse. + +I had intended to graduate this semester, but I blew it +(wasn't able to finish my project in time). I hope to +graduate by the end of the summer of '95. + +Most of the work in building objects for a system is in the +design, not in the programming; programming should be +relatively simple once the analysis and design is taken care +of. It is my sincere hope that this meager beginning might +help folks start developing a system that would work with +the Amiga and Amiga E, with elegance and efficiency. + +Ultimately, I would like to see object equivalences to the +entire Amiga OS handled by these objects, but I cannot +possibly do this on my own without desiring to charge for +the work . + +In this way, I see this rather daunting project of +developing a system of objects for Amiga E as an excellent +opportunity for the Amiga E Encyclopedia, for as folks code +examples of the OS, that same code can be re-written as +objects applicable to this project. + +If Object Technology works as I understand it to work, this +job will never be completed.. only perfected. As such, I am +concerned that this project be handled with as much +responsibility and care as possible. Please examine +documents carefully. Please try to grok Object Technology, +its advantages, methodology issues, and other related +matters as much as possible while you contribute. + +We may not be able to resurrect the Amiga from Commodore's +flames, but we can put up a good fight . + +Those of you familiar with Smalltalk may notice some +similarities in what I'm trying to do and the GNU Smalltalk +available for unix systems. I've taken many of the ideas +and reapplied them. Because this is not actually Smalltalk, +we have several significant differences in the way we handle +things. This is normal. + +@{" Table Of Contents " Link Table_Of_Contents} + +@{" My OT History " Link 1.} +@{" OT Satori " Link 2.} +@ENDNODE + +@NODE Table_Of_Contents " Table Of Contents " +MAIN@{" jevr.doc " Link MAIN} + 1.@{" My OT History " Link 1.} + 2.@{" OT Satori " Link 2.} +@ENDNODE + +@NODE 1. "My OT History" + +I've been trying to gather an understanding of Object +Technology since 1990, when I left the US military (I am +honorably discharged, something I think of as remarkable +considering my distaste for the military). I bought the +Lattice C++ compilor for $300, only to find Lattice had but +one object with the compilor... 'stream'. I felt as if I'd +been ripped off. + +Now SAS owns Lattice, and no longer freely provides the +technical support they used to provide, something I consider +horrid as the manuals are terribly misleading, and the +compilor will GURU if coaxed none-too-carefully. + +Thus I started working with Amiga E. Amiga E is faster, +handles objects with greater facility than C++, makes +smaller code, and has the greatest bunch of folks using it +that one could ever hope for. I'll admit that Amiga E has +its shortcomings, but that I have put Amiga E on my 40 meg +harddrive and not SAS's C++ compilor should speak volumes. +My $35 for Amiga E feels better spent than the $300 on SAS's +C++. + +I'm now taking Object Technology as a course at +UNC-Asheville. I'm probably not going to do well in the +course, though, because I can't stand the volumes of +busy-work this instructor loads the students with. A +three-credit hour course does not require papers written +each week on various readings we do... and my ability to +retain information is not so weak as to necessitate this +kind of work. Unfortunately, I cannot seem to convince the +instructor to ease up, so I'll probably not do well. + +None-the-less, I am learning what I want to learn from the +course. I figured out fairly early (during my SAS C++ +miseries) that the key to making Object Technology work was +not as much in the programming as the organization, but I +hadn't quite figured out the way to approach organizing what +I wanted to do. + +So I thought I'd try leaping into the whole mess with my +first fairly significant programming project for the Amiga, +'Quip'. Some of you may have seen it haunting Aminet... it +lurks as a rather large, hulking entity, and boasts itself +as The Fortune Cookie Program from Hell. The first version +I wrote was written in C++, although I took advantage of +none of the object features in the language, having been +accustomed to procedural ways of programming. Thus, C++ was +a failure for me, in terms of learning object technology. +Amiga E suffers from the same problem, frankly. They are +both hybrid languages, incorporating both Object and +Procedural methodologies. + +I realized I wasn't really working with objects, so I +attempted to reprogram the entire thing as a set of objects. +I made the classic OT programming mistake of turning the +main() part into a separate object and thinking "Object +Oriented". I had done a little more than this, though, but +ultimately I had failed to really grasp it, and I could tell +that my work was still somehow 'weak' in terms of +programming elegance; I couldn't reuse my code very well. + +It wasn't long after this that I abandoned programming for +a long time, concentrating on my music studies. Eventually, +I picked up the GNU C++ compilor, but I had to get rid of +it, since it was taking up too much space on my tiny +harddrive. Then I stumbled into Amiga E, which proved to be +faster than any compilor I'd run across on any platform. + +I was saddened that Amiga E wasn't object oriented (this was +the old 2.?? version). I still had demands set up for +myself for Quip, so I reprogrammed the entire thing from +scratch (this was at least the second or third time I had +done so), but I had to use procedural ways of doing things +to avoid global variables. I STILL hadn't really grasped OT +that well. Considering some of the comments I had made to +Wouter, and that Wouter had had a chance to examine some of +my code before I finished it (in the process of hunting down +errors I perceived in his compilors.. I think the errors +were mostly mine, as usual.. Wouter is the most patient +programmer I have ever stumbled across) I sometimes think I +must have looked like a total dolt as far as Object +Technology is concerned. + +I could tell I hadn't quite figured SOMETHING out, but I +didn't really quite grasp it until I picked up 'IBM +Smalltalk; The Language' for my Object Technology course. I +started reading some of it before the course started, and +suddenly figured out what my basic problem was, and how to +go about creating good objects. + +When the course started, everything fell right into place. +I had alread grasped the single most difficult concept this +way of programming threw to me, and I was hungry for more +information. + +One might say that this attempt to create a system of +objects for Amiga E and the Amiga is the culmination of +literally years of searching for The Way to program in this +kind of methodology. + +@ENDNODE + +@NODE 2. "OT Satori" + +The trick to working with OT is in the design (as I +mentioned before). Before writing the first character of +code, one must analyse and design what one is attempting to +do, and with what one must do it. + +This is the biggest difference: 'with what one must do it'. + +In the past, I had been trying to figure out 'how one must +do it' rather than 'with what one must do it.' The +difference is staggering. In fact, one begins to find a +greater ease in programming in an OT fashion than in the +older procedural way... the hard part becomes the analysis +and design. + +You find yourself building little objects, and ways for the +little objects to communicate to each other so they might, +in a tiny little community that makes up your program, get a +specific set of tasks done. Together, they form a kind of +community (or 'system' as the parlance goes). The focus is +on the data you're trying to play with, and not on the +actual "playing with the data". + +I've already uploaded a couple of examples of the Object +Technology approach, by way of showing its benefits (and, +hopefully, how to think about the matter elegantly). The +best example prior to this starting project that I uploaded +was my most recent set of Quip objects (which are still not +even close to being done , since I've been working on +this project and a zillion other things). I urge you to +examine that code (and this code) to get an idea of what I'm +up to. + +@ENDNODE + diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/guides/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/guides/Examples new file mode 100644 index 0000000..671bfc7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/guides/Examples @@ -0,0 +1,104 @@ +@database "OOEP Examples" + +@node main "OOEP demo sources" + +This database contains links to the example sources of the OOEP. Each +paragraph contains an introduction to the object and links to related +files (e.g. autodocs). + +Note that the entries with asterisks before them aren't included in this release. + + @{" General " link usingTheHierarchy/main} General hints + +* @{" Coordinate " link Coordinate} + + +Database related modules. Experimental. + +* @{" database " link database} +* @{" database/datafile " link database/datafile} +* @{" database/dbcreator " link database/dbcreator} +* @{" database/field " link database/field} +* @{" database/record " link database/record} + + +File related modules. Includes basic text and binary modules as well as +hypertext files. + +* @{" file " link file} +* @{" file/textfile " link file/textfile} +* @{" file/textfile/document " link file/textfile/document} +* @{" file/textfile/document/hypertextDocument " link file/textfile/document/hypertextDocument} +* @{" file/textfile/document/hypertextDocument/amigaguideDocument " link file/textfile/document/hypertextDocument/amigaguideDocument} +* @{" file/textfile/programsource " link file/textfile/programsource} +* @{" file/textfile/programsource/esource " link file/textfile/programsource/esource} + +* @{" font " link font} + + +Modules for use with graphical user interface. + +* @{" GUI " link //GUI/examples/main} +* @{" GUI/requester " link //GUI/requester/Examples/main} +* @{" GUI/requester/standard " link //GUI/requester/standard/Examples/main} + + +Library derived stuff. Involves basic library objects and modules that are +based on those libraries. catalogList for example makes it possible to use +many catalogs in your application. + + @{" library " link //library/examples/main} +* @{" library/asl " link library/asl} +* @{" library/device " link library/device} +* @{" library/device/audio " link library/device/audio} +* @{" library/device/printer " link library/device/printer} +* @{" library/device/trackdisk " link library/device/trackdisk} + @{" library/exec " link //library/exec/Examples/main} + @{" library/exec/port " link //library/exec/port/Examples/main} +* @{" library/exec/port/arexxPort " link library/exec/port/arexxPort} +* @{" library/exec/port/portList " link library/exec/port/portList} + @{" library/locale " link //library/locale/examples/main} + @{" library/locale/catalogList " link //library/locale/catalogList/Examples/main} +* @{" library/reqtools " link library/reqtools} + + +All kinds of lists. Simple lists, doubly linked lists, lists that are +queues, stacks or both. + + @{" list " link //list/Examples/main} + @{" list/associativeArray " link //list/associativeArray/Examples/main} +* @{" list/doublylinked " link //list/doublylinked/Examples/main} +* @{" list/doublylinked/stringlist " link //list/doublylinked/stringlist/Examples/main} + @{" list/elist " link //list/elist/examples/main} +* @{" list/execlist " link //list/execlist/examples/main} + + +Logic objects. + +* @{" logic " link logic} + + +Resources tracking modules for the ooep. Experimental. + +* @{" resource " link resource} +* @{" resource/master " link resource/master} + + +Objects that can be sorted - strings, numbers and so on. + +* @{" sort " link //sort/Examples/main} +* @{" sort/numbers " link //sort/numbers/Examples/main} +* @{" sort/numbers/fraction " link sort/numbers/fraction} +* @{" sort/numbers/fraction/coordinate " link sort/numbers/fraction/coordinate} + @{" sort/string " link //sort/string/Examples/main} + + +Stream objects. + +* @{" stream " link stream} + +Misc + +* @{" byteArray " link //byteArray/Examples/main} + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/guides/OOEproject b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/guides/OOEproject new file mode 100644 index 0000000..fd54894 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/guides/OOEproject @@ -0,0 +1,351 @@ +@DATABASE "OOEproject" +@MASTER "ram:OOEproject.doc" + +@NODE MAIN "OOEproject.doc" + + @{b}ooep@{ub} + +@{"0. Preface" LINK "0.Preface"} +@{"1. Why" LINK "1.Why"} +@{"2. Caveats" LINK "2.Caveats"} +@{"3. Submissions" LINK "3.Submissions"} +@{"4. Implementation" LINK "4.Implementation"} +@{"5. The Plan" LINK "5.The Plan"} +@{"6. Notes from the Authors" LINK "6.Notes from the Authors"} +@{"7. Addresses" LINK "7.Addresses"} +@{"8. Next Steps" LINK "8.Next Steps"} + +@ENDNODE +@NODE "0.Preface" "ooep/0. Preface" + + + This document explains the goals and current accomplishments + of the Object Oriented E Project, much of which was started + by Joseph E. Van Riper III, but loosely maintained by the + Amiga E Encyclopedia folks in general. + + Those of you who don't like to read any big docs can just + browse through the hierarchie via the @{" Examples " link EMODULES:oomodules/oodoc/guides/Examples/main} document. + +@ENDNODE +@NODE "1.Why" "ooep/1. Why" + + + OOEP was started because, as of this writing, the Amiga E + programming language, while very powerful, lacks a very + comfortable, easily extensible object library to take + advantage of its Object Technology features. So, while you + may program objects, you aren't getting the full benefits of + Object Technology. + + So, you have the option of creating your own extensible set + of objects and whatnot on your own, which will take you a + certain measure of time, or you can use ours. Since the + source code is included, you can fix any bugs you might + stumble upon, or optimize anything that doesn't work quickly + enough for you, or otherwise improve the system in some way. + Or, if you want, you may contribute new objects to extend + the system. All of these should be sent to the AEE (Amiga E + Encyclopedia) folks for approval and submission to the + greater Amiga E audience. + + With this set of objects, Amiga E can become a more friendly + environment to work with. + +@ENDNODE +@NODE "2.Caveats" "ooep/2. Caveats" + + + In building reusable code, and building it to be as + extensible as this hopes to be, one often finds him/herself + having to make various tradeoffs. This almost always takes + the form of speed vs. memory, although in the case of reuse, + sometimes it's speed/memory vs. reuse. + + A case in point might be some of the stuff that will be done + in the 'Numbers' objects. Both memory and speed will be + used due to the coersion schemes to convert sets of numbers + to other sets of numbers. + + Sometimes, you'll find the more classical Amiga E approaches + to be stronger than anything developed here. If you need + speed and efficiency or better use of memory, and these + modules don't exactly offer it for you, you may have to + build your objects a little more by scratch (say, perhaps, + using Amiga E's float numbers rather than our object + 'Float'). + + The goals of this project is reuse and extensibility. We + attempt to make our objects as efficient and + memory-conserving as possible, but our primary goal is + reuse. + + If there are any glaring problems (say, an object simply + doesn't work properly), we ask you either fix the problem + yourself and send the AEE team your fix (which will make you + part of the AEE team ) or make the AEE team aware of + the problem (many of them are also on the Amiga E mailing + list). + + You'll note the comments in the code are somewhat lacking. + We apologize for this.. in the interest of getting this + coded quickly, we dropped internal documentation. However, + this document is intended to explain the attributes and + methods of each object in the library, so you may find + your answers here. + +@ENDNODE +@NODE "3.Submissions" "ooep/3. Submissions" + + + You can submit extensions/corrections to this library + through the AEE mailing list or the Amiga E mailing list, or + perhaps by ftp to Aminet dev/e. Please include an e-mailing + address that we can contact you by, in case we have some + problems of some kind with your submission. + + You may as well send your contribution to one of us via snail + mail but eMail is strongly preferred. Getting in touch is so + much easier. + + If you want to contribute anything please make sure that it's + documented. It's very hard to find out how something's working + just by browsing through the source code. As you can see the + preferred way is to write autodocs in the modules and to turn + the autodocs extracted from them into Amigaguide databases. + + Read the @{"Addresses" LINK "7.Adresses"} chapter to know where + to send what. + +@ENDNODE +@NODE "4.Implementation" "ooep/4. Implementation" + + + You'll note that this library comes with its own + subdirectory 'oomodules'. This subdirectory is an idea of + Gregor, who started putting his devices objects in it. From + this directory, you can find the hierarchy of objects that + make up this project. You should put 'oomodules' in your + emodules: set of directories if you want to use them.. or + recompile all the codes with your own idea of how things + should be set up. + + If you make a correction in a higher-level object, all + objects derived from the corrected object will also need to + be recompiled. This is an unfortunate result of the way + Amiga E handles some of its internal stuff with the modules. + Therefore, if you make corrections to 'object', EVERYTHING + would need to be recompiled IN ORDER according to hierarchy. + + We hope to get things right the first time . + + In the following list, we'll outline each object and its + methods. As you click deeper into the guide (or pay + attention to the numbers preceding the titles in the doc), + you'll note that the methods from preceding objects are + automatically applied to the current objects. + + And so, we start with the one object from which all other + objects are derived.... + + @{"object/main" LINK "object/main"} + +@ENDNODE +@NODE "5.The Plan" "ooep/5. The Plan" + + There is, believe it or not, a general plan to all this. + We're attempting to apply as much of the GNU Smalltalk + structure (with perhaps some additional stuff out of IBM + Smalltalk) as we can in our designs. We acknowledge that we + cannot do things the same exact way (nor would we want to), + but we are attempting to loosely follow this plan. + + So, VERY roughly, here's a road-map to some of the basic + objects, and their heirarchy, that we hope to have + implemented and designed sometime in the future. Some of + these have already been at least partially implemented, + although not many of them. + + Object + Logic + Boolean + Bitwise + Categorical + List + QueueStack + Bag + TreeAVL + Set + Dictionary + Sort + Number + Integer + Real + Fraction + Complex + Coordinate + String + DateStamp + Time + Hour + Minutes + Seconds + Date + Weekday + Day + Month + Year + Hook + Library + Device + Stream + Printer + Serial + File + Console + StdErr + Clipboard + Rexx + Keyboard + Timer + Gameport + Audio + ReqTools + IffParse + Commodities + GadTools + Graphics + Icon + Keymap + Layers + Translator + Utility + Workbench + + You can help! Point out problems with this heirarchy, build + some of these objects, make out CRC cards or use-cases to + get a better idea what we're up against... help this come to + fruition. See `Submissions' to get an idea of how to + contribute. + + BTW: CRC cards might look something like the following: + + -------------+ + CLASS Object | + =============+================================================ + Attributes: | + -------------+ + + [none] + + -------------+------------------------------------------------ + Methods: | + -------------+ + new + init + size + opts + select + error + name + end + halt + sameAs + differentFrom + update + + -------------------------------------------------------------- + + They are intended to give an idea what the object is + supposed to do, and how it's supposed to do it. They're + only a tool towards developing the system. + +@ENDNODE +@NODE "6.Notes from the Authors" "ooep/6. Notes from the Authors" + + + As of this document, only two authors have contributed to this + project. Hopefully, more folks will catch on to this, and + contribute useful objects into this system, perhaps even improving + this system for everyone's benefit. + + This section of the document is included for special notes + (perhaps pleas, perhaps other things) from the various + authors who submit work to this daunting project. If you're + adding something to this document, please add your name to + the list. + + Authors of the ooep: + + @{" Joseph E. 'Trey' van Riper III " link /authors/jevr.guide/main} - This text is more than one year old. + @{" Gregor Goldbach " link /authors/gg.guide/main} + +@ENDNODE +@NODE "7.Addresses" "ooep/7. Addresses" + + + There are a number of ways to get in touch with us. First, there + is the E mailing list. You can subscribe it via writing a mail to + listserv.bkhouse.cts.com, the subject doesn't matter. Just write + SUBSCRIBE AmigaE in the body. That's it. To get the rules of this + mailing list write FAQ AmigaE or HELP AmigaE in the body. + + You may also touch us via the Web-site of the AEE since the OOEP is + a part of it. The address is + + http://grove.mv.com/amigae/AEE/index.html + + If there are any questions or remarks about objects you can of course + direct them to the author of that particular module or anybody else + of us. So here are our email and snail mail addresses. + + + Joseph E. van Riper III + email: + mu3@vnet.net + + (snail mail unknown) + + + Gregor Goldbach + email: + Glauschwuffel@amt.comlink.de + + snail mail: + Grüner Weg 10 + 21423 Pattensen + Germany +@ENDNODE + +@NODE "8.Next Steps" "ooep/8. Next Steps" + + For the reasons I, @{" Gregor Goldbach " link /authors/gg.guide/main}, stated elsewhere, the archive + is not in the state it should be. These are the things that have to + be done next (discussion wanted): + + - Check documentation (major) + + - Test objects and provide test programs (major) + + - Include introductory texts to OO and the oomodules/hierarchy (major) + + - Work out an exception and return code scheme for all objects (major) + + - Make build file (major) + + - include other objects and object collections (dd_modules, oo + framework) + + + + - Localize objects with library/locale/catalogList (minor) + + - Tidy up sources (minor) + + + + Discussion should take place in the e mailing list. Everyone is + encouraged to contribute thoughts, opinions and ideas. Modifications + to the hierarchy are coordinated through the e mailing list. + +@ENDNODE diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/misc/todo b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/misc/todo new file mode 100644 index 0000000..4ede67d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/misc/todo @@ -0,0 +1,111 @@ +This text is just a short list of things that have to be done in the +object oriented e project. As of this writing the ooep is only at the +beginning, so a lot of things have to be done. + + +1. General + + +creation of basic objects: stream. This object is needed for files, +devices and a lot more objects. + +The stream object represents any kind of data stream. Basically there are +two streams: input and output. Input from file or keyboard is an example +for input stream, output to the screen or to files for output stream. + +The opposite of stream is a record based handling of e.g. files. + + +documentation of the modules. *I* know how to use them since I wrote +most of them. Trey may recognize what I have done but someone else may +not. Up to now I don't know what you think of the objects, please tell +me. + +As you may see when you take a look at the sources I chose the autodoc way +of documenting things. Though the autodocs are nice when you want to know +what a single function does it has one great disadvantage: it doesn't show +which procs work with each other. There have to be guides to show this. + + +implement other objects as listed in The Plan. The Plan can be found in +emodules:oomodules/oodco/OOEProject. + +Increase communication :) The list has almost no traffic at all, let's +change this. If is keeps to be so quiet I'll prepare the package to post it +to aminet. + +Notify the e mailing list. When we're working and both lists are running +we should try to involve more people. + + +2. Objects + +2.1 General + +Modify the resource tracking system to work with the Explorer. Only the +Resource Master needs some simple modifications. + + +2.2 Application object + +This object basically does what MUI does. It builds a commodity with an arexx +port and opens the application catalog(s) and libraries. An optional GUI is +created and handled. + +The commodity creation uses the commodity object (if it exists). The GUI +is a list for MUI, BGUI, EasyGUI or a pointer to a proc provided by the +programmer. This is also the case for opening/closing/handling the gui. + + +2.3 Database objects + +- Support external record headers + + Build datafile of names of files that contain record headers. The record + headers look like those in standard data files and can be parsed by the + same methods. + + +2.4 Reference object + +When the reference object is used a global instance is needed. It should be +initialized by the application object. + + + +Exceptions +---------- + +Work out and implement an exeption scheme. + +Libraries: Raise "LIB",text on failure +Devices: Raise "dev", "" +GUI: + guis - screens + guiw - windows + guif - fonts + guir - requesters + + +Exception handling: + +The application should display a message that tells the user what went wrong. +This can be done using requesters and/or status lines. The proc that +handles the display could be implemented in the application.m or in an extra +exception.m. Exception.m could have a compiler switch to minimize the code, +e.g. simple text messages for a small shell-based program and requesters for +gui-based applications. + +After displaying the application should + +a) use a work-around to solve the problem, e.g. use a smaller font if the gui +couldn't be opened with the large font. + +b) continue its work at the position before the function was called that +caused the exception with the old status - no data should be lost. + +Gui-based apps should have an exception handler at their handle-idcmp() +proc to catch any Rethrow()'ed exceptions. It would exit nicely to the next +Wait(). That would be the case for the application object to create (see the +corresponding chapter for the application object). + diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/scripts/ADoc2AG.sh b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/scripts/ADoc2AG.sh new file mode 100644 index 0000000..6949a53 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/scripts/ADoc2AG.sh @@ -0,0 +1,42 @@ +# Turn autodoc files to amigagiude databases. +# +# Second draft July 7 1996 Gregor Goldbach +# +# Usage: makedoc source_dir destination_dir [-buildref] +# +# -buildref builds autodoc.xref, otherwise the one in +# source_dir is used + + +if $# < 2; abort; endif + +set currentdir $_cwd + +set ad2agpath "Work:Entwicklung/Werkzeuge/AD2AG/" + +set tempdir $1 +set destdir $2 +md $destdir + + +strcmp $3 "-buildref" + +if @strcmp( $3 "-buildref" ) = 0; $ad2agpath""AD2AG >NIL: FILES $tempdir TO $tempdir XREF; endif + + +$ad2agpath""AD2AG >NIL: FILES $tempdir TO $tempdir XREFFILE $tempdir/autodocs.xref + +cd $tempdir +# del *.doc <>NIL: +cp -m ~(*.doc) $destdir <>NIL: + +# cd / +# del $tempdir <>NIL: + + +cd $currentdir + +unset currentdir +unset ad2agpath +unset destdir +unset tempdir diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/scripts/getADoc.sh b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/scripts/getADoc.sh new file mode 100644 index 0000000..32c5d25 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/scripts/getADoc.sh @@ -0,0 +1,34 @@ +# Get autodoc information from E sources. +# Takes all *.e (recursively) from the current location. +# +# Second draft July 7 1996 Gregor Goldbach +# +# +# Usage: makedoc destination_directory +# + + +if $# = 0; abort; endif + +set currentdir $_cwd +set adocpath "Work:Entwicklung/Werkzeuge/Autodoc/" +set tempdir $1 + + +# note that the autodoc options are case sensitive +alias getADoc "%source%dest $adocpath\"\"Autodoc -t8 -I -C $source >$tempdir/$dest " + +md $tempdir + +# take all E sources recursively and extract autodocs. +# +# take this line to get all file names printed: +# foreach i ( .../*.e ) "strhead x \".\" $i; basename n $x; echo -n \"Get docs from \"$x; getADoc $i $n.doc; if @filelen( $tempdir/$n.doc ) = 20; del $tempdir/$n.doc; echo \" (purged)\"; else; echo \" (exists)\"; endif" + +foreach i ( .../*.e ) "strhead x \".\" $i; basename n $x; getADoc $i $n.doc; if @filelen( $tempdir/$n.doc ) = 20; del $tempdir/$n.doc; else; echo \"Get docs from \"$x; endif" + +cd $currentdir + +unset currentdir +unset adocpath +unset tempdir diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/scripts/readme b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/scripts/readme new file mode 100644 index 0000000..3e8cc4a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/scripts/readme @@ -0,0 +1,23 @@ +This directory contains two scripts for use with Csh (tested with version +5.48): + + GetADoc + Extract autodocs from all E sources in the current directory to a + destiation directory. Works recursively. + + Modify this script to your needs, you have to provide a path where + C='s autodoc program (or similar) resides. + + A recommended place to put the docs you get would be oodoc/autodocs. + The docs of the original distribution have been removed for they were + turned into amigaguide databases and can be found in oodoc/guides/. + + ADoc2AG + Converts autodoc files source directory to amigaguide databases and + puts them into a destination directory. + + Modify this script to your needs, you have to provide a path where + C='s ad2ag program (or similar) resides. + + The recommended place to put the databases you get would be + oodoc/guides. diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/templates/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/templates/Examples new file mode 100644 index 0000000..f436ab9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/templates/Examples @@ -0,0 +1,25 @@ +@database ..._example + +@node main "Introduction to ..." + + +There is an @{" autodoc " link EMODULES:oomodules/oodoc/guides/elist/main} file available or this object. + + +@endnode + + +@node initilisation "Allocation and initilisation of ..." + + +@endnode + +@node where "Where to use this object" + + +@endnode + +@node see_also "See also" + + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/templates/new_object.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/templates/new_object.e new file mode 100644 index 0000000..28fc3c5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/oodoc/templates/new_object.e @@ -0,0 +1,256 @@ +/* + +Object template. + +Replace 'new_object' with your object name and 'parent_object' with the +object name you inherit from. + +You definitely have to modify select(), init() and end(). The methods +open( and close() are just for your convenience, you may delete them if you +don't need them. + +First template version + +October 31 1996 Gregor Goldbach + +*/ + +OPT MODULE + +MODULE 'oomodules/' + +EXPORT OBJECT new_object OF parent_object +/****** library/new_object ****************************** + + NAME + new_object() of parent_object -- + + SYNOPSIS + parent_object.new_object() + + PURPOSE + Describe what the object's purpose is. + + ATTRIBUTES + List the attributes with their type and a description. If a default + value is set in init() you should write this down. + + attribute:type -- description + + SEE ALSO + parent_object + +********/ +ENDOBJECT + + + + + + +EXPORT PROC init() OF new_object +/****** new_object/init ****************************** + + NAME + init() of new_object -- Initialization of the new new_object object + instance. + + SYNOPSIS + new_object.init() + + FUNCTION + Sets attribute foobar to default value xxx. + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + Calls parental object's init() method. + + SEE ALSO + new_object + +********/ + + /* + * Call parental object's init() method if needed. + */ + + SUPER self.init() + +ENDPROC + + + + + + +PROC open() OF new_object +/****** new_object/open ****************************** + + NAME + open() of new_object -- + + SYNOPSIS + new_object.open() + + FUNCTION + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + new_object + +********/ + +ENDPROC + + + + + + +PROC close() OF new_object +/****** new_object/close ****************************** + + NAME + close() of new_object -- + + SYNOPSIS + new_object.close() + + FUNCTION + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + + SEE ALSO + new_object + +********/ + +ENDPROC + + + + + + +PROC select(optionlist, index) OF new_object +/****** new_object/close ****************************** + + NAME + select() of new_object -- Selection of action upon initialization. + + SYNOPSIS + new_object.select() + + FUNCTION + The following tags are recognized: + "tag" -- description + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + Calls parental object's select() method. + + SEE ALSO + new_object + +********/ + +DEF item + + item:=ListItem(optionlist,index) + + SELECT item + + CASE -> "open" + + INC index + self.your method(ListItem(optionlist,index)) + + DEFAULT + + /* + * Call parental object's select() method if we don't know the tag. + */ + + index := SUPER self.select(optionlist, index) + + ENDSELECT + +ENDPROC index + + + + + + +PROC end() OF new_object +/****** new_object/end ****************************** + + NAME + end() of new_object -- Global destructor for object instance. + + SYNOPSIS + new_object.end() + + FUNCTION + + RESULT + + EXAMPLE + + CREATION + + HISTORY + + NOTES + Calls parental object's end() method. + + SEE ALSO + new_object + +********/ + + /* + * Call parental object's end() method if needed. + */ + + SUPER self.end() + +ENDPROC + + + + + + +PROC name() OF new_object IS -> insert name constant here diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort.e new file mode 100644 index 0000000..04c61b8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort.e @@ -0,0 +1,358 @@ +-> sortobj.e: An abstract data manipulation class for Amiga E +-> It's written by Trey Van Riper of the Cheese Olfactory Workshop. +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/object' + +-> This is a totally abstract object to handle comparable objects. + +OBJECT sort OF object +/****** sort/--sort-- ****************************************** + + NAME + sort of object + + PURPOSE + The sort object basically handles sortable objects. Objects that + can be sorted in any way (alphanumerically, numerically, category, + etc) should be derived from Sort. All one should really have to do + to make their Sort object work is to create a method 'cmp()', per + below. + + ATTRIBUTES + None at all. + + NOTES + The following functions are comparitive functions for deciding what + is greater than, less than, or equal to what. You'll note that to + make all of these work, one only needs to define 'cmp()' in one's + own derived object... the rest of these will auto-magically work! + +****************************************************************************** + +History + + +*/ +ENDOBJECT + + +-> lt() means 'less than'. + +PROC lt(item:PTR TO sort) OF sort IS IF self.cmp(item)<0 THEN TRUE ELSE FALSE +/****** sort/lt ****************************************** + + NAME + lt() -- Test if an item is lower than itself. + + SYNOPSIS + self.lt(item:PTR TO sort) + + FUNCTION + It tests if the item provided is in some way lower than itself. + + INPUTS + item:PTR TO sort -- Item to compare to. + + RESULT + TRUE if item is lower than itself, FALSE otherwise. + + SEE ALSO + cmp() +****************************************************************************** + +History + + +*/ + +-> gt() means 'greater than'. + +PROC gt(item:PTR TO sort) OF sort IS IF self.cmp(item)>0 THEN TRUE ELSE FALSE +/****** sort/gt ****************************************** + + NAME + lt() -- Test if an item is greater than itself. + + SYNOPSIS + self.gt(item:PTR TO sort) + + FUNCTION + It tests if the item provided is in some way greater than itself. + + INPUTS + item:PTR TO sort -- Item to compare to. + + RESULT + TRUE if item is greater than itself, FALSE otherwise. + + SEE ALSO + cmp() +****************************************************************************** + +History + + +*/ + +-> et() means 'equal to'. + +PROC et(item:PTR TO sort) OF sort IS IF self.cmp(item)=0 THEN TRUE ELSE FALSE +/****** sort/et ****************************************** + + NAME + lt() -- Test if an item is equal to itself. + + SYNOPSIS + self.et(item:PTR TO sort) + + FUNCTION + It tests if the item provided is the same as itself. + + INPUTS + item:PTR TO sort -- Item to compare to. + + RESULT + TRUE if item is the same as itself, FALSE otherwise. + + SEE ALSO + cmp() +****************************************************************************** + +History + + +*/ + +-> le() means 'Less than/Equal to'. + +PROC le(item:PTR TO sort) OF sort IS IF self.lt(item) OR self.et(item) THEN TRUE ELSE FALSE +/****** sort/le ****************************************** + + NAME + le() -- Test if an item is lower than or equal to itself. + + SYNOPSIS + self.le(item:PTR TO sort) + + FUNCTION + It tests if the item provided is in some way lower than or equal + to itself. + + INPUTS + item:PTR TO sort -- Item to compare to. + + RESULT + TRUE if item is lower than or equal to itself, FALSE otherwise. + + SEE ALSO + cmp() +****************************************************************************** + +History + + +*/ + +-> ge() means 'Greater than/Equal to'. + +PROC ge(item:PTR TO sort) OF sort IS IF self.gt(item) OR self.et(item) THEN TRUE ELSE FALSE +/****** sort/ge ****************************************** + + NAME + ge() -- Test if an item is greater than or equal to itself. + + SYNOPSIS + self.ge(item:PTR TO sort) + + FUNCTION + It tests if the item provided is in some way greater than or equal + to itself. + + INPUTS + item:PTR TO sort -- Item to compare to. + + RESULT + TRUE if item is greater than or equal to itself, FALSE otherwise. + + SEE ALSO + cmp() +****************************************************************************** + +History + + +*/ + +-> ne() means 'Not Equal to'. + +PROC ne(item:PTR TO sort) OF sort IS IF self.et(item) THEN FALSE ELSE TRUE +/****** sort/ne ****************************************** + + NAME + ne() -- Test if an item is not equeal to itself. + + SYNOPSIS + self.ne(item:PTR TO sort) + + FUNCTION + It tests if the item provided is not equal to itself. + + INPUTS + item:PTR TO sort -- Item to compare to. + + RESULT + TRUE if item is not equal to itself, FALSE otherwise. + + SEE ALSO + cmp() +****************************************************************************** + +History + + +*/ + +-> cmp() means 'Compare', and will return 1, 0, or -1 depending upon whether +-> the internal item is Less than, Equal to, or Greater than the incoming item. +-> All the other comparative functions above depend upon this one, so don't +-> mess it up . + +PROC cmp(item:PTR TO sort) OF sort IS self.derivedClassResponse() +/****** sort/cmp ****************************************** + + NAME + cmp() -- Compare an item to itself. + + SYNOPSIS + self.cmp(item:PTR TO sort) + + FUNCTION + cmp() means 'Compare', and will return 1, 0, or -1 depending upon + whether the internal item is Less than, Equal to, or Greater than + the incoming item. All the other comparative functions above depend + upon this one, so don't mess it up . + + INPUTS + item:PTR TO sort -- Item to compare to. + + RESULT + -1 -- item is lower than itself + 0 -- item is equal to itself + +1 -- item is greater than itself + +****************************************************************************** + +History + + +*/ + +-> set() merely sets a value. + +PROC set(in) OF sort IS self.derivedClassResponse() +/****** sort/set ****************************************** + + NAME + set() -- Set value of instance. + + SYNOPSIS + sort.set(objectSpecific) + + FUNCTION + Set the value of the instance. + + INPUTS + objectSpecific -- use it as you want. + + NOTES + Does nothing. + +****************************************************************************** + +History + + +*/ + +-> write() creates a string of an item to print. + +PROC write() OF sort IS self.derivedClassResponse() +/****** sort/write ****************************************** + + NAME + write() -- Create printable string from object. + + SYNOPSIS + sort.write() + + FUNCTION + Creates a string of an item to print. + + NOTES + Does nothing. + +****************************************************************************** + +History + + +*/ + +-> get() returns the item itself (if appropriate). + +PROC get() OF sort IS self.derivedClassResponse() +/****** sort/get ****************************************** + + NAME + get() -- Get instance value. + + SYNOPSIS + sort.get() + + FUNCTION + Gets the instance's value. + + RESULT + Hopefully the value. + + NOTES + Does nothing for now. + + SEE ALSO + set() +****************************************************************************** + +History + + +*/ + +-> name() returns a unique name for the type of object. + +PROC name() OF sort IS 'Sort' +/****** sort/name ****************************************** + + NAME + name() -- Get name of object. + + SYNOPSIS + sort.name() + + FUNCTION + Gets the name of the object. + + RESULT + Pointer to string containing the name. + +****************************************************************************** + +History + + +*/ +/*EE folds +1 +10 29 +EE folds*/ diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/Examples new file mode 100644 index 0000000..d515222 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/Examples @@ -0,0 +1,12 @@ +@database sort_example + +@node main "Introduction to sort" + +The sort object basically handles sortable objects. Objects that can be +sorted in any way (alphanumerically, numerically, category etc) should be +derived from Sort. All one should really have to do to make their Sort object +work is to create a method 'cmp()' (see autodoc). + +There is an @{" autodoc " link EMODULES:oomodules/oodoc/guides/sort/main} file available or this object. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/address.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/address.e new file mode 100644 index 0000000..7fd1709 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/address.e @@ -0,0 +1,157 @@ +OPT MODULE +OPT EXPORT +-> address.e by Trey Van Riper of the Cheese Olfactory Workshop + +MODULE 'oomodules/sort/string','oomodules/sort' + +-> address.e is a derived object from 'sortobj', but we'll sort to lname. + +OBJECT address OF sort + lname:PTR TO string + fname:PTR TO string + street:PTR TO string + city:PTR TO string + phone:PTR TO string +ENDOBJECT + +PROC size() OF address IS 48 + +PROC name() OF address IS 'Address' + +-> We have much to initialize here. + +PROC init() OF address + DEF tmp:PTR TO string + NEW tmp.new() + self.fname:=tmp + NEW tmp.new() + self.lname:=tmp + NEW tmp.new() + self.street:=tmp + NEW tmp.new() + self.city:=tmp + NEW tmp.new() + self.phone:=tmp +ENDPROC + +-> select() does tons-o-stuff for new() + +PROC select(opt,i) OF address + DEF item + item:=ListItem(opt,i) + SELECT item + CASE "set" + INC i + self.set(ListItem(opt,i)) + CASE "sfnm" + INC i + self.setFname(ListItem(opt,i)) + CASE "slnm" + INC i + self.setLname(ListItem(opt,i)) + CASE "scty" + INC i + self.setCity(ListItem(opt,i)) + CASE "sstr" + INC i + self.setStreet(ListItem(opt,i)) + CASE "sphn" + INC i + self.setPhone(ListItem(opt,i)) + ENDSELECT +ENDPROC i + +-> Sets the first name. + +PROC setFname(in) OF address + self.fname.set(in) +ENDPROC + +-> These two functions set the last name. + +PROC set(in) OF address + self.setLname(in) +ENDPROC + +PROC setLname(in) OF address + self.lname.set(in) +ENDPROC + +-> Sets the Street address. + +PROC setStreet(in) OF address + self.street.set(in) +ENDPROC + +-> Sets the City/State + +PROC setCity(in) OF address + self.city.set(in) +ENDPROC + +-> Sets the phone #. + +PROC setPhone(in) OF address + self.phone.set(in) +ENDPROC + +-> Most addresses are sorted to the last name (at least +-> where I'm from), so the sorting is doing according to the +-> last name. + +PROC cmp(item:PTR TO address) OF address IS self.lname.cmp(item.lname) + +-> This helps determine how much 'write' will require. + +PROC length() OF address + DEF out + out := self.lname.length() + self.street.length() + self.city.length() + + self.phone.length() + self.fname.length() + 40 +ENDPROC out + +-> write() comes up with a text suitable to printing out an +-> address. Could be neater, but hey, it's only an example. +-> This, of course, gives a String output. + +PROC write() OF address + DEF out:PTR TO string + NEW out.new() + out.cat('Name: "') + out.catString(self.lname) + out.cat(', ') + out.catString(self.fname) + out.cat('"\nStreet: ') + out.catString(self.street) + out.cat('\nCity: ') + out.catString(self.city) + out.cat('\nPhone: ') + out.catString(self.phone) + out.cat('\n') + /* + StringF(out,'Name: "\s, \s"\nStreet: \s\nCity: \s\nPhone: \s\n',self.lname.write(), + self.fname.write(), + self.street.write(), + self.city.write(), + self.phone.write()) + */ +ENDPROC out + +-> This is a unique id # for address: "addr" + +PROC id() OF address IS "addr" + +-> Tons-o-stuff to deallocate. + +PROC end() OF address + DEF tmp:PTR TO string + tmp:=self.street + END tmp + tmp:=self.city + END tmp + tmp:=self.phone + END tmp + tmp:=self.lname + END tmp + tmp:=self.fname + END tmp +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers.e new file mode 100644 index 0000000..f30115e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers.e @@ -0,0 +1,31 @@ +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/sort' + +OBJECT number OF sort +ENDOBJECT + +PROC name() OF number IS 'Number' + +PROC add(in:PTR TO number) OF number IS self.derivedClassResponse() + +PROC subtract(in:PTR TO number) OF number IS self.derivedClassResponse() + +PROC multiply(in:PTR TO number) OF number IS self.derivedClassResponse() + +PROC power(in:PTR TO number) OF number IS self.derivedClassResponse() + +PROC max(in:PTR TO number) OF number IS self.derivedClassResponse() + +PROC abs() OF number IS self.derivedClassResponse() + +PROC neg() OF number IS self.derivedClassResponse() + +PROC min(in:PTR TO number) OF number IS self.derivedClassResponse() + +PROC sign() OF number IS self.derivedClassResponse() + +PROC bounds(min:PTR TO number,max:PTR TO number) OF number IS self.derivedClassResponse() + +PROC rnd(min=0:PTR TO number,max=0:PTR TO number) OF number IS self.derivedClassResponse() diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/Examples new file mode 100644 index 0000000..0836eb6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/Examples @@ -0,0 +1,7 @@ +@database numbers_example + +@node main "Introduction to numbers" + +This object does nothing and is just a skeleton for derived objects. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/float.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/float.e new file mode 100644 index 0000000..87d75b3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/float.e @@ -0,0 +1,103 @@ +/* + +First draft of a Float object. It's very rudimentary, just to get the +Coordinate going... + +Gregor Goldbach +*/ + +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/sort/numbers' + +OBJECT float OF number + value +ENDOBJECT + +PROC name() OF float IS 'Float' + +PROC set(value) OF float + self.value := value +ENDPROC + +PROC get() OF float IS self.value + +PROC cmp(what:PTR TO float) OF float + IF self.value < what.value THEN RETURN -1 + RETURN IF self.value > what.value THEN 1 ELSE 0 +ENDPROC + +PROC write() OF float +DEF out + + out := String(42) + IF out + RealF(out,self.value,8) + RETURN out + ELSE + RETURN NIL + ENDIF + +ENDPROC + +PROC add(in:PTR TO float) OF float +DEF value + + value := !self.get() + in.get() + self.set( value) +ENDPROC + +PROC substract(in:PTR TO float) OF float + self.set( !self.get() - in.get() ) +ENDPROC + +PROC multiply(in:PTR TO float) OF float + self.set( !self.get() * in.get() ) +ENDPROC + +PROC divide(in:PTR TO float) OF float + self.set( !self.get() / in.get() ) +ENDPROC + + + +->PROC power(in:PTR TO float) OF float IS EMPTY + +->PROC max(in:PTR TO float) OF float IS EMPTY + +PROC abs() OF float +DEF value + IF !self.value < 0 + value := self.get() + RETURN ! value * (-1) + ELSE + RETURN self.get() + ENDIF +ENDPROC + +PROC neg() OF float + self.set( !0-self.get()) +ENDPROC + +->PROC min(in:PTR TO float) OF float IS EMPTY + +->PROC sign() OF float IS EMPTY + +->PROC bounds(min:PTR TO float,max:PTR TO float) OF float IS EMPTY + +->PROC rnd(min=0:PTR TO float,max=0:PTR TO float) IS EMPTY + +PROC copy(to:PTR TO float) OF float + to.set( self.get() ) +ENDPROC + +PROC flt2int() OF float +DEF value:PTR TO float,dummy1,dummy2 + + NEW value.new() + + value.set( self.get() + 0.5) + value.set(Ffloor(value.get())) + RETURN !value.get()! +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/floattest.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/floattest.e new file mode 100644 index 0000000..331df1d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/floattest.e @@ -0,0 +1,30 @@ +MODULE 'oomodules/sort/numbers/float' + +PROC main() +DEF flt:PTR TO float, + fl2:PTR TO float + + NEW flt.new() + NEW fl2.new() + + flt.set(3.5) + fl2.set(2.0) + + WriteF('a=\s\n', flt.write()) + + flt.add(fl2) + + WriteF('+b=\s\n', flt.write()) + + flt.substract(fl2) + + WriteF('-b=\s\n', flt.write()) + + flt.neg() + + WriteF('-a=\s\n', flt.write()) + + flt.divide(fl2) + + WriteF('a/-b=\s\n', flt.write()) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/fractest.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/fractest.e new file mode 100644 index 0000000..ab61f6f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/fractest.e @@ -0,0 +1,72 @@ +MODULE 'oomodules/sort/numbers/fraction' + +PROC main() +DEF bruch_1:PTR TO fraction, + bruch_2:PTR TO fraction, zkette[80]:STRING + + NEW bruch_1.new(["set",2,3]) + NEW bruch_2.new(["copy",bruch_1]) + + WriteF('\s\n', bruch_1.write()) + WriteF('+\n\s\n', bruch_2.write()) + + bruch_1.add( bruch_2 ) + + WriteF('=\n\s\n', bruch_1.write()) + + bruch_1.substract( bruch_2 ) + + WriteF('-\n\s\n', bruch_2.write()) + + WriteF('=\n\s\n', bruch_1.write()) + + + + WriteF('now multiply...\n\n') + + bruch_1.opts(["set",2,3]) + + WriteF('\s\n', bruch_1.write()) + + bruch_2.opts(["set",2,4]) + + WriteF('*\n\s\n', bruch_2.write()) + + bruch_1.multiply( bruch_2 ) + + WriteF('=\n\s\n', bruch_1.write()) + + + + WriteF('now divide...\n\n') + + bruch_1.opts(["set",2,3]) + + WriteF('\s\n', bruch_1.write()) + + bruch_2.opts(["set",2,5]) + + WriteF('/\n\s\n', bruch_2.write()) + + bruch_1.divide( bruch_2 ) + + WriteF('=\n\s\n', bruch_1.write()) + + -> now just copy + + bruch_1.opts(["set", 3,7]) + bruch_1.copy( bruch_2 ) + + WriteF('\s\n', bruch_1.write()) + WriteF('\s\n', bruch_2.write()) + + bruch_1.flt2fraction(2.25) + WriteF('\s\n', bruch_1.write()) + bruch_1.flt2fraction(7.9675) + WriteF('\s\n', bruch_1.write()) + bruch_1.flt2fraction(3.1415926) + WriteF('\s\n', bruch_1.write()) + + RealF(zkette,bruch_1.fraction2flt(),5) + WriteF('\s\n', zkette) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/fraction.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/fraction.e new file mode 100644 index 0000000..4c086b0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/fraction.e @@ -0,0 +1,242 @@ +/* + +Things which are marked with 'CHANGE' should be changed + + +NOTE: this object is basically based on integer, so why not inherit from it? + In other words, it inherits technically, but not logically. So don't + let it inherit from integer but from number? + + - make it possible for add(), multiply() etc. to take 'Integer' as + argument, too? +*/ + +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/sort/numbers', 'oomodules/sort/numbers/integer' + + +OBJECT fraction OF number + upper:PTR TO integer + lower:PTR TO integer +ENDOBJECT + +PROC name() OF fraction IS 'Fraction' + +PROC init() OF fraction +DEF up:PTR TO integer,lo:PTR TO integer + + NEW up.new() + self.upper:=up + NEW lo.new() + self.lower:=lo +ENDPROC + +PROC getUpper() OF fraction IS self.upper.get() +PROC getLower() OF fraction IS self.lower.get() + +PROC setUpper(value) OF fraction IS self.upper.set(value) +PROC setLower(value) OF fraction IS self.lower.set(value) + +/* + * negate the fraction just by nagating the Upper + */ +PROC negate() OF fraction + self.upper.negate() +ENDPROC + +PROC add(what:PTR TO fraction) OF fraction +DEF resultingUpper:PTR TO integer, + resultingLower:PTR TO integer, + result_a,result_b + + NEW resultingUpper.new() + NEW resultingLower.new() + + IF self.lower.cmp(what.lower)=0 -> nenner sind gleich + self.setUpper(self.getUpper() + what.getUpper()) -> CHANGE when integer.add() exists + ELSE -> nenner sind unterschiedlich + resultingUpper.set( (self.getUpper() * what.getLower()) + (self.getLower() * what.getUpper())) -> zähler1 * nenner2 + nenner1 * zähler2 + resultingLower.set( self.getLower() * what.getLower()) -> nenner1 * nenner2 + + /* kürzen fehlt noch */ + + self.upper.set( resultingUpper.get() ) + self.lower.set( resultingLower.get() ) + + ENDIF + + END resultingUpper + END resultingLower + +ENDPROC + +PROC substract(what:PTR TO fraction) OF fraction +/* + +pure lazyness: + +just negate the argument, then add it... +*/ + what.negate() + self.add(what) + what.negate() +ENDPROC + +PROC multiply(what:PTR TO fraction) OF fraction +DEF resultingUpper:PTR TO integer, + resultingLower:PTR TO integer + + NEW resultingUpper.new() + NEW resultingLower.new() + + resultingUpper.set( self.getUpper() * what.getUpper() ) /* CHANGE integer.mul */ + resultingLower.set( self.getLower() * what.getLower() ) /* dto. */ + + /* kürzen fehlt */ + + self.upper.set( resultingUpper.get() ) + self.lower.set( resultingLower.get() ) + + END resultingUpper + END resultingLower + +ENDPROC + +PROC divide(bywhat:PTR TO fraction) OF fraction +DEF swapper:PTR TO integer + + NEW swapper.new() -> we need something to store + + swapper.set( bywhat.getUpper() ) -> store upper + + bywhat.setUpper( bywhat.getLower() ) -> set upper + bywhat.setLower( swapper.get() ) -> set lower + + self.multiply( bywhat ) -> multiply + + -> now swap back + + bywhat.setLower( bywhat.getUpper() ) + bywhat.setUpper( swapper.get() ) + + END swapper +ENDPROC + +PROC write() OF fraction +DEF out + + out := String(30) -> think that's enough + + StringF(out, '\d/\d', self.getUpper(), self.getLower()) +ENDPROC out + +PROC end() OF fraction +DEF integer:PTR TO integer + + integer := self.upper + END integer + + integer := self.lower + END integer + +ENDPROC + +PROC select(optionlist,index) OF fraction +/* + + With select up to now two arguments are taken: + + "copy" - takes a fraction as argument and gets its values. Take it as a + simple copy. + "set" - takes two numbers and uses them as Upper, Lower +*/ +DEF item, fraction:PTR TO fraction + + item := ListItem(optionlist, index) + + SELECT item + CASE "copy" + INC index + fraction := ListItem(optionlist,index) -> typed list + + self.setUpper( fraction.getUpper() ) + self.setLower( fraction.getLower() ) + CASE "set" + INC index + item := ListItem(optionlist,index) + self.setUpper( item ) + INC index + item := ListItem(optionlist,index) + self.setLower( item ) + ENDSELECT + +ENDPROC index + +-> just copies its attributes +PROC copy(to:PTR TO fraction) OF fraction + to.setUpper( self.getUpper() ) + to.setLower( self.getLower() ) +ENDPROC + +PROC flt2fraction(flt) OF fraction +/* + +This method sets its objects attributes to the values found in +the float. + +*/ +DEF index,lower=-1, gefunden=0, fltindex, + result, out[80]:STRING, + fltupper,upper, fltlower + + FOR index := 1 TO 1000 + fltindex := index! -> richtig + result := !flt * fltindex ->richtig + + ->RealF(out,result,5); WriteF('::\s\n',out) + + result := !Fceil(result)-result + + result := result < 0.0001 + + IF result THEN gefunden := 1 + IF gefunden=1 + lower:= index + index:=1000 + ENDIF + ENDFOR + + IF lower=-1 THEN lower:=1000 +-> the lower is found + + fltlower := lower! + fltupper := !flt * fltlower + upper := !fltupper! + + self.setUpper(upper) + IF upper=0 + self.setLower(1) + ELSE + self.setLower(lower) + ENDIF +ENDPROC + +PROC fraction2flt() OF fraction -> move to Float +DEF flt,upper,lower,kleiner=0 + + IF (upper := self.getUpper())<0 + upper:=upper*(-1) + INC kleiner + ENDIF + IF (lower := self.getLower())<0 + lower:=lower*(-1) + INC kleiner + ENDIF + + flt := ! upper / lower + + IF kleiner=1 THEN flt := ! 0 - flt + +ENDPROC flt diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/integer.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/integer.e new file mode 100644 index 0000000..f5d686e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/integer.e @@ -0,0 +1,80 @@ +-> integer.e is a very SIMPLE object for handling integers. +-> It's writen by Trey Van Riper of the Cheese Olfactory Workshop +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/sort/numbers' + +-> NOTE: In the future, 'integer' will be derived from 'number'. +-> In the meantime, though, I'll just leave it like this. + +OBJECT integer OF number + number +ENDOBJECT + +-> size() returns how much memory you can expect to use. + +PROC size() OF integer IS 8 + +-> name() returns the name of this kind of object. + +PROC name() OF integer IS 'Integer' + +-> The all-important 'cmp()' method! + +PROC cmp(item:PTR TO integer) OF integer + IF self.number < item.number THEN RETURN -1 + RETURN IF self.number > item.number THEN 1 ELSE 0 +ENDPROC + +-> select() doesn't do much.. lets you set a value from new(). + +PROC select(opt,i) OF integer + DEF item + item:=ListItem(opt,i) + SELECT item + CASE "set" + INC i + self.set(ListItem(opt,i)) + ENDSELECT +ENDPROC i + +-> write(), to create a string out of the integer. + +PROC write() OF integer + DEF out + out:=String(14) + StringF(out,'\d',self.number) +ENDPROC out + +-> get()ing the integer itself. + +PROC get() OF integer IS self.number + +-> set()ing the integer in some way. + +PROC set(in) OF integer + self.number:=in +ENDPROC + +PROC add(in) OF integer + self.number := self.number + in +ENDPROC + +PROC subtract(in) OF integer + self.number := self.number - in +ENDPROC + +PROC divide(in) OF integer + self.number := self.number / in +ENDPROC + +PROC multiply(in) OF integer + self.number := self.number * in +ENDPROC + +-> addition by GG: negate it +PROC negate() OF integer + self.number := 0 - self.number +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/twoNumbers.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/twoNumbers.e new file mode 100644 index 0000000..95bc404 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/numbers/twoNumbers.e @@ -0,0 +1,26 @@ +/* + +twoNumbers + +Take two objects that consist of numbers, e.g. Complex and Fraction. +Those exist of two numbers, only the methods are a bit different, so why +don't make a class of it and derive those two from it? Well, here you are. + +Objects to derive from this: + +Fraction +Complex +Line? + +*/ + +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/sort/numbers' + +OBJECT twoNumbers OF number +PRIVATE + value1:PTR TO number + value2:PTR TO number +ENDOBJECT diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string.e new file mode 100644 index 0000000..b58ea4b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string.e @@ -0,0 +1,853 @@ +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/sort','oomodules/sort/numbers/integer' + +-> string.e: a derived object from 'sort' to handle +-> strings. Much more work needs to be done with this. + +OBJECT string OF sort +/****** string/--string-- ****************************************** + + NAME + string of sort + + ATTRIBUTES + item -- Pointer to the characters in this string. Is the first + element of a string chain that is modified by such functions + as cat(). Various functions work with the string chain, write() + for example reduces the size of it to one entry. + + len:PTR TO integer -- The length of this instance. + + NOTES + Through this document the following terms are used: + 'String' -- this is the object we're talking about. + string -- a chain of characters ('this is one'). It is terminated + with a 0-byte. When there is a string required you may + also provide an estring. + + SEE ALSO + sort/--sort-- +****************************************************************************** + +History + + +*/ + item + len:PTR TO integer -> I made this 'integer' in order to use the cmp in there. +ENDOBJECT + +-> size() gives an idea how much memory you can expect is used + +PROC size() OF string IS 12 +/****** string/size ****************************************** + + NAME + size() -- Get size of instance. + + SYNOPSIS + string.size() + + FUNCTION + Returns the size of the instance. + +****************************************************************************** + +History + + +*/ + +-> name() returns the name of this kind of object. + +PROC name() OF string IS 'String' +/****** string/name ****************************************** + + NAME + name() -- Get name of object. + + SYNOPSIS + string.name() + + FUNCTION + Returns the name of the object. In this case 'String'. + +****************************************************************************** + +History + + +*/ + +-> We need to have a way to initialize 'len'. + +PROC init() OF string +/****** string/init ****************************************** + + NAME + init() -- Initialize the object. + + SYNOPSIS + string.init() + + FUNCTION + Allocates the Integer object used for len. + + SEE ALSO + integer/--integer-- +****************************************************************************** + +History + + +*/ + DEF tmp:PTR TO integer + NEW tmp.new() + self.len := tmp +ENDPROC + + +PROC select(opt,i) OF string +/****** string/select ****************************************** + + NAME + select() -- Select action on initialization. + + SYNOPSIS + string.select(optionlist,index) + + FUNCTION + Recognizes the following items: + "set" -- calls self.cat() with the following item + + "sset" -- calls self.catString() with the following item + + INPUTS + optionlist -- The optionlist + + index -- The index of the optionlist + + SEE ALSO + object/select() +****************************************************************************** + +History + + +*/ + DEF item + item:=ListItem(opt,i) + SELECT item + CASE "set" + INC i + self.cat(ListItem(opt,i)) + CASE "sset" + INC i + self.catString(ListItem(opt,i)) + ENDSELECT +ENDPROC i + +-> We have to dispose of the string and the 'len' pointer. + +PROC end() OF string +/****** string/end ****************************************** + + NAME + end() -- Global destructor. + + SYNOPSIS + string.end() + + FUNCTION + Frees used resources of the instance. It frees the string and the + length Integer. + + SEE ALSO + object/end() +****************************************************************************** + +History + + +*/ + DEF tmp,str + str:=self.item + tmp:=self.len + DisposeLink(str) -> get rid of the string. + END tmp -> get rid of its length, too +ENDPROC + + +-> cmp() compares two strings quickly.. but it doesn't handle international characters. +-> Many improvements could be made to this, I'm sure, but it has the virtue of being +-> fairly quick. Perhaps locale.library support would be nice. + +PROC cmp(item:PTR TO string) OF string +/****** string/cmp ****************************************** + + NAME + cmp() -- Compare to another 'String'. + + SYNOPSIS + string.cmp(item:PTR TO string) + + FUNCTION + Compares itself to another 'String' via E's builtin OstrCmp(). + + INPUTS + item:PTR TO string -- The 'String' to compare to. + + RESULT + 'Ordered String Compare' returns 1 if string2>string1, 0 for equal + and 1 for less. + + NOTES + cmp() compares two strings quickly.. but it doesn't handle + international characters. Many improvements could be made to this, + I'm sure, but it has the virtue of being fairly quick. Perhaps + locale.library support would be nice. + + SEE ALSO + E reference/OstrCmp() +****************************************************************************** + +History + + +*/ + DEF i,inner,outer + inner:=self.write() + outer:=item.write() + RETURN OstrCmp(inner,outer) +ENDPROC + +-> set() lets you put a value into the string. + +PROC set(in) OF string +/****** string/set ****************************************** + + NAME + set() -- Set the 'String''s contents. + + SYNOPSIS + string.set(in) + + FUNCTION + Sets the contents of itself. An already present string will be freed + first. + + INPUTS + in -- Pointer to normal 0-terminated string. Could be an estring + as well. + + EXAMPLE + + PROC main() + DEF string:PTR TO string + + NEW string.new() -> allocate and initialize + string.set('build no schools, construct no roads') + string.cat(' mark them as fools, let ignorance rule') + + WriteF('\s\n', string.write()) ->get string and write it + + ENDPROC + + SEE ALSO + cat() +****************************************************************************** + +History + + +*/ + IF self.item + DisposeLink(self.item) + self.item := NIL + ENDIF + + self.len.set(0) + self.cat(in) + +ENDPROC + +-> length() returns the length of the string. + +PROC length() OF string +/****** string/length ****************************************** + + NAME + length() -- Get length of 'String'. + + SYNOPSIS + string.length() + + FUNCTION + Gets the length of itself. + + RESULT + Length of itself. + + SEE ALSO + integer/get() +****************************************************************************** + +History + + +*/ + RETURN self.len.get() +ENDPROC + + +PROC write() OF string +/****** string/write ****************************************** + + NAME + write() -- Turn 'String' into printable string. + + SYNOPSIS + string.write() + + FUNCTION + If you want to turn 'String' into a normal string (or estring) so + you can work with it as if it was a normal series of characters you + should call this function. It returns a pointer to an estring that + contains 'String''s contents. + + RESULT + Pointer to estring containing + + NOTES + Works on the internal string chain and builds one continuous string + from it. The string chain contains only one entry after the call + of this proc. + + EXAMPLE + PROC main() + DEF string:PTR TO string + + NEW string.new() -> allocate and initialize + string.set('build no schools, construct no roads') + string.cat('mark them as fools, let ignorance rule') + + WriteF('\s\n', string.write()) ->get string and write it + + ENDPROC + +****************************************************************************** + +History + + +*/ + DEF out,this,next=0 + this:=self.item + next:=Next(this) + IF next + out:=String(self.len.get()+1) + WHILE next + next:=Next(this) + StrAdd(out,this) + this:=next + ENDWHILE + DisposeLink(self.item) + self.item:=out + ELSE + out:=self.item + ENDIF +ENDPROC out + + +PROC get() OF string +/****** string/get ****************************************** + + NAME + get() -- Get 'String''s item. + + SYNOPSIS + string.get() + + FUNCTION + Gets its item. Only for internal use, if you want to print the 'String' + or work with it you have to call write(). + + RESULT + string.item + + SEE ALSO + write() +****************************************************************************** + +History + + +*/ + RETURN self.item +ENDPROC + + +PROC cat(in) OF string +/****** string/cat ****************************************** + + NAME + cat() -- Add normal string. + + SYNOPSIS + string.cat(in) + + FUNCTION + Adds a normal string to itself. This can be a 0-terminated array of + char or an estring. The string is copied and added at the end. + + INPUTS + in -- string to add. + + RESULT + Pointer to the estring copy of the string to add. + + EXAMPLE + PROC main() + DEF string:PTR TO string + + NEW string.new() -> allocate and initialize + string.set('build no schools, construct no roads ') + string.cat('mark them as fools, let ignorance rule') + + WriteF('\s\n', string.write()) ->get string and write it + + ENDPROC + + + SEE ALSO + concat(), catString(), concatString() +****************************************************************************** + +History + + +*/ + DEF tmp,count + count:=StrLen(in) + tmp := String(count+1) + StrCopy(tmp,in) + self.concat(tmp,count) +ENDPROC tmp + + +PROC concat(in,count=0) OF string +/****** string/concat ****************************************** + + NAME + concat() -- Add string to the internal string chain. + + SYNOPSIS + string.concat(in,count=0) + + FUNCTION + Adds a string to the internal string chain. The length is set to the + new length. + + INPUTS + in -- normal string to add. + + count -- the length of in. Can be left 0 normally, in that case the + length is found out by StrLen(). + + NOTES + Mainly for internal use. Mortal beings use catString(). + + SEE ALSO + cat(), concatString(), catString() +****************************************************************************** + +History + + +*/ + DEF tmp,next + IF self.item + next:=tmp:=self.item + WHILE next + IF next:=Next(tmp) THEN tmp:=next + ENDWHILE + Link(tmp,in) + ELSE + self.item:=in + ENDIF + IF count THEN self.len.add(count) ELSE self.len.add(StrLen(in)) +ENDPROC + + +PROC concatString(in:PTR TO string) OF string +/****** string/concatString ****************************************** + + NAME + concatString() -- Add 'String' to the internal string chain. + + SYNOPSIS + string.concatString(in:PTR TO string) + + FUNCTION + Adds a 'String' to the internal string chain. The length is set to the + new length. + + INPUTS + in -- 'String' to add. + + RESULT + Pointer to new string or 0 if in was NIL. + + NOTES + Mainly for internal use. Mortal beings use catString(). + + SEE ALSO + cat(), concat(), catString() +****************************************************************************** + +History + + +*/ + IF in THEN self.concat(in.item,in.length()) ELSE RETURN 0 +ENDPROC self.item + + +PROC catString(in:PTR TO string) OF string +/****** string/catString ****************************************** + + NAME + catString() -- Cat a 'String' to another. + + SYNOPSIS + catString(in:PTR TO string) + + FUNCTION + Puts a 'String' at the end of itself. + + INPUTS + in:PTR TO string -- 'String' to add. + + RESULT + item of itself. + + SEE ALSO + concatString() + +****************************************************************************** + +History + + +*/ + IF in THEN self.cat(in.write()) ELSE RETURN 0 +ENDPROC self.item + + +PROC upper() OF string +/****** string/upper ****************************************** + + NAME + upper() -- Change the case of each character to upper. + + SYNOPSIS + string.upper() + + FUNCTION + The case of each character in the 'String' is turned to upper. + + NOTES + Calls write(). + +****************************************************************************** + +History + + +*/ + self.write() + UpperStr(self.item) +ENDPROC + + +PROC lower() OF string +/****** string/lower ****************************************** + + NAME + lower() -- Change the case of each character to lower. + + SYNOPSIS + string.lower() + + FUNCTION + The case of each character in the 'String' is turned to lower. + + NOTES + Calls write(). + +****************************************************************************** + +History + + +*/ + self.write() + LowerStr(self.item) +ENDPROC + + +PROC trimmed() OF string +/****** string/trimmed ****************************************** + + NAME + trimmed() -- Trim whitespace from 'String'. + + SYNOPSIS + string.trimmed() + + FUNCTION + Trims itself, i.e. returns a string that starts with the first + non-whitespace character. + + RESULT + Pointer to 'String' which contains the trimmed contents of self. + It is a newly created 'String', you have to END() it yourself when + you don't need it anymore. + +****************************************************************************** + +History + + +*/ + DEF out,tmp,spank:PTR TO string + self.write() + out:=String(self.length()+1) + tmp:=TrimStr(self.item) + StrCopy(out,tmp) + NEW spank.new(["set",out]) + DisposeLink(out) +ENDPROC spank + + +PROC find(in:PTR TO string) OF string +/****** string/find ****************************************** + + NAME + find() -- Test if 'String' is in 'String'. + + SYNOPSIS + string.find(in:PTR TO string) + + FUNCTION + Searches a 'String' in itself. + + INPUTS + in:PTR TO string -- 'String' to search for + + RESULT + TRUE if in is in self, FALSE otherwise. + + NOTES + Calls write() on in. + +****************************************************************************** + +History + + +*/ + DEF me,he + me:=self.write() + he:=in.write() + RETURN IF InStr(me,he,0)<>-1 THEN TRUE ELSE FALSE +ENDPROC + + +PROC asInteger() OF string +/****** string/asInteger ****************************************** + + NAME + asInteger() -- Turn 'String' to Integer + + SYNOPSIS + string.asInteger() + + FUNCTION + Tries to turn itself to an Integer. + + RESULT + PTR TO integer -- The integer that was in 'String'. + + NOTES + Only call when you know that the string contains an integer. There + is actually no way to test if the proc ran successful over the + strings contents. + + Call write(). + +****************************************************************************** + +History + + +*/ + DEF valstring,value,read,out:PTR TO integer + valstring:=self.write() + value,read:=Val(valstring) + NEW out.new(["set",value]) +ENDPROC out + + +PROC right(n) OF string +/****** string/right ****************************************** + + NAME + right() -- Get right part of 'String'. + + SYNOPSIS + string.right(length) + + FUNCTION + Gets part from the right side of itself and builds a new 'String' + from it. + + INPUTS + length -- get how many characters. + + RESULT + PTR TO string -- a freshly created 'String' that contains the desired + string part. + + EXAMPLE + + PROC main() + DEF mainString:PTR TO string, + partOfString:PTR TO string + + NEW mainString.new(["set", 'down in Los Angeles']) + + partOfString := mainString.right(11) + + WriteF('\s\n', partOfString.write()) + + END partOfString + END mainString + ENDPROC + + SEE ALSO + left(), middle() +****************************************************************************** + +History + + +*/ + RETURN self.middle(self.length()-n-1,n) +ENDPROC + + +PROC middle(pos,len=ALL) OF string +/****** string/middle ****************************************** + + NAME + middle() -- Get a part of 'String'. + + SYNOPSIS + string.middle(position,length) + + FUNCTION + Gets a part from itself and builds a new 'String' from it. + + INPUTS + position -- Start at what position of itself. + + length -- get how many characters from position up to the end. + + RESULT + PTR TO string -- a freshly created 'String' that contains the desired + string part. + + EXAMPLE + + PROC main() + DEF mainString:PTR TO string, + partOfString:PTR TO string + + NEW mainString.new(["set", 'down in Los Angeles']) + + partOfString := mainString.middle(5,2) + + WriteF('\s\n', partOfString.write()) + + END partOfString + END mainString + ENDPROC + + SEE ALSO + left(), right() +****************************************************************************** + +History + + +*/ + DEF out:PTR TO string,buffer,other + IF pos>=self.length() THEN RETURN 0 + buffer:=String(IF len=ALL THEN self.length()-pos ELSE len) + other:=self.write() + MidStr(buffer,other,pos,len) + NEW out.new(["set",buffer]) + DisposeLink(buffer) +ENDPROC out + + +PROC left(n) OF string +/****** string/left ****************************************** + + NAME + left() -- Get left part of 'String'. + + SYNOPSIS + string.left(length) + + FUNCTION + Gets a part from the left side of itself and builds a new 'String' + from it. + + INPUTS + length -- get how many characters. + + RESULT + PTR TO string -- a freshly created 'String' that contains the desired + string part. + + EXAMPLE + + PROC main() + DEF mainString:PTR TO string, + partOfString:PTR TO string + + NEW mainString.new(["set", 'down in Los Angeles']) + + partOfString := mainString.left(4) + + WriteF('\s\n', partOfString.write()) + + END partOfString + END mainString + ENDPROC + + SEE ALSO + middle(), right() +****************************************************************************** + +History + + +*/ + RETURN self.middle(0,n) +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string/Examples b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string/Examples new file mode 100644 index 0000000..d2d2b7e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string/Examples @@ -0,0 +1,15 @@ +@database string_example + +@node main "Introduction to string" + +Wrapper object for strings or, in other words, estring with associated +methods. Those methods are more powerful than those provided by E itself, +however, they are based on them. + +Whenever you want to use estrings you can use this object. + + @{" Autodoc " link EMODULES:oomodules/oodoc/guides/string/main} + + @{" Example " link EMODULES:oomodules/sort/string/test.e/main} -- simple example that fiddles around with basic functions. + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string/rawstring.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string/rawstring.e new file mode 100644 index 0000000..856ef99 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string/rawstring.e @@ -0,0 +1,12 @@ +OPT MODULE +OPT EXPORT + +-> This module is for handling blocks of memory in general. +-> The quirky thing about this is that it can compare +-> 'string' objects as well as rawstring. + +MODULE 'oomodules/sort/string' + +OBJECT rawstring OF string +ENDOBJECT + diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string/test.e new file mode 100644 index 0000000..439cc51 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/string/test.e @@ -0,0 +1,19 @@ +MODULE 'oomodules/sort/string' + +PROC main() +DEF string:PTR TO string + + NEW string.new() + + string.cat('blue') + string.cat(' in the ') + string.cat('face.') + + WriteF('\s\n', string.write()) + + string.set(' hi there.\n') + WriteF('\s\n', string.write()) + + END string + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/test.e b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/test.e new file mode 100644 index 0000000..1082fdf --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/OOmodules/sort/test.e @@ -0,0 +1,47 @@ +MODULE 'oomodules/sort/string','oomodules/sort/address' + +PROC main() HANDLE + DEF mystr:PTR TO string,hisstr:PTR TO string, + myaddr:PTR TO address + NEW mystr.new(["set",'aaaaaa']) + NEW hisstr.new(["set",'aaab']) + WriteF('mystr = «\s»\n',mystr.write()) + mystr.cat('bbbbbb') + WriteF('mystr after cat = «\s»\n',mystr.write()) + + WriteF('mystr = «\s»\nhisstr = «\s»\n',mystr.write(),hisstr.write()) + WriteF('mystr has a length of \d.\nhisstr has a length of \d.\n',mystr.length(),hisstr.length()) + + WriteF('Is mystr less than hisstr?\n') + IF mystr.lt(hisstr) THEN WriteF('Yes\n') ELSE WriteF('No\n') + + WriteF('Is mystr greater than hisstr?\n') + IF mystr.gt(hisstr) THEN WriteF('Yes\n') ELSE WriteF('No\n') + + WriteF('Is mystr less than or equal to hisstr?\n') + IF mystr.le(hisstr) THEN WriteF('Yes\n') ELSE WriteF('No\n') + WriteF('And mystr is a «\s».\n',mystr.name()) + mystr.catString(hisstr) + WriteF('Concatenating the two strings yields «\s» of length \d\n', + mystr.write(),mystr.length()) + WriteF('===================================================\nTesting address:\n---\n') + NEW myaddr.new(["sfnm",'Joseph', + "slnm",'Van Riper', + "scty",'Asheville, NC', + "sstr",'19-A Dredge Ave.', + "sphn",'(704) 555-6545']) + END mystr + END hisstr + mystr := myaddr.write() + WriteF('\s---\naddress string length: \d\n',mystr.write(),mystr.length()) + hisstr := mystr.left(5) + WriteF('left(5) :«\s»\n',hisstr.write()) + END hisstr + hisstr := mystr.right(5) + WriteF('right(5) :«\s»\n',hisstr.write()) + END hisstr + hisstr := mystr.middle(5,5) + WriteF('middle(5,5):«\s»\n',hisstr.write()) +EXCEPT + WriteF('error\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/ARexxPort.e b/amigae33a/E_v3.3a/Src/Src/Pd/ARexxPort.e new file mode 100644 index 0000000..09b9f5f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/ARexxPort.e @@ -0,0 +1,367 @@ +/* FOLD info + ~~~~ */ + +/* ARexxPort.e 1.0 - by Leon Woestenberg (leon@stack.urc.tue.nl) */ +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* + + Here I present some basic functions to make your E programs + capable of communicating with other multitasking programs via + ARexx. With these functions your program can: + + · Receive and react to ARexx commands that are sent to it. + · Invoke Rexx Master to run commands that your program does not + understand. This can be an ARexx script (in REXX:) too. + · Send ARexx commands to other programs or to Rexx Master. + + This source is public domain, so use it :) + + The source is fully commented and is almost self explaining. The + only hard thing is this: When an incoming ARexx message contains + a command that is not supported by your program, this message + is NOT YET REPLIED. First, a NEW message is created that is sent + to Rexx Master. This new message contains a pointer to the first + message. Now, when the new message is replied by Rexx Master, we + can remove the first message from memory (by using the pointer). + In this way, ARexx scripts can transparantly be used with ARexx + commands. Note that the default extension for these script can + be adapted for your program in the sendRexxMsg procedure. + + ARexx adds a really nice capability to your multitasking Amiga, + as tasks can interact in realtime with each other, so that they + can use each others features. Think about how your programs can + be extended with a nice ARexx interface. + + If you have any questions, suggestions or even bugreports, reach + me via Internet email. More common questions/discussions about + this source are also welcome on the Amiga E mailing list. + + Leon Woestenberg (leon@stack.urc.tue.nl) + +*/ +/* FEND */ +/* FOLD "modules" */ + +MODULE 'exec/ports','exec/nodes' +MODULE 'rexxsyslib','rexx/rexxio','rexx/rxslib','rexx/errors','rexx/storage' +MODULE 'dos/dos' + +/* FEND */ +/* FOLD "definitions" */ + +DEF hostport=NIL:PTR TO mp +DEF runflag=TRUE +DEF unconfirmed=0 + +/* FEND */ + +/* FOLD "main" */ +PROC main() HANDLE + + /* open rexx library */ + IF (rexxsysbase:=OpenLibrary('rexxsyslib.library',0)) + + /* create a host port for arexx */ + IF (hostport:=createPort('ExampleHost',0)) + + /* examples of your program sending arexx commands to others + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + + /* + + /* tell GoldED to move cursor up one line */ + sendRexxMsg('GOLDED.1','UP',NIL,0) + + /* tell the command shell to execute the list command */ + sendRexxMsg('REXX','"ADDRESS COMMAND list"',NIL,0) + + /* run a script from REXX: (set the default extension in sendRexxMsg) */ + sendRexxMsg('REXX','scriptname',NIL,0) + + /* send a 'QUIT' command to ourselves :o) */ + sendRexxMsg('ExampleHost','QUIT',NIL,0) + + */ + + /* inform the user we are running */ + WriteF('Waiting for events to occur. Send me an ARexx QUIT command by typing:\nrx "ADDRESS \aExampleHost\a; QUIT" from a shell. Or press CTRL-C to break me.\n') + + /* wait for events */ + wait() + + deletePort(hostport) + ELSE + WriteF('Sorry dude, seems like I\am already running once.\n') + ENDIF + CloseLibrary(rexxsysbase) + ELSE + WriteF('Could not open the rexxsyslib.library. I really need it!\n') + ENDIF +EXCEPT + WriteF('Something like \d went wrong, ya see?\n') + deletePort(hostport) + hostport:=NIL + IF rexxsysbase + CloseLibrary(rexxsysbase) + rexxsysbase:=NIL + ENDIF +ENDPROC +/* FEND */ +/* FOLD "wait" */ +PROC wait() + + DEF signalmask=0 + DEF hostmask=0 + + /* signalmask for our host port */ + hostmask:=Shl(1,hostport.sigbit) + + /* still running or unconfirmed messages? */ + WHILE runflag OR unconfirmed + + /* wait for event signals */ + signalmask:=Wait(hostmask OR SIGBREAKF_CTRL_C) + + /* and handle all happened events */ + IF signalmask AND hostmask THEN handleRexxMsg() + IF signalmask AND SIGBREAKF_CTRL_C THEN runflag:=FALSE + + ENDWHILE +ENDPROC +/* FEND */ + +/* FOLD "handleRexxMsg" */ +PROC handleRexxMsg() + + /* pointer to handled message */ + DEF rexxmsg:PTR TO rexxmsg + /* pointer to messagenode */ + DEF msgnode:PTR TO mn + /* pointer to listnode of message */ + DEF listnode:PTR TO ln + + /* list of 16 pointers to command strings */ + DEF rexxargs:PTR TO LONG + + /* points to first char of trimmed command */ + DEF command:PTR TO CHAR + + /* (another) message in queue? */ + WHILE rexxmsg:=GetMsg(hostport) + + /* set pointer to messagenode */ + msgnode:=rexxmsg.mn + + /* set pointer to listnode */ + listnode:=msgnode.ln + + /* set pointer to commands */ + rexxargs:=rexxmsg.args + + /* confirmation reply of a message sent by us? */ + IF listnode.type=NT_REPLYMSG + + /* original message pointer present? */ + IF rexxargs[15] + /* reply original message */ + ReplyMsg(rexxargs[15]) + ENDIF + + /* delete this confirmation message */ + DeleteArgstring(rexxargs[0]) + DeleteRexxMsg(rexxmsg) + + /* decrease unconfirmed count */ + DEC unconfirmed + + /* a brand new message */ + ELSE + + /* point to command after skipping spaces etc. */ + command:=TrimStr(rexxargs[0]) + WriteF('We received an ARexx command: \s\n',command) + + /* initialize the resultcodes */ + rexxmsg.result1:=0 + rexxmsg.result2:=NIL + + /* example of handling a command that someone sent to us + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + + /* command known? */ + IF StrCmp('QUIT',command,ALL) + WriteF('So let\as quit here.\n') + runflag:=FALSE + ReplyMsg(rexxmsg) + + /* command unknown */ + ELSE + WriteF('Hmmm. Unknown command. Let\as send it to Rexx Master...\n') + + /* forward this command to rexx master (maybe it's a script?) */ + /* the original unknown command message is not yet replied to */ + /* until we receive a confirmation from rexx master. */ + + /* therefore we remember this message by storing a messagepointer */ + /* in rexxargs[15] of the forwarded command to Rexx Master */ + + /* message can not be sent to rexx? */ + IF sendRexxMsg('REXX',rexxargs[0],rexxmsg,0)=NIL + + /* set fatal error returncodes */ + xReplyRexxCmd(rexxmsg,RC_FATAL,NIL) + + /* reply the message */ + ReplyMsg(rexxmsg) + + ENDIF + ENDIF + ENDIF + ENDWHILE +ENDPROC +/* FEND */ +/* FOLD "sendRexxMsg(hostname,command,unknownmsg,flags)" */ +PROC sendRexxMsg(hostname,command,unknownmsg,flags) + + DEF arexxport=NIL:PTR TO mp + DEF rexxmsg=NIL:PTR TO rexxmsg + DEF rexxargs:PTR TO LONG + DEF listnode=NIL:PTR TO ln + DEF temp=NIL + + /* return if hostport is not present */ + IF hostport=NIL THEN RETURN NIL + + listnode:=hostport.ln + + /* return if we can't make a rexxmessage */ + IF (rexxmsg:=CreateRexxMsg(hostport,'rexx',listnode.name))=NIL THEN RETURN NIL + + /* pointer to commands */ + rexxargs:=rexxmsg.args + + /* can we create an argstring? */ + IF temp:=CreateArgstring(command,StrLen(command)) + + /* set the first argstring */ + rexxargs[0]:=temp + + /* set the flags */ + rexxmsg.action:=RXCOMM OR flags + + /* store original message pointer into 16th argstring pointer */ + rexxargs[15]:=unknownmsg + + /* forbid multitasking */ + Forbid() + + /* send our message to an existing port for sure */ + IF (arexxport:=FindPort(hostname)) THEN PutMsg(arexxport,rexxmsg) + + /* permit multitasking */ + Permit() + + /* sended? */ + IF arexxport + + /* increase the unconfirmed counter */ + INC unconfirmed + + /* successfully sent this message */ + RETURN rexxmsg + ENDIF + ENDIF + + IF temp + DeleteArgstring(temp) + ENDIF + IF rexxmsg + DeleteRexxMsg(rexxmsg) + ENDIF + RETURN NIL +ENDPROC +/* FEND */ +/* FOLD "replyRexxMsg(rexxmsg,rc,returnstring)" */ +PROC xReplyRexxCmd(rexxmsg:PTR TO rexxmsg,rc,returnstring) + + /* set the returncode */ + rexxmsg.result1:=rc + + /* and a pointer to the result string */ + rexxmsg.result2:=IF (rexxmsg.action AND RXFF_RESULT) AND (returnstring<>NIL) THEN CreateArgstring(returnstring,StrLen(returnstring)) ELSE NIL + +ENDPROC +/* FEND */ +/* FOLD "createPort(portname,priority)" */ +PROC createPort(portname,priority) + + DEF port=NIL:PTR TO mp + DEF node=NIL:PTR TO ln + + /* make port public? */ + IF portname + + /* no-one make the same port please */ + Forbid() + + /* is our (soon to be) port unique? */ + IF FindPort(portname)=0 + + /* could we make a port? */ + IF port:=CreateMsgPort() + + node:=port.ln + + /* fill in the name */ + node.name:=portname + + /* public port priority */ + node.pri:=priority + + /* and make this port public */ + AddPort(port) + ENDIF + ENDIF + + /* multitask */ + Permit() + + /* just make private port */ + ELSE + + /* try to make a port */ + port:=CreateMsgPort() + + ENDIF +/* return pointer to port, or NIL if the port could not be made (unique) */ +ENDPROC port +/* FEND */ +/* FOLD "deletePort(port)" */ +PROC deletePort(port:PTR TO mp) + + DEF node=NIL:PTR TO ln + DEF msg=NIL:PTR TO mn + + /* pointer given? */ + IF port + + node:=port.ln + + /* if public then remove from public port list */ + IF node.name THEN RemPort(port) + + /* no more messages please */ + Forbid() + + /* remove all messages in queue */ + WHILE msg:=GetMsg(port) DO ReplyMsg(msg) + + /* delete the port */ + DeleteMsgPort(port) + + /* multitask */ + Permit() + ENDIF +ENDPROC +/* FEND */ + diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/E-Empty/empty-handler.e b/amigae33a/E_v3.3a/Src/Src/Pd/E-Empty/empty-handler.e new file mode 100644 index 0000000..9043a04 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/E-Empty/empty-handler.e @@ -0,0 +1,172 @@ + +/*** + + empty-handler.e v1.00 + + By Vidar Hokstad + + This code is hereby declared public domain. + + Returns the number of ASCII NUL (0) specified as filename: + "Copy Empty:100 Ram:test" will create a file "test" in Ram: + containing 100 ASCII NUL + + The code uses the ReplyPkt() function of V36+ dos.library. + To use it with 1.2/1.3, uncomment the replypkt() function, and + change the case of the "ReplyPkt()" calls to "replypkt" + + Based on "empty-handler" in C by o.wagner@aworld-2.zer[.sub.org] + + Needs AmigaE3.1a or newer + +***/ + +OPT OSVERSION=37,PREPROCESS + +MODULE 'dos/dos','dos/dosextens','dos/filehandler','exec/ports', + 'exec/nodes' + + +#define Baddr(val) Shl(val,2) + +PROC getpacket (p:PTR TO process) + DEF port:PTR TO mp, + msg:PTR TO mn + + port:= p.msgport -> The port of our process + WaitPort (port) -> Wait for a message + msg:= GetMsg (port) +ENDPROC msg.ln::ln.name + +/* +PROC replypkt (packet:PTR TO dospacket,res1,res2) + + DEF msg:PTR TO mn, + replyport:PTR TO mp,p:PTR TO process + + p:= FindTask(0) + + ->--- Set return codes + + packet.res1:=res1 + packet.res2:=res2 + + ->--- Find reply port + + replyport:=packet.port + + ->--- Pointer to the execmessage of the packet + + msg:=packet.link + + ->--- Set packet-port + + packet.port:=p.msgport + + ->--- "Connect" message and packet + + msg.ln::ln.name:=packet; + msg.ln::ln.succ:=NIL + msg.ln::ln.pred:=NIL + + ->--- ... and send message + PutMsg(replyport,msg) +ENDPROC +*/ + +PROC main () + DEF hproc:PTR TO process, + packet:PTR TO dospacket, + devnode:PTR TO devicenode, + fh:PTR TO filehandle,o:PTR TO mn + + DEF running=TRUE, + opencount=0, + emptylen,readlen,c, + nump:PTR TO CHAR, + filename[64]:STRING,typ + + ->--- Initialize handler + + hproc:= FindTask(0) + o:= wbmessage + packet:=o.ln::ln.name -> getpacket(hproc) + wbmessage:=0 + + devnode:= Baddr (packet.arg3) + devnode.task:= hproc.msgport + + ->--- Return startup packet + + ReplyPkt (packet,DOSTRUE,0) + + ->--- Main loop + + WHILE running + packet:= getpacket (hproc) + typ:=packet.type + SELECT typ + + CASE ACTION_FINDINPUT + nump:= Baddr(packet.arg3) + c:=0 + WHILE c":")) DO INC nump + IF nump[]=":" THEN INC nump + emptylen:=Val (nump) + INC opencount + + ->--- Filehandle + + fh:= Baddr(packet.arg1) + fh.interactive:=0 -> Non-interactive file + fh.args:=fh + fh.arg2:=emptylen + + ->--- Return packet + ReplyPkt(packet,DOSTRUE,0) + + CASE ACTION_END + ->--- If no open files, end the handler + + DEC opencount + running:= opencount<>0 + ReplyPkt(packet,DOSTRUE,0) + + CASE ACTION_READ + + ->--- FileHandle from open + fh:=packet.arg1 + nump:=packet.arg2 + emptylen:=fh.arg2 + readlen:=packet.arg3 + + ->--- Check for "end of file" + readlen:=Min(readlen,emptylen) + + c:=0 + WHILE c--- Subtract lenght + fh.arg2:=fh.arg2-readlen + + ReplyPkt (packet,readlen,0) + + + CASE ACTION_WRITE + ReplyPkt (packet,DOSFALSE,ERROR_DISK_WRITE_PROTECTED) + DEFAULT + ReplyPkt (packet,DOSFALSE,ERROR_ACTION_NOT_KNOWN) + ENDSELECT + ENDWHILE + devnode.task:=FALSE +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/E-Empty/empty.mountlist b/amigae33a/E_v3.3a/Src/Src/Pd/E-Empty/empty.mountlist new file mode 100644 index 0000000..9f44282 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/E-Empty/empty.mountlist @@ -0,0 +1,5 @@ +EMPTY: Handler = L:empty-handler + Stacksize = 4096 + Priority = 5 + GlobVec = -1 +# diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/FD2Module.e b/amigae33a/E_v3.3a/Src/Src/Pd/FD2Module.e new file mode 100644 index 0000000..d8d9503 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/FD2Module.e @@ -0,0 +1,204 @@ +/* + +fd2module V1.0 +Alex McCracken Mar 1994 + +This program is heavily based on Wouter van Oortmerssen's pragma2module. +In fact about 90% of the code belongs to Wouter, so I claim no credit for +this. However, since Wouter's praga2module works very well for files in +the correct format, I must state that if this fails it is most probably my +fault. You may use this program as you see fit, however should it fail and +eat your dog, cause your telly to explode, or cause any problems +what-so-ever, I will not be held responsible. In other word use this at +your own risk. I have made every effort to ensure it works, but I cannot +guarantee to have found all the niggly little ones that plauge almost all +programs. + +Usage + +The program in invoked by typing (CLI only): + + fd2module + +where libname is the name of the fd file minus the _lib.fd extension. +This will produce a file .m . At the moment the program echos the +fd file as it reads it, but this may change in a future release. You will +need to give the program the name of the library explicitly, again this may +change. + +Distribution + +This may be distributed by any means fit. However I retain the right to update + the package without informing anyone. This distribution should contain: + fd2module The executable + fd2module.doc This document + +Reaching me + +I can be reached in the following ways: + +Snail Mail: + Alex McCracken + 11 Charles Street + Kilmarnock + Ayrshire + KA1 2DX + Scotland + +Internet email: + mccracal@dcs.gla.ac.uk + +I only use my email account during term time so over the summer it is probally +best to write to me by snail mail. The email address should remain valid until +summer '95. + +*/ + +/* FD2Module + convert a library fd file to an E module. + Usage: fd2module + converts to */ + +ENUM INPUT_ERROR=10,OUTPUT_ERROR,FORMAT_ERROR + +DEF cfh,efh,eof,done, + gotbase=FALSE, + public=TRUE, + offset=30, + cfile[200]:STRING, + efile[200]:STRING, + cstring[200]:STRING + +PROC main() + StrCopy(cfile,arg,ALL) + StrAdd(cfile,'_lib.fd',ALL) + StrCopy(efile,arg,ALL) + StrAdd(efile,'.m',ALL) + WriteF('Amiga E FD2Module\nconverting: "\s" to "\s"\n',cfile,efile) + IF (cfh:=Open(cfile,OLDFILE))=0 THEN closeall(INPUT_ERROR) + IF (efh:=Open(efile,NEWFILE))=0 THEN closeall(OUTPUT_ERROR) + REPEAT + eof:=ReadStr(cfh,cstring) + done:=convert(cstring) + UNTIL eof OR done + WriteF('last offset: -\d\n',offset) + Out(efh,$FF) + WriteF('Done.\n') + closeall(0) +ENDPROC + +PROC closeall(er) + IF cfh<>0 THEN Close(cfh) + IF efh<>0 THEN Close(efh) + SELECT er + CASE INPUT_ERROR; WriteF('Could not open input file!\n') + CASE OUTPUT_ERROR; WriteF('Could not open output file!\n') + CASE FORMAT_ERROR; WriteF('Function definition file format error!\n') + ENDSELECT + CleanUp(er) +ENDPROC + +/* format of line to convert: + ##base _ + or + ##bias + or + ##public + or + ##private + or + ##end + or + * + or + ()()*/ + +PROC convert(str) +DEF pos,pos2,off2,len,narg,a,empty,dstr[50]:STRING,basestr[50]:STRING, + funcstr[50]:STRING,regstr[20]:STRING,libstr[50]:STRING, + tstr[80]:STRING,t2str[80]:STRING,t3str[80]:STRING,reg,check + MidStr(tstr,str,TrimStr(str)-str,ALL) + LowerStr(tstr) + WriteF('\s\n',str) + IF StrCmp(tstr,'##base ',STRLEN) OR StrCmp(tstr,'##base\t',STRLEN) + pos:=STRLEN + pos2:=InStr(tstr,'_',0) + IF pos2=-1 THEN closeall(FORMAT_ERROR) + IF gotbase=FALSE + gotbase:=TRUE + MidStr(basestr,str,(pos2+1),ALL) + LowerStr(basestr) + WriteF('Base will be: \s\n',basestr) + WriteF('Correct name of this library (with the ".library" or ".device"):\n>') + ReadStr(stdout,libstr) + Write(efh,["EM","OD",6]:INT,6) + Write(efh,libstr,EstrLen(libstr)+1) + Write(efh,basestr,EstrLen(basestr)+1) + ENDIF + ELSEIF StrCmp(tstr,'##bias ',STRLEN) OR StrCmp(tstr,'##bias\t',STRLEN) + pos:=STRLEN + MidStr(t2str,tstr,pos,ALL) + pos2:=TrimStr(t2str) + MidStr(t3str,t2str,pos2-t2str,ALL) + off2:=Val(t3str,NIL) + IF off2=0 THEN closeall(FORMAT_ERROR) + WHILE off2<>offset + Write(efh,'Dum',3) /* "empty function slots" */ + Out(efh,16) + IF offset>off2 THEN closeall(FORMAT_ERROR) + offset:=offset+6 + ENDWHILE + ELSEIF StrCmp(tstr,'##private',ALL) + public:=FALSE + ELSEIF StrCmp(tstr,'##public',ALL) + public:=TRUE + ELSEIF StrCmp(tstr,'##end',ALL) + RETURN TRUE + ELSEIF StrCmp(tstr,'*',STRLEN) + NOP + ELSE + IF public + pos:=0 + pos2:=InStr(str,'(',pos) + IF pos2=-1 THEN closeall(FORMAT_ERROR) + MidStr(funcstr,str,pos,pos2-pos) + IF funcstr[0]>="a" THEN funcstr[0]:=funcstr[0]-32 + IF funcstr[1]<"a" THEN funcstr[1]:=funcstr[1]+32 + Write(efh,funcstr,EstrLen(funcstr)) + pos:=pos2+1 + pos2:=InStr(str,'(',pos) + IF pos2=-1 THEN closeall(FORMAT_ERROR) + narg:=0 + MidStr(dstr,str,pos2+1,ALL) + UpperStr(dstr) + WHILE StrCmp(dstr,')',1)=FALSE + IF EstrLen(dstr)<2 THEN closeall(FORMAT_ERROR) + MidStr(regstr,dstr,0,2) + IF StrCmp(regstr,'D',1) OR StrCmp(regstr,'A',1) + IF StrCmp(regstr,'D',1) + reg:=0 + ELSEIF StrCmp(regstr,'A',1) + reg:=8 + ENDIF + MidStr(regstr,regstr,1,ALL) + reg:=reg+Val(regstr,{check}) + IF check<1 THEN closeall(FORMAT_ERROR) + ELSE + closeall(FORMAT_ERROR) + ENDIF + MidStr(dstr,dstr,2,ALL) + IF StrCmp(dstr,',',1) OR StrCmp(dstr,'/',1) + MidStr(dstr,dstr,1,ALL) + ENDIF + Out(efh,reg) + INC narg + ENDWHILE + IF narg=0 THEN Out(efh,16) + offset:=offset+6 + ELSE + Write(efh,'Dum',3) + Out(efh,16) + offset:=offset+6 + ENDIF + ENDIF +ENDPROC FALSE diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/IFF/README b/amigae33a/E_v3.3a/Src/Src/Pd/IFF/README new file mode 100644 index 0000000..d6f7604 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/IFF/README @@ -0,0 +1,13 @@ +A few small, and almost identical in "layout", E sources for +Wouter van Oortsmersens excellent AmigaE3.1a compiler. + +Written to demonstrate simple use of the "iffparse.library". + +These sources are e-mailware - if you find them of any use, send me a +short e-mail message at and tell me you use them +(suggestions for improvements, and questions, are also welcomed). + +Please read the sources for additional copyright info. + +Have fun, +Vidar Hokstad diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/IFF/ReadIFF.e b/amigae33a/E_v3.3a/Src/Src/Pd/IFF/ReadIFF.e new file mode 100644 index 0000000..36c8ed1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/IFF/ReadIFF.e @@ -0,0 +1,139 @@ + +/**** + + ReadIFF.e + © 1995 by Vidar Hokstad + + + COPYRIGHT NOTICE: + + This code can be distributed freely, and parts of the code, + or the whole code, can be used as is, or reused in any + product - free or commercial - provided the following terms + are met: + + - You accept that I give no guarantee, expressed or implied + of the usefulness or functionality of this code, and that + I accept no responsability for damage caused directly or + indirectly by the use of this program. + + - The product in which the code is used can not be used + for military applications. + + + INFO: + + Written as an exersize in using iffparse.library. It reads an + IFF file, and writes it's structure to stdout in a simple + format. + +***/ + + +OPT OSVERSION=37 + +MODULE 'iffparse','libraries/iffparse' + +RAISE "^C" IF CtrlC() = TRUE + +PROC readiff (name) HANDLE + + DEF iff:PTR TO iffhandle, -> Utility struct. for iffparse + node:PTR TO contextnode, -> additional info about chunk + fh, -> File handle of an IFF file + nest, -> How many levels deep in the + -> file are we? + ret,count + +-> --- INIT + + IF (iffparsebase:= OpenLibrary('iffparse.library',0))=NIL + Raise ("iffp") + ENDIF + + -> You *MUST* use AllocIFF() to allocate an iffhandle structure + IF (iff:=AllocIFF())=NIL THEN Raise ("iffh") + + -> Prepare the iffhandle to use a dos filehandle + InitIFFasDOS(iff) + + -> Open a file and fill inn the iffhandle + IF (fh:=Open (name,OLDFILE) )=0 THEN Raise ("open") + iff.stream:=fh + + -> Start a new IO session + IF OpenIFF (iff,IFFF_READ) THEN Raise ("oiff") + + +-> --- MAIN LOOP + + nest:=0;count:=0 + + WHILE (ret:=ParseIFF(iff,IFFPARSE_STEP))<>IFFERR_EOF + CtrlC() + + INC count + IF ret=IFFERR_EOC + DEC nest + Write (stdout,{spaces},nest*2) + Flush(stdout) + IF count>1 THEN PutStr ('\n') + PutStr ('}') + ELSE + count:=0 + PutStr ('\n') + node:= CurrentChunk(iff) + Write (stdout,{spaces},nest*2) + Flush(stdout) + Vprintf ('"%s" / "%s", size = %ld {', + [[node.id,0],[node.type,0],node.size]) + INC nest + ENDIF + ENDWHILE + + PutStr ('\n\n') +EXCEPT DO + +->--- CLEANUP: + + -> Was iffparse.library opened? + IF iffparsebase + + -> Was the iffhandle structure allocated? + IF iff + + -> Did OpenIFF() fail? + IF exception<>"oiff" THEN CloseIFF(iff) + + -> Was the file opened? + IF fh THEN Close(fh) + + -> Free the iffhandle. *MUST* be done with FreeIFF() + FreeIFF(iff) + ENDIF + CloseLibrary (iffparsebase) + ENDIF + + -> IF an exception occured, let the next exception handler deal + -> with it too... + + ReThrow() +ENDPROC + + +PROC main() HANDLE + DEF rdargs,args + + args:=[0] + IF rdargs:=ReadArgs ('FILENAME/A',args,NIL) + readiff (args[0]) + ENDIF +EXCEPT + IF exception = "^C" + PutStr ('***BREAK\n') + ELSE + Vprintf ('exception = %ld ("%s")\n',[exception,[exception,0]]) + ENDIF +ENDPROC + +spaces: CHAR ' ' diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/IFF/ScanIFF.e b/amigae33a/E_v3.3a/Src/Src/Pd/IFF/ScanIFF.e new file mode 100644 index 0000000..7de10f4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/IFF/ScanIFF.e @@ -0,0 +1,149 @@ +/**** + + ScanIFF.e + © 1995 by Vidar Hokstad + + + COPYRIGHT NOTICE: + + This code can be distributed freely, and parts of the code, + or the whole code, can be used as is, or reused in any + product - free or commercial - provided the following terms + are met: + + - You accept that I give no guarantee, expressed or implied + of the usefulness or functionality of this code, and that + I accept no responsability for damage caused directly or + indirectly by the use of this program. + + - The product in which the code is used can not be used + for military applications. + + + INFO: + + Written as an exersize in using iffparse.library. It reads an + IFF file, and dumps the contents of any occurences of a given + type of chunk, given the type and id. + +***/ + + +OPT OSVERSION=37 + +MODULE 'iffparse','libraries/iffparse','dos/dos' + +RAISE "^C" IF CtrlC() = TRUE + +-> Convert type/id string to a longword + +PROC gettype (str) + DEF ret + MOVE.L str,A0 + MOVE.B (A0)+,D0 + ASL.W #8,D0 + MOVE.B (A0)+,D0 + SWAP D0 + MOVE.B (A0)+,D0 + ASL.W #8,D0 + MOVE.B (A0),D0 + MOVE.L D0,ret +ENDPROC ret + +PROC scaniff (name,type,id) HANDLE + + DEF iff:PTR TO iffhandle, -> Utility struct. for iffparse + node:PTR TO contextnode, -> additional info about chunk + fh, -> File handle of an IFF file + buf[16]:ARRAY OF CHAR, -> Buffer for ReadChunkBytes() + len,i + +-> --- INIT + + IF (iffparsebase:= OpenLibrary('iffparse.library',0))=NIL + Raise ("iffp") + ENDIF + + -> You *MUST* use AllocIFF() to allocate an iffhandle structure + IF (iff:=AllocIFF())=NIL THEN Raise ("iffh") + + -> Prepare the iffhandle to use a dos filehandle + InitIFFasDOS(iff) + + -> Open a file and fill inn the iffhandle + IF (fh:=Open (name,OLDFILE) )=0 THEN Raise ("open") + iff.stream:=fh + + -> Start a new IO session + IF OpenIFF (iff,IFFF_READ) THEN Raise ("oiff") + + IF StopChunk (iff,gettype(type),gettype(id)) THEN Raise ("schn") + + +-> --- MAIN LOOP + +-> While there's something left to read, parse the IFF stream. + + WHILE ParseIFF(iff,IFFPARSE_SCAN)<>IFFERR_EOF + CtrlC() + + node:= CurrentChunk(iff) + Vprintf ('"%s" / "%s", size = %ld {\n', + [[node.id,0],[node.type,0],node.size]) + + -> Dump the contents of the requested chunk + WHILE (len:=ReadChunkBytes(iff,buf,16))>0 + PutStr (' ') + FOR i:=0 TO len-1 DO Vprintf (' $%02.lx',[buf[i]]) + PutStr ('\n') + ENDWHILE + + PutStr ('}\n') + ENDWHILE + + PutStr ('\n\n') +EXCEPT DO + +->--- CLEANUP: + + -> Was iffparse.library opened? + IF iffparsebase + + -> Was the iffhandle structure allocated? + IF iff + + -> Did OpenIFF() fail? + IF exception<>"oiff" THEN CloseIFF(iff) + + -> Was the file opened? + IF fh THEN Close(fh) + + -> Free the iffhandle. *MUST* be done with FreeIFF() + FreeIFF(iff) + ENDIF + CloseLibrary (iffparsebase) + ENDIF + + -> IF an exception occured, let the next exception handler deal + -> with it too... + + ReThrow() +ENDPROC + +PROC main() HANDLE + DEF rdargs,args + + args:=[0,0,0] + IF rdargs:=ReadArgs ('FILENAME/A,TYPE/A,ID/A',args,NIL) + scaniff (args[0],args[1],args[2]) + ELSE + PrintFault (ERROR_BAD_TEMPLATE,'Dos error') + ENDIF +EXCEPT + IF exception = "^C" + PutStr ('***BREAK\n') + ELSE + Vprintf ('exception = %ld ("%s")\n',[exception,[exception,0]]) + ENDIF +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/IFF/readclip.e b/amigae33a/E_v3.3a/Src/Src/Pd/IFF/readclip.e new file mode 100644 index 0000000..6ff6f65 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/IFF/readclip.e @@ -0,0 +1,166 @@ + +/**** + + ReadClipboard.e + © 1995 by Vidar Hokstad + + + COPYRIGHT NOTICE: + + This code can be distributed freely, and parts of the code, + or the whole code, can be used as is, or reused in any + product - free or commercial - provided the following terms + are met: + + - You accept that I give no guarantee, expressed or implied + of the usefulness or functionality of this code, and that + I accept no responsability for damage caused directly or + indirectly by the use of this program. + + - The product in which the code is used can not be used + for military applications. + + + INFO: + + Written as an exersize in using iffparse.library. Reads the + PRIMARY_CLIP clipboard unit, and prints it to stdout. + + Notice: Expects a FTXT clipboard, and will only utilize + FTXT CHRS chunks (which is what a standard clipboard contains). + + The only 2.04+ specific stuff is the use of Vprintf for writing + debug info. I don't really know if there's a version of + iffparse.library for older os-versions though. There ought to + be, but I dont really care :) + +***/ + + +OPT OSVERSION=37,PREPROCESS + +-> #define DEBUG + +MODULE 'iffparse','libraries/iffparse','devices/clipboard' + +RAISE "^C" IF CtrlC() = TRUE + + + +PROC readclip (unit) HANDLE + + DEF iff:PTR TO iffhandle, -> Utility struct. for iffparse + cliph=NIL, -> The clipboard handler + buf[200]:ARRAY OF CHAR, -> Buffer for ReadChunkBytes() + size -> Number of read bytes. + +#ifdef DEBUG + DEF node:PTR TO contextnode -> additional info about chunk +#endif + + +-> --- INIT + + IF (iffparsebase:= OpenLibrary('iffparse.library',0))=NIL + Raise ("iffp") + ENDIF + + -> You *MUST* use AllocIFF() to allocate an iffhandle structure + IF (iff:=AllocIFF())=NIL THEN Raise ("iffh") + + -> Prepare the iffhandle to use the clipboard + InitIFFasClip(iff) + + -> Open a clipboard stream and fill inn the iffhandle + IF (cliph:=OpenClipboard (unit) )=0 THEN Raise ("open") + iff.stream:=cliph + + -> Start a new IO session + IF OpenIFF (iff,IFFF_READ) THEN Raise ("oiff") + + -> Tell iffparse.library you want to examine chunks of type FTXT + -> and id CHRS which is pure ASCII text. + +#ifndef DEBUG + IF StopChunk (iff,"FTXT","CHRS") THEN Raise ("schn") +#endif + + +-> --- MAIN LOOP + +-> While theres something left to read, parse the IFF stream. +-> For a clipboard, there's usually only one chunk of interest, +-> but this way the code will work if theres more chunks too. + +-> IF "DEBUG" is defined, the IFF file is stepped through one +-> context change at a time, and additional info is dumped to +-> Output() + + +#ifndef DEBUG + WHILE ParseIFF(iff,IFFPARSE_SCAN)<>IFFERR_EOF +#endif + +#ifdef DEBUG + WHILE ParseIFF(iff,IFFPARSE_RAWSTEP)<>IFFERR_EOF +#endif + CtrlC() + +#ifdef DEBUG + node:= CurrentChunk(iff) + Vprintf ('id = "%s", type = "%s", size = %ld\n', + [[node.id,0],[node.type,0],node.size]) + Flush(stdout) + + -> Ensure that we only dump "CHRS" chunks + IF node.id="CHRS" +#endif + + -> Copy the chunk to the output file + WHILE (size:=ReadChunkBytes(iff,buf,200))>0 + Write(stdout,buf,size) + ENDWHILE + +#ifdef DEBUG + ENDIF +#endif + + ENDWHILE + +EXCEPT DO + +->--- CLEANUP: + + -> Was iffparse.library opened? + IF iffparsebase + + -> Was the iffhandle structure allocated? + IF iff + + -> Did OpenIFF() fail? + IF exception<>"oiff" THEN CloseIFF(iff) + + -> Was the Clipboard structure allocated? + IF cliph THEN CloseClipboard(cliph) + + -> Free the iffhandle. *MUST* be done with FreeIFF() + FreeIFF(iff) + ENDIF + CloseLibrary (iffparsebase) + ENDIF + + -> IF an exception occured, let the next exception handler deal + -> with it too... + + ReThrow() +ENDPROC + + +-> Read the PRIMARY_CLIP clipboard, and print it's contents to stdout +-> Display any exception that occurs. + +PROC main() HANDLE + readclip (PRIMARY_CLIP) +EXCEPT + Vprintf ('exception = %ld ("%s")\n',[exception,[exception,0]]) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/MakeKickFile.e b/amigae33a/E_v3.3a/Src/Src/Pd/MakeKickFile.e new file mode 100644 index 0000000..4869d65 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/MakeKickFile.e @@ -0,0 +1,109 @@ +;/* MakeKickFile.e - Execute me to compile with Amiga E v2.1 +ec MakeKickFile +quit +*/ +/* +** $Filename: MakeKickFile.e $ +** $Release: 1.1 $ +** +** (C) Copyright 1991-1993 Jaba Development. +** Written by Jan van den Baard +** +** Create a rom-kick file of the machine it is run on. +** It can create 256K and 512K ROM files. +** +** This is a direct translation from my original C code +** and the first thing I wrote in Amiga E. Therefore it +** might not make full use of E it's special features. +** Please forgive me for that. +** +** The usage is simple. You pass this program a filename +** and, if the rom size is known, it will write the ROM +** of the machine to the file. It writes the ROM, *NOT* +** a soft-kicked rom. +** +** The output can be used by setcpu or skick to boot up +** a machine with the ROM file. +** +** I have successfully tested it with an A1200 ROM on +** a A2500. +** +** No testing has been made with a 1.2/1.3 ROM file. +** I don't have access to a 1.2/1.3 machine. +** +** This really is a hack...but a hack that works! +**/ + +MODULE 'dos/dos' + +/* ROM size constants and magic cookies */ +CONST SMALLROM = $00040000, SMALLMAGIC = $11114EF9, + BIGROM = $00080000, BIGMAGIC = $11144EF9 + +/* C= RomFileHeader structure */ +OBJECT romfileheader + alwaysnil : LONG /* like it says -: always NIL */ + romsize : LONG /* the size of the ROM */ +ENDOBJECT + +/* only three excpetion errors... */ +ENUM ER_USAGE=1, ER_UNKNOWN, ER_IO + +/* here we go... */ +PROC main() HANDLE + DEF outfile = NIL, + base = NIL : PTR TO LONG, + size = NIL, + len = NIL, + rk, rfh : romfileheader + + WriteF( '\e[1mMakeKickFile version 1.1 - (C) 1991-1993 Jaba Development\e[0m\n' ); + + /* no args or "?" as arg then print the usage */ + IF StrCmp( arg, '', 1 ) OR StrCmp( arg, '?', 2 ) THEN Raise( ER_USAGE ) + + /* first try for a 512 KB ROM */ + base := $00F80000 + + /* if the magic cookie isn't BIGMAGIC then it must be a 256 KB ROM */ + IF ( base[ 0 ] <> BIGMAGIC ) THEN base := $00FC0000 + + /* let's see what ROM we are dealing with */ + rk := base[ 0 ] + + SELECT rk + CASE SMALLMAGIC; size := SMALLROM /* 256 KB */ + CASE BIGMAGIC; size := BIGROM /* 512 KB */ + DEFAULT; Raise( ER_UNKNOWN ) /* unknown... */ + ENDSELECT + + /* show the ROM size */ + WriteF( 'ROM Size = \dKByte.\n', size / 1024 ) + + /* open the kick-file */ + IF ( outfile := Open( arg, MODE_NEWFILE )) + WriteF( 'Writing KickFile image...\n' ) + + rfh.alwaysnil := NIL /* set this field to NIL */ + rfh.romsize := size /* put the ROM size here */ + + len := Write( outfile, rfh, 8 ) /* write the romfileheader */ + len := len + Write( outfile, base, size ) /* write the rom */ + + Close( outfile ) /* close the kick-file */ + + /* was the writing successfull? */ + IF ( ( len <> ( size + 8 )) OR IoErr() ) THEN Raise( ER_IO ) + ELSE + /* could not open the file! */ + WriteF( 'Unable to open the output file!\n' ) + ENDIF +EXCEPT + /* exception handler for when no output name was given + or the ROM is not recognized or an IO error. */ + SELECT exception + CASE ER_USAGE; WriteF( 'Usage: MakeKickFile \n' ) + CASE ER_UNKNOWN; WriteF( 'Unknown ROM! Exiting...\n' ) + DEFAULT; PrintFault( IoErr(), 'Error -' ) + ENDSELECT +ENDPROC IoErr() diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/PubScreenNames.e b/amigae33a/E_v3.3a/Src/Src/Pd/PubScreenNames.e new file mode 100644 index 0000000..f780bd6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/PubScreenNames.e @@ -0,0 +1,164 @@ +/* PubScreenNames.e + * Prints the names (and some other attributes) of the Public Screens actually + * opened. Also, tests for the presence of a particular screen. + * + * Public Domain by Diego Caravana. + * + * + * Thanks to Wouter van Oortmerssen for his VERY GOOD work, hoping that he + * will continue to improve E language ! + * + * Hey, consider to learn E !!! + * + */ + +/* TAB=4 */ + +OPT OSVERSION=37 + +/* Here is OBJECT we use for copying data inherent to Public Screen. Copying + * data is necessary because the locking of PubScreen List must be as short as + * possible (see Commodore Autodocs). This is due to the fact that the list + * cannot be modified (i.e. no public screen can be opened/closed) while it is + * locked by a task. + */ + +OBJECT mypubscreen + name, flags:INT, visitorcnt:INT, screen, task, next +ENDOBJECT + +MODULE 'intuition/screens', 'exec/lists', 'exec/nodes' + +CONST ARGS_NUM=2 +ENUM ARG_FULL, ARG_EXISTS + +ENUM ERR_NONE=0, ERR_PUBLOCK, ERR_MEM, ERR_WRONGARGS, OK_FOUND, OK_NOTFOUND + +DEF localpslist:mypubscreen, strflags[25]:STRING, args[ARGS_NUM]:ARRAY OF LONG + +RAISE ERR_MEM IF String()=NIL, + ERR_PUBLOCK IF LockPubScreenList()=NIL, + ERR_WRONGARGS IF ReadArgs()=NIL, + ERR_MEM IF New()=NIL + +PROC main() HANDLE +DEF pslist:PTR TO lh, psnode:PTR TO ln, i=0, localpsnode:PTR TO mypubscreen, + pubscreen:PTR TO pubscreennode, publock=NIL, rdargs=NIL + + VOID '$VER: PubScreenNames 1.1 (13.02.93) by Diego Caravana' + + rdargs := ReadArgs('FULL/S,EXISTS/K', args, 0) + + /* get the Public Screen List; it will not change while we are reading + */ + publock := LockPubScreenList() + + /* the first loop: copy all data we need as fast as possible + */ + pslist := publock + psnode := pslist.head + localpsnode := localpslist + + WHILE psnode.succ <> NIL + + /* test if EXISTS a screen with a specified name + */ + IF StrCmp(psnode.name, args[ARG_EXISTS], ALL) THEN Raise(OK_FOUND) + + /* allocate a estring dinamically to reduce memory usegand because + * STRINGs are not permitted (actually, I hope :) in OBJECTs + */ + localpsnode.name:=String(StrLen(psnode.name)+2) + StrCopy(localpsnode.name, psnode.name, ALL) + IF args[ARG_FULL]=-1 /* copy only if needed */ + pubscreen:=psnode + localpsnode.flags:=pubscreen.flags + localpsnode.visitorcnt:=pubscreen.visitorcount + localpsnode.task:=pubscreen.sigtask + localpsnode.screen:=pubscreen.screen + ENDIF + + /* allocate a OBJECT to contain the informations about the next + * screen + */ + localpsnode.next:=New(SIZEOF mypubscreen) + + /* change the pointers to examine the chain + */ + localpsnode:=localpsnode.next + psnode:=psnode.succ + ENDWHILE + + UnlockPubScreenList() + publock:=NIL /* to know that we have released the lock */ + + /* at this point, if a screen name was specified with EXISTS, it has not + * been found as a Public Screen in the previous loop, so we can surely + * exit with a null return code + */ + IF StrLen(args[ARG_EXISTS]) <> 0 THEN Raise(OK_NOTFOUND) + + /* print header with description of fields + */ + IF args[ARG_FULL]=-1 /* print the right one! */ + WriteF('\n N. Name Visitors Screen Task Flags\n') + WriteF( ' ---------------------------------------------------------------------------\n') + ELSE + WriteF('\n N. Name\n') + WriteF( ' ----------------------\n') + ENDIF + + /* the second loop: print all the data + */ + localpsnode:=localpslist + WHILE localpsnode.next <> NIL + i++ + + IF args[ARG_FULL]=-1 /* choose the infos to print */ + + /* not-so-simple code: the two flags are independent by one another + * and also we want a "|" (OR in C) put between them; then, there + * is a default string which is used when no flag is set + */ + StrCopy(strflags,'',ALL) + IF localpsnode.flags AND SHANGHAI + StrCopy(strflags,'SHANGHAI',ALL) + IF localpsnode.flags AND POPPUBSCREEN + StrAdd(strflags,'|POPPUBSCREEN',ALL) + ENDIF + ELSE + IF localpsnode.flags AND POPPUBSCREEN + StrCopy(strflags,'POPPUBSCREEN',ALL) + ENDIF + ENDIF + + WriteF(' \l\d[2] \l\s[18] \l\d[3] $\z\h[8] $\z\h[8] \l\s\n', + i, localpsnode.name, localpsnode.visitorcnt, + localpsnode.screen, localpsnode.task, strflags ) + ELSE + WriteF(' \l\d[2] \l\s[18]\n', i, localpsnode.name) + ENDIF + + localpsnode:=localpsnode.next + ENDWHILE + WriteF('\n Found \d Public Screen(s)\n\n', i) + + Raise(ERR_NONE) + +EXCEPT + IF publock THEN UnlockPubScreenList() + IF rdargs THEN FreeArgs(rdargs) + + SELECT exception + CASE ERR_NONE; + CASE OK_FOUND; CleanUp(5) /* if WARN will be true */ + CASE OK_NOTFOUND; CleanUp(0) + CASE ERR_PUBLOCK; WriteF('*** cannot obtain PubScreen infos!\n') + CASE ERR_MEM; WriteF('*** no memory!\n') + DEFAULT; PrintFault(IoErr(), '*** Error') + ENDSELECT + + IF exception THEN CleanUp(10) + CleanUp(0) + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/Pyth2.e b/amigae33a/E_v3.3a/Src/Src/Pd/Pyth2.e new file mode 100644 index 0000000..f410a11 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/Pyth2.e @@ -0,0 +1,213 @@ +/* +** This is the E version of the 'Tree of Pythagoras'. +** Written by Raymond Hoving, Waardgracht 30, 2312 RP Leiden, +** The Netherlands. +** E-mail address: hoving@stpc.wi.leidenuniv.nl +** Requires Kickstart V3.0+ and reqtools.library V38+ +** Creation date: Sun Jul 17 17:30:07 1994, Version: 2.0 +*/ + +OPT REG=5,OSVERSION=39 /* Kickstart 3.0+ only. */ + +MODULE 'intuition/intuition', 'intuition/screens', 'utility/tagitem', + 'reqtools', 'exec/ports', 'exec/libraries', + 'libraries/reqtools', 'graphics/modeid', 'graphics/text' + +DEF pythscreen=NIL : PTR TO screen, + pythwindow=NIL : PTR TO window, + pythidcmp=NIL : PTR TO mp, + screenmodereq=NIL : PTR TO rtscreenmoderequester, + scrwidth, scrheight, fontheight, + winxsize, winysize, xbase, ybase, mbase, + depth=1, mdepth=10, + time0, time1 + +CONST BORDERSIZE = 4 + +ENUM MSG_READY, MSG_ABORT, ERROR_REQTLIB, ERROR_SCREEN, + ERROR_WINDOW, ERROR_OOM + +PROC pythcleanup(errornumber) + + /* This procedure will deallocate all objects that were succesfully + ** allocated. When an error occured, this will be told to the user. + */ + + IF pythwindow<>NIL THEN CloseWindow(pythwindow) + IF pythscreen<>NIL THEN CloseScreen(pythscreen) + IF screenmodereq<>NIL THEN RtFreeRequest(screenmodereq) + IF reqtoolsbase<>NIL THEN CloseLibrary(reqtoolsbase) + SELECT errornumber + CASE ERROR_OOM + WriteF('ERROR: Out of memory.\n') + CASE ERROR_REQTLIB + WriteF('ERROR: Couldn\at open reqtools.library.\n') + CASE ERROR_SCREEN + WriteF('ERROR: Couldn\at open new screen.\n') + CASE ERROR_WINDOW + WriteF('ERROR: Couldn\at open new window.\n') + CASE MSG_ABORT + WriteF('Drawing cancelled.\n') + CASE MSG_READY + WriteF('I just drew \d little house\s!\n', + Shl(1,mdepth)-1, + IF mdepth=1 THEN '' ELSE 's') + ENDSELECT + CleanUp(errornumber) /* Call the standard E finalizer. */ +ENDPROC + +PROC pythtree(a1,a2,b1,b2) + + /* This (recursively called) procedure will do the actual + ** drawing of the tree. + */ + + DEF c1,c2,d1,d2,e1,e2,ci1,ci2,di1,di2 + IF GetMsg(pythidcmp)<>NIL THEN pythcleanup(MSG_ABORT) + IF depth<=mdepth /* Check if we aren't too deep. */ + INC depth /* This depth is still allowed. */ + SetAPen(stdrast,depth) /* Drawing color depends on recursion depth. */ + c1 := !a1-a2+b2 ; ci1 := !c1! + c2 := !a1+a2-b1 ; ci2 := !c2! + d1 := !b1+b2-a2 ; di1 := !d1! + d2 := !a1-b1+b2 ; di2 := !d2! /* Calculate all */ + e1 := !0.5 * (!c1-c2+d1+d2) /* needed coordinates. */ + e2 := !0.5 * (!c1+c2-d1+d2) + /* + ** e Note the use of ! between () in the calculations of e1 and + ** /\ e2. We use some extra LONG's to minimize convertion + ** / \ overhead. + ** c+----+d The coordinates of c,d and e are calculated from the + ** | | coordinates of a and b. Lineair Algebra is great fun! + ** | | + ** a+----+b + */ + Move(stdrast,ci1,ci2) + Draw(stdrast,!a1!,!a2!) + Draw(stdrast,!b1!,!b2!) + Draw(stdrast,di1,di2) + Draw(stdrast,ci1,ci2) + Draw(stdrast,!e1!,!e2!) + Draw(stdrast,di1,di2) /* Draw the little house. */ + IF Rnd(2) = 0 /* Makes the growing a bit */ + pythtree(c1,c2,e1,e2) /* more interesting. */ + pythtree(e1,e2,d1,d2) + ELSE + pythtree(e1,e2,d1,d2) + pythtree(c1,c2,e1,e2) + ENDIF + DEC depth /* Ready with this branch. */ + ENDIF +ENDPROC + +PROC main() + + DEF a1,a2,b1,b2 + + /* Open reqtools.library and allocate memory for requester structure. + */ + + IF (reqtoolsbase := OpenLibrary('reqtools.library',38)) = NIL THEN + pythcleanup(ERROR_REQTLIB) + + IF (screenmodereq := RtAllocRequestA(RT_SCREENMODEREQ,NIL)) = NIL THEN + pythcleanup(ERROR_OOM) + + /* Let the user decide which screenmode he/she wishes. Note that + ** the tree looks best on a screen with approximately the same + ** number of pixels in both directions, like 640x512. + */ + + IF RtScreenModeRequestA(screenmodereq,'Tree of Pythagoras', [ + RTSC_FLAGS,SCREQF_OVERSCANGAD OR SCREQF_AUTOSCROLLGAD OR SCREQF_SIZEGADS, + RTSC_MINWIDTH,100, + RTSC_MINHEIGHT,100, + TAG_DONE]) = FALSE THEN pythcleanup(MSG_ABORT) + + /* Then ask the maximum depth of recursion. + */ + + IF (RtGetLongA({mdepth},'Tree of Pythagoras',NIL, [ + RTGL_MIN,1, + RTGL_MAX,14, + RTGL_TEXTFMT,'Enter maximum depth of the tree:', + RT_WINDOW,pythwindow, + TAG_DONE])) = FALSE THEN pythcleanup(MSG_ABORT) + + /* Get relevant data from the screenmode structure. + */ + + scrwidth := screenmodereq.displaywidth + scrheight := screenmodereq.displayheight + + /* Open the screen the user decided to want. + */ + + IF (pythscreen := OpenScreenTagList(NIL, [ + SA_DEPTH,4, + SA_TYPE,CUSTOMSCREEN, + SA_DISPLAYID,screenmodereq.displayid, + SA_WIDTH,scrwidth, + SA_HEIGHT,scrheight, + SA_TITLE,'Screen of Pythagoras', + TAG_DONE])) = NIL THEN pythcleanup(ERROR_SCREEN) + + /* Now open a screen filling window on the sceen that was just opened. + */ + + IF (pythwindow:=OpenWindowTagList(NIL, [ + WA_WIDTH,scrwidth, + WA_HEIGHT,scrheight, + WA_IDCMP,IDCMP_CLOSEWINDOW, + WA_FLAGS,WFLG_CLOSEGADGET OR WFLG_ACTIVATE, + WA_TITLE,'Tree of Pythagoras by Raymond Hoving', + WA_CUSTOMSCREEN,pythscreen, + TAG_DONE])) = NIL THEN pythcleanup(ERROR_WINDOW) + + /* Get some useful data from the window structure. + */ + + stdrast := pythwindow.rport + pythidcmp := pythwindow.userport + fontheight := pythwindow.ifont::textfont.ysize + + /* Set the palette for this screen (brown to green). + */ + + LoadRGB4(ViewPortAddress(pythwindow), [ + $000,$89a,$640,$752,$762,$771,$781,$680,$580,$080, + $090,$0a0,$0b0,$0c0,$0d0,$0e0] : INT, 16) + + + /* Build a 'real random' seed from the current time + */ + + CurrentTime({time0},{time1}) + Rnd(-Abs(Eor(time0,time1))) + + /* Now calculate how big the tree can be on the selected screen. + */ + + winxsize := scrwidth - (2 * BORDERSIZE) + winysize := scrheight - (6 * BORDERSIZE + fontheight) + xbase := winxsize! / 12.2 /* Divider found by trial and error. */ + ybase := winysize! / 8.0 /* This one as well. */ + IF !xbase < ybase THEN mbase := xbase ELSE mbase := ybase + a1 := scrwidth! / 2.0 - mbase + b1 := scrwidth! / 2.0 + mbase + a2 := scrheight - (4 * BORDERSIZE)! + b2 := a2 + + /* Set the busy pointer and start drawing. + */ + + SetWindowPointerA(pythwindow,[WA_BUSYPOINTER,TRUE,TAG_DONE]) + pythtree(a1,a2,b1,b2) + SetWindowPointerA(pythwindow,TAG_DONE) + + /* Ready! Wait for the user to close the window. + */ + + WaitPort(pythidcmp) + pythcleanup(MSG_READY) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/Talk.e b/amigae33a/E_v3.3a/Src/Src/Pd/Talk.e new file mode 100644 index 0000000..167052c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/Talk.e @@ -0,0 +1,150 @@ +/* Talk V1.0 - by Rob Verver in 1992 */ +/* */ +/* With this shellcommand you can make the narrator say any text using the */ +/* new OS2 features. See the helptemplate for more info. When specifying */ +/* a value which is out of range, the correct range will be displayed. */ +/* */ +/* Possible enhancements: */ +/* Ability to speak phonetic strings */ +/* Input from standard input, for piping */ +/* Preferences file in ascii format, controling all settings */ +/* Escape codes changes values halfway a text */ + +OPT OSVERSION=37 + +MODULE 'Translator', 'devices/narrator', 'dos/dos', 'exec/memory', 'exec/io' + +CONST AUDIOCHANSIZE=4 +ENUM NONE, ERR_DOS, ERR_MEM, ERR_FILE, ERR_DEVICE, ERR_TRANS, ERR_INVALID + +OBJECT arglist + file, rate, pitch, robotic, female, volume, enthusiasm, perturb, f1adj, + f2adj, f3adj, a1adj, a2adj, a3adj, articulate, centralize, centphon, avbias, + afbias, priority +ENDOBJECT + +DEF template, args: arglist, phonebuf=NIL, rdargs=NIL, file=NIL, msgport=NIL, + filebuf=NIL, ioreq: PTR TO ndi, audiochan: PTR TO CHAR, valid=TRUE, + length, phonebufsize + +PROC main () HANDLE + audiochan := [3, 5, 10, 12]:CHAR + + /* parse commandline options */ + args := [NIL, [DEFRATE], [DEFPITCH], 0, 0, [DEFVOL], [DEFF0ENTHUS], + [DEFF0PERT], [0], [0], [0], [0], [0], [0], [DEFARTIC], + [DEFCENTRAL], NIL, [0], [0], [25]]: arglist + template := 'FILE,RATE/K/N,PITCH/K/N,ROBOTIC/S,FEMALE/S,VOLUME/K/N,' + + 'ENTHUSIASM/K/N,PERTURB/K/N,F1ADJ/K/N,F2ADJ/K/N,F3ADJ/K/N,' + + 'A1ADJ/K/N,A2ADJ/K/N,A3ADJ/K/N,ARTICULATE/K/N,CENTRALIZE/K/N,' + + 'CENTPHON/K,AVBIAS/K/N,AFBIAS/K/N,PRIORITY/K/N' + rdargs := ReadArgs (template, args, NIL) + IF rdargs=NIL THEN Raise (ERR_DOS) + + /* open translator library */ + translatorbase := OpenLibrary ('translator.library', 37) + IF translatorbase=NIL THEN Raise (ERR_TRANS) + + /* open input file */ + file := Open (args.file, MODE_OLDFILE) + IF file=NIL THEN Raise (ERR_FILE) + length := FileLength (args.file) /* !!! ascii, no fh */ + IF length<1 THEN Raise (ERR_FILE) + + /* allocate input buffer */ + filebuf := AllocVec (length, MEMF_PUBLIC) + IF filebuf=NIL THEN Raise (ERR_MEM) + + /* allocate buffer for phonetic strings */ + phonebufsize := Shl (length, 1) + phonebuf := AllocVec (phonebufsize, MEMF_PUBLIC) + IF phonebuf=NIL THEN Raise (ERR_MEM) + + /* open narrator device */ + msgport := CreateMsgPort () + IF msgport=NIL THEN Raise (ERR_DEVICE) + ioreq := CreateIORequest (msgport, SIZEOF ndi) + IF ioreq=NIL THEN Raise (ERR_DEVICE) + ioreq.flags := NDF_NEWIORB + IF OpenDevice ('narrator.device', 0, ioreq, NIL)<>NIL THEN Raise (ERR_DEVICE) + + /* check values validity */ + checkVal (Long (args.rate), MINRATE, MAXRATE, 'Invalid rate') + checkVal (Long (args.pitch), MINPITCH, MAXPITCH, 'Invalid pitch') + checkVal (Long (args.volume), MINVOL, MAXVOL, 'Invalid volume') + checkVal (Long (args.centralize), MINCENT, MAXCENT, 'Invalid centralization') + IF valid=FALSE THEN Raise (ERR_INVALID) + + ioreq.chmasks := audiochan + ioreq.nummasks := AUDIOCHANSIZE + + /* init values */ + ioreq.rate := Long (args.rate) + ioreq.pitch := Long (args.pitch) + ioreq.volume := Long (args.volume) + ioreq.f0enthusiasm := Long (args.enthusiasm) + ioreq.f0perturb := Long (args.perturb) + ioreq.f1adj := Long (args.f1adj) + ioreq.f2adj := Long (args.f2adj) + ioreq.f3adj := Long (args.f3adj) + ioreq.a1adj := Long (args.a1adj) + ioreq.a2adj := Long (args.a2adj) + ioreq.a3adj := Long (args.a3adj) + ioreq.articulate := Long (args.articulate) + ioreq.centralize := Long (args.centralize) + ioreq.centphon := Long (args.centphon) + ioreq.avbias := Long (args.avbias) + ioreq.afbias := Long (args.afbias) + ioreq.priority := Long (args.priority) + IF args.robotic<>NIL THEN ioreq.mode := ROBOTICF0 ELSE ioreq.mode := MANUALF0 + IF args.female<>NIL THEN ioreq.sex := FEMALE + + process () + + Raise (0) +EXCEPT + SELECT exception + CASE ERR_DOS; PrintFault (IoErr(), 'Error') + CASE ERR_MEM; PutStr ('Error: not enough memory\n') + CASE ERR_FILE; PutStr ('Error: couldn\at open file\n') + CASE ERR_DEVICE; PutStr ('Error: couldn\at open narrator device\n') + CASE ERR_TRANS; PutStr ('Error: could\at open translator library V37\n') + CASE ERR_INVALID; PutStr ('Error: wrong parameters\n') + ENDSELECT + + IF ioreq<>NIL THEN CloseDevice (ioreq) BUT DeleteIORequest (ioreq) + IF translatorbase<>NIL THEN CloseLibrary (translatorbase) + IF rdargs<>NIL THEN FreeArgs (rdargs) + IF phonebuf<>NIL THEN FreeVec (phonebuf) + IF filebuf<>NIL THEN FreeVec (filebuf) + IF file<>NIL THEN Close (file) + IF msgport<>NIL THEN DeleteMsgPort (msgport) + IF exception THEN CleanUp (10) +ENDPROC + +PROC checkVal (val, min, max, str) + IF valmax) + Vprintf ('%s: valid values are between %ld and %ld\n', [str, min, max]) + valid := FALSE + ENDIF +ENDPROC + +PROC process () + DEF readlen /* !!!! was equal to globvar */ + + readlen := Read (file, filebuf, length) + IF readlen<>length THEN Raise (ERR_FILE) + + Translate (filebuf, length, phonebuf, phonebufsize) + /* WriteF ('phonetic string:\s\n', phonebuf) */ + speakBuffer (phonebuf, StrLen (phonebuf)) +ENDPROC + +PROC speakBuffer (buffer, length) + DEF ior:PTR TO iostd + ior := ioreq + ior.command := CMD_WRITE + ior.data := buffer + ior.length := length + DoIO (ioreq) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/agacc.e b/amigae33a/E_v3.3a/Src/Src/Pd/agacc.e new file mode 100644 index 0000000..2c5b5fd --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/agacc.e @@ -0,0 +1,71 @@ +OPT OSVERSION=39 + +MODULE 'intuition/intuition' + +DEF s,w:PTR TO window,rast,x,m,mx,my,r,g,b + +PROC main() + IF s:=OpenS(320,256,8,$800,'AGA Colour Cube') + rast:=stdrast + IF w:=OpenW(0,11,320,245,0,WFLG_BORDERLESS,0,s,15,0) + SetTopaz(8) + fullcolour(0,0,0,0) + fullcolour(1,$40,$80,$c0) + fullcolour(11,0,0,0) + fullcolour(12,0,0,0) + fullcolour(13,0,0,0) + fullcolour(6,0,0,0) + r:=0 + g:=0 + b:=0 + Line(0,16,0,79,11) + Line(70,16,70,79,12) + Line(140,16,140,79,13) + FOR x:=0 TO 63 + Plot(1,16+x,192+x) + Plot(71,16+x,64+x) + Plot(141,16+x,128+x) + Line(2+x,16,2+x,79,64+x) + Line(72+x,16,72+x,79,128+x) + Line(142+x,16,142+x,79,192+x) + ENDFOR + Colour(6,0) + RectFill(w.rport,0,82,205,120) + Colour(5,0) + fullcolour(5,255,255,255) + TextF(44,10,'R:\z\h[2] G:\z\h[2] B:\z\h[2]',r,g,b) + TextF(0,130,'Left mouse on square changes') + TextF(0,138,'Red, Green or Blue colour') + TextF(0,146,'component. Right mouse exits.') + WHILE Mouse()<>2 + Delay(1) + mx:=MouseX(w) + my:=MouseY(w) + m:=Mouse() + IF (m=1) AND (my>=16) AND (my<=79) + IF (mx>=2) AND (mx<=65) + b:=mx-2*4 + g:=my-16*4 + ENDIF + IF (mx>=72) AND (mx<=135) + r:=mx-72*4 + b:=my-16*4 + ENDIF + IF (mx>=142) AND (mx<=205) + g:=mx-142*4 + r:=my-16*4 + ENDIF + fullcolour(11,r,0,0) + fullcolour(12,0,g,0) + fullcolour(13,0,0,b) + fullcolour(6,r,g,b) + TextF(44,10,'R:\z\h[2] G:\z\h[2] B:\z\h[2]',r,g,b) + ENDIF + ENDWHILE + CloseWindow(w) + ENDIF + CloseScreen(s) + ENDIF +ENDPROC + +PROC fullcolour(nr,r,g,b) IS SetColour(s,nr,r,g,b) diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/brush2image.e b/amigae33a/E_v3.3a/Src/Src/Pd/brush2image.e new file mode 100644 index 0000000..26d1e69 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/brush2image.e @@ -0,0 +1,131 @@ +/* + ILBM brush to Image. +*/ +MODULE 'dos/dos','intuition/intuition','asl','libraries/asl', +'libraries/iffparse','iffparse','utility/tagitem' +ENUM NOERROR,ER_LIBRARY,ER_NOMEM,ER_NOASLREQUEST,ER_FILENOTFOUND,ER_IFFERROR, + ER_NOBMHD +CONST ID_ILBM=$494C424D +CONST ID_BMHD=$424D4844 +CONST ID_BODY=$424F4459 +CONST ID_CMAP=$434D4150 + +DEF iff:PTR TO iffhandle + +PROC main() + DEF req:PTR TO filerequester,source[256]:STRING,err,xsize,ysize,depth,bmhd, + body,cmap,camg,cflag,p:PTR TO INT,bp:PTR TO CHAR,sp:PTR TO storedproperty + + IF KickVersion(37)=FALSE + WriteF('Sorry, Kickstart V37+ Required.\n') + getout(0) + ENDIF + IF (aslbase:=OpenLibrary('asl.library',37))=0 + error(ER_LIBRARY,'asl') + ENDIF + IF (iffparsebase:=OpenLibrary('iffparse.library',37))=0 + error(ER_LIBRARY,'iffparse') + ENDIF + IF (req:=AllocAslRequest(ASL_FILEREQUEST,[ASL_HAIL,'Choose ILBM toconvert',0]:tagitem))>0 + IF AslRequest(req,0)=0 + FreeAslRequest(req) + getout(0) + ELSE + StrCopy(source,req.drawer,ALL) ; AddPart(source,req.file,256) ; SetStr(source,StrLen(source)) + ENDIF + ELSE + error(ER_NOASLREQUEST,0) + ENDIF + IF FileLength(source)>0 + IF (iff:=AllocIFF())>0 + iff.stream:=Open(source,MODE_OLDFILE) + InitIFFasDOS(iff) + IF (err:=OpenIFF(iff,IFFF_READ))=0 + IF (err:=PropChunk(iff,"ILBM","BMHD"))=0 + IF (err:=ParseIFF(iff,IFFPARSE_SCAN)=IFFERR_EOF) + IF (sp:=FindProp(iff,"ILBM","BMHD"))>0 + bmhd:=sp.data + bp:=p:=bmhd ;xsize:=p[2] ; ysize:=p[3] + depth:=bp[13] ; cflag:=bp[14] + ELSE + error(ER_NOBMHD,0) + ENDIF + WriteF('Start:\z\h[8]Xsize:\d Ysize:\d Compression:\d Depth:\d\n',bmhd,xsize,ysize,cflag,depth) + getout(0) + ELSE + error(ER_IFFERROR,err) + ENDIF + ELSE + error(ER_IFFERROR,err) + ENDIF + ELSE + error(ER_IFFERROR,err) + ENDIF + ELSE + error(ER_IFFERROR,IFFERR_NOMEM) + ENDIF + ELSE + error(ER_FILENOTFOUND,source) + ENDIF +ENDPROC +CHAR '$VER: ILBM2Image v.01 (C) 1994 Jason Maskell',0 + +PROC getout(retcode) + IF iff + CloseIFF(iff) + Close(iff.stream) + FreeIFF(iff) + ENDIF + IF aslbase + CloseLibrary(aslbase) + ENDIF + IF iffparsebase + CloseLibrary(iffparsebase) + ENDIF + CleanUp(retcode) +ENDPROC + +PROC error(errnum,str) + DEF work[80]:STRING + SELECT errnum + CASE ER_LIBRARY + StringF(work,'Could not open \s.library V37+',str) + CASE ER_NOMEM + StringF(work,'Unable to allocate memory.') + CASE ER_NOASLREQUEST + StringF(work,'Unable to allocate ASL requester.') + CASE ER_FILENOTFOUND + StringF(work,'File "\s" not found.',str) + CASE ER_IFFERROR + SELECT str + CASE IFFERR_EOC + StringF(work,'Iffparse Error: Endof Context') + CASE IFFERR_NOSCOPE + StringF(work,'Iffparse Error: Novalid scope') + CASE IFFERR_NOMEM + StringF(work,'Iffparse Error:Internal Memory allocation failed.') + CASE IFFERR_READ + StringF(work,'Iffparse Error:Stream Read Error.') + CASE IFFERR_WRITE + StringF(work,'Iffparse Error:Stream Write Error.') + CASE IFFERR_SEEK + StringF(work,'Iffparse Error:Stream Seek Error.') + CASE IFFERR_MANGLED + StringF(work,'Iffparse Error: IFFfile is corrupt.') + CASE IFFERR_SYNTAX + StringF(work,'Iffparse Error: IFFSyntax Error.') + CASE IFFERR_NOTIFF + StringF(work,'Iffparse Error: Notan IFF file.') + DEFAULT + StringF(work,'Iffparse Error:Unknown Error code: \d',str) + ENDSELECT + CASE ER_NOBMHD + StringF(work,'No Bitmapheader found. Not a usable FORM') + DEFAULT + StringF(work,'Unknown Error code: \d',errnum) + ENDSELECT + request('ILBN2Image Error',work,'Ok',0) + getout(11) +ENDPROC +PROC request(title,body,gadgets,args) +ENDPROC EasyRequestArgs(0,[20,0,title,body,gadgets],0,args) diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/findf.e b/amigae33a/E_v3.3a/Src/Src/Pd/findf.e new file mode 100644 index 0000000..0127520 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/findf.e @@ -0,0 +1,244 @@ +/* + + findf + + A very fast case-sensitive grep-style search program using + async i/o and the Boyer-Moore search algorithm. + + Usage - same as 'c:search' for the commands implemented. + + Michael Zucchi 1994 + + */ + + +MODULE 'dos/dos', 'dos/dosasl', + 'locale', + 'tools/async' + +DEF skip[256]:ARRAY OF CHAR, -> skip array + line[1024]:ARRAY OF CHAR, -> input buffer + buffer[1024]:ARRAY OF CHAR, -> for case-sensitive searches + m, -> length of string + string:PTR TO CHAR, -> string to match + uppertable[256]:ARRAY OF CHAR,-> lower->upper conversion table + quiet, nonum, quick, ncase -> settings + + +PROC main() +DEF args:PTR TO LONG, rdargs, p:PTR TO LONG, an:PTR TO anchorpath,go, + fib:PTR TO fileinfoblock, loc, i + +args:=[0,0,0,0,0,0,0]; + +IF rdargs:=ReadArgs('FROM/M,SEARCH/A,ALL/S,NONUM/S,QUIET/S,QUICK/S,CASE/S', args, 0) + string:=args[1]; + nonum:=args[3]; + quiet:=args[4]; + quick:=args[5]; + ncase:=args[6]=0; + + IF ncase + IF localebase:=OpenLibrary('locale.library', 0) + IF loc:=OpenLocale(0); + FOR i:=0 TO 255 DO uppertable[i]:=ConvToUpper(loc, i); + CloseLocale(loc); + ELSE + FOR i:=0 TO 255 DO uppertable[i]:=IF i>="a" AND i<="z" THEN i-32 ELSE i + ENDIF + ELSE + FOR i:=0 TO 255 DO uppertable[i]:=IF i>="a" AND i<="z" THEN i-32 ELSE i + ENDIF + CloseLibrary(localebase); + MOVE.L uppertable,A0 + MOVE.L string,A1 + MOVEQ #0,D0 +mn_up: MOVE.B (A1),D0 + MOVE.B 0(A0,D0.W),(A1)+ + BNE.S mn_up + ENDIF + + initskip(); + + IF an:=New(SIZEOF anchorpath + 256) + an.strlen:=255 + an.breakbits:=SIGBREAKF_CTRL_C; + fib:=an.info + p:=args[0]; + go:=0 + WHILE p[] AND (go=0) + go:=MatchFirst(p[], an); + WHILE go=0 + IF (fib.direntrytype) <0 + go:=scanfile(an+SIZEOF anchorpath); + ELSE + IF args[2] + IF (an.flags AND APF_DIRCHANGED)=0 THEN an.flags:=an.flags OR APF_DODIR + ENDIF + ENDIF + IF go=0 THEN go:=MatchNext(an); + ENDWHILE + p++ + ENDWHILE + IF quick THEN WriteF('\e[M'); + Dispose(an); + ENDIF + FreeArgs(rdargs); +ELSE + WriteF('FindF, Michael Zucchi 1994.\nERROR: bad args\n'+ + ' FROM/M files/patterns to search\n'+ + ' SEARCH/A text to search for\n'+ + ' ALL/S recursively scan subdirectories\n'+ + ' NONUM/S do not output line numbers\n'+ + ' QUIET/S do not output matched lines\n'+ + ' QUICK/S faster file-scan display\n'+ + ' CASE/S do a case-sensitive search\n'); +ENDIF +ENDPROC + + +/* + search a single file, by filename, line at a time + */ + +PROC scanfile(name) +DEF number, file, found=0,go=0 + +IF quick + WriteF('\s\e[K\b', name); +ELSE + IF quiet=0 THEN WriteF('\s\n', name); +ENDIF + +number:=1; +IF (file:=as_Open(name, MODE_OLDFILE, 3, 10240)) + WHILE as_FGetS(file, line, 1023) AND (go=0) + IF testmatch() + IF quiet + IF found=0 THEN WriteF('\s\n', name); + JUMP close + ELSEIF nonum +-> IF quick AND found=0 THEN WriteF('\n'); + WriteF('\s', line); + ELSE +-> IF quick AND found=0 THEN WriteF('\n'); + WriteF('\d[6] \s', number, line); + ENDIF + found:=1 + ENDIF + number++ + go:=CheckSignal(SIGBREAKF_CTRL_C) + ENDWHILE +close: + as_Close(file); +ENDIF + +ENDPROC go + + + +/* + Initialise the skip table for a given search string + */ + +PROC initskip() +DEF i + +m:=StrLen(string); + +-> initialise skip table for all characters +FOR i:=0 TO 255 + skip[i]:=m+1; +ENDFOR + +-> set skip table for characters in the string +FOR i:=0 TO m-1 + skip[string[i]]:=m-i; +ENDFOR + +ENDPROC + +/* + Looks for a match in a given line + */ + +PROC testmatch() + +IF m<1 THEN RETURN + + MOVEM.L A4-A5,-(A7) + + MOVE.L m,D7 + SUBQ.L #1,D7 + + TST.L ncase + BEQ.S tm_case + + -> non case-sensitive + + MOVE.L line,A3 + MOVE.L buffer,A0 + LEA 1(A0,D7.L),A2 + MOVE.L uppertable,A1 + MOVEQ #0,D0 +tp_up: MOVE.B (A3)+,D0 + MOVE.B 0(A1,D0.W),(A0)+ + BNE.S tp_up + BRA.S tp_match + + -> case sensitive +tm_case: + MOVE.L line,A0 + LEA 1(A0,D7.L),A2 -> a[i] +tm_scan: + TST.B (A0)+ -> find end of string + BNE.S tm_scan + +tp_match: + MOVE.L string,A1 + MOVE.L A1,A5 + LEA 1(A1,D7.L),A1 -> p[j] + + MOVE.L skip,A4 + + MOVE.L D7,D3 + ADDQ.L #2,D3 + MOVEQ #0,D1 +tm_loop0: + MOVE.L D7,D2 + MOVE.L A1,A3 +tm_loop: + MOVE.B -(A2),D1 + CMP.B -(A3),D1 + BEQ.S tm_matchchar + + MOVE.L A5,D0 + SUB.L A3,D0 -> -j + ADD.L D3,D0 -> M-j+1 + + MOVE.B 0(A4,D1.W),D1 -> skip[character] + CMP.L D0,D1 + BLT.S tm_add0 + + ADD.L D1,A2 + +tm_ok: CMPA.L A0,A2 + BLT.S tm_loop0 + + MOVEQ #0,D0 + BRA.S tm_exit + +tm_add0: + ADD.L D0,A2 + BRA.S tm_ok + +tm_matchchar: + DBF D2,tm_loop + + MOVEQ #-1,D0 +tm_exit: + MOVEM.L (A7)+,A4-A5 + +ENDPROC D0 + + diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/floodwindow.e b/amigae33a/E_v3.3a/Src/Src/Pd/floodwindow.e new file mode 100644 index 0000000..e509134 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/floodwindow.e @@ -0,0 +1,80 @@ +/* + floodwindow.e + + A PROC which will flood inside the borders of any window in any colour + plus wrapper code showing how it works + + IMPORTANT NOTE: If you want to know title bar height _before_ you + open your window, eg, for font awareness, you should + use + DEF screen:PTR TO screen, + font:PTR TO textattr + screenfont:= screen.font + titlebarheight:= screen.wbortop+font.ysize+1 + + When Who What + ------- ------- --------------------------------------------------------- + 4/3/94 UWP! All of it! + +*/ + +MODULE 'intuition/screens','exec/lists','exec/nodes', + 'intuition/intuition', + 'intuition/screens','intuition/gadgetclass','graphics/text' + +PROC main() +DEF screen:PTR TO screen, window:PTR TO window,class, + imess:PTR TO intuimessage, quit + + screen:=(LockPubScreen(NIL)) /* no testing, I assume you have WB :) */ + window:=OpenWindowTagList(NIL,[ WA_TOP, screen.height/2, + WA_LEFT, screen.width/2, + WA_INNERWIDTH, screen.width/4, + WA_INNERHEIGHT, screen.height/2, + WA_CLOSEGADGET, TRUE, + WA_DRAGBAR, TRUE, + WA_DEPTHGADGET, TRUE, + WA_SIZEBBOTTOM, TRUE, /* toggle this */ + WA_SIZEGADGET, TRUE, + WA_MINHEIGHT, 100, + WA_MINWIDTH, 50, + WA_MAXHEIGHT, -1, + WA_MAXWIDTH, -1, + WA_IDCMP, IDCMP_CLOSEWINDOW OR + IDCMP_CHANGEWINDOW, + WA_TITLE, 'Use me! Abuse me!', + 0,0]) /* NB: no checking here either :<*/ + + floodwindow(window,3) + + quit:=FALSE + WHILE quit=FALSE + class:=NIL + IF imess:=GetMsg(window.userport) + class:=imess.class + IF class=IDCMP_CHANGEWINDOW + floodwindow(window,3) + ENDIF + IF class=IDCMP_CLOSEWINDOW + quit:=TRUE + ENDIF + ReplyMsg(imess) + ELSE + WaitPort(window.userport) + ENDIF + ENDWHILE + + CloseWindow(window) + UnlockPubScreen(NIL,screen) + +ENDPROC + +PROC floodwindow(window:PTR TO window,colour) + + SetAPen(window.rport,colour) + RectFill(window.rport, window.borderleft, + window.bordertop, + window.width-window.borderright-1, + window.height-window.borderbottom-1) + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/gtlv.e b/amigae33a/E_v3.3a/Src/Src/Pd/gtlv.e new file mode 100644 index 0000000..7a47aa1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/gtlv.e @@ -0,0 +1,233 @@ +/*--------------------------------------------------------------------* + E Source generated by SRCGEN v0.1 + + Demo showing how to create, manage, and cleanup a gadtools listview. + Includes button gadgets and a string gadget for functionality. + AUTHOR: B. Wills + SRCGEN :-) + *--------------------------------------------------------------------*/ +OPT OSVERSION=37 + +MODULE 'gadtools', 'libraries/gadtools', 'intuition/intuition', + 'intuition/screens', 'graphics/text', + 'exec/lists', 'exec/nodes', 'utility/tagitem' + +/*-- Function return values. --*/ +ENUM NONE, NOCONTEXT, NOGADGET, NOWB, NOVISUAL, OPENGT, NOWINDOW, NOMENUS, MEM + +/*-- Gadget IDs. --*/ +ENUM ADDBUTTON_ID, DELETEBUTTON_ID, STRING_ID, LISTVIEW_ID + +RAISE "MEM" IF New()=NIL, + "MEM" IF String()=NIL + +/*-- Standard SrcGen stuff. --*/ +DEF win=NIL:PTR TO window, + scr=NIL:PTR TO screen, + glist=NIL, + visual=NIL, + infos:PTR TO gadget, + messageClass, + offx, offy, tattr + +/*-- Listview and supporting gadgets. --*/ +DEF list=NIL:PTR TO mlh, /* Exec list holds listview items */ + listView=NIL:PTR TO gadget, /* Listview gadget */ + addButton=NIL:PTR TO gadget, /* Button gadget to add an item */ + deleteButton=NIL:PTR TO gadget, /* Button gadget to delete an item */ + stringGadget=NIL:PTR TO gadget, /* String gadget, value added to listview */ + stringGadgetValue:PTR TO CHAR /* Pointer to string gadget buffer */ + +PROC initList(l:PTR TO mlh) +/*-- Initialize an exec list. --*/ + l.head:=l+4 + l.tail:=NIL + l.tailpred:=l +ENDPROC + +PROC setupScreen() +/*-- Open libraries and get screen info. --*/ + IF (gadtoolsbase:=OpenLibrary('gadtools.library',37))=NIL THEN RETURN OPENGT + IF (scr:=LockPubScreen('Workbench'))=NIL THEN RETURN NOWB + IF (visual:=GetVisualInfoA(scr,NIL))=NIL THEN RETURN NOVISUAL + offy:=scr.wbortop+Int(scr.rastport+58)-10 + tattr:=['topaz.font',8,0,0]:textattr +ENDPROC NONE + +PROC closeScreen() +/*-- Free resources, close screen and libraries. --*/ + IF glist THEN FreeGadgets(glist) + IF visual THEN FreeVisualInfo(visual) + IF scr THEN UnlockPubScreen(NIL,scr) + IF gadtoolsbase THEN CloseLibrary(gadtoolsbase) +ENDPROC + +PROC createGadgets() +/*-- Initialize gadget structures and create 'em. --*/ + DEF g, stringInfo:PTR TO stringinfo + /*-- Init exec list to hold listview items. Starts out empty. --*/ + list:=New(SIZEOF mlh) + initList(list) + IF (g:=CreateContext({glist}))=NIL THEN RETURN NOCONTEXT + IF (g:=listView:=CreateGadgetA(LISTVIEW_KIND, g, + [offx+7, offy+13, 243, 100, + 'My Mondo List', tattr, LISTVIEW_ID, 0, visual, 0]:newgadget, + [GTLV_LABELS, list, + GTLV_SHOWSELECTED, NIL, TAG_DONE]))=NIL THEN RETURN NOGADGET + IF (g:=stringGadget:=CreateGadgetA(STRING_KIND,g, + [offx+7, offy+111, 243, 12, + '', tattr, STRING_ID, 0, visual, 0]:newgadget, + [GTST_MAXCHARS,25, TAG_DONE]))=NIL THEN RETURN NOGADGET +/*-- This is where the string gadget buffer is hidden. --*/ + stringInfo:=stringGadget.specialinfo + stringGadgetValue:=stringInfo.buffer +/*-------------------------------------------------------*/ + IF (g:=addButton:=CreateGadgetA(BUTTON_KIND, g, + [offx+58, offy+111+15, 65, 17, + 'Add', tattr, ADDBUTTON_ID, 16, visual, 0]:newgadget, + [TAG_DONE]))=NIL THEN RETURN NOGADGET + IF (g:=deleteButton:=CreateGadgetA(BUTTON_KIND, g, + [offx+129, offy+111+15, 65, 17, + 'Delete', tattr, DELETEBUTTON_ID, 16, visual, 0]:newgadget, + [TAG_DONE]))=NIL THEN RETURN NOGADGET +ENDPROC NONE + +PROC openWindow() + IF createGadgets()<>NONE THEN RETURN NOGADGET + /*-- Note WA_IDCMP to get messages from the listview gadget: --*/ + IF (win:=OpenWindowTagList(NIL, + [WA_LEFT, 38, + WA_TOP, 14, + WA_WIDTH, offx+257, + WA_HEIGHT, offy+150, + WA_IDCMP, (IDCMP_REFRESHWINDOW OR IDCMP_CLOSEWINDOW OR IDCMP_GADGETUP OR + IDCMP_MOUSEMOVE OR LISTVIEWIDCMP OR SCROLLERIDCMP), + WA_FLAGS, (WFLG_DRAGBAR OR WFLG_DEPTHGADGET OR WFLG_CLOSEGADGET OR + WFLG_SMART_REFRESH OR WFLG_ACTIVATE), + WA_TITLE,NIL, + WA_CUSTOMSCREEN, scr, + WA_MINWIDTH, 67, + WA_MINHEIGHT, 21, + WA_MAXWIDTH, $2C0, + WA_MAXHEIGHT, 277, + WA_AUTOADJUST, 1, + WA_GADGETS, glist, + TAG_DONE]))=NIL THEN RETURN NOWINDOW + Gt_RefreshWindow(win, NIL) +ENDPROC NONE + +PROC closeWindow() + IF win THEN CloseWindow(win) +ENDPROC + +PROC wait4message(win:PTR TO window) + DEF mes:PTR TO intuimessage, type + REPEAT + type:=0 + IF mes:=Gt_GetIMsg(win.userport) + type:=mes.class + SELECT type + CASE IDCMP_GADGETUP + /*-- Any old gadget will do. The address is used --*/ + /*-- to identify which one sent the message. --*/ + infos:=mes.iaddress + infos.gadgetid:=mes.code + CASE IDCMP_REFRESHWINDOW + Gt_BeginRefresh(win) + Gt_EndRefresh(win,TRUE) + type:=0 + ENDSELECT + Gt_ReplyIMsg(mes) + ELSE + WaitPort(win.userport) + ENDIF + UNTIL type +ENDPROC type + +PROC addToList() + DEF newNode=NIL:PTR TO ln, node:PTR TO ln, + len, done=FALSE, itemPosition=0 + /*-- Don't add if there's nothing in the string gadget. --*/ + IF (len:=StrLen(stringGadgetValue))=0 THEN RETURN + /*-- Create a node and a string to add to the listview. --*/ + newNode:=New(SIZEOF ln) + newNode.name:=String(len) + StrCopy(newNode.name, stringGadgetValue, ALL) + /*-- Detach the exec list from the listview gadget. --*/ + Gt_SetGadgetAttrsA (listView, win, NIL, [GTLV_LABELS, -1, TAG_DONE]) + /*-- Decide where to insert the new item. Sorted on first character. --*/ + node:=list.head + IF list.tailpred=list + AddHead(list, newNode) + ELSEIF Char(node.name)>stringGadgetValue[] + AddHead(list, newNode) + ELSEIF node=list.tailpred + AddTail(list, newNode) + ELSE + WHILE done=FALSE + node:=node.succ + INC itemPosition + IF Char(node.name)>stringGadgetValue[] + done:=TRUE + ELSEIF node.succ=NIL + done:=TRUE + ENDIF + ENDWHILE + Insert(list, newNode, node.pred) + ENDIF + /*-- Reattach the exec list to the listview gadget. --*/ + Gt_SetGadgetAttrsA (listView, win, NIL, + [GTLV_LABELS, list, + GTLV_TOP, itemPosition, + TAG_DONE]) +ENDPROC + +PROC deleteFromList(itemPosition) + DEF node:PTR TO ln, i + /*-- Don't delete if no item is selected. --*/ + IF (itemPosition=-1) OR (list.tailpred=list) THEN RETURN + /*-- Detach the exec list from the listview gadget. --*/ + Gt_SetGadgetAttrsA (listView, win, NIL, [GTLV_LABELS, -1, TAG_DONE]) + /*-- Find the node that corresponds to itemPosition in the exec list. --*/ + node:=list.head + FOR i:=1 TO itemPosition DO node:=node.succ + /*-- Remove and deallocate the node's data. --*/ + Remove(node) + Dispose(node.name) + Dispose(node) + /*-- Reattach the exec list to the listview gadget. --*/ + Gt_SetGadgetAttrsA (listView, win, NIL, + [GTLV_LABELS, list, TAG_DONE]) +ENDPROC + +PROC main() HANDLE + DEF listItemPosition=-1 /* sentinel value, indicates no selection */ + IF setupScreen()=NONE + IF openWindow()=NONE + REPEAT + messageClass:=wait4message(win) + SELECT messageClass + CASE IDCMP_GADGETUP + SELECT infos /* pointer to gadget */ + CASE addButton + addToList() /* requires a value in the string gadget */ + CASE deleteButton + deleteFromList(listItemPosition) /* requires a selection */ + listItemPosition:=-1 /* sentinel value=no selection */ + CASE listView + listItemPosition:=infos.gadgetid /* note the use of this field! */ + ENDSELECT + CASE IDCMP_INTUITICKS + NOP /* these are being sent for some shitty reason }:-( */ + ENDSELECT + UNTIL messageClass=IDCMP_CLOSEWINDOW + closeWindow() + ENDIF + ENDIF + closeScreen() + CleanUp(0) +EXCEPT + WriteF('Exception: "\s"\n', [exception, 0]) + closeWindow() + closeScreen() + CleanUp(0) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/ham8demo.e b/amigae33a/E_v3.3a/Src/Src/Pd/ham8demo.e new file mode 100644 index 0000000..7c6b43c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/ham8demo.e @@ -0,0 +1,76 @@ +OPT OSVERSION=37 + +MODULE 'gadtools','libraries/gadtools','intuition/intuition','exec/nodes', + 'intuition/screens','intuition/gadgetclass','graphics/text' + +ENUM ER_NONE,ER_NOSCRN,ER_NOWINDOW + +DEF wnd=NIL:PTR TO window, + scr=NIL:PTR TO screen + +PROC shutdown() + IF wnd THEN CloseWindow(wnd) + IF scr THEN CloseScreen(scr) +ENDPROC + +PROC setup() + IF (scr:=OpenScreenTagList(NIL, + [SA_WIDTH,528,SA_HEIGHT,512,SA_DEPTH,8,SA_DISPLAYID,$8804, + NIL,NIL]))=NIL THEN Raise(ER_NOSCRN) + IF (wnd:=OpenWindowTagList(NIL, + [WA_LEFT,0, + WA_TOP,0, + WA_WIDTH,528, + WA_HEIGHT,512, + WA_IDCMP,IDCMP_MOUSEBUTTONS, + WA_FLAGS,WFLG_SIMPLE_REFRESH OR WFLG_NOCAREREFRESH OR + WFLG_ACTIVATE OR WFLG_BORDERLESS, + WA_CUSTOMSCREEN,scr, + NIL]))=NIL THEN Raise(ER_NOWINDOW) +ENDPROC + +PROC draw() + DEF r,loop1,loop2,loop3 + r:=wnd.rport + FOR loop1:=0 TO 7 + FOR loop2:=0 TO 7 + SetAPen(r,loop1*8+loop2+64) + Move(r,loop2*66,loop1*64) + Draw(r,loop2*66,loop1*64+63) + FOR loop3:=0 TO 63 + SetAPen(r,loop3+128) + Move(r,loop2*66+1,loop1*64+loop3) + Draw(r,loop2*66+1,loop1*64+loop3) + SetAPen(r,loop3+192) + Move(r,loop2*66+2+loop3,loop1*64) + Draw(r,loop2*66+2+loop3,loop1*64+63) + ENDFOR + ENDFOR + ENDFOR +ENDPROC + +PROC waitmouse() + DEF mes:PTR TO intuimessage,quit=FALSE + REPEAT + IF mes:=GetMsg(wnd.userport) + IF mes.class=IDCMP_MOUSEBUTTONS THEN quit:=TRUE + ReplyMsg(mes) + ELSE + WaitPort(wnd.userport) + ENDIF + UNTIL quit +ENDPROC + +PROC main() HANDLE + DEF erlist:PTR TO LONG + setup() + draw() + waitmouse() + Raise(ER_NONE) +EXCEPT + shutdown() + IF exception>0 + erlist:=['open screen','open window'] + EasyRequestArgs(0,[20,0,0,'Could not \s.','OK'],0,[erlist[exception-1]]) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/mweg.e b/amigae33a/E_v3.3a/Src/Src/Pd/mweg.e new file mode 100644 index 0000000..d65bb6e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/mweg.e @@ -0,0 +1,256 @@ +MODULE 'exec/nodes', 'exec/ports', + 'intuition/intuition', + 'gadtools', 'libraries/gadtools' + +ENUM ER_NONE, ER_NOGT, ER_NOSCRN, ER_NOVISUAL, ER_NOMENUS, ER_NOINITWIN + +ENUM CM_NONE, + CM_NEW, CM_QUIT, + CM_NEXT, CM_PREV, CM_ZOOM, CM_BACK, CM_FRONT, CM_CLOSE + +OBJECT wininfolist + head: LONG + tail: LONG + tailpred: LONG +ENDOBJECT + +OBJECT wininfo + succ: LONG + pred: LONG + winptr: LONG +ENDOBJECT + +DEF winlist: PTR TO wininfolist, /* linked list of windows */ + menuptr = NIL: PTR TO menu, /* menus built by GadTools */ + scr = NIL, /* pointer to default screen */ + visual = NIL /* pointer to VisualInfo */ + +/* Display an error using an EasyRequest */ +PROC errmsg(msgptr) + EasyRequestArgs(0, [20, 0, 'Error', msgptr, 'OK'], 0, 0) +ENDPROC + +/* Open a new window */ +PROC openwin() + DEF wi: PTR TO wininfo, w: PTR TO window, + success = FALSE + + /* Get some memory for the node */ + wi := New(SIZEOF wininfo) + + IF wi + IF (w := OpenWindowTagList(NIL, + [WA_LEFT, Rnd(300), WA_TOP, Rnd(100), + WA_WIDTH, 340, WA_HEIGHT, 156, + WA_MINWIDTH, 160, WA_MINHEIGHT, 70, + WA_MAXWIDTH, -1, WA_MAXHEIGHT, -1, + WA_TITLE, 'A window', + WA_FLAGS, WFLG_SIMPLE_REFRESH OR WFLG_ACTIVATE OR WFLG_DRAGBAR OR + WFLG_CLOSEGADGET OR WFLG_DEPTHGADGET OR WFLG_SIZEGADGET, + WA_IDCMP, IDCMP_CLOSEWINDOW OR IDCMP_MENUPICK, + WA_SCREENTITLE, 'Multi-Windows Example by David Higginson', + NIL, NIL])) = NIL + errmsg('Could not open window.') + Dispose(wi) + ELSE + IF SetMenuStrip(w, menuptr) + wi.winptr := w + success := TRUE + ELSE + CloseWindow(w) + Dispose(wi) + errmsg('Could not attach menus to new window.') + ENDIF + ENDIF + ELSE + errmsg('Out of memory.') + ENDIF + + /* Link it in */ + IF success THEN AddHead(winlist, wi) + /* N.B. New nodes MUST be added at head of list */ +ENDPROC success + +PROC cm_new() + IF openwin() = FALSE THEN errmsg('Could not open window.') +ENDPROC + +PROC cm_next(wi: PTR TO wininfo) + wi := wi.succ + IF wi.succ = FALSE THEN wi := winlist.head + IF wi.succ THEN ActivateWindow(wi.winptr) +ENDPROC + +PROC cm_prev(wi: PTR TO wininfo) + wi := wi.pred + IF wi.pred = FALSE THEN wi := winlist.tailpred + IF wi.pred THEN ActivateWindow(wi.winptr) +ENDPROC + +/* Set up libraries, screens, menus */ +PROC setup() + /* Open gadtools library */ + IF (gadtoolsbase := OpenLibrary('gadtools.library', 37)) = NIL THEN + Raise(ER_NOGT) + + /* Set up exec list to hold window information */ + winlist := [0, 0, 0] + winlist.head := Mul(winlist + 4,1) + winlist.tailpred := winlist + + /* Get default screen and visualinfo info */ + IF (scr := LockPubScreen(NIL)) = NIL THEN Raise(ER_NOSCRN) + IF (visual := GetVisualInfoA(scr, NIL)) = NIL THEN Raise(ER_NOVISUAL) + + /* Create menus */ + IF (menuptr := CreateMenusA([NM_TITLE, 0, 'Project', 0, 0, 0, 0, + NM_ITEM, 0, 'New...', 'N', 0, 0, CM_NEW, + NM_ITEM, 0, NM_BARLABEL, 0 , 0, 0, 0, + NM_ITEM, 0, 'Quit', 'Q', 0, 0, CM_QUIT, + NM_TITLE, 0, 'Window', 0 , 0, 0, 0, + NM_ITEM, 0, 'Next', ',', 0, 0, CM_NEXT, + NM_ITEM, 0, 'Previous', '.', 0, 0, CM_PREV, + NM_ITEM, 0, NM_BARLABEL, 0 , 0, 0, 0, + NM_ITEM, 0, 'Zoom', 'Z', 0, 0, CM_ZOOM, + NM_ITEM, 0, NM_BARLABEL, 0 , 0, 0, 0, + NM_ITEM, 0, 'Bring to front', '>', 0, 0, CM_FRONT, + NM_ITEM, 0, 'Send to back', '<', 0, 0, CM_BACK, + NM_ITEM, 0, NM_BARLABEL, 0 , 0, 0, 0, + NM_ITEM, 0, 'Close', 'K', 0, 0, CM_CLOSE, + NM_END, 0, 0, 0, 0, 0, 0]:newmenu, NIL)) = NIL THEN Raise(ER_NOMENUS) + + IF LayoutMenusA(menuptr, visual, NIL) = FALSE THEN Raise(ER_NOMENUS) + + /* Open initial window */ + IF openwin() = FALSE THEN Raise(ER_NOINITWIN) +ENDPROC + +/* Wait for messages */ +PROC eventloop() + DEF quit = FALSE, + msg: PTR TO intuimessage, class, + sig, bitmask, recalc_bitmask = TRUE, + close_this_win, + wi: PTR TO wininfo, tempwi: PTR TO wininfo, + w: PTR TO window, u: PTR TO mp, + item: PTR TO menuitem, code, id + + REPEAT + /* Recalculate mask formed by ORing all sigbits */ + IF recalc_bitmask + bitmask := 0 + wi := winlist.head + WHILE wi.succ + w := wi.winptr + u := w.userport + bitmask := bitmask OR Shl(1,u.sigbit) + wi := wi.succ + ENDWHILE + ENDIF + + /* Wait for something to happen */ + sig := Wait(bitmask) + + /* Now test all windows' sigbits */ + wi := winlist.head + WHILE wi.succ + tempwi := wi.succ + w := wi.winptr + u := w.userport + IF sig AND Shl(1,u.sigbit) + /* Message(s) received from this window */ + + close_this_win := FALSE + + WHILE u + IF msg:=GetMsg(u) + class := msg.class + code := MENUNULL + + SELECT class + + CASE IDCMP_CLOSEWINDOW + /* User selected close gadget */ + /* Can't close yet because msgport would disappear */ + close_this_win := TRUE + + CASE IDCMP_MENUPICK + code := msg.code + + ENDSELECT + + ReplyMsg(msg) + + /* Process menu events after messaged replied */ + WHILE code <> MENUNULL + item := ItemAddress(menuptr, code) + IF item + id := Long(item + 34) + SELECT id + CASE CM_NEW; cm_new() + CASE CM_QUIT; quit := TRUE + CASE CM_NEXT; cm_next(wi) + CASE CM_PREV; cm_prev(wi) + CASE CM_ZOOM; IF w THEN ZipWindow(w) + CASE CM_FRONT; IF w THEN WindowToFront(w) + CASE CM_BACK; IF w THEN WindowToBack(w) + CASE CM_CLOSE; close_this_win := TRUE + ENDSELECT + code := item.nextselect + ELSE + code := MENUNULL + ENDIF + ENDWHILE + + IF close_this_win + recalc_bitmask := TRUE + + ClearMenuStrip(w) + CloseWindow(w) + Remove(wi) + Dispose(wi) + + IF winlist.tailpred = winlist THEN quit := TRUE + u := NIL + + ENDIF + ELSE + u := NIL /* No more messages */ + ENDIF + ENDWHILE + ENDIF + + wi := tempwi + + ENDWHILE + + UNTIL quit +ENDPROC + +PROC shutdown() + DEF wi: PTR TO wininfo + WHILE wi := RemTail(winlist) + ClearMenuStrip(wi.winptr) + CloseWindow(wi.winptr) + Dispose(wi) + ENDWHILE + FreeMenus(menuptr) + FreeVisualInfo(visual) + UnlockPubScreen(scr, NIL) + CloseLibrary(gadtoolsbase) +ENDPROC + +PROC main() HANDLE + DEF erlist:PTR TO LONG + setup() + eventloop() + Raise(ER_NONE) +EXCEPT + shutdown() + erlist := ['This program requires gadtools library.', + 'Could not find default public screen.', + 'Could not get visual info for screen.', + 'Could not create menus.', + 'Could not create initial window.'] + IF exception>0 THEN errmsg(erlist[exception - 1]) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/device.e b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/device.e new file mode 100644 index 0000000..6b9ff68 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/device.e @@ -0,0 +1,136 @@ +/* + +OBJECT device + +V1.2 by Gregor Goldbach with suggs by Trey van Riper + +methods: + +open() +close() +end() +doio() +sendio() +abortio() +reset() + +*/ + + + +OPT MODULE +OPT OSVERSION=37 +OPT EXPORT +OPT PREPROCESS + +MODULE 'exec/devices', 'exec/io', 'exec/nodes', 'exec/ports','exec/devices', + 'oomodules/library' + +CONST SIZE_OF_BIGGEST_DEVICE_BLOCK=100, -> the size of the biggest device block + LONGEST_NAME=40 + +OBJECT device OF library + name + unit + io:PTR TO io + flags + lasterror +ENDOBJECT + +PROC open(name, unit=NIL,flags=NIL) OF device +/* + +METHOD + + open(name,unit,flags) + +INPUTS + + name - the name of the device to be opened + unit - the unit number + flags - flags for this device + +DESCRIPTION + + Opens the given unit of the device. + +RESULTS + + TRUE if the device could be opened + +EXCEPTIONS + + May raise "dev" with exceptioninfo + + -2 - CreateMsgPort() failed + -3 - CreateIORequest() failed + -4 - OpenDevice() failed + +*/ + +DEF ioreq:PTR TO io, + meinport:mp,fehler + + self.name := name + self.unit := unit + self.flags := flags + +->try to open a no-name message port +->raise "dev,-2 if failed + + meinport := CreateMsgPort() + IF (meinport = NIL) + Throw("dev",-2) + ENDIF + +->try to create an iorequest +->close msgport and raise "dev",-3 if failed + + ioreq := CreateIORequest(meinport, SIZE_OF_BIGGEST_DEVICE_BLOCK) + IF (ioreq = NIL) + DeleteMsgPort(meinport) + Throw("dev",-3) + ENDIF + +->try to open the device +->close iorequest, msgport and raise "dev",-4 if failed + + fehler := OpenDevice(self.name,self.unit,ioreq,flags) + IF(fehler) + DeleteIORequest(ioreq) + DeleteMsgPort(meinport) + Throw("dev",-4) + ELSE + self.io := ioreq + RETURN(TRUE) + ENDIF +ENDPROC + +PROC close() OF device + CloseDevice(self.io) + DeleteIORequest(self.io) + DeleteMsgPort(self.io.mn::mn.replyport) +ENDPROC + +PROC end() OF device + self.close() +ENDPROC + +PROC doio() OF device + IF self.io THEN DoIO(self.io) +ENDPROC + +PROC sendio() OF device + IF self.io THEN SendIO(self.io) +ENDPROC + +PROC abortio() OF device + IF self.io THEN AbortIO(self.io) +ENDPROC + +PROC reset() OF device + IF self.io + self.io::iostd.command := CMD_RESET + DoIO(self.io) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/library.e b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/library.e new file mode 100644 index 0000000..c0b9582 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/library.e @@ -0,0 +1,21 @@ +OPT MODULE +OPT EXPORT + +OBJECT library + base +ENDOBJECT + +PROC open(name,version=NIL,dummy=NIL) OF library +/* + * Just opens a library and fills the entries. the dummy argument is needed for + * opne OF device uses three vars + */ + +DEF base + IF(base := OpenLibrary(name,version))=NIL THEN Raise("LIB") + self.base := base +ENDPROC base + +PROC close() OF library + IF self.base THEN CloseLibrary(self.base) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/objects.build b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/objects.build new file mode 100644 index 0000000..acf1bc3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/objects.build @@ -0,0 +1,23 @@ +# just type 'build FROM objects TARGET ' + +# printer +# +# uses: device, library + +printer.m: printer.e device.m library.m + echo "*Ncompiling printer.e" + ec printer.e + +# device +# +# uses: library + +device.m: device.e library.m + echo "*Ncompiling device.e" + ec device.e + +# library + +library.m: library.e + echo "*Ncompiling library.e" + ec library.e diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/printer.e b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/printer.e new file mode 100644 index 0000000..020279b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/printer.e @@ -0,0 +1,159 @@ +OPT MODULE +OPT OSVERSION=37 +OPT EXPORT + +MODULE 'devices/printer', 'exec/devices', 'exec/io', 'exec/nodes', + 'exec/ports','exec/devices', + 'oomodules/device' + +OBJECT printer OF device +ENDOBJECT + +PROC rawwrite(zkette,laenge) OF printer +/* + +METHOD + + rawwrite(string,len) + +INPUTS + + string - the characters to be printed, 0-terminated + len - number of characters + +DESCRIPTION + + Sends the characters to the printer. Esc-sequences will not be substituted. + Opens the printer.device if necessary. +*/ + + IF self.io=NIL + self.open('printer.device',0,0) + ENDIF + + IF self.io + + self.io::iostd.data := zkette + self.io::iostd.length := laenge + self.io::iostd.command := PRD_RAWWRITE + + self.doio() + + self.lasterror := self.io.error + ENDIF +ENDPROC + +PROC write(zkette,laenge) OF printer +/* + +METHOD + + rawwrite(string,len) + +INPUTS + + string - the characters to be printed, 0-terminated + len - number of characters + +DESCRIPTION + + Sends the characters to the printer. Esc-sequences will be substituted. + Opens the printer.device if necessary. +*/ + + IF self.io=NIL + self.open('printer.device',0,0) + ENDIF + + IF self.io + + self.io::iostd.data := zkette + self.io::iostd.length := laenge + + self.io::iostd.command := CMD_WRITE + + self.doio() + + self.lasterror := self.io.error + ENDIF +ENDPROC + +PROC xcommand(kommando,p0=NIL,p1=NIL,p2=NIL,p3=NIL) OF printer +/* + +METHOD + + xcommand(command,param0,param1,param2,param3) + +INPUTS + + command - the printer command to be executed (s. devices/printer) + param0-3 - command parameters + +DESCRIPTION + + Executes a printer command with the given parameters such as setting + left and right border, justification etc. + Opens the printer.device if necessary. + +*/ + + IF self.io=NIL + self.open('printer.device',0,0) + ENDIF + + self.io::ioprtcmdreq.prtcommand := kommando + self.io::ioprtcmdreq.parm0 := p0 + self.io::ioprtcmdreq.parm1 := p1 + self.io::ioprtcmdreq.parm2 := p2 + self.io::ioprtcmdreq.parm3 := p3 + self.io.command := PRD_PRTCOMMAND + self.doio() + +ENDPROC + +PROC graphicdump(rport,cmap,vmodes,srcx,srcy,srcwidth,srcheight,destcols,destrows,special) OF printer +/* + +METHOD + + graphicdump(params) + +INPUTS + + rport - the RastPort containing the image + cmap - screen's ColorMap + vmodes - ViewModes of the screen + srcx,srcy, + srcwidth, + srcheight - dimensionen: start point & width & height + destcols, + destrows - dimensions on the printer in points + Special - special flags + +DESCRIPTION + + Prints a part of the rastport. + Opens the printer.device if necessary. + +*/ + + IF self.io=NIL + self.open('printer.device',0,0) + ENDIF + + self.io::iodrpreq.rastport := rport + self.io::iodrpreq.colormap := cmap + self.io::iodrpreq.modes := vmodes + self.io::iodrpreq.srcx := srcx + self.io::iodrpreq.srcy := srcy + self.io::iodrpreq.srcwidth := srcwidth + self.io::iodrpreq.srcheight := srcheight + self.io::iodrpreq.destcols := destcols + self.io::iodrpreq.destrows := destrows + self.io::iodrpreq.special := special + + self.io.command := PRD_DUMPRPORT + self.doio() + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/printer_test.e b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/printer_test.e new file mode 100644 index 0000000..57b7022 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/printer_test.e @@ -0,0 +1,40 @@ +/* + * this tests the printer object. NOTE: those vars are only needed + * for the graphic dump :) + */ + +OPT OSVERSION=37 + +MODULE 'oomodules/device','exec/io','devices/printer', + 'oomodules/printer','devices/printer', + 'intuition/intuition', 'intuition/intuitionbase','graphics/gfxbase','graphics/view', + 'graphics/rastport' + +PROC main() +DEF drucker:PTR TO printer, + ibase:PTR TO intuitionbase, + gbase:PTR TO gfxbase, + vp:PTR TO viewport, + rp:PTR TO rastport + + ibase:=intuitionbase + gbase:=gfxbase + rp := ibase.activewindow::window.rport + vp := gbase.actiview::view.viewport + + NEW drucker + + drucker.graphicdump( rp, + vp.colormap, + vp.modes, + 0,0,100,100,100,100,0) + + drucker.rawwrite('Hallo', 5) + drucker.xcommand(27) -> superscript on + drucker.write('Hallo', 5) + + WriteF('Fehler:\d\n',drucker.io.error) + + + END drucker +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/reqtools.e b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/reqtools.e new file mode 100644 index 0000000..a0195a1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/reqtools.e @@ -0,0 +1,69 @@ +OPT MODULE +OPT EXPORT + +MODULE 'oomodules/library', 'reqtools', 'libraries/reqtools' + +CONST FILEREQ=0 + +OBJECT reqtools OF library + stringbuf + filebuf + dirbuf + number +ENDOBJECT + +PROC new() OF reqtools + self.open('reqtools.library', 0) + IF self.base = NIL + Raise("LIB") + ELSE + reqtoolsbase := self.base + ENDIF +ENDPROC + +PROC ez(body,gadgets,dunno,arglist,taglist) OF reqtools + IF reqtoolsbase + RETURN RtEZRequestA(body,gadgets,dunno,arglist,taglist) + ENDIF +ENDPROC + +PROC string(title=NIL,maxlen=200,dunno=NIL,dunno2=NIL) OF reqtools + IF self.stringbuf THEN Dispose(self.stringbuf) + self.stringbuf := New(maxlen) + + RtGetStringA(self.stringbuf,maxlen,title,dunno,dunno2) +ENDPROC + +PROC end() OF reqtools + IF self.stringbuf THEN Dispose(self.stringbuf) + CloseLibrary(reqtoolsbase) +ENDPROC + +PROC palette(title,dunno=NIL,dunno2=NIL) OF reqtools + self.number := RtPaletteRequestA(title,dunno,dunno2) +ENDPROC self.number + +PROC long(title,dunno=NIL,dunno2=NIL) OF reqtools +DEF number + RtGetLongA({number}, title, dunno, dunno2) + self.number := number +ENDPROC self.number + +PROC file(title,maxlen=200) OF reqtools HANDLE +DEF req:PTR TO rtfilerequester + + IF req:=RtAllocRequestA(FILEREQ,0) + + IF self.filebuf THEN Dispose(self.filebuf) + IF self.dirbuf THEN Dispose(self.dirbuf) + self.filebuf := NewR(maxlen) + self.dirbuf := NewR(maxlen) + + RtFileRequestA(req,self.filebuf,title,0) + AstrCopy(self.dirbuf,req.dir,maxlen) + RtFreeRequest(req) + ENDIF + +EXCEPT + NOP +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/reqtools_test.e b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/reqtools_test.e new file mode 100644 index 0000000..68b952a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/oomodules/reqtools_test.e @@ -0,0 +1,26 @@ +MODULE 'oomodules/reqtools','libraries/reqtools' + + +PROC main() +DEF req:PTR TO reqtools + + NEW req.new() + +/* req.ez('Nice to see ya!','Ah.|So what?',0,0,[RTEZ_REQTITLE,'Just a test',RT_REQPOS,REQPOS_POINTER]) + req.string('Just enter a string:') + WriteF('\s\n',req.stringbuf) + req.string('Just enter a string:') + WriteF('\s\n',req.stringbuf) + + req.long('just enter a number:') + WriteF('\d\n', req.number) + + req.palette('just choose a colour:') + WriteF('\d\n', req.number) +*/ + + req.file('FILE?') + WriteF('\s\n', req.filebuf) + WriteF('\s\n', req.dirbuf) + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/queens.e b/amigae33a/E_v3.3a/Src/Src/Pd/queens.e new file mode 100644 index 0000000..69a297a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/queens.e @@ -0,0 +1,80 @@ + +-> Copyright © 1996 Guichard Damien. + +OPT OSVERSION=37 + +OBJECT queen + myrow:LONG + mycolumn:LONG + neighbor:PTR TO queen + boardsize:LONG +ENDOBJECT + +PROC build(aQueen,col,size) OF queen + self.neighbor:=aQueen + self.mycolumn:=col + self.myrow:=1 + self.boardsize:=size + IF self.neighbor THEN self.neighbor.first() +ENDPROC + +PROC checkCol(colNumber,rowNumber) OF queen + DEF cd + IF rowNumber=self.myrow THEN RETURN FALSE + cd:=colNumber-self.mycolumn + IF self.myrow+cd=rowNumber THEN RETURN FALSE + IF self.myrow-cd=rowNumber THEN RETURN FALSE + IF self.neighbor THEN RETURN self.neighbor.checkCol(colNumber,rowNumber) +ENDPROC TRUE + +PROC first() OF queen + self.myrow:=1 +ENDPROC self.checkrow() + +PROC next() OF queen + self.myrow:=self.myrow+1 +ENDPROC self.checkrow() + +PROC checkrow() OF queen + IF self.neighbor=NIL + IF self.myrow>self.boardsize THEN RETURN 0 + RETURN self.myrow + ENDIF + WHILE self.myrow<=self.boardsize + IF self.neighbor.checkCol(self.mycolumn,self.myrow) THEN + RETURN self.myrow + self.myrow:=self.myrow+1 + ENDWHILE + IF self.neighbor.next()=0 THEN RETURN 0 +ENDPROC self.first() + +PROC printboard() OF queen + DEF x + IF self.neighbor THEN self.neighbor.printboard() + FOR x:=1 TO self.boardsize + FputC(stdout,IF x=self.myrow THEN "Q" ELSE ".") + ENDFOR + FputC(stdout,"\n") +ENDPROC + +PROC main() HANDLE + DEF myargs:PTR TO LONG,rdargs + DEF lastq=NIL:PTR TO queen,newq:PTR TO queen + DEF size,x + myargs:=New(8) + IF (rdargs:=ReadArgs('BOARDSIZE/N/A,ALL/S',myargs,NIL))=NIL THEN Raise(1) + IF (size:=Long(myargs[0]))<=0 THEN Raise(1) + FOR x:=1 TO size DO lastq:=NEW newq.build(lastq,x,size) + IF lastq.first() THEN lastq.printboard() + IF myargs[1]=FALSE THEN Raise(0) + WHILE TRUE + EXIT CtrlC() + EXIT lastq.next()=0 + FputC(stdout,"\n") + lastq.printboard() + ENDWHILE +EXCEPT DO + IF rdargs THEN FreeArgs(rdargs) + IF exception THEN WriteF('Bad Args!\n') +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/readclip.e b/amigae33a/E_v3.3a/Src/Src/Pd/readclip.e new file mode 100644 index 0000000..e5e6a71 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/readclip.e @@ -0,0 +1,166 @@ + +/**** + + ReadClipboard.e + © 1995 by Vidar Hokstad + + + COPYRIGHT NOTICE: + + This code can be distributed freely, and parts of the code, + or the whole code, can be used as is, or reused in any + product - free or commercial - provided the following terms + are met: + + - You accept that I give no guarantee, expressed or implied + of the usefulness or functionality of this code, and that + I accept no responsability for damage caused directly or + indirectly by the use of this program. + + - The product in which the code is used can not be used + for military applications. + + + INFO: + + Written as an exersize in using iffparse.library. Reads the + PRIMARY_CLIP clipboard unit, and prints it to stdout. + + Notice: Expects a FTXT clipboard, and will only utilize + FTXT CHRS chunks (which is what a standard clipboard contains). + + The only 2.04+ specific stuff is the use of Vprintf for writing + debug info. I don't really know if there's a version of + iffparse.library for older os-versions though. There ought to + be, but I dont really care :) + +***/ + + +OPT OSVERSION=37,PREPROCESS + +-> #define DEBUG + +MODULE 'iffparse','libraries/iffparse','devices/clipboard' + +RAISE "^C" IF CtrlC() = TRUE + + + +PROC readclip (unit,out) HANDLE + + DEF iff:PTR TO iffhandle, -> Utility struct. for iffparse + cliph=NIL, -> The clipboard handler + buf[200]:ARRAY OF CHAR, -> Buffer for ReadChunkBytes() + size -> Number of read bytes. + +#ifdef DEBUG + DEF node:PTR TO contextnode -> additional info about chunk +#endif + + +-> --- INIT + + IF (iffparsebase:= OpenLibrary('iffparse.library',0))=NIL + Raise ("iffp") + ENDIF + + -> You *MUST* use AllocIFF() to allocate an iffhandle structure + IF (iff:=AllocIFF())=NIL THEN Raise ("iffh") + + -> Prepare the iffhandle to use the clipboard + InitIFFasClip(iff) + + -> Open a clipboard stream and fill inn the iffhandle + IF (cliph:=OpenClipboard (unit) )=0 THEN Raise ("open") + iff.stream:=cliph + + -> Start a new IO session + IF OpenIFF (iff,IFFF_READ) THEN Raise ("oiff") + + -> Tell iffparse.library you want to examine chunks of type FTXT + -> and id CHRS which is pure ASCII text. + +#ifndef DEBUG + IF StopChunk (iff,"FTXT","CHRS") THEN Raise ("schn") +#endif + + +-> --- MAIN LOOP + +-> While theres something left to read, parse the IFF stream. +-> For a clipboard, there's usually only one chunk of interest, +-> but this way the code will work if theres more chunks too. + +-> IF "DEBUG" is defined, the IFF file is stepped through one +-> context change at a time, and additional info is dumped to +-> Output() + + +#ifndef DEBUG + WHILE ParseIFF(iff,IFFPARSE_SCAN)<>IFFERR_EOF +#endif + +#ifdef DEBUG + WHILE ParseIFF(iff,IFFPARSE_RAWSTEP)<>IFFERR_EOF +#endif + CtrlC() + +#ifdef DEBUG + node:= CurrentChunk(iff) + Vprintf ('id = "%s", type = "%s", size = %ld\n', + [[node.id,0],[node.type,0],node.size]) + Flush(stdout) + + -> Ensure that we only dump "CHRS" chunks + IF node.id="CHRS" +#endif + + -> Copy the chunk to the output file + WHILE (size:=ReadChunkBytes(iff,buf,200))>0 + Write(out,buf,size) + ENDWHILE + +#ifdef DEBUG + ENDIF +#endif + + ENDWHILE + +EXCEPT DO + +->--- CLEANUP: + + -> Was iffparse.library opened? + IF iffparsebase + + -> Was the iffhandle structure allocated? + IF iff + + -> Did OpenIFF() fail? + IF exception<>"oiff" THEN CloseIFF(iff) + + -> Was the Clipboard structure allocated? + IF cliph THEN CloseClipboard(cliph) + + -> Free the iffhandle. *MUST* be done with FreeIFF() + FreeIFF(iff) + ENDIF + CloseLibrary (iffparsebase) + ENDIF + + -> IF an exception occured, let the next exception handler deal + -> with it too... + + ReThrow() +ENDPROC + + +-> Read the PRIMARY_CLIP clipboard, and print it's contents to stdout +-> Display any exception that occurs. + +PROC main() HANDLE + readclip (PRIMARY_CLIP,stdout) +EXCEPT + Vprintf ('exception = %ld ("%s")\n',[exception,[exception,0]]) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/ReadMe b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/ReadMe new file mode 100644 index 0000000..867055d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/ReadMe @@ -0,0 +1,247 @@ + +If you are an Amigoid to whom one or more of the following statements applies: + + + 1. You always wanted to learn ARexx but the fact that it can't even flash + the screen by itself bothered you (well I know that there is \007), + + 2. You badly need quick and easily created wrapper-programs for your new + great E routines using ARexx's monitoring capabilities, + + 3. You want to write something really useful as PD, Shareware or + something, but don't know what people out there would need and truly + appreciate, + + 4. You want to start programming in E in an unconventional way, + + 5. You need some speial and quick functions for your ARexx scripts, + + 6. You often listen to those PC/Macintosh los... sorry -- 'users' and + begin to envy them their 'servers' and stuff, + + 7. You have your nose more or less in the middle of your face... + + + THIS IS FOR YOU ! IT WILL MAKE YOU HAPPY ! + + +What it is you're asking? Well this is a E module, called rexxHostC.m, two +sources as example of using it, and this ReadMe. + +The module provides you with an extremely user-friendly 'engin' for writing +Rexx function-hosta (i.e. servers). Take a look on the 'mini_host.e' file to +see how concise can an E program be! And it really provides ARexx with a +Intuition function! The executable is 5112 bytes big. + +The engin is object-oriented, it has been pretty thoroughly tested, and it +returns all memory used. What else can I say...? Here comes the HOW-TO. + +--------------------------------------------------------------- + +After creating an instance of a rexxHostC object, by calling NEW rexxHostC() +with required parameter/s, the program by itself will open rexsyslib.library, +create a public port with the provided or default name, add it to ARexx's +host list and [possibly after executing some user-provided function] enter a +loop waiting for ARexx function-calls, intercepting them and executing. This +loop will be broken if either: + + 1. COMMAND 'bye' arrives at its port + + 2. the program got ^C + + 3. the method break() is executed [directly or not] by any callback + +and then our instance of the rexxHostC object will do the cleanup, that is: +reply the outstanding messages, delete the port, close the rexsyslib.library +etc. and commit suicide. In most cases the host will terminate [unless, for +some strange reason, you decide otherwise and put lots of other code after +it]. + +The rexxHostC class has quite a few methods, but you don't need most of them +if you don't want them; they are only there to help you. Notice that the +'mini_host' demo uses no other method but the constructor! + +Here comes short description of the available methods: + +--------------------------------------------------------------- + +CONSTRUCTOR: + + rexxHostC( callback_list, + name = 'rexx_host', + host_priority = -50, + func_ptr = NIL ) + +where: + + callback_list + ------------- + + is a list of pairs: [ S, C, S, C, ... , S, C ] + + 'S' being an UPPERCASE string like 'BEEP' or 'BYE_BYE' [quotes + included!], representing the name of the function you are adding to ARexx + 'C' is a callback i.e. a pointer to a PROC'ess; it can also be a quoted + expression, a string like 'I love this\n', or just NIL; in the last + case ARexx will not find any function with this callback's name -- + just as if the name-string was not there. This callback-list is + [roughly] checked for validity and if it doesn't conform exception 4 + i.e. ERR_BADLIST will be raised. + + Callbacks take no arguments [not directly anyway] and return either + nothing or [nicer thing to do] a string [not necessarily an EString] + like 'this is your callback speaking', 'TRUE', or '666'. ARexx will by + himself [!] translate those strings that represent numbers [like the last + one here] to numbers. It is as easy as that for direct values, for + variables you will probably use the supplied routines longToStr() and + charToStr(), which turn an integer like 69 or a char like "A" into a + string for ARexx. See the 'big_host' demo-source for that. As to + callbacks' arguments there are three support routines supplied for that + purpose: getNumArgs(), getStr( index ) and getNum( index ), read later on + about them. + + name + ---- + + [optional] is a string representing name for your message-port which must + be different from all currently present public ports present in the + system or you will get exception 2 i.e. 'ERR_NOTUNIQUE'. + + + host_priority + -------------- + + [optional] is the priority AMONG all Arexx libraries and hosts. It is NOT + any task priority, so don't be too surprised at the low default value. In + fact you SHOULD NEVER USE HIGHER priority than any of the libraries/hosts + you will be calling, DEADLOCK will result otherwise! I would personally + never attempt anything over 0. 'host_priority' value will be clipped to + a number between -100 and 100. + + + func_ptr + -------- + + is the [optional] pointer to function you want executed AFTER setup is + completed, probably nothing more important than announcing that it is + waiting for Rexx messages. + + +Note that 'callback_list' is the only argument you must give the constructor. +Another unusual thing is that we have no public destructor. + +--------------------------------------------------------------- + + num := getNumArgs() + ------------ + + returns the number of arguments the function in question got from ARexx, + it will be something between 0 and 15. + +--------------------------------------------------------------- + + string, fGood := getStr( index ) + --------------- + + gives you the argument number 'index' as a string, the second BOOLEAN + return-value tells you whether this argument is valid, that is -- if it + really came from ARexx [this you might already know if you have + previously called getNumArgs()]. + + N.B. It starts from 1, as the argument #0 is the command itself! + +--------------------------------------------------------------- + + num, fGood := getNum( index ) + --------------- + + gives you the argument number 'index' as an integer, the second BOOLEAN + return-value tells you whether this argument is valid, that is -- if the + argument-string with this index string really came from ARexx and if it + is a number. + + N.B. It starts from 1, as the argument #0 is the command itself! + +--------------------------------------------------------------- + + break() + ------- + + breaks the waiting/receiving/executing loop and kills the rexxHandlerC + object. + +--------------------------------------------------------------- + + str := longToStr( long ) + ----------------- + + str := charToStr( char ) + ----------------- + + as already said, these functions will turn an integer or a char + respectively into a string just as ARexx wants it for a return-value from + its function, it is only needed for variables, the direct values can be + returned with strings like '123' or 'oui monsieur'. + +--------------------------------------------------------------- + + major, minor := version() + --------- + + returns major and minor version number of the rexxHostC.m + the current values are bye the way: 0 and 4 + +======================================================================= + +EXCEPTIONS that might be raised by rexxHostC-object: + + +"MEM" meaning: 'not enough memory' + +"REXX" meaning: 'rexxsyslib.library not found' + +ERR_NONAME = 1 meaning: 'I got NIL as port-name' + +ERR_NOTUNIQUE = 2 meaning: 'port-name not unique' + +ERR_LISTNIL = 3 meaning: 'callback-list ptr NIL' + +ERR_BADLIST = 4 meaning: 'bad callback-list' + +ERR_NOTADDED = 5 meaning: 'host not added to ARexx list...' + +--------------------------------------------------------------- + +LIMITATIONS: + +There are two major I can think of: + + 1. As all other similar Rexx hosts I met [for example RexxFuncHost by + Donald T. Meyer] one such active host screens all other from receiving + function-calls; so that ONLY ONE CAN BE EFFECTIVE AT ANY TIME. This is + due to the fact that, differently than with libraries, ARexx will not + send your function-call to any other host whatever error was reported by + the one that received it. It would be possible to find a solution to that + -- if I still feel any urge to play with this piece of software I might + do that -- but in practice it shouldn't be so much of a problem + considering E's lightning speed of compilation. If you already have the + callbacks, you can create a new host in couple of minutes and launch it + in place of the previously running one. It might even be possible to have + dynamically created callback-lists: if/when we start to get flooded with + great PD/ShareWare/commercial modules containing just callback-lists and + callbacks themselves [there would be some problems with getting the + arguments for the callbacks though], you would be able to manage them + dynamically from ARexx to be included in just one rexxHostC-based server. + + 2. UPPER/lower case does not matter for all function-calls. It wouldn't + be any problem to implement this as optional, but I doubt whether it + would be so useful. Both ARexx and AmigaDOS tend to be case-insensitive + in most cases, and preventing ARexx from turning the name in your + function-call to uppercase requires additional work. + + +This was written in E v3.0b and v3.1a [registered version], by Piotr Obminski +in December 1994. It is, an off-spin of a much larger project, but I +found it so cute that I decided to polish it and present it to the so called +'Amiga community' [as community service]. The example-proggies are PD, but +the rexxHostC.m is Copyrighted FreeWare by me that is Piotr Obminski. diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/big/big_host.e b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/big/big_host.e new file mode 100644 index 0000000..4c8a344 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/big/big_host.e @@ -0,0 +1,144 @@ +-> +-> big_host.e +-> +-> ARexx host (i.e. server) with bunch of totally useless functions... +-> written in E v3.0 as a demo showing limitless possiblities of the... +-> rexxHostC class +-> +-> Public Domain · by Piotr Obminski · 27-Dec-94 20:34:44 +-> +-> +-> ! A M I G A F O R E V E R ! +-> +-> + +MODULE '*rexxHostC' + + +DEF rx_obj : PTR TO rexxHostC + + +PROC main() HANDLE + DEF cb_list : PTR TO LONG + + cb_list := [ 'LOVE', { love }, + 'HATE', { hate }, + 'SAY_PIPI', { beep }, + 'DISPLAYBEEP', { beep }, + 'GLOW', { glow }, + 'NOTHING', NIL, + 'WBENCHTOBACK', `WbenchToBack() BUT 'OK', + 'WBENCHTOFRONT', `WbenchToFront() BUT 'OK', + 'GO_AWAY', { go_away }, + 'RATS', `'BIG RODENTS!', -> <-- see this?! + 'ODD', { odd } ] + + + NEW rx_obj.rexxHostC( cb_list, 'big_host', -51, + `PrintF( 'Setup completed, now try me!\n' ) ) + + +EXCEPT DO + + SELECT exception + CASE 0 + PrintF( 'You\ave aborted...\n' ) + CASE ERR_NOTUNIQUE + PrintF( 'It seems that I\am ALREADY RUNNING...\n' ) + CASE ERR_LISTNIL + PrintF( 'I\ave got NIL for CALLBACK LIST!\n' ) + CASE ERR_NOTADDED + PrintF( 'HOST could NOT be ADDED!\n' ) + CASE ERR_BADLIST + PrintF( 'Check your CALLBACK LIST!\n' ) + CASE "MEM" + PrintF( 'Memory!\n' ) + CASE "REXX" + PrintF( 'I need rexxsyslib.library!\n' ) + DEFAULT + PrintF( '? ? ?\n' ) -> this should never happen + ENDSELECT +ENDPROC + +-> ------------------------ callbacks ----------------------------- + +-> +-> just says how many arguments it got and displays them, to do that +-> it calls another callback +-> +PROC love() + PrintF( 'love() here calling hate()...\n' ) + hate() -> just call another callback +ENDPROC 'it''s "kärlek" in Swedish' + + +-> +-> just says how many arguments it got and displays them +-> +PROC hate() + DEF num, i + + num := rx_obj.getNumArgs() + + PrintF( 'hate() here, I got \d args!\n', num ) + + FOR i := 1 TO num + PrintF( 'arg #\d = \s\n', i, rx_obj.getStr( i ) ) + ENDFOR +ENDPROC 'it''s "hat" in Swedish' + + +-> +-> Intuition support -- wow! +-> +PROC beep() + DEF i, how_many = 3, fGotArg = FALSE + + IF rx_obj.getNumArgs() > 0 THEN how_many, fGotArg := rx_obj.getNum( 1 ) + + FOR i := 1 TO 3 + DisplayBeep( NIL ) + Delay( 10 ) + ENDFOR + + IF ( fGotArg = TRUE ) AND ( how_many = 3 ) + RETURN 'here you are: as many beeps as you requested!' + ELSE + RETURN 'you\ave got default number of beeps which is 3!' + ENDIF +ENDPROC + + +-> +-> some hardware-generated colors in inline assembly +-> +PROC glow() + DEF i + + FOR i := 0 TO 100000 + MOVE.W $DFF006, $DFF180 + BCHG #1, $BFE001 + ENDFOR +ENDPROC rx_obj.longToStr( i ) -> because Rexx wants strings! + + +-> +-> E's own Odd() for ARexx, it returns '1' for TRUE and '0' for FALSE +-> (which ARexx will see as numbers anyway!), it returns ARexx error +-> RX_WARN (i.e. 5) for bad number of arguments +-> +-> NOTE THAT THEY MUST BE RETURNED AS STRINGS FOR AREXX! (which will then +-> treat them as numbers) +-> +PROC odd() + IF rx_obj.getNumArgs() <> 1 THEN RETURN 5, 0 +ENDPROC IF Odd( rx_obj.getNum( 1 ) ) THEN '1' ELSE '0' + + +-> +-> this aborts rexxHostC object (we have the internal COMMAND 'BYE', +-> but let's define a FUNCTION doing exactly the same) +-> +PROC go_away() + rx_obj.break() -> that' how our method break() is used +ENDPROC 'if you must...' diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/big/big_host.info b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/big/big_host.info new file mode 100644 index 0000000..4d822c4 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/big/big_host.info differ diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/big/big_host.rexx b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/big/big_host.rexx new file mode 100644 index 0000000..590d287 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/big/big_host.rexx @@ -0,0 +1,20 @@ +/* big_host.rexx */ + +say "love( 69, amor ) returns" "'" || love( 69, amor ) || "'" + +say "hate( you, 666, odio ) returns" "'" || hate( you, 666, odio ) || "'" + +say "displaybeep( 20 ) returns" "'" || displaybeep( 20 ) || "'" + +say "glow() returns" glow() + +say "rats() returns" "'" || rats() || "'" + +say WBenchToBack() WBenchToFront() WBenchToBack() WBenchToFront() + + +address 'big_host' 'bye' + +/* or like this (which is slightly crazy): */ + +/* call go_away() */ diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/mini/mini_host.e b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/mini/mini_host.e new file mode 100644 index 0000000..595e24b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/mini/mini_host.e @@ -0,0 +1,14 @@ +-> +-> mini_host.e « Intuition for ARexx ;-) » +-> +-> Public Domain · by Piotr Obminski · 26-Dec-94 04:38:59 +-> + +MODULE '*rexxHostC' + + +PROC main() + DEF rx_obj : PTR TO rexxHostC + + NEW rx_obj.rexxHostC( [ 'BEEP', `DisplayBeep( NIL ) BUT '0' ] ) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/mini/mini_host.info b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/mini/mini_host.info new file mode 100644 index 0000000..4d822c4 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/mini/mini_host.info differ diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/mini/mini_host.rexx b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/mini/mini_host.rexx new file mode 100644 index 0000000..cbacf22 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/mini/mini_host.rexx @@ -0,0 +1,5 @@ +/* mini_host.rexx */ + +say beep() + +address 'rexx_host' 'bye' diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/rexxhostc.m b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/rexxhostc.m new file mode 100644 index 0000000..887e68b Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Pd/rexxHostC/rexxhostc.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/scroll.e b/amigae33a/E_v3.3a/Src/Src/Pd/scroll.e new file mode 100644 index 0000000..67bd72c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/scroll.e @@ -0,0 +1,101 @@ +MODULE 'exec/memory', + 'intuition/intuition','intuition/screens', + 'graphics/text','graphics/view' + +CONST NUMIMAGE=4,IMAGEDATASIZE=2*16*2,SCROLLSPEED=1 + +ENUM ER_NONE,ER_NOSCRN,ER_NOMEM + +DEF s=NIL,w=NIL:PTR TO window,sprite=NIL,imagedata=NIL + +PROC setupimages() + IF (imagedata:=AllocVec(NUMIMAGE*IMAGEDATASIZE, + MEMF_CHIP OR MEMF_CLEAR))=NIL THEN Raise(ER_NOMEM) + CopyMemQuick([$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000, + $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000, + $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000, + $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000, + + $FFFF,$FFFF,$C003,$C003,$C003,$C003,$C3C3,$C3C3, + $C3C3,$C3C3,$C003,$C003,$C003,$C003,$FFFF,$FFFF, + $0000,$0000,$0000,$0000,$0000,$0000,$03C0,$03C0, + $03C0,$03C0,$0000,$0000,$0000,$0000,$0000,$0000, + + $0000,$0000,$0000,$0000,$0000,$0000,$03C0,$03C0, + $03C0,$03C0,$0000,$0000,$0000,$0000,$0000,$0000, + $FFFF,$FFFF,$C003,$C003,$C003,$C003,$C003,$C003, + $C003,$C003,$C003,$C003,$C003,$C003,$FFFF,$FFFF, + + $FFFF,$FFFF,$C003,$C003,$C003,$C003,$C003,$C003, + $C003,$C003,$C003,$C003,$C003,$C003,$FFFF,$FFFF, + $FFFF,$FFFF,$C003,$C003,$C003,$C003,$C3C3,$C3C3, + $C3C3,$C3C3,$C003,$C003,$C003,$C003,$FFFF,$FFFF]:INT, + imagedata,NUMIMAGE*IMAGEDATASIZE) +ENDPROC + +PROC setupscreen() + CloseWorkBench() + IF (s:=OpenScreenTagList(NIL, + [SA_WIDTH,784,SA_HEIGHT,200,SA_DEPTH,2,SA_DISPLAYID,0, + SA_QUIET,TRUE,SA_FONT,['topaz.font',8,0,0]:textattr, + SA_OVERSCAN,OSCAN_TEXT, + 0,0]))=NIL THEN Raise(ER_NOSCRN) + IF (w:=OpenWindowTagList(NIL, + [WA_LEFT,0,WA_TOP,0,WA_WIDTH,784,WA_HEIGHT,256, + WA_IDCMP,0, + WA_FLAGS,WFLG_SIMPLE_REFRESH OR WFLG_NOCAREREFRESH OR + WFLG_BORDERLESS OR WFLG_ACTIVATE OR WFLG_RMBTRAP, + WA_CUSTOMSCREEN,s, + WA_MOUSEQUEUE,0,WA_RPTQUEUE,0, + 0,0]))=NIL THEN Raise(ER_NOSCRN) + IF sprite:=AllocMem(20,MEMF_CHIP OR MEMF_CLEAR) + SetPointer(w,sprite,1,16,0,0) + ENDIF + LoadRGB4(ViewPortAddress(w), + [$000,$F00,$0F0,$FF0]:INT,16) +ENDPROC + +PROC shutdown() + IF w THEN CloseWindow(w) + IF sprite THEN FreeMem(sprite,20) + IF s THEN CloseScreen(s) + IF imagedata THEN FreeVec(imagedata) + OpenWorkBench() +ENDPROC + +PROC scroll() + DEF vp:PTR TO viewport,bigx,smallx,tile,imagenum,i,r,ypos + r:=w.rport + vp:=s+44 + REPEAT + FOR bigx:=0 TO 384 STEP 16 + IF Mouse() + Raise(ER_NONE) + ENDIF + FOR smallx:=0 TO 15 STEP SCROLLSPEED + PutInt(vp.rasinfo+8,32+bigx+smallx) + ScrollVPort(vp) + WaitTOF() + FOR tile:=0 TO SCROLLSPEED-1 + IF smallx+tile<12 + imagenum:=Rnd(NUMIMAGE) + ypos:=smallx+tile*16 + i:=[0,0,16,16,1,imagenum*IMAGEDATASIZE+imagedata,3,0,NIL]:image + DrawImage(r,i,bigx,ypos) + DrawImage(r,i,bigx+400,ypos) + ENDIF + ENDFOR + ENDFOR + ENDFOR + UNTIL FALSE +ENDPROC + +PROC main() HANDLE + setupimages() + setupscreen() + scroll() + Raise(ER_NONE) +EXCEPT + shutdown() + IF exception<>ER_NONE THEN WriteF('There was an error.\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/setf/setf.e b/amigae33a/E_v3.3a/Src/Src/Pd/setf/setf.e new file mode 100644 index 0000000..3dc99bc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/setf/setf.e @@ -0,0 +1,107 @@ +/* setf.e -- a SnoopDos-like program to monitor calls to OpenLibrary() */ + +OPT OSVERSION=37 + +MODULE 'dos/dos', 'exec/ports', 'exec/tasks', 'exec/nodes', 'exec/memory' + +CONST OFFSET=$fdd8 /* execbase offset of OpenLibrary() */ + +/* "mymsg" must begin with the standard message object "mn", followed by + any kind of data (in this case, two pointers [to strings]). +*/ +OBJECT mymsg + msg:mn + s, t +ENDOBJECT + +/* "port" will be used from the patched routine, too, so it's global */ +DEF port:PTR TO mp + +/* You can change the library function to be patched by changing OFFSET + and the "execbase" in the *two* calls to SetFunction(). If you want to + patch a library other than dos, exec, graphics and intuition you need + to OpenLibrary() it first. + (Note: some [old?] libraries cannot be patched in this way. Also, some + functions in some libraries can't be patched like this either! Even the + RKRM's aren't too clear about this...) +*/ +PROC main() + DEF ps, us, loop, sig, oldf + IF port:=CreateMsgPort() + Forbid() /* Don't let anyone mess things up... */ + IF oldf:=SetFunction(execbase, OFFSET, {newf}) + PutLong({patch}, oldf) + Permit() /* Now we can let everyone else back in */ + LEA store(PC), A0 + MOVE.L A4, (A0) /* Store the A4 register... */ + ps:=Shl(1,port.sigbit) /* Set up port and user signal bits */ + us:=SIGBREAKF_CTRL_C + loop:=TRUE + WHILE loop + sig:=Wait(ps OR us) + IF sig AND ps + printmsgs() + ENDIF + IF sig AND us + loop:=FALSE + ENDIF + ENDWHILE + Forbid() /* Paranoid... */ + SetFunction(execbase, OFFSET, oldf) + ENDIF + Permit() + printmsgs() /* Make sure the port is empty */ + DeleteMsgPort(port) + ENDIF +ENDPROC + +/* Nicely (?) print the messages out... */ +PROC printmsgs() + DEF msg:PTR TO mymsg + WHILE msg:=GetMsg(port) + WriteF('Task \l\s[25] wants \r\s[20]\n', + IF msg.t THEN msg.t ELSE '*unnamed*', + IF msg.s THEN msg.s ELSE '*unnamed library*') + ReplyMsg(msg) + DisposeLink(msg.s) + DisposeLink(msg.t) + Dispose(msg) + ENDWHILE +ENDPROC + +/* Send a message to the patching process */ +PROC sendmsg() + DEF m:PTR TO mymsg, s, tsk:tc, l:ln + MOVE.L A1, s + /* Allocate a new message */ + m:=New(SIZEOF mymsg) + IF s + m.s:=String(StrLen(s)) + StrCopy(m.s,s,ALL) + ENDIF + tsk:=FindTask(NIL) /* Find out who we are */ + m.t:=NIL + IF tsk + l:=tsk.ln + IF l AND l.name + m.t:=String(StrLen(l.name)) + StrCopy(m.t, l.name, ALL) + ENDIF + ENDIF + PutMsg(port, m) +ENDPROC + +/* Place to store A4 register */ +store: LONG 0 +/* Place to store real call */ +patch: LONG 0 + +/* The new routine which will replace the original library function */ +newf: + MOVEM.L D0-D7/A0-A6, -(A7) + LEA store(PC), A0 + MOVE.L (A0), A4 /* Reinstate the A4 register so we can use E code */ + sendmsg() + MOVEM.L (A7)+, D0-D7/A0-A6 + MOVE.L patch(PC), -(A7) + RTS diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/setf/setf.readme b/amigae33a/E_v3.3a/Src/Src/Pd/setf/setf.readme new file mode 100644 index 0000000..e59d11e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/setf/setf.readme @@ -0,0 +1,18 @@ +Short: Running E code from other processes +Type: dev/e +Uploader: m88jrh@uk.ac.ox.ecs (Jason R. Hulance) +Author: m88jrh@uk.ac.ox.ecs (Jason R. Hulance) + +This archive contains a few E sources which use SetFunction() to patch some +library calls. They serve to show how to run E code from other processes. +The important point is that E uses the A4 register for its global variables +so this must be preserved. The examples show a running E program setting up +a storage place for a copy of A4, and then code from this program can be run +from another process (after first restoring A4). The "other process" is the +examples is the process which calls the patched system function. + +Code which does not use global variables is easier to deal with, since this +does not require restoration of A4. However, a lot of code implicitly uses +global variables, since things like library calls use the global library +base variables. Also, E built-in functions use a number of globals, e.g., +WriteF uses "stdout" and "conout". diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/showiff.e b/amigae33a/E_v3.3a/Src/Src/Pd/showiff.e new file mode 100644 index 0000000..d902bf4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/showiff.e @@ -0,0 +1,71 @@ +MODULE 'iff','libraries/iff','intuition/intuition','intuition/screens', + 'exec/memory' + +ENUM ER_NONE,ER_IFFLIB,ER_OPENIFF,ER_NOBMHD,ER_SCREEN,ER_WINDOW,ER_DECODE + +DEF iff=NIL,s=NIL,ct[256]:ARRAY OF INT,bmhd,w=NIL:PTR TO window, + quit=FALSE,msg:PTR TO intuimessage,sprite=NIL + +PROC main() HANDLE + /* Open library first */ + IF (iffbase:=OpenLibrary('iff.library',22))=NIL THEN Raise(ER_IFFLIB) + + /* arg = filename of IFF file */ + IF (iff:=IfFL_OpenIFF(arg,IFFL_MODE_READ))=NIL THEN Raise(ER_OPENIFF) + + /* BMHD = BitMap HeaDer (contains dimensions of picture) */ + IF (bmhd:=IfFL_GetBMHD(iff))=NIL THEN Raise(ER_NOBMHD) + + /* Open screen with correct dimensions */ + IF (s:=OpenScreenTagList(NIL, + [SA_WIDTH,Int(bmhd),SA_HEIGHT,Int(bmhd+2),SA_DEPTH,Char(bmhd+8), + SA_DISPLAYID,IfFL_GetViewModes(iff), + 0,0]))=NIL THEN Raise(ER_SCREEN) + + /* Open a full size dummy window */ + IF (w:=OpenWindowTagList(NIL, + [WA_LEFT,0,WA_TOP,0,WA_WIDTH,Int(bmhd),WA_HEIGHT,Int(bmhd+2), + WA_FLAGS,WFLG_SIMPLE_REFRESH OR WFLG_NOCAREREFRESH OR + WFLG_BORDERLESS OR WFLG_ACTIVATE, + WA_IDCMP,IDCMP_MOUSEBUTTONS OR IDCMP_RAWKEY, + WA_CUSTOMSCREEN,s, + NIL,NIL]))=NIL THEN Raise(ER_WINDOW) + + /* Blank the mouse pointer */ + IF sprite:=AllocMem(20,MEMF_CHIP OR MEMF_CLEAR) + SetPointer(w,sprite,1,16,0,0) + ENDIF + + /* Set the palette of the screen */ + LoadRGB4(s+44,ct,IfFL_GetColorTab(iff,ct)) + + /* Try to load the picture */ + IF (IfFL_DecodePic(iff,s+184))=FALSE THEN Raise(ER_DECODE) + + /* Wait for the user to press a mouse button */ + REPEAT + IF msg:=GetMsg(w.userport) + quit:=(msg.class AND (IDCMP_MOUSEBUTTONS OR IDCMP_RAWKEY)) + ELSE + quit:=(Wait(-1) AND Shl(1,12)) + ENDIF + UNTIL quit + + Raise(ER_NONE) +EXCEPT + /* Clean up */ + IF w THEN CloseWindow(w) + IF sprite THEN FreeMem(sprite,20) + IF s THEN CloseScreen(s) + IF iff THEN IfFL_CloseIFF(iff) + IF iffbase THEN CloseLibrary(iffbase) + + /* Display possible error message */ + IF exception>0 + WriteF('Error: \s.\n', + ListItem(['No IFF library','Could not open IFF file', + 'IFF File had no bitmap header','Could not open screen', + 'Could not open window','Could not decode picture'], + exception-1)) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/threads/Thread.e b/amigae33a/E_v3.3a/Src/Src/Pd/threads/Thread.e new file mode 100644 index 0000000..be9d469 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/threads/Thread.e @@ -0,0 +1,44 @@ +-> thread.e - the very basic way to setup a thread under v37+ + +MODULE 'dos/dos' +MODULE 'dos/dostags' +MODULE 'dos/dosextens' +MODULE 'utility/tagitem' + +MODULE '*modules/geta4' + +PROC main() + -> pointer to the thread process + DEF mythread:PTR TO process + + -> store the global data pointer (a4) so the thread can later get this. + -> IMPORTANT: this must be done before any thread does a geta4(). + -> to be safe, just do it at the begin of main(), as done here. + storea4() + + -> create a thread process + IF mythread:=CreateNewProc( + [ + NP_ENTRY,{thread}, -> where the thread process begins + NP_NAME,'MyThread', -> the thread process name + TAG_DONE + ]) + + ENDIF + Delay(50) + + -> IMPORTANT: the main process may never end when threads are running. + -> In this small example, we simply wait a while, which is NOT RIGHT!! + Delay(50) + +ENDPROC + +PROC thread() + -> get the global data pointer, previously stored by the main process. + -> IMPORTANT: do this before using global variables or functioncalls. + geta4() + + PrintF('Hello, it\as me, your newly created thread.\n') + PrintF('I stopped now\n') + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/threads/Thread2.e b/amigae33a/E_v3.3a/Src/Src/Pd/threads/Thread2.e new file mode 100644 index 0000000..a5ca182 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/threads/Thread2.e @@ -0,0 +1,93 @@ +-> thread2.e - a safer way to implement threads than thread.e + +MODULE 'dos/dos' +MODULE 'dos/dostags' +MODULE 'dos/dosextens' +MODULE 'utility/tagitem' + +MODULE 'exec/nodes' +MODULE 'exec/ports' +MODULE 'exec/memory' + +MODULE '*modules/geta4' + +PROC main() + -> message for interprocess communication + DEF message:PTR TO mn + -> port of main process + DEF port:PTR TO mp + -> pointer to the thread process + DEF mythread:PTR TO process + + storea4() + + -> port to talk with thread + IF port:=CreateMsgPort() + + -> allocate message + IF message:=AllocMem(SIZEOF mn,MEMF_CLEAR OR MEMF_PUBLIC) + + -> fill in message node + message::ln.type:=NT_MESSAGE + message.length:=SIZEOF mn + message.replyport:=port + + -> create a thread process + IF mythread:=CreateNewProc( + [ + NP_ENTRY,{thread}, -> where the thread process begins + NP_NAME,'MyThread', -> the thread process name + TAG_DONE + ]) + + -> send the thread a startup message + PutMsg(mythread.msgport,message) + + /* main program here */ + + -> wait for the threads' death + WaitPort(port) + + ENDIF + + FreeMem(message,SIZEOF mn) + ENDIF + DeleteMsgPort(port) + ENDIF +ENDPROC + +PROC thread() + -> pointer to this process + DEF thisthread:PTR TO process + -> pointer to the received message + DEF message:PTR TO mn + + -> get the global data pointer, previously stored by the main process. + -> IMPORTANT: do this before using global variables or functioncalls. + geta4() + + -> find out about ourselves + thisthread:=FindTask(0) + + -> wait for the startup message (sent by the main process) + WaitPort(thisthread.msgport) + + -> get the startup message + message:=GetMsg(thisthread.msgport) + + /* thread program begins here */ + + -> useless program, just waits a second + PrintF('Hello, I\am a newbie thread. It\as nice to be here.\n') + Delay(50) + + /* thread program ends here */ + + -> make sure there is no taskswitching after we replied the message + Forbid() + + -> reply to main process + ReplyMsg(message) + +-> thread dies here +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/threads/modules/geta4.e b/amigae33a/E_v3.3a/Src/Src/Pd/threads/modules/geta4.e new file mode 100644 index 0000000..cf7a3fa --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/threads/modules/geta4.e @@ -0,0 +1,17 @@ +-> geta4.e - store and get the global data pointer kept in register A4 + +OPT MODULE + +EXPORT PROC storea4() + LEA a4storage(PC),A0 + MOVE.L A4,(A0) +ENDPROC + +EXPORT PROC geta4() + LEA a4storage(PC),A0 + MOVE.L (A0),A4 +ENDPROC + +a4storage: + LONG NIL + diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/threads/modules/geta4.m b/amigae33a/E_v3.3a/Src/Src/Pd/threads/modules/geta4.m new file mode 100644 index 0000000..38a69b2 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Pd/threads/modules/geta4.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Pd/threads/thread.doc b/amigae33a/E_v3.3a/Src/Src/Pd/threads/thread.doc new file mode 100644 index 0000000..2a2ae08 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Pd/threads/thread.doc @@ -0,0 +1,52 @@ +threads + +NAME + + threads.e -- shows threading + +AUTHOR + + Leon Woestenberg of Digital Disturbance (Email: leon@stack.urc.tue.nl) + +DISTRIBUTABILITY + + Freeware. © 1994-1995 by Digital Disturbance. Do not change the contents + of this archive. Except from that, you may do anything you like with the + archive and its contents. + +REQUIREMENTS + + Needs geta4.m, which is included along with the source. + +INTRODUCTION + + The Amiga is a multitasking computer, meaning that different tasks run + at the same time, seen from the user point of view. A process is an + extension of a task, as it has some DOS properties (standard input, + current directory, etc.) as well. An Amiga E compiled executable is a + process. Sometimes, a program may need to do two things at a time, for + example a texteditor may print a text while the user is editing another + text. This is where threading comes in. + +DESCRIPTION + + Threading basically means that a program adds a task to the system to + perform an asynchronous operation, while the program itself can continue + doing something else. A thread is a task that is related to its main + task, and often depends upon the main task, as they often share resources + or data, and communicate with eachother. + + These sources show the very basics of adding threading to your E programs. + +BUGS + + Under crisis circumstances, these examples will probably fail. + +TODO + + Improve crisis-situation behaviour. Also write an application class with + threading features. + +SEE ALSO + + Books about Operating Systems, exec.library/CreateNewProc diff --git a/amigae33a/E_v3.3a/Src/Src/README b/amigae33a/E_v3.3a/Src/Src/README new file mode 100644 index 0000000..dca0cc1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/README @@ -0,0 +1,23 @@ +This directory contains example sources to have a look at. It contains +small examples that hardly do anything useful, as well as more elaborate +examples. + +The 'Guide' directory contains example sources to be used in +connection with Jason Hulance's 'Beginner's Guide'. + +More advanced E programmers should especially have a look at +the 'Tools' (and also Class) directory, which contains some +reusable modules. + +The 'Pd' directory contains various sources people have send me, +or ones that I have gathered from The E Mailing list etc. I only +adapted these source where they had problems with EC v3. For +comments etc. please contact author in question. + +The 'Modules' directory contains the sources to the standard modules. +They should only be used as reference: they can't be compiled "as is" +because they have difficult dependancies and need other special tricks +to get them to work. + +The 'Rkrm' directory contains all the Rom Kernal Reference Manual +examples translated to E (!), definitely worth a look. diff --git a/amigae33a/E_v3.3a/Src/Src/Reqs/AslDemo.e b/amigae33a/E_v3.3a/Src/Src/Reqs/AslDemo.e new file mode 100644 index 0000000..63415af --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Reqs/AslDemo.e @@ -0,0 +1,25 @@ +/* Some demo to use other, kick2 only librarys from E. + We'll pop up a filerequester from the asl.library. */ + +MODULE 'Asl', 'libraries/Asl' + +DEF req:PTR TO filerequester + +PROC main() + IF aslbase:=OpenLibrary('asl.library',37) + IF req:=AllocFileRequest() + WriteF('Pick a file:\n') + IF RequestFile(req) + WriteF('Guess what! you picked "\s" in "\s" !\n',req.file,req.drawer) + ELSE + WriteF('Hard eh?\n') + ENDIF + FreeFileRequest(req) + ELSE + WriteF('Could not open filerequester!\n') + ENDIF + CloseLibrary(aslbase) + ELSE + WriteF('Could not open asl.library!\n') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Reqs/Ereq.e b/amigae33a/E_v3.3a/Src/Src/Reqs/Ereq.e new file mode 100644 index 0000000..a8f991c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Reqs/Ereq.e @@ -0,0 +1,12 @@ +/* simple requesters ... */ + +OPT OSVERSION=37 + +PROC main() + DEF r + r:=request('Ahem...','Sure|Nope',NIL) + request('Your selection: \d','what do i care ...',[r]) +ENDPROC + +PROC request(body,gadgets,args) +ENDPROC EasyRequestArgs(0,[20,0,0,body,gadgets],0,args) diff --git a/amigae33a/E_v3.3a/Src/Src/Reqs/GadToolsDemo.e b/amigae33a/E_v3.3a/Src/Src/Reqs/GadToolsDemo.e new file mode 100644 index 0000000..34cd769 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Reqs/GadToolsDemo.e @@ -0,0 +1,100 @@ +/* gadtools demo */ + +ENUM NONE,ER_OPENLIB,ER_WB,ER_VISUAL,ER_CONTEXT,ER_GADGET,ER_WINDOW,ER_MENUS + +MODULE 'intuition/intuition', 'gadtools', 'libraries/gadtools', + 'intuition/gadgetclass', 'exec/nodes', 'intuition/screens' + +DEF scr=NIL:PTR TO screen, + visual=NIL, + wnd=NIL:PTR TO window, + glist=NIL,offy,g, + type,infos,listv:PTR TO LONG,menu + +PROC main() HANDLE + openinterface() + REPEAT + wait4message() + TextF(10,150+offy,'type: \d[3], info: \h[4]',type,infos) + UNTIL type=IDCMP_CLOSEWINDOW + Raise(NONE) +EXCEPT + closeinterface() + IF exception>0 THEN WriteF('Could not \s !\n', + ListItem(['','open "gadtools.library" v37','lock workbench', + 'get visual infos','create context','create gadget', + 'open window','allocate menus'],exception)) +ENDPROC + +PROC openinterface() + IF (gadtoolsbase:=OpenLibrary('gadtools.library',37))=NIL THEN + Raise(ER_OPENLIB) + IF (scr:=LockPubScreen('Workbench'))=NIL THEN Raise(ER_WB) + IF (visual:=GetVisualInfoA(scr,NIL))=NIL THEN Raise(ER_VISUAL) + offy:=scr.wbortop+Int(scr.rastport+58)+1 + IF (g:=CreateContext({glist}))=NIL THEN Raise(ER_CONTEXT) + IF (menu:=CreateMenusA([1,0,'Project',0,0,0,0, + 2,0,'Load','l',0,0,0, + 2,0,'Save','s',0,0,0, + 2,0,'Bla ->',0,0,0,0, + 3,0,'aaargh','a',0,0,0, + 3,0,'hmmm','h',0,0,0, + 2,0,'Quit','q',0,0,0, + 0,0,0,0,0,0,0]:newmenu,NIL))=NIL THEN Raise(ER_MENUS) + IF LayoutMenusA(menu,visual,NIL)=FALSE THEN Raise(ER_MENUS) + IF (g:=CreateGadgetA(SCROLLER_KIND,g, + [scr.wborleft+20,offy+9,155,22,NIL,NIL,1,0,visual,0]:newgadget, + [GTSC_TOP,2, + GTSC_VISIBLE,3, + GTSC_TOTAL,10, + GTSC_ARROWS,22, + PGA_FREEDOM,LORIENT_HORIZ, + GA_RELVERIFY,TRUE, + GA_IMMEDIATE,TRUE,0]))=NIL THEN Raise(ER_GADGET) + listv:=[0,0,0,0]; listv[0]:=listv+4; listv[2]:=listv + AddTail(listv,[0,0,0,0,'aaaargh']:ln) + AddTail(listv,[0,0,0,0,'hmmmm']:ln) + IF (g:=CreateGadgetA(LISTVIEW_KIND,g, + [scr.wborleft+20,offy+40,155,100,NIL,NIL,2,0,visual,0]:newgadget, + [GTLV_SCROLLWIDTH,20, + GTLV_LABELS,listv,0]))=NIL THEN Raise(ER_GADGET) + IF (wnd:=OpenW(10,15,200,offy+165,$304 OR SCROLLERIDCMP,$E, + 'E gadtools dEmO',NIL,1,glist))=NIL THEN Raise(ER_WINDOW) + IF SetMenuStrip(wnd,menu)=FALSE THEN Raise(ER_MENUS) + Gt_RefreshWindow(wnd,NIL) +ENDPROC + +PROC closeinterface() + IF wnd THEN ClearMenuStrip(wnd) + IF menu THEN FreeMenus(menu) + IF visual THEN FreeVisualInfo(visual) + IF wnd THEN CloseWindow(wnd) + IF glist THEN FreeGadgets(glist) + IF scr THEN UnlockPubScreen(NIL,scr) + IF gadtoolsbase THEN CloseLibrary(gadtoolsbase) +ENDPROC + +PROC wait4message() + DEF mes:PTR TO intuimessage,g:PTR TO gadget + REPEAT + type:=0 + IF mes:=Gt_GetIMsg(wnd.userport) + type:=mes.class + IF type=IDCMP_MENUPICK + infos:=mes.code + ELSEIF (type=IDCMP_GADGETDOWN) OR (type=IDCMP_GADGETUP) + g:=mes.iaddress + infos:=g.gadgetid + ELSEIF type=IDCMP_REFRESHWINDOW + Gt_BeginRefresh(wnd) + Gt_EndRefresh(wnd,TRUE) + type:=0 + ELSEIF type<>IDCMP_CLOSEWINDOW + type:=0 + ENDIF + Gt_ReplyIMsg(mes) + ELSE + Wait(-1) + ENDIF + UNTIL type +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Reqs/ReqDemo.e b/amigae33a/E_v3.3a/Src/Src/Reqs/ReqDemo.e new file mode 100644 index 0000000..e3996b7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Reqs/ReqDemo.e @@ -0,0 +1,20 @@ +/* Another demo how to use other librarys from E. + a requester from the req.library. */ + +MODULE 'Req' + +PROC main() + IF reqbase:=OpenLibrary('req.library',2) + IF request('This is some standard requester ...','Positive','Negative') + request('I guessed that ...','Sure!','Get Real!') + ELSE + request('Try to be more positive!','I will','Why should I?') + ENDIF + CloseLibrary(reqbase) + ELSE + WriteF('Could not open req.library!\n') + ENDIF +ENDPROC + +PROC request(messy,yes,no) +ENDPROC TextRequest([messy,0,0,0,yes,no,'Huh?',0,0,$2FFFF,0,0]) diff --git a/amigae33a/E_v3.3a/Src/Src/Reqs/ReqToolsDemo.e b/amigae33a/E_v3.3a/Src/Src/Reqs/ReqToolsDemo.e new file mode 100644 index 0000000..ece764f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Reqs/ReqToolsDemo.e @@ -0,0 +1,35 @@ +/* Yet another demo to use other librarys from E. + Now we do some requesters from the reqtools.library. */ + +MODULE 'ReqTools' + +CONST FILEREQ=0,REQINFO=1 + +DEF colour,num=10,buf[120]:STRING,req + +PROC main() + IF reqtoolsbase:=OpenLibrary('reqtools.library',37) + RtEZRequestA('Lets test that handy ReqTools library, shall we ?', + 'Why?|Not again!|Yes! lets see that!',0,0,0) + IF (colour:=RtPaletteRequestA('Pick your colour:',0,0))=-1 + RtEZRequestA('Hard to choose eh?','Damn right.',0,0,0) /* colreq */ + ELSE + RtEZRequestA('Did you really like colour \d ?','Nope|Zure!',0,[colour],0) + ENDIF + RtEZRequestA('Now for some input ...','What?',0,0,0) + RtGetLongA({num},'Enter a number:',0,0) /* longreq */ + StrCopy(buf,'bla',ALL) + RtGetStringA(buf,100,'Enter something:',0,0) /* stringreq */ + RtEZRequestA('Lets have that nice filerequester ...', + 'More!more!|Boring!',0,0,0) + IF req:=RtAllocRequestA(FILEREQ,0) + buf[0]:=0 + RtFileRequestA(req,buf,'Pick your file:',0) + RtFreeRequest(req) + ENDIF + RtEZRequestA('That\as it.','Phew.',0,0,0) + CloseLibrary(reqtoolsbase) + ELSE + WriteF('Could not open reqtools.library!\n') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/filehook.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/filehook.e new file mode 100644 index 0000000..100e6a8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/filehook.e @@ -0,0 +1,98 @@ +-> filehook.e + +OPT PREPROCESS + +-> E-Note: eCodeASLHook() sets up an E PROC for use as an ASL hook function +-> (i.e., you can use globals and not worry about trashing registers). +MODULE 'asl', + 'other/ecode', + 'dos/dos', + 'dos/dosasl', + 'intuition/intuition', + 'libraries/asl', + 'utility/hooks' + +ENUM ERR_NONE, ERR_AFILE, ERR_ECODE, ERR_KICK, ERR_LIB, ERR_WIN + +RAISE ERR_AFILE IF AllocFileRequest()=NIL, + ERR_KICK IF KickVersion()=FALSE, + ERR_LIB IF OpenLibrary()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST DESTPATLENGTH=20 + +DEF window=NIL, sourcepattern, pat[DESTPATLENGTH]:ARRAY + +PROC main() HANDLE + DEF fr=NIL:PTR TO filerequester, myFunc + + -> This is the pattern matching string that the hook function uses + sourcepattern:='(#?.info)' + + KickVersion(37) -> E-Note: requires V37 + + aslbase:=OpenLibrary('asl.library', 37) + + -> This is a V37 dos.library function that turns a pattern matching string + -> into something the DOS pattern matching functions can understand. + ParsePattern(sourcepattern, pat, DESTPATLENGTH) + + -> Open a window that gets ACTIVEWINDOW events + window:=OpenWindowTagList(NIL, [WA_TITLE, 'ASL Hook Function Example', + WA_IDCMP, IDCMP_ACTIVEWINDOW, + WA_FLAGS, WFLG_DEPTHGADGET, + NIL]) + + fr:=AllocFileRequest() + -> E-Note: eCodeASLHook() sets up an E PROC for use as an ASL hook function + IF NIL=(myFunc:=eCodeASLHook({hookFunc})) THEN Raise(ERR_ECODE) + IF AslRequest(fr, [ASL_DIR, 'SYS:Utilities', + ASL_WINDOW, window, + ASL_TOPEDGE, 0, + ASL_HEIGHT, 200, + ASL_HAIL, 'Pick an icon, select save', + -> E-Note: use the value returned from aslhook() + ASL_HOOKFUNC, myFunc, + ASL_FUNCFLAGS, FILF_DOWILDFUNC OR FILF_DOMSGFUNC OR + FILF_SAVE, + ASL_OKTEXT, 'Save', + NIL]) + WriteF('PATH=\s FILE=\s\n', fr.drawer, fr.file) + WriteF('To combine the path and filename, copy the path\n') + WriteF('to a buffer, add the filename with Dos AddPart().\n') + ENDIF +EXCEPT DO + IF fr THEN FreeFileRequest(fr) + IF window THEN CloseWindow(window) + IF aslbase THEN CloseLibrary(aslbase) + SELECT exception + CASE ERR_AFILE; WriteF('Error: Could not allocate file request\n') + CASE ERR_ECODE; WriteF('Error: Ran out of memory in eCodeASLHook()\n') + CASE ERR_KICK; WriteF('Error: Requires V37\n') + CASE ERR_LIB; WriteF('Error: Could not open ASL library\n') + CASE ERR_WIN; WriteF('Error: Could not open window\n') + ENDSELECT +ENDPROC + +PROC hookFunc(type, obj:PTR TO anchorpath, fr) + DEF returnvalue + SELECT type + CASE FILF_DOMSGFUNC + -> We got a message meant for the window + WriteF('You activated the window\n') + RETURN obj + CASE FILF_DOWILDFUNC + -> We got an AnchorPath structure, should the requester display this file? + + -> MatchPattern() is a dos.library function that compares a matching + -> pattern (parsed by the ParsePattern() DOS function) to a string and + -> returns TRUE if they match. + returnvalue:=MatchPattern(pat, obj.info.filename) + + -> We have to negate MatchPattern()'s return value because the file + -> requester expects a zero for a match not a TRUE value + RETURN returnvalue=FALSE + ENDSELECT +ENDPROC + +vers: CHAR 0, '$VER: filehook 37.0', 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/filepat.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/filepat.e new file mode 100644 index 0000000..5f63319 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/filepat.e @@ -0,0 +1,82 @@ +-> filepat.e + +MODULE 'asl', + 'intuition/intuition', + 'intuition/screens', + 'graphics/modeid', + 'libraries/asl', + 'workbench/startup' + +ENUM ERR_NONE, ERR_ASL, ERR_KICK, ERR_LIB, ERR_SCRN, ERR_WIN + +RAISE ERR_ASL IF AllocAslRequest()=NIL, + ERR_KICK IF KickVersion()=FALSE, + ERR_LIB IF OpenLibrary()=NIL, + ERR_SCRN IF OpenScreenTagList()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +DEF screen=NIL, window=NIL + +PROC main() HANDLE + DEF fr=NIL:PTR TO filerequester, frargs:PTR TO wbarg, x + KickVersion(37) -> E-Note: requires V37 + aslbase:=OpenLibrary('asl.library',37) + screen:=OpenScreenTagList(NIL, [SA_DISPLAYID, HIRESLACE_KEY, + SA_TITLE, 'ASL Test Screen', + NIL]) + window:=OpenWindowTagList(NIL, + [WA_CUSTOMSCREEN, screen, + WA_TITLE, 'Demo Customscreen, File Pattern, Multi-select', + -> E-Note: C version uses obsolete tags + WA_FLAGS, WFLG_DEPTHGADGET OR WFLG_DRAGBAR, + NIL]) + fr:=AllocAslRequest(ASL_FILEREQUEST, + [ASL_HAIL, 'FilePat/MultiSelect Demo', + ASL_DIR, 'libs:', + ASL_FILE, 'asl.library', + + -> Initial pattern string for pattern matching + ASL_PATTERN, '~(rexx#?|math#?)', + + -> Enable multiselection and pattern match gadget + ASL_FUNCFLAGS, FILF_MULTISELECT OR FILF_PATGAD, + + -> This requester comes up on the screen of this window + -> (and uses window's message port, if any). + ASL_WINDOW, window, + NIL]) + + -> Put up file requester + IF AslRequest(fr, 0) + -> If the file requester's numargs field is not zero, the user + -> multiselected. The number of files is stored in numargs. + IF fr.numargs + -> arglist is an array of wbarg objects (see 'workbench/startup.m'). + -> Each entry in this array corresponds to one of the files the user + -> selected (in alphabetical order). + frargs:=fr.arglist + + -> The user multiselected, step through the list of selected files. + FOR x:=0 TO fr.numargs-1 + WriteF('Argument \d: PATH=\s FILE=\s\n', x, fr.drawer, frargs[x].name) + ENDFOR + ELSE + -> The user didn't multiselect, use the normal way to get the file name. + WriteF('PATH=\s FILE=\s\n', fr.drawer, fr.file) + ENDIF + ENDIF +EXCEPT DO + IF fr THEN FreeAslRequest(fr) + IF window THEN CloseWindow(window) + IF screen THEN CloseScreen(screen) + IF aslbase THEN CloseLibrary(aslbase) + SELECT exception + CASE ERR_ASL; WriteF('Error: Could not allocate ASL request\n') + CASE ERR_KICK; WriteF('Error: Requires V37\n') + CASE ERR_LIB; WriteF('Error: Could not open ASL library\n') + CASE ERR_SCRN; WriteF('Error: Could not open screen\n') + CASE ERR_WIN; WriteF('Error: Could not open window\n') + ENDSELECT +ENDPROC + +vers: CHAR 0, '$VER: filepat 37.0', 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/filereq.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/filereq.e new file mode 100644 index 0000000..edb71f5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/filereq.e @@ -0,0 +1,47 @@ +-> filereq.e + +MODULE 'asl', + 'libraries/asl' + +ENUM ERR_NONE, ERR_ASL, ERR_KICK, ERR_LIB + +RAISE ERR_ASL IF AllocAslRequest()=NIL, + ERR_KICK IF KickVersion()=FALSE, + ERR_LIB IF OpenLibrary()=NIL + +CONST MYLEFTEDGE=0, MYTOPEDGE=0, MYWIDTH=320, MYHEIGHT=400 + +PROC main() HANDLE + DEF fr:PTR TO filerequester + KickVersion(37) -> E-Note: requires V37 + aslbase:=OpenLibrary('asl.library',37) + fr:=AllocAslRequest(ASL_FILEREQUEST, + [ASL_HAIL, 'The RKM file requester', + ASL_HEIGHT, MYHEIGHT, + ASL_WIDTH, MYWIDTH, + ASL_LEFTEDGE, MYLEFTEDGE, + ASL_TOPEDGE, MYTOPEDGE, + ASL_OKTEXT, 'O KAY', + ASL_CANCELTEXT, 'not OK', + ASL_FILE, 'asl.library', + ASL_DIR, 'libs:', + NIL]) + IF AslRequest(fr, NIL) + WriteF('PATH=\s FILE=\s\n', fr.drawer, fr.file) + WriteF('To combine the path and filename, copy the path\n') + WriteF('to a buffer, add the filename with Dos AddPart().\n') + ELSE + -> E-Note: C version gets this wrong! + WriteF('User Cancelled\n') + ENDIF +EXCEPT DO + IF fr THEN FreeAslRequest(fr) + IF aslbase THEN CloseLibrary(aslbase) + SELECT exception + CASE ERR_ASL; WriteF('Error: Could not allocate ASL request\n') + CASE ERR_KICK; WriteF('Error: Requires V37\n') + CASE ERR_LIB; WriteF('Error: Could not open ASL library\n') + ENDSELECT +ENDPROC + +vers: CHAR 0, '$VER: filereq 37.0', 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/fontreq.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/fontreq.e new file mode 100644 index 0000000..460c5bb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/ASL/fontreq.e @@ -0,0 +1,61 @@ +-> fontreq.e + +MODULE 'asl', + 'graphics/text', + 'libraries/asl' + +ENUM ERR_NONE, ERR_ASL, ERR_KICK, ERR_LIB + +RAISE ERR_ASL IF AllocAslRequest()=NIL, + ERR_KICK IF KickVersion()=FALSE, + ERR_LIB IF OpenLibrary()=NIL + +PROC main() HANDLE + DEF fr=NIL:PTR TO fontrequester + KickVersion(37) -> E-Note: requires V37 + aslbase:=OpenLibrary('asl.library', 37) + fr:=AllocAslRequest(ASL_FONTREQUEST, + -> Tell the requester to use my custom mode names: + -> Our replacement strings for the "mode" cycle gadget. The first + -> string is the cycle gadget's label. The other strings are the + -> actual strings that will appear on the cycle gadget. + [ASL_MODELIST, ['RKM Modes', 'Mode 0', 'Mode 1', 'Mode 2', + 'Mode 3', 'Mode 4',NIL], + -> Supply initial values for requester + ASL_FONTNAME, 'topaz.font', + ASL_FONTHEIGHT, 11, + ASL_FONTSTYLES, FSF_BOLD OR FSF_ITALIC, + ASL_FRONTPEN, 0, + ASL_BACKPEN, 1, + + -> Only display font sizes between 8 and 14, inclusive. + ASL_MINHEIGHT, 8, + ASL_MAXHEIGHT, 14, + + -> Give all the gadgetry, but only display fixed width fonts + ASL_FUNCFLAGS, FONF_FRONTCOLOR OR FONF_BACKCOLOR OR + FONF_DRAWMODE OR FONF_STYLES OR FONF_FIXEDWIDTH, + NIL]) + -> Pop up the requester + IF AslRequest(fr, NIL) + -> The user selected something, report their choice + WriteF('\s\n YSize = \d Style = $\h Flags = $\h\n'+ + ' FPen = $\h BPen = $\h DrawMode = $\h\n', + fr.attr.name, fr.attr.ysize, fr.attr.style, fr.attr.flags, + fr.frontpen, fr.backpen, fr.drawmode) + ELSE + -> The user cancelled the requester, or some kind of error occurred + -> preventing the requester from opening. + WriteF('Request Cancelled\n') + ENDIF +EXCEPT DO + IF fr THEN FreeAslRequest(fr) + IF aslbase THEN CloseLibrary(aslbase) + SELECT exception + CASE ERR_ASL; WriteF('Error: Could not allocate ASL request\n') + CASE ERR_KICK; WriteF('Error: Requires V37\n') + CASE ERR_LIB; WriteF('Error: Could not open ASL library\n') + ENDSELECT +ENDPROC + +vers: CHAR 0, '$VER: fontreq 37.0', 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/cbio.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/cbio.e new file mode 100644 index 0000000..ec2b238 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/cbio.e @@ -0,0 +1,309 @@ +-> Cbio.e +-> +-> Provide standard clipboard device interface routines +-> such as Open, Close, Post, Read, Write, etc. +-> +-> NOTES: These functions are useful for writing and reading simple FTXT. +-> Writing and reading complex FTXT, ILBM, etc., requires more work. You +-> should use the iffparse.library to write and read FTXT, ILBM and other IFF +-> file types. When this code is used with older versions of the Amiga OS +-> (i.e., before V36) a memory loss of 536 bytes will occur due to bugs in the +-> clipboard device. + +->>> Header (globals) +OPT MODULE + +MODULE 'devices/clipboard', + 'exec/io', + 'exec/memory', + 'exec/ports', + 'amigalib/ports', + 'amigalib/io' + +ENUM ERR_NONE, ERR_DERR, ERR_DEV, ERR_DLEN, ERR_DOIO, ERR_IO, ERR_PORT + +RAISE ERR_DEV IF OpenDevice()<>0, + ERR_DOIO IF DoIO()<>0 + +-> E-Note: don't need size field since using NewM()/Dispose() +EXPORT OBJECT cbbuf + count -> Number of characters after stripping + mem +ENDOBJECT + +EXPORT CONST ID_FORM="FORM", ID_FTXT="FTXT", ID_CHRS="CHRS" +->>> + +->>> EXPORT PROC cbOpen(unit) +-> +-> FUNCTION +-> Opens the clipboard.device. A clipboard unit number must be passed in +-> as an argument. By default, the unit number should be 0 (currently +-> valid unit numbers are 0-255). +-> +-> RESULTS +-> A pointer to an initialised IOClipReq structure. An exception is +-> raised if the function fails ("CBOP") +EXPORT PROC cbOpen(unit) HANDLE + DEF mp=NIL, ior=NIL + IF NIL=(mp:=createPort(0,0)) THEN Raise(ERR_PORT) + IF NIL=(ior:=createExtIO(mp, SIZEOF ioclipreq)) THEN Raise(ERR_IO) + OpenDevice('clipboard.device', unit, ior, 0) +EXCEPT + IF ior THEN deleteExtIO(ior) + IF mp THEN deletePort(mp) + Raise("CBOP") +ENDPROC ior +->>> + +->>> EXPORT PROC cbClose(ior:PTR TO ioclipreq) +-> +-> FUNCTION +-> Close the clipboard.device unit which was opened via cbOpen(). +-> +EXPORT PROC cbClose(ior:PTR TO ioclipreq) + DEF mp + mp:=ior.message.replyport + CloseDevice(ior) + deleteExtIO(ior) + deletePort(mp) +ENDPROC +->>> + +->>> EXPORT PROC cbWriteFTXT(ior:PTR TO ioclipreq, string) +-> +-> FUNCTION +-> Write a NIL terminated string of text to the clipboard. The string +-> will be written in simple FTXT format. +-> +-> Note that this function pads odd length strings automatically to +-> conform to the IFF standard. +-> +-> RESULTS +-> If the write did not succeed an exception is raised ("CBWR") +-> +EXPORT PROC cbWriteFTXT(ior:PTR TO ioclipreq, string) HANDLE + DEF length, slen, odd + slen:=StrLen(string) + odd:=Odd(slen) -> Pad byte flag + length:=IF odd THEN slen+1 ELSE slen + + -> Initial set-up for offset, error, and clipid + ior.offset:=0 + ior.error:=0 + ior.clipid:=0 + + -> Create the IFF header information + writeLong(ior, 'FORM') -> 'FORM' + length:=length+12 -> + length '[size]FTXTCHRS' + writeLong(ior, {length}) -> Total length + writeLong(ior, 'FTXT') -> 'FTXT' + writeLong(ior, 'CHRS') -> 'CHRS' + writeLong(ior, {slen}) -> String length + + -> Write string + ior.data:=string + ior.length:=slen + ior.command:=CMD_WRITE + DoIO(ior) + + -> Pad if needed + IF odd + ior.data:='' + ior.length:=1 + DoIO(ior) + ENDIF + + -> Tell the clipboard we are done writing + ior.command:=CMD_UPDATE + DoIO(ior) + -> Check if error was set by any of the preceding IO requests + IF ior.error THEN Raise(ERR_DERR) +EXCEPT + Raise("CBWR") +ENDPROC +->>> + +->>> PROC writeLong(ior:PTR TO ioclipreq, ldata) +PROC writeLong(ior:PTR TO ioclipreq, ldata) + ior.data:=ldata + ior.length:=4 + ior.command:=CMD_WRITE + DoIO(ior) + IF ior.actual<>4 THEN Raise(ERR_DLEN) +ENDPROC +->>> + +->>> EXPORT PROC cbQueryFTXT(ior:PTR TO ioclipreq) +-> +-> FUNCTION +-> Check to see if the clipboard contains FTXT. If so, call cbReadCHRS() +-> one or more times until all CHRS chunks have been read. +-> +-> RESULTS +-> TRUE if the clipboard contains an FTXT chunk, else FALSE. +-> +-> NOTES +-> If this function returns TRUE, you must either call cbReadCHRS() until +-> cbReadCHRS() returns FALSE, or call cbReadDone() to tell the +-> clipboard.device that you are done reading. +-> +EXPORT PROC cbQueryFTXT(ior:PTR TO ioclipreq) HANDLE + DEF cbuff[4]:ARRAY OF LONG + + -> Initial set-up for offset, error, and clipid + ior.offset:=0 + ior.error:=0 + ior.clipid:=0 + + -> Look for 'FORM[size]FTXT' + ior.command:=CMD_READ + ior.data:=cbuff + ior.length:=12 + + DoIO(ior) + + -> Check to see if we have at least 12 bytes + IF ior.actual<>12 THEN Raise(ERR_DERR) + -> Check to see if it starts with 'FORM' + IF cbuff[]<>ID_FORM THEN Raise(ERR_DERR) + -> Check to see if it is 'FTXT' + IF cbuff[2]<>ID_FTXT THEN Raise(ERR_DERR) + -> E-Note: all checks passed... + RETURN TRUE +EXCEPT + -> It's not 'FORM[size]FTXT', so tell clipboard we are done + cbReadDone(ior) +ENDPROC FALSE +->>> + +->>> EXPORT PROC cbReadCHRS(ior:PTR TO ioclipreq) +-> +-> FUNCTION +-> Reads and returns the text in the next CHRS chunk (if any) from the +-> clipboard. +-> +-> Allocates memory to hold data in next CHRS chunk. +-> +-> RESULTS +-> Pointer to a cbbuf object, or NIL if no more CHRS chunks. An +-> exception ("CBRD") is raised if failure (e.g., not enough memory). +-> +-> ***Important*** +-> +-> The caller must free the returned buffer when done with the +-> data by calling cbFreeBuf(). +-> +-> NOTES +-> This function strips NIL bytes, however, a full reader may wish to +-> perform more complete checking to verify that the text conforms to the +-> IFF standard (stripping data as required). +-> +EXPORT PROC cbReadCHRS(ior:PTR TO ioclipreq) HANDLE + DEF chunk, size, gotchunk + -> Find next CHRS chunk + -> E-Note: loop until exception from reading or found non-empty CHRS chunk + LOOP + gotchunk:=FALSE + readLong(ior, {chunk}) + gotchunk:=TRUE + -> Is CHRS chunk? + IF chunk=ID_CHRS + -> Get size of chunk, and copy data + readLong(ior, {size}) + -> E-Note: C version is wrong, should keep looping if empty CHRS chunk + IF size THEN RETURN fillCBData(ior, size) + ELSE + -> If not, skip to next chunk + readLong(ior, {size}) + IF Odd(size) THEN INC size -> If odd size, add pad byte + ior.offset:=ior.offset+size + ENDIF + ENDLOOP +EXCEPT + cbReadDone(ior) -> Tell clipboard we are done + -> E-Note: pass on exception if there are chunks left + IF gotchunk THEN Raise("CBRD") +ENDPROC NIL +->>> + +->>> PROC readLong(ior:PTR TO ioclipreq, ldata) +PROC readLong(ior:PTR TO ioclipreq, ldata) + ior.command:=CMD_READ + ior.data:=ldata + ior.length:=4 + DoIO(ior) + IF ior.actual<>4 THEN Raise(ERR_DLEN) + IF ior.error THEN Raise(ERR_DERR) +ENDPROC +->>> + +->>> PROC fillCBData(ior:PTR TO ioclipreq, size) +PROC fillCBData(ior:PTR TO ioclipreq, size) HANDLE + DEF to, from, x, count, length, buf=NIL:PTR TO cbbuf + -> E-Note: clear mem to make sure buf.mem is NIL if NewM() succeeds + buf:=NewM(SIZEOF cbbuf, MEMF_PUBLIC OR MEMF_CLEAR) + length:=size + IF Odd(size) THEN INC length -> If odd size, read 1 more + buf.mem:=NewM(length+1, MEMF_PUBLIC) + + ior.command:=CMD_READ + ior.data:=buf.mem + ior.length:=length + + to:=buf.mem + count:=0 + + DoIO(ior) + IF ior.actual<>length THEN Raise(ERR_DLEN) + + -> Strip NIL bytes + from:=buf.mem + FOR x:=0 TO size-1 + IF from[] + to[]:=from[] + to++ + INC count + ENDIF + from++ + ENDFOR + to[]:=NIL -> NIL terminate buffer + buf.count:=count -> Cache count of chars in buf +EXCEPT + IF buf + IF buf.mem THEN Dispose(buf.mem) + Dispose(buf) + ENDIF + ReThrow() +ENDPROC buf +->>> + +->>> EXPORT PROC cbReadDone(ior:PTR TO ioclipreq) +-> +-> FUNCTION +-> Reads past end of clipboard file until actual is equal to 0. +-> This is tells the clipboard that we are done reading. +-> +EXPORT PROC cbReadDone(ior:PTR TO ioclipreq) HANDLE + DEF buffer[256]:ARRAY + ior.command:=CMD_READ + ior.data:=buffer + ior.length:=254 + -> Falls through immediately if actual=0 + WHILE ior.actual DO DoIO(ior) +EXCEPT + -> E-Note: ignore exceptions from DoIO() +ENDPROC +->>> + +->>> EXPORT PROC cbFreeBuf(buf:PTR TO cbbuf) +-> +-> FUNCTION +-> Frees a buffer allocated by cbReadCHRS(). +-> +EXPORT PROC cbFreeBuf(buf:PTR TO cbbuf) + Dispose(buf.mem) + Dispose(buf) +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/cbio.m b/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/cbio.m new file mode 100644 index 0000000..e893439 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/cbio.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/changehook_test.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/changehook_test.e new file mode 100644 index 0000000..0767cdc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/changehook_test.e @@ -0,0 +1,101 @@ +-> Changehook_Test.e +-> +-> Demonstrate the use of CBD_CHANGEHOOK command. The program will set a hook +-> and wait for the clipboard data to change. You must put something in the +-> clipboard in order for it to return. +-> +-> Requires Kickstart 36 or greater. + +->>> Header (globals) +MODULE '*cbio', + 'tools/inithook', + 'devices/clipboard', + 'dos/dos', + 'utility/hooks' + +DEF version=1 + +-> Data to pass around with the clipHook +OBJECT chData + task + clipID +ENDOBJECT + +-> E-Note: clip_port is not actually used... +DEF hook:hook, ch:chData +->>> + +->>> PROC clipHook(h:PTR TO hook, o, msg:PTR TO cliphookmsg) +PROC clipHook(h:PTR TO hook, o, msg:PTR TO cliphookmsg) + DEF ch:PTR TO chData + ch:=h.data + IF ch + -> Remember the ID of clip + ch.clipID:=msg.clipid + + -> Signal the task that started the hook + Signal(ch.task, SIGBREAKF_CTRL_E) + ENDIF +ENDPROC +->>> + +->>> PROC openCB(unit) +PROC openCB(unit) + DEF clipIO:PTR TO ioclipreq + -> Open clipboard + -> E-Note: the C version opens 0 instead of using the parameter! + clipIO:=cbOpen(unit) + -> Fill out the IORequest + clipIO.data:=hook + clipIO.length:=1 + clipIO.command:=CBD_CHANGEHOOK + + -> Set up the hook data + ch.task:=FindTask(NIL) + + -> Prepare the hook + inithook(hook, {clipHook}, ch) + + -> Start the hook + WriteF(IF DoIO(clipIO) THEN 'Unable to set hook\n' ELSE 'Hook set\n') +ENDPROC clipIO +->>> + +->>> PROC closeCB(clipIO:PTR TO ioclipreq) +PROC closeCB(clipIO:PTR TO ioclipreq) + -> Fill out the IO request + clipIO.data:=hook + clipIO.length:=0 + clipIO.command:=CBD_CHANGEHOOK + + -> Stop the hook + WriteF(IF DoIO(clipIO) THEN 'Unable to stop hook\n' ELSE 'Hook is stopped\n') + + cbClose(clipIO) +ENDPROC +->>> + +->>> PROC main() +PROC main() HANDLE + DEF clipIO=NIL, sig_rcvd + WriteF('Test v\d\n', version) + + clipIO:=openCB(0) + + sig_rcvd:=Wait(SIGBREAKF_CTRL_C OR SIGBREAKF_CTRL_E) + + IF sig_rcvd AND SIGBREAKF_CTRL_C + WriteF('^C received\n') + ENDIF + + IF sig_rcvd AND SIGBREAKF_CTRL_E + WriteF('Clipboard change, current ID is \d\n', ch.clipID) + ENDIF +EXCEPT DO + IF clipIO THEN closeCB(clipIO) + SELECT exception + CASE "CBOP"; WriteF('Error: could not open clipboard device\n') + ENDSELECT +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/clipdemo.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/clipdemo.e new file mode 100644 index 0000000..b60a338 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Clipboard/clipdemo.e @@ -0,0 +1,218 @@ +-> Clipdemo.e +-> +-> Demonstrate use of clipboard I/O. Uses general functions provided in the +-> module cbio. Important note: when this code is run with older versions of +-> the Amiga OS (i.e., before V36) a memory loss of 536 bytes will occur due +-> to bugs in the clipboard device. + +->>> Header (globals) +MODULE '*cbio', + 'devices/clipboard', + 'dos/dos', + 'exec/ports', + 'amigalib/ports', + 'other/split' + +ENUM ERR_NONE, ERR_ARGS, ERR_PORT + +ENUM FORGETIT, READIT, WRITEIT, POSTIT +->>> + +->>> PROC main() +PROC main() HANDLE + DEF todo, string, arglist:PTR TO LONG + todo:=FORGETIT + -> Very simple code to parse for arguments - will suffice for the sake of + -> this example + -> E-Note: use argSplit() to get arguments + IF NIL=(arglist:=argSplit()) THEN Raise(ERR_ARGS) + IF ListLen(arglist)>0 + IF StrCmp(arglist[], '-r') + todo:=READIT + ELSEIF StrCmp(arglist[], '-w') + todo:=WRITEIT + ELSEIF StrCmp(arglist[], '-p') + todo:=POSTIT + ENDIF + + string:=NIL + + IF ListLen(arglist)>1 THEN string:=arglist[1] + ENDIF + + SELECT todo + CASE READIT + readClip() + CASE POSTIT + postClip(string) + CASE WRITEIT + writeClip(string) + DEFAULT + WriteF('\nPossible switches are:\n\n'+ +'-r Read, and output contents of clipboard.\n\n'+ +'-w [string] Write string to clipboard.\n\n'+ +'-p [string] Write string to clipboard using the clipboard POST mechanism.\n\n'+ +' The Post can be satisfied by reading data from\n'+ +' the clipboard. Note that the message may never\n'+ +' be received if some other application posts, or\n') + WriteF( +' performs an immediate write to the clipboard.\n\n'+ +' To run this test you must run two copies of this example.\n'+ +' Use the -p switch with one to post data, and the -r switch\n'+ +' with another to read the data.\n\n'+ +' The process can be stopped by using the BREAK command,\n'+ +' in which case this example checks the CLIP write ID\n'+ +' to determine if it should write to the clipboard before\n'+ +' exiting.\n\n') + ENDSELECT +EXCEPT DO + SELECT exception + CASE ERR_ARGS; WriteF('Error: could not split arguments\n') + ENDSELECT +ENDPROC +->>> + +->>> PROC readClip() +-> Read, and output FTXT in the clipboard. +PROC readClip() HANDLE + DEF ior=NIL, buf:PTR TO cbbuf + -> Open clipboard.device unit 0 + ior:=cbOpen(0) + -> Look for FTXT in clipboard + IF cbQueryFTXT(ior) + -> Obtain a copy of the contents of each CHRS chunk + WHILE buf:=cbReadCHRS(ior) + -> Process data + WriteF('\s\n', buf.mem) + -> Free buffer allocated by cbReadCHRS() + cbFreeBuf(buf) + ENDWHILE + + -> The next call is not really needed if you are sure you read to the end of + -> the clip. + cbReadDone(ior) + ELSE + WriteF('No FTXT in clipboard\n') + ENDIF +EXCEPT DO + IF ior THEN cbClose(ior) + SELECT exception + CASE "CBOP"; WriteF('Error opening clipboard unit 0\n') + CASE "CBRD"; WriteF('Error reading from clipboard\n') + ENDSELECT + ReThrow() +ENDPROC +->>> + +->>> PROC writeClip(string) +-> Write a string to the clipboard +PROC writeClip(string) HANDLE + DEF ior=NIL:PTR TO ioclipreq + IF string=NIL + WriteF('No string argument given\n') + RETURN + ENDIF + + -> Open clipboard.device unit 0 + ior:=cbOpen(0) + cbWriteFTXT(ior, string) +EXCEPT DO + IF ior THEN cbClose(ior) + SELECT exception + CASE "CBWR"; WriteF('Error writing to clipboard: error = \d\n', ior.error) + CASE "CBOP"; WriteF('Error opening clipboard.device\n') + ENDSELECT + ReThrow() +ENDPROC +->>> + +->>> PROC postClip(string) +-> Write a string to the clipboard using the POST mechanism +-> +-> The POST mechanism can be used by applications which want to defer writing +-> text to the clipboard until another application needs it (by attempting to +-> read it via CMD_READ). However note that you still need to keep a copy of +-> the data until you receive a SatisfyMsg from the clipboard.device, or your +-> program exits. +-> +-> In most cases it is easier to write the data immediately. +-> +-> If your program receives the SatisfyMsg from the clipboard.device, you MUST +-> write some data. This is also how you reply to the message. +-> +-> If your program wants to exit before it has received the satisfymsg, you +-> must check the clipid field at the time of the post against the current +-> post ID which is obtained by sending the CBD_CURRENTWRITEID command. +-> +-> If the value in clipid (returned by CBD_CURRENTWRITEID) is greater than +-> your post ID, it means that some other application has performed a post, or +-> immediate write after your post, and that you're application will never +-> receive the satisfymsg. +-> +-> If the value in clipid (returned by CBD_CURRENTWRITEID) is equal to your +-> post ID, then you must write your data, and send CMD_UPDATE before exiting. +PROC postClip(string) HANDLE + DEF satisfy=NIL:PTR TO mp, sm:PTR TO satisfymsg, ior=NIL:PTR TO ioclipreq, + mustwrite, postID + IF string=NIL + WriteF('No string argument given\n') + RETURN + ENDIF + + IF NIL=(satisfy:=createPort(0, 0)) THEN Raise(ERR_PORT) + -> Open clipboard.device unit 0 + ior:=cbOpen(0) + mustwrite:=FALSE + + -> Notify clipboard we have data + ior.data:=satisfy + ior.clipid:=0 + ior.command:=CBD_POST + DoIO(ior) + + postID:=ior.clipid + + WriteF('\nClipID = \d\n', postID) + + -> Wait for CTRL-C break, or message from clipboard + Wait(SIGBREAKF_CTRL_C OR Shl(1, satisfy.sigbit)) + + -> See if we got a message, or a break + WriteF('Woke up\n') + + IF sm:=GetMsg(satisfy) + WriteF('Got a message from the clipboard\n\n') + + -> We got a message - we MUST write some data + mustwrite:=TRUE + -> E-Note: I think we should reply to the msg... + ReplyMsg(sm) + ELSE + -> Determine if we must write before exiting by checking to see if our + -> POST is still valid + ior.command:=CBD_CURRENTWRITEID + DoIO(ior) + + WriteF('CURRENTWRITEID = \d\n', ior.clipid) + + IF postID>=ior.clipid THEN mustwrite:=TRUE + ENDIF + + -> Write the string of text + IF mustwrite + cbWriteFTXT(ior, string) + ELSE + WriteF('No need to write to clipboard\n') + ENDIF +EXCEPT DO + IF ior THEN cbClose(ior) + IF satisfy THEN deletePort(satisfy) + SELECT exception + CASE ERR_PORT; WriteF('Error creating message port\n') + CASE "CBOP"; WriteF('Error opening clipboard.device\n') + CASE "CBWR"; WriteF('Error writing to clipboard\n') + ENDSELECT + ReThrow() +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/HotKey.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/HotKey.e new file mode 100644 index 0000000..d101df3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/HotKey.e @@ -0,0 +1,163 @@ +-> HotKey.e - Simple hot key commodity + +OPT PREPROCESS -> E-Note: we are using the CxXXX creation macros + +MODULE 'commodities', + 'icon', + 'amigalib/argarray', + 'dos/dos', + 'exec/ports', + 'libraries/commodities' + +ENUM ERR_NONE, ERR_ARG, ERR_BRKR, ERR_CRCX, ERR_CXERR, ERR_LIB, ERR_PORT + +RAISE ERR_BRKR IF CxBroker()=NIL, + ERR_CRCX IF CreateCxObj()=NIL, -> E-Note: the CxXXX macros use this + ERR_LIB IF OpenLibrary()=NIL, + ERR_PORT IF CreateMsgPort()=NIL + +CONST EVT_HOTKEY=1 + +DEF broker_mp=NIL:PTR TO mp, broker=NIL, filter=NIL, sender, translate, + cxsigflag + +PROC main() HANDLE + DEF hotkey, ttypes=NIL, msg + cxbase:=OpenLibrary('commodities.library', 37) + -> Open the icon.library for the support functions, argArrayXXX() + iconbase:=OpenLibrary('icon.library', 36) + broker_mp:=CreateMsgPort() + cxsigflag:=Shl(1, broker_mp.sigbit) + + -> argArrayInit() is a support function (from the 2.0 version of amiga.lib) + -> that makes it easy to read arguments from either a CLI or from Workbench's + -> ToolTypes. Because it uses icon.library, the library has to be open before + -> calling this function. argArrayDone() cleans up after this function. + -> E-Note: argArrayInit() needs no arguments: it uses global arg and wbmessage + IF (ttypes:=argArrayInit())=NIL THEN Raise(ERR_ARG) + + broker:=CxBroker([NB_VERSION, 0, + 'RKM HotKey', -> String to identify this broker + 'A Simple Hotkey', + 'A simple hot key commodity', + -> Don't want any new commodities starting with this name. + -> If someone tries it, let me know + NBU_UNIQUE OR NBU_NOTIFY, + -> argInt() (also in amiga.lib) searches through the array set up by + -> argArrayInit() for a specific ToolType. If it finds one, it returns the + -> numeric value of the number that followed the ToolType (e.g., + -> CX_PRIORITY=7). If it doesn't find the ToolType, it returns the default + -> value (the third argument). + 0, argInt(ttypes, 'CX_PRIORITY', 0), 0, + broker_mp, 0]:newbroker, NIL) + + -> argString() works just like argInt(), except it returns a pointer to a + -> string rather than an integer. In the example below, if there is no + -> ToolType 'HOTKEY', the function returns a pointer to 'rawkey control esc'. + hotkey:=argString(ttypes, 'HOTKEY', 'rawkey control esc') + + -> CxFilter() is a macro that creates a filter CxObject. This filter passes + -> input events that match the string pointed to by hotkey. + filter:=CxFilter(hotkey) + -> Add a CxObject to another's personal list + AttachCxObj(broker, filter) + + -> CxSender() creates a sender CxObject. Every time a sender gets a + -> CxMessage, it sends a new CxMessage to the port pointed to in the first + -> argument. CxSender()'s second argument will be the ID of any CxMessages + -> the sender sends to the port. The data pointer associated with the + -> CxMessage will point to a *COPY* of the InputEvent structure associated + -> with the orginal CxMessage. + sender:=CxSender(broker_mp, EVT_HOTKEY) + AttachCxObj(filter, sender) + + -> CxTranslate() creates a translate CxObject. When a translate CxObject + -> gets a CxMessage, it deletes the original CxMessage and adds a new input + -> event to the input.device's input stream after the Commodities input + -> handler. CxTranslate's argument points to an InputEvent structure from + -> which to create the new input event. In this example, the pointer is NIL, + -> meaning no new event should be introduced, which causes any event that + -> reaches this object to disappear from the input stream. + translate:=CxTranslate(NIL) + AttachCxObj(filter, translate) + + -> CxObjError() is a commodities.library function that returns the internal + -> accumulated error code of a CxObject. + IF CxObjError(filter)<>FALSE THEN Raise(ERR_CXERR) + + ActivateCxObj(broker, TRUE) + processMsg() + +EXCEPT DO + -> DeleteCxObjAll() is a commodities.library function that not only deletes + -> the CxObject pointed to in its argument, but it deletes all of the + -> CxObjects that are attached to it. + IF broker THEN DeleteCxObjAll(broker) + IF broker_mp + WHILE msg:=GetMsg(broker_mp) DO ReplyMsg(msg) + DeleteMsgPort(broker_mp) -> E-Note: C version incorrectly uses DeletePort() + ENDIF + IF ttypes THEN argArrayDone() + IF iconbase THEN CloseLibrary(iconbase) + IF cxbase THEN CloseLibrary(cxbase) + SELECT exception + CASE ERR_ARG; WriteF('Error: Could not init arg array\n') + CASE ERR_BRKR; WriteF('Error: Could not create broker\n') + CASE ERR_CRCX; WriteF('Error: Could not create CX object\n') + CASE ERR_CXERR; WriteF('Error: Could not activate broker\n') + CASE ERR_LIB; WriteF('Error: Could not open required library\n') + CASE ERR_PORT; WriteF('Error: Could not create message port\n') + ENDSELECT +ENDPROC + +PROC processMsg() + DEF msg, sigrcvd, msgid, msgtype, done=FALSE + REPEAT + sigrcvd:=Wait(SIGBREAKF_CTRL_C OR cxsigflag) + WHILE msg:=GetMsg(broker_mp) + msgid:=CxMsgID(msg) + msgtype:=CxMsgType(msg) + ReplyMsg(msg) + SELECT msgtype + CASE CXM_IEVENT + WriteF('A CXM_IEVENT, ') + SELECT msgid + CASE EVT_HOTKEY -> We got the message from the sender CxObject + WriteF('You hit the HotKey.\n') + DEFAULT + WriteF('unknown.\n') + ENDSELECT + CASE CXM_COMMAND + WriteF('A command: ') + SELECT msgid + CASE CXCMD_DISABLE + WriteF('CXCMD_DISABLE\n') + ActivateCxObj(broker, FALSE) + CASE CXCMD_ENABLE + WriteF('CXCMD_ENABLE\n') + ActivateCxObj(broker, TRUE) + CASE CXCMD_KILL + WriteF('CXCMD_KILL\n') + done:=TRUE + CASE CXCMD_UNIQUE + -> Commodities Exchange can be told not only to refuse to launch a + -> commodity with a name already in use but also can notify the + -> already running commodity that it happened. It does this by + -> sending a CXM_COMMAND with the ID set to CXMCMD_UNIQUE. If the + -> user tries to run a windowless commodity that is already running, + -> the user wants the commodity to shut down. + WriteF('CXCMD_UNIQUE\n') + done:=TRUE + DEFAULT + WriteF('Unknown msgid\n') + ENDSELECT + DEFAULT + WriteF('Unknown msgtype\n') + ENDSELECT + ENDWHILE + IF sigrcvd AND SIGBREAKF_CTRL_C + WriteF('CTRL C signal break\n') + done:=TRUE + ENDIF + UNTIL done +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/PopShell.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/PopShell.e new file mode 100644 index 0000000..c286ee9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/PopShell.e @@ -0,0 +1,153 @@ +-> PopShell.e - Simple hot key commodity + +OPT PREPROCESS -> E-Note: we are using the CxXXX creation macros + +MODULE 'commodities', + 'icon', + 'amigalib/argarray', + 'amigalib/cx', + 'devices/timer', + 'devices/inputevent', + 'dos/dos', + 'exec/ports', + 'libraries/commodities' + +ENUM ERR_NONE, ERR_ARGS, ERR_BRKR, ERR_CRCX, ERR_CXERR, ERR_HOT, ERR_IE, + ERR_LIB, ERR_PORT + +RAISE ERR_BRKR IF CxBroker()=NIL, + ERR_CRCX IF CreateCxObj()=NIL, -> E-Note: the CxXXX macros use this + ERR_LIB IF OpenLibrary()=NIL, + ERR_PORT IF CreateMsgPort()=NIL + +CONST EVT_HOTKEY=1 + +DEF broker_mp=NIL:PTR TO mp, broker=NIL, filter=NIL, + cxsigflag, ie=NIL:PTR TO inputevent + +PROC main() HANDLE + DEF hotkey, ttypes=NIL, msg, newshell + -> E-Note: we can use invertStringRev(), so we don't need to spell backwards! + newshell:='newshell\b' + cxbase:=OpenLibrary('commodities.library', 37) + iconbase:=OpenLibrary('icon.library', 36) + broker_mp:=CreateMsgPort() + cxsigflag:=Shl(1, broker_mp.sigbit) + -> E-Note: argArrayInit() uses global "wbmessage" and "arg" by default + -> E-Note: C version fails to check return value + IF NIL=(ttypes:=argArrayInit()) THEN Raise(ERR_ARGS) + hotkey:=argString(ttypes, 'HOTKEY', 'rawkey control esc') + + broker:=CxBroker([NB_VERSION, 0, -> E-Note: pad byte! + 'RKM PopShell', -> String to identify this broker + 'A Simple PopShell', + 'A simple PopShell commodity', + -> Don't want any new commodities starting with this name. + -> If someone tries it, let me know + NBU_UNIQUE OR NBU_NOTIFY, + 0, argInt(ttypes, 'CX_PRIORITY', 0), + 0, broker_mp, 0]:newbroker, NIL) + + -> hotKey() is an amigalib function that creates a filter, sender and + -> translate CxObject and connects them to report a hot key press and + -> delete its input event. + IF NIL=(filter:=hotKey(hotkey, broker_mp, EVT_HOTKEY)) THEN Raise(ERR_HOT) + + -> Add a CxObject to another's personal list + AttachCxObj(broker, filter) + IF CxObjError(filter)<>FALSE THEN Raise(ERR_CXERR) + + -> invertString() is an amigalib function that creates a linked list of input + -> events which would translate into the string passed to it. Note that it + -> puts the input events in the opposite order in which the corresponding + -> letters appear in the string. A translate CxObject expects them backwards. + -> E-Note: ...so use invertStringRev() and stay sane... + IF NIL=(ie:=invertStringRev(newshell, NIL)) THEN Raise(ERR_IE) + + ActivateCxObj(broker, TRUE) + processMsg() + +EXCEPT DO + -> We have to release the memory allocated by invertStringRev. + -> E-Note: ...well, this isn't really necessary since it uses NEW + IF ie THEN freeIEvents(ie) + -> DeleteCxObjAll() is a commodities.library function that not only deletes + -> the CxObject pointed to in its argument, but deletes all of the CxObjects + -> attached to it. + IF broker THEN DeleteCxObjAll(broker) + -> This amigalib function cleans up after argArrayInit() + IF ttypes THEN argArrayDone() + IF broker_mp -> Empty the port of all CxMsgs + WHILE msg:=GetMsg(broker_mp) DO ReplyMsg(msg) + DeleteMsgPort(broker_mp) + ENDIF + IF iconbase THEN CloseLibrary(iconbase) + IF cxbase THEN CloseLibrary(cxbase) + SELECT exception + CASE ERR_ARGS; WriteF('Error: Could not parse tooltypes/arguments\n') + CASE ERR_BRKR; WriteF('Error: Could not create broker\n') + CASE ERR_CRCX; WriteF('Error: Could not create CX object\n') + CASE ERR_CXERR; WriteF('Error: Could not activate broker\n') + CASE ERR_HOT; WriteF('Error: Could not create hot key\n') + CASE ERR_LIB; WriteF('Error: Could not open required library\n') + CASE ERR_PORT; WriteF('Error: Could not create message port\n') + ENDSELECT +ENDPROC + +PROC processMsg() + DEF msg, sigrcvd, msgid, msgtype, done=FALSE + REPEAT + sigrcvd:=Wait(SIGBREAKF_CTRL_C OR cxsigflag) + + WHILE msg:=GetMsg(broker_mp) + msgid:=CxMsgID(msg) + msgtype:=CxMsgType(msg) + ReplyMsg(msg) + + SELECT msgtype + CASE CXM_IEVENT + WriteF('A CXM_EVENT, ') + SELECT msgid + CASE EVT_HOTKEY + -> We got the message from the sender CxObject + WriteF('You hit the HotKey.\n') + -> Add the string "newshell" to input * stream. If a shell gets it, + -> it'll open a new shell. + AddIEvents(ie) + DEFAULT + WriteF('unknown.\n') + ENDSELECT + CASE CXM_COMMAND + WriteF('A command: ') + SELECT msgid + CASE CXCMD_DISABLE + WriteF('CXCMD_DISABLE\n') + ActivateCxObj(broker, FALSE) + CASE CXCMD_ENABLE + WriteF('CXCMD_ENABLE\n') + ActivateCxObj(broker, TRUE) + CASE CXCMD_KILL + WriteF('CXCMD_KILL\n') + done:=TRUE + CASE CXCMD_UNIQUE + -> Commodities Exchange can be told not only to refuse to launch a + -> commodity with a name already in use but also can notify the + -> already running commodity that it happened. It does this by + -> sending a CXM_COMMAND with the ID set to CXMCMD_UNIQUE. If the + -> user tries to run a windowless commodity that is already running, + -> the user wants the commodity to shut down. + WriteF('CXCMD_UNIQUE\n') + done:=TRUE + DEFAULT + WriteF('Unknown msgid\n') + ENDSELECT + DEFAULT + WriteF('Unknown msgtype\n') + ENDSELECT + ENDWHILE + IF sigrcvd AND SIGBREAKF_CTRL_C + done:=TRUE + WriteF('CTRL C signal break\n') + ENDIF + UNTIL done +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/broker.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/broker.e new file mode 100644 index 0000000..b860754 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/broker.e @@ -0,0 +1,113 @@ +-> broker.e - Simple skeletal example of opening a broker. + +MODULE 'commodities', + 'dos/dos', + 'exec/libraries', + 'exec/ports', + 'libraries/commodities' + +ENUM ERR_NONE, ERR_ARG, ERR_BRKR, ERR_CXERR, ERR_LIB, ERR_PORT + +RAISE ERR_BRKR IF CxBroker()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_PORT IF CreateMsgPort()=NIL + +DEF broker=NIL, broker_mp=NIL:PTR TO mp, cxsigflag + +PROC main() HANDLE + DEF msg + -> Before bothering with anything else, open the library + cxbase:=OpenLibrary('commodities.library', 37) + -> Commodities talks to a Commodities application through an Exec Message + -> port, which the application provides + broker_mp:=CreateMsgPort() + + -> The commodities.library function CxBroker() adds a broker to the master + -> list. It takes two arguments, a pointer to a NewBroker structure and a + -> pointer to a LONG. The NewBroker structure contains information to set + -> up the broker. If the second argument is not NIL, CxBroker will fill it + -> in with an error code. + broker:=CxBroker( + [NB_VERSION, -> Version of the NewBroker object + 0, -> E-Note: pad byte + 'RKM broker', -> Name: commodities uses for this commodity + 'Broker', -> Title of commodity that appears in CXExchange + 'A simple example of a broker', -> Description + 0, -> Unique: tells CX not to launch a commodity with the same name + 0, -> Flags: tells CX if this commodity has a window + 0, -> Pri: this commodity's priority + 0, -> E-Note: pad byte + broker_mp, -> Port: mp CX talks to + 0 -> ReservedChannel: reserved for later use + ]:newbroker, NIL) + cxsigflag:=Shl(1, broker_mp.sigbit) + + -> After it's set up correctly, the broker has to be activated + ActivateCxObj(broker, TRUE) + + -> The main processing loop + processMsg() + +EXCEPT DO + -> It's time to clean up. Start by removing the broker from the Commodities + -> master list. The DeleteCxObjAll() function will take care of removing a + -> CxObject and all those connected to it from the Commodities network + IF broker THEN DeleteCxObj(broker) + IF broker_mp + -> Empty the port of CxMsgs + WHILE msg:=GetMsg(broker_mp) DO ReplyMsg(msg) + DeleteMsgPort(broker_mp) -> E-Note: C version incorrectly uses DeletePort() + ENDIF + IF cxbase THEN CloseLibrary(cxbase) + SELECT exception + CASE ERR_BRKR; WriteF('Error: Could not create broker\n') + CASE ERR_CXERR; WriteF('Error: Could not activate broker\n') + CASE ERR_LIB; WriteF('Error: Could not open commodities.library\n') + CASE ERR_PORT; WriteF('Error: Could not create message port\n') + ENDSELECT +ENDPROC + +PROC processMsg() + DEF msg, sigrcvd, msgid, msgtype, done=FALSE + REPEAT + -> Wait for something to happen + sigrcvd:=Wait(SIGBREAKF_CTRL_C OR cxsigflag) + + -> Process any messages + WHILE msg:=GetMsg(broker_mp) + -> Extract any necessary information from the CxMessage and return it + msgid:=CxMsgID(msg) + msgtype:=CxMsgType(msg) + ReplyMsg(msg) + + SELECT msgtype + CASE CXM_IEVENT + -> Shouldn't get any of these in this example + CASE CXM_COMMAND + -> Commodities has sent a command + WriteF('A command: ') + SELECT msgid + CASE CXCMD_DISABLE + WriteF('CXCMD_DISABLE\n') + -> The user clicked CX Exchange disable gadget, better disable + ActivateCxObj(broker, FALSE) + CASE CXCMD_ENABLE + -> User clicked enable gadget + WriteF('CXCMD_ENABLE\n') + ActivateCxObj(broker, TRUE) + CASE CXCMD_KILL + -> User clicked kill gadget, better quit + WriteF('CXCMD_KILL\n') + done:=TRUE + ENDSELECT + DEFAULT + WriteF('Unknown msgtype\n') + ENDSELECT + ENDWHILE + -> Test to see if user tried to break + IF sigrcvd AND SIGBREAKF_CTRL_C + done:=TRUE + WriteF('CTRL C signal break\n') + ENDIF + UNTIL done +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/divert.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/divert.e new file mode 100644 index 0000000..f4868a3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Commodities/divert.e @@ -0,0 +1,163 @@ +-> divert.e - commodity to monitor user inactivity + +OPT PREPROCESS -> E-Note: we are using the CxXXX creation macros + +MODULE 'icon', + 'commodities', + 'amigalib/argarray', + 'other/ecode', + 'devices/inputevent', + 'dos/dos', + 'exec/libraries', + 'exec/ports', + 'libraries/commodities' + +ENUM ERR_NONE, ERR_ARGS, ERR_BRKR, ERR_CRCX, ERR_CXERR, ERR_ECODE, ERR_LIB, + ERR_PORT, ERR_SIG + +RAISE ERR_BRKR IF CxBroker()=NIL, + ERR_CRCX IF CreateCxObj()=NIL, -> E-Note: the CxXXX macros use this + ERR_LIB IF OpenLibrary()=NIL, + ERR_PORT IF CreateMsgPort()=NIL, + ERR_SIG IF AllocSignal()=-1 + +CONST TIMER_CLICKS=100 + +DEF broker_mp=NIL:PTR TO mp, broker=NIL, cocustom=NIL, cosignal=NIL, + task, cxsigflag, signal=-1, cxobjsignal + +-> E-Note: the C static used in the custom function is just a global variable +DEF time=0 + +PROC main() HANDLE + DEF ttypes=NIL, msg, cxfunc + cxbase:=OpenLibrary('commodities.library', 37) + -> Open the icon.library for support functions, argXXX() + iconbase:=OpenLibrary('icon.library', 36) + broker_mp:=CreateMsgPort() + cxsigflag:=Shl(1, broker_mp.sigbit) + + -> argArrayInit() is a support function (in the 2.0 version of amigalib) + -> that makes it easy to read arguments from either a CLI or from + -> Workbench's ToolTypes. Because it uses icon.library, the library has + -> to be open before before calling this function. argArrayDone() cleans + -> up after this function. + -> E-Note: uses global "wbmessage" and "arg" so it needs no arguments + ttypes:=argArrayInit() + + broker:=CxBroker([NB_VERSION, 0, 'Divert', -> String to identify this broker + 'Divert', 'Show divert', + -> Don't want any new commodities starting with this name. + -> If someone tries it, let me know + NBU_UNIQUE OR NBU_NOTIFY, 0, + -> argInt() (in amigalib) searches through the array set up by argArrayInit() + -> for a specific ToolType. If it finds one, it returns the numeric value of + -> the number that followed the ToolType (e.g., CX_PRIORITY=7). If it doesn't + -> find the ToolType, it returns the default value (the third argument). + argInt(ttypes, 'CX_PRIORITY', 0), + 0, broker_mp, 0]:newbroker, NIL) + + -> CxCustom() takes two arguments, a pointer to the custom function and an + -> ID. Commodities Exchange will assign that ID to any CxMsg passed to the + -> custom function. + -> E-Note: eCodeCxCustom() protects an E function so you can use it as a + -> CX custom function + IF NIL=(cxfunc:=eCodeCxCustom({cxFunction})) THEN Raise(ERR_ECODE) + cocustom:=CxCustom(cxfunc, 0) + AttachCxObj(broker, cocustom) + + -> Allocate a signal bit for the signal CxObj + signal:=AllocSignal(-1) + -> Set up the signal mask + cxobjsignal:=Shl(1, signal) + cxsigflag:=cxsigflag OR cxobjsignal + + -> CxSignal takes two arguments, a pointer to the task to signal (normally + -> the commodity) and the number of the signal bit the commodity acquired + -> to signal with. + task:=FindTask(NIL) + cosignal:=CxSignal(task, signal) + AttachCxObj(cocustom, cosignal) + ActivateCxObj(broker, TRUE) + processMsg() + +EXCEPT DO + IF signal<>-1 THEN FreeSignal(signal) + -> DeleteCxObjAll() is a commodities.library function that not only deletes + -> the CxObject pointed to in its argument, but it deletes all of the + -> CxObjects that are attached to it. + IF broker THEN DeleteCxObjAll(broker) + -> This amigalib function cleans up after argArrayInit() + IF ttypes THEN argArrayDone() + IF broker_mp + -> Empty the port of all CxMsgs + WHILE msg:=GetMsg(broker_mp) DO ReplyMsg(msg) + DeleteMsgPort(broker_mp) -> E-Note: C version incorrectly uses DeletePort() + ENDIF + IF iconbase THEN CloseLibrary(iconbase) + IF cxbase THEN CloseLibrary(cxbase) + SELECT exception + CASE ERR_ARGS; WriteF('Error: Could not parse tooltypes/arguments\n') + CASE ERR_BRKR; WriteF('Error: Could not create broker\n') + CASE ERR_CRCX; WriteF('Error: Could not create CX object\n') + CASE ERR_CXERR; WriteF('Error: Could not activate broker\n') + CASE ERR_ECODE; WriteF('Error: Ran out of memory in eCodeCxCustom()\n') + CASE ERR_LIB; WriteF('Error: Could not open commodities.library\n') + CASE ERR_PORT; WriteF('Error: Could not create message port\n') + CASE ERR_SIG; WriteF('Error: Could not allocate signal\n') + ENDSELECT +ENDPROC + +PROC processMsg() + DEF msg, sigrcvd, msgid, done=FALSE + REPEAT + sigrcvd:=Wait(SIGBREAKF_CTRL_C OR cxsigflag) + + WHILE msg:=GetMsg(broker_mp) + msgid:=CxMsgID(msg) + ReplyMsg(msg) + + SELECT msgid + CASE CXCMD_DISABLE + ActivateCxObj(broker, FALSE) + CASE CXCMD_ENABLE + ActivateCxObj(broker, TRUE) + CASE CXCMD_KILL + done:=TRUE + CASE CXCMD_UNIQUE + done:=TRUE + ENDSELECT + ENDWHILE + + IF sigrcvd AND SIGBREAKF_CTRL_C THEN done:=TRUE + + -> Check to see if the signal CxObj signalled us. + IF sigrcvd AND cxobjsignal THEN WriteF('Got Signal\n') + UNTIL done +ENDPROC + +-> The custom function for the custom CxObject. Any code for a custom CxObj +-> must be short and sweet because it runs as part of the input.device task. +PROC cxFunction(cxm, co) + DEF ie:PTR TO inputevent + + -> Get the struct InputEvent associated with this CxMsg. Unlike the + -> InputEvent extracted from a CxSender's CxMsg, this is a *REAL* input + -> event, be careful with it. + ie:=CxMsgData(cxm) + + -> This custom function counts the number of timer events that go by while + -> no other input events occur. If it counts more than a certain amount of + -> timer events, it clears the count and diverts the timer event CxMsg to the + -> custom object's personal list. If an event besides a timer event passes + -> by, the timer event count is reset. + IF ie.class=IECLASS_TIMER + time++ + IF time>=TIMER_CLICKS + time:=0 + DivertCxMsg(cxm, co, co) + ENDIF + ELSE + time:=0 + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Console/AskKeymap.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Console/AskKeymap.e new file mode 100644 index 0000000..8303d4a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Console/AskKeymap.e @@ -0,0 +1,65 @@ +-> AskKeymap.e + +->>> Header (globals) +MODULE 'devices/console', + 'devices/conunit', + 'devices/keymap', + 'exec/io', + 'exec/memory', + 'exec/ports' + +ENUM ERR_NONE, ERR_DEV, ERR_IO, ERR_PORT + +RAISE ERR_DEV IF OpenDevice()<>0, + ERR_IO IF CreateIORequest()=NIL, + ERR_PORT IF CreateMsgPort()=NIL +->>> + +->>> PROC main() +PROC main() HANDLE + DEF consoleMP:PTR TO mp, consoleIO:PTR TO iostd, keymap:PTR TO keymap, + i, j, prt, dev_open=FALSE + -> Release 2 (V36) or a later version of the OS is required + KickVersion(36) + -> Create the message port + consoleMP:=CreateMsgPort() + -> Create the IORequest + consoleIO:=CreateIORequest(consoleMP, SIZEOF iostd) + -> Open Console device + OpenDevice('console.device', CONU_LIBRARY, consoleIO, 0) + dev_open:=TRUE + -> Allocate memory for the keymap + keymap:=NewM(SIZEOF keymap, MEMF_PUBLIC OR MEMF_CLEAR) + -> Device opened, send query command to it + consoleIO.length:=SIZEOF keymap + -> Where to put it + consoleIO.data:=keymap + consoleIO.command:=CD_ASKKEYMAP + IF DoIO(consoleIO) + -> Inform user that CD_ASKKEYMAP failed + WriteF('CD_ASKKEYMAP failed. Error - \d\n', consoleIO.error) + ELSE + -> Print values for top row of keyboard + prt:=keymap.lokeymap + WriteF('Result of CD_ASKKEYMAP for top row of keyboard\n\n' + + '\tShift\n' + + '\tAlt\tAlt\tShift\tNo Qualifier\n') + FOR j:=0 TO 13 + FOR i:=0 TO 3 DO WriteF('\t\c', prt[]++) + WriteF('\n') + ENDFOR + ENDIF +EXCEPT DO + IF keymap THEN Dispose(keymap) + IF dev_open THEN CloseDevice(consoleIO) + IF consoleIO THEN DeleteIORequest(consoleIO) + IF consoleMP THEN DeleteMsgPort(consoleMP) + SELECT exception + CASE ERR_DEV; WriteF('Error: could not open console device\n') + CASE ERR_IO; WriteF('Error: could not create I/O\n') + CASE ERR_PORT; WriteF('Error: could not create port\n') + CASE "MEM"; WriteF('Error: ran out of memory\n') + ENDSELECT +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Console/Console.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Console/Console.e new file mode 100644 index 0000000..ee8a474 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Console/Console.e @@ -0,0 +1,230 @@ +-> Console.e +-> +-> Example of opening a window and using the console device to send text and +-> control sequences to it. The example can be easily modified to do +-> additional control sequences. + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'devices/console', + 'exec/io', + 'exec/ports', + 'intuition/intuition', + 'intuition/screens', + 'amigalib/io', + 'amigalib/ports' + +ENUM ERR_NONE, ERR_DEV, ERR_IO, ERR_PORT + +RAISE ERR_DEV IF OpenDevice()<>0 + +-> Note - using two character ESC[. Hex 9B could be used instead +#define RESETCON '\ec' +#define CURSOFF '\e[0 p' +#define CURSON '\e[ p' +#define DELCHAR '\e[P' + +-> SGR (set graphic rendition) +#define COLOR02 '\e[32m' +#define COLOR03 '\e[33m' +#define ITALICS '\e[3m' +#define BOLD '\e[1m' +#define UNDERLINE '\e[4m' +#define NORMAL '\e[0m' + +DEF win=NIL:PTR TO window, writeReq=NIL:PTR TO iostd, writePort=NIL:PTR TO mp, + readReq=NIL:PTR TO iostd, readPort=NIL:PTR TO mp, openedConsole=FALSE +->>> + +->>> PROC main() +PROC main() HANDLE + DEF winmsg:PTR TO intuimessage, signals, conreadsig, windowsig, lch, + inControl=0, going=TRUE, ch, ibuf, obuf[200]:STRING, error, class + + -> Create reply port and io block for writing to console + IF NIL=(writePort:=createPort('RKM.console.write', 0)) THEN Raise(ERR_PORT) + IF NIL=(writeReq:=createExtIO(writePort, SIZEOF iostd)) THEN Raise(ERR_IO) + + -> Create reply port and io block for reading from console + IF NIL=(readPort:=createPort('RKM.console.read', 0)) THEN Raise(ERR_PORT) + IF NIL=(readReq:=createExtIO(readPort, SIZEOF iostd)) THEN Raise(ERR_IO) + + -> Open a window + win:=OpenWindow([10, 10, 620, 180, -1, -1, IDCMP_CLOSEWINDOW, + WFLG_DEPTHGADGET OR WFLG_SIZEGADGET OR WFLG_DRAGBAR OR + WFLG_CLOSEGADGET OR WFLG_SMART_REFRESH OR WFLG_ACTIVATE, + NIL, NIL, 'Console Test', NIL, NIL, + 100, 45, 640, 200, WBENCHSCREEN]:nw) + + -> Now, attach a console to the window + openConsole(writeReq, readReq, win) + openedConsole:=TRUE + + -> Demonstrate some console escape sequences + conPuts(writeReq, 'Here''s some normal text\n') + StringF(obuf, '\s\sHere''s some text in color 3 and italics\n', + COLOR03, ITALICS) + conPuts(writeReq, obuf) + conPuts(writeReq, NORMAL) + Delay(50) -> Delay for dramatic effect + + conPuts(writeReq, 'We will now delete this asterisk =*=') + Delay(50) + conPuts(writeReq, {bspace}) -> Backspace twice + Delay(50) + conPuts(writeReq, DELCHAR) -> Delete the character + Delay(50) + + queueRead(readReq, {ibuf}) -> Send the first console read request + + conPuts(writeReq, '\n\nNow reading console\n') + conPuts(writeReq, 'Type some keys. Close window when done.\n\n') + + conreadsig:=Shl(1, readPort.sigbit) + windowsig:=Shl(1, win.userport.sigbit) + WHILE going + -> A character, or an IDCMP msg, or both could wake us up + signals:=Wait(conreadsig OR windowsig) + + -> If a console signal was received, get the character + IF signals AND conreadsig + IF -1<>(lch:=conMayGetChar(readPort, {ibuf})) + ch:=lch + -> Show hex and ascii (if printable) for char we got. If you want to + -> parse received control sequences, such as function or Help keys, + -> you would buffer control sequences as you receive them, starting to + -> buffer whenever you receive $9B (or $1B[ for user-typed sequences) + -> and ending when you receive a valid terminating character for the + -> type of control sequence you are receiving. For CSI sequences, + -> valid terminating characters are generally $40 through $7E. In our + -> example, InControl has the following values: 0 = no, 1 = have $1B, + -> 2 = have $9B OR $1B and [, 3 = now inside control sequence, + -> -1 = normal end esc, -2 = non-CSI(no [) $1B end esc + -> NOTE - a more complex parser is required to recognize other types + -> of control sequences. + + -> $1B ESC not followed by "[", is not CSI seq + IF inControl=1 THEN (inControl:=IF ch="[" THEN 2 ELSE -2) + IF (ch=$9B) OR (ch=$1B) -> Control seq starting + inControl:=IF ch=$1B THEN 1 ELSE 2 + conPuts(writeReq, '=== Control Seq ===\n') + ENDIF + -> We'll show the value of this char we received + IF ((ch>=$1F) AND (ch<=$7E)) OR (ch>=$A0) + StringF(obuf, 'Received: hex $\z\h[2] = \c\n', ch, ch) + ELSE + StringF(obuf, 'Received: hex $\z\h[2]\n', ch) + ENDIF + conPuts(writeReq, obuf) + ENDIF + ENDIF + + -> If IDCMP messages received, handle them + IF signals AND windowsig + -> We have to ReplyMsg these when done with them + WHILE winmsg:=GetMsg(win.userport) + class:=winmsg.class + SELECT class + CASE IDCMP_CLOSEWINDOW + going:=FALSE + ENDSELECT + ReplyMsg(winmsg) + ENDWHILE + ENDIF + ENDWHILE + + -> We always have an outstanding queued read request so we must abort it if + -> it hasn't completed, and we must remove it. + IF CheckIO(readReq)=FALSE THEN AbortIO(readReq) + WaitIO(readReq) -> Clear it from our replyport + +EXCEPT DO + IF openedConsole THEN closeConsole(writeReq) + IF win THEN CloseWindow(win) + IF readReq THEN deleteExtIO(readReq) + IF readPort THEN deletePort(readPort) + IF writeReq THEN deleteExtIO(writeReq) + IF writePort THEN deletePort(writePort) + SELECT exception + CASE ERR_DEV; WriteF('Error: could not open console device\n') + CASE ERR_IO; WriteF('Error: could not create I/O\n') + CASE ERR_PORT; WriteF('Error: could not create port\n') + ENDSELECT +ENDPROC + +-> E-Note: simple way to get a string with two backspaces +bspace: CHAR 8, 8, 0 +->>> + +->>> PROC openConsole(writereq:PTR TO iostd, readReq:PTR TO iostd, window) +-> Attach console device to an open Intuition window. +-> E-Note: This function will raise an exception if the console device is not +-> opened correctly. +PROC openConsole(writereq:PTR TO iostd, readreq:PTR TO iostd, window) + DEF error + writereq.data:=window + writereq.length:=SIZEOF window + error:=OpenDevice('console.device', 0, writereq, 0) + readreq.device:=writereq.device -> Clone required parts + readreq.unit:=writereq.unit +ENDPROC error +->>> + +->>> PROC closeConsole(writereq) +PROC closeConsole(writereq) IS CloseDevice(writereq) +->>> + +->>> PROC conPutChar(writereq:PTR TO iostd, char) +-> Output a single character to a specified console. +PROC conPutChar(writereq:PTR TO iostd, char) + writereq.command:=CMD_WRITE + -> E-Note: use typed list to get address of the CHAR in the LONG 'char' + writereq.data:=[char]:CHAR + writereq.length:=1 + DoIO(writereq) + -> Command works because DoIO blocks until command is done (otherwise + -> pointer to string could become invalid in the meantime). +ENDPROC +->>> + +->>> PROC conWrite(writereq:PTR TO iostd, string, length) +-> Output a stream of known length to a console. +PROC conWrite(writereq:PTR TO iostd, string, length) + writereq.command:=CMD_WRITE + writereq.data:=string + writereq.length:=length + DoIO(writereq) +ENDPROC +->>> + +->>> PROC conPuts(writereq:PTR TO iostd, string) +-> Output a NIL-terminated string of characters to a console. +PROC conPuts(writereq:PTR TO iostd, string) + writereq.command:=CMD_WRITE + writereq.data:=string + writereq.length:=-1 -> This means print until terminating NIL + DoIO(writereq) +ENDPROC +->>> + +->>> PROC queueRead(readreq:PTR TO iostd, whereto) +-> Queue up a read request to console, passing it pointer to a buffer into +-> which it can read the character +PROC queueRead(readreq:PTR TO iostd, whereto) + readreq.command:=CMD_READ + readreq.data:=whereto + readreq.length:=1 + SendIO(readreq) +ENDPROC +->>> + +->>> PROC conMayGetChar(msgport, whereto) +-> Check if a character has been received. If none, return -1 +PROC conMayGetChar(msgport, whereto) + DEF temp, readreq:PTR TO iostd + IF NIL=(readreq:=GetMsg(msgport)) THEN RETURN -1 + temp:=whereto[] -> Get the character... + queueRead(readreq, whereto) -> ...then re-use the request block +ENDPROC temp +->>> diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Console/console b/amigae33a/E_v3.3a/Src/Src/Rkrm/Console/console new file mode 100644 index 0000000..de9d431 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Rkrm/Console/console differ diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/DeviceIO/deviceuse.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/DeviceIO/deviceuse.e new file mode 100644 index 0000000..ca08fc0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/DeviceIO/deviceuse.e @@ -0,0 +1,85 @@ +-> DeviceUse.e - an example of using an Amiga device (here, serial device) +-> - attempt to create a message port with createPort() (from amigalib) +-> - attempt to create the I/O request with ereateExtIO() (from amigalib) +-> - attempt to open the serial device with Exec OpenDevice() +-> +-> If successful, use the serial command SDCMD_QUERY, then reverse our steps. +-> If we encounter an error at any time, we will gracefully exit. Note that +-> applications which require at least V37 OS should use the Exec functions +-> CreateMsgPort()/DeleteMsgPort() and CreateIORequest()/DeleteIORequest() +-> instead of the similar amigalib functions which are used in this example. + +OPT PREPROCESS + +MODULE 'amigalib/io', + 'amigalib/ports', + 'devices/serial', + 'exec/io', + 'exec/ports' + +ENUM ERR_NONE, ERR_DEV, ERR_IO, ERR_PORT + +RAISE ERR_DEV IF OpenDevice()<>0 + +PROC main() HANDLE + DEF serialMP=NIL:PTR TO mp, serialIO=NIL:PTR TO ioextser, + reply:PTR TO ioextser + -> Create the message port. + IF NIL=(serialMP:=createPort(NIL,NIL)) THEN Raise(ERR_PORT) + + -> Create the I/O request. Note that 'devices/serial' defines the type of + -> io required by the serial device--an ioextser. Many devices require + -> specialised extended IO requests which start with an embedded io object. + -> E-Note: ignore the rubbish about casting + IF NIL=(serialIO:=createExtIO(serialMP, SIZEOF ioextser)) THEN Raise(ERR_IO) + + -> Open the serial device (non-zero return value means failure here). + OpenDevice(SERIALNAME, 0, serialIO, 0) + + -> Device is open + serialIO.iostd.command:=SDCMD_QUERY + -> DoIO - demonstrates synchronous device use, returns error or 0. + IF DoIO(serialIO) + WriteF('Query failed. Error - \d\n', serialIO.iostd.error) + ELSE + -> Print serial device status - see include file for meaning. + -> Note that with DoIO, the Wait and GetMsg are done by Exec. + WriteF('Serial device status: $\h\n\n', serialIO.status) + ENDIF + + serialIO.iostd.command:=SDCMD_QUERY + -> SendIO - demonstrates asynchronous device use (returns immediately). + SendIO(serialIO) + -> We could do other things here while the query is being done. And to + -> manage our asynchronous device IO: + -> - we can CheckIO(serialIO) to check for completion + -> - we can AbortIO(serialIO) to abort the command + -> - we can WaitPort(serialMP) to wait for any serial port reply + -> OR we can WaitIO(serialIO) to wait for this specific IO request + -> OR we can Wait(Shl(1, serialMP.sigbit)) for reply port signal + Wait(Shl(1, serialMP.sigbit)) + + WHILE reply:=GetMsg(serialMP) + -> Since we sent out only one serialIO request the while loop is not + -> really needed--we only expect one reply to our one query command, and + -> the reply message pointer returned by GetMsg() will just be another + -> pointer to our one serialIO request. With Wait() or WaitPort(), you + -> must GetMsg() the message. + IF reply.iostd.error + WriteF('Query failed. Error - \d\n', reply.iostd.error) + ELSE + WriteF('Serial device status: $\h\n\n', reply.status) + ENDIF + ENDWHILE + CloseDevice(serialIO) -> Close the serial device. +EXCEPT DO + IF serialIO THEN deleteExtIO(serialIO) -> Delete the I/O request. + IF serialMP THEN deletePort(serialMP) -> Delete the message port. + SELECT exception + CASE ERR_DEV; WriteF('Error: \s did not open\n', SERIALNAME) + -> Inform user that the I/O request could be created. + CASE ERR_IO; WriteF('Error: Could not create I/O request\n') + -> Inform user that the message port could not be created. + CASE ERR_PORT; WriteF('Error: Could not create message port\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Interrupts/rbf.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Interrupts/rbf.e new file mode 100644 index 0000000..53be0b0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Interrupts/rbf.e @@ -0,0 +1,140 @@ +-> rbf.e - Serial receive buffer full interrupt handler example. +-> +-> To receive characters, this example requires ASCII serial input at your +-> Amiga's current serial hardware baud rate (i.e., 9600 after reboot, else +-> last baud rate used). + +-> E-Note: E does not (as of v3.1a) support Resources in the conventional way +MODULE 'other/ecode', + 'other/misc', + 'dos/dos', + 'exec/execbase', + 'exec/interrupts', + 'exec/nodes', + 'exec/memory', + 'hardware/custom', + 'hardware/intbits', + 'resources/misc' + +ENUM ERR_NONE, ERR_BITS, ERR_ECODE, ERR_PORT, ERR_SIG + +RAISE ERR_SIG IF AllocSignal()=-1 + +CONST BUFFERSIZE=256, NAMESIZE=32 +CONST ALLOCEDBUFFER=BUFFERSIZE+2 + +OBJECT rbfData + task + signal + bufferCount -> E-Note: C version disagrees with Assembly handler! + charBuffer[ALLOCEDBUFFER]:ARRAY + flagBuffer[ALLOCEDBUFFER]:ARRAY + name[NAMESIZE]:ARRAY +ENDOBJECT + +-> E-Note: set-up "custom" +DEF custom=CUSTOMADDR:PTR TO custom + +PROC main() HANDLE + -> E-Note: to help with cleaning up, currentuser has been replaced by + -> portuser and bitsuser, both initialised to non-zero + DEF allocname, rbfdata=NIL:PTR TO rbfData, portuser=-1, bitsuser=-1, + signr=-1, serdevice, rbfint=NIL:PTR TO is, priorint:PTR TO is, + priorenable, signal, exec:PTR TO execbase + -> E-Note: get the right type for execbase + exec:=execbase + + allocname:='rbf-example' + + miscbase:=OpenResource('misc.resource') + + -> Allocate the serial port registers. + IF portuser:=allocMiscResource(MR_SERIALPORT, allocname) + -> Hey! Someone's got it! + WriteF('serial hardware allocated by \s. Trying to remove it\n', portuser) + + Forbid() + IF serdevice:=FindName(exec.devicelist, portuser) THEN RemDevice(serdevice) + Permit() + + IF portuser:=allocMiscResource(MR_SERIALPORT, allocname) -> And try again + -> E-Note: error if still allocated + Raise(ERR_PORT) + ENDIF + ENDIF + + -> Get the serial control bits. (Give up if allocated.) + IF bitsuser:=allocMiscResource(MR_SERIALBITS, allocname) THEN Raise(ERR_BITS) + -> Got them both + WriteF('serial hardware allocated\n') + + -> Allocate a signal bit for the interrupt handler to signal us. + signr:=AllocSignal(-1) + + rbfint:=NewM(SIZEOF is, MEMF_PUBLIC OR MEMF_CLEAR) + rbfdata:=NewM(SIZEOF rbfData, MEMF_PUBLIC OR MEMF_CLEAR) + rbfdata.task:=FindTask(NIL) -> Init rbfdata object + rbfdata.signal:=Shl(1, signr) + + rbfint.ln.type:=NT_INTERRUPT -> Init interrupt node. + -> E-Note: copy *safely* to rbfdata.name + AstrCopy(rbfdata.name, allocname, NAMESIZE) + rbfint.ln.name:=rbfdata.name + rbfint.data:=rbfdata + rbfint.code:=eCodeIntHandler({rbfHandler}) + IF rbfint.code=NIL THEN Raise(ERR_ECODE) + + -> Save state of RBF and interrupt disable it. + priorenable:=custom.intenar AND INTF_RBF + custom.intena:=INTF_RBF + IF priorint:=SetIntVector(INTB_RBF, rbfint) + WriteF('replaced the \s RBF interrupt handler\n', priorint.ln.name) + ENDIF + + WriteF('enabling RBF interrupt\n') + custom.intena:=INTF_SETCLR OR INTF_RBF + + WriteF('waiting for buffer to fill up. Use CTRL-C to break\n') + signal:=Wait(Shl(1, signr) OR SIGBREAKF_CTRL_C) + + IF signal AND SIGBREAKF_CTRL_C THEN WriteF('>break<\n') + WriteF('Character buffer contains:\n\s\n', rbfdata.charBuffer) + + custom.intena:=INTF_RBF -> Restore previous handler. + SetIntVector(INTB_RBF, priorint) -> Enable it if it was enabled before. + IF priorenable THEN custom.intena:=INTF_SETCLR OR INTF_RBF + +EXCEPT DO + -> E-Note: these next two aren't really necessary + IF rbfdata THEN Dispose(rbfdata) + IF rbfint THEN Dispose(rbfint) + IF signr<>-1 THEN FreeSignal(signr) + -> Release serial hardware + IF bitsuser=NIL THEN freeMiscResource(MR_SERIALBITS) + IF portuser=NIL THEN freeMiscResource(MR_SERIALPORT) + -> There is no 'CloseResource()' function + SELECT exception + CASE ERR_BITS; WriteF('Serial control already allocated by \s\n', bitsuser) + CASE ERR_ECODE; WriteF('Ran out of memory in eCodeIntHandler()\n') + CASE ERR_PORT; WriteF('Serial hardware already allocated by \s\n', portuser) + CASE ERR_SIG; WriteF('Can''t allocate signal\n') + CASE "MEM"; WriteF('Ran out of memory\n') + ENDSELECT +ENDPROC + +-> Note - This simple handler just receives one buffer full of serial +-> input data, signals main, then ignores all subsequent serial data. + +-> E-Note: we could use Assembly, but we'll show how to use an E PROC +-> E-Note: you get rbfint.data as first arg, interrupt flags as second +PROC rbfHandler(data:PTR TO rbfData, intflags) + DEF input + IF data.bufferCount timersoftint.e - Timer device software interrupt message port example. + +-> E-Note: we need eCodeSoftInt() in order to execute E code as an interrupt +MODULE 'amigalib/io', + 'amigalib/lists', + 'other/ecode', + 'devices/timer', + 'dos/dos', + 'exec/interrupts', + 'exec/io', + 'exec/memory', + 'exec/nodes', + 'exec/ports' + +ENUM ERR_NONE, ERR_DEVICE, ERR_ECODE, ERR_TIMER + +RAISE ERR_DEVICE IF OpenDevice()<>0 + +CONST MICRO_DELAY=1000 + +ENUM OFF, ON, STOPPED + +OBJECT tsiData + counter + flag + port:PTR TO mp +ENDOBJECT + +DEF tsidata=NIL:PTR TO tsiData + +PROC main() HANDLE + DEF port=NIL:PTR TO mp, softint=NIL:PTR TO is, tr:PTR TO timerequest, + endcount, code + + -> Allocate message port, data and interrupt objects. Don't use createPort() + -> or CreateMsgPort() since they allocate a signal (don't need that) for a + -> PA_SIGNAL type port. We need PA_SOFTINT. + tsidata:=NewM(SIZEOF tsiData, MEMF_PUBLIC OR MEMF_CLEAR) + port:=NewM(SIZEOF mp, MEMF_PUBLIC OR MEMF_CLEAR) + newList(port.msglist) -> Initialise message list + softint:=NewM(SIZEOF is, MEMF_PUBLIC OR MEMF_CLEAR) + + -> Set up the (software) interrupt structure. Note that this task runs at + -> priority 0. Software interrupts may only be priority -32, -16, 0, +16, + -> +32. Also not that the correct node type for a software interrupt is + -> NT_INTERRUPT. (NT_SOFTINT is an internal Exec flag). This is the same + -> setup as that for a software interrupt which you Cause(). + -> E-Note: We can initialise data here to contain a pointer to shared data + -> structures. The interrupt routine will receive the data in A1. + -> E-Note: eCodeSoftInt() protects an E function and preserves non-scratch + -> registers so you can call it from, for instance, interrupts. + IF NIL=(code:=eCodeSoftInt({tsoftcode})) THEN Raise(ERR_ECODE) + softint.code:=code -> The software interrupt routine + softint.data:=tsidata + softint.ln.pri:=0 + + port.ln.type:=NT_MSGPORT -> Set up the PA_SOFTINT message port (no need to + port.flags:=PA_SOFTINT -> make this port public). + port.sigtask:=softint -> Pointer to interrupt object + + -> Allocate timerequest + IF NIL=(tr:=createExtIO(port, SIZEOF timerequest)) THEN Raise(ERR_TIMER) + + -> Open timer.device. 0 is success + OpenDevice('timer.device', UNIT_MICROHZ, tr, 0) + tsidata.flag:=ON -> Init data structure to share globally. + tsidata.port:=port + + -> Send of the first timerequest to start. IMPORTANT: Do NOT beginIO() to + -> any device other than audio or timer from within a software or hardware + -> interrupt. The beginIO() code may allocate memory, wait or perform other + -> functions which are illegal or dangerous during interrupts. + WriteF('starting softint. CTRL-C to break...\n') + + tr.io.command:=TR_ADDREQUEST -> Initial iorequest to start + tr.time.micro:=MICRO_DELAY -> software interrupt + beginIO(tr) + + Wait(SIGBREAKF_CTRL_C) + endcount:=tsidata.counter + WriteF('timer softint counted \d milliseconds.\n', endcount) + + WriteF('Stopping timer...\n') + tsidata.flag:=OFF + + WHILE tsidata.flag<>STOPPED DO Delay(10) + CloseDevice(tr) + +EXCEPT DO + IF tr THEN deleteExtIO(tr) + IF softint THEN Dispose(softint) + IF port THEN Dispose(port) + IF tsidata THEN Dispose(tsidata) + SELECT exception + CASE ERR_DEVICE; WriteF('Couldn''t open timer.device\n') + CASE ERR_ECODE; WriteF('Ran out of memory in eCodeSoftInt()\n') + CASE ERR_TIMER; WriteF('Couldn''t create timerequest\n') + CASE "MEM"; WriteF('Ran out of memory\n') + ENDSELECT +ENDPROC + +PROC tsoftcode(data) + DEF tr:PTR TO timerequest + -> E-Note: thanks to eCodeSoftInt() we get the softint.data as an argument, + -> so we could use that instead of the global tsidata. This means + -> that tsidata could be made local to main()... + + -> Remove the message from the port. + tr:=GetMsg(tsidata.port) + + -> Keep on going if main() hasn't set flag to OFF. + IF tr AND (tsidata.flag=ON) + -> Increment counter and re-send timerequest -- IMPORTANT: This + -> self-perpetuating technique of calling beginIO() during a software + -> interrupt may only be used with the audio and timer device. + tsidata.counter:=tsidata.counter+1 + tr.io.command:=TR_ADDREQUEST + tr.time.micro:=MICRO_DELAY + beginIO(tr) + ELSE + -> Tell main() we're out of here. + tsidata.flag:=STOPPED + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Interrupts/vertb.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Interrupts/vertb.e new file mode 100644 index 0000000..023771c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Interrupts/vertb.e @@ -0,0 +1,64 @@ +-> vertb.e - Vertical blank interrupt server example. + +-> E-Note: we need eCodeSoftInt() in order to execute E code as an interrupt +-> (this wouldn't be needed if we just used Assembly, see below) +MODULE 'other/ecode', + 'dos/dos', + 'exec/interrupts', + 'exec/memory', + 'exec/nodes', + 'hardware/intbits' + +ENUM ERR_NONE, ERR_ECODE + +PROC main() HANDLE + DEF vbint:PTR TO is, counter=0, endcount + + -> Allocate memory for interrupt node. + vbint:=NewM(SIZEOF is, MEMF_PUBLIC OR MEMF_CLEAR) + vbint.ln.type:=NT_INTERRUPT -> Initialise the node. + vbint.ln.pri:=-60 + vbint.ln.name:='VertB-Example' + vbint.data:={counter} + vbint.code:=eCodeIntServer({vertBServer}) + IF vbint.code=NIL THEN Raise(ERR_ECODE) + + AddIntServer(INTB_VERTB, vbint) -> Kick this interrupt server into life. + + WriteF('VBlank server will increment a counter every frame.\n') + WriteF('counter started at zero, CTRL-C to remove server\n') + + Wait(SIGBREAKF_CTRL_C) + endcount:=counter + WriteF('\d vertical blanks occurred\nRemoving server\n', endcount) + + RemIntServer(INTB_VERTB, vbint) + +EXCEPT DO + -> E-Note: not really necessary... + IF vbint THEN Dispose(vbint) + SELECT exception + CASE ERR_ECODE; WriteF('Error: Ran out of memory in eCodeIntServer()\n') + CASE "MEM"; WriteF('Error: Ran out of memory\n') + ENDSELECT +ENDPROC + +-> Entered with: A0 == scratch (execpt for highest pri vertb server) +-> D0 == scratch A1 == is_Data +-> D1 == scratch A5 == vector to interrupt code (scratch) +-> A6 == scratch +-> +-> E-Note: we could use this Assembly, but we'll show how to use a PROC instead +-> (so we needed eCodeIntServer() above) +-> +-> vertBServer: +-> ADDI.L #1, (A1) -> Increments counter is_Data points to +-> MOVEQ.L #0, D0 -> Set Z flag to continue to process other vb-servers +-> RTS -> Return to exec + +-> E-Note: we get vbint.data as an argument, and the PROC result should be +-> zero to continue with other servers in this chain (the default), +-> or non-zero (e.g., RETURN TRUE) to skip them +PROC vertBServer(data:PTR TO LONG) + data[]:=data[]+1 +ENDPROC \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Lists/buildlist.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Lists/buildlist.e new file mode 100644 index 0000000..7459f5c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Lists/buildlist.e @@ -0,0 +1,95 @@ +-> buildlist.e - Example which uses an application-specific Exec list + +MODULE 'amigalib/lists', + 'exec/lists', + 'exec/nodes' + +CONST DATASIZE=62 + +OBJECT nameNode + ln:ln -> System Node structure + data[DATASIZE]:ARRAY -> Node-specific data +ENDOBJECT + +CONST NAMENODE_ID=100 -> The type of 'nameNode' + +PROC main() HANDLE + DEF nameList=NIL:PTR TO lh -> Note that a mlh would also work + NEW nameList + newList(nameList) -> Important: prepare header for use + + addName(nameList, 'Name7'); addName(nameList, 'Name6') + addName(nameList, 'Name5'); addName(nameList, 'Name4') + addName(nameList, 'Name2'); addName(nameList, 'Name0') + + addName(nameList, 'Name7'); addName(nameList, 'Name5') + addName(nameList, 'Name3'); addName(nameList, 'Name1') + + displayName(nameList, 'Name5') + displayNameList(nameList) + +EXCEPT DO + IF nameList + -> E-Note: none of this is necessary, since the program is terminating + -> and the memory will be freed automatically + freeNameNodes(nameList) + END nameList -> Free list header + ENDIF + SELECT exception + CASE "MEM"; WriteF('Error: Out of memory\n') + ENDSELECT +ENDPROC + +-> Allocate a NameNode structure, copy the given name into the structure, then +-> add it the specified list. This example does not provide an error return +-> for the out of memory condition. +-> E-Note: ...instead it raises an exception which is handled by the caller +PROC addName(list, name) + DEF namenode:PTR TO nameNode + NEW namenode + -> E-Note: copy *safely* to namenode.data + AstrCopy(namenode.data, name, DATASIZE) + namenode.ln.name:=namenode.data + namenode.ln.type:=NAMENODE_ID + namenode.ln.pri:=0 + AddHead(list, namenode) +ENDPROC + +-> Free the entire list, including the header. The header is not updated as +-> the list is freed. This function demonstrates how to avoid referencing +-> freed memory when deallocating nodes. +PROC freeNameNodes(list:PTR TO lh) + DEF worknode:PTR TO nameNode, nextnode + worknode:=list.head -> First node + WHILE nextnode:=worknode.ln.succ + END worknode + worknode:=nextnode + ENDWHILE +ENDPROC + +-> Print the names of each node in a list. +PROC displayNameList(list:PTR TO lh) + DEF node:PTR TO ln + IF list.tailpred=list + WriteF('List is empty.\n') + ELSE + node:=list.head + WHILE node.succ + WriteF('$\h -> \s\n', node, node.name) + node:=node.succ + ENDWHILE + ENDIF +ENDPROC + +-> Print the location of all nodes with a specified name. +PROC displayName(list, name) + DEF node:PTR TO ln + IF node:=FindName(list,name) + WHILE node + WriteF('Found a \s at location $\h\n', node.name, node) + node:=FindName(node, name) + ENDWHILE + ELSE + WriteF('No node with name \s found.\n', name) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Memory/allocate.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Memory/allocate.e new file mode 100644 index 0000000..16b22e0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Memory/allocate.e @@ -0,0 +1,40 @@ +-> allocate.e - Example of allocating and using a private memory pool. + +MODULE 'exec/memory', + 'exec/nodes' + +CONST BLOCKSIZE=4000 -> Or whatever you need + +PROC main() HANDLE + DEF mh=NIL:PTR TO mh, mc=NIL:PTR TO mc, block1, block2 + + -> Get the MemHeader needed to keep track of our new block. + NEW mh + + -> Get the actual block the above MemHeader will manage. + mc:=NewR(BLOCKSIZE) + + mh.ln.type:=NT_MEMORY + mh.first:=mc + mh.lower:=mc + mh.upper:=mc+BLOCKSIZE + mh.free:=BLOCKSIZE + + mc.next:=NIL -> Set up first chunk in the freelist + mc.bytes:=BLOCKSIZE + + block1:=Allocate(mh, 20) + block2:=Allocate(mh, 314) + + WriteF('Our mh object at $\h. Our block of memory at $\h\n', mh, mc) + WriteF('Allocated from our pool: block1 at $\h, block2 at $\h\n', + block1, block2) + +EXCEPT DO + -> E-Note: the freeing is not necessary, since the program is terminating + IF mc THEN Dispose(mc) + IF mh THEN END mh + SELECT exception + CASE "MEM"; WriteF('Error: Ran out of memory\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Memory/allocentry.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Memory/allocentry.e new file mode 100644 index 0000000..7dda765 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Memory/allocentry.e @@ -0,0 +1,43 @@ +-> allocentry.e - Example of allocating several memory areas. + +MODULE 'exec/memory' + +CONST ALLOCERROR=$80000000 + +-> E-Note: like the Assembly version, a ml does not contain a me, so body[4] +OBJECT memBlocks + head:ml -> One entry in the header, additional entries follow + body[4]:ARRAY OF me -> directly as part of the same data structure +ENDOBJECT + +DEF memlist:PTR TO ml, -> Pointer to a ml object + memblocks:memBlocks + +PROC main() + memblocks.head.numentries:=4 -> E-Note: The ml does not contain another me! + + -> Describe the first piece of memory we want. + -> E-Note: every me is in the body, unlike the C version + memblocks.body[0].reqs:=MEMF_CLEAR + memblocks.body[0].length:=4000 + + -> Describe the other pieces of memory we want. Additional me's are + -> initialised this way. If we wanted even more entries, we would need to + -> declare a larger me array in our memBlocks object. + memblocks.body[1].reqs:=MEMF_CHIP OR MEMF_CLEAR + memblocks.body[1].length:=100000 + memblocks.body[2].reqs:=MEMF_PUBLIC OR MEMF_CLEAR + memblocks.body[2].length:=200000 + memblocks.body[3].reqs:=MEMF_PUBLIC + memblocks.body[3].length:=25000 + + memlist:=AllocEntry(memblocks) + + IF memlist AND ALLOCERROR -> 'error' bit 31 is set (see below). + WriteF('AllocEntry FAILED\n') + ENDIF + + -> We got all memory we wanted. Use it and call FreeEntry() to free it + WriteF('AllocEntry succeeded - now freeing all allocated blocks\n') + FreeEntry(memlist) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Ports/port1.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Ports/port1.e new file mode 100644 index 0000000..c8ef9dc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Ports/port1.e @@ -0,0 +1,51 @@ +-> port1.e - Port and message example, run at the same time as port2.e + +MODULE 'amigalib/ports', + 'dos/dos', + 'exec/ports' + +ENUM ERR_NONE, ERR_PORT + +OBJECT xyMessage + msg:mn + x:INT + y:INT +ENDOBJECT + +PROC main() HANDLE + DEF xyport=NIL:PTR TO mp, xymsg:PTR TO xyMessage, + portsig, usersig, signal, abort=FALSE + IF NIL=(xyport:=createPort('xyport', 0)) THEN Raise(ERR_PORT) + portsig:=Shl(1, xyport.sigbit) + usersig:=SIGBREAKF_CTRL_C -> Give user a 'break' signal. + + WriteF('Start port2 in another shell. CTRL-C here when done.\n') + -> port1 will wait forever and reply to messages, until the user breaks + REPEAT + signal:=Wait(portsig OR usersig) + -> Since we only have one port that might get messages we have to reply + -> to, it is not really necessary to test for the portsignal. If there + -> is not a message at the port, xymsg simply will be NIL. + IF signal AND portsig + WHILE xymsg:=GetMsg(xyport) + WriteF('port1 received: x = \d y = \d\n', xymsg.x, xymsg.y) + xymsg.x:=xymsg.x+50 -> Since we have not replied yet to the owner of + xymsg.y:=xymsg.y+50 -> xymsg, we can change the data contents of xymsg. + WriteF('port1 replying with: x = \d y = \d\n', xymsg.x, xymsg.y) + ReplyMsg(xymsg) + ENDWHILE + ENDIF + IF signal AND usersig -> The user wants to abort. + abort:=TRUE + ENDIF + UNTIL abort +EXCEPT DO + IF xyport + -> Make sure the port is empty. + WHILE xymsg:=GetMsg(xyport) DO ReplyMsg(xymsg) + deletePort(xyport) + ENDIF + SELECT exception + CASE ERR_PORT; WriteF('Couldn''t create "xyport"\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Ports/port2.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Ports/port2.e new file mode 100644 index 0000000..016a594 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Ports/port2.e @@ -0,0 +1,69 @@ +-> port2.e - Port and message example, run at the same time as port1.e + +MODULE 'amigalib/ports', + 'dos/dos', + 'exec/memory', + 'exec/nodes', + 'exec/ports' + +ENUM ERR_NONE, ERR_FINDPORT, ERR_CREATEPORT + +OBJECT xyMessage + msg:mn + x:INT + y:INT +ENDOBJECT + +PROC main() HANDLE + DEF xyreplyport=NIL:PTR TO mp, xymsg=NIL:PTR TO xyMessage, + reply:PTR TO xyMessage + -> Using createPort() with no name because this port need not be public. + IF NIL=(xyreplyport:=createPort(NIL, 0)) THEN Raise(ERR_CREATEPORT) + xymsg:=NewM(SIZEOF xyMessage, MEMF_PUBLIC OR MEMF_CLEAR) + xymsg.msg.ln.type:=NT_MESSAGE -> Make up a message, including the + xymsg.msg.length:=SIZEOF xyMessage -> reply port. + xymsg.msg.replyport:=xyreplyport + xymsg.x:=10 -> Our special message information + xymsg.y:=20 + + WriteF('Sending to port1: x = \d y = \d\n', xymsg.x, xymsg.y) + + -> port2 will simply try to put one message to port1, wait for the reply, + -> and then exit + IF FALSE=safePutToPort(xymsg, 'xyport') THEN Raise(ERR_FINDPORT) + + WaitPort(xyreplyport) + IF reply:=GetMsg(xyreplyport) + -> We don't ReplyMsg since WE initiated the message. + WriteF('Reply contains: x = \d y = \d\n', xymsg.x, xymsg.y) + ENDIF + + -> Since we only use this private port for receiving replies, and we sent + -> only one and got one reply there is no need to cleanup. For a public port, + -> or if you pass a pointer to the port to another process, it is a very + -> good habit to always handle all messages at the port before you delete it. +EXCEPT DO + IF xymsg THEN Dispose(xymsg) -> E-Note: not really necessary + IF xyreplyport THEN deletePort(xyreplyport) + SELECT exception + CASE ERR_CREATEPORT + WriteF('Couldn''t create "xyreplyport"\n') + CASE ERR_FINDPORT + WriteF('Can''t find "xyport"; start port1 in a separate shell\n') + CASE "MEM" + WriteF('Couldn''t get memory\n') + ENDSELECT +ENDPROC + +PROC safePutToPort(message, portname) + DEF port:PTR TO mp + Forbid() + port:=FindPort(portname) + IF port THEN PutMsg(port, message) + Permit() + -> Once we've done a Permit(), the port might go away and leave us with an + -> invalid port address. So we return just a boolean to indicate whether + -> the message has been sent or not. + -> E-Note: Be careful - if FindPort() automatically raised an exception + -> you might forget to Permit()! +ENDPROC port<>NIL -> FALSE if the port was not found diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Semaphores/semaphore.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Semaphores/semaphore.e new file mode 100644 index 0000000..3f42c4b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Semaphores/semaphore.e @@ -0,0 +1,13 @@ +-> semaphore.e - Exec semaphore example + +MODULE 'exec/semaphores' + +PROC main() + DEF lockSemaphore:ss + InitSemaphore(lockSemaphore) + ObtainSemaphore(lockSemaphore) -> Task now owns the semaphore. + + -> ... + + ReleaseSemaphore(lockSemaphore) -> Task has released the semaphore. +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Signals/signals.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Signals/signals.e new file mode 100644 index 0000000..6952da7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Signals/signals.e @@ -0,0 +1,71 @@ +-> signals.e + +-> E-Note: eCodeTask() protects an E function so you can call it from other +-> tasks and have access to the global variables of this program +MODULE 'amigalib/tasks', + 'other/ecode', + 'dos/dos' + +ENUM ERR_NONE, ERR_ECODE, ERR_SIG, ERR_TASK + +RAISE ERR_SIG IF AllocSignal()=-1 + +DEF mainsignum=-1, mainsig, wakeupsigs, maintask=NIL, subtask=NIL + +PROC main() HANDLE + DEF done=FALSE, waitingForSubtask=TRUE, ecode, subtaskname + subtaskname:='RKM_signal_subtask' + + -> We must allocate any special signals we want to receive. + mainsignum:=AllocSignal(-1) + + mainsig:=Shl(1, mainsignum) -> subtask can access this global + maintask:=FindTask(NIL) -> subtask can access this global + + WriteF('We alloc a signal, create a task, wait for signals\n') + IF NIL=(ecode:=eCodeTask({subtaskcode})) THEN Raise(ERR_ECODE) + IF NIL=(subtask:=createTask(subtaskname, 0, ecode, 2000)) THEN Raise(ERR_TASK) + + WriteF('After subtask signals, press CTRL-C or CTRL-D to exit\n') + + REPEAT + -> Wait on the combined mask for all of the signals we are interested in. + -> All processes have the CTRL_C thru CTRL_F signals. We're also Waiting + -> on the mainsig we allocated for our subtask to signal us with. We could + -> also Wait on the signals of any ports/windows our main task created... + wakeupsigs:=Wait(mainsig OR SIGBREAKF_CTRL_C OR SIGBREAKF_CTRL_D) + + -> Deal with all signals that woke us up - may be more than one + IF wakeupsigs AND mainsig + WriteF('Signalled by subtask\n') + waitingForSubtask:=FALSE -> OK to kill subtask now + ENDIF + IF wakeupsigs AND SIGBREAKF_CTRL_C + WriteF('Got CTRL-C signal\n') + done:=TRUE + ENDIF + IF wakeupsigs AND SIGBREAKF_CTRL_D + WriteF('Got CTRL-D signal\n') + done:=TRUE + ENDIF + UNTIL done AND (waitingForSubtask=FALSE) +EXCEPT DO + IF subtask + Forbid() + deleteTask(subtask) + Permit() + ENDIF + IF mainsignum<>-1 THEN FreeSignal(mainsignum) + SELECT exception + CASE ERR_SIG; WriteF('No signals available\n') + CASE ERR_TASK; WriteF('Can''t create subtask\n') + CASE ERR_ECODE; WriteF('Ran out of memory in eCodeTask()\n') + ENDSELECT +ENDPROC + +PROC subtaskcode() + Signal(maintask, mainsig) + Wait(NIL) -> Safe state in which this subtask can be deleted +ENDPROC + +verstag: CHAR 0, '$VER: signals 37.1 (28.3.91)', 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Tasks/simpletask.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Tasks/simpletask.e new file mode 100644 index 0000000..3519049 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Tasks/simpletask.e @@ -0,0 +1,56 @@ +-> simpletask.e - Uses the amigalib function createTask() to create a simple +-> subtask. See the Includes and Autodocs manual for createTask() source code. + +MODULE 'amigalib/tasks', + 'other/ecode', + 'dos/dos' + +ENUM ERR_NONE, ERR_ECODE, ERR_TASK + +CONST STACK_SIZE=1000 + +-> Task name, pointers for allocated task struct and stack +DEF task=NIL, simpletaskname, sharedvar + +PROC main() HANDLE + DEF taskcode + simpletaskname:='SimpleTask' + + sharedvar:=0 + + -> E-Note: eCodeTask() protects an E function so you can call it from other + -> tasks and have access to the global variables of this program + IF NIL=(taskcode:=eCodeTask({simpletask})) THEN Raise(ERR_ECODE) + IF NIL=(task:=createTask(simpletaskname, 0, taskcode, STACK_SIZE)) + Raise(ERR_TASK) + ENDIF + + WriteF('This program initialised a variable to zero, then started a\n') + WriteF('separate task which is incrementing that variable right now,\n') + WriteF('while this program waits for you to press RETURN.\n') + WriteF('Press RETURN now: ') + -> E-Note: WriteF() opens a window if necessary, so use stdout if no stdin + Inp(IF stdin THEN stdin ELSE stdout) + + WriteF('The shared variable now equals \d\n', sharedvar) + +EXCEPT DO + IF task + -> We can simply remove the task we added because our simpletask does + -> not make any system calls which could cause it to be awakened or + -> signalled later. + Forbid() + deleteTask(task) + Permit() + ENDIF + SELECT exception + CASE ERR_ECODE; WriteF('Ran out of memory in eCodeTask()\n') + CASE ERR_TASK; WriteF('Can''t create task\n') + ENDSELECT +ENDPROC IF exception<>ERR_NONE THEN RETURN_FAIL ELSE RETURN_OK + +PROC simpletask() + WHILE sharedvar<$8000000 DO sharedvar++ + -> Wait forever because main() is going to RemTask() us + Wait(NIL) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Tasks/tasklist.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Tasks/tasklist.e new file mode 100644 index 0000000..501b135 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Tasks/tasklist.e @@ -0,0 +1,102 @@ +-> tasklist.e - Snapshots and prints the ExecBase task list + +MODULE 'amigalib/lists', + 'exec/execbase', + 'exec/lists', + 'exec/nodes', + 'exec/tasks' + +CONST NAMELEN=32 + +-> Use extended structure to hold task information +OBJECT taskNode + ln:ln + taskaddress + sigalloc + sigwait + name[NAMELEN]:ARRAY +ENDOBJECT + +PROC main() HANDLE + DEF ourtasklist:PTR TO lh, task:PTR TO tc, node:PTR TO taskNode, + tnode:PTR TO taskNode, rnode, exec:PTR TO execbase + -> E-Note: get the right type for execbase + exec:=execbase + + -> Allocate memory for out list + NEW ourtasklist + -> Initialise list structure (ala newList()) + -> E-Note: so why not use newList()!?! + newList(ourtasklist) + + -> Make sure tasks won't switch lists or go away + Disable() + + -> Snapshot task WAIT list + snapshot(exec.taskwait, ourtasklist) + + -> Snapshot task READY list + -> E-Note: rnode will be first READY task + rnode:=snapshot(exec.taskready, ourtasklist) + + -> Re-enable interrupts and taskswitching + Enable() + + -> Print now (printing above would have defeated a Forbid or Disable) + WriteF('Pri Address SigAlloc SigWait Taskname\n') + + node:=ourtasklist.head + WriteF('\nWAITING:\n') + WHILE tnode:=node.ln.succ + IF tnode=rnode THEN WriteF('\nREADY:\n') -> We set rnode above + WriteF('\z\d[2] \z$\h[8] \z$\h[8] \z$\h[8] \s\n', + node.ln.pri, node.taskaddress, node.sigalloc, + node.sigwait, node.name) + -> E-Note: ignore the messy clean up - see exception handler + node:=tnode + ENDWHILE + + -> Say who we are + WriteF('\nTHIS TASK:\n') + task:=FindTask(NIL) + WriteF('\z\d[2] \z$\h[8] \z$\h[8] \z$\h[8] \s\n', + task.ln.pri, task, task.sigalloc, task.sigwait, task.ln.name) + +EXCEPT DO + IF ourtasklist + -> E-Note: none of this is necessary, since the program is terminating + node:=ourtasklist.head + WHILE tnode:=node.ln.succ + END node + node:=tnode + ENDWHILE + END ourtasklist + ENDIF + SELECT exception + CASE "MEM"; WriteF('Error: Ran out of memory\n') + ENDSELECT +ENDPROC + +-> E-Note: having a separate procedure avoids repeating all this code as well +-> as localising any exception from NEW +PROC snapshot(from:PTR TO lh, to:PTR TO lh) HANDLE + -> E-Note: we are really dealing with "tc" (task) nodes not "ln" nodes + DEF exectask:PTR TO tc, tnode:PTR TO taskNode, first=NIL + exectask:=from.head + WHILE exectask.ln.succ + NEW tnode + -> Save task information we want to print + -> E-Note: copy *safely* to tnode.name + AstrCopy(tnode.name, exectask.ln.name, NAMELEN) + tnode.ln.pri:=exectask.ln.pri + tnode.taskaddress:=exectask + tnode.sigalloc:=exectask.sigalloc + tnode.sigwait:=exectask.sigwait + AddTail(to, tnode) + IF first=NIL THEN first:=tnode -> E-Note: first task copied + exectask:=exectask.ln.succ + ENDWHILE +EXCEPT DO +ENDPROC first + +versTag: CHAR 0, '$VER: tasklist 37.2 (31.3.92)', 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Tasks/trap.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Tasks/trap.e new file mode 100644 index 0000000..1bd15ab --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Exec_Library/Tasks/trap.e @@ -0,0 +1,43 @@ +-> trap.e - E example of sample integer divide-by-zero trap + +MODULE 'exec/tasks' + +DEF oldTrapCode, countdiv0 + +PROC main() + DEF thistask:PTR TO tc, k, j, z + + thistask:=FindTask(NIL) + + -> Save our task's current trap code pointer + oldTrapCode:=thistask.trapcode + + -> Point task to our assembler trap handler code. Ours will just count + -> divide-by-zero traps, and pass other traps on to the normal TrapCode. + thistask.trapcode:={trapa} + + countdiv0:=0 + + z:=0 -> E-Note: the E compiler will not allow an explicit "k/0"! + FOR k:=0 TO 3 -> Let's divide by zero a few times + WriteF('dividing \d by zero... ', k) + j:=k/z + WriteF('did it\n') + ENDFOR + WriteF('\nDivide by zero happened \d times\n', countdiv0) + + thistask.trapcode:=oldTrapCode -> Restore old trap code +ENDPROC + +trapa: -> Our trap handler entry + CMPI.L #5, (A7) -> Is this a divide by zero ? + BNE.S notdiv0 -> No + ADD.L #1, countdiv0 -> Yes, increment our div0 count +endtrap: + ADDQ #4, A7 -> Remove exception number from SSP + RTE -> Return from exception +notdiv0: + TST.L oldTrapCode -> Is there another trap handler ? + BEQ.S endtrap -> No, so we'll exit + MOVE.L oldTrapCode, -(A7) -> Yes, go on to old TrapCode + RTS -> Jumps to old TrapCode diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Expansion/findboards.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Expansion/findboards.e new file mode 100644 index 0000000..cc63207 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Expansion/findboards.e @@ -0,0 +1,80 @@ +-> findboards.e + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'expansion', + 'libraries/configregs', + 'libraries/configvars' + +ENUM ERR_NONE, ERR_LIB + +RAISE ERR_LIB IF OpenLibrary()=NIL + +-> E-Note: used to convert an INT to unsigned +#define UNSIGNED(x) ((x) AND $FFFF) +-> E-Note: used to convert a LONG to unsigned CHAR +#define UNSIGNEDCHAR(x) ((x) AND $FF) +->>> + +->>> PROC main() +PROC main() HANDLE + DEF myCD:PTR TO configdev, m, i, p, f, t + expansionbase:=OpenLibrary('expansion.library', 0) + + -> FindConfigDev(oldConfigDev,manufacturer,product) + -> oldConfigDev = NIL for the top of the list + -> manufacturer = -1 for any manufacturer + -> product = -1 for any product + myCD:=NIL + WHILE myCD:=FindConfigDev(myCD, -1, -1) -> Search for all ConfigDevs + WriteF('\n---ConfigDev structure found at location $\h---\n', myCD) + + -> These values were read directly from the board at expansion time + WriteF('Board ID (ExpansionRom) information:\n') + + t:=myCD.rom.type + m:=UNSIGNED(myCD.rom.manufacturer) + p:=myCD.rom.product + f:=myCD.rom.flags + i:=UNSIGNED(myCD.rom.initdiagvec) + + WriteF('er_Manufacturer =\d=$\z\h[4]=(~$\h[4])\n', + m, m, UNSIGNED(Not(m))) + WriteF('er_Product =\d=$\z\h[2]=(~$\h[2])\n', + p, p, UNSIGNEDCHAR(Not(p))) + + WriteF('er_Type =$\z\h[2]', myCD.rom.type) + IF myCD.rom.type AND ERTF_MEMLIST + WriteF(' (Adds memory to free list)\n') + ELSE + WriteF('\n') + ENDIF + + WriteF('er_Flags =$\z\h[2]=(~$\h[2])\n', + f, UNSIGNEDCHAR(Not(f))) + WriteF('er_InitDiagVec =$\z\h[4]=(~$\h[4])\n', + i, UNSIGNED(Not(i))) + + -> These values are generated when the AUTOCONFIG(tm) software relocates + -> the board + WriteF('Configuration (ConfigDev) information:\n') + WriteF('cd_BoardAddr =$\h\n', myCD.boardaddr) + WriteF('cd_BoardSize =$\h (\dK)\n', + myCD.boardsize, myCD.boardsize/1024) + + WriteF('cd_Flags =$\h', myCD.flags) + IF myCD.flags AND CDF_CONFIGME + WriteF('\n') + ELSE + WriteF(' (driver clears CONFIGME bit)\n') + ENDIF + ENDWHILE +EXCEPT DO + IF expansionbase THEN CloseLibrary(expansionbase) + SELECT exception + CASE ERR_LIB; WriteF('Error: could not open expansion library\n') + ENDSELECT +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/GadTools/gadtoolsgadgets.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/GadTools/gadtoolsgadgets.e new file mode 100644 index 0000000..dc48738 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/GadTools/gadtoolsgadgets.e @@ -0,0 +1,273 @@ +-> gadtoolsgadgets.e +-> Simple example of using a number of gadtools gadgets. + +MODULE 'gadtools', + 'exec/ports', + 'graphics/text', + 'intuition/intuition', + 'intuition/screens', + 'libraries/gadtools' + +ENUM ERR_NONE, ERR_FONT, ERR_GAD, ERR_KICK, ERR_LIB, ERR_PUB, ERR_VIS, ERR_WIN + +RAISE ERR_FONT IF OpenFont()=NIL, + ERR_GAD IF CreateGadgetA()=NIL, + ERR_KICK IF KickVersion()=FALSE, + ERR_LIB IF OpenLibrary()=NIL, + ERR_PUB IF LockPubScreen()=NIL, + ERR_VIS IF GetVisualInfoA()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +-> Gadget ENUM to be used as GadgetIDs and also as the indexes into the +-> gadget array my_gads[]. +ENUM MYGAD_SLIDER, MYGAD_STRING1, MYGAD_STRING2, MYGAD_STRING3, MYGAD_BUTTON + +-> Range for the slider: +CONST SLIDER_MIN=1, SLIDER_MAX=20 + +DEF topaz80 + +-> Function to handle a GADGETUP or GADGETDOWN event. For GadTools gadgets, +-> it is possible to use this function to handle MOUSEMOVEs as well, with +-> little or no work. +-> E-Note: slider_level is not a 'PTR TO INT', but 'PTR TO LONG' +PROC handleGadgetEvent(win, gad:PTR TO gadget, code, + slider_level:PTR TO LONG, my_gads:PTR TO LONG) + DEF id + id:=gad.gadgetid + SELECT id + CASE MYGAD_SLIDER + -> Sliders report their level in the IntuiMessage Code field: + WriteF('Slider at level \d\n', code) + slider_level[]:=code + CASE MYGAD_STRING1 + -> String gadgets report GADGETUP's + WriteF('String gadget 1: "\s".\n', gad.specialinfo::stringinfo.buffer) + CASE MYGAD_STRING2 + -> String gadgets report GADGETUP's + WriteF('String gadget 2: "\s".\n', gad.specialinfo::stringinfo.buffer) + CASE MYGAD_STRING3 + -> String gadgets report GADGETUP's + WriteF('String gadget 3: "\s".\n', gad.specialinfo::stringinfo.buffer) + CASE MYGAD_BUTTON + -> Buttons report GADGETUP's (button resets slider to 10) + WriteF('Button was pressed, slider reset to 10.\n') + slider_level[]:=10 + Gt_SetGadgetAttrsA(my_gads[MYGAD_SLIDER], win, NIL, + [GTSL_LEVEL, slider_level[], NIL]) + ENDSELECT +ENDPROC + +-> Function to handle vanilla keys. +-> E-Note: slider_level is not a 'PTR TO INT', but 'PTR TO LONG' +PROC handleVanillaKey(win, code, slider_level:PTR TO LONG, my_gads:PTR TO LONG) + SELECT "w" OF code + CASE "v" + -> Increase slider level, but not past maximum + slider_level[]:=Min(slider_level[]+1, SLIDER_MAX) + Gt_SetGadgetAttrsA(my_gads[MYGAD_SLIDER], win, NIL, + [GTSL_LEVEL, slider_level[], NIL]) + CASE "V" + -> Decrease slider level, but not past maximum + slider_level[]:=Max(slider_level[]-1, SLIDER_MIN) + Gt_SetGadgetAttrsA(my_gads[MYGAD_SLIDER], win, NIL, + [GTSL_LEVEL, slider_level[], NIL]) + CASE "c", "C" + -> Button resets slider to 10 + slider_level[]:=10 + Gt_SetGadgetAttrsA(my_gads[MYGAD_SLIDER], win, NIL, + [GTSL_LEVEL, slider_level[], NIL]) + CASE "f", "F" + ActivateGadget(my_gads[MYGAD_STRING1], win, NIL) + CASE "s", "S" + ActivateGadget(my_gads[MYGAD_STRING2], win, NIL) + CASE "t", "T" + ActivateGadget(my_gads[MYGAD_STRING3], win, NIL) + ENDSELECT +ENDPROC + +-> Here is where all the initialisation and creation of GadTools gadgets take +-> place. This function requires a pointer to a NIL-initialised gadget list +-> pointer. It returns a pointer to the last created gadget. +-> E-Note: exceptions raised by CreateGadgetA() will be handled by caller +PROC createAllGadgets(glistptr:PTR TO LONG, vi, topborder, + slider_level, my_gads:PTR TO LONG) + DEF gad, ng:PTR TO newgadget + -> All the gadget creation calls accept a pointer to the previous gadget, and + -> link the new gadget to that gadget's NextGadget field. Also, they exit + -> gracefully, returning NIL, if any previous gadget was NIL. This limits + -> the amount of checking for failure that is needed. You only need to check + -> before you tweak any gadget structure or use any of its fields, and + -> finally once at the end, before you add the gadgets. + + -> The following operation is required of any program that uses GadTools. + -> It gives the toolkit a place to stuff context data. + gad:=CreateContext(glistptr) + + -> Since the NewGadget structure is unmodified by any of the CreateGadgetA() + -> calls, we need only change those fields which are different. + ng:=[140, (20+topborder), 200, 12, '_Volume: ', topaz80, + MYGAD_SLIDER, NG_HIGHLABEL, vi, 0]:newgadget + + my_gads[MYGAD_SLIDER]:=(gad:=CreateGadgetA(SLIDER_KIND, gad, ng, + [GTSL_MIN, SLIDER_MIN, + GTSL_MAX, SLIDER_MAX, + GTSL_LEVEL, slider_level, + GTSL_LEVELFORMAT, '\d[2]', + GTSL_MAXLEVELLEN, 2, + GT_UNDERSCORE, "_", + NIL])) + + ng.topedge := ng.topedge+20 + ng.height := 14 + ng.gadgettext := '_First:' + ng.gadgetid := MYGAD_STRING1 + my_gads[MYGAD_STRING1]:=(gad:=CreateGadgetA(STRING_KIND, gad, ng, + [GTST_STRING, 'Try pressing', + GTST_MAXCHARS, 50, + GT_UNDERSCORE, "_", + NIL])) + + ng.topedge := ng.topedge+20 + ng.gadgettext := '_Second:' + ng.gadgetid := MYGAD_STRING2 + my_gads[MYGAD_STRING2]:=(gad:=CreateGadgetA(STRING_KIND, gad, ng, + [GTST_STRING, 'TAB or Shift-TAB', + GTST_MAXCHARS, 50, + GT_UNDERSCORE, "_", + NIL])) + + ng.topedge := ng.topedge+20 + ng.gadgettext := '_Third:' + ng.gadgetid := MYGAD_STRING3 + my_gads[MYGAD_STRING3]:=(gad:=CreateGadgetA(STRING_KIND, gad, ng, + [GTST_STRING, 'To see what happens!', + GTST_MAXCHARS, 50, + GT_UNDERSCORE, "_", + NIL])) + + ng.leftedge := 50 + ng.topedge := 20 + ng.width := 100 + ng.height := 12 + ng.gadgettext := '_Click Here' + ng.gadgetid := MYGAD_BUTTON + ng.flags := 0 + gad:=CreateGadgetA(BUTTON_KIND, gad, ng, + [GT_UNDERSCORE, "_", NIL]) +ENDPROC gad + +-> Standard message handling loop with GadTools message handling functions +-> used (Gt_GetIMsg() and Gt_ReplyIMsg()). +-> E-Note: slider_level is not a 'PTR TO INT', but 'PTR TO LONG' +PROC process_window_events(mywin:PTR TO window, slider_level:PTR TO LONG, + my_gads:PTR TO LONG) + DEF imsg:PTR TO intuimessage, imsgClass, imsgCode, gad, terminated=FALSE + REPEAT + Wait(Shl(1, mywin.userport.sigbit)) + + -> Gt_GetIMsg() returns an IntuiMessage with more friendly information for + -> complex gadget classes. Use it wherever you get IntuiMessages where + -> using GadTools gadgets. + WHILE (terminated=FALSE) AND (imsg:=Gt_GetIMsg(mywin.userport)) + -> Presuming a gadget, of course, but no harm... Only dereference this + -> value (gad) where the Class specifies that it is a gadget event. + gad:=imsg.iaddress + + imsgClass:=imsg.class + imsgCode:=imsg.code + + -> Use the toolkit message-replying function here... + Gt_ReplyIMsg(imsg) + + SELECT imsgClass + -> --- WARNING --- WARNING --- WARNING --- WARNING --- WARNING --- + -> GadTools puts the gadget address into IAddress of IDCMP_MOUSEMOVE + -> messages. This is NOT true for standard Intuition messages, + -> but is an added feature of GadTools. + CASE IDCMP_GADGETDOWN + handleGadgetEvent(mywin, gad, imsgCode, slider_level, my_gads) + CASE IDCMP_MOUSEMOVE + handleGadgetEvent(mywin, gad, imsgCode, slider_level, my_gads) + CASE IDCMP_GADGETUP + handleGadgetEvent(mywin, gad, imsgCode, slider_level, my_gads) + + CASE IDCMP_VANILLAKEY + handleVanillaKey(mywin, imsgCode, slider_level, my_gads) + CASE IDCMP_CLOSEWINDOW + terminated:=TRUE + CASE IDCMP_REFRESHWINDOW + -> With GadTools, the application must use Gt_BeginRefresh() + -> where it would normally have used BeginRefresh() + Gt_BeginRefresh(mywin) + Gt_EndRefresh(mywin, TRUE) + ENDSELECT + ENDWHILE + UNTIL terminated +ENDPROC + +-> Prepare for using GadTools, set up gadgets and open window. +-> Clean up and when done or on error. +PROC gadtoolsWindow() HANDLE + DEF font=NIL, mysc=NIL:PTR TO screen, mywin=NIL, glist=NIL, + my_gads[4]:ARRAY OF LONG, vi, slider_level=5, topborder + -> Open topaz 8 font, so we can be sure it's openable when we later + -> set ng.textattr to Topaz80: + topaz80:=['topaz.font', 8, 0, 0]:textattr + font:=OpenFont(topaz80) + mysc:=LockPubScreen(NIL) + vi:=GetVisualInfoA(mysc, [NIL]) + + -> Here is how we can figure out ahead of time how tall the window's + -> title bar will be: + topborder:=mysc.wbortop+mysc.font.ysize+1 + + createAllGadgets({glist}, vi, topborder, slider_level, my_gads) + + mywin:=OpenWindowTagList(NIL, + [WA_TITLE, 'GadTools Gadget Demo', + WA_GADGETS, glist, WA_AUTOADJUST, TRUE, + WA_WIDTH, 400, WA_MINWIDTH, 50, + WA_INNERHEIGHT, 140, WA_MINHEIGHT, 50, + WA_DRAGBAR, TRUE, WA_DEPTHGADGET, TRUE, + WA_ACTIVATE, TRUE, WA_CLOSEGADGET, TRUE, + WA_SIZEGADGET, TRUE, WA_SIMPLEREFRESH, TRUE, + WA_IDCMP, IDCMP_CLOSEWINDOW OR IDCMP_REFRESHWINDOW OR + IDCMP_VANILLAKEY OR SLIDERIDCMP OR + STRINGIDCMP OR BUTTONIDCMP, + WA_PUBSCREEN, mysc, + NIL]) + -> After window is open, gadgets must be refreshed with a call to the + -> GadTools refresh window function. + Gt_RefreshWindow(mywin, NIL) + + process_window_events(mywin, {slider_level}, my_gads) + +EXCEPT DO + IF mywin THEN CloseWindow(mywin) + -> FreeGadgets() even if createAllGadgets() fails, as some of the gadgets may + -> have been created... If glist is NIL then FreeGadgets() will do nothing. + FreeGadgets(glist) + IF vi THEN FreeVisualInfo(vi) + IF mysc THEN UnlockPubScreen(mysc, NIL) + IF font THEN CloseFont(font) + ReThrow() -> E-Note: pass on exception if it was an error +ENDPROC + +-> Open all libraries and run. Clean up when finished or on error.. +PROC main() HANDLE + KickVersion(37) + gadtoolsbase:=OpenLibrary('gadtools.library', 37) + gadtoolsWindow() +EXCEPT DO + IF gadtoolsbase THEN CloseLibrary(gadtoolsbase) + SELECT exception + CASE ERR_FONT; WriteF('Error: Failed to open Topaz 80\n') + CASE ERR_GAD; WriteF('Error: createAllGadgets() failed\n') + CASE ERR_KICK; WriteF('Error: Requires V37\n') + CASE ERR_LIB; WriteF('Error: Requires V37 gadtools.library\n') + CASE ERR_PUB; WriteF('Error: Couldn''t lock default public screen\n') + CASE ERR_VIS; WriteF('Error: GetVisualInfoA() failed\n') + CASE ERR_WIN; WriteF('Error: OpenWindow() failed\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/GadTools/gadtoolsmenu.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/GadTools/gadtoolsmenu.e new file mode 100644 index 0000000..4e533e5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/GadTools/gadtoolsmenu.e @@ -0,0 +1,98 @@ +-> gadtoolsmenu.e +-> Example showing the basic usage of the menu system with a window. +-> Menu layout is done with GadTools, as is recommended for applications. + +OPT PREPROCESS + +MODULE 'gadtools', + 'intuition/intuition', + 'libraries/gadtools' + +ENUM ERR_NONE, ERR_LIB, ERR_MENU, ERR_VIS, ERR_WIN + +RAISE ERR_LIB IF OpenLibrary()=NIL, + ERR_MENU IF CreateMenusA()=NIL, + ERR_VIS IF GetVisualInfoA()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +-> E-Note: used to convert an INT to unsigned +#define UNSIGNED(x) ((x) AND $FFFF) + +-> Watch the menus and wait for the user to select the close gadget or quit +-> from the menus. +PROC handle_window_events(win, menuStrip) + DEF done=FALSE, menuNumber, menuNum, itemNum, subNum, + item:PTR TO menuitem, class + REPEAT + -> E-Note: we can use WaitIMessage in this example + class:=WaitIMessage(win) + SELECT class + CASE IDCMP_CLOSEWINDOW + done:=TRUE + CASE IDCMP_MENUPICK + -> E-Note: convert message code to an unsigned INT + menuNumber:=UNSIGNED(MsgCode()) + WHILE (menuNumber<>MENUNULL) AND (done=FALSE) + item:=ItemAddress(menuStrip, menuNumber) + + -> Process the item here! + menuNum:=MENUNUM(menuNumber) + itemNum:=ITEMNUM(menuNumber) + subNum:=SUBNUM(menuNumber) + + -> Stop if quit is selected + IF (menuNum=0) AND (itemNum=5) THEN done:=TRUE + + -> E-Note: convert item.nextselect to an unsigned INT + menuNumber:=UNSIGNED(item.nextselect) + ENDWHILE + ENDSELECT + UNTIL done +ENDPROC + +-> Open all of the required libraries and set-up the menus +PROC main() HANDLE + DEF win=NIL:PTR TO window, my_VisualInfo=NIL, menuStrip=NIL + gadtoolsbase:=OpenLibrary('gadtools.library', 37) + win:=OpenWindowTagList(NIL, [WA_WIDTH, 400, WA_ACTIVATE, TRUE, + WA_HEIGHT, 100, WA_CLOSEGADGET, TRUE, + WA_TITLE, 'Menu Test Window', + WA_IDCMP, IDCMP_CLOSEWINDOW OR IDCMP_MENUPICK, + NIL]) + my_VisualInfo:=GetVisualInfoA(win.wscreen, [NIL]) + menuStrip:=CreateMenusA([NM_TITLE, 0, 'Project', 0, 0, 0, 0, + NM_ITEM, 0, 'Open...', 'O', 0, 0, 0, + NM_ITEM, 0, 'Save', 'S', 0, 0, 0, + NM_ITEM, 0, NM_BARLABEL, 0, 0, 0, 0, + NM_ITEM, 0, 'Print', 0, 0, 0, 0, + NM_SUB, 0, 'Draft', 0, 0, 0, 0, + NM_SUB, 0, 'NLQ', 0, 0, 0, 0, + NM_ITEM, 0, NM_BARLABEL, 0, 0, 0, 0, + NM_ITEM, 0, 'Quit...', 'Q', 0, 0, 0, + NM_TITLE, 0, 'Edit', 0, 0, 0, 0, + NM_ITEM, 0, 'Cut', 'X', 0, 0, 0, + NM_ITEM, 0, 'Copy', 'C', 0, 0, 0, + NM_ITEM, 0, 'Paste', 'V', 0, 0, 0, + NM_ITEM, 0, NM_BARLABEL, 0, 0, 0, 0, + NM_ITEM, 0, 'Undo', 'Z', 0, 0, 0, + NM_END, 0, NIL, 0, 0, 0, 0]:newmenu, + [NIL]) + IF LayoutMenusA(menuStrip, my_VisualInfo, [NIL]) + IF SetMenuStrip(win, menuStrip) + handle_window_events(win, menuStrip) + + ClearMenuStrip(win) + ENDIF + FreeMenus(menuStrip) + ENDIF +EXCEPT DO + IF my_VisualInfo THEN FreeVisualInfo(my_VisualInfo) + IF win THEN CloseWindow(win) + IF gadtoolsbase THEN CloseLibrary(gadtoolsbase) + SELECT exception + CASE ERR_LIB; WriteF('Error: Could not open gadtools.library\n') + CASE ERR_MENU; WriteF('Error: Could not create menu\n') + CASE ERR_VIS; WriteF('Error: Could not get visual info\n') + CASE ERR_WIN; WriteF('Error: Could not open window\n') + ENDSELECT +ENDPROC \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/GadTools/simplegtgadget.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/GadTools/simplegtgadget.e new file mode 100644 index 0000000..f497913 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/GadTools/simplegtgadget.e @@ -0,0 +1,103 @@ +-> simplegtgadget.e - Simple example of a GadTools gadget. + +OPT OSVERSION=37 + +MODULE 'gadtools', + 'exec/ports', + 'graphics/text', + 'intuition/intuition', + 'intuition/screens', + 'libraries/gadtools' + +ENUM ERR_NONE, ERR_GAD, ERR_LIB, ERR_PUB, ERR_VIS, ERR_WIN + +RAISE ERR_GAD IF CreateGadgetA()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_PUB IF LockPubScreen()=NIL, + ERR_VIS IF GetVisualInfoA()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST MYGAD_BUTTON=4 + +-> Open all libraries and run. Clean up when finished or on error.. +PROC main() HANDLE + gadtoolsbase:=OpenLibrary('gadtools.library', 37) + gadtoolsWindow() +EXCEPT DO + IF gadtoolsbase THEN CloseLibrary(gadtoolsbase) + SELECT exception + CASE ERR_GAD; WriteF('Error: Could not create gadget\n') + CASE ERR_LIB; WriteF('Error: Could not open gadtools.library\n') + CASE ERR_PUB; WriteF('Error: Could not lock public screen\n') + CASE ERR_VIS; WriteF('Error: Could not get visual info\n') + CASE ERR_WIN; WriteF('Error: Could not open window\n') + ENDSELECT +ENDPROC + +-> Prepare for using GadTools, set up gadgets and open window. +-> Clean up and when done or on error. +PROC gadtoolsWindow() HANDLE + DEF mysc=NIL:PTR TO screen, mywin=NIL, glist=NIL, gad, vi=NIL + mysc:=LockPubScreen(NIL) + vi:=GetVisualInfoA(mysc, [NIL]) + -> GadTools gadgets require this step to be taken + gad:=CreateContext({glist}) + + -> Create a button gadget centered below the window title + gad:=CreateGadgetA(BUTTON_KIND, gad, + [150, (20+mysc.wbortop+mysc.font.ysize+1), + 100, 12, + 'Click Here', ['topaz.font', 8, 0, 0]:textattr, + MYGAD_BUTTON, 0, + vi, NIL]:newgadget, + [NIL]) + mywin:=OpenWindowTagList(NIL, + [WA_TITLE, 'GadTools Gadget Demo', + WA_GADGETS, glist, WA_AUTOADJUST, TRUE, + WA_WIDTH, 400, WA_INNERHEIGHT, 100, + WA_DRAGBAR, TRUE, WA_DEPTHGADGET, TRUE, + WA_ACTIVATE, TRUE, WA_CLOSEGADGET, TRUE, + WA_IDCMP, IDCMP_CLOSEWINDOW OR + IDCMP_REFRESHWINDOW OR BUTTONIDCMP, + WA_PUBSCREEN, mysc, + NIL]) + Gt_RefreshWindow(mywin, NIL) + process_window_events(mywin) +EXCEPT DO + IF mywin THEN CloseWindow(mywin) + -> FreeGadgets() must be called after the context has been created. + -> It does nothing if glist is NIL + FreeGadgets(glist) + IF vi THEN FreeVisualInfo(vi) + IF mysc THEN UnlockPubScreen(NIL, mysc) + ReThrow() -> E-Note: pass on exception if it is an error +ENDPROC + +-> Standard message handling loop with GadTools message handling functions +-> used (Gt_GetIMsg() and Gt_ReplyIMsg()). +PROC process_window_events(mywin:PTR TO window) + DEF imsg:PTR TO intuimessage, gad:PTR TO gadget, terminated=FALSE, class + REPEAT + Wait(Shl(1, mywin.userport.sigbit)) + + -> Use Gt_GetIMsg() and Gt_ReplyIMsg() for handling IntuiMessages + -> with GadTools gadgets. + WHILE (terminated=FALSE) AND (imsg:=Gt_GetIMsg(mywin.userport)) + -> Gt_ReplyIMsg() at end of loop + class:=imsg.class + SELECT class + CASE IDCMP_GADGETUP -> Buttons only report GADGETUP + gad:=imsg.iaddress + IF gad.gadgetid=MYGAD_BUTTON THEN WriteF('Button was pressed\n') + CASE IDCMP_CLOSEWINDOW + terminated:=TRUE + CASE IDCMP_REFRESHWINDOW + -> This handling is REQUIRED with GadTools. + Gt_BeginRefresh(mywin) + Gt_EndRefresh(mywin, TRUE) + ENDSELECT + -> Use the toolkit message-replying function here... + Gt_ReplyIMsg(imsg) + ENDWHILE + UNTIL terminated +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Gameport/Absolute_Joystick.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Gameport/Absolute_Joystick.e new file mode 100644 index 0000000..1a1f008 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Gameport/Absolute_Joystick.e @@ -0,0 +1,291 @@ +-> Absolute_Joystick.e - Gameport device absolute joystick example + +->>> Header (globals) +MODULE 'amigalib/ports', + 'amigalib/io', + 'devices/gameport', + 'devices/inputevent', + 'devices/timer', + 'exec/execbase', + 'exec/io', + 'exec/nodes', + 'exec/ports' + +ENUM ERR_NONE, ERR_DEV, ERR_IO, ERR_PORT + +RAISE ERR_DEV IF OpenDevice()<>0 + +CONST JOY_X_DELTA=1, JOY_Y_DELTA=1, TIMEOUT_SECONDS=10 + +DEF exec:PTR TO execbase +->>> + +->>> PROC printInstructions() +-> Routine to print out some information for the user. +PROC printInstructions() + WriteF('\n >>> gameport.device Absolute Joystick Demo <<<\n\n') + + IF exec.vblankfrequency=60 + WriteF(' Running on NTSC system (60 Hz).\n') + ELSEIF exec.vblankfrequency=50 + WriteF(' Running on PAL system (50 Hz).\n') + ENDIF + + WriteF(' Attach joystick to rear connector (A3000) and (A1000).\n' + + ' Attach joystick to right connector (A2000).\n' + + ' Attach joystick to left connector (A500).\n' + + ' Then move joystick and click its button(s).\n\n' + + ' To EXIT program press and release fire button 3 consecutive ' + + 'times.\n' + + ' The program also exits if no activity occurs for 1 minute.\n\n') +ENDPROC +->>> + +->>> PROC check_move(game_event:PTR TO inputevent) +-> Print out information on the event received. +PROC check_move(game_event:PTR TO inputevent) + DEF xmove, ymove, timeout=FALSE + xmove:=game_event.x + ymove:=game_event.y + + IF xmove=1 + IF ymove=1 + WriteF('RIGHT DOWN\n') + ELSEIF ymove=0 + WriteF('RIGHT\n') + ELSEIF ymove=-1 + WriteF('RIGHT UP\n') + ELSE + WriteF('UNKNOWN Y\n') + ENDIF + ELSEIF xmove=-1 + IF ymove=1 + WriteF('LEFT DOWN\n') + ELSEIF ymove=0 + WriteF('LEFT\n') + ELSEIF ymove=-1 + WriteF('LEFT UP\n') + ELSE + WriteF('UNKNOWN Y\n') + ENDIF + ELSEIF xmove=0 + IF ymove=1 + WriteF('DOWN\n') + ELSEIF ymove=0 + -> Note that 0,0 can be a timeout, or a direction release. + IF game_event.timestamp.secs >= (exec.vblankfrequency*TIMEOUT_SECONDS) + -> Under 1.3 (V34) and earlier versions of the Amiga OS, the + -> timestamp.secs field used in the IF statement above is not + -> correctly filled in. Therefore, this program cannot tell the + -> difference between a release event and a timeout under 1.3 (release + -> events will be reported as timeouts). + WriteF('TIMEOUT\n') + timeout:=TRUE + ELSE + WriteF('RELEASE\n') + ENDIF + ELSEIF ymove=-1 + WriteF('UP\n') + ELSE + WriteF('UNKNOWN Y\n') + ENDIF + ELSE + WriteF('UNKNOWN X ') + IF ymove=1 + WriteF('unknown action\n') + ELSEIF ymove=0 + WriteF('unknown action\n') + ELSEIF ymove=-1 + WriteF('unknown action\n') + ELSE + WriteF('UNKNOWN Y\n') + ENDIF + ENDIF +ENDPROC timeout +->>> + +->>> PROC send_read_request(game_event, game_io_msg:PTR TO iostd) +-> Send a request to the gameport to read an event. +PROC send_read_request(game_event, game_io_msg:PTR TO iostd) + game_io_msg.command:=GPD_READEVENT + game_io_msg.flags:=0 + game_io_msg.data:=game_event + game_io_msg.length:=SIZEOF inputevent + SendIO(game_io_msg) -> Asynchronous - message will return later +ENDPROC +->>> + +->>> PROC processEvents(game_io_msg:PTR TO iostd, game_msg_port:PTR TO mp) +-> Simple loop to process gameport events. +PROC processEvents(game_io_msg:PTR TO iostd, game_msg_port:PTR TO mp) + DEF timeout, timeouts, button_count, not_finished, code, + game_event:inputevent -> Where input event will be stored + -> From now on, just read input events into the event buffer, + -> one at a time. READEVENT waits for the preset conditions. + timeouts:=0 + button_count:=0 + not_finished:=TRUE + + WHILE (timeouts<6) AND not_finished + -> Send the read request + send_read_request(game_event, game_io_msg) + + -> Wait for joystick action + Wait(Shl(1, game_msg_port.sigbit)) + WHILE NIL<>GetMsg(game_msg_port) + timeout:=FALSE + code:=game_event.code + SELECT code + CASE IECODE_LBUTTON + WriteF(' FIRE BUTTON PRESSED \n') + CASE IECODE_LBUTTON OR IECODE_UP_PREFIX + WriteF(' FIRE BUTTON RELEASED \n') + button_count++ + IF 3=button_count THEN not_finished:=FALSE + CASE IECODE_RBUTTON + WriteF(' ALT BUTTON PRESSED \n') + button_count:=0 + CASE IECODE_RBUTTON OR IECODE_UP_PREFIX + WriteF(' ALT BUTTON RELEASED \n') + button_count:=0 + CASE IECODE_NOBUTTON + -> Check for change in position + timeout:=check_move(game_event) + button_count:=0 + DEFAULT + ENDSELECT + + IF timeout + INC timeouts + ELSE + timeouts:=0 + ENDIF + ENDWHILE + ENDWHILE +ENDPROC +->>> + +->>> PROC set_controller_type(type, game_io_msg:PTR TO iostd) +-> Allocate the controller if it is available. You allocate the controller by +-> setting its type to something other than GPCT_NOCONTROLLER. Before you +-> allocate the thing you need to check if anyone else is using it (it is free +-> if it is set to GPCT_NOCONTROLLER). +PROC set_controller_type(type, game_io_msg:PTR TO iostd) + DEF success=FALSE, controller_type_addr + controller_type_addr:=[0]:CHAR + -> Begin critical section. + -> We need to be sure that between the time we check that the controller is + -> available and the time we allocate it, no one else steals it. + Forbid() + + game_io_msg.command:=GPD_ASKCTYPE -> Enquire current status + game_io_msg.flags:=IOF_QUICK + game_io_msg.data:=controller_type_addr -> Put answer in here + game_io_msg.length:=1 + DoIO(game_io_msg) + + -> No one is using this device unit, let's claim it + IF controller_type_addr[]=GPCT_NOCONTROLLER + game_io_msg.command:=GPD_SETCTYPE + game_io_msg.flags:=IOF_QUICK + game_io_msg.data:=[type]:CHAR + game_io_msg.length:=1 + DoIO( game_io_msg) + success:=TRUE + ENDIF + + Permit() -> Critical section end +ENDPROC success +->>> + +->>> PROC set_trigger_conditions(gpt:PTR TO gameporttrigger, game_io_msg:...) +-> Tell the gameport when to trigger. +PROC set_trigger_conditions(gpt:PTR TO gameporttrigger, + game_io_msg:PTR TO iostd) + -> Trigger on all joystick key transitions + gpt.keys:=GPTF_UPKEYS OR GPTF_DOWNKEYS + gpt.xdelta:=JOY_X_DELTA + gpt.ydelta:=JOY_Y_DELTA + -> Timeout trigger every TIMEOUT_SECONDS second(s) + gpt.timeout:=exec.vblankfrequency*TIMEOUT_SECONDS + + game_io_msg.command:=GPD_SETTRIGGER + game_io_msg.flags:=IOF_QUICK + game_io_msg.data:=gpt + game_io_msg.length:=SIZEOF gameporttrigger + DoIO(game_io_msg) +ENDPROC +->>> + +->>> PROC flush_buffer(game_io_msg:PTR TO iostd) +-> Clear the buffer. Do this before you begin to be sure you start in a known +-> state. +PROC flush_buffer(game_io_msg:PTR TO iostd) + game_io_msg.command:=CMD_CLEAR + game_io_msg.flags:=IOF_QUICK + game_io_msg.data:=NIL + game_io_msg.length:=0 + DoIO(game_io_msg) +ENDPROC +->>> + +->>> PROC free_gp_unit(game_io_msg:PTR TO iostd) +-> Free the unit by setting its type back to GPCT_NOCONTROLLER. +PROC free_gp_unit(game_io_msg:PTR TO iostd) + DEF type=GPCT_NOCONTROLLER + game_io_msg.command:=GPD_SETCTYPE + game_io_msg.flags:=IOF_QUICK + game_io_msg.data:=[type]:CHAR + game_io_msg.length:=1; + DoIO(game_io_msg) +ENDPROC +->>> + +->>> PROC main() +-> Allocate everything and go. On failure, free any resources that have been +-> allocated. +PROC main() HANDLE + DEF joytrigger:gameporttrigger, game_io_msg=NIL:PTR TO iostd, + game_msg_port=NIL, open_dev=FALSE + -> E-Note: get the right type for exec + exec:=execbase + -> Create port for gameport device communications + IF NIL=(game_msg_port:=createPort('RKM_game_port', 0)) + Raise(ERR_PORT) + ENDIF + -> Create message block for device IO + IF NIL=(game_io_msg:=createExtIO(game_msg_port, SIZEOF iostd)) + Raise(ERR_IO) + ENDIF + + game_io_msg.mn.ln.type:=NT_UNKNOWN + -> Open the right/back (unit 1, number 2) gameport.device unit + OpenDevice('gameport.device', 1, game_io_msg, 0) + open_dev:=TRUE + -> Set controller type to joystick + IF set_controller_type(GPCT_ABSJOYSTICK, game_io_msg) + -> Specify the trigger conditions + set_trigger_conditions(joytrigger, game_io_msg) + + printInstructions() + + -> Clear device buffer to start from a known state. + -> There might still be events left. + flush_buffer(game_io_msg) + + processEvents(game_io_msg, game_msg_port) + + -> Free gameport unit so other applications can use it! + free_gp_unit(game_io_msg) + ENDIF +EXCEPT DO + IF open_dev THEN CloseDevice(game_io_msg) + IF game_io_msg THEN deleteExtIO(game_io_msg) + IF game_msg_port THEN deletePort(game_msg_port) + SELECT exception + CASE ERR_DEV; WriteF('Error: could not open gameport device\n') + CASE ERR_IO; WriteF('Error: could not create I/O\n') + CASE ERR_PORT; WriteF('Error: could not create port\n') + ENDSELECT +ENDPROC +->>> diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Layers/clipping.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Layers/clipping.e new file mode 100644 index 0000000..92c8a52 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Layers/clipping.e @@ -0,0 +1,137 @@ +-> clipping.e + +->>> Header (globals) +MODULE 'layers', + 'graphics/gfx', + 'intuition/intuition' + +ENUM ERR_NONE, ERR_LIB, ERR_WIN + +RAISE ERR_LIB IF OpenLibrary()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST MY_WIN_WIDTH=300, MY_WIN_HEIGHT=100 +->>> + +->>> PROC unclipWindow(win:PTR TO window) +-> Used to remove a clipping region installed by clipWindow() or +-> clipWindowToBorders(), disposing of the installed region and reinstalling +-> the region removed. +PROC unclipWindow(win:PTR TO window) + DEF old_region + -> Remove any old region by installing a NIL region, then dispose of the old + -> region if one was installed. + IF old_region:=InstallClipRegion(win.wlayer, NIL) + DisposeRegion(old_region) + ENDIF +ENDPROC +->>> + +->>> PROC clipWindow(win:PTR TO window, minX, minY, maxX, maxY) +-> Clip a window to a specified rectangle (given by upper left and lower right +-> corner). The removed region is returned so that it may be reinstalled +-> later. +PROC clipWindow(win:PTR TO window, minX, minY, maxX, maxY) + DEF new_region, my_rectangle + -> Set up the limits for the clip. + my_rectangle:=[minX, minY, maxX, maxY]:rectangle + -> Get a new region and OR in the limits. + IF new_region:=NewRegion() + IF OrRectRegion(new_region, my_rectangle)=FALSE + DisposeRegion(new_region) + new_region:=NIL + ENDIF + ENDIF +-> Install the new region, and return any existing region. If the above +-> allocation and region processing failed, then new_region will be NIL and +-> no clip region will be installed. +ENDPROC InstallClipRegion(win.wlayer, new_region) +->>> + +->>> PROC clipWindowToBorders(win:PTR TO window) +-> Clip a window to its borders. +-> The removed region is returned so that it may be re-installed later. +PROC clipWindowToBorders(win:PTR TO window) +ENDPROC clipWindow(win, win.borderleft, win.bordertop, + win.width-win.borderright-1, win.height-win.borderbottom-1) +->>> + +->>> PROC wait_for_close(win) +-> Wait for the user to select the close gadget. +PROC wait_for_close(win) + REPEAT -> E-Note: use built-in WaitIMessage() + UNTIL WaitIMessage(win)=IDCMP_CLOSEWINDOW +ENDPROC +->>> + +->>> PROC draw_in_window(win:PTR TO window, message) +-> Simple routine to blast all bits in a window with color three to show where +-> the window is clipped. After a delay, flush back to color zero and refresh +-> the window borders. +PROC draw_in_window(win:PTR TO window, message) + WriteF('\s...', message) + SetRast(win.rport, 3) + Delay(200) + SetRast(win.rport, 0) + RefreshWindowFrame(win) + WriteF('...done\n') +ENDPROC +->>> + +->>> PROC clip_test(win:PTR TO window) +-> Show drawing into an unclipped window, a window clipped to the borders and +-> a window clipped to a random rectangle. It is possible to clip more +-> complex shapes by AND'ing, OR'ing and exclusive-OR'ing regions and +-> rectangles to build a user clip region. +-> +-> This example assumes that old regions are not going to be re-used, so it +-> simply throws them away. +PROC clip_test(win) + DEF old_region + draw_in_window(win, 'Window with no clipping') + + -> If the application has never installed a user clip region, then + -> old_region will be NIL here. Otherwise, delete the old region (you + -> could save it and re-install it later...) + IF old_region:=clipWindowToBorders(win) + DisposeRegion(old_region) + ENDIF + draw_in_window(win, 'Window clipped to window borders') + unclipWindow(win) + + -> Here we know old_region will be NIL, as that is what we installed with + -> unclipWindow()... + IF old_region:=clipWindow(win, 20, 20, 100, 50) + DisposeRegion(old_region) + ENDIF + draw_in_window(win, 'Window clipped from (20,20) to (100,50)') + unclipWindow(win) + + wait_for_close(win) +ENDPROC +->>> + +->>> PROC main() +-> Open and close resources, call the test routine when ready. +PROC main() HANDLE + DEF win=NIL + KickVersion(37) + layersbase:=OpenLibrary('layers.library', 37) + win:=OpenWindowTagList(NIL, [WA_WIDTH, MY_WIN_WIDTH, + WA_HEIGHT, MY_WIN_HEIGHT, + WA_IDCMP, IDCMP_CLOSEWINDOW, + WA_CLOSEGADGET, TRUE, + WA_DRAGBAR, TRUE, + WA_ACTIVATE, TRUE, + NIL]) + clip_test(win) +EXCEPT DO + IF win THEN CloseWindow(win) + IF layersbase THEN CloseLibrary(layersbase) + SELECT exception + CASE ERR_LIB; WriteF('Error: could not open layers.library V37+\n') + CASE ERR_WIN; WriteF('Error: could not open window\n') + ENDSELECT +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Layers/layers.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Layers/layers.e new file mode 100644 index 0000000..59670e6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Layers/layers.e @@ -0,0 +1,371 @@ +-> Layers.e + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'layers', + 'graphics/clip', + 'graphics/layers', + 'graphics/gfx', + 'graphics/gfxbase', + 'graphics/rastport', + 'graphics/view' + +ENUM ERR_NONE, ERR_BLYR, ERR_CMAP, ERR_LIB, ERR_LYR + +RAISE ERR_BLYR IF CreateBehindLayer()=NIL, + ERR_CMAP IF GetColorMap()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_LYR IF NewLayerInfo()=NIL + +CONST L_DELAY=100, S_DELAY=50, DUMMY=0 + +ENUM RED_PEN=1, GREEN_PEN, BLUE_PEN + +CONST SCREEN_D=2, SCREEN_W=320, SCREEN_H=200 + +-> The starting size of example layers, offsets are used for placement. +CONST W_H=50, W_T=5, W_W=80 +CONST W_B=W_T+W_H-1 +CONST SWH=SCREEN_W/2, WWH=W_W/2 +CONST W_L=SWH-WWH +CONST W_R=W_L+W_W-1 + +-> Size of the superbitmap. +CONST SUPER_H=SCREEN_H, SUPER_W=SCREEN_W + +-> Starting size of the message layer. +CONST M_H=10, M_W=SCREEN_W, M_L=0 +CONST M_T=SCREEN_H-M_H +CONST M_B=M_T+M_H-1 +CONST M_R=M_L+M_W-1 + +DEF theLayerFlags:PTR TO LONG, colourtable:PTR TO INT +->>> + +->>> PROC myLabelLayer(layer:PTR TO layer, colour, string) +-> Clear the layer THEN draw in a text string. +PROC myLabelLayer(layer:PTR TO layer, colour, string) + -> Fill layer with colour + SetRast(layer.rp, colour) + + -> Set up for writing text into layer + SetDrMd(layer.rp, RP_JAM1) + SetAPen(layer.rp, 0) + Move(layer.rp, 5, 7) + + -> Write into layer + Text(layer.rp, string, StrLen(string)) +ENDPROC +->>> + +->>> PROC pMessage(layer, string) +-> Write a message into a layer with a delay. +PROC pMessage(layer, string) + Delay(S_DELAY) + myLabelLayer(layer, GREEN_PEN, string) +ENDPROC +->>> + +->>> PROC error(layer, string) +-> Write an error message into a layer with a delay. +PROC error(layer, string) + myLabelLayer(layer, RED_PEN, string) + Delay(L_DELAY) +ENDPROC +->>> + +->>> PROC doLayers(msgLayer, layer_array:PTR TO LONG) +-> Do some layers manipulations to demonstrate their abilities. +PROC doLayers(msgLayer, layer_array:PTR TO LONG) + DEF ktr, ktr_2, tlayer:PTR TO layer + + pMessage(msgLayer, 'Label all Layers') + myLabelLayer(layer_array[0], RED_PEN, 'SUPER') + myLabelLayer(layer_array[1], GREEN_PEN, 'Smart') + myLabelLayer(layer_array[2], BLUE_PEN, 'Simple') + + pMessage(msgLayer, 'MoveLayer 1 InFrontOf 0') + IF FALSE=MoveLayerInFrontOf(layer_array[1], layer_array[0]) + error(msgLayer, 'MoveLayerInFrontOf() failed.') + ENDIF + + pMessage(msgLayer, 'MoveLayer 2 InFrontOf 1') + IF FALSE=MoveLayerInFrontOf(layer_array[2], layer_array[1]) + error(msgLayer, 'MoveLayerInFrontOf() failed.') + ENDIF + + pMessage(msgLayer, 'Refresh Simple Refresh Layer') + myLabelLayer(layer_array[2], BLUE_PEN, 'Simple') + + pMessage(msgLayer, 'Incrementally MoveLayers...') + FOR ktr:=0 TO 29 + IF FALSE=MoveLayer(DUMMY, layer_array[1], -1, 0) + error(msgLayer, 'MoveLayer() failed.') + ENDIF + IF FALSE=MoveLayer(DUMMY, layer_array[2], -2, 0) + error(msgLayer, 'MoveLayer() failed.') + ENDIF + ENDFOR + + pMessage(msgLayer, 'Refresh Simple Refresh Layer') + myLabelLayer(layer_array[2], BLUE_PEN, 'Simple') + + pMessage(msgLayer, 'Make Layer 0 the UpfrontLayer') + IF FALSE=UpfrontLayer(DUMMY, layer_array[0]) + error(msgLayer, 'UpfrontLayer() failed.') + ENDIF + + pMessage(msgLayer, 'Make Layer 2 the BehindLayer') + IF FALSE=BehindLayer(DUMMY, layer_array[2]) + error(msgLayer, 'BehindLayer() failed.') + ENDIF + + pMessage(msgLayer, 'Incrementally MoveLayers again...') + FOR ktr:=0 TO 29 + IF FALSE=MoveLayer(DUMMY, layer_array[1], 0, 1) + error(msgLayer, 'MoveLayer() failed.') + ENDIF + IF FALSE=MoveLayer(DUMMY, layer_array[2], 0, 2) + error(msgLayer, 'MoveLayer() failed.') + ENDIF + ENDFOR + + pMessage(msgLayer, 'Refresh Simple Refresh Layer') + myLabelLayer(layer_array[2], BLUE_PEN, 'Simple') + + pMessage(msgLayer, 'Big MoveLayer') + FOR ktr:=0 TO 2 + tlayer:=layer_array[ktr] + IF FALSE=MoveLayer(DUMMY, tlayer, -tlayer.minx, 0) + error(msgLayer, 'MoveLayer() failed.') + ENDIF + ENDFOR + + pMessage(msgLayer, 'Incrementally increase size') + FOR ktr:=0 TO 4 + FOR ktr_2:=0 TO 2 + IF FALSE=SizeLayer(DUMMY, layer_array[ktr_2], 1, 1) + error(msgLayer, 'SizeLayer() failed.') + ENDIF + ENDFOR + ENDFOR + + pMessage(msgLayer, 'Refresh Smart Refresh Layer') + myLabelLayer(layer_array[1], GREEN_PEN, 'Smart') + pMessage(msgLayer, 'Refresh Simple Refresh Layer') + myLabelLayer(layer_array[2], BLUE_PEN, 'Simple') + + pMessage(msgLayer, 'Big SizeLayer') + FOR ktr:=0 TO 2 + tlayer:=layer_array[ktr] + IF FALSE=SizeLayer(DUMMY, tlayer, SCREEN_W-tlayer.maxx-1, 0) + error(msgLayer, 'SizeLayer() failed.') + ENDIF + ENDFOR + + pMessage(msgLayer, 'Refresh Smart Refresh Layer') + myLabelLayer(layer_array[1], GREEN_PEN, 'Smart') + pMessage(msgLayer, 'Refresh Simple Refresh Layer') + myLabelLayer(layer_array[2], BLUE_PEN, 'Simple') + + pMessage(msgLayer, 'ScrollLayer down') + FOR ktr:=0 TO 29 + FOR ktr_2:=0 TO 2 + ScrollLayer(DUMMY, layer_array[ktr_2], 0, -1) + ENDFOR + ENDFOR + + pMessage(msgLayer, 'Refresh Smart Refresh Layer') + myLabelLayer(layer_array[1], GREEN_PEN, 'Smart') + pMessage(msgLayer, 'Refresh Simple Refresh Layer') + myLabelLayer(layer_array[2], BLUE_PEN, 'Simple') + + pMessage(msgLayer, 'ScrollLayer up') + FOR ktr:=0 TO 29 + FOR ktr_2:=0 TO 2 + ScrollLayer(DUMMY, layer_array[ktr_2], 0, 1) + ENDFOR + ENDFOR + + pMessage(msgLayer, 'Refresh Smart Refresh Layer') + myLabelLayer(layer_array[1], GREEN_PEN, 'Smart') + pMessage(msgLayer, 'Refresh Simple Refresh Layer') + myLabelLayer(layer_array[2], BLUE_PEN, 'Simple') + + Delay(L_DELAY) +ENDPROC +->>> + +->>> PROC disposeLayers(msgLayer, layer_array:PTR TO LONG) +-> Delete the layer array created by allocLayers(). +PROC disposeLayers(msgLayer, layer_array:PTR TO LONG) + DEF ktr + FOR ktr:=0 TO 2 + IF layer_array[ktr] + IF FALSE=DeleteLayer(DUMMY, layer_array[ktr]) + error(msgLayer, 'Error deleting layer') + ENDIF + ENDIF + ENDFOR +ENDPROC +->>> + +->>> PROC allocLayers(msgLayer,layer_array,super_bitmap,theLayerInfo,theBitMap) +-> Create some hard-coded layers. The first must be SUPER-bitmap, with the +-> bitmap passed as an argument. The others must not be super-bitmap. The +-> pointers to the created layers are returned in layer_array. +-> +-> Return FALSE on failure. On a FALSE return, the layers are properly +-> cleaned up. +PROC allocLayers(msgLayer, layer_array:PTR TO LONG, super_bitmap, + theLayerInfo, theBitMap) HANDLE + DEF ktr, tlayer:PTR TO layer + FOR ktr:=0 TO 2 + pMessage(msgLayer, 'Create BehindLayer') + IF ktr=0 + tlayer:=CreateBehindLayer(theLayerInfo, theBitMap, + W_L+(ktr*30), W_T+(ktr*30), W_R+(ktr*30), W_B+(ktr*30), + theLayerFlags[ktr], super_bitmap) + ELSE + tlayer:=CreateBehindLayer(theLayerInfo, theBitMap, + W_L+(ktr*30), W_T+(ktr*30), W_R+(ktr*30), W_B+(ktr*30), + theLayerFlags[ktr], NIL) + ENDIF + + pMessage(msgLayer, 'Fill the RastPort') + SetRast(tlayer.rp, ktr+1) + layer_array[ktr]:=tlayer + ENDFOR +EXCEPT + disposeLayers(msgLayer, layer_array) + ReThrow() +ENDPROC +->>> + +->>> PROC disposeBitMap(bitmap:PTR TO bitmap, depth, width, height) +-> Free the bitmap and all bitplanes created by allocBitMap(). +PROC disposeBitMap(bitmap:PTR TO bitmap, depth, width, height) + DEF ktr + IF bitmap + FOR ktr:=0 TO depth-1 + IF bitmap.planes[ktr] THEN FreeRaster(bitmap.planes[ktr], width, height) + ENDFOR + Dispose(bitmap) + ENDIF +ENDPROC +->>> + +->>> PROC allocBitMap(depth, width, height) +-> Allocate and initialize a bitmap structure. +PROC allocBitMap(depth, width, height) HANDLE + DEF ktr, bitmap=NIL:PTR TO bitmap + NEW bitmap + InitBitMap(bitmap, depth, width, height) + + FOR ktr:=0 TO depth-1 + bitmap.planes[ktr]:=AllocRaster(width, height) + BltClear(bitmap.planes[ktr], RASSIZE(width, height), 1) + ENDFOR +EXCEPT + disposeBitMap(bitmap, depth, width, height) + ReThrow() +ENDPROC bitmap +->>> + +->>> PROC startLayers(theLayerInfo, theBitMap) +-> Set up to run the layers example, doLayers(). Clean up when done. +PROC startLayers(theLayerInfo, theBitMap) HANDLE + DEF msgLayer=NIL, theSuperBitMap=NIL, theLayers=NIL + theLayers:=[NIL, NIL, NIL]:LONG + IF msgLayer:=CreateUpfrontLayer(theLayerInfo, theBitMap, + M_L, M_T, M_R, M_B, LAYERSMART, NIL) + pMessage(msgLayer, 'Setting up Layers') + theSuperBitMap:=allocBitMap(SCREEN_D, SUPER_W, SUPER_H) + allocLayers(msgLayer, theLayers, theSuperBitMap, theLayerInfo, theBitMap) + doLayers(msgLayer, theLayers) + ENDIF +EXCEPT DO + disposeLayers(msgLayer, theLayers) + disposeBitMap(theSuperBitMap, SCREEN_D, SUPER_W, SUPER_H) + IF msgLayer + IF FALSE=DeleteLayer(DUMMY, msgLayer) + error(msgLayer, 'Error deleting layer') + ENDIF + ENDIF +ENDPROC +->>> + +->>> PROC runNewView() +-> Set up a low-level graphics display for layers to work on. Layers should +-> not be built directly on Intuition screens, use a low-level graphics view. +-> If you need mouse or other events for the layers display, you have to get +-> them directly from the input device. The only supported method of using +-> layers library calls with Intuition (other than the InstallClipRegion() +-> call) is through Intuition windows. +-> +-> See graphics primitives chapter for details on creating and using the +-> low-level graphics calls. +PROC runNewView() HANDLE + DEF theView:view, oldview:PTR TO view, theViewPort:viewport, + theRasInfo, theColourMap=NIL:PTR TO colormap, + theLayerInfo=NIL:PTR TO layer_info, theBitMap=NIL:PTR TO bitmap, + colourpalette:PTR TO INT, ktr, gfx:PTR TO gfxbase + + -> E-Note: get the right type... + gfx:=gfxbase + -> Save current view, to be restored when done + IF oldview:=gfx.actiview + -> Get a LayerInfo structure + theLayerInfo:=NewLayerInfo() + theColourMap:=GetColorMap(4) + colourpalette:=theColourMap.colortable; + FOR ktr:=0 TO 3 DO colourpalette[]++:=colourtable[ktr] + + theBitMap:=allocBitMap(SCREEN_D, SCREEN_W, SCREEN_H) + InitView(theView) + InitVPort(theViewPort) + + theView.viewport:=theViewPort + + theRasInfo:=[NIL, theBitMap, 0, 0]:rasinfo + + theViewPort.dwidth:=SCREEN_W; theViewPort.dheight:=SCREEN_H + theViewPort.rasinfo:=theRasInfo; theViewPort.colormap:=theColourMap + + MakeVPort(theView, theViewPort); MrgCop(theView); LoadView(theView) + WaitTOF() + + startLayers(theLayerInfo, theBitMap) + + -> Put back the old view, wait for it to become active before freeing any + -> of our display + LoadView(oldview) + WaitTOF() + + -> Free dynamically created structures + FreeVPortCopLists(theViewPort) + FreeCprList(theView.lofcprlist) + ENDIF +EXCEPT DO + IF theBitMap THEN disposeBitMap(theBitMap, SCREEN_D, SCREEN_W, SCREEN_H) + IF theColourMap THEN FreeColorMap(theColourMap) + IF theLayerInfo THEN DisposeLayerInfo(theLayerInfo) + ReThrow() +ENDPROC +->>> + +->>> PROC main() +-> Open the libraries used by the example. Clean up when done. +PROC main() HANDLE + -> Global constant data for initialising the layers. + theLayerFlags:=[LAYERSUPER, LAYERSMART, LAYERSIMPLE]:LONG + colourtable:=[$000, $F44, $4F4, $44F]:INT + + layersbase:=OpenLibrary('layers.library', 33) + runNewView() +EXCEPT DO + IF layersbase THEN CloseLibrary(layersbase) +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/RGBBoxes.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/RGBBoxes.e new file mode 100644 index 0000000..78a46ea --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/RGBBoxes.e @@ -0,0 +1,199 @@ +-> RGBBoxes.e - Simple ViewPort example -- works with 1.3 and Release 2 + +->>> Header (globals) +MODULE 'dos/dos', + 'exec/libraries', + 'graphics/displayinfo', + 'graphics/gfx', + 'graphics/gfxbase', + 'graphics/gfxnodes', + 'graphics/modeid', + 'graphics/videocontrol', + 'graphics/view' + +ENUM ERR_NONE, ERR_COLMAP, ERR_FINDDISP, ERR_GETDISP, ERR_GFXNEW, ERR_MONI, + ERR_RAST, ERR_VIDEO + +RAISE ERR_COLMAP IF GetColorMap()=NIL, + ERR_FINDDISP IF FindDisplayInfo()=NIL, + ERR_GETDISP IF GetDisplayInfoData()=0, + ERR_GFXNEW IF GfxNew()=NIL, + ERR_MONI IF OpenMonitor()=NIL, + ERR_RAST IF AllocRaster()=NIL, + ERR_VIDEO IF VideoControl()<>NIL + +-> The number of bitplanes, and the nominal width and height used in 1.3. +CONST DEPTH=2, WIDTH=640, HEIGHT=400 + +-> RGB values for the four colours used +CONST BLACK=$000, RED=$f00, GREEN=$0f0, BLUE=$00f + +DEF bitMap:bitmap, + displaymem=NIL -> Pointer for writing to BitMap memory +->>> + +->>> PROC main() +PROC main() HANDLE + -> E-Note: a lot of the globals are really local to main() + DEF view:view, oldview=NIL, viewPort:viewport, cm=NIL:PTR TO colormap, + vextra=NIL:PTR TO viewextra, vpextra=NIL:PTR TO viewportextra, + monspec=NIL, dimquery:dimensioninfo, depth, box, rasInfo:rasinfo, + modeID, colortable, boxoffsets:PTR TO INT, gfx:PTR TO gfxbase + gfx:=gfxbase -> E-Note: get the right type for gfxbase + + -> Set the plane pointers to NIL so the handler will know if they are used. + -> E-Note: this needs to be done *before* anything that may go wrong + FOR depth:=0 TO DEPTH-1 DO bitMap.planes[depth]:=NIL + + -> Example steals the screen from Intuition if Intuition is around. + oldview:=gfx.actiview -> Save current View to restore later. + + InitView(view) -> Initialise the View and set view.modes. + -> This is the old 1.3 way (only V_LACE counts). + view.modes:=view.modes OR V_LACE + + IF gfx.lib.version>=36 + -> Form the ModeID from values in 'graphics/displayinfo' + modeID:=DEFAULT_MONITOR_ID OR HIRESLACE_KEY + + -> Make the viewextra object + vextra:=GfxNew(VIEW_EXTRA_TYPE) + -> Attach the ViewExtra to the View + GfxAssociate(view, vextra) + view.modes:=view.modes OR EXTEND_VSTRUCT + + -> Create and attach a MonitorSpec to the ViewExtra + monspec:=OpenMonitor(NIL, modeID) + vextra.monitor:=monspec + ENDIF + + -> Initialise the BitMap for RasInfo. + InitBitMap(bitMap, DEPTH, WIDTH, HEIGHT) + + -> Allocate space for BitMap + FOR depth:=0 TO DEPTH-1 DO bitMap.planes[depth]:=AllocRaster(WIDTH, HEIGHT) + + -> Initialise the RasInfo. + rasInfo:=[NIL, bitMap, 0, 0]:rasinfo + + InitVPort(viewPort) -> Initialise the ViewPort. + view.viewport:=viewPort -> Link the ViewPort into the View. + viewPort.rasinfo:=rasInfo + viewPort.dwidth:=WIDTH + viewPort.dheight:=HEIGHT + + -> Set the display mode the old-fashioned way + viewPort.modes:=V_HIRES OR V_LACE + + IF gfx.lib.version>=36 + -> Make a ViewPortExtra and get ready to attach it + vpextra:=GfxNew(VIEWPORT_EXTRA_TYPE) + + -> Initialise the DisplayClip field of the ViewPortExtra + GetDisplayInfoData(NIL, dimquery, SIZEOF dimensioninfo, DTAG_DIMS, modeID) + CopyMem(dimquery.nominal, vpextra.displayclip, SIZEOF rectangle) + -> E-Note: FindDisplayInfo in a the tag-list later + + -> This is for backwards compatibility with, for example, a 1.3 screen + -> saver utility that looks at the Modes field. + viewPort.modes:=modeID AND $0000FFFF + ENDIF + + -> Initialize the ColorMap. + -> 2 planes deep, so 4 entries (2 raised to the #_planes power). + cm:=GetColorMap(4) + + IF gfx.lib.version>=36 + -> Attach the color map and Release 2 extended structures + VideoControl(cm, [VTAG_ATTACH_CM_SET, viewPort, + VTAG_VIEWPORTEXTRA_SET, vpextra, + VTAG_NORMAL_DISP_SET, FindDisplayInfo(modeID), + NIL]) + ELSE + -> Attach the ColorMap, old 1.3-style + viewPort.colormap:=cm + ENDIF + + colortable:=[BLACK, RED, GREEN, BLUE]:INT + -> Change colors to those in colortable. + LoadRGB4(viewPort, colortable, 4) + + MakeVPort(view, viewPort) -> Construct preliminary Copper instruction list. + + -> Merge preliminary lists into a real Copper list in the view object + MrgCop(view) + + -> Clear the ViewPort + FOR depth:=0 TO DEPTH-1 + displaymem:=bitMap.planes[depth] + BltClear(displaymem, bitMap.bytesperrow*bitMap.rows, 1) + ENDFOR + + LoadView(view) + + boxoffsets:=[802, 2010, 3218]:INT + -> Now fill some boxes so that user can see something. + -> Always draw into both planes to assure true colors. + FOR box:=1 TO 3 -> Three boxes; red, green and blue. + FOR depth:=0 TO DEPTH-1 -> Two planes + displaymem:=bitMap.planes[depth]+boxoffsets[box-1] + drawFilledBox(box, depth) + ENDFOR + ENDFOR + + Delay(10*TICKS_PER_SECOND) -> Pause for 10 seconds. + LoadView(oldview) -> Put back the old View. + WaitTOF() -> Wait until the View is being rendered to free memory. + + -> Deallocate the hardware Copper list created by MrgCopy(). Since this is + -> interlace, also check for a short frame copper list to free. + FreeCprList(view.lofcprlist) + IF view.shfcprlist THEN FreeCprList(view.shfcprlist) + + -> Free all intermediate Copper lists created by MakeVPort(). + FreeVPortCopLists(viewPort) + +EXCEPT DO + -> Free the color map created by GetColorMap() + IF cm THEN FreeColorMap(cm) + -> Free the ViewPortExtra created by GfxNew() + IF vpextra THEN GfxFree(vpextra) + -> Free the BitPlanes drawing area. + FOR depth:=0 TO DEPTH-1 + IF bitMap.planes[depth] THEN FreeRaster(bitMap.planes[depth], WIDTH, HEIGHT) + ENDFOR + -> Free the MonitorSpec created with OpenMonitor(). + IF monspec THEN CloseMonitor(monspec) + -> Free the ViewExtra created with GfxNew(). + IF vextra THEN GfxFree(vextra) + SELECT exception + CASE ERR_COLMAP; WriteF('Could not get ColorMap\n') + CASE ERR_FINDDISP; WriteF('Could not get DisplayInfo\n') + CASE ERR_GETDISP; WriteF('Could not get DimensionInfo\n') + CASE ERR_GFXNEW; WriteF('Could not get ViewExtra/ViewPortExtra\n') + CASE ERR_MONI; WriteF('Could not get MonitorSpec\n') + CASE ERR_RAST; WriteF('Could not get BitPlanes\n') + CASE ERR_VIDEO; WriteF('Could not attach extended structures\n') + ENDSELECT +ENDPROC IF exception<>ERR_NONE THEN RETURN_FAIL ELSE RETURN_OK +->>> + +->>> PROC drawFilledBox(fillcolor, plane) +-> Create a WIDTH/2 by HEIGHT/2 box of color "fillcolor" into the given plane +PROC drawFilledBox(fillcolor, plane) + DEF value, boxHeight, boxWidth, width + + -> Divide (WIDTH/2) by eight because each CHAR that is written stuffs eight + -> bits into the BitMap. + boxWidth:=(WIDTH/2)/8 + + value:=IF fillcolor AND Shl(1, plane) THEN $FF ELSE 0 + + -> E-Note: slightly re-expressed to read a lot better... + FOR boxHeight:=1 TO HEIGHT/2 + FOR width:=1 TO boxWidth DO displaymem[]++:=value + displaymem:=displaymem+(bitMap.bytesperrow-boxWidth) + ENDFOR +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/WBClone.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/WBClone.e new file mode 100644 index 0000000..a29a59d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/WBClone.e @@ -0,0 +1,294 @@ +-> WBClone.e - Clone the Workbench using graphics calls + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'exec/memory', + 'graphics/displayinfo', + 'graphics/gfx', + 'graphics/gfxnodes', + 'graphics/monitor', + 'graphics/rastport', + 'graphics/view', + 'graphics/videocontrol', + 'intuition/intuitionbase', + 'intuition/screens' + +ENUM ERR_NONE, ERR_CMAP, ERR_DINFO, ERR_GFXNEW, ERR_KICK, ERR_MONI + +RAISE ERR_CMAP IF GetColorMap()=NIL, + ERR_DINFO IF GetDisplayInfoData()=NIL, + ERR_GFXNEW IF GfxNew()=NIL, + ERR_KICK IF KickVersion()=FALSE, + ERR_MONI IF OpenMonitor()=NIL + +#define INTUITIONNAME 'intuition.library' +->>> + +->>> PROC destroyView(view:PTR TO view) +-> Close and free everything to do with the View +PROC destroyView(view:PTR TO view) + DEF ve:PTR TO viewextra + IF view + IF ve:=GfxLookUp(view) + IF ve.monitor THEN CloseMonitor(ve.monitor) + GfxFree(ve) + ENDIF + + -> Free up the copper lists + IF view.lofcprlist THEN FreeCprList(view.lofcprlist) + IF view.shfcprlist THEN FreeCprList(view.shfcprlist) + + Dispose(view) + ENDIF +ENDPROC +->>> + +->>> PROC dupView(v:PTR TO view, modeID) +-> Duplicate the View +PROC dupView(v:PTR TO view, modeID) HANDLE + -> Allocate and init a view OBJECT. Also, get a viewextra OBJECT and + -> attach the monitor type to the View. + DEF view=NIL:PTR TO view, ve=NIL:PTR TO viewextra, + mspc=NIL:PTR TO monitorspec + view:=NewM(SIZEOF view, MEMF_CLEAR OR MEMF_PUBLIC) + ve:=GfxNew(VIEW_EXTRA_TYPE) + mspc:=OpenMonitor(NIL, modeID) + InitView(view) + view.dyoffset:=v.dyoffset + view.dxoffset:=v.dxoffset + view.modes:=v.modes + GfxAssociate(view, ve) + ve.monitor:=mspc + RETURN view +EXCEPT + -> E-Note: C version is wrong; failure may happen before attaching to view + IF mspc THEN CloseMonitor(mspc) + IF ve THEN GfxFree(ve) + IF view THEN Dispose(view) + ReThrow() -> E-Note: pass on exception if it was an error +ENDPROC +->>> + +->>> PROC destroyViewPort(vp:PTR TO viewport) +-> Close and free everything to do with the viewport +PROC destroyViewPort(vp:PTR TO viewport) + DEF cm:PTR TO colormap, ti:PTR TO LONG + IF vp + -> Find the ViewPort's ColorMap. From that use VideoControl to get the + -> ViewPortExtra, and free it. + -> Then free the ColorMap, and finally the ViewPort itself. + IF cm:=vp.colormap + -> E-Note: ti[1] will be filled in by the call to VideoControl + IF VideoControl(cm, ti:=[VTAG_VIEWPORTEXTRA_GET, NIL, NIL])=NIL + GfxFree(ti[1]) + ELSE + WriteF('VideoControl error in destroyViewPort()\n') + ENDIF + + FreeColorMap(cm) + ELSE + WriteF('Could not free the ColorMap\n') + ENDIF + + FreeVPortCopLists(vp) + + Dispose(vp) + ENDIF +ENDPROC +->>> + +->>> PROC dupViewPort(vp:PTR TO viewport, modeID) +CONST COLOURS=32 -> E-Note: this is a bit out of date... + +-> Duplicate the ViewPort +PROC dupViewPort(vp:PTR TO viewport, modeID) HANDLE + -> Allocate and initialise a ViewPort. Copy the ViewPort width and heights, + -> offsets, and modes values. Allocate and initialise a ColorMap. + -> + -> Also, allocate a ViewPortExtra, and copy the TextOScan values of the + -> ModeID from the database into the ViewPortExtra. + DEF myvp=NIL:PTR TO viewport, vpe=NIL:PTR TO viewportextra, + cm=NIL:PTR TO colormap, query:dimensioninfo, colour, c + myvp:=NewM(SIZEOF viewport, MEMF_CLEAR OR MEMF_PUBLIC) + vpe:=GfxNew(VIEWPORT_EXTRA_TYPE) + cm:=GetColorMap(COLOURS) -> E-Note: use the constant that's been defined! + GetDisplayInfoData(NIL, query, SIZEOF dimensioninfo, DTAG_DIMS, modeID) + InitVPort(myvp) + + -> Duplicate the viewport object + myvp.dwidth:=vp.dwidth + myvp.dheight:=vp.dheight + myvp.dxoffset:=vp.dxoffset + myvp.dyoffset:=vp.dyoffset + myvp.modes:=vp.modes + myvp.spritepriorities:=vp.spritepriorities + myvp.extendedmodes:=vp.extendedmodes + + -> Duplicate the Overscan values + CopyMem(query.txtoscan, vpe.displayclip, SIZEOF rectangle) + + -> Attach everything together + IF VideoControl(cm, [VTAG_ATTACH_CM_SET, myvp, + VTAG_VIEWPORTEXTRA_SET, vpe, + VTAG_NORMAL_DISP_SET, FindDisplayInfo(modeID), + NIL]) + WriteF('VideoControl error in duplicateViewPort()\n') + ENDIF + + -> Copy the colours from the Workbench + FOR c:=0 TO COLOURS-1 + IF -1<>(colour:=GetRGB4(vp.colormap, c)) + SetRGB4CM(cm, c, Shr(colour, 8), Shr(colour, 4) AND $F, colour AND $F) + ENDIF + ENDFOR + RETURN myvp +EXCEPT + -> E-Note: C version is wrong; failure may happen before attaching to myvp + IF cm THEN FreeColorMap(cm) + IF vpe THEN GfxFree(vpe) + IF myvp THEN Dispose(myvp) + ReThrow() -> E-Note: pass on exception if an error +ENDPROC +->>> + +->>> PROC destroyBitMap(mybm:PTR TO bitmap, width, height, depth) +-> Close and free everything to do with the BitMap +PROC destroyBitMap(mybm:PTR TO bitmap, width, height, depth) + DEF i + IF mybm + FOR i:=0 TO depth-1 + IF mybm.planes[i] THEN FreeRaster(mybm.planes[i], width, height) + ENDFOR + Dispose(mybm) + ENDIF +ENDPROC +->>> + +->>> PROC createBitMap(width, height, depth) +-> Create the BitMap +PROC createBitMap(width, height, depth) HANDLE + -> Allocate a bitmap OBJECT, initialise it and allocate each plane. + DEF mybm:PTR TO bitmap, i + mybm:=NewM(SIZEOF bitmap, MEMF_CLEAR OR MEMF_PUBLIC) + InitBitMap(mybm, depth, width, height) + FOR i:=0 TO depth-1 + mybm.planes[i]:=AllocRaster(width, height) + ENDFOR + RETURN mybm +EXCEPT + -> E-Note: hey! the C version is OK this time! + destroyBitMap(mybm, width, height, depth) + ReThrow() -> E-Note: pass on exception if an error +ENDPROC +->>> + +->>> PROC showView(view, vp, bm, width, height) +-> Assemble and display the View +PROC showView(view:PTR TO view, vp:PTR TO viewport, bm:PTR TO bitmap, + width, height) HANDLE + -> Attach the BitMap to the ViewPort via a RasInfo. Attach the ViewPort to + -> the View. Clear the BitMap, and draw into it by attaching the BitMap to + -> a RastPort. Then MakeVPort(), MrgCop() and LoadView(). + -> Just wait for the user to press before returning. + DEF rp=NIL:PTR TO rastport, ri=NIL:PTR TO rasinfo + rp:=NewM(SIZEOF rastport, MEMF_CLEAR OR MEMF_PUBLIC) + ri:=NewM(SIZEOF rasinfo, MEMF_CLEAR OR MEMF_PUBLIC) + InitRastPort(rp) + rp.bitmap:=bm + ri.bitmap:=bm + vp.rasinfo:=ri + view.viewport:=vp + + -> Render + SetRast(rp, 0) -> Clear the background + SetAPen(rp, Shl(1, bm.depth)-1) -> Use the last pen + Move(rp, 0, 0) + Draw(rp, width, 0) + Draw(rp, width, height) + Draw(rp, 0, height) + Draw(rp, 0, 0) + + -> Display it + MakeVPort(view, vp) + MrgCop(view) + LoadView(view) + + -> E-Note: make this work even under Workbench + WriteF(''); Inp(IF stdin THEN stdin ELSE stdout) + + -> Bring back the system + RethinkDisplay() +EXCEPT DO + IF ri THEN Dispose(ri) + IF rp THEN Dispose(rp) + ReThrow() -> E-Note: pass on exception if an error +ENDPROC +->>> + +->>> PROC main() +-> Clone the Workbench View using Graphics Library calls. +PROC main() HANDLE + DEF wb=NIL:PTR TO screen, myview=NIL, myvp=NIL, mybm=NIL, + modeID, ibaseLock=NIL, intuition:PTR TO intuitionbase + + KickVersion(37) -> E-Note: requires V37 + + -> To clone the Workbench using graphics calls involves duplicating the + -> Workbench ViewPort, ViewPort mode, and Intuition's View. This also + -> involves duplicating the DisplayClip for the overscan value, the colours, + -> and the View position. + -> + -> When this is all done, the View, ViewPort, ColorMap and BitMap (and + -> ViewPortExtra, ViewExtra and RasInfo) all have to be linked together, and + -> the copperlists made to create the display. + -> + -> This is not as difficult as it sounds (trust me!) + + -> First, lock the Workbench screen, so no changes can be made to it while + -> we are duplicating it. + wb:=LockPubScreen('Workbench') + + -> Find the Workbench's ModeID. This is a 32-bit number that identifies the + -> monitor type, and the display mode of that monitor. + modeID:=GetVPModeID(wb.viewport) + + -> We need to duplicate Intuition's View structure, so lock IntuitionBase to + -> prevent the View changing under our feet. + ibaseLock:=LockIBase(0) + intuition:=intuitionbase -> E-Note: get the right type for intuitionbase + myview:=dupView(intuition.viewlord, modeID) + + -> The View has been cloned, so we don't need to keep it locked. + UnlockIBase(ibaseLock) + ibaseLock:=NIL -> E-Note: set to NIL so we don't Unlock it again + + -> Now duplicate the Workbench's ViewPort. Remember, we still have the + -> Workbench locked. + myvp:=dupViewPort(wb.viewport, modeID) + + -> Create a BitMap to render into. This will be of the same dimensions + -> as the Workbench. + mybm:=createBitMap(wb.width, wb.height, wb.bitmap.depth) + + -> Now we have everything copied, show something + showView(myview, myvp, mybm, wb.width-1, wb.height-1) + +EXCEPT DO + -> Free up everything we may have allocated or still have locked + IF mybm THEN destroyBitMap(mybm, wb.width, wb.height, wb.bitmap.depth) + IF myvp THEN destroyViewPort(myvp) + IF myview THEN destroyView(myview) + IF ibaseLock THEN UnlockIBase(ibaseLock) + IF wb THEN UnlockPubScreen(NIL, wb) + SELECT exception + CASE ERR_CMAP; WriteF('Could not get ColorMap\n') + CASE ERR_DINFO; WriteF('Display database error\n') + CASE ERR_GFXNEW; WriteF('Could not get the View-/ViewPort- Extra\n') + CASE ERR_KICK; WriteF('Requires at least V37\n') + CASE ERR_MONI; WriteF('Could not open monitor\n') + CASE "MEM"; WriteF('Ran out of memory\n') + ENDSELECT +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/genlockdemo.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/genlockdemo.e new file mode 100644 index 0000000..48c7b80 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/genlockdemo.e @@ -0,0 +1,403 @@ +-> genlockdemo.e - Genlock VideoControl example. + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'gadtools', + 'exec/libraries', + 'graphics/displayinfo', + 'graphics/gfxbase', + 'graphics/modeid', + 'graphics/text', + 'graphics/videocontrol', + 'graphics/view', + 'intuition/intuition', + 'intuition/screens', + 'libraries/gadtools', + 'utility/tagitem' + +ENUM ERR_NONE, ERR_CTXT, ERR_ECS, ERR_GAD, ERR_KICK, ERR_LIB, ERR_SCRN, + ERR_VIS, ERR_WIN + +RAISE ERR_CTXT IF CreateContext()=NIL, + ERR_GAD IF CreateGadgetA()=NIL, + ERR_KICK IF KickVersion()=FALSE, + ERR_LIB IF OpenLibrary()=NIL, + ERR_SCRN IF OpenScreenTagList()=NIL, + ERR_VIS IF GetVisualInfoA()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL, + "MEM" IF String()=NIL + +-> 'libraries/gadtools' does not define a library name. +#define GADTOOLSNAME 'gadtools.library' + +-> Some gadget ID's +ENUM BORDERBLANK_ID=16, BORDERNOTRANS_ID, BITPLANEKEY_ID, CHROMAPLANE_ID, + CHROMAKEY_ID + +-> E-Note: get the right type to use gfxbase +DEF gfx:PTR TO gfxbase +->>> + +->>> PROC main() +PROC main() HANDLE + DEF genscreen=NIL:PTR TO screen, controlwindow=NIL:PTR TO window, + glist=NIL, gadget:PTR TO gadget, hitgadget:PTR TO gadget, + vp:PTR TO viewport, viewlord:PTR TO view, vi=NIL, ng:PTR TO newgadget, + -> E-Note: C version is over-cautious about the size of vtags + imsg:PTR TO intuimessage, vtags[22]:ARRAY OF tagitem, + gadgetPtrs[21]:ARRAY OF LONG, iclass, icode, i, j, abort=FALSE, isPAL, + gfx:PTR TO gfxbase + gfx:=gfxbase -> E-Note: set-up correct typed gfxbase + KickVersion(37) + gadtoolsbase:=OpenLibrary(GADTOOLSNAME, 37) + IF 0=(gfx.chiprevbits0 AND GFXF_HR_DENISE) THEN Raise(ERR_ECS) + -> Check if the user happens to prefer PAL or if this is a true PAL system. + isPAL:=checkPAL('Workbench') + + -> Open a 'standard' HIRES screen. + genscreen:=OpenScreenTagList(NIL, + -> Give me 3D look window (I'll use a quiet screen). + [SA_PENS, [0, 1, 1, 2, 1, 3, 1, 0, 3, -1]:INT, + SA_DISPLAYID, HIRES_KEY, + SA_DEPTH, 4, + -> Give me a lot of border. + SA_WIDTH, 640, + SA_HEIGHT, IF isPAL THEN 256 ELSE 200, + SA_OVERSCAN, 0, + -> Hold the titlebar, please. + SA_QUIET, TRUE, + -> Give me a sysfont 1 as default rastport font. + SA_SYSFONT, 1, + NIL]) + -> Blast some colourbars in screen's rastport, leave some colour 0 gaps. + j:=0 + FOR i:=0 TO 15 + SetAPen(genscreen.rastport, i) + RectFill(genscreen.rastport, j+1, 0, j+30, IF isPAL THEN 255 ELSE 199) + j:=j+40 + ENDFOR + -> A line to show where borders start. + SetAPen(genscreen.rastport, 5) + Move(genscreen.rastport, 0, 0) + Draw(genscreen.rastport, genscreen.width-1, 0) + Draw(genscreen.rastport, genscreen.width-1, genscreen.height-1) + Draw(genscreen.rastport, 0, genscreen.height-1) + Draw(genscreen.rastport, 0, 0) + + -> Open a restricted window, no dragging or sizing, just closing (don't + -> want to refresh screen). + controlwindow:=OpenWindowTagList(NIL, + [WA_TITLE, 'VideoControl', + WA_LEFT, 210, + WA_TOP, 20, + WA_WIDTH, 220, + WA_HEIGHT, 150, + WA_CUSTOMSCREEN, genscreen, + WA_FLAGS, WFLG_CLOSEGADGET OR WFLG_ACTIVATE OR + WFLG_NOCAREREFRESH, + WA_IDCMP, IDCMP_CLOSEWINDOW OR IDCMP_GADGETUP, + NIL]) + -> OK, got a window, lets make some gadgets. + vi:=GetVisualInfoA(genscreen, [NIL]) + gadget:=CreateContext({glist}) + ng:=[controlwindow.borderleft+120, controlwindow.bordertop+2, + 12, 12, + -> Just a demo, set everything to topaz 80. + 'BORDERBLANK', ['topaz.font', 8, 0, 0]:textattr, + BORDERBLANK_ID, PLACETEXT_LEFT OR NG_HIGHLABEL, + vi, NIL]:newgadget + -> E-Note: the C version fails to check the return value of every single one + -> of the calls to CreateGadgetA(), which is fatal since "gadget" is + -> dereferenced as "gadget.height" (we are using automatic exceptions) + gadget:=CreateGadgetA(CHECKBOX_KIND, gadget, ng, [NIL]) + gadgetPtrs[BORDERBLANK_ID]:=gadget + + ng.topedge:=ng.topedge+gadget.height+2 + ng.gadgettext:='BORDERNOTRANS' + ng.gadgetid:=BORDERNOTRANS_ID + gadget:=CreateGadgetA(CHECKBOX_KIND, gadget, ng, [NIL]) + gadgetPtrs[BORDERNOTRANS_ID]:=gadget + + ng.topedge:=ng.topedge+gadget.height+2 + ng.gadgettext:='CHROMAKEY' + ng.gadgetid:=CHROMAKEY_ID + gadget:=CreateGadgetA(CHECKBOX_KIND, gadget, ng, [NIL]) + gadgetPtrs[CHROMAKEY_ID]:=gadget + + ng.topedge:=ng.topedge+gadget.height+2 + ng.gadgettext:='BITPLANEKEY' + ng.gadgetid:=BITPLANEKEY_ID + gadget:=CreateGadgetA(CHECKBOX_KIND, gadget, ng, [NIL]) + gadgetPtrs[BITPLANEKEY_ID]:=gadget + + ng.topedge:=ng.topedge+gadget.height+2 + ng.width:=90 + ng.gadgettext:='CHROMAPLANE' + ng.gadgetid:=CHROMAPLANE_ID + gadget:=CreateGadgetA(CYCLE_KIND, gadget, ng, + [GTCY_LABELS, ['Plane 0', 'Plane 1', 'Plane 2', 'Plane 3', NIL], + NIL]) + gadgetPtrs[CHROMAPLANE_ID]:=gadget + + ng.topedge:=ng.topedge+gadget.height+20 + ng.width:=12 + ng.flags:=PLACETEXT_ABOVE OR NG_HIGHLABEL + FOR j:=0 TO 1 + FOR i:=0 TO 7 + ng.leftedge:=controlwindow.borderleft+2+(i*gadget.width) + -> E-Note: we can let E clear up all the E-strings we make + ng.gadgettext:=StringF(String(3), '\d', i+(j*8)) + ng.gadgetid:=i+(j*8) + gadget:=CreateGadgetA(CHECKBOX_KIND, gadget, ng, [NIL]) + -> E-Note: C version gets the index wrong + gadgetPtrs[i+(j*8)]:=gadget + ENDFOR + ng.topedge:=ng.topedge+gadget.height + ng.flags:=PLACETEXT_BELOW OR NG_HIGHLABEL + ENDFOR + + AddGList(controlwindow, glist, -1, -1, NIL) + RefreshGList(glist, controlwindow, NIL, -1) + Gt_RefreshWindow(controlwindow, NIL) + + -> Finally, a window with some gadgets... + -> + -> Get the current genlock state. Obviously I already know what the settings + -> will be (all off), since I opened the screen myself. Do it just to show + -> how to get them. + vp:=genscreen.viewport + + -> Is borderblanking on? + vtags[0].tag:=VTAG_BORDERBLANK_GET + vtags[0].data:=NIL + + -> Is bordertransparent set? + vtags[1].tag:=VTAG_BORDERNOTRANS_GET + vtags[1].data:=NIL + + -> Key on bitplane? + vtags[2].tag:=VTAG_BITPLANEKEY_GET + vtags[2].data:=NIL + + -> Get plane which is used to key on + vtags[3].tag:=VTAG_CHROMA_PLANE_GET + vtags[3].data:=NIL + + -> Chromakey overlay on? + vtags[4].tag:=VTAG_CHROMAKEY_GET + vtags[4].data:=NIL + + FOR i:=0 TO 15 + -> Find out which colours overlay + vtags[i+5].tag:=VTAG_CHROMA_PEN_GET + vtags[i+5].data:=i + ENDFOR + + -> Indicate end of tag array + vtags[21].tag:=VTAG_END_CM + vtags[21].data:=NIL + + -> And send the commands. On return the Tags themselves will indicate the + -> genlock settings for this ViewPort's ColorMap. + VideoControl(vp.colormap, vtags) + + -> And initialise the gadgets, according to genlock settings. + + IF vtags[0].tag=VTAG_BORDERBLANK_SET + Gt_SetGadgetAttrsA(gadgetPtrs[BORDERBLANK_ID], controlwindow, NIL, + [GTCB_CHECKED, TRUE, NIL]) + ENDIF + IF vtags[1].tag=VTAG_BORDERNOTRANS_SET + Gt_SetGadgetAttrsA(gadgetPtrs[BORDERNOTRANS_ID], controlwindow, NIL, + [GTCB_CHECKED, TRUE, NIL]) + ENDIF + IF vtags[2].tag=VTAG_BITPLANEKEY_SET + Gt_SetGadgetAttrsA(gadgetPtrs[BITPLANEKEY_ID], controlwindow, NIL, + [GTCB_CHECKED, TRUE, NIL]) + ENDIF + IF vtags[3].tag=VTAG_CHROMA_PLANE_SET + Gt_SetGadgetAttrsA(gadgetPtrs[CHROMAPLANE_ID], controlwindow, NIL, + [GTCY_ACTIVE, vtags[3].data, NIL]) + ENDIF + IF vtags[4].tag=VTAG_CHROMAKEY_SET + Gt_SetGadgetAttrsA(gadgetPtrs[CHROMAKEY_ID], controlwindow, NIL, + [GTCB_CHECKED, TRUE, NIL]) + ENDIF + FOR i:=0 TO 15 + IF vtags[i+5].tag=VTAG_CHROMA_PEN_SET + -> E-Note: C version fails to terminate the tag list! + Gt_SetGadgetAttrsA(gadgetPtrs[i], controlwindow, NIL, + [GTCB_CHECKED, TRUE, NIL]) + ENDIF + ENDFOR + + -> Will only send single commands from here on. + vtags[1].tag:=VTAG_END_CM + + -> Get user input. + REPEAT + WaitPort(controlwindow.userport) + WHILE imsg:=Gt_GetIMsg(controlwindow.userport) + iclass:=imsg.class + icode:=imsg.code + hitgadget:=imsg.iaddress + Gt_ReplyIMsg(imsg) + + -> E-Note: C version uses obsolete tags + SELECT iclass + CASE IDCMP_GADGETUP + IF hitgadget.gadgetid < 16 + IF hitgadget.flags AND GFLG_SELECTED + -> Set colour key + vtags[0].tag:=VTAG_CHROMA_PEN_SET + ELSE + -> Clear colour key + vtags[0].tag:=VTAG_CHROMA_PEN_CLR + ENDIF + ELSE + i:=hitgadget.gadgetid + SELECT i + CASE BORDERBLANK_ID + IF hitgadget.flags AND GFLG_SELECTED + -> Set border blanking on + vtags[0].tag:=VTAG_BORDERBLANK_SET + ELSE + -> Turn border blanking off + vtags[0].tag:=VTAG_BORDERBLANK_CLR + ENDIF + CASE BORDERNOTRANS_ID + IF hitgadget.flags AND GFLG_SELECTED + -> Set border transparency on + vtags[0].tag:=VTAG_BORDERNOTRANS_SET + ELSE + -> Turn border transparency off + vtags[0].tag:=VTAG_BORDERNOTRANS_CLR + ENDIF + CASE BITPLANEKEY_ID + IF hitgadget.flags AND GFLG_SELECTED + -> Key on current selected bitplane (chromaplane) + vtags[0].tag:=VTAG_BITPLANEKEY_SET + ELSE + -> Turn bitplane keying off + vtags[0].tag:=VTAG_BITPLANEKEY_CLR + ENDIF + CASE BITPLANEKEY_ID + IF hitgadget.flags AND GFLG_SELECTED + -> Key on current selected bitplane (chromaplane) + vtags[0].tag:=VTAG_BITPLANEKEY_SET + ELSE + -> Turn bitplane keying off + vtags[0].tag:=VTAG_BITPLANEKEY_CLR + ENDIF + CASE CHROMAPLANE_ID + -> Set plane to key on + vtags[0].tag:=VTAG_CHROMA_PLANE_SET + vtags[0].data:=icode + CASE BITPLANEKEY_ID + IF hitgadget.flags AND GFLG_SELECTED + -> Key on current selected bitplane (chromaplane) + vtags[0].tag:=VTAG_BITPLANEKEY_SET + ELSE + -> Turn bitplane keying off + vtags[0].tag:=VTAG_BITPLANEKEY_CLR + ENDIF + CASE CHROMAKEY_ID + IF hitgadget.flags AND GFLG_SELECTED + -> Set chromakey overlay on + vtags[0].tag:=VTAG_CHROMAKEY_SET + ELSE + -> Turn chromakey overlay off + vtags[0].tag:=VTAG_CHROMAKEY_CLR + ENDIF + ENDSELECT + ENDIF + + -> Send video command. + VideoControl(vp.colormap, vtags) + -> Get the View for this genlock screen. + viewlord:=ViewAddress() + -> And remake the ViewPort. + MakeVPort(viewlord, vp) + MrgCop(viewlord) + LoadView(viewlord) + + CASE IDCMP_CLOSEWINDOW + -> Get out of here. + abort:=TRUE + ENDSELECT + ENDWHILE + UNTIL abort + + RemoveGList(controlwindow, glist, -1) + +EXCEPT DO + -> E-Note: works even if glist=NIL + FreeGadgets(glist) + IF vi THEN FreeVisualInfo(vi) + IF controlwindow THEN CloseWindow(controlwindow) + IF genscreen THEN CloseScreen(genscreen) + -> E-Note: the E-strings used for gadget text will be freed automatically + IF gadtoolsbase THEN CloseLibrary(gadtoolsbase) + imsg:=NIL -> E-Note: get ready to receive a possible error message + SELECT exception + CASE ERR_CTXT; imsg:='Can''t create gadget context' + CASE ERR_ECS; imsg:='Requires ECS' + CASE ERR_GAD; imsg:='Can''t create gadget' + CASE ERR_KICK; imsg:='Requires V37' + CASE ERR_LIB; imsg:='Unable to open gadtools.library' + CASE ERR_SCRN; imsg:='Can''t open screen' + CASE ERR_VIS; imsg:='Can''t get visual info' + CASE ERR_WIN; imsg:='Can''t open window' + CASE "MEM"; imsg:='Out of memory' + ENDSELECT + IF imsg THEN EasyRequestArgs(NIL, [SIZEOF easystruct, 0, 'GenlockDemo', + '\s', 'Continue']:easystruct, + NIL, [imsg]) +ENDPROC +->>> + +->>> PROC checkPAL(screenname) +-> Generic routine to check for a PAL System. CheckPAL returns TRUE, if the +-> videomode of the specified public screen (or default videmode) is PAL. If +-> the screenname is NIL, the default public screen will be used. +PROC checkPAL(screenname) + DEF screen:PTR TO screen, modeID=LORES_KEY, displayinfo:displayinfo, isPAL + IF gfx.lib.version>=36 + -> We got V36, so lets use the new calls to find out what kind of videomode + -> the user (hopefully) prefers. + IF screen:=LockPubScreen(screenname) + -> Use graphics.library/GetVPModeID() to get the ModeID of the specified + -> screen. Will use the default public screen (Workbench most of the + -> time) if NIL. It is _very_ unlikely that this would be invalid, heck + -> it's impossible. + IF INVALID_ID<>(modeID:=GetVPModeID(screen.viewport)) + -> If the screen is in VGA mode, we can't tell whether the system is PAL + -> or NTSC. So to be foolproof we fall back to the displayinfo of the + -> default.monitor by inquiring about just the LORES_KEY displaymode if + -> we don't know. The default.monitor reflects the initial video setup + -> of the system, thus is an alias for either ntsc.monitor or + -> pal.monitor. We only use the displaymode of the specified public + -> screen if it's display mode is PAL or NTSC and NOT the default. + IF ((modeID AND MONITOR_ID_MASK)<>NTSC_MONITOR_ID) AND + ((modeID AND MONITOR_ID_MASK)<>PAL_MONITOR_ID) + modeID:=LORES_KEY + ENDIF + ENDIF + UnlockPubScreen(NIL, screen) + ENDIF + -> If fails modeID=LORES_KEY. Can't lock screen, so fall back on + -> default monitor. + IF GetDisplayInfoData(NIL, displayinfo, SIZEOF displayinfo, + DTAG_DISP, modeID) + -> Currently the default monitor is always either PAL or NTSC. + isPAL:=displayinfo.propertyflags AND DIPF_IS_PAL + ENDIF + ELSE + -> < V36. The enhancements to the videosystem in V36 cannot be better + -> expressed than with the simple way to determine PAL in V34. + isPAL:=gfx.displayflags AND PAL + ENDIF +ENDPROC isPAL +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/usercopperexample.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/usercopperexample.e new file mode 100644 index 0000000..547e082 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Primitives/usercopperexample.e @@ -0,0 +1,135 @@ +-> UserCopperExample.e - User Copper List Example + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'dos/dos', + 'exec/memory', + 'graphics/copper', + 'graphics/gfxmacros', + 'graphics/text', + 'graphics/videocontrol', + 'graphics/view', + 'hardware/custom', + 'intuition/intuition', + 'intuition/preferences', + 'intuition/screens' + +ENUM ERR_NONE, ERR_KICK, ERR_SCRN, ERR_WIN + +RAISE ERR_KICK IF KickVersion()=FALSE, + ERR_SCRN IF OpenScreenTagList()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL, + "MEM" IF AllocMem()=NIL + +DEF screen=NIL:PTR TO screen, window=NIL:PTR TO window, + -> E-Note: set-up custom + custom=CUSTOMADDR:PTR TO custom +->>> + +->>> PROC main() +PROC main() HANDLE + DEF ret_val=RETURN_OK, viewPort:PTR TO viewport + -> Open a screen and a window + openAll() + -> Create and attach the user Copper list. + loadCopper() + -> Wait until the user clicks in the close gadget. + REPEAT + UNTIL WaitIMessage(window)=IDCMP_CLOSEWINDOW +EXCEPT DO + IF window + viewPort:=ViewPortAddress(window) + IF viewPort.ucopins + -> Free the memory allocated for the Copper list. + FreeVPortCopLists(viewPort) + RemakeDisplay() + ENDIF + CloseWindow(window) + ENDIF + IF screen THEN CloseScreen(screen) + SELECT exception + CASE ERR_KICK; WriteF('Error: requires V37\n') + ret_val:=ERROR_INVALID_RESIDENT_LIBRARY + CASE ERR_SCRN; WriteF('Error: failed to open screen\n') + ret_val:=ERROR_NO_FREE_STORE + CASE ERR_WIN; WriteF('Error: failed to open window\n') + ret_val:=ERROR_NO_FREE_STORE + CASE "MEM"; WriteF('Error: ran out of memory\n') + ret_val:=ERROR_NO_FREE_STORE + ENDSELECT +ENDPROC ret_val +->>> + +->>> PROC openAll() +CONST MY_WA_WIDTH=270 -> Width of window. + +-> Opens screen and window +-> E-Note: any exception raised here will be handled by the caller +PROC openAll() + KickVersion(37) + screen:=OpenScreenTagList(NIL, + [SA_OVERSCAN, OSCAN_STANDARD, + SA_TITLE, 'User Copper List Example', + SA_FONT, ['topaz.font', TOPAZ_SIXTY, 0, 0]:textattr, + NIL]) + -> E-Note: C version uses obsolete tags, and in fact used an IDCMP flag, + -> INACTIVEWINDOW, with WA_FLAGS (I guess they meant WFLG_ACTIVATE) + window:=OpenWindowTagList(NIL, + [WA_CUSTOMSCREEN, screen, + WA_TITLE, '<- Click here to quit.', + WA_IDCMP, IDCMP_CLOSEWINDOW, + WA_FLAGS, WFLG_DRAGBAR OR WFLG_CLOSEGADGET OR + WFLG_ACTIVATE, + WA_LEFT, (screen.width-MY_WA_WIDTH)/2, + WA_TOP, screen.height/2, + WA_HEIGHT, screen.font.ysize+3, + WA_WIDTH, MY_WA_WIDTH, + NIL]) +ENDPROC +->>> + +->>> PROC loadCopper() +CONST NUMCOLORS=32 + +-> Creates a Copper list program and adds it to the system +-> E-Note: again, any exception raised here will be handled by the caller +PROC loadCopper() + DEF i, scanlines_per_color, viewPort:PTR TO viewport, uCopList, + spectrum:PTR TO INT + -> Allocate memory for the Copper list. + -> Make certain that the initial memory is cleared. + -> E-Note: we *have* to use AllocMem() since FreeVPortCopLists() is used + uCopList:=AllocMem(SIZEOF ucoplist, MEMF_PUBLIC OR MEMF_CLEAR) + + -> Initialise the Copper list buffer. + CINIT(uCopList, NUMCOLORS) + + scanlines_per_color:=screen.height/NUMCOLORS + + spectrum:=[$0604, $0605, $0606, $0607, $0617, $0618, $0619, $0629, + $072a, $073b, $074b, $074c, $075d, $076e, $077e, $088f, + $07af, $06cf, $05ff, $04fb, $04f7, $03f3, $07f2, $0bf1, + $0ff0, $0fc0, $0ea0, $0e80, $0e60, $0d40, $0d20, $0d00]:INT + -> Load in each color. + FOR i:=0 TO NUMCOLORS-1 + CWAIT(uCopList, i*scanlines_per_color, 0) + -> E-Note: hard to use CMOVE() due to use of {}, which CMOVEA() eliminates + -> E-Note: use the offset constant COLOR plus n*SIZEOF INT for n-th color + CMOVEA(uCopList, CUSTOMADDR+COLOR+0, spectrum[i]) + ENDFOR + + CEND(uCopList) -> End the Copper list. + + viewPort:=ViewPortAddress(window) -> Get a pointer to the ViewPort. + Forbid() -> Forbid task switching while changing the Copper list. + viewPort.ucopins:=uCopList + Permit() -> Permit task switching again. + + -> Enable user Copper list clipping this ViewPort. + VideoControl(viewPort.colormap, [VTAG_USERCLIP_SET, NIL, NIL]) + + RethinkDisplay() -> Display the new Copper list. +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/animtools.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/animtools.e new file mode 100644 index 0000000..a517d95 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/animtools.e @@ -0,0 +1,356 @@ +-> animtools.e +-> +-> This file is a collection of tools which are used with the VSprite, Bob and +-> Animation system software. It is intended as a useful EXAMPLE, and while it +-> shows what must be done, it is not the only way to do it. If Not Enough +-> Memory, or error return, each cleans up after itself before returning. +-> NOTE that these routines assume a very specific structure to the GEL lists. +-> Make sure that you use the correct pairs together +-> (i.e., makeOb()/freeOb()) + +->>> Header (globals) +OPT MODULE, PREPROCESS +OPT EXPORT + +MODULE 'exec/memory', + 'graphics/gels', + 'graphics/gfx', + 'graphics/rastport' + +-> 'intuition/intuitionbase' does not define a library name. +#define INTUITIONNAME 'intuition.library' + +-> These objects are used by the functions below to allow for an easier +-> interface to the animation system. +->>> + +->>> OBJECT newVSprite +-> Object to hold information for a new VSprite. +OBJECT newVSprite + image:PTR TO INT -> Image data for the VSprite + colorSet:PTR TO INT -> Colour array for the VSprite + wordWidth:INT -> Width in words + lineHeight:INT -> Height in lines + imageDepth:INT -> Depth of the image + x:INT -> Initial x position + y:INT -> Initial y position + flags:INT -> VSprite flags + hitMask:INT -> Hit mask + meMask:INT -> Me mask +ENDOBJECT +->>> + +->>> OBJECT newBob +-> Object to hold information for a new Bob. +OBJECT newBob + image:PTR TO INT -> Image data FOR the Bob + wordWidth:INT -> Width in words + lineHeight:INT -> Height in lines + imageDepth:INT -> Depth of the image + planePick:INT -> Planes that get image data + planeOnOff:INT -> Unused planes to turn on + bFlags:INT -> Bob flags + dBuf:INT -> 1=double buf, 0=not + rasDepth:INT -> Depth of the raster + x:INT -> Initial x position + y:INT -> Initial y position + hitMask:INT -> Hit mask + meMask:INT -> Me mask +ENDOBJECT +->>> + +->>> OBJECT newAnimComp +-> Object to hold information for a new animation component. +OBJECT newAnimComp + routine:LONG -> Routine called when Comp IS displayed + xt:INT -> Initial delta offset position + yt:INT + time:INT -> Initial timer value + cFlags:INT -> Flags for the Comp +ENDOBJECT +->>> + +->>> OBJECT newAnimSeq +-> Object to hold information for a new animation sequence. +OBJECT newAnimSeq + headOb:PTR TO ao -> Common head of object + images:PTR TO INT -> Array of Comp image data + xt:PTR TO INT -> Arrays of initial offsets + yt:PTR TO INT + times:PTR TO INT -> Array of initial timer values + routines:PTR TO LONG -> Array of functions called when Comp is drawn + cFlags:INT -> Flags for the Comp + count:INT -> Number of Comps in sequence (= arrays size) + singleImage:INT -> One (or count) images +ENDOBJECT +->>> + +->>> PROC setupGelSys(rPort:PTR TO rastport, reserved) HANDLE +-> Setup the GELs system. After this call is made you can use VSprites, Bobs, +-> AnimComps and AnimObs. Note that this links the GelsInfo structure into the +-> RastPort, and calls InitGels(). It uses information in your rastport +-> object to establish boundary collision defaults at the outer edges of the +-> raster. This routine sets up for everything - collision detection and all. +-> You must already have run LoadView before ReadyGelSys is called. +PROC setupGelSys(rPort:PTR TO rastport, reserved) HANDLE + DEF gInfo=NIL:PTR TO gelsinfo, vsHead=NIL:PTR TO vs, vsTail=NIL:PTR TO vs + NEW gInfo, vsHead, vsTail + NEW gInfo.nextline[8], gInfo.lastcolor[8], gInfo.collhandler + gInfo.sprrsrvd:=reserved + -> Set left- and top-most to 1 to better keep items inside the display + -> boundaries. + gInfo.leftmost:=1; gInfo.topmost:=1 + gInfo.rightmost:=(rPort.bitmap.bytesperrow*8)-1 + gInfo.bottommost:=rPort.bitmap.rows-1 + rPort.gelsinfo:=gInfo + InitGels(vsHead, vsTail, gInfo) +EXCEPT + IF gInfo THEN END gInfo.nextline[8], gInfo.lastcolor[8], gInfo.collhandler + END gInfo, vsHead, vsTail + ReThrow() +ENDPROC gInfo +->>> + +->>> PROC cleanupGelSys(gInfo:PTR TO gelsinfo, rPort:PTR TO rastport) +-> Free all of the stuff allocated by setupGelSys(). Only call this routine if +-> setupGelSys() returned successfully. The GelsInfo structure IS the one +-> returned by setupGelSys(). It also unlinks the GelsInfo from the RastPort. +PROC cleanupGelSys(gInfo:PTR TO gelsinfo, rPort:PTR TO rastport) + rPort.gelsinfo:=NIL + END gInfo.nextline[8], gInfo.lastcolor[8], gInfo.collhandler, + gInfo.gelhead, gInfo.geltail + END gInfo +ENDPROC +->>> + +->>> PROC makeVSprite(nVSprite:PTR TO newVSprite) HANDLE +-> Create a VSprite from the information given in nVSprite. Use freeVSprite() +-> to free this GEL. +PROC makeVSprite(nVSprite:PTR TO newVSprite) HANDLE + DEF vsprite=NIL:PTR TO vs, line_size, plane_size + line_size:=SIZEOF INT * nVSprite.wordWidth + plane_size:=line_size * nVSprite.lineHeight + NEW vsprite + vsprite.borderline := NewM(line_size, MEMF_CHIP) + vsprite.collmask := NewM(plane_size, MEMF_CHIP) + vsprite.y := nVSprite.y + vsprite.x := nVSprite.x + vsprite.vsflags := nVSprite.flags + vsprite.width := nVSprite.wordWidth + vsprite.depth := nVSprite.imageDepth + vsprite.height := nVSprite.lineHeight + vsprite.memask := nVSprite.meMask + vsprite.hitmask := nVSprite.hitMask + vsprite.imagedata := nVSprite.image + vsprite.sprcolors := nVSprite.colorSet + vsprite.planepick := 0 + vsprite.planeonoff := 0 + InitMasks(vsprite) +EXCEPT + IF vsprite + Dispose(vsprite.borderline) + Dispose(vsprite.collmask) + ENDIF + END vsprite + ReThrow() +ENDPROC vsprite +->>> + +->>> PROC makeBob(nBob:PTR TO newBob) HANDLE +-> Create a Bob from the information given in nBob. Use freeBob() to free this +-> GEL. A VSprite is created for this bob. This routine properly allocates +-> all double buffered information if it is required. +PROC makeBob(nBob:PTR TO newBob) HANDLE + DEF bob=NIL:PTR TO bob, vsprite=NIL:PTR TO vs, rassize + rassize:=SIZEOF INT * nBob.wordWidth * nBob.lineHeight * nBob.rasDepth + NEW bob + bob.savebuffer:=NewM(rassize, MEMF_CHIP) + vsprite:=makeVSprite([nBob.image, NIL, nBob.wordWidth, nBob.lineHeight, + nBob.imageDepth, nBob.x, nBob.y, nBob.bFlags, + nBob.hitMask, nBob.meMask]:newVSprite) + vsprite.planepick:=nBob.planePick + vsprite.planeonoff:=nBob.planeOnOff + vsprite.vsbob:=bob + bob.bobvsprite:=vsprite + bob.imageshadow:=vsprite.collmask + bob.bobflags:=0 + bob.before:=NIL + bob.after:=NIL + bob.bobcomp:=NIL + + IF nBob.dBuf + NEW bob.dbuffer + bob.dbuffer.bufbuffer:=NewM(rassize, MEMF_CHIP) + ELSE + bob.dbuffer:=NIL + ENDIF +EXCEPT + IF vsprite THEN freeVSprite(vsprite) + IF bob + IF bob.dbuffer THEN Dispose(bob.dbuffer.bufbuffer) + END bob.dbuffer + Dispose(bob.savebuffer) + ENDIF + END bob + ReThrow() +ENDPROC bob +->>> + +->>> PROC makeComp(nBob:PTR TO newBob, nAnimComp:PTR TO newAnimComp) HANDLE +-> Create a Animation Component from the information given in nAnimComp and +-> nBob. Use freeComp() to free this GEL. makeComp() calls makeBob(), and +-> links the Bob into an AnimComp. +PROC makeComp(nBob:PTR TO newBob, nAnimComp:PTR TO newAnimComp) HANDLE + DEF compBob=NIL:PTR TO bob, aComp=NIL:PTR TO ac + NEW aComp + compBob:=makeBob(nBob) + compBob.before:=NIL + compBob.after:=NIL + compBob.bobcomp:=aComp -> Link 'em up + aComp.animbob := compBob + aComp.timeset := nAnimComp.time -> Number of ticks active + aComp.ytrans := nAnimComp.yt -> Offset relative to HeadOb + aComp.xtrans := nAnimComp.xt + aComp.animcroutine := nAnimComp.routine + aComp.compflags := nAnimComp.cFlags + aComp.timer := 0 + aComp.prevseq := NIL + aComp.nextseq := NIL + aComp.prevcomp := NIL + aComp.nextcomp := NIL + aComp.headob := NIL +EXCEPT + -> E-Note: Don't need to freeBob(compBob)... + END aComp + ReThrow() +ENDPROC aComp +->>> + +->>> PROC makeSeq(nBob:PTR TO newBob, nAnimSeq:PTR TO newAnimSeq) HANDLE +-> Create an Animation Sequence from the information given in nAnimSeq and +-> nBob. Use freeSeq() to free this GEL. This routine creates a linked list +-> of animation components which make up the animation sequence. It links them +-> all up, making a circular list of the prevseq and nextseq pointers. That is +-> to say, the first component of the sequence's prevseq points to the last +-> component; the last component of the sequence's nextseq points back to the +-> first component. If dbuf is on, the underlying Bobs will be set up for +-> double buffering. If singleImage is non-zero, the 'images' pointer is +-> assumed to point to an array of only one image, instead of an array of +-> 'count' images, and all Bobs will use the same image. +PROC makeSeq(nBob:PTR TO newBob, nAnimSeq:PTR TO newAnimSeq) HANDLE + DEF seq, firstCompInSeq=NIL:PTR TO ac, seqComp=NIL:PTR TO ac, + lastCompMade=NIL:PTR TO ac, image_size, nAnimComp:newAnimComp + -> Get the initial image. This is the only image that is used if + -> nAnimSeq.singleImage is non-zero. + nBob.image:=nAnimSeq.images + image_size:=nBob.lineHeight * nBob.imageDepth * nBob.wordWidth + + -> For each comp in the sequence + FOR seq:=0 TO nAnimSeq.count-1 + nAnimComp.xt := nAnimSeq.xt[seq] + nAnimComp.yt := nAnimSeq.yt[seq] + nAnimComp.time := nAnimSeq.times[seq] + nAnimComp.routine := nAnimSeq.routines[seq] + nAnimComp.cFlags := nAnimSeq.cFlags + seqComp:=makeComp(nBob, nAnimComp) + seqComp.headob:=nAnimSeq.headOb + -> Make a note of where the first component is. + IF firstCompInSeq=NIL THEN firstCompInSeq:=seqComp + -> Link the component into the list + IF lastCompMade<>NIL THEN lastCompMade.nextseq:=seqComp + seqComp.nextseq:=NIL + seqComp.prevseq:=lastCompMade + lastCompMade:=seqComp + -> If nAnimSeq.singleImage is zero, the image array has nAnimSeq.count + -> images. + IF nAnimSeq.singleImage=0 + -> E-Note: image_size is in INTs so multiply up first + nBob.image:=nBob.image+(image_size*SIZEOF INT) + ENDIF + ENDFOR + -> On the last component in the sequence, set Next/Prev to make the linked + -> list a loop of components. + lastCompMade.nextseq:=firstCompInSeq + firstCompInSeq.prevseq:=lastCompMade +EXCEPT + IF firstCompInSeq THEN freeSeq(firstCompInSeq, nBob.rasDepth) + ReThrow() +ENDPROC firstCompInSeq +->>> + +->>> PROC freeVSprite(vsprite:PTR TO vs) +-> Free the data created by makeVSprite(). Assumes images deallocated +-> elsewhere. +PROC freeVSprite(vsprite:PTR TO vs) + DEF line_size, plane_size + line_size:=SIZEOF INT * vsprite.width + plane_size:=line_size * vsprite.height + Dispose(vsprite.borderline) + Dispose(vsprite.collmask) + END vsprite +ENDPROC +->>> + +->>> PROC freeBob(bob:PTR TO bob, rasdepth) +-> Free the data created by makeBob(). It's important that rasdepth match the +-> depth you passed to makeBob() when this GEL was made. Assumes images +-> deallocated elsewhere. +PROC freeBob(bob:PTR TO bob, rasdepth) + DEF rassize + rassize:=SIZEOF INT * bob.bobvsprite.width * bob.bobvsprite.height * rasdepth + IF bob.dbuffer THEN Dispose(bob.dbuffer.bufbuffer) + END bob.dbuffer + Dispose(bob.savebuffer) + freeVSprite(bob.bobvsprite) + END bob +ENDPROC +->>> + +->>> PROC freeComp(myComp:PTR TO ac, rasdepth) +-> Free the data created by makeComp(). It's important that rasdepth match +-> the depth you passed to makeComp() when this GEL was made. Assumes images +-> deallocated elsewhere. +PROC freeComp(myComp:PTR TO ac, rasdepth) + freeBob(myComp.animbob, rasdepth) + END myComp +ENDPROC +->>> + +->>> PROC freeSeq(headComp:PTR TO ac, rasdepth) +-> Free the data created by makeSeq(). Complementary to makeSeq(), this +-> routine goes through the nextseq pointers and frees the Comps. This routine +-> only goes forward through the list, and so it must be passed the first +-> component in the sequence, or the sequence must be circular (which is +-> guaranteed if you use makeSeq()). It's important that rasdepth match the +-> depth you passed to makeSeq() when this GEL was made. Assumes images +-> deallocated elsewhere! +PROC freeSeq(headComp:PTR TO ac, rasdepth) + DEF curComp:PTR TO ac, nextComp + -> Break the nextseq loop, so we get a NIL at the end of the list. + headComp.prevseq.nextseq:=NIL + + curComp:=headComp -> Get the start of the list + WHILE curComp<>NIL + nextComp:=curComp.nextseq + freeComp(curComp, rasdepth) + curComp:=nextComp + ENDWHILE +ENDPROC +->>> + +->>> PROC freeOb(headOb:PTR TO ao, rasdepth) +-> Free an animation object (list of sequences). freeOb() goes through the +-> nextcomp pointers, starting at the AnimOb's headcomp, and frees every +-> sequence. It only goes forward. It then frees the Object itself. Assumes +-> images deallocated elsewhere! +PROC freeOb(headOb:PTR TO ao, rasdepth) + DEF curSeq:PTR TO ac, nextSeq + curSeq:=headOb.headcomp -> Get the start of the list + WHILE curSeq<>NIL + nextSeq:=curSeq.nextcomp + freeSeq(curSeq, rasdepth) + curSeq:=nextSeq + ENDWHILE + END headOb +ENDPROC +->>> diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/animtools.m b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/animtools.m new file mode 100644 index 0000000..b01b027 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/animtools.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/bob.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/bob.e new file mode 100644 index 0000000..bd2ebb4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/bob.e @@ -0,0 +1,124 @@ +-> bob.e - Simple Bob example + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'dos/dos', + 'exec/memory', + 'exec/ports', + 'graphics/gels', + 'intuition/intuition', + 'intuition/screens', + '*animtools' + +ENUM ERR_NONE, ERR_KICK, ERR_WIN + +RAISE ERR_KICK IF KickVersion()=FALSE, + ERR_WIN IF OpenWindow()=NIL + +CONST GEL_SIZE=4 + +DEF bob_data1, bob_data2, myNewBob:PTR TO newBob +->>> + +->>> PROC bobDrawGList(rport, vport) +-> Draw the Bobs into the RastPort. +PROC bobDrawGList(rport, vport) + SortGList(rport) + DrawGList(rport, vport) + -> If the GelsList includes true VSprites, MrgCop() and LoadView() here + WaitTOF() +ENDPROC +->>> + +->>> PROC process_window(win:PTR TO window, myBob:PTR TO bob) +-> Process window and dynamically change bob: Get messages. Go away on +-> IDCMP_CLOSEWINDOW. Update and redisplay bob on IDCMP_INTUITICKS. Wait for +-> more messages. +PROC process_window(win:PTR TO window, myBob:PTR TO bob) + DEF msg:PTR TO intuimessage + LOOP + Wait(Shl(1, win.userport.sigbit)) + WHILE msg:=GetMsg(win.userport) + -> Only IDCMP_CLOSEWINDOW AND IDCMP_INTUITICKS are active + IF msg.class=IDCMP_CLOSEWINDOW + ReplyMsg(msg) + RETURN + ENDIF + -> Must be IDCMP_INTUITICKS: change x and y values on the fly. Note: do + -> not have to add window offset, Bob is relative to the window (sprite + -> relative to screen). + myBob.bobvsprite.x:=msg.mousex+20 + myBob.bobvsprite.y:=msg.mousey+1 + ReplyMsg(msg) + ENDWHILE + -> After getting a message, change image data on the fly + myBob.bobvsprite.imagedata:=IF myBob.bobvsprite.imagedata=bob_data1 THEN + bob_data2 ELSE bob_data1 + InitMasks(myBob.bobvsprite) -> Set up masks for new image + bobDrawGList(win.rport, ViewPortAddress(win)) + ENDLOOP +ENDPROC +->>> + +->>> PROC do_Bob(win:PTR TO window) +-> Working with the Bob: setup the GEL system, and get a new Bob (makeBob()). +-> Add the bob to the system and display. Use the Bob. When done, remove the +-> Bob and update the display without the bob. Cleanup everything. +PROC do_Bob(win:PTR TO window) HANDLE + DEF myBob=NIL, my_ginfo=NIL + my_ginfo:=setupGelSys(win.rport, $03) + myBob:=makeBob(myNewBob) + AddBob(myBob, win.rport) + bobDrawGList(win.rport, ViewPortAddress(win)) + process_window(win, myBob) + RemBob(myBob) + bobDrawGList(win.rport, ViewPortAddress(win)) +EXCEPT DO + IF myBob THEN freeBob(myBob, myNewBob.rasDepth) + IF my_ginfo THEN cleanupGelSys(my_ginfo, win.rport) + ReThrow() +ENDPROC +->>> + +->>> PROC main() +PROC main() HANDLE + DEF win=NIL + KickVersion(37) + -> E-Note: set-up global data + -> Bob data - two sets that are alternated between. Note that this data is + -> at the resolution of the screen. + bob_data1:=copyListToChip([$FFFF0003, $FFF00003, $FFF00003, $FFFF0003, + $3FFFFFFC, $3FF00FFC, $3FF00FFC, $3FFFFFFC]) + bob_data2:=copyListToChip([$C000FFFF, $C0000FFF, $C0000FFF, $C000FFFF, + $3FFFFFFC, $3FF00FFC, $3FF00FFC, $3FFFFFFC]) + -> Data for the new Bob object defined in animtools.m + myNewBob:=[bob_data2, 2, GEL_SIZE, + 2, 3, 0, VSF_SAVEBACK OR VSF_OVERLAY, + 0, 8, 160, 100, 0, 0]:newBob + win:=OpenWindow([80, 20, 400, 150, -1, -1, + IDCMP_CLOSEWINDOW OR IDCMP_INTUITICKS, + WFLG_ACTIVATE OR WFLG_CLOSEGADGET OR WFLG_DEPTHGADGET OR + WFLG_RMBTRAP, + NIL, NIL, 'Bob', NIL, NIL, 0, 0, 0, 0, WBENCHSCREEN]:nw) + do_Bob(win) +EXCEPT DO + IF win THEN CloseWindow(win) + SELECT exception + CASE ERR_KICK; WriteF('Error: requires V37\n') + CASE ERR_WIN; WriteF('Error: could not open window\n') + CASE "MEM"; WriteF('Error: ran out of memory\n') + ENDSELECT +ENDPROC IF exception<>ERR_NONE THEN RETURN_FAIL ELSE RETURN_OK +->>> + +->>> PROC copyListToChip(data) +-> E-Note: get some Chip memory and copy list (quick, since LONG aligned) +PROC copyListToChip(data) + DEF size, mem + size:=ListLen(data)*SIZEOF LONG + mem:=NewM(size, MEMF_CHIP) + CopyMemQuick(data, mem, size) +ENDPROC mem +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/collide.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/collide.e new file mode 100644 index 0000000..8662528 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/collide.e @@ -0,0 +1,514 @@ +-> collide.e - An example of collision detection between objects and between +-> the border. + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'dos/dos', + 'exec/memory', + 'graphics/collide', + 'graphics/gels', + 'graphics/gfx', + 'graphics/rastport', + 'graphics/view', + 'intuition/intuition', + 'intuition/screens', + 'other/ecode', + '*animtools' + +ENUM ERR_NONE, ERR_RAST, ERR_SCRN, ERR_WIN + +RAISE ERR_RAST IF AllocRaster()=NIL, + ERR_SCRN IF OpenScreen()=NIL, + ERR_WIN IF OpenWindow()=NIL + +CONST RBMWIDTH=320, RBMHEIGHT=200, RBMDEPTH=4 + +-> These give the number of frames (COUNT), size (HEIGHT, WIDTH, DEPTH), and +-> word width (WWIDTH) of the animated object. +CONST BOING_COUNT=6, BOING_HEIGHT=25, BOING_WIDTH=32, BOING_DEPTH=1 +CONST BOING_WWIDTH=BOING_WIDTH+15/16 + +-> These are the IDs for the system to use for the three objects. These +-> numbers will be used for the collision detection system. +-> +-> Do not use zero (0), as it is reserved by the collision system for border +-> hits (see 'graphics/collide', BORDERHIT). +ENUM BOING_1=2, BOING_2, BOING_3 + +DEF ns:PTR TO ns, nw:PTR TO nw, boing3Times:PTR TO INT, + boing3YTranses:PTR TO INT, boing3XTranses:PTR TO INT, + boing3CRoutines:PTR TO LONG, boing3Image:PTR TO LONG, + newBoingBob:PTR TO newBob, newBoingSeq:PTR TO newAnimSeq + +-> E-Note: this is the static variable from setupBitMaps(). +DEF myBitMaps[2]:ARRAY OF LONG +->>> + +->>> PROC setupGlobals() +PROC setupGlobals() + ns:=[0, 0, 320, 200, 2, 0, 1, NIL, + CUSTOMSCREEN, NIL, 'Collision with AnimObs', NIL, NIL]:ns + nw:=[50, 50, 220, 100, -1, -1, IDCMP_CLOSEWINDOW, + WFLG_CLOSEGADGET OR WFLG_RMBTRAP, NIL, NIL, 'Close Window to Stop', + NIL, NIL, 150, 100, 150, 100, CUSTOMSCREEN]:nw + -> These are the number of counts that each frame is displayed. They are + -> all one, so each frame is displayed once then the animation system will + -> move on to the next in the sequence. + boing3Times:=[1, 1, 1, 1, 1, 1]:INT + -> These are all set to zero as we do not want anything added to the X and Y + -> positions using ring motion control. All movement is done using the + -> acceleration and velocity values. + boing3YTranses:=[0, 0, 0, 0, 0, 0]:INT + boing3XTranses:=[0, 0, 0, 0, 0, 0]:INT + -> No special routines to call when each anim comp is displayed. + boing3CRoutines:=[NIL, NIL, NIL, NIL, NIL, NIL]:LONG + boing3Image:=copyListToChip( + -> ----- bitmap Boing, frame 0: w = 32, h = 25 ------ + [$00230000, $004E3000, $00E33A00, $03C3C900, + $07878780, $108F8700, $31F78790, $61F04790, + $63E0FB90, $43E0F848, $3BC0F870, $3801F870, + $383DF070, $387E1070, $387C0EE0, $D87C1F10, + $467C1E10, $479C1E30, $67873E20, $0787CC60, + $0F0F8700, $048F0E00, $02771C00, $0161D800, + $00272000, + -> ----- bitmap Boing, frame 1: w = 32, h = 25 ------ + $00318000, $01071800, $00F01900, $09E1EC80, + $13C1E340, $1803E380, $387BC390, $30F801D0, + $70F83DC0, $E1F03E08, $9DF07C30, $9E307C30, + $9E1C7C30, $1C1F9C30, $1C1F0630, $7C1F0780, + $623F0798, $63DE0F10, $23C10F20, $33C3EE20, + $0BC3C380, $0647C700, $023F8E00, $0130F800, + $00338000, + -> ----- bitmap Boing, frame 2: w = 32, h = 25 ------ + $0019C000, $01038800, $02788D00, $0CF0FE80, + $11F0F140, $0E60F1E0, $1C39F0C0, $1C3E30C0, + $387E0CE0, $F87C1F28, $8C7C1F18, $8F3C1F18, + $8F061E18, $8F07DE18, $8F07C018, $6E0FC1C0, + $300F83C8, $31EF8390, $31F08780, $11E0F720, + $11E1F1C0, $0B61E300, $071BC600, $01386C00, + $00318000, + -> ----- bitmap Boing, frame 3: w = 32, h = 25 ------ + $001CE000, $01B1CC00, $031CC500, $0C3C3680, + $18787840, $2F7078E0, $0E087860, $1E0FB860, + $1C1F0460, $BC1F07B0, $C43F0788, $C7FE0788, + $C7C00F88, $C781EF88, $C783F118, $2783E0E8, + $3983E1E0, $3863E1C0, $1878C1C0, $38783380, + $10F078C0, $0B70F180, $0588E200, $009E2400, + $0018C000, + -> ----- bitmap Boing, frame 4: w = 32, h = 25 ------ + $000E6000, $00F8E400, $030FE600, $061E1300, + $0C3E1C80, $27FC1C60, $07843C60, $4F07FE20, + $8F07C230, $1E0FC1F0, $620F83C8, $61CF83C8, + $61E183C8, $63E063C8, $63E0F9C8, $03E0F878, + $1DC0F860, $1C21F0E0, $5C3EF0C0, $0C3C11C0, + $143C3C40, $09B83880, $05C07000, $00CF0400, + $000C6000, + -> ----- bitmap Boing, frame 5: w = 32, h = 25 ------ + $00262000, $00FC7400, $01877200, $030F0100, + $0E0F0E80, $319F0E00, $23C60F30, $63C1CF30, + $4781F310, $0783E0D0, $7383E0E0, $70C3E0E0, + $70F9E1E0, $70F821E0, $70F83FE0, $91F03E38, + $4FF07C30, $4E107C60, $4E0F7860, $2E1F08C0, + $0E1E0E00, $049E1C80, $00E43800, $00C79000, + $000E6000]) + -> These objects contain the initialisation data for the animation sequence. + newBoingBob:=[NIL, BOING_WWIDTH, BOING_HEIGHT, BOING_DEPTH, $2, $0, + VSF_SAVEBACK OR VSF_OVERLAY, 0, RBMDEPTH, 0, 0, 0, 0]:newBob + newBoingSeq:=[NIL, boing3Image, boing3XTranses, boing3YTranses, + boing3Times, boing3CRoutines, 0, BOING_COUNT, 0]:newAnimSeq +ENDPROC +->>> + +->>> PROC setupBoing(dbufing) +-> Make a new animation object. Since all of the boing balls use the same +-> underlying data, the initalisation structures are hard-coded into the +-> routine (newBoingBob and newBoingSeq.) +-> +-> Return a pointer to the object if successful. +PROC setupBoing(dbufing) HANDLE + DEF bngOb=NIL:PTR TO ao, bngComp:PTR TO ac + NEW bngOb + newBoingBob.dBuf:=dbufing -> Double-buffer status + newBoingSeq.headOb:=bngOb -> Pass down head object + + bngComp:=makeSeq(newBoingBob, newBoingSeq) + -> The head comp is the one that is returned by makeSeq() + bngOb.headcomp:=bngComp +EXCEPT + IF bngOb THEN END bngOb + ReThrow() +ENDPROC bngOb +->>> + +->>> PROC runAnimation(win:PTR TO window, dbufing, animKey, myBitMaps) +-> A simple message handling LOOP that also draws the successive frames. +PROC runAnimation(win:PTR TO window, dbufing, animKey, myBitMaps) + DEF intuiMsg:PTR TO intuimessage, toggleFrame + -> toggleFrame is used to keep track of which frame of the double buffered + -> screen we are currently displaying. The variable must exist for the life + -> of the displayed objects, so it is defined here. + toggleFrame:=0 + + -> End the loop on a IDCMP_CLOSEWINDOW event. + LOOP + -> Draw the gels, then check for messages. Check the messages after each + -> display so we get a quick response. + drawGels(win, animKey, dbufing, {toggleFrame}, myBitMaps) + + -> Quit on a Control-C + -> E-Note: use built-in check + IF CtrlC() THEN RETURN + + -> Check for a IDCMP_CLOSEWINDOW event, die if found + WHILE intuiMsg:=GetMsg(win.userport) + IF intuiMsg.class=IDCMP_CLOSEWINDOW + ReplyMsg(intuiMsg) + RETURN + ENDIF + ReplyMsg(intuiMsg) + ENDWHILE + ENDLOOP +ENDPROC +->>> + +->>> PROC setupPlanes(bitMap:PTR TO bitmap, depth, width, height) +-> Called only for double-buffered displays. Allocate and clear each +-> bit-plane in a bitmap structure. Clean-up on failure. +PROC setupPlanes(bitMap:PTR TO bitmap, depth, width, height) HANDLE + DEF plane_num + FOR plane_num:=0 TO depth-1 + bitMap.planes[plane_num]:=AllocRaster(width, height) + BltClear(bitMap.planes[plane_num], (width/8)*height, 1) + ENDFOR +EXCEPT + freePlanes(bitMap, depth, width, height) + ReThrow() +ENDPROC +->>> + +->>> PROC setupBitMaps(depth, width, height) +-> Allocate the two bitmaps for a double-buffered display. Routine only +-> called when the display is double-buffered. +PROC setupBitMaps(depth, width, height) HANDLE + DEF p=NIL:PTR TO bitmap, q=NIL:PTR TO bitmap + -> Allocate the two bitmap objects. These do not have to be in CHIP. + -> E-Note: use p and q to get correct type. + myBitMaps[0]:=NEW p + myBitMaps[1]:=NEW q + -> Initialise the bitmaps to the correct size. + InitBitMap(p, depth, width, height) + InitBitMap(q, depth, width, height) + -> Allocate and initialise the bit-planes for the bitmaps. + setupPlanes(p, depth, width, height) + setupPlanes(q, depth, width, height) +EXCEPT + IF p + freePlanes(p, depth, width, height) + END p + ENDIF + IF q + freePlanes(q, depth, width, height) + END q + ENDIF + ReThrow() +ENDPROC myBitMaps +->>> + +->>> PROC freePlanes(bitMap:PTR TO bitmap, depth, width, height) +-> Free all of the bit-planes in a bitmap structure. +PROC freePlanes(bitMap:PTR TO bitmap, depth, width, height) + DEF plane_num + FOR plane_num:=0 TO depth-1 + IF bitMap.planes[plane_num] + FreeRaster(bitMap.planes[plane_num], width, height) + ENDIF + ENDFOR +ENDPROC +->>> + +->>> PROC freeBitMaps(myBitMaps:PTR TO LONG, depth, width, height) +-> Free the two bitmaps from the double buffered display. The bit-planes are +-> freed first, then the bitmap objects. +PROC freeBitMaps(myBitMaps:PTR TO LONG, depth, width, height) + freePlanes(myBitMaps[0], depth, width, height) + freePlanes(myBitMaps[1], depth, width, height) + END myBitMaps[2] +ENDPROC +->>> + +->>> PROC setupDisplay(win:PTR TO LONG, dbufing, myBitMaps:PTR TO LONG) +-> Open the screen and the window for the display. +-> +-> If using double buffered display, assume the bitmaps have been opened and +-> correctly set-up. +PROC setupDisplay(win:PTR TO LONG, dbufing, myBitMaps:PTR TO LONG) HANDLE + DEF gInfo, screen=NIL, wp=NIL:PTR TO window + -> If double-buffered, set-up the new screen structure for custom bitmap. + IF dbufing + ns.type:=ns.type OR CUSTOMBITMAP + ns.custombitmap:=myBitMaps[0] + ENDIF + + -> Open everything. Check for failure. + screen:=OpenScreen(ns) + nw.screen:=screen + -> E-Note: use wp to get the right type + win[]:=(wp:=OpenWindow(nw)) + IF dbufing + -> We are double buffered. Set the rastport for it. + wp.wscreen.rastport.flags:=RPF_DBUFFER + + -> This copies the Intuition display (close gadget) to the second bitmap + -> so the display does not flash when we change between them. + wp.wscreen.rastport.bitmap:=myBitMaps[1] + BltBitMapRastPort(myBitMaps[0], 0, 0, wp.wscreen.rastport, + 0, 0, RBMWIDTH, RBMHEIGHT, $C0) + wp.wscreen.rastport.bitmap:=myBitMaps[0] + ENDIF + + -> Ready the gel system for accepting objects. This is only done once for + -> each rastport in use. + gInfo:=setupGelSys(wp.wscreen.rastport, $03) +EXCEPT + IF wp THEN CloseWindow(wp) + IF screen THEN CloseScreen(screen) + ReThrow() +ENDPROC gInfo +->>> + +->>> PROC drawGels(win:..., animKey, dbufing, toggleFrame:..., myBitMaps:...) +-> Handle the update of the display. Animate the simulation and check for +-> collisions. If the screen is double buffered, swap the bit map as +-> required. +-> E-Note: toggleFrame is PTR TO LONG since '{toggle}' was used. +PROC drawGels(win:PTR TO window, animKey, dbufing, + toggleFrame:PTR TO LONG, myBitMaps:PTR TO LONG) + -> Do the required animation stuff. You must sort both after the animate + -> call and after the collision call. + Animate(animKey, win.wscreen.rastport) + SortGList(win.wscreen.rastport) + + DoCollision(win.wscreen.rastport) + SortGList(win.wscreen.rastport) + + -> Toggle if double buffered + IF dbufing + win.wscreen.viewport.rasinfo.bitmap:=myBitMaps[toggleFrame[]] + ENDIF + + -> Draw the new position of the gels into the screen. + DrawGList(win.wscreen.rastport, win.wscreen.viewport) + + -> If using a double buffered display, you have a more complicated update + -> procedure. If not then simply use WaitTOF(). + IF dbufing + MakeScreen(win.wscreen) + RethinkDisplay() + toggleFrame[]:=1-toggleFrame[] + win.wscreen.rastport.bitmap:=myBitMaps[toggleFrame[]] + ELSE + WaitTOF() + ENDIF +ENDPROC +->>> + +->>> PROC bounceWall(vs1:PTR TO vs, borderflags) +-> Handle bouncing the animation objects off the walls. +PROC bounceWall(vs1:PTR TO vs, borderflags) + DEF ob:PTR TO ao + -> Get a pointer to the object from the sprite pointer. + ob:=vs1.vsbob.bobcomp.headob + + -> Check for hits and act appropriately. For right and left, reverse the x + -> velocity if the object is moving towards the wall (it may have already + -> reversed but still be in contact with the wall). For the bottom and top + -> you also have to subtract out the velocity. + IF ((borderflags AND RIGHTHIT) AND (ob.xvel>0)) OR + ((borderflags AND LEFTHIT) AND (ob.xvel<0)) + ob.xvel:=-ob.xvel + ELSEIF ((borderflags AND TOPHIT) AND (ob.yvel<0)) OR + ((borderflags AND BOTTOMHIT) AND (ob.yvel>0)) + ob.yvel:=ob.yvel-ob.yaccel + ob.yvel:=-ob.yvel + ENDIF +ENDPROC +->>> + +->>> PROC hit_routine(vs1:PTR TO vs, vs2:PTR TO vs) +-> Handle the collision between two animation objects. This routine simulates +-> objects bouncing off of each other. This does not do a very good job of +-> it, it does not take into account the angle of the collision or real +-> physics. If anyone wants to fix it, please feel free. +-> +-> The call to DoCollision() causes a call back to this routine when two +-> animation objects overlap. +PROC hit_routine(vs1:PTR TO vs, vs2:PTR TO vs) + DEF vel1, vel2, ob1:PTR TO ao, ob2:PTR TO ao + -> Get pointers to the objects from the sprite pointers. + ob1:=vs1.vsbob.bobcomp.headob + ob2:=vs2.vsbob.bobcomp.headob + + -> Check that the bob is not being removed! This is due to a 1.3 bug where + -> all bobs are tested for collision, even the ones that are in the process + -> of being removed. See text for more information. + -> + -> Bobs are moved to a very large negative position as they are being + -> removed. If the BOBSAWAY flag is set, then both bobs in the collision + -> are in the process of being removed--don't do anything in the collision + -> routine. + IF 0=(vs1.vsbob.bobflags AND BF_BOBSAWAY) + -> Cache the velocity values. + -> Do the X values first (order is not important). + vel1:=ob1.xvel + vel2:=ob2.xvel + + -> If the two objects are moving in the opposite direction (X component) + -> then negate the velocities, else swap the velocities. + IF ((vel1>0) AND (vel2<0)) OR ((vel1<0) AND (vel2>0)) + ob1.xvel:=-vel1 + ob2.xvel:=-vel2 + ELSE + ob1.xvel:=vel2 + ob2.xvel:=vel1 + ENDIF + + -> Cache the velocity values. + -> Do the Y values second (order is not important). + vel1:=ob1.yvel + vel2:=ob2.yvel + + -> If the two objects are moving in the opposite direction (Y component) + -> then negate the velocities, else swap the velocities. + IF ((vel1>0) AND (vel2<0)) OR ((vel1<0) AND (vel2>0)) + ob1.yvel:=-vel1 + ob2.yvel:=-vel2 + ELSE + ob1.yvel:=vel2 + ob2.yvel:=vel1 + ENDIF + ENDIF +ENDPROC +->>> + +->>> PROC main() +-> Run a double buffered display if the user puts any arguments on the command +-> line. +-> +-> Set-up the display, set-up the animation system and the objects, set-up +-> collisions between objects and against walls, and run the thing. +-> +-> Clean-up and close resources when done. +PROC main() HANDLE + DEF myBitMaps:PTR TO LONG, boingOb=NIL:PTR TO ao, boing2Ob=NIL:PTR TO ao, + boing3Ob=NIL:PTR TO ao, win=NIL:PTR TO window, gInfo=NIL, animKey, + dbufing=0, hitcode + -> E-Note: set-up global data + setupGlobals() + -> If any arguments, use double-buffering + IF arg THEN IF arg[] THEN dbufing:=1 + WriteF(IF dbufing THEN + 'Double buffering - no args means single buffered\n' ELSE + 'Single buffering - supply any arguments to do double buffering\n') + -> Note that setupBitMaps() will only be called if we are double buffering. + IF dbufing THEN myBitMaps:=setupBitMaps(RBMDEPTH, RBMWIDTH, RBMHEIGHT) + gInfo:=setupDisplay({win}, dbufing, myBitMaps) + -> You have to initialise the animation key before you use it. + InitAnimate({animKey}) + + -> Set-up the first boing ball. All of these use the same data, hard coded + -> into setupBoing(). Change the colour by changing planePick. Set the ID + -> of the ball (meMask) to BOING_1. hitMask = $FF means that it will + -> collide with everything. + newBoingBob.planePick:=$2 + newBoingBob.meMask:=Shl(1, BOING_1) + newBoingBob.hitMask:=$FF + boingOb:=setupBoing(dbufing) + + -> Pick an initial position, velocity and acceleration and add the OBJECT to + -> the system. NOTE that the Y-velocity and X-acceleration are not set + -> (they default to zero.) This means that the objects will maintain a + -> constant movement to the left or right, and will rely on the Y + -> accelleration for the downward movement. The collision routines change + -> these values, producing bouncing off of walls and other objects. + -> + -> NOTE: ANFRACSIZE is a value that shifts animation constants past an + -> internal decimal point. If you do not do this, then the values will only + -> be some fraction of what you expect. See the text of the Animation + -> chapter. + boingOb.any:=Shl(10, ANFRACSIZE) + boingOb.anx:=Shl(250, ANFRACSIZE) + boingOb.xvel:=-Shl(3, ANFRACSIZE) + boingOb.yaccel:=35 + AddAnimOb(boingOb, {animKey}, win.wscreen.rastport) + + -> Do the second object--see above comments. + newBoingBob.planePick:=$1 + newBoingBob.meMask:=Shl(1, BOING_2) + newBoingBob.hitMask:=$FF + boing2Ob:=setupBoing(dbufing) + boing2Ob.any:=Shl(50, ANFRACSIZE) + boing2Ob.anx:=Shl(50, ANFRACSIZE) + boing2Ob.xvel:=Shl(2, ANFRACSIZE) + boing2Ob.yaccel:=35 + AddAnimOb(boing2Ob, {animKey}, win.wscreen.rastport) + + -> Do the third object--see above comments. + -> Here we also use planeOnOff to change the colour. + newBoingBob.planePick:=$1 + newBoingBob.planeOnOff:=$2 + newBoingBob.meMask:=Shl(1, BOING_3) + newBoingBob.hitMask:=$FF + boing3Ob:=setupBoing(dbufing) + boing3Ob.any:=Shl(80, ANFRACSIZE) + boing3Ob.anx:=Shl(150, ANFRACSIZE) + boing3Ob.xvel:=Shl(1, ANFRACSIZE) + boing3Ob.yaccel:=35 + AddAnimOb(boing3Ob, {animKey}, win.wscreen.rastport) + + -> Set up the collisions between boing balls. + -> NOTE that they all call the same routine. + -> E-Note: wrap hit_routine() so it can be used as a collision function (the + -> function is simple enough not to need the full register + -> preservation of eCodeCollision(), so eCodeSwapArgs() is used). + hitcode:=eCodeSwapArgs({hit_routine}) + SetCollision(BOING_1, hitcode, gInfo) + SetCollision(BOING_2, hitcode, gInfo) + SetCollision(BOING_3, hitcode, gInfo) + + -> Set the collisions with the walls. + -> E-Note: see above comment about eCodeXXX(). + SetCollision(BORDERHIT, eCodeSwapArgs({bounceWall}), gInfo) + + -> Everything set-up... Run the animation. + runAnimation(win, dbufing, {animKey}, myBitMaps) + + -> Done.. Free-up everything and clean up the mess. +EXCEPT DO + IF boing3Ob THEN freeOb(boing3Ob, RBMDEPTH) + IF boing2Ob THEN freeOb(boing2Ob, RBMDEPTH) + IF boingOb THEN freeOb(boingOb, RBMDEPTH) + IF gInfo THEN cleanupGelSys(gInfo, win.wscreen.rastport) + IF win THEN CloseWindow(win) + -> E-Note: C version does not do this safely... + IF nw.screen THEN CloseScreen(nw.screen) + IF dbufing THEN freeBitMaps(myBitMaps, RBMDEPTH, RBMWIDTH, RBMHEIGHT) + SELECT exception + CASE ERR_RAST; WriteF('Error: could not allocate raster\n') + CASE ERR_SCRN; WriteF('Error: could not open screen\n') + CASE ERR_WIN; WriteF('Error: could not open window\n') + CASE "MEM"; WriteF('Error: ran out of memory\n') + ENDSELECT +ENDPROC IF exception<>ERR_NONE THEN RETURN_FAIL ELSE RETURN_OK +->>> + +->>> PROC copyListToChip(data) +-> E-Note: get some Chip memory and copy list (quick, since LONG aligned) +PROC copyListToChip(data) + DEF size, mem + size:=ListLen(data)*SIZEOF LONG + mem:=NewM(size, MEMF_CHIP) + CopyMemQuick(data, mem, size) +ENDPROC mem +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/ssprite.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/ssprite.e new file mode 100644 index 0000000..a7d1745 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/ssprite.e @@ -0,0 +1,103 @@ +-> ssprite.e - Simple Sprite example + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'dos/dos', + 'exec/memory', + 'graphics/gfx', + 'graphics/gfxmacros', + 'graphics/sprite', + 'graphics/view', + 'hardware/custom', + 'hardware/dmabits', + 'intuition/screens' + +ENUM ERR_NONE, ERR_KICK, ERR_SCRN, ERR_SPRT + +RAISE ERR_KICK IF KickVersion()=FALSE, + ERR_SCRN IF OpenScreenTagList()=NIL, + ERR_SPRT IF GetSprite()=-1 + +DEF sprite_data +->>> + +->>> PROC main() +PROC main() HANDLE + DEF sprite:simplesprite, viewport, sprite_num=-1, delta_move, ktr1, ktr2, + colour_reg, screen=NIL:PTR TO screen + KickVersion(37) + screen:=OpenScreenTagList(NIL, NIL) + viewport:=screen.viewport + sprite_num:=GetSprite(sprite, 2) + + -> Calculate the correct base colour register number, + -> set up the colour registers. + colour_reg:=16+((sprite_num AND $06)*2) + WriteF('colour_reg=\d\n', colour_reg) + SetRGB4(viewport, colour_reg+1, 12, 3, 8) + SetRGB4(viewport, colour_reg+2, 13, 13, 13) + SetRGB4(viewport, colour_reg+3, 4, 4, 15) + + sprite.x:=0 -> Initialise position and size info to match that shown in + sprite.y:=0 -> sprite_data so system knows layout of data later. + sprite.height:=9 + + -> E-Note: data is really a lot of LONGs + sprite_data:=copyListToChip([0, -> Position control + $ffff0000, -> Image data line 1, color 1 + $ffff0000, -> Image data line 2, color 1 + $0000ffff, -> Image data line 3, color 2 + $0000ffff, -> Image data line 4, color 2 + $00000000, -> Image data line 5, transparent + $0000ffff, -> Image data line 6, color 2 + $0000ffff, -> Image data line 7, color 2 + $ffffffff, -> Image data line 8, color 3 + $ffffffff, -> Image data line 9, color 3 + 0]) -> Reserved, must init to 0 + + -> Install sprite data and move sprite to start position. + ChangeSprite(viewport, sprite, sprite_data) + MoveSprite(viewport, sprite, 30, 0) + + -> Move the sprite back and forth. + delta_move:=1 + FOR ktr1:=0 TO 5 + FOR ktr2:=0 TO 99 + MoveSprite(viewport, sprite, sprite.x+delta_move, sprite.y+delta_move) + WaitTOF() -> One move per video frame. + + -> Show the effect of turning off sprite DMA. + IF ktr2=40 THEN OFF_SPRITE + IF ktr2=60 THEN ON_SPRITE + ENDFOR + delta_move:=-delta_move + ENDFOR + + -> Note: if you turn off the sprite at the wrong time (when it is being + -> displayed), the sprite will appear as a vertical bar on the screen. + -> To really get rid of the sprite, you must OFF_SPRITE while it is not + -> displayed. This is hard in a multi-tasking system (the solution is not + -> addressed in this program). + ON_SPRITE -> Just to be sure + +EXCEPT DO + IF sprite_num<>-1 THEN FreeSprite(sprite_num) + IF screen THEN CloseScreen(screen) + SELECT exception + CASE ERR_KICK; WriteF('Error: requires V37\n') + CASE ERR_SCRN; WriteF('Error: could not open screen\n') + CASE ERR_SPRT; WriteF('Error: could not allocate a new sprite\n') + ENDSELECT +ENDPROC IF exception<>ERR_NONE THEN RETURN_FAIL ELSE RETURN_OK +->>> + +->>> PROC copyListToChip(data) +-> E-Note: get some Chip memory and copy list (quick, since LONG aligned) +PROC copyListToChip(data) + DEF size, mem + size:=ListLen(data)*SIZEOF LONG + mem:=NewM(size, MEMF_CHIP) + CopyMemQuick(data, mem, size) +ENDPROC mem +->>> diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/vsprite.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/vsprite.e new file mode 100644 index 0000000..95845ce --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Sprites_Bobs/vsprite.e @@ -0,0 +1,155 @@ +-> vsprite.e - Virtual Sprite example + +->>> Header (globals) +MODULE 'dos/dos', + 'exec/memory', + 'exec/ports', + 'graphics/collide', + 'graphics/gels', + 'graphics/rastport', + 'intuition/intuition', + 'intuition/screens', + 'other/ecode', + '*animtools' + +ENUM ERR_NONE, ERR_KICK, ERR_WIN + +RAISE ERR_KICK IF KickVersion()=FALSE, + ERR_WIN IF OpenWindow()=NIL + +CONST GEL_SIZE=4 + +-> VSprite data - there are two sets that are alternated between. Note that +-> this data is always displayed as low resolution. +DEF vsprite_data1, vsprite_data2, mySpriteColours, mySpriteAltColours +->>> + +->>> PROC vspriteDrawGList(win, myRPort) +-> Basic VSprite display subroutine +PROC vspriteDrawGList(win, myRPort) + SortGList(myRPort) + DrawGList(myRPort, ViewPortAddress(win)) + RethinkDisplay() +ENDPROC +->>> + +->>> PROC borderCheck(hitVSprite:PTR TO vs, borderflags) +-> Collision routine for vsprite hitting border. Note that when the collision +-> is VSprite to VSprite (or Bob to Bob, Bob to AnimOb, etc.), then the +-> parameters are both pointers to a VSprite. +PROC borderCheck(hitVSprite:PTR TO vs, borderflags) + IF borderflags AND RIGHTHIT + hitVSprite.sprcolors:=mySpriteAltColours + hitVSprite.vuserext:=-40 + ENDIF + IF borderflags AND LEFTHIT + hitVSprite.sprcolors:=mySpriteColours + hitVSprite.vuserext:=20 + ENDIF +ENDPROC +->>> + +->>> PROC process_window(win:PTR TO window, myRPort, myVSprite:PTR TO vs) +-> Process window and dynamically change vsprite. Get messages. Go away on +-> CLOSEWINDOW. Update and redisplay vsprite on INTUITICKS. Wait for more +-> messages. +PROC process_window(win:PTR TO window, myRPort, myVSprite:PTR TO vs) + DEF msg:PTR TO intuimessage + LOOP + Wait(Shl(1, win.userport.sigbit)) + WHILE NIL<>(msg:=GetMsg(win.userport)) + -> Only IDCMP_CLOSEWINDOW and IDCMP_INTUITICKS are active + IF msg.class=IDCMP_CLOSEWINDOW + ReplyMsg(msg) + RETURN + ENDIF + -> Must be an INTUITICKS: change x and y values on the fly. Note offset + -> by window left and top edge--sprite is relative to the screen, not + -> window. Divide the MouseY in half to adjust for Lores movement + -> increments on a Hires screen. + myVSprite.x:=win.leftedge+msg.mousex+myVSprite.vuserext + myVSprite.y:=win.topedge+(msg.mousey/2)+1 + ReplyMsg(msg) + ENDWHILE + -> Got a message, change image data on the fly + myVSprite.imagedata:=IF myVSprite.imagedata=vsprite_data1 THEN + vsprite_data2 ELSE vsprite_data1 + SortGList(myRPort) + DoCollision(myRPort) + vspriteDrawGList(win, myRPort) + ENDLOOP +ENDPROC +->>> + +->>> PROC do_VSprite(win, myRPort:PTR TO rastport) HANDLE +-> Working with the VSprite. Setup the GEL system and get a new VSprite +-> (makeVSprite()). Add VSprite to the system and display. Use the vsprite. +-> When done, remove VSprite and update the display without the VSprite. +-> Cleanup everything. +PROC do_VSprite(win, myRPort:PTR TO rastport) HANDLE + DEF myVSprite=NIL:PTR TO vs, my_ginfo=NIL + my_ginfo:=setupGelSys(myRPort, $FC) + myVSprite:=makeVSprite( + -> Image data, sprite colour array, word width (1 for true VSprite) + [vsprite_data1, mySpriteColours, 1, + -> Line height, image depth (2 for true VSprite), x, y position + GEL_SIZE, 2, 160, 100, + -> Flags (VSF_VSPRITE for true VSprite), hit mask and me mask + VSF_VSPRITE, Shl(1, BORDERHIT), 0]:newVSprite) + AddVSprite(myVSprite, myRPort) + vspriteDrawGList(win, myRPort) + myVSprite.vuserext:=20 + -> E-Note: wrap borderCheck function for use as collision routine + SetCollision(BORDERHIT, eCodeCollision({borderCheck}), myRPort.gelsinfo) + process_window(win, myRPort, myVSprite) + RemVSprite(myVSprite) +EXCEPT DO + IF myVSprite THEN freeVSprite(myVSprite) + IF my_ginfo + vspriteDrawGList(win, myRPort) + cleanupGelSys(my_ginfo, myRPort) + ENDIF + ReThrow() +ENDPROC +->>> + +->>> PROC main() HANDLE +-> Example VSprite program. First open a window. +PROC main() HANDLE + DEF win=NIL:PTR TO window, myRPort=NIL:PTR TO rastport + KickVersion(37) + NEW myRPort -> E-Note: allocate a zeroed rastport + -> E-Note: set-up global data + vsprite_data1:=copyListToChip([$7FFE80FF, $7C3E803F, $7C3E803F, $7FFE80FF, 0]) + vsprite_data2:=copyListToChip([$7FFEFF01, $7C3EFC01, $7C3EFC01, $7FFEFF01, 0]) + mySpriteColours:=[$0000, $00F0, $0F00]:INT + mySpriteAltColours:=[$000F, $0F00, $0FF0]:INT + win:=OpenWindow([80, 20, 400, 150, -1, -1, + IDCMP_CLOSEWINDOW OR IDCMP_INTUITICKS, + WFLG_ACTIVATE OR WFLG_CLOSEGADGET OR WFLG_DEPTHGADGET OR + WFLG_RMBTRAP OR WFLG_DRAGBAR, + NIL, NIL, 'VSprite', NIL, NIL, 0, 0, 0, 0, WBENCHSCREEN]:nw) + InitRastPort(myRPort) + -> Copy the window rastport + CopyMem(win.wscreen.rastport, myRPort, SIZEOF rastport) + do_VSprite(win, myRPort) +EXCEPT DO + IF win THEN CloseWindow(win) + END myRPort + SELECT exception + CASE ERR_KICK; WriteF('Error: requires V37\n') + CASE ERR_WIN; WriteF('Error: could not open window\n') + CASE "MEM"; WriteF('Error: ran out of memory\n') + ENDSELECT +ENDPROC IF exception<>ERR_NONE THEN RETURN_FAIL ELSE RETURN_OK +->>> + +->>> PROC copyListToChip(data) +-> E-Note: get some Chip memory and copy list (quick, since LONG aligned) +PROC copyListToChip(data) + DEF size, mem + size:=ListLen(data)*SIZEOF LONG + mem:=NewM(size, MEMF_CHIP) + CopyMemQuick(data, mem, size) +ENDPROC mem +->>> diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Text/MeasureText.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Text/MeasureText.e new file mode 100644 index 0000000..5c70d11 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Text/MeasureText.e @@ -0,0 +1,190 @@ +-> MeasureText.e + +->>> Header (globals) +MODULE 'asl', + 'diskfont', + 'graphics/rastport', + 'graphics/text', + 'intuition/intuition', + 'intuition/screens', + 'libraries/asl', + 'other/split' + +ENUM ERR_NONE, ERR_ARGS, ERR_ASL, ERR_FONT, ERR_KICK, ERR_LIB, ERR_OPEN, + ERR_READ, ERR_WIN + +RAISE ERR_ASL IF AllocAslRequest()=NIL, + ERR_FONT IF OpenDiskFont()=NIL, + ERR_KICK IF KickVersion()=FALSE, + ERR_LIB IF OpenLibrary()=NIL, + ERR_OPEN IF Open()=NIL, + ERR_READ IF Read()<0, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST BUFSIZE=32000 -> E-Note: 32768 is too big for a static ARRAY + +DEF buffer[BUFSIZE]:ARRAY, myfile=NIL, wtbarheight, + fr=NIL:PTR TO fontrequester, myfont=NIL:PTR TO textfont, + w=NIL:PTR TO window, myrp:PTR TO rastport +->>> + +->>> PROC main() +PROC main() HANDLE + DEF arglist:PTR TO LONG + KickVersion(37) -> Run only on 2.0 machines + -> E-Note: use argSplit() to get argv-like list (minus command name) + IF NIL=(arglist:=argSplit()) THEN Raise(ERR_ARGS) + IF ListLen(arglist)=1 -> E-Note: replaces 'argc==2' + myfile:=Open(arglist[0], OLDFILE) -> Open the file to print out. + diskfontbase:=OpenLibrary('diskfont.library', 37) + aslbase:=OpenLibrary('asl.library', 37) + fr:=AllocAslRequest(ASL_FONTREQUEST, -> Open an ASL font requester. + -> Supply initial values for requester + [ASL_FONTNAME, 'topaz.font', + ASL_FONTHEIGHT, 11, + ASL_FONTSTYLES, FSF_BOLD OR FSF_ITALIC, + ASL_FRONTPEN, 1, + ASL_BACKPEN, 0, + + -> Give us all the gadgetry + ASL_FUNCFLAGS, FONF_FRONTCOLOR OR FONF_BACKCOLOR OR + FONF_DRAWMODE OR FONF_STYLES, + NIL]) + -> Pop up the requester + IF AslRequest(fr, NIL) + -> Extract the font and display attributes from the fontrequest. + myfont:=OpenDiskFont([fr.attr.name, fr.attr.ysize, + fr.attr.style, fr.attr.flags]:textattr) + w:=OpenWindowTagList(NIL, [WA_SIZEGADGET, TRUE, + WA_MINWIDTH, 200, + WA_MINHEIGHT, 200, + WA_DRAGBAR, TRUE, + WA_DEPTHGADGET, TRUE, + WA_TITLE, arglist[0], + NIL]) + myrp:=w.rport + -> Figure out where the baseline of the uppermost line should be. + wtbarheight:=w.wscreen.barheight+myfont.baseline+2 + + -> Set the font and add software styling to the text if I asked for it + -> in OpenFont() and didn't get it. Because most Amiga fonts do not + -> have styling built into them (with the exception of the CG outline + -> fonts), if the user selected some kind of styling for the text, it + -> will to be added algorithmically by calling SetSoftStyle(). + SetFont(myrp, myfont) + SetSoftStyle(myrp, Eor(fr.attr.style, myfont.style), + FSF_BOLD OR FSF_UNDERLINED OR FSF_ITALIC) + SetDrMd(myrp, fr.drawmode) + SetAPen(myrp, fr.frontpen) + SetBPen(myrp, fr.backpen) + Move(myrp, w.wscreen.wborleft, wtbarheight) + + mainLoop() + + -> Short delay to allow user to see the text before it goes away. + Delay(25) + ELSE + WriteF('Request Cancelled\n') + ENDIF + ELSE + WriteF('Template: MeasureText \n') + ENDIF +EXCEPT DO + IF w THEN CloseWindow(w) + IF myfont THEN CloseFont(myfont) + IF fr THEN FreeAslRequest(fr) + IF aslbase THEN CloseLibrary(aslbase) + IF diskfontbase THEN CloseLibrary(diskfontbase) + IF myfile THEN Close(myfile) + SELECT exception + CASE ERR_ARGS; WriteF('Error: ran out of memory splitting arguments\n') + CASE ERR_ASL; WriteF('Error: could not allocate ASL request\n') + CASE ERR_FONT; WriteF('Error: could not open font\n') + CASE ERR_KICK; WriteF('Error: requires V37+\n') + CASE ERR_LIB; WriteF('Error: could not open required library\n') + CASE ERR_OPEN; WriteF('Error: could not open file\n') + CASE ERR_READ; WriteF('Error: Read() failed on file\n') + CASE ERR_WIN; WriteF('Error: could not open window\n') + ENDSELECT +ENDPROC +->>> + +->>> PROC mainLoop() +PROC mainLoop() + DEF resulttextent:textextent, fit, actual, count, printable, crrts, aok=TRUE + -> While there's something to read, fill the buffer. + WHILE (actual:=Read(myfile, buffer, BUFSIZE)) AND aok + count:=0 + + WHILE count Skip non-printable characters, but account for newline characters. + WHILE ((buffer[count] < myfont.lochar) OR + (buffer[count] > myfont.hichar)) AND (count < actual) + -> Is this character a newline? If it is, bump up the newline count. + IF buffer[count]=$0A THEN INC crrts + INC count + ENDWHILE + + IF crrts>0 -> If there were any newlines, be sure to display them. + Move(myrp, w.borderleft, myrp.cp_y+(crrts*(myfont.ysize+1))) + eop() -> Did we go past the end of the page? + ENDIF + + printable:=count + -> Find the next non-printables. + WHILE (buffer[printable] >= myfont.lochar) AND + (buffer[printable] <= myfont.hichar) AND (printable < actual) + INC printable + ENDWHILE + -> Print the string of printable characters wrapping lines to the + -> beginning of the next line as needed. + WHILE count How many characters in the current string of printable characters + -> will fit between the rastport's current X position and the edge of + -> the window? + fit:=TextFit(myrp, buffer+count, + printable-count, resulttextent, + NIL, 1, + w.width-(myrp.cp_x+w.borderleft+w.borderright), + myfont.ysize+1) + IF fit=0 + -> Nothing else fits on this line, need to wrap to the next line + Move(myrp, w.borderleft, myrp.cp_y+myfont.ysize+1) + ELSE + Text(myrp, buffer+count, fit) + count:=count+fit + ENDIF + eop() + ENDWHILE + + IF CtrlC() -> Did the user hit Ctrl-C? + aok:=FALSE + WriteF('Ctrl-C Break\n') + count:=BUFSIZE+1 + ENDIF + ENDWHILE + ENDWHILE +ENDPROC +->>> + +->>> PROC eop() +PROC eop() + -> If we reached the page bottom, clear the rastport and move to the top. + IF myrp.cp_y > (w.height-(w.borderbottom+2)) + Delay(25) + SetAPen(myrp, 0) + RectFill(myrp, w.borderleft, w.bordertop, w.width-(w.borderright+1), + w.height-(w.borderbottom+1)) + SetAPen(myrp, 1) + Move(myrp, w.borderleft+1, wtbarheight) + SetAPen(myrp, fr.frontpen) + ENDIF +ENDPROC +->>> + +->>> Version string +vers: + CHAR 0, '$VER: MeasureText 37.1', 0 +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Text/availfonts.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Text/availfonts.e new file mode 100644 index 0000000..227ee4e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Text/availfonts.e @@ -0,0 +1,272 @@ +-> AvailFonts.e + +->>> Header (globals) +MODULE 'diskfont', + 'layers', + 'utility', + 'exec/nodes', + 'exec/ports', + 'graphics/rastport', + 'graphics/gfx', + 'graphics/text', + 'intuition/intuition', + 'intuition/screens', + 'libraries/diskfont' + +ENUM ERR_NONE, ERR_DRAW, ERR_LIB, ERR_REGN, ERR_WIN + +RAISE ERR_DRAW IF GetScreenDrawInfo()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_REGN IF NewRegion()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +OBJECT stringobj + string + charcount + stringwidth +ENDOBJECT + +DEF alphabetstring, fname:stringobj, fheight:stringobj, xDPI:stringobj, + yDPI:stringobj, entrynum:stringobj +DEF mywin=NIL:PTR TO window, mycliprp, myrp:rastport +DEF myrect:rectangle, new_region=NIL, old_region +DEF mydrawinfo=NIL:PTR TO drawinfo, afh=NIL:PTR TO afh, fontheight, + alphabetcharcount, stringwidth +->>> + +->>> PROC main() +PROC main() HANDLE + DEF defaultfont=NIL, defaultfontattr, afsize, afshortage, cliprectside + -> E-Note: use the STRLEN short-cut to get string lengths. + alphabetstring:='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' + alphabetcharcount:=STRLEN + defaultfontattr:=['topaz.font', 9, 0, 0]:textattr + fname.string:='Font Name: '; fname.charcount:=STRLEN + fheight.string:='Font Height: '; fheight.charcount:=STRLEN + xDPI.string:='X DPI: '; xDPI.charcount:=STRLEN + yDPI.string:='Y DPI: '; yDPI.charcount:=STRLEN + entrynum.string:='Entry #: '; entrynum.charcount:=STRLEN + KickVersion(37) + diskfontbase:=OpenLibrary('diskfont.library', 37) + layersbase:=OpenLibrary('layers.library', 37) + utilitybase:=OpenLibrary('utility.library', 37) + mywin:=OpenWindowTagList(NIL, [WA_SMARTREFRESH, TRUE, -> Open that window. + WA_SIZEGADGET, FALSE, + WA_CLOSEGADGET, TRUE, + WA_IDCMP, IDCMP_CLOSEWINDOW, + WA_DRAGBAR, TRUE, + WA_DEPTHGADGET, TRUE, + WA_TITLE, 'AvailFonts() example', + NIL]) + -> An object copy: clone my window's rastport. This rastport will be used + -> to render the font specs, not the actual font sample. + CopyMem(mywin.rport, myrp, SIZEOF rastport) + mydrawinfo:=GetScreenDrawInfo(mywin.wscreen) + SetFont(myrp, mydrawinfo.font) + + myrect.minx:=mywin.borderleft -> LAYOUT THE WINDOW + myrect.miny:=mywin.bordertop + myrect.maxx:=mywin.width-(mywin.borderright+1) + myrect.maxy:=mywin.height-(mywin.borderbottom+1) + + cliprectside:=(myrect.maxx-myrect.minx)/20 + + fontheight:=myrp.font.ysize+2 + -> If the default screen font is more than one-sixth the size of the window, + -> use topaz-9. + IF fontheight>((myrect.maxy-myrect.miny)/6) + defaultfont:=OpenFont(defaultfontattr) + SetFont(myrp, defaultfont) + fontheight:=myrp.font.ysize+2 + ENDIF + + fname.stringwidth:=TextLength(myrp, fname.string, fname.charcount) + fheight.stringwidth:=TextLength(myrp, fheight.string, fheight.charcount) + xDPI.stringwidth:=TextLength(myrp, xDPI.string, xDPI.charcount) + yDPI.stringwidth:=TextLength(myrp, yDPI.string, yDPI.charcount) + entrynum.stringwidth:=TextLength(myrp, entrynum.string, entrynum.charcount) + + -> What is the largest string length? + stringwidth:=Max(Max(Max(Max(fname.stringwidth, fheight.stringwidth), + xDPI.stringwidth), yDPI.stringwidth), entrynum.stringwidth) + stringwidth:=stringwidth+mywin.borderleft + + -> If the stringwidth is more than half the viewing area, quit because the + -> font is just too big. + IF stringwidth<((myrect.maxx-myrect.minx)/2) + SetAPen(myrp, mydrawinfo.pens[TEXTPEN]) + SetDrMd(myrp, RP_JAM2) + + Move(myrp, myrect.minx+8+stringwidth-fname.stringwidth, + myrect.miny+4+myrp.font.baseline) + Text(myrp, fname.string, fname.charcount) + + Move(myrp, myrect.minx+8+stringwidth-fheight.stringwidth, + myrp.cp_y+fontheight) + Text(myrp, fheight.string, fheight.charcount) + + Move(myrp, myrect.minx+8+stringwidth-xDPI.stringwidth, + myrp.cp_y+fontheight) + Text(myrp, xDPI.string, xDPI.charcount) + + Move(myrp, myrect.minx+8+stringwidth-yDPI.stringwidth, + myrp.cp_y+fontheight) + Text(myrp, yDPI.string, yDPI.charcount) + + Move(myrp, myrect.minx+8+stringwidth-entrynum.stringwidth, + myrp.cp_y+fontheight) + Text(myrp, entrynum.string, entrynum.charcount) + + myrect.minx:=myrect.minx+cliprectside + myrect.maxx:=myrect.maxx-cliprectside + myrect.miny:=myrect.miny+(5*fontheight)+8 + myrect.maxy:=myrect.maxy-8 + + -> Draw a box around the cliprect + SetAPen(myrp, mydrawinfo.pens[SHINEPEN]) + Move(myrp, myrect.minx-1, myrect.maxy+1) + Draw(myrp, myrect.maxx+1, myrect.maxy+1) + Draw(myrp, myrect.maxx+1, myrect.miny-1) + + SetAPen(myrp, mydrawinfo.pens[SHADOWPEN]) + Draw(myrp, myrect.minx-1, myrect.miny-1) + Draw(myrp, myrect.minx-1, myrect.maxy) + + SetAPen(myrp, mydrawinfo.pens[TEXTPEN]) + -> Fill up a buffer with a LIST of the available fonts. + afsize:=AvailFonts(afh, 0, + AFF_MEMORY OR AFF_DISK OR AFF_SCALED OR AFF_TAGGED) + REPEAT + afh:=NewR(afsize) + afshortage:=AvailFonts(afh, afsize, + AFF_MEMORY OR AFF_DISK OR AFF_SCALED OR AFF_TAGGED) + IF afshortage + Dispose(afh) + afsize:=afsize+afshortage + afh:=-1 + ENDIF + UNTIL afshortage=0 + + -> This is for the layers.library clipping region that gets attached to + -> the window. This prevents the application from unnecessarily rendering + -> beyond the bounds of the inner part of the window. For more information + -> on clipping, see the Layers chapter of the RKRM. + new_region:=NewRegion() -> More layers stuff + IF OrRectRegion(new_region, myrect) -> Even more layers stuff + -> Obtain a pointer to the window's rastport and set up some of the + -> rastport attributes. This example obtains the text pen for the + -> window's screen using the GetScreenDrawInfo() function. + mycliprp:=mywin.rport + SetAPen(mycliprp, mydrawinfo.pens[TEXTPEN]) + mainLoop() + ENDIF + ENDIF +EXCEPT DO + IF new_region THEN DisposeRegion(new_region) + IF afh THEN Dispose(afh) + -> E-Note: C version forgets to CloseFont() + IF defaultfont THEN CloseFont(defaultfont) + IF mydrawinfo THEN FreeScreenDrawInfo(mywin.wscreen, mydrawinfo) + IF mywin THEN CloseWindow(mywin) + IF utilitybase THEN CloseLibrary(utilitybase) + IF layersbase THEN CloseLibrary(layersbase) + IF diskfontbase THEN CloseLibrary(diskfontbase) + SELECT exception + CASE ERR_DRAW; WriteF('Error: could not get drawinfo from screen\n') + CASE ERR_LIB; WriteF('Error: could not open required library\n') + CASE ERR_REGN; WriteF('Error: could not allocate new region\n') + CASE ERR_WIN; WriteF('Error: could not open window\n') + CASE "MEM"; WriteF('Error: ran out of memory\n') + ENDSELECT +ENDPROC +->>> + +->>> PROC mainLoop() +PROC mainLoop() + DEF x, mymsg:PTR TO intuimessage, aok=TRUE, afont:PTR TO taf, + myfont:PTR TO textfont, buf[8]:STRING, dpi + + -> E-Note: task data not needed since we can use CtrlC() + afont:=afh+SIZEOF afh + + FOR x:=0 TO afh.numentries-1 + IF aok + IF myfont:=OpenDiskFont(afont.attr) + -> Print the TextFont attributes. + SetAPen(myrp, mydrawinfo.pens[BACKGROUNDPEN]) + RectFill(myrp, stringwidth, mywin.bordertop+4, + mywin.width-(mywin.borderright+1), myrect.miny-2) + + SetAPen(myrp, mydrawinfo.pens[TEXTPEN]) + Move(myrp, stringwidth+mywin.borderleft, + mywin.bordertop+4+myrp.font.baseline) + Text(myrp, myfont.mn.ln.name, StrLen(myfont.mn.ln.name)) + + -> Print the font's Y Size. + Move(myrp, stringwidth+mywin.borderleft, myrp.cp_y+fontheight) + StringF(buf, '\d', myfont.ysize) + Text(myrp, buf, StrLen(buf)) + + -> Print the X DPI + Move(myrp, stringwidth+mywin.borderleft, myrp.cp_y+fontheight) + dpi:=GetTagData(TA_DEVICEDPI, 0, + myfont.mn.replyport::textfontextension.tags) + IF dpi + StringF(buf, '\d', Shr(dpi AND $FFFF0000, 16)) + Text(myrp, buf, StrLen(buf)) + ELSE + Text(myrp, 'NIL', 3) + ENDIF + + -> Print the Y DPI + Move(myrp, stringwidth+mywin.borderleft, myrp.cp_y+fontheight) + IF dpi + StringF(buf, '\d', dpi AND $0000FFFF) + Text(myrp, buf, StrLen(buf)) + ELSE + Text(myrp, 'NIL', 3) + ENDIF + + -> Print the entrynum + Move(myrp, stringwidth+mywin.borderleft, myrp.cp_y+fontheight) + StringF(buf, '\d', x) + Text(myrp, buf, StrLen(buf)) + + SetFont(mycliprp, myfont) + -> Install clipping rectangle + old_region:=InstallClipRegion(mywin.wlayer, new_region) + + SetRast(mycliprp, mydrawinfo.pens[BACKGROUNDPEN]) + Move(mycliprp, myrect.minx, + myrect.maxy-(myfont.ysize-myfont.baseline)) + Text(mycliprp, alphabetstring, alphabetcharcount) + + Delay(100) + + -> Remove clipping rectangle + new_region:=InstallClipRegion(mywin.wlayer, old_region) + + WHILE mymsg:=GetMsg(mywin.userport) + aok:=FALSE + x:=afh.numentries + ReplyMsg(mymsg) + ENDWHILE + + -> Did the user hit Ctrl-C? + IF CtrlC() + aok:=FALSE + x:=afh.numentries + WriteF('Ctrl-C Break\n') + ENDIF + CloseFont(myfont) + ENDIF + ENDIF + afont++ + ENDFOR +ENDPROC +->>> + +->>> Version string +vers: + CHAR 0, '$VER: AvailFonts 36.3', 0 +->>> diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Text/cliptext.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Text/cliptext.e new file mode 100644 index 0000000..5f33170 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Graphics_Libraries/Text/cliptext.e @@ -0,0 +1,261 @@ +-> cliptext.e + +->>> Header (globals) +MODULE 'diskfont', + 'layers', + 'diskfont/diskfonttag', + 'dos/rdargs', + 'graphics/displayinfo', + 'graphics/gfx', + 'graphics/rastport', + 'graphics/text', + 'intuition/intuition', + 'intuition/screens', + 'utility/tagitem' + +ENUM ERR_NONE, ERR_ARGS, ERR_FONT, ERR_KICK, ERR_LIB, ERR_OPEN, ERR_READ, + ERR_REGN, ERR_WIN + +RAISE ERR_ARGS IF ReadArgs()=NIL, + ERR_FONT IF OpenDiskFont()=NIL, + ERR_KICK IF KickVersion()=FALSE, + ERR_LIB IF OpenLibrary()=NIL, + ERR_OPEN IF Open()=NIL, + ERR_READ IF Read()<0, + ERR_REGN IF NewRegion()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST BUFSIZE=4096 + +ENUM FONT_NAME, FONT_SIZE, FILE_NAME, JAM_MODE, XASP, YASP, NUM_ARGS + +CONST DEFAULTFONTSIZE=11, DEFAULTJAMMODE=0, DEFAULTXASP=0, DEFAULTYASP=0 + +DEF args:PTR TO LONG, tagitem[2]:ARRAY OF tagitem, buffer[BUFSIZE]:ARRAY, + myfile=NIL, mymsg:PTR TO intuimessage, mydrawinfo:PTR TO drawinfo, + mywin=NIL:PTR TO window, myrp:PTR TO rastport, + myfont=NIL:PTR TO textfont, myrectangle:rectangle, new_region=NIL +->>> + +->>> PROC main() +PROC main() HANDLE + DEF myrda=NIL:PTR TO rdargs, mydi:displayinfo, mymodeid, + mydefaultfontsize=DEFAULTFONTSIZE, + mydefaultJAMMode=DEFAULTJAMMODE, + mydefaultXASP=DEFAULTXASP, -> E-Note: C version fails to use these! + mydefaultYASP=DEFAULTYASP + args:=['topaz.font', {mydefaultfontsize}, 's:startup-sequence', + {mydefaultJAMMode}, {mydefaultXASP}, {mydefaultYASP}] + -> Run only on 2.0 machines + KickVersion(36) + -> dos.library standard command line parsing. See the dos.library Autodoc + myrda:=ReadArgs('FontName,FontSize/N,FileName,Jam/N,XASP/N,YASP/N\n', + args, NIL) + myfile:=Open(args[FILE_NAME], OLDFILE) -> Open the file to display. + diskfontbase:=OpenLibrary('diskfont.library', 36) -> Open the libraries. + layersbase:=OpenLibrary('layers.library', 36) + -> This application wants to hear about three things: 1) When the user + -> clicks the window's close gadget, 2) when the user starts to resize the + -> window, 3) and when the user has finished resizing the window. + mywin:=OpenWindowTagList(NIL, -> Open that window. + [WA_MINWIDTH, 100, + WA_MINHEIGHT, 100, + WA_SMARTREFRESH, TRUE, + WA_SIZEGADGET, TRUE, + WA_CLOSEGADGET, TRUE, + WA_IDCMP, IDCMP_CLOSEWINDOW OR IDCMP_NEWSIZE OR + IDCMP_SIZEVERIFY, + WA_DRAGBAR, TRUE, + WA_DEPTHGADGET, TRUE, + WA_TITLE, args[FILE_NAME], + TAG_END]) + tagitem[0].tag:=OT_DEVICEDPI + + -> See if there is a non-zero value in the XASP or YASP fields. + -> Diskfont.library will get a divide by zero GURU if you give it a zero + -> XDPI or YDPI value. + -> If there is a zero value in one of them... + IF (Long(args[XASP])=0) OR (Long(args[YASP])=0) + -> ...use the aspect ratio of the current display as a default... + mymodeid:=GetVPModeID(mywin.wscreen.viewport) + IF GetDisplayInfoData(NIL, mydi, SIZEOF displayinfo, DTAG_DISP, mymodeid) + mydefaultXASP:=mydi.resolution.x + mydefaultYASP:=mydi.resolution.y + WriteF('XASP = \d YAsp = \d\n', mydefaultXASP, mydefaultYASP) + -> Notice that the X and Y get _swapped_ to keep the look of the font + -> glyphs the same using screens with different aspect ratios. + args[YASP]:={mydefaultXASP} + args[XASP]:={mydefaultYASP} + ELSE + -> ...unless something is preventing us from getting the screens + -> resolution. In that case, forget about the DPI tag. + tagitem[0].tag:=TAG_END + ENDIF + ENDIF + -> Here we have to put the X and Y DPI into the OT_DEVICEDPI tags data + -> field. THESE ARE NOT REAL X AND Y DPI VALUES FOR THIS FONT OR THE + -> DISPLAY. They only serve to supply the diskfont.library with values to + -> calculate the aspect ratio. The X value gets stored in the upper word of + -> the tag value and the Y DPI gets stored in the lower word. Because + -> ReadArgs() stores the _address_ of integers it gets from the command + -> line, you have to dereference the pointer it puts into the argument + -> array. + tagitem.data:=Shl(Long(args[XASP]), 16) OR Long(args[YASP]) + tagitem.tag:=TAG_END + + -> Set up myfont to match the font the user requested. + myfont:=OpenDiskFont([args[FONT_NAME], Long(args[FONT_SIZE]), + FSF_TAGGED, 0, tagitem]:ttextattr) -> Open that font. + -> This is for the layers.library clipping region that gets attached to the + -> window. This prevents the application from unnecessarily rendering + -> beyond the bounds of the inner part of the window. For now, you can + -> ignore the layers stuff if you are just interested in learning about + -> using text. For more information on clipping regions and layers, see the + -> Layers chapter of this manual. + myrectangle.minx:=mywin.borderleft + myrectangle.miny:=mywin.bordertop + myrectangle.maxx:=mywin.width-(mywin.borderright+1) + myrectangle.maxy:=mywin.height-(mywin.borderbottom+1) + + new_region:=NewRegion() + IF OrRectRegion(new_region, myrectangle) + InstallClipRegion(mywin.wlayer, new_region) + -> Obtain a pointer to the window's rastport and set up some of the + -> rastport attributes. This example obtains the text pen for the + -> window's screen using GetScreenDrawInfo(). + myrp:=mywin.rport + SetFont(myrp, myfont) + IF mydrawinfo:=GetScreenDrawInfo(mywin.wscreen) + SetAPen(myrp, mydrawinfo.pens[TEXTPEN]) + FreeScreenDrawInfo(mywin.wscreen, mydrawinfo) + ENDIF + SetDrMd(myrp, Long(args[JAM_MODE])) + + mainLoop() + ENDIF +EXCEPT DO + IF new_region THEN DisposeRegion(new_region) + IF myfont THEN CloseFont(myfont) + IF mywin THEN CloseWindow(mywin) + IF layersbase THEN CloseLibrary(layersbase) + IF diskfontbase THEN CloseLibrary(diskfontbase) + IF myfile THEN Close(myfile) + IF myrda THEN FreeArgs(myrda) + SELECT exception + CASE ERR_ARGS; WriteF('Error: ReadArgs() failed\n') + CASE ERR_FONT; WriteF('Error: could not open font\n') + CASE ERR_KICK; WriteF('Error: requires V36+\n') + CASE ERR_LIB; WriteF('Error: could not open required library\n') + CASE ERR_OPEN; WriteF('Error: could not open file\n') + CASE ERR_READ; WriteF('Error: Read() on the file failed\n') + CASE ERR_REGN; WriteF('Error: could not allocate region\n') + CASE ERR_WIN; WriteF('Error: could not open window\n') + ENDSELECT +ENDPROC +->>> + +->>> PROC mainLoop() +PROC mainLoop() + DEF count, actual, position, aok=TRUE, waitfornewsize=FALSE + -> E-Note: we don't need to find the task since we can use CtrlC() + Move(myrp, mywin.borderleft+1, mywin.bordertop+myfont.ysize+1) + + -> While there's something to read, fill the buffer + WHILE ((actual:=Read(myfile, buffer, BUFSIZE)) > 0) AND aok + position:=0 + count:=0 + + WHILE position<=actual + -> E-Note: logic swapped here... + IF waitfornewsize + WaitPort(mywin.userport) + ELSE + WHILE (buffer[count]>=myfont.lochar) AND + (buffer[count]<=myfont.hichar) AND (count<=actual) DO INC count + Text(myrp, buffer+position, count-position) + + WHILE ((buffer[count]myfont.hichar)) AND (count<=actual) + IF buffer[count]=$0A + Move(myrp, mywin.borderleft, myrp.cp_y+myfont.ysize+1) + ENDIF + INC count + ENDWHILE + position:=count + ENDIF + + WHILE mymsg:=GetMsg(mywin.userport) + -> The user clicked the close gadget. + IF mymsg.class=IDCMP_CLOSEWINDOW + aok:=FALSE + position:=actual+1 + ReplyMsg(mymsg) + -> The user picked up the window's sizing gagdet. + ELSEIF mymsg.class=IDCMP_SIZEVERIFY + -> When the user has picked up the window's sizing gadget when the + -> IDCMP_SIZEVERIFY flag is set, the application has to reply to + -> this message to tell Intuition to allow the user to move the + -> sizing gadget and resize the window. The reason for using this + -> here is because the user can resize the window while cliptext.e + -> is rendering text to the window. Cliptext.e has to stop + -> rendering text when it receives an IDCMP_SIZEVERIFY message. + -> + -> If this example had instead asked to hear about IDCMP events that + -> could take place between SIZEVERIFY and NEWSIZE events + -> (especially INTUITICKS), it should turn off those events here + -> using ModifyIDCMP(). + -> + -> After we allow the user to resize the window, we cannot write + -> into the window until the user has finished resizing it because + -> we need the window's new size to adjust the clipping area. + -> Specifically, we have to wait for an IDCMP_NEWSIZE message which + -> Intuition will send when the user lets go of the resize gadget. + -> For now, we set the waitfornewsize flag to stop rendering until + -> we get that NEWSIZE message. + waitfornewsize:=TRUE + WaitBlit() + -> The blitter is done, let the user resize the window + ReplyMsg(mymsg) + ELSE + ReplyMsg(mymsg) + waitfornewsize:=FALSE + -> The user has resized the window, so get the new window dimensions + -> and readjust the layers clipping region accordingly. + myrectangle.minx:=mywin.borderleft + myrectangle.miny:=mywin.bordertop + myrectangle.maxx:=mywin.width-(mywin.borderright+1) + myrectangle.maxy:=mywin.height-(mywin.borderbottom+1) + InstallClipRegion(mywin.wlayer, NIL) + ClearRegion(new_region) + IF OrRectRegion(new_region, myrectangle) + InstallClipRegion(mywin.wlayer, new_region) + ELSE + aok:=FALSE + position:=actual+1 + ENDIF + ENDIF + ENDWHILE + IF CtrlC() -> Check for user break. + aok:=FALSE + position:=actual+1 + ENDIF + + -> If we reached the bottom of the page, clear the rastport and move + -> back to the top. + IF myrp.cp_y>(mywin.height-(mywin.borderbottom+2)) + Delay(25) + + -> Set the entire rastport to colour zero. This will not include the + -> window borders because of the layers clipping. + SetRast(myrp, 0) + Move(myrp, mywin.borderleft+1, mywin.bordertop+myfont.ysize+1) + ENDIF + ENDWHILE + ENDWHILE +ENDPROC +->>> + +->>> Version string +vers: + CHAR 0, '$VER: cliptext 37.2', 0 +->>> diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/IFFParse/clipftxt.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/IFFParse/clipftxt.e new file mode 100644 index 0000000..6571927 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/IFFParse/clipftxt.e @@ -0,0 +1,166 @@ +-> clipftxt.e - Writes ASCII text to clipboard unit as FTXT +-> (All clipboard data must be IFF) +-> +-> Usage: clipftxt unitnumber +-> +-> To convert to an example of reading only, comment out #define WRITEREAD + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'iffparse', + 'libraries/iffparse', + 'other/split' + +ENUM ERR_NONE, ERR_ARGS, ERR_CLIP, ERR_IFF, ERR_LIB, ERR_OIFF, ERR_STOP, + ERR_USE, ERR_WRIT + +RAISE ERR_CLIP IF OpenClipboard()=NIL, + ERR_IFF IF AllocIFF()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_OIFF IF OpenIFF()<>0, + ERR_STOP IF StopChunk()<>FALSE + +-> Causes example to write FTXT first, then read it back. +-> Comment out to create a reader only +#define WRITEREAD + +-> E-Note: using argSplit() so one arg count is one less than C's argv +CONST MINARGS=1, RBUFSZ=512, ID_FTXT="FTXT", ID_CHRS="CHRS" + +DEF usage, errormsgs:PTR TO LONG, mytext +->>> + +->>> PROC main() +PROC main() HANDLE + DEF iff=NIL:PTR TO iffhandle, cn:PTR TO contextnode, error=0, unitnumber=0, + rlen, textlen, readbuf[RBUFSZ]:ARRAY, arglist:PTR TO LONG, going=TRUE + -> E-Note: set-up globals + usage:='Usage: clipftxt unitnumber (use zero for primary unit)\n' + -> Text error messages for possible IFFERR_#? returns from various IFF + -> routines. To get the index into this array, take your IFFERR code, + -> negate it, and subtract one. + -> idx = -error - 1; + errormsgs:=['End of file (not an error).', 'End of context (not an error).', + 'No lexical scope.', 'Insufficient memory.', + 'Stream read error.', 'Stream write error.', + 'Stream seek error.', 'File is corrupt.', 'IFF syntax error.', + 'Not an IFF file.', 'Required call-back hook missing.', + 'Return to client. You should never see this.']:LONG + mytext:='This FTXT written to clipboard by clipftxt example.\n' + textlen:=STRLEN + IF NIL=(arglist:=argSplit()) THEN Raise(ERR_ARGS) + -> If not enough args or "?", print usage + IF ListLen(arglist)<>MINARGS THEN Raise(ERR_USE) + IF arglist[][]="?" THEN Raise(ERR_USE) + unitnumber:=Val(arglist[]) + + iffparsebase:=OpenLibrary('iffparse.library', 0) + + -> Allocate IFF_File OBJECT + iff:=AllocIFF() + + -> Set up IFF_File for Clipboard I/O. + iff.stream:=OpenClipboard(unitnumber) + InitIFFasClip(iff) + WriteF('Opened clipboard unit \d\n', unitnumber) + + InitIFFasClip(iff) + +#ifdef WRITEREAD + + -> Start the IFF transaction. + OpenIFF(iff, IFFF_WRITE) + + -> Write our text to the clipboard as CHRS chunk in FORM FTXT + -> + -> First, write the FORM ID (FTXT) + IF FALSE=(error:=PushChunk(iff, ID_FTXT, ID_FORM, IFFSIZE_UNKNOWN)) + -> Now the CHRS chunk ID followed by the chunk data. We'll just write one + -> CHRS chunk. You could write more chunks. + IF FALSE=(error:=PushChunk(iff, 0, ID_CHRS, IFFSIZE_UNKNOWN)) + -> Now the actual data (the text) + IF WriteChunkBytes(iff, mytext, textlen)<>textlen + WriteF('Error writing CHRS data.\n') + error:=IFFERR_WRITE + ENDIF + ENDIF + IF FALSE=error THEN error:=PopChunk(iff) + ENDIF + IF FALSE=error THEN error:=PopChunk(iff) + + IF error THEN Raise(ERR_WRIT) + + WriteF('Wrote text to clipboard as FTXT\n') + + -> Now let's close it, then read it back. First close the write handle, then + -> close the clipboard. + CloseIFF(iff) + IF iff.stream THEN CloseClipboard(iff.stream) + iff.stream:=NIL -> E-Note: reinitialise it to NIL to help error trapping + + iff.stream:=OpenClipboard(unitnumber) + WriteF('Reopened clipboard unit \d\n', unitnumber) + +#endif -> WRITEREAD + + OpenIFF(iff, IFFF_READ) + + -> Tell iffparse we want to stop on FTXT CHRS chunks + StopChunk(iff, ID_FTXT, ID_CHRS) + + -> Find all of the FTXT CHRS chunks + -> E-Note: the going flag makes this easier to understand + WHILE going + error:=ParseIFF(iff, IFFPARSE_SCAN) + IF error=IFFERR_EOC -> Enter next context + ELSEIF error + going:=FALSE + ELSE + -> We only asked to stop at FTXT CHRS chunks. If no error we've hit a + -> stop chunk. Read the CHRS chunk data + cn:=CurrentChunk(iff) + + IF cn + IF (cn.type=ID_FTXT) AND (cn.id=ID_CHRS) + WriteF('CHRS chunk contains:\n') + WHILE (rlen:=ReadChunkBytes(iff, readbuf, RBUFSZ)) > 0 + -> E-Note: stdout is safe since WriteF() has been used above + Write(stdout, readbuf, rlen) + ENDWHILE + IF rlen<0 THEN error:=rlen + ENDIF + ENDIF + ENDIF + ENDWHILE + + IF error AND (error<>IFFERR_EOF) + WriteF('IFF read failed, error \d: \s\n', error, errormsgs[-error-1]) + ENDIF +EXCEPT DO + IF iff + -> Terminate the IFF transaction with the stream. Free all associated + -> structures. + CloseIFF(iff) + -> Close the clipboard stream + IF iff.stream THEN CloseClipboard(iff.stream) + -> Free the IFF_File structure itself. + FreeIFF(iff) + ENDIF + IF iffparsebase THEN CloseLibrary(iffparsebase) + SELECT exception + CASE ERR_CLIP; WriteF('Error: could not open clipboard\n') + CASE ERR_IFF; WriteF('Error: could not allocate IFF handle\n') + CASE ERR_LIB; WriteF('Error: could not open iffparse.library\n') + CASE ERR_OIFF; WriteF('Error: could not open IFF handle\n') + CASE ERR_USE; WriteF(usage) + CASE ERR_WRIT; WriteF('IFF write failed, error \d: \s\n', error, errormsgs[-error-1]) + ENDSELECT +ENDPROC +->>> + +->>> Version string +-> 2.0 Version string for c:Version to find +vers: + CHAR 0, '$VER: clipftxt 37.2', 0 +->>> diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/IFFParse/sift.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/IFFParse/sift.e new file mode 100644 index 0000000..4629055 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/IFFParse/sift.e @@ -0,0 +1,157 @@ +-> sift.e - Takes any IFF file and tells you what's in it. Verifies syntax +-> and all that cool stuff. +-> +-> Usage: sift -c ; For clipboard scanning +-> or sift ; For DOS file scanning +-> +-> Reads the specified stream and prints an IFFCheck-like listing of the +-> contents of the IFF file, if any. Stream is a DOS file for +-> argument, or is the clipboard's primary clip for -c. This program must be +-> run from a CLI. + +->>> Header (globals) +MODULE 'iffparse', + 'devices/clipboard', + 'libraries/iffparse', + 'other/split' + +ENUM ERR_NONE, ERR_ARGS, ERR_CLIP, ERR_IFF, ERR_LIB, ERR_OIFF, ERR_OPEN, + ERR_USE + +RAISE ERR_CLIP IF OpenClipboard()=NIL, + ERR_IFF IF AllocIFF()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_OIFF IF OpenIFF()<>0, + ERR_OPEN IF Open()=NIL + +-> E-Note: using argSplit() so one less argument than argv (no command name) +CONST MINARGS=1 + +DEF usage, errormsgs:PTR TO LONG +->>> + +->>> PROC main() +PROC main() HANDLE + DEF iff=NIL:PTR TO iffhandle, error, cbio, arglist:PTR TO LONG, going=TRUE + -> E-Note: set-up globals + usage:='Usage: sift IFFfilename (or -c for clipboard)\n' + -> Text error messages for possible IFFERR_#? returns from various IFF + -> routines. To get the index into this array, take your IFFERR code, + -> negate it, and subtract one. + -> idx = -error - 1; + errormsgs:=['End of file (not an error).', 'End of context (not an error).', + 'No lexical scope.', 'Insufficient memory.', + 'Stream read error.', 'Stream write error.', + 'Stream seek error.', 'File is corrupt.', 'IFF syntax error.', + 'Not an IFF file.', 'Required call-back hook missing.', + 'Return to client. You should never see this.']:LONG + IF NIL=(arglist:=argSplit()) THEN Raise(ERR_ARGS) + -> If not enough args or "?", print usage + IF ListLen(arglist)<>MINARGS THEN Raise(ERR_USE) + IF arglist[][]="?" THEN Raise(ERR_USE) + + -> Check to see if we are doing I/O to the Clipboard. + cbio:=(arglist[][]="-") AND (arglist[][1]="c") + + iffparsebase:=OpenLibrary('iffparse.library', 0) + + -> Allocate IFF_File OBJECT + iff:=AllocIFF() + + -> Internal support is provided for both AmigaDOS files, and the + -> clipboard.device. This bizarre 'IF' statement performs the appropriate + -> machinations for each case. + IF cbio + -> Set up IFF_File for Clipboard I/O. + iff.stream:=OpenClipboard(PRIMARY_CLIP) + InitIFFasClip(iff) + ELSE + -> Set up IFF_File for AmigaDOS I/O. + iff.stream:=Open(arglist[], OLDFILE) + InitIFFasDOS(iff) + ENDIF + + -> Start the IFF transaction. + OpenIFF(iff, IFFF_READ) + + -> E-Note: the going flag makes this easier to understand + WHILE going + -> The interesting bit. IFFPARSE_RAWSTEP permits us to have precision + -> monitoring of the parsing process, which is necessary if we wish to + -> print the structure of an IFF file. ParseIFF() with _RAWSTEP will + -> return the following things for the following reasons: + -> + -> Return code: Reason: + -> 0 Entered new context. + -> IFFERR_EOC About to leave a context. + -> IFFERR_EOF Encountered end-of-file. + -> A parsing error. + error:=ParseIFF(iff, IFFPARSE_RAWSTEP) + + -> Since we're only interested in when we enter a context, we 'discard' + -> end-of-context (_EOC) events. + IF error=IFFERR_EOC + ELSEIF error + -> Leave the loop if there is any other error. + going:=FALSE + ELSE + -> If we get here, error was zero. Print out the current state of + -> affairs. + printTopChunk(iff) + ENDIF + ENDWHILE + + -> If error was IFFERR_EOF, then the parser encountered the end of the file + -> without problems. Otherwise, we print a diagnostic. + IF error=IFFERR_EOF + WriteF('File scan complete.\n') + ELSE + WriteF('File scan aborted, error \d: \s\n', error, errormsgs[-error-1]) + ENDIF +EXCEPT DO + IF iff + -> Terminate the IFF transaction with the stream. + CloseIFF(iff) + -> Close the stream itself. + IF iff.stream + IF cbio THEN CloseClipboard(iff.stream) ELSE Close(iff.stream) + ENDIF + -> Free the IFF_File object itself. + FreeIFF(iff) + ENDIF + IF iffparsebase THEN CloseLibrary(iffparsebase) + SELECT exception + CASE ERR_CLIP; WriteF('Error: could not open clipboard\n') + CASE ERR_IFF; WriteF('Error: could not allocate IFF handle\n') + CASE ERR_LIB; WriteF('Error: could not open iffparse.library\n') + CASE ERR_OIFF; WriteF('Error: could not open IFF handle\n') + CASE ERR_OPEN; WriteF('Error: could not open file\n') + CASE ERR_USE; WriteF(usage) + ENDSELECT +ENDPROC +->>> + +->>> PROC printTopChunk(iff:PTR TO iffhandle) +PROC printTopChunk(iff:PTR TO iffhandle) + DEF top:PTR TO contextnode, i, idbuf[5]:ARRAY + -> Get a pointer to the context node describing the current context. + IF NIL=(top:=CurrentChunk(iff)) THEN RETURN + + -> Print a series of dots equivalent to the current nesting depth of chunks + -> processed so far. This will cause nested chunks to be printed out + -> indented. + FOR i:=iff.depth TO 1 STEP -1 DO WriteF('. ') + + -> Print out the current chunk's ID and size. + WriteF('\s \d ', IdtoStr(top.id, idbuf), top.size) + + -> Print the current chunk's type, with a newline. + WriteF('\s\n', IdtoStr(top.type, idbuf)) +ENDPROC +->>> + +->>> Version string +-> 2.0 Version string for c:Version to find +vers: + CHAR 0, '$VER: sift 37.1', 0 +->>> diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/rkmbutclass.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/rkmbutclass.e new file mode 100644 index 0000000..21b4fb6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/rkmbutclass.e @@ -0,0 +1,345 @@ +-> RKMButClass.e - Example Boopsi gadget for RKRM:Libraries + +OPT PREPROCESS + +MODULE 'utility', + 'amigalib/boopsi', + 'tools/installhook', + 'devices/inputevent', + 'graphics/rastport', + 'intuition/cghooks', + 'intuition/classes', + 'intuition/classusr', + 'intuition/gadgetclass', + 'intuition/icclass', + 'intuition/imageclass', + 'intuition/intuition', + 'intuition/screens', + 'utility/tagitem' + +ENUM ERR_NONE, ERR_LIB, ERR_WIN + +RAISE ERR_LIB IF OpenLibrary()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +OBJECT butINST + midX, midY -> Coordinates of middle of gadget +ENDOBJECT + +CONST RKMBUT_PULSE=TAG_USER+1, + -> butINST has one flag: + ERASE_ONLY=1, -> Tells rendering routine to only erase the gadget, not + -> rerender a new one. This lets the gadget erase itself + -> before it rescales. + INTWIDTH=40, INTHEIGHT=20 + +DEF w=NIL:PTR TO window, rkmbutcl=NIL, + integer=NIL:PTR TO gadget, but=NIL:PTR TO gadget + +-> The main() function connects an rkmButClass object to a Boopsi integer +-> gadget, which displays the rkmButClass gadget's RKMBUT_PULSE value. The +-> code scales and move the gadget while it is in place. +PROC main() HANDLE + utilitybase:=OpenLibrary('utility.library', 37) + w:=OpenWindowTagList(NIL, + [WA_FLAGS, WFLG_DEPTHGADGET OR WFLG_DRAGBAR OR + WFLG_CLOSEGADGET OR WFLG_SIZEGADGET, + WA_IDCMP, IDCMP_CLOSEWINDOW, + WA_WIDTH, 640, + WA_HEIGHT, 200, + NIL]) + WindowLimits(w, 450, 200, 640, 200) + IF rkmbutcl:=initRKMButGadClass() + integer:=NewObjectA(NIL, 'strgclass', + [GA_ID, 1, + GA_TOP, w.bordertop+5, + GA_LEFT, w.borderleft+5, + GA_WIDTH, INTWIDTH, + GA_HEIGHT, INTHEIGHT, + STRINGA_LONGVAL, 0, + STRINGA_MAXCHARS, 5, + NIL]) + but:=NewObjectA(rkmbutcl, NIL, + [GA_ID, 2, + GA_TOP, w.bordertop+5, + GA_LEFT, integer.leftedge+integer.width+5, + GA_WIDTH, INTWIDTH, + GA_HEIGHT, INTHEIGHT, + GA_PREVIOUS, integer, + ICA_MAP, [RKMBUT_PULSE, STRINGA_LONGVAL, NIL], + ICA_TARGET, integer, + NIL]) + + AddGList(w, integer, -1, -1, NIL) + RefreshGList(integer, w, NIL, -1) + + SetWindowTitles(w, '<-- Click to resize gadget Height', NIL) + mainLoop(NIL, 0) + + SetWindowTitles(w, '<-- Click to resize gadget Width', NIL) + mainLoop(GA_HEIGHT, 100) + + SetWindowTitles(w, '<-- Click to resize gadget Y position', NIL) + mainLoop(GA_WIDTH, 100) + + SetWindowTitles(w, '<-- Click to resize gadget X position', NIL) + mainLoop(GA_TOP, but.topedge+20) + + SetWindowTitles(w, '<-- Click to quit', NIL) + mainLoop(GA_LEFT, but.leftedge+20) + + RemoveGList(w, integer, -1) + ENDIF +EXCEPT DO + IF but THEN DisposeObject(but) + IF integer THEN DisposeObject(integer) + IF rkmbutcl THEN freeRKMButGadClass(rkmbutcl) + IF w THEN CloseWindow(w) + IF utilitybase THEN CloseLibrary(utilitybase) + SELECT exception + CASE ERR_LIB; WriteF('Error: Could not open utility.library\n') + CASE ERR_WIN; WriteF('Error: Could not open window\n') + ENDSELECT +ENDPROC + +PROC mainLoop(attr, value) + SetGadgetAttrsA(but, w, NIL, [attr, value, NIL]) + REPEAT + UNTIL WaitIMessage(w)=IDCMP_CLOSEWINDOW +ENDPROC + +-> Make the class and set up the dispatcher's hook +PROC initRKMButGadClass() + DEF cl:PTR TO iclass + IF cl:=MakeClass(NIL, 'gadgetclass', NIL, SIZEOF butINST, 0) + -> Initialise the dispatcher Hook. + -> E-Note: use installhook to set up the hook + installhook(cl.dispatcher, {dispatchRKMButGad}) + ENDIF +ENDPROC cl + +-> Free the class +PROC freeRKMButGadClass(cl) IS FreeClass(cl) + +-> The RKMBut class dispatcher +PROC dispatchRKMButGad(cl:PTR TO iclass, o, msg:PTR TO msg) + DEF inst:PTR TO butINST, retval=FALSE, g:PTR TO gadget, gpi:PTR TO gpinput, + ie:PTR TO inputevent, rp, x, y, w, h, tmp, gpmsg:gprender + -> E-Note: installhook makes sure A4 is set-up properly + tmp:=msg.methodid + SELECT tmp + CASE OM_NEW -> First, pass up to superclass + IF g:=doSuperMethodA(cl, o, msg) + -> Initialise local instance data + inst:=INST_DATA(cl, g) + inst.midX:=g.leftedge+(g.width/2) + inst.midY:=g.topedge+(g.height/2) + retval:=g + ENDIF + CASE GM_HITTEST -> Since this is a rectangular gadget this + -> method always returns GMR_GADGETHIT. + retval:=GMR_GADGETHIT + CASE GM_GOACTIVE + inst:=INST_DATA(cl, o) + + -> Only become active if the GM_GOACTIVE was triggered by direct user input. + IF msg::gpinput.ievent + -> This gadget is now active, change visual state to selected and render. + g:=o + g.flags:=g.flags OR GFLG_SELECTED + renderRKMBut(cl, o, msg) + retval:=GMR_MEACTIVE + ELSE + -> The GM_GOACTIVE was not triggered by direct user input. + retval:=GMR_NOREUSE + ENDIF + CASE GM_RENDER + retval:=renderRKMBut(cl, o, msg) + CASE GM_HANDLEINPUT + -> While it is active, this gadget sends its superclass an OM_NOTIFY pulse + -> for every IECLASS_TIMER event that goes by (about one every 10th of a + -> second). Any object that is connected to this gadget will get A LOT of + -> OM_UPDATE messages. + g:=o + gpi:=msg + ie:=gpi.ievent + + inst:=INST_DATA(cl, o) + + retval:=GMR_MEACTIVE + + IF ie.class=IECLASS_RAWMOUSE + tmp:=ie.code + SELECT tmp + CASE SELECTUP + -> The user let go of the gadget so return GMR_NOREUSE to deactivate + -> and to tell Intuition not to reuse this Input Event as we have + -> already processed it. If the user let go of the gadget while the + -> mouse was over it, mask GMR_VERIFY into the return value so Intuition + -> will send a Release Verify (GADGETUP). + IF (gpi.mousex < g.leftedge) OR + (gpi.mousex > (g.leftedge+g.width)) OR + (gpi.mousey < g.topedge) OR + (gpi.mousey > (g.topedge+g.height)) + retval:=GMR_NOREUSE OR GMR_VERIFY + ELSE + retval:=GMR_NOREUSE + ENDIF + + -> Since the gadget is going inactive, send a final notification to + -> the ICA_TARGET. + notifyPulse(cl, o, 0, inst.midX, msg) + CASE MENUDOWN + -> The user hit the menu button. Go inactive and let Intuition reuse + -> the menu button event so Intuition can pop up the menu bar. + retval:=GMR_REUSE + + -> Since the gadget is going inactive, send a final notification to + -> the ICA_TARGET. + notifyPulse(cl, o, 0, inst.midX, msg) + DEFAULT + retval:=GMR_MEACTIVE + ENDSELECT + ELSEIF ie.class=IECLASS_TIMER + -> If the gadget gets a timer event, it sends an interim OM_NOTIFY to + -> its superclass. + notifyPulse(cl, o, OPUF_INTERIM, inst.midX, gpi) + ENDIF + CASE GM_GOINACTIVE + -> Intuition said to go inactive. Clear the GFLG_SELECTED bit and render + -> using unselected imagery. + g:=o + g.flags:=g.flags AND Not(GFLG_SELECTED) + renderRKMBut(cl, o, msg) + CASE OM_SET + -> Although this class doesn't have settable attributes, this gadget class + -> does have scaleable imagery, so it needs to find out when its size and/or + -> position has changed so it can erase itself, THEN scale, and rerender. + IF FindTagItem(GA_WIDTH, msg::opset.attrlist) OR + FindTagItem(GA_HEIGHT, msg::opset.attrlist) OR + FindTagItem(GA_TOP, msg::opset.attrlist) OR + FindTagItem(GA_LEFT, msg::opset.attrlist) + g:=o + + x:=g.leftedge + y:=g.topedge + w:=g.width + h:=g.height + + inst:=INST_DATA(cl, o) + + retval:=doSuperMethodA(cl, o, msg) + + -> Get pointer to RastPort for gadget. + IF rp:=ObtainGIRPort(msg::opset.ginfo) + SetAPen(rp, msg::opset.ginfo.drinfo.pens[BACKGROUNDPEN]) + SetDrMd(rp, RP_JAM1) -> Erase the old gadget. + RectFill(rp, x, y, x+w, y+h) + inst.midX:=g.leftedge+(g.width/2) -> Recalculate where the + inst.midY:=g.topedge+(g.height/2) -> center of the gadget is. + + -> Rerender the gadget. + -> E-Note: Intuition may alter the message, so don't use a static list + gpmsg.methodid:=GM_RENDER + gpmsg.ginfo:=msg::opset.ginfo + gpmsg.rport:=rp + gpmsg.redraw:=GREDRAW_REDRAW + doMethodA(o, gpmsg) + ReleaseGIRPort(rp) + ENDIF + ELSE + retval:=doSuperMethodA(cl, o, msg) + ENDIF + DEFAULT + -> rkmmodelclass does not recognise the methodID, let the superclass's + -> dispatcher take a look at it. + retval:=doSuperMethodA(cl, o, msg) + ENDSELECT +ENDPROC retval + +-> Build an OM_NOTIFY message for RKMBUT_PULSE and send it to the superclass. +PROC notifyPulse(cl, o:PTR TO gadget, flags, mid, gpi:PTR TO gpinput) + DEF msg:PTR TO opnotify -> E-Note: "opnotify" is really "opupdate" + -> If this is an OM_UPDATE method, make sure the part the OM_UPDATE message + -> adds to the OM_SET message gets added. That lets the dispatcher handle + -> OM_UPDATE and OM_SET in the same case. + msg:=[OM_NOTIFY, [RKMBUT_PULSE, mid-(gpi.mousex+o.leftedge), + GA_ID, o.gadgetid, NIL], + gpi.ginfo, flags]:opnotify + + -> E-Note: A bug (?) in Intuition means that the methodid of an OM_NOTIFY + -> message may be altered, so you can't get away with just using a + -> constant value in the above static list... + msg.methodid:=OM_NOTIFY + + doSuperMethodA(cl, o, msg) +ENDPROC + +-> Erase and rerender the gadget. +PROC renderRKMBut(cl:PTR TO iclass, g:PTR TO gadget, msg:PTR TO gprender) + DEF inst:PTR TO butINST, rp, retval=TRUE, pens:PTR TO INT, + back, shine, shadow, w, h, x, y + inst:=INST_DATA(cl, g) + pens:=msg.ginfo.drinfo.pens + + IF msg.methodid=GM_RENDER + -> If msg is truly a GM_RENDER message (not a gpinput that looks like a + -> gprender), use the rastport within it... + rp:=msg.rport + ELSE -> ...Otherwise, get a rastport using ObtainGIRPort(). + rp:=ObtainGIRPort(msg.ginfo) + ENDIF + + IF rp + IF g.flags AND GFLG_SELECTED + -> If the gadget is selected, reverse the meanings of the pens. + back:=pens[FILLPEN] + shine:=pens[SHADOWPEN] + shadow:=pens[SHINEPEN] + ELSE + back:=pens[BACKGROUNDPEN] + shine:=pens[SHINEPEN] + shadow:=pens[SHADOWPEN] + ENDIF + SetDrMd(rp, RP_JAM1) + + SetAPen(rp, back) -> Erase the old gadget. + RectFill(rp, g.leftedge, g.topedge, + g.leftedge+g.width, g.topedge+g.height) + + SetAPen(rp, shadow) -> Draw shadow edge. + Move(rp, g.leftedge+1, g.topedge+g.height) + Draw(rp, g.leftedge+g.width, g.topedge+g.height) + Draw(rp, g.leftedge+g.width, g.topedge+1) + + w:=g.width/4 -> Draw Arrows - Sorry, no frills imagery + h:=g.height/2 + x:=g.leftedge+(w/2) + y:=g.topedge+(h/2) + + Move(rp, x, inst.midY) + Draw(rp, x+w, y) + Draw(rp, x+w, y+g.height-h) + Draw(rp, x, inst.midY) + + x:=g.leftedge+(w/2)+(g.width/2) + + Move(rp, x+w, inst.midY) + Draw(rp, x, y) + Draw(rp, x, y+g.height-h) + Draw(rp, x+w, inst.midY) + + SetAPen(rp, shine) -> Draw shine edge. + Move(rp, g.leftedge, g.topedge+g.height-1) + Draw(rp, g.leftedge, g.topedge) + Draw(rp, g.leftedge+g.width-1, g.topedge) + + IF msg.methodid<>GM_RENDER -> If we allocated a rastport, give it back. + ReleaseGIRPort(rp) + ENDIF + ELSE + retval:=FALSE + ENDIF +ENDPROC retval + +vers: CHAR 0, '$VER: TestBut 37.1', 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/rkmmodel.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/rkmmodel.e new file mode 100644 index 0000000..14535c0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/rkmmodel.e @@ -0,0 +1,143 @@ +-> RKMModel.e - A simple custom modelclass subclass. + +OPT MODULE +OPT PREPROCESS + +OPT OSVERSION=37 + +MODULE 'utility', + 'amigalib/boopsi', + 'tools/installhook', + 'intuition/classes', + 'intuition/classusr', + 'utility/hooks', + 'utility/tagitem' + +-> The attributes defined by this class +EXPORT ENUM RKMMOD_DUMMY=TAG_USER, + RKMMOD_CURRVAL, -> This attribute is the current value of the model. + RKMMOD_UP, -> These two are fake attributes that rkmmodelclass + RKMMOD_DOWN, -> uses as pulse values to increment/decrement the + -> rkmmodel's RKMMOD_CURRVAL attribute. + RKMMOD_LIMIT -> This attribute contains the upper bound of the + -> rkmmodel's RKMMOD_CURRVAL. The rkmmodel has a + -> static lower bound of zero. + +-> If the programmer doesn't set RKMMOD_LIMIT, it defaults to this. +CONST DEFAULTVALLIMIT=100 + +OBJECT rkmModData + currval, vallimit -> The instance data for this class +ENDOBJECT + +-> Initialise the class +EXPORT PROC initRKMModClass() -> Make the class and set up the dispatcher's hook + DEF cl:PTR TO iclass + IF cl:=MakeClass(NIL, 'modelclass', NIL, SIZEOF rkmModData, 0) + -> E-Note: use installhook to set up the hook + installhook(cl.dispatcher, {dispatchRKMModel}) -> Initialise the Hook + ENDIF +ENDPROC cl + +-> Free the class +EXPORT PROC freeRKMModClass(cl) IS FreeClass(cl) + +-> The class Dispatcher +PROC dispatchRKMModel(cl:PTR TO iclass, o, msg:PTR TO msg) + DEF mmd:PTR TO rkmModData, id, ti:PTR TO tagitem, tstate, tag, + retval=NIL -> A generic return value used by this class's methods. The + -> meaning of this field depends on the method. For example, + -> OM_GET uses this as a boolean return value, while OM_NEW + -> uses it as a pointer to the new object. + -> E-Note: installhook makes sure A4 is set-up properly + id:=msg.methodid + IF id=OM_SET THEN id:=OM_UPDATE -> E-Note: handled the same in this class + SELECT id + CASE OM_NEW -> Pass message onto superclass first so it can set aside memory + -> for the object and take care of superclass instance data. + IF retval:=doSuperMethodA(cl, o, msg) + -> For the OM_NEW method, the object pointer passed to the dispatcher + -> does not point to an object (how could it? The object doesn't exist + -> yet.). doSuperMethodA() returns a pointer to a newly created object. + -> INST_DATA() is a macro defined in 'intuition/classes' that returns a + -> pointer to the object's instance data that is local to this class. For + -> example, the instance data local to this class is the rkmModData + -> structure defined above. + mmd:=INST_DATA(cl, retval) + -> Initialise object's attributes + -> E-Note: "opnew" is really "opset" + mmd.currval:=GetTagData(RKMMOD_CURRVAL, 0, msg::opnew.attrlist) + mmd.vallimit:=GetTagData(RKMMOD_LIMIT,DEFAULTVALLIMIT,msg::opnew.attrlist) + ENDIF + CASE OM_UPDATE -> E-Note: includes OM_SET (see "IF id=.." above) + mmd:=INST_DATA(cl, o) + doSuperMethodA(cl,o,msg) -> Let the superclasses set their attributes first + tstate:=msg::opset.attrlist + -> Step through all of the attribute/value pairs in the list. Use the + -> utility.library tag functions to do this so they can properly process + -> special tag IDs like TAG_SKIP, TAG_IGNORE, etc. + WHILE ti:=NextTagItem({tstate}) + tag:=ti.tag + SELECT tag + CASE RKMMOD_CURRVAL + IF ti.data>mmd.vallimit THEN ti.data:=mmd.vallimit + mmd.currval:=ti.data + notifyCurrVal(cl, o, msg, mmd) + retval:=1 -> Changing RKMMOD_CURRVAL can cause a visual change to the + -> gadgets in the rkmmodel's broadcast list. The rkmmodel has + -> to tell the application by returning a value besides zero. + CASE RKMMOD_UP + mmd.currval:=mmd.currval+1 + -> Make sure the current value is not greater than value limit. + IF mmd.currval>mmd.vallimit THEN mmd.currval:=mmd.vallimit + notifyCurrVal(cl, o, msg, mmd) + retval:=1 -> Changing RKMMOD_UP can cause a visual change to the gadgets + -> in the rkmmodel's broadcast list. The rkmmodel has to tell + -> the application by returning a value besides zero. + CASE RKMMOD_DOWN + mmd.currval:=mmd.currval-1 + -> Make sure the currval didn't go negative + IF mmd.currval<0 THEN mmd.currval:=0 + notifyCurrVal(cl, o, msg, mmd) + retval:=1 -> Changing RKMMOD_DOWN can cause a visual change to gadgets + -> in the rkmmodel's broadcast list. The rkmmodel has to tell + -> the application by returning a value besides zero. + CASE RKMMOD_LIMIT + mmd.vallimit:=ti.data -> Set the limit. Note that this does not do + -> bounds checking on the current + -> rkmModData.currval value. + ENDSELECT + ENDWHILE + CASE OM_GET -> The only attribute that is "gettable" in this class + mmd:=INST_DATA(cl, o) -> or its superclasses is RKMMOD_CURRVAL. + IF msg::opget.attrid=RKMMOD_CURRVAL + msg::opget.storage[]:=mmd.currval + retval:=TRUE + ELSE + retval:=doSuperMethodA(cl, o, msg) + ENDIF + DEFAULT -> rkmmodelclass does not recognise the methodID, so let the + -> superclass's dispatcher take a look at it. + retval:=doSuperMethodA(cl, o, msg) + ENDSELECT +ENDPROC retval + +PROC notifyCurrVal(cl, o, msg:PTR TO opupdate, mmd:PTR TO rkmModData) + DEF notifymsg:PTR TO opnotify -> E-Note: "opnotify" is really "opupdate" + -> If this is an OM_UPDATE method, make sure the part the OM_UPDATE message + -> adds to the OM_SET message gets added. That lets the dispatcher handle + -> OM_UPDATE and OM_SET in the same case. + notifymsg:=[OM_NOTIFY, [RKMMOD_CURRVAL, mmd.currval, NIL], msg.ginfo, + IF msg.methodid=OM_UPDATE THEN msg.flags ELSE 0]:opnotify + + -> E-Note: A bug (?) in Intuition means that the methodid of an OM_NOTIFY + -> message may be altered, so you can't get away with just using a + -> constant value in the above static list... + notifymsg.methodid:=OM_NOTIFY + + -> If the RKMMOD_CurrVal changes, we want everyone to know about it. + -> Theoretically, the class is supposed to send itself a OM_NOTIFY message. + -> Because this class lets its superclass handle the OM_NOTIFY message, it + -> skips the middleman and sends the OM_NOTIFY directly to its superclass. + doSuperMethodA(cl, o, notifymsg) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/rkmmodel.m b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/rkmmodel.m new file mode 100644 index 0000000..325877d Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/rkmmodel.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/talk2boopsi.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/talk2boopsi.e new file mode 100644 index 0000000..cdc7c7a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/talk2boopsi.e @@ -0,0 +1,107 @@ +-> This example creates a Boopsi prop gadget and integer string gadget, +-> connecting them so they update each other when the user changes their value. +-> The example program only initialises the gadgets and puts them on the window; +-> it doesn't have to interact with them to make them talk to each other. + +OPT OSVERSION=37 + +MODULE 'intuition/gadgetclass', + 'intuition/icclass', + 'intuition/intuition' + +ENUM ERR_NONE, ERR_OBJ, ERR_WIN + +RAISE ERR_OBJ IF NewObjectA()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST PROPGADGET_ID=1, INTGADGET_ID=2, + PROPGADGETWIDTH=10, PROPGADGETHEIGHT=80, INTGADGETHEIGHT=18, + VISIBLE=10, TOTAL=100, INITIALVAL=25, MINWINDOWWIDTH=80 +CONST MINWINDOWHEIGHT=PROPGADGETHEIGHT+70, MAXCHARS=3 + +PROC main() HANDLE + DEF w=NIL:PTR TO window, prop=NIL, integer=NIL + + -> Open the window--notice that the window's IDCMP port + -> does not listen for GADGETUP messages. + w:=OpenWindowTagList(NIL, + [WA_FLAGS, WFLG_DEPTHGADGET OR WFLG_DRAGBAR OR + WFLG_CLOSEGADGET OR WFLG_SIZEGADGET, + WA_IDCMP, IDCMP_CLOSEWINDOW, + WA_MINWIDTH, MINWINDOWWIDTH, + WA_MINHEIGHT, MINWINDOWHEIGHT, + NIL]) + + -> Create a new propgclass object + prop:=NewObjectA(NIL, 'propgclass', + [GA_ID, PROPGADGET_ID, -> These are defined by gadgetclass and + GA_TOP, w.bordertop+5, -> correspond to similarly named fields + GA_LEFT, w.borderleft+5, -> in the Gadget structure. + GA_WIDTH, PROPGADGETWIDTH, + GA_HEIGHT, PROPGADGETHEIGHT, + -> This tells the prop gadget to map its PGA_Top attribute to + -> STRINGA_LONGVAL when it issues an update about the change to + -> its PGA_Top value. + ICA_MAP, [PGA_TOP, STRINGA_LONGVAL, NIL], + -> The rest of this gadget's attributes are defined by propgclass. + PGA_TOTAL, TOTAL, -> The integer range of the prop gadget. + PGA_TOP, INITIALVAL, -> The initial value of the prop gadget. + PGA_VISIBLE, VISIBLE, -> This determines how much of the prop gadget + -> area is covered by the prop gadget's knob, + -> or how much of the gadget's TOTAL range is + -> taken up by the prop gadget's knob. + PGA_NEWLOOK, TRUE, -> Use new-look prop gadget imagery + NIL]) + + -> Create the integer string gadget + integer:=NewObjectA(NIL, 'strgclass', + [GA_ID, INTGADGET_ID, -> Parameters for the Gadget structure + GA_TOP, w.bordertop+5, + GA_LEFT, w.borderleft+PROPGADGETWIDTH+10, + GA_WIDTH, (MINWINDOWWIDTH- + (w.borderleft+w.borderright+PROPGADGETWIDTH+15)), + GA_HEIGHT, INTGADGETHEIGHT, + -> This tells the string gadget to map its STRINGA_LONGVAL + -> attribute to PGA_TOP when it issues an update. + ICA_MAP, [STRINGA_LONGVAL, PGA_TOP, NIL], + ICA_TARGET, prop, + -> The GA_PREVIOUS attribute is defined by gadgetclass and is used + -> to wedge a new gadget into a list of gadget's linked by their + -> gadget.nextgadget field. When NewObject() creates this gadget, + -> it inserts the new gadget into this list behind the GA_PREVIOUS + -> gadget. This attribute is a pointer to the previous gadget. + -> This attribute cannot be used to link new gadgets into the + -> gadget list of an open window or requester, use + -> AddGList() instead. + GA_PREVIOUS, prop, + -> These attributes are defined by strgclass. The first contains + -> the value of the integer string gadget. The second is the + -> maximum number of characters the user is allowed to type into + -> the gadget. + STRINGA_LONGVAL, INITIALVAL, + STRINGA_MAXCHARS, MAXCHARS, + NIL]) + + -> Because the integer string gadget did not exist when this example created + -> the prop gadget, it had to wait to set the ICA_Target of the prop gadget. + SetGadgetAttrsA(prop, w, NIL, [ICA_TARGET, integer, NIL]) + + AddGList(w,prop,-1,-1,NIL) -> Add the gadgets to the window and display them. + RefreshGList(prop, w, NIL, -1) + + REPEAT -> Wait for the user to click the window close gadget. + UNTIL WaitIMessage(w)=IDCMP_CLOSEWINDOW + + RemoveGList(w, prop, -1) + +EXCEPT DO + IF integer THEN DisposeObject(integer) + IF prop THEN DisposeObject(prop) + IF w THEN CloseWindow(w) + SELECT exception + CASE ERR_OBJ; WriteF('Error: Failed to create new Object\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + ENDSELECT +ENDPROC + +vers: CHAR 0, '$VER: Talk2boopsi 37.1', 0 \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/userkmmodel.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/userkmmodel.e new file mode 100644 index 0000000..50cdac7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Boopsi/userkmmodel.e @@ -0,0 +1,182 @@ +OPT OSVERSION=37 + +MODULE '*rkmmodel', + 'amigalib/boopsi', + 'utility', + 'intuition/classusr', + 'intuition/gadgetclass', + 'intuition/icclass', + 'intuition/imageclass', + 'intuition/intuition' + +ENUM ERR_NONE, ERR_DRAW, ERR_LIB, ERR_OBJ, ERR_WIN + +RAISE ERR_DRAW IF GetScreenDrawInfo()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_OBJ IF NewObjectA()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST PROPID=1, INTEGERID=2, RIGHTID=3, LEFTID=4, PROPWIDTH=80, PROPHEIGHT=10, + INTWIDTH=50, INTHEIGHT=14, VISIBLE=10, TOTAL=100, INITIALVAL=25 +CONST MINWINDOWWIDTH=80, MINWINDOWHEIGHT=PROPHEIGHT+70, MAXCHARS=4 + +DEF w=NIL:PTR TO window, mydrawinfo=NIL, rkmmodcl=NIL, + rkmmodel=NIL, currval2int=NIL, currval2prop=NIL, + prop=NIL:PTR TO gadget, integer=NIL:PTR TO gadget, + leftbut=NIL:PTR TO gadget, rightbut=NIL:PTR TO gadget, + rightimage=NIL, leftimage=NIL + +PROC main() HANDLE + DEF qwe + utilitybase:=OpenLibrary('utility.library', 37) + w:=OpenWindowTagList(NIL, + [WA_FLAGS, WFLG_DEPTHGADGET OR WFLG_DRAGBAR OR + WFLG_CLOSEGADGET OR WFLG_SIZEGADGET, + WA_IDCMP, IDCMP_CLOSEWINDOW, + NIL]) + -> E-Note: we could have made initRKMModClass raise an exception + IF rkmmodcl:=initRKMModClass() + mydrawinfo:=GetScreenDrawInfo(w.wscreen) + makeGadgetsAndRKMModel() + doMethodA(rkmmodel, [OM_ADDMEMBER, currval2prop]) + currval2prop:=NIL -> E-Note: this is now part of the rkmmodel object + doMethodA(rkmmodel, [OM_ADDMEMBER, currval2int]) + currval2int:=NIL -> E-Note: again, now part of the rkmmodel object + WindowLimits(w, + w.borderleft+w.borderright+integer.leftedge+integer.width+10, + w.bordertop+w.borderbottom+prop.height+10, + w.maxwidth, + w.maxheight) + AddGList(w, prop, -1, -1, NIL) + RefreshGadgets(prop, w, NIL) + + GetAttr(RKMMOD_CURRVAL, rkmmodel, {qwe}) + WriteF('RKMMOD_CURRVAL = \d\n', qwe) + Delay(200) + + IF SetAttrsA(rkmmodel, [RKMMOD_CURRVAL, 10, NIL]) + RefreshGadgets(prop, w, NIL) + ENDIF + GetAttr(RKMMOD_CURRVAL, rkmmodel, {qwe}) + WriteF('RKMMOD_CURRVAL = \d\n', qwe) + Delay(200) + + IF SetAttrsA(rkmmodel, [RKMMOD_CURRVAL, 30, NIL]) + RefreshGadgets(prop, w, NIL) + ENDIF + GetAttr(RKMMOD_CURRVAL, rkmmodel, {qwe}) + WriteF('RKMMOD_CURRVAL = \d\n', qwe) + Delay(200) + + IF SetAttrsA(rkmmodel, [RKMMOD_CURRVAL, 50, NIL]) + RefreshGadgets(prop, w, NIL) + ENDIF + GetAttr(RKMMOD_CURRVAL, rkmmodel, {qwe}) + WriteF('RKMMOD_CURRVAL = \d\n', qwe) + Delay(200) + + IF SetAttrsA(rkmmodel, [RKMMOD_UP, 1, NIL]) + RefreshGadgets(prop, w, NIL) + ENDIF + + -> Wait for the user to click window close gadget + REPEAT + UNTIL WaitIMessage(w)=IDCMP_CLOSEWINDOW + RemoveGList(w, prop, -1) + ENDIF + +EXCEPT DO + IF currval2int THEN DisposeObject(currval2int) + IF currval2prop THEN DisposeObject(currval2prop) + IF rightbut THEN DisposeObject(rightbut) + IF leftbut THEN DisposeObject(leftbut) + IF integer THEN DisposeObject(integer) + IF prop THEN DisposeObject(prop) + IF rkmmodel THEN DisposeObject(rkmmodel) + IF leftimage THEN DisposeObject(leftimage) + IF rightimage THEN DisposeObject(rightimage) + + IF mydrawinfo THEN FreeScreenDrawInfo(w.wscreen, mydrawinfo) + IF rkmmodcl THEN freeRKMModClass(rkmmodcl) + IF w THEN CloseWindow(w) + IF utilitybase THEN CloseLibrary(utilitybase) + SELECT exception + CASE ERR_DRAW; WriteF('Error: Failed to get screen DrawInfo\n') + CASE ERR_LIB; WriteF('Error: Failed to open utility library\n') + CASE ERR_OBJ; WriteF('Error: Failed to make new Object\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + ENDSELECT +ENDPROC + +PROC makeGadgetsAndRKMModel() HANDLE + rightimage:=NewObjectA(NIL, 'sysiclass', + [SYSIA_WHICH, RIGHTIMAGE, + SYSIA_DRAWINFO, mydrawinfo, NIL]) + leftimage:=NewObjectA(NIL, 'sysiclass', + [SYSIA_WHICH, LEFTIMAGE, + SYSIA_DRAWINFO, mydrawinfo, NIL]) + rkmmodel:=NewObjectA(rkmmodcl, NIL, + [RKMMOD_CURRVAL, INITIALVAL, + RKMMOD_LIMIT, TOTAL-VISIBLE, NIL]) + prop:=NewObjectA(NIL, 'propgclass', + [GA_ID, PROPID, + GA_TOP, w.bordertop+5, + GA_LEFT, w.borderleft+5, + GA_WIDTH, PROPWIDTH, + GA_HEIGHT, PROPHEIGHT, + ICA_MAP, [PGA_TOP, RKMMOD_CURRVAL, + STRINGA_LONGVAL, RKMMOD_CURRVAL, + NIL], + ICA_TARGET, rkmmodel, + PGA_FREEDOM, FREEHORIZ, + PGA_TOTAL, TOTAL, + PGA_TOP, INITIALVAL, + PGA_VISIBLE, VISIBLE, + PGA_NEWLOOK, TRUE, + NIL]) + integer:=NewObjectA(NIL, 'strgclass', + [GA_ID, INTEGERID, + GA_TOP, w.bordertop+5, + GA_LEFT, prop.leftedge+prop.width+48, + GA_WIDTH, INTWIDTH, + GA_HEIGHT, INTHEIGHT, + ICA_MAP, [PGA_TOP, RKMMOD_CURRVAL, + STRINGA_LONGVAL, RKMMOD_CURRVAL, + NIL], + ICA_TARGET, rkmmodel, + GA_PREVIOUS, prop, + STRINGA_LONGVAL, INITIALVAL, + STRINGA_MAXCHARS, MAXCHARS, + NIL]) + leftbut:=NewObjectA(NIL, 'buttongclass', + [GA_ID, LEFTID, + GA_IMAGE, leftimage, + GA_TOP, w.bordertop+5, + GA_LEFT, prop.leftedge+prop.width, + ICA_MAP, [GA_ID, RKMMOD_DOWN, NIL], + ICA_TARGET, rkmmodel, + GA_PREVIOUS, integer, + NIL]) + rightbut:=NewObjectA(NIL, 'buttongclass', + [GA_ID, RIGHTID, + GA_IMAGE, rightimage, + GA_TOP, w.bordertop+5, + GA_LEFT, prop.leftedge+prop.width+leftbut.width, + ICA_MAP, [GA_ID, RKMMOD_UP, NIL], + ICA_TARGET, rkmmodel, + GA_PREVIOUS, leftbut, + NIL]) + currval2prop:=NewObjectA(NIL, 'icclass', + [ICA_MAP, [RKMMOD_CURRVAL, PGA_TOP, NIL], + ICA_TARGET, prop, + NIL]) + currval2int:=NewObjectA(NIL, 'icclass', + [ICA_MAP, [RKMMOD_CURRVAL, STRINGA_LONGVAL, NIL], + ICA_TARGET, integer, + NIL]) + RETURN TRUE +EXCEPT + ReThrow() -> E-Note: pass on exception if it is an error +ENDPROC + +vers: CHAR 0, '$VER: UseRKMModel 37.1', 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Gadgets/simplegad.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Gadgets/simplegad.e new file mode 100644 index 0000000..288546c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Gadgets/simplegad.e @@ -0,0 +1,70 @@ +-> simplegad.e - show the use of a button gadget. + +MODULE 'graphics/rastport', -> RastPort and other structures + 'intuition/intuition' -> Intuition data structures and tags + +CONST BUTTON_GAD_NUM=3, MYBUTTONGADWIDTH=100, MYBUTTONGADHEIGHT=50 + +-> NOTE that the use of constant size and positioning values are not +-> recommended; it just makes it easy to show what is going on. The position +-> of the gadget should be dynamically adjusted depending on the height of the +-> font in the title bar of the window. + +ENUM ERR_NONE, ERR_WIN, ERR_KICK + +RAISE ERR_WIN IF OpenWindowTagList()=NIL + +-> Routine to show the use of a button (boolean) gadget. +PROC main() HANDLE + DEF win=NIL:PTR TO window, class, gad:PTR TO gadget + -> Make sure to get version 37, for OpenWindowTags() */ + IF KickVersion(37)=FALSE THEN Raise(ERR_KICK) + + -> E-Note: E automatically opens the Intuition library + -> E-Note: automatically error-checked (automatic exception) + win:=OpenWindowTagList(NIL, + [WA_WIDTH, 400, + WA_HEIGHT, 100, + WA_GADGETS, -> E-Note: use typed lists for gadget + [NIL, 20, 20, MYBUTTONGADWIDTH, MYBUTTONGADHEIGHT, + GFLG_GADGHCOMP, GACT_RELVERIFY OR GACT_IMMEDIATE, + GTYP_BOOLGADGET, + [-1, -1, 1, 0, RP_JAM1, 5, -> E-Note: Border + [0, 0, -> E-Note: 5 co-ords (INTs) + MYBUTTONGADWIDTH+1, 0, + MYBUTTONGADWIDTH+1, MYBUTTONGADHEIGHT+1, + 0, MYBUTTONGADHEIGHT+1, + 0,0]:INT, + NIL]:border, + NIL, NIL, 0, NIL, BUTTON_GAD_NUM, NIL]:gadget, + WA_ACTIVATE, TRUE, + WA_CLOSEGADGET, TRUE, + WA_IDCMP, IDCMP_GADGETDOWN OR IDCMP_GADGETUP OR + IDCMP_CLOSEWINDOW, + NIL]) + REPEAT + class:=WaitIMessage(win) + -> SELECT on the type of the event + SELECT class + CASE IDCMP_GADGETUP + -> Caused by GACT_RELVERIFY + gad:=MsgIaddr() + WriteF('Received an IDCMP_GADGETUP , gadget number \d\n', gad.gadgetid) + CASE IDCMP_GADGETDOWN + -> Caused by GACT_IMMEDIATE + gad:=MsgIaddr() + WriteF('Received an IDCMP_GADGETDOWN , gadget number \d\n', gad.gadgetid) + ENDSELECT + UNTIL class=IDCMP_CLOSEWINDOW + WriteF('Received an IDCMP_CLOSEWINDOW\n') + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF win THEN CloseWindow(win) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + CASE ERR_KICK; WriteF('Error: Needs Kickstart V37+\n') + CASE "MEM"; WriteF('Error: Ran out of memory\n') + ENDSELECT +ENDPROC \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Gadgets/strhooks.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Gadgets/strhooks.e new file mode 100644 index 0000000..58077a2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Gadgets/strhooks.e @@ -0,0 +1,188 @@ +-> strhooks.e - string gadget hooks demo +-> E-Note: this uses several of the 'tools' modules, notably 'installhook' + +MODULE 'utility', + 'graphics/rastport', + 'intuition/intuition', + 'intuition/screens', + 'intuition/sghooks', + 'utility/hooks', + 'tools/ctype', + 'tools/installhook' + +ENUM ERR_NONE, ERR_DRAW, ERR_KICK, ERR_LIB, ERR_PUB, ERR_WIN + +RAISE ERR_DRAW IF GetScreenDrawInfo()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_PUB IF LockPubScreen()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST SG_STRLEN=44, MYSTRGADWIDTH=200 + +-> We'll dynamically allocate/clear most structures, buffers +OBJECT vars + sgg_Window:PTR TO window + sgg_Gadget:gadget + sgg_StrInfo:stringinfo + sgg_Extend:stringextend + sgg_Hook:hook + sgg_Buff[SG_STRLEN]:ARRAY + sgg_WBuff[SG_STRLEN]:ARRAY + sgg_UBuff[SG_STRLEN]:ARRAY +ENDOBJECT + +-> Open all required libraries, set-up the string gadget. +-> Prepare the hook, open the sgg_Window and go... +PROC main() HANDLE + -> E-Note: subtle name changes needed... + DEF vars=NIL:PTR TO vars, screen=NIL:PTR TO screen, + drawinfo=NIL:PTR TO drawinfo + + IF KickVersion(37)=FALSE THEN Raise(ERR_KICK) + + utilitybase:=OpenLibrary('utility.library', 37) + + -> Get the correct pens for the screen + screen:=LockPubScreen(NIL) + + drawinfo:=GetScreenDrawInfo(screen) + + NEW vars -> E-Note: raises an exception if it fails + vars.sgg_Extend.pens[0]:=drawinfo.pens[FILLTEXTPEN] + vars.sgg_Extend.pens[1]:=drawinfo.pens[FILLPEN] + vars.sgg_Extend.activepens[0]:=drawinfo.pens[FILLTEXTPEN] + vars.sgg_Extend.activepens[1]:=drawinfo.pens[FILLPEN] + vars.sgg_Extend.edithook:=vars.sgg_Hook + vars.sgg_Extend.workbuffer:=vars.sgg_WBuff + + vars.sgg_StrInfo.buffer:=vars.sgg_Buff + vars.sgg_StrInfo.undobuffer:=vars.sgg_UBuff + vars.sgg_StrInfo.maxchars:=SG_STRLEN + vars.sgg_StrInfo.extension:=vars.sgg_Extend + + -> There should probably be a border around the string gadget. + -> As is, it is hard to locate when disabled. + vars.sgg_Gadget.leftedge:=20 + vars.sgg_Gadget.topedge:=30 + vars.sgg_Gadget.width:=MYSTRGADWIDTH + vars.sgg_Gadget.height:=screen.rastport.txheight + vars.sgg_Gadget.flags:=GFLG_GADGHCOMP OR GFLG_STRINGEXTEND + vars.sgg_Gadget.activation:=GACT_RELVERIFY + vars.sgg_Gadget.gadgettype:=GTYP_STRGADGET + vars.sgg_Gadget.specialinfo:=vars.sgg_StrInfo + -> E-Note: use typed lists for border and its data + -> E-Note: because we're using E we don't need stupid INIT_LATER + vars.sgg_Gadget.gadgetrender:=[-2,-2,1,0,RP_JAM1,5, + [0, 0, + MYSTRGADWIDTH+3, 0, + MYSTRGADWIDTH+3, screen.rastport.txheight+3, + 0, screen.rastport.txheight+3, + 0, 0]:INT, + NIL]:border + + -> E-Note: use Wouter's installhook + installhook(vars.sgg_Hook, {str_hookRoutine}) + + vars.sgg_Window:=OpenWindowTagList(NIL, + [WA_PUBSCREEN, screen, + WA_LEFT, 21, WA_TOP, 20, + WA_WIDTH, 500, WA_HEIGHT, 150, + WA_MINWIDTH, 50, WA_MAXWIDTH, -1, + WA_MINHEIGHT, 30, WA_MAXHEIGHT, -1, + WA_SIMPLEREFRESH, TRUE, + WA_NOCAREREFRESH, TRUE, + WA_RMBTRAP, TRUE, + WA_IDCMP, IDCMP_GADGETUP OR IDCMP_CLOSEWINDOW, + WA_FLAGS, WFLG_CLOSEGADGET OR WFLG_NOCAREREFRESH OR + WFLG_DRAGBAR OR WFLG_DEPTHGADGET OR + WFLG_SIMPLE_REFRESH, + WA_TITLE, 'String Hook Accepts HEX Digits Only', + WA_GADGETS, vars.sgg_Gadget, + NIL]) + handleWindow(vars) + -> E-Note: exit and clean up via handler +EXCEPT DO + IF (vars<>NIL) AND vars.sgg_Window THEN CloseWindow(vars.sgg_Window) + -> E-Note: vars automatically freed + IF drawinfo THEN FreeScreenDrawInfo(screen, drawinfo) + IF screen THEN UnlockPubScreen(NIL, screen) + IF utilitybase THEN CloseLibrary(utilitybase) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_DRAW; WriteF('Error: Failed to get drawinfo from screen\n') + CASE ERR_KICK; WriteF('Error: Needs Kickstart V37+\n') + CASE ERR_LIB; WriteF('Error: Failed to open utility.library\n') + CASE ERR_PUB; WriteF('Error: Failed to lock public screen\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + CASE "MEM"; WriteF('Error: Ran out of memory\n') + ENDSELECT +ENDPROC + +-> This is an example string editing hook, which shows the basics of creating +-> a string editing function. This hook restricts entry to hexadecimal digits +-> (0-9, A-F, a-f) and converts them to upper case. To demonstrate processing +-> of mouse-clicks, this hook also detects clicking on a character, and +-> converts it to a zero. +-> +-> NOTE String editing hooks are called on Intuition's task context, so the +-> hook may not use DOS and may not cause Wait() to be called. +PROC str_hookRoutine(hook, sgw:PTR TO sgwork, msg:PTR TO LONG) + DEF work_ptr, return_code + + -> Hook must return non-zero if command is supported. + -> This will be changed to zero if the command is unsupported. + return_code:=-1 + + IF msg[]=SGH_KEY + -> Key hit -- could be any key (Shift, repeat, character, etc.) + + -> Allow only upper case characters to be entered. + -> Act only on modes that add or update characters in the buffer. + IF (sgw.editop=EO_REPLACECHAR) OR (sgw.editop=EO_INSERTCHAR) + -> Code contains the ASCII representation of the character entered, if + -> it maps to a single byte. We could also look into the work buffer to + -> find the new character. + -> + -> sgw.code = sgw.workbuffer[sgw.bufferpos-1] + -> + -> If the character is not a legal hex digit, don't use the work buffer + -> and beep the screen. + -> E-Note: use isxdigit from 'tools/ctype' + IF isxdigit(sgw.code)=FALSE + sgw.actions:=sgw.actions OR SGA_BEEP + sgw.actions:=sgw.actions AND Not(SGA_USE) + ELSE + -> And make it upper-case, for nicety + work_ptr:=sgw.workbuffer + work_ptr[sgw.bufferpos-1]:=toupper(sgw.code) + ENDIF + ENDIF + ELSEIF msg[]=SGH_CLICK + -> Mouse click + -> Zero the digit clicked on + IF sgw.bufferpos < sgw.numchars + work_ptr:=sgw.workbuffer+sgw.bufferpos + work_ptr[]:="0" + ENDIF + ELSE + -> UNKNOWN COMMAND + -> Hook should return zero if the command is not supported + return_code:=0 + ENDIF +ENDPROC return_code + +-> E-Note: we don't need the hookEntry stuff, installhook does it all + +-> Process messages received by the sgg_Window. Quit when the close gadget +-> is selected. +-> E-Note: E version is simpler, since we use WaitIMessage +PROC handleWindow(vars:PTR TO vars) + DEF class + REPEAT + class:=WaitIMessage(vars.sgg_Window) + -> If a code is set in the hook after an SGH_KEY command, where SGA_END is + -> set on return from the hook, the code will be returned in the Code field + -> of the IDCMP_GADGETUP message. + -> E-Note: ...so use MsgCode() to get at it + UNTIL class=IDCMP_CLOSEWINDOW +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Gadgets/updatestrgad.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Gadgets/updatestrgad.e new file mode 100644 index 0000000..1aa2fd2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Gadgets/updatestrgad.e @@ -0,0 +1,119 @@ +-> updatestrgad.e - Show the use of a string gadget. Shows both the use of +-> ActivateGadget() and how to properly modify the contents of a string gadget. + +MODULE 'graphics/rastport', + 'intuition/intuition' + +ENUM ERR_NONE, ERR_KICK, ERR_WIN + +RAISE ERR_WIN IF OpenWindowTagList()=NIL + +-> NOTE that the use of constant size and positioning values are not +-> recommended; it just makes it easy to show what is going on. The position +-> of the gadget should be dynamically adjusted depending on the height of the +-> font in the title bar of the window. This example adapts the gadget height +-> to the screen font. Alternatively, you could specify your font under V37 +-> with the StringExtend structure. +CONST BUFSIZE=100, MYSTRGADWIDTH=200, MYSTRGADHEIGHT=8 + +DEF strBuffer[BUFSIZE]:STRING, strUndoBuffer[BUFSIZE]:STRING, + strGad:PTR TO gadget, ansnum=0, answers:PTR TO LONG + +-> Show the use of a string gadget. +PROC main() HANDLE + DEF win=NIL:PTR TO window + -> Make sure to get version 37, for OpenWindowTags() + IF KickVersion(37)=FALSE THEN Raise(ERR_KICK) + -> Load a value into the string gadget buffer. + -> This will be displayed when the gadget is first created. + StrCopy(strBuffer, 'START') + + -> E-Note: set-up the two globals... + answers:=['Try Again','Sorry','Perhaps','A Winner'] + strGad:=[NIL, 20, 20, MYSTRGADWIDTH, MYSTRGADHEIGHT, + GFLG_GADGHCOMP, GACT_RELVERIFY OR GACT_STRINGCENTER, + GTYP_STRGADGET, + [-2, -2, 1, 0, RP_JAM1, 5, + [0, 0, + MYSTRGADWIDTH + 3, 0, + MYSTRGADWIDTH + 3, MYSTRGADHEIGHT + 3, + 0, MYSTRGADHEIGHT + 3, + 0, 0]:INT, + NIL]:border, + NIL, NIL, 0, + -> E-Note: use NEW so remaining fields are allocated (and set to 0) + NEW [strBuffer, strUndoBuffer, 0, BUFSIZE]:stringinfo, + 0, NIL]:gadget + + win:=OpenWindowTagList(NIL, + [WA_WIDTH, 400, + WA_HEIGHT, 100, + WA_TITLE, 'Activate Window, Enter Text', + WA_GADGETS, strGad, + WA_CLOSEGADGET, TRUE, + WA_IDCMP, IDCMP_ACTIVEWINDOW OR + IDCMP_CLOSEWINDOW OR IDCMP_GADGETUP, + NIL]) + + handleWindow(win, strGad) + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF win THEN CloseWindow(win) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_KICK; WriteF('Error: Needs Kickstart V37+\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + CASE "MEM"; WriteF('Error: Ran out of memory\n') + ENDSELECT +ENDPROC + +-> Process messages received by the window. Quit when the close gadget +-> is selected, activate the gadget when the window becomes active. +-> E-Note: E version is simpler, since we use WaitIMessage +PROC handleWindow(win, gad) + DEF class + REPEAT + class:=WaitIMessage(win) + SELECT class + CASE IDCMP_ACTIVEWINDOW + -> Activate the string gadget. This is how to activate a string gadget + -> in a new window--wait for the window to become active by waiting for + -> the IDCMP_ACTIVEWINDOW event, then activate the gadget. Here we + -> report on the success or failure. + IF ActivateGadget(gad, win, NIL) + updateStrGad(win, gad, 'Activated') + ENDIF + CASE IDCMP_GADGETUP + -> If it's a gadget message, IAddress points to Gadget. If user hit + -> RETURN in our string gadget for demonstration, we will change what he + -> entered. We only have 1 gadget, so we don't have to check which one. + updateStrGad(win, strGad, answers[ansnum]) + INC ansnum -> Point to next answer + -> E-Note: we know the lengths of lists, so no need for ANSCNT + IF ansnum>=ListLen(answers) THEN ansnum:=0 + ENDSELECT + UNTIL class=IDCMP_CLOSEWINDOW +ENDPROC + +-> Routine to update the value in the string gadget's buffer, then activate +-> the gadget. +PROC updateStrGad(win, gad:PTR TO gadget, newstr) + -> First, remove the gadget from the window. This must be done before + -> modifying any part of the gadget!!! + RemoveGList(win, gad, 1) + + -> For fun, change the value in the buffer, as well as the cursor and initial + -> display position. + StrCopy(gad.specialinfo::stringinfo.buffer, newstr) + gad.specialinfo::stringinfo.bufferpos:=0 + gad.specialinfo::stringinfo.disppos:=0 + + -> Add the gadget back, placing it at the end of the list (-1) and refresh + -> its imagery. + AddGList(win, gad, -1, 1, NIL) + RefreshGList(gad, win, NIL, 1) + + -> Activate the string gadget + ActivateGadget(gad, win, NIL) +ENDPROC \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/IO_Methods/closewindowsafely.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/IO_Methods/closewindowsafely.e new file mode 100644 index 0000000..2d68834 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/IO_Methods/closewindowsafely.e @@ -0,0 +1,58 @@ +-> closeWindowSafely +-> +-> These functions close an Intuition window that shares a port with other +-> Intuition windows. +-> +-> We are careful to set the UserPort to NIL before closing, and to free any +-> messages that it might have been sent. + +OPT MODULE -> E-Note: create a module for re-use + +MODULE 'exec/lists', + 'exec/nodes', + 'exec/ports', + 'intuition/intuition' + +-> Function to remove and reply all IntuiMessages on a port that have been +-> sent to a particular window (note that we don't rely on the succ pointer +-> of a message after we have replied it) +PROC stripIntuiMessages(mp:PTR TO mp, win) + DEF msg:PTR TO intuimessage, succ + msg:=mp.msglist.head + WHILE succ:=msg.execmessage.ln.succ + IF msg.idcmpwindow=win + -> Intuition is about to free this message. + -> Make sure that we have politely sent it back. + Remove(msg) + ReplyMsg(msg) + ENDIF + msg:=succ + ENDWHILE +ENDPROC + +-> Entry point to closeWindowSafely(). +-> Strip all IntuiMessages from an IDCMP which are waiting for a specific +-> window. When the messages are gone, set the UserPort of the window to NIL +-> and call ModifyIDCMP(win,0). This will free the Intuition parts of the IDCMP +-> and turn off messages to this port without changing the original UserPort +-> (which may be in use by other windows). +-> E-Note: this is the function we want to export from the module +EXPORT PROC closeWindowSafely(win:PTR TO window) + -> We forbid here to keep out of race conditions with Intuition + Forbid() + + -> Send back any messages for this window that have not yet been processed + stripIntuiMessages(win.userport, win) + + -> Clear UserPort so Intuition will not free it + win.userport:=NIL + + -> Tell Intuition to stop sending more messages + ModifyIDCMP(win, 0) + + -> Turn multitasking back on + Permit() + + -> Now it's safe to really close the window + CloseWindow(win) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/IO_Methods/closewindowsafely.m b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/IO_Methods/closewindowsafely.m new file mode 100644 index 0000000..a3d3155 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/IO_Methods/closewindowsafely.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/IO_Methods/eventloop.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/IO_Methods/eventloop.e new file mode 100644 index 0000000..712093a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/IO_Methods/eventloop.e @@ -0,0 +1,130 @@ +-> eventloop.e - standard technique to handle IntuiMessages from an IDCMP. + +MODULE 'exec/ports', + 'intuition/intuition' + +ENUM ERR_NONE, ERR_WIN + +RAISE ERR_WIN IF OpenWindowTagList()=NIL + +PROC main() HANDLE + DEF signals, done, win=NIL:PTR TO window + win:=OpenWindowTagList(NIL, + [WA_TITLE, 'Press Keys and Mouse in this Window', + WA_WIDTH, 500, + WA_HEIGHT, 50, + WA_ACTIVATE, TRUE, + WA_CLOSEGADGET, TRUE, + WA_RMBTRAP, TRUE, + WA_IDCMP, IDCMP_CLOSEWINDOW OR IDCMP_VANILLAKEY OR + IDCMP_RAWKEY OR IDCMP_DISKINSERTED OR + IDCMP_DISKREMOVED OR IDCMP_MOUSEBUTTONS, + NIL]) + + -> Perform this loop until the message handling routine signals that we + -> are done. + -> + -> When the Wait() returns, check which signal hit and process the correct + -> port. There is only one port here, so the test could be eliminated. If + -> multiple ports were being watched, the test would become: + -> + -> signals:=Wait(Shl(1, win1.userport.sigbit) OR + -> Shl(1, win2.userport.sigbit) OR + -> Shl(1, win3.userport.sigbit)) + -> IF signals AND Shl(1, win1.userport.sigbit) + -> done:=handleWin1IDCMP(win1, done) + -> ELSEIF signals AND Shl(1, win2.userport.sigbit) + -> done:=handleWin2IDCMP(win2, done) + -> ELSEIF signals AND Shl(1, win3.userport.sigbit) + -> done:=handleWin3IDCMP(win3, done) + -> ENDIF + -> + -> Note that these could all call the same routine with different window + -> pointers (if the handling was identical). + -> + -> handleIDCMP() should remove all of the messages from the port. + -> E-Note: since this example should be generalisable to more than one + -> window, WaitIMessage is not used (for a change!) + done:=FALSE + REPEAT + signals:=Wait(Shl(1, win.userport.sigbit)) + IF signals AND Shl(1, win.userport.sigbit) + done:=handleIDCMP(win, done) + ENDIF + UNTIL done + +EXCEPT DO + IF win THEN CloseWindow(win) + SELECT exception + CASE ERR_WIN; WriteF('Error: Failed to open window.\n') + ENDSELECT +ENDPROC + +-> handleIDCMP() - Handle all of the messages from an IDCMP. +PROC handleIDCMP(win:PTR TO window, done) + DEF message:PTR TO intuimessage, code, mousex, mousey, class + + -> Remove all of the messages from the port by calling GetMsg() until + -> it returns NULL. + -> + -> The code should be able to handle three cases: + -> + -> 1. No messages waiting at the port, and the first call to GetMsg() + -> returns NULL. In this case the code should do nothing. + -> + -> 2. A single message waiting. The code should remove the message, + -> processes it, and finish. + -> + -> 3. Multiple messages waiting. The code should process each waiting + -> message, and finish. + WHILE message:=GetMsg(win.userport) + -> It is often convenient to copy the data out of the message. In many + -> cases, this lets the application reply to the message quickly. Copying + -> the data is not required, if the code does not reply to the message + -> until the end of the loop, then it may directly reference the message + -> information anywhere before the reply. + class:=message.class + code:=message.code + mousex:=message.mousex + mousey:=message.mousey + + -> The loop should reply as soon as possible. Note that the code may not + -> reference data in the message after replying to the message. Thus, the + -> application should not reply to the message until it is done referencing + -> information in it. + -> + -> Be sure to reply to every message received with GetMsg(). + ReplyMsg(message) + + -> The class contains the IDCMP type of the message. + SELECT class + CASE IDCMP_CLOSEWINDOW + done:=TRUE + CASE IDCMP_VANILLAKEY + WriteF('IDCMP_VANILLAKEY (\c)\n', code) + CASE IDCMP_RAWKEY + WriteF('IDCMP_RAWKEY\n') + CASE IDCMP_DISKINSERTED + WriteF('IDCMP_DISKINSERTED\n') + CASE IDCMP_DISKREMOVED + WriteF('IDCMP_DISKREMOVED\n') + CASE IDCMP_MOUSEBUTTONS + -> The code often contains useful data, such as the ASCII value (for + -> IDCMP_VANILLAKEY), or the type of button event here. + SELECT code + CASE SELECTUP + WriteF('SELECTUP at \d,\d\n', mousex, mousey) + CASE SELECTDOWN + WriteF('SELECTDOWN at \d,\d\n', mousex, mousey) + CASE MENUUP + WriteF('MENUUP\n') + CASE MENUDOWN + WriteF('MENUDOWN\n') + DEFAULT + WriteF('UNKNOWN CODE\n') + ENDSELECT + DEFAULT + WriteF('Unknown IDCMP message\n') + ENDSELECT + ENDWHILE +ENDPROC done diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/compleximage.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/compleximage.e new file mode 100644 index 0000000..2427de5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/compleximage.e @@ -0,0 +1,83 @@ +-> compleximage.e - Program to show the use of a complex Intuition Image. + +OPT OSVERSION=37 -> E-Note: silently require V37 + +MODULE 'exec/memory', + 'intuition/intuition', + 'intuition/screens' + +ENUM ERR_NONE, ERR_SCRN, ERR_WIN + +RAISE ERR_SCRN IF OpenScreenTagList()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST MYIMAGE_LEFT=0, MYIMAGE_TOP=0, + MYIMAGE_WIDTH=24, MYIMAGE_HEIGHT=10, + MYIMAGE_DEPTH=2 + +-> E-Note: get some Chip memory and copy list (quick, since LONG aligned) +PROC copyListToChip(data) + DEF size, mem + size:=ListLen(data)*SIZEOF LONG + mem:=NewM(size, MEMF_CHIP) + CopyMemQuick(data, mem, size) +ENDPROC mem + +-> Main routine. Open required window and draw the images. This routine opens +-> a very simple window with no IDCMP. See the chapters on "Windows" and +-> "Input and Output Methods" for more info. Free all resources when done. +PROC main() HANDLE + DEF scr=NIL, win=NIL:PTR TO window, myImage:image + scr:=OpenScreenTagList(NIL, [SA_DEPTH, 4, SA_PENS, [-1]:INT, NIL]) + win:=OpenWindowTagList(NIL, [WA_RMBTRAP, TRUE, WA_CUSTOMSCREEN, scr, NIL]) + + -> This contains the image data. It is a two bit-plane open rectangle which + -> is 24 pixels wide and 10 high. Make sure it's in CHIP memory by allocating + -> a block of chip memory with a call like this: NewM(data_size,MEMF_CHIP), + -> and then copy the data to that block. + myImage:=[MYIMAGE_LEFT, MYIMAGE_TOP, MYIMAGE_WIDTH, + MYIMAGE_HEIGHT, MYIMAGE_DEPTH, + copyListToChip([ -> First bit-plane of data, open rectangle + $FFFFFF00, $C0000300, $C0000300, $C0000300, + $C0000300, $C0000300, $C0000300, $C0000300, + $C0000300, $FFFFFF00, + -> Second bit-plane of data, filled rectangle + $00000000, $00000000, $00000000, $00FF0000, + $00FF0000, $00FF0000, $00FF0000, $00000000, + $00000000, $00000000]), + 3, 0, NIL]:image -> Use first two bit-planes, clear unused planes + + -> Draw the 1 bit-plane image into the first two bit-planes + DrawImage(win.rport, myImage, 10, 10) + + -> Draw the same image at a new location + DrawImage(win.rport, myImage, 100, 10) + + -> Change the image to use the second and fourth bitplanes, PlanePick is 1010 + -> binary or $0A, and draw it again at a different location + myImage.planepick:=$0A + DrawImage(win.rport, myImage, 10, 50) + + -> Now set all the bits in the first bitplane with PlaneOnOff. This will + -> make all the bits set in the second bitplane appear as color 3 (0011 + -> binary), all the bits set in the fourth bitplane appear as color 9 (1001 + -> binary) and all other pixels will be color 1 (0001 binary. If there were + -> any points in the image where both bits were set, they would appear as + -> color 11 (1011 binary). Draw the image at a different location. + myImage.planeonoff:=$01 + DrawImage(win.rport, myImage, 100, 50) + + -> Wait a bit, then quit. + -> In a real application, this would be an event loop, like the one described + -> in the Intuition Input and Output Methods chapter. + Delay(200) + +EXCEPT DO + IF win THEN CloseWindow(win) + IF scr THEN CloseScreen(scr) + SELECT exception + CASE ERR_SCRN; WriteF('Error: Failed to open custom screen.\n') + CASE ERR_WIN; WriteF('Error: Failed to open window.\n') + CASE "MEM"; WriteF('Error: Ran out of (chip) memory.\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/intuitext.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/intuitext.e new file mode 100644 index 0000000..22d87cb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/intuitext.e @@ -0,0 +1,64 @@ +-> intuitext.e - Program to show the use of an Intuition IntuiText object. + +OPT OSVERSION=37 -> E-Note: silently require V37 + +MODULE 'exec/ports', + 'exec/nodes', + 'graphics/rastport', + 'graphics/text', + 'intuition/intuition', + 'intuition/screens' + +ENUM ERR_NONE, ERR_DRAW, ERR_PUB, ERR_WIN + +RAISE ERR_DRAW IF GetScreenDrawInfo()=NIL, + ERR_PUB IF LockPubScreen()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST MYTEXT_LEFT=0, MYTEXT_TOP=0 + +-> Main routine. Open required window and draw the images. This routine opens +-> a very simple window with no IDCMP. See the chapters on "Windows" and +-> "Input and Output Methods" for more info. Free all resources when done. +PROC main() HANDLE + DEF screen=NIL, drawinfo=NIL:PTR TO drawinfo, win=NIL:PTR TO window, + myTEXTPEN, myBACKGROUNDPEN + + screen:=LockPubScreen(NIL) + + drawinfo:=GetScreenDrawInfo(screen) + + -> Get a copy of the correct pens for the screen. This is very important in + -> case the user or the application has the pens set in a unusual way. + myTEXTPEN:=drawinfo.pens[TEXTPEN] + myBACKGROUNDPEN:=drawinfo.pens[BACKGROUNDPEN] + + -> Open a simple window on the workbench screen for displaying a text string. + -> An application would probably never use such a window, but it is useful + -> for demonstrating graphics... + win:=OpenWindowTagList(NIL, [WA_PUBSCREEN, screen, WA_RMBTRAP, TRUE, NIL]) + + + -> Draw the text string at 10, 10 + PrintIText(win.rport, + [myTEXTPEN, myBACKGROUNDPEN, RP_JAM2, MYTEXT_LEFT, MYTEXT_TOP, + [drawinfo.font.mn.ln.name, drawinfo.font.ysize, + drawinfo.font.style, drawinfo.font.flags]:textattr, + 'Hello, World. ;-)', NIL]:intuitext, + 10, 10) + + -> Wait a bit, then quit. + -> In a real application, this would be an event loop, like the one described + -> in the Intuition Input and Output Methods chapter. + Delay(200) + +EXCEPT DO + IF win THEN CloseWindow(win) + IF drawinfo THEN FreeScreenDrawInfo(screen, drawinfo) + IF screen THEN UnlockPubScreen(NIL, screen) + SELECT exception + CASE ERR_DRAW; WriteF('Error: Failed to get DrawInfo for screen\n') + CASE ERR_PUB; WriteF('Error: Failed to lock public screen\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/shadowborder.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/shadowborder.e new file mode 100644 index 0000000..051f559 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/shadowborder.e @@ -0,0 +1,66 @@ +-> shadowborder.e - Program to show the use of an Intuition Border. + +OPT OSVERSION=37 -> E-Note: silently require V37 + +MODULE 'graphics/rastport', + 'intuition/intuition', + 'intuition/screens' + +ENUM ERR_NONE, ERR_DRAW, ERR_PUB, ERR_WIN + +RAISE ERR_DRAW IF GetScreenDrawInfo()=NIL, + ERR_PUB IF LockPubScreen()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST MYBORDER_LEFT=0, MYBORDER_TOP=0 + +-> Main routine. Open required window and draw the images. This routine opens +-> a very simple window with no IDCMP. See the chapters on "Windows" and +-> "Input and Output Methods" for more info. Free all resources when done. +PROC main() HANDLE + DEF screen=NIL, win=NIL:PTR TO window, drawinfo=NIL:PTR TO drawinfo, + shineBorder, shadowBorder, mySHADOWPEN=1, mySHINEPEN=2 + + -> E-Note: C version doesn't think these should cause fatal errors... + screen:=LockPubScreen(NIL) + drawinfo:=GetScreenDrawInfo(screen) + + -> Get a copy of the correct pens for the screen. This is very important in + -> case the user or the application has the pens set in a unusual way. + mySHADOWPEN:=drawinfo.pens[SHADOWPEN] + mySHINEPEN:=drawinfo.pens[SHINEPEN] + + -> Open a simple window on the workbench screen for displaying a border. An + -> application would probably never use such a window, but it is useful for + -> demonstrating graphics... + -> E-Note: C version uses "screen" after unlocking it! + win:=OpenWindowTagList(NIL, [WA_PUBSCREEN, screen, WA_RMBTRAP, TRUE, NIL]) + + shineBorder:=[MYBORDER_LEFT, MYBORDER_TOP, mySHINEPEN, 0, + RP_JAM1, 5, [0,0, 50,0, 50,30, 0,30, 0,0]:INT, + NIL]:border + shadowBorder:=[MYBORDER_LEFT+1, MYBORDER_TOP+1, mySHADOWPEN, 0, + RP_JAM1, 5, [0,0, 50,0, 50,30, 0,30, 0,0]:INT, + shineBorder]:border + + -> Draw the border at 10, 10 + DrawBorder(win.rport, shadowBorder, 10, 10) + + -> Draw the border again at 100, 10 + DrawBorder(win.rport, shadowBorder, 100, 10) + + -> Wait a bit, then quit. + -> In a real application, this would be an event loop, like the one described + -> in the Intuition Input and Output Methods chapter. + Delay(200) + +EXCEPT DO + IF win THEN CloseWindow(win) + IF drawinfo THEN FreeScreenDrawInfo(screen, drawinfo) + IF screen THEN UnlockPubScreen(NIL, screen) + SELECT exception + CASE ERR_DRAW; WriteF('Error: Failed to get DrawInfo for screen\n') + CASE ERR_PUB; WriteF('Error: Failed to lock public screen\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + ENDSELECT +ENDPROC \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/simpleimage.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/simpleimage.e new file mode 100644 index 0000000..2703d1b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Images_Text/simpleimage.e @@ -0,0 +1,62 @@ +-> simpleimage.e - Program to show the use of a simple Intuition Image. + +OPT OSVERSION=37 -> E-Note: silently require V37 + +MODULE 'exec/memory', + 'intuition/intuition' + +ENUM ERR_NONE, ERR_WIN + +RAISE ERR_WIN IF OpenWindowTagList()=NIL + +CONST MYIMAGE_LEFT=0, MYIMAGE_TOP=0, + MYIMAGE_WIDTH=24, MYIMAGE_HEIGHT=10, + MYIMAGE_DEPTH=1 + +-> E-Note: get some Chip memory and copy list (quick, since LONG aligned) +PROC copyListToChip(data) + DEF size, mem + size:=ListLen(data)*SIZEOF LONG + mem:=NewM(size, MEMF_CHIP) + CopyMemQuick(data, mem, size) +ENDPROC mem + +-> Main routine. Open required window and draw the images. This routine opens +-> a very simple window with no IDCMP. See the chapters on "Windows" and +-> "Input and Output Methods" for more info. Free all resources when done. +PROC main() HANDLE + DEF win=NIL:PTR TO window, myImage:image + win:=OpenWindowTagList(NIL, [WA_WIDTH, 200, + WA_HEIGHT, 100, + WA_RMBTRAP, TRUE, + NIL]) + + -> This contains the image data. It is a one bit-plane open rectangle which + -> is 24 pixels wide and 10 high. Make sure it's in CHIP memory by allocating + -> a block of chip memory with a call like this: NewM(data_size,MEMF_CHIP), + -> and then copy the data to that block. + myImage:=[MYIMAGE_LEFT, MYIMAGE_TOP, MYIMAGE_WIDTH, + MYIMAGE_HEIGHT, MYIMAGE_DEPTH, + copyListToChip([$FFFFFF00, $C0000300, $C0000300, $C0000300, + $C0000300, $C0000300, $C0000300, $C0000300, + $C0000300, $FFFFFF00]), + 1, 0, NIL]:image -> Use first bit-plane, clear unused planes + + -> Draw the 1 bit-plane image into the first bit-plane (colour 1) + DrawImage(win.rport, myImage, 10, 10) + + -> Draw the same image at a new location + DrawImage(win.rport, myImage, 100, 10) + + -> Wait a bit, then quit. + -> In a real application, this would be an event loop, like the one described + -> in the Intuition Input and Output Methods chapter. + Delay(200) + +EXCEPT DO + IF win THEN CloseWindow(win) + SELECT exception + CASE ERR_WIN; WriteF('Error: Failed to open window.\n') + CASE "MEM"; WriteF('Error: Ran out of (chip) memory.\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Intuition_GUI/easyintuition.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Intuition_GUI/easyintuition.e new file mode 100644 index 0000000..09a813f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Intuition_GUI/easyintuition.e @@ -0,0 +1,110 @@ +-> easyintuition.e Simple backward-compatible V37 Intuition example +-> +-> This example uses extended structures with the pre-V37 OpenScreen() and +-> OpenWindow() functions to compatibly open an Intuition display. Enhanced +-> V37 options specified via tags are ignored on 1.3 systems. + +-> E-Note: you need to be more specific about modules than C does about includes +MODULE 'intuition/intuition', -> Intuition and window data structures and tags + 'intuition/screens', -> Screen data structures and tags + 'graphics/view', -> Screen resolutions + 'dos/dos' -> Official return codes defined here + +-> Position and sizes for our window +CONST WIN_LEFTEDGE=20, WIN_TOPEDGE=20, + WIN_WIDTH=400, WIN_MINWIDTH=80, + WIN_HEIGHT=150, WIN_MINHEIGHT=20 + +-> Exception values +-> E-Note: exceptions are a much better way of handling errors +ENUM ERR_NONE, ERR_SCRN, ERR_WIN + +-> Automatically raise exceptions +-> E-Note: these take care of a lot of error cases +RAISE ERR_SCRN IF OpenS()=NIL, + ERR_WIN IF OpenW()=NIL + +PROC main() HANDLE + -> Declare variables here + -> E-Note: the signals stuff is handled directly by WaitIMessage + DEF screen1=NIL:PTR TO screen, window1=NIL:PTR TO window + + -> E-Note: E automatically opens the Intuition library + + -> Open the screen + -> E-Note: automatically error-checked (automatic exception) + -> E-Note: simplified using OpenS + screen1:=OpenS(640, -> Width (high-resolution) + STDSCREENHEIGHT, -> Height (non-interlace) + 2, -> Depth (4 colours will be available) + V_HIRES, -> The high-resolution display mode + 'Our Screen', -> The screen title + -> We can specify that we want the V37-compatible 3D look when running under + -> V37 by adding an SA_PENS tag. + [SA_PENS, [-1]:INT, -> Tags for additional V37 features + -> E-Note: these tags replace the missing OpenS parameters + SA_DETAILPEN, 0, + SA_BLOCKPEN, 1, + NIL]) + + -> E-Note: we attach the window to the open screen directly, below + + -> ... and open the window + -> E-Note: automatically error-checked (automatic exception) + window1:=OpenW(WIN_LEFTEDGE, + WIN_TOPEDGE, + WIN_WIDTH, + WIN_HEIGHT, + + -> This field specifies the events we want to get + IDCMP_CLOSEWINDOW, + + -> These flags specify system gadgets and other attributes + WFLG_CLOSEGADGET OR WFLG_SMART_REFRESH OR WFLG_ACTIVATE OR + WFLG_DRAGBAR OR WFLG_DEPTHGADGET OR WFLG_SIZEGADGET OR + WFLG_NOCAREREFRESH, + + 'EasyWindow', -> Window title + screen1, -> Attach to screen1... + CUSTOMSCREEN, -> ... a custom screen + NIL, -> Pointer to first gadget + -> Under V37, we'll get a special screen title when our window is active + -> Tags for additional V37 features + [WA_SCREENTITLE, 'Our Screen - EasyWindow is Active', + -> E-Note: these tags replace the missing OpenW parameters + WA_MINWIDTH, WIN_MINWIDTH, + WA_MINHEIGHT, WIN_MINHEIGHT, + WA_MAXWIDTH, -1, + WA_MAXHEIGHT, -1, + NIL]) + + -> Here's the main input event loop + -> E-Note: the signals and stuff is handled by WaitIMessage + REPEAT + UNTIL handleIDCMP(window1) + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF window1 THEN CloseW(window1) + IF screen1 THEN CloseS(screen1) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_SCRN; WriteF('Error: Failed to open custom screen\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + ENDSELECT +-> E-Note: select return code according to exception +ENDPROC IF exception THEN RETURN_WARN ELSE RETURN_OK + +PROC handleIDCMP(win:PTR TO window) + DEF class, done=FALSE + -> E-Note: WaitIMessage replaces a lot of C code concerned with signals + class:=WaitIMessage(win) + -> E-Note: other parts of the message are available via MsgXXX() functions + + -> See what events occurred + SELECT class + CASE IDCMP_CLOSEWINDOW + done:=TRUE + ENDSELECT +ENDPROC done + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Intuition_GUI/easyintuition37.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Intuition_GUI/easyintuition37.e new file mode 100644 index 0000000..cb3a665 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Intuition_GUI/easyintuition37.e @@ -0,0 +1,103 @@ +-> easyintuition37.e -- Simple Intuition program for V37 (Release 2) and later +-> versions of the operating system + +-> Use lowest non-obsolete version that supplies the functions needed +OPT OSVERSION=37 + +-> E-Note: you need to be more specific about modules than C does about includes +MODULE 'intuition/intuition', -> Intuition and window data structures and tags + 'intuition/screens', -> Screen data structures and tags + 'graphics/modeid', -> Release 2 Amiga display mode ID's + 'dos/dos' -> Official return codes defined here + +-> Position and sizes for our window +CONST WIN_LEFTEDGE=20, WIN_TOPEDGE=20, + WIN_WIDTH=400, WIN_MINWIDTH=80, + WIN_HEIGHT=150, WIN_MINHEIGHT=20 + +-> Exception values +-> E-Note: exceptions are a much better way of handling errors +ENUM ERR_NONE, ERR_SCRN, ERR_WIN + +-> Automatically raise exceptions +-> E-Note: these take care of a lot of error cases +RAISE ERR_SCRN IF OpenScreenTagList()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +PROC main() HANDLE + -> Declare variables here + -> E-Note: the signals stuff is handled directly by WaitIMessage + DEF screen1=NIL:PTR TO screen, window1=NIL:PTR TO window + + -> E-Note: E automatically opens the Intuition library + + -> Open the screen + -> E-Note: automatically error-checked (automatic exception) + -> E-Note: pens is just a INT-typed list + screen1:=OpenScreenTagList(NIL, + [SA_PENS, [-1]:INT, + SA_DISPLAYID, HIRES_KEY, + SA_DEPTH, 2, + SA_TITLE, 'Our Screen', + NIL]) + + -> ... and open the window + -> E-Note: automatically error-checked (automatic exception) + window1:=OpenWindowTagList(NIL, + -> Specify window dimensions and limits + [WA_LEFT, WIN_LEFTEDGE, + WA_TOP, WIN_TOPEDGE, + WA_WIDTH, WIN_WIDTH, + WA_HEIGHT, WIN_HEIGHT, + WA_MINWIDTH, WIN_MINWIDTH, + WA_MINHEIGHT, WIN_MINHEIGHT, + WA_MAXWIDTH, -1, + WA_MAXHEIGHT, -1, + -> Specify the system gadgets we want + WA_CLOSEGADGET, TRUE, + WA_SIZEGADGET, TRUE, + WA_DEPTHGADGET, TRUE, + WA_DRAGBAR, TRUE, + -> Specify other attributes + WA_ACTIVATE, TRUE, + WA_NOCAREREFRESH, TRUE, + + -> Specify the events we want to know about + WA_IDCMP, IDCMP_CLOSEWINDOW, + + -> Attach the window to the open screen ... + WA_CUSTOMSCREEN, screen1, + WA_TITLE, 'EasyWindow', + WA_SCREENTITLE,'Our Screen - EasyWindow is Active', + NIL]) + + -> Here's the main input event loop + -> E-Note: the signals and stuff is handled by WaitIMessage + REPEAT + UNTIL handleIDCMP(window1) + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF window1 THEN CloseWindow(window1) + IF screen1 THEN CloseScreen(screen1) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_SCRN; WriteF('Error: Failed to open custom screen\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + ENDSELECT +-> E-Note: select return code according to exception +ENDPROC IF exception THEN RETURN_WARN ELSE RETURN_OK + +PROC handleIDCMP(win:PTR TO window) + DEF class, done=FALSE + -> E-Note: WaitIMessage replaces a lot of C code concerned with signals + class:=WaitIMessage(win) + -> E-Note: other parts of the message are available via MsgXXX() functions + + -> See what events occurred + SELECT class + CASE IDCMP_CLOSEWINDOW + done:=TRUE + ENDSELECT +ENDPROC done + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Menus/menulayout.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Menus/menulayout.e new file mode 100644 index 0000000..169a8ce --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Menus/menulayout.e @@ -0,0 +1,460 @@ +-> menulayout.e - Example showing how to do menu layout in general. This +-> example also illustrates handling menu events, including IDCMP_MENUHELP +-> events. +-> +-> Note that handling arbitrary fonts is fairly complex. Applications that +-> require V37 should use the simpler menu layout routines found in the +-> GadTools library. + +OPT PREPROCESS + +MODULE 'dos/dos', + 'graphics/rastport', + 'graphics/text', + 'intuition/intuition', + 'intuition/screens' + +ENUM ERR_NONE, ERR_DRAW, ERR_FONT, ERR_KICK, ERR_MENU, ERR_PUB, ERR_WIN + +RAISE ERR_DRAW IF GetScreenDrawInfo()=NIL, + ERR_FONT IF OpenFont()=NIL, + ERR_MENU IF SetMenuStrip()=FALSE, + ERR_PUB IF LockPubScreen()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +DEF firstMenu + +-> Open all of the required libraries. Note that we require V37, as the +-> routine uses OpenWindowTags(). +PROC main() HANDLE + IF KickVersion(37)=FALSE THEN Raise(ERR_KICK) + + doWindow() + +EXCEPT DO + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_DRAW; WriteF('Error: Failed to get screen DrawInfo\n') + CASE ERR_KICK; WriteF('Error: Needs Kickstart V37+\n') + CASE ERR_MENU; WriteF('Error: Failed to attach menu\n') + CASE ERR_PUB; WriteF('Error: Failed to lock public screen\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + ENDSELECT + RETURN IF exception=ERR_NONE THEN RETURN_FAIL ELSE RETURN_OK +ENDPROC + +-> Open a window with some properly positioned text. Layout and set the menus, +-> then process any events received. Cleanup when done. +PROC doWindow() HANDLE + -> E-Note: some of these are global arrays in the C version + DEF settItem, editItem, prtItem, projItem, menus, + winText0:PTR TO intuitext, winText1:PTR TO intuitext, + window=NIL:PTR TO window, screen=NIL:PTR TO screen, + drawinfo=NIL:PTR TO drawinfo, + win_width, alt_width, win_height + + screen:=LockPubScreen(NIL) + drawinfo:=GetScreenDrawInfo(screen) + + -> Window Text for Explanation of Program + -> Get the colors for the window text + -> Use the screen's font for the text + -> E-Note: link directly without an array + winText0:=[drawinfo.pens[TEXTPEN], drawinfo.pens[BACKGROUNDPEN], RP_JAM2, + 0, 0, screen.font, 'How to do a Menu', NIL]:intuitext + winText1:=[drawinfo.pens[TEXTPEN], drawinfo.pens[BACKGROUNDPEN], RP_JAM2, + 0, 0, screen.font, '(with Style)', winText0]:intuitext + + -> Calculate window size + win_width:=100+IntuiTextLength(winText0) + alt_width:=100+IntuiTextLength(winText1) + IF win_width Calculate the correct positions for the text in the window + winText0.leftedge:=Shr(win_width-IntuiTextLength(winText0), 1) + winText0.topedge:=1+screen.wbortop+(2*screen.font.ysize) + winText1.leftedge:=Shr(win_width-IntuiTextLength(winText1), 1) + winText1.topedge:=winText0.topedge+screen.font.ysize + + -> Open the window + window:=OpenWindowTagList(NIL, + [WA_PUBSCREEN, screen, + WA_IDCMP, IDCMP_MENUPICK OR IDCMP_CLOSEWINDOW OR IDCMP_MENUHELP, + WA_FLAGS, WFLG_DRAGBAR OR WFLG_DEPTHGADGET OR WFLG_CLOSEGADGET OR + WFLG_ACTIVATE OR WFLG_NOCAREREFRESH, + WA_LEFT, 10, WA_TOP, screen.barheight+1, + WA_WIDTH, win_width, WA_HEIGHT, win_height, + WA_TITLE, 'Menu Example', WA_MENUHELP, TRUE, + NIL]) + + -> Give a brief explanation of the program + PrintIText(window.rport, winText1, 0, 0) + + -> E-Note: define the menus using (local) typed lists rather than arrays + -> E-Note: link menu items in reverse order to layout + + -> Settings Items + -> 'Eat It Too' (excludes 'Have Your Cake') + settItem:=[NIL, 0, 0, 0, 0, + ITEMTEXT OR ITEMENABLED OR HIGHCOMP OR CHECKIT, 4, + [0, 1, RP_JAM2, CHECKWIDTH, 1, NIL, + ' Eat It Too', NIL]:intuitext, + NIL, NIL, NIL, MENUNULL]:menuitem + -> 'Have Your Cake' (initially selected, excludes 'Eat It Too') + settItem:=[settItem, 0, 0, 0, 0, + ITEMTEXT OR ITEMENABLED OR HIGHCOMP OR CHECKIT OR CHECKED, 8, + [0, 1, RP_JAM2, CHECKWIDTH, 1, NIL, + ' Have Your Cake', NIL]:intuitext, + NIL, NIL, NIL, MENUNULL]:menuitem + -> 'Auto Save' (toggle-select, initially selected) + settItem:=[settItem, 0, 0, 0, 0, + ITEMTEXT OR ITEMENABLED OR HIGHCOMP OR CHECKIT OR + MENUTOGGLE OR CHECKED, 0, + [0, 1, RP_JAM2, CHECKWIDTH, 1, NIL, + ' Auto Save', NIL]:intuitext, + NIL, NIL, NIL, MENUNULL]:menuitem + -> 'Sound...' + settItem:=[settItem, 0, 0, 0, 0, + ITEMTEXT OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, + 'Sound...', NIL]:intuitext, + NIL, NIL, NIL, MENUNULL]:menuitem + + -> Edit Menu Items + -> 'Undo' (key-equivalent: "Z") + editItem:=[NIL, 0, 0, 0, 0, + ITEMTEXT OR COMMSEQ OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'Undo', NIL]:intuitext, + NIL, "Z", NIL, MENUNULL]:menuitem + -> 'Erase' (disabled) + editItem:=[editItem, 0, 0, 0, 0, + ITEMTEXT OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'Erase', NIL]:intuitext, + NIL, NIL, NIL, MENUNULL]:menuitem + -> 'Paste' (key-equivalent: "V") + editItem:=[editItem, 0, 0, 0, 0, + ITEMTEXT OR COMMSEQ OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'Paste', NIL]:intuitext, + NIL, "V", NIL, MENUNULL]:menuitem + -> 'Copy' (key-equivalent: "C") + editItem:=[editItem, 0, 0, 0, 0, + ITEMTEXT OR COMMSEQ OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'Copy', NIL]:intuitext, + NIL, "C", NIL, MENUNULL]:menuitem + -> 'Cut' (key-equivalent: "X") + editItem:=[editItem, 0, 0, 0, 0, + ITEMTEXT OR COMMSEQ OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'Cut', NIL]:intuitext, + NIL, "X", NIL, MENUNULL]:menuitem + + -> Print Sub-Items + -> 'Draft' + prtItem:=[NIL, 0, 0, 0, 0, + ITEMTEXT OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'Draft', NIL]:intuitext, + NIL, NIL, NIL, MENUNULL]:menuitem + -> 'NLQ' + prtItem:=[prtItem, 0, 0, 0, 0, + ITEMTEXT OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'NLQ', NIL]:intuitext, + NIL, NIL, NIL, MENUNULL]:menuitem + + -> Uses the >> character to indicate a sub-menu item. + -> This is \273 Octal, 0xBB Hex or Alt-0 from the Keyboard. + -> + -> NOTE that standard menus place this character at the right margin of the + -> menu box. This may be done by using a second IntuiText structure for the + -> single character, linking this IntuiText to the first one, and positioning + -> the IntuiText so that the character appears at the right margin. + -> GadTools library will provide the correct behavior. + + -> Project Menu Items + -> 'Quit' (key-equivalent: "Q") + projItem:=[NIL, 0, 0, 0, 0, + ITEMTEXT OR COMMSEQ OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'Quit', NIL]:intuitext, + NIL, "Q", NIL, MENUNULL]:menuitem + -> 'About...' + projItem:=[projItem, 0, 0, 0, 0, + ITEMTEXT OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'About...', NIL]:intuitext, + NIL, NIL, NIL, MENUNULL]:menuitem + -> 'Print' (has sub-menu) + projItem:=[projItem, 0, 0, 0, 0, + ITEMTEXT OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'Print »', NIL]:intuitext, + NIL, NIL, prtItem, MENUNULL]:menuitem + -> 'Save As...' (key-equivalent: "A") + projItem:=[projItem, 0, 0, 0, 0, + ITEMTEXT OR COMMSEQ OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'Save As...', NIL]:intuitext, + NIL, "A", NIL, MENUNULL]:menuitem + -> 'Save' (key-equivalent: "S") + projItem:=[projItem, 0, 0, 0, 0, + ITEMTEXT OR COMMSEQ OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'Save', NIL]:intuitext, + NIL, "S", NIL, MENUNULL]:menuitem + -> 'Open...' (key-equivalent: "O") + projItem:=[projItem, 0, 0, 0, 0, + ITEMTEXT OR COMMSEQ OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'Open...', NIL]:intuitext, + NIL, "O", NIL, MENUNULL]:menuitem + -> 'New' (key-equivalent: "N") + projItem:=[projItem, 0, 0, 0, 0, + ITEMTEXT OR COMMSEQ OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 2, 1, NIL, 'New', NIL]:intuitext, + NIL, "N", NIL, MENUNULL]:menuitem + + -> Menu Titles + -> E-Note: link in reverse order to layout + -> E-Note: use NEW to zero trailing fields + menus:=NEW [NIL, 120, 0, 88, 0, MENUENABLED, 'Settings', settItem]:menu + menus:=NEW [menus, 70, 0, 39, 0, MENUENABLED, 'Edit', editItem]:menu + menus:=NEW [menus, 0, 0, 63, 0, MENUENABLED, 'Project', projItem]:menu + + -> A pointer to the first menu for easy reference + firstMenu:=menus + + -> Adjust the menu to conform to the font (TextAttr) + adjustMenus(menus, window.wscreen.font) + + -> Attach the menu to the window + SetMenuStrip(window, menus) + + REPEAT + UNTIL handleIDCMP(window) + + -> Clean up everything used here + ClearMenuStrip(window) + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF window THEN CloseWindow(window) + IF drawinfo THEN FreeScreenDrawInfo(screen, drawinfo) + IF screen THEN UnlockPubScreen(NIL, screen) + -> E-Note: pass on error, or else RETURN_OK if no error + ReThrow() +ENDPROC RETURN_OK + +-> Print out what menu was selected. Properly handle the IDCMP_MENUHELP +-> events. Set done to TRUE if quit is selected. +PROC processMenus(selection, done) + DEF menuNum, itemNum, subNum, item:PTR TO menuitem + + menuNum:=MENUNUM(selection) + itemNum:=ITEMNUM(selection) + subNum:=SUBNUM(selection) + + -> When processing IDCMP_MENUHELP, you are not guaranteed to get a menu item. + IF itemNum<>NOITEM + item:=ItemAddress(firstMenu, selection) + IF item.flags AND CHECKED THEN WriteF('(Checked) ') + ENDIF + + SELECT menuNum + CASE 0 -> Project Menu + SELECT itemNum + CASE NOITEM; WriteF('Project Menu\n') + CASE 0; WriteF('New\n') + CASE 1; WriteF('Open\n') + CASE 2; WriteF('Save\n') + CASE 3; WriteF('Save As\n') + CASE 4; WriteF('Print ') + SELECT subNum + CASE NOSUB; WriteF('Item\n') + CASE 0; WriteF('NLQ\n') + CASE 1; WriteF('Draft\n') + ENDSELECT + CASE 5; WriteF('About\n') + CASE 6; WriteF('Quit\n'); done:=TRUE + ENDSELECT + CASE 1 -> Edit Menu + SELECT itemNum + CASE NOITEM; WriteF('Edit Menu\n') + CASE 0; WriteF('Cut\n') + CASE 1; WriteF('Copy\n') + CASE 2; WriteF('Paste\n') + CASE 3; WriteF('Erase\n') + CASE 4; WriteF('Undo\n') + ENDSELECT + CASE 2 -> Settings Menu + SELECT itemNum + CASE NOITEM; WriteF('Settings Menu\n') + CASE 0; WriteF('Sound\n') + CASE 1; WriteF('Auto Save\n') + CASE 2; WriteF('Have Your Cake\n') + CASE 3; WriteF('Eat It Too\n') + ENDSELECT + CASE NOMENU -> No menu selected, can happen with IDCMP_MENUHELP + WriteF('no menu\n') + ENDSELECT +ENDPROC done + +-> E-Note: used to convert an INT to unsigned +#define UNSIGNED(x) ((x) AND $FFFF) + +-> Handle the IDCMP messages. Set done to TRUE if quit or closewindow is +-> selected. +PROC handleIDCMP(win) + DEF done=FALSE, selection, class, item:PTR TO menuitem + class:=WaitIMessage(win) + SELECT class + CASE IDCMP_CLOSEWINDOW + done:=TRUE + CASE IDCMP_MENUHELP + -> The routine that handles the menus for IDCMP_MENUHELP must be very + -> careful it can receive menu information that is impossible under + -> IDCMP_MENUPICK. For instance, the code value on a IDCMP_MENUHELP may + -> have a valid number for the menu, then NOITEM and NOSUB. IDCMP_MENUPICK + -> would get MENUNULL in this case. IDCMP_MENUHELP never come as + -> multi-select items, and the event terminates the menu processing session. + -> + -> Note that the return value from the processMenus() routine is ignored: + -> the application should not quit if the user selects "help" over the quit + -> menu item. + WriteF('IDCMP_MENUHELP: Help on ') + processMenus(MsgCode(), done) + CASE IDCMP_MENUPICK + -> E-Note: convert message code to an unsigned INT + selection:=UNSIGNED(MsgCode()) + WHILE selection<>MENUNULL + WriteF('IDCMP_MENUPICK: Selected ') + done:=processMenus(selection, done) + item:=ItemAddress(firstMenu, selection) + -> E-Note: convert item.nextselect to an unsigned INT + selection:=UNSIGNED(item.nextselect) + ENDWHILE + ENDSELECT +ENDPROC done + +-> Steps through each item to determine the maximum width of the strip +PROC maxLength(textRPort, first_item, char_size) + DEF maxLength, total_textlen, cur_item:PTR TO menuitem, + itext:PTR TO intuitext, extra_width, maxCommCharWidth, commCharWidth + + extra_width:=char_size -> Used as padding for each item + + -> Find the maximum length of a command character, if any. + -> If found, it will be added to the extra_width field. + maxCommCharWidth:=0 + cur_item:=first_item + WHILE cur_item + IF cur_item.flags AND COMMSEQ + -> E-Note: requires address of the command character + commCharWidth:=TextLength(textRPort, [cur_item.command]:CHAR, 1) + IF commCharWidth>maxCommCharWidth THEN maxCommCharWidth:=commCharWidth + ENDIF + cur_item:=cur_item.nextitem + ENDWHILE + + -> If we found a command sequence, add it to the extra required space. Add + -> space for the Amiga key glyph plus space for the command character. Note + -> this only works for HIRES screens, for LORES, use LOWCOMMWIDTH. + IF maxCommCharWidth>0 THEN extra_width:=extra_width+maxCommCharWidth+COMMWIDTH + + -> Find the maximum length of the menu items, given the extra width + -> calculated above. + maxLength:=0 + cur_item:=first_item + WHILE cur_item + itext:=cur_item.itemfill + total_textlen:=extra_width+itext.leftedge+ + TextLength(textRPort, itext.itext, StrLen(itext.itext)) + + -> Returns the greater of the two + IF total_textlen>maxLength THEN maxLength:=total_textlen + + cur_item:=cur_item.nextitem + ENDWHILE +ENDPROC maxLength + +-> Set all IntuiText in a chain (they are linked through the nexttext field) +-> to the same font. +PROC setITextAttr(first_IText, textAttr) + DEF cur_IText:PTR TO intuitext + cur_IText:=first_IText + WHILE cur_IText + cur_IText.itextfont:=textAttr + cur_IText:=cur_IText.nexttext + ENDWHILE +ENDPROC + +-> Adjust the MenuItems and SubItems +PROC adjustItems(textRPort, first_item, textAttr, char_size, + height, level, left_edge) + DEF item_num, cur_item:PTR TO menuitem, strip_width, subitem_edge + IF first_item=NIL THEN RETURN + + -> The width of this strip is the maximum length of its members. + strip_width:=maxLength(textRPort, first_item, char_size) + + -> Position the items. + cur_item:=first_item + item_num:=0 + WHILE cur_item + cur_item.topedge:=(item_num*height)-level + cur_item.leftedge:=left_edge + cur_item.width:=strip_width + cur_item.height:=height + + -> Place the sub_item 3/4 of the way over on the item + subitem_edge:=strip_width-(strip_width/4) + + setITextAttr(cur_item.itemfill, textAttr) + adjustItems(textRPort, cur_item.subitem, textAttr, char_size, + height, 1, subitem_edge) + + cur_item:=cur_item.nextitem + INC item_num + ENDWHILE +ENDPROC + + +-> The following routines adjust an entire menu system to conform to the +-> specified font's width and height. Allows for Proportional Fonts. This is +-> necessary for a clean look regardless of what the users preference in Fonts +-> may be. Using these routines, you don't need to specify TopEdge, LeftEdge, +-> Width or Height in the MenuItem structures. +-> +-> NOTE that this routine does not work for menus with images, but assumes that +-> all menu items are rendered with IntuiText. +-> +-> This set of routines does NOT check/correct if the menu runs off the screen +-> due to large fonts, too many items, lo-res screen. +PROC adjustMenus(first_menu, textAttr) HANDLE + DEF textrp:PTR TO rastport, cur_menu:PTR TO menu, font=NIL:PTR TO textfont, + start, char_size, height + + -> E-Note: dynamically allocate a zeroed rastport (might raise exception) + NEW textrp + + -> Open the font + font:=OpenFont(textAttr) + SetFont(textrp, font) -> Put font in to temporary RastPort + + char_size:=TextLength(textrp, 'n', 1) -> Get the width of the font + + -> To prevent crowding of the Amiga key when using COMMSEQ, don't allow the + -> items to be less than 8 pixels high. Also, add an extra pixel for + -> inter-line spacing. + height:=1+(IF font.ysize>8 THEN font.ysize ELSE 8) + + start:=2 -> Set Starting Pixel + + -> Step thru the menu structure and adjust it + cur_menu:=first_menu + WHILE cur_menu + cur_menu.leftedge:=start + cur_menu.width:=char_size+ + TextLength(textrp, cur_menu.menuname, + StrLen(cur_menu.menuname)) + adjustItems(textrp, cur_menu.firstitem, textAttr, char_size, height, 0, 0) + start:=start+cur_menu.width+(char_size*2) + cur_menu:=cur_menu.nextmenu + ENDWHILE +EXCEPT DO + IF font THEN CloseFont(font) -> Close the Font + -> E-Note: as C version ignores font error we'll ignore any NEW error... + RETURN exception=ERR_NONE +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Menus/simplemenu.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Menus/simplemenu.e new file mode 100644 index 0000000..71456d1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Menus/simplemenu.e @@ -0,0 +1,139 @@ +-> simplemenu.e: How to use the menu system with a window under all OS versions. + +OPT PREPROCESS + +MODULE 'graphics/rastport', + 'graphics/text', + 'intuition/intuition', + 'intuition/screens' + +-> These values are based on the ROM font Topaz8. Adjust these values to +-> correctly handle the screen's current font. +CONST MENWIDTH=56+8, -> Longest menu item name * font width + 8 pixels for trim + MENHEIGHT=10 -> Font height + 2 pixels + +-> We only use a single menu, but the code is generalisable to more than +-> one menu. +CONST NUM_MENUS=1 + +ENUM ERR_NONE, ERR_WIN, ERR_MENU + +RAISE ERR_WIN IF OpenWindow()=NIL, + ERR_MENU IF SetMenuStrip()=FALSE -> E-Note: not really necessary... + +PROC main() HANDLE + -> E-Note: some of these are global arrays in the C version + DEF topaz80, submenu1, menu1, menutitle, menustrip:PTR TO menu, + win=NIL:PTR TO window, left=2 + + win:=OpenWindow([40, 40, 300, 100, 0, 1, IDCMP_CLOSEWINDOW OR IDCMP_MENUPICK, + WFLG_DRAGBAR OR WFLG_ACTIVATE OR WFLG_CLOSEGADGET, NIL, NIL, + 'Menu Test Window', NIL, NIL, 0, 0, 0, 0, WBENCHSCREEN]:nw) + + -> To keep this example simple, we'll hard-code the font used for menu items. + -> Algorithmic layout can be used to handle arbitrary fonts. Under Release 2, + -> GadTools provides font-sensitive menu layout. Note that we still must + -> handle fonts for the menu headers. + topaz80:=['topaz.font', 8, 0, 0]:textattr + + -> E-Note: linking needs to be done in reverse order to layout + -> Sub-item 1, NLQ + submenu1:=[NIL, MENWIDTH-2, MENHEIGHT-2, MENWIDTH, MENHEIGHT, + ITEMTEXT OR MENUTOGGLE OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 0, 1, topaz80, 'NLQ', NIL]:intuitext, + NIL, NIL, NIL, NIL]:menuitem + -> Sub-item 0, Draft + submenu1:=[submenu1, MENWIDTH-2, -2, MENWIDTH, MENHEIGHT, + ITEMTEXT OR MENUTOGGLE OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 0, 1, topaz80, 'Draft', NIL]:intuitext, + NIL, NIL, NIL, NIL]:menuitem + + -> E-Note: linking needs to be done in reverse order to layout + -> Item 3, Quit + menu1:=[NIL, 0, 3*MENHEIGHT, MENWIDTH, MENHEIGHT, + ITEMTEXT OR MENUTOGGLE OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 0, 1, topaz80, 'Quit', NIL]:intuitext, + NIL, NIL, NIL, NIL]:menuitem + -> Item 2, Print + menu1:=[menu1, 0, 2*MENHEIGHT, MENWIDTH, MENHEIGHT, + ITEMTEXT OR MENUTOGGLE OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 0, 1, topaz80, 'Print »', NIL]:intuitext, + NIL, NIL, submenu1, NIL]:menuitem + -> Item 1, Save + menu1:=[menu1, 0, MENHEIGHT, MENWIDTH, MENHEIGHT, + ITEMTEXT OR MENUTOGGLE OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 0, 1, topaz80, 'Save', NIL]:intuitext, + NIL, NIL, NIL, NIL]:menuitem + -> Item 0, Open... + menu1:=[menu1, 0, 0, MENWIDTH, MENHEIGHT, + ITEMTEXT OR MENUTOGGLE OR ITEMENABLED OR HIGHCOMP, 0, + [0, 1, RP_JAM2, 0, 1, topaz80, 'Open...', NIL]:intuitext, + NIL, NIL, NIL, NIL]:menuitem + + menutitle:='Project' + + -> E-Note: use NEW, or remember to initialise last elements to 0 + menustrip:=[NIL, left, 0, + TextLength(win.wscreen.rastport, menutitle, StrLen(menutitle))+8, + MENHEIGHT, MENUENABLED, menutitle, menu1, 0, 0, 0, 0]:menu + + left:=left+menustrip.width + + SetMenuStrip(win, menustrip) + + handleWindow(win, menustrip) + + ClearMenuStrip(win) + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF win THEN CloseWindow(win) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + CASE ERR_MENU; WriteF('Error: Failed to attach menu\n') + ENDSELECT +ENDPROC + +-> E-Note: used to convert an INT to unsigned +#define UNSIGNED(x) ((x) AND $FFFF) + +-> Wait for the user to select the close gadget. +-> E-Note: E version is simpler, since we use WaitIMessage +PROC handleWindow(win, menuStrip) + DEF done=FALSE, class, menuNumber, menuNum, itemNum, subNum, + item:PTR TO menuitem + REPEAT + class:=WaitIMessage(win) + SELECT class + CASE IDCMP_CLOSEWINDOW + done:=TRUE + CASE IDCMP_MENUPICK + -> E-Note: menuNumber is an unsigned INT + menuNumber:=UNSIGNED(MsgCode()) + WHILE (menuNumber<>MENUNULL) AND (done=FALSE) + item:=ItemAddress(menuStrip, menuNumber) + + -> Process this item + -> If there were no sub-items attached to that item, + -> SubNumber will equal NOSUB. + menuNum:=MENUNUM(menuNumber) + itemNum:=ITEMNUM(menuNumber) + subNum:=SUBNUM(menuNumber) + + -> Note that we are printing all values, even things like NOMENU, + -> NOITEM and NOSUB. An application should check for these cases. + WriteF('IDCMP_MENUPICK: menu \d, item \d, sub \d\n', + menuNum, itemNum, subNum) + + -> This one is the quit menu selection... + -> stop if we get it, and don't process any more. + -> E-Note: the C version is wrong! QUIT is itemNum = 3 + IF (menuNum=0) AND (itemNum=3) THEN done:=TRUE + + -> E-Note: menuNumber is an unsigned INT + menuNumber:=UNSIGNED(item.nextselect) + ENDWHILE + ENDSELECT + UNTIL done +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Mouse_Keyboard/custompointer.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Mouse_Keyboard/custompointer.e new file mode 100644 index 0000000..27b99e6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Mouse_Keyboard/custompointer.e @@ -0,0 +1,66 @@ +-> custompointer.c - Show the use of a custom busy pointer, as well as using a +-> requester to block input to a window. + +OPT OSVERSION=37 -> E-Note: silently require V37 + +MODULE 'exec/memory', + 'intuition/intuition' + +ENUM ERR_NONE, ERR_WIN + +RAISE ERR_WIN IF OpenWindowTagList()=NIL + +PROC main() HANDLE + DEF win=NIL, null_request:requester, waitPointer + + -> The window is opened as active (WA_ACTIVATE) so that the busy pointer will + -> be visible. If the window was not active, the user would have to activate + -> it to see the change in the pointer. + win:=OpenWindowTagList(NIL, [WA_ACTIVATE, TRUE, NIL]) + + -> E-Note: the data is really a lot of LONGs (and in Chip memory!) + waitPointer:=copyListToChip([$00000000, -> Reserved, must be NIL + $040007C0, $000007C0, $01000380, $000007E0, + $07C01FF8, $1FF03FEC, $3FF87FDE, $3FF87FBE, + $7FFCFF7F, $7EFCFFFF, $7FFCFFFF, $3FF87FFE, + $3FF87FFE, $1FF03FFC, $07C01FF8, $000007E0, + $00000000 -> Reserved, must be NIL + ]) + + -> A NULL requester can be used to block input in a window without any + -> imagery provided. + InitRequester(null_request) + + Delay(50) -> Simulate activity in the program + + -> Put up the requester to block user input in the window, and set the + -> pointer to the busy pointer. + IF Request(null_request, win) + SetPointer(win, waitPointer, 16, 16, -6, 0) + + Delay(100) -> Simulate activity in the program + + -> Clear the pointer (which resets the window to the default pointer) and + -> remove the requester. + ClearPointer(win) + EndRequest(null_request, win) + ENDIF + + Delay(100) -> Simulate activity in the program + +EXCEPT DO + IF win THEN CloseWindow(win) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + CASE "MEM"; WriteF('Error: Ran out of (chip) memory\n') + ENDSELECT +ENDPROC + +-> E-Note: get some Chip memory and copy list (quick, since LONG aligned) +PROC copyListToChip(data) + DEF size, mem + size:=ListLen(data)*SIZEOF LONG + mem:=NewM(size, MEMF_CHIP) + CopyMemQuick(data, mem, size) +ENDPROC mem diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Mouse_Keyboard/mousetest.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Mouse_Keyboard/mousetest.e new file mode 100644 index 0000000..5ccd543 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Mouse_Keyboard/mousetest.e @@ -0,0 +1,174 @@ +-> mousetest.e - Read position and button events from the mouse. + +OPT OSVERSION=37 + +MODULE 'devices/inputevent', + 'exec/ports', + 'graphics/gfxbase', + 'graphics/rastport', + 'graphics/text', + 'intuition/intuition', + 'intuition/screens' + +ENUM ERR_NONE, ERR_DRAW, ERR_PUB, ERR_WIN + +RAISE ERR_DRAW IF GetScreenDrawInfo()=NIL, + ERR_PUB IF LockPubScreen()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +-> E-Note: C version should use this for a string... +CONST BUFSIZE=15 + +-> Something to use to track the time between messages to test for +-> double-clicks. +OBJECT myTimeVal + leftSeconds, leftMicros + rightSeconds, rightMicros +ENDOBJECT + +PROC main() HANDLE + DEF win=NIL:PTR TO window, scr=NIL:PTR TO screen, + dr_info=NIL:PTR TO drawinfo, width, gfx:PTR TO gfxbase + + -> Lock the default public screen in order to read its DrawInfo data + scr:=LockPubScreen(NIL) + + dr_info:=GetScreenDrawInfo(scr) + + -> Use wider of space needed for output (18 chars and spaces) or titlebar + -> text plus room for titlebar gads (approx 18 each) + -> E-Note: get the right type for gfxbase + gfx:=gfxbase + width:=Max(gfx.defaultfont.xsize * 18, + (18*2)+TextLength(scr.rastport, 'MouseTest', STRLEN)) + + win:=OpenWindowTagList(NIL, + [WA_TOP, 20, + WA_LEFT, 100, + WA_INNERWIDTH, width, + WA_HEIGHT, (2*gfx.defaultfont.ysize)+ + scr.wbortop+scr.font.ysize+1+scr.wborbottom, + WA_FLAGS, WFLG_DEPTHGADGET OR WFLG_CLOSEGADGET OR + WFLG_ACTIVATE OR WFLG_REPORTMOUSE OR + WFLG_RMBTRAP OR WFLG_DRAGBAR, + WA_IDCMP, IDCMP_CLOSEWINDOW OR IDCMP_RAWKEY OR + IDCMP_MOUSEMOVE OR IDCMP_MOUSEBUTTONS, + WA_TITLE, 'MouseTest', + WA_PUBSCREEN, scr, + NIL]) + + WriteF('Monitors the Mouse:\n') + WriteF(' Move Mouse, Click and DoubleClick in Windows\n') + + SetAPen(win.rport, dr_info.pens[TEXTPEN]) + SetBPen(win.rport, dr_info.pens[BACKGROUNDPEN]) + SetDrMd(win.rport, RP_JAM2) + + process_window(win) + +EXCEPT DO + IF win THEN CloseWindow(win) + IF dr_info THEN FreeScreenDrawInfo(scr, dr_info) + IF scr THEN UnlockPubScreen(NIL, scr) + SELECT exception + CASE ERR_DRAW; WriteF('Error: Failed to get DrawInfo for screen\n') + CASE ERR_PUB; WriteF('Error: Failed to lock public screen\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + ENDSELECT +ENDPROC + +-> process_window() - Simple message loop for processing IntuiMessages +PROC process_window(win:PTR TO window) + -> E-Note: C version failed to use BUFSIZE! + DEF going, msg:PTR TO intuimessage, class, tv, prt_buff[BUFSIZE]:STRING, + xText, yText -> Places to position text in window + + -> E-Note: going rather than done saves a lot of Not()-ing + going:=TRUE + tv:=[0, 0, 0, 0]:myTimeVal + xText:=win.borderleft+(win.ifont.xsize*2) + yText:=win.bordertop+3+win.ifont.baseline + + -> E-Note: we can't use WaitIMessage() because we want mousex, mousey + WHILE going + Wait(Shl(1, win.userport.sigbit)) + WHILE going AND (msg:=GetMsg(win.userport)) + class:=msg.class + SELECT class + CASE IDCMP_CLOSEWINDOW + going:=FALSE + + -> NOTE NOTE NOTE: If the mouse queue backs up a lot, Intuition will + -> start dropping MOUSEMOVE messages off the end until the queue is + -> serviced. This may cause the program to lose some of the MOUSEMOVE + -> events at the end of the stream. + -> + -> Look in the window structure if you need the true position of the + -> mouse pointer at any given time. Look in the MOUSEBUTTONS message if + -> you need position when it clicked. An alternate to this processing + -> would be to set a flag that a mousemove event arrived, then print the + -> position of the mouse outside of a "WHILE GetMsg()" loop. This allows + -> a single processing call for many mouse events, which speeds up + -> processing A LOT! Something like: + -> + -> WHILE GetMsg() + -> IF class=IDCMP_MOUSEMOVE THEN mouse_flag:= TRUE + -> ReplyMsg() -> NOTE: copy out all needed fields first ! + -> ENDWHILE + -> IF mouse_flag + -> process_mouse_event() + -> mouse_flag:=FALSE + -> ENDIF + -> + -> You can also use IDCMP_INTUITICKS for slower paced messages (all + -> messages have mouse coordinates.) + CASE IDCMP_MOUSEMOVE + -> Show the current position of the mouse relative to the upper left + -> hand corner of our window + Move(win.rport, xText, yText) + StringF(prt_buff, 'X=\d[5] Y=\d[5]', msg.mousex, msg.mousey) + Text(win.rport, prt_buff, BUFSIZE) + CASE IDCMP_MOUSEBUTTONS + doButtons(msg, tv) + ENDSELECT + ReplyMsg(msg) + ENDWHILE + ENDWHILE +ENDPROC + +-> Show what mouse buttons where pushed +PROC doButtons(msg:PTR TO intuimessage, tv:PTR TO myTimeVal) + DEF code + IF msg.qualifier AND (IEQUALIFIER_LSHIFT OR IEQUALIFIER_RSHIFT) + WriteF('Shift ') + ENDIF + + code:=msg.code + SELECT code + CASE SELECTDOWN + WriteF('Left Button Down at X=\d Y=\d', msg.mousex, msg.mousey) + IF DoubleClick(tv.leftSeconds, tv.leftMicros, msg.seconds, msg.micros) + WriteF(' DoubleClick!') + ELSE + tv.leftSeconds:=msg.seconds + tv.leftMicros:=msg.micros + tv.rightSeconds:=0 + tv.rightMicros:=0 + ENDIF + CASE SELECTUP + WriteF('Left Button Up at X=\d Y=\d', msg.mousex, msg.mousey) + CASE MENUDOWN + WriteF('Right Button Down at X=\d Y=\d', msg.mousex, msg.mousey) + IF DoubleClick(tv.rightSeconds, tv.rightMicros, msg.seconds, msg.micros) + WriteF(' DoubleClick!') + ELSE + tv.leftSeconds:=0 + tv.leftMicros:=0 + tv.rightSeconds:=msg.seconds + tv.rightMicros:=msg.micros + ENDIF + CASE MENUUP + WriteF('Right Button Up at X=\d Y=\d', msg.mousex, msg.mousey) + ENDSELECT + WriteF('\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Mouse_Keyboard/rawkey.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Mouse_Keyboard/rawkey.e new file mode 100644 index 0000000..0633e51 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Mouse_Keyboard/rawkey.e @@ -0,0 +1,149 @@ +-> rawkey.e - How to correctly convert from RAWKEY to keymapped ASCII + +MODULE 'console', + 'devices/inputevent', + 'devices/timer', + 'exec/io', + 'intuition/intuition' + +ENUM ERR_NONE, ERR_DEV, ERR_WIN + +RAISE ERR_DEV IF OpenDevice()<>0, + ERR_WIN IF OpenWindowTagList()=NIL + +-> A buffer is created for RawKeyConvert() to put its output. BUFSIZE is the +-> size of the buffer in bytes. NOTE that this program starts out with a +-> buffer size of 2. This is only to show how the buffer is automatically +-> increased in size by this example! In an application, start with a much +-> larger buffer and you will probably never have to increase its size. 128 +-> bytes or so should do the trick, but always be able to change the size if +-> required. +CONST BUFSIZE=2 + +PROC main() HANDLE + DEF win=NIL, ioreq:iostd, ievent=NIL:PTR TO inputevent, + buffer=NIL, bufsize=BUFSIZE + -> Open the console device just to do keymapping. (unit -1 means any unit) + OpenDevice('console.device', -1, ioreq, 0) + consoledevice:=ioreq.device + -> Allocate the initial character buffer used by deadKeyConvert() and + -> RawKeyConvert() for returning translated characters. If the characters + -> generated by these routines cannot fit into the buffer, the application + -> must pass a larger buffer. This is done in this code by freeing the old + -> buffer and allocating a new one. + buffer:=NewR(bufsize) + NEW ievent + win:=OpenWindowTagList(NIL, + [WA_WIDTH, 300, + WA_HEIGHT, 50, + WA_FLAGS, WFLG_DEPTHGADGET OR WFLG_CLOSEGADGET OR WFLG_ACTIVATE, + WA_IDCMP, IDCMP_CLOSEWINDOW OR IDCMP_RAWKEY, + WA_TITLE, 'Raw Key Example', + NIL]) + WriteF('Press keyboard keys to see ASCII conversion from rawkey\n') + WriteF('Unprintable characters will be shown as \c\n\n', $7F) + process_window(win, ievent, {buffer}, {bufsize}) + +EXCEPT DO + IF win THEN CloseWindow(win) + -> E-Note: don't need to free any memory -- automatically done + IF consoledevice THEN CloseDevice(ioreq) + SELECT exception + CASE ERR_DEV; WriteF('Error: Failed to open console device.\n') + CASE ERR_WIN; WriteF('Error: Failed to open window.\n') + CASE "MEM"; WriteF('Error: Ran out of memory.\n') + ENDSELECT +ENDPROC + +-> Convert RAWKEYs into VANILLAKEYs, also shows special keys like HELP, Cursor +-> Keys, FKeys, etc. It returns: +-> -1 if not enough room in the buffer, try again with a bigger buffer. +-> otherwise, returns the number of characters placed in the buffer. +PROC deadKeyConvert(kbuffer, kbsize, kmap, ievent:PTR TO inputevent) + ievent.class:=IECLASS_RAWKEY + ievent.code:=MsgCode() + ievent.qualifier:=MsgQualifier() + ievent.eventaddress:=MsgIaddr() + RETURN RawKeyConvert(ievent, kbuffer, kbsize, kmap) +ENDPROC + +-> print_qualifiers() - Print out the values found in the qualifier bits of +-> the message. This will print out all of the qualifier bits set. +PROC print_qualifiers(qual) + WriteF('Qual: ') + IF qual AND IEQUALIFIER_LSHIFT THEN WriteF('LShft, ') + IF qual AND IEQUALIFIER_RSHIFT THEN WriteF('RShft, ') + IF qual AND IEQUALIFIER_CAPSLOCK THEN WriteF('CapLok, ') + IF qual AND IEQUALIFIER_CONTROL THEN WriteF('Ctrl, ') + IF qual AND IEQUALIFIER_LALT THEN WriteF('LAlt, ') + IF qual AND IEQUALIFIER_RALT THEN WriteF('RAlt, ') + IF qual AND IEQUALIFIER_LCOMMAND THEN WriteF('LCmd, ') + IF qual AND IEQUALIFIER_RCOMMAND THEN WriteF('RCmd, ') + IF qual AND IEQUALIFIER_NUMERICPAD THEN WriteF('NumPad, ') + IF qual AND IEQUALIFIER_REPEAT THEN WriteF('Rpt, ') + IF qual AND IEQUALIFIER_INTERRUPT THEN WriteF('Intrpt, ') + IF qual AND IEQUALIFIER_MULTIBROADCAST THEN WriteF('Multi Broadcast, ') + IF qual AND IEQUALIFIER_MIDBUTTON THEN WriteF('MidBtn, ') + IF qual AND IEQUALIFIER_RBUTTON THEN WriteF('RBtn, ') + IF qual AND IEQUALIFIER_LEFTBUTTON THEN WriteF('LBtn, ') + IF qual AND IEQUALIFIER_RELATIVEMOUSE THEN WriteF('RelMouse, ') +ENDPROC + +-> doKeys() - Show what keys were pressed. +PROC doKeys(ievent, buffer:PTR TO LONG, bufsize:PTR TO LONG) HANDLE + DEF char_pos, numchars, realc, c + + -> deadKeyConvert() returns -1 if there was not enough space in the buffer to + -> convert the string. Here, the routine increases the size of the buffer on + -> the fly... Set the return code to FALSE on failure. + numchars:=deadKeyConvert(buffer[], bufsize[]-1, NIL, ievent) + WHILE (numchars=-1) AND buffer[] + -> Conversion failed, buffer too small. Try to double the size of the buffer. + Dispose(buffer[]) + bufsize[]:=bufsize[]*2 + WriteF('Increasing buffer size to \d\n', bufsize[]) + + buffer[]:=NewR(bufsize[]) + numchars:=deadKeyConvert(buffer[], bufsize[]-1, NIL, ievent) + ENDWHILE + + -> numchars contains the number of characters placed within the buffer. Key + -> up events and key sequences that do not generate any data for the program + -> (like deadkeys) will return zero. Special keys (like HELP, the cursor + -> keys, FKeys, etc.) return multiple characters that have to then be parsed + -> by the application. + + -> If high bit set, then this is a key up otherwise this is a key down + IF MsgCode() AND $80 + WriteF('Key Up: ') + ELSE + WriteF('Key Down: ') + ENDIF + + print_qualifiers(MsgQualifier()) + WriteF(' rawkey #\d maps to \d ASCII character\s\n', + $7F AND MsgCode(), numchars, IF numchars<>1 THEN 's' ELSE '') + FOR char_pos:=0 TO numchars-1 + realc:=(c:=buffer[][char_pos]) + IF (c<=$1F) OR ((c>=$80) AND (c<$A0)) THEN c:=$7F + WriteF(' \d[3] ($\z\h[2]) = \c\n', realc, realc, c) + ENDFOR +EXCEPT DO + RETURN exception=ERR_NONE +ENDPROC + +-> process_window() - Simple event loop. Note that the message is not replied +-> to until the end of the loop so that it may be used in the doKeys() call. +-> E-Note: we use WaitIMessage() so a lot of this and above is simplified +PROC process_window(win, ievent, buffer, bufsize) + DEF going=TRUE, class + WHILE going + class:=WaitIMessage(win) + SELECT class + CASE IDCMP_CLOSEWINDOW + going:=FALSE + CASE IDCMP_RAWKEY + going:=doKeys(ievent, buffer, bufsize) + ENDSELECT + ENDWHILE +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Requesters_Alerts/blockinput.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Requesters_Alerts/blockinput.e new file mode 100644 index 0000000..ed1d416 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Requesters_Alerts/blockinput.e @@ -0,0 +1,111 @@ +-> blockinput.e -- Program to demonstrate how to block the input from a window +-> using a minimal requester, and how to put up a busy pointer. + +OPT OSVERSION=37 -> E-Note: silently require V37 + +MODULE 'exec/memory', + 'intuition/intuition' + +ENUM ERR_NONE, ERR_WIN + +RAISE ERR_WIN IF OpenWindowTagList()=NIL + +-> Open a window and display a busy-pointer for a short time then wait for the +-> user to hit the close gadget (in processIDCMP()). Normally, the application +-> would bracket sections of code where it wishes to block window input with +-> the beginWait() and endWait() functions. +PROC main() HANDLE + DEF win=NIL + + win:=OpenWindowTagList(NIL, + [WA_IDCMP, IDCMP_CLOSEWINDOW OR IDCMP_INTUITICKS, + WA_ACTIVATE, TRUE, + WA_WIDTH, 320, + WA_HEIGHT, 100, + WA_CLOSEGADGET, TRUE, + WA_DRAGBAR, TRUE, + WA_DEPTHGADGET, TRUE, + WA_SIZEGADGET, TRUE, + WA_MAXWIDTH, -1, + WA_MAXHEIGHT, -1, + NIL]) + processIDCMP(win) + +EXCEPT DO + IF win THEN CloseWindow(win) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + CASE "MEM"; WriteF('Error: Ran out of (chip) memory\n') + ENDSELECT +ENDPROC + +-> E-Note: get some Chip memory and copy list (quick, since LONG aligned) +PROC copyListToChip(data) + DEF size, mem + size:=ListLen(data)*SIZEOF LONG + mem:=NewM(size, MEMF_CHIP) + CopyMemQuick(data, mem, size) +ENDPROC mem + +-> Clear the requester with InitRequester. This makes a requester of +-> width = 0, height = 0, left = 0, top = 0; in fact, everything is zero. This +-> requester will simply block input to the window until EndRequest is called. +-> +-> The pointer is set to a reasonable 4-color busy pointer, with proper offsets. +PROC beginWait(win, waitRequest) + DEF waitPointer + + -> Data for a busy pointer. + -> This data must be in chip memory!!! + -> E-Note: the data is really a lot of LONGs + waitPointer:=copyListToChip([$00000000, -> Reserved, must be NIL + $040007C0, $000007C0, $01000380, $000007E0, + $07C01FF8, $1FF03FEC, $3FF87FDE, $3FF87FBE, + $7FFCFF7F, $7EFCFFFF, $7FFCFFFF, $3FF87FFE, + $3FF87FFE, $1FF03FFC, $07C01FF8, $000007E0, + $00000000 -> Reserved, must be NIL + ]) + + InitRequester(waitRequest) + IF Request(waitRequest, win) + SetPointer(win, waitPointer, 16, 16, -6, 0) + SetWindowTitles(win, 'Busy - Input Blocked', -1) + RETURN TRUE + ELSE + RETURN FALSE + ENDIF +ENDPROC + +-> Routine to reset the pointer to the system default, and remove the requester +-> installed with beginWait(). +PROC endWait(win, waitRequest) + ClearPointer(win) + EndRequest(waitRequest, win) + SetWindowTitles(win, 'Not Busy', -1) +ENDPROC + +-> Wait for the user to close the window. +PROC processIDCMP(win) + DEF class, myreq:requester, tick_count + + -> Put up a requester with no imagery (size zero). + IF beginWait(win, myreq) + -> Insert code here for a window to act as the requester. + + -> We'll count down INTUITICKS, which come about ten times a second. We'll + -> keep the busy state for about three seconds. + tick_count:=30 + ENDIF + + REPEAT + class:=WaitIMessage(win) + SELECT class + CASE IDCMP_INTUITICKS + IF tick_count>0 + DEC tick_count + IF tick_count=0 THEN endWait(win, myreq) + ENDIF + ENDSELECT + UNTIL class=IDCMP_CLOSEWINDOW +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Requesters_Alerts/displayalert.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Requesters_Alerts/displayalert.e new file mode 100644 index 0000000..31b1272 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Requesters_Alerts/displayalert.e @@ -0,0 +1,26 @@ +-> displayalert.e - This program implements a recoverable alert + +MODULE 'intuition/intuition' + +PROC main() + IF DisplayAlert(RECOVERY_ALERT, {alertMsg}, 52) + WriteF('Alert returned TRUE\n') + ELSE + WriteF('Alert returned FALSE\n') + ENDIF +ENDPROC + +-> Each string requires its own positioning information, as explained in the +-> manual. Hex notation has been used to specify the positions of the text. +-> Hex numbers start with a "$" and the characters that make up the number. +-> +-> Each line needs 2 bytes of x position, and 1 byte of y position. +-> in our 1st line: x = 0 $f0 (2 bytes) and y = $14 (1 byte) +-> In our 2nd line: x = 0 $80 (2 bytes) and y = $24 (1 byte) +-> Each line is NIL terminated plus a continuation character (0=done). The +-> entire alert must end in TWO NILs, one for the end of the string, and one +-> for the 0 continuation character. +-> E-Note: using static data is just one way of doing this neatly +alertMsg: + CHAR 0, $f0, $14, 'OH NO, NOT AGAIN!', NIL, 1, + 0, $80, $24, 'PRESS MOUSEBUTTON: LEFT=TRUE RIGHT=FALSE', NIL, 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Requesters_Alerts/easyrequest.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Requesters_Alerts/easyrequest.e new file mode 100644 index 0000000..59f463f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Requesters_Alerts/easyrequest.e @@ -0,0 +1,41 @@ +-> easyrequest.e - Show the use of an easy requester. + +OPT OSVERSION=37 -> Note: silently require V37 + +MODULE 'intuition/intuition' + +-> Main routine to show the use of EasyRequestArgs() +PROC main() + DEF answer, number, text + + number:=3125794 -> For use in the middle button + + -> The easy request strucutre uses many features of EasyRequestArgs(), + -> including: + -> multiple lines of body text separated by '\n'. + -> variable substitution of a string (%s) in the body text. + -> multiple button gadgets separated by '|'. + -> variable substitution in a gadget (long decimal '%ld'). + + -> NOTE in the variable substitution: + -> the string goes in the first open variable (in body text). + -> the number goes in the second open (gadget text). + text:='Text for the request\n'+ + 'Second line of %s text\n'+ + 'Third line of text for the request' + answer:=EasyRequestArgs(NIL, + [SIZEOF easystruct, 0, 'Request Window Name', + text, + 'Yes|%ld|No']:easystruct, + NIL, ['(Variable)', number]) + -> Process the answer. Note that the buttons are numbered in a strange + -> order. This is because the rightmost button is always a negative reply. + -> The code can use this if it chooses, with a construct like: + -> + -> IF EasyRequestArgs() THEN positive_response() + SELECT answer + CASE 1; WriteF('Selected "Yes"\n') + CASE 2; WriteF('Selected "\d"\n', number) + CASE 0; WriteF('Selected "No"\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/clonescreen.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/clonescreen.e new file mode 100644 index 0000000..ec52070 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/clonescreen.e @@ -0,0 +1,120 @@ +-> clonescreen.e - clone an existing public screen + +MODULE 'intuition/screens', -> Screen data structures and tags + 'graphics/text', -> Text font structure + 'graphics/modeid', -> Release 2 Amiga display mode ID's + 'exec/nodes', -> Nodes -- get font name + 'exec/ports' -> Ports -- get font name + +ENUM ERR_NONE, ERR_SCRN, ERR_LOCKPUB, ERR_GETDRAW, ERR_MODEID, ERR_FONT + +RAISE ERR_SCRN IF OpenScreenTagList()=NIL, + ERR_LOCKPUB IF LockPubScreen()=NIL, + ERR_GETDRAW IF GetScreenDrawInfo()=NIL, + ERR_MODEID IF GetVPModeID()=INVALID_ID, + ERR_FONT IF OpenFont()=NIL, + "MEM" IF String()=NIL + +PROC main() + DEF pub_screen_name + pub_screen_name:='Workbench' + + IF KickVersion(37) + -> Require version 37 + -> E-Note: E automatically opens the Intuition and Graphics libraries + cloneScreen(pub_screen_name) + ENDIF +ENDPROC + +-> Clone a public screen whose name is passed to the routine. Width, Height, +-> Depth, Pens, Font and DisplayID attributes are all copied from the screen. +-> Overscan is assumed to be OSCAN_TEXT, as there is no easy way to find the +-> overscan type of an existing screen. AutoScroll is turned on, as it does +-> not hurt. Screens that are smaller than the display clip will not scroll. + +PROC cloneScreen(pub_screen_name) HANDLE + DEF my_screen=NIL:PTR TO screen, screen_modeID, pub_scr_font_name, + font_name, pub_screen_font:PTR TO textattr, opened_font, + pub_screen=NIL:PTR TO screen, screen_drawinfo=NIL:PTR TO drawinfo + + -> pub_screen_name is a pointer to the name of the public screen to clone + -> E-Note: automatically error-checked (automatic exception) + pub_screen:=LockPubScreen(pub_screen_name) + + -> Get the DrawInfo structure from the locked screen + -> E-Note: automatically error-checked (automatic exception) + screen_drawinfo:=GetScreenDrawInfo(pub_screen) + + -> E-Note: pub_screen.viewport is a structure in C and (as usual) a pointer + -> to the structure in E + -> E-Note: automatically error-checked (automatic exception) + screen_modeID:=GetVPModeID(pub_screen.viewport) + + -> Get a copy of the font + -> The name of the font must be copied as the public screen may go away at + -> any time after we unlock it. Allocate enough memory to copy the font + -> name, create a TextAttr that matches the font, and open the font. + -> E-Note: pointer typing needed to multiply select from system objects + pub_scr_font_name:=screen_drawinfo.font.mn.ln.name + + -> E-Note: allocate and copy all in one go + -> E-Note: automatically error-checked (automatic exception) + font_name:=StrCopy(String(StrLen(pub_scr_font_name)), pub_scr_font_name) + + -> E-Note: use a typed list for initialised object + pub_screen_font:=[font_name, + screen_drawinfo.font.ysize, + screen_drawinfo.font.style, + screen_drawinfo.font.flags]:textattr + + -> E-Note: pub_screen_font is a structure in C and (as usual) a pointer to + -> the structure in E + -> E-Note: automatically error-checked (automatic exception) + opened_font:=OpenFont(pub_screen_font) + + -> screen_modeID may now be used in a call to OpenScreenTagList() with the + -> tag SA_DISPLAYID + -> E-Note: automatically error-checked (automatic exception) + my_screen:=OpenScreenTagList(NIL, + [SA_WIDTH, pub_screen.width, + SA_HEIGHT, pub_screen.height, + SA_DEPTH, screen_drawinfo.depth, + SA_OVERSCAN, OSCAN_TEXT, + SA_AUTOSCROLL, TRUE, + SA_PENS, screen_drawinfo.pens, + SA_FONT, pub_screen_font, + SA_DISPLAYID, screen_modeID, + SA_TITLE, 'Cloned Screen', + NIL]) + + -> Free the drawinfo and public screen as we don't need them any more. + -> We now have our own screen. + FreeScreenDrawInfo(pub_screen, screen_drawinfo) + screen_drawinfo:=NIL + UnlockPubScreen(pub_screen_name, pub_screen) + pub_screen:=NIL + + Delay(300) -> Should be the rest of the program + + -> E-Note: exit and clean up via handler +EXCEPT DO + -> The first two are freed in the main code if OpenScreenTagList() does not + -> fail. If something goes wrong, free them here. + IF screen_drawinfo THEN FreeScreenDrawInfo(pub_screen, screen_drawinfo) + IF pub_screen THEN UnlockPubScreen(pub_screen_name, pub_screen) + IF my_screen THEN CloseScreen(my_screen) + IF opened_font THEN CloseFont(opened_font) + -> E-Note: it is not strictly necessary, but tidy, to free the font_name + IF font_name THEN DisposeLink(font_name) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_FONT + -> E-Note: it's helpful to say which font went wrong + WriteF('Error: Failed to open font "\s"\n', font_name) + CASE ERR_GETDRAW; WriteF('Error: Failed to get DrawInfo of screen\n') + CASE ERR_LOCKPUB; WriteF('Error: Failed to locked public screen\n') + CASE ERR_MODEID; WriteF('Error: Public screen has invalid mode ID\n') + CASE ERR_SCRN; WriteF('Error: Failed to open custom screen\n') + CASE "MEM"; WriteF('Error: Ran out of memory\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/doublebuffer.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/doublebuffer.e new file mode 100644 index 0000000..2fa630d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/doublebuffer.e @@ -0,0 +1,144 @@ +-> doublebuffer.e - Show the use of a double-buffered screen + +MODULE 'intuition/screens', -> Screen data structures + 'graphics/rastport', -> RastPort and other structures + 'graphics/view', -> ViewPort and other structures + 'graphics/gfx' -> BitMap and other structures + +-> Characteristics of the screen +CONST SCR_WIDTH=320, SCR_HEIGHT=200, SCR_DEPTH=2 + +-> Exception values +-> E-Note: exceptions are a much better way of handling errors +ENUM ERR_NONE, ERR_SCRN, ERR_RAST + +-> Automatically raise exceptions +-> E-Note: these take care of a lot of error cases +RAISE ERR_SCRN IF OpenScreen()=NIL, + ERR_RAST IF AllocRaster()=NIL + +-> Main routine. Setup for using the double buffered screen. Clean up all +-> resources when done or on any error. +PROC main() HANDLE + DEF myBitMaps=NIL:PTR TO LONG, screen=NIL:PTR TO screen + -> E-Note: E automatically opens the Intuition and Graphics libraries + myBitMaps:=setupBitMaps(SCR_DEPTH, SCR_WIDTH, SCR_HEIGHT) + + -> Open a simple quiet screen that is using the first of the two bitmaps. + -> E-Note: use a typed list to get an initialised object + -> E-Note: automatically error-checked (automatic exception) + screen:=OpenScreen([0, -> LeftEdge + 0, -> TopEdge + SCR_WIDTH, -> Width + SCR_HEIGHT, -> Height + SCR_DEPTH, -> Depth + 0, -> DetailPen + 1, -> BlockPen + V_HIRES, -> ViewModes + CUSTOMSCREEN OR CUSTOMBITMAP OR SCREENQUIET, -> Type + NIL, -> Font + NIL, -> DefaultTitle + NIL, -> Gadgets + myBitMaps[0] -> CustomBitMap + ]:ns) + -> Indicate that the rastport is double buffered. + screen.rastport.flags:=RPF_DBUFFER + runDBuff(screen, myBitMaps) + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF screen THEN CloseScreen(screen) + IF myBitMaps THEN freeBitMaps(myBitMaps, SCR_DEPTH, SCR_WIDTH, SCR_HEIGHT) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_SCRN; WriteF('Error: Failed to open custom screen\n') + CASE ERR_RAST; WriteF('Error: Ran out of memory in AllocRaster()\n') + CASE "MEM"; WriteF('Error: Ran out of memory\n') + ENDSELECT +ENDPROC + +-> setupBitMaps(): allocate the bit maps for a double buffered screen. +PROC setupBitMaps(depth, width, height) HANDLE + DEF myBitMaps:PTR TO LONG + -> E-Note: an immediate list in E takes the place of the static in C + -> E-Note: initialise the two bitmaps to NIL pointers + myBitMaps:=[NIL,NIL] + -> E-Note: NewR raises an exception if it fails + myBitMaps[0]:=NewR(SIZEOF bitmap) + myBitMaps[1]:=NewR(SIZEOF bitmap) + InitBitMap(myBitMaps[0], depth, width, height) + InitBitMap(myBitMaps[1], depth, width, height) + setupPlanes(myBitMaps[0], depth, width, height) + setupPlanes(myBitMaps[1], depth, width, height) +EXCEPT + freeBitMaps(myBitMaps, depth, width, height) + -> E-Note: exception must be passed on to caller + ReThrow() +ENDPROC myBitMaps + +-> runDBuff(): loop through a number of iterations of drawing into alternate +-> frames of the double-buffered screen. Note that the object is drawn in +-> colour 1. +PROC runDBuff(screen:PTR TO screen, myBitMaps:PTR TO LONG) + DEF ktr, xpos, ypos, toggleFrame=0 + SetAPen(screen.rastport, 1) + FOR ktr:=1 TO 199 + -> Calculate a position to place the object, these calculations ensure the + -> object will stay on the screen given the range of ktr and the size of + -> the object. + xpos:=ktr + ypos:=IF Mod(ktr,100)>=50 THEN 50-Mod(ktr,50) ELSE Mod(ktr,50) + + -> Switch the bitmap so that we are drawing into the correct place + screen.rastport.bitmap:=myBitMaps[toggleFrame] + screen.viewport.rasinfo.bitmap:=myBitMaps[toggleFrame] + + -> Draw the object + -> Here we clear the old frame and draw a simple filled rectangle + SetRast(screen.rastport, 0) + RectFill(screen.rastport, xpos, ypos, xpos+100, ypos+100) + + -> Update the physical display to match the newly drawn bitmap + MakeScreen(screen) -> Tell Intuition to do its stuff + RethinkDisplay() -> Intuition compatible MrgCop() & LoadView() + -> It also does a WaitTOF() + + -> Switch the frame number for the next time through + -> E-Note: this is exactly what the C version does... + toggleFrame:=Eor(toggleFrame, 1) + ENDFOR +ENDPROC + +-> freeBitMaps(): free up the memory allocated by setupBitMaps() +PROC freeBitMaps(myBitMaps:PTR TO LONG, depth, width, height) + -> E-Note: freeBitMaps() can be safely if written carefully + IF myBitMaps[0] + freePlanes(myBitMaps[0], depth, width, height) + Dispose(myBitMaps[0]) + ENDIF + IF myBitMaps[1] + freePlanes(myBitMaps[1], depth, width, height) + Dispose(myBitMaps[1]) + ENDIF +ENDPROC + +-> setupPlanes(): allocate the bit planes for a screen bit map +PROC setupPlanes(bitMap:PTR TO bitmap, depth, width, height) + DEF plane_num, planes:PTR TO LONG + planes:=bitMap.planes + FOR plane_num:=0 TO depth-1 + -> E-Note: automatically error-checked (automatic exception) + planes[plane_num]:=AllocRaster(width, height) + BltClear(planes[plane_num], (width/8)*height, 1) + ENDFOR + -> E-Note: exceptions handled in caller, which frees memory +ENDPROC + +-> freePlanes(): free up the memory allocated by setupPlanes() +PROC freePlanes(bitMap:PTR TO bitmap, depth, width, height) + DEF plane_num, planes:PTR TO LONG + planes:=bitMap.planes + FOR plane_num:=0 TO depth-1 + IF planes[plane_num] THEN FreeRaster(planes[plane_num], width, height) + ENDFOR +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/dualplayfield.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/dualplayfield.e new file mode 100644 index 0000000..47d2f42 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/dualplayfield.e @@ -0,0 +1,157 @@ +-> dualplayfield.e - Shows how to turn on dual-playfield mode in a screen. + +MODULE 'intuition/intuition', -> Intuition data structures and tags + 'intuition/screens', -> Screen data structures and tags + 'graphics/modeid', -> Release 2 Amiga display mode ID's + 'exec/memory', -> Memory flags + 'graphics/gfx', -> Bitmap and other structures + 'graphics/rastport', -> RastPort and other structures + 'graphics/view' -> ViewPort and other structures + +ENUM ERR_NONE, ERR_SCRN, ERR_WIN, ERR_RAST, ERR_MODEID + +RAISE ERR_SCRN IF OpenScreenTagList()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL, + ERR_RAST IF AllocRaster()=NIL, + ERR_MODEID IF GetVPModeID()=INVALID_ID + +PROC main() HANDLE + DEF win=NIL, scr=NIL + -> E-Note: E automatically opens the Intuition and Graphics libraries + scr:=OpenScreenTagList(NIL, + [SA_DEPTH, 2, + SA_DISPLAYID, HIRES_KEY, + SA_TITLE, 'Dual Playfield Test Screen', + NIL]) + win:=OpenWindowTagList(NIL, + [WA_TITLE, 'Dual Playfield Mode', + WA_IDCMP, IDCMP_CLOSEWINDOW, + WA_WIDTH, 200, + WA_HEIGHT, 100, + WA_DRAGBAR, TRUE, + WA_CLOSEGADGET, TRUE, + WA_CUSTOMSCREEN, scr, + NIL]) + doDualPF(win) + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF win THEN CloseWindow(win) + IF scr THEN CloseScreen(scr) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_SCRN; WriteF('Error: Failed to open custom screen\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + CASE ERR_RAST; WriteF('Error: Ran out of memory in AllocRaster\n') + CASE ERR_MODEID; WriteF('Error: Bad/invalid mode ID for viewport\n') + CASE "MEM"; WriteF('Error: Ran out of memory\n') + ENDSELECT +ENDPROC + +-> Allocate all of the stuff required to add dual playfield to a screen. +PROC doDualPF(win:PTR TO window) HANDLE + DEF myscreen:PTR TO screen, rinfo2=NIL:PTR TO rasinfo, + bmap2=NIL:PTR TO bitmap, rport2=NIL:PTR TO rastport + + myscreen:=win.wscreen -> Find the window's screen + + -> Allocate the second playfield's rasinfo, bitmap, and bitplane + -> E-Note: NewM raises an exception if it fails + rinfo2:=NewM(SIZEOF rasinfo, MEMF_PUBLIC OR MEMF_CLEAR) + -> Get a rastport, and set it up for rendering into bmap2 + rport2:=NewM(SIZEOF rastport, MEMF_PUBLIC) + bmap2:=NewM(SIZEOF bitmap, MEMF_PUBLIC OR MEMF_CLEAR) + InitBitMap(bmap2, 1, myscreen.width, myscreen.height) + + -> Extra playfield will only use one bitplane here. + -> E-Note: automatically error checked (automatic exception) + bmap2.planes[0]:=AllocRaster(myscreen.width, myscreen.height) + InitRastPort(rport2) + rinfo2.bitmap:=bmap2 + rport2.bitmap:=bmap2 + + SetRast(rport2, 0) + + -> E-Note: an exception will be raised if installDualPF fails + installDualPF(myscreen, rinfo2) + SetRGB4(myscreen.viewport, 9, 0, $F, 0) + + drawSomething(rport2) + + handleIDCMP(win) + + removeDualPF(myscreen) + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF bmap2 + IF bmap2.planes[0] -> E-Note: NewM makes this zero when bmap2 allocated + FreeRaster(bmap2.planes[0], myscreen.width, myscreen.height) + ENDIF + Dispose(bmap2) + ENDIF + IF rport2 THEN Dispose(rport2) + IF rinfo2 THEN Dispose(rinfo2) + -> E-Note: pass exception on if it was an error + ReThrow() +ENDPROC + +-> Manhandle the viewport: install second playfield and change modes +PROC installDualPF(scrn:PTR TO screen, rinfo2) + -> You can only play with the bits in the Modes field if the upper half of + -> the screen mode ID is zero!!! + -> E-Note: automatic and explicit exceptions raised here + IF GetVPModeID(scrn.viewport) AND $FFFF0000 THEN Raise(ERR_MODEID) + + Forbid() + + -> Install rinfo2 for viewport's second playfield + scrn.viewport.rasinfo.next:=rinfo2 + scrn.viewport.modes:=scrn.viewport.modes OR V_DUALPF + + Permit() + + -> Put viewport change into effect + MakeScreen(scrn) + RethinkDisplay() +ENDPROC + +-> Draw some lines in a rast port... This is used to get some data into the +-> second playfield. The windows on the screen will move underneath these +-> graphics without disturbing them. +PROC drawSomething(rp:PTR TO rastport) + DEF width, height, r, c + + width:=rp.bitmap.bytesperrow * 8 + height:=rp.bitmap.rows + + SetAPen(rp, 1) + + FOR r:=0 TO height-1 STEP 40 + FOR c:=0 TO width-1 STEP 40 + -> E-Note: we could use E's graphics functions + Move(rp, 0, r) + Draw(rp, c, 0) + ENDFOR + ENDFOR +ENDPROC + +-> Simple event loop to wait for the user to hit the close gadget on the window. +PROC handleIDCMP(win) + WHILE WaitIMessage(win)<>IDCMP_CLOSEWINDOW + ENDWHILE +ENDPROC + +-> Remove the effects of installDualPF(). +-> Only call if installDualPF() succeeded. +PROC removeDualPF(scrn:PTR TO screen) + Forbid() + + scrn.viewport.rasinfo.next:=NIL + scrn.viewport.modes:=scrn.viewport.modes AND Not(V_DUALPF) + + Permit() + + MakeScreen(scrn) + RethinkDisplay() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/newlookscreen.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/newlookscreen.e new file mode 100644 index 0000000..f6b6444 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/newlookscreen.e @@ -0,0 +1,47 @@ +-> newlookscreen.e - open a screen with the "new look" + +-> E-Note: you need to be more specific about modules than C does about includes +MODULE 'intuition/screens' -> Screen data structures and tags + +-> Exception values +-> E-Note: exceptions are a much better way of handling errors +ENUM ERR_NONE, ERR_SCRN, ERR_KICK + +-> Automatically raise exceptions +-> E-Note: these take care of a lot of error cases +RAISE ERR_SCRN IF OpenScreenTagList()=NIL + +-> Simple routine to demonstrate opening a screen with the new look. Simply +-> supply the tag SA_PENS along with a minimal pen specification, Intuition +-> will fill in all unspecified values with defaults. Since we are not +-> supplying values, all are Intuition defaults. +PROC main() HANDLE + DEF my_screen=NIL:PTR TO screen + + -> E-Note: E automatically opens the Intuition library + + -> E-Note: use KickVersion rather than checking library version + -> E-Note: Raise() exception rather than nesting conditionals + IF KickVersion(37)=FALSE THEN Raise(ERR_KICK) + + -> The screen is opened two bitplanes deep so that the new look will show + -> up better. + -> E-Note: automatically error-checked (automatic exception) + -> E-Note: pens is just a INT-typed list + my_screen:=OpenScreenTagList(NIL, + [SA_PENS, [-1]:INT, + SA_DEPTH, 2, + NIL]) + + -> Screen successfully opened + Delay(30) -> Normally the program would be here + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF my_screen THEN CloseScreen(my_screen) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_SCRN; WriteF('Error: Failed to open custom screen\n') + CASE ERR_KICK; WriteF('Error: Needs Kickstart V37+\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/publicscreen.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/publicscreen.e new file mode 100644 index 0000000..9fd895e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/publicscreen.e @@ -0,0 +1,70 @@ +-> publicscreen.e - open a screen with the pens from a public screen + +MODULE 'intuition/screens' + +ENUM ERR_NONE, ERR_SCRN, ERR_LOCKPUB, ERR_GETDRAW + +RAISE ERR_SCRN IF OpenScreenTagList()=NIL, + ERR_LOCKPUB IF LockPubScreen()=NIL, + ERR_GETDRAW IF GetScreenDrawInfo()=NIL + +PROC main() + IF KickVersion(37) + -> Check the version. Release 2 is required for public screen functions + -> E-Note: E automatically opens the Intuition library + usePubScreenPens() + ENDIF +ENDPROC + +-> Open a screen that uses the pens of an existing public screen (the Workbench +-> screen in this case). +PROC usePubScreenPens() HANDLE + DEF my_screen=NIL:PTR TO screen, pubScreenName, + pub_screen=NIL:PTR TO screen, screen_drawinfo=NIL:PTR TO drawinfo + pubScreenName:='Workbench' + + -> Get a lock on the Workbench screen + -> E-Note: automatically error-checked (automatic exception) + pub_screen:=LockPubScreen(pubScreenName) + + -> Get the DrawInfo structure from the locked screen + -> E-Note: automatically error-checked (automatic exception) + screen_drawinfo:=GetScreenDrawInfo(pub_screen) + + -> The pens are copied in the OpenScreenTagList() call, so we can simply use + -> a pointer to the pens in the tag list. + -> + -> This works better if the depth and colors of the new screen matches that + -> of the public screen. Here we are forcing the Workbench screen pens on a + -> monochrome screen (which may not be a good idea). You could add the tag: + -> (SA_DEPTH, screen_drawinfo.depth) + -> E-Note: automatically error-checked (automatic exception) + my_screen:=OpenScreenTagList(NIL, + [SA_PENS, screen_drawinfo.pens, + -> E-Note: try uncommenting next line (see above) + -> SA_DEPTH, screen_drawinfo.depth, + NIL]) + + -> We no longer need to hold the lock on the public screen or a copy of its + -> DrawInfo structure as we now have our own screen. Release the screen. + FreeScreenDrawInfo(pub_screen, screen_drawinfo) + screen_drawinfo:=NIL + UnlockPubScreen(pubScreenName, pub_screen) + pub_screen:=NIL + + Delay(90) -> Should be the rest of the program + + -> E-Note: exit and clean up via handler +EXCEPT DO + -> The first two are freed in the main code if OpenScreenTagList() does not + -> fail. If something goes wrong, free them here. + IF screen_drawinfo THEN FreeScreenDrawInfo(pub_screen, screen_drawinfo) + IF pub_screen THEN UnlockPubScreen(pubScreenName, pub_screen) + IF my_screen THEN CloseScreen(my_screen) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_SCRN; WriteF('Error: Failed to open custom screen\n') + CASE ERR_LOCKPUB; WriteF('Error: Failed to locked public screen\n') + CASE ERR_GETDRAW; WriteF('Error: Failed to get DrawInfo of screen\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/pubscreenbeep.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/pubscreenbeep.e new file mode 100644 index 0000000..c10710d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/pubscreenbeep.e @@ -0,0 +1,28 @@ +-> pubscreenbeep.e +-> +-> Simple example of how to find a public screen to work with in Release 2. + +-> E-Note: no need for modules, since we don't use anything that isn't built-in, +-> but module 'intuition/screens' would be needed if we actually needed to know +-> that "my_wbscreen_ptr" was a "PTR TO screen" rather than just a pointer... +PROC main() + DEF my_wbscreen_ptr -> Pointer to the Workbench screen + + IF KickVersion(36) + -> OK, we have the right version of the OS so we can use the new public + -> screen functions of Release 2 (V36) + IF my_wbscreen_ptr:=LockPubScreen('Workbench') + -> OK found the Workbench screen. Normally the program would be here. + -> A window could be opened or the attributes of the screen copied + DisplayBeep(my_wbscreen_ptr) + + UnlockPubScreen(NIL, my_wbscreen_ptr) + ENDIF + ELSE + -> Prior to Release 2 (V36), there were no public screens, just Workbench. + -> In those older systems, windows can be opened on Workbench without + -> locking or a pointer by setting the Type=WBENCHSCREEN in object "nw". + -> Attributes can be obtained by setting the Type argument to WBENCHSCREEN + -> in the call to GetScreenData(). + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/screen34to37.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/screen34to37.e new file mode 100644 index 0000000..554a22e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Screens/screen34to37.e @@ -0,0 +1,57 @@ +-> screen34to37.e +-> +-> Simple example to show how to open a custom screen that gives the new look +-> under V37, yet still works with older version of the operating system. +-> Attach the tag SA_PENS and a minimal pen specification to ExtNewScreen, and +-> call the old OpenScreen() function. The tags will be ignored by V34 and +-> earlier versions of the OS. In V36 and later the tags are accepted by +-> Intuition. + +-> E-Note: you need to be more specific about modules than C does about includes +MODULE 'intuition/screens', -> Screen data structures and tags + 'graphics/view' -> Screen resolutions + +-> Exception values +-> E-Note: exceptions are a much better way of handling errors +ENUM ERR_NONE, ERR_SCRN + +-> Automatically raise exceptions +-> E-Note: these take care of a lot of error cases +RAISE ERR_SCRN IF OpenS()=NIL + +PROC main() HANDLE + -> Pointer to our new, custom screen + DEF my_screen=NIL:PTR TO screen + + -> E-Note: E automatically opens the Intuition library + + -> The screen is opened two bitplanes deep so that the new look will show + -> up better. + -> E-Note: automatically error-checked (automatic exception) + -> E-Note: simplified using OpenS + my_screen:=OpenS(640, -> Smaller values here reduce the + STDSCREENHEIGHT, -> drawing area and save memory. + 2, -> Two planes means 4 colours. + V_HIRES, + 'My Screen', + -> Attach the pen specification tags + -> E-Note: the tag list can be supplied directly + -> E-Note: pens is just an INT-typed list + [SA_PENS, [-1]:INT, + -> E-Note: these tags replace the missing OpenS parameters + SA_DETAILPEN, 0, + SA_BLOCKPEN, 1, + NIL]) + + -> Screen successfully opened + + Delay(200) -> Normally the program would be here + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF my_screen THEN CloseS(my_screen) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_SCRN; WriteF('Error: Failed to open custom screen\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Special/remembertest.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Special/remembertest.e new file mode 100644 index 0000000..c6a38cb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Special/remembertest.e @@ -0,0 +1,85 @@ +-> RememberTest - Illustrates the use of AllocRemember() and FreeRemember(). +-> E-Note: E's New() family of memory allocators are usually adequate... + +MODULE 'dos/dos', + 'exec/memory' + +RAISE "MEM" IF AllocRemember()=NIL + +-> Random sizes to demonstrate the Remember functions. */ +CONST SIZE_A=100, SIZE_B=200 + +PROC main() + methodOne() + methodTwo() +ENDPROC RETURN_OK + +-> MethodOne +-> Illustrates using AllocRemember() to allocate all memory and FreeRemember() +-> to free it all. +PROC methodOne() HANDLE + DEF memBlockA=NIL, memBlockB=NIL, rememberKey=NIL + + memBlockA:=AllocRemember({rememberKey}, SIZE_A, MEMF_CLEAR OR MEMF_PUBLIC) + memBlockB:=AllocRemember({rememberKey}, SIZE_B, MEMF_CLEAR OR MEMF_PUBLIC) + + -> Both memory allocations succeeded. + -> The program may now use this memory. + +EXCEPT DO + -> It is not necessary to keep track of the status of each allocation. + -> Intuition has kept track of all successful allocations by updating its + -> linked list of Remember nodes. The following call to FreeRemember() will + -> deallocate any and all of the memory that was successfully allocated. + -> The memory blocks as well as the link nodes will be deallocated because + -> the "ReallyForget" parameter is TRUE. + -> + -> It is possible to have reached the call to FreeRemember() in one of three + -> states. Here they are, along with their results. + -> + -> 1. Both memory allocations failed. + -> RememberKey is still NIL. FreeRemember() will do nothing. + -> 2. The memBlockA allocation succeeded but the memBlockB allocation failed. + -> FreeRemember() will free the memory block pointed to by memBlockA. + -> 3. Both memory allocations were successful. + -> FreeRemember() will free the memory blocks pointed to by + -> memBlockA and memBlockB. + FreeRemember({rememberKey}, TRUE) + ReThrow() -> E-Note: pass on exception if an error +ENDPROC + +-> MethodTwo +-> Illustrates using AllocRemember() to allocate all memory, FreeRemember() to +-> free the link nodes, and FreeMem() to free the actual memory blocks. +PROC methodTwo() HANDLE + DEF memBlockA=NIL, memBlockB=NIL, rememberKey=NIL + + memBlockA:=AllocRemember({rememberKey}, SIZE_A, MEMF_CLEAR OR MEMF_PUBLIC) + memBlockB:=AllocRemember({rememberKey}, SIZE_B, MEMF_CLEAR OR MEMF_PUBLIC) + + -> Both memory allocations succeeded. + -> For the purpose of illustration, FreeRemember() is called at this point, + -> but only to free the link nodes. The memory pointed to by memBlockA and + -> memBlockB is retained. + FreeRemember({rememberKey}, FALSE) + + -> Individually free the two memory blocks. The Exec FreeMem() call must be + -> used, as the link nodes are no longer available. + FreeMem(memBlockA, SIZE_A) + FreeMem(memBlockB, SIZE_B) + +EXCEPT DO + -> It is possible to have reached the call to FreeRemember() in one of three + -> states. Here they are, along with their results. + -> + -> 1. Both memory allocations failed. + -> RememberKey is still NIL. FreeRemember() will do nothing. + -> 2. The memBlockA allocation succeeded but the memBlockB allocation failed. + -> FreeRemember() will free the memory block pointed to by memBlockA. + -> 3. Both memory allocations were successful. + -> If this is the case, the program has already freed the link nodes with + -> FreeRemember() and the memory blocks with FreeMem(). When + -> FreeRemember() freed the link nodes, it reset RememberKey to NIL. + -> This (second) call to FreeRemember() will do nothing. + FreeRemember({rememberKey}, TRUE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/lines.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/lines.e new file mode 100644 index 0000000..0bfb861 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/lines.e @@ -0,0 +1,294 @@ +-> lines.e -- implements a superbitmap with scroll gadgets +-> This program requires V37, as it uses calls to OpenWindowTags(), +-> LockPubScreen(). + +OPT PREPROCESS -> E-Note: enable use of macros + +MODULE 'layers', -> We are going to use the Layers library + 'intuition/intuition', -> Intuition data structures and tags + 'intuition/screens', -> Screen data structures and tags + 'graphics/rastport', -> RastPort and other structures + 'graphics/clip', -> Layer and other structures + 'graphics/gfx', -> BitMap and other structures + 'graphics/text', -> TextFont and other structures + 'exec/memory' -> Memory flags + +ENUM ERR_NONE, ERR_LIB, ERR_KICK, ERR_PUB, ERR_RAST, ERR_WIN + +RAISE ERR_LIB IF OpenLibrary()=NIL, + ERR_PUB IF LockPubScreen()=NIL, + ERR_RAST IF AllocRaster()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +CONST WIDTH_SUPER=800, HEIGHT_SUPER=600, + UP_DOWN_GADGET=0, LEFT_RIGHT_GADGET=1, NO_GADGET=2 +-> E-Note: MAXPOT and MAXBODY should be used instead of MAXPROPVAL + +#define LAYERXOFFSET(x) (x.rport.layer.scroll_x) +#define LAYERYOFFSET(x) (x.rport.layer.scroll_y) + +-> E-Note: need objects like botGad to be zeroed, so use pointers here +DEF win=NIL:PTR TO window, botGadInfo=NIL:PTR TO propinfo, + botGadImage=NIL:PTR TO image, botGad=NIL:PTR TO gadget, + sideGadInfo=NIL:PTR TO propinfo, sideGadImage=NIL:PTR TO image, + sideGad=NIL:PTR TO gadget + +PROC main() HANDLE + DEF myscreen=NIL + IF KickVersion(37)=FALSE THEN Raise(ERR_KICK) + + -> E-Note: E automatically opens the Intuition and Graphics libraries + -> Open the Layers library for the program. + -> E-Note: automatically error-checked (automatic exception) + layersbase:=OpenLibrary('layers.library', 33) + + -> LockPubScreen()/UnlockPubScreen is only available under V36 and later. Use + -> GetScreenData() under V34 systems to get a copy of the screen structure... + -> E-Note: automatically error-checked (automatic exception) + myscreen:=LockPubScreen(NIL) + + superWindow(myscreen) + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF myscreen THEN UnlockPubScreen(NIL, myscreen) + IF layersbase THEN CloseLibrary(layersbase) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_KICK; WriteF('Error: Needs Kickstart V37+\n') + CASE ERR_LIB; WriteF('Error: Could not open layers.library\n') + CASE ERR_PUB; WriteF('Error: Could not lock public screen\n') + CASE ERR_RAST; WriteF('Error: Ran out of memory in AllocRaster\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + CASE "MEM"; WriteF('Error: Ran out of memory\n') + ENDSELECT +ENDPROC + +-> A string with this format will be found by the version command supplied by +-> Commodore. This will allow users to give version numbers with error reports. +-> E-Note: labels can only be used after the first PROC line... +vers: CHAR '$VER: lines 37.2',0 + +-> Create, initialise and process the super bitmap window. Cleanup if any error. +PROC superWindow(myscreen:PTR TO screen) HANDLE + DEF bigBitMap=NIL:PTR TO bitmap, planeNum, mydepth + + -> Set-up the border prop gadgets for the OpenWindow() call. + initBorderProps(myscreen) + + -> The code relies on the allocation of the BitMap structure with the + -> MEMF_CLEAR flag. This allows the assumption that all of the bitmap + -> pointers are NIL, except those successfully allocated by the program. + -> E-Note: NewM raises an exception if it fails + bigBitMap:=NewM(SIZEOF bitmap, MEMF_PUBLIC OR MEMF_CLEAR) + + mydepth:=myscreen.bitmap.depth + InitBitMap(bigBitMap, mydepth, WIDTH_SUPER, HEIGHT_SUPER) + + -> E-Note: we handle errors with exceptions + FOR planeNum:=0 TO mydepth-1 + bigBitMap.planes[planeNum]:=AllocRaster(WIDTH_SUPER, HEIGHT_SUPER) + ENDFOR + + -> Only open the window if the bitplanes were successfully allocated. Fail + -> via exception if they were not. + + -> OpenWindowTags() and OpenWindowTagList() are only available when the + -> library version is at least V36. Under earlier versions of Intuition, use + -> OpenWindow() with a NewWindow structure. + win:=OpenWindowTagList(NIL, + [WA_WIDTH, 150, + WA_HEIGHT, (4*(myscreen.wbortop+myscreen.font.ysize+1)), + WA_MAXWIDTH, WIDTH_SUPER, + WA_MAXHEIGHT, HEIGHT_SUPER, + WA_IDCMP, IDCMP_GADGETUP OR IDCMP_GADGETDOWN OR + IDCMP_NEWSIZE OR IDCMP_INTUITICKS OR IDCMP_CLOSEWINDOW, + WA_FLAGS, WFLG_SIZEGADGET OR WFLG_SIZEBRIGHT OR WFLG_SIZEBBOTTOM OR + WFLG_DRAGBAR OR WFLG_DEPTHGADGET OR WFLG_CLOSEGADGET OR + WFLG_SUPER_BITMAP OR WFLG_GIMMEZEROZERO OR WFLG_NOCAREREFRESH, + WA_GADGETS, sideGad, + WA_TITLE, {vers}+6, -> Take title from version string + WA_PUBSCREEN, myscreen, + WA_SUPERBITMAP, bigBitMap, + NIL]) + + -> Set-up the window display + SetRast(win.rport, 0) -> Clear the bitplanes + SetDrMd(win.rport, RP_JAM1) + + doNewSize() -> Adjust props to represent portion visible + doDrawStuff() + + -> Process the window, return on IDCMP_CLOSEWINDOW + doMsgLoop() + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF win THEN CloseWindow(win) + IF bigBitMap + FOR planeNum:=0 TO mydepth-1 + -> Free only the bitplanes actually allocated... + IF bigBitMap.planes[planeNum] + FreeRaster(bigBitMap.planes[planeNum], WIDTH_SUPER, HEIGHT_SUPER) + ENDIF + ENDFOR + Dispose(bigBitMap) + ENDIF + ReThrow() -> E-Note: pass exception on if it was an error +ENDPROC + +-> Set-up the prop gadgets -- initialise them to values that fit into the +-> window border. The height of the prop gadget on the side of the window +-> takes the height of the title bar into account in its set-up. Note the +-> initialisation assumes a fixed size "sizing" gadget. +-> +-> Note also, that the size of the sizing gadget is dependent on the screen +-> resolution. The numbers given here are only valid if the screen is NOT +-> lo-res. These values must be re-worked slightly for lo-res screens. +-> +-> The PROPNEWLOOK flag is ignored by 1.3. +PROC initBorderProps(myscreen:PTR TO screen) + DEF top -> E-Note: temp variable for top calc + -> Initialises the two prop gadgets. + -> + -> Note where the PROPNEWLOOK flag goes. Adding this flag requires no extra + -> storage, but tells the system that our program is expecting the new-look + -> prop gadgets under 2.0. + -> E-Note: we initialise using typed lists and NEW, so that we do not need + -> to fill in every field (NEW will zero the trailing ones). + -> Without NEW only a partial structure would be allocated... + -> E-Note: allocate zeroed images + NEW botGadImage, sideGadImage + + botGadInfo:=NEW [AUTOKNOB OR FREEHORIZ OR PROPNEWLOOK, + 0, 0, -1, -1]:propinfo + + botGad:=NEW [NIL, 3, -7, -23, 6, + GFLG_RELBOTTOM OR GFLG_RELWIDTH, + GACT_RELVERIFY OR GACT_IMMEDIATE OR GACT_BOTTOMBORDER, + GTYP_PROPGADGET OR GTYP_GZZGADGET, + botGadImage, NIL, NIL, NIL, + botGadInfo, LEFT_RIGHT_GADGET]:gadget + + sideGadInfo:=NEW [AUTOKNOB OR FREEVERT OR PROPNEWLOOK, + 0, 0, -1, -1]:propinfo + + -> NOTE the TopEdge adjustment for the border and the font for V36. + top:=myscreen.wbortop+myscreen.font.ysize+2 + sideGad:=NEW [botGad, -14, top, 12, -top-11, + GFLG_RELRIGHT OR GFLG_RELHEIGHT, + GACT_RELVERIFY OR GACT_IMMEDIATE OR GACT_RIGHTBORDER, + GTYP_PROPGADGET OR GTYP_GZZGADGET, + sideGadImage, NIL, NIL, NIL, + sideGadInfo, UP_DOWN_GADGET]:gadget +ENDPROC + +-> This function does all the work of drawing the lines +PROC doDrawStuff() + DEF x1, y1, x2, y2, pen, ncolors, deltx, delty + + ncolors:=Shl(1, win.wscreen.bitmap.depth) + -> E-Note: Rnd could be seeded using VbeamPos... + deltx:=Rnd(6)+2 + delty:=Rnd(6)+2 + + pen:=Rnd(ncolors-1)+1 + SetAPen(win.rport, pen) + x1:=0; y1:=0; x2:=WIDTH_SUPER-1; y2:=HEIGHT_SUPER-1 + WHILE x1 < WIDTH_SUPER + Move(win.rport, x1, y1) + Draw(win.rport, x2, y2) + x1:=x1+deltx + x2:=x2-deltx + ENDWHILE + + pen:=Rnd(ncolors-1)+1 + SetAPen(win.rport, pen) + x1:=0; y1:=0; x2:=WIDTH_SUPER-1; y2:=HEIGHT_SUPER-1 + WHILE y1 < HEIGHT_SUPER + Move(win.rport, x1, y1) + Draw(win.rport, x2, y2) + y1:=y1+delty + y2:=y2-delty + ENDWHILE +ENDPROC + +-> This function provides a simple interface to ScrollLayer +PROC slideBitMap(dx, dy) + ScrollLayer(0, win.rport.layer, dx, dy) +ENDPROC + +-> E-Note: define macros to compute fraction of Pot and Body +-> E-Note: use Mul() and Div() since definitely over 16-bits +#define FRACTIONPOT(n,d) (Div(Mul(n, MAXPOT), d)) +#define FRACTIONBODY(n,d) (Div(Mul(n, MAXBODY), d)) + +-> Update the prop gadgets and bitmap positioning when the size changes. +PROC doNewSize() + DEF tmp + tmp:=LAYERXOFFSET(win) + win.gzzwidth + IF tmp>=WIDTH_SUPER THEN slideBitMap(WIDTH_SUPER-tmp, 0) + + NewModifyProp(botGad, win, NIL, AUTOKNOB OR FREEHORIZ, + FRACTIONPOT(LAYERXOFFSET(win), WIDTH_SUPER - win.gzzwidth), + NIL, + FRACTIONBODY(win.gzzwidth, WIDTH_SUPER), + MAXBODY, + 1) + + tmp:=LAYERYOFFSET(win) + win.gzzheight + IF tmp>=HEIGHT_SUPER THEN slideBitMap(0, HEIGHT_SUPER-tmp) + + NewModifyProp(sideGad, win, NIL, AUTOKNOB OR FREEVERT, + NIL, + FRACTIONPOT(LAYERYOFFSET(win), HEIGHT_SUPER - win.gzzheight), + MAXBODY, + FRACTIONBODY(win.gzzheight, HEIGHT_SUPER), + 1) +ENDPROC + +-> E-Note: convert signed INT from a Pot to unsigned for calculations +#define UNSIGNED(x) (x AND $FFFF) +-> E-Note: define macro to compute layer offset from Pot value +-> E-Note: use Mul() and Div() since definitely over 16-bits +#define CALCOFFSET(size, pot) (Div(Mul(size, UNSIGNED(pot)), MAXPOT)) + +-> Process the currently selected gadget. This is called from IDCMP_INTUITICKS +-> and when the gadget is released IDCMP_GADGETUP. +PROC checkGadget(gadgetID) + DEF tmp, dx=0, dy=0 + + SELECT gadgetID + CASE UP_DOWN_GADGET + tmp:=CALCOFFSET(HEIGHT_SUPER-win.gzzheight, sideGadInfo.vertpot) + dy:=tmp - LAYERYOFFSET(win) + CASE LEFT_RIGHT_GADGET + tmp:=CALCOFFSET(WIDTH_SUPER-win.gzzwidth, botGadInfo.horizpot) + dx:=tmp - LAYERXOFFSET(win) + ENDSELECT + + IF dx OR dy THEN slideBitMap(dx, dy) +ENDPROC + +-> Main message loop for the window. +-> E-Note: E version is simpler, since we use WaitIMessage +PROC doMsgLoop() + DEF class, currentGadget=NO_GADGET, g:PTR TO gadget + -> E-Note: g is used to cast the type of MsgIaddr() + REPEAT + class:=WaitIMessage(win) + SELECT class + CASE IDCMP_NEWSIZE + doNewSize() + doDrawStuff() + CASE IDCMP_GADGETDOWN + g:=MsgIaddr() + currentGadget:=g.gadgetid + CASE IDCMP_GADGETUP + checkGadget(currentGadget) + currentGadget:=NO_GADGET + CASE IDCMP_INTUITICKS + checkGadget(currentGadget) + ENDSELECT + UNTIL class=IDCMP_CLOSEWINDOW +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/openwindowtags.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/openwindowtags.e new file mode 100644 index 0000000..d7f9b97 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/openwindowtags.e @@ -0,0 +1,44 @@ +-> openwindowtags.e - open a window using tags + +MODULE 'intuition/intuition' -> Intuition data structures and tags + +CONST MY_WIN_LEFT=20, MY_WIN_TOP=10, + MY_WIN_WIDTH=300, MY_WIN_HEIGHT=110 + +ENUM ERR_NONE, ERR_WIN, ERR_KICK + +RAISE ERR_WIN IF OpenWindowTagList()=NIL + +-> Open a simple window using OpenWindowTagList() +PROC main() HANDLE + DEF win=NIL + -> These calls are only valid if we have Intuition version 37 or greater + IF KickVersion(37)=FALSE THEN Raise(ERR_KICK) + win:=OpenWindowTagList(NIL, + [WA_LEFT, MY_WIN_LEFT, + WA_TOP, MY_WIN_TOP, + WA_WIDTH, MY_WIN_WIDTH, + WA_HEIGHT, MY_WIN_HEIGHT, + WA_CLOSEGADGET, TRUE, + WA_IDCMP, IDCMP_CLOSEWINDOW, + NIL]) + -> Window successfully opened here + handle_window_events(win) + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF win THEN CloseWindow(win) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + CASE ERR_KICK; WriteF('Error: Needs Kickstart V37+\n') + ENDSELECT +ENDPROC + +-> Normally this routine would contain an event loop like the one given in the +-> chapter "Intuition Input and Output Methods". Here we just wait for any +-> messages we requested to appear at the Window's port. +PROC handle_window_events(win) + -> E-Note: we can use E's special message poller + WaitIMessage(win) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/visiblewindow.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/visiblewindow.e new file mode 100644 index 0000000..9494f98 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/visiblewindow.e @@ -0,0 +1,114 @@ +-> visiblewindow.e +-> Open a window on the visible part of a screen, with the window as large as +-> the visible part of the screen. It is assumed that the visible part of the +-> screen is OSCAN_TEXT, which how the user has set their preferences. + +MODULE 'intuition/intuition', -> Intuition data structures and tags + 'intuition/screens', -> Screen data structures and tags + 'graphics/gfx', -> Graphics structures + 'graphics/modeid' -> Release 2 Amiga display mode ID's + +ENUM ERR_NONE, ERR_WIN, ERR_PUB + +RAISE ERR_WIN IF OpenWindowTagList()=NIL, + ERR_PUB IF LockPubScreen()=NIL + +-> Minimum window width and height: These values should really be calculated +-> dynamically given the size of the font and the window borders. Here, to +-> keep the example simple they are hard-coded values. +CONST MIN_WINDOW_WIDTH=100, MIN_WINDOW_HEIGHT=50 + +-> E-Note: minimum and maximum are built-in + +PROC main() + -> These calls are only valid if we have version 37 or greater + -> E-Note: E automatically opens the Intuition and Graphics libraries + IF KickVersion(37) + fullScreen() + ELSE -> E-Note: we can print a minimal error + WriteF('Error: Needs Kickstart V37+\n') + ENDIF +ENDPROC + +-> Open a window on the default public screen, then leave it open until the +-> user selects the close gadget. The window is full-sized, positioned in the +-> currently visible OSCAN_TEXT area. +PROC fullScreen() HANDLE + DEF test_window=NIL:PTR TO window, pub_screen=NIL:PTR TO screen, + rect:rectangle, screen_modeID, + -> Set some reasonable defaults for left, top, width and height + -> We'll pick up the real values with the call to QueryOverscan() + left=0, top=0, width=640, height=200 + + -> Get a lock on the default public screen + -> E-Note: automatically error-checked (automatic exception) + pub_screen:=LockPubScreen(NIL) + + -> This technique returns the text overscan rectangle of the screen that we + -> are opening on. If you really need the actual value set into the display + -> clip of the screen, use the VideoControl() command of the graphics library + -> to return a copy of the ViewPortExtra structure. See the Graphics library + -> chapter and Autodocs for more details. + -> + -> GetVPModeID() is a graphics call... + IF (screen_modeID:=GetVPModeID(pub_screen.viewport))<>INVALID_ID + IF QueryOverscan(screen_modeID, rect, OSCAN_TEXT) + -> Make sure window coordinates are positive or zero + left := Max(0, -pub_screen.leftedge) + top := Max(0, -pub_screen.topedge) + + -> Get width and height from size of display clip + width:=rect.maxx-rect.minx+1 + height:=rect.maxy-rect.miny+1 + + -> Adjust height for pulled-down screen (only show visible part) + IF pub_screen.topedge > 0 + height:=height-pub_screen.topedge + ENDIF + + -> Ensure that window fits on screen + height:=Min(height,pub_screen.height) + width:=Min(width,pub_screen.width) + + -> Make sure window is at least minimum size + width:=Max(width, MIN_WINDOW_WIDTH) + height:=Max(height, MIN_WINDOW_HEIGHT) + ENDIF + ENDIF + + -> Open the window on the public screen + -> E-Note: automatically error-checked (automatic exception) + test_window:=OpenWindowTagList(NIL, + [WA_LEFT, left, WA_WIDTH, width, + WA_TOP, top, WA_HEIGHT, height, + WA_CLOSEGADGET, TRUE, + WA_IDCMP, IDCMP_CLOSEWINDOW, + WA_PUBSCREEN, pub_screen, + NIL]) + -> Unlock the screen. The window now acts as a lock on the screen, and we do + -> not need the screen after the window has been closed. + UnlockPubScreen(NIL, pub_screen) + -> E-Note: set it to NIL to help deal with errors + pub_screen:=NIL + + -> If we have a valid window open, run the rest of the program, then clean + -> up when done. + handle_window_events(test_window) + + -> E-Note: exit and clean up via handler +EXCEPT DO + IF test_window THEN CloseWindow(test_window) + IF pub_screen THEN UnlockPubScreen(NIL, pub_screen) + -> E-Note: we can print a minimal error message + SELECT exception + CASE ERR_PUB; WriteF('Error: Could not lock public screen\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + ENDSELECT +ENDPROC + +-> Wait for the user to select the close gadget. +PROC handle_window_events(win) + -> E-Note: we can use E's special message poller + REPEAT + UNTIL WaitIMessage(win)=IDCMP_CLOSEWINDOW +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/winpubscreen.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/winpubscreen.e new file mode 100644 index 0000000..b606f24 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Intuition/Windows/winpubscreen.e @@ -0,0 +1,57 @@ +-> winpubscreen.e +-> Open a window on the default public screen (usually the Workbench screen) + +MODULE 'intuition/intuition' -> Intuition data structures and tags + +ENUM ERR_NONE, ERR_WIN, ERR_KICK, ERR_PUB + +RAISE ERR_WIN IF OpenWindowTagList()=NIL, + ERR_PUB IF LockPubScreen()=NIL + +-> Open a simple window on the default public screen, then leave it open until +-> the user selects the close gadget. +PROC main() HANDLE + DEF test_window=NIL, test_screen=NIL + IF KickVersion(37)=FALSE THEN Raise(ERR_KICK) + -> Get a lock on the default public screen + test_screen:=LockPubScreen(NIL) + -> Open the window on the public screen + test_window:=OpenWindowTagList(NIL, + [WA_LEFT, 10, WA_TOP, 20, + WA_WIDTH, 300, WA_HEIGHT, 100, + WA_DRAGBAR, TRUE, + WA_CLOSEGADGET, TRUE, + WA_SMARTREFRESH, TRUE, + WA_NOCAREREFRESH, TRUE, + WA_IDCMP, IDCMP_CLOSEWINDOW, + WA_TITLE, 'Window Title', + WA_PUBSCREEN, test_screen, + NIL]) + -> Unlock the screen. The window now acts as a lock on the screen, and we do + -> not need the screen after the window has been closed. + UnlockPubScreen(NIL, test_screen) + -> Note: set it to NIL to help deal with errors + test_screen:=NIL + + -> If we have a valid window open, run the rest of the program, then clean up + -> when done. + handle_window_events(test_window) + + -> Note: exit and clean up via handler +EXCEPT DO + IF test_window THEN CloseWindow(test_window) + IF test_screen THEN UnlockPubScreen(NIL, test_screen) + -> Note: we can print a minimal error message + SELECT exception + CASE ERR_KICK; WriteF('Error: Needs Kickstart V37+\n') + CASE ERR_PUB; WriteF('Error: Could not lock public screen\n') + CASE ERR_WIN; WriteF('Error: Failed to open window\n') + ENDSELECT +ENDPROC + +-> Wait for the user to select the close gadget. +PROC handle_window_events(win) + -> Note: we can use E's special message poller + REPEAT + UNTIL WaitIMessage(win)=IDCMP_CLOSEWINDOW +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/appkeymap.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/appkeymap.e new file mode 100644 index 0000000..92f8076 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/appkeymap.e @@ -0,0 +1,155 @@ +-> appkeymap.e - Subroutines to copy the default keymap, modify the copy +-> +-> Usage: (PTR TO keymap) appkeymap:=createAppKeyMap() +-> PROC deleteAppKeyMap(appkeymap:PTR TO keymap) +-> +-> This example modifies the copied keymap by unmapping all of the numeric +-> keypad keys. This creates a good keymap for use with either keymap.library +-> MapANSI() or commodities InvertString(). If you used a default keymap with +-> the above functions, numeric keypad raw key values would be returned for +-> keys which are available with fewer keypresses on numeric pad than on the +-> normal keyboard. It is generally preferable to have the normal keyboard +-> raw values since many applications attach special meanings to numeric pad +-> keys. The AlterAppKeyMap() routine in this module could easilty be +-> modified to instead set new values for numeric pad or function keys. +-> +-> IMPORTANT: Do Not Use SetKeyMapDefault() unless you are a system +-> preferences editor OR an application that takes over the machine. If you +-> want to use a customized keymap such as this in your application, open your +-> own Intuition window, attach a console device to it, and then use the +-> console device SETKEYMAP command to set your console device unit to your +-> custom keymap. + +->>> Header (globals) +OPT MODULE + +MODULE 'keymap', + 'devices/keymap' + +ENUM ERR_NONE, ERR_ASK, ERR_LIB + +RAISE ERR_ASK IF AskKeyMapDefault()=NIL, + ERR_LIB IF OpenLibrary()=NIL + +-> Raw keys we might want to remap which are the same on all keyboards +EXPORT ENUM UP_KEY=$4C, DOWN_KEY, RIGHT_KEY, LEFT_KEY, F1_KEY, F2_KEY, F3_KEY, + F4_KEY, F5_KEY, F6_KEY, F7_KEY, F8_KEY, F9_KEY, F10_KEY + +EXPORT CONST N0_KEY=$0F, N1_KEY=$1D, N2_KEY=$1E, N3_KEY=$1F, N4_KEY=$2D, + N5_KEY=$2E, N6_KEY=$2F, N7_KEY=$3D, N8_KEY=$3E, N9_KEY=$3F + +EXPORT CONST NPERIOD_KEY=$3C, NOPAREN_KEY=$5A, NCPAREN_KEY=$5B, NSLASH_KEY=$5C, + NASTER_KEY=$5D, NMINUS_KEY=$4A, NPLUS_KEY=$5E, NENTER_KEY=$43 + +EXPORT CONST RETURN_KEY=$44, HELP_KEY=$5F + +-> Count of elements in keymap arrays +EXPORT CONST MAP_SIZE=64, TYPE_SIZE=64, CAPS_SIZE=8, REPS_SIZE=8 +EXPORT CONST MAP_SIZE_P=MAP_SIZE*2, TYPE_SIZE_P=TYPE_SIZE*2, + CAPS_SIZE_P=CAPS_SIZE*2, REPS_SIZE_P=REPS_SIZE*2 + +-> We allocate our Lo and Hi array pairs each as a single array +EXPORT OBJECT keyMapArrays + lhKeyMap[MAP_SIZE_P]:ARRAY OF LONG + lhKeyMapTypes[TYPE_SIZE_P]:ARRAY + lhCapsable[CAPS_SIZE_P]:ARRAY + lhRepeatable[REPS_SIZE_P]:ARRAY +ENDOBJECT + +DEF karrays:PTR TO keyMapArrays, defkeymap:PTR TO keymap, + appkeymap:PTR TO keymap, mapsize +->>> + +->>> EXPORT PROC createAppKeyMap() +EXPORT PROC createAppKeyMap() HANDLE + keymapbase:=OpenLibrary('keymap.library', 37) + defkeymap:=NIL -> E-Note: help with error trapping + -> Get a pointer to the keymap which is set as the system default + defkeymap:=AskKeyMapDefault() + -> Allocate our KeyMap structures and arrays + mapsize:=SIZEOF keymap+SIZEOF keyMapArrays + appkeymap:=NIL + appkeymap:=NewR(mapsize) + -> Init our appkeymap fields to point to our allocated arrays. + -> Each LH array contains a Lo and a Hi array. + -> E-Note: the +1 in the C version means +SIZEOF keymap + karrays:=appkeymap+SIZEOF keymap + appkeymap.lokeymap:=karrays.lhKeyMap + appkeymap.hikeymap:=karrays.lhKeyMap+(MAP_SIZE*(SIZEOF LONG)) + appkeymap.lokeymaptypes:=karrays.lhKeyMapTypes + appkeymap.hikeymaptypes:=karrays.lhKeyMapTypes+TYPE_SIZE + appkeymap.locapsable:=karrays.lhCapsable + appkeymap.hicapsable:=karrays.lhCapsable+CAPS_SIZE + appkeymap.lorepeatable:=karrays.lhRepeatable + appkeymap.hirepeatable:=karrays.lhRepeatable+REPS_SIZE + + -> Copy the user's default system keymap arrays to our appkeymap arrays to + -> get the proper keymappings for the user's keyboard. + copyKeyMap(defkeymap, appkeymap) + + -> Now make our changes to our appkeymap + alterAppKeyMap(appkeymap) +EXCEPT DO + IF keymapbase THEN CloseLibrary(keymapbase) +ENDPROC appkeymap +->>> + +->>> EXPORT PROC deleteAppKeyMap(appkeymap:PTR TO keymap) +EXPORT PROC deleteAppKeyMap(appkeymap:PTR TO keymap) + IF appkeymap THEN Dispose(appkeymap) +ENDPROC +->>> + +->>> PROC alterAppKeyMap(appkeymap:PTR TO keymap) +PROC alterAppKeyMap(appkeymap:PTR TO keymap) + DEF nullkeys, keymappings:PTR TO LONG, keymaptypes, rawkeynum, i + -> NIL terminated ARRAY of keys our application wants to remap or disable + nullkeys:=[N0_KEY, N1_KEY, N2_KEY, N3_KEY, N4_KEY, + N5_KEY, N6_KEY, N7_KEY, N8_KEY, N9_KEY, + NPERIOD_KEY, NOPAREN_KEY, NCPAREN_KEY, NSLASH_KEY, + NASTER_KEY, NMINUS_KEY, NPLUS_KEY, NENTER_KEY, + NIL]:CHAR + -> Our application wants numeric pad keys remapped to nothing so that we can + -> use this keymap with MapANSI and NOT get back raw codes for numeric + -> keypad. Alternatively (for example) you could set the types to + -> KCF_STRING and set the mappings to point to NIL terminated strings. + keymappings:=appkeymap.lokeymap + keymaptypes:=appkeymap.lokeymaptypes + + i:=0 + WHILE rawkeynum:=nullkeys[i] + -> Because we allocated each of our Lo and Hi ARRAY pairs as sequential + -> memory, we can use the RAWKEY values directly to index into our + -> sequential Lo/Hi ARRAY + keymaptypes[rawkeynum]:=KCF_NOP + INC i + ENDWHILE +ENDPROC +->>> + +->>> PROC copyKeyMap(s:PTR TO keymap, d:PTR TO keymap) +PROC copyKeyMap(s:PTR TO keymap, d:PTR TO keymap) + DEF bb, ll:PTR TO LONG, i + -> Copy keymap s (source) to keymap d (dest) + ll:=s.lokeymap + FOR i:=0 TO MAP_SIZE-1 DO d.lokeymap[i]:=ll[]++ + ll:=s.hikeymap + FOR i:=0 TO MAP_SIZE-1 DO d.hikeymap[i]:=ll[]++ + + bb:=s.lokeymaptypes + FOR i:=0 TO TYPE_SIZE-1 DO d.lokeymaptypes[i]:=bb[]++ + bb:=s.hikeymaptypes + FOR i:=0 TO TYPE_SIZE-1 DO d.hikeymaptypes[i]:=bb[]++ + + bb:=s.locapsable + FOR i:=0 TO CAPS_SIZE-1 DO d.locapsable[i]:=bb[]++ + bb:=s.hicapsable + FOR i:=0 TO CAPS_SIZE-1 DO d.hicapsable[i]:=bb[]++ + + bb:=s.lorepeatable + FOR i:=0 TO REPS_SIZE-1 DO d.lorepeatable[i]:=bb[]++ + bb:=s.hirepeatable + FOR i:=0 TO REPS_SIZE-1 DO d.hirepeatable[i]:=bb[]++ +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/appkeymap.m b/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/appkeymap.m new file mode 100644 index 0000000..b8657e3 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/appkeymap.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/mapansi.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/mapansi.e new file mode 100644 index 0000000..ab291e8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/mapansi.e @@ -0,0 +1,99 @@ +-> mapansi.e - Converts a string to input events using MapANSI() function. +-> +-> This example will also take the created input events and add them to the +-> input stream using the simple commodities.library function AddIEvents(). +-> Alternately, you could open the input.device and use the input device +-> command IND_WRITEEVENT to add events to the input stream. + +->>> Header (globals) +MODULE 'commodities', + 'keymap', + 'devices/inputevent' + +ENUM ERR_NONE, ERR_INT, ERR_LIB, ERR_OVER + +RAISE ERR_LIB IF OpenLibrary()=NIL + +DEF inputEvent=NIL:PTR TO inputevent +->>> + +->>> PROC main() +PROC main() HANDLE + DEF string, tmp1, tmp2, i, + iebuffer[6]:ARRAY -> Space for two dead keys + 1 key + qualifiers + openall() + string:=';String converted to input events and sent to input device\n' + inputEvent.class:=IECLASS_RAWKEY + -> Turn each character into an inputevent + tmp1:=string + WHILE tmp1[] + -> Convert one character, use default key map + i:=MapANSI(tmp1, 1, iebuffer, 3, NIL) + -> Make sure we start without deadkeys + inputEvent.prev1downcode:=0 + inputEvent.prev1downqual:=0 + inputEvent.prev2downcode:=0 + inputEvent.prev2downqual:=0 + + tmp2:=iebuffer + SELECT i + CASE -2 + WriteF('Internal error\n') + Raise(ERR_INT) + CASE -1 + WriteF('Overflow\n') + Raise(ERR_OVER) + CASE 0 + WriteF('Can''t generate code\n') + CASE 3 + inputEvent.prev2downcode:=tmp2[]++ + inputEvent.prev2downqual:=tmp2[]++ + inputEvent.prev1downcode:=tmp2[]++ + inputEvent.prev1downqual:=tmp2[]++ + inputEvent.code:=tmp2[]++ + inputEvent.qualifier:=tmp2[] + CASE 2 + inputEvent.prev1downcode:=tmp2[]++ + inputEvent.prev1downqual:=tmp2[]++ + inputEvent.code:=tmp2[]++ + inputEvent.qualifier:=tmp2[] + CASE 1 + inputEvent.code:=tmp2[]++ + inputEvent.qualifier:=tmp2[] + ENDSELECT + + -> Send the key down event + AddIEvents(inputEvent) + -> Create a key up event + inputEvent.code:=inputEvent.code OR IECODE_UP_PREFIX + -> Send the key up event + AddIEvents(inputEvent) + tmp1++ + ENDWHILE +EXCEPT DO + closeall() + SELECT exception + CASE ERR_INT; WriteF('Error: MapANSI() internal error\n') + CASE ERR_LIB; WriteF('Error: could not open required library\n') + CASE ERR_OVER; WriteF('Error: MapANSI() overflow error\n') + CASE "MEM"; WriteF('Error: ran out of memory\n') + ENDSELECT +ENDPROC +->>> + +->>> PROC openall() +PROC openall() + keymapbase:=OpenLibrary('keymap.library', 37) + cxbase:=OpenLibrary('commodities.library', 37) + NEW inputEvent +ENDPROC +->>> + +->>> PROC closeall() +PROC closeall() + IF inputEvent THEN END inputEvent + IF cxbase THEN CloseLibrary(cxbase) + IF keymapbase THEN CloseLibrary(keymapbase) +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/maprawkey.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/maprawkey.e new file mode 100644 index 0000000..c7003ae --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Keymap/maprawkey.e @@ -0,0 +1,97 @@ +-> maprawkey.e - Map Intuition RAWKEY events to ANSI with MapRawKey() + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'keymap', + 'devices/inputevent', + 'exec/ports', + 'intuition/intuition' + +ENUM ERR_NONE, ERR_LIB, ERR_WIN + +RAISE ERR_LIB IF OpenLibrary()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +-> E-Note: used to convert an INT to unsigned +#define UNSIGNED(x) ((x) AND $FFFF) + +DEF window=NIL:PTR TO window +->>> + +->>> PROC main() +PROC main() HANDLE + DEF imsg:PTR TO intuimessage, eventptr:PTR TO LONG, windowsignal, + inputevent:PTR TO inputevent, buffer[8]:ARRAY, i, going=TRUE, class + openall() + window:=OpenWindowTagList(NIL, + [WA_WIDTH, 500, + WA_HEIGHT, 60, + WA_TITLE, 'MapRawKey - Press Keys', + WA_FLAGS, WFLG_CLOSEGADGET OR WFLG_ACTIVATE, + WA_IDCMP, IDCMP_RAWKEY OR IDCMP_CLOSEWINDOW, + NIL]) + windowsignal:=Shl(1, window.userport.sigbit) + + -> Initialise inputevent object + -> E-Note: first allocate it cleared using NEW + NEW inputevent + inputevent.class:=IECLASS_RAWKEY + + WHILE going + Wait(windowsignal) + + WHILE imsg:=GetMsg(window.userport) + class:=imsg.class + SELECT class + CASE IDCMP_CLOSEWINDOW + going:=FALSE + CASE IDCMP_RAWKEY + inputevent.code:=imsg.code + inputevent.qualifier:=UNSIGNED(imsg.qualifier) + + WriteF('RAWKEY: Code=$\z\h[4] Qualifier=$\z\h[4]\n', + imsg.code, UNSIGNED(imsg.qualifier)) + + -> Make sure deadkeys and qualifiers are taken into account. + eventptr:=imsg.iaddress + inputevent.eventaddress:=eventptr[] + + -> Map RAWKEY to ANSI + i:=MapRawKey(inputevent, buffer, 8, NIL) + + IF i=-1 + WriteF('*Overflow*') + ELSEIF i + -> This key or key combination mapped to something + WriteF('MAPS TO: ') + Write(stdout, buffer, i) + WriteF('\n') + ENDIF + ENDSELECT + ReplyMsg(imsg) + ENDWHILE + ENDWHILE +EXCEPT DO + IF window THEN CloseWindow(window) + closeall() + SELECT exception + CASE ERR_LIB; WriteF('Error: could not open keymap library\n') + CASE ERR_WIN; WriteF('Error: could not open window\n') + CASE "MEM"; WriteF('Error: ran out of memory\n') + ENDSELECT +ENDPROC +->>> + +->>> PROC openall() +PROC openall() + keymapbase:=OpenLibrary('keymap.library', 37) +ENDPROC +->>> + +->>> PROC closeall() +PROC closeall() + IF keymapbase THEN CloseLibrary(keymapbase) +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/dpieee.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/dpieee.e new file mode 100644 index 0000000..0b7d984 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/dpieee.e @@ -0,0 +1,29 @@ +-> dpieee.e - Math DP IEEE example of dTst(). + +->>> Header (globals) +MODULE 'tools/longreal' + +CONST STRSIZE=20 +CONST FRACTSIZE=STRSIZE-8 +->>> + +->>> PROC main() +PROC main() HANDLE + -> E-Note: use the longreals from 'tools/longreal' for double precision IEEE + DEF num1:longreal, result, six:longreal, s[STRSIZE]:STRING + dInit(FALSE) -> E-Note: only use mathieeedoubbas library + dDiv(dPi(num1), dFloat(-6,six), num1) -> -30 degrees in radians + -> E-Note: or alternatively use dInit(TRUE) and dRad(dFloat(-30,num1), num1) + + result:=dTst(num1) + WriteF('Num1 = \s and result = \d\n', dFormat(s, num1, FRACTSIZE), result) + +EXCEPT DO + dCleanup() + SELECT exception + CASE "DLIB"; WriteF('Error: could not open mathieeedoubbas library\n') + ENDSELECT +ENDPROC +->>> + + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/dptrans.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/dptrans.e new file mode 100644 index 0000000..542bf1d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/dptrans.e @@ -0,0 +1,31 @@ +-> dptrans.e - Math Double-Precision Transcendental example of dSin(). + +->>> Header (globals) +MODULE 'tools/longreal' + +CONST STRSIZE=20 +CONST FRACTSIZE=STRSIZE-8 +->>> + +->>> PROC main() +PROC main() HANDLE + -> E-Note: use the longreals from 'tools/longreal' for double precision IEEE + DEF num1:longreal, result:longreal, four:longreal, s[STRSIZE]:STRING + dInit() + dDiv(dPi(num1), dFloat(4, four), num1) + -> E-Note: or alternatively use dRad(dFloat(45, num1), num1) + + dSin(num1, result) + WriteF('The double precision sine of 45 degrees is \s\n', + dFormat(s, result, FRACTSIZE)) + +EXCEPT DO + dCleanup() + SELECT exception + CASE "DLIB"; WriteF('Error: could not open mathieeedoubbas library\n') + ENDSELECT +ENDPROC +->>> + + + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/spieee.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/spieee.e new file mode 100644 index 0000000..008c966 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/spieee.e @@ -0,0 +1,32 @@ +-> spieee.e - Math SP IEEE example of SPMul(). + +->>> Header (globals) +MODULE 'mathieeesingbas' + +ENUM ERR_NONE, ERR_LIB + +RAISE ERR_LIB IF OpenLibrary()=NIL + +CONST STRSIZE=10, ACC=5 +->>> + +->>> PROC main() +PROC main() HANDLE + -> E-Note: IEEE single is the format used for reals in E + DEF mul1=-3.6, mul2=18.7 -> 3.6 multiplied by 18.7 + DEF result, s[STRSIZE]:STRING + mathieeesingbasbase:=OpenLibrary('mathieeesingbas.library', 34) + result:=IeeeSPMul(mul1, mul2) + -> E-Note: alternatively, no need to open library, use: result:=!mul1*mul2 + WriteF(RealF(s, mul1, ACC)) + WriteF(' multiplied by ') + WriteF(RealF(s, mul2, ACC)) + WriteF(' = \s\n', RealF(s, result, ACC)) +EXCEPT DO + IF mathieeesingbasbase THEN CloseLibrary(mathieeesingbasbase) + SELECT exception + CASE ERR_LIB; WriteF('Error: could not open mathieeesingbas library\n') + ENDSELECT +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/sptrans.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/sptrans.e new file mode 100644 index 0000000..7ac3cf5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Math/sptrans.e @@ -0,0 +1,30 @@ +-> sptrans.e - Math SP IEEE Transcendental example of SPCos(). + +->>> Header (globals) +MODULE 'mathieeesingtrans' + +ENUM ERR_NONE, ERR_LIB + +RAISE ERR_LIB IF OpenLibrary()=NIL + +CONST STRSIZE=10, ACC=5 +->>> + +->>> PROC main() +PROC main() HANDLE + -> E-Note: IEEE single is the format used for reals in E + -> E-Note: C version gets it wrong: 30 degrees in radians is PI/6=0.52359878 + DEF num1=0.52359878, result, s[STRSIZE]:STRING + mathieeesingtransbase:=OpenLibrary('mathieeesingtrans.library', 34) + result:=IeeeSPCos(num1) + -> E-Note: alternatively, no need to open library, use: result:=Fcos(num1) + WriteF('The single precision cosine of 30 degrees is \s\n', + RealF(s, result, ACC)) +EXCEPT DO + IF mathieeesingtransbase THEN CloseLibrary(mathieeesingtransbase) + SELECT exception + CASE ERR_LIB; WriteF('Error: could not open mathieeesingtrans library\n') + ENDSELECT +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Preferences/prefnotify.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Preferences/prefnotify.e new file mode 100644 index 0000000..cb289ca --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Preferences/prefnotify.e @@ -0,0 +1,57 @@ +-> prefnotify.e - Notified if serial prefs change +OPT PREPROCESS + +MODULE 'dos/dos', + 'dos/notify' + +ENUM ERR_NONE, ERR_KICK, ERR_NOTIFY, ERR_SIGNAL + +RAISE ERR_NOTIFY IF StartNotify()<>DOSTRUE, + ERR_SIGNAL IF AllocSignal()=255 + +#define PREFSFILENAME 'ENV:sys/serial.prefs' + +PROC main() HANDLE + DEF done=FALSE, notifyrequest=NIL:PTR TO notifyrequest, + signum=255, signals + -> We need at least V37 for notification + IF KickVersion(37)=FALSE THEN Raise(ERR_KICK) + -> Allocate a NotifyRequest structure + NEW notifyrequest + -> And allocate signalsbit + signum:=AllocSignal(-1) + -> Initialise notification request + notifyrequest.name:=PREFSFILENAME + notifyrequest.flags:=NRF_SEND_SIGNAL + -> Signal this task... + notifyrequest.task:=FindTask(NIL) + + -> ... with this signals bit + notifyrequest.signalnum:=signum + + StartNotify(notifyrequest) + WriteF('Select Serial Prefs SAVE or USE to notify this program\n') + WriteF('CTRL-C to exit\n\n') + -> Loop until Ctrl-C to exit + REPEAT + signals:=Wait(Shl(1, signum) OR SIGBREAKF_CTRL_C) + IF signals AND Shl(1, signum) + WriteF('Notification signal received.\n') + ENDIF + IF signals AND SIGBREAKF_CTRL_C + EndNotify(notifyrequest) + done:=TRUE + ENDIF + UNTIL done +EXCEPT DO + IF signum<>255 THEN FreeSignal(signum) + IF notifyrequest THEN END notifyrequest -> E-Note: not really necessary... + SELECT exception + CASE ERR_KICK; WriteF('Requires at least V37\n') + CASE ERR_NOTIFY; WriteF('Can''t start notification\n') + CASE ERR_SIGNAL; WriteF('No signals available\n') + CASE "MEM"; WriteF('Not enough memory for NotifyRequest.\n') + ENDSELECT +ENDPROC + +verstag: CHAR 0, '$VER: prefnot 37.1 (09.07.91)', 0 \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Preferences/showprefs.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Preferences/showprefs.e new file mode 100644 index 0000000..7418d0d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Preferences/showprefs.e @@ -0,0 +1,137 @@ +-> showprefs.e - Parse and show some info from an IFF Preferences file +-> E-Note: ignore the rubbish (in the C version) about startup code + +MODULE 'iffparse', + 'devices/timer', + 'dos/dos', + 'graphics/text', + 'libraries/iffparse', + 'prefs/font', + 'prefs/icontrol', + 'prefs/input', + 'prefs/overscan', + 'prefs/printergfx', + 'prefs/printertxt', + 'prefs/prefhdr', + 'prefs/screenmode', + 'prefs/serial' + +ENUM ERR_NONE, ERR_IFF, ERR_LIB, ERR_OPEN, ERR_RDARGS, TOTAL_ERRS + +-> E-Note: the use of exceptions is carefully balanced +RAISE ERR_IFF IF AllocIFF()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_OPEN IF Open()=NIL, + ERR_RDARGS IF ReadArgs()=NIL + +PROC main() HANDLE + DEF readargs=NIL, rargs[2]:ARRAY OF LONG, iffhandle=NIL:PTR TO iffhandle, + filename=NIL, error, rc=RETURN_OK, iffErrTxt:PTR TO LONG + + iffparsebase:=OpenLibrary('iffparse.library', 37) + + readargs:=ReadArgs('FILE/A', rargs, NIL) + IF filename:=rargs[0] + -> Allocate an IFF handle + iffhandle:=AllocIFF() + -> Open the file for reading + iffhandle.stream:=Open(filename, OLDFILE) + -> Initialise the iff handle + InitIFFasDOS(iffhandle) + IF (error:=OpenIFF(iffhandle, IFFF_READ))=0 + PropChunk(iffhandle, ID_PREF, ID_PRHD) + + PropChunk(iffhandle, ID_PREF, ID_FONT) + PropChunk(iffhandle, ID_PREF, ID_ICTL) + PropChunk(iffhandle, ID_PREF, ID_INPT) + PropChunk(iffhandle, ID_PREF, ID_OSCN) + PropChunk(iffhandle, ID_PREF, ID_PGFX) + PropChunk(iffhandle, ID_PREF, ID_PTXT) + PropChunk(iffhandle, ID_PREF, ID_SCRM) + PropChunk(iffhandle, ID_PREF, ID_SERL) + + -> E-Note: handle the funny loop more cleanly using a separate procedure + REPEAT + UNTIL error:=parse(iffhandle) + ENDIF + CloseIFF(iffhandle) + IF error<>IFFERR_EOF + iffErrTxt:=['EOF', 'EOC', 'no lexical scope', 'insufficient memory', + 'stream read error','stream write error','stream seek error', + 'file corrupt', 'IFF syntax error', 'not an IFF file', + 'required call-back hook missing', NIL] + WriteF('\s: \s\n', rargs[], iffErrTxt[-error-1]) + rc:=RETURN_FAIL + ENDIF + ENDIF +EXCEPT DO + SELECT TOTAL_ERRS OF exception + CASE ERR_OPEN, ERR_RDARGS + error:=IoErr() + SetIoErr(error) + IF error + rc:=RETURN_FAIL + PrintFault(error, IF filename THEN filename ELSE '') + ENDIF + CASE ERR_IFF; WriteF('Can''t allocate IFF handle\n') + CASE ERR_LIB; WriteF('Can''t open iffparse.library\n') + ENDSELECT + IF iffhandle THEN FreeIFF(iffhandle) + IF readargs THEN FreeArgs(readargs) + IF iffparsebase THEN CloseLibrary(iffparsebase) +ENDPROC rc + +-> E-Note: handle the funny loop more cleanly using a separate procedure +PROC parse(iffhandle) + DEF ifferror, sp:PTR TO storedproperty, hdrsp, cnode:PTR TO contextnode + IF ifferror:=ParseIFF(iffhandle, IFFPARSE_STEP) + RETURN IF ifferror=IFFERR_EOC THEN 0 ELSE ifferror + ENDIF + + -> Do nothing if this is a PrefHeader chunk; we'll pop it later when there + -> is a pref chunk. + IF cnode:=CurrentChunk(iffhandle) + IF (cnode.id=ID_PRHD) OR (cnode.id=ID_FORM) THEN RETURN 0 + ENDIF + + -> Get the preferences header, stored previously + hdrsp:=FindProp(iffhandle, ID_PREF, ID_PRHD) + + IF sp:=FindProp(iffhandle, ID_PREF, ID_FONT) + WriteF('FrontPen: \d\n', sp.data::fontprefs.frontpen) + WriteF('BackPen: \d\n', sp.data::fontprefs.backpen) + WriteF('Font: \s\n', sp.data::fontprefs.name) + WriteF('YSize: \d\n', sp.data::fontprefs.textattr.ysize) + WriteF('Style: \d\n', sp.data::fontprefs.textattr.style) + WriteF('Flags: \d\n', sp.data::fontprefs.textattr.flags) + ELSEIF sp:=FindProp(iffhandle, ID_PREF, ID_ICTL) + WriteF('TimeOut: \d\n', sp.data::icontrolprefs.timeout) + WriteF('MetaDrag: \d\n', sp.data::icontrolprefs.metadrag) + WriteF('WBtoFront: \d\n', sp.data::icontrolprefs.wbtofront) + WriteF('FrontToBack: \d\n', sp.data::icontrolprefs.fronttoback) + WriteF('ReqTrue: \d\n', sp.data::icontrolprefs.reqtrue) + WriteF('ReqFalse: \d\n', sp.data::icontrolprefs.reqfalse) + -> Etc. + ELSEIF sp:=FindProp(iffhandle, ID_PREF, ID_INPT) + WriteF('PointerTicks: \d\n', sp.data::inputprefs.pointerticks) + WriteF('DoubleClick/Secs: \d\n', sp.data::inputprefs.doubleclick.secs) + WriteF('DoubleClick/Micro: \d\n', sp.data::inputprefs.doubleclick.micro) + -> Etc. + ELSEIF sp:=FindProp(iffhandle, ID_PREF, ID_OSCN) + WriteF('DisplayID: $\h\n', sp.data::overscanprefs.displayid) + -> Etc. + ELSEIF sp:=FindProp(iffhandle, ID_PREF, ID_PGFX) + WriteF('Aspect: \d\n', sp.data::printergfxprefs.aspect) + -> Etc. + ELSEIF sp:=FindProp(iffhandle, ID_PREF, ID_PTXT) + WriteF('Driver: \s\n', sp.data::printertxtprefs.driver) + -> Etc. + ELSEIF sp:=FindProp(iffhandle, ID_PREF, ID_SCRM) + WriteF('DisplayID: $\h\n', sp.data::screenmodeprefs.displayid) + -> Etc. + ELSEIF sp:=FindProp(iffhandle, ID_PREF, ID_SERL) + WriteF('BaudRate: \d\n', sp.data::serialprefs.baudrate) + -> Etc. + ENDIF + RETURN 0 +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/README b/amigae33a/E_v3.3a/Src/Src/Rkrm/README new file mode 100644 index 0000000..186a128 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/README @@ -0,0 +1,41 @@ +Short: E versions of RKRM examples (Part One and Two) +Author: m88jrh@ecs.ox.ac.uk (Jason R. Hulance) + +JRH's RKRM Examples (Part One and Two) +====================================== + +This archive contains translations of all the examples from the following +chapters of the RKRM (Libraries): ASL, Commodities, Exec, GadTools, +Intuition, Preferences, Workbench, Expansion, Graphics (all the corresponding +chapters), IFFParse, Keymap, Math (minus the FFP examples) and Utility. Also +included are translations of all the Resource, Clipboard and Console examples +from the RKRM (Devices). + +The examples retain most of the original comments, with comments specific to +these E versions beginning "-> E-Note:". A lot of effort has been put into +showing how to effectively use E features such as exceptions and lists. +A number of bugs in the original examples have also been eliminated. + +If you are new to E you should pay special attention to the effect of using +exceptions: error handling is and clean-up is neatly separated from the main +code, and the code is generally much less indented. You should also notice +the special care taken to initialise variables appropriately so that +clean-up is made much more simple in the handlers. + +If you wish to recompile the sources (I expect you might...), you will need +my Typed Modules (V40), my AmigaLib modules and my Useful modules. These +archives should all be available where you found this archive (Aminet? In +'dev/e'?). [note: these are all included in the 'Modules' directory of +this distribution -wouter] + +These executables, E sources and E modules are all Copyright (C) 1995, +Jason R. Hulance. +The original RKRM examples are Copyright (C) 1992, Commodore-Amiga Inc. + +You are free to use the files in this archive to help create your own +programs (whether they are freeware or commercial), but if you wish to +distribute any part of this archive you must include it all, unmodified, +and with this file. + +(Hopefully, there will be a Part Three which will contain the remainder of the +RKRM examples.) diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Allocate_Misc.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Allocate_Misc.e new file mode 100644 index 0000000..189b57c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Allocate_Misc.e @@ -0,0 +1,47 @@ +-> Allocate_Misc.e +-> +-> Example of allocating a miscellaneous resource. We will allocate the serial +-> resource and wait until CTRL-C is pressed. While we are waiting, the +-> Query_Serial program should be run. It will try to open the serial device +-> and if unsuccessful, will return the name of the owner. It will be us! + +-> E-Note: E does not (as of v3.1a) support Resources in the conventional way +MODULE 'other/misc', + 'dos/dos', + 'resources/misc' + +ENUM ERR_NONE, ERR_BITS, ERR_PORT + +PROC main() HANDLE + -> E-Note: to help with cleaning up "owner" has been split into "portowner" + -> and "bitsowner" which are initialised to non-NIL values + DEF portowner=-1, bitsowner=-1 -> Owner of misc resource + + miscbase:=OpenResource('misc.resource') + + -> Allocate both pieces of the serial hardware + IF portowner:=allocMiscResource(MR_SERIALPORT, 'Serial Port Hog') + Raise(ERR_PORT) + ENDIF + IF bitsowner:=allocMiscResource(MR_SERIALBITS, 'Serial Port Hog') + Raise(ERR_BITS) + ENDIF + + -> Wait for CTRL-C to be pressed + WriteF('\nWaiting for CTRL-C...\n') + Wait(SIGBREAKF_CTRL_C) + + -> We're back + +EXCEPT DO + -> Deallocate the serial port register + IF bitsowner=NIL THEN freeMiscResource(MR_SERIALBITS) + -> Deallocate the serial port + IF portowner=NIL THEN freeMiscResource(MR_SERIALPORT) + SELECT exception + CASE ERR_BITS + WriteF('Unable to allocate MR_SERIALBITS because \s owns it\n', bitsowner) + CASE ERR_PORT + WriteF('Unable to allocate MR_SERIALPORT because \s owns it\n', portowner) + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/CIA_interval.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/CIA_interval.e new file mode 100644 index 0000000..4d086d9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/CIA_interval.e @@ -0,0 +1,271 @@ +-> Cia_Interval.e - Demonstrate allocation and use of a cia interval timer + +OPT PREPROCESS + +-> E-Note: we need eCodeIntServer() in order to use an E PROC as a CIA interrupt +MODULE 'other/cia', + 'other/ecode', + 'exec/interrupts', + 'exec/libraries', + 'exec/nodes', + 'exec/tasks', + 'hardware/cia', + 'resources/cia' + +ENUM ERR_NONE, ERR_ECODE, ERR_SIG, ERR_TIMER + +CONST COUNTDOWN=20, HICOUNT=$FF, LOCOUNT=$FF + +CONST STOPA_AND=CIACRAF_TODIN OR CIACRAF_PBON OR + CIACRAF_OUTMODE OR CIACRAF_SPMODE + -> + -> AND mask for use with control register A + -> (interval timer A on either CIA) + -> + -> STOP - + -> START bit 0 == 0 (STOP IMMEDIATELY) + -> PBON bit 1 == same + -> OUT bit 2 == same + -> RUN bit 3 == 0 (SET CONTINUOUS MODE) + -> LOAD bit 4 == 0 (NO FORCE LOAD) + -> IN bit 5 == 0 (COUNTS 02 PULSES) + -> SP bit 6 == same + -> TODIN bit 7 == same (unused on ciacra) + +CONST STOPB_AND=CIACRBF_ALARM OR CIACRBF_PBON OR CIACRBF_OUTMODE + -> + -> AND mask for use with control register B + -> (interval timer B on either CIA) + -> + -> STOP - + -> START bit 0 == 0 (STOP IMMEDIATELY) + -> PBON bit 1 == same + -> OUT bit 2 == same + -> RUN bit 3 == 0 (SET CONTINUOUS MODE) + -> LOAD bit 4 == 0 (NO FORCE LOAD) + -> IN0 bit 5 == 0 (COUNTS 02 PULSES) + -> IN1 bit 6 == 0 (COUNTS 02 PULSES) + -> ALARM bit 7 == same (TOD alarm control bit) + +CONST STARTA_OR=CIACRAF_START + -> + -> OR mask for use with control register A + -> (interval timer A on either CIA) + -> + -> START - + -> + -> START bit 0 == 1 (START TIMER) + -> + -> All other bits unaffected. + +CONST STARTB_OR=CIACRBF_START + -> + -> OR mask for use with control register B + -> (interval timer A on either CIA) + -> + -> START - + -> + -> START bit 0 == 1 (START TIMER) + -> + -> All other bits unaffected. + +-> Structure which will be used to hold all relevant information about cia +-> timer we manage to allocate. +OBJECT freetimer + ciabase -> CIA Library Base + timerbit -> Timer bit allocated + cia -> Pointer to hardware + ciacr:PTR TO CHAR -> Pointer to control register + cialo:PTR TO CHAR -> Pointer to low byte of timer + ciahi:PTR TO CHAR -> Pointer to high byte of timer + timerint:is -> Interrupt structure + stopmask:CHAR -> Stop/set-up timer + startmask:CHAR -> Start timer +ENDOBJECT + +-> Structure which will be used by the interrupt routine called when our +-> cia interval timer generates an interrupt. +OBJECT exampledata + task -> Task to signal + signal -> Signal bit to use + counter +ENDOBJECT + +DEF ciaa=CIAA_ADDR:PTR TO cia, ciab=CIAB_ADDR:PTR TO cia + +-> This is the interrupt routine which will be called when our CIA interval +-> timer counts down. +-> +-> This example decrements a counter each time the interrupt routine is called +-> until the counter reaches 0, at which time it signals our main task. +-> +-> Note that interrupt handling code should be efficient, and will generally be +-> written in assembly code. Signaling another task such as this example does +-> is also a useful way of handling interrupts in an expedient manner. +-> E-Note: thanks to eCodeIntServer() we get ft.timerint.data as an argument +PROC exampleInterrupt(ed:PTR TO exampledata) + IF ed.counter + ed.counter:=ed.counter-1 -> Decrement counter + ELSE + ed.counter:=COUNTDOWN -> Reset counter + Signal(ed.task, Shl(1, ed.signal)) + ENDIF +ENDPROC + +PROC main() HANDLE + DEF ft:freetimer, ed:exampledata + + -> Set up data which will be passed to interrupt + ed.task:=FindTask(NIL) + + -> E-Note: C version doesn't check the return value properly + ed.signal:=AllocSignal(-1) + IF ed.signal=-1 THEN Raise(ERR_SIG) + + -> Prepare freetimer object: set-up interrupt + ft.timerint.ln.type:=NT_INTERRUPT + ft.timerint.ln.pri:=0 + ft.timerint.ln.name:='cia_example' + + ft.timerint.data:=ed + -> E-Note: eCodeIntServer() wraps an E PROC for use as a CIA interrupt + ft.timerint.code:=eCodeIntServer({exampleInterrupt}) + IF ft.timerint.code=NIL THEN Raise(ERR_ECODE) + + -> Call function to find a free CIA interval timer with flag indicating + -> that we prefer a CIA-A timer. + WriteF('Attempting to allocate a free timer\n') + + findFreeTimer(ft, TRUE) + + WriteF('CIA-\c timer ', IF ft.cia=ciaa THEN "A" ELSE "B") + + WriteF('\c allocated\n', IF ft.timerbit=CIAICRB_TA THEN "A" ELSE "B") + + -> We found a free interval timer. Let's start it running. + startTimer(ft, ed) + + -> Wait for a signal + WriteF('Waiting for signal bit \d\n', ed.signal) + + Wait(Shl(1, ed.signal)) + + WriteF('We woke up!\n') + + -> Release the interval timer + remICRVector(ft.ciabase, ft.timerbit, ft.timerint) + +EXCEPT DO + IF ed.signal<>-1 THEN FreeSignal(ed.signal) + SELECT exception + CASE ERR_ECODE; WriteF('Ran out of memory in eCodeIntServer()\n') + CASE ERR_SIG; WriteF('Could not allocate signal\n') + CASE ERR_TIMER; WriteF('No CIA interval timer available\n') + ENDSELECT +ENDPROC + +-> This routine sets up the interval timer we allocated with addICRVector(). +-> Note that we may have already received one, or more interrupts from our +-> timer. Make no assumptions about the initial state of any of the hardware +-> registers we will be using. +PROC startTimer(ft:PTR TO freetimer, ed:PTR TO exampledata) + DEF cia:PTR TO cia + cia:=ft.cia + + -> Note that there are differences between control register A, and B on + -> each CIA (e.g., the TOD alarm bit, and INMODE bits). + IF ft.timerbit=CIAICRB_TA + -> E-Note: use offsets to get addresses of the CIA bytes + ft.ciacr:=cia+CIACRA -> Control register A + ft.cialo:=cia+CIATALO -> Low byte counter + ft.ciahi:=cia+CIATAHI -> High byte counter + + ft.stopmask:=STOPA_AND -> Set-up mask values + ft.startmask:=STARTA_OR + ELSE + ft.ciacr:=cia+CIACRB -> Control register B + ft.cialo:=cia+CIATBLO -> Low byte counter + ft.ciahi:=cia+CIATBHI -> High byte counter + + ft.stopmask:=STOPB_AND -> Set-up mask values + ft.startmask:=STARTB_OR + ENDIF + + -> Modify control register within Disable(). This is done to avoid race + -> conditions since code like this will be generated: + -> + -> value = Read hardware byte + -> AND value with MASK + -> Write value to hardware byte + -> + -> If we take a task switch in the middle of this sequence, two tasks trying + -> to modify the same register could trash each others' bits. + -> + -> Normally this code would be written in Assembly language using atomic + -> instructions so that the Disable() would not be needed. + + Disable() + -> STOP timer, set 02 pulse count-down mode, set continuous mode + ft.ciacr[]:=ft.ciacr[] AND ft.stopmask + Enable() + + -> Clear signal bit - interrupt will signal us later + SetSignal(NIL, Shl(1, ed.signal)) + + -> Count-down X number of times + ed.counter:=COUNTDOWN + + -> Start the interval timer - we will start the counter after writing the + -> low, and high byte counter values. + ft.cialo[]:=LOCOUNT + ft.ciahi[]:=HICOUNT + + -> Turn on start bit - same bit for both A, and B control regs + Disable() + ft.ciacr[]:=ft.ciacr[] OR ft.startmask + Enable() +ENDPROC + +-> A routine to find a free interval timer. +-> +-> This routine makes no assumptions about which interval timers (if any) are +-> available for use. Currently there are two interval timers per CIA chip. +-> +-> Because CIA usage may change in the future, your code should use a routine +-> like this to find a free interval timer. +-> +-> Note that the routine takes a preference flag (which is used to indicate +-> that you would prefer an interval timer on CIA-A). If the flag is FALSE, +-> it means that you would prefer an interval timer on CIA-B. +PROC findFreeTimer(ft:PTR TO freetimer, preferA) + DEF ciaabase, ciabbase + + -> Get pointers to both Resource bases + ciaabase:=OpenResource(CIAANAME) + ciabbase:=OpenResource(CIABNAME) + + -> Try for a CIA-A timer first? + ft.ciabase:=IF preferA THEN ciaabase ELSE ciabbase -> Library address + ft.cia:=IF preferA THEN ciaa ELSE ciab -> Hardware address + + IF tryTimer(ft) THEN RETURN + + -> Try for an interval timer on the other cia + ft.ciabase:=IF preferA THEN ciabbase ELSE ciaabase -> Library address + ft.cia:=IF preferA THEN ciab ELSE ciaa -> Hardware address + + IF tryTimer(ft)=FALSE THEN Raise(ERR_TIMER) +ENDPROC + +-> Try to obtain a free interval timer on a CIA. +PROC tryTimer(ft:PTR TO freetimer) + IF NIL=addICRVector(ft.ciabase, CIAICRB_TA, ft.timerint) + ft.timerbit:=CIAICRB_TA + RETURN TRUE + ENDIF + + IF NIL=addICRVector(ft.ciabase, CIAICRB_TB, ft.timerint) + ft.timerbit:=CIAICRB_TB + RETURN TRUE + ENDIF +ENDPROC FALSE diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Get_Disk_Unit_ID.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Get_Disk_Unit_ID.e new file mode 100644 index 0000000..f3b20df --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Get_Disk_Unit_ID.e @@ -0,0 +1,26 @@ +-> Get_Disk_Unit_ID.e - Example of getting the UnitID of a disk + +OPT PREPROCESS + +-> E-Note: E does not (as of v3.1a) support Resources in the conventional way +MODULE 'other/disk', + 'resources/disk' + +PROC main() + DEF ids, type + IF NIL=(diskbase:=OpenResource(DISKNAME)) + WriteF('Cannot open \s\n', DISKNAME) -> E-Note: big typo in C version + ELSE + WriteF('Defined drive types are:\n') + WriteF(' AMIGA $00000000\n') + WriteF(' 5.25" $55555555\n') + WriteF(' AMIGA $00000000 (high density)\n') -> Commodore-only product + WriteF(' None $FFFFFFFF\n\n') + + -> What are the UnitIDs? + FOR ids:=0 TO 3 + type:=getUnitID(ids) + WriteF('The UnitID for unit \d is $\z\h[8]\n', ids, type) + ENDFOR + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Get_Filesys.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Get_Filesys.e new file mode 100644 index 0000000..030f127 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Get_Filesys.e @@ -0,0 +1,38 @@ +-> Get_Filesys.e - Example of examining the FileSysRes list + +OPT PREPROCESS + +MODULE 'exec/lists', + 'exec/nodes', + 'resources/filesysres' + +DEF filesysresbase:PTR TO filesysresource + +PROC main() + DEF fse:PTR TO filesysentry, x + -> NOTE - you should actually be in a Forbid while accessing any system list + -> for which no other method of arbitration is available. However, for this + -> example we will be printing the information (which would break a Forbid + -> anyway) so we won't Forbid. In real life, you should Forbid, copy the + -> information you need, Permit, then print the info. + IF NIL=(filesysresbase:=OpenResource(FSRNAME)) + WriteF('Cannot open \s\n', FSRNAME) + ELSE + fse:=filesysresbase.filesysentries.head + WHILE fse.ln.succ + -> An A3000 running V34 does not have the name field filled in. + -> An A2000 running V34 with an A590/2091 controller also does not have + -> the name field filled in. + IF fse.ln.name THEN WriteF('Found filesystem creator: \s\n', fse.ln.name) + + WriteF(' DosType: ') + FOR x:=24 TO 8 STEP -8 DO Out(stdout, Shr(fse.dostype,x) AND $FF) + + Out(stdout, (fse.dostype AND $FF)+$30) + + WriteF('\n Version: \d', Shr(fse.version, 16)) + WriteF('.\d\n\n', fse.version AND $FFFF) + fse:=fse.ln.succ + ENDWHILE + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Query_Serial.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Query_Serial.e new file mode 100644 index 0000000..c909a2e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Query_Serial.e @@ -0,0 +1,60 @@ +-> Query_Serial.e - Try to open the serial device and if unsuccessful, +-> return the name of the owner. + +OPT PREPROCESS -> E-Note: we are using the NAME macros + +-> E-Note: E does not (as of v3.1a) support Resources in the conventional way +MODULE 'amigalib/io', + 'amigalib/ports', + 'other/misc', + 'devices/serial', + 'dos/dos', + 'exec/io', + 'resources/misc' + +ENUM ERR_NONE, ERR_CRIO, ERR_PORT + +CONST UNIT_NUMBER=0 + +DEF serialMP=NIL, serialIO=NIL:PTR TO ioextser + +PROC main() HANDLE + DEF status, -> Return value of SDCMD_QUERY + user -> Name of serial port owner if not us + + IF NIL=(serialMP:=createPort(NIL, NIL)) THEN Raise(ERR_PORT) + IF NIL=(serialIO:=createExtIO(serialMP, SIZEOF ioextser)) THEN Raise(ERR_CRIO) + IF OpenDevice(SERIALNAME, UNIT_NUMBER, serialIO, 0) + WriteF('\n\s did not open', SERIALNAME) + + miscbase:=OpenResource(MISCNAME) + + -> Find out who has the serial device + IF NIL=(user:=allocMiscResource(MR_SERIALPORT, 'Us')) + WriteF('\n') + freeMiscResource(MR_SERIALPORT) + ELSE + WriteF(' because \s owns it\n\n', user) + ENDIF + ELSE + serialIO.iostd.command:=SDCMD_QUERY + SendIO(serialIO) -> Execute query + + status:=serialIO.status -> Store returned status + + WriteF('\t The serial port status is \h\n', status) + + AbortIO(serialIO) + WaitIO(serialIO) + + CloseDevice(serialIO) + ENDIF + +EXCEPT DO + IF serialIO THEN deleteExtIO(serialIO) + IF serialMP THEN deletePort(serialMP) + SELECT exception + CASE ERR_CRIO; WriteF('Can''t create IO request\n') + CASE ERR_PORT; WriteF('Can''t create message port\n') + ENDSELECT +ENDPROC IF exception<>ERR_NONE THEN RETURN_FAIL ELSE RETURN_OK diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Read_BattClock.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Read_BattClock.e new file mode 100644 index 0000000..c62a70d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Read_BattClock.e @@ -0,0 +1,63 @@ +-> Read_BattClock.e +-> +-> Example of reading the BattClock and converting its output to a useful +-> measure of time by calling the Amiga2Date() utility function. + +OPT PREPROCESS + +-> E-Note: E does not (as of v3.1a) support Resources in the conventional way +MODULE 'other/battclock', -> E-Note: swapping these two trips a bug in EC v3.1a + 'utility', + 'resources/battclock', + 'utility/date' + +ENUM ERR_NONE, ERR_LIB, ERR_RES + +RAISE ERR_LIB IF OpenLibrary()=NIL, + ERR_RES IF OpenResource()=NIL + +PROC main() HANDLE + DEF days:PTR TO LONG, months:PTR TO LONG, ampm, + amigaTime, myClock:clockdata + days:=['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', + 'Friday', 'Saturday'] + months:=['January', 'February', 'March', 'April', 'May', 'June', + 'July', 'August', 'September', 'October', 'November', 'December'] + + utilitybase:=OpenLibrary('utility.library', 33) + battclockbase:=OpenResource(BATTCLOCKNAME) + + -> Get number of seconds till now + amigaTime:=readBattClock() + + -> Convert to a ClockData structure + Amiga2Date(amigaTime, myClock) + + WriteF('\nRobin, tell everyone the BatDate and BatTime') + + -> Print the Date + WriteF('\n\nOkay Batman, the BatDate is ') + WriteF('\s, \s \d, \d', days[myClock.wday], months[myClock.month-1], + myClock.mday, myClock.year) + + -> Convert military time to normal time and set AM/PM + IF myClock.hour<12 + ampm:='AM' -> hour less than 12, must be morning + ELSE + ampm:='PM' -> hour greater than 12,must be night + myClock.hour:=myClock.hour-12 -> Subtract the extra 12 of military + ENDIF + + IF myClock.hour=0 THEN myClock.hour:=12 -> Don't forget the 12s + + -> Print the time + WriteF('\n the BatTime is ') + WriteF('\d:\z\d[2]:\z\d[2] \s\n\n', + myClock.hour, myClock.min, myClock.sec, ampm) +EXCEPT DO + IF utilitybase THEN CloseLibrary(utilitybase) + SELECT exception + CASE ERR_LIB; WriteF('Error: Could not open utility.library\n') + CASE ERR_RES; WriteF('Error: Unable to open the \s\n', BATTCLOCKNAME) + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Read_Potinp.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Read_Potinp.e new file mode 100644 index 0000000..3962b6d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Resources/Read_Potinp.e @@ -0,0 +1,65 @@ +-> Read_Potinp.e +-> +-> An example of using the potgo.resource to read pins 9 and 5 of port 1 +-> (the non-mouse port). This bypasses the gameport.device. When the right +-> or middle button on a mouse plugged into port 1 is pressed, the read value +-> will change. +-> +-> Use of port 0 (mouse) is unaffected. + +-> E-Note: E does not (as of v3.1a) support Resources in the conventional way +MODULE 'other/potgo', + 'dos/dos', + 'hardware/custom' + +ENUM ERR_NONE, ERR_POT, ERR_RES + +RAISE ERR_RES IF OpenResource()=NIL + +CONST OUTRY=$8000, DATRY=$4000, OUTRX=$2000, DATRX=$1000 + +DEF potbits, value + +PROC main() HANDLE + -> E-Note: set-up "custom" + DEF custom=CUSTOMADDR:PTR TO custom + + potgobase:=OpenResource('potgo.resource') + + -> Get the bits for the right and middle mouse buttons on the alternate + -> mouse port. + potbits:=allocPotBits(OUTRY OR DATRY OR OUTRX OR DATRX) + + IF potbits<>(OUTRY OR DATRY OR OUTRX OR DATRX) + freePotBits(potbits) + Raise(ERR_POT) + ENDIF + + -> Set all ones in the register (masked by potbits) + writePotgo($FFFFFFFF, potbits) + + WriteF('\n'+ + 'Plug a mouse into the second port. This program will indicate when\n'+ + 'the right or middle button (if the mouse is so equipped) is pressed.\n'+ + 'Stop the program with Control-C. Press return now to begin.\n') + -> E-Note: stdout is valid (we've used WriteF()), so try that if no stdin + Inp(IF stdin THEN stdin ELSE stdout) + + REPEAT + -> Read word at $DFF016 + value:=custom.potinp + + -> Show what was read (restricted to our allocated bits) + -> E-Note: use "\b" to prevent a linefeed, giving single line, fast update + WriteF('POTINP = $\h\b', value AND potbits) + UNTIL SIGBREAKF_CTRL_C AND SetSignal(0, 0) -> Until CTRL-C is pressed + WriteF('\n') + + freePotBits(potbits) + +EXCEPT DO + SELECT exception + CASE ERR_POT; WriteF('Pot bits are already allocated! \h\n', potbits) + CASE ERR_RES; WriteF('Could not open potgo.resource\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/a2d.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/a2d.e new file mode 100644 index 0000000..521b546 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/a2d.e @@ -0,0 +1,55 @@ +-> a2d.e + +->>> Header (globals) +MODULE 'timer', + 'utility', + 'devices/timer', + 'exec/io', + 'utility/date' + +ENUM ERR_NONE, ERR_DEV, ERR_LIB + +RAISE ERR_DEV IF OpenDevice()<>0, + ERR_LIB IF OpenLibrary()=NIL +->>> + +->>> PROC main() +PROC main() HANDLE + DEF clockdata:PTR TO clockdata, tr:PTR TO timerequest, tv:PTR TO timeval, + seconds, open_dev=FALSE + utilitybase:=OpenLibrary('utility.library', 37) + NEW tr, tv, clockdata + OpenDevice('timer.device', UNIT_VBLANK, tr, 0) + open_dev:=TRUE + timerbase:=tr.io.device + + GetSysTime(tv) + + WriteF('GetSysTime():\t\d \d\n', tv.secs, tv.micro) + + Amiga2Date(tv.secs, clockdata) + + WriteF('Amiga2Date(): sec \d min \d hour \d\n', + clockdata.sec, clockdata.min, clockdata.hour) + + WriteF(' mday \d month \d year \d wday \d\n', + clockdata.mday, clockdata.month, clockdata.year, clockdata.wday) + + seconds:=CheckDate(clockdata) + + WriteF('CheckDate():\t\d\n', seconds) + + seconds:=Date2Amiga(clockdata) + + WriteF('Date2Amiga():\t\d\n', seconds) +EXCEPT DO + IF open_dev THEN CloseDevice(tr) + END clockdata, tv, tr + IF utilitybase THEN CloseLibrary(utilitybase) + SELECT exception + CASE ERR_DEV; WriteF('Error: could not open timer device\n') + CASE ERR_LIB; WriteF('Error: could not open utility library\n') + CASE "MEM"; WriteF('Error: ran out of memory\n') + ENDSELECT +ENDPROC +->>> diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/hooks1.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/hooks1.e new file mode 100644 index 0000000..27d39bb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/hooks1.e @@ -0,0 +1,39 @@ +-> hooks1.e + +->>> Header (globals) +MODULE 'utility', + 'utility/hooks', + 'tools/installhook' + +ENUM ERR_NONE, ERR_LIB + +RAISE ERR_LIB IF OpenLibrary()=NIL +->>> + +->>> PROC myFunction(h:PTR TO hook, o, msg) +-> This function only prints out a message indicating that we are inside the +-> callback function. +PROC myFunction(h:PTR TO hook, o, msg) + -> E-Note: installhook has set-up access to data segment + WriteF('Inside myFunction()\n') +ENDPROC 1 +->>> + +->>> PROC main() +PROC main() HANDLE + DEF h:hook + -> Open the utility library + utilitybase:=OpenLibrary('utility.library', 36) + -> Initialise the callback hook + -> E-Note: use installhook to do the main stuff (so h.data cannot be used) + installhook(h, {myFunction}) + -> Use the utility library function to invoke the hook + CallHookPkt(h, NIL, NIL) +EXCEPT DO + IF utilitybase THEN CloseLibrary(utilitybase) + SELECT exception + CASE ERR_LIB; WriteF('Error: could not open utility library\n') + ENDSELECT +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/istr.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/istr.e new file mode 100644 index 0000000..316710a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/istr.e @@ -0,0 +1,39 @@ +-> istr.e + +->>> Header (globals) +MODULE 'utility' + +ENUM ERR_NONE, ERR_LIB + +RAISE ERR_LIB IF OpenLibrary()=NIL +->>> + +->>> PROC main() +PROC main() HANDLE + DEF butter, bread, ch1, ch2, result + butter:='Bøtervløøt' + bread:='Knåckerbrøt' + + utilitybase:=OpenLibrary('utility.library', 37) + + result:=Stricmp(butter, bread) + + WriteF('Comparing \s with \s yields \d\n', butter, bread, result) + + result:=Strnicmp(bread, butter, StrLen(bread)) + + WriteF('Comparing (with length) \s with \s yields \d\n', bread, butter, result) + + ch1:=ToUpper($E6) -> æ ASCII character 230 ae ligature + ch2:=ToLower($D0) -> Ð ASCII character 208 Icelandic Eth + + WriteF('Chars \c \c\n', ch1, ch2) +EXCEPT DO + -> E-Note: C version forgets to close the library! + IF utilitybase THEN CloseLibrary(utilitybase) + SELECT exception + CASE ERR_LIB; WriteF('Error: could not open utility library\n') + ENDSELECT +ENDPROC +->>> + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/tag1.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/tag1.e new file mode 100644 index 0000000..2aa2c4e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/tag1.e @@ -0,0 +1,74 @@ +-> tag1.e + +->>> Header (globals) +MODULE 'utility', + 'intuition/intuition', + 'utility/tagitem' + +ENUM ERR_NONE, ERR_LIB, ERR_TAG, ERR_WIN + +RAISE ERR_LIB IF OpenLibrary()=NIL, + ERR_TAG IF AllocateTagItems()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL +->>> + +->>> PROC main() +PROC main() HANDLE + DEF tags=NIL:PTR TO tagitem, win=NIL + KickVersion(37) + -> We need the utility library for this example + utilitybase:=OpenLibrary('utility.library', 37) + + -> ********************************************************************* + -> This section allocates a tag array, fills it in with values, and then + -> uses it. + -> ********************************************************************* + + -> Allocate a tag array + tags:=AllocateTagItems(7) + -> Fill in our tag array + tags[0].tag:=WA_WIDTH + tags[0].data:=320 + tags[1].tag:=WA_HEIGHT + tags[1].data:=50 + tags[2].tag:=WA_TITLE + tags[2].data:='RKM Tag Example 1' + tags[3].tag:=WA_IDCMP + tags[3].data:=IDCMP_CLOSEWINDOW + tags[4].tag:=WA_CLOSEGADGET + tags[4].data:=TRUE + tags[5].tag:=WA_DRAGBAR + tags[5].data:=TRUE + tags[6].tag:=TAG_DONE + + -> Open the window, using the tag attributes as the only description. + win:=OpenWindowTagList(NIL, tags) + -> Wait for an event to occur + WaitIMessage(win) + + -> Close the window now that we're done with it + CloseWindow(win) + win:=NIL -> E-Note: help with error trapping + + -> ********************************************************************* + -> This section builds a static tag list, and passes it to the function. + -> ********************************************************************* + + win:=OpenWindowTagList(NIL, + [WA_WIDTH, 320, + WA_HEIGHT, 50, + WA_TITLE, 'RKM Tag Example 1', + WA_IDCMP, IDCMP_CLOSEWINDOW, + WA_CLOSEGADGET, TRUE, + WA_DRAGBAR, TRUE, + TAG_DONE]) + -> Wait for an event to occur + WaitIMessage(win) +EXCEPT DO + IF win THEN CloseWindow(win) + IF tags THEN FreeTagItems(tags) + IF utilitybase THEN CloseLibrary(utilitybase) +ENDPROC +->>> + + diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/uptime.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/uptime.e new file mode 100644 index 0000000..8ccdcf4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Utility/uptime.e @@ -0,0 +1,54 @@ +-> uptime.e + +->>> Header (globals) +OPT PREPROCESS + +MODULE 'utility', + 'dos/dos', + 'dos/dosextens', + 'utility/date' + +ENUM ERR_NONE, ERR_INFO, ERR_LIB, ERR_LOCK + +RAISE ERR_INFO IF Info()<>DOSTRUE, + ERR_LIB IF OpenLibrary()=NIL, + ERR_LOCK IF Lock()=NIL +->>> + +->>> PROC main() +PROC main() HANDLE + DEF infodata=NIL:PTR TO infodata, ramdevice:PTR TO devlist, + now=NIL:PTR TO datestamp, currenttime, boottime, lock=NIL, d, h, m + utilitybase:=OpenLibrary('utility.library', 37) + NEW infodata, now + lock:=Lock('RAM:', SHARED_LOCK) + Info(lock, infodata) + -> E-Note: convert BCPL pointer + ramdevice:=BADDR(infodata.volumenode) + boottime:=Smult32(ramdevice.volumedate.days, 86400) + + Smult32(ramdevice.volumedate.minute, 60) + + SdivMod32(ramdevice.volumedate.tick, TICKS_PER_SECOND) + DateStamp(now) + currenttime:=Smult32(now.days, 86400) + + Smult32(now.minute, 60) + + SdivMod32(now.tick, TICKS_PER_SECOND) + currenttime:=currenttime-boottime + IF currenttime > 0 + -> E-Note: a multiple assignment gets the two UdivMod32() results + d,h:=UdivMod32(currenttime, 86400) + h,m:=UdivMod32(h, 3600) + m:=UdivMod32(m, 60) + WriteF('Up for \d days, \d hours, \d minutes\n', d, h, m) + ENDIF +EXCEPT DO + IF lock THEN UnLock(lock) + END now, infodata + IF utilitybase THEN CloseLibrary(utilitybase) + SELECT exception + CASE ERR_INFO; WriteF('Error: could not get info on lock\n') + CASE ERR_LIB; WriteF('Error: could not open utility library\n') + CASE ERR_LOCK; WriteF('Error: could not lock RAM:\n') + CASE "MEM"; WriteF('Error: ran out of memory\n') + ENDSELECT +ENDPROC +->>> diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/appicon.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/appicon.e new file mode 100644 index 0000000..5e1c96d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/appicon.e @@ -0,0 +1,80 @@ +-> appicon.e -- Show use of an AppIcon + +OPT OSVERSION=37 + +MODULE 'icon', + 'wb', + 'workbench/startup', + 'workbench/workbench' + +ENUM ERR_NONE, ERR_APPICON, ERR_DOBJ, ERR_LIB, ERR_PORT + +RAISE ERR_APPICON IF AddAppIconA()=NIL, + ERR_DOBJ IF GetDefDiskObject()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_PORT IF CreateMsgPort()=NIL + +PROC main() HANDLE + DEF dobj=NIL:PTR TO diskobject, myport=NIL, appicon=NIL, + appmsg:PTR TO appmessage, dropcount=0, x + -> Get the the right version of the Icon Library, initialise iconbase + iconbase:=OpenLibrary('icon.library', 37) + -> Get the the right version of the Workbench Library + workbenchbase:=OpenLibrary('workbench.library', 37) + -> This is the easy way to get some icon imagery + -> Real applications should use custom imagery + dobj:=GetDefDiskObject(WBDISK) + -> The type must be set to NIL for a WBAPPICON + dobj.type:=NIL + + -> The CreateMsgPort() function is in Exec version 37 and later only + myport:=CreateMsgPort() + -> Put the AppIcon up on the Workbench window + appicon:=AddAppIconA(0, 0, 'TestAppIcon', myport, NIL, dobj, NIL) + -> For the sake of this example, we allow the AppIcon to be activated + -> only five times. + WriteF('Drop files on the Workbench AppIcon\n') + WriteF('Example exits after 5 drops\n') + + WHILE dropcount<5 + -> Here's the main event loop where we wait for messages to show up + -> from the AppIcon + WaitPort(myport) + + -> Might be more than one message at the port... + WHILE appmsg:=GetMsg(myport) + IF appmsg.numargs=0 + -> If numargs is 0 the AppIcon was activated directly + WriteF('User activated the AppIcon.\n') + WriteF('A Help window for the user would be good here\n') + ELSEIF appmsg.numargs>0 + -> If numargs is >0 the AppIcon was activated by having one or more + -> icons dropped on top of it + WriteF('User dropped \d icons on the AppIcon\n', appmsg.numargs) + FOR x:=0 TO appmsg.numargs-1 + WriteF('#\d name="\s"\n', x+1, appmsg.arglist[x].name) + ENDFOR + ENDIF + -> Let Workbench know we're done with the message + ReplyMsg(appmsg) + ENDWHILE + INC dropcount + ENDWHILE + +EXCEPT DO + IF appicon THEN RemoveAppIcon(appicon) + IF myport + -> Clear away any messages that arrived at the last moment + WHILE appmsg:=GetMsg(myport) DO ReplyMsg(appmsg) + DeleteMsgPort(myport) + ENDIF + IF dobj THEN FreeDiskObject(dobj) + IF workbenchbase THEN CloseLibrary(workbenchbase) + IF iconbase THEN CloseLibrary(iconbase) + SELECT exception + CASE ERR_APPICON; WriteF('Error: Could not attach AppIcon to Workbench\n') + CASE ERR_DOBJ; WriteF('Error: Could not get default icon\n') + CASE ERR_LIB; WriteF('Error: Could not open required library\n') + CASE ERR_PORT; WriteF('Error: Could not create port\n') + ENDSELECT +ENDPROC \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/appmenuitem.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/appmenuitem.e new file mode 100644 index 0000000..968f37a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/appmenuitem.e @@ -0,0 +1,69 @@ +-> appmenuitem.e -- Show use of an AppMenuItem + +OPT OSVERSION=37 + +MODULE 'wb', + 'dos/dostags', + 'workbench/startup', + 'workbench/workbench' + +ENUM ERR_NONE, ERR_APPMENU, ERR_LIB, ERR_PORT + +RAISE ERR_APPMENU IF AddAppMenuItemA()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_PORT IF CreateMsgPort()=NIL + +PROC main() HANDLE + DEF myport=NIL, appitem=NIL, + appmsg=NIL:PTR TO appmessage, result, x, count=0, file + workbenchbase:=OpenLibrary('workbench.library', 37) + -> The CreateMsgPort() function is in Exec version 37 and later only + myport:=CreateMsgPort() + -> Add our own AppMenuItem to the Workbench Tools Menu + appitem:=AddAppMenuItemA(0, -> Our ID# for item + 'SYS:Utilities/More', -> Our UserData + 'Browse Files', -> MenuItem Text + myport, NIL) -> MsgPort, no tags + + WriteF('Select Workbench Tools demo menuitem "Browse Files"\n') + + -> For this example, we allow the AppMenuItem to be selected only once, + -> then we remove it and exit + WaitPort(myport) + WHILE (appmsg:=GetMsg(myport)) AND (count<1) + -> Handle messages from the AppMenuItem - we have only one item so we don't + -> have to check its appmsg.id number. We'll System() the command string + -> that we passed as userdata when we added the menu item. We find our + -> userdata pointer in appmsg.userdata + + WriteF('User picked AppMenuItem with \d icons selected\n', appmsg.numargs) + FOR x:=0 TO appmsg.numargs-1 + WriteF(' #\d name="\s"\n', x+1, appmsg.arglist[x].name) + ENDFOR + + INC count + IF file:=Open('CON:0/40/640/150/AppMenu Example/auto/close/wait', OLDFILE) + result:=SystemTagList(appmsg.userdata, [SYS_INPUT, file, + SYS_OUTPUT, NIL, + SYS_ASYNCH, TRUE, NIL]) + -> If Asynch System() itself fails, we must close file + IF result=-1 THEN Close(file) + ENDIF + ReplyMsg(appmsg) + ENDWHILE + +EXCEPT DO + IF appitem THEN RemoveAppMenuItem(appitem) + IF myport + -> Clear away any messages that arrived at the last moment + -> and let Workbench know we're done with the messages + WHILE appmsg:=GetMsg(myport) DO ReplyMsg(appmsg) + DeleteMsgPort(myport) + ENDIF + IF workbenchbase THEN CloseLibrary(workbenchbase) + SELECT exception + CASE ERR_APPMENU; WriteF('Error: Could not attach AppMenuItem to Workbench\n') + CASE ERR_LIB; WriteF('Error: Could not open workbench.library\n') + CASE ERR_PORT; WriteF('Error: Could not create port\n') + ENDSELECT +ENDPROC \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/appwindow.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/appwindow.e new file mode 100644 index 0000000..4dd3873 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/appwindow.e @@ -0,0 +1,76 @@ +-> appwindow.e -- Show use of an AppWindow + +OPT OSVERSION=37 + +MODULE 'wb', + 'exec/ports', + 'intuition/intuition', + 'workbench/startup', + 'workbench/workbench' + +ENUM ERR_NONE, ERR_APPWIN, ERR_LIB, ERR_PORT, ERR_WIN + +RAISE ERR_APPWIN IF AddAppWindowA()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_PORT IF CreateMsgPort()=NIL, + ERR_WIN IF OpenWindowTagList()=NIL + +PROC main() HANDLE + DEF awport=NIL:PTR TO mp, win=NIL:PTR TO window, appwin=NIL, + imsg:PTR TO intuimessage, amsg:PTR TO appmessage, argptr:PTR TO wbarg, + winsig, appwinsig, signals, id=1, userdata=0, done=FALSE, i + workbenchbase:=OpenLibrary('workbench.library', 37) + -> The CreateMsgPort() function is in Exec version 37 and later only + awport:=CreateMsgPort() + win:=OpenWindowTagList(NIL, [WA_WIDTH, 200, WA_HEIGHT, 50, + -> E-Note: C version uses obsolete flags + WA_IDCMP, IDCMP_CLOSEWINDOW, + WA_FLAGS, WFLG_CLOSEGADGET OR WFLG_DRAGBAR, + WA_TITLE, 'AppWindow', + NIL]) + appwin:=AddAppWindowA(id, userdata, win, awport, NIL) + WriteF('AppWindow added... Drag files into AppWindow\n') + winsig:=Shl(1, win.userport.sigbit) + appwinsig:=Shl(1, awport.sigbit) + REPEAT + -> Wait for IDCMP messages and AppMessages + signals:=Wait(winsig OR appwinsig) + + IF signals AND winsig -> Got an IDCMP message + WHILE imsg:=GetMsg(win.userport) + -> E-Note: C version uses obsolete flags + IF imsg.class=IDCMP_CLOSEWINDOW THEN done:=TRUE + ReplyMsg(imsg) + ENDWHILE + ENDIF + IF signals AND appwinsig -> Got an AppMessage + WHILE amsg:=GetMsg(awport) + WriteF('AppMsg: Type=\d, ID=\d, NumArgs=\d\n', + amsg.type, amsg.id, amsg.numargs) + argptr:=amsg.arglist + FOR i:=0 TO amsg.numargs-1 + WriteF(' arg(\d): Name="\s", Lock=\h\n', + i, argptr.name, argptr.lock) + argptr++ + ENDFOR + ReplyMsg(amsg) + ENDWHILE + ENDIF + UNTIL done + +EXCEPT DO + IF appwin THEN RemoveAppWindow(appwin) + IF win THEN CloseWindow(win) + IF awport + -> Make sure there are no more outstanding messages + WHILE amsg:=GetMsg(awport) DO ReplyMsg(amsg) + DeleteMsgPort(awport) + ENDIF + IF workbenchbase THEN CloseLibrary(workbenchbase) + SELECT exception + CASE ERR_APPWIN; WriteF('Error: Could not create AppWindow\n') + CASE ERR_LIB; WriteF('Error: Could not open required library\n') + CASE ERR_PORT; WriteF('Error: Could not create port\n') + CASE ERR_WIN; WriteF('Error: Could not open window\n') + ENDSELECT +ENDPROC \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/iconexample.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/iconexample.e new file mode 100644 index 0000000..a6e33a5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/iconexample.e @@ -0,0 +1,185 @@ +-> iconexample.e - Workbench icon startup, creation, and parsing example + +MODULE 'icon', + 'dos/dos', + 'intuition/intuition', + 'workbench/startup', + 'workbench/workbench' + +ENUM ERR_NONE, ERR_LIB, ERR_OPEN, ERR_WRITE, ERR_MAKE + +RAISE ERR_LIB IF OpenLibrary()=NIL, + ERR_OPEN IF Open()=NIL, + ERR_WRITE IF Write()=-1 + +DEF projIcon:diskobject + +PROC main() HANDLE + DEF wbenchMsg:PTR TO wbstartup, wbarg:PTR TO wbarg, file=NIL, i, olddir, + projname, deftoolname, iconImageData, iconGadget, toolTypes + projname:='RAM:Example_Project' + deftoolname:='iconexample' + toolTypes:=['FILETYPE=text', 'FLAGS=BOLD|ITALICS', NIL] + -> Plane 0 + iconImageData:=[$0000,$0000,$0000,$1000,$0000,$0000,$0000,$3000, + $0FFF,$FFFC,$0000,$3000,$0800,$0004,$0000,$3000, + $0800,$07FF,$FFC0,$3000,$08A8,$A400,$00A0,$3000, + $0800,$0400,$0090,$3000,$08AA,$A400,$0088,$3000, + $0800,$042A,$A0FC,$3000,$082A,$A400,$0002,$3000, + $0800,$0400,$0002,$3000,$0800,$A42A,$A0A2,$3000, + $0800,$0400,$0002,$3000,$0950,$A42A,$8AA2,$3000, + $0800,$0400,$0002,$3000,$082A,$A400,$0002,$3000, + $0800,$042A,$2AA2,$3000,$0FFF,$FC00,$0002,$3000, + $0000,$0400,$0002,$3000,$0000,$07FF,$FFFE,$3000, + $0000,$0000,$0000,$3000,$7FFF,$FFFF,$FFFF,$F000, + -> Plane 1 + $FFFF,$FFFF,$FFFF,$E000,$D555,$5555,$5555,$4000, + $D000,$0001,$5555,$4000,$D7FF,$FFF9,$5555,$4000, + $D7FF,$F800,$0015,$4000,$D757,$5BFF,$FF55,$4000, + $D7FF,$FBFF,$FF65,$4000,$D755,$5BFF,$FF75,$4000, + $D7FF,$FBD5,$5F01,$4000,$D7D5,$5BFF,$FFFD,$4000, + $D7FF,$FBFF,$FFFD,$4000,$D7FF,$5BD5,$5F5D,$4000, + $D7FF,$FBFF,$FFFD,$4000,$D6AF,$5BD5,$755D,$4000, + $D7FF,$FBFF,$FFFD,$4000,$D7D5,$5BFF,$FFFD,$4000, + $D7FF,$FBD5,$D55D,$4000,$D000,$03FF,$FFFD,$4000, + $D555,$53FF,$FFFD,$4000,$D555,$5000,$0001,$4000, + $D555,$5555,$5555,$4000,$8000,$0000,$0000,$0000]:INT + -> E-Note: C version uses obsolete gadget flags + iconGadget:=[NIL, -> Next Gadget Pointer + 97, 12, 52, 23, -> Left, Top, Width, Height + GFLG_GADGIMAGE OR GFLG_GADGHBOX, -> Flags + GACT_IMMEDIATE OR GACT_RELVERIFY, -> Activation Flags + GTYP_BOOLGADGET, -> Gadget Type + [0, 0, -> Top Corner + 52, 22, 2, -> Width, Height, Depth + iconImageData, -> Image Data + 3, 0, -> PlanePick, PlaneOnOff + NIL]:image, -> Next Image + NIL, -> Select Image + NIL, -> Gadget Text + NIL, -> Mutual Exclude + NIL, -> Special Info + 0, -> Gadget ID + NIL]:gadget -> User Data + -> E-Note: a list can't be used for a diskobject because of the nested gadget + projIcon.magic:=WB_DISKMAGIC + projIcon.version:=WB_DISKVERSION + CopyMem(iconGadget, projIcon.gadget, SIZEOF gadget) + projIcon.type:=WBPROJECT + projIcon.defaulttool:=deftoolname + projIcon.tooltypes:=toolTypes + projIcon.currentx:=NO_ICON_POSITION + projIcon.currenty:=NO_ICON_POSITION + projIcon.drawerdata:=NIL + projIcon.toolwindow:=NIL + projIcon.stacksize:=4000 + + -> Open icon.library + iconbase:=OpenLibrary('icon.library',33) + + -> If started from CLI, this example will create a small text file + -> RAM:Example_Project, and create an icon for the file which points + -> to this program as its default tool. + IF wbmessage=NIL + -> Make a sample project (data) file + file:=Open(projname, NEWFILE) + Write(file, 'Have a nice day\n', STRLEN) + + -> Now save/update icon for this data file + makeIcon(projname, toolTypes, deftoolname) + WriteF('\s data file and icon saved.\n', projname) + WriteF('Use Workbench menu Icon Information to examine the icon.\n') + WriteF('Then copy this example (iconexample) to RAM:\n') + WriteF('and double-click the \s project icon\n', projname) + ELSE -> Else we are from WB - ie. we were either started by a tool icon, + -> or as in this case, by being the default tool of a project icon. + -> E-Note: WriteF opens its own window if necessary + wbenchMsg:=wbmessage + + -> First arg is our executable (tool). Any additional args are projects + -> or icons passed to us via either extend select or default tool method. + wbarg:=wbenchMsg.arglist + FOR i:=0 TO wbenchMsg.numargs-1 + -> If there's a directory lock for this wbarg, CD there + olddir:=-1 + IF wbarg.lock AND (wbarg.name[]<>0) THEN olddir:=CurrentDir(wbarg.lock) + + showToolTypes(wbarg) + + IF (i>0) AND (wbarg.name[]<>0) + WriteF('In Main. We could open the \s file here\n', wbarg.name) + ENDIF + IF olddir<>-1 THEN CurrentDir(olddir) -> CD back where we were + wbarg++ + ENDFOR + Delay(500) + WriteF('\nPress RETURN to close window\n') + ENDIF +EXCEPT DO + IF file THEN Close(file) + SELECT exception + CASE ERR_LIB; WriteF('Can''t open icon.library\n') + CASE ERR_OPEN; WriteF('Can''t open file "\s"\n', projname) + CASE ERR_WRITE; WriteF('Error writing data file\n') + CASE ERR_MAKE; WriteF('Error writing icon\n') + ENDSELECT + RETURN IF exception=ERR_NONE THEN RETURN_OK ELSE RETURN_FAIL +ENDPROC + +PROC makeIcon(name, newtooltypes, newdeftool) + DEF dobj:PTR TO diskobject, oldtooltypes, olddeftool, success=FALSE + IF dobj:=GetDiskObject(name) + -> If file already has an icon, we will save off any fields we need to + -> update, update those fields, put the object, restore the old field + -> pointers and then free the object. This will preserve any custom + -> imagery the user has, and the user's current placement of the icon. + -> If your application does not know where the user currently keeps your + -> application, you should not update his dobj.defaulttool. + oldtooltypes:=dobj.tooltypes + olddeftool:=dobj.defaulttool + + dobj.tooltypes:=newtooltypes + dobj.defaulttool:=newdeftool + + success:=PutDiskObject(name, dobj) + + -> We must restore the original pointers before freeing + dobj.tooltypes:=oldtooltypes + dobj.defaulttool:=olddeftool + FreeDiskObject(dobj) + ENDIF + -> Else, put our default icon + IF success=FALSE THEN success:=PutDiskObject(name, projIcon) + IF success=FALSE THEN Raise(ERR_MAKE) +ENDPROC + +PROC showToolTypes(wbarg:PTR TO wbarg) + DEF dobj:PTR TO diskobject, toolarray, s, success=FALSE + WriteF('\nWBArg Lock=$\h, Name=\s ($\h)\n', + wbarg.lock, wbarg.name, wbarg.name[]) + + IF (wbarg.name[]<>0) AND (dobj:=GetDiskObject(wbarg.name)) + WriteF(' We have read the DiskObject (icon) for this arg\n') + toolarray:=dobj.tooltypes + + IF s:=FindToolType(toolarray, 'FILETYPE') + WriteF(' Found tooltype FILETYPE with value \s\n', s) + ENDIF + IF s:=FindToolType(toolarray, 'FLAGS') + WriteF(' Found tooltype FLAGS with value \s\n', s) + IF MatchToolValue(s, 'BOLD') + WriteF(' BOLD flag requested\n') + ENDIF + IF MatchToolValue(s, 'ITALICS') + WriteF(' ITALICS flag requested\n') + ENDIF + ENDIF + -> Free the diskobject we got + FreeDiskObject(dobj) + success:=TRUE + ELSEIF wbarg.name[]=0 + WriteF(' Must be a disk or drawer icon\n') + ELSE + WriteF(' Can''t find any DiskObject (icon) for this WBArg\n') + ENDIF +ENDPROC success diff --git a/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/prargs.e b/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/prargs.e new file mode 100644 index 0000000..c7aecee --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Rkrm/Workbench/prargs.e @@ -0,0 +1,55 @@ +-> PrArgs.e - This program prints all Workbench or Shell (CLI) arguments. +-> E-Note: ignore all the rubbish (in the C version) about start-ups + +MODULE 'other/split', + 'workbench/startup' + +PROC main() + DEF argmsg:PTR TO wbstartup, wb_arg:PTR TO wbarg, ktr, olddir, + argv:PTR TO LONG + -> wbmessage is non-NIL when run from the Workbench, NIL when run from the CLI + IF wbmessage + -> E-Note: WriteF opens its own output window, if necessary + -> wbmessage contains a pointer to the WBStartup message + argmsg:=wbmessage + wb_arg:=argmsg.arglist -> Head of the arg list + + WriteF('Run from the Workbench, \d args.\n', argmsg.numargs) + + FOR ktr:=0 TO argmsg.numargs-1 + IF wb_arg.lock<>NIL + -> Locks supported, change to the proper directory + olddir:=CurrentDir(wb_arg.lock) + + -> Process the file. + -> If you have done the CurrentDir() above, then you can access the file + -> by its name. Otherwise, you have to examine the lock to get a + -> complete path to the file. + WriteF('\tArg \d[2] (w/ lock): "\s".\n', ktr, wb_arg.name) + + -> Change back to the original directory when done. Be sure to change + -> back before you exit. + CurrentDir(olddir) + ELSE + -> Something that does not support locks + WriteF('\tArg \d[2] (no lock): "\s".\n', ktr, wb_arg.name) + ENDIF + wb_arg++ + ENDFOR + -> E-Note: no need to wait: output window closes after a RETURN press + ELSE + -> E-Note: WriteF opens its own output window, if necessary + -> E-Note: argSplit() splits arg into a NIL-terminated E-list, which can be + -> used like C's argv (except that the first element of the list is + -> the first argument, not the program name...) + IF argv:=argSplit() + WriteF('Run from the CLI, \d args.\n', ListLen(argv)) + FOR ktr:=0 TO ListLen(argv)-1 + -> Print an arg, and its number + WriteF('\tArg \d[2]: "\s".\n', ktr+1, argv[ktr]) + ENDFOR + ELSE -> E-Note: argSplit() ran out of memory... + WriteF('Run from the CLI, arg is "\s".\n', arg) + ENDIF + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/AmigaLib.doc b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/AmigaLib.doc new file mode 100644 index 0000000..0e663fc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/AmigaLib.doc @@ -0,0 +1,115 @@ +Short: amiga.lib as E modules +Type: dev/e +Author: m88jrh@ecs.ox.ac.uk (Jason R. Hulance) +Uploader: m88jrh@ecs.ox.ac.uk (Jason R. Hulance) + + +AmigaLib +======== + +Amiga E modules of many of the amiga.lib functions. +These translations are Copyright (C) 1995, Jason R. Hulance. +The original amiga.lib is Copyright (C) 1985-1992, Commodore-Amiga Inc. + +You are free to use these modules in your programs, whether they are freeware +or commercial. However, if you want to distribute any of this archive you +must include it all, unmodified, together with this file. + + +Contents +-------- + + argarray.m: + PROC argArrayInit(str=0) + PROC argArrayDone() + PROC argInt(tt,entry,defaultval) + PROC argString(tt,entry,defaultstring) + + boopsi.m: + PROC callHookA(h,obj,msg) + PROC coerceMethodA(cl,obj,msg) + PROC doMethodA(obj,msg) + PROC doSuperMethodA(cl,obj,msg) + PROC setSuperAttrsA(cl,obj,msg) + + cx.m: + PROC freeIEvents(events) + PROC hotKey(description,port,id) + PROC invertString(str,km) + PROC invertStringRev(str,km) + PROC userFilter(tt,action_name,default_descr) + + interrupts.m: + PROC addTOF(i,p,a) + PROC remTOF(i) + PROC waitbeam(pos) + + io.m: + PROC beginIO(ioreq) + PROC createExtIO(port,ioSize) + PROC deleteExtIO(ioReq) + PROC createStdIO(port) + PROC deleteStdIO(ioReq) + + lists.m: + PROC newList(mlh) + + ports.m: + PROC createPort(name,pri) + PROC deletePort(port) + + random.m: + PROC fastRand(num) + PROC rangeRand(num) + + tasks.m: + PROC createTask(name,pri,initPC,stackSize) + PROC deleteTask(tc) + + time.m: + PROC timeDelay(unit,seconds,micros) + +There are also a number of test programs, which show how to use many of +the functions. + + +Documentation +------------- + +The documentation on amiga.lib serves as adequate documentation of these +functions, with the following observations: + + argarray.m: + o argArrayInit() takes only an optional string. This can be a string + of arguments like the E global "arg" (which is the default). This + string is only used if "wbmessage" is NIL, and is *altered* if used + (i.e., the result is a manipulation of the string, and so by default + "arg" will be affected). If you don't like this, pass this function + a copy of your arguments string (and be careful not to free it until + you've finished with the result of this function). + + boopsi.m: + o callHookA() is like CallHookPkt() from utility.library except it does + not require the utility.library to be open! + o setSuperAttrsA() replaces the stack-based (varargs) function + SetSuperAttrs(). setSuperAttrsA() takes a pointer to a Boopsi message + as its third argument (so you would usually use a typed list). + + cx.m: + o invertStringRev() is like InvertString() except it does not require + you to reverse the string to be inverted. See testcx.e. + o userFilter(tt, action_name, default_descr) creates a CxFilter object + with a description string taken from the tooltype defined by + "action_name" in the tooltypes array "tt" (which is usually the result + of a call to argArrayInit()). If the tooltype is not found then the + "default_descr" is used instead. + + interrupts.m: + o waitbeam(pos) waits until the VBeam position is at least "pos". + + tasks.m: + o createTask() can has slightly enhanced error checking if you are + running V37+. + +The main reason for the creation of these modules was my translations of the +RKRM examples. These should provide even more useful documentation. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/argarray.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/argarray.e new file mode 100644 index 0000000..105eb11 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/argarray.e @@ -0,0 +1,46 @@ +OPT MODULE + +MODULE 'icon', + 'other/split', + 'workbench/startup', + 'workbench/workbench' + +DEF cxlib_arg, cxlib_dobj:PTR TO diskobject + +EXPORT PROC argArrayInit(str=NIL) + DEF argmsg:PTR TO wbstartup, lock=NIL + IF iconbase=NIL + RETURN NIL + ELSEIF argmsg:=wbmessage + IF argmsg.arglist.lock THEN lock:=CurrentDir(argmsg.arglist.lock) + cxlib_dobj:=GetDiskObject(argmsg.arglist.name) + IF lock THEN CurrentDir(lock) + RETURN IF cxlib_dobj THEN cxlib_dobj.tooltypes ELSE NIL + ELSE + RETURN cxlib_arg:=argSplit(str) + ENDIF +ENDPROC + +EXPORT PROC argArrayDone() + IF iconbase + IF wbmessage + FreeDiskObject(cxlib_dobj) + ELSE + DisposeLink(cxlib_arg) + ENDIF + ENDIF +ENDPROC + +EXPORT PROC argString(tt:PTR TO LONG, entry, defaultstring) + DEF res=NIL + IF tt AND (iconbase<>NIL) + res:=FindToolType(tt, entry) + ENDIF +ENDPROC IF res THEN res ELSE defaultstring + +EXPORT PROC argInt(tt:PTR TO LONG, entry, defaultval) + DEF res=NIL + IF tt AND (iconbase<>NIL) + IF res:=FindToolType(tt, entry) THEN StrToLong(res, {defaultval}) + ENDIF +ENDPROC defaultval diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/boopsi.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/boopsi.e new file mode 100644 index 0000000..ab5f122 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/boopsi.e @@ -0,0 +1,41 @@ +OPT MODULE +OPT PREPROCESS + +MODULE 'intuition/classes', + 'intuition/classusr', + 'utility/hooks' + +EXPORT PROC callHookA(h:PTR TO hook, obj, msg) +-> CallHookPkt would require that caller has the utility library open + DEF entry + entry:=h.entry + MOVE.L h, A0 + MOVE.L msg, A1 + MOVE.L obj, A2 + MOVE.L entry, A3 + JSR (A3) + MOVE.L D0, entry +ENDPROC entry + +EXPORT PROC setSuperAttrsA(cl:PTR TO iclass, obj, msg) +ENDPROC doSuperMethodA(cl, obj, [OM_SET, msg, NIL]) + +EXPORT PROC coerceMethodA(cl:PTR TO iclass, obj, msg) + IF obj AND (cl<>NIL) + RETURN callHookA(cl.dispatcher, obj, msg) + ENDIF +ENDPROC NIL + +EXPORT PROC doSuperMethodA(cl:PTR TO iclass, obj, msg) + IF obj AND (cl<>NIL) + RETURN callHookA(cl.super.dispatcher, obj, msg) + ENDIF +ENDPROC NIL + +EXPORT PROC doMethodA(obj, msg) + DEF o:PTR TO object_ + IF obj + o:=OBJECT_(obj) -> Get real object + RETURN callHookA(o.class.dispatcher, obj, msg) + ENDIF +ENDPROC NIL diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/cx.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/cx.e new file mode 100644 index 0000000..6eb7122 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/cx.e @@ -0,0 +1,116 @@ +OPT MODULE + +OPT PREPROCESS + +MODULE 'commodities', + 'icon', + 'devices/inputevent', + 'libraries/commodities' + +EXPORT PROC userFilter(tt, action_name, default_descr) + DEF desc=NIL + IF (iconbase=NIL) OR (cxbase=NIL) THEN RETURN NIL + IF tt THEN desc:=FindToolType(tt, action_name) +ENDPROC CxFilter(IF desc THEN desc ELSE default_descr) + +EXPORT PROC hotKey(description, port, id) + DEF filter + IF cxbase=NIL THEN RETURN NIL + IF filter:=CxFilter(description) + AttachCxObj(filter, CxSender(port, id)) + AttachCxObj(filter, CxTranslate(NIL)) + IF CxObjError(filter) + DeleteCxObjAll(filter) + filter:=NIL + ENDIF + ENDIF +ENDPROC filter + +EXPORT PROC freeIEvents(events:PTR TO inputevent) + DEF next + WHILE events + next:=events.nextevent + END events + events:=next + ENDWHILE +ENDPROC + +ENUM ERR_NONE, ERR_ESC, ERR_ANGLE + +EXPORT PROC invertStringRev(str, km) HANDLE + DEF events=NIL, c, curr:PTR TO inputevent, ie:PTR TO inputevent + IF cxbase=NIL THEN RETURN NIL + IF str + IF str[] + curr:=(events:=NEW ie) + c:=str[]++ + REPEAT + IF c="<" + str:=doangle(str, curr) + ELSE + IF c="\\" THEN c:=doesc(str[]++) + InvertKeyMap(c, curr, km) + ENDIF + IF c:=str[]++ + curr.nextevent:=NEW ie + curr:=ie + ENDIF + UNTIL c=NIL + ENDIF + ENDIF + RETURN events +EXCEPT + freeIEvents(events) + RETURN NIL +ENDPROC + +EXPORT PROC invertString(str, km) HANDLE + DEF events=NIL:PTR TO inputevent, c, prev:PTR TO inputevent + IF cxbase=NIL THEN RETURN NIL + IF str + IF str[] + WHILE c:=str[]++ + prev:=events + NEW events + events.nextevent:=prev + IF c="<" + str:=doangle(str, events) + ELSE + IF c="\\" THEN c:=doesc(str[]++) + InvertKeyMap(c, events, km) + ENDIF + ENDWHILE + ENDIF + ENDIF + RETURN events +EXCEPT + freeIEvents(events) + RETURN NIL +ENDPROC + +PROC doesc(c) + SELECT "u" OF c + CASE "\q", "'", "<", "\\" + RETURN c + CASE "0" + RETURN 0 + CASE "n", "r" + RETURN "\b" + CASE "t" + RETURN "\t" + DEFAULT + Raise(ERR_ESC) + ENDSELECT +ENDPROC + +PROC doangle(str, events:PTR TO inputevent) + DEF s, c, ix:inputxpression + s:=str + WHILE s[] AND (s[]<>">") DO s++ + IF c:=s[] THEN s[]:=NIL + IF ParseIX(str, ix)<>0 THEN Raise(ERR_ANGLE) + events.class:=ix.class + events.code:=ix.code + events.qualifier:=ix.qualifier + s[]++:=c +ENDPROC s diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/interrupts.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/interrupts.e new file mode 100644 index 0000000..391e89c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/interrupts.e @@ -0,0 +1,28 @@ +OPT MODULE + +MODULE 'graphics/graphint', + 'hardware/intbits' + +EXPORT PROC addTOF(i:PTR TO isrvstr, p, a) + i.code:={ttskasm} + i.iptr:=i + i.ccode:=p + i.carg:=a + AddIntServer(INTB_VERTB, i) +ENDPROC + +EXPORT PROC remTOF(i:PTR TO isrvstr) + RemIntServer(INTB_VERTB, i) +ENDPROC + +EXPORT PROC waitbeam(pos) + WHILE pos>VbeamPos() DO NOP +ENDPROC + +ttskasm: + MOVE.L $1A(A1), -(A7) + MOVEA.L $16(A1), A0 + JSR (A0) + ADDQ.L #4, A7 + MOVEQ.L #0, D0 + RTS diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/io.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/io.e new file mode 100644 index 0000000..402b892 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/io.e @@ -0,0 +1,42 @@ +OPT MODULE + +MODULE 'exec/io', + 'exec/memory', + 'exec/nodes', + 'exec/ports' + +ENUM ERR_NONE, ERR_SIG + +RAISE ERR_SIG IF AllocSignal()=-1 + +EXPORT PROC beginIO(ioreq:PTR TO io) + DEF base + base:=ioreq.device + MOVEA.L base, A6 + MOVEA.L ioreq, A1 + JSR -30(A6) +ENDPROC + +EXPORT PROC createStdIO(port) IS createExtIO(port, SIZEOF iostd) + +EXPORT PROC deleteStdIO(ioReq) IS deleteExtIO(ioReq) + +EXPORT PROC createExtIO(port, ioSize) HANDLE + DEF ioReq=NIL:PTR TO io + IF port + ioReq:=NewM(ioSize, MEMF_CLEAR OR MEMF_PUBLIC) + ioReq.mn.ln.type:=NT_REPLYMSG + ioReq.mn.length:=ioSize + ioReq.mn.replyport:=port + ENDIF +EXCEPT DO +ENDPROC ioReq + +EXPORT PROC deleteExtIO(ioReq:PTR TO io) + IF ioReq + ioReq.mn.ln.succ:=-1 + ioReq.mn.replyport:=-1 + ioReq.device:=-1 + Dispose(ioReq) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/lists.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/lists.e new file mode 100644 index 0000000..ad216c3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/lists.e @@ -0,0 +1,9 @@ +OPT MODULE + +MODULE 'exec/lists' + +EXPORT PROC newList(mlh:PTR TO mlh) + mlh.head:=mlh+4 -> Point to tail + mlh.tail:=NIL + mlh.tailpred:=mlh -> Point to head +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/ports.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/ports.e new file mode 100644 index 0000000..224edc9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/ports.e @@ -0,0 +1,37 @@ +OPT MODULE + +MODULE 'amigalib/lists', + 'exec/lists', + 'exec/memory', + 'exec/nodes', + 'exec/ports' + +EXPORT PROC createPort(name, pri) HANDLE + DEF sigBit=-1, port=NIL:PTR TO mp + sigBit:=AllocSignal(-1) + port:=NewM(SIZEOF mp, MEMF_CLEAR OR MEMF_PUBLIC) + port.ln.name:=name + port.ln.pri:=pri + port.ln.type:=NT_MSGPORT + port.flags:=PA_SIGNAL + port.sigbit:=sigBit + port.sigtask:=FindTask(NIL) + IF name + AddPort(port) + ELSE + newList(port.msglist) + ENDIF + RETURN port +EXCEPT + IF port THEN Dispose(port) + IF sigBit<>-1 THEN FreeSignal(sigBit) + RETURN NIL +ENDPROC + +EXPORT PROC deletePort(port:PTR TO mp) + IF port.ln.name THEN RemPort(port) + port.sigtask:=-1 + port.msglist.head:=-1 + FreeSignal(port.sigbit) + Dispose(port) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/random.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/random.e new file mode 100644 index 0000000..5daaa7d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/random.e @@ -0,0 +1,23 @@ +OPT MODULE + +OPT PREPROCESS + +DEF rangeSeed + +EXPORT PROC fastRand(num) IS IF num>0 THEN num*2 ELSE Eor(num*2, $1d872b41) + +#define UNSIGNED(x) (x AND $FFFF) + +EXPORT PROC rangeRand(num) + DEF max + max:=UNSIGNED(num-1) + REPEAT + max:=Shr(max,1) + rangeSeed:=fastRand(rangeSeed) + UNTIL (max<=0) + IF num + RETURN UNSIGNED(Shr(Mul(UNSIGNED(num), UNSIGNED(rangeSeed)), 16)) + ELSE + RETURN UNSIGNED(rangeSeed) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/tasks.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/tasks.e new file mode 100644 index 0000000..ca796a8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/tasks.e @@ -0,0 +1,46 @@ +OPT MODULE + +MODULE 'amigalib/lists', + 'exec/memory', + 'exec/nodes', + 'exec/tasks' + +OBJECT fakememlist + ln_succ:LONG + ln_pred:LONG + ln_type:CHAR + ln_pri:CHAR + ln_name:LONG + numentries:INT + tsk_reqs:LONG + tsk_length:LONG + stk_reqs:LONG + stk_length:LONG +ENDOBJECT + +EXPORT PROC createTask(name, pri, initPC, stackSize, data=NIL) + DEF ml:fakememlist, newTask=NIL:PTR TO tc + stackSize:=(stackSize+3) AND -4 -> Not(3) is -4 (honest!) + CopyMem([0, 0, 0, 0, 0, 2, + MEMF_PUBLIC OR MEMF_CLEAR, SIZEOF tc, + MEMF_CLEAR, stackSize]:fakememlist, + ml, SIZEOF fakememlist) + IF ml:=AllocEntry(ml) + newTask:=ml.tsk_reqs + newTask.splower:=ml.stk_reqs + newTask.spupper:=newTask.splower+stackSize + newTask.spreg:=newTask.spupper + newTask.userdata:=data + newTask.ln.type:=NT_TASK + newTask.ln.pri:=pri + newTask.ln.name:=name + newList(newTask.mementry) + AddHead(newTask.mementry, ml) + IF (AddTask(newTask, initPC, 0)=NIL) AND KickVersion(37) + FreeEntry(ml) + RETURN NIL + ENDIF + ENDIF +ENDPROC newTask + +EXPORT PROC deleteTask(tc) IS RemTask(tc) diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testargarray.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testargarray.e new file mode 100644 index 0000000..fa912e4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testargarray.e @@ -0,0 +1,23 @@ +MODULE 'icon', + 'amigalib/argarray' + +ENUM ERR_NONE, ERR_LIB + +RAISE ERR_LIB IF OpenLibrary()=NIL + +PROC main() HANDLE + DEF p:PTR TO LONG, i=0 + iconbase:=OpenLibrary('icon.library', 33) + IF p:=argArrayInit() -> Result is a NIL-terminated list of strings + WriteF('Integer value of "ARG_ONE" is \d (default is 2)\n', + argInt(p, 'ARG_ONE', 2)) + WriteF('String value of "OTHER" is "\s" (default is "fred")\n', + argString(p, 'OTHER', 'fred')) + WriteF('\nActual arguments are:\n') + WHILE p[] DO WriteF('\d[2]: "\s"\n', i++, p[]++) + WriteF('Total: \d arguments\n', i) + argArrayDone() + ENDIF +EXCEPT DO + IF iconbase THEN CloseLibrary(iconbase) +ENDPROC \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testcx.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testcx.e new file mode 100644 index 0000000..9509970 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testcx.e @@ -0,0 +1,94 @@ +OPT PREPROCESS + +MODULE 'commodities', + 'amigalib/cx', + 'devices/timer', + 'devices/inputevent', + 'dos/dos', + 'exec/ports', + 'libraries/commodities' + +ENUM ERR_NONE, ERR_BRKR, ERR_CRCX, ERR_CXERR, ERR_HOT, ERR_LIB, ERR_PORT + +RAISE ERR_BRKR IF CxBroker()=NIL, + ERR_CRCX IF CreateCxObj()=NIL, + ERR_LIB IF OpenLibrary()=NIL, + ERR_PORT IF CreateMsgPort()=NIL + +CONST EVT_HOTKEY=1 + +DEF broker_mp=NIL:PTR TO mp, broker=NIL, cxsigflag, ie:PTR TO inputevent + +PROC main() HANDLE + DEF hotkey, msg, newshell + newshell:='newshell\b' + cxbase:=OpenLibrary('commodities.library', 37) + broker_mp:=CreateMsgPort() + cxsigflag:=Shl(1, broker_mp.sigbit) + + broker:=CxBroker([NB_VERSION, 0, + 'HotKey', 'Little Hotkey', 'A little hot key commodity', + NBU_UNIQUE OR NBU_NOTIFY, + 0, 0, 0, broker_mp, 0]:newbroker, NIL) + + IF hotkey:=hotKey('rawkey control f1', broker_mp, EVT_HOTKEY) + AttachCxObj(broker, hotkey) + IF CxObjError(hotkey)<>FALSE + Raise(ERR_CXERR) + ELSE + IF ie:=invertStringRev(newshell, NIL) + ActivateCxObj(broker, TRUE) + processMsg() + freeIEvents(ie) + ENDIF + ENDIF + ELSE + Raise(ERR_HOT) + ENDIF +EXCEPT DO + IF broker THEN DeleteCxObjAll(broker) + IF broker_mp + WHILE msg:=GetMsg(broker_mp) DO ReplyMsg(msg) + DeleteMsgPort(broker_mp) + ENDIF + IF cxbase THEN CloseLibrary(cxbase) + SELECT exception + CASE ERR_BRKR; WriteF('Error: Could not create broker\n') + CASE ERR_CRCX; WriteF('Error: Could not create CX object\n') + CASE ERR_CXERR; WriteF('Error: Could not activate broker\n') + CASE ERR_HOT; WriteF('Error: Could not create hot key\n') + CASE ERR_LIB; WriteF('Error: Could not open required library\n') + CASE ERR_PORT; WriteF('Error: Could not create message port\n') + ENDSELECT +ENDPROC + +PROC processMsg() + DEF msg, sigrcvd, msgid, msgtype, going=TRUE + WHILE going + sigrcvd:=Wait(SIGBREAKF_CTRL_C OR cxsigflag) + WHILE msg:=GetMsg(broker_mp) + msgid:=CxMsgID(msg) + msgtype:=CxMsgType(msg) + ReplyMsg(msg) + SELECT msgtype + CASE CXM_IEVENT + IF msgid=EVT_HOTKEY + WriteF('You hit the HotKey -- adding input events\n') + AddIEvents(ie) + ENDIF + CASE CXM_COMMAND + SELECT msgid + CASE CXCMD_DISABLE + ActivateCxObj(broker, FALSE) + CASE CXCMD_ENABLE + ActivateCxObj(broker, TRUE) + CASE CXCMD_KILL + going:=FALSE + CASE CXCMD_UNIQUE + going:=FALSE + ENDSELECT + ENDSELECT + ENDWHILE + IF sigrcvd AND SIGBREAKF_CTRL_C THEN going:=FALSE + ENDWHILE +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testinterrupts.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testinterrupts.e new file mode 100644 index 0000000..64516ee --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testinterrupts.e @@ -0,0 +1,20 @@ +MODULE 'amigalib/interrupts', + 'dos/dos', + 'graphics/graphint' + +DEF var + +PROC main() + DEF i:isrvstr + var:=0 + WriteF('var = \d\n', var) + addTOF(i, {test_int}, {var}) + WriteF('var = \d\n', var) + Wait(SIGBREAKF_CTRL_C) + WriteF('var = \d\n', var) + remTOF(i) +ENDPROC + +PROC test_int(addr:PTR TO LONG) + addr[]:=addr[]+1 +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testinterrupts2.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testinterrupts2.e new file mode 100644 index 0000000..7012a98 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testinterrupts2.e @@ -0,0 +1,33 @@ +MODULE 'amigalib/interrupts', + 'dos/dos', + 'graphics/graphint' + +DEF var + +-> This example using an interrupt to toggle which string to print. +-> Try running it in a Shell, then try redirecting output to a file. +-> Look at the difference in the number of times it prints the same +-> string (i.e., how many times it gets to complete a WriteF before +-> the interrupt occurs), +PROC main() + DEF i:isrvstr, strs:PTR TO LONG, x, y, z + strs:=['hello\n', 'goodbye\n'] + var:=0 + x:=0; y:=0 + WriteF('var = \d\n', var) + addTOF(i, {test_int}, {var}) + WriteF('var = \d\n', var) + REPEAT + z:=var + IF z<>y + x:=0; y:=z + ENDIF + WriteF('\d \s', x++, strs[z]) + UNTIL CtrlC() + WriteF('var = \d\n', var) + remTOF(i) +ENDPROC + +PROC test_int(addr:PTR TO LONG) + addr[]:=1-addr[] +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testtime.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testtime.e new file mode 100644 index 0000000..d06003a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/testtime.e @@ -0,0 +1,8 @@ +MODULE 'amigalib/time' + +PROC main() + DEF error + WriteF('Just going to delay for 20 secs...\n') + error:=timeDelay(0, 20, 0) + WriteF(IF error THEN 'Ack! Something went wrong.\n' ELSE 'Done!\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/time.e b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/time.e new file mode 100644 index 0000000..54b81d0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/AmigaLib/time.e @@ -0,0 +1,24 @@ +OPT MODULE + +MODULE 'amigalib/io', + 'amigalib/ports', + 'devices/timer', + 'exec/io' + +EXPORT PROC timeDelay(unit, seconds, micros) + DEF port, tr:PTR TO timerequest, error=TRUE + IF port:=createPort(NIL, 0) + IF tr:=createExtIO(port, SIZEOF timerequest) + IF OpenDevice('timer.device', unit, tr, 0)=0 + tr.time.secs:=seconds + tr.time.micro:=micros + tr.io.command:=TR_ADDREQUEST + DoIO(tr) + CloseDevice(tr) + error:=FALSE + ENDIF + deleteExtIO(tr) + ENDIF + deletePort(port) + ENDIF +ENDPROC error diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexx.doc b/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexx.doc new file mode 100644 index 0000000..be9b788 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexx.doc @@ -0,0 +1,63 @@ +arexx.m: simple routines for adding an arexx-port to your program. + + port:=rx_OpenPort(portname) + +Creates an arexx-port. macro programs may now reach you by saying +'ADDRESS portname'. May raise: "MEM", "SIG", "DOUB". the last two are +'could not allocate signal' and 'port with same name already exists'. + + rx_ClosePort(port) + +Frees up the port and all associated resources. May safely be called +with NIL. + + mes,string:=rx_GetMsg(port) + +Just about the same as exec's GetMsg, only now rexx-specific. +extracts the string send from the macro program. If mes=NIL then there +was no message. + + rx_ReplyMsg(mes,rc=0,resultstring=NIL) + +reply the message you got from rx_GetMsg(). pass rc=0 for no error, +and a string if you think the command send requires a result. rc>0 +signals an error (no result is returned). + + rx_HandleAll(interpret_proc,portname) + +The first four functions supply you with all the machinery needed +for adding an arexxport to your programs. However, if all your +program does is wait for and process messages from arexx anyway, +you can use this function which encapsulates the other four. All +it needs is a PROC to process the messages and again a portname. + +Alternatively, the source of this function is a usefull example +of how to call the other four functions, just incase you want +to call them yourself: + + +PROC rx_HandleAll(interpret_proc,portname) HANDLE + DEF port=NIL,sig,quit=FALSE,mes,s,rc,rs + port,sig:=rx_OpenPort(portname) + REPEAT + Wait(sig) + REPEAT + mes,s:=rx_GetMsg(port) + IF mes + quit,rc,rs:=interpret_proc(s) + rx_ReplyMsg(mes,rc,rs) + ENDIF + UNTIL (mes=NIL) OR (quit=TRUE) + UNTIL quit + Raise() +EXCEPT + rx_ClosePort(port) + ReThrow() +ENDPROC + + +From the code we can see that the proc given as an argument to rx_HandleAll() +gets as argument a string he may want to process, and returns a flag +wether to quit or not, and the rc and result as mentioned in the rx_Reply() +function. see arexxsimple.e how to make an arexxhost with this function +with just a few lines of code. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexx.e b/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexx.e new file mode 100644 index 0000000..5629443 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexx.e @@ -0,0 +1,73 @@ +OPT MODULE + +MODULE 'exec/ports', 'exec/nodes', 'rexx/storage', 'rexxsyslib' + +RAISE "MEM" IF CreateArgstring()=NIL + +DEF rexxsysbase + +EXPORT PROC rx_OpenPort(portname) + DEF port:PTR TO mp,sig,exc=0 + NEW port + Forbid() + IF FindPort(portname) + exc:="DOUB" + ELSE + port.sigtask:=FindTask(0) + port.flags:=PA_SIGNAL + port::ln.name:=portname + port::ln.type:=NT_MSGPORT + IF (sig:=AllocSignal(-1))=NIL + exc:="SIG" + ELSE + port.sigbit:=sig + AddPort(port) + ENDIF + ENDIF + Permit() + IF exc THEN Raise(exc) +ENDPROC port,Shl(1,sig) + +EXPORT PROC rx_ClosePort(port:PTR TO mp) + IF port + FreeSignal(port.sigbit) + RemPort(port) + Dispose(port) + ENDIF +ENDPROC + +EXPORT PROC rx_GetMsg(port) + DEF mes:PTR TO rexxmsg + IF mes:=GetMsg(port) + rexxsysbase:=mes.libbase + RETURN mes,Long(mes.args) + ENDIF +ENDPROC NIL,NIL + +EXPORT PROC rx_ReplyMsg(mes:PTR TO rexxmsg,rc=0,resultstring=NIL) + mes.result1:=rc + mes.result2:=NIL + IF mes.action AND RXFF_RESULT AND (rc=0) AND (resultstring<>NIL) + mes.result2:=CreateArgstring(resultstring,StrLen(resultstring)) + ENDIF + ReplyMsg(mes) +ENDPROC + +EXPORT PROC rx_HandleAll(interpret_proc,portname) HANDLE + DEF port=NIL,sig,quit=FALSE,mes,s,rc,rs + port,sig:=rx_OpenPort(portname) + REPEAT + Wait(sig) + REPEAT + mes,s:=rx_GetMsg(port) + IF mes + quit,rc,rs:=interpret_proc(s) + rx_ReplyMsg(mes,rc,rs) + ENDIF + UNTIL (mes=NIL) OR (quit=TRUE) + UNTIL quit + Raise() +EXCEPT + rx_ClosePort(port) + IF exception THEN ReThrow() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexxtest.e b/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexxtest.e new file mode 100644 index 0000000..46d4a97 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexxtest.e @@ -0,0 +1,11 @@ +-> test arexx module, the easy way out + +MODULE 'tools/arexx' + +PROC main() + rx_HandleAll({process},'AREXXTESTPORT') +ENDPROC + +PROC process(s) + WriteF('Received message "\s" from Arexx!\n',s) +ENDPROC StrCmp(s,'quit'),0,'result!' diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexxtest.rexx b/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexxtest.rexx new file mode 100644 index 0000000..b993952 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Arexx/arexxtest.rexx @@ -0,0 +1,14 @@ +/* rx module test */ + +address AREXXTESTPORT + +OPTIONS RESULTS + +say 'testing....' + +'bla' +say 'result='result +'quit' +say 'result='result + +say 'done.' diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Async/async.guide b/amigae33a/E_v3.3a/Src/Src/Tools/Async/async.guide new file mode 100644 index 0000000..c436bb7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Async/async.guide @@ -0,0 +1,346 @@ +@database Async.guide + + +@$VER: Async.Guide 1.0 (06.11.93). +@toc async.m/main +@author Michael Zucchi +@(c) 1993 Michael Zucchi, All right reserved + + +@node Main "Async.guide" +@next "Commands" + +Aynschronous file reading module for AmigaE2.5+ + +© 1993 @{"Michael Zucchi" Link "Author"} +All Rights Reserved + +This document describes the usage of a suite of asynchronous file reading +routines designed for the AmigaE language. The interface is designed to +follow the V36 dos.library calls as closely as possible. + +The following sections are available: + + @{" OverView " Link "OverView"} some of the ideas behind the module + + @{u}General functions@{uu} + + @{"as_Open() " Link "as_Open"} to open a file + @{"as_Close() " Link "as_Close"} to close a file + @{"as_Read() " Link "as_Read"} reading from the file + + @{u}High level functions@{uu} + + @{"as_FGetS() " Link "as_FGetS"} reading text lines + @{"as_FGetC() " Link "as_FGetC"} reading character by character + + @{u}Low level functions@{uu} + + @{"as_NextBuffer()" Link "as_NextBuffer"} accessing input buffers direct + + + @{" Examples " Link Examples} + + @{b}NOTE: This module @{i}requires @{ui}Workbench 2.0 (V36) or higher! Please + make sure that this version of the system libraries is present before + using these functions.@{ub} + +@endnode + +@node OverView "Module overview" + +Just what is meant by 'asynchronous i/o'? + +When most programs use dos.library to read/write files, they simply call +Read() or Write(). What happens then is that these functions examine the +filehandle passed to them for information about the handler that handles +the file, and creates a dos 'packet' out of this information (see +dos/dosextens.m to see what a packet looks like). This packet is then sent +via the standard message passing system to the handler handling the file. +The dos function calls then wait for a reply to the request via the process's +message port pr_MessagePort - i.e. they @{u}wait@{uu} until the filesystem and handler +have retrieved the information before returning (incidentally, the fact that +the replies come in through pr_MessagePort is the reason dos cannot be called +from a standard 'task'). With a slow i.o device (e.g. floppy disk) all +of this waiting can mean the cpu is sitting idle a lot of the time waiting +for data to come in. + +How do you fix this less than ideal situation? Its quite simple. You +can create your @{u}own@{uu} packets and send these packets direct to dos. +This way, a custom reply port can be set up for the packets, and requests +for reads (or writes) can be sent out immediately, and the data read when +the packets are returned. If something needs to be done while the filesystem +is fetching this data, then your program can get it done - without having +to wait. + +This is basically what async.m does. Currently only reading is supported, +but writing will be added in the future, along with utilitiy functions like +Seek() etc. I got the idea from some code i got off the local BBS, something +from one of the cool guys at Commodore i think. + +@endnode + +@node "Author" "The guy who wrote it" + +I wrote this code some time ago, mainly for a multi-threaded directory +utility i've been working on from time to time. I found it so handy for +adding just that extra bit of performance to just about everything i wrote +that i thought other people might find it useful too. + +Presently, i study `from time to time' (:-) in order to obtain a Computer +Systems Engineering degree from the Univerity Of South Australia. +I'm `Zed' of FRONTIER in my anti-os hours. + +I can be contacted in the following ways: + +Internet email: + +9107047w@lux.levels.unisa.edu.au + till the end of '94 at least - reliable + +`Real Mode' (tm) mail: + +Michael Zucchi +PO BOX 824 +Waikerie +South Australia 5330 + slow, but very reliable - till mum sells the house :) + +Michael Zucchi +110 Dunrobin Rd +Warradale +South Australia 5046 + to my door - till i move (?) + +@endnode + + +@node as_Open +async.m/as_Open async.m/as_Open + +SYNTAX + + file := as_Open( name:PTR TO CHAR, + mode:LONG, + count:LONG, + size:LONG ); + +PURPOSE + Opens an asynchronous file, and returns a pointer to a (private) file + handle. When called, packets will be sent to the appropriate handler + to fill all buffers, and the return will call immediately. + +INPUTS + name A string, describing the name of the file to open + mode Same as mode in dos.library/Open. @{u}Must@{uu} be MODE_OLDFILE + for now. + count Number of buffers to allocate. 3 works very well. + size The size of each buffer to allocate. Above 5000 works + well, must be a multiple of 4. + +OUTPUTS + file A pointer to a filehandle that may be passed to the other + async functions. + +NOTES + No sanity checking is done on any of the input values. Use + reasonable values for everything. + The filehandle returned by as_Open() is NOT compatible with normal + dos filehandles, and system calls! + +SEE ALSO + @{"as_Close()" Link "as_Close"}, @{"as_NextBuffer()" Link "as_NextBuffer"}, @{"as_Read()" Link "as_Read"}, @{"as_FGetS()" Link "as_FGetS"}, @{"as_FGetC()" Link "as_FGetC"} +@endnode + +@node as_Close +async.m/as_Close async.m/as_Close + +SYNTAX + + as_Close( file:LONG ); + +PURPOSE + Closes the file, free's all memory buffers and cleans up all + outstanding packets. This call may be made as any time on a valid + async filehandle. + +INPUTS + file valid filehandle from as_Open(), or NIL in which case nothing + happens. + +OUTPUTS + +NOTES + +SEE ALSO + @{"as_Open()" Link "as_Open"} + +@endnode + +@node as_Read +async.m/as_Read async.m/as_Read + +SYNTAX + + bytes := as_Read( file:LONG, + buffer:PTR TO CHAR, + number:LONG ); + +PURPOSE + as_Read reads a number of bytes ('number') into the buffer specified + by 'buffer', from the async file 'file'. + + The number of bytes actually read in is indicated by the return value. + A return of zero indicates end of file, and errors are flagged by a + return value of -1. + +INPUTS + file Only a valid filehandle from as_Open() is allowed. + buffer A pointer to at least 'number' bytes of memory to store the + data. May be arbitrarily aligned. + number Specifies the number of bytes to read. number=0 is ignored. + +OUTPUTS + bytes The number of bytes actually stored in 'buffer'. A value of + zero indicates end of file, and -1 that a file error has + occurred, check IoErr() for detail. + +NOTES + +SEE ALSO + @{"as_Open()" Link "as_Open"}, @{"as_Close()" Link "as_Close"}, @{"as_NextBuffer()" Link "as_NextBuffer"}, @{"as_FGetS()" Link "as_FGetS"}, @{"as_FGetC()" Link "as_FGetC"} +@endnode + +@node as_FGetS +async.m/as_FGetS async.m/as_FGetS + +SYNTAX + + buffer := as_FGetS( file:LONG, + buffer:PTR TO CHAR, + number:LONG ); + +PURPOSE + Reads upto 'size' bytes from the file 'file' into the buffer pointed + to by the buffer parameter. Stops reading at end of file or once a + NEWLINE ($0a) character is encountered. Returns a pointer to that + buffer or NIL on end of file or error. + + The string stored in the buffer is NULL terminated. + +INPUTS + file A valid filehandle from @{"as_Open()" Link "as_Open"}. + buffer A pointer to at least 'number' bytes of memory to store the + data. May be arbitrarily aligned. + number Specifies the number of bytes to read, at maximum. This @{b}MUST + be >2@{ub}. + +OUTPUTS + buffer Same as 'buffer' passed as an input, or NIL on end of file + or file error. + +NOTES + If the line is too long to fit, the input stream is not skipped till + the next linefeed. + +SEE ALSO + @{"as_Open()" Link "as_Open"}, @{"as_Close()" Link "as_Close"}, @{"as_Read()" Link "as_Read"}, @{"as_NextBuffer()" Link "as_NextBuffer"}, @{"as_FGetC()" Link "as_FGetC"} +@endnode + +@node as_FGetC +async.m/as_FGetC async.m/as_FGetC + +SYNTAX + + char := as_FGetC( file:LONG ); + +PURPOSE + Reads the next character from the input file. Returns -1 on error + or end of file. The character is an unsigned 32 bit quantity. + +INPUTS + file A valid filehandle from @{"as_Open()" Link "as_Open"}. + +OUTPUTS + char The next available byte from the input stream, or -1 on + error. + +NOTES + This call is about as efficient as possible. + +SEE ALSO + @{"as_Open()" Link "as_Open"}, @{"as_Close()" Link "as_Close"}, @{"as_Read()" Link "as_Read"}, @{"as_NextBuffer()" Link "as_NextBuffer"}, @{"as_FGetS()" Link "as_FGetS"} +@endnode + + +@node as_NextBuffer +async.m/as_NextBuffer async.m/as_NextBuffer + +SYNTAX + + buffer,valid := as_NextBuffer( file:LONG ); + +PURPOSE + Returns the next available data buffer in the file. If end of file + has not yet been reached, and a buffer has now been made free, then + another read request is sent to the filesystem, in an asynchronous + manner. + +INPUTS + file A valid filehandle from @{"as_Open()" Link "as_Open"}. + +OUTPUTS + buffer The address of the internal data buffer, 0 for end of file, + or -1 on a file error. + valid Number of valid bytes in the buffer. This will be the same + as the size of each buffer as specified when the file was + opened, unless it is the last buffer being read. + +NOTES + @{b}The call is NOT compatible with any of the other reading functions.@{ub} + If you call those functions, you must NOT call this function, and + visa-versa. It is a low level function which both of the other read + functions make use of directly, and should only be used (esclusively) + where extra performance/lower memory use is required. + +SEE ALSO + @{"as_Open()" Link "as_Open"}, @{"as_Close()" Link "as_Close"}, @{"as_Read()" Link "as_Read"}, @{"as_FGetS()" Link "as_FGetS"}, @{"as_FGetC()" Link "as_FGetC"} +@endnode + + +@node Examples "Information about the examples" + +Included with this package are a few examples of using this module. + +@{u}typef@{uu} + + This is a simple example demonstrating the use of the as_FGetS() call. + It simply types a specified file to the current shell - quite a bit + faster than c:type does. + + usage: + @{"typef" Link typef.e/main} [Name] + +@{u}PlaySamp@{uu} + + This is a non-trivial example of the as_Read() function. It is a + complete 'raw sample' player that can be used to play ANY sized sample + from disk. + + usage: + @{"PlaySamp" Link playsamp.e/main} [Name] [ ... ] RATE + +@{u}histogram@{uu} + + A simple example of using the as_NextBuffer() command. It counts + the occurrannces of each byte in a file, and produces a report when + done. + + usage: + @{"histogram" Link histogram.e/main} [Name] + + Coding a more useful example for as_NextBuffer() requires a bit more + work than i have time for :) + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Async/histogram.e b/amigae33a/E_v3.3a/Src/Src/Tools/Async/histogram.e new file mode 100644 index 0000000..917af89 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Async/histogram.e @@ -0,0 +1,36 @@ +/* + + histogram.e Michael Zucchi 1993 + + Gives a population count for each byte in a file. + + */ + +MODULE 'tools/async', 'dos/dos' + +DEF counts[300]:ARRAY OF LONG; + +PROC main() + +DEF in,args:PTR TO LONG,rdargs,start:PTR TO CHAR,size,i; + +args:=[0]; +IF rdargs:=ReadArgs('Name/A', args, 0) + IF (in:=as_Open(args[0],MODE_OLDFILE,3,5120)) + REPEAT + start,size := as_NextBuffer(in); + IF start>0 + FOR i:=0 TO size-1 + counts[start[i]]:=counts[start[i]]+1; + ENDFOR + ENDIF + UNTIL start<=0 + as_Close(in) + FOR i:=0 TO 255 + WriteF('$\h[02]: \d\n', i, counts[i]); + ENDFOR + ENDIF + FreeArgs(rdargs) +ENDIF + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Async/playsamp.e b/amigae33a/E_v3.3a/Src/Src/Tools/Async/playsamp.e new file mode 100644 index 0000000..05ae273 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Async/playsamp.e @@ -0,0 +1,152 @@ +/* + + PlaySamp.e Michael Zucchi 1993 + + A disk based raw sample player, written in AmigaE. + + */ + +MODULE 'tools/async', + 'dos/dos', + 'exec/io', 'exec/memory', 'exec/ports', + 'devices/audio' + +CONST BUFFSIZE = 5120, + BUFFCOUNT = 3 + +PROC main() + +DEF args:PTR TO LONG,rdargs,rate,names:PTR TO LONG + +args:=[0,0] +IF rdargs:=ReadArgs('Name/A/M,Rate/N',args,0) + + -> is there an easier way to do this crap? + MOVE.L args,A0 + MOVE.L 4(A0),D0 + BEQ.S rate_def + MOVE.L D0,A0 + MOVE.L (A0),D0 + CMP.L #999,D0 + BLT.S rate_def + CMP.L #60001,D0 + BLT.S rate_ok +rate_def: + MOVE.L #10000,D0 +rate_ok: + MOVE.L D0,rate + + names:=args[0]; + WHILE (names[0]) + play(names[]++,rate) + ENDWHILE + FreeArgs(rdargs) +ENDIF + +ENDPROC + +PROC play(filename,rate) + +DEF arequest1:PTR TO ioaudio, + arequest2:ioaudio, + reply1,reply2, + ior:PTR TO io, + ioa:PTR TO ioaudio, + mnode:PTR TO mn, + buffer1,buffer2, + file, + len, + go + +WriteF('playing "\s"\n',filename) + +IF file:=as_Open(filename,MODE_OLDFILE,BUFFCOUNT,BUFFSIZE) + IF buffer1:=AllocVec(BUFFSIZE,MEMF_CHIP) + IF buffer2:=AllocVec(BUFFSIZE,MEMF_CHIP) + IF reply1:=CreateMsgPort() + IF reply2:=CreateMsgPort() + IF arequest1:=CreateIORequest(reply1, SIZEOF ioaudio) + + /* want to allocate and use any channel with OpenDev() */ + arequest1.data:=[1,2,4,8]:CHAR + arequest1.length:=4; + ior:=arequest1 + ior.command:=ADCMD_ALLOCATE + IF (0=OpenDevice('audio.device', 0, arequest1, 0)) + + /* copy iorequest for double buffered operation */ + ior.flags:=ADIOF_PERVOL + arequest1.volume:=64 /* volume = MAX */ + arequest1.period:=Div(3546895,rate)/* set frequency */ + arequest1.cycles:=1 /* 1 cycle only */ + ior.command:=CMD_WRITE + CopyMem(arequest1,arequest2,SIZEOF ioaudio) + mnode:=arequest2 + mnode.replyport:=reply2 + + /* send first two buffer's full to device */ + len:=as_Read(file,buffer1,BUFFSIZE) + arequest1.data:=buffer1 + arequest1.length:=len + beginio(arequest1) + len:=as_Read(file,buffer2,BUFFSIZE) + arequest2.data:=buffer2 + arequest2.length:=len + beginio(arequest2) + + /* wait on request1 first time around */ + mnode:=arequest1 + go:=1 + + /* until done, keep feeding data to device */ + WHILE (go) + WaitPort(mnode.replyport) + VOID GetMsg(mnode.replyport) + ioa:=mnode + IF ioa=arequest1 + mnode:=arequest2 + ELSE + mnode:=arequest1 + ENDIF + IF ((len:=as_Read(file, ioa.data, BUFFSIZE))>0) AND (CheckSignal(SIGBREAKF_CTRL_C)=0) + ioa.length:=len + beginio(ioa) + ELSE + go:=0 + ENDIF + ENDWHILE + + /* clean up */ + WaitPort(mnode.replyport) + GetMsg(mnode.replyport) + + CloseDevice(arequest1) + ENDIF + DeleteIORequest(arequest1) + ENDIF + DeleteMsgPort(reply2) + ENDIF + DeleteMsgPort(reply1) + ENDIF + FreeVec(buffer2) + ENDIF + FreeVec(buffer1) + ENDIF + as_Close(file) +ENDIF + +ENDPROC + + +/* from amiga.lib */ +PROC beginio(arequest) + MOVE.L arequest,A1 + MOVE.L A6,-(A7) + MOVE.L $14(A1),A6 + JSR -$1E(A6) + MOVE.L (A7)+,A6 +ENDPROC + + + + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Async/typef.e b/amigae33a/E_v3.3a/Src/Src/Tools/Async/typef.e new file mode 100644 index 0000000..f13adca --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Async/typef.e @@ -0,0 +1,26 @@ +/* + + typef.e Michael Zucchi 1993 + + A simple, quick 'type' command, using async.m + + */ + +MODULE 'tools/async', 'dos/dos' + +PROC main() + +DEF in,args:PTR TO LONG,rdargs,line[1024]:ARRAY OF CHAR + +args:=[0]; +IF rdargs:=ReadArgs('Name/A', args, 0) + IF (in:=as_Open(args[0],MODE_OLDFILE,3,5120)) + WHILE (as_FGetS(in, line, 1024)) AND (CheckSignal(SIGBREAKF_CTRL_C)=0) + PutStr(line) + ENDWHILE + as_Close(in) + ENDIF + FreeArgs(rdargs) +ENDIF + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Boopsi/Boopsi.e b/amigae33a/E_v3.3a/Src/Src/Tools/Boopsi/Boopsi.e new file mode 100644 index 0000000..72459a0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Boopsi/Boopsi.e @@ -0,0 +1,21 @@ +OPT MODULE + +MODULE 'intuition/classes', 'utility/hooks', 'intuition/classusr' + +/* example call: domethod(myobj,[METHODID,...]) */ + +EXPORT PROC domethod(obj:PTR TO object,msg:PTR TO msg) + DEF h:PTR TO hook,o:PTR TO object,dispatcher + IF obj + o:=obj-SIZEOF object /* instance data is to negative offset */ + h:=o.class + dispatcher:=h.entry /* get dispatcher from hook in iclass */ + MOVE.L h,A0 + MOVE.L msg,A1 + MOVE.L obj,A2 /* probably should use CallHookPkt, but the */ + MOVE.L dispatcher,A3 /* original code (DoMethodA()) doesn't. */ + JSR (A3) /* call classDispatcher() */ + MOVE.L D0,o + RETURN o + ENDIF +ENDPROC NIL diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/CloneScreen/clonescreen.e b/amigae33a/E_v3.3a/Src/Src/Tools/CloneScreen/clonescreen.e new file mode 100644 index 0000000..c14ff2f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/CloneScreen/clonescreen.e @@ -0,0 +1,76 @@ +-> clonescreen.c, from RKRM libs. + +OPT MODULE, OSVERSION=37 + +MODULE 'intuition/intuition', 'intuition/screens', + 'graphics/text', 'graphics/modeid' + +EXPORT PROC openclonescreen(pub_screen_name,clone_title,depth=0,clone_pub_name=NIL) + DEF my_screen=NIL:PTR TO screen, screen_modeID, pub_scr_font_name, + font_name, font_name_size, pub_screen_font:PTR TO textattr, + opened_font=NIL:PTR TO textfont, pub_screen:PTR TO screen, + screen_drawinfo=NIL:PTR TO drawinfo, di_font:PTR TO textfont + + IF pub_screen:=LockPubScreen(pub_screen_name) + IF screen_drawinfo:=GetScreenDrawInfo(pub_screen) + di_font:=screen_drawinfo.font + IF (screen_modeID:=GetVPModeID(pub_screen.viewport))<>INVALID_ID + pub_scr_font_name:=Long(di_font+10) -> node.name + font_name_size:=1+StrLen(pub_scr_font_name) + IF font_name:=String(font_name_size) + StrCopy(font_name,pub_scr_font_name) + pub_screen_font:=[font_name,di_font.ysize,di_font.style,di_font.flags]:textattr + IF opened_font:=OpenFont(pub_screen_font) + IF my_screen:=OpenScreenTagList(NIL, + [SA_WIDTH, pub_screen.width, + SA_HEIGHT, pub_screen.height, + SA_DEPTH, IF depth THEN depth ELSE screen_drawinfo.depth, + SA_TYPE, IF clone_pub_name THEN PUBLICSCREEN ELSE CUSTOMSCREEN, + SA_OVERSCAN, OSCAN_TEXT, + SA_AUTOSCROLL, TRUE, + SA_FONT, pub_screen_font, + SA_PENS, screen_drawinfo.pens, + SA_DISPLAYID, screen_modeID, + SA_TITLE, clone_title, + SA_PUBNAME, clone_pub_name, + NIL]) + ENDIF + ENDIF + ENDIF + ENDIF + FreeScreenDrawInfo(pub_screen,screen_drawinfo) + ENDIF + UnlockPubScreen(pub_screen_name,pub_screen) + ENDIF + IF my_screen=NIL THEN Raise("SCR") +ENDPROC my_screen,opened_font + +EXPORT PROC closeclonescreen(screen,font,window=NIL) + DEF r + IF window THEN CloseWindow(window) + IF screen THEN r:=CloseScreen(screen) + IF r THEN IF font THEN CloseFont(font) +ENDPROC r + +EXPORT PROC getcloneinfo(screen:PTR TO screen) + DEF di:PTR TO drawinfo, depth=0 + IF di:=GetScreenDrawInfo(screen) + depth:=di.depth + FreeScreenDrawInfo(screen,di) + ENDIF +ENDPROC depth,screen.width,screen.height + +EXPORT PROC backdropwindow(screen:PTR TO screen,idcmp=0,flags=0) + DEF wnd=NIL:PTR TO window + IF (wnd:=OpenWindowTagList(NIL, + [WA_LEFT,0, + WA_TOP,0, + WA_WIDTH,screen.width, + WA_HEIGHT,screen.height, + WA_IDCMP,idcmp, + WA_FLAGS,flags OR $1900, + WA_TITLE,'', + WA_CUSTOMSCREEN,screen, + NIL]))=NIL THEN Raise("WIN") + stdrast:=wnd.rport +ENDPROC wnd diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/CloneScreen/testclone.e b/amigae33a/E_v3.3a/Src/Src/Tools/CloneScreen/testclone.e new file mode 100644 index 0000000..c7ca29c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/CloneScreen/testclone.e @@ -0,0 +1,21 @@ +-> test screen cloning + +OPT OSVERSION=37 + +MODULE 'tools/clonescreen' + +PROC main() HANDLE + DEF screen=NIL,font=NIL,win=NIL,xsize,ysize,depth + screen,font:=openclonescreen('Workbench','My Cloned Workbench') + win:=backdropwindow(screen) + depth,xsize,ysize:=getcloneinfo(screen) + EasyRequestArgs(win,[20,0,'On My Own Screen + Backdrop Window!', + 'Screen Dimensions Are \dx\dx\d', + 'Continue'],0,[xsize,ysize,depth]) +EXCEPT DO + closeclonescreen(screen,font,win) + SELECT exception + CASE "SCR"; WriteF('no screen!\n') + CASE "WIN"; WriteF('no window!\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Constructors/constructors.doc b/amigae33a/E_v3.3a/Src/Src/Tools/Constructors/constructors.doc new file mode 100644 index 0000000..0ed142a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Constructors/constructors.doc @@ -0,0 +1,18 @@ +constructors.m + +This module conatins various constructor functions for common +data structures. + + lh:=newlist(lh=NIL:PTR TO lh,type=0) + +initialises a an exec list header for you. if lh=NIL, it will allocate +a the header for you, otherwise it will use the pointer. +raises: "MEM" (only if lh=NIL) +example: mylist:=newlist() + + ln:=newnode(ln=NIL:PTR TO ln,name=NIL,type=0,pri=0) + +like newlist, newnode will allocate a node for you if ln=NIL. +raises: "MEM" (only if ln=NIL) +example: newnode(n,'bla') + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Constructors/constructors.e b/amigae33a/E_v3.3a/Src/Src/Tools/Constructors/constructors.e new file mode 100644 index 0000000..47ffd96 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Constructors/constructors.e @@ -0,0 +1,22 @@ +-> various constructors module + +OPT MODULE +OPT EXPORT + +MODULE 'exec/lists', 'exec/nodes' + +PROC newlist(lh=NIL:PTR TO lh,type=0) + IF lh=NIL THEN lh:=NEW lh + lh.head:=lh+4 + lh.tailpred:=lh + lh.tail:=0 + lh.type:=0 + lh.pad:=0 +ENDPROC lh + +PROC newnode(ln=NIL:PTR TO ln,name=NIL,type=0,pri=0) + IF ln=NIL THEN ln:=NEW ln + ln.name:=name + ln.pri:=pri + ln.type:=type +ENDPROC ln diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Constructors/constructorstest.e b/amigae33a/E_v3.3a/Src/Src/Tools/Constructors/constructorstest.e new file mode 100644 index 0000000..c64f3ae --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Constructors/constructorstest.e @@ -0,0 +1,11 @@ +-> constructortest.e + +MODULE 'tools/constructors' + +PROC main() HANDLE + DEF list,a + list:=newlist() + FOR a:=1 TO 10 DO Enqueue(list,newnode(NIL,'silly_nodes_test'+a,0,Rnd(100))) +EXCEPT + WriteF('no mem!\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/CookRawKey/cookRawkey.doc b/amigae33a/E_v3.3a/Src/Src/Tools/CookRawKey/cookRawkey.doc new file mode 100644 index 0000000..6ee0d8f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/CookRawKey/cookRawkey.doc @@ -0,0 +1,36 @@ +cookRawkey.m - Module of functions designed to process a raw input event, +translating it into its corresponding Vanilla keycode as defined by the +current keymap. Uses the console.device. + + warmupRawkeyCooker() + +Initializes the module to enable processing of raw input events. Should be +called once prior to invoking any of the other functions in the module. +May raise any of the following exceptions: "MEM", ER_CREATEPORT, +ER_CREATEIO, ER_OPENDEVICE, ER_ASKKEYMAP. + + ascii_keycode:=cookRawkey(message.code, message.qualifier, message.iaddress) + +ascii_keycode gets the Vanilla ASCII value if one exists, else 0. message is +here a PTR TO intuimessage, which contains the address of an IDCMP_RAWKEY +message. Vanilla ASCII codes may be manufactured by passing in a valid raw +code and a valid raw qualifier, and a valid PTR TO LONG which points to +deadkey prefixes (or zeroized memory if deadkeys aren't desired, i.e., +[0]:LONG) for the iaddress. + + shutdownRawkeyCooker() + +Cleans up the module. Should be called once when the module's functions are +no longer needed. Raises no exceptions. Performs complete sanity checks, +and may therefore be safely called multiple times. + + +NOTES: + +It is entirely possible that this module will successfully translate any +kind of raw input event properly, although this has not been tested. :-) + +You may repeatedly warmup and shutdown the rawkey cooker module, but you must +be careful to call shutdownRawkeyCooker() before calling warmupRawkeyCooker() +a subsequent time. Otherwise, the allocated resources will be irreclaimable +and your system will degrade. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/CookRawKey/cookRawkey.e b/amigae33a/E_v3.3a/Src/Src/Tools/CookRawKey/cookRawkey.e new file mode 100644 index 0000000..75f25a2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/CookRawKey/cookRawkey.e @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------* + cookRawkey.e - Use console.device to convert rawkeys to asciikeys. + + Modifications: + Rev 1, 4 Oct 94, Barry Wills + cookRawkey() modified to correctly process deadkeys; + 1) changed parameter 'iAddress' to 'iAddress:PTR TO LONG'; + 2) changed statement 'PutLong(ie+10, iAddress)' to + 'PutLong(ie+10, iAddress[])' + *---------------------------------------------------------------------------*/ +OPT MODULE + +MODULE 'console', + 'devices/console', + 'devices/conunit', + 'devices/inputevent', + 'devices/keymap', + 'exec/io', + 'exec/ports' + +EXPORT CONST ER_NONE = 0, + ER_CREATEPORT = "PORT", + ER_CREATEIO = "IO", + ER_OPENDEVICE = "DEV", + ER_ASKKEYMAP = "KMAP" + +DEF consoleMessagePort:PTR TO mp, + consoleIO:PTR TO iostd + +EXPORT PROC warmupRawkeyCooker() + IF (consoleMessagePort:=CreateMsgPort())=NIL THEN RETURN ER_CREATEPORT + IF (consoleIO:=CreateIORequest(consoleMessagePort, SIZEOF iostd))= + NIL THEN RETURN ER_CREATEIO + IF OpenDevice('console.device', CONU_LIBRARY, + consoleIO, CONFLAG_DEFAULT) THEN RETURN ER_OPENDEVICE + consoleIO.command:=CD_ASKKEYMAP + consoleIO.length:=SIZEOF keymap + consoleIO.data:=NewR(SIZEOF keymap) + IF DoIO(consoleIO) THEN RETURN ER_ASKKEYMAP + IF (consoleIO.flags AND IOF_QUICK)=0 THEN WaitIO(consoleIO) + consoledevice:=consoleIO.device +ENDPROC ER_NONE + /* warmupRawkeyCooker */ + +EXPORT PROC shutdownRawkeyCooker() + IF consoleIO + IF consoleIO.data THEN Dispose(consoleIO.data) + IF consoleIO.device + AbortIO(consoleIO) + CloseDevice(consoleIO) + ENDIF + DeleteIORequest(consoleIO) + ENDIF + IF consoleMessagePort THEN DeleteMsgPort(consoleMessagePort) +ENDPROC + /* shutdownRawkeyCooker */ + +EXPORT PROC cookRawkey(idcmpCode, idcmpQualifier, iAddress:PTR TO LONG) + DEF asciiChar=0, ie:inputevent, buffer[1]:STRING, actual + ie.nextevent:=NIL + ie.class:=IECLASS_RAWKEY + ie.subclass:=0 + ie.code:=idcmpCode + ie.qualifier:=idcmpQualifier + PutLong(ie+10, iAddress[]) + actual:=RawKeyConvert(ie, buffer, 1, consoleIO.data) + IF actual=1 THEN asciiChar:=buffer[0] +ENDPROC asciiChar + /* cookRawkey */ diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/CookRawKey/cookRawkeyTest.e b/amigae33a/E_v3.3a/Src/Src/Tools/CookRawKey/cookRawkeyTest.e new file mode 100644 index 0000000..e7cc209 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/CookRawKey/cookRawkeyTest.e @@ -0,0 +1,124 @@ +/*------------------------------------------------------------------------* + cookRawkeyTest.e - test and demonstrate usage of module cookRawkey.m + + See function winDim() for a neato (although somewhat messy) example of + font- and os-sensitivity. + + Note: if your using custom fonts, you must have all characters defined + in order to see them. If any show up blank (except for, like, Space), + chances are that character isn't defined in your font. + *------------------------------------------------------------------------*/ + +MODULE 'devices/inputevent', + 'graphics/gfxbase', + 'graphics/rastport', + 'graphics/text', + 'intuition/intuition', + 'intuition/screens', + 'tools/cookRawkey', + 'tools/ctype' + +CONST ESCAPE_KEY=27 + +CONST TEXT_MAXLENGTH=23, + TITLE_MAXLENGTH=20 + +DEF wborleft, wborbottom, fontBelowBase + +PROC max(a, b) IS IF a>b THEN a ELSE b + +PROC winDim(gfxBase:PTR TO gfxbase, windowTitle) +/* determine the dimensions necessary to display our text. */ + DEF scr:PTR TO screen, xsize=0, ysize=0 + IF KickVersion(36) + IF scr:=LockPubScreen('Workbench') + xsize:=max(gfxBase.defaultfont::textfont.xsize*TEXT_MAXLENGTH, + IntuiTextLength([0,1,RP_JAM1,0,0, scr.font, + windowTitle,NIL]:intuitext)+1)+ + (wborleft:=scr.wborleft)+scr.wborright + ysize:=gfxBase.defaultfont::textfont.ysize+ + scr.rastport::rastport.font::textfont.ysize+ + scr.wbortop+1+ + (wborbottom:=scr.wborbottom) + UnlockPubScreen(NIL, scr) + ENDIF + ELSE + wborleft:=4 + wborbottom:=4 + xsize:=8*TEXT_MAXLENGTH+(wborleft*2) + ysize:=8*2+(wborbottom*2+1) + ENDIF +ENDPROC xsize,ysize + +PROC format(s, format, n) +/*---------------------------------------------------------* + format string 's' with number 'n', according to format + string 'format'. pads leading spaces in 's' with zeroes. + *---------------------------------------------------------*/ + DEF i, strLast + StringF(s, format, n) + strLast:=StrLen(s)-1 + FOR i:=0 TO strLast DO IF s[i]=" " THEN s[i]:="0" +ENDPROC s + +PROC main() HANDLE + DEF win=NIL:PTR TO window, winTitle, winHeight, winWidth, + idcmpMessage:PTR TO intuimessage, idcmpCode, idcmpQualifier, iAddress, + error, errorMessage, asciiChar, hexStr[3]:STRING, decStr[3]:STRING + /*------------------------------* + Init rawkey conversion module. + *------------------------------*/ + IF error:=warmupRawkeyCooker() THEN Raise(error) + winWidth,winHeight:=winDim(gfxbase, winTitle:='Press Escape to Quit') + /*-- Convert rawkeys until ESC key is pressed. --*/ + IF win:=OpenW(20, 20, winWidth, winHeight, + IDCMP_RAWKEY, WFLG_ACTIVATE, + winTitle, NIL, WBENCHSCREEN, NIL) + IF FALSE=KickVersion(36) THEN SetTopaz(win) + fontBelowBase:=win.rport::rastport.txheight- + win.rport::rastport.font::textfont.baseline + REPEAT + /*-- Wait on rawkey. --*/ + WHILE (idcmpMessage:=GetMsg(win.userport))=NIL DO WaitPort(win.userport) + /*-- Copy intuimessage info, then reply. --*/ + idcmpCode:=idcmpMessage.code + idcmpQualifier:=idcmpMessage.qualifier + iAddress:=idcmpMessage.iaddress + ReplyMsg(idcmpMessage) + /*------------------------* + Convert rawkey to ascii. + *------------------------*/ + IF asciiChar:=cookRawkey(idcmpCode, idcmpQualifier, iAddress) + TextF(wborleft, win.height-wborbottom-fontBelowBase, + 'Char=\c Hex=$\s Dec=\s', + IF isprint(asciiChar) THEN asciiChar ELSE $7f, + format(hexStr, '\h[3]', asciiChar), + format(decStr, '\d[3]', asciiChar)) + ENDIF + UNTIL asciiChar=ESCAPE_KEY + CloseW(win) + ELSE + WriteF('Can''t open window\n') + ENDIF + /*---------------------------------* + Cleanup rawkey conversion module. + *---------------------------------*/ + shutdownRawkeyCooker() +EXCEPT + errorMessage:='figger it out' + /*--------------------------------------* + Handle exceptions raised by conversion + *--------------------------------------*/ + SELECT exception + CASE "MEM"; errorMessage:='get memory' + CASE ER_CREATEPORT; errorMessage:='create message port' + CASE ER_CREATEIO; errorMessage:='create IO request' + CASE ER_OPENDEVICE; errorMessage:='open console.device' + CASE ER_ASKKEYMAP; errorMessage:='ask keymap' + ENDSELECT + WriteF('Could not \s!\n', errorMessage) + /*---------------------------------* + Cleanup rawkey conversion module. + *---------------------------------*/ + shutdownRawkeyCooker() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Ctype/ctest.e b/amigae33a/E_v3.3a/Src/Src/Tools/Ctype/ctest.e new file mode 100644 index 0000000..b6815a4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Ctype/ctest.e @@ -0,0 +1,5 @@ +MODULE 'tools/ctype' + +PROC main() + WriteF('\d \d \d\n',islower(tolower("A")),islower(toupper("a")),isalnum("+")) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Ctype/ctype.doc b/amigae33a/E_v3.3a/Src/Src/Tools/Ctype/ctype.doc new file mode 100644 index 0000000..58ee219 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Ctype/ctype.doc @@ -0,0 +1,16 @@ +ctype.m: functions usually found in ctype.h + +tolower(c) converts any char to lowercase +toupper(c) converts any char to uppercase + +isspace(a) " " +isupper(a) "A" .. "Z" +islower(a) "a" .. "z" +isalpha(a) "a" .. "z", "A" .. "Z" +isalnum(a) "a" .. "z", "A" .. "Z", "0" .. "9" +isxdigit(a) "0" .. "9", "a" .. "f", "A" .. "Z" +isdigit(a) "0" .. "9" +iscntrl(a) 0 .. 31, 128 .. 159 +isprint(a) 32 .. 127, 160 .. 255 +isgraph(a) isprint - isspace +ispunct(a) isgraph - isalnum diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/GI1.License b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/GI1.License new file mode 100644 index 0000000..4dee842 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/GI1.License @@ -0,0 +1,56 @@ + Gadget & Image Collection #1 + +COPYRIGHT and TRADEMARKS + +Gadget & Image Collection #1 +(c) Copyright 1992-94 Commodore-Amiga, Inc. All Rights Reserved + +FILES + + classes (dir) + gadgets (dir) + button.gadget calendar.gadget + tabs.gadget + images (dir) + led.image + + +DISCLAIMER + +These FILES are provided "AS-IS" and subject to change without notice; +no warranties are made. All use is at your own risk. No liability or +responsibility is assumed. + + +DISTRIBUTION + +The FILES may be reproduced and distributed subject to agreement with +the following terms and conditions: + +1. The FILES may be reproduced but may not be modified in any way + with the exception of unarchiving for unarchived distribution. + +2. The FILES may only be distributed as an integral part of a software + product solely for Commodore Amiga computers. + +3. Commodore shall be held harmless from any and all claims, damages + and liabilities resulting from or arising out of the use or + distribution of the FILES. + +4. The copyright, trademarks, and disclaimer shown above must be + distributed with all copies of the FILES. + +5. The FILES may not be installed on a user's system or Workbench + unless the installation procedure has determined that the user's + system or Workbench does not contain a more recent version of the + FILES. + +7. Such technical information as is contained in the FILES (and any + product thereof) or in the related documentation, utilities, and + examples may not be exported in contravention of the laws and + regulations of the United States. + +8. Commodore may terminate permission to distribute the FILES at + any time, with or without cause. This permission will + automatically terminate upon any breach of these terms and + conditions. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/GI1.Readme b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/GI1.Readme new file mode 100644 index 0000000..c8cd852 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/GI1.Readme @@ -0,0 +1,12 @@ +GI1 42.1 - Copyright (c) 1994 Commodore-Amiga, Inc. + All Rights Reserved. + Written by David N. Junod + +This is a collection of BOOPSI gadgets and images. Includes a +sophisticated button gadget, calendar gadget, LED image and a page +selection gadget. These classes work with all Amigas and require a +minimum of 2.04 (V37). + +See GI1.License for distribution information. An Installer installation +script is included to ease installation of the classes, Autodocs, header +files and examples. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/button.gadget b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/button.gadget new file mode 100644 index 0000000..7ee40a7 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/button.gadget differ diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/calendar.gadget b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/calendar.gadget new file mode 100644 index 0000000..dde6380 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/calendar.gadget differ diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/tabs.gadget b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/tabs.gadget new file mode 100644 index 0000000..03c9327 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/tabs.gadget differ diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/tapedeck.gadget b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/tapedeck.gadget new file mode 100644 index 0000000..028771c Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Gadgets/tapedeck.gadget differ diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Images/led.image b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Images/led.image new file mode 100644 index 0000000..ff1943b Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Classes/Images/led.image differ diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/EasyGUI.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/EasyGUI.doc new file mode 100644 index 0000000..d666696 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/EasyGUI.doc @@ -0,0 +1,1322 @@ + Introducing: + + E A S Y G U I v3.3b4 + + An interface builder for E, with the following highlights: + + - It's totally Font-Sensitive + - It's Resizable + - It's Self-Organising, i.e. it arranges gadgets + - It's more StyleGuide compliant than your granny + - It's Fast and Flexible + - It's relatively small, needs no extra external libraries + - The layout-engine is user-extendable with PLUGINs + - And above all: It's extremely easy to use!!! + ++---------------------------------------------------------------+ +| 0. History | ++---------------------------------------------------------------+ + +As of v3.3a, maintained by Jason R. Hulance, who you can contact at +the addresses given in the Beginner's Guide to Amiga E. +(Email: jason@fsel.com) + +[v3.3b4:] +- Fixed changegui() window resizing to move window as well, if + necessary. + +[v3.3b3 is a minor update that fixes a bug with AppWindow messages +that crept in under the guise of a safety feature in v3.3b...] + +Changes from the v3.3b version: +- Fixed bug: STR, INTEGER and CHECK gadgets' action functions were not + getting passed the correct new value parameter. +- Fixed bug: LISTV wasn't always wide enough for label. +- Added EG_HIDE tag to enable the GUI to be created with a hidden (closed) + window. +- Changed blockwin()/unblockwin() so they now nest properly. + +Changes from the v3.3a version: +- MAJOR CHANGE: made the main functions use a taglist for their optional + arguments (it was getting a bit ridiculous...). This gives a bit more + flexibility for the programmer and makes for much more readable code, so + I'm afraid it was inevitable. To ease the change-over a bit there is an + example module which gives the old style versions of the functions (just + for EasyGUI.m; you can do your own for EasyGUI_lite.m). +- MAJOR ADDITION: support for multi-window GUIs. This is via the + multiinit(), addmultiA(), multimessage(), cleanmulti() and checkmulti() + functions. The new scheme shares message ports, and efficiently + dispatches on the message data. This is *massively* more efficient than + using the old scheme (OR-ing the signal masks of each window), and + effectively removes the limit of windows that a GUI can use. +- Changed 'info' default to -1, which now gets translated to the guihandle. + This helps a lot with multi-window GUIs. +- Changed 'data' default to -1, which now gets translated to the gadget + (not the *real* gadget, but the one that can be used with the setXXX() + functions). +- Changed the default screen to be the *default* public screen (rather than + specifically Workbench). +- Changed AppWindow gadget location code to make it more robust, and now + includes the gadget label as "hittable". +- Added a short description of the examples to this doc. +- Added a reference to the guihandle to each PLUGIN so they can more easily + access the GUI window and use the GUI manipulation functions. +- Added closewin()/openwin() to enable the window to be temporarily closed + and opened. These are most useful for iconification (see the iconify and + toolify PLUGINs). Note that this new feature may break old PLUGINs that + assume the GUI window will never change. +- Added extra 'maxw' and 'maxh' parameters to make window open with maximum + width/height (taking into account position, too). +- Added extra 'wintype' parameter to give control over window borders. +- Added some more changeXXX() functions, and changed (sorry!) the other + changeXXX() functions to make them more uniform. +- Added extra checking in message loop to ignore stray IDCMP_MOUSEMOVE + messages. This is needed because GadTools doesn't identify the gadget if + you use GACT_FOLLOWMOUSE, so your PLUGIN finds it hard to trap this + message properly. + [Problem reported by Ralph Wermke ] +- Fixed bug in key handling code for the SLIDER gadget. + [Bug reported first by Fred van der Zee ] +- Fixed an old bug: guihandles weren't deallocated by cleangui(). +- Fixed an old bug: some messages weren't getting replied. +- Fixed an old bug: window wasn't being centred on screen if smaller than + display (and may not have been openable). +- Minor changes to the layout of a couple of gadgets. +- Made gadtoolsbase and workbenchbase public, mainly so that PLUGINs + can use them (if you have a GUI open then they must be valid). +- Made things more friendly for multi-tasking: gh.wnd is NIL when the + GUI is in an unmodifiable state. +- Made awprocs use a copy of the appmessage, mainly so that they can do + things like manipulate the GUI without problems. +- Made a third version of EasyGUI. This is EasyGUI_debug.m, which is the + same as EasyGUI.m except that it will print a short diagnostic message + before raising an exception. This should be used when developing your + program to help track down the actual reason for a fault. + +Changes from the v3.2e version: +- Lots of minor fixes to most gadgets. +- Added conditional resizing. +- Added (optional) data field for all gadgets. +- Added Style Guide compliant keyboard shortcuts. +- Added extra arguments to some PLUGIN methods. +- Added simple mechanism for PLUGINs to use GadTools gadgets (gtrender()). +- Added AppWindow support for main window, *BUTTON, LISTV, STR and PLUGINs. +- Added a lot of GUI manipulation functions. +- Made an EasyGUI_lite version without a lot of features. + +changes from the v3.2a version: +- now supports PLUGINs for unlimited complex gui's!!! (check section 5) +- added settext() and setnum() +- fixed NUM gadget +- added topaz-fallback version +- bug: rendered into the border when used with sysihack +- bug: could cause enforcer hits when some strings were NIL +- bug: dealocation of resources in wrong order caused problems + +changes from the v3.1a version: +- new functions to access/modify gadgets while GUI is active +- easily add gadtools menus +- more complete docs +- works better with multiple simultanuous EasyGUIs +- LISTV, MX and CYCLE have an extra "current" parameter now +- STR now takes an _estring_ as value (change this in old sources!) +- bug: current gadget values would reset upon resize +- bug: would open in middle of screen instead of visible part +- many tiny bugs removed + ++---------------------------------------------------------------+ +| 1. EasyGUI Intro | ++---------------------------------------------------------------+ + +EasyGUI takes the form a module file that needs to be included into your E +source (needless to say, it needs v2.04/v37 of the OS). The most simple +form of constructing a GUI consist of calling the function easyguiA() with +a (possibly nested) E list which describes your GUI. just to show how +Easy, try this source: + + MODULE 'tools/EasyGUI' + PROC main() IS easyguiA('um,...',[BUTTON,0,'Ok!']) + +This'll open a window with just one gadget in it, and wait for the user to +push it. If easyguiA() can't get what it wants, it'll start throwing around +exceptions, so we'll probably need an exception handler to be able to +inform the user properly (see below). + +The first arg of easyguiA() is the window title, the second one is the GUI +description. The form of these desciptions is quite simple: It's a list +with as first element the type of gadget, the second is called an action +value (more later), and the rest is gadget-specific. + +To be able to build GUI's outof more components than just one gadget, one +can group gadgets with a ROW and a COL list: + + [COLS, + [BUTTON,1,'Ok'], + [BUTTON,0,'Cancel'] + ] + +This'll create a new group, consisting of two gadgets next to each other. +COLS and ROWS groups are like a single gadget, i.e. you can easily put them +into other groups, to create GUI's of infinite complexity. + +Other Grouping functions are EQCOLS and EQCOLS, which try to align gadgets +in a group. IF you get strange layouts using these, you should try grouping +subgroups before putting them in a larger group. + +[BEVEL,a] will put a bevel box around a, whatever it is (a gadget, a +group...), and BEVELR is the recessed version. + +Other elements of groups are mostly gadgets, which have a specific #of +arguments. [If the number of arguments is incorrect, EasyGUI will raise the +"Egui" exception.] + +The first element is always the type of gadget to create (see below). The +second element is always something called an "actionvalue", which tells +EasyGUI what needs to be done when the user interacts with the gadget. All +elements after that are gadget specific. + +An action value may be: +- a small positive integer (0-1000). If the user selects this gadget, + EasyGUI will close the window, and return that value as returnvalue from + the easyguiA() call. This is meant for "Ok" / "Cancel" type buttons. +- a pointer to an "action function". If the user selects this gadget, + EasyGUI will call the function with as arguments depending on the type of + gadget (for example a slider will get it's current value). After the + actionfunction returns, EasyGUI continues processing messages from the + GUI. + example: + + ...[BUTTON,{load},'Load'],... + + PROC load(info) IS WriteF('You pushed the "Load" button!\n') + + + the value of `info' is explained below. Or: + + DEF s[100]:STRING + + ...[STR,{str},'input:',s,50,4], + [CYCLE,{cycle},'choose:',['Yep','Nope',NIL],1],... + + PROC str(info,news) IS WriteF('the new string is: \s\n',news) + PROC cycle(info,newc) IS WriteF('the new choice is: \d\n',newc) + + In the action function, you can store the new value, however EasyGUI + keeps track of it itself too: In the case of the STR above it will + StrCopy() new values into your estring, so it automatically has the + correct value after closing. In the case of all other gadgets it stores + the new (integer) value in the list (so that `1' in `CYCLE' may become + `0'). This has the added benefit that windows that are opened and then + closed again will automatically start with the current values. + + If you want to close the GUI from an action function then you can call + the quitgui() function, which raises a "QUIT" exception (be careful to + not handle this exception in your code -- just ReThrow() it if your + action function has an exception handler). The single argument to + quitgui() (which defaults to 0) will be returned from the easyguiA() call, + in the same way that action values are. The definition of quitgui() is: + + PROC quitgui(ret=0) IS Throw("QUIT",ret) + + There are two new, optional arguments to action functions: `qual' and + `data'. If you wish to use these arguments your action function must + include them at the beginning (and you must have a `data' argument if you + want to use the `qual' argument). For instance, a button action function + can be defined in any of these three ways: + + PROC action(info) IS WriteF('info=$\h\n', + info) + PROC action(data,info) IS WriteF('info=$\h,data=$\h\n', + info,data) + PROC action(qual,data,info) IS WriteF('info=$\h,data=$\h,qual=$\h\n', + info,data,qual) + + (This scheme gives *full* compatibility with the old EasyGUI action + functions, whilst still allowing the new features to be used.) + + The `data' argument is the optional data field specified in the gadget. + If it is not specified or it's -1 then the actual data value that is used + is the gadget list pointer (for use with the setXXX() functions). You + could use it, instead, to pass a pointer to an object specific to the + gadget. The action function can then just call a method of that object. + This allows the same action function to be used by a number of different + gadgets, with the specific action being carried out via the data element + (since the data can be different for each gadget). + + The `qual' is basically the qualifier part of the intuimessage used to + indicate gadget clicks. Use the IEQUALIFIER_XXX constants from the + module 'devices/inputevent' to see which qualifiers were pressed when + the gadget was clicked. For example: + + PROC buttonaction(qual,data,info) + IF qual AND (IEQUALIFIER_LSHIFT OR IEQUALIFIER_RSHIFT) + PrintF('You were pressing a shift key when you clicked on me!\n') + ENDIF + ENDPROC + +The easyguiA() function: + + easyguiA(windowtitle,gui,tags=NIL) + +`tags' is a taglist which can use the following tags: + +EG_INFO + the data may be ANY value, and is passed as an arg to the action + functions. For example if you write a prefsrequester, this may be the + the prefs OBJECT. Your actionfunctions then have a simple task changing + the value of the element in question. (If this is -1 or not present, + then it the info used will be the 'guihandle' value for this GUI. See + Chapter 4.) + +EG_SCRN + the data is an optional screen ptr to open on. if NIL or not present + EasyGUI opens on the default public screen (usually Workbench). + +EG_FONT + the data is a fontdescription (i.e., a `textattr'). If NIL or not + present, EasyGUI will use the same font as the screen (for Workbench this + is the font the user selected as "screenfont" in fontprefs). + +EG_MENU + the data is a newmenus structure (as in gadtools.library). EasyGUI will + then automatically attach it to the window and arrange any messages. You + can give the same actionvalues as gadgets in the newmenu.userdata, and + the actionfunction can be the same as for a `BUTTON', i.e.: + + [...,NM_ITEM,0,'Load','l',0,0,{load},...]:newmenu + + can use the same load() as in the example further above (the optional + `qual' and `data' arguments [see below] will always be NIL). [The + constants NM_ITEM, etc., are from the module 'libraries/gadtools'.] + +EG_GHVAR + the data is the address of a LONG variable which gets a copy of the + guihandle (see Multiple Windows, below). You just specify something like + {gh} instead of having to use guiinitA(), etc. Note that you can also + get the guihandle by using the new default for the `info' of a GUI + (as described above). + +EG_AWPROC + the data is a function to be called when the user drops icons on the + window (and no gadget handles the drop). By default, this is NIL and + this means that the window will not to be made into an AppWindow. If + it's *not* NIL then the window *will* be an AppWindow, and the *BUTTON, + LISTV and STR gadgets will get their awprocs called if icons are dropped + directly on them (PLUGIN gadgets can also react to AppWindow messages). + If the drop does not land on a gadget with an awproc then this awproc + (for the whole window) will be called. (See the examples.) awprocs are + like action functions and can be defined in one of two ways: + + PROC awproc(info,awmsg:PTR TO appmessage) + PROC awproc(data,info,awmsg:PTR TO appmessage) + + `info' is the GUI info, `awmsg' is a *copy* of the appmessage and `data' + is the optional data field for the gadget (or the `plugin_object' for + PLUGINs, and NIL for the window one). + +EG_TOP, EG_LEFT + the data define the top-left coordinate of the window. If either of them + is -1 (the default), then the window will be centred on that axis (in the + visible part of the screen). + +EG_MAXW, EG_MAXH + the (boolean) data specify whether to try make the window size maximal in + width or height (based on screen size), rather than the default of + minimal (based on the GUI). If you specify a position then the maximal + size of that axis will be the remaining part of the screen. So, on a + screen of width 640, if you specify EG_LEFT of 100 then the maximum width + the window can be is 540. + +EG_WTYPE + the data is a constant to dictate the window decoration (i.e., what + happens with the borders). The choices are: + + WTYPE_SIZE the default, which gives you all the standard + gadgets and a size gadget at the bottom. + WTYPE_NOSIZE omits the size gadget. + WTYPE_BASIC just has a simple border around the window. + WTYPE_NOBORDER has (suprisingly) no border. + + Be careful with these last two options as there is no close gadget for + the user to click -- you must provide them with your own method of + closing the GUI (a menu item?). (Note: the window title is ignored with + the last two types, since there's no title bar.) + +EG_CLOSE + the data is an action value/function used when the user clicks the close + gadget on the GUI window. This is most useful for multi-window GUIs (see + Multiple Windows), but it can be useful to prompt the user to confirm + before quitting the GUI. The action value will be returned from + easyguiA()/guimessage()/multiloop()/multimessage(), as usual. The action + function can be defined in one of two ways: + + PROC closeproc(info) + PROC closeproc(mh:PTR TO multihandle,info) + + `info' is the GUI's info parameter (see above), and `mh' is the + multi-window handle (see Multiple Windows) or NIL if it's a single window + GUI. + +EG_CLEAN + the data is a function to be called when the GUI is destroyed (e.g., by + calling cleangui()). This is most useful for multi-window GUIs (see + Multiple Windows), but it can generally be useful for cleaning up the + GUI's PLUGINs (see Chapter 5). The function will be called *after* the + window and the GUI has been closed and deallocated, so, for example, the + PLUGINs will no longer be on screen. It should be defined like this: + + PROC cleanproc(info) + + `info' is the GUI's info parameter (see above). Note: if guiinitA() or + addmultiA() cause an exception then this function will *not* be called. + This makes it easier to setup a GUI (see the examples). + +EG_HIDE + the (boolean) data specifies whether the GUI window is initially hidden + (closed). The default is FALSE; if you specify TRUE then you can use + openwin() to show the window when you want it to be seen. Note: this tag + is a bit useless for a normal call to easyguiA() as there's little chance + of it receiving any GUI messages if the window is closed (so the Wait() + will never return). + + ++---------------------------------------------------------------+ +| 2. Gadgets | ++---------------------------------------------------------------+ + +general format: [NAME,action,text,...] +in {}: which direction it may resize. ++ = a value that can be affected lateron with the set#? functions +* = optional value (can be omitted) + +Each gadget shows the gadget template, explanation, the form of the +actionfunction, and a typical example. + +The optional arguments to action functions (qual and data) are described in +the above chapter. + + +[BUTTON,action,intext,data*,key*,awproc*,disabled+*] + data = user data value passed to action function + key = keyboard shortcut (presses button) + awproc(data*,info,awmsg) = AppWindow proc (see above) + disabled = whether this gadget is disabled or not + buttonaction(qual*,data*,info) + example: [BUTTON,0,'Cancel'] + +[CHECK,action,righttext,checkedbool+,lefttextbool,data*,key*,disabled+*] + checkedbool = whether gadget should initially be check-marked + key = keyboard shortcut (toggles check) + disabled = whether this gadget is disabled or not + checkaction(qual*,data*,info,checkedbool) + example: [CHECK,{case},'Ignore case',TRUE,FALSE] + +[INTEGER,action,lefttext,num+,relsize,data*,key*,disabled+*] + num = initial value + key = keyboard shortcut (activates gadget) + disabled = whether this gadget is disabled or not + integeraction(qual*,data*,info,newnum) {x} + example: [INTEGER,{v},'int:',5,3] + (Note: see discussion of getinteger() in chapter 4 below.) + +[LISTV,action,textabove,relx,rely,execlist+,readbool,selected,current+, + data*,key*,awproc*,disabled+*] + execlist = ptr to an execlist. (see tools/constructors.m) + readbool = whether listview is read-only (action is ignored if it is!) + selected = 0=none, 1=highlight/show selected + key = keyboard shortcut (unshifted->select next, shifted->prev) + awproc(data*,info,awmsg) = AppWindow proc (see above) + disabled = whether this gadget is disabled or not + listviewaction(qual*,data*,info,num_selected) {x,y} + example: [LISTV,0,NIL,5,5,filenamelist,0,NIL,0] + (Note: disabling doesn't work under V37.) + +[MX,action,righttext,nil_term_elist,lefttextbool,current, + data*,key*,disabled+*] + (Note: under v37 the righttext is spaced correctly but not rendered.) + key = keyboard shortcut (unshifted->next choice, shifted->prev, wraps) + disabled = whether this gadget is disabled or not + mxaction(qual*,data*,info,num_selected) + example: [MX,{v},NIL,['One','Two','Three',NIL],FALSE,1] + (Note: disabling doesn't work under V37.) + +[CYCLE,action,lefttext,nil_term_elist,current,data*,key*,disabled+*] + key = keyboard shortcut (unshifted->next choice, shifted->prev, wraps) + disabled = whether this gadget is disabled or not + cycleaction(qual*,data*,info,num_selected) + example: [CYCLE,{v},'choose:',['Yep','Nope',NIL],1] + +[PALETTE,action,lefttext,depth,relx,rely,current+,data*,key*,disabled+*] + (Note: the current field is new to v3.3a and is _not_ optional, so any + existing v3.2e sources using a PALETTE gadget will need a small edit.) + depth = 1..8, number of bitplanes this color is for + key = keyboard shortcut (unshifted->next pen, shifted->prev, wraps) + disabled = whether this gadget is disabled or not + paletteaction(qual*,data*,info,colour) {x,y} + example: [PALETTE,{v},'color:',3,5,2] + +[SCROLL,action,isvert,total+,top+,visible+,relsize,data*,key*,disabled+*] + total = resolution of scroller + top = current top represented + visible = current + key = keyboard shortcut (unshifted->increment, shifted->decrement) + disabled = whether this gadget is disabled or not + scolleraction(qual*,data*,info,curtop) {x|y} + example: [SCROLL,{v},FALSE,10,0,2,2] + +[SLIDE,action,lefttext,isvert,min,max,cur+,relsize,levelformat, + data*,key*,disabled+*] + min,max = value range of slider + cur = current value + levelformat = string that shows levelformat, example '%2ld'. leave + a large amount of spaces left in lefttext for this. + key = keyboard shortcut (unshifted->increment, shifted->decrement) + disabled = whether this gadget is disabled or not + slideraction(qual*,data*,info,cur) {x|y} + example: [SLIDE,0,'Colors:',FALSE,1,8,3,5,''] + +[STR,action,lefttext,initial+,maxchars,relsize, + over*,data*,key*,awproc*,disabled+*] + initial = initial string contents: NOTE: HAS TO BE AN ESTRING! + maxchars = max #of chars for string + over = overwrite mode boolean (default is FALSE, i.e., insert mode) + key = keyboard shortcut (activates gadget) + awproc(data*,info,awmsg) = AppWindow proc (see above) + disabled = whether this gadget is disabled or not + stringaction(qual*,data*,info,string) {x} + (Note: action function is passed the E-string, not the gadget's buffer.) + example: [STR,0,'Pattern',s,100,5] (DEF s[100]:STRING) + (Note: see discussion of getstr() in chapter 4 below.) + +[TEXT,text,lefttext,borderbool,relsize] {x} + borderbool = whether or not a recessed bevelbox is placed around 'text' + example: [TEXT,'Selected Fonts',NIL,FALSE,3] + +[NUM,int,lefttext,borderbool,relsize] {x} + borderbool: as TEXT + example: [NUM,123,'num:',TRUE,5] + +[SBUTTON,action,intext,data*,key*,awproc*,disabled+*] {x} + same as button, only now resizes horizontally. + +[PLUGIN,action,plugin_object,isgt*,awproc*] + isgt = whether this PLUGIN is made from GadTools gadgets (see chapter 5) + awproc(plugin_object*,info,awmsg) = AppWindow proc (see above) + pluginaction(info,plugin_object) + (see separate chapter 5 on using/implementing these). + +[BAR], [SPACE] {x,y}, [SPACEH] {x}, [SPACEV] {y} + BAR places a nice divider-bar between gadgets/groups. Whether it's + horizontal or vertical depends on which group it is in. + SPACE/SPACEH/SPACEV do nothing, they only eat up space. This can be very + handy in GUI design, they act like a spring between elements (do not use + them on the borders of a GUI, only in the middle). + + +#?text: + (where #? is left/right etc.): a text to place next to the gadget. Often + is allowed to be NIL. + +relsize,relx,rely: + Generally gadgets will automatically get a size depending on a number of + factors, but relsize allows the programmer to give a minimum size for + certain gadgets, thereby sizing a whole group. If other gadgets already + account for the minimum size, this one can safely be set to a low value + such as 2. All these sizes are calculated in terms of the _height_ of + the font. Always try out your GUI with different fonts. For example if + you design a gui that only just fits horizontally with an 8 point font on + 640x200, when run on with a 13 point font on 640x512, the gui will be + quite a bit bigger horizontally, but the screen isn't, so it won't fit. + (see also: the "bigg" exception below). + +nil_term_elist: + a nil-terminated E list, such as ['One','Two','Three',NIL] + +isvert: + TRUE if gadget needs to be vertical, horizontal by default. + +key: + All keyboard shortcuts are optional (so marked with a * in the following + descriptions). If specified then they must be lowercase letters ("a" to + "z"). However, the shifted and unshifted keystrokes are *both* handled, + in the way described by the Style Guide (and this is briefly outlined for + each gadget). Also, if a key is specified then an "_" in the gadget + label text indicates the character in the label which is to be + underscored (and this ought to be the same letter as the key). If a key + is not specified then any "_"s in the label are not special. (If an + action function is invoked as a result of a key press then the `qual' + will always be 0.) + +disabled: + If this optional field is specified then the gadget can be disabled and + enabled using the setdisabled() function (see below, chapter 4), and the + current status of the gadget will be recorded in this field, too. + + +The following constants/enumerations are defined in order to make +referencing/creating the lists for each gadget a bit more readable. + + EXPORT ENUM BEV_GUI=1, + BUT_ACT=1, BUT_TXT, BUT_DATA, BUT_KEY, BUT_APPW, BUT_DIS, + CHK_ACT=1, CHK_TXT, CHK_VAL, CHK_LEFT, CHK_DATA, CHK_KEY, CHK_DIS, + INT_ACT=1, INT_TXT, INT_VAL, INT_REL, INT_DATA, INT_KEY, INT_DIS, + LST_ACT=1, LST_TXT, LST_RELX, LST_RELY, LST_LIST, LST_RO, LST_SHOW, + LST_CURR, LST_DATA, LST_KEY, LST_APPW, LST_DIS, + MX_ACT=1, MX_TXT, MX_LIST, MX_LEFT, MX_CURR, MX_DATA, MX_KEY, + MX_DIS, + CYC_ACT=1, CYC_TXT, CYC_LIST, CYC_CURR, CYC_DATA, CYC_KEY, CYC_DIS, + PAL_ACT=1, PAL_TXT, PAL_DEP, PAL_RELX, PAL_RELY, PAL_CURR, PAL_DATA, + PAL_KEY, PAL_DIS, + SCR_ACT=1, SCR_VERT, SCR_TOTL, SCR_TOP, SCR_VIS, SCR_REL, SCR_DATA, + SCR_KEY, SCR_DIS, + SLI_ACT=1, SLI_TXT, SLI_VERT, SLI_MIN, SLI_MAX, SLI_CURR, SLI_REL, + SLI_FMT, SLI_DATA, SLI_KEY, SLI_DIS, + STR_ACT=1, STR_TXT, STR_STR, STR_MAX, STR_REL, STR_OVR, STR_DATA, + STR_KEY, STR_APPW, STR_DIS, + TXT_VAL=1, TXT_TXT, TXT_BORD, TXT_REL, + NUM_VAL=1, NUM_TXT, NUM_BORD, NUM_REL, + PLG_ACT=1, PLG_OBJ, PLG_GT, PLG_APPW + + ++---------------------------------------------------------------+ +| 3. How Layout Works | ++---------------------------------------------------------------+ + +EasyGUI works by automatically layouting the gadgets on the screen. In a +first pass, it will compute the minimum size for each element: for gadgets +this involves the size of fonts and various other things. For a ROWS list, +for example, it will take the width of the biggest gadget as its width, and +computes its height by adding the heights of all other gadgets. For EQROWS +this is slightly more complicated: EasyGUI also computes a "middle" for +various gadgets, often between the text that denotes what a gadget is about +and the gadget itself. It then tries to align all of these. for EQCOLS it +simply tries to make all columns equal width. + +In a second pass, EasyGUI assigns the final coordinates to all gadgets. +Important to notice is that in a GUI often there is more space available +than is required for a gadget, for example the gadget above it in a ROWS +environment is much wider. Also, the user may have resized the window. To +do something useful with this space, EasyGUI looks at which gadgets can do +something useful with extra space, such as LISTV, or STR, SCROLL etc. This +process of granting extra space propagates through ROWS/COLS, which act as +gadgets themselves. Gadgets like BUTTON don't benefit from more space, so +they give that away to their neighbours. + + ++---------------------------------------------------------------+ +| 4. Advanced features | ++---------------------------------------------------------------+ + +Different versions of EasyGUI +----------------------------- +For those who care more about saving a few KB than the extra functionality, +there are two different versions: + + 1) EasyGUI_lite.m + This does not have multi-window support, keyboard support for + gadgets, AppWindow support or GUI manipulation functions (i.e., + dynamically changing a GUI, window blocking and gadget disabling). + Current code size: 17324 bytes. + 2) EasyGUI.m + The full version, with nothing taken out. + Current code size: 23968 bytes. + +There's also a third version of EasyGUI which is just a variant of +EasyGUI.m: this is a debug version, EasyGUI_debug.m, which gives some more +information about an error before raising an exception (so you shouldn't +really distribute programs compiled with this module -- it's just for +development purposes). + + +Throwing exceptions from actionfunctions +---------------------------------------- +is allowed: EasyGUI will catch it, close the window properly, and then +ReThrow() if it wasn't a "QUIT" exception. If it was "QUIT" then the +exceptioninfo value will be the return value of the easyguiA()/guimessage() +or multiloop()/multimessage() functions, just like the way actionvalues +work (except for the slight difference in a multi-window GUI, as noted +below). + +Exceptions raised by EasyGUI itself: + +"MEM" -- no mem +"GUI" -- for things like CreateGadgetA, OpenWindowTagList etc. +"GT" -- couldn't open gadtools.library + +"bigg" -- for "BIG Gui": interface is calculated to be bigger than the + screen. Generally you should keep gui's small, so that they + still fit on 640x200 topaz screens. If the user runs Times/30 on + a screen this size, he probably knows he has a problem. +"Egui" -- a design error: most probably handed over a list to dogui() that + was either to long or too short + -- Raise()ed by own function + + +Multiple Windows +---------------- +There are two ways of handling multiple windows in EasyGUI. The first +has really been superseded by the second, though. + +1) The simplest use of EasyGUI is just by calling easyguiA(). You can + however open any number of windows, and check messages for all of them. + + guiinitA(windowtitle,gui,tags=NIL) + guimessage(guihandle) + cleangui(guihandle) + + Call guiinitA() for each window (exactly the same arguments as + easyguiA(). Then, keep calling guimessage() for each of them, when + messages arive. you can close them again with cleangui(), for example + when a gui returns a positive integer (the actioncode). Negative integers + signal that it simply finished processing all messages, but no need to + close the window yet. Note: it is *not* safe to call cleangui() from + *any* action function (except as noted below, in the description of + cleanmulti()). (If you want to close the GUI prematurely, you can use + the closewin() function.) + + example of usage of these three function (= definition easyguiA()) + + EXPORT PROC easyguiA(windowtitle,gui,tags=NIL) HANDLE + DEF gh=NIL:PTR TO guihandle,res=-1 + gh:=guiinitA(windowtitle,gui,tags) + WHILE res<0 + Wait(gh.sig) + res:=guimessage(gh) + ENDWHILE + EXCEPT DO + cleangui(gh) + ReThrow() + ENDPROC res + + the object you get has some handy fields in there: the window in question + `wnd' (or NIL if it's currently closed), the sigmask `sig' (i.e., _not_ + the signal bits) if you want to do a proper Wait() (OR them), the GUI's + info and the handle for the multi-window group `mh' (or NIL if this is a + single GUI) [see below for more details on this]. + + OBJECT guihandle + /* Public (read-only) parts: */ + wnd:PTR TO window + sig:LONG + info + mh:PTR TO multihandle -> See below... + ENDOBJECT + + The GUI's info is provided to make retrieving the info from the guihandle + easier (in an EG_CLEAN proc, for instance). If you want to draw into + `wnd': stdrast is automatically set to the last EasyGUI opened. `wnd' + can also be used a flag to indicate when it is safe to manipulate the + GUI (to help with multi-tasking): when it's NIL it's not safe to modify + the GUI directly, unless you've been passed the window pointer (e.g., + render() and clear_render()). The setXXX() functions are always safe. + Note: `wnd' can change due to closewin()/openwin() calls which mean that + the GUI may be in different windows during its life. + +2) But starting in v3.3b, there's a much more efficient (and simpler) way + of handling multiple-window GUIs. This uses the functions multiinit(), + addmultiA(), multiloop() (which uses multimessage()) and cleanmulti(), in + roughly the same way as the single window versions. It's all based + around a `multihandle': + + OBJECT multihandle + /* Public (read-only) parts: */ + sig:LONG + opencount:LONG + ENDOBJECT + + multiinit() + addmultiA(multihandle,windowtitle,gui,tags=NIL) + multiloop(multihandle) + multimessage(multihandle) + cleanmulti(multihandle) + + multiinit() is used to initialise a new group of GUIs and produce a new + `multihandle'. It takes no arguments. You must call this function first + and use the multihandle with the other functions to refer to your group + of GUIs. You can still refer to each individual GUI using a guihandle + (see below). A quick example to show how simple the new multi-window + scheme is: + + PROC multiplewindows() HANDLE + DEF mh=NIL, gh1:PTR TO guihandle, gh2:PTR TO guihandle,res + mh:=multiinit() + gh1:=addmultiA(mh,'GUI One',[BUTTON,{but1},'Press Me']) + gh2:=addmultiA(mh,'GUI Two',[BUTTON,{but2},'Press Me']) + -> Could add more GUIs... + res:=multiloop(mh) + EXCEPT DO + cleanmulti(mh) + ENDPROC + + addmultiA() is very much like guiinitA(). It creates a new window with + your specified GUI and returns the guihandle. You can call this function + even from action functions, when the GUI group is active. + + addmultiA(mh:PTR TO multihandle,windowtitle,gui,tags=NIL) + + The extra parameter is `mh' to indicate the group to which this window + will be added. + + If the tag EG_CLOSE is not specified or the data is an action value + (between 0 and 1000) then the GUI will be destroyed and removed from the + group (the guihandle will now be invalid) and the action value will be + returned (from multimessage()) -- just like a normal action value. If it + is an action function then the window is *not* closed and the action + function is called. As stated above, you define such an action function + in one of two ways: + + PROC closeproc(info) + PROC closeproc(mh:PTR TO multihandle,info) + + `info' is the GUI's info parameter and `mh' is the multihandle for this + group. Use `mh' to find the `opencount' -- the number of GUIs with open + windows. This count will include this GUI so if it's equal to one then + you know this is the last open window in the group. Your action function + may want to prompt the user and then close the window (using closewin()), + destroy the GUI and remove it from the group (using cleangui()), or leave + the window open. + + multiloop() is defined in terms of multimessage() and opencount, and is + similar to the definition of easyguiA(). + + EXPORT PROC multiloop(mh:PTR TO multihandle) + DEF res=-1 + WHILE res<0 + EXIT mh.opencount=0 + Wait(mh.sig) + res:=multimessage(mh) + ENDWHILE + ENDPROC res + + The signal mask for waiting for messages is `sig' in the multihandle. + You can use this for more complex Wait()s, and then call multimessage() + to handle any messages that may have arrived for any of the GUIs. Any + action values generated by a GUI (or via quitgui()) are returned by + multimessage() and hence terminate multiloop(). The above example calls + multiloop() only once, so an action value will eventually destroy the + whole group (by calling cleanmulti()). Note: a real action value will + cause the GUI that produced it to be closed via cleangui(), but a value + returned through use of quitgui() will not -- this is because if you've + called quitgui() then you can just as easily write code to close the + window (or whatever) in the same action function. + + By using the `opencount', the loop will be terminated when there are no + more open GUI windows. Alternatively, if you are using your own Wait() + you might want to check that there are no GUIs left (even ones with + closed windows). To this end there's the function multiempty() which + returns TRUE if and only if there are no GUIs in the group. (Note: if + there are only GUIs left with no window then the simple Wait() will never + return!) + + cleanmulti() destroys all GUIs in the group (whether they have an open or + closed window) and deallocates the multihandle. It is *not* safe to use + the multihandle or any of the guihandles after this. So, in particular, + it is *not* safe to call cleanmulti() from *any* action function. It is, + however, safe to call cleangui() on GUIs in the group, if you are using + cleanmulti() to do the final cleanup (rather than calling cleangui() on + remembered guihandles). + + To help with manipulating a group there are the multiexists() and + multiforall() functions, which work in a very similar way to ForAll() and + Exists(). + + multiforall(varaddr,mh:PTR TO multihandle,expr) + multiexists(varaddr,mh:PTR TO multihandle,expr) + + `varaddr' is the address of a (global) guihandle variable, `mh' + identifies the GUI group and `expr' is a quoted expression to be + evaluated. multiforall() will evaluate the expression for every GUI in + the group (whether its window is open or closed) and return TRUE if the + expression is TRUE (non-zero) for all GUIs, else it will return FALSE. + multiexists() will stop at the first GUI for which the expression is + TRUE, and return the value of the expression. Unlike Exists(), you are + guaranteed that the variable pointed to by `varaddr' will contain the + guihandle of the corresponding GUI (or NIL if none were found). So, you + can use multiexists() to find GUIs. Note: be careful what the expression + does with the guihandle and the GUI group; it is quite safe to cleangui() + on the supplied guihandle, but it is not safe to affect any other GUI in + this way. Any GUIs added to the group by the expression will not be part + of the forall or exists (for those who can't live without knowing: the + list is explored from head to tail, and new GUIs are added to the head; + so the last GUI considered will be the oldest GUI). + + For example, you can print the title of each GUI with an open window: + + multiforall({gh},mh,`IF gh.wnd THEN WriteF('\s\n',gh.wnd.title) ELSE 0) + + A final reminder: `varaddr' must be the *address* of a *global* variable + (and so must all the variables used in the quoted expression). + + Useful note: as long as a guihandle is valid (i.e., as long as cleangui() + has not been called on it), the normal GUI functions checkgui() and + guimessage() will actually work on the whole group that a GUI is in. + (Note: the proper, safe functions to use for multi-window GUIs are + checkmulti() and multimessage(), respectively.) + + +Multiple copies of a GUI +------------------------ +If your app allows to have multiple copies of the _same_ gui open at the +same time (for example if you open windows recursively, or you use the +multiple window technique described above to open more instances of one +GUI), you might need to dynamically allocate the GUI description, because +of the way dynamically computed values are put into static E lists. A GUI +desciption with [] lists is static, i.e. only allocated once. Adding NEW to +all of them is hard to deallocate, and this is where disposegui() comes in. +To safely use this feature, allocate ALL lists belonging to the GUI +desciption dynamically with NEW [...] (this does not include lists such as +the one used for the various labels in CYCLE-gadgets). + + easyguiA('Bla', + gui:=NEW [ROWS, + NEW [STR,{str},'input:',s,50,4], + NEW [CYCLE,{cycle},'choose:',['Yep','Nope',NIL],1]]) + disposegui(gui) + +Call disposegui() with the top-level list. On each gadget-list (i.e., +NEW [CYCLE,...]) it will simply call FastDisposeList(), on COLS and ROWS +etc. it will first deallocate each element recursively. + + +Manipulating Gadgets +-------------------- +[This assumes you've got the guihandle by using the ghaddr argument of +easyguiA(), the DIY version of EasyGUI (as described under 'Multiple +Windows'), or you're using the new default for the 'info' of a GUI.] + +You might need to modify gadgets while a GUI is active, for example to set +a slider when a corresponding integer gadget is modified by the user, or to +change the contents of a listview. + +You can denote gadgets to change by simply storing their addresses, i.e.: + + [COLS, + mygad:=[CHECK,....], + ... + ] + +Now you can use `mygad' with some of the functions below. Note that, of +course `mygad' isn't a gadget, but it helps EasyGUI to find the real +gadget. + + setcheck(gh,gad,bool) + setinteger(gh,gad,new) + setlistvlabels(gh,gad,labs) + setlistvselected(gh,gad,active) + setlistvvisible(gh,gad,vis) + setmx(gh,gad,active) + setcycle(gh,gad,active) + setpalette(gh,gad,colour) + setscrolltop(gh,gad,top) + setscrolltotal(gh,gad,total) + setscrollvisible(gh,gad,visible) + setslide(gh,gad,new) + setstr(gh,gad,new) + settext(gh,gad,newtext) + setnum(gh,gad,newnum) + +for all these: `gh' is the gui you're talking about (as returned from +guiinitA()/addmultiA(), or via the `ghaddr' argument of easyguiA() or the +new default for the 'info' of a GUI), `gad' is a value that denotes the +gadget as described above. the third value is whatever you're changing +about the gadget. Note that in doing so, you need to respect usual +restrictions on gadtools gadgets, for example setlistvlabels() requires +that you first set it to -1, then modify the list, and put it back. +setlistvvisible() will try to make the indicated item in the LISTV visible. +setlistvselected() will make a new selection and try to make it visible +(and -1 turns off the selection). + + setdisabled(gh,gad,disabled=TRUE) + +This applies to all gadgets, but works only if you've actually specified a +value (TRUE or FALSE) for the optional `disabled' field for the gadget. + + realgadget:=findgadget(gh,list) + +allows you to find the gadget address, for all those modifications that +aren't possible with the above set#? functions. It returns an intuition +gadget structure. Note that preferably you will want to use the set#? +functions, as these cooperate with EasyGUI very well (in keeping track of +the current value, for example: setstr() also copies the new value to the +estring you attached to the gadget). While there is at least one GUI still +allocated the `gadtoolsbase' and `workbenchbase' are valid, so you can +quite easily manipulate gadgets in action functions using GadTools +functions. (If you do open either of these libraries, be careful not to +overwrite these variables with NIL! That is, use an automatic exception on +OpenLibrary() or otherwise check the return value before assigning it.) + + getstr(gh,gad) + getinteger(gh,gad) + +These return and store the current value of a STR or INTEGER gadget (where +gh and gad are as described above for the setxxx() functions). They are +useful because Intuition only sends a message (and so causes the current +values to be stored) when the user hits the return or tab key in these +gadgets. So, if you really want to know a STR or INTEGER gadget's current +value use getstr() or getinteger(). + + +Topaz Fallback +-------------- +the function `easygui_fallbackA()' is equivalent to `easyguiA()' apart from +the fact that when EasyGUI fails with the "bigg" exception, it will try +again with topaz-8. Note that you should never want to rely on topaz, this +function was only added for emergency situations. If your GUI is too big +on some systems, you should redesign your GUI to fit comfortably instead. +(see other parts of this doc that talk about GUI-size and testing). + + +GUI Manipulation +---------------- + + closewin(gh) + +Temporarily closes the GUI window. Use openwin() to reinstate the GUI. +This function is useful for iconifying a GUI (see the iconify and toolify +PLUGINs). You can test whether a GUI's window is closed (or otherwise +unmodifiable) by checking if the `wnd' element of the guihandle is NIL. +Note that if your GUI is on the default public screen then it will no +longer be a visitor (i.e., you can then use changescreen() to move it to a +new screen). (A blocked window is unblocked before it is closed.) + + openwin(gh) + +Reopens a closed GUI window: it will reopen in the same position and size +as it was when it closed. Note that the window is not guaranteed to open +correctly again (someone may have grabbed your memory, for example). The +window will always open unblocked. Once open again, gh.wnd will be non-NIL +(i.e., the address of the window). + + changegui(gh,gui) + +Changes the GUI in a window (fairly) seamlessly. The old GUI is removed +and the new GUI tries to take its place, resizing if necessary (a NIL `gui' +is just ignored). The window will be resized if the new GUI's minimum size +is bigger than the current size, or if the new GUI does not allow resizing. +A side-effect of this new, dynamic ability to change GUIs is that the +default window type is to have a size gadget, even the GUI can't be +resized. You can change this by specifying a different EG_WTYPE, or use +changewindowtype(). + + changemenus(gh,newmenus=NIL) + +Changes the GUI's menus. If `newmenus' is NIL or not present then the +current menus are removed and the window is left with no menus. + + changeinfo(gh,info=-1) + +Changes the GUI's info. If `info' is -1 or not present then the GUI's +info is changed to be the guihandle for the window. (Remember: the info is +passed to the GUI's action functions.) + + changetitle(gh,windowtitle=NIL) + +Changes the title of the GUI's window. (But remember that the title is +ignored for window type WTYPE_BASIC and WTYPE_NOBORDER.) + + changescreen(gh,scr=NIL) + +If the GUI window is closed (gh.wnd=NIL) then this will alter the GUI's +screen (if it's open then this function does nothing). If `scr' is NIL +then the default public screen will be used. If the font was linked to the +screen then it will be updated, too. + + changefont(gh,tattr=NIL) + +Again, this works only if the GUI window is closed. If `tattr' is NIL then +the font of the screen is used. + + changewintype(gh,wintype=WTYPE_SIZE) + +Another one that works only if the GUI window is closed. This sets the +window border type. You can use one of WTYPE_NOBORDER, WTYPE_BASIC, +WTYPE_NOSIZE and WTYPE_SIZE, as described above. + + movewin(gh,x=-1,y=-1) + +Moves the window of the GUI referenced by gh to the new (top-left) +coordinate. If x or y is -1 (the default) then that coordinate is not +changed. (Note: the change is delayed until the next INTUITICK.) + + sizewin(gh,xs=-1,ys=-1) + +Attempts to resize the window of the GUI referenced by gh. If xs or ys is +-1 (the default) then that dimension is not changed. The resizing is not +guaranteed to be carried out since the size may be smaller than the GUI's +minimum or the GUI may not be sizable. (Note: the change is delayed until +the next INTUITICK.) + +Simple window blocking to prevent the user using a GUI: + + blockwin(gh) + +This puts up an invisible requester over the window of the GUI referenced +by gh, and disables window sizing. If you're running v39+ then the busy +pointer will be set on this window. You would use this to block a GUI +before you put up another one. Note: the window can still be moved and +depth arranged. (This works only if the GUI's window is open.) + + unblockwin(gh) + +Reinstates the GUI, allowing the user to interact with it again. The +blockwin() and unblockwin() calls nest, so you need an equal number of +unblockwin() calls to blockwin() calls before the window is actually +unblocked. Note: a GUI window is implicitly unblocked (forcefully!) when +it is closed. In general: try to design your GUIs such that the user can +use them all simultaneously, this is much friendlier (i.e., make use of the +multi-window support given by addmultiA()...). + + checkgui(gh) + +Checks for any GUI messages and processes them, invoking actionfunctions if +necessary. If this causes the GUI to want to be closed (e.g., the user has +pressed the close gadget), then a "QUIT" exception is thrown and the +exceptioninfo is the value that would have been returned by the easyguiA() +call (so, as with quitgui(), your exception handlers might like to make +"QUIT" a special case and just ReThrow() it). + +This function is useful, for example, when you're in an action function +that's performing a long calculation. By polling the GUI at convenient +points using this function you will make the GUI more responsive. However, +you are responsible for coping with the possibility that the user may +cause, for instance, the same action function to be called again. A simple +solution is use some kind of semaphore (a global boolean variable, for +example) to mark whether you are currently in an action function and busy. +See the led_test.e examples and the old CU Amiga tutorials on Amiga E. + + checkmulti(mh) + +This is checkgui() for multi-window GUIs. As mentioned above (in 'Multiple +Windows') you can use checkgui() to check and act on messages for *all* the +GUIs in the same group as the one identified by the guihandle, but the +guihandle must be valid. This function uses the multihandle so is always +safe as long as the group exists. + + ++---------------------------------------------------------------+ +| 5. PLUGINs | ++---------------------------------------------------------------+ + +PLUGINs allow the programmer to extend EasyGUI with new functionality, +i.e., to add any kind of rendering/gadgets to the GUI, while cooperating +automatically with EasyGUI's layout/resizing. You can use plugins to add +rendering areas in the midst of EasyGUI gadgetry (e.g., for graphics +programs), add BOOPSI gadgets to a GUIs etc. You can supply ready-made +plugins for other programmers to use. + + OBJECT plugin + /* Public (read-only) parts: */ + -> Position and size. + x:INT,y:INT,xs:INT,ys:INT + -> guihandle for the GUI the PLUGIN is on. + gh:PTR TO guihandle + ENDOBJECT + +Any PLUGIN is an object inherited from the 'plugin' object found in +easygui.m. To implement a new plugin all that needs to be done is redefine +a few methods. Then, this PLUGIN can be plugged in to any EasyGUI with for +example: + + [PLUGIN,{plugaction},NEW mp.myplugin()] + +in your GUI-spec. Whether the action-value is used depends on the PLUGIN, +as we'll see below. If it is called it will be passed the PLUGIN object as +well as the GUI info: + + PROC pluginaction(info,plugin_object:PTR TO plugin) + +Have a quick look at the plugin example sources, or keep them handy while +reading the bit below. + +Creating the object +------------------- +create your new object as a 'plugin'-subtype. You may add constructors/ +destructors if you wish. following methods implement the plugins +behaviour, and may be redefined: + + will_resize() + +is called once just before the window is opened. You should return a +flag-set telling in which ways your object can resize, making use of the +constants RESIZEX and RESIZEY, 0 of course meaning your object is fixed in +size (default method returns RESIZEX OR RESIZEY, i.e., resize in both +directions). New to v3.3a is COND_RESIZEX and COND_RESIZEY, which allow +your PLUGIN to resize in the corresponding direction only if something else +in its gadget group is unconditionally resizable. (For example, a BAR is +conditionally resizable, so that it does not force a group of BUTTONs to be +resizable.) + + min_size(ta:PTR TO textattr,fontheight) + +is called once just before the window is opened. ta is the font used +in the GUI. you should return the _minimum_ x and y sizes of your +PLUGIN as _two_ returnvalues, making use of `fontheight' if you wish. +Note that EasyGUI may actually grant you a lot more space than just +the minimum space you ask for, depending on the other gadgets and +user-resizing. If your object can have al sorts of sizes, pick a +relatively small one as minimum. The default method just returns +(fontheight,fontheight) + + render(ta:PTR TO textattr,x,y,xs,ys,win:PTR TO window) + +Here you should render your object to the window. In the case of a gadget +this means creating the gadget and attaching it to the window (AddGList(), +RefreshGList(), make sure you render only your own gadget(s)). ta is the +font used in the GUI. (xs,ys) is always at least the minimum size you +asked for. (x,y,xs,ys) is also copied to your object before this method is +called, for use in other methods). The default method paints a nice black +box :-) You shouldn't take too long in this method as it will make window +redraw look slow. (It is safe to use existing v3.2e PLUGIN modules, but to +recompile under v3.3a you will need to add the `ta' argument to your PLUGIN +render() method.) + + gtrender(gl,vis,ta:PTR TO textattr,x,y,xs,ys,win:PTR TO window) + +New to v3.3a: a replacement for render() which enables simple addition of +GadTools gadgets to the standard EasyGUI gadgets. If you want to use this +method instead of the normal render() then: 1) the PLUGIN must support it, +and 2) you must specify TRUE for the `isgt' field of the PLUGIN gadget. +gtrender() should simply create its gadgets by linking into the current +list (given by `gl') and using the visual info `vis'. It should then +return the new gadget list (i.e., the last GadTools gadget linked in). And +then that's it: your GadTools gadgets will be freed automatically, so if +your PLUGIN is just GadTools gadgets you don't need to override the normal +(empty) definition clear_render(). If you use gtrender() then you need not +override render(): this will help indicate a problem if users forget to +specify `isgt' with your PLUGIN. See the password PLUGIN example. + + clear_render(win:PTR TO window) + +mainly useful for gadgets to remove the gadget from the window and free it +(RemoveGList(), remove only your own gadget(s)!). Normally render() is +called when the window opens, and clear_render() when the window closes, +when the user resizes, however, clear_render() and render() are called one +after another, in that order, to account for the changed window layout. +The default method does nothing. + + message_test(imsg:PTR TO intuimessage,win:PTR TO window) + +is phase-1 of the message handling, splitted in two to not block intuition +too much. In message_test() the only thing you should do is return TRUE +_if_ and _only_if_ the intuimessage is meant for your object, otherwise +FALSE. (The only exceptions to this are IDCMP_MOUSEMOVE messages from a +GACT_FOLLOWMOUSE or WFLG_REPORTMOUSE, which can be ignored safely [i.e., +you may return FALSE] as they cannot easily be attributed to an originating +gadget). For a mouse-click, test if it was in your area (the current +dimensions of your object in the GUI are present in the `plugin' object), +for gadgets, make sure it is really your gadget causing the message (check +.iaddress). If you reply TRUE to messages that are potentially meant for +other objects, you might choke them. Do not engage in other actions in +this method, such as rendering; do these things in the message_action() +method. The default method returns FALSE. + +The GUI window uses the following IDCMP flags: + + IDCMP_ACTIVEWINDOW IDCMP_INACTIVEWINDOW + IDCMP_GADGETDOWN IDCMP_GADGETUP + IDCMP_INTUITICKS + IDCMP_MOUSEBUTTONS IDCMP_MOUSEMOVE + IDCMP_NEWSIZE + IDCMP_RAWKEY IDCMP_VANILLAKEY + +You may get your PLUGIN objects to generate these messages (via gadgets) +and then trap them (via message_test()), or you can just snoop on them in +message_test(). + + message_action(class,qual,code,win:PTR TO window) + +is the second part, and will only be called if you returned TRUE in the +previous method. here you may do any action needed (additional rendering +based on the user action). class, qual and code are copies of the class, +qualifier and code part of the intuimessage, so you don't need to remember +them in message_test(). You should return TRUE if you want the action the +user of the PLUGIN has written in his GUI-spec to be executed upon +termination of this method (do this if your object clearly can be "hit", +such as a gadget. If you just do some rendering you might want to ignore +the actionvalue). The default method returns FALSE. (As noted above, the +action function is passed the PLUGIN object as well as the GUI info.) + +Note: do not confuse message_action() with action values: the former is for +implementing the plugin's behaviour generally, while the latter is for +specific behaviour in a specific GUI, attached by the user of your plugin +(which could be you again :-). + + appmessage(amsg:PTR TO appmessage,win:PTR TO window) + +Like the testing for window IDCMP, but for AppWindow message testing. +Return TRUE _only_if_ the message is meant for this PLUGIN. The PLUGINs +(optional) awproc will then be called (as normal, with the optional data +field being the `plugin_object'). Note: for compatibility, the +appmessage() method is called only for PLUGINs that specify a non-NIL +`awproc' field. Just be careful to *not* specify a non-NIL `awproc' field +with old PLUGIN modules. + +If you supply a plugin as module for others, you'll have to state what +constructor(s) they may use, wether or not they have to supply a sensible +action-value. END will almost always have to be called. + + ++---------------------------------------------------------------+ +| 6. guide to the examples | ++---------------------------------------------------------------+ + +There are numerous examples to show the various features of EasyGUI. +Here's a small guide to help you find the ones that might be interesting: + + alldist.e - The original example. + alldist2.e - The original example, using multi-windows and + blocking. You can have all the example GUIs + open at once! + + testaw.e - AppWindow example. + testchange.e - changegui() example. + testchange2.e - changeXXX() and multi-window example. + testkey.e - Keyboard shortcuts example, with window + blocking and gadget disabling. + testmulti.e - Multi-window example (recursive!). + testmulti2.e - Multi-window and multiforall() example. + testqual.e - Qualifier example. + + animcontrol_test.e - Tests animcontrol PLUGIN. + button_test.e - Tests flavours of button PLUGIN. + calendar_test.e - Tests calender PLUGIN. + colorwheel_test.e - Tests colorwheel PLUGIN. + gradient_test.e - Tests gradient (slider) PLUGIN. + imagebutton_test.e - Tests flavours of imagebutton PLUGIN. + led_test.e - Tests led PLUGIN, with pseudo-async activity. + led_test2.e - Tests led PLUGIN, with multi-windows and + pseudo-async activities. + led_test3.e - Tests led PLUGIN, with multi-windows and + *real* async activities. + led_test4.e - Tests led and ticker PLUGINs, with + multi-windows and pseudo-async activities. + password_test.e - Tests password PLUGIN. + tabs_test.e - Tests tabs PLUGIN. + tabs_test2.e - Tests tabs PLUGIN and changegui() example. + tapedeck_test.e - Tests tapedeck PLUGIN. + ticker_test.e - Tests ticker PLUGIN. + +These can be found in Src/EasyGUI. The sources for the example PLUGINs are +in Src/Plugins. + + ++---------------------------------------------------------------+ +| 7. bugs/future | ++---------------------------------------------------------------+ + +bugs: +- method of displaying slider values not bulletproof +- GadTools sends two messages if your slider value is changed to a + negative value, so your action function can get called twice. + +[the planned render spaces can now be done much better by using PLUGINs] + + +---------------------------------------------------------------- + +General advice: try out and modify the examples. Sometimes something won't +work, but EasyGUI is flexible enough that at least one way of arranging +groups etc. will give you a nice GUI :-). If you need more power than +EasyGUI currently gives, you'll have to use MUI/BGUI/WhatEver instead. + +Wouter (and Jason!) diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/animcontrol.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/animcontrol.doc new file mode 100644 index 0000000..4eae096 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/animcontrol.doc @@ -0,0 +1,61 @@ +AnimControl PLUGIN +------------------ +Consists of play, rewind, fast forward, stop and frame number gadgets. +Uses the 'tapedeck.gadget' which needs to be in the normal place of +libs:gadgets/ (usually libs: is also assigned to sys:classes/, and .gadget +files should be stored in the sys:classes/gadgets/ directory). + +Constructors: + + animcontrol(frame=0,frames=8,play=FALSE,disabled=FALSE) + frame -> The first frame (=position of slider) + frames -> The number of frames (=extent of slider) + play -> Whether the play button is pressed initially + disabled -> Whether this gadget is disabled + +Destructor: + + END *must* be called for each NEWed object. + +Data (should be considered read-only): + + OBJECT animcontrol OF plugin + frame -> Current frame number + mode -> Current mode + disabled -> Disabled or enabled + PRIVATE ... + ENDOBJECT + + The mode is taken from 'gadgets/tapedeck'. It will be: + o BUT_PLAY if playing + o BUT_STOP if stopped + o BUT_FORWARD if fast forward is being held + o BUT_REWIND if rewind is being held + +New methods: + + setframe(n) -> Set the current frame number + setplay(play=TRUE) -> Set play/stop mode + setdisabled(disabled=TRUE) -> Disable/enable the gadget + +Action functions: + + Your action function will be called (or your action value returned + by easygui()) in the following circumstances: + o The rewind or fast forward button has been pressed + (mode will be BUT_FORWARD or BUT_REWIND) + o The rewind or fast forward button has been released + (mode will be BUT_STOP) + o The play button has been pressed (and released) + (mode will be BUT_PLAY) + o The stop button has been pressed (and released) + (mode will be BUT_STOP) + o The frame slider has been moved + (mode will be BUT_STOP, frame may have changed) + +Exceptions: + + "anim" will be raised by the constructor if the .gadget file can't + be opened. + "anim" will be raised by the render() method if the gadget can't + be created. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/button.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/button.doc new file mode 100644 index 0000000..657c1c0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/button.doc @@ -0,0 +1,68 @@ +Button PLUGIN +------------- +A flexible button gadget in three flavours: normal (momentary), toggle and +push (sticky). Uses the 'button.gadget' which needs to be in the normal +place of libs:gadgets/ (usually libs: is also assigned to sys:classes/, and +.gadget files should be stored in the sys:classes/gadgets/ directory). + +Constructors: + + button(text,resizex=FALSE,resizey=FALSE,disabled=FALSE) + text -> The button's label + resizex -> Whether this button can resize in width + resizey -> Whether this button can resize in height + disabled -> Whether this gadget is disabled + + togglebutton(text,selected=FALSE,resizex=FALSE,resizey=FALSE, + disabled=FALSE) + text -> The button's label + selected -> Whether this button is selected (on) initially + resizex -> Whether this button can resize in width + resizey -> Whether this button can resize in height + disabled -> Whether this gadget is disabled + + pushbutton(text,selected=FALSE,resizex=FALSE,resizey=FALSE, + disabled=FALSE) + text -> The button's label + selected -> Whether this button is selected (on) initially + resizex -> Whether this button can resize in width + resizey -> Whether this button can resize in height + disabled -> Whether this gadget is disabled + +Destructor: + + END *must* be called for each NEWed object. + +Data (should be considered read-only): + + OBJECT button OF plugin + selected -> Current state of the button (=0 is off, <>0 is on) + disabled -> Disabled or enabled + PRIVATE ... + ENDOBJECT + + The selected element is useful only for toggle and push buttons. + +New methods: + + setselected(selected=TRUE) -> Set the button on or off + settext(text) -> Change the button label + setdisabled(disabled=TRUE) -> Disable/enable the gadget + + Note: setselected() is ignored for normal buttons. + Note: push buttons cannot be deselected by the user (they're sticky), + so use setselected() to deselect them when necessary. + Note: settext() does not check that the new label is not too wide... + +Action functions: + + Your action function will be called (or your action value returned by + easygui()) in the following circumstances: + o When the button is pressed to select or deselect it. + +Exceptions: + + "butt" will be raised by the constructor if the .gadget file can't be + opened. + "butt" will be raised by the render() method if the gadget can't be + created. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/calendar.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/calendar.doc new file mode 100644 index 0000000..539a443 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/calendar.doc @@ -0,0 +1,51 @@ +Calendar PLUGIN +--------------- +Draws a calendar of a month and allows a day to be selected. Uses the +'calendar.gadget' which needs to be in the normal place of libs:gadgets/ +(usually libs: is also assigned to sys:classes/, and .gadget files should +be stored in the sys:classes/gadgets/ directory). + +Constructors: + + calendar(date:PTR TO clockdata,resizex=FALSE,resizey=FALSE, + disabled=FALSE) + date -> The initial date selected + resizex -> Whether this gadget can resize in width + resizey -> Whether this gadget can resize in height + disabled -> Whether this gadget is disabled + +Destructor: + + END *must* be called for each NEWed object. + +Data (should be considered read-only, except as mentioned below): + + OBJECT calendar OF plugin + date:PTR TO clockdata -> Current date + disabled -> Disabled or enabled + PRIVATE ... + ENDOBJECT + +New methods: + + setdate(date=NIL:PTR TO clockdata) -> Set the current date + setdisabled(disabled=TRUE) -> Disable/enable the gadget + + Note: if NIL if specified for setdate() then the current date will be + used (in which case it's OK to edit the data in self.date just + before calling setdate()). + Note: it's up to you to make sure the dates you supply are sensible. + +Action functions: + + Your action function will be called (or your action value returned by + easygui()) in the following circumstances: + o When one of the day buttons is pressed + (the date will reflect the current state) + +Exceptions: + + "cal" will be raised by the constructor if the .gadget file can't be + opened. + "cal" will be raised by the render() method if the gadget can't be + created. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/colorwheel.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/colorwheel.doc new file mode 100644 index 0000000..8c6a209 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/colorwheel.doc @@ -0,0 +1,62 @@ +ColorWheel PLUGIN +----------------- +The famous colorwheel from the Palette prefs program. Uses the +'colorwheel.gadget' which needs to be in the normal place of libs:gadgets/ +(usually libs: is also assigned to sys:classes/, and .gadget files should +be stored in the sys:classes/gadgets/ directory). + +Constructors: + + colorwheel(rgb:PTR TO colorwheelrgb,hsb=NIL:PTR TO colorwheelhsb, + box=FALSE,disabled=FALSE) + rgb -> The initial value as RGB + hsb -> The initial value as HSB + box -> Whether to put a bevel box around the wheel + disabled -> Whether this gadget is disabled + +Destructor: + + END *must* be called for each NEWed object. + +Data (should be considered read-only, except as mentioned below): + + OBJECT colorwheel OF plugin + rgb:PTR TO colorwheelrgb -> Current RGB value + hsb:PTR TO colorwheelhsb -> Current HSB value + disabled -> Disabled or enabled + PRIVATE ... + ENDOBJECT + + Only one of rgb and hsb will be valid at any time (the invalid one will + be NIL), depending on which system you used when you last set the + current value. + +New methods: + + setrgb(rgb=NIL) -> Set the current value using RGB + sethsb(hsb=NIL) -> Set the current value using HSB + getrgb(rgb) -> Get the current RGB value + gethsb(hsb) -> Get the current HSB value + setdisabled(disabled=TRUE) -> Disable/enable the gadget + + Note: using setrgb()/sethsb() changes the system that the colorwheel + uses, so after a setrgb() the hsb element will be invalid (NIL). + Note: if NIL is specified for setrgb() or sethsb() then the current one + will be used (in which case it's OK to edit the data in self.rgb + or self.hsb just before calling setXXX()). + Note: getrgb()/gethsb() fill in the colorwheelrgb/hsb that you supply + with the current colorwheel value, but do not change the system + that's being used. + +Action functions: + + Your action function will be called (or your action value returned by + easygui()) in the following circumstances: + o When the pointer is moved. + +Exceptions: + + "colw" will be raised by the constructor if the .gadget file can't be + opened. + "colw" will be raised by the render() method if the gadget can't be + created. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/gradient.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/gradient.doc new file mode 100644 index 0000000..4751bda --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/gradient.doc @@ -0,0 +1,51 @@ +GradientSlider PLUGIN +--------------------- +The silder that goes with the colorwheel from the Palette prefs program. +Uses the 'gradientslider.gadget' which needs to be in the normal place of +libs:gadgets/ (usually libs: is also assigned to sys:classes/, and .gadget +files should be stored in the sys:classes/gadgets/ directory). + +Constructors: + + gradient(vert=FALSE,curval=0,rel=5,pens=NIL:PTR TO INT,disabled=FALSE) + vert -> Whether this gadget is vertical or horizontal + curval -> The current value of the slider + rel -> The relative size (height if vert, width if not) + pens -> The pen array used in the gradient (ends with -1) + disabled -> Whether this gadget is disabled + +Destructor: + + END *must* be called for each NEWed object. + +Data (should be considered read-only, except as mentioned below): + + OBJECT button OF plugin + curval -> The current value of the slider (0 to $FFFF) + pens:PTR TO INT -> The current pen array for the gradient + disabled -> Disabled or enabled + PRIVATE ... + ENDOBJECT + +New methods: + + setcurval(x) -> Set the current value of the slider + setpens(pens=NIL:PTR TO INT) -> Change the pen array + setdisabled(disabled=TRUE) -> Disable/enable the gadget + + Note: if NIL is specified for setpens() then the current pen array + will be used (in which case it's OK to edit the data in self.pens + just before calling setpens()). + +Action functions: + + Your action function will be called (or your action value returned by + easygui()) in the following circumstances: + o When the slider is moved or released. + +Exceptions: + + "grad" will be raised by the constructor if the .gadget file can't be + opened. + "grad" will be raised by the render() method if the gadget can't be + created. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/imagebutton.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/imagebutton.doc new file mode 100644 index 0000000..d73ca83 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/imagebutton.doc @@ -0,0 +1,81 @@ +ImageButton PLUGIN +------------------ +A flexible image button gadget in three flavours: normal (momentary), +toggle and push (sticky). Uses the 'button.gadget' which needs to be in +the normal place of libs:gadgets/ (usually libs: is also assigned to +sys:classes/, and .gadget files should be stored in the +sys:classes/gadgets/ directory). + +Constructors: + + imagebutton(image:PTR TO image,width=0,height=0, + resizex=FALSE,resizey=FALSE,disabled=FALSE) + image -> The button's image + width -> The nominal width of the gadget + height -> The nominal height of the gadget + resizex -> Whether this button can resize in width + resizey -> Whether this button can resize in height + disabled -> Whether this gadget is disabled + + toggleimagebutton(image:PTR TO image,width=0,height=0,selected=FALSE, + resizex=FALSE,resizey=FALSE,disabled=FALSE) + image -> The button's image + width -> The nominal width of the gadget + height -> The nominal height of the gadget + selected -> Whether this button is selected (on) initially + resizex -> Whether this button can resize in width + resizey -> Whether this button can resize in height + disabled -> Whether this gadget is disabled + + pushimagebutton(image:PTR TO image,width=0,height=0,selected=FALSE, + resizex=FALSE,resizey=FALSE,disabled=FALSE) + image -> The button's image + width -> The nominal width of the gadget + height -> The nominal height of the gadget + selected -> Whether this button is selected (on) initially + resizex -> Whether this button can resize in width + resizey -> Whether this button can resize in height + disabled -> Whether this gadget is disabled + + Note: the width and height of the gadget will be at least as big as + that needed to fit the image (so it's safe to specify them as 0). + +Destructor: + + END *must* be called for each NEWed object. + +Data (should be considered read-only): + + OBJECT imagebutton OF plugin + selected -> Current state of the button (=0 is off, <>0 is on) + disabled -> Disabled or enabled + PRIVATE ... + ENDOBJECT + + The selected element is useful only for toggle and push buttons. + +New methods: + + setselected(selected=TRUE) -> Set the button on or off + setimage(image:PTR TO image) -> Change the button's image + setdisabled(disabled=TRUE) -> Disable/enable the gadget + + Note: setselected() is ignored for normal buttons. + Note: push buttons cannot be deselected by the user (they're sticky), + so use setselected() to deselect them when necessary. + Note: setimage() will work only if the image fits in the button's + minimum size (so, you should specify the maximum width and height + of the images you will use in the constructor...) + +Action functions: + + Your action function will be called (or your action value returned by + easygui()) in the following circumstances: + o When the button is pressed to select or deselect it. + +Exceptions: + + "butt" will be raised by the constructor if the .gadget file can't be + opened. + "butt" will be raised by the render() method if the gadget can't be + created. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/led.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/led.doc new file mode 100644 index 0000000..402cd4c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/led.doc @@ -0,0 +1,50 @@ +LED PLUGIN +---------- +Draws pairs of digits to look like LED displays (such as clocks). Uses the +'led.image' which needs to be in the normal place of libs:images/ (usually +libs: is also assigned to sys:classes/, and .image files should be stored +in the sys:classes/images/ directory). + +Constructors: + + led(pairs=2,values=NIL,colon=FALSE,signed=FALSE,negative=FALSE,pen=1) + pairs -> The number of pairs of digits + values -> The values (one value per pair of digits) + colon -> Whether the colon between pairs is displayed + signed -> Whether use will be made of the leading minus sign + negative -> Whether the leading minus sign is on or off + pen -> The pen (colour) of the LED + +Destructor: + + END *must* be called for each NEWed object. + +Data (should be considered read-only, except as mentioned below): + + OBJECT led OF plugin + pairs + values:PTR TO INT + colon + signed + negative + pen + PRIVATE ... + ENDOBJECT + +New methods: + + redisplay() -> Redraw according to new values + + Note: it is OK to change the public data just before calling + redisplay() (and this is the only real use for redisplay()). + +Action functions: + + Ignored. + +Exceptions: + + "led" will be raised by the constructor if the .image file can't be + opened. + "led" will be raised by the render()/redisplay() methods if the image + can't be created. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/password.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/password.doc new file mode 100644 index 0000000..2734905 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/password.doc @@ -0,0 +1,48 @@ +Password PLUGIN +--------------- +Makes a rudimentary password entry gadget. Uses a standard GadTools string +gadget so you need to specify TRUE for the optional `isgt' field of the +PLUGIN gadget to use it (otherwise you get a black rectangle!). + +Constructors: + + password(estr,label=NIL,over=FALSE,relx=0,disabled=FALSE) + estr -> The initial password (must be an E-string) + label -> The label for the gadget + over -> Whether the string gadget is in overwrite mode + relx -> Relative width (default is 5) + disabled -> Whether this gadget is disabled + +Destructor: + + END *must* be called for each NEWed object. + +Data (should be considered read-only): + + OBJECT password OF plugin + estr -> Current password + disabled -> Disabled or enabled + PRIVATE ... + ENDOBJECT + +New methods: + + setpass(str) -> Set the password to str (copied) + setdisabled(disabled=TRUE) -> Disable/enable the gadget + +Action functions: + + Your action function will be called (or your action value returned by + easygui()) in the following circumstances: + o When the return or tab is pressed in the gadget + + Note: unlike normal STR gadgets, the estr is *always* up-to-date. + +Exceptions: + + "pass" will be raised by the constructor if the gadtools.library can't + be opened. + "pass" will be raised by the render() method if the gadget can't be + created. + "MEM" will be raised by the constructor or setpass() method if the + temporary string can't be created. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/tabs.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/tabs.doc new file mode 100644 index 0000000..05c23cb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/tabs.doc @@ -0,0 +1,47 @@ +Tabs PLUGIN +----------- +Makes a set of tabs for page selection (most useful with changegui()). +Uses the 'tabs.gadget' which needs to be in the normal place of +libs:gadgets/ (usually libs: is also assigned to sys:classes/, and .gadget +files should be stored in the sys:classes/gadgets/ directory). + +Constructors: + + tabs(tabslist:PTR TO tablabel,current=0,max=TRUE,disabled=FALSE) + tabslist -> The list of labels to use + current -> The initial tab selected + max -> Whether each tab has the width of the widest tab + disabled -> Whether this gadget is disabled + + Note: the gadget will *conditionally* resize in width. + +Destructor: + + END *must* be called for each NEWed object. + +Data (should be considered read-only): + + OBJECT tabs OF plugin + current -> Currently selected tab + disabled -> Disabled or enabled + PRIVATE ... + ENDOBJECT + +New methods: + + setcurrent(x) -> Set the current selected tab + setdisabled(disabled=TRUE) -> Disable/enable the gadget + +Action functions: + + Your action function will be called (or your action value returned by + easygui()) in the following circumstances: + o When one of the tabs is pressed + (current will indicate the selected tab) + +Exceptions: + + "tabs" will be raised by the constructor if the .gadget file can't be + opened. + "tabs" will be raised by the render() method if the gadget can't be + created. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/tapedeck.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/tapedeck.doc new file mode 100644 index 0000000..d59942d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/tapedeck.doc @@ -0,0 +1,52 @@ +TapeDeck PLUGIN +--------------- +Consists of play, rewind, fast forward, stop and pause gadgets. Uses the +'tapedeck.gadget' which needs to be in the normal place of libs:gadgets/ +(usually libs: is also assigned to sys:classes/, and .gadget files should +be stored in the sys:classes/gadgets/ directory). + +Constructors: + + tapedeck(mode=BUT_STOP,paused=FALSE,disabled=FALSE) + mode -> The current mode (see below) + paused -> Whether the pause button is pressed initially + disabled -> Whether this gadget is disabled + +Destructor: + + END *must* be called for each NEWed object. + +Data (should be considered read-only): + + OBJECT tapedeck OF plugin + mode -> Current mode + paused -> Paused or not + disabled -> Disabled or enabled + PRIVATE ... + ENDOBJECT + + The mode is taken from 'gadgets/tapedeck'. It will be: + o BUT_PLAY if playing + o BUT_STOP if stopped + o BUT_FORWARD if fast forwarding + o BUT_REWIND if rewinding + +New methods: + + setmode(mode=BUT_STOP) -> Set the current mode + setpaused(paused=TRUE) -> Set paused on or off + setdisabled(disabled=TRUE) -> Disable/enable the gadget + +Action functions: + + Your action function will be called (or your action value returned by + easygui()) in the following circumstances: + o When one of the buttons is pressed + (mode and paused will reflect the current state) + +Exceptions: + + "tape" will be raised by the constructor if the .gadget file can't be + opened. + "tape" will be raised by the render() method if the gadget can't be + created. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/ticker.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/ticker.doc new file mode 100644 index 0000000..8fa5580 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Docs/ticker.doc @@ -0,0 +1,23 @@ +Ticker PLUGIN +------------- +A simple PLUGIN that absorbs all the IDCMP_INTUITICKS and calls its action +function on each tick. + +Constructors: + + None, just create the object. + +Destructor: + + None, you needn't call END, but it doesn't hurt. + +Action functions: + + Your action function will be called (or your action value returned by + easygui()) in the following circumstances: + o When an IDCMP_INTUITICK occurs. Note: IDCMP_INTUITICKS only happen + to the active window! + +Exceptions: + + None. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/all.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/all.e new file mode 100644 index 0000000..b5c3d81 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/all.e @@ -0,0 +1,379 @@ +-> Test GUI's gathered in one program. + +OPT OSVERSION=37 +MODULE 'tools/EasyGUI', 'tools/exceptions', 'libraries/gadtools' + +DEF gh + +DEF havefonts=FALSE, havescreenmode=FALSE, havefile=FALSE, havesearch=FALSE, + havesearch2=FALSE, haveamosaic=FALSE, havedb=FALSE, havedm=FALSE, + havetiny=FALSE, havemessy=FALSE + +DEF s[50]:STRING + +PROC main() HANDLE + DEF mh=NIL:PTR TO multihandle + StrCopy(s,'bla') + mh:=multiinit() + addmultiA(mh,'EasyGUI Tests', + [EQROWS, + [BUTTON,{fonts},'Fonts'], + [BUTTON,{screenmode},'ScreenMode'], + [BUTTON,{file},'File Requester'], + [BUTTON,{search},'Search Requester'], + [BUTTON,{search2},'Search Requester 2'], + [BUTTON,{amosaic},'Amosaic'], + [BUTTON,{db},'DataBase'], + [BUTTON,{dm},'DiskMaster'], + [BUTTON,{tiny},'Tiny Test'], + [BUTTON,{messy},'Messy Test'] + ], + [EG_CLOSE,{quit}, NIL] + ) + REPEAT + WriteF('result=\d\n',multiloop(mh)) + UNTIL mh.opencount=0 +EXCEPT DO + cleanmulti(mh) + report_exception() +ENDPROC + +PROC quit(mh,info) IS multiforall({gh},mh,`cleangui(gh)) + +PROC havenot(var:PTR TO LONG) + var[]:=FALSE +ENDPROC + +PROC fonts(x:PTR TO guihandle) + IF havefonts=FALSE + havefonts:=TRUE + addmultiA(x.mh, 'Font Preferences', + [EQROWS, + [TEXT,'Selected Fonts',NIL,FALSE,3], + [BEVELR, + [EQROWS, + [TEXT,'xentiny 8','Workbench Icon Text:',FALSE,3], + [TEXT,'end 10','System Default Text:',FALSE,3], + [TEXT,'except 12','Screen text:',FALSE,3] + ] + ], + [SBUTTON,0,'Select Workbench Icon Text...'], + [SBUTTON,0,'Select System Default Text...'], + [SBUTTON,0,'Select Screen text...'], + [BAR], + [COLS, + [BUTTON,0,'Save'], + [SPACEH], + [BUTTON,0,'Use'], + [SPACEH], + [BUTTON,0,'Cancel'] + ] + ], + [EG_CLEAN,{havenot}, EG_INFO,{havefonts}, NIL] + ) + ENDIF +ENDPROC + +PROC screenmode(x:PTR TO guihandle) + IF havescreenmode=FALSE + havescreenmode:=TRUE + addmultiA(x.mh,'ScreenMode Preferences', + [EQROWS, + [COLS, + [EQROWS, + [LISTV,0,'Display Mode',10,4,NIL,TRUE,0,0], + [COLS, + [EQROWS,[INTEGER,0,'Width:',640,5],[INTEGER,0,'Height:',512,5]], + [ROWS,[CHECK,0,'Default',TRUE,FALSE],[CHECK,0,'Default',TRUE,FALSE]] + ], + [SLIDE,0,'Colors:',FALSE,1,8,3,5,''], + [CHECK,0,'AutoScroll:',TRUE,TRUE] + ], + ->[BAR], + [BEVELR, + [EQROWS, + [TEXT,'688x539','Visible Size:',FALSE,3], + [TEXT,'640x200','Minimum Size:',FALSE,3], + [TEXT,'16368x16384','Maximum Size:',FALSE,3], + [TEXT,'256','Maximum Colors:',FALSE,3], + [SPACE] + ] + ] + ], + [BAR], + [COLS, + [BUTTON,0,'Save'], + [SPACEH], + [BUTTON,0,'Use'], + [SPACEH], + [BUTTON,0,'Cancel'] + ] + ], + [EG_CLEAN,{havenot}, EG_INFO,{havescreenmode}, NIL] + ) + ENDIF +ENDPROC + +PROC file(x:PTR TO guihandle) + IF havefile=FALSE + havefile:=TRUE + addmultiA(x.mh,'Select a file:', + [EQROWS, + [LISTV,0,NIL,1,5,NIL,0,NIL,0], + [STR,{fr},'Pattern',s,200,5], + [STR,{fr},'Drawer',s,200,5], + [STR,{fr},'File',s,200,5], + [COLS, + [BUTTON,1,'Ok'], + [SPACEH], + [BUTTON,2,'Disks'], + [SPACEH], + [BUTTON,3,'Parent'], + [SPACEH], + [BUTTON,0,'Cancel'] + ] + ], + [EG_CLEAN,{havenot}, EG_INFO,{havefile}, NIL] + ) + ENDIF +ENDPROC + +PROC fr(a,b) IS WriteF('fr: \s\n',b) + +PROC search(x:PTR TO guihandle) + IF havesearch=FALSE + havesearch:=TRUE + addmultiA(x.mh,'Enter Search/Replace text:', + [ROWS, + [ROWS, -> ROWS + [EQROWS, + [STR,{find},'Locate',s,10,10], + [STR,{repl},'Replace',s,10,10] + ], + [COLS, -> COLS + [CHECK,{case},'Ignore case',TRUE,FALSE], + [CHECK,{word},'Whole words only',FALSE,FALSE], + [CHECK,{forw},'Search forward',TRUE,FALSE] + ] + ], + [BAR], + [EQCOLS, + [BUTTON,1,'Search'], + [SPACEH], + [BUTTON,2,'Replace'], + [SPACEH], + [BUTTON,0,'Cancel'] + ] + ], + [EG_CLEAN,{havenot}, EG_INFO,{havesearch}, NIL] + ) + ENDIF +ENDPROC + +PROC find(x,y) IS WriteF('Find="\s"!\n',y) +PROC repl(x,y) IS WriteF('Repl="\s"!\n',y) +PROC case(x,y) IS WriteF('Case=\d!\n',y) +PROC word(x,y) IS WriteF('Word=\d!\n',y) +PROC forw(x,y) IS WriteF('Forw=\d!\n',y) + +PROC search2(x:PTR TO guihandle) + IF havesearch2=FALSE + havesearch2:=TRUE + addmultiA(x.mh,'Enter Search/Replace text:', + [ROWS, + [COLS, -> ROWS + [EQROWS, + [STR,{find},'Locate',s,10,10], + [STR,{repl},'Replace',s,10,10] + ], + [EQROWS, -> COLS + [CHECK,{case},'Ignore case',TRUE,FALSE], + [CHECK,{word},'Whole words only',FALSE,FALSE], + [CHECK,{forw},'Search forward',TRUE,FALSE] + ] + ], + [BAR], + [EQCOLS, + [BUTTON,1,'Search'], + [SPACEH], + [BUTTON,2,'Replace'], + [SPACEH], + [BUTTON,0,'Cancel'] + ] + ], + [EG_CLEAN,{havenot}, EG_INFO,{havesearch2}, NIL] + ) + ENDIF +ENDPROC + +PROC amosaic(x:PTR TO guihandle) + IF haveamosaic=FALSE + haveamosaic:=TRUE + addmultiA(x.mh,'AMosaic', + [EQROWS, + [TEXT,'Wouter''s WWW page','Title:',TRUE,3], + [TEXT,'file://localhost/...','URL:',TRUE,3], + [COLS, + [SBUTTON,0,'Back'], + [SBUTTON,0,'Forward'], + [SBUTTON,0,'Home'], + [SBUTTON,0,'Open'], + [SBUTTON,0,'Reload'], + [SBUTTON,0,'Quit'] + ], + [COLS, + [BEVELR, + [SPACE] + ], + [SCROLL,0,TRUE,10,0,2,10] + ], + [TEXT,'file://localhost/...',NIL,FALSE,3] + ], + [EG_CLEAN,{havenot}, EG_INFO,{haveamosaic}, NIL] + ) + ENDIF +ENDPROC + +PROC db(x:PTR TO guihandle) + IF havedb=FALSE + havedb:=TRUE + addmultiA(x.mh,'EasyBase v0.1', + [ROWS, + [LISTV,0,NIL,5,4,NIL,0,NIL,0], + [COLS, + [BUTTON,0,'New'], + [BUTTON,{fields},'Fields',x.mh], + [BUTTON,0,'Load'], + [BUTTON,0,'Save']]], + [EG_CLEAN,{havenot}, EG_INFO,{havedb}, NIL]) + ENDIF +ENDPROC + +PROC fields(mh,i) HANDLE + multiforall({gh},mh,`blockwin(gh)) + easyguiA('Edit Fields', + [ROWS, + [LISTV,0,NIL,5,3,NIL,0,NIL,0], + [COLS, + [BUTTON,{addfield},'Add'], + [BUTTON,0,'Delete'], + [BUTTON,0,'Change']]]) +EXCEPT DO + multiforall({gh},mh,`unblockwin(gh)) + ReThrow() +ENDPROC + +PROC editfield(gh) HANDLE + blockwin(gh) + easyguiA('Field Characteristics', + [ROWS, + [EQROWS, + [STR,0,'fieldname',s,200,10], + [INTEGER,0,'fieldlength',40,10]], + [BUTTON,0,'Ok']]) +EXCEPT DO + unblockwin(gh) + ReThrow() +ENDPROC + +PROC addfield(i) IS editfield(i) + +PROC dm(x:PTR TO guihandle) + IF havedm=FALSE + havedm:=TRUE + addmultiA(x.mh,'E FileManager v0.1', + [ROWS, + [COLS, + [ROWS, + [LISTV,0,NIL,1,10,NIL,0,NIL,0], + [STR,0,'',s,200,5] + ], + [EQROWS, + [BUTTON,1,'DF0:'], + [BUTTON,1,'DF1:'], + [BUTTON,1,'Ram:'], + [BUTTON,1,'System:'], + [BUTTON,1,'Work:'], + [BUTTON,1,'E:'], + [SPACEV] + ], + [ROWS, + [LISTV,0,NIL,1,5,NIL,0,NIL,0], + [STR,0,'',s,200,5] + ] + ], + [COLS, + [EQROWS,[SBUTTON,1,'Parent'],[SBUTTON,1,'All']], + [EQROWS,[SBUTTON,1,'Copy'],[SBUTTON,1,'Clear']], + [EQROWS,[SBUTTON,1,'Move'],[SBUTTON,1,'Toggle']], + [EQROWS,[SBUTTON,1,'Rename'],[SBUTTON,1,'Size']], + [EQROWS,[SBUTTON,1,'Delete'],[SBUTTON,1,'View']], + [EQROWS,[SBUTTON,1,'MakeDir'],[SBUTTON,0,'Config']] + ] + ], + [EG_CLEAN,{havenot}, EG_INFO,{havedm}, NIL] + ) + ENDIF +ENDPROC + +PROC tiny(x:PTR TO guihandle) + IF havetiny=FALSE + havetiny:=TRUE + addmultiA(x.mh,'um..',[SBUTTON,0,'blerk'], + [EG_CLEAN,{havenot}, EG_INFO,{havetiny}, NIL]) + ENDIF +ENDPROC + +PROC messy(x:PTR TO guihandle) + IF havemessy=FALSE + havemessy:=TRUE + addmultiA(x.mh,'test-gui', + [ROWS, + [COLS, + [BEVEL, + [ROWS, + [BUTTON,{um},'Um,...'], + [MX,{v},NIL,['One','Two','Three',NIL],FALSE,1], + [BUTTON,{pom},'PomPomPom'], + [CHECK,{v},'check this out!',TRUE,FALSE], + [STR,{v},'input',s,50,3], + [LISTV,{v},NIL,2,5,NIL,FALSE,0,0] + ] + ], + [BEVEL, + [EQROWS, + [STR,{v},'input',s,50,4], + [INTEGER,{v},'int:',5,3], + [SLIDE,{v},'tata: ',FALSE,0,999,20,2,'%3ld'], + [TEXT,'bla','text:',FALSE,5], + [NUM,123,'num:',TRUE,5], + [PALETTE,{v},'kleur:',3,5,2,0], + [CYCLE,{v},'choose:',['Yep','Nope',NIL],1], + [SCROLL,{v},FALSE,10,0,2,2] + ] + ] + ], + [BAR], + [EQCOLS, + [BUTTON,1,'Save'], + [BUTTON,2,'Use'], + [BUTTON,0,'Cancel'] + ] + ], + [EG_CLEAN,{havenot}, EG_INFO,{havemessy}, + EG_MENU,[NM_TITLE,0,'Project',0, 0,0,0, + NM_ITEM,0,'Load', 'l',0,0,{um}, + NM_ITEM,0,'Save', 's',0,0,{um}, + NM_ITEM,0,'Bla ->', 0, 0,0,0, + NM_SUB,0,'aaargh', 'a',0,0,1, + NM_SUB,0,'hmmm', 'h',0,0,2, + NM_ITEM,0,'Quit', 'q',0,0,0, + 0,0,0,0,0,0,0]:newmenu, + NIL] + ) + ENDIF +ENDPROC + +PROC um(x) IS WriteF('um!\n') +PROC pom(x) IS WriteF('pom!\n') +PROC v(x,y) IS WriteF('v=\d!\n',y) diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/animcontrol_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/animcontrol_test.e new file mode 100644 index 0000000..815ccd6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/animcontrol_test.e @@ -0,0 +1,32 @@ +MODULE 'tools/easygui', 'tools/exceptions', + 'plugins/animcontrol' + +PROC main() HANDLE + DEF a=NIL:PTR TO animcontrol + NEW a.animcontrol(10,20) + easyguiA('BOOPSI in EasyGUI!', + [ROWS, + [TEXT,'AnimControl test...',NIL,TRUE,1], + [PLUGIN,{animcontrolaction},a], + [EQCOLS, + [BUTTON,{reset},'Reset',a], + [BUTTON,{toggle_enabled},'Toggle Enabled',a] + ] + ]) +EXCEPT DO + END a + report_exception() +ENDPROC + +PROC animcontrolaction(i,a:PTR TO animcontrol) + PrintF('Action: mode=\d frame=\d\n', a.mode, a.frame) +ENDPROC + +PROC reset(a:PTR TO animcontrol,i) + a.setframe(10) + a.setplay(FALSE) +ENDPROC + +PROC toggle_enabled(a:PTR TO animcontrol,i) + a.setdisabled(a.disabled=FALSE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/button_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/button_test.e new file mode 100644 index 0000000..40b4bc9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/button_test.e @@ -0,0 +1,42 @@ +MODULE 'tools/easygui', 'tools/exceptions', + 'plugins/button' + +DEF b2=NIL:PTR TO button + +PROC main() HANDLE + DEF b1=NIL:PTR TO button, b3=NIL:PTR TO button, + bp=NIL:PTR TO button + NEW bp.togglebutton('Paused') + easyguiA('BOOPSI in EasyGUI!', + [ROWS, + [TEXT,'Button test...',NIL,TRUE,5], + [COLS, + [PLUGIN,{buttonaction1},NEW b1.togglebutton('New')], + [PLUGIN,{buttonaction1},NEW b2.pushbutton('Open')], + [PLUGIN,{buttonaction2},NEW b3.button('Save')], + [PLUGIN,{buttonaction3},bp] + ], + [SBUTTON,{toggle_enabled},'Toggle Enabled',bp] + ]) +EXCEPT DO + END b1,b2,b3,bp + report_exception() +ENDPROC + +PROC buttonaction1(i,b:PTR TO button) + WriteF('button selected=\d\n', b.selected) +ENDPROC + +PROC buttonaction2(i,b:PTR TO button) + WriteF('button selected=\d\n', b.selected) + b2.setselected(FALSE) +ENDPROC + +PROC buttonaction3(i,b:PTR TO button) + WriteF('button selected=\d\n', b.selected) + b.settext(IF b.selected THEN 'Play' ELSE 'Paused') +ENDPROC + +PROC toggle_enabled(b:PTR TO button,i) + b.setdisabled(b.disabled=FALSE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/calendar_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/calendar_test.e new file mode 100644 index 0000000..9ec220e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/calendar_test.e @@ -0,0 +1,38 @@ +MODULE 'tools/EasyGUI', 'tools/exceptions', + 'utility/date', + 'plugins/calendar' + +DEF title + +PROC main() HANDLE + DEF c=NIL:PTR TO calendar + NEW c.calendar([0,0,0,25,12,1996,0]:clockdata,TRUE) + easyguiA('BOOPSI in EasyGUI!', + [ROWS, + title:=[TEXT,'Calendar: December 1996',NIL,TRUE,5], + [PLUGIN,{calendaraction},c], + [EQCOLS, + [BUTTON,{reset},'Set to October',c], + [BUTTON,{toggle_enabled},'Toggle Enabled',c] + ] + ]) +EXCEPT DO + END c + report_exception() +ENDPROC + +PROC calendaraction(i,c:PTR TO calendar) + WriteF('You picked day \d\n', c.date.mday) +ENDPROC + +PROC reset(c:PTR TO calendar,gh) + IF c.date.month<>10 + c.date.month:=10 + c.setdate() + settext(gh,title,'Calendar: October 1996') + ENDIF +ENDPROC + +PROC toggle_enabled(c:PTR TO calendar,i) + c.setdisabled(c.disabled=FALSE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/colorwheel_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/colorwheel_test.e new file mode 100644 index 0000000..8a0569c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/colorwheel_test.e @@ -0,0 +1,62 @@ +MODULE 'tools/easygui', 'tools/exceptions', + 'gadgets/colorwheel', + 'plugins/colorwheel' + +DEF rgb:colorwheelrgb, hsb:colorwheelhsb, title + +PROC init(rgb:PTR TO colorwheelrgb) + rgb.red:=-1; rgb.blue:=0; rgb.green:=0 +ENDPROC + +PROC main() HANDLE + DEF c=NIL:PTR TO colorwheel + init(rgb) + NEW c.colorwheel(rgb,NIL,TRUE) + easyguiA('BOOPSI in EasyGUI!', + [ROWS, + title:=[TEXT,'Colorwheel test (using RGB)...',NIL,TRUE,1], + [COLS, + [PLUGIN,{colorwheelaction},c], + [EQROWS, + [BUTTON,{reset},'Reset',c], + [BUTTON,{swap},'RGB/HSB',c], + [BUTTON,{toggle_enabled},'Toggle Enabled',c] + ] + ] + ]) +EXCEPT DO + END c + report_exception() +ENDPROC + +PROC colorwheelaction(i,c:PTR TO colorwheel) + IF c.rgb + PrintF('RGB r=$\h, g=$\h, b=$\h\n', + c.rgb.red, c.rgb.green, c.rgb.blue) + ELSE + PrintF('HSB h=$\h, s=$\h, b=$\h\n', + c.hsb.hue, c.hsb.saturation, c.hsb.brightness) + ENDIF +ENDPROC + +PROC reset(c:PTR TO colorwheel,gh) + init(rgb) + c.setrgb(rgb) + settext(gh,title,'Reset Colorwheel to RGB...') +ENDPROC + +PROC swap(c:PTR TO colorwheel,gh) + IF c.rgb + settext(gh,title,'Now Colorwheel is HSB...') + c.gethsb(hsb) + c.sethsb(hsb) + ELSE + settext(gh,title,'Colorwheel using RGB...') + c.getrgb(rgb) + c.setrgb(rgb) + ENDIF +ENDPROC + +PROC toggle_enabled(c:PTR TO colorwheel,i) + c.setdisabled(c.disabled=FALSE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/gradient_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/gradient_test.e new file mode 100644 index 0000000..3bb4571 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/gradient_test.e @@ -0,0 +1,40 @@ +MODULE 'tools/EasyGUI', 'tools/exceptions', + 'plugins/gradient' + +DEF disabled=FALSE, pens1, pens2 + +PROC main() HANDLE + DEF g=NIL:PTR TO gradient + pens1:=[2,0,1,-1]:INT + pens2:=[1,0,2,-1]:INT + NEW g.gradient(FALSE,$4444,6,pens1) + easyguiA('BOOPSI in EasyGUI!', + [ROWS, + [TEXT,'GradientSlider test...',NIL,TRUE,15], + [PLUGIN,{gradaction},g], + [COLS, + [BUTTON,{reset},'Reset',g], + [BUTTON,{swap_pens},'Swap Pens',g], + [BUTTON,{toggle_enabled},'Toggle Enabled',g] + ] + ]) +EXCEPT DO + report_exception() +ENDPROC + +PROC gradaction(i,g:PTR TO gradient) + WriteF('gradient value = \z$\h[4]\n', g.curval) +ENDPROC + +PROC reset(g:PTR TO gradient,i) + g.setcurval($4444) + g.setpens(pens1) +ENDPROC + +PROC swap_pens(g:PTR TO gradient,i) + g.setpens(IF g.pens=pens1 THEN pens2 ELSE pens1) +ENDPROC + +PROC toggle_enabled(g:PTR TO gradient,i) + g.setdisabled(g.disabled=FALSE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/iconify_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/iconify_test.e new file mode 100644 index 0000000..6bf2cd9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/iconify_test.e @@ -0,0 +1,33 @@ +MODULE 'tools/exceptions', + 'tools/easygui', + 'other/split', + 'plugins/iconify' + +PROC main() HANDLE + DEF args:PTR TO LONG, p=NIL:PTR TO iconify + IF args:=argSplit() + IF args[] + PrintF('Using the icon for "\s"\n',args[]) + ELSE + PrintF('Using default icon (try "sys:tools/CMD" as an argument)\n') + ENDIF + NEW p.iconify('Iconify',args[],'Hello',TRUE) + easyguiA('GadTools in EasyGUI!', + [ROWS, + [TEXT,'Iconify test...',NIL,TRUE,1], + [SPACE], + [PLUGIN,0,p,TRUE], + [SPACE], + [BUTTON,{toggle_enabled},'Toggle Enabled',p] + ]) + ELSE + PrintF('Bad arguments: specify a filename\n') + ENDIF +EXCEPT DO + END p + report_exception() +ENDPROC + +PROC toggle_enabled(p:PTR TO iconify,i) + p.setdisabled(p.disabled=FALSE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/imagebutton_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/imagebutton_test.e new file mode 100644 index 0000000..fcbd9eb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/imagebutton_test.e @@ -0,0 +1,128 @@ +MODULE 'tools/easygui', 'tools/exceptions', 'tools/copylist', + 'intuition/intuition', + 'plugins/imagebutton' + +DEF pp1, pp2, b2=NIL:PTR TO imagebutton + +PROC main() HANDLE + DEF b1=NIL:PTR TO imagebutton, b3=NIL:PTR TO imagebutton, + bp=NIL:PTR TO imagebutton, img1, img2, img3, + d1=NIL, d2=NIL, d3=NIL, d4=NIL, d5=NIL + img1:=[0,0,22,22,3, + d1:=copyListToChip([ /* Plane 0 */ + $00000000,$00000000,$00000000,$00000000, + $00FC0000,$00060000,$00058000,$0404C000, + $0407E000,$04006000,$04006000,$04006000, + $04006000,$04006000,$04006000,$04006000, + $04006000,$04006000,$04006000,$07FFE000, + $01FFE000,$00000000, + /* Plane 1 */ + $00000000,$02000000,$0A800000,$07000000, + $38C00000,$07F80000,$0BFA8000,$07FB4000, + $07F82000,$07FFA000,$07FFA000,$07FFA000, + $03FFA000,$03FFA000,$03FFA000,$03FFA000, + $03FFA000,$03FFA000,$03FFA000,$00002000, + $01FFE000,$00000000, + /* Plane 2 */ + $00000000,$00000000,$00000000,$00000000, + $00C00000,$00000000,$00008000,$04004000, + $04002000,$04002000,$04002000,$04002000, + $00002000,$00002000,$00002000,$00002000, + $00002000,$00002000,$00002000,$00002000, + $01FFE000,$00000000]), + $0007,0,NIL]:image + img2:=[0,0,22,22,3, + d2:=copyListToChip([ /* Plane 0 */ + $00000000,$00007000,$0003F000,$000FF000, + $001FF800,$000FF800,$0007F800,$1E0FF000, + $21DFF000,$40FFF000,$407FF000,$40FB2000, + $5FFF8000,$50008000,$7000E000,$6000C000, + $60018000,$60018000,$40010000,$7FFE0000, + $00000000,$00000000, + /* Plane 1 */ + $00000000,$00004000,$00022000,$0001E000, + $0017E800,$000BE800,$0003D800,$0007D000, + $1ECE5000,$3F1DB000,$3FB9F000,$3F752000, + $20000000,$2FFF0000,$3FFF6000,$1FFF4000, + $1FFF8000,$3FFE8000,$3FFE0000,$00000000, + $00000000,$00000000, + /* Plane 2 */ + $00000000,$00004000,$00020000,$00000000, + $00100800,$00080800,$00001800,$00001000, + $1EC01000,$3F01B000,$3F81F000,$3F052000, + $20000000,$25550000,$3AAA6000,$15554000, + $0AAB8000,$35548000,$2AAA0000,$00000000, + $00000000,$00000000]), + $0007,0,NIL]:image + img3:=[0,0,22,22,3, + d3:=copyListToChip([ /* Plane 0 */ + $00000000,$10000000,$3C000000,$7E000000, + $3F000000,$1FB00000,$0FF00000,$07FC0000, + $07FC0000,$0BFC0000,$17FF8000,$17F8C000, + $11F8C000,$17FFE000,$14002000,$1C003800, + $18003000,$18006000,$18006000,$10004000, + $1FFF8000,$00000000, + /* Plane 1 */ + $00000000,$00000000,$14000000,$3A000000, + $1D000000,$0E900000,$07200000,$03EC0000, + $01EC0000,$05F40000,$0BF00000,$08F74000, + $0F374000,$08000000,$0BFFC000,$0FFFD800, + $07FFD000,$07FFE000,$0FFFA000,$0FFF8000, + $00000000,$00000000, + /* Plane 2 */ + $00000000,$00000000,$04000000,$02000000, + $01000000,$00900000,$00000000,$000C0000, + $000C0000,$04040000,$08000000,$08074000, + $0F274000,$08000000,$09554000,$0EAA9800, + $05555000,$02AAE000,$0D552000,$0AAA8000, + $00000000,$00000000]), + $0007,0,NIL]:image + pp1:=[0,0,22,7,2, + d4:=copyListToChip([$00030000, $0003C000, $0003F000, $0003FC00, + $0003F000, $0003C000, $00030000, + $E3800000, $E3800000, $E3800000, $E3800000, + $E3800000, $E3800000, $E3800000]), + $0003, 0, NIL]:image + pp2:=[0,0,22,7,2, + d5:=copyListToChip([$E3800000, $E3800000, $E3800000, $E3800000, + $E3800000, $E3800000, $E3800000, + $00030000, $0003C000, $0003F000, $0003FC00, + $0003F000, $0003C000, $00030000]), + $0003, 0, NIL]:image + + NEW bp.toggleimagebutton(pp1,30,22) + + easyguiA('BOOPSI in EasyGUI!', + [ROWS, + [TEXT,'ImageButton test...',NIL,TRUE,5], + [COLS, + [PLUGIN,{buttonaction1},NEW b1.toggleimagebutton(img1)], + [PLUGIN,{buttonaction1},NEW b2.pushimagebutton(img2)], + [PLUGIN,{buttonaction2},NEW b3.imagebutton(img3)], + [PLUGIN,{buttonaction3},bp] + ], + [SBUTTON,{toggle_enabled},'Toggle Enabled',bp] + ]) +EXCEPT DO + END b1,b2,b3,bp + Dispose(d1); Dispose(d2); Dispose(d3); Dispose(d4); Dispose(d5) + report_exception() +ENDPROC + +PROC buttonaction1(i,b:PTR TO imagebutton) + WriteF('button selected=\d\n', b.selected) +ENDPROC + +PROC buttonaction2(i,b:PTR TO imagebutton) + WriteF('button selected=\d\n', b.selected) + b2.setselected(FALSE) +ENDPROC + +PROC buttonaction3(i,b:PTR TO imagebutton) + WriteF('button selected=\d\n', b.selected) + b.setimage(IF b.selected THEN pp2 ELSE pp1) +ENDPROC + +PROC toggle_enabled(b:PTR TO imagebutton,i) + b.setdisabled(b.disabled=FALSE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test.e new file mode 100644 index 0000000..097a284 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test.e @@ -0,0 +1,55 @@ +MODULE 'tools/easygui', 'tools/exceptions', + 'graphics/text', + 'plugins/led' + +DEF going=FALSE, title + +PROC main() HANDLE + DEF l=NIL:PTR TO led + NEW l.led(2,[0,0]:INT,TRUE) + easyguiA('BOOPSI in EasyGUI!', + [ROWS, + title:=[TEXT,'LED Boopsi image tester...',NIL,TRUE,1], + [COLS, + [EQROWS, + [BUTTON,{runaction},'Run',l], + [BUTTON,{stopaction},'Stop'] + ], + [PLUGIN,0,l] + ] + ]) +EXCEPT DO + END l + report_exception() +ENDPROC + +PROC runaction(l:PTR TO led,gh) HANDLE + DEF h,m + IF going + settext(gh,title,'I''m busy counting!') + ELSE + going:=TRUE + settext(gh,title,'Started counting...') + Delay(10) + FOR h:=0 TO 12 + FOR m:=0 TO 59 + l.values:=[h,m]:INT + l.redisplay() + l.colon:=(l.colon=FALSE) + checkgui(gh) + Delay(10) + settext(gh,title,'Counting...') + ENDFOR + ENDFOR + settext(gh,title,'Finished!') + going:=FALSE + ENDIF +EXCEPT + going:=FALSE + settext(gh,title,'You stopped me!') + IF exception<>"STOP" THEN ReThrow() +ENDPROC + +PROC stopaction(i) + IF going THEN Raise("STOP") +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test2.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test2.e new file mode 100644 index 0000000..9c7fa05 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test2.e @@ -0,0 +1,149 @@ +-> This one shows the use of multi-window GUIs with PLUGINs, and multiple, +-> pseudo-asynchronous activities. +MODULE 'tools/easygui', 'tools/exceptions', + 'graphics/text', 'intuition/intuition', + 'plugins/led' + +-> Global for multiforall(). +DEF gh:PTR TO guihandle + +-> Number of GUIs counting. +DEF counting=0 + +CONST NUM_VALUES=2 + +-> Store all the GUI data in one place. +OBJECT mygui + -> In particular, keep PLUGIN references here. + ledplug:PTR TO led + gh:PTR TO guihandle + gui + title + going + values[NUM_VALUES]:ARRAY OF INT +ENDOBJECT + +-> The main loop: create one window to start with. +PROC main() HANDLE + DEF mh=NIL + mh:=multiinit() + create(mh) + multiloop(mh) +EXCEPT DO + cleanmulti(mh) + report_exception() +ENDPROC + +-> Create a new GUI. +PROC create(mh) HANDLE + DEF t, g, gui=NIL:PTR TO mygui + NEW gui + -> Allocate all PLUGINs for the GUI like this. + NEW gui.ledplug.led(NUM_VALUES,gui.values,TRUE) + -> Now we can try opening a GUI. + gui.gh:=addmultiA(mh,'BOOPSI in EasyGUI!', + g:=NEW [ROWS, + t:=NEW [TEXT,'LED Boopsi image tester...',NIL,TRUE,16], + NEW [COLS, + NEW [EQROWS, + NEW [BUTTON,{runaction},'Run/Stop'], + NEW [BUTTON,{spawn},'Spawn'], + NEW [BUTTON,0,'Quit'] + ], + NEW [PLUGIN,0,gui.ledplug] + ] + ], + [EG_INFO,gui, EG_LEFT,Rnd(400), EG_TOP,Rnd(400), + -> The cleanup routine will deallocate the PLUGINs used. + EG_CLEAN,{cleanmygui}, EG_CLOSE,{close}, NIL]) + gui.gui:=g + gui.title:=t +EXCEPT + -> If there was any problem then it may have been the creation of PLUGINs + -> or addmultiA(). Luckily, addmultiA() (and guiinitA()) will *not* call + -> the EG_CLEAN function if they caused the problem, so we can (safely). + cleanmygui(gui) + ReThrow() +ENDPROC + +-> The custom clean up code for each GUI. +PROC cleanmygui(gui:PTR TO mygui) + IF gui + disposegui(gui.gui) + END gui.ledplug + END gui + ENDIF +ENDPROC + +-> The action function creates a new GUI in the group. +PROC spawn(info:PTR TO mygui) IS create(info.gh.mh) + +-> The run/stop action. +PROC runaction(info:PTR TO mygui) + IF info.going + settext(info.gh,info.title,'You stopped me!') + stop(info) + ELSE + settext(info.gh,info.title,'Started counting...') + Delay(10) + settext(info.gh,info.title,'Counting...') + run(info) + ENDIF +ENDPROC + +PROC stop(info:PTR TO mygui) + -> Going, so stop. + info.going:=FALSE + -> One less is counting. + DEC counting +ENDPROC + +PROC run(info:PTR TO mygui) + DEF mh + -> Stopped, so go. + info.going:=TRUE + -> One more counting. + INC counting + -> We're the first so we're the loop. + IF counting=1 + mh:=info.gh.mh + -> While there is someone counting + WHILE counting + -> Tick each GUI that's going. + multiforall({gh},mh,`next(gh.info)) + checkmulti(mh) + Delay(10) + ENDWHILE + ENDIF +ENDPROC + +-> Next count. +PROC next(info:PTR TO mygui) + DEF l:PTR TO led,h,m + IF info.going + l:=info.ledplug + l.colon:=(l.colon=FALSE) + m:=info.values[1]+1 + IF m=60 + m:=0 + h:=info.values[]+1 + IF h=13 + h:=0 + info.going:=FALSE + DEC counting + settext(info.gh,info.title,'Finished!') + ENDIF + l.values[]:=h + ENDIF + l.values[1]:=m + l.redisplay() + ENDIF +ENDPROC + +-> Close function. +PROC close(info:PTR TO mygui) + -> Stop if running. + IF info.going THEN stop(info) + -> Destroy window. + cleangui(info.gh) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test3.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test3.e new file mode 100644 index 0000000..b8be15a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test3.e @@ -0,0 +1,171 @@ +-> This one shows the use of multi-window GUIs with PLUGINs, and multiple, +-> real asynchronous activities (by creating tasks). +MODULE 'tools/easygui', 'tools/exceptions', + 'graphics/text', 'intuition/intuition', + 'plugins/led', + 'amigalib/tasks', 'amigalib/time', 'other/ecode', + 'devices/timer', 'exec/tasks' + +-> Global for multiexists(). +DEF gh:PTR TO guihandle + +CONST NUM_VALUES=2 + +-> Store all the GUI data in one place. +OBJECT mygui + -> In particular, keep PLUGIN references here. + ledplug:PTR TO led + gh:PTR TO guihandle + gui + title + going + values[NUM_VALUES]:ARRAY OF INT + task +ENDOBJECT + +-> The main loop: create one window to start with. +PROC main() HANDLE + DEF mh=NIL + mh:=multiinit() + create(mh) + multiloop(mh) +EXCEPT DO + cleanmulti(mh) + report_exception() +ENDPROC + +-> Create a new GUI. +PROC create(mh) HANDLE + DEF t, g, gui=NIL:PTR TO mygui + NEW gui + -> Allocate all PLUGINs for the GUI like this. + NEW gui.ledplug.led(NUM_VALUES,gui.values,TRUE) + -> Now we can try opening a GUI. + gui.gh:=addmultiA(mh,'BOOPSI in EasyGUI!', + g:=NEW [ROWS, + t:=NEW [TEXT,'LED Boopsi image tester...',NIL,TRUE,16], + NEW [COLS, + NEW [EQROWS, + NEW [BUTTON,{runaction},'Run/Stop'], + NEW [BUTTON,{spawn},'Spawn'], + NEW [BUTTON,{quit},'Quit'] + ], + NEW [PLUGIN,0,gui.ledplug] + ] + ], + [EG_INFO,gui, EG_LEFT,Rnd(400), EG_TOP,Rnd(400), + -> The cleanup routine will deallocate the PLUGINs used. + EG_CLEAN,{cleanmygui}, EG_CLOSE,{close}, NIL]) + gui.gui:=g + gui.title:=t +EXCEPT + -> If there was any problem then it may have been the creation of PLUGINs + -> or addmultiA(). Luckily, addmultiA() (and guiinitA()) will *not* call + -> the EG_CLEAN function if they caused the problem, so we can (safely). + cleanmygui(gui) + ReThrow() +ENDPROC + +PROC quit(info) IS quitgui(0) + +-> The custom clean up code for each GUI. +PROC cleanmygui(gui:PTR TO mygui) + IF gui + -> Stop and destroy task, if necessary. + stop(gui) + disposegui(gui.gui) + END gui.ledplug + END gui + ENDIF +ENDPROC + +-> The action function creates a new GUI in the group. +PROC spawn(info:PTR TO mygui) IS create(info.gh.mh) + +-> The run/stop action. +PROC runaction(info:PTR TO mygui) + IF info.going + settext(info.gh,info.title,'You stopped me!') + stop(info) + ELSE + settext(info.gh,info.title,'Started counting...') + Delay(10) + settext(info.gh,info.title,'Counting...') + run(info) + ENDIF +ENDPROC + +PROC stop(info:PTR TO mygui) + -> Going, so stop. + info.going:=FALSE + -> Temporarily make it high priority to die quicker. + Forbid() + IF info.task THEN SetTaskPri(info.task,5) + Permit() + -> Wait for task to die. + WHILE info.task DO Delay(1) +ENDPROC + +PROC run(info:PTR TO mygui) + DEF taskcode + IF info.task=NIL + IF taskcode:=eCodeTask({taskloop}) + -> Make new Counter task, low priority. + info.task:=createTask('Counter',-5,taskcode,1000,info) + ENDIF + ENDIF +ENDPROC + +-> The loop the task will execute. +PROC taskloop() + DEF task:PTR TO tc, info:PTR TO mygui, error=FALSE + task:=FindTask(NIL) + info:=task.userdata + info.going:=TRUE + -> While there is something to do. + WHILE next(info) + -> Cannot Delay() since this code is run by a Task (not a Process). + -> (200000 is a fifth of a second, or 10 ticks) + EXIT error:=timeDelay(UNIT_MICROHZ,0,200000) + ENDWHILE + -> Kill ourself safely. + Forbid() + -> This GUI update is safe, since within Forbid()/Permit(). + IF error THEN settext(info.gh,info.title,'Timer error!') + info.task:=NIL + deleteTask(task) + Permit() +ENDPROC + +-> Next count. +PROC next(info:PTR TO mygui) + DEF l:PTR TO led,h,m + IF info.going + l:=info.ledplug + l.colon:=(l.colon=FALSE) + m:=info.values[1]+1 + IF m=60 + m:=0 + h:=info.values[]+1 + IF h=13 + h:=0 + info.going:=FALSE + -> Must Forbid()/Permit() since we're a different task to the GUI. + Forbid() + settext(info.gh,info.title,'Finished!') + Permit() + RETURN FALSE + ENDIF + l.values[]:=h + ENDIF + l.values[1]:=m + -> Must Forbid()/Permit() since we're a different task to the GUI. + Forbid() + l.redisplay() + Permit() + RETURN TRUE + ENDIF +ENDPROC FALSE + +-> Close function. +PROC close(info:PTR TO mygui) IS cleangui(info.gh) diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test4.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test4.e new file mode 100644 index 0000000..76c65a0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/led_test4.e @@ -0,0 +1,127 @@ +-> This one shows the use of multi-window GUIs with PLUGINs. A ticker is +-> used, so the counting stops when none of the windows in the group is +-> active! +MODULE 'tools/easygui', 'tools/exceptions', + 'graphics/text', 'intuition/intuition', + 'plugins/led', 'plugins/ticker' + +-> Global for multiforall(). +DEF gh:PTR TO guihandle + +CONST NUM_VALUES=2 + +-> Store all the GUI data in one place. +OBJECT mygui + -> In particular, keep PLUGIN references here. + ledplug:PTR TO led + ticker:PTR TO ticker + gh:PTR TO guihandle + gui + title + going + values[NUM_VALUES]:ARRAY OF INT +ENDOBJECT + +-> The main loop: create one window to start with. +PROC main() HANDLE + DEF mh=NIL + mh:=multiinit() + create(mh) + multiloop(mh) +EXCEPT DO + cleanmulti(mh) + report_exception() +ENDPROC + +-> Create a new GUI. +PROC create(mh) HANDLE + DEF t, g, gui=NIL:PTR TO mygui + NEW gui + -> Allocate all PLUGINs for the GUI like this. + NEW gui.ledplug.led(NUM_VALUES,gui.values,TRUE) + NEW gui.ticker + -> Now we can try opening a GUI. + gui.gh:=addmultiA(mh,'BOOPSI in EasyGUI!', + g:=NEW [ROWS, + t:=NEW [TEXT,'LED Boopsi image tester...',NIL,TRUE,16], + NEW [PLUGIN,{tick},gui.ticker], + NEW [COLS, + NEW [EQROWS, + NEW [BUTTON,{runaction},'Run/Stop'], + NEW [BUTTON,{spawn},'Spawn'], + NEW [BUTTON,0,'Quit'] + ], + NEW [PLUGIN,0,gui.ledplug] + ] + ], + [EG_INFO,gui, EG_LEFT,Rnd(400), EG_TOP,Rnd(400), + -> The cleanup routine will deallocate the PLUGINs used. + EG_CLEAN,{cleanmygui}, EG_CLOSE,{close}, NIL]) + gui.gui:=g + gui.title:=t +EXCEPT + -> If there was any problem then it may have been the creation of PLUGINs + -> or addmultiA(). Luckily, addmultiA() (and guiinitA()) will *not* call + -> the EG_CLEAN function if they caused the problem, so we can (safely). + cleanmygui(gui) + ReThrow() +ENDPROC + +-> The custom clean up code for each GUI. +PROC cleanmygui(gui:PTR TO mygui) + IF gui + disposegui(gui.gui) + END gui.ticker + END gui.ledplug + END gui + ENDIF +ENDPROC + +-> The action function creates a new GUI in the group. +PROC spawn(info:PTR TO mygui) IS create(info.gh.mh) + +-> The run/stop action. +PROC runaction(info:PTR TO mygui) + IF info.going + -> Going, so stop. + info.going:=FALSE + settext(info.gh,info.title,'You stopped me!') + ELSE + -> Stopped, so go. + info.going:=TRUE + settext(info.gh,info.title,'Started counting...') + Delay(10) + settext(info.gh,info.title,'Counting...') + ENDIF +ENDPROC + +-> Tick! +PROC tick(info:PTR TO mygui,t) + -> Go to next count for all open windows. + multiforall({gh},info.gh.mh,`IF gh.wnd THEN next(gh.info) ELSE 0) +ENDPROC + +-> Next count. +PROC next(info:PTR TO mygui) + DEF l:PTR TO led,h,m + IF info.going + l:=info.ledplug + l.colon:=(l.colon=FALSE) + m:=info.values[1]+1 + IF m=60 + m:=0 + h:=info.values[]+1 + IF h=13 + h:=0 + info.going:=FALSE + settext(info.gh,info.title,'Finished!') + ENDIF + l.values[]:=h + ENDIF + l.values[1]:=m + l.redisplay() + ENDIF +ENDPROC + +-> Close function. +PROC close(info:PTR TO mygui) IS cleangui(info.gh) diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/password_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/password_test.e new file mode 100644 index 0000000..1025855 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/password_test.e @@ -0,0 +1,41 @@ +MODULE 'tools/exceptions', + 'tools/easygui', + 'plugins/password' + +DEF default + +PROC main() HANDLE + DEF p=NIL:PTR TO password, s[20]:STRING + default:='My Password!' + StrCopy(s,default) + NEW p.password(s,'Password:',TRUE,10) + easyguiA('GadTools in EasyGUI!', + [ROWS, + [TEXT,'Password test...',NIL,TRUE,1], + [PLUGIN,{passaction},p,TRUE], + [COLS, + [BUTTON,{show},'Show',p], + [BUTTON,{reset},'Reset',p], + [BUTTON,{toggle_enabled},'Toggle Enabled',p] + ] + ]) +EXCEPT DO + END p + report_exception() +ENDPROC + +PROC passaction(i,p:PTR TO password) + PrintF('Action: "\s"\n',p.estr) +ENDPROC + +PROC show(p:PTR TO password,i) + PrintF('Show: "\s"\n', p.estr) +ENDPROC + +PROC reset(p:PTR TO password,i) + p.setpass(default) +ENDPROC + +PROC toggle_enabled(p:PTR TO password,i) + p.setdisabled(p.disabled=FALSE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/tabs_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/tabs_test.e new file mode 100644 index 0000000..a69cf35 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/tabs_test.e @@ -0,0 +1,36 @@ +MODULE 'tools/easygui', 'tools/exceptions', + 'gadgets/tabs', + 'plugins/tabs' + +PROC main() HANDLE + DEF t=NIL:PTR TO tabs + NEW t.tabs(['Display', -1,-1,-1,-1, NIL, + 'Edit', -1,-1,-1,-1, NIL, + 'File', -1,-1,-1,-1, NIL, + NIL]:tablabel, + 0,FALSE) + easyguiA('BOOPSI in EasyGUI!', + [ROWS, + [TEXT,'Tabs test...',NIL,TRUE,5], + [PLUGIN,{tabsaction},t], + [EQCOLS, + [BUTTON,{reset},'Reset',t], + [BUTTON,{toggle_enabled},'Toggle Enabled',t] + ] + ]) +EXCEPT DO + END t + report_exception() +ENDPROC + +PROC tabsaction(i,t:PTR TO tabs) + WriteF('tabs value = \d\n',t.current) +ENDPROC + +PROC reset(t:PTR TO tabs,i) + t.setcurrent(0) +ENDPROC + +PROC toggle_enabled(t:PTR TO tabs,i) + t.setdisabled(t.disabled=FALSE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/tabs_test2.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/tabs_test2.e new file mode 100644 index 0000000..1a7374d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/tabs_test2.e @@ -0,0 +1,28 @@ +MODULE 'tools/easygui', 'tools/exceptions', + 'gadgets/tabs', + 'plugins/tabs' + +DEF labels:PTR TO tablabel, gui:PTR TO LONG + +PROC main() + DEF top, t=NIL:PTR TO tabs + labels:=['Slide', -1,-1,-1,-1, NIL, + 'Check', -1,-1,-1,-1, NIL, + 'Palette', -1,-1,-1,-1, NIL, + NIL]:tablabel + NEW t.tabs(labels) + top:=[PLUGIN,{tabsaction},t] + gui:=[ + [ROWS,top,[SPACE],[SLIDE,{ignore},'Colors:',FALSE,1,8,3,5,'']], + [ROWS,top,[SPACE],[CHECK,{ignore},'Ignore case',TRUE,FALSE]], + [ROWS,top,[SPACE],[PALETTE,{ignore},'Palette:',3,5,2,0]] + ] + easyguiA('Tabs Test 2', gui[]) +ENDPROC + +PROC ignore(i,x) IS EMPTY + +PROC tabsaction(gh,t:PTR TO tabs) + changegui(gh,gui[t.current]) + changetitle(gh,labels[t.current].label) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/tapedeck_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/tapedeck_test.e new file mode 100644 index 0000000..a4b9f35 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/tapedeck_test.e @@ -0,0 +1,32 @@ +MODULE 'tools/easygui', 'tools/exceptions', + 'plugins/tapedeck' + +PROC main() HANDLE + DEF t=NIL:PTR TO tapedeck + NEW t.tapedeck() + easyguiA('BOOPSI in EasyGUI!', + [ROWS, + [TEXT,'Tapedeck test...',NIL,TRUE,1], + [PLUGIN,{tapedeckaction},t], + [EQCOLS, + [BUTTON,{reset},'Reset',t], + [BUTTON,{toggle_enabled},'Toggle Enabled',t] + ] + ]) +EXCEPT DO + END t + report_exception() +ENDPROC + +PROC tapedeckaction(i,t:PTR TO tapedeck) + PrintF('Action: mode=\d\s\n', t.mode, IF t.paused THEN ' (paused)' ELSE '') +ENDPROC + +PROC reset(t:PTR TO tapedeck,i) + t.setmode() + t.setpaused(FALSE) +ENDPROC + +PROC toggle_enabled(t:PTR TO tapedeck,i) + t.setdisabled(t.disabled=FALSE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testaw.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testaw.e new file mode 100644 index 0000000..a4d8d63 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testaw.e @@ -0,0 +1,59 @@ +-> testaw.e - shows use of AppWindow handling and changing GUIs +MODULE 'tools/easygui', + 'workbench/startup', 'workbench/workbench' + +CONST MAXLEN=20 + +DEF current=0, gui:PTR TO LONG + +PROC main() + DEF s[MAXLEN]:STRING + -> Have a list of three different GUIs + gui:=[ + [LISTV,{ignore},'Drop Icons on Me!',15,7,NIL,0,1,0,0,0,{gadappw}], + [ROWS,[STR,{ignore},'Drop Icons on Me:',s,MAXLEN,5,0,0,0,{gadappw}], + [SPACEV],[BUTTON,{ignore},'But Not on Me']], + [ROWS,[BUTTON,{ignore},'Drop Icons on Me:',0,0,{gadappw}], + [SPACEV],[STR,{ignore},'Not on Me:',s,MAXLEN,5]] + ] + easyguiA('Test App Window', gui[current], + [EG_AWPROC,{winappw}, NIL]) +ENDPROC + +-> Ignore button presses etc. +PROC ignore(info,num) IS EMPTY + +-> Show next GUI in list +PROC nextgui(gh) + current++ + IF current>=ListLen(gui) THEN current:=0 + changegui(gh, gui[current]) +ENDPROC + +-> Default (window) App message handler +PROC winappw(info,awmsg) + PrintF('You missed the gadget... try again!\n') +ENDPROC + +-> App message handler for a gadget +PROC gadappw(info,awmsg) + PrintF('You hit the gadget! ') + showappmsg(awmsg) + nextgui(info) +ENDPROC + +CONST NAMELEN=256 + +-> Show the contents of the App message +PROC showappmsg(amsg:PTR TO appmessage) + DEF i, args:PTR TO wbarg, name[NAMELEN]:ARRAY + PrintF('Hit at (\d,\d)\n', amsg.mousex, amsg.mousey) + args:=amsg.arglist + FOR i:=1 TO amsg.numargs + NameFromLock(args.lock,name,NAMELEN) + PrintF(' arg(\d): Name="\s", Lock=$\h ("\s")\n', + i, args.name, args.lock, name) + args++ + ENDFOR + PrintF('\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testchange.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testchange.e new file mode 100644 index 0000000..df944d9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testchange.e @@ -0,0 +1,32 @@ +-> testchange.e - show use of changegui() and BUTTON data field +MODULE 'tools/easygui' + +DEF gui:PTR TO LONG, titles:PTR TO LONG + +PROC main() + DEF top + top:=[COLS, + [SPACEH], + -> Use generic action function, with BUTTON data 0, 1 or 2. + [BUTTON,{change},'GUI _A',0,"a"], + [SPACEH], + [BUTTON,{change},'GUI _B',1,"b"], + [SPACEH], + [BUTTON,{change},'GUI _C',2,"c"], + [SPACEH] + ] + titles:=['GUI A','GUI B','GUI C'] + gui:=[ + [ROWS,top,[SPACE],[SLIDE,{ignore},'Colors:',FALSE,1,8,3,5,'']], + [ROWS,top,[SPACE],[CHECK,{ignore},'Ignore case',TRUE,FALSE]], + [ROWS,top,[SPACE],[PALETTE,{ignore},'Palette:',3,5,2,0]] + ] + easyguiA('Change Test', gui[]) +ENDPROC + +PROC ignore(info,x) IS EMPTY + +PROC change(index,gh) + changegui(gh,gui[index]) + changetitle(gh,titles[index]) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testchange2.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testchange2.e new file mode 100644 index 0000000..862b694 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testchange2.e @@ -0,0 +1,277 @@ +-> testchange2.e - shows use of some changeXXX() functions +MODULE 'tools/exceptions', + 'exec/lists', 'exec/nodes', + 'graphics/text', 'graphics/view', + 'libraries/gadtools', + 'amigalib/lists', + 'tools/easygui' + +RAISE "SCRN" IF OpenS()=NIL + +-> Index of the sub-GUI in the main GUI list. +CONST SUB_POS=3 + +-> The custom screen. +DEF scr=NIL + +-> The main GUI, the list of sub-GUIs, the titles and the menus. +DEF gui:PTR TO LONG, subguis:PTR TO LONG, titles:PTR TO LONG, menus + +-> The connected window, the main window, a gh for multiforall() and a tmp. +DEF ghconn=NIL, ghmain, forall, tmp + +-> The slider in the connected and main windows, and the check in main. +DEF connsl=NIL, mainsl=NIL:PTR TO LONG, mainchk=NIL + +PROC main() HANDLE + DEF mh=NIL + -> The list of GUIs we'll use (and change) as sub-GUIs in the main GUI. + subguis:=[ + [COLS, + [TEXT,'Try the menus!',NIL,TRUE,1], + [SLIDE,{ignore},'Colors:',FALSE,1,8,3,5,''] + ], + [COLS, + [SLIDE,{ignore},'Colors:',FALSE,1,8,3,5,''], + [CHECK,{ignore},'Ignore case',TRUE,FALSE] + ], + [COLS, + [CHECK,{ignore},'Ignore case',TRUE,TRUE], + [PALETTE,{ignore},'Palette:',3,5,2,0] + ] + ] + -> The main GUI. + gui:=[ROWS, + [COLS, + [SPACEH], + -> Use generic action function, with BUTTON data 0, 1 or 2. + [BUTTON,{change_gui},'GUI _X',0,"x"], + [SPACEH], + [BUTTON,{change_gui},'GUI _Y',1,"y"], + [SPACEH], + [BUTTON,{change_gui},'GUI _Z',2,"z"], + [SPACEH] + ], + [SPACE], + 0, -> The sub-GUI, initialise this below... + [SPACE], + [COLS, + [SBUTTON,{block_all},'_Block All',0,"b"], + [SBUTTON,{close_all},'_Close All',0,"c"] + ], + [BAR], + mainchk:=[CHECK,{connected_win},'Create/Destroy Connected Window', + FALSE,FALSE], + mainsl:=[SLIDE,{main_sl_fun},'Connected: ',FALSE,1,20,3,5,'\d[2]'] + ] + -> Initially, use the first sub-GUI. + gui[SUB_POS]:=subguis[] + titles:=['GUI X','GUI Y','GUI Z'] + -> We're going to share the menus between our two windows. + menus:=[NM_TITLE,0,'Project', NIL,0,0,0, + NM_ITEM,0,'Quit', 'Q',0,0,0, + NM_TITLE,0,'Screen', NIL,0,0,0, + NM_ITEM,0,'Default', 'D',0,0,{default}, + NM_ITEM,0,'Custom', 'C',0,0,{custom}, + NM_TITLE,0,'Window Type', NIL,0,0,0, + NM_ITEM,0,'No Border', 'N',0,0,{noborder}, + NM_ITEM,0,'Basic', 'B',0,0,{basic}, + NM_ITEM,0,'No Size', 'O',0,0,{nosize}, + NM_ITEM,0,'Size', 'S',0,0,{size}, + NM_TITLE,0,'GUI', NIL,0,0,0, + NM_ITEM,0,'X', 'X',0,0,{x}, + NM_ITEM,0,'Y', 'Y',0,0,{y}, + NM_ITEM,0,'Z', 'Z',0,0,{z}, + NM_TITLE,0,'Font', NIL,0,0,0, + NM_ITEM,0,'Screen', 'F',0,0,{font}, + NM_ITEM,0,'Topaz', 'T',0,0,{topaz}, + NM_END, 0,NIL, NIL,0,0,0]:newmenu + -> Start a multi-window group. + mh:=multiinit() + -> Open the main GUI. + ghmain:=addmultiA(mh, 'Check out the menus...', gui, + [EG_MENU,menus, EG_CLOSE,{closemain}, NIL]) + -> Process messages. + multiloop(mh) +EXCEPT DO + cleanmulti(mh) + -> If we opened the screen, close it. + IF scr THEN CloseS(scr) + report_exception() +ENDPROC + + +->>> Main GUI/shared action functions <<<- + +-> Close all windows, prompt then reopen. +PROC close_all(gh) HANDLE + allclose(gh) + easyguiA('New GUI', + [ROWS, + [TEXT,'Old GUIs closed',NIL,TRUE,15], + [TEXT,'Close me to reopen!',NIL,TRUE,15] + ]) +EXCEPT DO + allopen(gh) + ReThrow() +ENDPROC + +-> Block all windows, prompt then unblock. +PROC block_all(gh:PTR TO guihandle) HANDLE + multiforall({forall},gh.mh,`blockwin(forall)) + easyguiA('New GUI', + [ROWS, + [TEXT,'Old GUIs blocked',NIL,TRUE,15], + [TEXT,'Close me to unblock!',NIL,TRUE,15] + ]) +EXCEPT DO + multiforall({forall},gh.mh,`unblockwin(forall)) + ReThrow() +ENDPROC + +-> Change the font to default (screen) or Topaz. +PROC font(info) IS change_font(info,NIL) +PROC topaz(info) IS change_font(info,['topaz.font',8,0,0]:textattr) + +-> Change to the default public screen. +PROC default(gh:PTR TO guihandle) HANDLE + allclose(gh) + IF scr + CloseS(scr) + -> The screen is now invalid. + scr:=NIL + ENDIF + multiforall({forall},gh.mh,`changescreen(forall,NIL)) +EXCEPT DO + allopen(gh) + ReThrow() +ENDPROC + +-> Change to a custom screen. +PROC custom(gh:PTR TO guihandle) HANDLE + allclose(gh) + IF scr=NIL THEN scr:=OpenS(640,400,4,V_HIRES OR V_LACE,'Custom Screen') + tmp:=scr + multiforall({forall},gh.mh,`changescreen(forall,tmp)) +EXCEPT DO + allopen(gh) + ReThrow() +ENDPROC + +-> Change the window type. +PROC noborder(info) IS change_type(info,WTYPE_NOBORDER) +PROC basic(info) IS change_type(info,WTYPE_BASIC) +PROC nosize(info) IS change_type(info,WTYPE_NOSIZE) +PROC size(info) IS change_type(info,WTYPE_SIZE) + +-> Change the main GUI. +PROC x(info) IS change_gui(0,ghmain) +PROC y(info) IS change_gui(1,ghmain) +PROC z(info) IS change_gui(2,ghmain) + +PROC change_gui(index,gh) + changetitle(gh,titles[index]) + gui[SUB_POS]:=subguis[index] + changegui(gh,gui) +ENDPROC + +PROC ignore(info,x) IS EMPTY + + +->>> Connection code <<<- + +-> Connected slider on main GUI. +PROC main_sl_fun(info,cur) + IF ghconn THEN setslide(ghconn,connsl,cur) +ENDPROC + +-> Connected slider on the other GUI. +PROC conn_sl_fun(info,cur) + IF ghmain THEN setslide(ghmain,mainsl,cur) +ENDPROC + + +->>> Closing code <<<- + +-> Closing the main GUI quits. +PROC closemain(mh,gh) IS quitgui(0) + +-> Closing the other GUI destroys it. +PROC closeconn(mh,info) + cleangui(ghconn) + -> The guihandle is now invalid. + ghconn:=NIL + -> Uncheck the check in the main GUI. + IF mainchk THEN setcheck(ghmain,mainchk,FALSE) +ENDPROC + + +->>> Other GUI functions <<<- + +-> React to check changes on main GUI. +PROC connected_win(gh:PTR TO guihandle,bool) + IF bool + -> If it's been created reopen it, else create and add it to the group. + IF ghconn + openwin(ghconn) + ELSE + ghconn:=addmultiA(gh.mh, 'Connected Window', + [ROWS, + connsl:=[SLIDE,{conn_sl_fun},'Connected: ',FALSE,1,20, + IF mainsl THEN mainsl[SLI_CURR] ELSE 3,10,'\d[2]'], + [COLS, + [SBUTTON,{block_all},'_Block All',0,"b"], + [SBUTTON,{close_all},'_Close All',0,"c"] + ], + [SBUTTON,{clean_gui},'cl_eangui()',0,"e"] + ], + [EG_TOP,0, EG_LEFT,0, EG_MENU,menus, + EG_SCRN,scr, EG_CLOSE,{closeconn}, NIL]) + ENDIF + ELSEIF ghconn + -> If it's been created, destroy it. + cleangui(ghconn) + -> The guihandle is now invalid. + ghconn:=NIL + ENDIF +ENDPROC + +-> Action function for cleangui() button (reuse closeconn()). +PROC clean_gui(info) IS closeconn(0,0) + + +->>> Auxiliary functions <<<- + +-> Close all GUIs (and update check on main GUI) +PROC allclose(gh:PTR TO guihandle) + multiforall({forall},gh.mh,`closewin(forall)) + -> Make check false only if the other window exists + IF ghconn THEN setcheck(ghmain,mainchk,FALSE) +ENDPROC + +-> Open all GUIs (and update check on main GUI) +PROC allopen(gh:PTR TO guihandle) + multiforall({forall},gh.mh,`openwin(forall)) + -> Make check true only if the other window exists + IF ghconn THEN setcheck(ghmain,mainchk,TRUE) +ENDPROC + +-> Change the window type. +PROC change_type(gh:PTR TO guihandle,t) HANDLE + allclose(gh) + tmp:=t + multiforall({forall},gh.mh,`changewintype(forall,tmp)) +EXCEPT DO + allopen(gh) + ReThrow() +ENDPROC + +-> Change the window font. +PROC change_font(gh:PTR TO guihandle,tattr) HANDLE + allclose(gh) + tmp:=tattr + multiforall({forall},gh.mh,`changefont(forall,tmp)) +EXCEPT DO + allopen(gh) + ReThrow() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testkey.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testkey.e new file mode 100644 index 0000000..bc435b1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testkey.e @@ -0,0 +1,83 @@ +-> testkey.e - shows use of keyboard short-cuts +MODULE 'tools/easygui', + 'exec/lists', 'exec/nodes', + 'graphics/text', + 'amigalib/lists' + +CONST MAXLEN=20 + +DEF gad, disabled=TRUE + +PROC main() + DEF s[MAXLEN]:STRING, list:lh, choices + newList(list) + AddTail(list, [0,0,0,0,'Item']:ln) + AddTail(list, [0,0,0,0,'Item-2']:ln) + AddTail(list, [0,0,0,0,'Item-3']:ln) + AddTail(list, [0,0,0,0,'Item-4']:ln) + AddTail(list, [0,0,0,0,'Item-5']:ln) + AddTail(list, [0,0,0,0,'Item-6']:ln) + choices:=['Zero','One','Two',NIL] + StrCopy(s,'Hello') + easyguiA('Press Some Keys!', + [COLS, + [EQROWS, + [CYCLE,{cycle},'_Cycle:',choices,1,0,"c"], + [STR,{password},'S_tring:',s,MAXLEN,5,FALSE,0,"t"], + [BAR], + -> Show new CHECK and MX alignments + [CHECK,{check},'C_heck:',TRUE,TRUE,0,"h"], + [MX,{mx},'_MX:',choices,TRUE,0,0,"m"], + [BAR], + -> Show new CHECK and MX right text + [CHECK,{check2},'Ch_eck2 (Right)',TRUE,FALSE,0,"e"], + [MX,{mx2},'M_X2 (Right)',choices,FALSE,0,0,"x"] + ], + [BAR], + [ROWS, + -> Show new LISTV label and show selected + [LISTV,{listv},'_List:',8,5,list,FALSE,1,0,0,"l",0], + [SLIDE,{slide},'_Slide:',FALSE,1,8,3,3,'',0,"s"], +-> [SCROLL,{slide},FALSE,80,10,3,3,0,"i"], + -> Show new PALETTE current field, min size and show selected + [PALETTE,{palette},'_Palette:',3,5,2,2,0,"p"], + gad:=[SBUTTON,{button},'_blockwin()',0,"b",0,disabled], + [SBUTTON,{disable},'_disable()',0,"d"] + ] + ]) +ENDPROC + +PROC button(gh) HANDLE + blockwin(gh) + easyguiA('New GUI', + [ROWS, + [TEXT,'Old GUI blocked',NIL,TRUE,15], + [BUTTON,0,'_Unblock',0,"u"] + ]) +EXCEPT DO + unblockwin(gh) + ReThrow() +ENDPROC + +PROC disable(gh) + disabled:=disabled=FALSE + setdisabled(gh,gad,disabled) +ENDPROC + +PROC slide(info,val) IS PrintF('Slide has moved to \d\n', val) + +PROC cycle(info,val) IS PrintF('Cycle choice is now \d\n', val) + +PROC check(info,val) IS PrintF('Check is now \s\n', + IF val THEN 'TRUE' ELSE 'FALSE') +PROC check2(info,val) IS PrintF('Check2 is now \s\n', + IF val THEN 'TRUE' ELSE 'FALSE') + +PROC mx(info,val) IS PrintF('MX choice is now \d\n', val) +PROC mx2(info,val) IS PrintF('MX2 choice is now \d\n', val) + +PROC password(info,val) IS PrintF('Password is now "\s"\n', val) + +PROC palette(info,val) IS PrintF('Palette pen is now \d\n', val) + +PROC listv(info,val) IS PrintF('List selection moved to \d\n', val) diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testmulti.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testmulti.e new file mode 100644 index 0000000..4b479cc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testmulti.e @@ -0,0 +1,59 @@ +-> testmulti.e - Simple (recursive) use of multi-window GUI support. +-> (Note: Intuition gets a bit weird with lots of windows -- lockups or +-> crashes with huge numbers of windows are not EasyGUI's fault...) +MODULE 'tools/easygui', 'tools/exceptions' + +RAISE "MEM" IF String()=NIL + +DEF guis=1 + +PROC main() HANDLE + DEF mh=NIL + mh:=multiinit() + -> Start at level 0. + create(mh,0) + multiloop(mh) +EXCEPT DO + cleanmulti(mh) + report_exception() +ENDPROC + +-> Add a new window to the group mh at level i. +PROC add(level,gh:PTR TO guihandle) IS create(gh.mh,level) + +-> Add a new window to the group mh at level i. +PROC create(mh,level) + DEF s + -> Next level. + INC level + s:=StringF(String(10),'GUI \d',guis) + -> Got to NEW the gui since the same one is being used multiple times. + addmultiA(mh, s, + NEW [ROWS, + NEW [TEXT,'Multi GUI Test',NIL,TRUE,10], + NEW [COLS, + NEW [NUM,level,'Level:',0,1], + NEW [NUM,guis,'GUI:',0,1] + ], + NEW [COLS, + -> Recursive call to create() via add()! + NEW [BUTTON,{add},'_Add',level,"a"], + NEW [SPACE], + -> Pressing the Quit button quits multiloop() and so + -> then all windows are closed. + NEW [BUTTON,0,'_Quit',0,"q"] + ] + ], + -> Open at a random position, with level as info. + [EG_LEFT,Rnd(400), EG_TOP,Rnd(400), EG_CLOSE,{close}, NIL]) + -> Now another GUI. + INC guis +ENDPROC + +-> This function is called when the GUI close gadget is hit. +-> (Hitting the close gadget closes only that window, unless it is the last.) +PROC close(mh:PTR TO multihandle,info) + WriteF('GUIs left with open windows = \d\n',mh.opencount) + -> Is this the last open window? + IF mh.opencount=1 THEN quitgui(0) ELSE closewin(info) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testmulti2.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testmulti2.e new file mode 100644 index 0000000..2220a8d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testmulti2.e @@ -0,0 +1,44 @@ +-> testmulti2.e - Another very simple use of multi-window GUI support. +MODULE 'tools/easygui', 'tools/exceptions', 'intuition/intuition' + +-> The global for use with multiforall(). +DEF gh:PTR TO guihandle + +PROC main() HANDLE + DEF mh=NIL, gh1:PTR TO guihandle,res + mh:=multiinit() + gh1:=addmultiA(mh,'GUI One', + [ROWS, + [TEXT,'The first GUI.',NIL,TRUE,13], + [SBUTTON,{but1},'Press Me'] + ], + [EG_LEFT,10, EG_TOP,20, NIL]) + addmultiA(mh,'GUI Two', + [ROWS, + [TEXT,'And the second GUI.',NIL,TRUE,13], + [SBUTTON,{but2},'Press Me'] + ], + -> Put the second window below the first, but hidden. + [EG_LEFT,10, EG_TOP,gh1.wnd.topedge+gh1.wnd.height, + EG_HIDE,TRUE, NIL]) + -> Could add more... + res:=multiloop(mh) +EXCEPT DO + cleanmulti(mh) + report_exception() +ENDPROC + +-> Button on GUI one does something special. +PROC but1(info:PTR TO guihandle) + WriteF('Hit button on GUI One. Closing then opening.\n') + multiforall({gh},info.mh, + `IF gh.wnd THEN WriteF('Title="\s"\n',gh.wnd.title) BUT closewin(gh) ELSE 0) + WriteF('Sleeping a bit...\n') + Delay(100) + WriteF('Awake!\n') + -> This shows that gh.wnd is NIL when the window is closed. + multiforall({gh},info.mh, + `WriteF('Win=$\h\n',gh.wnd) BUT openwin(gh)) +ENDPROC + +PROC but2(i) IS WriteF('Hit button on GUI Two\n') diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testqual.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testqual.e new file mode 100644 index 0000000..cdffad9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/testqual.e @@ -0,0 +1,14 @@ +MODULE 'tools/easygui', 'devices/inputevent' + +PROC main() + easyguiA('Qualifier Test', + [SBUTTON,{buttonaction},'Press Me! (With/Without Shift)']) +ENDPROC + +PROC buttonaction(qual,data,info) + IF qual AND (IEQUALIFIER_LSHIFT OR IEQUALIFIER_RSHIFT) + PrintF('You were pressing a shift key when you clicked on me!\n') + ELSE + PrintF('Nope, no shift key this time...\n') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/ticker_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/ticker_test.e new file mode 100644 index 0000000..582cd02 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/ticker_test.e @@ -0,0 +1,19 @@ +MODULE 'tools/easygui', 'tools/exceptions', + 'plugins/ticker' + +PROC main() HANDLE + DEF t=NIL:PTR TO ticker + NEW t + easyguiA('Ticker!', + [ROWS, + [TEXT,'Ticker test:',NIL,TRUE,10], + [PLUGIN,{tickaction},t] + ]) +EXCEPT DO + END t + report_exception() +ENDPROC + +PROC tickaction(i,t) + WriteF('Tick!\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/toolify_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/toolify_test.e new file mode 100644 index 0000000..6a65304 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Examples/toolify_test.e @@ -0,0 +1,23 @@ +MODULE 'tools/exceptions', + 'tools/easygui', + 'plugins/toolify' + +PROC main() HANDLE + DEF p=NIL:PTR TO toolify + NEW p.toolify('Toolify','Hello from Toolify',TRUE) + easyguiA('GadTools in EasyGUI!', + [ROWS, + [TEXT,'Toolify test...',NIL,TRUE,1], + [SPACE], + [PLUGIN,0,p,TRUE], + [SPACE], + [BUTTON,{toggle_enabled},'Toggle Enabled',p] + ]) +EXCEPT DO + END p + report_exception() +ENDPROC + +PROC toggle_enabled(p:PTR TO toolify,i) + p.setdisabled(p.disabled=FALSE) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/animcontrol.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/animcontrol.e new file mode 100644 index 0000000..b7eed95 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/animcontrol.e @@ -0,0 +1,100 @@ +OPT MODULE, PREPROCESS + +MODULE 'tools/EasyGUI', 'tools/ghost', + 'intuition/intuition', 'intuition/gadgetclass', + 'gadgets/tapedeck' + +EXPORT OBJECT animcontrol OF plugin + frame + mode + disabled +PRIVATE + animcontrol:PTR TO gadget + animcontrolbase + frames + downmode +ENDOBJECT + +PROC animcontrol(frame=0,frames=8,play=FALSE,disabled=FALSE) OF animcontrol + self.animcontrolbase:=OpenLibrary('gadgets/tapedeck.gadget',39) + IF self.animcontrolbase=NIL THEN Raise("anim") + self.frame:=frame + self.frames:=frames + self.mode:=IF play THEN BUT_PLAY ELSE BUT_STOP + self.disabled:=disabled +ENDPROC + +PROC end() OF animcontrol + IF self.animcontrolbase THEN CloseLibrary(self.animcontrolbase) +ENDPROC + +PROC min_size(ta,fh) OF animcontrol +ENDPROC 203,15 + +PROC will_resize() OF animcontrol IS 0 + +PROC render(ta,x,y,xs,ys,w) OF animcontrol + self.animcontrol:=NewObjectA(NIL,'tapedeck.gadget', + [GA_TOP,y, GA_LEFT,x, GA_WIDTH,xs, GA_HEIGHT,ys, + TDECK_MODE,self.mode, TDECK_FRAMES,self.frames, + TDECK_CURRENTFRAME,self.frame, TDECK_TAPE,FALSE, + GA_DISABLED,self.disabled, + GA_RELVERIFY,TRUE, GA_IMMEDIATE,TRUE, NIL]) + IF self.animcontrol=NIL THEN Raise("anim") + AddGList(w,self.animcontrol,-1,1,NIL) + RefreshGList(self.animcontrol,w,NIL,1) + IF self.disabled THEN ghost(w,self.x,self.y,self.xs,self.ys) +ENDPROC + +PROC clear_render(win:PTR TO window) OF animcontrol + IF self.animcontrol + RemoveGList(win,self.animcontrol,1) + DisposeObject(self.animcontrol) + ENDIF +ENDPROC + +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF animcontrol + IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.animcontrol + IF imsg.class=IDCMP_GADGETDOWN THEN RETURN imsg.iaddress=self.animcontrol +ENDPROC FALSE + +PROC message_action(class,qual,code,win:PTR TO window) OF animcontrol + DEF mode, frame + GetAttr(TDECK_MODE,self.animcontrol,{mode}) + GetAttr(TDECK_CURRENTFRAME,self.animcontrol,{frame}) + IF class=IDCMP_GADGETDOWN + self.downmode:=mode + IF mode=BUT_FRAME THEN mode:=BUT_STOP + self.mode:=mode + IF (mode<>BUT_REWIND) AND (mode<>BUT_FORWARD) THEN RETURN FALSE + ELSE + IF self.downmode=BUT_FRAME + mode:=BUT_STOP + self.downmode:=BUT_STOP + ENDIF + self.mode:=mode + ENDIF + self.frame:=frame +ENDPROC TRUE + +PROC setframe(n) OF animcontrol + self.frame:=n + SetGadgetAttrsA(self.animcontrol,self.gh.wnd,NIL,[TDECK_CURRENTFRAME,n,NIL]) + IF self.disabled THEN ghost(self.gh.wnd,self.x,self.y,self.xs,self.ys) +ENDPROC + +PROC setplay(play=TRUE) OF animcontrol + self.mode:=IF play THEN BUT_PLAY ELSE BUT_STOP + SetGadgetAttrsA(self.animcontrol,self.gh.wnd,NIL,[TDECK_MODE,self.mode,NIL]) + IF self.disabled THEN ghost(self.gh.wnd,self.x,self.y,self.xs,self.ys) +ENDPROC + +PROC setdisabled(disabled=TRUE) OF animcontrol + SetGadgetAttrsA(self.animcontrol,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL]) + IF disabled + ghost(self.gh.wnd,self.x,self.y,self.xs,self.ys) + ELSE + unghost(self.animcontrol,self.gh.wnd) + ENDIF + self.disabled:=disabled +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/button.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/button.e new file mode 100644 index 0000000..f277c07 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/button.e @@ -0,0 +1,92 @@ +OPT MODULE + +MODULE 'tools/EasyGUI', 'tools/textlen', + 'intuition/intuition', 'intuition/gadgetclass', + 'gadgets/button' + +EXPORT OBJECT button OF plugin + selected + disabled +PRIVATE + button:PTR TO gadget + buttonbase + text + toggle, push, resize +ENDOBJECT + +PROC button(text,resizex=FALSE,resizey=FALSE,disabled=FALSE) OF button + self.buttonbase:=OpenLibrary('gadgets/button.gadget',37) + IF self.buttonbase=NIL THEN Raise("butt") + self.text:=text + self.toggle:=FALSE + self.push:=FALSE + self.selected:=FALSE + self.resize:=(IF resizex THEN RESIZEX ELSE 0) OR + (IF resizey THEN RESIZEY ELSE 0) + self.disabled:=disabled +ENDPROC + +PROC togglebutton(text,selected=FALSE,resizex=FALSE,resizey=FALSE,disabled=FALSE) OF button + self.button(text,resizex,resizey) + self.toggle:=TRUE + self.selected:=selected +ENDPROC + +PROC pushbutton(text,selected=FALSE,resizex=FALSE,resizey=FALSE,disabled=FALSE) OF button + self.button(text,resizex,resizey) + self.push:=TRUE + self.selected:=selected +ENDPROC + +PROC end() OF button + IF self.buttonbase THEN CloseLibrary(self.buttonbase) +ENDPROC + +PROC min_size(ta,fh) OF button +ENDPROC textlen(self.text,ta)+16,fh+6 + +PROC will_resize() OF button IS self.resize + +PROC render(ta,x,y,xs,ys,w) OF button + self.button:=NewObjectA(NIL,'button.gadget', + [GA_TOP,y, GA_LEFT,x, GA_WIDTH,xs, GA_HEIGHT,ys, + GA_TEXT,self.text, GA_TOGGLESELECT,self.toggle, + BUTTON_PUSHBUTTON,self.push, GA_TEXTATTR,ta, + GA_DISABLED,self.disabled, GA_SELECTED,self.selected, + GA_RELVERIFY,TRUE, NIL]) + IF self.button=NIL THEN Raise("butt") + AddGList(w,self.button,-1,1,NIL) + RefreshGList(self.button,w,NIL,1) +ENDPROC + +PROC clear_render(win:PTR TO window) OF button + IF self.button + RemoveGList(win,self.button,1) + DisposeObject(self.button) + ENDIF +ENDPROC + +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF button + IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.button +ENDPROC FALSE + +PROC message_action(class,qual,code,win:PTR TO window) OF button + self.selected:=code +ENDPROC TRUE + +PROC setselected(selected=TRUE) OF button + IF self.toggle OR self.push + SetGadgetAttrsA(self.button,self.gh.wnd,NIL,[GA_SELECTED,selected,NIL]) + self.selected:=selected + ENDIF +ENDPROC + +PROC settext(text) OF button + SetGadgetAttrsA(self.button,self.gh.wnd,NIL,[GA_TEXT,text,NIL]) + self.text:=text +ENDPROC + +PROC setdisabled(disabled=TRUE) OF button + SetGadgetAttrsA(self.button,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL]) + self.disabled:=disabled +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/calendar.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/calendar.e new file mode 100644 index 0000000..7642634 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/calendar.e @@ -0,0 +1,68 @@ +OPT MODULE + +MODULE 'tools/EasyGUI', 'tools/textlen', + 'intuition/intuition', 'intuition/gadgetclass', + 'gadgets/calendar', 'graphics/text', + 'utility/date' + +EXPORT OBJECT calendar OF plugin + date:PTR TO clockdata + disabled +PRIVATE + calendar:PTR TO gadget + calendarbase + resize +ENDOBJECT + +PROC calendar(date,resizex=FALSE,resizey=FALSE,disabled=FALSE) OF calendar + self.calendarbase:=OpenLibrary('gadgets/calendar.gadget',37) + IF self.calendarbase=NIL THEN Raise("cal") + self.date:=date + self.resize:=(IF resizex THEN RESIZEX ELSE 0) OR + (IF resizey THEN RESIZEY ELSE 0) + self.disabled:=disabled +ENDPROC + +PROC end() OF calendar + IF self.calendarbase THEN CloseLibrary(self.calendarbase) +ENDPROC + +PROC min_size(ta,fh) OF calendar IS textlen('Wed',ta)+2*7,fh*7+13 + +PROC will_resize() OF calendar IS self.resize + +PROC render(ta,x,y,xs,ys,w) OF calendar + self.calendar:=NewObjectA(NIL,'calendar.gadget', + [GA_TOP,y, GA_LEFT,x, GA_WIDTH,xs, GA_HEIGHT,ys, + GA_TEXTATTR,ta, GA_RELVERIFY,TRUE, + GA_DISABLED,self.disabled, + CALENDAR_CLOCKDATA,self.date, NIL]) + IF self.calendar=NIL THEN Raise("cal") + AddGList(w,self.calendar,-1,1,NIL) + RefreshGList(self.calendar,w,NIL,1) +ENDPROC + +PROC clear_render(win:PTR TO window) OF calendar + IF self.calendar + RemoveGList(win,self.calendar,1) + DisposeObject(self.calendar) + ENDIF +ENDPROC + +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF calendar + IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.calendar +ENDPROC FALSE + +PROC message_action(class,qual,code,win:PTR TO window) OF calendar + self.date.mday:=code +ENDPROC TRUE + +PROC setdate(date=NIL) OF calendar + IF date THEN self.date:=date + SetGadgetAttrsA(self.calendar,self.gh.wnd,NIL,[CALENDAR_CLOCKDATA,self.date,NIL]) +ENDPROC + +PROC setdisabled(disabled=TRUE) OF calendar + SetGadgetAttrsA(self.calendar,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL]) + self.disabled:=disabled +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/colorwheel.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/colorwheel.e new file mode 100644 index 0000000..83327cd --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/colorwheel.e @@ -0,0 +1,114 @@ +OPT MODULE + +MODULE 'tools/EasyGUI', 'tools/ghost', + 'intuition/intuition', 'intuition/gadgetclass', 'intuition/screens', + 'gadgets/colorwheel' + +EXPORT OBJECT colorwheel OF plugin + rgb:PTR TO colorwheelrgb + hsb:PTR TO colorwheelhsb + disabled +PRIVATE + colorwheel:PTR TO gadget + colorwheelbase + box +ENDOBJECT + +PROC colorwheel(rgb,hsb=NIL,box=FALSE,disabled=FALSE) OF colorwheel + self.colorwheelbase:=OpenLibrary('gadgets/colorwheel.gadget',39) + IF self.colorwheelbase=NIL THEN Raise("colw") + IF rgb + self.rgb:=rgb + self.hsb:=NIL + ELSE + self.rgb:=NIL + self.hsb:=hsb + ENDIF + self.box:=box + self.disabled:=disabled +ENDPROC + +PROC end() OF colorwheel + IF self.colorwheelbase THEN CloseLibrary(self.colorwheelbase) +ENDPROC + +PROC min_size(ta,fh) OF colorwheel +ENDPROC 50,50 + +PROC will_resize() OF colorwheel IS RESIZEX OR RESIZEY + +PROC render(ta,x,y,xs,ys,w:PTR TO window) OF colorwheel + self.colorwheel:=NewObjectA(NIL,'colorwheel.gadget', + [GA_TOP,y+IF self.box THEN 0 ELSE 2, + GA_LEFT,x+IF self.box THEN 0 ELSE 2, + GA_WIDTH,xs-IF self.box THEN 0 ELSE 4, + GA_HEIGHT,ys-IF self.box THEN 0 ELSE 4, + IF self.hsb THEN WHEEL_HSB ELSE WHEEL_RGB, + IF self.hsb THEN self.hsb ELSE self.rgb, + GA_RELVERIFY,TRUE, WHEEL_SCREEN,w.wscreen, + WHEEL_BEVELBOX,self.box, GA_DISABLED,self.disabled, + NIL]) + IF self.colorwheel=NIL THEN Raise("colw") + AddGList(w,self.colorwheel,-1,1,NIL) + RefreshGList(self.colorwheel,w,NIL,1) + IF self.disabled THEN IF self.box=FALSE THEN ghost(w,self.x,self.y,self.xs,self.ys) +ENDPROC + +PROC clear_render(win:PTR TO window) OF colorwheel + IF self.colorwheel + RemoveGList(win,self.colorwheel,1) + DisposeObject(self.colorwheel) + ENDIF +ENDPROC + +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF colorwheel + IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.colorwheel +ENDPROC FALSE + +PROC message_action(class,qual,code,win:PTR TO window) OF colorwheel + IF self.rgb + GetAttr(WHEEL_RGB,self.colorwheel,self.rgb) + ELSE + GetAttr(WHEEL_HSB,self.colorwheel,self.hsb) + ENDIF +ENDPROC TRUE + +PROC getrgb(rgb) OF colorwheel + GetAttr(WHEEL_RGB,self.colorwheel,rgb) +ENDPROC rgb + +PROC gethsb(hsb) OF colorwheel + GetAttr(WHEEL_HSB,self.colorwheel,hsb) +ENDPROC hsb + +PROC setrgb(rgb=NIL) OF colorwheel + IF rgb + self.rgb:=rgb + self.hsb:=NIL + ENDIF + IF self.rgb THEN SetGadgetAttrsA(self.colorwheel,self.gh.wnd,NIL, + [WHEEL_RGB,self.rgb,NIL]) +ENDPROC + +PROC sethsb(hsb) OF colorwheel + IF hsb + self.rgb:=NIL + self.hsb:=hsb + ENDIF + IF self.hsb THEN SetGadgetAttrsA(self.colorwheel,self.gh.wnd,NIL, + [WHEEL_HSB,self.hsb,NIL]) +ENDPROC + +PROC setdisabled(disabled=TRUE) OF colorwheel + SetGadgetAttrsA(self.colorwheel,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL]) + IF disabled + IF self.box=FALSE + ghost(self.gh.wnd,self.x,self.y,self.xs,self.ys) + ELSE + unghost(self.colorwheel,self.gh.wnd) + ENDIF + ELSE + unghost_clear(self.colorwheel,self.gh.wnd,self.x,self.y,self.xs,self.ys) + ENDIF + self.disabled:=disabled +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/gradient.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/gradient.e new file mode 100644 index 0000000..afb0214 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/gradient.e @@ -0,0 +1,86 @@ +OPT MODULE + +MODULE 'tools/EasyGUI', 'tools/ghost', + 'intuition/gadgetclass', 'intuition/intuition', + 'gadgets/gradientslider' + +EXPORT OBJECT gradient OF plugin + curval + pens:PTR TO INT + disabled +PRIVATE + grad:PTR TO gadget + gradbase + vert + rel +ENDOBJECT + +PROC gradient(vert=FALSE,curval=0,rel=5,pens=NIL,disabled=FALSE) OF gradient + self.gradbase:=OpenLibrary('gadgets/gradientslider.gadget',39) + IF self.gradbase=NIL THEN Raise("grad") + self.curval:=curval + self.vert:=vert + self.rel:=rel + self.pens:=pens + self.disabled:=disabled +ENDPROC + +PROC end() OF gradient + IF self.gradbase THEN CloseLibrary(self.gradbase) +ENDPROC + +PROC min_size(ta,fh) OF gradient IS + IF self.vert THEN (fh+6) ELSE (fh*self.rel), + IF self.vert THEN (fh*self.rel) ELSE (fh+6) + +PROC will_resize() OF gradient IS IF self.vert THEN RESIZEY ELSE RESIZEX + +PROC render(ta,x,y,xs,ys,w) OF gradient + self.grad:=NewObjectA(NIL,'gradientslider.gadget', + [GA_TOP,y, GA_LEFT,x, GA_WIDTH,xs, GA_HEIGHT,ys, + GRAD_CURVAL,self.curval, GRAD_PENARRAY,self.pens, + PGA_FREEDOM,IF self.vert THEN LORIENT_VERT ELSE LORIENT_HORIZ, + GA_RELVERIFY,TRUE, GA_DISABLED,self.disabled, NIL]) + IF self.grad=NIL THEN Raise("grad") + AddGList(w,self.grad,-1,1,NIL) + RefreshGList(self.grad,w,NIL,1) + IF self.disabled THEN ghost(w,self.x,self.y,self.xs,self.ys) +ENDPROC + +PROC clear_render(win:PTR TO window) OF gradient + IF self.grad + RemoveGList(win,self.grad,1) + DisposeObject(self.grad) + ENDIF +ENDPROC + +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF gradient + IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.grad +ENDPROC FALSE + +PROC message_action(class,qual,code,win:PTR TO window) OF gradient + DEF val=0 + GetAttr(GRAD_CURVAL,self.grad,{val}) + self.curval:=val +ENDPROC TRUE + +PROC setcurval(x) OF gradient + self.curval:=x + SetGadgetAttrsA(self.grad,self.gh.wnd,NIL,[GRAD_CURVAL,x,NIL]) +ENDPROC + +PROC setpens(pens=NIL) OF gradient + IF pens THEN self.pens:=pens + self.clear_render(self.gh.wnd) + self.render(NIL,self.x,self.y,self.xs,self.ys,self.gh.wnd) +ENDPROC + +PROC setdisabled(disabled=TRUE) OF gradient + SetGadgetAttrsA(self.grad,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL]) + IF disabled + ghost(self.gh.wnd,self.x,self.y,self.xs,self.ys) + ELSE + unghost(self.grad,self.gh.wnd) + ENDIF + self.disabled:=disabled +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/iconify.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/iconify.e new file mode 100644 index 0000000..b71f669 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/iconify.e @@ -0,0 +1,94 @@ +OPT MODULE, PREPROCESS + +MODULE 'intuition/intuition', 'intuition/gadgetclass', + 'libraries/gadtools', + 'tools/textlen', + 'tools/EasyGUI', + 'workbench/startup', 'workbench/workbench', + 'gadtools', 'icon', 'wb' + +RAISE "icfy" IF AddAppIconA()=NIL, + "icfy" IF OpenLibrary()=NIL, + "icfy" IF CreateMsgPort()=NIL + +DEF iconbase -> Redefine for privateness + +-> Share gadtoolbase and workbenchbase with EasyGUI... + +#define DEFICON 'env:sys/def_tool' + +EXPORT OBJECT iconify OF plugin + disabled +PRIVATE + iconify:PTR TO gadget + iconopen + label, icon, iconlabel + resize +ENDOBJECT + +PROC iconify(label,icon=NIL,iconlabel=NIL, + resizex=FALSE,resizey=FALSE,disabled=FALSE) OF iconify + iconbase:=OpenLibrary('icon.library',37) + self.iconopen:=TRUE + self.label:=IF label THEN label ELSE '' + self.icon:=IF icon THEN icon ELSE DEFICON + self.iconlabel:=IF iconlabel THEN iconlabel ELSE self.label + self.disabled:=disabled + self.resize:=(IF resizex THEN RESIZEX ELSE 0) OR + (IF resizey THEN RESIZEY ELSE 0) +ENDPROC + +PROC end() OF iconify + IF self.iconopen + CloseLibrary(iconbase) + self.iconopen:=FALSE + ENDIF +ENDPROC + +PROC min_size(ta,fh) OF iconify IS textlen(self.label,ta)+16,fh+6 + +PROC will_resize() OF iconify IS self.resize + +-> Don't need to define this: +->PROC render(ta,x,y,xs,ys,w) OF iconify IS EMPTY + +PROC gtrender(gl,vis,ta,x,y,xs,ys,w) OF iconify + -> Or, a gadget in the title bar would have also been nice... + self.iconify:=CreateGadgetA(BUTTON_KIND,gl, + [x,y,xs,ys,self.label,ta,0, + PLACETEXT_IN,vis,NIL]:newgadget, [NIL]) + IF self.iconify=NIL THEN Raise("icfy") +ENDPROC self.iconify + +-> Don't need to define this: +-> PROC clear_render(win:PTR TO window) OF iconify IS EMPTY + +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF iconify + IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.iconify +ENDPROC FALSE + +PROC message_action(class,qual,code,win:PTR TO window) OF iconify HANDLE + DEF dobj=NIL:PTR TO diskobject, myport=NIL, appicon=NIL, + appmsg:PTR TO appmessage + closewin(self.gh) + -> Fallback to using a default icon if not found... + IF NIL=(dobj:=GetDiskObjectNew(self.icon)) THEN dobj:=GetDiskObjectNew(DEFICON) + dobj.type:=NIL + myport:=CreateMsgPort() + appicon:=AddAppIconA(0,0,self.iconlabel,myport,NIL,dobj,NIL) + WaitPort(myport) +EXCEPT DO + IF appicon THEN RemoveAppIcon(appicon) + IF myport + -> Clear away any messages that arrived at the last moment + WHILE appmsg:=GetMsg(myport) DO ReplyMsg(appmsg) + DeleteMsgPort(myport) + ENDIF + IF dobj THEN FreeDiskObject(dobj) + openwin(self.gh) +ENDPROC FALSE + +PROC setdisabled(disabled=TRUE) OF iconify + Gt_SetGadgetAttrsA(self.iconify,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL]) + self.disabled:=disabled +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/imagebutton.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/imagebutton.e new file mode 100644 index 0000000..b630ac3 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/imagebutton.e @@ -0,0 +1,101 @@ +OPT MODULE + +MODULE 'tools/EasyGUI', + 'graphics/rastport', + 'intuition/intuition', 'intuition/gadgetclass', + 'gadgets/button' + +EXPORT OBJECT imagebutton OF plugin + selected + disabled +PRIVATE + button:PTR TO gadget + buttonbase + image:PTR TO image + toggle, push, resize + width, height +ENDOBJECT + +PROC imagebutton(image:PTR TO image,width=0,height=0,resizex=FALSE, + resizey=FALSE,disabled=FALSE) OF imagebutton + self.buttonbase:=OpenLibrary('gadgets/button.gadget',37) + IF self.buttonbase=NIL THEN Raise("butt") + self.image:=image + self.toggle:=FALSE + self.push:=FALSE + self.selected:=FALSE + self.resize:=(IF resizex THEN RESIZEX ELSE 0) OR + (IF resizey THEN RESIZEY ELSE 0) + self.disabled:=disabled + self.width:=Max(width,image.width) + self.height:=Max(height,image.height) +ENDPROC + +PROC toggleimagebutton(image,width=0,height=0,selected=FALSE,resizex=FALSE, + resizey=FALSE,disabled=FALSE) OF imagebutton + self.imagebutton(image,width,height,resizex,resizey) + self.toggle:=TRUE + self.selected:=selected +ENDPROC + +PROC pushimagebutton(image,width=0,height=0,selected=FALSE,resizex=FALSE, + resizey=FALSE,disabled=FALSE) OF imagebutton + self.imagebutton(image,width,height,resizex,resizey) + self.push:=TRUE + self.selected:=selected +ENDPROC + +PROC end() OF imagebutton + IF self.buttonbase THEN CloseLibrary(self.buttonbase) +ENDPROC + +PROC min_size(ta,fh) OF imagebutton +ENDPROC self.width+4, self.height+2 + +PROC will_resize() OF imagebutton IS self.resize + +PROC render(ta,x,y,xs,ys,w:PTR TO window) OF imagebutton + self.button:=NewObjectA(NIL,'button.gadget', + [GA_TOP,y, GA_LEFT,x, GA_WIDTH,xs, GA_HEIGHT,ys, + GA_IMAGE,self.image, GA_TOGGLESELECT,self.toggle, + BUTTON_PUSHBUTTON,self.push, + GA_DISABLED,self.disabled, GA_SELECTED,self.selected, + GA_RELVERIFY,TRUE, BUTTON_FILLPEN,w.rport.bgpen, NIL]) + IF self.button=NIL THEN Raise("butt") + AddGList(w,self.button,-1,1,NIL) + RefreshGList(self.button,w,NIL,1) +ENDPROC + +PROC clear_render(win:PTR TO window) OF imagebutton + IF self.button + RemoveGList(win,self.button,1) + DisposeObject(self.button) + ENDIF +ENDPROC + +PROC message_test(imsg:PTR TO intuimessage,win) OF imagebutton + IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.button +ENDPROC FALSE + +PROC message_action(class,qual,code,win) OF imagebutton + self.selected:=code +ENDPROC TRUE + +PROC setselected(selected=TRUE) OF imagebutton + IF self.toggle OR self.push + SetGadgetAttrsA(self.button,self.gh.wnd,NIL,[GA_SELECTED,selected,NIL]) + self.selected:=selected + ENDIF +ENDPROC + +PROC setimage(image:PTR TO image) OF imagebutton + IF (image.width<=self.width) AND (image.height<=self.height) + SetGadgetAttrsA(self.button,self.gh.wnd,NIL,[GA_IMAGE,image,NIL]) + self.image:=image + ENDIF +ENDPROC + +PROC setdisabled(disabled=TRUE) OF imagebutton + SetGadgetAttrsA(self.button,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL]) + self.disabled:=disabled +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/led.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/led.e new file mode 100644 index 0000000..2224d00 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/led.e @@ -0,0 +1,52 @@ +OPT MODULE + +MODULE 'tools/EasyGUI', 'graphics/rastport', + 'intuition/intuition', 'intuition/imageclass', + 'images/led', 'utility/tagitem' + +EXPORT OBJECT led OF plugin + pairs + values:PTR TO INT + colon + signed + negative + pen +PRIVATE + ledbase +ENDOBJECT + +PROC led(pairs=2,values=NIL,colon=FALSE,signed=FALSE,negative=FALSE,pen=1) OF led + self.ledbase:=OpenLibrary('images/led.image',37) + IF self.ledbase=NIL THEN Raise("led") + self.pairs:=pairs + self.values:=values + self.colon:=colon + self.signed:=signed + self.negative:=negative + self.pen:=pen +ENDPROC + +PROC end() OF led + IF self.ledbase THEN CloseLibrary(self.ledbase) +ENDPROC + +PROC min_size(ta,fh) OF led +ENDPROC self.pairs*19-IF self.signed THEN 0 ELSE 5,12 + +PROC will_resize() OF led IS RESIZEX OR RESIZEY + +PROC render(ta,x,y,xs,ys,w:PTR TO window) OF led + DEF led + IF (led:=NewObjectA(NIL,'led.image', + [IA_FGPEN,self.pen, IA_WIDTH,xs-1, IA_HEIGHT,ys, + IF self.values THEN LED_VALUES ELSE TAG_IGNORE,self.values, + LED_PAIRS,self.pairs, LED_COLON,self.colon, + LED_SIGNED,self.signed, LED_NEGATIVE,self.negative, + NIL]))=NIL THEN Raise("led") + DrawImage(w.rport,led,x,y) + DisposeObject(led) +ENDPROC + +PROC redisplay() OF led + IF self.gh.wnd THEN self.render(NIL,self.x,self.y,self.xs,self.ys,self.gh.wnd) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/password.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/password.e new file mode 100644 index 0000000..10504cd --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/password.e @@ -0,0 +1,132 @@ +OPT MODULE, PREPROCESS + +MODULE 'intuition/intuition', 'intuition/sghooks', 'intuition/gadgetclass', + 'gadtools', + 'libraries/gadtools', + 'tools/textlen', 'tools/inithook', + 'utility/hooks', + 'tools/EasyGUI' + +RAISE "MEM" IF String()=NIL + +CONST NUM_EOS=EO_SPECIAL+1 + +-> Share gadtoolsbase with EasyGUI + +EXPORT OBJECT password OF plugin + estr + disabled +PRIVATE + password:PTR TO gadget + label + over + relx + mid + hook:hook +ENDOBJECT + +PROC password(estr,label=NIL,over=FALSE,relx=0,disabled=FALSE) OF password + self.estr:=estr + self.label:=IF label THEN label ELSE '' + self.over:=over + self.relx:=IF relx THEN relx ELSE 5 + self.disabled:=disabled + inithook(self.hook,{passHookCode},estr) +ENDPROC + +PROC end() OF password IS EMPTY + +PROC min_size(ta,fh) OF password + self.mid:=textlen(self.label,ta)+8 +ENDPROC self.relx*fh+self.mid, fh+6 + +PROC will_resize() OF password IS RESIZEX + +-> Don't need to define this: +->PROC render(ta,x,y,xs,ys,w) OF password IS EMPTY + +PROC gtrender(gl,vis,ta,x,y,xs,ys,w) OF password HANDLE + DEF len, pass=NIL + pass:=makePass(self.estr) + len:=textlen(self.label,ta) + self.password:=CreateGadgetA(STRING_KIND,gl, + [x+self.mid,y,xs-self.mid,ys,self.label,ta,0, + PLACETEXT_LEFT,vis,NIL]:newgadget, + [GTST_STRING,pass, GTST_EDITHOOK,self.hook, + GTST_MAXCHARS,StrMax(self.estr), GA_DISABLED,self.disabled, + STRINGA_REPLACEMODE,self.over, NIL]) + IF self.password=NIL THEN Raise("pass") +EXCEPT DO + DisposeLink(pass) + ReThrow() +ENDPROC self.password + +-> Don't need to define this: +-> PROC clear_render(win:PTR TO window) OF password IS EMPTY + +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF password + IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.password +ENDPROC FALSE + +PROC message_action(class,qual,code,win:PTR TO window) OF password +ENDPROC TRUE + +PROC setpass(str) OF password HANDLE + DEF pass=NIL + pass:=makePass(str) + Gt_SetGadgetAttrsA(self.password,self.gh.wnd,NIL,[GTST_STRING,pass,NIL]) + StrCopy(self.estr,str) +EXCEPT DO + DisposeLink(pass) +ENDPROC + +PROC setdisabled(disabled=TRUE) OF password + Gt_SetGadgetAttrsA(self.password,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL]) + self.disabled:=disabled +ENDPROC + +PROC makePass(s) + DEF len, p=NIL + IF s + IF len:=StrLen(s) + SetStr(p:=String(len),len) + WHILE len DO p[len--]:="*" + ENDIF + ENDIF +ENDPROC p + +PROC passHookCode(hook:PTR TO hook, sgw:PTR TO sgwork, msg:PTR TO LONG) + DEF realBuff:PTR TO CHAR, bp + IF msg[]=SGH_KEY + realBuff:=hook.data + bp:=sgw.bufferpos + SELECT NUM_EOS OF sgw.editop + CASE EO_DELBACKWARD + IF bp<>sgw.numchars + sgw.actions:=(sgw.actions OR SGA_BEEP) AND Not(SGA_USE) + ELSE + SetStr(realBuff, bp) + ENDIF + CASE EO_REPLACECHAR + realBuff[bp--]:=sgw.code + sgw.workbuffer[bp]:="*" + CASE EO_INSERTCHAR + IF bp<>sgw.numchars + sgw.actions:=(sgw.actions OR SGA_BEEP) AND Not(SGA_USE) + ELSE + SetStr(realBuff, bp) + realBuff[bp--]:=sgw.code + sgw.workbuffer[bp]:="*" + ENDIF + CASE EO_NOOP, EO_MOVECURSOR, EO_ENTER, EO_BADFORMAT + -> Safely ignore + DEFAULT + -> EO_DELFORWARD, EO_BIGCHANGE, EO_RESET, EO_UNDO, EO_CLEAR, EO_SPECIAL + -> Disallow + sgw.actions:=(sgw.actions OR SGA_BEEP) AND Not(SGA_USE) + ENDSELECT + RETURN -1 + ENDIF + -> UNKNOWN COMMAND + -> Hook should return zero if the command is not supported +ENDPROC 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/tabs.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/tabs.e new file mode 100644 index 0000000..4d042dd --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/tabs.e @@ -0,0 +1,89 @@ +OPT MODULE + +MODULE 'tools/EasyGUI', 'tools/ghost', 'tools/textlen', + 'intuition/intuition', 'intuition/gadgetclass', + 'gadgets/tabs' + +EXPORT OBJECT tabs OF plugin + current + disabled +PRIVATE + tabs:PTR TO gadget + tabsbase + tabslist + max +ENDOBJECT + +PROC tabs(tabslist,current=0,max=TRUE,disabled=FALSE) OF tabs + self.tabsbase:=OpenLibrary('gadgets/tabs.gadget',37) + IF self.tabsbase=NIL THEN Raise("tabs") + self.tabslist:=tabslist + self.current:=current + self.max:=max + self.disabled:=disabled +ENDPROC + +PROC end() OF tabs + IF self.tabsbase THEN CloseLibrary(self.tabsbase) +ENDPROC + +PROC min_size(ta,fh) OF tabs + DEF p:PTR TO tablabel, w=0, n=0 + p:=self.tabslist + IF self.max + WHILE p.label + w:=Max(w,textlen(p.label,ta)) + n++ + p++ + ENDWHILE + w:=w*n + ELSE + WHILE p.label + w:=w+textlen(p.label,ta) + n++ + p++ + ENDWHILE + ENDIF +ENDPROC n*20+w+7,fh+5 + +PROC will_resize() OF tabs IS COND_RESIZEX + +PROC render(ta,x,y,xs,ys,w) OF tabs + self.tabs:=NewObjectA(NIL,'tabs.gadget', + [GA_TOP,y, GA_LEFT,x, GA_WIDTH,xs-1, GA_HEIGHT,ys, + GA_TEXTATTR,ta, GA_RELVERIFY,TRUE, + TABS_CURRENT,self.current, TABS_LABELS,self.tabslist, + LAYOUTA_CHILDMAXWIDTH,self.max, + GA_DISABLED,self.disabled, NIL]) + IF self.tabs=NIL THEN Raise("tabs") + AddGList(w,self.tabs,-1,1,NIL) + RefreshGList(self.tabs,w,NIL,1) +ENDPROC + +PROC clear_render(win:PTR TO window) OF tabs + IF self.tabs + RemoveGList(win,self.tabs,1) + DisposeObject(self.tabs) + ENDIF +ENDPROC + +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF tabs + IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.tabs +ENDPROC FALSE + +PROC message_action(class,qual,code,win:PTR TO window) OF tabs + self.current:=code +ENDPROC TRUE + +PROC setcurrent(x) OF tabs + self.current:=x + SetGadgetAttrsA(self.tabs,self.gh.wnd,NIL,[TABS_CURRENT,x,NIL]) +ENDPROC + +PROC setdisabled(disabled=TRUE) OF tabs + SetGadgetAttrsA(self.tabs,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL]) + self.disabled:=disabled + IF disabled=FALSE + unghost_clear(self.tabs,self.gh.wnd,self.x,self.y,self.xs,self.ys) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/tapedeck.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/tapedeck.e new file mode 100644 index 0000000..b4ea1f5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/tapedeck.e @@ -0,0 +1,87 @@ +OPT MODULE + +MODULE 'tools/EasyGUI', 'tools/ghost', + 'intuition/intuition', 'intuition/gadgetclass', + 'gadgets/tapedeck' + +EXPORT OBJECT tapedeck OF plugin + mode + paused + disabled +PRIVATE + tapedeck:PTR TO gadget + tapedeckbase +ENDOBJECT + +PROC tapedeck(mode=BUT_STOP,paused=FALSE,disabled=FALSE) OF tapedeck + self.tapedeckbase:=OpenLibrary('gadgets/tapedeck.gadget',39) + IF self.tapedeckbase=NIL THEN Raise("tape") + self.mode:=mode + self.paused:=paused + self.disabled:=disabled +ENDPROC + +PROC end() OF tapedeck + IF self.tapedeckbase THEN CloseLibrary(self.tapedeckbase) +ENDPROC + +PROC min_size(ta,fh) OF tapedeck +ENDPROC 201,15 + +PROC will_resize() OF tapedeck IS 0 + +PROC render(ta,x,y,xs,ys,w) OF tapedeck + self.tapedeck:=NewObjectA(NIL,'tapedeck.gadget', + [GA_TOP,y, GA_LEFT,x, GA_WIDTH,xs, GA_HEIGHT,ys, + TDECK_MODE,self.mode, TDECK_PAUSED,self.paused, + TDECK_TAPE,TRUE, GA_DISABLED,self.disabled, + GA_RELVERIFY,TRUE, NIL]) + IF self.tapedeck=NIL THEN Raise("tape") + AddGList(w,self.tapedeck,-1,1,NIL) + RefreshGList(self.tapedeck,w,NIL,1) + IF self.disabled THEN ghost(w,self.x,self.y,self.xs,self.ys) +ENDPROC + +PROC clear_render(win:PTR TO window) OF tapedeck + IF self.tapedeck + RemoveGList(win,self.tapedeck,1) + DisposeObject(self.tapedeck) + ENDIF +ENDPROC + +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF tapedeck + IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.tapedeck +ENDPROC FALSE + +PROC message_action(class,qual,code,win:PTR TO window) OF tapedeck + DEF x + GetAttr(TDECK_MODE,self.tapedeck,{x}) + self.mode:=x + GetAttr(TDECK_PAUSED,self.tapedeck,{x}) + self.paused:=IF x THEN TRUE ELSE FALSE +ENDPROC TRUE + +PROC setmode(mode=BUT_STOP) OF tapedeck + self.mode:=mode + IF mode=BUT_PAUSE THEN self.paused:=self.paused=FALSE + SetGadgetAttrsA(self.tapedeck,self.gh.wnd,NIL,[TDECK_MODE,mode,NIL]) + IF self.disabled THEN ghost(self.gh.wnd,self.x,self.y,self.xs,self.ys) +ENDPROC + +PROC setpaused(paused=TRUE) OF tapedeck + IF self.paused<>paused + SetGadgetAttrsA(self.tapedeck,self.gh.wnd,NIL,[TDECK_MODE,BUT_PAUSE,NIL]) + IF self.disabled THEN ghost(self.gh.wnd,self.x,self.y,self.xs,self.ys) + ENDIF + self.paused:=paused +ENDPROC + +PROC setdisabled(disabled=TRUE) OF tapedeck + SetGadgetAttrsA(self.tapedeck,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL]) + IF disabled + ghost(self.gh.wnd,self.x,self.y,self.xs,self.ys) + ELSE + unghost_clear(self.tapedeck,self.gh.wnd,self.x,self.y,self.xs,self.ys) + ENDIF + self.disabled:=disabled +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/ticker.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/ticker.e new file mode 100644 index 0000000..54e4880 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/ticker.e @@ -0,0 +1,18 @@ +OPT MODULE + +MODULE 'tools/EasyGUI', + 'intuition/intuition' + +EXPORT OBJECT ticker OF plugin +ENDOBJECT + +PROC min_size(ta,fh) OF ticker IS 0,0 + +PROC will_resize() OF ticker IS FALSE + +PROC render(ta,x,y,xs,ys,w:PTR TO window) OF ticker IS EMPTY + +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF ticker +ENDPROC imsg.class=IDCMP_INTUITICKS + +PROC message_action(class,qual,code,win) OF ticker IS TRUE diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/toolify.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/toolify.e new file mode 100644 index 0000000..13fe83e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Plugins/toolify.e @@ -0,0 +1,75 @@ +OPT MODULE, PREPROCESS + +MODULE 'intuition/intuition', 'intuition/gadgetclass', + 'libraries/gadtools', + 'tools/textlen', + 'tools/EasyGUI', + 'workbench/startup', 'workbench/workbench', + 'gadtools', 'wb' + +RAISE "tlfy" IF AddAppMenuItemA()=NIL, + "tlfy" IF CreateMsgPort()=NIL + +-> Share gadtoolsbase and workbenchbase with EasyGUI + +EXPORT OBJECT toolify OF plugin + disabled +PRIVATE + toolify:PTR TO gadget + label, toollabel + resize +ENDOBJECT + +PROC toolify(label,toollabel=NIL, + resizex=FALSE,resizey=FALSE,disabled=FALSE) OF toolify + self.label:=IF label THEN label ELSE '' + self.toollabel:=IF toollabel THEN toollabel ELSE self.label + self.disabled:=disabled + self.resize:=(IF resizex THEN RESIZEX ELSE 0) OR + (IF resizey THEN RESIZEY ELSE 0) +ENDPROC + +PROC end() OF toolify IS EMPTY + +PROC min_size(ta,fh) OF toolify IS textlen(self.label,ta)+16,fh+6 + +PROC will_resize() OF toolify IS self.resize + +-> Don't need to define this: +->PROC render(ta,x,y,xs,ys,w) OF toolify IS EMPTY + +PROC gtrender(gl,vis,ta,x,y,xs,ys,w) OF toolify + -> Or, a gadget in the title bar would have also been nice... + self.toolify:=CreateGadgetA(BUTTON_KIND,gl, + [x,y,xs,ys,self.label,ta,0, + PLACETEXT_IN,vis,NIL]:newgadget, [NIL]) + IF self.toolify=NIL THEN Raise("tlfy") +ENDPROC self.toolify + +-> Don't need to define this: +-> PROC clear_render(win:PTR TO window) OF toolify IS EMPTY + +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF toolify + IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.toolify +ENDPROC FALSE + +PROC message_action(class,qual,code,win:PTR TO window) OF toolify HANDLE + DEF myport=NIL, appitem=NIL, appmsg:PTR TO appmessage + closewin(self.gh) + myport:=CreateMsgPort() + appitem:=AddAppMenuItemA(0,0,self.toollabel,myport,NIL) + WaitPort(myport) +EXCEPT DO + IF appitem THEN RemoveAppMenuItem(appitem) + IF myport + -> Clear away any messages that arrived at the last moment + WHILE appmsg:=GetMsg(myport) DO ReplyMsg(appmsg) + DeleteMsgPort(myport) + ENDIF + openwin(self.gh) +ENDPROC FALSE + +PROC setdisabled(disabled=TRUE) OF toolify + Gt_SetGadgetAttrsA(self.toolify,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL]) + self.disabled:=disabled +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/README b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/README new file mode 100644 index 0000000..28e1279 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/README @@ -0,0 +1,83 @@ +Short: EasyGUI v3.3b.3 (multiple windows!) +Type: dev/e +Author: jason@fsel.com (Jason R. Hulance) + +New v3.3b.3 EasyGUI package +=========================== + +(v3.3b.3 is a minor update that fixes a bug with AppWindow messages +that crept in under the guise of a safety feature in v3.3b...) + +Re-read Docs/EasyGUI.doc! + +For the impatient, here is the big news: + +- MAJOR CHANGE: made the main functions use a taglist for their optional + arguments (it was getting a bit ridiculous...). This gives a bit more + flexibility for the programmer and makes for much more readable code, so + I'm afraid it was inevitable. To ease the change-over a bit there is an + example module which gives the old style versions of the functions (just + for EasyGUI.m; you can do your own for EasyGUI_lite.m). +- MAJOR ADDITION: support for multi-window GUIs. This is via the + multiinit(), addmultiA(), multimessage(), cleanmulti() and checkmulti() + functions. The new scheme shares message ports, and efficiently + dispatches on the message data. This is *massively* more efficient than + using the old scheme (OR-ing the signal masks of each window), and + effectively removes the limit of windows that a GUI can use. + + +Installing the modules +---------------------- +Copy the files from the sub-directories of the Modules directory to the +same place in your emodules: directory. Note: there are some updates to +the typed modules of the v3.2a distribution included. + +Installing the .gadget and .image files +--------------------------------------- +Copy the .gadget and .image files from the sub-directories of the Classes +directory to the same place in your sys:classes directory (or at least, +somewhere so that libs:gadgets/x.gadget and libs:images/x.image find the +appropriate files). + +PLUGINS +------- +There are now lots of examples of PLUGINs with full source code and some +documentation. Hopefully this will provoke some more interest in this +area... Also, there is a simplified way of using GadTools gadgets as +PLUGINs, via gtrender(). + +Test files +---------- +There are several test files showing how to use the new features and new +PLUGINs (in Src/EasyGUI/). + +Feedback +-------- +Please let me have some... + +Copyright +--------- + +The .gadget and .image files are: + + Copyright (c) 1994 Commodore-Amiga, Inc. + +and discussed further in Classes/GI1.Readme and Classes/GI1.License. + +EasyGUI.m, EasyGUI_lite.m and alldist.e are: + + Copyright (c) 1994-6, Wouter van Oortmerssen and Jason R. Hulance. + +All other files in this archive are: + + Copyright (c) 1996, Jason R. Hulance. + +You are free to use these files in your own programs, and you may modify +the souces supplied for your own purposes. But it would be nice if you +mention the wonderful Wouter and his amazing Amiga E every now and then... + + +Well, have fun! + + +Jason (jason@fsel.com) diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Source/EasyGUI.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Source/EasyGUI.e new file mode 100644 index 0000000..0881a36 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Source/EasyGUI.e @@ -0,0 +1,2008 @@ +-> EasyGui.m, constructs fast nononsense font sensitive resizable gui's. + +OPT MODULE, OSVERSION=37, PREPROCESS + +-> Let only one of the following be defined: + +->#define EASYGUI_LITE +#define EASYGUI_FULL +->#define EASYGUI_DEBUG + + +-> This selects various components based on above choice. +#ifndef EASYGUI_LITE +#define EASY_KEYBOARD +#ifdef EASYGUI_DEBUG +#ifndef EASYGUI_FULL +#define EASYGUI_FULL +#endif +#endif +#ifdef EASYGUI_FULL +#define EASY_APPWINDOW +#define EASY_EXTRAS +#endif +#endif + +-> This enables a descriptive message before an exception is raised. +#ifdef EASYGUI_DEBUG +#define RaiseX(x,l,s) myraise(x,l,s) +MODULE 'tools/exceptions' +#endif +#ifndef EASYGUI_DEBUG +#define RaiseX(x,l,s) Raise(x) +#endif + +MODULE 'gadtools', + 'exec/libraries', 'exec/lists', 'exec/nodes', 'exec/ports', + 'graphics/rastport', 'graphics/text', + 'graphics/gfx', 'graphics/videocontrol', 'graphics/view', + 'intuition/gadgetclass', 'intuition/imageclass', 'intuition/intuition', + 'intuition/screens', + 'libraries/gadtools', + 'tools/textlen', 'amigalib/lists', + 'utility/tagitem', + 'utility' + +#ifdef EASY_APPWINDOW +MODULE 'wb', 'workbench/workbench' +#endif + +#ifdef EASY_KEYBOARD +MODULE 'tools/ctype' +#endif + +DEF utilitybase -> Redefine for privateness + +#ifdef EASY_EXTRAS +/************ multihandle ************/ +EXPORT OBJECT multihandle + sig + opencount +PRIVATE +#ifdef EASY_APPWINDOW + awport:PTR TO mp +#endif + wndport:PTR TO mp + guis:lh +ENDOBJECT +#endif + +-> The offset of the `link' node in a guihandle. Used for getting +-> back to the guihandle from the node in the list. +CONST GH_LINK_OFFSET=16 + +/************ guihandle ************/ +EXPORT OBJECT guihandle + -> Window, Signal Mask (not Bit), Info + wnd:PTR TO window,sig,info +#ifdef EASY_EXTRAS + -> Multi-Window Handle + mh:PTR TO multihandle +#endif +PRIVATE +#ifdef EASY_EXTRAS + -> Node for Linking GUIs in Multi-Window GUIs + link:ln +#endif + -> Private Window Pointer (so that wnd is a flag for GUI validity, too) + pwnd:PTR TO window + -> Last Gadget, VisualInfo, Font, Font_uses_screen, GT_lib_is_open + gl:PTR TO gadget,visual,tattr:PTR TO textattr,ta_scr,gt_isopen + -> Gadget desc, Gadget list, Screen, Screen_is_WB + base:PTR TO g,glist,scr:PTR TO screen,is_wb + -> Min Width and Height, X and Y Offset Past Window Borders + xsize,ysize,xoff,yoff + -> Menus, Plugins + menus, plugins:PTR TO plugin +#ifndef EASY_KEYBOARD + -> First String Gadget + firststr +#endif +#ifdef EASY_KEYBOARD + -> Map of Key to Gadget + keys[26]:ARRAY OF LONG +#endif +#ifdef EASY_APPWINDOW + -> AppWindow Port, AppWindow, WB_lib_is_open + awport:PTR TO mp,appwin,wb_isopen +#endif +#ifdef EASY_EXTRAS + -> Requester used for Blocking + req:PTR TO requester +#endif + -> GUI X and Y, GUI Desc, Window Title, Menu Desc + x,y,gui,wtitle,awproc,newmenus + -> Window Port, OnClose Proc, Window Type, OnClean Proc + wndport:PTR TO mp,onclose,wtype,onclean + -> Hack to make menu selections safe + menuitem:PTR TO LONG +#ifdef EASY_EXTRAS + -> Count of blockwin() calls + blockcnt +#endif +ENDOBJECT + +-> Flag set for resizing constants. +SET CRSZ_X, CRSZ_Y, UNCOND_X, UNCOND_Y + +EXPORT CONST COND_RESIZEX=CRSZ_X, COND_RESIZEY=CRSZ_Y +EXPORT CONST RESIZEX=COND_RESIZEX OR UNCOND_X, RESIZEY=COND_RESIZEY OR UNCOND_Y + +CONST RESIZEXANDY=RESIZEX OR RESIZEY + +-> Resize testing macros. +#define DoesXResize(flag) ((flag) AND COND_RESIZEX) +#define DoesYResize(flag) ((flag) AND COND_RESIZEY) +#define DoesXUncond(flag) ((flag) AND RESIZEX=RESIZEX) +#define DoesYUncond(flag) ((flag) AND RESIZEY=RESIZEY) + +-> Gadget type constants. +-> 0 1 2 3 4 5 +EXPORT ENUM ROWS,EQROWS,COLS,EQCOLS,BEVEL,BEVELR, +-> 6 7 8 9 10 11 12 13 14 15 16 17 + BUTTON,CHECK,INTEGER,LISTV,MX,CYCLE,PALETTE,SCROLL,SLIDE,STR,TEXT,NUM, +-> 18 19 20 21 22 23 24 25 + SBUTTON,PLUGIN,BAR,SPACEH,SPACE,SPACEV,RBUTTON,MAXGUI + +-> ROWS... BUTTON... PALETTE... SBUTTON... RBUTTON... +-> Mapping of gadget type to GT KIND. +#define KINDTAB \ + [0,0,0,0,0,0, 1,2,3,4,5,7,8,9,11,12,13,6, 1, 0, 0,0,0,0, 1,12]:CHAR +-> Mapping of gadget type to number of required arguments. +#define MINARGS \ + [2,2,2,2,2,2, 3,5,5,9,6,4,7,7, 9, 6, 5,5, 3, 3, 1,1,1,1, 3,6]:CHAR + +-> Constants to index gadget desc lists. +EXPORT ENUM BEV_GUI=1, + BUT_ACT=1, BUT_TXT, BUT_DATA, BUT_KEY, BUT_APPW, BUT_DIS, + CHK_ACT=1, CHK_TXT, CHK_VAL, CHK_LEFT, CHK_DATA, CHK_KEY, CHK_DIS, + INT_ACT=1, INT_TXT, INT_VAL, INT_REL, INT_DATA, INT_KEY, INT_DIS, + LST_ACT=1, LST_TXT, LST_RELX, LST_RELY, LST_LIST, LST_RO, LST_SHOW, + LST_CURR, LST_DATA, LST_KEY, LST_APPW, LST_DIS, + MX_ACT=1, MX_TXT, MX_LIST, MX_LEFT, MX_CURR, MX_DATA, MX_KEY, + MX_DIS, + CYC_ACT=1, CYC_TXT, CYC_LIST, CYC_CURR, CYC_DATA, CYC_KEY, CYC_DIS, + PAL_ACT=1, PAL_TXT, PAL_DEP, PAL_RELX, PAL_RELY, PAL_CURR, PAL_DATA, + PAL_KEY, PAL_DIS, + SCR_ACT=1, SCR_VERT, SCR_TOTL, SCR_TOP, SCR_VIS, SCR_REL, SCR_DATA, + SCR_KEY, SCR_DIS, + SLI_ACT=1, SLI_TXT, SLI_VERT, SLI_MIN, SLI_MAX, SLI_CURR, SLI_REL, + SLI_FMT, SLI_DATA, SLI_KEY, SLI_DIS, + STR_ACT=1, STR_TXT, STR_STR, STR_MAX, STR_REL, STR_OVR, STR_DATA, + STR_KEY, STR_APPW, STR_DIS, + TXT_VAL=1, TXT_TXT, TXT_BORD, TXT_REL, + NUM_VAL=1, NUM_TXT, NUM_BORD, NUM_REL, + PLG_ACT=1, PLG_OBJ, PLG_GT, PLG_APPW + +ENUM EG_TYPE=0, EG_ACT, EG_TXT + +-> Test group type macros. +#define IsRow(type) ((type)<=EQROWS) +#define IsCol(type) ((type)>EQROWS) +#define IsRowOrCol(type) ((type) Test space sizing macros. +#define HasHSpace(type) ((type)<=SPACE) +#define HasVSpace(type) ((type)>=SPACE) +#define HSpace(type) (IF HasHSpace(type) THEN RESIZEX ELSE 0) +#define VSpace(type) (IF HasVSpace(type) THEN RESIZEY ELSE 0) +#define SpaceFlags(type) (HSpace(type) OR VSpace(type)) + +-> Test button sizing macros. +#define HasHButtSp(type) ((type)>=SBUTTON) +#define HasVButtSp(type) ((type)=RBUTTON) +#define HButtSp(type) (IF HasHButtSp(type) THEN RESIZEX ELSE 0) +#define VButtSp(type) (IF HasVButtSp(type) THEN RESIZEY ELSE 0) +#define ButtSpFlags(type) (HButtSp(type) OR VButtSp(type)) + +CONST SP=2,YSP=3 -> very basic spacing (Y=nonsense!?!) +CONST XSPACING=YSP,YSPACING=SP, -> basic spacing between gadgets + SIDESPACE=YSP,TOPSPACE=SP, -> spacing to window border + BUTXSPACE=16,BUTYSPACE=6, -> space around text in button (min) + BEVELXSPACE=4,BEVELYSPACE=3, -> between bevelbox and inner gadgets + MXSPACE=2,CHECKSPACE=2 -> between two mx and check gads + +EXPORT ENUM WTYPE_NOBORDER, WTYPE_BASIC, WTYPE_NOSIZE, WTYPE_SIZE + +-> Window flags. +CONST WIN_FBASIC=WFLG_ACTIVATE OR WFLG_NEWLOOKMENUS +CONST WIN_FNOBORD=WFLG_BORDERLESS OR WIN_FBASIC +CONST WIN_FNOSIZE=WIN_FBASIC OR WFLG_DRAGBAR OR WFLG_DEPTHGADGET OR + WFLG_CLOSEGADGET +CONST WIN_FSIZE=WIN_FNOSIZE OR WFLG_SIZEBBOTTOM OR WFLG_SIZEGADGET + +-> Gadget click IDCMP. +CONST GAD_IDCMP=IDCMP_GADGETDOWN OR IDCMP_GADGETUP OR IDCMP_MOUSEMOVE + +-> Window IDMCP (without NEWSIZE). +CONST WIN_IDCMP_NS=GAD_IDCMP OR IDCMP_REFRESHWINDOW OR IDCMP_MOUSEBUTTONS OR + IDCMP_MENUPICK OR IDCMP_CLOSEWINDOW OR IDCMP_RAWKEY OR + IDCMP_ACTIVEWINDOW OR IDCMP_INACTIVEWINDOW OR + IDCMP_INTUITICKS OR IDCMP_CHANGEWINDOW OR IDCMP_VANILLAKEY + +-> Window IDMCP (with NEWSIZE). +CONST WIN_IDCMP=IDCMP_NEWSIZE OR WIN_IDCMP_NS + +-> Message loop constants. +CONST GUI_CONT=-1, GUI_QUIT=0 + +-> Action function test macro. +#define IsActionFun(ret) (((ret)<0) OR ((ret)>1000)) + +-> Convert to unsigned INT. +#define Unsigned(x) ((x) AND $FFFF) + +-> System gadget aspect ratio macro. +#define SysISize(flags) \ + (IF (flags) AND SCREENHIRES THEN SYSISIZE_MEDRES ELSE SYSISIZE_LOWRES) + +-> Gadget information extraction macros. +#define GadLongInt(gad) (gad.specialinfo::stringinfo.longint) +#define GadString(gad) (gad.specialinfo::stringinfo.buffer) +#define IsChecked(gad) ((gad.flags AND GFLG_SELECTED)<>0) + +-> Constant to mark gadget has no mid-point. +CONST NO_MID=-1 + +-> Gadget data (intermediate level). +OBJECT g + -> Link, X, Y, Width, Height + next,x,y,xs,ys + -> Gadget Type, Gadget Desc, Flags, Mid-Point + type,list:PTR TO LONG,flags,mid +ENDOBJECT + +/************ plugin ************/ +EXPORT OBJECT plugin PRIVATE + -> Gadget Data, Link + base:PTR TO g, next:PTR TO plugin +PUBLIC + -> X, Y, Width, Height + x:INT,y:INT,xs:INT,ys:INT + -> guihandle + gh:PTR TO guihandle +ENDOBJECT + +PROC min_size(ta,fontheight) OF plugin IS fontheight,fontheight +PROC will_resize() OF plugin IS RESIZEXANDY +PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF plugin IS FALSE +PROC message_action(class,qual,code,win:PTR TO window) OF plugin IS FALSE +PROC clear_render(win:PTR TO window) OF plugin IS EMPTY + +PROC render(ta:PTR TO textattr,x,y,xs,ys,win:PTR TO window) OF plugin + fillbox(win.rport,1,x,y,x+xs-1,y+ys-1) +ENDPROC + +PROC appmessage(amsg,win:PTR TO window) OF plugin IS FALSE +PROC gtrender(gl,vis,ta,x,y,xs,ys,win) OF plugin IS gl +/************ plugin end ************/ + +-> Magic idenitifier for AppWindow gadgets. +CONST EG_MAGIC=$EA51EA51 + +-> Tag list constants +CONST EG_TAGBASE=TAG_USER+$4000 + +EXPORT ENUM EG_TITLE=EG_TAGBASE, EG_GUI, EG_INFO, EG_SCRN, EG_FONT, EG_MENU, + EG_GHVAR, EG_AWPROC, EG_LEFT, EG_TOP, EG_MAXW, EG_MAXH, EG_WTYPE, + EG_CLOSE, EG_CLEAN, EG_HIDE + +-> Gadget list attribute selection. +#define ATTR(gui,n) gui[(n)] +#define HasATTR(list,n) (ListLen((list))>n) +#define OptATTR(list,n) optattr(list,n) +#define OptDefATTR(list,n) optdefattr(list,n) + +PROC optattr(list:PTR TO LONG,n) IS IF HasATTR(list,n) THEN ATTR(list,n) ELSE 0 + +PROC optdefattr(list:PTR TO LONG,n) + DEF res=-1 + IF HasATTR(list,n) THEN res:=ATTR(list,n) +ENDPROC IF res<>-1 THEN res ELSE list + +PROC indexdata(type) + DEF index, but=FALSE, val=0 + SELECT MAXGUI OF type + CASE BUTTON,SBUTTON,RBUTTON; index:=BUT_DATA; but:=TRUE + CASE CHECK; index:=CHK_DATA; val:=CHK_VAL + CASE LISTV; index:=LST_DATA + CASE MX; index:= MX_DATA + CASE STR; index:=STR_DATA; val:=STR_STR + CASE INTEGER; index:=INT_DATA; val:=INT_VAL + CASE CYCLE; index:=CYC_DATA + CASE PALETTE; index:=PAL_DATA + CASE SCROLL; index:=SCR_DATA + CASE SLIDE; index:=SLI_DATA + ENDSELECT +ENDPROC index, but, val + +#ifndef EASY_KEYBOARD +#ifndef EASY_EXTRAS +#define EASY_NOKEYBEXTRA +#endif +#endif + +#ifndef EASY_NOKEYBEXTRA +-> Optional value based on index. +PROC optindex(i:PTR TO LONG,index) IS IF index THEN OptATTR(i,index) ELSE 0 +#endif + +#ifdef EASY_KEYBOARD +#define optkey(t,i) optindex(i,indexkey(t)) +PROC indexkey(type) + DEF index + SELECT MAXGUI OF type + CASE BUTTON,SBUTTON,RBUTTON; index:=BUT_KEY + CASE CHECK; index:=CHK_KEY + CASE LISTV; index:=LST_KEY + CASE MX; index:= MX_KEY + CASE STR; index:=STR_KEY + CASE INTEGER; index:=INT_KEY + CASE CYCLE; index:=CYC_KEY + CASE PALETTE; index:=PAL_KEY + CASE SCROLL; index:=SCR_KEY + CASE SLIDE; index:=SLI_KEY + ENDSELECT +ENDPROC index +#endif + +#ifndef EASY_EXTRAS +#define optdis(t,i) 0 +#endif +#ifdef EASY_EXTRAS +#define optdis(t,i) optindex(i,indexdis(t)) +PROC indexdis(type) + DEF index=0 + SELECT MAXGUI OF type + CASE BUTTON,SBUTTON,RBUTTON; index:=BUT_DIS + CASE CHECK; index:=CHK_DIS + CASE LISTV; index:=LST_DIS + CASE MX; index:= MX_DIS + CASE STR; index:=STR_DIS + CASE INTEGER; index:=INT_DIS + CASE CYCLE; index:=CYC_DIS + CASE PALETTE; index:=PAL_DIS + CASE SCROLL; index:=SCR_DIS + CASE SLIDE; index:=SLI_DIS + ENDSELECT +ENDPROC index + +/********** setdisabled **********/ +EXPORT PROC setdisabled(gh,gad:PTR TO LONG,disabled=TRUE) + DEF index + index:=indexdis(ATTR(gad,EG_TYPE)) + IF HasATTR(gad,index) THEN setattr(gh,gad,disabled,GA_DISABLED,index) +ENDPROC +#endif + +-> Clear window contents and redraw frame. +PROC clearwindow(w:PTR TO window) + fillbox(w.rport,0,w.borderleft,w.bordertop, + w.width-w.borderright-1, w.height-w.borderbottom-1) + RefreshWindowFrame(w) +ENDPROC + +PROC fillbox(rport,pen,x,y,x2,y2) + SetAPen(rport,pen) + RectFill(rport,x,y,x2,y2) +ENDPROC + +-> Create new gadget data. +PROC newg(xs,ys,type,list,flags=0,mid=NO_MID) IS NEW [0,0,0,xs,ys,type,list,flags,mid]:g + +-> Access functions for gadget type mapping lists. +PROC minARGS() IS MINARGS +PROC kindTAB() IS KINDTAB + +#ifdef EASYGUI_DEBUG +-> In debug version this will be called instead of raising an exception. +PROC myraise(x,l,s) + exception:=x; exceptioninfo:=0 + WriteF('Just about to raise exception:\n') + report_exception() + IF (l>0) AND (l<2000) + WriteF(' Error ref \d: \s\n',l,s) + ELSE + WriteF(' \s (Gadget list $\h)\n',s,l) + ENDIF + Raise(x) +ENDPROC +#endif + +/********** easyguiA() **********/ +EXPORT PROC easyguiA(title,gui,tags=NIL) HANDLE + DEF gh=NIL:PTR TO guihandle,res=-1 + gh:=guiinitA(title,gui,tags) + WHILE res<0 + Wait(gh.sig) + res:=guimessage(gh) + ENDWHILE +EXCEPT DO + cleangui(gh) + ReThrow() +ENDPROC res + +/********** easygui_fallbackA() **********/ +EXPORT PROC easygui_fallbackA(title,gui,tags=NIL) HANDLE + RETURN easyguiA(title,gui,tags) +EXCEPT + IF exception="bigg" + RETURN easyguiA(title,gui,[EG_FONT,['topaz.font',8,0,0]:textattr, + TAG_MORE,tags]) + ENDIF + ReThrow() +ENDPROC + +-> Init font. +PROC initfont(gh:PTR TO guihandle,tattr) + gh.tattr:=tattr + gh.ta_scr:=(tattr=NIL) +ENDPROC + +-> Init screen. +PROC initscr(gh:PTR TO guihandle,scr) + gh.scr:=scr + gh.is_wb:=(scr=NIL) +ENDPROC + +-> Set up menus. +PROC setmenus(gh:PTR TO guihandle) + -> setup menus + IF gh.newmenus + gh.menus:=CreateMenusA(gh.newmenus,NIL) + IF gh.menus=NIL THEN RaiseX("GUI",431,'Could not create menus. Bad menu description? Or out of memory?') + IF LayoutMenusA(gh.menus,gh.visual,[GTMN_NEWLOOKMENUS,TRUE,NIL])=FALSE THEN RaiseX("GUI",432,'Could not layout menus. Out of memory?') + IF SetMenuStrip(gh.pwnd,gh.menus)=FALSE THEN RaiseX("GUI",433,'Could not set menu strip. Should never happen!') + ENDIF +ENDPROC + +PROC win_off(n,s:PTR TO screen) + DEF y + IF n=WTYPE_NOBORDER THEN RETURN 1,1 + y:=s.wbortop+TOPSPACE + IF n>WTYPE_BASIC THEN y:=y+s.rastport.txheight+1 +ENDPROC s.wborleft+SIDESPACE,y + +PROC win_pad(n,s:PTR TO screen) + DEF y=TOPSPACE + IF n=WTYPE_NOBORDER THEN RETURN 1,1 + y:=y+IF n=WTYPE_SIZE THEN getrealbot(s) ELSE s.wborbottom +ENDPROC s.wborright+SIDESPACE,y + +-> Set up GUI. +PROC setgui(gh:PTR TO guihandle) + DEF base:PTR TO g,s:PTR TO screen,w:PTR TO window,xsize,ysize, + cm,h=NIL:PTR TO LONG,vpe=NIL:PTR TO viewportextra,x,y + s:=gh.scr + w:=gh.pwnd + + -> Get gadget data and calculate minimum GUI size. + gh.base:=base:=minsize(gh.gui,gh) + IF w=NIL + -> Calculate offset of borders in window. + x,y:=win_off(gh.wtype,s) + gh.xoff:=x + gh.yoff:=y + ENDIF + -> Calculate minimum width and height of window. + x,y:=win_pad(gh.wtype,s) + xsize:=x+gh.xoff+base.xs + ysize:=y+gh.yoff+base.ys + + IF (xsize>s.width) OR (ysize>s.height) THEN RaiseX("bigg",455,'Size is too big for the screen.') + +#ifdef EASY_EXTRAS + -> If window open then adjust sizing. + IF w + -> Calculate X size and pos delta if needed. + cm:=IF (w.width>=xsize) AND DoesXResize(base.flags) THEN w.width ELSE xsize + x:=IF cm+w.leftedge>s.width THEN s.width-cm ELSE w.leftedge + -> Calculate Y size and pos delta if needed. + h:=IF (w.height>=ysize) AND DoesYResize(base.flags) THEN w.height ELSE ysize + y:=IF h+w.topedge>s.height THEN s.height-h ELSE w.topedge + -> Disallow window sizing. + ModifyIDCMP(w, WIN_IDCMP_NS) + -> Temporarily allow window to grow as large and small as possible. + WindowLimits(w,8,8,-1,-1) + -> Move and size window. + ChangeWindowBox(w,x,y,cm,h) + -> Set window to proper limits. + setwinlimits(w,xsize,ysize, + IF DoesXResize(base.flags) THEN -1 ELSE xsize, + IF DoesYResize(base.flags) THEN -1 ELSE ysize) + -> Remove mess. + clearwindow(w) + -> Allow resizing (maybe) again. + ModifyIDCMP(w, WIN_IDCMP) + ELSE +#endif + -> Window not open so create it. + -> get visual infos + gh.visual:=GetVisualInfoA(gh.scr,NIL) + IF gh.visual=NIL THEN RaiseX("GUI",482,'Could not get visual info. Out of memory?') + + -> calc window position (centre of visible part of screen) + h:=VTAG_VIEWPORTEXTRA_GET -> Ack! VideoControl changes tag! + IF IF cm:=s.viewport.colormap THEN VideoControl(cm, h:=[h,NIL,NIL]) BUT vpe:=h[1] ELSE vpe:=NIL + x:=Min(vpe.displayclip.maxx-vpe.displayclip.minx+1,s.width)-xsize/2-s.viewport.dxoffset + y:=Min(vpe.displayclip.maxy-vpe.displayclip.miny+1,s.height)-ysize/2-s.viewport.dyoffset + ELSE + x:=s.width-xsize/2 + y:=s.height-ysize/2 + ENDIF + w:=s.width + h:=s.height + -> If position stored use that, else centred. And adjust max size. + IF gh.x<>-1 + x:=gh.x + -> Offset the maximum + w:=Bounds(w-x,xsize,w) + ENDIF + IF gh.y<>-1 + y:=gh.y + h:=Bounds(h-y,ysize,h) + ENDIF + -> Use minimum or stored size (default is maximum). + IF gh.xsize=0 + w:=xsize + ELSEIF DoesXResize(base.flags)=FALSE + w:=xsize + ELSEIF gh.xsize<>-1 + w:=Bounds(gh.xsize,xsize,s.width) + ENDIF + IF gh.ysize=0 + h:=ysize + ELSEIF DoesYResize(base.flags)=FALSE + h:=ysize + ELSEIF gh.ysize<>-1 + h:=Bounds(gh.ysize,ysize,s.height) + ENDIF + + -> open the window + gh.pwnd:=w:=OpenWindowTagList(NIL, + [WA_LEFT, Bounds(x,0,s.width-w), + WA_TOP, Bounds(y,0,s.height-h), + WA_WIDTH, w, + WA_HEIGHT, h, + WA_IDCMP, 0, -> Was WIN_IDCMP: now ports are shared. + WA_FLAGS, ListItem([WIN_FNOBORD,WIN_FBASIC, + WIN_FNOSIZE,WIN_FSIZE], gh.wtype), + WA_TITLE, IF gh.wtype>WTYPE_BASIC THEN gh.wtitle ELSE NIL, + WA_CUSTOMSCREEN, gh.scr, + WA_MINWIDTH, xsize, + WA_MINHEIGHT, ysize, + WA_MAXWIDTH, IF DoesXResize(base.flags) THEN -1 ELSE xsize, + WA_MAXHEIGHT, IF DoesYResize(base.flags) THEN -1 ELSE ysize, + ->WA_AUTOADJUST,1, + NIL]) + IF w=NIL THEN RaiseX("GUI",537,'Could not open window. Too many layers?') + w.userdata:=gh + -> Set up window IDCMP port. + w.userport:=gh.wndport + ModifyIDCMP(w,WIN_IDCMP) + +#ifdef EASY_APPWINDOW + IF gh.awproc THEN gh.appwin:=AddAppWindowA(gh,gh.awproc,gh.pwnd,gh.awport,NIL) +#endif + stdrast:=w.rport +#ifdef EASY_EXTRAS + ENDIF +#endif + -> Remember minimum window size. + gh.xsize:=xsize + gh.ysize:=ysize + -> Now render the gadgets. + gh.glist:=rendergui(gh) +ENDPROC + +/********** guiinitA() **********/ +#ifdef EASY_EXTRAS +EXPORT PROC guiinitA(title,gui,tags=NIL) IS addmultiA(NIL,title,gui,tags) +#endif +#ifndef EASY_EXTRAS +EXPORT PROC guiinitA(title,gui,tags=NIL) HANDLE + DEF gh=NIL:PTR TO guihandle + gh:=makehandle(title,gui,NIL,tags) +EXCEPT + -> Stop the user cleanup in this case. + gh.onclean:=NIL + cleangui(gh) + ReThrow() +ENDPROC gh +#endif + +PROC openlibrary(s) + DEF lib + IF (lib:=OpenLibrary(s,37))=NIL THEN RaiseX("LIB",613,s) +ENDPROC lib + +-> Make a handle and initialise from the tags. +PROC makehandle(title,gui,mh,tags) HANDLE + DEF gh=NIL:PTR TO guihandle, temp:PTR TO LONG, isopen=FALSE + NEW gh + utilitybase:=openlibrary('utility.library') + isopen:=TRUE + IF temp:=GetTagData(EG_GHVAR,NIL,tags) THEN temp[]:=gh + gh.wtype:=GetTagData(EG_WTYPE,WTYPE_SIZE,tags) + gh.wtitle:=title + gh.gui:=gui + gh.info:=IF -1<>(temp:=GetTagData(EG_INFO,-1,tags)) THEN temp ELSE gh + initscr(gh,GetTagData(EG_SCRN,NIL,tags)) + initfont(gh,GetTagData(EG_FONT,NIL,tags)) + gh.newmenus:=GetTagData(EG_MENU,NIL,tags) + gh.awproc:=GetTagData(EG_AWPROC,NIL,tags) + gh.x:=GetTagData(EG_LEFT,-1,tags) + gh.y:=GetTagData(EG_TOP,-1,tags) + gh.onclose:=GetTagData(EG_CLOSE,NIL,tags) + gh.onclean:=GetTagData(EG_CLEAN,NIL,tags) + IF GetTagData(EG_MAXW,FALSE,tags) THEN gh.xsize:=-1 + IF GetTagData(EG_MAXH,FALSE,tags) THEN gh.ysize:=-1 +#ifdef EASY_EXTRAS + gh.mh:=mh +#endif + setinit(gh) +EXCEPT DO + IF exception + END gh + ReThrow() + ELSE + IF GetTagData(EG_HIDE,FALSE,tags)=FALSE THEN openwin(gh) + ENDIF + IF isopen THEN CloseLibrary(utilitybase) +ENDPROC gh + +-> Initialisation stuff. +PROC setinit(gh:PTR TO guihandle) HANDLE + -> Open library safely. + gadtoolsbase:=openlibrary('gadtools.library') + gh.gt_isopen:=TRUE +#ifdef EASY_EXTRAS + -> Window IDCMP port. + IF gh.mh + -> If multi-window then share port. + gh.wndport:=gh.mh.wndport + -> Also, share the *complete* signal mask. + -> (This ensures that guimessage() works...) + gh.sig:=gh.mh.sig + ELSE +#endif + gh.wndport:=makeport() + gh.sig:=Shl(1,gh.wndport.sigbit) +#ifdef EASY_EXTRAS + ENDIF +#endif +#ifdef EASY_APPWINDOW + -> Open library safely. + workbenchbase:=openlibrary('workbench.library') + gh.wb_isopen:=TRUE +#ifdef EASY_EXTRAS + -> AppWindow port + IF gh.mh + -> If multi-window then share port (even if no awproc) + -> (This ensures that guimessage() works...) + gh.awport:=gh.mh.awport + ELSEIF gh.awproc +#endif +#ifndef EASY_EXTRAS + IF gh.awproc +#endif + gh.awport:=makeport() + gh.sig:=gh.sig OR Shl(1,gh.awport.sigbit) + ELSE + gh.awport:=NIL + ENDIF +#endif +EXCEPT + cleaninit(gh) + ReThrow() +ENDPROC + +/********** openwin() **********/ +EXPORT PROC openwin(gh:PTR TO guihandle) + IF gh.pwnd=NIL + -> Set up screen. + IF gh.is_wb + IF gh.scr=NIL THEN gh.scr:=LockPubScreen(NIL) + IF gh.scr=NIL THEN RaiseX("GUI",417,'Could not lock default public screen (Workbench?). Is it open?') + ENDIF + -> Set up font. + IF gh.ta_scr THEN gh.tattr:=gh.scr.font + -> Set up window and GUI. + setgui(gh) + -> Set up menus. + setmenus(gh) +#ifdef EASY_EXTRAS + -> If multi then bump count of open windows. + IF gh.mh THEN gh.mh.opencount:=gh.mh.opencount+1 +#endif + ENDIF +ENDPROC gh + +#ifdef EASY_EXTRAS +/********** changescreen() **********/ +EXPORT PROC changescreen(gh:PTR TO guihandle,scr=NIL) + IF gh.wnd=NIL THEN initscr(gh,scr) +ENDPROC + +/********** changefont() **********/ +EXPORT PROC changefont(gh:PTR TO guihandle,tattr=NIL) + IF gh.wnd=NIL THEN initfont(gh,tattr) +ENDPROC + +/********** changewintype() **********/ +EXPORT PROC changewintype(gh:PTR TO guihandle,wintype=WTYPE_SIZE) + IF gh.wnd=NIL THEN gh.wtype:=wintype +ENDPROC + +/********** changeinfo() **********/ +EXPORT PROC changeinfo(gh:PTR TO guihandle,info=-1) + gh.info:=IF info<>-1 THEN info ELSE gh +ENDPROC + +/********** changetitle() **********/ +EXPORT PROC changetitle(gh:PTR TO guihandle,windowtitle=NIL) + IF gh.wnd + IF (windowtitle=NIL) OR (gh.wtype>WTYPE_BASIC) + SetWindowTitles(gh.wnd, windowtitle, -1) + ENDIF + ENDIF + gh.wtitle:=windowtitle +ENDPROC + +/********** changemenus() **********/ +EXPORT PROC changemenus(gh:PTR TO guihandle,newmenus=NIL) HANDLE + IF gh.wnd THEN removemenus(gh) + gh.newmenus:=newmenus + IF gh.wnd THEN setmenus(gh) +EXCEPT + removemenus(gh) + ReThrow() +ENDPROC + +/********** changegui() **********/ +EXPORT PROC changegui(gh:PTR TO guihandle,gui) + IF gui + IF gh.pwnd THEN removegui(gh) + gh.gui:=gui + IF gh.pwnd THEN setgui(gh) + ENDIF +ENDPROC + +/********** movewin() **********/ +EXPORT PROC movewin(gh:PTR TO guihandle,x=-1,y=-1) + DEF w:PTR TO window + IF w:=gh.wnd + MoveWindow(w, IF x=-1 THEN 0 ELSE (x-w.leftedge), + IF y=-1 THEN 0 ELSE (y-w.topedge)) + ENDIF +ENDPROC + +/********** sizewin() **********/ +EXPORT PROC sizewin(gh:PTR TO guihandle,xs=-1,ys=-1) + DEF w:PTR TO window + IF w:=gh.wnd + SizeWindow(w, IF xs=-1 THEN 0 ELSE (xs-w.width), + IF ys=-1 THEN 0 ELSE (ys-w.height)) + ENDIF +ENDPROC + +-> Try setting window limits a few times. +PROC setwinlimits(w,minx,miny,maxx,maxy) + DEF i + FOR i:=0 TO 3 + EXIT WindowLimits(w,minx,miny,maxx,maxy) + Delay(1) + ENDFOR +ENDPROC + +/********** blockwin() **********/ +EXPORT PROC blockwin(gh:PTR TO guihandle) + DEF lib:PTR TO lib,c,w:PTR TO window + gh.blockcnt:=(c:=gh.blockcnt)+1 + IF c=0 + -> Only works if window open and not already blocked. + IF (w:=gh.wnd) AND (gh.req=NIL) + -> Only allow window refresh messages. + ModifyIDCMP(w, IDCMP_REFRESHWINDOW) + -> Stop window sizing. + setwinlimits(w,w.width,w.height,w.width,w.height) + NEW gh.req + -> Block window with requester. + InitRequester(gh.req) + Request(gh.req, w) + lib:=intuitionbase + IF lib.version>=39 THEN SetWindowPointerA(w,[WA_BUSYPOINTER,TRUE, + WA_POINTERDELAY,TRUE,NIL]) + ENDIF + ENDIF +ENDPROC + +/********** unblockwin() **********/ +EXPORT PROC unblockwin(gh:PTR TO guihandle) + DEF lib:PTR TO lib,c,w:PTR TO window + IF (c:=gh.blockcnt)>0 + gh.blockcnt:=c-1 + IF c=1 + -> Only works if window open and blocked. + IF (w:=gh.wnd) AND (gh.req<>NIL) + -> Remove requester. + EndRequest(gh.req, w) + -> Reset window limits. + setwinlimits(w,gh.xsize,gh.ysize, + IF DoesXResize(gh.base.flags) THEN -1 ELSE gh.xsize, + IF DoesYResize(gh.base.flags) THEN -1 ELSE gh.ysize) + -> Reset IDCMP. + ModifyIDCMP(w, WIN_IDCMP) + END gh.req + lib:=intuitionbase + IF lib.version>=39 THEN SetWindowPointerA(w,[WA_BUSYPOINTER,FALSE,NIL]) + ENDIF + ENDIF + ENDIF +ENDPROC +#endif + +#ifdef EASY_APPWINDOW +-> Handle AppWindow messages. +PROC appwmessage(port) HANDLE + DEF ret,data,list:PTR TO LONG,amsg=NIL:PTR TO appmessage,gh:PTR TO guihandle, + pl:PTR TO plugin + IF port + WHILE amsg:=GetMsg(port) + -> Get guihandle from message ID. + gh:=amsg.id + -> See if any PLUGIN wants it. + pl:=gh.plugins + WHILE pl + IF OptATTR(pl.base.list,PLG_APPW)=NIL THEN JUMP plugin_appw_skip + EXIT pl.appmessage(amsg,gh.pwnd) +plugin_appw_skip: + pl:=pl.next + ENDWHILE + ret:=NIL + data:=NIL + -> Get awproc (in ret) and data. + IF pl + ret:=OptATTR(pl.base.list,PLG_APPW) + data:=pl + ELSE + IF list:=findxy(gh,amsg.mousex,amsg.mousey) + SELECT MAXGUI OF ATTR(list,EG_TYPE) + CASE BUTTON, SBUTTON, RBUTTON + ret:=OptATTR(list,BUT_APPW) + data:=OptDefATTR(list,BUT_DATA) + CASE LISTV + ret:=OptATTR(list,LST_APPW) + data:=OptDefATTR(list,LST_DATA) + CASE STR + ret:=OptATTR(list,STR_APPW) + data:=OptDefATTR(list,STR_DATA) + ENDSELECT + ENDIF + ENDIF + -> If no gadget awproc then use window one. + IF ret=NIL + ret:=amsg.userdata + data:=NIL + ENDIF + -> Call the awproc. + IF ret THEN ret(data,gh.info,amsg) + -> Now we can reply to the message. + ReplyMsg(amsg) + amsg:=NIL + ENDWHILE + ENDIF +EXCEPT + -> Still need to reply if exception happened at a bad point + IF amsg THEN ReplyMsg(amsg) + ReThrow() +ENDPROC +#endif + +-> Handle menu messages. +PROC menumessage(gh:PTR TO guihandle,code) HANDLE + DEF ret=GUI_CONT,menunum,item:PTR TO menuitem + menunum:=Unsigned(code) + -> Stop if the window's gone away. + WHILE (menunum<>MENUNULL) AND gh.pwnd + item:=ItemAddress(gh.menus,menunum) + -> Get action value/function. + ret:=GTMENUITEM_USERDATA(item) + -> Stop if action value. + EXIT IsActionFun(ret)=FALSE + gh.menuitem:={item} + -> Call action function. + ret(NIL,NIL,gh.info) + ret:=GUI_CONT + EXIT item=NIL + menunum:=Unsigned(item.nextselect) + ENDWHILE +EXCEPT DO + gh.menuitem:=NIL + ReThrow() +ENDPROC ret + +-> Handle GadTools/window messages. +PROC gtmessage(port) HANDLE + DEF ret=GUI_CONT,mes=NIL:PTR TO intuimessage,type,gh:PTR TO guihandle, + gs:PTR TO gadget,list:PTR TO LONG,code,pl:PTR TO plugin,qual + WHILE mes:=Gt_GetIMsg(port) + -> Get guihandle from window userdata. + gh:=mes.idcmpwindow.userdata + -> See if any PLUGIN wants it. + pl:=gh.plugins + WHILE pl + EXIT pl.message_test(mes,gh.pwnd) + pl:=pl.next + ENDWHILE + -> Copy important bits of the message. + type:=mes.class + code:=mes.code + gs:=mes.iaddress + qual:=Unsigned(mes.qualifier) + -> Now we can reply to the message. + Gt_ReplyIMsg(mes) + mes:=NIL + IF pl + -> Call the PLUGIN's action function if necessary. + IF pl.message_action(type,qual,code,gh.pwnd) + ret:=ATTR(pl.base.list,PLG_ACT) + IF IsActionFun(ret) + ret(gh.info,pl) + ret:=GUI_CONT + ENDIF + ENDIF + ELSE + -> Gadget click. + IF type AND GAD_IDCMP +->WriteF('type=$\h, code=$\h, gad=$\h\n', type, code, gs) + -> Protect from stray IDCMP_MOUSEMOVE. + IF gs AND (gs<>gh.pwnd) + -> Get gadget description list. + list:=gs.userdata + -> Set new attribute. + performset(gs,code,list) + -> Get action value/function. + ret:=ATTR(list,EG_ACT) + IF IsActionFun(ret) + performaction(ret,gs,gh.info,code,list,qual) + ret:=GUI_CONT + ENDIF + ENDIF +#ifdef EASY_KEYBOARD + -> Key press. + ELSEIF type=IDCMP_VANILLAKEY + ret:=performkey(gh,code) +#endif + -> Window refresh. + ELSEIF type=IDCMP_REFRESHWINDOW + Gt_BeginRefresh(gh.pwnd) + Gt_EndRefresh(gh.pwnd,TRUE) + -> Window size change. + ELSEIF type=IDCMP_NEWSIZE + -> Remove the gadgets, clear and recreate. + removegads(gh) + clearwindow(gh.pwnd) + gh.glist:=rendergui(gh) + -> Close gadget click. + ELSEIF type=IDCMP_CLOSEWINDOW + -> Find action value/function. + ret:=gh.onclose + IF IsActionFun(ret) +#ifdef EASY_EXTRAS + ret(gh.mh,gh.info) +#endif +#ifndef EASY_EXTRAS + ret(NIL,gh.info) +#endif + ret:=GUI_CONT + ENDIF + -> Menu choice(s). + ELSEIF type=IDCMP_MENUPICK + ret:=menumessage(gh,code) + ENDIF + ENDIF + EXIT ret<>GUI_CONT + ENDWHILE +#ifdef EASY_EXTRAS + IF ret<>GUI_CONT THEN IF gh.mh THEN cleangui(gh) +#endif +EXCEPT + -> Still need to reply if exception happened in PLUGIN message_test(). + IF mes THEN Gt_ReplyIMsg(mes) + ReThrow() +ENDPROC ret + +#ifdef EASY_EXTRAS +/********** multiinit() **********/ +EXPORT PROC multiinit() HANDLE + DEF mh=NIL:PTR TO multihandle + NEW mh + newList(mh.guis) + mh.wndport:=makeport() + mh.sig:=Shl(1,mh.wndport.sigbit) +#ifdef EASY_APPWINDOW + mh.awport:=makeport() + mh.sig:=mh.sig OR Shl(1,mh.awport.sigbit) +#endif +EXCEPT + cleanmulti(mh) + ReThrow() +ENDPROC mh + +/********** addmultiA() **********/ +EXPORT PROC addmultiA(mh:PTR TO multihandle,title,gui,tags=NIL) HANDLE + DEF gh=NIL:PTR TO guihandle + gh:=makehandle(title,gui,mh,tags) + IF mh THEN AddHead(mh.guis,gh.link) +EXCEPT + -> Stop the user cleanup in this case. + gh.onclean:=NIL + cleangui(gh) + ReThrow() +ENDPROC gh + +/********** multiforall() **********/ +EXPORT PROC multiforall(varaddr:PTR TO LONG,mh:PTR TO multihandle,expr) IS + multieval(varaddr,mh,expr,FALSE) + +/********** multiexists() **********/ +EXPORT PROC multiexists(varaddr:PTR TO LONG,mh:PTR TO multihandle,expr) IS + multieval(varaddr,mh,expr,TRUE) + +-> Evaluate and maybe stop... +PROC multieval(varaddr:PTR TO LONG,mh:PTR TO multihandle,expr,exists) + DEF node:PTR TO ln, next, this, res + -> If empty then TRUE for forall, but FALSE for exists + res:=(exists=FALSE) + IF mh + node:=mh.guis.head + WHILE next:=node.succ + varaddr[]:=node-GH_LINK_OFFSET + IF this:=Eval(expr) + -> If exists then we've found a match. + IF exists THEN RETURN this + ELSE + -> Forall is FALSE. Exists is still FALSE. + res:=FALSE + ENDIF + node:=next + ENDWHILE + ENDIF + -> Invalidate for case where exists fails. + varaddr[]:=NIL +ENDPROC res + +/********** multiempty() **********/ +EXPORT PROC multiempty(mh:PTR TO multihandle) IS mh.guis.tailpred=mh.guis + +/********** multiloop() **********/ +EXPORT PROC multiloop(mh:PTR TO multihandle) + DEF res=-1 + WHILE res<0 + EXIT mh.opencount=0 + Wait(mh.sig) + res:=multimessage(mh) + ENDWHILE +ENDPROC res + +/********** cleanmulti() **********/ +EXPORT PROC cleanmulti(mh:PTR TO multihandle) + IF mh + -> Clean up any remaining guihandles. + WHILE multiempty(mh)=FALSE DO cleangui(mh.guis.head-GH_LINK_OFFSET) +#ifdef EASY_APPWINDOW + IF mh.awport + DeleteMsgPort(mh.awport) + mh.awport:=NIL + ENDIF +#endif + IF mh.wndport + DeleteMsgPort(mh.wndport) + mh.wndport:=NIL + ENDIF + END mh + ENDIF +ENDPROC + +/********** checkmulti() **********/ +EXPORT PROC checkmulti(mh:PTR TO multihandle) + DEF ret + -> Check if there a message waiting on our ports. + IF SetSignal(0,0) AND mh.sig + IF (ret:=multimessage(mh))>=0 THEN quitgui(ret) + ENDIF +ENDPROC +#endif + +-> Note: as long as gh is valid, guimessage() can be used in place of +-> multimessage() for multi-window GUIs. But remember that gh could +-> be invalidated by an action function when guimessage() is called. + +/********** guimessage() **********/ +/********** multimessage() **********/ +#ifdef EASY_APPWINDOW +EXPORT PROC guimessage(gh:PTR TO guihandle) IS message(gh.wndport,gh.awport) +#ifdef EASY_EXTRAS +EXPORT PROC multimessage(mh:PTR TO multihandle) IS message(mh.wndport,mh.awport) +#endif +#endif +#ifndef EASY_APPWINDOW +EXPORT PROC guimessage(gh:PTR TO guihandle) IS message(gh.wndport,NIL) +#ifdef EASY_EXTRAS +EXPORT PROC multimessage(mh:PTR TO multihandle) IS message(mh.wndport,NIL) +#endif +#endif + +-> Handle messages from the ports. +PROC message(wndport,awport) HANDLE + DEF ret=-1 +#ifdef EASY_APPWINDOW + appwmessage(awport) +#endif + ret:=gtmessage(wndport) +EXCEPT + -> If we got "QUIT" then return value is in exceptioninfo. + IF exception="QUIT" + ret:=exceptioninfo + ELSE + ReThrow() + ENDIF +ENDPROC ret + +/********** quitgui() **********/ +EXPORT PROC quitgui(ret=0) IS Throw("QUIT",ret) + +-> Note: as above, checkgui() is safe for multi-window GUIs as long as +-> gh is valid. + +/********** checkgui() **********/ +EXPORT PROC checkgui(gh:PTR TO guihandle) + DEF ret + -> Check if there a message waiting on our ports. + IF SetSignal(0,0) AND gh.sig + IF (ret:=guimessage(gh))>=0 THEN quitgui(ret) + ENDIF +ENDPROC + +-> Remove menus and reset handle. +PROC removemenus(gh:PTR TO guihandle) + IF gh.menus + -> Hack to prevent the item.nextselect if closed from menu action function. + IF gh.menuitem THEN gh.menuitem[]:=NIL + IF gh.pwnd THEN ClearMenuStrip(gh.pwnd) + FreeMenus(gh.menus) + gh.menus:=NIL + ENDIF +ENDPROC + +-> Remove GUI and reset handle. +PROC removegui(gh:PTR TO guihandle) + clean(gh.base) + gh.base:=NIL + removegads(gh) + gh.glist:=NIL + gh.plugins:=NIL +ENDPROC + +-> Check if is this an IDCMP message for the window. +PROC testintuimsg(msg:PTR TO intuimessage,data) IS msg.idcmpwindow=data + +#ifdef EASY_APPWINDOW +-> Check if is this an appmessage for the AppWindow. +PROC testappwmsg(msg:PTR TO appmessage,data) IS msg.id=data +#endif + +-> Selectively remove messages from the port. +PROC clearmsgs(mp:PTR TO mp,f,data) + DEF msg:PTR TO mn, succ + -> Must be in Forbid()/Permit() brackets... + Forbid() + msg:=mp.msglist.head + WHILE succ:=msg.ln.succ + IF f(msg,data) + Remove(msg) + ReplyMsg(msg) + ENDIF + msg:=succ + ENDWHILE + Permit() +ENDPROC + +-> Create a new message port. +PROC makeport() + DEF port:PTR TO mp + IF (port:=CreateMsgPort())=NIL THEN RaiseX("GUI",1065,'Could not create message port. Run out of signal bits?') +ENDPROC port + +-> Clean initialisation stuff and reset handle. +PROC cleaninit(gh:PTR TO guihandle) + -> Clean ports. +#ifdef EASY_APPWINDOW +#ifdef EASY_EXTRAS + IF (gh.mh=NIL) AND gh.awport THEN DeleteMsgPort(gh.awport) +#endif +#ifndef EASY_EXTRAS + IF gh.awport THEN DeleteMsgPort(gh.awport) +#endif + gh.awport:=NIL + IF gh.wb_isopen + CloseLibrary(workbenchbase) + gh.wb_isopen:=FALSE + ENDIF +#endif +#ifdef EASY_EXTRAS + IF (gh.mh=NIL) AND gh.wndport THEN DeleteMsgPort(gh.wndport) +#endif +#ifndef EASY_EXTRAS + IF gh.wndport THEN DeleteMsgPort(gh.wndport) +#endif + gh.wndport:=NIL + IF gh.gt_isopen + CloseLibrary(gadtoolsbase) + gh.gt_isopen:=FALSE + ENDIF +ENDPROC + +/********** cleangui() **********/ +EXPORT PROC cleangui(gh:PTR TO guihandle) + DEF f + IF gh + -> Close window if necessary. + closewin(gh) + IF f:=gh.onclean THEN f(gh.info) + cleaninit(gh) +#ifdef EASY_EXTRAS + IF gh.mh + -> Unlink from multi-window list. + Remove(gh.link) + gh.mh:=NIL + ENDIF +#endif + END gh + ENDIF +ENDPROC + +/********** closewin() **********/ +EXPORT PROC closewin(gh:PTR TO guihandle) + DEF w:PTR TO window + IF w:=gh.wnd + -> Remember window size and position. + gh.x:=w.leftedge + gh.y:=w.topedge + gh.xsize:=w.width + gh.ysize:=w.height +#ifdef EASY_EXTRAS + gh.blockcnt:=1 -> Force unblock, if necessary. + unblockwin(gh) -> Just in case! +#endif + removegui(gh) + removemenus(gh) +#ifdef EASY_APPWINDOW + IF gh.appwin + RemoveAppWindow(gh.appwin) + gh.appwin:=NIL + ENDIF + -> Remove any last minute messages safely. + IF gh.awport THEN clearmsgs(gh.awport,{testappwmsg},gh) +#endif + IF w + -> Must be in Forbid()/Permit() brackets. + Forbid() + -> Remove any last minute messages safely. + clearmsgs(gh.wndport,{testintuimsg},w) + -> Make sure no more messages get sent. + w.userport:=NIL + ModifyIDCMP(w,0) + Permit() + -> Now the window can be closed safely. + CloseWindow(w) + gh.pwnd:=NIL + ENDIF + stdrast:=NIL + IF gh.visual + FreeVisualInfo(gh.visual) + gh.visual:=NIL + ENDIF +#ifdef EASY_EXTRAS + -> If multi then decrement count of open windows. + IF gh.mh THEN gh.mh.opencount:=gh.mh.opencount-1 +#endif + IF gh.is_wb + IF gh.scr THEN UnlockPubScreen(NIL,gh.scr) + gh.scr:=NIL + ENDIF + -> If the font is linked to the screen, it's no longer valid. + IF gh.ta_scr THEN gh.tattr:=NIL + ENDIF +ENDPROC + +-> Render the gadgets on the window. +PROC rendergui(gh:PTR TO guihandle) + DEF glist=0,w:PTR TO window,base:PTR TO g + w:=gh.pwnd + base:=gh.base + gh.gl:=CreateContext({glist}) + IF gh.gl=NIL THEN RaiseX("GUI",1183,'Could not create gadget context. Out of memory?') + stdrast:=w.rport + -> Adjust intermediate gadgets to be real gadgets fitting in window. + adjust(base, gh.xoff,gh.yoff, + w.width-gh.xsize+base.xs,w.height-gh.ysize+base.ys, gh) + AddGList(w,glist,-1,-1,NIL) +#ifndef EASY_KEYBOARD + -> If no keyboard support, activate first sting gadget. + IF gh.firststr THEN ActivateGadget(gh.firststr,w,NIL) +#endif + RefreshGList(glist,w,NIL,-1) + Gt_RefreshWindow(w,NIL) + -> Set public pointer, as a flag to say it's OK to play with the GUI, now. + gh.wnd:=w +ENDPROC glist + +-> Remove PLUGINs and gadgets from window. +PROC removegads(gh:PTR TO guihandle) + DEF pl:PTR TO plugin + -> Set public pointer to NIL, to say it's no longer safe to play with the GUI. + gh.wnd:=NIL + pl:=gh.plugins + WHILE pl + pl.clear_render(gh.pwnd) + pl:=pl.next + ENDWHILE + IF gh.glist + RemoveGList(gh.pwnd,gh.glist,-1) + FreeGadgets(gh.glist) + ENDIF +ENDPROC + +-> Decide what the real screen bottom is by getting size gadget height. +PROC getrealbot(s:PTR TO screen) + DEF dri,bot,im:PTR TO image + bot:=s.wborbottom + IF dri:=GetScreenDrawInfo(s) + IF im:=NewObjectA(NIL,'sysiclass', + [SYSIA_DRAWINFO,dri, SYSIA_WHICH,SIZEIMAGE, + SYSIA_SIZE,SysISize(s.flags), NIL]) + bot:=im.height + DisposeObject(im) + ENDIF + FreeScreenDrawInfo(s,dri) + ENDIF +ENDPROC bot + +#ifdef EASY_KEYBOARD +-> Fiddled so actually one less than length... +PROC execlistlen(list:PTR TO mlh) + DEF len=-1, node:PTR TO mln + -> Catch the case where the LISTV is being cleanly updated. + IF list<>-1 + IF list + node:=list.head + WHILE node:=node.succ DO len++ + ENDIF + ENDIF +ENDPROC len + +-> Do action appropriate to key press. +PROC performkey(gh:PTR TO guihandle,code) + DEF list:PTR TO LONG,ret,val,tag,index,data,gad=NIL:PTR TO gadget,inc + -> Look up gadget in key index. + IF islower(code) -> Positive action + gad:=gh.keys[code-"a"] + inc:=TRUE + ELSEIF isupper(code) -> Negative action + gad:=gh.keys[code-"A"] + inc:=FALSE + ENDIF + IF gad=NIL THEN RETURN GUI_CONT +/* Ack! Doesn't work under OS2.0... +#ifdef EASY_EXTRAS + Gt_GetGadgetAttrsA(gad,gh.pwnd,NIL,[GA_DISABLED,{ret},NIL]) + IF ret THEN RETURN GUI_CONT +#endif +*/ + list:=gad.userdata + ret:=ATTR(list,EG_ACT) +#ifdef EASY_EXTRAS + -> If disabled then don't react. + IF optdis(gad.gadgetid,list) THEN RETURN GUI_CONT +#endif + -> Tag is TRUE if a button. + data,tag:=indexdata(gad.gadgetid) + data:=OptDefATTR(list,data) + SELECT MAXGUI OF gad.gadgetid + -> Just press button. + -> CASE BUTTON,SBUTTON,RBUTTON + CASE STR,INTEGER + -> Activate string and integer gadgets. + ActivateGadget(gad,gh.pwnd,NIL) + CASE CHECK + -> Toggle check gadgets. + tag:=GTCB_CHECKED + index:=CHK_VAL + val:=(IsChecked(gad)=FALSE) + CASE MX + -> Next/prev item, wrapping. + tag:=GTMX_ACTIVE + index:=ListLen(ATTR(list,MX_LIST))-2 + val:=ATTR(list,MX_CURR) + IF inc + IF val++>=index THEN val:=0 + ELSE + IF val--<0 THEN val:=index + ENDIF + index:=MX_CURR + CASE CYCLE + -> Next/prev item, wrapping. + tag:=GTCY_ACTIVE + index:=ListLen(ATTR(list,CYC_LIST))-2 + val:=ATTR(list,CYC_CURR) + IF inc + IF val++>=index THEN val:=0 + ELSE + IF val--<0 THEN val:=index + ENDIF + index:=CYC_CURR + CASE SCROLL + -> Inc/dec, stopping at ends. + tag:=GTSC_TOP + val:=ATTR(list,SCR_TOP) + IF inc + IF val++>=(ATTR(list,SCR_TOTL)-ATTR(list,SCR_VIS)) THEN tag:=0 + ELSE + IF val--<0 THEN tag:=0 + ENDIF + index:=SCR_TOP + CASE SLIDE + -> Inc/dec, stopping at ends. + tag:=GTSL_LEVEL + val:=ATTR(list,SLI_CURR) + IF inc + IF val++>=ATTR(list,SLI_MAX) THEN tag:=0 + ELSE + IF val-- Next/prev, stopping at ends. + tag:=GTLV_SELECTED + val:=ATTR(list,LST_CURR) + IF inc + IF val++>=execlistlen(ATTR(list,LST_LIST)) THEN tag:=0 + ELSE + IF val--<0 THEN tag:=0 + ENDIF + index:=LST_CURR + CASE PALETTE + -> Next/prev, wrapping. + tag:=GTPA_COLOR + val:=ATTR(list,PAL_CURR) + index:=Shl(1,ATTR(list,PAL_DEP))-1 + IF inc + IF val++>=index THEN val:=0 + ELSE + IF val--<0 THEN val:=index + ENDIF + index:=PAL_CURR + ENDSELECT + -> Perform change if required. + IF tag + IF tag<>TRUE -> If not a button (non-zero is tag value). + setgadattr(gad,gh.pwnd,list,val,tag,index) + IF gad.gadgetid=LISTV THEN setgadattr(gad,gh.pwnd,list,val,GTLV_MAKEVISIBLE) + ENDIF + -> Do action. + IF IsActionFun(ret) + -> If button (non-zero is tag value). + IF tag=TRUE THEN ret(0,data,gh.info) ELSE ret(0,data,gh.info,val) + ret:=GUI_CONT + ENDIF + ELSE + ret:=GUI_CONT + ENDIF +ENDPROC ret +#endif + +-> Call action function based on new code. +PROC performaction(fun,gad:PTR TO gadget,info,code,l:PTR TO LONG,qual) + DEF data,but,val + data,but,val:=indexdata(gad.gadgetid) + data:=OptDefATTR(l,data) +ENDPROC (IF but THEN fun(qual,data,info) ELSE + fun(qual,data,info,IF val THEN ATTR(l,val) ELSE code)) + +/********** getstr **********/ +EXPORT PROC getstr(gh,g) IS gadstr(g,findgadget(gh,g)) + +/********** getinteger **********/ +EXPORT PROC getinteger(gh,g) IS gadinteger(g,findgadget(gh,g)) + +-> Copy buffer string to gadget E-string. +PROC gadstr(l:PTR TO LONG, gad:PTR TO gadget) IS + IF gad THEN StrCopy(ATTR(l,STR_STR),GadString(gad)) ELSE 0 + +-> Copy buffer integer to gadget integer. +PROC gadinteger(l:PTR TO LONG, gad:PTR TO gadget) + DEF x=0 + IF gad THEN ATTR(l,INT_VAL):=x:=GadLongInt(gad) +ENDPROC x + +-> Record new gadget value. +PROC performset(gad:PTR TO gadget,code,l:PTR TO LONG) + SELECT MAXGUI OF gad.gadgetid + CASE STR; gadstr(l,gad) + CASE INTEGER; gadinteger(l,gad) + CASE CHECK; ATTR(l,CHK_VAL):=IsChecked(gad) + CASE MX; ATTR(l,MX_CURR):=code + CASE CYCLE; ATTR(l,CYC_CURR):=code + CASE SCROLL; ATTR(l,SCR_TOP):=code + CASE SLIDE; ATTR(l,SLI_CURR):=code + CASE LISTV; ATTR(l,LST_CURR):=code + CASE PALETTE; ATTR(l,PAL_CURR):=code + ENDSELECT +ENDPROC + +-> Clean gadget description objects. +PROC clean(base:PTR TO g) + DEF i:PTR TO g,j + IF base + IF IsRowOrCol(base.type) + i:=base.list + WHILE i + j:=i + i:=i.next + clean(j) + ENDWHILE + ELSEIF IsBevel(base.type) + clean(base.list) + ENDIF + END base + ENDIF +ENDPROC + +-> Length of text, ignoring a "_" if present. +#ifdef EASY_KEYBOARD +#define textlenkey(s,g,k) textlen_key(s,g,k) +#endif +#ifndef EASY_KEYBOARD +#define textlenkey(s,g,k) textlen(s,g) +#endif + +-> Calculate minimum size for a PALETTE gadget showing depth d +-> Ack! Fiddled to compensate for OS2.0 indicator +PROC min_pal(x,y,d) + DEF dy + IF (x+y)=0 THEN RETURN RaiseX("Egui",1441,'Bad PALETTE gadget sizes.') + dy:=Div(Mul(y,d),x+y) +ENDPROC Max(Mul(Shl(1,d-dy),7)+21,x), Max(Shl(4,dy)+3,y) + +-> Calculate minimum size of GUI. +PROC minsize(gui:PTR TO LONG,gh:PTR TO guihandle,isinrows=TRUE,eql=FALSE) + DEF p:PTR TO g,h,minargs,a,b:PTR TO LONG,c,pl:PTR TO plugin,type, + ta:PTR TO textattr + minargs:=minARGS() + ta:=gh.tattr + h:=ta.ysize + type:=ATTR(gui,EG_TYPE) + IF (type<0) OR (type>=MAXGUI) THEN RaiseX("Egui",gui,'Bad gadget type.') + IF (ListLen(gui) Calculate minimum size of group. +PROC foreach(guilist:PTR TO LONG,type,gh:PTR TO guihandle,row,eq) + DEF l,x=0,y=0,z=0,zmid=NO_MID,zother=0,a,p:PTR TO g,list=NIL, + last:PTR TO g,resize=0,xs,t + last:={list} + l:=ListLen(guilist)-1 + FOR a:=1 TO l + p:=minsize(guilist[a],gh,row,eq) + resize:=resize OR p.flags + xs:=p.xs + IF row + x:=Max(xs,x) + y:=y+p.ys+IF y THEN YSPACING ELSE 0 + ELSE + y:=Max(p.ys,y) + x:=x+xs+IF x THEN XSPACING ELSE 0 + ENDIF + z:=Max(z,xs) -> for EQ(ROWS/COLS) + t:=p.mid + zmid:=Max(zmid,t) + zother:=Max(zother,IF t<>NO_MID THEN (xs-t) ELSE xs) + last.next:=p + last:=p + ENDFOR + IF eq + last:=list + z:=IF zmid<>NO_MID THEN (zmid+zother) ELSE zother + WHILE last + last.xs:=z + last.mid:=IF last.mid<>NO_MID THEN zmid ELSE 0 + last:=last.next + ENDWHILE + x:=IF row THEN z ELSE (z+XSPACING*l-XSPACING) + ENDIF + resize:=(IF DoesXUncond(resize) THEN RESIZEX ELSE 0) OR + (IF DoesYUncond(resize) THEN RESIZEY ELSE 0) +ENDPROC newg(x,y,type,list,resize) + +-> Calculate real positions and sizes, and create real gadgets. +PROC adjust(base:PTR TO g,x,y,xs,ys,gh:PTR TO guihandle,isinrow=TRUE) + DEF pl:PTR TO plugin + IF DoesXResize(base.flags)=FALSE THEN (x:=xs-base.xs/2+x) BUT xs:=base.xs + IF DoesYResize(base.flags)=FALSE THEN (y:=ys-base.ys/2+y) BUT ys:=base.ys + SELECT MAXGUI OF base.type + CASE ROWS,EQROWS,COLS,EQCOLS + adjustall(base,x,y,xs,ys,gh) + CASE BEVEL,BEVELR + adjust(base.list,BEVELXSPACE+x,BEVELYSPACE+y, + xs-(BEVELXSPACE*2),ys-(BEVELYSPACE*2),gh) + DrawBevelBoxA(gh.pwnd.rport,x,y,xs,ys, + [GT_VISUALINFO,gh.visual,GTBB_FRAMETYPE,BBFT_BUTTON, + IF base.type=BEVELR THEN GTBB_RECESSED ELSE TAG_IGNORE,0,NIL]) + CASE BAR + IF isinrow + Line(x,y+1,x+xs-1,y+1,1) + Line(x,y+2,x+xs-1,y+2,2) + ELSE + Line(x+1,y,x+1,y+ys-1,1) + Line(x+2,y,x+2,y+ys-1,2) + ENDIF + CASE PLUGIN + pl:=ATTR(base.list,PLG_OBJ) + pl.x:=x; pl.y:=y; pl.xs:=xs; pl.ys:=ys + IF OptATTR(base.list,PLG_GT) + gh.gl:=pl.gtrender(gh.gl,gh.visual,gh.tattr,x,y,xs,ys,gh.pwnd) + ELSE + pl.render(gh.tattr,x,y,xs,ys,gh.pwnd) + ENDIF + DEFAULT + base.x:=x; base.y:=y + creategadget(base,xs,ys,gh) + ENDSELECT +ENDPROC x+xs+XSPACING,y+ys+YSPACING + +-> adjust over column and row groups. +PROC adjustall(base:PTR TO g,x,y,xs,ys,gh) + DEF p:PTR TO g,rs=0,fs=0,sp=0,ds=0,t,rg=0,u,row + -> fs is fixed-width total, rs is resize total + -> ds is gad count, sp is space gad count + p:=base.list + row:=IsRow(base.type) + WHILE p + t:=IF row THEN p.ys ELSE p.xs + IF (row AND DoesYResize(p.flags)) OR (row=FALSE AND DoesXResize(p.flags)) + IF t<=0 THEN sp++ ELSE ((rs:=rs+t) BUT rg++) + ELSE + fs:=fs+t + ENDIF + p:=p.next + ds++ + ENDWHILE + p:=base.list + ds:=(IF row THEN ys ELSE xs)-rs-fs-(ds-1*IF row THEN YSPACING ELSE XSPACING) + -> ds is now difference in space reqts + WHILE p + t:=IF row THEN p.ys ELSE p.xs + IF (row AND DoesYResize(p.flags)) OR (row=FALSE AND DoesXResize(p.flags)) + IF t<=0 + IF rg + IF row THEN ys:=0 ELSE xs:=0 + ELSE -> If only space gads can resize... + fs:=((sp-1)/2+ds)/sp -> Share space completely and fairly + ds:=ds-fs + sp-- + IF row THEN ys:=fs ELSE xs:=fs + ENDIF + ELSE + fs:=((t*ds)+((rs-1)/2))/rs -> Share space completely and fairly + ds:=ds-fs + rs:=rs-t + IF row THEN ys:=t+fs ELSE xs:=t+fs + ENDIF + ELSE + IF row THEN ys:=t ELSE xs:=t + ENDIF + t,u:=adjust(p,x,y,xs,ys,gh,row) + IF row THEN y:=u ELSE x:=t + p:=p.next + ENDWHILE +ENDPROC + +-> Create real gadget. +PROC creategadget(base:PTR TO g,lxs,lys,gh:PTR TO guihandle) + DEF tl,i:PTR TO LONG,minargs,text,flags=0,kindtab,h,textl,x,y,xs,ys, + mid,domid=FALSE,key=0,appw=0 + minargs:=minARGS() + -> Args at least two, so not SPACE* (never called for other possibilities) + IF minargs[base.type]>=2 + i:=base.list + h:=gh.tattr.ysize + flags:=PLACETEXT_RIGHT + x:=base.x + y:=base.y + xs:=base.xs + ys:=base.ys + mid:=IF (base.mid<>NO_MID) AND base.mid THEN (base.mid) ELSE 0 + text:=ATTR(i,EG_TXT) -> speculative + IF text=NIL THEN text:='' + SELECT MAXGUI OF base.type + CASE BUTTON,SBUTTON,RBUTTON + tl:=[NIL] + flags:=PLACETEXT_IN + IF HasHButtSp(base.type) THEN xs:=lxs + IF HasVButtSp(base.type) THEN ys:=lys +#ifdef EASY_APPWINDOW + appw:=OptATTR(i,BUT_APPW) +#endif + CASE CHECK + tl:=[GTCB_CHECKED,IF ATTR(i,CHK_VAL) THEN 1 ELSE 0, GTCB_SCALED,TRUE, NIL] + textl:=IF StrLen(text) THEN mid ELSE 0 + x:=x+textl + IF ATTR(i,CHK_LEFT) THEN flags:=PLACETEXT_LEFT + xs:=h*2+2 + ys:=h+1 + CASE LISTV + xs:=ATTR(i,LST_CURR) + tl:=[GTLV_LABELS,ATTR(i,LST_LIST), GTLV_SELECTED,xs, + IF ATTR(i,LST_SHOW)>=1 THEN GTLV_SHOWSELECTED ELSE TAG_IGNORE,NIL, + -> GTLV_SCROLLWIDTH,h*2, + GTLV_READONLY,ATTR(i,LST_RO), +-> IF xs<>-1 THEN GTLV_TOP ELSE TAG_IGNORE, xs, + IF xs<>-1 THEN GTLV_MAKEVISIBLE ELSE TAG_IGNORE, xs, NIL] + flags:=PLACETEXT_ABOVE + xs:=lxs + IF StrLen(text) + ys:=lys-h-6 + y:=y+h+6 + ELSE + ys:=lys + ENDIF +#ifdef EASY_APPWINDOW + appw:=OptATTR(i,LST_APPW) +#endif + CASE MX + tl:=[GTMX_LABELS,ATTR(i,MX_LIST), GTMX_ACTIVE,ATTR(i,MX_CURR), + GTMX_TITLEPLACE,IF ATTR(i,MX_LEFT) THEN PLACETEXT_LEFT ELSE PLACETEXT_RIGHT, + GTMX_SPACING,MXSPACE, GTMX_SCALED,TRUE, NIL] + textl:=IF StrLen(text) THEN mid ELSE 0 + x:=x+textl + IF ATTR(i,MX_LEFT)=FALSE THEN flags:=PLACETEXT_RIGHT + xs:=h + ys:=h + CASE STR + tl:=[GTST_STRING,ATTR(i,STR_STR), STRINGA_REPLACEMODE,OptATTR(i,STR_OVR), + GTST_MAXCHARS,Min(StrMax(ATTR(i,STR_STR)),ATTR(i,STR_MAX)), NIL] + domid:=TRUE +#ifdef EASY_APPWINDOW + appw:=OptATTR(i,STR_APPW) +#endif + CASE INTEGER + tl:=[GTIN_NUMBER,ATTR(i,INT_VAL), GTIN_MAXCHARS,15, NIL] + domid:=TRUE + lxs-- + CASE CYCLE + tl:=[GTCY_LABELS,ATTR(i,CYC_LIST), GTCY_ACTIVE,ATTR(i,CYC_CURR), NIL] + domid:=TRUE + CASE PALETTE + -> Ack! Indicator width is large for OS2.0 compatibility + tl:=[GTPA_DEPTH,ATTR(i,PAL_DEP), GTPA_INDICATORWIDTH,16, + GTPA_COLOR,ATTR(i,PAL_CURR), NIL] + domid:=TRUE + CASE SCROLL + tl:=[GTSC_TOP,ATTR(i,SCR_TOP), GTSC_TOTAL,ATTR(i,SCR_TOTL), + PGA_FREEDOM,IF ATTR(i,SCR_VERT) THEN LORIENT_VERT ELSE LORIENT_HORIZ, + GTSC_VISIBLE,ATTR(i,SCR_VIS), GTSC_ARROWS,12, NIL] + xs:=lxs + ys:=lys + text:='' + CASE SLIDE + tl:=[GTSL_MIN,ATTR(i,SLI_MIN), GTSL_MAX,ATTR(i,SLI_MAX), + GTSL_LEVEL,ATTR(i,SLI_CURR), GTSL_LEVELFORMAT,ATTR(i,SLI_FMT), + PGA_FREEDOM,IF ATTR(i,SLI_VERT) THEN LORIENT_VERT ELSE LORIENT_HORIZ, + GTSL_MAXLEVELLEN,3, NIL] + domid:=TRUE + CASE TEXT + tl:=[GTTX_TEXT,ATTR(i,TXT_VAL), GTTX_BORDER,ATTR(i,TXT_BORD), NIL] + domid:=TRUE + CASE NUM + tl:=[GTNM_NUMBER,ATTR(i,NUM_VAL), GTNM_BORDER,ATTR(i,NUM_BORD), NIL] + domid:=TRUE + ENDSELECT + IF domid + flags:=PLACETEXT_LEFT + textl:=IF StrLen(text) THEN mid ELSE 0 +-> textl:=IF mid<>NO_MID THEN mid ELSE 0 + x:=x+textl + xs:=lxs-textl + ys:=lys + ENDIF +#ifdef EASY_KEYBOARD + key:=optkey(base.type,i) +#endif + kindtab:=kindTAB() + gh.gl:=CreateGadgetA(kindtab[base.type],gh.gl, + [x,y,xs,ys,text,gh.tattr,base.type,flags,gh.visual,NIL]:newgadget, + [IF key THEN GT_UNDERSCORE ELSE TAG_IGNORE,"_", + IF optdis(base.type,i) THEN GA_DISABLED ELSE TAG_IGNORE,TRUE, + TAG_MORE,tl]) + IF gh.gl=NIL THEN RaiseX("GUI",i,'Could not create gadget. Out of memory?') + gh.gl.userdata:=i +#ifdef EASY_APPWINDOW + IF appw THEN gh.gl.mutualexclude:=EG_MAGIC -> AppW magic identifier. +#endif +#ifndef EASY_KEYBOARD + IF base.type=STR THEN IF gh.firststr=NIL THEN gh.firststr:=gh.gl +#endif +#ifdef EASY_KEYBOARD + -> Remember gadget in key index. Key must be lowercase. + IF islower(key) THEN gh.keys[key-"a"]:=gh.gl +#endif + ENDIF +ENDPROC + +/********** findgadget **********/ +EXPORT PROC findgadget(gh:PTR TO guihandle,list) + DEF gad:PTR TO gadget + IF gh.wnd + gad:=gh.glist + WHILE gad + IF gad.userdata=list THEN RETURN gad + gad:=gad.nextgadget + ENDWHILE + ENDIF +ENDPROC NIL + +#ifdef EASY_APPWINDOW +-> Search for gadget desc list based on mouse position. +PROC findxy(gh:PTR TO guihandle,x,y) + DEF gad:PTR TO gadget,offx=0,offy=0 + gad:=gh.glist + WHILE gad + IF gad.mutualexclude=EG_MAGIC -> Then it's an EasyGUI AppW gadget... + -> The only gadgets (so far) have a label on the left or the top, + -> so compensate and calculate the offset. + IF gad.gadgettext + offx:=gad.gadgettext.leftedge + IF offx>0 THEN offx:=0 + offy:=gad.gadgettext.topedge + IF offy>0 THEN offy:=0 + ENDIF + IF x>=(gad.leftedge+offx) THEN + IF y>=(gad.topedge+offy) THEN + IF gad.leftedge+gad.width>x THEN + IF gad.topedge+gad.height>y THEN RETURN gad.userdata + ENDIF + gad:=gad.nextgadget + ENDWHILE +ENDPROC NIL +#endif + +-> Set gadget attribute based on real gadget. +PROC setgadattr(g,w,gad:PTR TO LONG,value,tag,index=0) + IF g THEN Gt_SetGadgetAttrsA(g,w,NIL,[tag,value,NIL]) + IF index THEN ATTR(gad,index):=value +ENDPROC + +-> Set gadget attribute based on gadget desc list. +PROC setattr(gh:PTR TO guihandle,gad,value,tag,index=0) IS + setgadattr(findgadget(gh,gad),gh.wnd,gad,value,tag,index) + +/********** setXXXXX **********/ +EXPORT PROC setcheck(gh,gad,bool) IS setattr(gh,gad,bool,GTCB_CHECKED,CHK_VAL) +EXPORT PROC setinteger(gh,gad,new) IS setattr(gh,gad,new,GTIN_NUMBER,INT_VAL) +EXPORT PROC setmx(gh,gad,active) IS setattr(gh,gad,active,GTMX_ACTIVE,MX_CURR) +EXPORT PROC setcycle(gh,gad,active) IS setattr(gh,gad,active,GTCY_ACTIVE,CYC_CURR) +EXPORT PROC setpalette(gh,gad,colour) IS setattr(gh,gad,colour,GTPA_COLOR,PAL_CURR) +EXPORT PROC setscrolltop(gh,gad,top) IS setattr(gh,gad,top,GTSC_TOP,SCR_TOP) +EXPORT PROC setscrolltotal(gh,gad,total) IS setattr(gh,gad,total,GTSC_TOTAL,SCR_TOTL) +EXPORT PROC setscrollvisible(gh,gad,visible) IS setattr(gh,gad,visible,GTSC_VISIBLE,SCR_VIS) +EXPORT PROC setslide(gh,gad,new) IS setattr(gh,gad,new,GTSL_LEVEL,SLI_CURR) +EXPORT PROC settext(gh,gad,new) IS setattr(gh,gad,new,GTTX_TEXT,TXT_VAL) +EXPORT PROC setnum(gh,gad,new) IS setattr(gh,gad,new,GTNM_NUMBER,NUM_VAL) +EXPORT PROC setlistvlabels(gh,gad,labs) IS setattr(gh,gad,labs,GTLV_LABELS,LST_LIST) +EXPORT PROC setlistvvisible(gh:PTR TO guihandle,gad,vis) IS setattr(gh,gad,vis,GTLV_MAKEVISIBLE) + +EXPORT PROC setlistvselected(gh:PTR TO guihandle,gad,active) + DEF g + setgadattr(g:=findgadget(gh,gad),gh.wnd,gad,active,GTLV_SELECTED,LST_CURR) + IF active<>-1 THEN setgadattr(g,gh.wnd,gad,active,GTLV_MAKEVISIBLE) +ENDPROC + +EXPORT PROC setstr(gh,gad:PTR TO LONG,new) + setattr(gh,gad,new,GTST_STRING) +ENDPROC StrCopy(ATTR(gad,STR_STR),new) + +/********** disposegui **********/ +EXPORT PROC disposegui(gui:PTR TO LONG) + DEF a,l + IF gui + IF IsGroup(ATTR(gui,EG_TYPE)) + l:=ListLen(gui)-1 + FOR a:=1 TO l DO disposegui(gui[a]) + ENDIF + FastDisposeList(gui) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Source/README_IMPORTANT b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Source/README_IMPORTANT new file mode 100644 index 0000000..50e575b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Source/README_IMPORTANT @@ -0,0 +1,26 @@ +TERMS AND CONDITIONS FOR USING THE EASYGUI SOURCECODE + +* modifying or reusing part or whole of easygui.e for your + own project is always allowed: giving credit is encouraged. +* making new versions of easygui public is discouraged in + general. if you still feel that need, try in this order: + - be aware that often extensions can be implemented without + modifying the EasyGUI module, by using PLUGINs. + - suggest the extension to the maintainer of the "official" + EasyGUI, currently Jason Hulance. + - cooperate with other people that may be working on a + custom EasyGUI (try discussing this on the E mailing list). + - if you HAVE to start your own spin-off project, make sure + your release is heavily marked as being different from the + official version while still giving credit. e.g. + "Harry's TurboGUI v1.0a featuring virtual groups, + based on Wouter and Jason's original EasyGUI v3.3b4". + After you start your own version, don't come and + bother us about making it the official version. + Doing your own commercial version or anything else related + to money won't be tolerated at all. + +The purpose of this release is first and foremost educational. + +If you intend to do something with this code which doesn't +seem to be covered by the above, ask me (Wouter) or Jason first. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/EasyGUI_notag.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/EasyGUI_notag.e new file mode 100644 index 0000000..3c421f8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/EasyGUI_notag.e @@ -0,0 +1,29 @@ +OPT MODULE + +MODULE 'tools/easygui' + +EXPORT PROC easygui(windowtitle,gui,info=NIL,screen=NIL,textattr=NIL, + newmenus=NIL,ghaddr=NIL:PTR TO LONG,awproc=NIL, + x=-1,y=-1) IS + easyguiA(windowtitle,gui, + [EG_INFO, info, + EG_SCRN, screen, + EG_FONT, textattr, + EG_MENU, newmenus, + EG_GHVAR, ghaddr, + EG_AWPROC, awproc, + EG_LEFT, x, + EG_TOP, y, + NIL]) + +EXPORT PROC guiinit(windowtitle,gui,info=NIL,screen=NIL,textattr=NIL, + newmenus=NIL,awproc=NIL,x=-1,y=-1) IS + guiinitA(windowtitle,gui, + [EG_INFO, info, + EG_SCRN, screen, + EG_FONT, textattr, + EG_MENU, newmenus, + EG_AWPROC, awproc, + EG_LEFT, x, + EG_TOP, y, + NIL]) diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/copylist.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/copylist.e new file mode 100644 index 0000000..8b32ea0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/copylist.e @@ -0,0 +1,11 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/memory' + +PROC copyListToChip(data) + DEF size, mem + size:=ListLen(data)*SIZEOF LONG + mem:=NewM(size, MEMF_CHIP) + CopyMemQuick(data, mem, size) +ENDPROC mem diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/easygui_notag.m b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/easygui_notag.m new file mode 100644 index 0000000..ee4efc4 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/easygui_notag.m differ diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/ghost.doc b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/ghost.doc new file mode 100644 index 0000000..11fbefd --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/ghost.doc @@ -0,0 +1,25 @@ +ghost.m +------- +A suite of four functions for ghosting (and unghosting) areas in an +Intuition-like way (I think). + +Ghosting: + + ghost(win:PTR TO window,x,y,xs,ys) + -> Ghosts the specified area of the window (splats dots) + +Unghosting: + + unghost(gad,win:PTR TO window) + -> Redisplays the indicated gadget + clear(win:PTR TO window,x,y,xs,ys) + -> Clears the specified area of the window + unghost_clear(gad,win:PTR TO window,x,y,xs,ys) + -> Clears the specified area then redisplays gadget + +If you're ghosting a gadget then ghost()/unghost() should be sufficient. +If not then try unghost_clear() instead of unghost(). + +If you're ghosting any other kind of area then use ghost() for ghosting and +redrawing for unghosting. To help with this, you might like to use clear() +and then do your normal redrawing. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/ghost.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/ghost.e new file mode 100644 index 0000000..6168a17 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/ghost.e @@ -0,0 +1,32 @@ +OPT MODULE, PREPROCESS +OPT EXPORT + +MODULE 'graphics/gfxmacros', 'graphics/rastport', + 'intuition/intuition', 'intuition/gadgetclass' + +PROC ghost(win:PTR TO window,x,y,xs,ys) + DEF apen, afpt, afptsz, drmd, r:PTR TO rastport + r:=win.rport + apen:=r.fgpen + SetAPen(r,1) + afpt:=r.areaptrn; afptsz:=r.areaptsz + SetAfPt(r,[$1111,$4444]:INT,1) + drmd:=r.drawmode + SetDrMd(r,RP_JAM1) + RectFill(r,x,y,x+xs-1,y+ys-1) + SetAPen(r,apen) + SetAfPt(r,afpt,afptsz) + SetDrMd(r,drmd) +ENDPROC + +PROC unghost(gad,win) IS RefreshGList(gad,win,NIL,1) + +PROC unghost_clear(gad,win,x,y,xs,ys) + clear(win,x,y,xs,ys) + unghost(gad,win) +ENDPROC + +PROC clear(win:PTR TO window,x,y,xs,ys) + SetAPen(win.rport,0) + RectFill(win.rport,x,y,x+xs-1,y+ys-1) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/textlen.e b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/textlen.e new file mode 100644 index 0000000..5341120 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/EasyGUI/Tools/textlen.e @@ -0,0 +1,16 @@ +OPT MODULE +OPT EXPORT + +MODULE 'intuition/intuition' + +PROC textlen(s,ta) IS IF s THEN IntuiTextLength([0,0,0,0,0,ta,s,NIL]:intuitext) ELSE 0 + +PROC textlen_key(s,ta,key) + DEF len=0 + IF s + len:=textlen(s,ta) + IF key + IF InStr(s,'_')<>-1 THEN len:=len-textlen('_',ta) + ENDIF + ENDIF +ENDPROC len diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Exceptions/exceptions.e b/amigae33a/E_v3.3a/Src/Src/Tools/Exceptions/exceptions.e new file mode 100644 index 0000000..22c93f4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Exceptions/exceptions.e @@ -0,0 +1,26 @@ +-> general exception catcher for test purposes + +OPT MODULE + +EXPORT PROC report_exception() + DEF e[5]:ARRAY + IF exception + WriteF('Program caused exception: ') + IF exception<10000 + WriteF('\d\n',exception) + ELSE + SELECT exception + CASE "MEM"; WriteF('no memory\n') + CASE "OPEN"; WriteF('could not open file \s\n',IF exceptioninfo THEN exceptioninfo ELSE '') + CASE "^C"; WriteF('***BREAK\n') + -> and others... + DEFAULT + e[4]:=0 + ^e:=exception + WHILE e[]=0 DO e++ + WriteF('"\s" ',e) + WriteF(IF exceptioninfo<1000 THEN '[\d]\n' ELSE '[\h]\n',exceptioninfo) + ENDSELECT + ENDIF + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Exceptions/exceptionstest.e b/amigae33a/E_v3.3a/Src/Src/Tools/Exceptions/exceptionstest.e new file mode 100644 index 0000000..d38a3f5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Exceptions/exceptionstest.e @@ -0,0 +1,18 @@ +MODULE 'tools/exceptions' + +PROC main() + t(0) -> NOP + t(10) + t("MEM") + t("OPEN") + t("^C") + t("BL") + t("BLA") + t("BLAA") +ENDPROC + +PROC t(x) HANDLE + Throw(x,'bla') +EXCEPT + report_exception() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/File/file.doc b/amigae33a/E_v3.3a/Src/Src/Tools/File/file.doc new file mode 100644 index 0000000..3e5d19c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/File/file.doc @@ -0,0 +1,35 @@ +FILE.M: general file handling functions. + + mem,len:=readfile(filename,trailbyte="\n",memflags=0) + +reads file "filename", trailing both at begin and end with 4 bytes each. +The purpose of trailing is to enable fast searching; "\n" makes sense +if filename is a text file, 0 for binary files. +returns: ptr file was loaded to, and length. +raises: "NEW", "OPEN" filename, "IN" + + freefile(mem) + +frees memory allocated by readfile(). if you don't call freefile(), +memory is deallocated at the end of the program. + + writefile(filename,mem,len) + +writes a block of memory as file. +raises: "OPEN" filename, "OUT" + + num:=countstrings(mem,len) + +counts strings in memory block. mem must be "\n" trailed. +returns: #of strings + + list:=stringsinfile(mem,len,max) + +builds a LIST of nil-terminated strings, gathered from mem. +max is maxsize of list, which can either be obtained from countstrings() +(slow but accurate) or from your own guess (fast but inaccurate) +returns: LIST of C-string pointers +raises: "MEM" +notes: - the contents of mem will be altered (i.e. "\n" bytes changed to 0) + - mem must be "\n" trailed. + - if ListLen(list) is equal to max, most likely max was too small diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/File/file.e b/amigae33a/E_v3.3a/Src/Src/Tools/File/file.e new file mode 100644 index 0000000..8ff4fd9 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/File/file.e @@ -0,0 +1,71 @@ +/* file.m */ + +OPT MODULE + +EXPORT PROC readfile(filename,trailbyte="\n",memflags=0) + DEF len,m,rl,fh,a + IF (len:=FileLength(filename))<1 THEN Throw("OPEN",filename) + m:=NewM(len+8,memflags) + FOR a:=0 TO 3 + m[a]:=trailbyte + m[len+4+a]:=trailbyte + ENDFOR + m:=m+4 + IF (fh:=Open(filename,OLDFILE))=NIL THEN Raise("OPEN") + rl:=Read(fh,m,len) + Close(fh) + IF rl<>len THEN Raise("IN") +ENDPROC m,len + +EXPORT PROC freefile(mem) + Dispose(mem-4) +ENDPROC + +EXPORT PROC writefile(filename,mem,len) + DEF fh,wl + IF (fh:=Open(filename,NEWFILE))=NIL THEN Throw("OPEN",filename) + wl:=Write(fh,mem,len) + Close(fh) + IF wl<>len THEN Raise("OUT") +ENDPROC + +EXPORT PROC countstrings(mem,len) + MOVE.L mem,A0 + MOVE.L A0,D1 + ADD.L len,D1 + MOVEQ #0,D0 + MOVEQ #10,D2 +strings: + ADDQ.L #1,D0 +findstring: + CMP.B (A0)+,D2 + BNE.S findstring + CMPA.L D1,A0 + BMI.S strings +ENDPROC D0 + +EXPORT PROC stringsinfile(mem,len,max) + DEF list,l + IF (list:=List(max))=NIL THEN Raise("MEM") + MOVE.L list,A1 + MOVE.L max,D3 + MOVE.L mem,A0 + MOVE.L A0,D1 + ADD.L len,D1 + MOVEQ #0,D0 + MOVEQ #10,D2 +stringsl: + CMP.L D3,D0 + BPL.S done + ADDQ.L #1,D0 + MOVE.L A0,(A1)+ +findstringl: + CMP.B (A0)+,D2 + BNE.S findstringl + CLR.B -1(A0) + CMPA.L D1,A0 + BMI.S stringsl +done: + MOVE.L D0,l + SetList(list,l) +ENDPROC list diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/File/filetest.e b/amigae33a/E_v3.3a/Src/Src/Tools/File/filetest.e new file mode 100644 index 0000000..a4247d4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/File/filetest.e @@ -0,0 +1,13 @@ +-> test files + +MODULE 'tools/file', 'tools/exceptions' + +PROC main() HANDLE + DEF m,l,n,list,x,y=1 + m,l:=readfile(arg) + WriteF('file has \d lines:\n\n',n:=countstrings(m,l)) + list:=stringsinfile(m,l,n) + ForAll({x},list,`WriteF('\d\t\s\n',y++,x)) +EXCEPT + report_exception() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/FilledVector.guide b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/FilledVector.guide new file mode 100644 index 0000000..a3f4b1e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/FilledVector.guide @@ -0,0 +1,1084 @@ +@database FilledVector.guide + +Docs for filled vector module + +© 1993,1994 Michael Zucchi +All rights reserved + +@node Main "FilledVector.guide" + +Filled Vector Module for AmigaE 2.5+ + +© 1993,1994 @{"Michael Zucchi" Link "Author"} +All Rights Reserved + +This document describes the usage of a suite of 3d filled vector routines +compiled for the AmigaE language. + +The following sections are available: + + @{" OverView " Link "OverView"} some of the ideas behind the module + + @{" Polygon Context " Link "Polygon Context"} describing destination memory + + @{" Vector Object " Link VectorObject} vector object creation/manipulation + + @{" Rendering " Link "Rendering"} rendering functions + + @{" Matrix " Link "Matrix"} coordinate manupulation functions + + + @{Examples link examples} a few playthings i came up with ... + +@{b}NOTE:@{ub} You need to have: + +MODULE 'tools/filledvector', 'tools/filledvdefs' + +Somewhere in your MODULE include section + + + +This module should work with all Amiga's + +@endnode + +@node OverView + +@{u}Filled Vector Module Overview@{uu} + +Whats this module all about? + +This module contains some reasonably 'optimised' rendering code +to render 3d polygon filled vectors. This includes some a +reasonably complex and versatile object format that can be +used to create complex iconvex vector objects. + +Because it uses the blitter to do rendering, it means you +can have very complex objects (ones with holes in them +and so on) without slowing it down too much. Unfortunately, +performance on accelerated machines isn't so hot ... + +BTW, i say "optimised", but its not that fast really ... one +reason is because i'm keeping the system intact :) +Another reason, is this code is somewhat old by now, and i +dont really have the time to update it to the latest +kill-os version i have (the kill-os version uses a very +interrupt-intensive customblitter queue, and it operates +on parameters fixed at compile-time. It is also a LOT +faster though ...). It also uses some more efficient +data structures and algorithms that i havent had time +to put into this one. + +One of the "cool" features it DOES have though, is the ability +to perform z clipping as its rendering objects. This allows +you to smoothly run through objects as you run into them, +rather than having them dissapear just as they start to get big. +It doesn't use a particularaly reliable or fast z clipping +algorithm but its still not too bad. (again, my kill-os +vector code uses a much more efficient version ...). + + +Hopefully someone out there will be able to do more with it +than just another version of ZedWB :) (although, for +full-on vector world creation, you need some more +tools ...) + + MZ + +@endnode + +@node "Author" + +I'm another one of these poor students, but i live in Australia, not Europe! +I've been stuffing about with this vector shit since i had a '64, but never +really got to do anything with it ... + +Presently, i study 'from time to time' :-) in order to obtain a Computer +Systems Engineering degree from the Univerity Of South Australia. +I'm the 'Zed' of FRONTIER in my anti-os hours. + +I can be contacted in the following ways: + +Internet email: + +9107047w@lux.levels.unisa.edu.au + till the end of '94 at least - reliable + +zucchi@hal9000.apana.org.au +zucchi@bkroom.apana.org.au + until i keep acounts there (?) + +`Real Mode' (tm) mail: + +Michael Zucchi +PO BOX 824 +Waikerie +South Australia 5330 + slow, but very reliable - till mum sells the house :) + +Michael Zucchi +110 Dunrobin Rd +Warradale +South Australia 5046 + till end of '94 + +@endnode + + +;--------------------------------------------------------------------------- +;--------------------------------------------------------------------------- +; Polygon Context Functions + + +@node "Polygon Context" + +This section describes the functions used for creating and manipulating +'polygon contexts'. + + @{" Polygon Context OverView " Link "Polygon Context Overview"} + + @{"newPolyContext() " Link "newPolyContext"} create a new one + @{"freePolyContext()" Link "freePolyContext"} free one + @{"setPolyBitMap() " Link "setPolyBitMap"} change where it renders + @{"setPolyClipRect()" Link "setPolyClipRect"} change clipping window + +All of these functions operate with system libraries starting from V33 +(workbench 1.2). However, @{u}please note@{uu} that interleaved bitmaps are +only possible when using @{b}V39@{ub} libraries (WB3.0+). + +@endnode + + + +@node "Polygon Context Overview" + +A polygon context is similar to a rastport, but instead of containing +all and sundry general purpose drawing variables as a rastport must, +it only contains data necessary for polygon rendering. + +The following is an example of some of the information that is stored in +the polygon context: + + clipping rectangle + minimum dimensions of current polygon (for blitting) + size of destination bitmap + bytesperrow of bitmap and screen + + pointer to a bitplane to render polygons into + pointer to bitmap to blit thus renderd polygons + some temporary storage + +Because of the context sensitive nature of this data object, when one +is allocated it must be attached to a specific screen or bitmap - and MUST NOT +be used for another screen or bitmap, unless it is absolutely clear that +they are of the same dimensions (the buffered screen routines guaruntee this). + +All fields of the polygon context are !PRIVATE! and must only be +accessed via the provided functions! + +@endnode + + +@node "newPolyContext" +@{u}filledvector.m/newPolyContext filledvector.m/newPolyContext@{uu} + + @{b}SYNTAX@{ub} + + polycontext:=newPolyContext( bitmap, workspace ) + + @{b}PURPOSE@{ub} + + Allocates memmory required for the polygon context and associated + memory. A single bitplane the same size as the bitmap is allocated + for blitting into along with some work memory. + + @{b}INPUTS@{ub} + bitmap a standard 'Amiga bitmap' that is to be the destination + for rendering operations. This may be changed during runtime + with the @{"setPolyBitMap()" Link "setPolyBitMap"} function. + workspace a number used to allocate workspace for the polygon + rendering functions. Currrently make this the maximum number + of points in any single object, plus 16. + + @{b}OUTPUTS@{ub} + polycontext + pointer to a private polgon context handle that can + be passed to the other functions + + @{b}SEE ALSO@{ub} + @{"freePolyContext()" Link "freePolyContext"}, @{"Rendering functions" Link Rendering} +@endnode + +@node "freePolyContext" +@{u}filledvector.m/freePolyContext filledvector.m/freePolyContext@{uu} + + @{b}SYNTAX@{ub} + + VOID freePolyContext( poly context ) + + @{b}PURPOSE@{ub} + + Frees the memory associated with a given polygon context. This + function should always be called before a program exits. + + @{b}INPUTS@{ub} + polycontext + Pointer to a polygon context handle that was previously + allocated with @{"newPolyContext()" Link "newPolyContext"}. It MUST have + been allocated with this function. This value MUST NOT + be NIL. + + @{b}SEE ALSO@{ub} + @{"newPolyContext()" Link "newPolyContext"} +@endnode + + +@node "setPolyBitMap" +@{u}filledvector.m/setPolyBitMap filledvector.m/setPolyBitMap@{uu} + + @{b}SYNTAX@{ub} + + VOID setPolyBitMap( poly context, bitmap ) + + @{b}PURPOSE@{ub} + + Sets the bitmap that the rendering functions will render into. This + bitmap must be either the one used to allocate the polygon context, + or one with identical structure. + + @{b}INPUTS@{ub} + polycontext + Previously allocated (using @{"newPolyContext()" Link "newPolyContext"}), valid polygon + context. Must not be NIL. + bitmap + Pointer to a standard Amiga bimap that is to become the new + destination for rendering. + + @{b}SEE ALSO@{ub} + @{"newPolyContext()" Link "newPolyContext"} +@endnode + + +@node "setPolyClipRect" +@{u}filledvector.m/setPolyClipRect filledvector.m/setPolyClipRect@{uu} + + @{b}SYNTAX@{ub} + + VOID setPolyClipRect( poly context, [minx, miny, maxx, maxy]:INT ) + + @{b}PURPOSE@{ub} + + This function sets the viewport through which all rendering will + take place. The values supplied, minx/miny/maxx and maxy must + all be within the size of the bitmap being rendered into, with a + further restriction that maxx>minx and so on. + + @{b}INPUTS@{ub} + polycontext + Previously allocated (using @{"newPolyContext()" Link "newPolyContext"}), valid polygon + context. Must not be NIL. + [minx, miny, maxx, maxy]:INT + An array of 4 16 bit numbers that describe the clipping + rectangle to be used. + + @{b}SEE ALSO@{ub} + @{"newPolyContext()" Link "newPolyContext"}, @{"Rendering functions" Link Rendering} +@endnode + + +@node setPolyFlags +@{u}filledvector.m/setPolyFlags filledvector.m/setPolyFlags@{uu} + + @{b}SYNTAX@{ub} + + VOID setPolyFlags( poly context, newflags, mask ) + + @{b}PURPOSE@{ub} + + This function sets the polygon context flags (see below) for + the given polygon context. Not much can be changed just yet. + Like several Amiga system functions, the mask value sets + which of the bits in the newflags will become set to those + values (0 or 1, or whatever). + + PCF_ZCLIP + This flag will set zclipping on or off. If this bit + is on, zclipping will be performed for all polygons + rendered. Turning off zclipping can reduce + calulcations somewhat, but they can't get too close + to the virtual eye-level of the viewer, without + stuffing up. + + @{b}INPUTS@{ub} + polycontext + Previously allocated (using @{"newPolyContext()" Link "newPolyContext"}), valid polygon + context. Must not be NIL. + newflags + State of new flags + mask A 1 in a bit position of the mask indicates that the + corresponding bit in the newflags parameter is to be + copied to the polygon context flags field. A 0 + indicates that that bit is to remain unchanged. + + @{b}SEE ALSO@{ub} + @{"newPolyContext()" Link "newPolyContext"} +@endnode + + +;--------------------------------------------------------------------------- +;--------------------------------------------------------------------------- +; Vector Object Functions + + +@node VectorObject + +This section describes the functions available for creating, destroying, +and working with `vector objects'. These are high level object +definitions that can be used to describe quite complex objects, which +can then be rendered very efficiently. + +Creating new objects can be difficult, @{"designing objects" link ObjectDesign.guide/main} explains +more information about how to go about this. + + + @{"newVectorObject() " Link "newVectorObject"} create a new vector object + @{"freeVectorObject() " Link "freeVectorObject"} free a vector object + @{"copyVectorObject() " Link "copyVectorObject"} make an efficient copy of an object + @{"cloneVectorObject()" Link "cloneVectorObject"} make a minimal copy of an object + + @{"getVObjectPoints() " Link "getVObjectPoints"} access the array of vertices + + + @{"newVList() " Link "newVList"} create a list header for linking objects + @{"freeVList() " Link "freeVList"} free the list, and optionally all objects in it + @{"addVObject()" Link "addVObject"} add an object to an object list + @{"remVObject()" Link "remVObject"} remove an object from an object list + + @{"sortVList() " Link "sortVList"} do a fast sort in descending Z order of the list + + + @{"drawVObject() " Link "drawVObject"} draw a single vector object + @{"drawVList() " Link "drawVList"} draw a list of objects + @{"moveDrawVList()" Link moveDrawVList} render a scene of objects + +All of these functions operate with system libraries starting from V33 +(workbench 1.2). + +@endnode + +@node newVectorObject +@{u}filledvector.m/newVectorObject filledvector.m/newVectorObject@{uu} + + @{b}SYNTAX@{ub} + + vobject := newVectorObject( type, numpoints, numfaces, points, faces ) + + @{b}PURPOSE@{ub} + + Creates a new vector object, and initialises its fields to those + supplied. + + @{b}INPUTS@{ub} + type type of object, currently only '0' is valid + numpoints + the number of vertices/points in the object + numfaces + the number of faces in the object + points an array of INT's which are the vertices used by the object. + Each entry in the list consists of 3 words the X, Y and Z + coordinates of that point. There must be at least + numpoints*3 INT's in this list. + faces an array of "vface" data structures which describe the faces + of the object. There must be at least as many of these + as the numfaces argument. See @{"designing objects" Link Design} for more + information. + + @{b}OUTPUTS@{ub} + vobject Pointer to a vobject type OBJECT that can be used to manipulate + the object in some ways. + + @{b}SEE ALSO@{ub} + @{"freeVectorObject()" Link freeVectorObject}, @{"copyVectorObject()" Link copyVectorObject}, @{"cloneVectorObject()" link cloneVectorObject}, + @{"Designing objects" Link objectdesign.guide/main} +@endnode + +@node freeVectorObject +@{u}filledvector.m/freeVectorObject filledvector.m/freeVectorObject@{uu} + + @{b}SYNTAX@{ub} + + VOID freeVectorObject( vobject ) + + @{b}PURPOSE@{ub} + + Free's a vector object, and any associated memory. This function + should be used to free all objects previously created or copied, + before the program exits. + + @{b}INPUTS@{ub} + vobject previously allocated vector object (either using + @{"newVectorObject()" Link newVectorObject}, @{"copyVectorObject()" link copyVectorObject} or @{"cloneVectorObject()" Link cloneVectorObject}), + it may also be NIL, in which case it does nothing. + + @{b}SEE ALSO@{ub} + @{"newVectorObject()" Link newVectorObject}, @{"copyVectorObject()" Link copyVectorObject}, @{"cloneVectorObject()" link cloneVectorObject}, +@endnode + +@node copyVectorObject +@{u}filledvector.m/copyVectorObject filledvector.m/copyVectorObject@{uu} + + @{b}SYNTAX@{ub} + + vobject := copyVectorObject( vobject ) + + @{b}PURPOSE@{ub} + + Makes an efficient copy of a vector object. The entire object is + copied, including the points, the face definitions (colours etc), + but the polygon definitions are not copied to save space. + + @{b}INPUTS@{ub} + vobject previously allocated vector object (either using + @{"newVectorObject()" Link newVectorObject}, @{"copyVectorObject()" link copyVectorObject} or @{"cloneVectorObject()" Link cloneVectorObject}), + it may also be NIL, in which case it returns NIL. + + @{b}OUTPUTS@{ub} + vobject a copied vector object. + + @{b}SEE ALSO@{ub} + @{"newVectorObject()" Link newVectorObject}, @{"freeVectorObject()" Link freeVectorObject}, @{"cloneVectorObject()" link cloneVectorObject} +@endnode + + +@node cloneVectorObject +@{u}filledvector.m/cloneVectorObject filledvector.m/cloneVectorObject@{uu} + + @{b}SYNTAX@{ub} + + vobject := copyVectorObject( vobject ) + + @{b}PURPOSE@{ub} + + Makes a minimal copy of a vector object. The points array, and the + face array are NOT copied. This allows an identical object to be + created and positioned independently of the original, but any + manipulation of either object (colours or points) will affect the + other. + + @{b}INPUTS@{ub} + vobject previously allocated vector object (either using + @{"newVectorObject()" Link newVectorObject}, @{"copyVectorObject()" link copyVectorObject} or @{"cloneVectorObject()" Link cloneVectorObject}), + it may also be NIL, in which case it returns NIL. + + @{b}OUTPUTS@{ub} + vobject a cloned vector object. + + @{b}SEE ALSO@{ub} + @{"newVectorObject()" Link newVectorObject}, @{"freeVectorObject()" Link freeVectorObject}, @{"copyVectorObject()" link copyVectorObject} +@endnode + +@node getVObjectPoints +@{u}filledvector.m/getVObjectPoints filledvector.m/getVObjectPoints@{uu} + + @{b}SYNTAX@{ub} + + points := getVObjectPoints( vobject ) + + @{b}PURPOSE@{ub} + + Allows a pointer to the internal point/vertice array to be obtained. + This can be used with the @{matrix link Matrix} and other manipulation + functions (you are free to do what you like) for post-processing the + object. + + This array will contain as many points as the number of points used + in the argument to the initial @{"newVectorObject()" link newVectorObject} call. + + @{b}INPUTS@{ub} + vobject previously allocated vector object (either using + @{"newVectorObject()" Link newVectorObject}, @{"copyVectorObject()" link copyVectorObject} or @{"cloneVectorObject()" Link cloneVectorObject}), + it may also be NIL, in which case it returns NIL. + + @{b}OUTPUTS@{ub} + points A pointer to an array of INT's that are the 3d points of the + object. If the object has been cloned, this will point to + the same physical array as the parent's point list. + + @{b}SEE ALSO@{ub} + @{"newVectorObject()" Link newVectorObject} +@endnode + + +@node newVlist +@{u}filledvector.m/newVList filledvector.m/newVList@{uu} + + @{b}SYNTAX@{ub} + + vlist := newVList() + + @{b}PURPOSE@{ub} + + Creates a new list header,and initialises it. This is used for + linking several objects into a bigger object, or as a way of + efficiently manipulating several objects at a time. + + @{b}OUTPUTS@{ub} + vlist pointer to a newly allocated vlist header, or NIL incase of + failure. + + @{b}SEE ALSO@{ub} + @{"freeVList()" Link freeVList}, @{addVObject() link addVObject}, @{remVObject() link remVObject}, + @{sortVList() link sortVList}, @{drawVlist() link drawVList}, @{moveDrawVlist link moveDrawVlist} +@endnode + + +@node freeVlist +@{u}filledvector.m/freeVList filledvector.m/freeVList@{uu} + + @{b}SYNTAX@{ub} + + VOID freeVList( vlist, freenodes ) + + @{b}PURPOSE@{ub} + + Free's a vector object list header, and optionally, all of the + vector objects connected to the list. + + @{b}INPUTS@{ub} + vlist pointer to a previously allocated vlist header, allocated with + @{newVList() link newVList}, this must not be NIL! + freenodes + Boolean value which indicates whether all of the objects in + the vlist are also to be free'd. + + @{b}SEE ALSO@{ub} + @{"newVList()" Link newVList} +@endnode + + +@node addVlist +@{u}filledvector.m/addVList filledvector.m/addVList@{uu} + + @{b}SYNTAX@{ub} + + VOID addVList( vlist, vobject ) + + @{b}PURPOSE@{ub} + + Adds a vector object to the vlist. + + @{b}INPUTS@{ub} + vlist pointer to a previously allocated vlist header, allocated with + @{newVList() link newVList}, this must not be NIL! + vobject previously allocated vector object (either using + @{"newVectorObject()" Link newVectorObject}, @{"copyVectorObject()" link copyVectorObject} or @{"cloneVectorObject()" Link cloneVectorObject}), + it may also be NIL, in which case it returns NIL. + + @{b}SEE ALSO@{ub} + @{"newVList()" Link newVList}, @{remVList() link remVlist} +@endnode + + +@node remVlist +@{u}filledvector.m/remVList filledvector.m/remVList@{uu} + + @{b}SYNTAX@{ub} + + VOID addVList( vlist, vobject ) + + @{b}PURPOSE@{ub} + + Removes the vector object from the vlist. + + @{b}INPUTS@{ub} + vlist pointer to a previously allocated vlist header, allocated with + @{newVList() link newVList}, this must not be NIL! + (currently, this field is unused, since the list uses a doubly + linked list. If int he future, this changes, then this + will become important) + vobject a vobject that has previosly been added to the vlist using + @{addVList() link addVList}. + + @{b}SEE ALSO@{ub} + @{"newVList()" Link newVList}, @{addVList() link addVlist} +@endnode + + + +@node sortVlist +@{u}filledvector.m/sortVList filledvector.m/sortVList@{uu} + + @{b}SYNTAX@{ub} + + VOID sortVList( vlist ) + + @{b}PURPOSE@{ub} + + Takes the vlist argument, and scans all of the vector objects on + the list. It looks at the vobject.pz value, and uses this to + sort the list indescending Z order. + + The algorithm used by this sort is a modified mergesort, which + uses a prescan stage to break the list into already-sorted + sublists, which it then takes pairs of, and merges to create + larger sublists, until sorted. This will mean that a nearly + sorted list can be sorted VERY quickly. Even with a completely + reversed list, the properties of the mergesort algorithm + guarentee a very fast worst case performance. + + @{b}INPUTS@{ub} + vlist pointer to a previously allocated vlist header, allocated with + @{newVList() link newVList}, this must not be NIL! + vobject a vobject that has previosly been added to the vlist using + @{addVList() link addVList}. + + @{b}SEE ALSO@{ub} + @{"newVList()" Link newVList}, @{drawVList() link drawVlist} +@endnode + + +@node drawVObject +@{u}filledvector.m/drawVObject filledvector.m/drawVObject@{uu} + + @{b}SYNTAX@{ub} + + VOID drawVObject( polygon context, vobject ) + + @{b}PURPOSE@{ub} + + Draws a single vector object into the polygon context described. + The object's position and angles are taken into account, resulting + in a positioned and rotated object being rendered into the + destination bitmap. + + @{b}INPUTS@{ub} + poly context + Pointer to a polygon context handle that was previously + allocated with @{"newPolyContext()" Link "newPolyContext"}. It MUST have + been allocated with this function. This value MUST NOT + be NIL. + vobject previously allocated vector object (either using + @{"newVectorObject()" Link newVectorObject}, @{"copyVectorObject()" link copyVectorObject} or @{"cloneVectorObject()" Link cloneVectorObject}), + it must NOT be NIL. + + @{b}SEE ALSO@{ub} + @{"Polygon Context" link "Polygon Context"}, @{"Vector Objects" link VectorObject} +@endnode + + +@node drawVList +@{u}filledvector.m/drawVList filledvector.m/drawVList@{uu} + + @{b}SYNTAX@{ub} + + VOID drawVList( polygon context, vlist ) + + @{b}PURPOSE@{ub} + + Scans the vector object list, and draws all of the items contained + within it. No sorting of the objects is done whatsoever, so if + you wish to have correctly depth sorted (i.e. painters algorithm) + objects, @{sortVList() link sortVList} must be called first. + + Each object is rendered using its position and angles as specified + in the vobject OBJECT. + + @{b}INPUTS@{ub} + poly context + Pointer to a polygon context handle that was previously + allocated with @{"newPolyContext()" Link "newPolyContext"}. It MUST have + been allocated with this function. This value MUST NOT + be NIL. + vlist pointer to a previously allocated vlist header, allocated with + @{newVList() link newVList}, this must not be NIL! + + @{b}SEE ALSO@{ub} + @{"newVList()" Link newVList}, @{"Polygon Context" link "Polygon Context"}, @{"Vector Objects" link VectorObject} +@endnode + + +@node moveDrawVList +@{u}filledvector.m/moveDrawVList filledvector.m/movewDrawVList@{uu} + + @{b}SYNTAX@{ub} + + VOID movewDrawVList( polygon context, vlist, position ) + + @{b}PURPOSE@{ub} + + This is a high level function which performs a lot of processing + in one step. Initially, it scans the list of objects, and + uses the supplied position OBJECT to rotate and position all + of the objects into an internal list. Once this has taken place, + this list is depth sorted, and all objects in the list are + rendered, starting from the back. + + The positions within each vobject now become relative to the + position supplied as an argument above. The angles should + be relative too, but currently the angles stored in each vobject + are ignored when this function is called. + + @{b}INPUTS@{ub} + poly context + Pointer to a polygon context handle that was previously + allocated with @{"newPolyContext()" Link "newPolyContext"}. It MUST have + been allocated with this function. This value MUST NOT + be NIL. + vlist pointer to a previously allocated vlist header, allocated with + @{newVList() link newVList}, this must not be NIL! + position + an OBJECT position object, which describes the position + and angle at which the object list is to be drawn. + + @{b}SEE ALSO@{ub} + @{"newVList()" Link newVList}, @{"Polygon Context" link "Polygon Context"}, @{"Vector Objects" link VectorObject} +@endnode + + +;--------------------------------------------------------------------------- +;--------------------------------------------------------------------------- +; Rendering Functions + +@node Rendering + + + Currently, the only available rendering functions are + those in the @{"vector object" link VectorObject} section. + + Sometime in the future, some more low-level, but simple + to use polygon rendering functions will be provided. + +@endnode + +;--------------------------------------------------------------------------- +;--------------------------------------------------------------------------- +; Matrix Functions + + +@node Matrix + +This section describes the range of general purpose matrix-based functions +that are available for manipulating sets of points in 2d and 3d. + +Have a look at @{"matrix information" link matrixinfo} on just how to use these +functions. + + @{"setMatIdent() " link setMatIdent} setup a matrix to do nothing (identity matrix) + @{"setMatRotate()" link setMatRotate} setup a matrix to perform a rotation + @{"setMatScale() " link setMatScale} setup a matrix to perform a scaling operation + + @{"matSize() " link matSize} scale the rows of a matrix + @{"matMult() " link matMult} multiply two matrices + + @{"matApply3() " link matApply3} apply a matrix to a set of 3d points + +All functions here work with all machines. + +@endnode + +@node matrixinfo + +So, there's all of these matrix functions - just what the hell do you do with +them? Well, matrices are an efficient way to manipulate things like points +in 3d. You can do things like scaling, rotation, shearing, and so on all using +a single matrix. You can also combine operations, like doing several rotations +at once, or a rotation and a scale, by combining the individual transformations +into one matrix, and then applying this matrix in one go to the points. + +Ok, how about an example. Say we wish to rotate several points, and then scale +them up by 100%, in the X direction. + + +DEF matrotate:matrix, matscale:matrix + +setMatRotate(matrotate, anglex, angley, anglez); -> rotate angles +setMatScale(matscale, 2048, 1024, 1024); -> scale 2x in x +matMult(matscale, matrotate) -> create new transform + +matApply3(matrotate, 10, points, buffer); -> apply the matrix + + +Because the scaling matrix is left-multiplied with the rotation matrix +(the matMult call above), then the new matrix will act as if two seperate +transformations had occured, the first being a rotate, and the second +a scaling. + +If the order of multiplication of the matrices was reversed, then the +matrix would represent first a scaling operation, and THEN a rotation. +These two different matrices result in quite different outputs. + +This operation (multiplying the two matrices) is known as concatenation, +and is mentioned throughout the function descriptions. + +Another way to perform scaling is to use the matSize() function. This +modifies the rows of the matrix directly, and will produce similar +results (and is actually more efficient), but it always acts as if +it is the last operation. + +See the various functions for more information about what is available. +A textbook on 3d graphics, or simply one on linear algebra which talks +about affine transformations may also be handy. + +@endnode + + +@node setMatIdent +@{u}filledvector.m/setMatIdent filledvector.m/setMatIdent@{uu} + + @{b}SYNTAX@{ub} + + VOID setMatIdent( matrix ) + + @{b}PURPOSE@{ub} + + Sets up the contents of the matrix pointed to by matrix to + the internal identity matrix value. + + @{b}OUTPUTS@{ub} + matrix Matrix setup to do nothing. + + @{b}SEE ALSO@{ub} + @{setMatRotate() link setMatRotate}, @{setMatScale() link setMatScale} +@endnode + + +@node setMatRotate +@{u}filledvector.m/setMatRotate filledvector.m/setMatRotate@{uu} + + @{b}SYNTAX@{ub} + + VOID setMatRotate( matrix, anglex, angley, anglez ) + + @{b}PURPOSE@{ub} + + Sets up the contents of the matrix pointed to by matrix to + a rotation matrix which represents the rotations provided + in the arguments. This matrix is itself a concatentated + matrix (but calculated much more efficiently than taking + 3 2d rotations and multiplying them together), and as such + has certain properties. For example, the order of rotations + becomes important - i think the order is anglez, angly then + anglex. + + If you wish to rotate with other angle ordering, then + you can make 2d rotation matrices using this function, + and setting two of the angles to 0, then concatenating + the resultant matrices yourself (using @{matMult() link matMult}). + + @{b}INPUTS@{ub} + anglex, angley, anglez + The angles to use as the basis of the rotations. + 0 = 0 degrees, and 512 = 360 degrees. + +OUTPUS + matrix Matrix setup with a rotation matrix + + @{b}SEE ALSO@{ub} + @{setMatIdent() link setMatIdent}, @{setMatScale() link setMatScale} +@endnode + + +@node setMatScale +@{u}filledvector.m/setMatScale filledvector.m/setMatScale@{uu} + + @{b}SYNTAX@{ub} + + VOID setMatScale( matrix, scalex, scaley, scalez ) + + @{b}PURPOSE@{ub} + + Sets up the contents of the matrix pointed to by matrix to + a scaling matrix which represents the scaling provided + in the arguments. + + This provides a true mathematicall accurate scaling operation, + that can be concatenated and ordered correctly. For a simpler + version, see @{matSize() link matSize}. + + @{b}INPUTS@{ub} + scalex, scaley, scalez + The scaling values (fixed point) to be used to setup + the matrix. These fixed point values are normalised + to 1024. This means a value of 512 will mean a + halving along that axis, and a value of 2048 + a doubling etc. + + @{b}OUTPUTS@{ub} + matrix Matrix setup with a scaling operation + + @{b}NOTES@{ub} + Dont try to scale above 32 times larger! (32767), negative + values are also acceptable, and will tend to flip the + object inside out along that axis (odd results). + + @{b}SEE ALSO@{ub} + @{setMatIdent() link setMatIdent}, @{setMatRotate() link setMatRotate}, @{matSize() link matSize} +@endnode + + +@node matSize +@{u}filledvector.m/matSize filledvector.m/matSize@{uu} + + @{b}SYNTAX@{ub} + + VOID matSize( matrix, scalex, scaley, scalez ) + + @{b}PURPOSE@{ub} + + Modifies the matrix, by scaling each of its rows by the + 3 values provided. This provides a more efficient + way to add a scaling operation to a matrix, but it always + acts as if it was the last operation performed on the + matrix. + + @{b}INPUTS@{ub} + scalex, scaley, scalez + The scaling values (fixed point) to be used to setup + the matrix. These fixed point values are normalised + to 1024. This means a value of 512 will mean a + halving along that axis, and a value of 2048 + a doubling etc. + + @{b}OUTPUTS@{ub} + matrix Matrix modified with the scaling factors above + + @{b}SEE ALSO@{ub} + @{setMatScale() link setMatScale} +@endnode + + +@node matMult +@{u}filledvector.m/matMult filledvector.m/matMult@{uu} + + @{b}SYNTAX@{ub} + + VOID matMult( source matrix, dest matrix ) + + @{b}PURPOSE@{ub} + + Concatenates the two matrix operations, by left multiplying + (go look in a maths book!) the destination matrix by the + source matrix, and storing the result in the dest matrix. + The net result is that the two transformation matrices are + combined, with the effect being that the resultant matrix + will represent the operation originally performed by the + dest matrix, followed by the operation performed by the + source matrix. + + Maybe an @{example link matrixinfo} would help! + + @{b}INPUTS@{ub} + source matrix + operation to be performed by the concatenated result + last. This matrix is left-multiplied with the + dest matrix. + dest matrix + operation to be performed by the concatenated result + first. The result of the entire operation is also + stored in here + + @{b}OUTPUTS@{ub} + dest matrix + the result of the operation is stored in the dest matrix + + @{b}NOTES@{ub} + The result of any concatenation must fit within the size + of the numbers used to prevent any errors. This means + that the net result of any operation must not result + in a scaling up of more than 32x. + + @{b}SEE ALSO@{ub} + @{setMatRotate() link setMatRotate}, @{setMatScale() link setMatScale}, @{setMatIdent() link setMatIdent} +@endnode + + +@node matApply3 +@{u}filledvector.m/matApply3 filledvector.m/matApply3@{uu} + + @{b}SYNTAX@{ub} + + VOID matApply3( matrix, number, source points, dest points ) + + @{b}PURPOSE@{ub} + + Multiplies each 3d point in the points list by the matrix, + and stores the result somewhere else. + + The matrix can be setup to perform any affine transformation + that it has been setup to (currently functions exist for + setting up scaling and rotation matrices only). + + @{b}INPUTS@{ub} + matrix matrix containing transformation to apply. + number the number of points to apply the operation to. + Currently, must be >0. + source points + An array of INT's which contains the 3d coordinates + to process + + @{b}OUTPUTS@{ub} + dest points + An array, at least as big as number*3 INT's in which + to store the result. This value may be the same + as the source points parameter, if you just wish to + process an existing list of points. + + @{b}SEE ALSO@{ub} + @{setMatRotate() link setMatRotate}, @{setMatScale() link setMatScale}, @{setMatIdent() link setMatIdent}, + @{matMult() link matMult} +@endnode + + +@node Examples "Example code" + + + I've had this module floating around on my hdd for 6-12 months + actually ... i just needed to gt my finger out and write + all this damn documentation :) + + (i was going to recode it using some ideas i've had since then, + but i never got around to it ..!) + + Anyway, it means i've had time to come up with some decent + (if still trivial) examples. + + The Vxx+ below shows which versions of the OS the examples work + with. Since some use the ScrBuffer module, they require + Workbench 3.0+ (V39+). + + @{cube link cube.e/main} V33+ + + A very simple example which demonstrates the basics required to + get a vector object spinning on the screen. It uses the + cube designed in the @{tutorial link objectdesign.guide/main}, and also some + simple Workbench 1.2 functions to do the page flipping. + + @{cube39 link cube39.e/main} V39+ + + Another simple demo of the module. This one also uses the + Workbench 3.0+ double buffering routines to make it run smoother, + and allow you to drag the screen. + + @{zed link zed.e/main} V39+ + + One of the first examples i coded :) Its a spinning Zed logo, + and uses WB3.0 double buffering, and demonstrates the use + of that, the vector module, multiple part objects, and some + of the matrix routines. Use the left mousebutton to make it + go away, and right to make it come closer. (you can still + drag its screen BTW). Both to exit. + + @{wb1200 link wb1200.e/main} V37+ + + An animated workbench backdrop! Uses an offscreen render bitmap to + draw a picture, which is then blitted to the workbench screen. + This has been tested and works on machines with custom graphics + cards! (if slowly ...) + + @{torus link torus.e/main} V37+ + + Identical to wb1200, but uses a different object. The object + in this one was created in imagine, and converted using a + longwinded and labourious process ... + +@endnode diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/ObjectDesign.guide b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/ObjectDesign.guide new file mode 100644 index 0000000..d43bfab --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/ObjectDesign.guide @@ -0,0 +1,524 @@ +@database ObjectDesign.guide + +Docs for filled vector module, designing objects + +© 1994 Michael Zucchi +All rights reserved + +@node Main "ObjectDesign.guide" + +Documentation for Filled Vector Module for AmigaE 3.0+, object design + +© 1994 @{"Michael Zucchi" Link "FilledVector.guide/Author"} +All Rights Reserved + + + @{"Creating new objects" link Create} + + @{"Modifying objects" link Modify} + + @{"Using objects" link Using} + +@endnode + +@node Create "Creating Objects" + +@{u}Object Creation@{uu} + + +Creating objects by hand is very difficult ... unfortunately, +this is the iinly real way to create objects at the moment. + +The utility @{ReadNFF link ReadNFF} can however be used to simplify +the entry of data into the computer, and if you dont mind +being limited to objects made of triangles, you can even use it +to read in objects created with Imagine (not without more +work mind you). + +The following steps need to be taken whether designing objects +with or without using ReadNFF, its just the final stages that +can be simplified using it. + +@{u}Starting@{uu} + +First, you need an idea. This can often be difficult, especially +since you will want to create the object so it uses as few polygons +as possible, yet still gets drawn correctly. + +@{u}Working out the points@{uu} + +Once you have the idea though, it helps to draw it down on a piece +of paper. You need to be able to identify and number all of +the vertices or points in the object. The actual coordinates +of these vertices will also need to be calculated - in 3d. Drawing +several views of the object may help with this. + +After this stage, you should have a list of coordinates, and you +should also have identified each of the points by an index (start +it at 0). + +For example, a cube. + + 4-----5 + /| /| + 0-----1 | + | | | | + | | | | + | 7---|-6 + |/ |/ + 3-----2 + + + +'ve Y + ^ + | ^+'ve Z + |/ + o--> +'ve X + +The numbers show the points we have assigned to each of the 8 +corners of the cube. + +Say, we want the cube to be 200*200*200 in size, we also would +like to have centered about its centre of gravity (in the middle) +so we place each point 100 from the origin. + +This, our points table becomes: + + -100,100,-100 0 + 100,100,-100 1 + 100,-100,-100 2 + -100,-100,-100 3 + -100,100,100 4 + 100,100,100 5 + 100,-100,100 6 + -100,-100,100 7 + +Ok, so far so good, this is actually the easy part for most objects ... + + +@{u}Working out the polygons@{uu} + +This is where it starts to get tricky. Each "face" of an object +(i.e. polygon) requires several pieces of information. + +Firstly, it requires a set of line end-points which go up to make +lines which form the polygon edges. This list of points must +form a CLOSED shape. It can however form this shape in whatever +way it likes, including crossing lines, and even several closed +shapes. If multiple shapes are present, then they act as if each +of them is complemented together (i.e. they will be transparent +where they overlap). There is one restriction however for +each polygon or face formed, all of the points of the face +should be in the same "plane" otherwise it wont draw correctly. + +So, going back to our cube example, the front face would consist +of the following linking lines: + +point 0 connected to 1, 1 to 2, 2 to 3 and 3 to 0. + +This is 4 lines, so our polygon definition becomes: + +[4, 0,1,1,2,2,3,3,0]:INT + +The other polygons can be similarly defined. + +@{u}Working out the order@{uu} + +One very important thing to note about how this vector module works +is that individual polygons are NOT depth sorted! And yet, even +very complex shapes like the 2 from the A1200 logo are drawn +correctly. How can this be so? + +This is where the 2 other pieces of information provided to the +rendering engine are used. Firstly, the "crossn" members of +the face OBJECT are used to describe which way a given polygon +is facing (out or in), this allows the render engine to automatically +forget about drawing the back sides of objects (known as backface +removal). Secondly, the order in which the polygons are drawn +(which is the same as the order they are defined in the creation +function) becomes important. + +This takes a bit of a mind-leap, but if you think about it carefully +enough, you can see that only drawing faces of objects that are indeed +facing you, and drawing them in the right order, you can get away +without having to do any depth sorting for most objects you are +likely to try to design. + +Take a table as an example. If you wish to create a 3d table, with +a solid, filled tabletop, and 4 square legs, you order the polygons +like this: + +draw the underside of the table +draw the 2 inside (the ones facing the centre of the table) faces of all + legs +draw the 2 outside faces of all of the legs +draw the sides of the table +draw the tabletop + +Since faces which are not "facing" the viewer are automatically culled, +it can see that the above scheme can be used to draw the table +accurately from EVERY concievable external view. + +And whats more, since no depth sorting step is required, computation +time is reduced. + +Some objects however cannot be drawn accurately all the time using this +technique - either make sure you get it right for the cases where +it is visible, break it into seperate objects, or simplify your object +:) + +In the case of this simple cube, the order is unimportant, since +there are no overlapping polygons (when drawn). + +@{u}Cross product indices@{uu} + +The cross product points (the "crossn" members mentioned above) are +very necessary though. Its not too difficult to work out these +either, provided you have a good spatial sense (unless you want +to keep drawing rotated views of your object anyway!). + +What you need to do for each face, is work out 3 points that +are in the same plane as the face (usually 3 points of the +face/polygon itself). Ideally, the 3 points should be as far apart +as possible, and lines from the middle one to the other 2 should +be close to 90 degrees (this is not necessary, but it provides +for a more accurate result). These 3 points must then be ordered +so that if you were to draw a line from point 0 to point 1, then +point 1 to point 2, the lines would move around in a clockwise +direction - this is if the object were rotated so that the given +polygon was facing you. + +So, for the cube, for front face, the 3 points could be: +0,1,2 +They could also be 1,2,3 or 2,3,0 or 3,0,1 as well. + +As an example, the back face would have to use 6,5,4 or +and combination in the same direction. If we used 4,5,6 +then it would mean that that back face was facing inwards +instead of outwards, and the object wouldn't be drawn +properly. Remember, the points need to traverse in a +clockwise direction around the polygon. + +Incidentally, theres nothing stopping you defining 2 faces +with the same points, but one facing outwards, and one inwards, +if you really needed two sided polygons. + +Finally, choose which colour index you want for each of the +polygons, taking into account the palette of the screen on +which you willbe working. + +You now basically have all the information required to generate +a new vector object. The following sections describe how you +do this by hand, or alternatively, how to use @{ReadNFF link ReadNFF} to +help you. + +@{u}Putting it together, all by hand@{uu} + +For the cube, we have: +front face: + [0,1,2, 1, [4, 0,1,1,2,2,3,3,0]:INT, 0]:face + + ^^^^^ - The 3 cross product indices calculated above + + ^ - The colour of this polygon + + ^ - The number of edges in the polygon + + ^^^^^^^^^^^^^^^ - The edge link table, + pairs of line endpoints + + ^ - padding + +This can be done for all of the 6 faces of the cube to create +the face array that needs to be fed into the newVectorObject() +call. + +With a bit more work, we get: + + [0,1,2, 1, [4, 0,1,1,2,2,3,3,0]:INT, 0, -> front + 6,5,4, 2, [4, 4,5,5,6,6,7,7,4]:INT, 0, -> back + 2,1,5, 3, [4, 1,5,5,6,6,2,2,1]:INT, 0, -> right + 4,0,3, 4, [4, 4,0,0,3,3,7,7,4]:INT, 0, -> left + 1,0,4, 5, [4, 0,1,1,5,5,4,4,0]:INT, 0, -> top + 7,3,2, 6, [4, 3,2,2,6,6,7,7,3]:INT, 0]:face -> bottom + +And in this case, the ordering is unimportant. + +Although above i usually defined the polygon using point indices +which followed on from each other around the edges of the +polygon, any ordering is allowed. For example, the front +could also have been defined as: + + [0,1,2, 1, [4, 3,2,0,1,0,3,1,2]:INT, 0, -> front + +Since, the lines formed still create the same shape. + +Combining everything so far, we can come up with the function call +required to make our cube exist. + + cube:=newVectorObject(0, -> basic type + 8, -> 8 points + 6, -> 6 faces + [-100,100,-100, -> 0 -> points array + 100,100,-100, -> 1 + 100,-100,-100, -> 2 + -100,-100,-100, -> 3 + -100,100,100, -> 4 + 100,100,100, -> 5 + 100,-100,100, -> 6 + -100,-100,100]:INT, -> 7 -> faces array below + [0,1,2, 1, [4, 0,1,1,2,2,3,3,0]:INT, 0, -> front + 6,5,4, 2, [4, 4,5,5,6,6,7,7,4]:INT, 0, -> back + 2,1,5, 3, [4, 1,5,5,6,6,2,2,1]:INT, 0, -> right + 4,0,3, 4, [4, 4,0,0,3,3,7,7,4]:INT, 0, -> left + 1,0,4, 5, [4, 0,1,1,5,5,4,4,0]:INT, 0, -> top + 7,3,2, 6, [4, 3,2,2,6,6,7,7,3]:INT, 0]:face); -> bottom + +And thats it! _phew_ Have a look at some of the examples, you +can appreciate how difficult some of them were to make :) + +@{u}Putting it together, using ReadNFF@{uu} + +Checkout the @{ReadNFF link ReadNFF} section for this. + +@endnode + +@node ReadNFF + +@{u}ReadNFF information@{uu} + +This is a badly written, kludgy, and awkward to use utility +that can however greatly simplify object creation. + +There not many @{options link rnffOptions} that need explaining. + +It reads in a file in NFF format (neutral file format?) and +converts it to sourcecode for the function call to create +the object in AmigaE format. + +Apart from designing objects using NFF by hand, there are +utilities such as tddd2nff which can be used to convert +Imagine objects to NFF, then NFF can be read by ReadNFF +to create a function call. However, imagine doesn't +know anything about polygon ordering, or correct +cross product direction (since imagine uses triangles, +ReadNFF is able to create the right cross product for +you - but it will often be in reverse of what you want) +doesn't work. So, it often requires a lot of hand-work +to get the objects to work anyway ... + +Going back to the cube example, we'll see how to use +ReadNFF to do some of the work. + + + 4-----5 + /| /| + 0-----1 | + | | | | + | | | | + | 7---|-6 + |/ |/ + 3-----2 + +For the ReadNFF file, what we need to do is to define all +of the coordinates for each polygon. We can also try +to order these points so that the polygons themselves +are defined in clockwise order (to help the code +create accurate cross product points), but this wont +always work if the object has >3 points because +of the point optimisation method used. + +So, we come up with the following definition for our cube: + +# a cube, in NFF format +# Comments start with #, and can be anywhere outside of +# polygon definitions +# A polygon definition is started with a p, followed by +# exactly one space, then a number which defines +# the number of points in that polygon +# There is 1 point per line, seperated with spaces +# with the x coordinate flush left (no leading +# spaces), with spaces (not tabs!) seperating +# each number +# front face +p 4 +-100 100 -100 +100 100 -100 +100 -100 -100 +-100 -100 -100 +# back face +p 4 +-100 -100 100 +100 -100 100 +100 100 100 +-100 100 100 +# right +p 4 +100 100 -100 +100 100 100 +100 -100 100 +100 -100 -100 +# left +p 4 +-100 100 -100 +-100 -100 -100 +-100 -100 100 +-100 100 100 +# top +p 4 +-100 100 -100 +-100 100 100 +100 100 100 +100 100 -100 +# bottom +p 4 +100 -100 -100 +-100 -100 -100 +-100 -100 100 +100 -100 100 + + +Ok, this can be fed into ReadNFF, and it comes up with: +(with a little editing) + + + obj:=newVectorObject(0,8,6, + [-100,100,-100, + 100,100,-100, + 100,-100,-100, + -100,-100,-100, + -100,-100,100, + 100,-100,100, + 100,100,100, + -100,100,100]:INT, + [0,1,2,0,[4,0,1,1,2,2,3,3,0]:INT,0, + 4,5,6,1,[4,4,5,5,6,6,7,7,4]:INT,0, + 1,6,5,2,[4,1,6,6,5,5,2,2,1]:INT,0, + 0,3,4,3,[4,0,3,3,4,4,7,7,0]:INT,0, + 0,7,6,4,[4,0,7,7,6,6,1,1,0]:INT,0, + 2,3,4,5,[4,2,3,3,4,4,5,5,2]:INT,0]:face + +The editing involved: + deleting a spurios point at the end of the point array + (ok, so its buggy as hell!) + adding the []:face to the face array, and moving + it from the start of the output to the end + and thats about it ... + +So, will this object work all on its own? I think so, since +because the way the points were ordered in the file, they +came out the same as the original. In this case, no more +editing is required, luckily. All that needs to be modified +is the colours, which isn't too difficult. + +With more complex objects, you may have to manually enter +in the cross product indices as well as the colours. It +does save a bit of work though. @{Torus link torus.e/main} shows +an example of an object created in Imagine 2.0 (using +create primitive/torus), which was then hand-edited to make +it work (every second polygon needed its cross indices +reversed). + +Hopefully one day i'll sit down and design either a proper +script language to make designing objects simpler, or +a 3d editor ... (although, other commitments may affect +this!). + +@endnode + + +@node rnffoptions "ReadNFF command line options" + + ReadNFF options: + + When you run it, it will open a window and the file, and as the + file is read in, a wireframe version of the object will + be displayed. The output of the program is simply dumped + to the cli inwhich it was run. Once finished, it will + automatically close the window. + + NAME/A + Supply the filename of the NFF file to read. Not much + error checking is done, so if this is in an invalid + format, you're not going to get much more than a bloody + mess out of it :) + + SHIFT/N + Amount to shift values before they are output. This is + only important with floating point input, or where + some scaling is needed. Each number conforms to a shift + up by 1. So, a shift value of 2 will mean the values + are multiplied by 4 before being converted to ingeter + format. + +@endnode + +@node Modify "Modifying Objects" + +@{u}Modifying Objects@{uu} + +Currently there is really only one way to modify objects - the +points in the object can be modified. + +You can't even modify the colours of polygons and so on +for copied objects (which would be handy ...) this should +be fixed soon ... + +@{u}Playing with Points@{uu} + +Using @{getVObjectPoints() link filledvector.guide/getvobjectpoints} the application programmer +has direct access to the coordinate table used by the object. +This can be modified in any way you see fit, say by scaling +the object and so on. + +One thing that must be noted thouh, is that the points should +continue to retain the same relationship to each other as +when the object was defined - otherwise the face setup, +backface removal and so on will not operate correctly. + +This still allows a bit of scope for object morhping and things +like that. (If i had the effort, i'd give you an example +of morphing objects :) + + +For objects that have been copied using @{copyVectorObject() link filledvector.guide/copyvectorobject} +you can modify the points freely, as each copy of the object +gets its own points. For cloned objects (@{cloneVectorObject() link filledvector.guide/clonevectorobject} +the point lists are NOT copied, so in this case, you must +be careful you dont accidentally change the wrong points! + + +When objects have been copied, this is where being able +to modify them becomes useful. You can use the rotation +and scaling functions in @{"matrix operations" link filledvector.guide/matrix} to +modify the copied object to create new versions. + +@endnode + +@node Using "Using Objects" + +@{u}Using Objects@{uu} + +Its all very well being able to create and bend objects and so +on, but how do you get them onto the screen usefully? + +One-off objects, like a swirling Zed logo are easy enough. +This uses a vector object list to allow the system itself +to handle the nitty gritty of depth sorting and so on, +and then uses the object's positions to position the +letters within their own "space". + +Using the @{matrix link filledvector.guide/matrix} functions, you +could build up your own library of functions designed to +position the objects (using thier position specifiers), +rotate them to the view you want, and then use the +@{"vector object list functions" link filledvector.guide/VectorObject} to do the depth sorting +and rendering for you. + +Finally, you could code everything yourself except for the +object rendering function, and just use @{drawVObject() link filledvector.guide/drawVObject} +to do the hard work, at reasonable speed. + + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/cube.e b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/cube.e new file mode 100644 index 0000000..167a81b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/cube.e @@ -0,0 +1,69 @@ + +/* + + A _simple_ cube example, using Workbench 1.3 code + + FilledVector.m module example code, Michael Zucchi + + This code in the public domain + +*/ + +OPT OSVERSION=33 + +MODULE 'intuition/intuition', 'intuition/screens', + 'tools/filledvector', 'tools/filledvdefs' + +DEF s0:PTR TO screen, s1:PTR TO screen, scr:PTR TO screen, + pc,cube:PTR TO vobject, destz=2000; + +PROC main() + +s0:=OpenS(320,200,4,0,'3d Cube'); -> 2 screens for doublebuffering +s1:=OpenS(320,200,4,0,'3d Cube'); + +pc:=newPolyContext(s0.bitmap,20) -> create context +setPolyFlags(pc,1,1) -> turn on zclipping + + cube:=newVectorObject(0, -> basic type + 8, -> 8 points + 6, -> 6 faces + [-100,100,-100, -> 0 -> points array + 100,100,-100, -> 1 + 100,-100,-100, -> 2 + -100,-100,-100, -> 3 + -100,100,100, -> 4 + 100,100,100, -> 5 + 100,-100,100, -> 6 + -100,-100,100]:INT, -> 7 -> faces array below + [0,1,2, 1, [4, 0,1,1,2,2,3,3,0]:INT, 0, -> front + 6,5,4, 2, [4, 4,5,5,6,6,7,7,4]:INT, 0, -> back + 2,1,5, 3, [4, 1,5,5,6,6,2,2,1]:INT, 0, -> right + 4,0,3, 4, [4, 4,0,0,3,3,7,7,4]:INT, 0, -> left + 1,0,4, 5, [4, 0,1,1,5,5,4,4,0]:INT, 0, -> top + 7,3,2, 6, [4, 3,2,2,6,6,7,7,3]:INT, 0]:face); -> bottom + +scr:=s0 +cube.pz:=1000; + +WHILE Mouse()<>3 + SetRast(scr.rastport,0); -> clear the screen + setPolyBitMap(pc, scr.bitmap); -> take note of change + drawVObject(pc, cube); -> draw to off-screen + + ScreenToFront(scr); -> bring it to the front + + cube.ax:=cube.ax+1 -> move object + cube.ay:=cube.ay+2 + cube.az:=cube.az+3 + cube.pz:=cube.pz+((destz-cube.pz)/6) + IF Abs(cube.pz-destz)<6 THEN destz:=Rnd(2000)+10 + + IF scr=s0 THEN scr:=s1 ELSE scr:=s0; -> swap screens +ENDWHILE + +freeVectorObject(cube); +CloseS(s0) +CloseS(s1) + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/cube39.e b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/cube39.e new file mode 100644 index 0000000..b037a6d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/cube39.e @@ -0,0 +1,67 @@ + +/* + + A _simple_ cube example, using Workbench 3.0 code + + FilledVector.m module example code, Michael Zucchi + + This code in the public domain + +*/ + +OPT OSVERSION=39 + +MODULE 'intuition/intuition', 'intuition/screens', + 'tools/filledvector', 'tools/filledvdefs', + 'tools/scrbuffer', + 'graphics/rastport' + +DEF scr,pc,cube:PTR TO vobject, destz=2000, + rast:rastport; + +PROC main() + +InitRastPort(rast); + +scr:=sb_OpenScreen([SA_DEPTH,4,SA_WIDTH,320,SA_HEIGHT,200,0],0); + +pc:=newPolyContext(sb_GetBitMap(scr),20) -> create context +setPolyFlags(pc,1,1) -> turn on zclipping + + cube:=newVectorObject(0, -> basic type + 8, -> 8 points + 6, -> 6 faces + [-100,100,-100, -> 0 -> points array + 100,100,-100, -> 1 + 100,-100,-100, -> 2 + -100,-100,-100, -> 3 + -100,100,100, -> 4 + 100,100,100, -> 5 + 100,-100,100, -> 6 + -100,-100,100]:INT, -> 7 -> faces array below + [0,1,2, 1, [4, 0,1,1,2,2,3,3,0]:INT, 0, -> front + 6,5,4, 2, [4, 4,5,5,6,6,7,7,4]:INT, 0, -> back + 2,1,5, 3, [4, 1,5,5,6,6,2,2,1]:INT, 0, -> right + 4,0,3, 4, [4, 4,0,0,3,3,7,7,4]:INT, 0, -> left + 1,0,4, 5, [4, 0,1,1,5,5,4,4,0]:INT, 0, -> top + 7,3,2, 6, [4, 3,2,2,6,6,7,7,3]:INT, 0]:face); -> bottom + +cube.pz:=1000; + +WHILE Mouse()<>3 + rast.bitmap:=sb_NextBuffer(scr); -> next screen + SetRast(rast,0); -> clear the off-screen + setPolyBitMap(pc, rast.bitmap); -> take note of change + drawVObject(pc, cube); -> draw to off-screen + + cube.ax:=cube.ax+1 -> move object + cube.ay:=cube.ay+2 + cube.az:=cube.az+3 + cube.pz:=cube.pz+((destz-cube.pz)/6) + IF Abs(cube.pz-destz)<6 THEN destz:=Rnd(2000)+10 +ENDWHILE + +freeVectorObject(cube); +sb_CloseScreen(scr); + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/torus.e b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/torus.e new file mode 100644 index 0000000..3c05163 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/torus.e @@ -0,0 +1,373 @@ + +/* + + Complex Workbench2.0+ Example of FilledVector.m + + This program creates a spinning Torus that spins + around on the back of Workbench. On a 1200 without + fastmem, it can hapily be run in the background without + causing noticeable delays. This object is a bit + more 'chunky' than the a1200 logo in wb1200, and + it can make the system feel a bit jerky. + + On the command line, specify the number of columns, + followed by the number of rows of images you want, + it defaults to 2x2. + + Run it with Workbench NOT inbackdrop mode, and to + remove it, run it again (it will interact with + the other wbbackdrop code in this archive) + + + The Torus was created in Imagine 2.0, and then saved. + The program tddd2nff (from t3dlib) was then used to + decompose the object into NFF. ReadNFF was then + used to convert the object to FilledVector.m format, + and following this, some hand editing (quite a lot ...) + was used to create a useable object. + + + Michael Zucchi, 1994. Program in public domain. + + (this is identical to wb1200.e, but has a different + object) +*/ + + + +OPT OSVERSION=37 + +MODULE 'tools/filledvector', 'tools/filledvdefs', + 'exec/lists', 'exec/ports', 'exec/nodes', 'exec/libraries', + 'intuition/screens', 'intuition/intuition', 'intuition/intuitionbase', + 'graphics/gfx', 'graphics/rastport', 'graphics/layers' + +DEF list:PTR TO mlh,pc, + ball:PTR TO vobject, + scr:PTR TO screen,abitm:PTR TO bitmap, + win:PTR TO window, + myrast:rastport, + mport:PTR TO mp, + width,height,depth, + rows,cols + +DEF dx,dy,dz + +/******************************************************************** + + main + + */ + +PROC main() +DEF rdargs, args:PTR TO LONG,p:PTR TO LONG, i, gfx:PTR TO lib + +cols:=2; +rows:=2; + +-> check arguments +args:=[0,0]; +IF rdargs:=ReadArgs('cols/N,rows/N', args, 0) + IF p:=args[0] THEN cols:=p[0] + IF p:=args[1] THEN rows:=p[0] + FreeArgs(rdargs); +ENDIF + +-> see if we're already running, if yes, signal the other version +Forbid(); +mport:=FindPort('backdrop'); +IF mport + Signal(mport.sigtask, Shl(1,mport.sigbit)) +ENDIF +Permit(); + +-> if we are not already running, start doing our thing +IF mport=0 + + -> create a public port where we can be found later + mport:=CreateMsgPort(); + mport::ln.name:='backdrop'; + mport::ln.pri:=-128; + AddPort(mport); + + -> open the backdrop window + win:=OpenWindowTagList(0, [WA_FLAGS, WFLG_BACKDROP OR WFLG_BORDERLESS OR WFLG_SIMPLE_REFRESH OR WFLG_NOCAREREFRESH, + WA_BACKFILL, LAYERS_NOBACKFILL, 0]); + + -> calculate size of each tile + width:=win.width/cols + height:=win.height/rows + IF height AND 1 THEN height++ + IF width AND 31 THEN width:=width+(32-(width AND 31)) + + -> find the depth of workbench, and open our rendering bitmap + scr:=LockPubScreen(0); + + depth:=scr.rastport::rastport.bitmap::bitmap.depth + gfx:=gfxbase; + + IF gfx.version<39 + abitm:=New(SIZEOF bitmap+(8*4)); + p:=abitm.planes + FOR i:=0 TO depth-1 DO p[i]:=AllocRaster(width,height); + InitBitMap(abitm,depth,width,height); + ELSE + abitm:=AllocBitMap(width,height,depth, + BMF_CLEAR+BMF_INTERLEAVED,0); + ENDIF + + UnlockPubScreen(0, scr); + + -> finish of setting up, then goto the main loop + SetTaskPri(FindTask(0), -128); + InitRastPort(myrast); + myrast.bitmap:=abitm; + + IF win + IF createobjects() + IF pc:=newPolyContext(abitm,50) + demo() + freePolyContext(pc) + ENDIF + freeobjects() + ENDIF + CloseWindow(win); + ENDIF + + IF gfx.version<39 + p:=abitm.planes + FOR i:=0 TO depth-1 DO FreeRaster(p[i], width,height); + InitBitMap(abitm,depth,width,height); + ELSE + FreeBitMap(abitm); + ENDIF + + RemPort(mport); + DeleteMsgPort(mport); + +ENDIF -> IF mport=0 + +ENDPROC + +/******************************************************************** + + Main loop. Render/move the object until we get told to stop + + */ + +PROC demo() + DEF p:position,x,y,c, sigbit, destz + + c:=0; + p.ax:=0;p.ay:=0;p.az:=0;p.px:=0;p.py:=0;p.pz:=750; + + destz:=Rnd(1000)+400; + sigbit:=Shl(1, mport.sigbit); + setPolyFlags(pc,1,1) + + -> main loop + WHILE (SetSignal(0, sigbit) AND sigbit)=0 -> see if we've been told to stop? + + cls() + setPolyBitMap(pc, abitm) + + IF c--<0 + setangles() + c:=60; + ENDIF + + -> pri back to 0, this will stop us losing cpu while blitter owned (hang!) + SetTaskPri(FindTask(0), 0); + + moveDrawVList(pc, list, p) + FOR x:=0 TO cols-1 + FOR y:=0 TO rows-1 + BltBitMapRastPort(abitm, 0,0, win.rport, x*width,y*height,width,height,$c0); + ENDFOR + ENDFOR + + -> its safe to go back to low pri again + SetTaskPri(FindTask(0), -128); + + -> move object + p.pz:=p.pz+((destz-p.pz)/6) + IF Abs(p.pz-destz)<6 THEN destz:=Rnd(4000)+200 + p.az:=p.az+dz; + p.ax:=p.ax-dx; + p.ay:=p.ay+dy; + + ENDWHILE +ENDPROC + +PROC setangles() +dx:=Rnd(9)-4 +dy:=Rnd(9)-4 +dz:=Rnd(9)-4 +ENDPROC + + +/******************************************************************** + + Clears the bitmap we're rendering into, then fills it with the + stipple pattern + + */ + +PROC cls() + SetRast(myrast, 0); + WaitBlit() + + MOVE.L abitm,A2 + MOVE.L 8(A2),A1 + MOVE.L height,D3 + LSR.L #1,D3 + SUBQ.L #1,D3 + MOVE.L #$55555555,D0 + MOVE.L #$AAAAAAAA,D1 +d_lp0: + MOVE.L A1,A0 + ADDA.W (A2),A1 + MOVE.L width,D2 + LSR.W #5,D2 + SUBQ.W #1,D2 +d_lp1: + MOVE.L D0,(A0)+ + DBF D2,d_lp1 + MOVE.L A1,A0 + ADDA.W (A2),A1 + MOVE.L width,D2 + LSR.W #5,D2 + SUBQ.W #1,D2 +d_lp2: + MOVE.L D1,(A0)+ + DBF D2,d_lp2 + DBF D3,d_lp0 +ENDPROC + +/******************************************************************** + + Create all of the objects + + */ + +PROC createobjects() + DEF stat=-1, + tmp:PTR TO vobject + + /* allocate a list, and add them to it */ + list:=newVList() + + ball:=newVectorObject(0,32,64, ->64, + [141,-142,100, + 200,0,100, + 277,-115,0, + 277,114,0, + 141,141,100, + 114,277,0, + 0,200,100, + -115,277,0, + -142,141,100, + -278,114,0, + -200,0,100, + -278,-115,0, + -142,-142,100, + -115,-278,0, + 0,-200,100, + 114,-278,0, + 200,0,-100, + 141,141,-100, + 0,200,-100, + -142,141,-100, + -200,0,-100, + -142,-142,-100, + 0,-200,-100, + 141,-142,-100, + 92,38,0, + 38,92,0, + -39,92,0, + -93,38,0, + -93,-39,0, + -39,-93,0, + 38,-93,0, + 92,-39,0, + 0,0,0]:INT, +[24,17,16,32,[3,16,17,17,24,24,16]:INT,0, -> all of these lines had their +24,25,17,33,[3,24,25,25,17,17,24]:INT,0, +25,18,17,34,[3,17,18,18,25,25,17]:INT,0, -> cross product numbers swapped +25,26,18,35,[3,25,26,26,18,18,25]:INT,0, +26,19,18,36,[3,18,19,19,26,26,18]:INT,0, -> +26,27,19,37,[3,26,27,27,19,19,26]:INT,0, +27,20,19,38,[3,19,20,20,27,27,19]:INT,0, -> +27,28,20,39,[3,27,28,28,20,20,27]:INT,0, +28,21,20,40,[3,20,21,21,28,28,20]:INT,0, -> +28,29,21,41,[3,28,29,29,21,21,28]:INT,0, +29,22,21,42,[3,21,22,22,29,29,21]:INT,0, -> +29,30,22,43,[3,29,30,30,22,22,29]:INT,0, +30,23,22,44,[3,22,23,23,30,30,22]:INT,0, -> +30,31,23,45,[3,30,31,31,23,23,30]:INT,0, +31,16,23,46,[3,23,16,16,31,31,23]:INT,0, -> +31,24,16,47,[3,31,24,24,16,16,31]:INT,0, +4,25,24,48,[3,24,25,25,4,4,24]:INT,0, -> +4,6,25,49,[3,4,6,6,25,25,4]:INT,0, +6,26,25,50,[3,25,26,26,6,6,25]:INT,0, -> +6,8,26,51,[3,6,8,8,26,26,6]:INT,0, +8,27,26,52,[3,26,27,27,8,8,26]:INT,0, -> +8,10,27,53,[3,8,10,10,27,27,8]:INT,0, +10,28,27,54,[3,27,28,28,10,10,27]:INT,0, -> +10,12,28,55,[3,10,12,12,28,28,10]:INT,0, +12,29,28,56,[3,28,29,29,12,12,28]:INT,0, -> +12,14,29,57,[3,12,14,14,29,29,12]:INT,0, +14,30,29,58,[3,29,30,30,14,14,29]:INT,0, -> +14,0,30,59,[3,14,0,0,30,30,14]:INT,0, +0,31,30,60,[3,30,31,31,0,0,30]:INT,0, -> +0,1,31,61,[3,0,1,1,31,31,0]:INT,0, +1,24,31,62,[3,31,24,24,1,1,31]:INT,0, -> +1,4,24,63,[3,1,4,4,24,24,1]:INT,0, + +16,3,2,16,[3,2,3,3,16,16,2]:INT,0, -> +16,17,3,17,[3,16,17,17,3,3,16]:INT,0, +17,5,3,18,[3,3,5,5,17,17,3]:INT,0, -> +17,18,5,19,[3,17,18,18,5,5,17]:INT,0, +18,7,5,20,[3,5,7,7,18,18,5]:INT,0, -> +18,19,7,21,[3,18,19,19,7,7,18]:INT,0, +19,9,7,22,[3,7,9,9,19,19,7]:INT,0, -> +19,20,9,23,[3,19,20,20,9,9,19]:INT,0, +20,11,9,24,[3,9,11,11,20,20,9]:INT,0, -> +20,21,11,25,[3,20,21,21,11,11,20]:INT,0, +21,13,11,26,[3,11,13,13,21,21,11]:INT,0, -> +21,22,13,27,[3,21,22,22,13,13,21]:INT,0, +22,15,13,28,[3,13,15,15,22,22,13]:INT,0, -> +22,23,15,29,[3,22,23,23,15,15,22]:INT,0, +23,2,15,30,[3,15,2,2,23,23,15]:INT,0, -> +23,16,2,31,[3,23,16,16,2,2,23]:INT,0, + +2,1,0,0,[3,0,1,1,2,2,0]:INT,0, -> +2,3,1,1,[3,2,3,3,1,1,2]:INT,0, +3,4,1,2,[3,1,4,4,3,3,1]:INT,0, -> +3,5,4,3,[3,3,5,5,4,4,3]:INT,0, +5,6,4,4,[3,4,6,6,5,5,4]:INT,0, -> +5,7,6,5,[3,5,7,7,6,6,5]:INT,0, +7,8,6,6,[3,6,8,8,7,7,6]:INT,0, -> +7,9,8,7,[3,7,9,9,8,8,7]:INT,0, +9,10,8,8,[3,8,10,10,9,9,8]:INT,0, -> +9,11,10,9,[3,9,11,11,10,10,9]:INT,0, +11,12,10,10,[3,10,12,12,11,11,10]:INT,0, -> +11,13,12,11,[3,11,13,13,12,12,11]:INT,0, +13,14,12,12,[3,12,14,14,13,13,12]:INT,0, -> +13,15,14,13,[3,13,15,15,14,14,13]:INT,0, +15,0,14,14,[3,14,0,0,15,15,14]:INT,0, -> +15,2,0,15,[3,15,2,2,0,0,15]:INT,0]:face) + + + ball.pz:=0 + addVObject(list,ball) + + +ENDPROC stat + +PROC freeobjects() + freeVList(list,1) /* also free nodes */ +ENDPROC + + + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/wb1200.e b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/wb1200.e new file mode 100644 index 0000000..ceba044 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/wb1200.e @@ -0,0 +1,444 @@ + +/* + + Complex Workbench2.0+ Example of FilledVector.m + + This program creates a spinning "A1200" logo that spins + around on the back of Workbench. On a 1200 without + fastmem, it can hapily be run in the background without + causing noticeable delays. + + On the command line, specify the number of columns, + followed by the number of rows of images you want, + it defaults to 2x2. + + Run it with Workbench NOT inbackdrop mode, and to + remove it, run it again. + + Michael Zucchi, 1994. Program in public domain. + +*/ + + + +OPT OSVERSION=37 + +MODULE 'tools/filledvector', 'tools/filledvdefs', + 'exec/lists', 'exec/ports', 'exec/nodes', 'exec/libraries', + 'intuition/screens', 'intuition/intuition', 'intuition/intuitionbase', + 'graphics/gfx', 'graphics/rastport', 'graphics/layers' + +DEF list:PTR TO mlh,pc, + let_0:PTR TO vobject, + let_1:PTR TO vobject, + let_2:PTR TO vobject, + let_A:PTR TO vobject, + scr:PTR TO screen,abitm:PTR TO bitmap, + win:PTR TO window, + myrast:rastport, + mport:PTR TO mp, + width,height,depth, + rows,cols + +DEF dx,dy,dz + +/******************************************************************** + + main + + */ + +PROC main() +DEF rdargs, args:PTR TO LONG,p:PTR TO LONG, i, gfx:PTR TO lib + +cols:=2; +rows:=2; + +-> check arguments +args:=[0,0]; +IF rdargs:=ReadArgs('cols/N,rows/N', args, 0) + IF p:=args[0] THEN cols:=p[0] + IF p:=args[1] THEN rows:=p[0] + FreeArgs(rdargs); +ENDIF + +-> see if we're already running, if yes, signal the other version +Forbid(); +mport:=FindPort('backdrop'); +IF mport + Signal(mport.sigtask, Shl(1,mport.sigbit)) +ENDIF +Permit(); + +-> if we are not already running, start doing our thing +IF mport=0 + + -> create a public port where we can be found later + mport:=CreateMsgPort(); + mport::ln.name:='backdrop'; + mport::ln.pri:=-128; + AddPort(mport); + + -> open the backdrop window + win:=OpenWindowTagList(0, [WA_FLAGS, WFLG_BACKDROP OR WFLG_BORDERLESS OR WFLG_SIMPLE_REFRESH OR WFLG_NOCAREREFRESH, + WA_BACKFILL, LAYERS_NOBACKFILL, 0]); + + -> calculate size of each tile + width:=win.width/cols + height:=win.height/rows + IF height AND 1 THEN height++ + IF width AND 31 THEN width:=width+(32-(width AND 31)) + + -> find the depth of workbench, and open our rendering bitmap + scr:=LockPubScreen(0); + + depth:=scr.rastport::rastport.bitmap::bitmap.depth + gfx:=gfxbase; + + IF gfx.version<39 + abitm:=New(SIZEOF bitmap+(8*4)); + p:=abitm.planes + FOR i:=0 TO depth-1 DO p[i]:=AllocRaster(width,height); + InitBitMap(abitm,depth,width,height); + ELSE + abitm:=AllocBitMap(width,height,depth, + BMF_CLEAR+BMF_INTERLEAVED,0); + ENDIF + + UnlockPubScreen(0, scr); + + -> finish of setting up, then goto the main loop + SetTaskPri(FindTask(0), -128); + InitRastPort(myrast); + myrast.bitmap:=abitm; + + IF win + IF createobjects() + IF pc:=newPolyContext(abitm,50) + demo() + freePolyContext(pc) + ENDIF + freeobjects() + ENDIF + CloseWindow(win); + ENDIF + + IF gfx.version<39 + p:=abitm.planes + FOR i:=0 TO depth-1 DO FreeRaster(p[i], width,height); + InitBitMap(abitm,depth,width,height); + ELSE + FreeBitMap(abitm); + ENDIF + + RemPort(mport); + DeleteMsgPort(mport); + +ENDIF -> IF mport=0 + +ENDPROC + +/******************************************************************** + + Main loop. Render/move the object until we get told to stop + + */ + +PROC demo() + DEF p:position,x,y,c, sigbit, destz + + c:=0; + p.ax:=0;p.ay:=0;p.az:=0;p.px:=0;p.py:=0;p.pz:=750; + + destz:=Rnd(1000)+400; + sigbit:=Shl(1, mport.sigbit); + setPolyFlags(pc,1,1) + + -> main loop + WHILE (SetSignal(0, sigbit) AND sigbit)=0 -> see if we've been told to stop? + + cls() + setPolyBitMap(pc, abitm) + + IF c--<0 + setangles() + c:=60; + ENDIF + + -> pri back to 0, this will stop us losing cpu while blitter owned (hang!) + SetTaskPri(FindTask(0), 0); + + moveDrawVList(pc, list, p) + FOR x:=0 TO cols-1 + FOR y:=0 TO rows-1 + BltBitMapRastPort(abitm, 0,0, win.rport, x*width,y*height,width,height,$c0); + ENDFOR + ENDFOR + + -> its safe to go back to low pri again + SetTaskPri(FindTask(0), -128); + + -> move object + p.pz:=p.pz+((destz-p.pz)/6) + IF Abs(p.pz-destz)<6 THEN destz:=Rnd(4000)+200 + p.az:=p.az+dz; + p.ax:=p.ax-dx; + p.ay:=p.ay+dy; + + ENDWHILE +ENDPROC + +PROC setangles() +dx:=Rnd(9)-4 +dy:=Rnd(9)-4 +dz:=Rnd(9)-4 +ENDPROC + + +/******************************************************************** + + Clears the bitmap we're rendering into, then fills it with the + stipple pattern + + */ + +PROC cls() + SetRast(myrast, 0); + WaitBlit() + + MOVE.L abitm,A2 + MOVE.L 8(A2),A1 + MOVE.L height,D3 + LSR.L #1,D3 + SUBQ.L #1,D3 + MOVE.L #$55555555,D0 + MOVE.L #$AAAAAAAA,D1 +d_lp0: + MOVE.L A1,A0 + ADDA.W (A2),A1 + MOVE.L width,D2 + LSR.W #5,D2 + SUBQ.W #1,D2 +d_lp1: + MOVE.L D0,(A0)+ + DBF D2,d_lp1 + MOVE.L A1,A0 + ADDA.W (A2),A1 + MOVE.L width,D2 + LSR.W #5,D2 + SUBQ.W #1,D2 +d_lp2: + MOVE.L D1,(A0)+ + DBF D2,d_lp2 + DBF D3,d_lp0 +ENDPROC + +/******************************************************************** + + Create all of the objects + + */ + +PROC createobjects() + DEF stat=-1, + tmp:PTR TO vobject + + /* allocate a list, and add them to it */ + list:=newVList() + + let_0:=newVectorObject(0,16,10, + [8*3,126*3,-20*4, + 37*3,30*3,-20*4, + 83*3,0*3,-20*4, + 134*3,0*3,-20*4, + 153*3,31*3,-20*4, + 111*3,144*3,-20*4, + 79*3,165*3,-20*4, + 20*3,165*3,-20*4, + 8*3,126*3,20*4, + 37*3,30*3,20*4, + 83*3,0*3,20*4, + 134*3,0*3,20*4, + 153*3,31*3,20*4, + 111*3,144*3,20*4, + 79*3,165*3,20*4, + 20*3,165*3,20*4]:INT, + [0,1,9,1, + [4,0,1,1,9,9,8,8,0]:INT,0, + 0+1,1+1,9+1,2, + [4,0+1,1+1,1+1,9+1,9+1,8+1,8+1,0+1]:INT,0, + 0+2,1+2,9+2,3, + [4,0+2,1+2,1+2,9+2,9+2,8+2,8+2,0+2]:INT,0, + 0+3,1+3,9+3,4, + [4,0+3,1+3,1+3,9+3,9+3,8+3,8+3,0+3]:INT,0, + 0+4,1+4,9+4,5, + [4,0+4,1+4,1+4,9+4,9+4,8+4,8+4,0+4]:INT,0, + 0+5,1+5,9+5,6, + [4,0+5,1+5,1+5,9+5,9+5,8+5,8+5,0+5]:INT,0, + 0+6,1+6,9+6,7, + [4,0+6,1+6,1+6,9+6,9+6,8+6,8+6,0+6]:INT,0, + 7,0,8,8, + [4,7,0,0,8,8,15,15,7]:INT,0, + -> front/back + 4,1,0,9, + [8,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,0]:INT,0, + 8,9,12,10, + [8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,8]:INT,0]:face); + + + + let_1:=newVectorObject(0,8,6, + [1*3,165*3,-20*4, + 22*3,165*3,-20*4, + 105*3,0*3,-20*4, + 84*3,0*3,-20*4, + 1*3,165*3,20*4, + 22*3,165*3,20*4, + 105*3,0*3,20*4, + 84*3,0*3,20*4]:INT, + [0,1,2,1, + [4,1,2,2,3,3,0,0,1]:INT,0, + 6,5,4,2, + [4,7,6,6,5,5,4,4,7]:INT,0, + 5,6,2,3, + [4,6,2,6,5,5,1,1,2]:INT,0, + 7,4,0,4, + [4,3,7,7,4,4,0,0,3]:INT,0, + 5,1,0,5, + [4,4,5,5,1,1,0,0,4]:INT,0, + 6,7,3,6, + [4,6,7,7,3,3,2,2,6]:INT,0]:face); + + let_A:=newVectorObject(0,22,13, + [2*3,165*3,-20*4, + 128*3,0*3,-20*4, + 148*3,0*3,-20*4, + 148*3,165*3,-20*4, + 127*3,165*3,-20*4, + 127*3,100*3,-20*4, + 76*3,100*3,-20*4, + 27*3,165*3,-20*4, + 127*3,84*3,-20*4, + 127*3,33*3,-20*4, + 88*3,84*3,-20*4, + 2*3,165*3,20*4, + 128*3,0*3,20*4, + 148*3,0*3,20*4, + 148*3,165*3,20*4, + 127*3,165*3,20*4, + 127*3,100*3,20*4, + 76*3,100*3,20*4, + 27*3,165*3,20*4, + 127*3,84*3,20*4, + 127*3,33*3,20*4, + 88*3,84*3,20*4]:INT, + [ + 9,10,21,2, -> left inside A + [4,9,10,10,21,21,20,20,9]:INT,0, + 8,9,20,1, -> inside right A + [4,8,9,9,20,20,19,19,8]:INT,0, + 4,5,16,4, -> right inside A + [4,4,5,5,16,16,15,15,4]:INT,0, + 5,6,17,5, -> inside top leg + [4,5,6,6,17,17,16,16,5]:INT,0, + 6,7,18,6, -> left inside leg + [4,6,7,7,18,18,17,17,6]:INT,0, + 10,8,19,3, -> bottom inside A + [4,10,8,8,19,19,21,21,10]:INT,0, + 0,1,12,7, -> left out + [4,0,1,1,12,12,11,11,0]:INT,0, + 1,2,13,8, -> top + [4,1,2,2,13,13,12,12,1]:INT,0, + 2,3,14,9, -> right out + [4,2,3,3,14,14,13,13,2]:INT,0, + 3,4,15,10, -> bottom leg right + [4,3,4,4,15,15,14,14,3]:INT,0, + 7,0,11,11, -> bottom leg left + [4,7,0,0,11,11,18,18,7]:INT,0, + 3,2,0,12, -> front + [11,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,0,8,9,9,10,10,8]:INT,0, + 11,13,14,13, -> back + [11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,11,19,20,20,21,21,19]:INT,0]:face); + + + let_2:=newVectorObject(0,24,14, + [54*3,40*3,-20*4, + 27*3,34*3,-20*4, + 92*3,-2*3,-20*4, + 159*3,22*3,-20*4, + 141*3,74*3,-20*4, + 52*3,149*3,-20*4, + 137*3,149*3,-20*4, + 137*3,165*3,-20*4, + 2*3,165*3,-20*4, + 119*3,63*3,-20*4, + 125*3,31*3,-20*4, + 93*3,21*3,-20*4, + + 54*3,40*3,20*4, + 27*3,34*3,20*4, + 92*3,-2*3,20*4, + 159*3,22*3,20*4, + 141*3,74*3,20*4, + 52*3,149*3,20*4, + 137*3,149*3,20*4, + 137*3,165*3,20*4, + 2*3,165*3,20*4, + 119*3,63*3,20*4, + 125*3,31*3,20*4, + 93*3,21*3,20*4]:INT, + + /* since no 'depth' sorting is done - ensure innermost surfaces drawn first */ + [ + 5,6,18,19, -> top of base + [4,5,6,6,18,18,17,17,5]:INT,0, + 9,10,22,21, -> inside top left + [4,9,10,10,22,22,21,21,9]:INT,0, + 10,11,23,23, -> inside top mid + [4,10,11,11,23,23,22,22,10]:INT,0, + 11,0,12,24, -> inside top left + [4,11,0,0,12,12,23,23,11]:INT,0, + 8,9,21,16, -> top of rasier + [4,8,9,9,21,21,20,20,8]:INT,0, + 0,1,13,22, -> front edge + [4,0,1,1,13,13,12,12,0]:INT,0, + 4,5,17,17, -> bottom of raiser + [4,4,5,5,17,17,16,16,4]:INT,0, + 3,4,16,13, -> right side + [4,3,4,4,16,16,15,15,3]:INT,0, + 6,7,19,18, -> right side of base + [4,6,7,7,19,19,18,18,6]:INT,0, + 7,8,20,14, -> base + [4,7,8,8,20,20,19,19,7]:INT,0, + 2,3,15,15, -> top right + [4,2,3,3,15,15,14,14,2]:INT,0, + 1,2,14,20, -> top left + [4,1,2,2,14,14,13,13,1]:INT,0, + + 2,1,0,25, /* front face */ + [12,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,0]:INT,0, + 12,13,14,26, /* rear face */ + [12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,12]:INT,0]:face); + + + /* add objects to the list, and position them accordingly */ + addVObject(list,let_A) + let_A.px:=-1275-100 + addVObject(list,let_1) + let_1.px:=-735-100 + addVObject(list,let_2) + let_2.px:=-345-100 + tmp:=cloneVectorObject(let_0); + addVObject(list,let_0) + let_0.px:=195-100 + addVObject(list,tmp); + tmp.px:=735-100 + +ENDPROC stat + +PROC freeobjects() + freeVList(list,1) /* also free nodes */ +ENDPROC + + + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/zed.e b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/zed.e new file mode 100644 index 0000000..19d8e4c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/examples/zed.e @@ -0,0 +1,267 @@ +/* + More complex demonstration of filledvector.m, with + a multiple object display, and using the matrix + functions to modify an object after its been made + + Michael Zucchi, 1994, This code in the public domain + */ + +OPT OSVERSION=39 + +MODULE 'tools/filledvector', 'tools/filledvdefs', 'exec/lists', 'intuition/screens', + 'tools/scrbuffer', 'graphics/rastport' + +DEF list:PTR TO mlh,screen,pc, + zed:PTR TO vobject,eee:PTR TO vobject,dee:PTR TO vobject, + scr:PTR TO screen + +PROC main() + /* create objects, and add to list */ + IF createobjects() + warpobjects() + IF screen:=sb_OpenScreen([SA_DEPTH,4,SA_WIDTH,320,SA_HEIGHT,256,SA_DISPLAYID,$0000,0],0) + IF pc:=newPolyContext(sb_GetBitMap(screen),50) + demo() + freePolyContext(pc) + ENDIF + sb_CloseScreen(screen) + ENDIF + freeobjects() + ENDIF +ENDPROC + +/* just demos basic rendering until the user chooses to exit */ + +PROC demo() + DEF p:position,bitm,myrp:rastport + + p.ax:=0;p.ay:=0;p.az:=0;p.px:=80;p.py:=0;p.pz:=8000; + + setPolyFlags(pc,1,1) -> z clipping on + + bitm:=sb_NextBuffer(screen) + sb_NextBuffer(screen) + scr:=sb_GetScreen(screen); + InitRastPort(myrp); + + WHILE Mouse()<>3 + bitm:=sb_NextBuffer(screen) + myrp.bitmap:=bitm + SetRast(myrp,0); + setPolyBitMap(pc, bitm) + + moveDrawVList(pc, list, p) + p.az:=p.az+1; + p.ax:=p.ax-2; + p.ay:=p.ay+3; + + IF Mouse()=1 THEN p.pz:=p.pz+35 + IF Mouse()=2 THEN p.pz:=p.pz-35 + ENDWHILE + + +ENDPROC + +PROC createobjects() + DEF stat=-1 + + /* allocate a list, and add them to it */ + list:=newVList() + + /* the letter z */ + zed:=newVectorObject(0,20,12, + [-178*3,98*3,20*4, /* points */ + -34*3,98*3,20*4, + -34*3,66*3,20*4, + -146*3,-50*3,20*4, + -34*3,-50*3,20*4, + -34*3,-82*3,20*4, + -178*3,-82*3,20*4, + -178*3,-50*3,20*4, + -66*3,66*3,20*4, + -178*3,66*3,20*4, + -178*3,98*3,-20*4, /* lower side */ + -34*3,98*3,-20*4, + -34*3,66*3,-20*4, + -146*3,-50*3,-20*4, + -34*3,-50*3,-20*4, + -34*3,-82*3,-20*4, + -178*3,-82*3,-20*4, + -178*3,-50*3,-20*4, + -66*3,66*3,-20*4, + -178*3,66*3,-20*4]:INT, + /* since no 'depth' sorting is done - ensure innermost surfaces drawn first */ + [3,4,14,1, /* bottom inside edge */ + [4,3,4,4,14,14,13,13,3]:INT,0, + 8,9,19,2, /* top inside edge */ + [4,8,9,9,19,19,18,18,8]:INT,0, + + 2,3,13,3, /* sloping inside edge */ + [4,2,3,3,13,13,12,12,2]:INT,0, + 7,8,18,4, /* sloping inside edge-left */ + [4,7,8,8,18,18,17,17,7]:INT,0, + + 2,1,0,5, /* front face */ + [10,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,0]:INT,0, + 10,11,12,6, /* back face */ + [10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,10]:INT,0, + 0,1,11,7, /* top bar of z */ + [4,0,1,1,11,11,10,10,0]:INT,0, + 5,6,16,8, /* bottom bar of z */ + [4,5,6,6,16,16,15,15,5]:INT,0, + 1,2,12,9, /* first back end */ + [4,1,2,2,12,12,11,11,1]:INT,0, + 4,5,15,10, /* next back end */ + [4,4,5,5,15,15,14,14,4]:INT,0, + 6,7,17,11, /* left lower end */ + [4,6,7,7,17,17,16,16,6]:INT,0, + 9,0,10,12, /* upper left end */ + [4,9,0,0,10,10,19,19,9]:INT,0]:face); + + /* the letter e */ + eee:=newVectorObject(0,24,14, + [0*3,0*3,20*4, + 66*3,0*3,20*4, + 66*3,-18*3,20*4, + 18*3,-18*3,20*4, + 18*3,-34*3,20*4, + 50*3,-34*3,20*4, + 50*3,-50*3,20*4, + 18*3,-50*3,20*4, + 18*3,-66*3,20*4, + 66*3,-66*3,20*4, + 66*3,-82*3,20*4, + 0*3,-82*3,20*4, + 0*3,0*3,-20*4, + 66*3,0*3,-20*4, + 66*3,-18*3,-20*4, + 18*3,-18*3,-20*4, + 18*3,-34*3,-20*4, + 50*3,-34*3,-20*4, + 50*3,-50*3,-20*4, + 18*3,-50*3,-20*4, + 18*3,-66*3,-20*4, + 66*3,-66*3,-20*4, + 66*3,-82*3,-20*4, + 0*3,-82*3,-20*4]:INT, + + /* since no 'depth' sorting is done - ensure innermost surfaces drawn first */ + [3,4,16,13, /* inside top right of E */ + [4,3,4,4,16,16,15,15,3]:INT,0, + 7,8,20,14, /* inside lower right of E */ + [4,7,8,8,20,20,19,19,7]:INT,0, + 2,3,15,15, /* upper inner E */ + [4,2,3,3,15,15,14,14,2]:INT,0, + 8,9,21,16, /* lower inner */ + [4,8,9,9,21,21,20,20,8]:INT,0, + 4,5,17,17, /* top of bar */ + [4,4,5,5,17,17,16,16,4]:INT,0, + 6,7,19,18, /* bottom of bar */ + [4,6,7,7,19,19,18,18,6]:INT,0, + 5,6,18,19, /* front of bar */ + [4,5,6,6,18,18,17,17,5]:INT,0, + /* all outside surfaces */ + 1,2,14,20, /* top front cap */ + [4,1,2,2,14,14,13,13,1]:INT,0, + 9,10,22,21, /* bottom front cap */ + [4,9,10,10,22,22,21,21,9]:INT,0, + + 0,1,13,22, /* top */ + [4,0,1,1,13,13,12,12,0]:INT,0, + 10,11,23,23, /* bottom */ + [4,10,11,11,23,23,22,22,10]:INT,0, + 11,0,12,24, /* back */ + [4,11,0,0,12,12,23,23,11]:INT,0, + + 2,1,0,25, /* front face */ + [12,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,0]:INT,0, + 12,13,14,26, /* rear face */ + [12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,12]:INT,0]:face); + + + /* the letter d */ + dee:=newVectorObject(0,24,14, + [-34*3,42*3,20*4, + 18*3,42*3,20*4, + 34*3,26*3,20*4, + 34*3,-26*3,20*4, + 18*3,-42*3,20*4, + -34*3,-42*3,20*4, + -18*3,26*3,20*4, + 0,26*3,20*4, + 18*3,10*3,20*4, + 18*3,-10*3,20*4, + 0,-26*3,20*4, + -18*3,-26*3,20*4, + + -34*3,42*3,-20*4, + 18*3,42*3,-20*4, + 34*3,26*3,-20*4, + 34*3,-26*3,-20*4, + 18*3,-42*3,-20*4, + -34*3,-42*3,-20*4, + -18*3,26*3,-20*4, + 0,26*3,-20*4, + 18*3,10*3,-20*4, + 18*3,-10*3,-20*4, + 0,-26*3,-20*4, + -18*3,-26*3,-20*4]:INT, + + [19,7,6,27, /* top inner */ + [4,6,7,7,19,19,18,18,6]:INT,0, + 20,8,7,28, /* top right inner */ + [4,7,8,8,20,20,19,19,7]:INT,0, + 21,9,8,29, /* right inner */ + [4,8,9,9,21,21,20,20,8]:INT,0, + 22,10,9,30, /* lower right inner */ + [4,9,10,10,22,22,21,21,9]:INT,0, + 23,11,10,31, /* lower inner */ + [4,10,11,11,23,23,22,22,10]:INT,0, + 18,6,11,32, /* inner left */ + [4,11,6,6,18,18,23,23,11]:INT,0, + + 0,1,13,33, /* top */ + [4,0,1,1,13,13,12,12,0]:INT,0, + 1,2,14,34, /* top right */ + [4,1,2,2,14,14,13,13,1]:INT,0, + 2,3,15,35, /* right */ + [4,2,3,3,15,15,14,14,2]:INT,0, + 3,4,16,36, /* lower right */ + [4,3,4,4,16,16,15,15,3]:INT,0, + 4,5,17,37, /* bottom */ + [4,4,5,5,17,17,16,16,4]:INT,0, + + 5,0,12,38, /* back */ + [4,5,0,0,12,12,17,17,5]:INT,0, + + 2,1,0,39, /* front face */ + [12,0,1,1,2,2,3,3,4,4,5,5,0,6,7,7,8,8,9,9,10,10,11,11,6]:INT,0, + 12,13,14,40, /* rear face */ + [12,12,13,13,14,14,15,15,16,16,17,17,12,18,19,19,20,20,21,21,22,22,23,23,18]:INT,0]:face); + + dee.px:=130*3;dee.py:=-42*3; -> real position + + addVObject(list,zed) + addVObject(list,eee) + addVObject(list,dee) + +ENDPROC stat + +PROC freeobjects() + freeVList(list,1) /* also free nodes */ +ENDPROC + +/* + Use the matrix functions to modify the objects a little bit + */ + +PROC warpobjects() +DEF mat:matrix + +setMatRotate(mat, 0,40,0); +matApply3(mat,24,getVObjectPoints(dee),getVObjectPoints(dee)) +setMatRotate(mat, 0,-40,0); +matApply3(mat,20,getVObjectPoints(zed),getVObjectPoints(zed)) + +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/filledvdefs.e b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/filledvdefs.e new file mode 100644 index 0000000..15b373f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/filledvdefs.e @@ -0,0 +1,80 @@ +/* + FilledVDefs.e + + Module for FilledVector.m definitions + + 1994 Michael Zucchi +*/ + +OPT MODULE + +/* + * Polygon Context Flags + */ + +EXPORT CONST PCF_ZCLIP = 1 -> perform z clipping? + + +/* + * A position object which is used by several function to define + * a locality and an orientation in one. + * (i.e. a position and angle) + */ + +EXPORT OBJECT position + ax:INT -> x,y,z angles + ay:INT + az:INT + px:INT -> x,y,z position + py:INT + pz:INT +ENDOBJECT + +/* + * Each VObject allocated will return one of these. They can be linked + * into lists using the VList functions. + * The position/orientation of the object can also be conveniently + * stoed and accessed from here. Note however that there is considerably + * more PRIVATE data following ... + */ + +EXPORT OBJECT vobject + next:LONG -> next field for a linked list + prev:LONG -> prev field + ax:INT -> angles of object (depends on rendering function used) + ay:INT + az:INT + px:INT -> position of object + py:INT + pz:INT +ENDOBJECT -> more data, PRIVATE + +/* + * Each face of an object uses one of these. These are used also + * to define a new object. + */ + +EXPORT OBJECT face + cross0:INT -> the 3 points used for the cross-product visibility test + cross1:INT + cross2:INT + colour:INT -> the colour of the object, the bottom 8 bits represent the + -> base colour. In the future, the top 8 bits MAY be used + -> to represent an alternate colour for stipling. + facelist:PTR TO INT -> pointer to the polygon definition, which + -> includes first: + -> a INT which says how many lines are in this polygon + -> pairs of INT's which point to the vertices used by + -> each of the lines of the polygon + pad00:LONG -> future expansion maybe (makes the OBJECT 16 bytes long) +ENDOBJECT + +/* + * A matix object, as used by the various matrix manipulation + * functions. Currently uses 3x3 matrices, but perhaps + * some 4x4 matrix routines will be written someday (?) + */ + +EXPORT OBJECT matrix + matdata[10]:ARRAY OF INT +ENDOBJECT diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/readnff b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/readnff new file mode 100644 index 0000000..307eaad Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Tools/FilledVector/readnff differ diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Hook/hooktest.e b/amigae33a/E_v3.3a/Src/Src/Tools/Hook/hooktest.e new file mode 100644 index 0000000..0ab3556 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Hook/hooktest.e @@ -0,0 +1,16 @@ +-> test hooks + +MODULE 'utility', 'utility/hooks', 'tools/installhook' + +PROC main() + DEF myhook:hook + IF utilitybase:=OpenLibrary('utility.library',37) + installhook(myhook,{myfunction}) + CallHookPkt(myhook,1,2) + CloseLibrary(utilitybase) + ENDIF +ENDPROC + +PROC myfunction(hook,obj,msg) + WriteF('hook: $\h, obj: \d, msg: \d\n',hook,obj,msg) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Hook/installhook.e b/amigae33a/E_v3.3a/Src/Src/Tools/Hook/installhook.e new file mode 100644 index 0000000..c33ec9b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Hook/installhook.e @@ -0,0 +1,22 @@ +OPT MODULE + +EXPORT PROC installhook(hook,func) + MOVE.L hook,A0 + MOVE.L func,12(A0) + LEA hookentry(PC),A1 + MOVE.L A1,8(A0) + MOVE.L A4,16(A0) + MOVE.L A0,D0 +ENDPROC D0 + +hookentry: + MOVEM.L D2-D7/A2-A6,-(A7) + MOVE.L 16(A0),A4 + MOVE.L A0,-(A7) + MOVE.L A2,-(A7) + MOVE.L A1,-(A7) + MOVE.L 12(A0),A0 + JSR (A0) + LEA 12(A7),A7 + MOVEM.L (A7)+,D2-D7/A2-A6 + RTS diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/ILBM/ilbm.guide b/amigae33a/E_v3.3a/Src/Src/Tools/ILBM/ilbm.guide new file mode 100644 index 0000000..7cde5f8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/ILBM/ilbm.guide @@ -0,0 +1,335 @@ +@database ilbm.guide + +@$VER: ilbm.Guide 1.0 (14.02.94). +@toc ilbm.m/main +@author Michael Zucchi +@(c) 1994 Michael Zucchi, All right reserved + + +@node Main "ilbm.guide" +@next "Commands" + +IFF ILBM picture loading module for AmigaE2.5+ + +© 1993 @{"Michael Zucchi" Link "Author"} +All Rights Reserved + +This document describes the ilbm.m module, which includes commands for loading +and displaying (if possible) IFF ilbm pictures. The functions provided are +intended to be as easy to use as possible, while providing a lot of flexibility. + +The following sections are available: + + @{" OverView " Link "OverView"} some of the ideas behind the module + + @{u}Module functions@{uu} + + @{"ilbm_New() " Link "ilbm_New"} to open a picture + @{"ilbm_Dispose() " Link "ilbm_Dispose"} to cleanup + + @{"ilbm_PictureInfo()" Link "ilbm_PictureInfo"} to get picture size/palette etc + @{"ilbm_LoadPicture()" Link "ilbm_LoadPicture"} loads data into a bitmap/screen + + @{"ilbm_FreeBitMap() " Link "ilbm_FreeBitMap"} to free a bitmap allocated by LoadPicture + + @{" Examples " Link Examples} + + @{b}NOTE: This module @{i}requires @{ui}Workbench 2.0 (V36) or higher! Please + make sure that this version of the system libraries is present before + using these functions.@{ub} + + @{b}NOTE!!! Due to a small oversight, only COMPRESSED ilbm's currently work. + This will be fixed soon ... i hope?@{ub} (uncompressed ilbm's are uncommon anyway) + +@endnode + +@node OverView "Module overview" + +Not much to say really - this module is just for loading/saving IFF ILBM's! +Designed to be used to easily load ilbm's for picture screens, or into bitmaps +for later blitting, or anywhere else where an ilbm would be useful. + +One thing - this module will work on V36 systems, however, on V39+ systems, +new graphics.library functions are used wherever possible. e.g. LoadRGB32() +for full 24-bit palettes on AGA+ machines. + +@{b}future plans@{ub} + +As it stands, the module is ideal for loading pictures for displaying. Another +idea that may be implemented is a 'chunky' mode loading function (e.g. +ILBML_CHUNKY) whereby the data is converted to byte-per-pixel format before +being output to a byte array. +A save function would also be useful - i havent implemented it yet because of +lack of time, and also to keep the module small. + +Actually ... + +This sort of thing should be handled much better using datatypes. Unfortunately, +they're a bit of a pain to use at the moment - and very inefficient. I see +this module being primarily used for loading ILBM's for graphics for +games/applications, rather than for writing picture viewers. + +@endnode + +@node "Author" "The guy who wrote it" + +The iff unpacker i wrote a long time ago for zgif, its reasonably fast, but +it doesn't go all out for speed! + +Presently, i study `from time to time' (:-) in order to obtain a Computer +Systems Engineering degree from the Univerity Of South Australia. (1994=final year) +I'm also currently `Zed' of FRONTIER in my anti-os hours. + +I can be contacted in the following ways: + +Internet email: + +9107047w@lux.levels.unisa.edu.au + till the end of '94 at least - reliable + +`Real Mode' (tm) mail: + +Michael Zucchi +PO BOX 824 +Waikerie +South Australia 5330 + slow, but very reliable - till mum sells the house :) + +Michael Zucchi +110 Dunrobin Rd +Warradale +South Australia 5046 + to my door - till i move (?) + +@endnode + + +@node ilbm_New +@{u}ilbm.m/ilbm_New ilbm.m/ilbm_New@{uu} + +@{b}SYNTAX@{ub} + + ilbmhandle := ilbm_New( name:PTR TO CHAR, + flags:LONG ); + +@{b}PURPOSE@{ub} + Creates a (private!) ilbm handle structure, and fills in several + fields. The file specified by 'name' is opened, and the IFF ILBM + chunks BMHD, CAMG, and CMAP are parsed. + +@{b}INPUTS@{ub} + name A NULL terminated string, specifying the name of the + picture. This MUST be present! + flags A mask of options, current flags are: + + ILBMF_COLOURS4 + create a LoadRGB4() compatible version of the + palette, and store a pointer to it in the picture + info block as 'pal4' (see @{"ilbm_PictureInfo()" Link ilbm_PictureInfo} + + ILBMF_COLOURS32 + create a LoadRGB32() compatible version of the + palette, and store a pointer to it in the picture + info block as 'pal32' (see @{"ilbm_PictureInfo()" Link ilbm_PictureInfo} + +@{b}OUTPUTS@{ub} + ilbmhandle A !!PRIVATE!! handle used with the other ilbm_xxx + functions. If for some reason something didn't work, it + will be 0. + +@{b}NOTES@{ub} + +@{b}SEE ALSO@{ub} + @{"ilbm_Dispose()" Link ilbm_Dispose}, @{"ilbm_LoadPicture()" link ilbm_LoadPicture}, @{"ilbm_PictureInfo()" Link ilbm_PictureInfo} + +@endnode + +@node ilbm_Dispose +@{u}ilbm.m/ilbm_Dispose ilbm.m/ilbm_Dispose@{uu} + +@{b}SYNTAX@{ub} + + ilbm_Dispose( iffhandle:LONG ); + +@{b}PURPOSE@{ub} + Closes the original file, free's the iffparse.library stuff, and + closes some libraries. Use this to free uneeded data once the + picture has been loaded. + +@{b}INPUTS@{ub} + iffhandle An iffhandle obtained from @{"ilbm_New()" Link ilbm_New}, or 0. + +@{b}OUTPUTS@{ub} + +@{b}NOTES@{ub} + It is safe to pass iffhandle:=0 to this function. + +@{b}SEE ALSO@{ub} + @{"ilbm_New()" Link "ilbm_New()"} + +@endnode + +@node ilbm_PictureInfo +@{u}ilbm.m/ilbm_PictureInfo ilbm.m/ilbm_PictureInfo@{uu} + +@{b}SYNTAX@{ub} + + pictureinfo := ilbm_PictureInfo( iffhandle:LONG ) + +@{b}PURPOSE@{ub} + Returns a pointer to a pictureinfo object which contains information + about the picture being loaded. + +@{b}INPUTS@{ub} + iffhandle A VALID iffhandle obtained from @{"ilbm_New()" Link ilbm_New}. + +@{b}OUTPUTS@{ub} + pictureinfo A pointer to an object of type 'pictureinfo'. + The fields will be set-up as following: + + bmhd pointer to the BitMapHeader from the IFF file + modeid the modeid, as obtained from the CAMG chunk - or 0. + This may also be set by the application before calling + @{"ilbm_LoadPicture()" Link ilbm_LoadPicture} + colours number of colours represented in the picture. An + IFF-24 picture will have 16,777,216 stored here! + palraw If the number of colours (above) is 256 or less, and + a CMAP chunk was present, palraw is a pointer to the + raw 24-bit palette read from the IFF file. The colours + are stores as groups of 3 bytes - Red/Green/Blue + pal4 If ILBMF_COLOURS4 was specified when the iffhandle + was created, and there was a CMAP present, AND + there was enough memory, pal4 is a pointer to + a LoadRGB4() compatible array of colours - 'colours' + of them. + pal32 If ILBMF_COLOURS32 was specified when the iffhandle + was created, and there was a CMAP present, AND + there was enough memory, pal32 is a pointer to + a LoadRGB32() compatible array of colours - 'colours' + of them. + +@{b}NOTES@{ub} + The modeid field is the only one writeable! All others are read-only. + + If memory is tight, the pal4 and pal32 fields may still be zero, even + if they were requested originally. It would be a good idea always + to check these fields before use. + +@{b}SEE ALSO@{ub} + @{"ilbm_New()" Link ilbm_New}, @{"ilbm_Dispose()" Link ilbm_Dispose}, @{"ilbm_LoadPicture()" link ilbm_LoadPicture} + +@endnode + +@node ilbm_LoadPicture +@{u}ilbm.m/ilbm_LoadPicture ilbm.m/ilbm_LoadPicture@{uu} + +@{b}SYNTAX@{ub} + + status := ilbm_LoadPicture ( iffhandle:LONG, + taglist:LONG ) + +@{b}PURPOSE@{ub} + Loads the picture into the specified enviroment. + +@{b}INPUTS@{ub} + iffhandle An iffhandle obtained using @{"ilbm_New()" link ilbm_New}, or 0 + in which case an error will be returned + tags A tag-list specifying the loading options. Currently defiend + tags are: + + ILBML_BITMAP tag.data points to an existing bitmap in which + to load the picture data. The bitmap needs + to be big enough ... + ILBML_SCREEN tag.data points to an existing screen in which + to load the picture/palette. + ILBML_CHUNKY tag.data specifies a byte array to store a + chunky-pixel version of the picture + NOT IMPLEMENTED + ILBML_GETBITMAP This specifies that ilbm_LoadPicture() will + allocate its own bitmap. In this case, + tag.data is a pointer to a variable, which + will hold the obtained bitmap. + @{"ilbm_FreeBitMap()" link ilbm_FreeBitMap} @{b}MUST@{ub} be used to free this + bitmap. + ILBML_GETSCREEN Specifies that ilbm_LoadPicture() will open the + screen for you. tag.data points to a variable + that will hold the screen pointer once obtained. + If the screen could not open, zero is stored + that variable. The screen must be closed by + a CloseScreen() call - this can be after + @{"ilbm_Dispose()" link ilbm_Dispose} is called. + ILBML_GETCHUNKY guess! NOT IMPLEMENTED + ILBML_SCREENTAGS If ILBML_GETSCREEN was used, then this tag + can be used to specify additional tags to be + used when opening the screen. The following + tags must NOT be used: SA_WIDTH, SA_HEIGHT, + SA_DEPTH, SA_DISPLAYID. + ILBML_NOCOLOUR If SA_SCREEN/SA_GETSCREEN have been specified, + then using this BOOL tag will prevent + ilbm_LoadPicture() from setting the palette + for the screen. Only specify if it is to be + true. + +@{b}OUTPUTS@{ub} + status =0 if all went OK, or negative for errors (see ilbmdefs.m) + +@{b}NOTES@{ub} + Remember, if one of the 'GET' tags is used, it is up to the application + to free whatever was got. + +@{b}SEE ALSO@{ub} + @{"ilbm_New()" Link ilbm_New}, @{"ilbm_Dispose()" Link ilbm_Dispose}, @{"ilbm_PictureInfo()" link ilbm_PictureInfo}, @{"ilbm_FreeBitMap()" Link ilbm_FreeBitMap} + +@endnode + +@node ilbm_FreeBitMap +@{u}ilbm.m/ilbm_FreeBitMap ilbm.m/ilbm_FreeBitMap@{uu} + +@{b}SYNTAX@{ub} + + ilbm_FreeBitMap( bitmap ) + +@{b}PURPOSE@{ub} + Free's a bitmap returned by @{"ilbm_LoadPicture()" link ilbm_LoadPicture}, via the ILBML_GETBITMAP + tag. + +@{b}INPUTS@{ub} + bitmap a VALID bitmap, as returned by the ILBML_GETBITMAP tag. + +@{b}OUTPUTS@{ub} + +@{b}NOTES@{ub} + If V39 is present, this function just calls FreeBitMap() - otherwise, + it uses its own custom routines. + +@{b}SEE ALSO@{ub} + @{"ilbm_LoadPicture()" link ilbm_LoadPicture} + +@endnode + + +@node Examples "Information about the examples" + +This section describes the source-form examples so far provided. + +@{u}showpic@{uu} + + A simple picture-viewer. It demonstrates an easy way to load and + display a picture in an Amiga Screen. The use of the asl.library's + file requester is also demonstrated. + + usage: + @{"showpic" Link showpic.e/main} + +@{u}picwindow@{uu} + + Another simple picture-viewer. This one displays the picture on + the workbench screen, in a suitably sized window. It demonstrates + loading into bitmaps, obtaining information about the picture + before it is displayed, and blitting into workbench windows. + + usage: + @{"picwindow" Link picwindow.e/main} + +@endnode + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/ILBM/picwindow.e b/amigae33a/E_v3.3a/Src/Src/Tools/ILBM/picwindow.e new file mode 100644 index 0000000..2b91da5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/ILBM/picwindow.e @@ -0,0 +1,92 @@ +/* + + picwindow.e Michael Zucchi 1994 + + Loads a picture into a window on workbench (without colours ...) + Demonstrates use of the ILBM MODULE - loading into bitmaps, and obtaining + picture information. It also demonstrates asl file requester + + This program may be freely distributed only among registered + AmigaE owners. + */ + + +MODULE 'tools/ilbm', 'tools/ilbmdefs', + 'intuition/intuition', + 'asl', 'libraries/ASL' + +DEF bm,win:PTR TO window, + buffer[256]:ARRAY + +PROC main() +DEF ilbm,filename,width,height,bmh:PTR TO bmhd,pi:PTR TO picinfo + +IF filename:=requestfile('Select picture') + IF ilbm:=ilbm_New(filename,0) + ilbm_LoadPicture(ilbm,[ILBML_GETBITMAP,{bm},0]) + + -> get a pointer TO the images picture-info, we extract the bitmap header, + -> and read the picture's size. + pi:=ilbm_PictureInfo(ilbm) + bmh:=pi.bmhd; + width:=bmh.w; + height:=bmh.h; + + -> the ilbm-handle is no longer needed, we can free it + ilbm_Dispose(ilbm) + + -> if a bitmap actually opened, open a window, and blit it in + IF bm + IF win:=OpenWindowTagList(0,[WA_INNERWIDTH,width,WA_INNERHEIGHT,height, + WA_AUTOADJUST,-1, + WA_IDCMP,IDCMP_CLOSEWINDOW, + WA_FLAGS,WFLG_CLOSEGADGET+WFLG_DRAGBAR+WFLG_DEPTHGADGET, + WA_TITLE,filename, + WA_SCREENTITLE,'Pic-Window 0.1 1994 Michael Zucchi',0]) + + -> bit into actual dimensions the OS could give us (the window might not be as big as the picture) + BltBitMapRastPort(bm,0,0,win.rport, + win.borderleft,win.bordertop, + win.width-win.borderright-win.borderleft, + win.height-win.borderbottom-win.bordertop,$c0); + + WaitPort(win.userport) + CloseWindow(win) + + ENDIF + ilbm_FreeBitMap(bm) + ENDIF + ENDIF +ENDIF + +ENDPROC + +/* + Presents an ASL load-file requester. If the user selected a file, it is + expanded to a full path-name. + */ +PROC requestfile(title) +DEF name=0,fr:PTR TO filerequester + +IF aslbase:=OpenLibrary('asl.library',36) + IF fr:=AllocAslRequest(ASL_FILEREQUEST,[ASLFR_TITLETEXT,title,0]) + IF AslRequest(fr,0) + + -> sorry, a bit of ASM here. Well ... how ELSE? + -> this does a strcpy() ... + MOVE.L fr,A0 + MOVE.L 8(A0),A0 -> directory pointer from 'filerequester' + MOVE.L buffer,A1 + cp: MOVE.B (A0)+,(A1)+ + BNE.S cp + + AddPart(buffer,fr.file,256) + name:=buffer + ENDIF + FreeAslRequest(fr) + ENDIF + CloseLibrary(aslbase) +ENDIF + +ENDPROC name + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/ILBM/showpic.e b/amigae33a/E_v3.3a/Src/Src/Tools/ILBM/showpic.e new file mode 100644 index 0000000..36da0fa --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/ILBM/showpic.e @@ -0,0 +1,70 @@ +/* + + showpic.e Michael Zucchi 1994 + + Simple IFF ILBM picture viewer + Demonstrates use of the ILBM module, and the asl file requester + + This program may be freely distributed only among registered + AmigaE owners. + */ + + +MODULE 'tools/ilbm', 'tools/ilbmdefs', + 'intuition/intuition', + 'asl', 'libraries/ASL' + +DEF scr, + buffer[256]:ARRAY + +PROC main() +DEF ilbm,filename + +IF filename:=requestfile('Select picture') + IF ilbm:=ilbm_New(filename,0) + ilbm_LoadPicture(ilbm,[ILBML_GETSCREEN,{scr},0]) + ilbm_Dispose(ilbm) -> no longer needed ... + + -> this is only an example! In a real application, always use IDCMP ports, + -> and windows + + IF scr -> only if one was created. + WHILE Mouse()<>1 + Delay(4) + ENDWHILE + CloseScreen(scr) + ENDIF + ENDIF +ENDIF + +ENDPROC + +/* + Presents an ASL load-file requester. If the user selected a file, it is + expanded to a full path-name. + */ +PROC requestfile(title) +DEF name=0,fr:PTR TO filerequester + +IF aslbase:=OpenLibrary('asl.library',36) + IF fr:=AllocAslRequest(ASL_FILEREQUEST,[ASLFR_TITLETEXT,title,0]) + IF AslRequest(fr,0) + + -> sorry, a bit of ASM here. Well ... how ELSE? + -> this does a strcpy() ... + MOVE.L fr,A0 + MOVE.L 8(A0),A0 -> directory pointer from 'filerequester' + MOVE.L buffer,A1 + cp: MOVE.B (A0)+,(A1)+ + BNE.S cp + + AddPart(buffer,fr.file,256) + name:=buffer + ENDIF + FreeAslRequest(fr) + ENDIF + CloseLibrary(aslbase) +ENDIF + +ENDPROC name + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/InitHook/inithook.e b/amigae33a/E_v3.3a/Src/Src/Tools/InitHook/inithook.e new file mode 100644 index 0000000..cd633d5 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/InitHook/inithook.e @@ -0,0 +1,26 @@ +OPT MODULE + +MODULE 'utility/hooks' + +EXPORT PROC inithook(hook:PTR TO hook, func, data=NIL) + hook.subentry:=func + hook.entry:={hookentry} + hook.data:=data + LEA.L storeA4(PC), A0 -> Copy A4 to safe place + MOVE.L A4, (A0) +ENDPROC hook + +storeA4: + LONG 0 + +hookentry: + MOVEM.L D2-D7/A2-A6,-(A7) -> Save regs + MOVE.L A0,-(A7) -> Stuff parameters on stack for proc call + MOVE.L A2,-(A7) + MOVE.L A1,-(A7) + MOVE.L storeA4(PC), A4 -> Reinstate A4 + MOVE.L 12(A0),A0 -> Get sub-entry + JSR (A0) -> Execute function + LEA 12(A7),A7 -> Remove parameters + MOVEM.L (A7)+,D2-D7/A2-A6 -> Restore regs + RTS diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Iterators/iterators_test.e b/amigae33a/E_v3.3a/Src/Src/Tools/Iterators/iterators_test.e new file mode 100644 index 0000000..562e9bf --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Iterators/iterators_test.e @@ -0,0 +1,21 @@ +-> iterators test + +MODULE 'tools/exceptions', 'tools/constructors', '*iterators', + 'exec/lists', 'exec/nodes' + +OBJECT bla OF ln + v:LONG +ENDOBJECT + +PROC main() HANDLE + DEF l,n:PTR TO bla,x=10 + l:=newlist() + WHILE x>0 DO AddHead(l,NEW n.n(x--)) + iterate_exec_list({n},l,`WriteF('v = \d\n',n.v)) +EXCEPT + report_exception() +ENDPROC + +PROC n(v) OF bla + self.v:=v +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Lex/simplelex.doc b/amigae33a/E_v3.3a/Src/Src/Tools/Lex/simplelex.doc new file mode 100644 index 0000000..ba5acdf --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Lex/simplelex.doc @@ -0,0 +1,47 @@ +simplelex.m: very simple general purpose lexical analyser for various tasks. + +This lex() can used there where one quickly needs a lex without +bothering to make one yourself. It may also serve as an example +or starting point on how to make your own lex. See simplelextest.e +for a nice parser example that makes use of this lex. + + + lex_int(start,len,freeform=FALSE,onelinecomment=-2) + +initialises the lex. start and len denote the memory area where +the text is that lex() will take it's tokens from. The memory +needs to be trailed by "\n", readfile() from file.m does this for +you. freeform says wether "\n" should be interpreted as whitespace +or not. onelinecomment allows only one char. + + token,attr:=lex() + +the actual lex. returns a token, and for some tokens also an attribute. + +" ", "\t" whitespace, not returned +"\n" LEX_EOL, or whitespace +"[a-zA-Z_][a-zA-Z0-9_]*" LEX_IDENT, attr=ptr to first char + [same as E's idents] + LEX_INTEGER, attr=value + [everything accepted by Val()] + LEX_EOF +"" LEX_STRINGQ, attr=ptr to first char +'' LEX_STRINGA, idem. + +any other character is returned as token on it's own. + + linenum:=lex_curline() + +returns the current linenumber being lexical-analysed. + + ptr:=lex_current() + +returns the current ptr in the text. Handy for those cases where +lex() returns 'ptr to first char', as this will then be 'ptr past +last char'. + + pos:=lex_getline(estring) + +copies the current line into the estring, and returns the offset +into that string where lex() currently is. Very handy for precise +error-reports, as the simplelextest.e demonstrates. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Lex/simplelex.e b/amigae33a/E_v3.3a/Src/Src/Tools/Lex/simplelex.e new file mode 100644 index 0000000..ae88514 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Lex/simplelex.e @@ -0,0 +1,65 @@ +-> very simple lex module + +OPT MODULE + +MODULE 'tools/ctype' + +DEF begin, cur, end, free, line, comment -> private + +EXPORT PROC lex_init(start,size,freeform=FALSE,onelinecomment=-2) + end:=(begin:=cur:=start)+size; free:=freeform; line:=1 + comment:=onelinecomment +ENDPROC + +EXPORT ENUM LEX_EOF=256, LEX_EOL, LEX_INTEGER, LEX_IDENT, + LEX_STRINGA, LEX_STRINGQ + +EXPORT PROC lex() + DEF a,b,c + LOOP + SELECT 256 OF c:=cur[]++ + CASE "\n" + IF cur>end THEN RETURN (cur:=end) BUT LEX_EOF + line++ + IF free=FALSE THEN RETURN LEX_EOL + CASE " ", "\t" + /* whitespace, do nothing */ + CASE "0" TO "9", "$", "%", "-" + a,b:=Val(cur-1) + IF b=0 THEN RETURN c + cur:=cur+b-1 + RETURN LEX_INTEGER, a + CASE "a" TO "z", "A" TO "Z", "_" + a:=cur; c:=cur[] + WHILE isalnum(c) OR (c="_") DO cur++ BUT c:=cur[] + RETURN LEX_IDENT,a + CASE "\q", "\a" + a:=cur + WHILE (a[]<>c) AND (a[]<>"\n") DO a++ + IF a[]="\n" THEN RETURN c + b:=cur + cur:=a+1 + RETURN IF c="\a" THEN LEX_STRINGQ ELSE LEX_STRINGA, b + DEFAULT + IF c=comment + WHILE cur[]++<>"\n" + ENDWHILE + line++ + ELSE + RETURN c + ENDIF + ENDSELECT + ENDLOOP +ENDPROC + +EXPORT PROC lex_curline() IS line +EXPORT PROC lex_current() IS cur + +EXPORT PROC lex_getline(s) + DEF b,e + b:=e:=cur + WHILE b[]--<>"\n" DO NOP + b++ + WHILE e[]<>"\n" DO e++ + StrCopy(s,b,e-b) +ENDPROC cur-b diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Lex/simplelextest.e b/amigae33a/E_v3.3a/Src/Src/Tools/Lex/simplelextest.e new file mode 100644 index 0000000..5458e19 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Lex/simplelextest.e @@ -0,0 +1,73 @@ +-> lex test, parses lists with ints from a file. + +MODULE 'tools/simplelex', 'tools/file', 'tools/lisp' + +DEF t,at -> current token and attribute + +PROC main() HANDLE + DEF m=NIL,l,a + m,l:=readfile('testinput.lists') + lex_init(m,l,TRUE,"#") + t,at:=lex() + WHILE (a:=parse())<>-1 + showcellint(a) + WriteF('\n') + ENDWHILE +EXCEPT DO + IF m THEN freefile(m) + SELECT exception + CASE "OPEN"; WriteF('no file!\n') + CASE "MEM"; WriteF('no mem!\n') + CASE "perr"; printerr(exceptioninfo) + ENDSELECT +ENDPROC + +PROC parse() + DEF a + IF t="<" + t,at:=lex() + IF t=">" + t,at:=lex() + RETURN NIL + ELSE + a:=parse() + RETURN + ENDIF + ELSEIF t=LEX_INTEGER + a:=at + t,at:=lex() + RETURN a + ELSEIF t=LEX_EOF + RETURN -1 + ELSE + Throw("perr",'"<" or integer expected') + ENDIF +ENDPROC + +PROC parsecdr() + DEF a + IF t="," + t,at:=lex() + a:=parse() + RETURN + ELSEIF t="|" + t,at:=lex() + a:=parse() + IF t<>">" THEN Throw("perr",'">" expected') + t,at:=lex() + RETURN a + ELSEIF t=">" + t,at:=lex() + RETURN NIL + ELSE + Throw("perr",'"," or "|" or ">" expected') + ENDIF +ENDPROC + +PROC printerr(s) + DEF ers[200]:STRING,pos,a + pos:=lex_getline(ers)-1 + WriteF('\nERROR: \s\nLINE: \d\n\s\n',s,lex_curline(),ers) + IF pos>0 THEN FOR a:=1 TO pos DO WriteF(' ') + WriteF('^\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Lex/testinput.lists b/amigae33a/E_v3.3a/Src/Src/Tools/Lex/testinput.lists new file mode 100644 index 0000000..0363554 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Lex/testinput.lists @@ -0,0 +1,16 @@ +# examples of cell-expressions to parse + +<1|2> + +<1,2,3> + +<1, + <2|3>, + <4,5|6>| + 7> + +# remove comment for each of the following lines to see error reports: + +# <1,bla> +# <1|2,3> +# <1;2> diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Lisp/lisp.e b/amigae33a/E_v3.3a/Src/Src/Tools/Lisp/lisp.e new file mode 100644 index 0000000..6a5e2fb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Lisp/lisp.e @@ -0,0 +1,133 @@ +-> list Tools! + +OPT MODULE +OPT EXPORT + +/*------some-typical-lisp-functions--------*/ + +/* note: these are quite inefficient functions and could be done + much faster using destructive implementations. They are however + very nice as LISP-programming examples */ + +-> appends two lists + +PROC append(x,y) + DEF h,t + IF x + x <=> + RETURN + ENDIF +ENDPROC y + +-> 'naive'-reverses a list. notorious for it's inefficiency. + +PROC nrev(x) + DEF h,t + IF x + x <=> + RETURN append(nrev(t),) + ENDIF +ENDPROC NIL + +-> returns a list of results from applying fun to elements of l + +PROC map(l,fun) + DEF h,t + IF l + l <=> + RETURN + ENDIF +ENDPROC NIL + +-> returns a list of elements in l for which fun returns true + +PROC filter(l,fun) + DEF h,t,r + IF l + l <=> + r:=filter(t,fun) + RETURN IF fun(h) THEN ELSE r + ENDIF +ENDPROC NIL + +-> returns two lists of elements in l for which fun returns true and false + +PROC partition(l,fun) + DEF h,t,rt,rf + IF l + l <=> + rt,rf:=partition(t,fun) + IF fun(h) THEN RETURN ,rf ELSE RETURN rt, + ENDIF +ENDPROC NIL,NIL + +-> folds function through list, i.e.: +-> foldr(<1,2,3>,{add},0) = add(1,add(2,add(3,0))) + +PROC foldr(l,fun,end) + DEF h,t + IF l + l <=> + RETURN fun(h,foldr(t,fun,end)) + ENDIF +ENDPROC end + +-> zip combines two lists into one list of pairs. + +PROC zip(x,y) + DEF a,b,c,d + IF x + IF y + x <=> + y <=> + RETURN <|zip(b,d)> + ENDIF + ENDIF +ENDPROC NIL + +-> length of a list + +PROC length(x) IS IF x THEN length(Cdr(x))+1 ELSE 0 + + +/*--------universal-cell-printing---------*/ + +/* prints any cell structure in memory, proc(v) is called whenever + a value is not a cell. below predefined functions for lists/trees + of ints and strings */ + +EXPORT PROC showcell(cell,proc) + DEF a,c + IF cell + IF Cell(cell) + WriteF('<') + cell <=> + showcell(a,proc) + IF c + WHILE Cell(c) AND (c<>0) + WriteF(',') + c <=> + showcell(a,proc) + ENDWHILE + IF c + WriteF('|') + showcell(c,proc) + ENDIF + WriteF('>') + ELSE + WriteF('>') + ENDIF + ELSE + proc(cell) + ENDIF + ELSE + WriteF('<>') + ENDIF +ENDPROC + +PROC showcellint(cell) IS showcell(cell,{showint}) +PROC showcellstr(cell) IS showcell(cell,{showstr}) + +PROC showint(x) IS WriteF('\d',x) +PROC showstr(x) IS WriteF('\s',x) + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Lisp/lisptest.e b/amigae33a/E_v3.3a/Src/Src/Tools/Lisp/lisptest.e new file mode 100644 index 0000000..ea63b38 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Lisp/lisptest.e @@ -0,0 +1,33 @@ +-> test lisp tool module + +MODULE 'tools/lisp' + +PROC main() + DEF a,b + + -> map a reverse over lists + + showcellint(map(<<1,2,3>,<4,5,6>,<7,8,9>>,{nrev})) + + -> sum a list + + WriteF('\n\d\n',foldr(<1,2,3>,{add},0)) + + -> select a list of zipped pairs whose head>tail + + showcellint(filter(zip(<1,2,3,4,5>,<2,1,-1,5,4>),{greater})) + + -> number of positive and negative number of elements in a list + + a,b:=partition(<1,-5,8,2,-2,4,5,7>,{pos}) + WriteF('\n\d \d\n',length(a),length(b)) + +ENDPROC + +PROC add(x,y) IS x+y +PROC pos(x) IS x>=0 + +PROC greater(c) + DEF h,t + c <=> +ENDPROC h>t diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longdemo.e b/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longdemo.e new file mode 100644 index 0000000..a37086c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longdemo.e @@ -0,0 +1,85 @@ +/* Example program for longreal module */ +/* By EA van Breemen 1994 */ + + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ +/* In order to use the conversion functions use STRING type */ +/* for the buffers, not ARRAY. Otherwise the functions will */ +/* produce unexpected results */ + +/* Note some roundingerrors may occur due to IEEE maths */ +/* In futher releases this will be fixed */ + + +/* Some notes on the functions in longreal */ + +/* Most functions are described in the ROMKernals. See the */ +/* chapters on IEEE functions */ +/* There are 3 ascii-longreal conversion functions */ + +/* dFormat(buffer,x,num) -> converts fractional number x with + num digits to a string in buffer + + dLFormat(buffer,x,num) -> same as dFormat, but now also large + numbers i.e. 1.2e250 + + a2d(buffer,x) -> the inverse of dLFormat: converting + from asciistring in buffer to + longreal x */ + + +/* Include this module for using longreals */ + +MODULE 'tools/longreal' + + +/* Our small main program */ + +PROC main() + DEF buffer[256]:STRING /* Very important: use STRING for buffer !!!! */ + DEF a:longreal /* Our dummy longreal for results */ + DEF i /* A simple counter */ + + dInit() /* Init the module before using */ + + WriteF('First some conversions:\n') + WriteF('Reading 1.234567 -> gives:') + + a2d('1.234567',a) /* Convert from ascii to longreal */ + dFormat(buffer,a,6) /* And back again (6 digits) */ + WriteF('\s\n',buffer) /* Print it */ + + WriteF('Reading +1.234567e-2 -> gives:') + + a2d('+1.234567e-2',a) /* Convert from ascii to longreal */ + dFormat(buffer,a,6) /* And back again (6 digits) */ + WriteF('\s\n',buffer) /* Print it */ + + + WriteF('Reading -1.234567E100 -> gives:') + + a2d('-1.234567E100',a) /* Convert from ascii to longreal */ + +/* Now the number is too large for dFormat, use dLFormat instead */ + + dLFormat(buffer,a,6) /* And back again (6 digits) */ + WriteF('\s\n',buffer) /* Print it */ + + WriteF('Now some other stuff\n') + + FOR i:=1 TO 16 + WriteF('PI=\s \n',dFormat(buffer,dPi(a),i)) + ENDFOR + + WriteF('A sinus table\n') + FOR i:=0 TO 360 STEP 45 + dFloat(i,a) /* Convert an int to a longreal */ + dSin(dRad(a)) + WriteF('Sin(\d)=\s \n',i,dLFormat(buffer,a,15)) + ENDFOR + + WriteF('End of longdemo\n') + + dCleanup() /* Cleanup the module after using */ + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longreal.doc b/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longreal.doc new file mode 100644 index 0000000..2bacd6d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longreal.doc @@ -0,0 +1,99 @@ +longreal.m: A module for 64bit floats in E. + + +The module introduces a type 'longreal' to the E language. +All functions in the module are prefixed by a 'd' (for 'double') +Before you use this module, first call: + +dInit() + +and upon exit _always_ call: + +dCleanup() + +dInit() may raise an "DLIB" exception if +it fails to open one of the IEEE double libraries. If you don't +need any transcendental functions, dInit(FALSE) will cause only the +mathieeedoubbas.library to be opened. + + +Using longreals as a type. +There are various ways to create a longreal variable. simplest is: + +DEF f:longreal + +or: + +DEF f:PTR TO longreal + +and then later: + +NEW f + +also, you can make arrays of longreals, or use them in objects: + +OBJECT bla + x:INT, y:longreal +ENDOBJECT + +DEF a[100]:ARRAY OF longreal, b:bla + +As you see they work just like the builtin types. +In the above examples + +f, a[1], a[10], b.y + +all denote longreal variables. these can be used whereever a +longreal is expected in the functions decribed below. Note however +that, being objects, longreals are passed by reference. + + + i:=dFix(f) dFloat(i,f) + +convert a longreal to a LONG and a LONG to a longreal respectively. +dFloat() returns f + + dAdd(x,y) dAdd(x,y,to) + dSub(x,y) dSub(x,y,to) + dMul(x,y) dMul(x,y,to) + dDiv(x,y) dDiv(x,y,to) + +perform these common operations on their arguments. 'x' and 'y' are in the +same order as their operator-counterparts. The result is stored in 'to', +or in 'x' if only two arguments are passed. (all functions return 'to' or +'x', resp.). + + r:=dCompare(x,y) r:=dTest(x) + +Compare longreals. dTest compares x with 0 as second arg. result 'r' is +positive if x>y, negative for x0. Returns s. +Not great and somewhat slow, but it works :-) + + dSqrt(x) + + +---------------- +NOTE: Erwin has added a large bunch of useful functions, and documentation +on these can be found in the module source, and longdemo.e. +Because the module got rather big, I also included the original longreal +module (now longrealtiny.m) for those who don't need all the bells and +whistles... + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longreal.e b/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longreal.e new file mode 100644 index 0000000..e19a675 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longreal.e @@ -0,0 +1,519 @@ +-> longreal module! + +OPT MODULE +OPT EXPORT + +OBJECT longreal + PRIVATE a,b +ENDOBJECT + +MODULE 'mathieeedoubbas', 'mathieeedoubtrans' + +EXPORT DEF mathieeedoubbascount, mathieeedoubtranscount + +RAISE "DLIB" IF OpenLibrary()=NIL + +PROC dInit(trans=TRUE) + IF mathieeedoubbascount=0 + mathieeedoubbasbase:=OpenLibrary('mathieeedoubbas.library',0) + ENDIF + mathieeedoubbascount++ + IF trans + IF mathieeedoubtranscount=0 + mathieeedoubtransbase:=OpenLibrary('mathieeedoubtrans.library',0) + ENDIF + mathieeedoubtranscount++ + ENDIF +ENDPROC + +PROC dCleanup(trans=TRUE) + IF mathieeedoubbasbase + IF mathieeedoubbascount--=0 THEN CloseLibrary(mathieeedoubbasbase) + ENDIF + IF trans + IF mathieeedoubtransbase + IF mathieeedoubtranscount--=0 THEN CloseLibrary(mathieeedoubtransbase) + ENDIF + ENDIF +ENDPROC + +PROC dFloat(int,longreal:PTR TO longreal) + DEF a,b + a,b:=IeeeDPFlt(int) + longreal.a:=a + longreal.b:=b +ENDPROC longreal + +PROC dFix(longreal:PTR TO longreal) IS IeeeDPFix(longreal.a,longreal.b) + +PROC dTst(x:PTR TO longreal) IS IeeeDPTst(x.a,x.b) + +PROC dCompare(x:PTR TO longreal,y:PTR TO longreal) IS IeeeDPCmp(x.a,x.b,y.a,y.b) + +PROC dAdd(x:PTR TO longreal,y:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPAdd(x.a,x.b,y.a,y.b) + IF to + to.a:=a; to.b:=b + RETURN to + ELSE + x.a:=a; x.b:=b + ENDIF +ENDPROC x + +PROC dSub(x:PTR TO longreal,y:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPSub(x.a,x.b,y.a,y.b) + IF to + to.a:=a; to.b:=b + RETURN to + ELSE + x.a:=a; x.b:=b + ENDIF +ENDPROC x + +PROC dMul(x:PTR TO longreal,y:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPMul(x.a,x.b,y.a,y.b) + IF to + to.a:=a; to.b:=b + RETURN to + ELSE + x.a:=a; x.b:=b + ENDIF +ENDPROC x + +PROC dDiv(x:PTR TO longreal,y:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPDiv(x.a,x.b,y.a,y.b) + IF to + to.a:=a; to.b:=b + RETURN to + ELSE + x.a:=a; x.b:=b + ENDIF +ENDPROC x + +PROC dRound(x:PTR TO longreal) + DEF a,b + a,b:=IeeeDPFloor(x.a,x.b) + x.a:=a; x.b:=b +ENDPROC x + +PROC dRoundUp(x:PTR TO longreal) + DEF a,b + a,b:=IeeeDPCeil(x.a,x.b) + x.a:=a; x.b:=b +ENDPROC x + +PROC dNeg(x:PTR TO longreal) + DEF a,b + a,b:=IeeeDPNeg(x.a,x.b) + x.a:=a; x.b:=b +ENDPROC x + +PROC dAbs(x:PTR TO longreal) + DEF a,b + a,b:=IeeeDPAbs(x.a,x.b) + x.a:=a; x.b:=b +ENDPROC x + +PROC dCopy(x:PTR TO longreal,y:PTR TO longreal) + x.a:=y.a + x.b:=y.b +ENDPROC x + +/*********************************************************************/ +/* Converts a longreal x to ascii in buffer s with num digits */ +/* Only for fraction numbers */ +/* */ +/* PARAM IN s - buffer for ascii representation [STRING] */ +/* x - longreal to be converted */ +/* num - number of digits */ +/* RETURN s - buffer for ascii representation [STRING] */ +/* COMMENT Buffer s must be large enough to contain the string */ +/*********************************************************************/ + +PROC dFormat(s,x,num) + DEF c:longreal, d:longreal, e, f[1]:ARRAY, fmt + IF dTst(x)<0 + dNeg(x) + fmt:='-\d.' + ELSE + fmt:='\d.' + ENDIF + StringF(s,fmt,dFix(x)) + dCopy(c,x) + FOR e:=1 TO num + dCopy(d,c) + dRound(d) + dSub(c,d) + dFloat(10,d) + dMul(c,d) + f[]:="0"+Abs(dFix(c)) + StrAdd(s,f,1) + ENDFOR +ENDPROC s + +/*********************************************************************/ +/* Converts a longreal x to ascii in buffer s with num digits */ +/* Also for 'large' numbers */ +/* */ +/* PARAM IN s - buffer for ascii representation [STRING] */ +/* x - longreal to be converted */ +/* num - number of digits */ +/* RETURN s - buffer for ascii representation [STRING] */ +/* COMMENT Buffer s must be large enough to contain the string */ +/*********************************************************************/ + +PROC dLFormat(s,x:PTR TO longreal,num) + DEF power,a:longreal + DEF one:longreal,ten:longreal + DEF buffer[30]:STRING + DEF sign + + sign:=1 + dDouble(10.0,ten) + dDouble(1.0,one) + dCopy(a,x) + power:=0 + IF dTst(a)=0 + dFormat(s,a,num) + RETURN s + ENDIF + IF (dTst(a)=-1) + sign:=-1 + dNeg(a) + ENDIF + IF dCompare(a,one)=-1 + WHILE dCompare(a,one)=-1 + dMul(a,ten) + power-- + ENDWHILE + ELSE + WHILE dCompare(a,ten)=1 + dDiv(a,ten) + power++ + ENDWHILE + ENDIF + dFormat(buffer,a,num) + IF (sign=1) + StringF(s,'\sE\d',buffer,power) + ELSE + StringF(s,'-\sE\d',buffer,power) + ENDIF +ENDPROC s + +/*********************************************************************/ +/* Converts an ascii representation to a longreal */ +/* */ +/* PARAM IN buffer - buffer with longreal in ascii [STRING] */ +/* x - converted longreal */ +/*********************************************************************/ + +PROC a2d(buffer,x:PTR TO longreal) + DEF divider:longreal + DEF fraction:longreal + DEF ten:longreal + DEF tmp:longreal + DEF longexp:longreal + + DEF i,exp,expsign,sign + + DEF tmpbuffer[256]:STRING + + dFloat(0,x) + dFloat(10,ten) + i:=0 + sign:=1 + IF buffer[i]="-" + sign:=-1 + i++ + ELSE + IF buffer[i]="+" THEN i++ + ENDIF + + WHILE ((buffer[i]>="0") AND (buffer[i]<="9") AND (buffer[i]<>0)) + dFloat(buffer[i]-"0",tmp) + dMul(x,ten) + dAdd(x,tmp) + i++ + ENDWHILE + + + IF (buffer[i]="." AND (buffer[i+1]>="0") AND (buffer[i+1]<="9")) + i++ + dFloat(1,divider) + dFloat(0,fraction) + WHILE ((buffer[i]>="0") AND (buffer[i]<="9") AND (buffer[i]<>0)) + dMul(fraction,ten) + dFloat(buffer[i]-"0",tmp) + dAdd(fraction,tmp) + dMul(divider,ten) + i++ + ENDWHILE + dDiv(fraction,divider) + dAdd(x,fraction) + ENDIF + dFloat(sign,tmp) + dMul(x,tmp) + + IF ((buffer[i]="E") OR (buffer[i]="e")) + i++ + IF buffer[i]="-" + expsign:=-1 + i++ + ELSE + expsign:=1 + IF (buffer[i]="+") THEN i++ + ENDIF + exp:=0 + WHILE ((buffer[i]>="0") AND (buffer[i]<="9") AND (buffer[i]<>0)) + exp:=Mul(exp,10)+buffer[i]-"0" + i++ + ENDWHILE + dFloat(exp*expsign,longexp) + dPow(ten,longexp) + dMul(x,ten) + ENDIF +ENDPROC + + +/* Converts an IEEE single to a longreal */ + +PROC dDouble(x,to:PTR TO longreal) + DEF a,b + a,b:=IeeeDPFieee(x) + to.a:=a + to.b:=b +ENDPROC + + +/* Converts a longreal to an IEEE single */ + +PROC dSingle(x:PTR TO longreal) IS IeeeDPTieee(x.a,x.b) + + +PROC dSqrt(x:PTR TO longreal) + DEF a,b + a,b:=IeeeDPSqrt(x.a,x.b) + x.a:=a; x.b:=b +ENDPROC + + +/* Return longreal PI in x */ + +PROC dPi(x:PTR TO longreal) + x.a:=$400921FB /* Dirty but quick 8-) */ + x.b:=$54442D18 +ENDPROC x + +/* Converts x from degrees to radians */ + +PROC dRad(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF s:longreal,t:longreal + + dPi(t) + dDouble(180.0,s) + + dDiv(t,s) + dMul(t,x) + IF to + to.a:=t.a + to.b:=t.b + RETURN to + ELSE + x.a:=t.a + x.b:=t.b + RETURN x + ENDIF +ENDPROC + +PROC dSin(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPSin(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + +PROC dCos(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPCos(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + +PROC dTan(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPTan(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + +PROC dASin(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPAsin(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + + +PROC dACos(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPAcos(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + + +PROC dATan(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPAtan(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + +PROC dSinh(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPSinh(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + +PROC dCosh(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPCosh(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + +PROC dTanh(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPTanh(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + + +PROC dExp(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPExp(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + +PROC dLn(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPLog(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + +PROC dLog(x:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPLog10(x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + +/* Calculates x^y */ + +PROC dPow(x:PTR TO longreal,y:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPPow(y.a,y.b,x.a,x.b) + IF to + to.a:=a + to.b:=b + RETURN to + ELSE + x.a:=a + x.b:=b + RETURN x + ENDIF +ENDPROC + + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longrealtest.e b/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longrealtest.e new file mode 100644 index 0000000..600ea4d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longrealtest.e @@ -0,0 +1,26 @@ +/* + +idea: Piet Molenaar + +calculates (a*a-4)*3 for a = 2 to .. +finds the "a"'s (integers, a,a+1,a+2 are the lenghts of the sides +of a triangle (with almost equals sides)), such that the surface is +a whole number! how remarkable! + +*/ + +MODULE 'tools/longrealtiny' + +PROC main() + DEF a:longreal, b:longreal, c:longreal, d:longreal, e:longreal, s[100]:STRING, x + dInit() + dFloat(4,b) + dFloat(3,c) + FOR x:=2 TO 40000 + IF (x AND $FFF)=0 THEN WriteF('busy doing: \d\n',x) + IF CtrlC() THEN RETURN + dRound(dCopy(e,dSqrt(dMul(dSub(dMul(dFloat(x,a),a,d),b),c)))) + IF dCompare(e,d)=0 THEN WriteF('\d <=> \s\n',x,dFormat(s,d,20)) + ENDFOR + dCleanup() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longrealtiny.e b/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longrealtiny.e new file mode 100644 index 0000000..ea946fa --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/LongReal/longrealtiny.e @@ -0,0 +1,143 @@ +-> longreal module! + +OPT MODULE +OPT EXPORT + +OBJECT longreal + PRIVATE a,b +ENDOBJECT + +MODULE 'mathieeedoubbas', 'mathieeedoubtrans' + +EXPORT DEF mathieeedoubbascount, mathieeedoubtranscount + +RAISE "DLIB" IF OpenLibrary()=NIL + +PROC dInit(trans=TRUE) + IF mathieeedoubbascount=0 + mathieeedoubbasbase:=OpenLibrary('mathieeedoubbas.library',0) + ENDIF + mathieeedoubbascount++ + IF trans + IF mathieeedoubtranscount=0 + mathieeedoubtransbase:=OpenLibrary('mathieeedoubtrans.library',0) + ENDIF + mathieeedoubtranscount++ + ENDIF +ENDPROC + +PROC dCleanup(trans=TRUE) + IF mathieeedoubbasbase + IF mathieeedoubbascount--=0 THEN CloseLibrary(mathieeedoubbasbase) + ENDIF + IF trans + IF mathieeedoubtransbase + IF mathieeedoubtranscount--=0 THEN CloseLibrary(mathieeedoubtransbase) + ENDIF + ENDIF +ENDPROC + +PROC dFloat(int,longreal:PTR TO longreal) + DEF a,b + a,b:=IeeeDPFlt(int) + longreal.a:=a + longreal.b:=b +ENDPROC longreal + +PROC dFix(longreal:PTR TO longreal) IS IeeeDPFix(longreal.a,longreal.b) + +PROC dCompare(x:PTR TO longreal,y:PTR TO longreal) IS IeeeDPCmp(x.a,x.b,y.a,y.b) + +PROC dAdd(x:PTR TO longreal,y:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPAdd(x.a,x.b,y.a,y.b) + IF to + to.a:=a; to.b:=b + RETURN to + ELSE + x.a:=a; x.b:=b + ENDIF +ENDPROC x + +PROC dSub(x:PTR TO longreal,y:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPSub(x.a,x.b,y.a,y.b) + IF to + to.a:=a; to.b:=b + RETURN to + ELSE + x.a:=a; x.b:=b + ENDIF +ENDPROC x + +PROC dMul(x:PTR TO longreal,y:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPMul(x.a,x.b,y.a,y.b) + IF to + to.a:=a; to.b:=b + RETURN to + ELSE + x.a:=a; x.b:=b + ENDIF +ENDPROC x + +PROC dDiv(x:PTR TO longreal,y:PTR TO longreal,to=NIL:PTR TO longreal) + DEF a,b + a,b:=IeeeDPDiv(x.a,x.b,y.a,y.b) + IF to + to.a:=a; to.b:=b + RETURN to + ELSE + x.a:=a; x.b:=b + ENDIF +ENDPROC x + +PROC dRound(x:PTR TO longreal) + DEF a,b + a,b:=IeeeDPFloor(x.a,x.b) + x.a:=a; x.b:=b +ENDPROC x + +PROC dRoundUp(x:PTR TO longreal) + DEF a,b + a,b:=IeeeDPCeil(x.a,x.b) + x.a:=a; x.b:=b +ENDPROC x + +PROC dNeg(x:PTR TO longreal) + DEF a,b + a,b:=IeeeDPNeg(x.a,x.b) + x.a:=a; x.b:=b +ENDPROC x + +PROC dAbs(x:PTR TO longreal) + DEF a,b + a,b:=IeeeDPAbs(x.a,x.b) + x.a:=a; x.b:=b +ENDPROC x + +PROC dCopy(x:PTR TO longreal,y:PTR TO longreal) + x.a:=y.a + x.b:=y.b +ENDPROC x + +PROC dFormat(s,x,num) + DEF c:longreal, d:longreal, e, f[1]:ARRAY + StringF(s,'\d.',dFix(x)) + dCopy(c,x) + FOR e:=1 TO num + dCopy(d,c) + dRound(d) + dSub(c,d) + dFloat(10,d) + dMul(c,d) + f[]:="0"+dFix(c) + StrAdd(s,f,1) + ENDFOR +ENDPROC s + +PROC dSqrt(x:PTR TO longreal) + DEF a,b + a,b:=IeeeDPSqrt(x.a,x.b) + x.a:=a; x.b:=b +ENDPROC x diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Macros/macros.e b/amigae33a/E_v3.3a/Src/Src/Tools/Macros/macros.e new file mode 100644 index 0000000..cc79c6a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Macros/macros.e @@ -0,0 +1,24 @@ +/* This modules contains some missing 'macros' implemented as functions + as E doesn't support macros +*/ + +OPT MODULE + +MODULE 'graphics/rastport' + +/* Some intuition 'macros' */ + +EXPORT PROC menunum(x) IS x AND $1F + +EXPORT PROC itemnum(x) IS Shr(x,5) AND $3F + +EXPORT PROC subnum(x) IS Shr(x,11) AND $1F + + +/* A graphic 'macro' */ + +EXPORT PROC setdrpt(rport:PTR TO rastport,no) + rport.lineptrn:=no + rport.flags:=rport.flags OR FRST_DOT + rport.linpatcnt:=15 +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Pt/Player.e b/amigae33a/E_v3.3a/Src/Src/Tools/Pt/Player.e new file mode 100644 index 0000000..51e33e0 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Pt/Player.e @@ -0,0 +1,16 @@ +-> protracker player + +MODULE 'tools/file', 'tools/pt', 'tools/exceptions' + +PROC main() HANDLE + DEF m,l + WriteF('Protracker player in E (now playing: "\s", Ctrl-C to stop).\n',arg) + m,l:=readfile(arg,0,2) + pt_play(m) + REPEAT + Delay(10) -> instead, we could be doing something very usefull here + UNTIL CtrlC() + pt_stop() +EXCEPT DO + report_exception() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/README b/amigae33a/E_v3.3a/Src/Src/Tools/README new file mode 100644 index 0000000..b6c4320 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/README @@ -0,0 +1,3 @@ +In this directory you'll find sources to handy modules in +the emodules:tools directory, as well as examples that make use +of them, and sometimes even docs. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/ScrBuffer/ScrBuffer.guide b/amigae33a/E_v3.3a/Src/Src/Tools/ScrBuffer/ScrBuffer.guide new file mode 100644 index 0000000..9b2d3f8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/ScrBuffer/ScrBuffer.guide @@ -0,0 +1,226 @@ +@database ScrBuffer.guide + +Docs for screen buffering module + +© 1993 Michael Zucchi +All rights reserved + +@node Main "ScrBuffer.guide" +@next "sb_OpenScreen" + +Filled Vector Module for AmigaE 3.0+ + +© 1994 @{"Michael Zucchi" Link "Author"} +All Rights Reserved + +Not to be used for commercial software without express written permission +from the author. + +This document describes the functions available for creating and working with +@{b}Workbench 3.0+@{ub} double buffered screen routines. They provide a general +purpose high level suite of routines for accessing these system routines +that can be used for any double buffering system. + +Functions currently available are: + + @{"sb_OpenScreen() " Link "sb_OpenScreen"} to open a screen + @{"sb_CloseScreen()" Link "sb_CloseScreen"} to close a screen + @{"sb_NextBuffer() " Link "sb_NextBuffer"} waits for the next buffer to be displayed + @{"sb_GetBitMap() " Link "sb_GetBitMap"} gives hidden bitmap pointer + @{"sb_GetScreen() " Link "sb_GetScreen"} gives base screen pointer + + @{"examples" Link "examples"} how to use it + +@{b}Remember, use of this module requires that V39 libraries are present +in the target system! Never use these functions without making sure this +is the case.@{ub} + +@endnode + + + +@node "Author" + +I'm another one of these poor students, but i live in Australia, not Europe! + +Presently, i study 'from time to time' :-) in order to obtain a Computer +Systems Engineering degree from the Univerity Of South Australia. Now less +than 6 months to go (at last!) + +Other than this and other AmigaE modules, i've coded a couple of demos for +FRONTIER as the coder 'Zed', along with some small utilities, esp ZGif. + +I can be contacted in the following ways: + +Internet email: + +9107047w@lux.levels.unisa.edu.au + till the end of '94 at least - reliable + +zucchi@hal9000.apana.org.au + if it works it works ... + +`Real Mode' (tm) mail: + +Michael Zucchi +PO BOX 824 +Waikerie +South Australia 5330 + slow, but very reliable + +Michael Zucchi +110 Dunrobin Rd +Warradale +South Australia 5046 + to my door - till i move (?) + + +@endnode + + +@node "sb_OpenScreen" +@prev "Main" +@{u}scrbuffer.m/sb_OpenScreen scrbuffer.m/sb_OpenScreen@{uu} + + @{b}SYNTAX@{ub} + + buffered screen := sb_OpenScreen ( tags, type ) + + @{b}PURPOSE@{ub} + + To open multibuffered screen. Also allocates at least 1 more + buffer to 'multibuffer' and a message port to recieve notification + events. + + @{b}INPUTS@{ub} + tags list of tags as found in "intuition/screens" that describe + the screen you wish to open. All the usual tags such + as SA_WIDTH, SA_HEIGHT, SA_DEPTH etc are used. + type the type of buffered screen to open. Only use 0 for now, + may be enhanced in future to add multi-buffering. + + + @{b}OUTPUTS@{ub} + buffered screen + a pointer to the buffered screen, or 0 if the screen or + asociate memory could not be allocated. All fields of + this structure are @{b}PRIVATE@{ub}. + + @{b}SEE ALSO@{ub} + @{"sb_CloseScreen()" Link "sb_CloseScreen"}, @{"sb_NextBuffer()" Link sb_NextBuffer}, @{"sb_GetBitMap()" Link sb_GetBitMap}, @{"sb_GetScreen()" Link sb_GetScreen} +@endnode + + + +@node "sb_CloseScreen" +@{u}scrbuffer.m/sb_CloseScreen scrbuffer.m/sb_CloseScreen@{uu} + + @{b}SYNTAX@{ub} + + sb_CloseScreen ( buffered screen ) + + @{b}PURPOSE@{ub} + + Closes a buffered screen. All associated resources (buffers, + message ports etc) are returned to the system. + + @{b}INPUTS@{ub} + screen a buffered screen handle, as returned from @{"sb_OpenScreen()" Link "sb_OpenScreen"} + @{b}NOT@{ub} a standard Amiga screen! + + @{b}SEE ALSO@{ub} + @{"sb_OpenScreen()" Link "sb_OpenScreen"} +@endnode + +@node "sb_NextBuffer" +@{u}scrbuffer.m/sb_NextBuffer scrbuffer.m/sb_NextBuffer@{uu} + + @{b}SYNTAX@{ub} + + bitmap = sb_NextBuffer( buffered screen ) + + @{b}PURPOSE@{ub} + + Ask the operating system to change the bitmap of the screen associated + with the double buffered screen, and wait for it to happen so that the + other screen is hidden, ready for rendering. It does this by calling + ChangeScreenBuffer() from the V39 Intuition library, then waiting + for the reply message. + + @{b}INPUTS@{ub} + screen a buffered screen handle, as returned from @{"sb_OpenScreen()" Link "sb_OpenScreen"} + + @{b}OUTPUTS@{ub} + bitmap a standard Amiga bitmap, that represents the currently HIDDEN + display area. This will usually need to be cleared and can + then be rendered into. + + @{b}SEE ALSO@{ub} + @{"sb_OpenScreen()" Link "sb_OpenScreen"}, @{"sb_NextBuffer()" Link sb_NextBuffer}, @{"sb_GetBitMap()" Link sb_GetBitMap}, @{"sb_GetScreen()" Link sb_GetScreen} +@endnode + +@node "sb_GetBitMap" +@{u}scrbuffer.m/sb_GetBitMap scrbuffer.m/sb_GetBitMap@{uu} + + @{b}SYNTAX@{ub} + + bitmap = sb_GetBitMap( buffered screen ) + + @{b}PURPOSE@{ub} + + Returns the currently hidden bitmap. This will be identical to that + returned by @{"sb_NextBuffer()" Link "sb_NextBuffer"}. + + @{b}INPUTS@{ub} + screen a buffered screen handle, as returned from @{"sb_OpenScreen()" Link "sb_OpenScreen"} + + @{b}OUTPUTS@{ub} + bitmap a standard amiga bitmap, that represents the currently HIDDEN + display area. + + @{b}SEE ALSO@{ub} + @{"sb_NextBuffer()" Link "sb_NextBuffer"}, @{"sb_OpenScreen()" Link "sb_OpenScreen"}, @{"sb_GetBitMap()" Link sb_GetBitMap}, @{"sb_GetScreen()" Link sb_GetScreen} +@endnode + + +@node "sb_GetScreen" +@{u}scrbuffer.m/sb_GetScreen scrbuffer.m/sb_GetScreen@{uu} + + @{b}SYNTAX@{ub} + + screen = sb_GetScreen( buffered screen ) + + @{b}PURPOSE@{ub} + + Returns the Amiga screen associated with the double buffered + screen. This is to enable windows and other standard intuition + operations to be performed on the screen. + + @{b}INPUTS@{ub} + screen a buffered screen handle, as returned from @{"sb_OpenScreen()" Link "sb_OpenScreen"} + + @{b}OUTPUTS@{ub} + screen a standard Amiga Screen + + @{b}SEE ALSO@{ub} + @{"sb_NextBuffer()" Link "sb_NextBuffer"}, @{"sb_OpenScreen()" Link "sb_OpenScreen"}, @{"sb_GetBitMap()" Link sb_GetBitMap} +@endnode + + + +@node examples "Information about the examples" + + Only 1 example has been written so far. + + @{"TheBOX" Link "TheBox.e/main"} + + A simple example that shows how to open a simple double buffered screen, + and render into the offscreen bitmap using the system functions. It also + shows how a window can be opened on the screen to get input events. + + +@endnode + + + + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/ScrBuffer/thebox.e b/amigae33a/E_v3.3a/Src/Src/Tools/ScrBuffer/thebox.e new file mode 100644 index 0000000..750179a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/ScrBuffer/thebox.e @@ -0,0 +1,75 @@ +/* + + Example for ScrBuffer.m double buffered screen module + + by Michael Zucchi, 1994 this code in the public domain + + */ + + +MODULE 'intuition/intuition', 'intuition/screens', + 'graphics/rastport', + 'tools/scrbuffer' + +DEF bscr, scr:PTR TO screen, win:PTR TO window + +PROC main() + +DEF x,y,x2,y2,x3,y3, dx, dy, rp, myrp:rastport, c, go, im:PTR TO intuimessage + +bscr:=sb_OpenScreen([SA_WIDTH, 320, SA_HEIGHT, 256, SA_DEPTH, 4, + SA_OVERSCAN, OSCAN_STANDARD, SA_AUTOSCROLL, -1, SA_PENS, [-1]:INT, 0], 0); + +-> find the screen we are using, and make a copy of the rastport so we can use it +scr:=sb_GetScreen(bscr); +CopyMem(scr.rastport, myrp, SIZEOF rastport); +myrp.layer:=0; -> must set layer to 0 'cause we dont have one! + +-> open a window so we can get REAL input events +win:=OpenWindowTagList(0, [WA_CUSTOMSCREEN, scr, WA_BACKDROP, -1, + WA_FLAGS, WFLG_BORDERLESS+WFLG_ACTIVATE+WFLG_RMBTRAP, + WA_IDCMP, IDCMP_VANILLAKEY, 0]); + +dx:=2;dy:=1; +x:=50;y:=50; -> position +x2:=0;y2:=0; +x3:=0;y3:=0; -> where to erase +c:=1 -> colour +go:=1; + +WHILE go + IF (im:=GetMsg(win.userport)) -> get any vanillakey events + IF im.class=IDCMP_VANILLAKEY AND im.code=27 THEN go:=0; + ReplyMsg(im); + ENDIF + + myrp.bitmap:=sb_NextBuffer(bscr); -> change screen buffers, and get its bitmap + + SetAPen(myrp, 0); -> erase the old image + RectFill(myrp, x3, y3, x3+100, y3+50); + SetAPen(myrp, c); -> draw the new box + RectFill(myrp, x, y, x+100, y+50); + + Move(myrp, 50,50); + Text(myrp, 'ESC to quit!', 12); + + x3:=x2;y3:=y2; -> roll coordinates + x2:=x;y2:=y; + + x:=x+dx; -> new position + y:=y+dy; + + IF (x>(320-110)) OR (x<10) -> bounce the box off of walls + dx:=-dx;c++ + ENDIF + IF (y>(256-60)) OR (y<10) + dy:=-dy;c++ + ENDIF +ENDWHILE + +-> clean up. In 'real life' all the open functions would be tested after use +CloseWindow(win); +sb_CloseScreen(bscr); + +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/TrapGuru/gurutest.e b/amigae33a/E_v3.3a/Src/Src/Tools/TrapGuru/gurutest.e new file mode 100644 index 0000000..6f3366b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/TrapGuru/gurutest.e @@ -0,0 +1,20 @@ +/* shows ho to catch processor exceptions from own programs + I don't guarantee what the module trapguru.m does is 100% ok + for all CPU's */ + +MODULE 'tools/trapguru' + +PROC main() + DEF a + trapguru() -> install trap handler + FOR a:=1 TO 10 DO bla(a) +ENDPROC + +PROC bla(x) HANDLE + DEF a=0 + a:=a/a -> cause processor exception +EXCEPT + IF exception="GURU" + WriteF('guru \d occured: $\z\h[8]\n',x,exceptioninfo) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/TrapGuru/trapguru.e b/amigae33a/E_v3.3a/Src/Src/Tools/TrapGuru/trapguru.e new file mode 100644 index 0000000..7497c19 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/TrapGuru/trapguru.e @@ -0,0 +1,45 @@ +/* trapguru.m + + installs a trap-handler in your task-structure, to catch + processor exceptions like zero-divide etc. + When handler gets invoked, it will throw an E-exception + "GURU" with alertnum as info. + + I don't guarantee this is 100% reliable for all CPU's etc. + +*/ + + +OPT MODULE + +MODULE 'exec/tasks' + +EXPORT PROC trapguru() + DEF mytask:PTR TO tc + mytask:=FindTask(NIL) + mytask.trapcode:={tcode} + LEA store(PC),A0 + MOVE.L A4,(A0) +ENDPROC + +tcode: + MOVE.L (A7)+,D0 + LEA store(PC),A0 + MOVE.L D0,4(A0) + MOVEQ #3,D1 + CMP.L D1,D0 + BGT.S noadjust + MOVE.L $4.W,A6 + BTST #0,297(A6) + BNE.S noadjust + ADDQ.L #8,A7 +noadjust: + LEA continue(PC),A0 + MOVE.L A0,2(A7) + RTE +continue: + LEA store(PC),A0 + MOVE.L (A0),A4 + Throw("GURU",Long({store}+4)) +store: + LONG 0,0 diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/UsefulV2.doc b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/UsefulV2.doc new file mode 100644 index 0000000..b7984f4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/UsefulV2.doc @@ -0,0 +1,150 @@ +Short: JRH's useful E modules (version 2) +Type: dev/e +Author: jason@fsel.com (Jason R. Hulance) +Uploader: jason@fsel.com (Jason R. Hulance) + +JRH's Useful Modules (Version 2) +================================ + +These modules are Copyright (C) 1995, Jason R. Hulance. + +You are free to use these modules in your programs, whether they are freeware +or commercial. However, if you want to distribute any of this archive you +must include it all, unmodified, together with this file. + +Contents +-------- + +[This version is mainly a bug-fix: the eCodeXXX() routines did not flush the +CPU caches so could fail on a 68040, and the resource modules have been +simplified thanks to a bug-fixed EC v3.2a.] + +Various modules: + + ecode.m: + PROC eCode(func) + PROC eCodePreserve(func) + PROC eCodeTask(func) + PROC eCodeASLHook(func) + PROC eCodeCxCustom(func) + PROC eCodeCollision(func) + PROC eCodeIntHandler(func) + PROC eCodeIntServer(func) + PROC eCodeSoftInt(func) + PROC eCodeSwapArgs(func) + PROC eCodeDispose(addr) + + split.m: + PROC argSplit(str=0) + + +Amiga E does not support Resources (at least, not up to v3.1a, anyway). +These modules rectify this. + + battclock.m: + DEF battclockbase + PROC readBattClock() + PROC resetBattClock() + PROC writeBattClock(time) + + battmem.m: + DEF battmembase + PROC obtainBattSemaphore() + PROC readBattMem(buffer,offset,length) + PROC releaseBattSemaphore() + PROC writeBattMem(buffer,offset,length) + + cia.m: + PROC ableICR(resource,mask) + PROC addICRVector(resource,iCRBit,interrupt) + PROC remICRVector(resource,iCRBit,interrupt) + PROC setICR(resource,mask) + + disk.m: + DEF diskbase + PROC allocUnit(unitNum) + PROC freeUnit(unitNum) + PROC getUnit(unitPointer) + PROC getUnitID(unitNum) + PROC giveUnit() + PROC readUnitID(unitNum) + + misc.m: + DEF miscbase + PROC allocMiscResource(unitNum,name) + PROC freeMiscResource(unitNum) + + potgo.m: + DEF potgobase + PROC allocPotBits(bits) + PROC freePotBits(bits) + PROC writePotgo(word,mask) + + +Documentation +------------- + +The standard documentation on the Resource functions suffices for the +Resource modules. All the other functions (eCodeXXX and split) return NIL +if an error occurred, which is normally "out of memory". + + ecode.m: + o eCode() takes the address of an E function (or a label) and wraps it + so that it can be called from other tasks/processes and still access + the global variables of the main program. This function was created + for use with createTask(), but has other uses. + o eCodePreserve() is similar, but it also protects the function by + preserving the non-scratch registers on the stack. This means the + function can retrieve (and change) registers D2-D7/A2-A6 as local + variables. For instance, + PROC fun(a6,a5,a4,a3,a2,d7,d6,d5,d4,d3,d2) IS d2:=d3+a3 + will have the effect of changing register D2 (and D0) when the + function returns. Note: you do not need to specify all registers, + just the suffix of the above that you are actually interested in. + PROC fun(a3,a2,d7,d6,d5,d4,d3,d2) IS d2:=d3+a3 + would have done... + o eCodeTask() is just eCode() with a more suggestive name. + o eCodeASLHook() takes the address of an E function (or a label) and + returns something usable as an ASL hook function (nothing to do with + the utility library hooks, more's the pity). + o eCodeCxCustom() does the same for CX custom functions. + o eCodeCollision() does the same for GEL collision functions. + o eCodeIntHandler() is for interrupt handlers: you get A1 and D1 as + arguments (in that order) to your function. (A1 is the data element + of your interrupt, and D1 contains the interrupt flags.) + o eCodeIntServer() is for interrupt servers: you get A1 (the data + element of your interrupt) as an argument. + o eCodeSoftInt() is the same, but for software interrupts. + o eCodeSwapArgs() is like eCode() except it swaps the order of two + arguments on the stack. This means the E function can have its + arguments in the same order as a similar C function. For example, + you can use this instead of eCodeCollision() if your collision code is + simple (i.e., doesn't use PrintF() and the like). + o eCodeDispose() is passed the result of the one of the above + functions, and will to dispose the memory used by the special wrapper. + You will rarely need to use this, as the memory will be freed + automatically at the end of the program. + o eCodeASLHook(), eCodeCxCustom(), eCodeIntHandler(), eCodeIntServer() + and eCodeSoftInt() all use their own private scratch area to preserve + registers, thus saving crucial stack space. This has the disadvantage + of making the code non-reentrant, so if you need to use the same + function as multiple interrupt servers you must use eCodeIntServer() + multiple times. Apart from that they should be OK, since they do + not get called from multiple tasks. (If you find this a problem then + you can use eCodePreserve()...) + o eCodePreserve() uses a big bit of STACK to store registers, so be + careful... + + split.m: + o argSplit(str=NIL) splits a string of arguments like "arg" (which is + the default), handling quoted arguments correctly. The result is an + E-list of strings, or NIL if an error occurred. The list is also + NIL-terminated so you have a choice of ways to manipulate it. The + string passed to this function (or "arg" by default) is *altered* by + this function, so you shouldn't try using it directly. You can + DisposeLink() the resulting list if you want to free it before the end + of the program. (You are also responsible for freeing the string when + you are done with it, unless it was the default "arg", of course.) + +The main reason for the creation of these modules was my translations of the +RKRM examples. These provide many examples of the use of these functions. diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/battclock.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/battclock.e new file mode 100644 index 0000000..8e2ec01 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/battclock.e @@ -0,0 +1,19 @@ +OPT MODULE + +EXPORT DEF battclockbase + +EXPORT PROC resetBattClock() + MOVE.L battclockbase, A6 + JSR -6(A6) -> Offset of real ResetBattClock +ENDPROC + +EXPORT PROC readBattClock() + MOVE.L battclockbase, A6 + JSR -12(A6) -> Offset of real ReadBattClock +ENDPROC D0 + +EXPORT PROC writeBattClock(time) + MOVE.L time, D0 + MOVE.L battclockbase, A6 + JSR -18(A6) -> Offset of real WriteBattClock +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/battmem.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/battmem.e new file mode 100644 index 0000000..7b3f7aa --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/battmem.e @@ -0,0 +1,29 @@ +OPT MODULE + +EXPORT DEF battmembase + +EXPORT PROC obtainBattSemaphore() + MOVE.L battmembase, A6 + JSR -6(A6) -> Offset of real ObtainBattSemaphore +ENDPROC + +EXPORT PROC releaseBattSemaphore() + MOVE.L battmembase, A6 + JSR -12(A6) -> Offset of real ReleaseBattSemaphore +ENDPROC + +EXPORT PROC readBattMem(buffer, offset, length) + MOVE.L buffer, A0 + MOVE.L offset, D0 + MOVE.L length, D1 + MOVE.L battmembase, A6 + JSR -18(A6) -> Offset of real ReadBattMem +ENDPROC D0 + +EXPORT PROC writeBattMem(buffer, offset, length) + MOVE.L buffer, A0 + MOVE.L offset, D0 + MOVE.L length, D1 + MOVE.L battmembase, A6 + JSR -24(A6) -> Offset of real WriteBattMem +ENDPROC D0 diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/bitfield.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/bitfield.e new file mode 100644 index 0000000..381690e --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/bitfield.e @@ -0,0 +1,18 @@ +OPT MODULE, PREPROCESS +OPT EXPORT + +#define NBITMASK(n) (Shl(1,(n))-1) + +#define NBITSATX(n,x) (Shl(NBITMASK(n),(x))) + +#define NOTNBITSATX(n,x) (Not(NBITSATX(n,x))) + +#define GETNBITSATX(n,x,f) (lshr((f) AND NBITSATX(n,x), (x))) + +#define SETNBITSATX(n,x,f,v) (((f) AND NOTNBITSATX(n,x)) OR Shl((v) AND NBITMASK(n), x)) + +PROC lshr(x,y) + MOVE.L x, D0 + MOVE.L y, D1 + LSR.L D1, D0 +ENDPROC D0 diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/cia.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/cia.e new file mode 100644 index 0000000..06d7eca --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/cia.e @@ -0,0 +1,27 @@ +OPT MODULE + +EXPORT PROC addICRVector(resource, iCRBit, interrupt) + MOVE.L iCRBit, D0 + MOVE.L interrupt, A1 + MOVE.L resource, A6 + JSR -6(A6) -> Offset of real AddICRVector +ENDPROC D0 + +EXPORT PROC remICRVector(resource, iCRBit, interrupt) + MOVE.L iCRBit, D0 + MOVE.L interrupt, A1 + MOVE.L resource, A6 + JSR -12(A6) -> Offset of real RemICRVector +ENDPROC + +EXPORT PROC ableICR(resource, mask) + MOVE.L mask, D0 + MOVE.L resource, A6 + JSR -18(A6) -> Offset of real AbleICR +ENDPROC D0 + +EXPORT PROC setICR(resource, mask) + MOVE.L mask, D0 + MOVE.L resource, A6 + JSR -24(A6) -> Offset of real SetICR +ENDPROC D0 diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/disk.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/disk.e new file mode 100644 index 0000000..e67c377 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/disk.e @@ -0,0 +1,38 @@ +OPT MODULE + +EXPORT DEF diskbase + +EXPORT PROC allocUnit(unitNum) + MOVE.L unitNum, D0 + MOVE.L diskbase, A6 + JSR -6(A6) -> Offset of real AllocUnit +ENDPROC D0 + +EXPORT PROC freeUnit(unitNum) + MOVE.L unitNum, D0 + MOVE.L diskbase, A6 + JSR -12(A6) -> Offset of real FreeUnit +ENDPROC + +EXPORT PROC getUnit(unitPointer) + MOVE.L unitPointer, A1 + MOVE.L diskbase, A6 + JSR -18(A6) -> Offset of real GetUnit +ENDPROC D0 + +EXPORT PROC giveUnit() + MOVE.L diskbase, A6 + JSR -24(A6) -> Offset of real GiveUnit +ENDPROC + +EXPORT PROC getUnitID(unitNum) + MOVE.L unitNum, D0 + MOVE.L diskbase, A6 + JSR -30(A6) -> Offset of real GetUnitID +ENDPROC D0 + +EXPORT PROC readUnitID(unitNum) + MOVE.L unitNum, D0 + MOVE.L diskbase, A6 + JSR -36(A6) -> Offset of real ReadUnitID +ENDPROC D0 diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/ecode.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/ecode.e new file mode 100644 index 0000000..650c899 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/ecode.e @@ -0,0 +1,207 @@ +OPT MODULE + +MODULE 'exec/memory', + 'hardware/custom' + +-> Wraps an E function so it can still access globals, even from other tasks. +EXPORT PROC eCode(func) IS setup(func,{start},{end}-{start}) + +-> Wraps an E function as above, but also preserves the non-scratch registers. +EXPORT PROC eCodePreserve(func) IS setup(func,{pStart},{pEnd}-{pStart}) + +-> Wraps an E function for use with createTask() +EXPORT PROC eCodeTask(func) IS eCode(func) + +-> Wraps an E function for use as an ASL hook +EXPORT PROC eCodeASLHook(func) IS setup(func,{aStart},{aEnd}-{aStart}) + +-> Wraps an E function for use as an CX custom function +EXPORT PROC eCodeCxCustom(func) IS setup(func,{cStart},{cEnd}-{cStart}) + +-> Wraps an E function for use as a GEL collision function +EXPORT PROC eCodeCollision(func) IS eCodeCxCustom(func) + +-> Wraps an E function for use as an interrupt handler +EXPORT PROC eCodeIntHandler(func) IS setup(func,{hStart},{hEnd}-{hStart}) + +-> Wraps an E function for use as an interrupt server +EXPORT PROC eCodeIntServer(func) IS setup(func,{sStart},{sEnd}-{sStart}) + +-> Wraps an E function for use as a software interrupt +EXPORT PROC eCodeSoftInt(func) IS setup(func,{iStart},{iEnd}-{iStart}) + +-> Wraps an E function as eCode(), but swaps the order of two args +EXPORT PROC eCodeSwapArgs(func) IS setup(func,{oStart},{oEnd}-{oStart}) + +EXPORT PROC eCodeDispose(mem) IS IF mem THEN Dispose(mem-8) ELSE NIL + +PROC setup(func, addr, len) HANDLE + DEF mem:PTR TO LONG, a4 + mem:=NewM(len, MEMF_PUBLIC) + -> Fully relocatable code can be copied to another memory location + CopyMem(addr, mem, len) + mem[]++:=func + MOVE.L A4, a4 + mem[]++:=a4 + IF KickVersion(36) THEN CacheClearU() -> Write out the cache (68040 especially bad...) + RETURN mem +EXCEPT + RETURN NIL +ENDPROC + +start: +function: + LONG 0 +storeA4: + LONG 0 +entry: + MOVE.L storeA4(PC), A4 -> Restore A4 + MOVE.L function(PC), -(A7) + RTS -> Call real function +end: + NOP + +pStart: +pFunction: + LONG 0 +pStoreA4: + LONG 0 +pEntry: + MOVEM.L D2-D7/A2-A6, -(A7) -> Preserve registers + MOVE.L pStoreA4(PC), A4 -> Restore A4 + MOVE.L pFunction(PC), A5 + JSR (A5) -> Call real function + MOVEM.L (A7)+, D2-D7/A2-A6 -> Restore registers + RTS +pEnd: + NOP + +aStart: +aFunction: + LONG 0 +aStoreA4: + LONG 0 +aEntry: + MOVE.L (A7)+, A1 -> Remember the caller + MOVE.L (A7), A0 -> Swap 3 arguments + MOVE.L 8(A7), (A7) + MOVE.L A0, 8(A7) + LEA aStack(PC), A0 + MOVEM.L D2-D7/A1-A6, (A0) -> Preserve registers + MOVE.L aStoreA4(PC), A4 -> Restore A4 + MOVE.L aFunction(PC), A0 + JSR (A0) -> Call real function + LEA aStack(PC), A0 + MOVEM.L (A0), D2-D7/A1-A6 -> Restore registers + MOVE.L A1, -(A7) -> Restore caller + RTS +aStack: + LONG 2,3,4,5,6,7,1,2,3,4,5,6,0 +aEnd: + NOP + +cStart: +cFunction: + LONG 0 +cStoreA4: + LONG 0 +cEntry: + MOVE.L (A7)+, A1 -> Remember the caller + MOVE.L (A7), A0 -> Swap 2 arguments + MOVE.L 4(A7), (A7) + MOVE.L A0, 4(A7) + LEA cStack(PC), A0 + MOVEM.L D2-D7/A1-A6, (A0) -> Preserve registers + MOVE.L cStoreA4(PC), A4 -> Restore A4 + MOVE.L cFunction(PC), A0 + JSR (A0) -> Call real function + LEA cStack(PC), A0 + MOVEM.L (A0), D2-D7/A1-A6 -> Restore registers + MOVE.L A1, -(A7) -> Restore caller + RTS +cStack: + LONG 2,3,4,5,6,7,1,2,3,4,5,6,0 +cEnd: + NOP + +hStart: +hFunction: + LONG 0 +hStoreA4: + LONG 0 +hEntry: + LEA hStack(PC), A0 + MOVEM.L D2-D7/A2-A4, (A0) -> Preserve registers + MOVE.L hStoreA4(PC), A4 -> Restore A4 + MOVE.L hFunction(PC), A0 + MOVEM.L D1/A1, -(A7) -> Push D1 and A1 as arguments + JSR (A0) -> Call real function + LEA 8(A7), A7 -> Remove arguments + LEA hStack(PC), A0 + MOVEM.L (A0), D2-D7/A2-A4 -> Restore registers + RTS +hStack: + LONG 2,3,4,5,6,7,2,3,4,0 +hEnd: + NOP + +sStart: +sFunction: + LONG 0 +sStoreA4: + LONG 0 +sEntry: + LEA sStack(PC), A6 + MOVEM.L D2-D7/A2-A4, (A6) -> Preserve registers + MOVE.L sStoreA4(PC), A4 -> Restore A4 + MOVE.L sFunction(PC), A6 + MOVE.L A1, -(A7) -> Push A1 as an argument + JSR (A6) -> Call real function + LEA 4(A7), A7 -> Remove argument + LEA sStack(PC), A6 + MOVEM.L (A6), D2-D7/A2-A4 -> Restore registers + MOVE.L #CUSTOMADDR, A0 -> Reset A0 to custom base + TST.L D0 -> Set Z flag according to func result + RTS +sStack: + LONG 2,3,4,5,6,7,2,3,4,0 +sEnd: + NOP + +iStart: +iFunction: + LONG 0 +iStoreA4: + LONG 0 +iEntry: + LEA iStack(PC), A0 + MOVEM.L D2-D7/A2-A4/A6, (A0) -> Preserve registers + MOVE.L iStoreA4(PC), A4 -> Restore A4 + MOVE.L iFunction(PC), A0 + MOVE.L A1, -(A7) -> Push A1 as an argument + JSR (A0) -> Call real function + LEA 4(A7), A7 -> Remove argument + LEA iStack(PC), A0 + MOVEM.L (A0), D2-D7/A2-A4/A6 -> Restore registers + RTS +iStack: + LONG 2,3,4,5,6,7,2,3,4,6,0 +iEnd: + NOP + +oStart: +oFunction: + LONG 0 +oStoreA4: + LONG 0 +oEntry: + MOVE.L 4(A7), A0 -> Swap 2 arguments + MOVE.L 8(A7), 4(A7) + MOVE.L A0, 8(A7) + MOVE.L oStoreA4(PC), A4 -> Restore A4 + MOVE.L oFunction(PC), -(A7) + RTS -> Call real function +oEnd: + NOP + + diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/misc.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/misc.e new file mode 100644 index 0000000..78d147a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/misc.e @@ -0,0 +1,16 @@ +OPT MODULE + +EXPORT DEF miscbase + +EXPORT PROC allocMiscResource(unitNum, name) + MOVE.L unitNum, D0 + MOVE.L name, A1 + MOVE.L miscbase, A6 + JSR -6(A6) -> Offset of real AllocMiscResource +ENDPROC D0 + +EXPORT PROC freeMiscResource(unitNum) + MOVE.L unitNum, D0 + MOVE.L miscbase, A6 + JSR -12(A6) -> Offset of real FreeMiscResource +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/potgo.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/potgo.e new file mode 100644 index 0000000..02d16d7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/potgo.e @@ -0,0 +1,22 @@ +OPT MODULE + +EXPORT DEF potgobase + +EXPORT PROC allocPotBits(bits) + MOVE.L bits, D0 + MOVE.L potgobase, A6 + JSR -6(A6) -> Offset of real AllocPotBits +ENDPROC D0 + +EXPORT PROC freePotBits(bits) + MOVE.L bits, D0 + MOVE.L potgobase, A6 + JSR -12(A6) -> Offset of real FreePotBits +ENDPROC + +EXPORT PROC writePotgo(word, mask) + MOVE.L word, D0 + MOVE.L mask, D1 + MOVE.L potgobase, A6 + JSR -18(A6) -> Offset of real WritePotgo +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/sendexplorer.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/sendexplorer.e new file mode 100644 index 0000000..08c836d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/sendexplorer.e @@ -0,0 +1,16 @@ +OPT MODULE + +MODULE 'other/sendrexx' + +CONST MAXLINE=512 + +EXPORT PROC sendExplorer(addr,obj=NIL,repPort=NIL,message=NIL,quiet=FALSE) + DEF s[MAXLINE]:STRING + StringF(s, '''DISPLAY \s$\h OBJECT "\s" MESSAGE "\s"''', + IF quiet THEN 'QUIET ' ELSE '', addr, + IF obj THEN obj ELSE '', IF message THEN message ELSE '') +ENDPROC rx_SendMsg('EXPLORER',s,repPort) + +EXPORT PROC quitExplorer(repPort=NIL) IS rx_SendMsg('EXPLORER','''QUIT''',repPort) + +EXPORT PROC isExplorerRunning() IS FindPort('EXPLORER')<>NIL diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/sendrexx.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/sendrexx.e new file mode 100644 index 0000000..dbf4f81 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/sendrexx.e @@ -0,0 +1,46 @@ +OPT MODULE, PREPROCESS + +MODULE 'exec/ports', + 'exec/nodes', + 'rexx/rxslib', + 'rexx/storage', + 'rexxsyslib', + 'amigalib/ports' + +ENUM ERR_NONE, ERR_LIB, ERR_RMSG, ERR_RSTR + +RAISE ERR_LIB IF OpenLibrary()=NIL, + ERR_RMSG IF CreateRexxMsg()=NIL, + ERR_RSTR IF CreateArgstring()=NIL + +EXPORT PROC rx_SendMsg(portname, s, repPort=NIL) HANDLE + DEF port=NIL, msg=NIL:PTR TO rexxmsg, myrep=NIL, lib=NIL, success=FALSE + IF rexxsysbase=NIL + rexxsysbase:=lib:=OpenLibrary(RXSNAME, 0) + ENDIF + IF repPort=NIL + IF NIL=(repPort:=myrep:=createPort(NIL,0)) THEN Raise("PORT") + ENDIF + msg:=CreateRexxMsg(repPort, NIL, portname) + msg.action:=RXCOMM + msg.args[]:=CreateArgstring(s, StrLen(s)) + msg.mn.ln.name:=RXSDIR + Forbid() + IF port:=FindPort(RXSDIR) THEN PutMsg(port, msg) + Permit() + IF port + WaitPort(repPort) + msg:=GetMsg(repPort) + success:=(msg.result1=0) + ENDIF +EXCEPT DO + IF msg + IF msg.args[] THEN DeleteArgstring(msg.args[]) + DeleteRexxMsg(msg) + ENDIF + IF myrep THEN deletePort(myrep) + IF lib + CloseLibrary(lib) + rexxsysbase:=NIL + ENDIF +ENDPROC success diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/setprogname.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/setprogname.e new file mode 100644 index 0000000..f1498db --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/setprogname.e @@ -0,0 +1,16 @@ +OPT MODULE, PREPROCESS +OPT EXPORT + +MODULE 'dos/dos', + 'dos/dosextens' + +PROC setprogname(p:PTR TO LONG) + DEF cli:PTR TO commandlineinterface, bstr + IF p[]=NIL + IF cli:=Cli() + bstr:=BADDR(cli.commandname) + p[]:=String(bstr[]) + IF p[] THEN StrCopy(p[],bstr+1,bstr[]) + ENDIF + ENDIF +ENDPROC \ No newline at end of file diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Useful/split.e b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/split.e new file mode 100644 index 0000000..0b40d82 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Useful/split.e @@ -0,0 +1,62 @@ +OPT MODULE + +ENUM A_BEGIN, A_SPACE, A_QUOTE, A_QUOTE2, A_END + +CONST NUM="\a"+1 + +-> Split the string "str" (which defaults to the arguments string "arg") +EXPORT PROC argSplit(str=NIL) IS splitStr_(IF str THEN str ELSE arg) + +-> A small function to split an argument string like "arg" into a C-like array +-> of arguments, handling quoted arguments properly. Uses recursion to collect +-> list contents, then allocate list and set contents. Result is NIL if out of +-> memory, or an E-list of pointers to (normal) strings (this list is also NIL +-> terminated so you have a choice of how to use it). The original string is +-> effectively destroyed and should not be used after calling this function. +PROC splitStr_(str, len=0) + DEF tmp=A_BEGIN:PTR TO LONG, s -> Reuse tmp to save stack space + s:=str + WHILE tmp<>A_END + SELECT NUM OF str[] + CASE 0, "\n", "\b" + IF tmp=A_BEGIN THEN s:=NIL + str[]:=0 + tmp:=A_END + CASE "\q" + SELECT A_END OF tmp + CASE A_BEGIN; tmp:=A_QUOTE; s++ + CASE A_QUOTE; tmp:=A_END; str[]:=0 + ENDSELECT + str++ + CASE "\a" + SELECT A_END OF tmp + CASE A_BEGIN; tmp:=A_QUOTE2; s++ + CASE A_QUOTE2; tmp:=A_END; str[]:=0 + ENDSELECT + str++ + CASE " ", "\t" + SELECT A_END OF tmp + CASE A_BEGIN; s++ + CASE A_SPACE; tmp:=A_END; str[]:=0 + ENDSELECT + str++ + DEFAULT + IF tmp=A_BEGIN THEN tmp:=A_SPACE + str++ + ENDSELECT + ENDWHILE + IF s -> If not the last one... + IF FreeStack()>=1000 -> (Check stack since recursing...) + tmp:=splitStr_(str, len+1) -> ... split the rest, + IF tmp THEN tmp[len]:=s -> and add this one in + ELSE + tmp:=NIL + ENDIF + ELSE -> Else reached the end of arg... + tmp:=List(len+1) -> ... allocate list and set length + IF tmp -> (Extra element is for NIL termination) + tmp[len]:=NIL + SetList(tmp, len) + ENDIF + ENDIF +ENDPROC tmp -> Returns NIL if List() fails diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Vector/Vector.e b/amigae33a/E_v3.3a/Src/Src/Tools/Vector/Vector.e new file mode 100644 index 0000000..d016d28 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Vector/Vector.e @@ -0,0 +1,173 @@ +OPT MODULE + +EXPORT PROC polygon3d(list:PTR TO LONG,col=1) + DEF n,i,sx,sy,ox,oy,f=FALSE + n:=ListLen(list)/3 + FOR i:=1 TO n + sx,sy:=vec3d(list[]++,list[]++,list[]++) + IF f THEN Line(ox,oy,sx,sy,col) ELSE f:=TRUE + ox:=sx; oy:=sy; + ENDFOR +ENDPROC + +EXPORT PROC init3d(phi=75,theta=40) + LEA sintab(PC),A0 /* uses A0,A1,D0 */ + LEA c1(PC),A1 + MOVE.L phi,D0 + LSL.W #1,D0 + MOVE.W 0(A0,D0.W),6(A1) + ADD.W #180,D0 + MOVE.W 0(A0,D0.W),2(A1) + MOVE.L theta,D0 + LSL.W #1,D0 + MOVE.W 0(A0,D0.W),4(A1) + ADD.W #180,D0 + MOVE.W 0(A0,D0.W),(A1) +ENDPROC + +EXPORT PROC setpers3d(irho=1000,id=400) /* for average size rho:d = 5:2 */ + LEA rho(PC),A0 + MOVE.W irho.W,(A0) + MOVE.W id.W,2(A0) +ENDPROC + +EXPORT PROC setmiddle3d(x=160,y=128) + LEA midx(PC),A0 + MOVE.W x.W,(A0) + MOVE.W y.W,2(A0) +ENDPROC + +c1: INT $00c2 +c2: INT $0045 +s1: INT $00a3 +s2: INT $00f5 +rho: INT 2000 +d: INT 900 +midx: INT 160 +midy: INT 128 + +EXPORT PROC vec3d(x,y,z) + MOVE.L x,D0 + MOVE.L y,D1 + MOVE.L z,D2 + MOVE.L A4,-(A7) + MOVE.W c1(PC),D3 + MOVE.W c2(PC),D4 + MOVE.W s1(PC),D5 + MOVE.W s2(PC),D6 + MOVE D0,D7 /* EXPECTS X,Y,Z IN D0-D2 */ + MULS D5,D7 /* TRASHES ALL REGS BUT A5-A7 */ + ASR.L #8,D7 + MOVE D7,A0 /* TEMP1 = X*S1 */ + MOVE D1,D7 + MULS D3,D7 + ASR.L #8,D7 + SUB A0,D7 + MOVE D7,A2 /* XE = Y*C1-TEMP1 */ + MOVE D1,D7 + MULS D5,D7 + ASR.L #8,D7 + MULS D4,D7 + ASR.L #8,D7 + MOVE D7,A0 /* TEMP1 = Y*S1*C2 */ + MOVE D0,D7 + MULS D3,D7 + ASR.L #8,D7 + MULS D4,D7 + ASR.L #8,D7 + MOVE D7,A1 /* TEMP2 = X*C1*C2 */ + MOVE D2,D7 + MULS D6,D7 + ASR.L #8,D7 + SUB A0,D7 + SUB A1,D7 + MOVE D7,A3 /* YE = Z*S2-TEMP1-TEMP2 */ + MULS D6,D0 + ASR.L #8,D0 + MULS D3,D0 + ASR.L #8,D0 + MOVE D0,A0 /* TEMP1 = X*S2*C1 */ + MULS D6,D1 + ASR.L #8,D1 + MULS D5,D1 + ASR.L #8,D1 + MOVE D1,A1 /* TEMP2 = Y*S2*S1 */ + NEG D2 + MULS D4,D2 + ASR.L #8,D2 + ADD rho(PC),D2 + SUB A0,D2 + SUB A1,D2 /* ZE(D2) = -Z*C2+RHO-TEMP1-TEMP2 */ + MOVE A2,D3 + MOVE A3,D4 + MOVE d(PC),D0 + MOVE D0,D1 + MULS D3,D0 + DIVS D2,D0 + ADD midx(PC),D0 /* SX(D0) = D*XE/ZE+160 */ + NEG D1 + MULS D4,D1 + DIVS D2,D1 + ADD midy(PC),D1 /* SY(D1) = -D*YE/ZE+128 */ + MOVE.L (A7)+,A4 + EXT.L D0 + EXT.L D1 +ENDPROC D0 + +sintab: INT $0000,$0004,$0008,$000D,$0011,$0016,$001A,$001F + INT $0023,$0027,$002C,$0030,$0035,$0039,$003D,$0041 + INT $0046,$004A,$004E,$0053,$0057,$005B,$005F,$0063 + INT $0067,$006B,$006F,$0073,$0077,$007B,$007F,$0083 + INT $0087,$008A,$008E,$0092,$0095,$0099,$009C,$00A0 + INT $00A3,$00A7,$00AA,$00AD,$00B1,$00B4,$00B7,$00BA + INT $00BD,$00C0,$00C3,$00C6,$00C8,$00CB,$00CE,$00D0 + INT $00D3,$00D5,$00D8,$00DA,$00DC,$00DF,$00E1,$00E3 + INT $00E5,$00E7,$00E8,$00EA,$00EC,$00EE,$00EF,$00F1 + INT $00F2,$00F3,$00F5,$00F6,$00F7,$00F8,$00F9,$00FA + INT $00FB,$00FB,$00FC,$00FD,$00FD,$00FE,$00FE,$00FE + INT $00FE,$00FE,$00FF,$00FE,$00FE,$00FE,$00FE,$00FE + INT $00FD,$00FD,$00FC,$00FB,$00FB,$00FA,$00F9,$00F8 + INT $00F7,$00F6,$00F5,$00F3,$00F2,$00F1,$00EF,$00EE + INT $00EC,$00EA,$00E8,$00E7,$00E5,$00E3,$00E1,$00DF + INT $00DC,$00DA,$00D8,$00D5,$00D3,$00D0,$00CE,$00CB + INT $00C8,$00C6,$00C3,$00C0,$00BD,$00BA,$00B7,$00B4 + INT $00B1,$00AD,$00AA,$00A7,$00A3,$00A0,$009C,$0099 + INT $0095,$0092,$008E,$008A,$0087,$0083,$007F,$007B + INT $0077,$0073,$006F,$006B,$0067,$0063,$005F,$005B + INT $0057,$0053,$004E,$004A,$0046,$0041,$003D,$0039 + INT $0035,$0030,$002C,$0027,$0023,$001F,$001A,$0016 + INT $0011,$000D,$0008,$0004,$0000,$FFFC,$FFF8,$FFF3 + INT $FFEF,$FFEA,$FFE6,$FFE1,$FFDD,$FFD9,$FFD4,$FFD0 + INT $FFCB,$FFC7,$FFC3,$FFBF,$FFBA,$FFB6,$FFB2,$FFAD + INT $FFA9,$FFA5,$FFA1,$FF9D,$FF99,$FF95,$FF91,$FF8D + INT $FF89,$FF85,$FF81,$FF7D,$FF79,$FF76,$FF72,$FF6E + INT $FF6B,$FF67,$FF64,$FF60,$FF5D,$FF59,$FF56,$FF53 + INT $FF4F,$FF4C,$FF49,$FF46,$FF43,$FF40,$FF3D,$FF3A + INT $FF38,$FF35,$FF32,$FF30,$FF2D,$FF2B,$FF28,$FF26 + INT $FF24,$FF21,$FF1F,$FF1D,$FF1B,$FF19,$FF18,$FF16 + INT $FF14,$FF12,$FF11,$FF0F,$FF0E,$FF0D,$FF0B,$FF0A + INT $FF09,$FF08,$FF07,$FF06,$FF05,$FF05,$FF04,$FF03 + INT $FF03,$FF02,$FF02,$FF02,$FF02,$FF02,$FF01,$FF02 + INT $FF02,$FF02,$FF02,$FF02,$FF03,$FF03,$FF04,$FF05 + INT $FF05,$FF06,$FF07,$FF08,$FF09,$FF0A,$FF0B,$FF0D + INT $FF0E,$FF0F,$FF11,$FF12,$FF14,$FF16,$FF18,$FF19 + INT $FF1B,$FF1D,$FF1F,$FF21,$FF24,$FF26,$FF28,$FF2B + INT $FF2D,$FF30,$FF32,$FF35,$FF38,$FF3A,$FF3D,$FF40 + INT $FF43,$FF46,$FF49,$FF4C,$FF4F,$FF53,$FF56,$FF59 + INT $FF5D,$FF60,$FF64,$FF67,$FF6B,$FF6E,$FF72,$FF76 + INT $FF79,$FF7D,$FF81,$FF85,$FF89,$FF8D,$FF91,$FF95 + INT $FF99,$FF9D,$FFA1,$FFA5,$FFA9,$FFAD,$FFB2,$FFB6 + INT $FFBA,$FFBE,$FFC3,$FFC7,$FFCB,$FFD0,$FFD4,$FFD9 + INT $FFDD,$FFE1,$FFE6,$FFEA,$FFEF,$FFF3,$FFF8,$FFFC + INT $0000,$0004,$0008,$000D,$0011,$0016,$001A,$001F + INT $0023,$0027,$002C,$0030,$0035,$0039,$003D,$0041 + INT $0046,$004A,$004E,$0053,$0057,$005B,$005F,$0063 + INT $0067,$006B,$006F,$0073,$0077,$007B,$007F,$0083 + INT $0087,$008A,$008E,$0092,$0095,$0099,$009C,$00A0 + INT $00A3,$00A7,$00AA,$00AD,$00B1,$00B4,$00B7,$00BA + INT $00BD,$00C0,$00C3,$00C6,$00C8,$00CB,$00CE,$00D0 + INT $00D3,$00D5,$00D8,$00DA,$00DC,$00DF,$00E1,$00E3 + INT $00E5,$00E7,$00E8,$00EA,$00EC,$00EE,$00EF,$00F1 + INT $00F2,$00F3,$00F5,$00F6,$00F7,$00F8,$00F9,$00FA + INT $00FB,$00FB,$00FC,$00FD,$00FD,$00FE,$00FE,$00FE + INT $00FE,$00FE diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest1.e b/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest1.e new file mode 100644 index 0000000..84a5f1f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest1.e @@ -0,0 +1,16 @@ +MODULE 'tools/vector' + +CONST R=100 + +PROC main() + DEF w + IF w:=OpenW(0,11,400,160,$200,$F,'testing the vector3d module!',NIL,1,NIL) + init3d(75,60) + setmiddle3d(200,80) + setpers3d(500,200) + polygon3d([R,R,R, R,R,-R, R,-R,-R, R,-R,R, R,R,R, R,-R,R, -R,-R,R, -R,R,R, R,R,R],3) + polygon3d([-R,-R,-R, -R,-R,R, -R,R,R, -R,R,-R, -R,-R,-R, -R,R,-R, R,R,-R, R,-R,-R, -R,-R,-R],3) + WaitIMessage(w) + CloseW(w) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest2.e b/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest2.e new file mode 100644 index 0000000..09b3aeb --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest2.e @@ -0,0 +1,46 @@ +MODULE 'tools/vector' + +CONST R=100,MAXD=24,N=3 /* set N=1..7 (number of shades) */ + +OBJECT status + phi,theta,depth,x,y +ENDOBJECT + +DEF depth:PTR TO LONG,stats[N]:ARRAY OF status + +PROC main() + DEF w,curphi=75,curtheta=40,curd=0,curs=0,a,fact=1,curx=100,cury=100 + IF w:=OpenW(0,11,220,189,$200,$E,'3d VectorZ in E!',NIL,1,NIL) + SetRast(stdrast,1) + RefreshWindowFrame(w) + FOR a:=0 TO N-1 DO stats[a].phi:=-1 + depth:=[200,201,202,205,208,211,215,220,224,230,238,246,254,262,270,276,280,285,289,292,295,298,299,300] + REPEAT + stats[curs].phi:=curphi + stats[curs].theta:=curtheta + stats[curs].depth:=curd + stats[curs].x:=curx + stats[curs].y:=cury + drawshape(stats[curs],2) + curs++ + IF curs>=N THEN curs:=0 + curd:=curd+fact + IF curd>=(MAXD-1) THEN (curd:=MAXD-1) BUT fact:=-fact + IF curd<=0 THEN (curd:=0) BUT fact:=-fact + curphi:=curphi+2 + IF curphi>=360 THEN curphi:=0 + curtheta:=curtheta+2 + IF curtheta>=360 THEN curtheta:=0 + IF stats[curs].phi>=0 THEN drawshape(stats[curs],1) + UNTIL GetMsg(Long(w+$56)) + CloseW(w) + ENDIF +ENDPROC + +PROC drawshape(s:PTR TO status,col) + setmiddle3d(s.x,s.y) + setpers3d(750,depth[s.depth]) + init3d(s.phi,s.theta) + polygon3d([R,R,R,R,R,-R,R,-R,-R,R,-R,R,R,R,R,R,-R,R,-R,-R,R,-R,R,R,R,R,R],col) + polygon3d([-R,-R,-R,-R,-R,R,-R,R,R,-R,R,-R,-R,-R,-R,-R,R,-R,R,R,-R,R,-R,-R,-R,-R,-R],col) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest3.e b/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest3.e new file mode 100644 index 0000000..4d8a22d --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest3.e @@ -0,0 +1,44 @@ +MODULE 'tools/vector' + +CONST R=100,S=40 + +DEF r1=R,n1=-R,r2=R,n2=-R,fac1=-1,fac2=1,fac3=1,fac4=-1 +DEF o1,o2,l1,l2 + +PROC main() + DEF w,sx1,sx2,sy1,sy2,phi,theta + o1:=List(S) + o2:=List(S) + IF w:=OpenW(0,11,200,189,$200,$E,'3d VectorZ in E!',NIL,1,NIL) + SetRast(stdrast,1) + RefreshWindowFrame(w) + phi:=74 + theta:=60 + setmiddle3d(100,100) + setpers3d(750,300) + REPEAT + dofac({r1},{fac1}) + dofac({r2},{fac2}) + dofac({n1},{fac3}) + dofac({n2},{fac4}) + WaitTOF() + polygon3d(o1,1) + polygon3d(o2,1) + phi:=phi+2; IF phi>=360 THEN phi:=phi-360 + theta:=theta+2; IF theta>=360 THEN theta:=theta-360 + init3d(phi,theta) + polygon3d(l1:=[r1,r1,r1,r1,r1,n1,r1,n1,n1,r1,n1,r1,r1,r1,r1,r1,n1,r1,n1,n1,r1,n1,r1,r1,r1,r1,r1],2) + polygon3d(l2:=[n2,n2,n2,n2,n2,r2,n2,r2,r2,n2,r2,n2,n2,n2,n2,n2,r2,n2,r2,r2,n2,r2,n2,n2,n2,n2,n2],3) + ListCopy(o1,l1,ALL) + ListCopy(o2,l2,ALL) + Delay(1) + UNTIL GetMsg(Long(w+$56)) + CloseW(w) + ENDIF +ENDPROC + +PROC dofac(var,f) + ^var:=^var+^f + IF ^var>0 THEN IF (^var>120) OR (^var<80) THEN ^f:=-^f + IF ^var<0 THEN IF (^var<-120) OR (^var>-80) THEN ^f:=-^f +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest4.e b/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest4.e new file mode 100644 index 0000000..fbf8c81 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/Vector/vectest4.e @@ -0,0 +1,92 @@ +/* this is supposed to be one of them magnifying class vectors, + but it works a little bumpy right now (implementation=experimental). + change WINX and WINY below. +*/ + +MODULE 'tools/vector' + +CONST R=100,S=-100,MAXD=24,N=3 /* set N=1..7 (number of shades) */ +CONST DISTANCE=80,WINX=639,WINY=282 + +OBJECT status + phi,theta,depth,x,y +ENDOBJECT + +DEF depth:PTR TO LONG,stats[N]:ARRAY OF status, translist:PTR TO LONG + +PROC main() + DEF w,curphi=75,curtheta=40,curd=0,curs=0,a,fact=1,x,y,nx,ny,ox,oy + IF w:=OpenW(0,0,WINX,WINY,$200,$E,'3d VectorZ in E! (move mouse!)',NIL,1,NIL) + SetRast(stdrast,1) + translist:=[0,-16,-28,-36,-40,-40,-36,-28,-16,0,16,28,36,40,40,36,28,16,0] + FOR x:=0 TO WINX STEP 16 + FOR y:=0 TO WINY STEP 16 + nx,ny:=posttrans(x,y) + ox,oy:=posttrans(x,y+16) + Line(nx,ny,ox,oy,4) + ox,oy:=posttrans(x+16,y) + Line(nx,ny,ox,oy,4) + ENDFOR + ENDFOR + RefreshWindowFrame(w) + SetDrMd(stdrast,2) + PutChar(stdrast+24,3) + FOR a:=0 TO N-1 DO stats[a].phi:=-1 + depth:=[200,201,202,205,208,211,215,220,224,230,238,246,254,262,270,276,280,285,289,292,295,298,299,300] + REPEAT + stats[curs].phi:=curphi + stats[curs].theta:=curtheta + stats[curs].depth:=curd + stats[curs].x:=Bounds(MouseX(w),DISTANCE,WINX-DISTANCE) + stats[curs].y:=Bounds(MouseY(w),DISTANCE,WINY-DISTANCE) + drawshape(stats[curs],2) + curs++ + IF curs>=N THEN curs:=0 + curd:=curd+fact + IF curd>=(MAXD-1) THEN (curd:=MAXD-1) BUT fact:=-fact + IF curd<=0 THEN (curd:=0) BUT fact:=-fact + curphi:=curphi+2 + IF curphi>=360 THEN curphi:=0 + curtheta:=curtheta+2 + IF curtheta>=360 THEN curtheta:=0 + IF stats[curs].phi>=0 THEN drawshape(stats[curs],1) + UNTIL GetMsg(Long(w+$56)) + CloseW(w) + ELSE + WriteF('um,...\n') + ENDIF +ENDPROC + +PROC drawshape(s:PTR TO status,col) + setmiddle3d(s.x,s.y) + setpers3d(750,depth[s.depth]) + init3d(s.phi,s.theta) + polygon([R,R,S, R,R,R, R,S,R, R,S,S, R,R,S, S,R,S, S,R,R, S,S,R, S,S,S, S,R,S],col) + polygon([R,S,R, S,S,R],col) + polygon([R,R,R, S,R,R],col) + polygon([R,S,S, S,S,S],col) +ENDPROC + +PROC posttrans(x,y) + IF x>DISTANCE + IF y>DISTANCE + IF DISTANCE+288>x + IF DISTANCE+288>y + x:=ListItem(translist,Shr(x-DISTANCE,4))+x + y:=ListItem(translist,Shr(y-DISTANCE,4))+y + ENDIF + ENDIF + ENDIF + ENDIF +ENDPROC x,y + +PROC polygon(list:PTR TO LONG,col=1) + DEF n,i,sx,sy,ox,oy,f=FALSE + n:=ListLen(list)/3 + FOR i:=1 TO n + sx,sy:=vec3d(list[]++,list[]++,list[]++) + sx,sy:=posttrans(sx,sy) + IF f THEN Line(ox,oy,sx,sy,col) ELSE f:=TRUE + ox:=sx; oy:=sy; + ENDFOR +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/qItemAddress/README b/amigae33a/E_v3.3a/Src/Src/Tools/qItemAddress/README new file mode 100644 index 0000000..176deef --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/qItemAddress/README @@ -0,0 +1,18 @@ +Short: E module; case-sensitive menu hotkeys +Dest: dev/e +Uploader: el269@cleveland.freenet.edu +Long: +CONTENTS: + qualifiedItemAddress.e - E source for module qualifiedItemAddress.m + test.e - test/demo source + +The function in this module works identically to the Intuition +function ItemAddress(), except that it uses an additional argument +(keycode qualifier) to return the address of a menu item based on +the case (upper- or lowercase) of it's Intuition hotkey. + +Author: Barry Wills +Email: el269@cleveland.freenet.edu +Address: 5528D Pryor Dr. + SAFB, IL 62225, USA +Status: Public Domain diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/qItemAddress/qualifiedItemAddress.e b/amigae33a/E_v3.3a/Src/Src/Tools/qItemAddress/qualifiedItemAddress.e new file mode 100644 index 0000000..336910b --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/qItemAddress/qualifiedItemAddress.e @@ -0,0 +1,96 @@ +/*----------------------------------------------------------------------------* + + EMODULES:other/qualifiedItemAddress + + NAME + qualifiedItemAddress -- processes case-sensitive menu command hotkeys + for either shift key + + SYNOPSIS + itemAddress:=qualifiedItemAddress(menuStrip, menuNumber, qualifier) + + PROC qualifiedItemAddress(menuStrip:PTR TO menu, menuNumber, qualifier=0) + DEF itemAddress:PTR TO menuitem + ENDPROC itemAddress + + FUNCTION + Use of this function is similar to the Intuition routine ItemAddress(), + with the addition of the qualifier argument. Both menuNumber and + qualifier can be obtained from the Intuition IDCMP_MENUPICK message + received by your program. menuStrip is searched for the upper- or + lowercase equivalent menu command hotkey, depending on whether + qualifier contains IEQUALIFIER_RSHIFT and/or IEQUALIFIER_LSHIFT. If + qualifier is 0, the function will return the item identified by + Intuition (if indeed menuNumber corresponds to a valid menu item). A + value of NIL will be returned if no valid menu item can be identified. + + INPUTS + menuStrip = a pointer to the first menu in your menu strip + menuNumber = the value which contains the packed data that selects the + the menu and item (and sub-item). Very simply, the rawkey code + gotten from an IDCMP_MENUPICK intuimessage + qualifier = the rawkey qualifier gotten from and IDCMP_MENUPICK + intuimessage + + RESULT + If menuNumber = MENUNULL or does not correspond to a valid menu item on + menuStrip, this function returns NIL; else this function returns the + address of the menu item specified by menuNumber and qualifier. + + *----------------------------------------------------------------------------*/ + +OPT MODULE +OPT REG=5 + +MODULE 'intuition/intuition', + 'devices/inputevent', + 'other/lowerChar', + 'other/upperChar' + +EXPORT PROC qualifiedItemAddress(menuStrip:PTR TO menu, menuNumber, qualifier=0) + DEF item:PTR TO menuitem, origItem:PTR TO menuitem, subitem:PTR TO menuitem, + correctItem=NIL:PTR TO menuitem, commandChar, tChar=0 + /*-- Get the vanilla item address: --*/ + IF (origItem:=ItemAddress(menuStrip, menuNumber))=NIL THEN RETURN NIL + /*-------------------------------------------------------------------* + Qualifier will be: + - 0 if selected with the mouse; + - LCOMMAND unshifted, or RCOMMAND shifted if selected with hotkey + If Qualifier is 0, just return the one Intuition sent us. + *-------------------------------------------------------------------*/ + IF qualifier=0 THEN RETURN origItem + /*-- Determine if we're looking for a shifted char or not: --*/ + commandChar:=IF qualifier AND (IEQUALIFIER_RSHIFT OR IEQUALIFIER_LSHIFT) THEN + upperChar(origItem.command) ELSE lowerChar(origItem.command) + /*-- Loop through menus, looking for our char: --*/ + IF commandChar=origItem.command + correctItem:=origItem + ELSE + REPEAT ->cycle thru menus + item:=menuStrip.firstitem + REPEAT ->cycle thru items + subitem:=item.subitem + WHILE subitem<>NIL ->cycle thru subitems + IF (tChar:=subitem.command)=commandChar + correctItem:=subitem + subitem:=NIL + ELSE + subitem:=subitem.nextitem + ENDIF + ENDWHILE + IF tChar=commandChar + item:=NIL + ELSEIF (tChar:=item.command)=commandChar + correctItem:=item + item:=NIL + ELSE + item:=item.nextitem + ENDIF + UNTIL item=NIL + menuStrip:=IF tChar=commandChar THEN NIL ELSE menuStrip.nextmenu + UNTIL menuStrip=NIL + ENDIF + /*-- Preserve multiple selections for a single menu event. -*/ + IF correctItem THEN correctItem.nextselect:=origItem.nextselect +ENDPROC correctItem + /* qualifiedItemAddress */ diff --git a/amigae33a/E_v3.3a/Src/Src/Tools/qItemAddress/test.e b/amigae33a/E_v3.3a/Src/Src/Tools/qItemAddress/test.e new file mode 100644 index 0000000..8ddc5a1 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Tools/qItemAddress/test.e @@ -0,0 +1,168 @@ +/*----------------------------------------------------------* + Demo of qualifiedItemAddress module. + + E Source generated by SRCGEN v0.1 + + CHANGES TO ORIGINAL GEN'ED CODE: + - inclusion of module 'other/qualifiedItemAddress' + - localization of some global variables to the functions + wait4message() and main() + - restructured wait4message() to return multiple values + when a IDCMP_MENUPICK message is received + - restructured main() to process (correctly) multiply + selected menu items in a single event + - minor changes to the CreateMenusA() arguments + + Source modified by B. Wills, Dec 12, 1994. + Placed in public domain. + *----------------------------------------------------------*/ + +OPT OSVERSION=37 +OPT REG=5 + +MODULE 'gadtools', + 'libraries/gadtools', + 'intuition/intuition', + 'intuition/screens', + 'intuition/gadgetclass', + 'graphics/text' + +MODULE 'other/qualifiedItemAddress' + +ENUM NONE,NOCONTEXT,NOGADGET,NOWB,NOVISUAL,OPENGT,NOWINDOW,NOMENUS + +DEF project0wnd:PTR TO window, + project0menus, + project0glist, + scr:PTR TO screen, + visual=NIL, + offx,offy,tattr + +PROC setupscreen() + IF (gadtoolsbase:=OpenLibrary('gadtools.library',37))=NIL THEN RETURN OPENGT + IF (scr:=LockPubScreen('Workbench'))=NIL THEN RETURN NOWB + IF (visual:=GetVisualInfoA(scr,NIL))=NIL THEN RETURN NOVISUAL + offy:=scr.wbortop+Int(scr.rastport+58)-10 + tattr:=['topaz.font',8,0,0]:textattr +ENDPROC + +PROC closedownscreen() + IF visual THEN FreeVisualInfo(visual) + IF scr THEN UnlockPubScreen(NIL,scr) + IF gadtoolsbase THEN CloseLibrary(gadtoolsbase) +ENDPROC + +PROC openproject0window() + DEF g:PTR TO gadget + IF (g:=CreateContext({project0glist}))=NIL THEN RETURN NOCONTEXT + IF (project0menus:= + CreateMenusA([1,0,'M1',0,$0,0,0, + 2,0,'I1', 'a',$0,0,0, + 2,0,'I2', 'A',$0,0,0, + 2,0,'I3', NIL,$0,0,0, + 3,0,'I3.1', 'b',$0,0,0, + 3,0,'I3.2', 'B',$0,0,0, + 2,0,'I4', NIL,$0,0,0, + 3,0,'I4.1', 'C',$0,0,0, + 3,0,'I4.2', 'c',$0,0,0, + 1,0,'M2', NIL,$0,0,0, + 2,0,'I1', 'd',$0,0,0, + 2,0,'I2', 'E',$0,0,0, + 2,0,'I3', NIL,$0,0,0, + 3,0,'I3.1', 'D',$0,0,0, + 3,0,'I3.2', 'e',$0,0,0, + 2,0,'I4', 'f',$0,0,0, + 2,0,'I5', 'G',$0,0,0, + 0,0,0,0,0,0,0]:newmenu,NIL))=NIL THEN RETURN NOMENUS + IF LayoutMenusA(project0menus,visual,NIL)=FALSE THEN RETURN NOMENUS + IF (project0wnd:=OpenWindowTagList(NIL, + [WA_LEFT,10, + WA_TOP,15, + WA_WIDTH,offx+400, + WA_HEIGHT,offy+89, + WA_IDCMP,$24C077E, + WA_FLAGS,$100F, + WA_TITLE,'Try Hotkeys AND Mouse', + WA_CUSTOMSCREEN,scr, + WA_MINWIDTH,67, + WA_MINHEIGHT,21, + WA_MAXWIDTH,$2C0, + WA_MAXHEIGHT,$226, + WA_AUTOADJUST,1, + WA_AUTOADJUST,1, + NIL]))=NIL THEN RETURN NOWINDOW + IF SetMenuStrip(project0wnd,project0menus)=FALSE THEN RETURN NOMENUS + Gt_RefreshWindow(project0wnd,NIL) + SetStdRast(project0wnd.rport) + Colour(1) +ENDPROC + +PROC closeproject0window() + IF project0wnd THEN ClearMenuStrip(project0wnd) + IF project0menus THEN FreeMenus(project0menus) + IF project0wnd THEN CloseWindow(project0wnd) + IF project0glist THEN FreeGadgets(project0glist) +ENDPROC + +PROC reporterr(er) + DEF erlist:PTR TO LONG + IF er + erlist:=['get context','create gadget','lock wb','get visual infos', + 'open "gadtools.library" v37+','open window','create menus'] + EasyRequestArgs(0,[20,0,0,'Could not \s!','ok'],0,[erlist[er-1]]) + ENDIF +ENDPROC er + +PROC wait4message(win:PTR TO window) + DEF mes:PTR TO intuimessage, class, code, qualifier + REPEAT + class:=0 + IF mes:=Gt_GetIMsg(win.userport) + class:=mes.class + IF class=IDCMP_MENUPICK + code:=mes.code + qualifier:=mes.qualifier + ELSEIF (class=IDCMP_GADGETDOWN) OR (class=IDCMP_GADGETUP) + code:=mes.iaddress + ELSEIF class=IDCMP_REFRESHWINDOW + Gt_BeginRefresh(win) + Gt_EndRefresh(win,TRUE) + class:=0 + ELSEIF class<>IDCMP_CLOSEWINDOW /* remove these if you like */ + class:=0 + ENDIF + Gt_ReplyIMsg(mes) + ELSE + WaitPort(win.userport) + ENDIF + UNTIL class +ENDPROC class,code,qualifier + +PROC main() + DEF done=FALSE, class, code, qualifier, iaddress=NIL:PTR TO menuitem + IF reporterr(setupscreen())=0 + reporterr(openproject0window()) + REPEAT + class,code,qualifier:=wait4message(project0wnd) + SELECT class + CASE IDCMP_CLOSEWINDOW + done:=TRUE + CASE IDCMP_MENUPICK + WHILE code<>-1 ->MENUNULL doesn't work since + -> terminal nextselect is -1 in E, vice 65535 in C. + IF iaddress:=qualifiedItemAddress(project0menus, code, qualifier) + TextF(4, 30, 'MenuId=\d Char=\c Qual=$\h ', + code, iaddress.command, qualifier) + code:=iaddress.nextselect + Delay(50) ->allow time to read the menu info + ELSE + code:=-1 + ENDIF + IF CtrlC() THEN code:=-1 + ENDWHILE + ENDSELECT + UNTIL done + closeproject0window() + ENDIF + closedownscreen() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt.c b/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt.c new file mode 100644 index 0000000..32b9f88 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt.c @@ -0,0 +1,367 @@ +/* AmigaGuide to Text converter (v2). Copyright (c) 1994, Jason R. Hulance */ +/* C version. Restricted use of ANSI codes, so they work on Xterms etc. */ +/* Should compile easily (using gcc, say): */ +/* gcc -O2 -o ag2txt ag2txt.c */ + +#include +#include + +typedef enum { N_INIT, N_OUT, N_IN, NODE_STATES } NODE; +typedef enum { L_INIT, L_QUOTED, L_SPACED, LINE_STATES } LINE; +typedef enum { A_INIT, A_AT, A_BRAC, A_IGNORE, A_END, AT_STATES } AT; + +#define MAX_LINE_LEN (1024) +#define MAX_WIDTH (120) +#define CMP_EQUAL (0) +#define CMP_UNEQUAL (1) + +#define TRUE (0==0) +#define FALSE (1==0) + +char in[MAX_LINE_LEN]; +FILE *outh=NULL; + +typedef enum {BOLD, ITALIC, F_LINK, TITLE, HIGHLIGHT, OTHER} FONT; + +void write_ansi(FONT type, int on) +{ + /* BOLD ITALIC F_LINK TITLE HIGHLIGHT OTHER */ + if(on) { + static char *ansi[] = { + "\033[1m", "\033[1m", "\033[1m", "\033[7m", "\033[1m", "\033[1m" }; + fputs(ansi[type], outh); + } + else { + static char *ansi[] = { + "\033[0m", "\033[0m", "\033[0m", "\033[0m", "\033[0m", "\033[0m" }; + fputs(ansi[type], outh); + } +} + +int Stricmp(char *s, char *t) +{ + while(*s && *t) { + if(toupper(*s) != *t) + return CMP_UNEQUAL; + s++, t++; + } + return (*s || *t) ? CMP_UNEQUAL : CMP_EQUAL; +} + +int Strnicmp(char *s, char *t) +{ + while(*s && *t) { + if(toupper(*s) != *t) + return CMP_UNEQUAL; + s++, t++; + } + return (*t) ? CMP_UNEQUAL : CMP_EQUAL; +} + +void error(char *msg, int err) +{ + fputs(msg, stderr); + exit(err); +} + +char *get_word(char **line, int *chkbrac) +{ + LINE status=L_INIT; + char *t=NULL, *to; + int noword=TRUE, special=FALSE; + + if(line==NULL || *line==NULL) + return NULL; + to=*line; + while(**line && noword) { + if(to != *line) *to = **line; + switch(**line) { + case '"': + if(special) + to++; + else { + switch(status) { + case L_INIT: + status=L_QUOTED; + t=(*line)+1; + to++; + break; + case L_QUOTED: + *to='\0'; + noword=FALSE; + break; + default: + to++; + break; + } + } + break; + case '\n': case '\t': case ' ': + if(status==L_SPACED) { + *to='\0'; + noword=FALSE; + } + else + to++; + break; + default: + if(chkbrac && **line=='}') { + *to='\0'; + noword=FALSE; + *chkbrac=TRUE; + } + else { + if(status==L_INIT) { + t=*line; + status=L_SPACED; + } + to++; + } + break; + } + if(special) + special=FALSE; + else if(**line=='\\') { + special=TRUE; + to--; + } + (*line)++; + } + return t; +} + +int parse_at_line(char **line) +{ + char *first, *second, *third; + int gotbrac=FALSE, i=0, on=TRUE; + char c; + + first=get_word(line, &gotbrac); + if(first && *first) { + i=1; + if(gotbrac==FALSE) { + second=get_word(line, &gotbrac); + if(second && *second) { + i=2; + if(gotbrac==FALSE) { + third=get_word(line, &gotbrac); + if(third && *third) + i=3; + } + } + } + } + switch(i) { + case 1: + if(toupper(*first)=='U') { + on=FALSE; + first++; + } + c=toupper(*first); + switch(c) { + case 'B': + write_ansi(BOLD, on); + break; + case 'I': + write_ansi(ITALIC, on); + break; + } + break; + case 2: + if(Stricmp(first, "FG")==CMP_EQUAL) { + if(Stricmp(second, "HIGHLIGHT")==CMP_EQUAL) + write_ansi(HIGHLIGHT, TRUE); + else if(Stricmp(second, "TEXT")==CMP_EQUAL) + write_ansi(HIGHLIGHT, FALSE); + } + else if(Stricmp(second, "CLOSE")==CMP_EQUAL || + Stricmp(second, "QUIT")==CMP_EQUAL) { + write_ansi(OTHER, TRUE); + fputs(first, outh); + write_ansi(OTHER, FALSE); + } + break; + case 3: + if(Stricmp(second, "LINK")==CMP_EQUAL || + Stricmp(second, "ALINK")==CMP_EQUAL) { + write_ansi(F_LINK, TRUE); + fputs(first, outh); + write_ansi(F_LINK, FALSE); + } + else { + write_ansi(OTHER, TRUE); + fputs(first, outh); + write_ansi(OTHER, FALSE); + } + break; + } + return gotbrac; +} + +void parse_node_line(char *line, char *title) +{ + char *first, *second; + first=get_word(&line, NULL); + second=get_word(&line, NULL); + if(first && *first) { + if(second && *second) + strcpy(title, second); + else + strcpy(title, first); + } +} + +void parse_title_line(char *line, char *title) +{ + char *first; + first=get_word(&line, NULL); + if(first && *first) + strcpy(title, first); +} + +void statecopy(AT state) +{ + switch(state) { + case A_IGNORE: + fputc('\\', outh); + break; + case A_AT: + fputc('@', outh); + break; + case A_BRAC: + fputs("@{", outh); + break; + } +} + +void output(char *line) +{ + AT status=A_INIT; + int gotbrac; + char c; + + if(line[0]=='@' && line[1]!='{') + return; + while(c=*line) { + switch(c) { + case '\\': + if(status==A_INIT) + status=A_IGNORE; + else { + statecopy(status); + fputc(c, outh); + status=A_INIT; + } + line++; + break; + case '@': + if(status==A_INIT) + status=A_AT; + else { + if(status!=A_IGNORE) statecopy(status); + fputc(c, outh); + status=A_INIT; + } + line++; + break; + case '{': + if(status==A_AT) + status=A_BRAC; + else { + statecopy(status); + fputc(c, outh); + status=A_INIT; + } + line++; + break; + case '}': + switch(status) { + case A_BRAC: case A_END: + break; + default: + statecopy(status); + fputc(c, outh); + break; + } + status=A_INIT; + line++; + break; + default: + switch(status) { + case A_BRAC: + gotbrac=parse_at_line(&line); + status=(gotbrac ? A_INIT : A_END); + break; + case A_END: + line++; + break; + default: + statecopy(status); + fputc(c, outh); + status=A_INIT; + line++; + } + } + } +} + +void main(int argc, char *argv[]) +{ + FILE *fh; + NODE status=N_INIT; + char *s, title[MAX_WIDTH]; + int empty=TRUE; + char *top="\n--------------------------------------" \ + "--------------------------------------\n"; + char *bot="======================================" \ + "======================================\n"; + if(argc<2) + error("Usage: ag2txt []\n", 1); + if((fh=fopen(argv[1], "r"))==NULL) { + fprintf(stderr, "\"%s\" ", argv[1]); + error("could not be opened\n", 2); + } + if(argc>2) + outh=fopen(argv[2], "w"); + if(outh==NULL) + outh=stdout; + while(fgets(in, MAX_LINE_LEN, fh)) { + switch(status) { + case N_INIT: + if(Strnicmp(in, "@DATABASE")!=CMP_EQUAL) + error("Bad AmigaGuide input file\n", 3); + else + status=N_OUT; + break; + case N_OUT: + if(Strnicmp(in, "@NODE ")==CMP_EQUAL) { + status=N_IN; + parse_node_line(in+6, title); + empty=TRUE; + } + break; + case N_IN: + if(empty && Strnicmp(in, "@TITLE")==CMP_EQUAL) + parse_title_line(in+6, title); + else if(Strnicmp(in, "@ENDNODE")==CMP_EQUAL) { + fputs(bot, outh); + status=N_OUT; + } + else { + s=in; + while(*s == ' ' || *s == '\t' || *s == '\n') s++; + if(!(empty && *s=='\0')) { + if(empty) { + write_ansi(TITLE, TRUE); + fputs(title, outh); + write_ansi(TITLE, FALSE); + fputs(top, outh); + empty=FALSE; + } + output(in); + } + } + break; + } + } +} diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt_OS1.3.e b/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt_OS1.3.e new file mode 100644 index 0000000..da62cd6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt_OS1.3.e @@ -0,0 +1,313 @@ +/* AmigaGuide to Text converter (v2). Copyright (c) 1994, Jason R. Hulance */ +/* E version. For AmigaDos 1.3 or before (?). Very slow because it lacks */ +/* buffering on the I/O, and it's not likely to be added by me, either :-) */ + +ENUM N_INIT, N_OUT, N_IN, NODE_STATES +ENUM L_INIT, L_QUOTED, L_SPACED, LINE_STATES +ENUM A_INIT, A_AT, A_BRAC, A_IGNORE, A_END, AT_STATES +ENUM NO_ERR, ERR_FILE, ERR_DATA, ERR_BRK, NUM_ERRS + +CONST MAX_LINE_LEN=1024, MAX_WIDTH=120, CMP_EQUAL=0, CMP_UNEQUAL=1 + +DEF in[MAX_LINE_LEN]:STRING, outh=NIL + +ENUM BOLD, ITALIC, F_LINK, TITLE, HIGHLIGHT, OTHER + +PROC write_ansi(type, on=TRUE) + DEF ansi:PTR TO LONG + /* BOLD ITALIC F_LINK TITLE HIGHLIGHT OTHER */ + IF on + ansi:=['\e[1m', '\e[3m', '\e[1m\e[3m', '\e[7m', '\e[1m', '\e[1m'] + ELSE + ansi:=['\e[22m', '\e[23m', '\e[23m\e[22m', '\e[0m', '\e[22m', '\e[22m'] + ENDIF + fputs(outh, ansi[type]) +ENDPROC + +PROC fputc(fh, c) IS Out(fh, c) +PROC fputs(fh, s) IS Write(fh, s, StrLen(s)) + +PROC toupper(c) IS IF (c<"a") OR (c>"z") THEN c ELSE c-32 + +PROC stricmp(s1, s2, all=TRUE) + WHILE (s2[]<>0) AND (s1[]<>0) + IF toupper(s1[]++)<>s2[]++ THEN RETURN CMP_UNEQUAL + ENDWHILE + IF all + RETURN IF (s1[] OR s2[]) THEN CMP_UNEQUAL ELSE CMP_EQUAL + ELSE + RETURN IF s2[] THEN CMP_UNEQUAL ELSE CMP_EQUAL + ENDIF +ENDPROC + +PROC main() HANDLE + DEF fh, status=N_INIT, s, title[MAX_WIDTH]:STRING, + empty=TRUE, top, bot, ownout=TRUE, err + s, arg:=get_word(arg) + IF (fh:=Open(s, OLDFILE))=NIL THEN Raise(ERR_FILE) + IF arg[] + s:=get_word(arg) + IF s[] + outh:=Open(s, NEWFILE) + ENDIF + ENDIF + IF outh=NIL + WriteF('') + outh:=stdout + ownout:=FALSE + ENDIF + top:='\n--------------------------------------' + + '--------------------------------------\n' + bot:='======================================' + + '======================================\n' + REPEAT + err:=ReadStr(fh, in) + SELECT NODE_STATES OF status + CASE N_INIT + IF stricmp(in, '@DATABASE', FALSE)<>CMP_EQUAL + Raise(ERR_DATA) + ELSE + status:=N_OUT + ENDIF + CASE N_OUT + IF stricmp(in, '@NODE ', FALSE)=CMP_EQUAL + status:=N_IN + parse_node_line(in+STRLEN, title) + empty:=TRUE + ENDIF + CASE N_IN + IF empty AND (stricmp(in, '@TITLE', FALSE)=CMP_EQUAL) + parse_title_line(in+STRLEN, title) + ELSEIF stricmp(in, '@ENDNODE', FALSE)=CMP_EQUAL + fputs(outh, bot) + status:=N_OUT + ELSE + IF CtrlC() THEN Raise(ERR_BRK) + s:=TrimStr(in) + IF Not(empty AND (s[]=0)) + IF empty + write_ansi(TITLE) + fputs(outh, title) + write_ansi(TITLE, FALSE) + fputs(outh, top) + empty:=FALSE + ENDIF + output(in) + ENDIF + ENDIF + ENDSELECT + UNTIL err=-1 +EXCEPT DO + SELECT NUM_ERRS OF exception + CASE ERR_FILE + WriteF('Could not open file "\s"\n', s) + CASE ERR_DATA + WriteF('"\s" is not an AmigaGuide file\n') + CASE ERR_BRK + WriteF('User aborted\n') + ENDSELECT + IF ownout AND outh THEN Close(outh) + IF fh THEN Close(fh) +ENDPROC + +PROC output(line) + DEF status=A_INIT, gotbrac, c + IF line[]="@" THEN IF line[1]<>"{" THEN RETURN + WHILE c:=line[] + SELECT c + CASE "\\" + IF status=A_INIT + status:=A_IGNORE + ELSE + statecopy(status) + fputc(outh, c) + status:=A_INIT + ENDIF + line++ + CASE "@" + IF status=A_INIT + status:=A_AT + ELSE + IF status<>A_IGNORE THEN statecopy(status) + fputc(outh, c) + status:=A_INIT + ENDIF + line++ + CASE "{" + IF status=A_AT + status:=A_BRAC + ELSE + statecopy(status) + fputc(outh, c) + status:=A_INIT + ENDIF + line++ + CASE "}" + SELECT AT_STATES OF status + CASE A_BRAC, A_END + DEFAULT + statecopy(status) + fputc(outh, c) + ENDSELECT + status:=A_INIT + line++ + DEFAULT + SELECT AT_STATES OF status + CASE A_BRAC + line,gotbrac:=parse_at_line(line) + status:=IF gotbrac THEN A_INIT ELSE A_END + CASE A_END + line++ + DEFAULT + statecopy(status) + fputc(outh, c) + status:=A_INIT + line++ + ENDSELECT + ENDSELECT + ENDWHILE + fputc(outh, "\n") +ENDPROC + +PROC statecopy(state) + SELECT AT_STATES OF state + CASE A_IGNORE + fputc(outh, "\\") + CASE A_AT + fputc(outh, "@") + CASE A_BRAC + fputs(outh, '@{') + ENDSELECT +ENDPROC + +PROC parse_at_line(line) + DEF first, second, third, gotbrac, i=0, on=TRUE, c + first,line,gotbrac:=get_word(line, TRUE) + IF first[] + i:=1 + IF gotbrac=FALSE + second,line,gotbrac:=get_word(line, TRUE) + IF second[] + i:=2 + IF gotbrac=FALSE + third,line,gotbrac:=get_word(line, TRUE) + IF third[] THEN i:=3 + ENDIF + ENDIF + ENDIF + ENDIF + SELECT 4 OF i + CASE 1 + IF toupper(first[])="U" + on:=FALSE + first++ + ENDIF + c:=toupper(first[]) + SELECT c + CASE "B" + write_ansi(BOLD, on) + CASE "I" + write_ansi(ITALIC, on) + ENDSELECT + CASE 2 + IF stricmp(first, 'FG')=CMP_EQUAL + IF stricmp(second, 'HIGHLIGHT')=CMP_EQUAL + write_ansi(HIGHLIGHT) + ELSEIF stricmp(second, 'TEXT')=CMP_EQUAL + write_ansi(HIGHLIGHT, FALSE) + ENDIF + ELSEIF (stricmp(second, 'CLOSE')=CMP_EQUAL) OR + (stricmp(second, 'QUIT')=CMP_EQUAL) + write_ansi(OTHER) + fputs(outh, first) + write_ansi(OTHER, FALSE) + ENDIF + CASE 3 + IF (stricmp(second, 'LINK')=CMP_EQUAL) OR + (stricmp(second, 'ALINK')=CMP_EQUAL) + write_ansi(F_LINK) + fputs(outh, first) + write_ansi(F_LINK, FALSE) + ELSE + write_ansi(OTHER) + fputs(outh, first) + write_ansi(OTHER, FALSE) + ENDIF + ENDSELECT +ENDPROC line,gotbrac + +PROC parse_node_line(line, title) + DEF first, second + first,line:=get_word(line) + second,line:=get_word(line) + IF first[] + IF second[] + StrCopy(title, second) + ELSE + StrCopy(title, first) + ENDIF + ENDIF +ENDPROC + +PROC parse_title_line(line, title) + DEF first + first,line:=get_word(line) + IF first[] + StrCopy(title, first) + ENDIF +ENDPROC + +CONST L_SIZE=35 + +PROC get_word(line, chkbrac=FALSE) + DEF status=L_INIT, noword=TRUE, foundbrac=FALSE, + t=NIL, to, special=FALSE + to:=line + WHILE line[] AND noword + IF to<>line THEN to[]:=line[] + SELECT L_SIZE OF line[] + CASE "\q" + IF special + to++ + ELSE + SELECT LINE_STATES OF status + CASE L_INIT + status:=L_QUOTED + t:=line+1 + to++ + CASE L_QUOTED + to[]:=0 + noword:=FALSE + DEFAULT + to++ + ENDSELECT + ENDIF + CASE "\n", "\t", " " + IF status=L_SPACED + to[]:=0 + noword:=FALSE + ELSE + to++ + ENDIF + DEFAULT + IF chkbrac AND (line[]="}") + to[]:=0 + noword:=FALSE + foundbrac:=TRUE + ELSE + IF status=L_INIT + t:=line + status:=L_SPACED + ENDIF + to++ + ENDIF + ENDSELECT + IF special + special:=FALSE + ELSEIF line[]="\\" + special:=TRUE + to-- + ENDIF + line++ + ENDWHILE +ENDPROC t,line,foundbrac diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt_OS2.0.e b/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt_OS2.0.e new file mode 100644 index 0000000..130f9bc --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt_OS2.0.e @@ -0,0 +1,306 @@ +/* AmigaGuide to Text converter (v2). Copyright (c) 1994, Jason R. Hulance */ +/* E version. For AmigaDos 2.0+. Uses Michael Zucchi's excellent 'async' */ +/* module that comes with E v3.0 to get a 1/3 speed up over the AmigaDOS */ +/* buffered I/O functions. (Would be good if 'async' handled output, too.) */ + +OPT OSVERSION=37 + +MODULE 'utility', 'tools/async', 'dos/stdio' + +ENUM N_INIT, N_OUT, N_IN, NODE_STATES +ENUM L_INIT, L_QUOTED, L_SPACED, LINE_STATES +ENUM A_INIT, A_AT, A_BRAC, A_IGNORE, A_END, AT_STATES +ENUM NO_ERR, ERR_FILE, ERR_LIB, ERR_DATA, ERR_BRK, NUM_ERRS + +CONST MAX_LINE_LEN=1024, MAX_WIDTH=120, CMP_EQUAL=0 + +RAISE ERR_LIB IF OpenLibrary()=NIL + +DEF in[MAX_LINE_LEN]:ARRAY, outh=NIL + +ENUM BOLD, ITALIC, F_LINK, TITLE, HIGHLIGHT, OTHER + +PROC write_ansi(type, on=TRUE) + DEF ansi:PTR TO LONG + /* BOLD ITALIC F_LINK TITLE HIGHLIGHT OTHER */ + IF on + ansi:=['\e[1m', '\e[3m', '\e[1m\e[3m', '\e[7m', '\e[1m', '\e[1m'] + ELSE + ansi:=['\e[22m', '\e[23m', '\e[23m\e[22m', '\e[0m', '\e[22m', '\e[22m'] + ENDIF + Fputs(outh, ansi[type]) +ENDPROC + +PROC main() HANDLE + DEF fh, status=N_INIT, s, title[MAX_WIDTH]:STRING, + empty=TRUE, top, bot, ownout=TRUE + utilitybase:=OpenLibrary('utility.library', 37) + s, arg:=get_word(arg) + IF (fh:=as_Open(s, OLDFILE, 3, 8*1024))=NIL THEN Raise(ERR_FILE) + IF arg[] + s:=get_word(arg) + IF s[] + outh:=Open(s, NEWFILE) + ENDIF + ENDIF + IF outh=NIL + WriteF('') + outh:=stdout + ownout:=FALSE + ENDIF + top:='\n--------------------------------------' + + '--------------------------------------\n' + bot:='======================================' + + '======================================\n' + WHILE as_FGetS(fh, in, MAX_LINE_LEN) + SELECT NODE_STATES OF status + CASE N_INIT + IF Strnicmp(in, '@DATABASE', STRLEN)<>CMP_EQUAL + Raise(ERR_DATA) + ELSE + status:=N_OUT + ENDIF + CASE N_OUT + IF Strnicmp(in, '@NODE ', STRLEN)=CMP_EQUAL + status:=N_IN + parse_node_line(in+STRLEN, title) + empty:=TRUE + ENDIF + CASE N_IN + IF empty AND (Strnicmp(in, '@TITLE', STRLEN)=CMP_EQUAL) + parse_title_line(in+STRLEN, title) + ELSEIF Strnicmp(in, '@ENDNODE', STRLEN)=CMP_EQUAL + Fputs(outh, bot) + status:=N_OUT + ELSE + IF CtrlC() THEN Raise(ERR_BRK) + s:=TrimStr(in) + IF Not(empty AND (s[]=0)) + IF empty + write_ansi(TITLE) + Fputs(outh, title) + write_ansi(TITLE, FALSE) + Fputs(outh, top) + empty:=FALSE + ENDIF + output(in) + ENDIF + ENDIF + ENDSELECT + ENDWHILE +EXCEPT DO + SELECT NUM_ERRS OF exception + CASE ERR_LIB + WriteF('Could not open utility.library\n') + CASE ERR_FILE + WriteF('Could not open file "\s"\n', s) + CASE ERR_DATA + WriteF('"\s" is not an AmigaGuide file\n') + CASE ERR_BRK + WriteF('User aborted\n') + ENDSELECT + IF ownout AND outh THEN Close(outh) + IF fh THEN as_Close(fh) + IF utilitybase THEN CloseLibrary(utilitybase) +ENDPROC + +PROC output(line) + DEF status=A_INIT, gotbrac, c + IF line[]="@" THEN IF line[1]<>"{" THEN RETURN + WHILE c:=line[] + SELECT c + CASE "\\" + IF status=A_INIT + status:=A_IGNORE + ELSE + statecopy(status) + FputC(outh, c) + status:=A_INIT + ENDIF + line++ + CASE "@" + IF status=A_INIT + status:=A_AT + ELSE + IF status<>A_IGNORE THEN statecopy(status) + FputC(outh, c) + status:=A_INIT + ENDIF + line++ + CASE "{" + IF status=A_AT + status:=A_BRAC + ELSE + statecopy(status) + FputC(outh, c) + status:=A_INIT + ENDIF + line++ + CASE "}" + SELECT AT_STATES OF status + CASE A_BRAC, A_END + DEFAULT + statecopy(status) + FputC(outh, c) + ENDSELECT + status:=A_INIT + line++ + DEFAULT + SELECT AT_STATES OF status + CASE A_BRAC + line,gotbrac:=parse_at_line(line) + status:=IF gotbrac THEN A_INIT ELSE A_END + CASE A_END + line++ + DEFAULT + statecopy(status) + FputC(outh, c) + status:=A_INIT + line++ + ENDSELECT + ENDSELECT + ENDWHILE +ENDPROC + +PROC statecopy(state) + SELECT AT_STATES OF state + CASE A_IGNORE + FputC(outh, "\\") + CASE A_AT + FputC(outh, "@") + CASE A_BRAC + Fputs(outh, '@{') + ENDSELECT +ENDPROC + +PROC parse_at_line(line) + DEF first, second, third, gotbrac, i=0, on=TRUE, c + first,line,gotbrac:=get_word(line, TRUE) + IF first[] + i:=1 + IF gotbrac=FALSE + second,line,gotbrac:=get_word(line, TRUE) + IF second[] + i:=2 + IF gotbrac=FALSE + third,line,gotbrac:=get_word(line, TRUE) + IF third[] THEN i:=3 + ENDIF + ENDIF + ENDIF + ENDIF + SELECT 4 OF i + CASE 1 + IF ToUpper(first[])="U" + on:=FALSE + first++ + ENDIF + c:=ToUpper(first[]) + SELECT c + CASE "B" + write_ansi(BOLD, on) + CASE "I" + write_ansi(ITALIC, on) + ENDSELECT + CASE 2 + IF Stricmp(first, 'FG')=CMP_EQUAL + IF Stricmp(second, 'HIGHLIGHT')=CMP_EQUAL + write_ansi(HIGHLIGHT) + ELSEIF Stricmp(second, 'TEXT')=CMP_EQUAL + write_ansi(HIGHLIGHT, FALSE) + ENDIF + ELSEIF (Stricmp(second, 'CLOSE')=CMP_EQUAL) OR + (Stricmp(second, 'QUIT')=CMP_EQUAL) + write_ansi(OTHER) + Fputs(outh, first) + write_ansi(OTHER, FALSE) + ENDIF + CASE 3 + IF (Stricmp(second, 'LINK')=CMP_EQUAL) OR + (Stricmp(second, 'ALINK')=CMP_EQUAL) + write_ansi(F_LINK) + Fputs(outh, first) + write_ansi(F_LINK, FALSE) + ELSE + write_ansi(OTHER) + Fputs(outh, first) + write_ansi(OTHER, FALSE) + ENDIF + ENDSELECT +ENDPROC line,gotbrac + +PROC parse_node_line(line, title) + DEF first, second + first,line:=get_word(line) + second,line:=get_word(line) + IF first[] + IF second[] + StrCopy(title, second) + ELSE + StrCopy(title, first) + ENDIF + ENDIF +ENDPROC + +PROC parse_title_line(line, title) + DEF first + first,line:=get_word(line) + IF first[] + StrCopy(title, first) + ENDIF +ENDPROC + +CONST L_SIZE=35 + +PROC get_word(line, chkbrac=FALSE) + DEF status=L_INIT, noword=TRUE, foundbrac=FALSE, + t=NIL, to, special=FALSE + to:=line + WHILE line[] AND noword + IF to<>line THEN to[]:=line[] + SELECT L_SIZE OF line[] + CASE "\q" + IF special + to++ + ELSE + SELECT LINE_STATES OF status + CASE L_INIT + status:=L_QUOTED + t:=line+1 + to++ + CASE L_QUOTED + to[]:=0 + noword:=FALSE + DEFAULT + to++ + ENDSELECT + ENDIF + CASE "\n", "\t", " " + IF status=L_SPACED + to[]:=0 + noword:=FALSE + ELSE + to++ + ENDIF + DEFAULT + IF chkbrac AND (line[]="}") + to[]:=0 + noword:=FALSE + foundbrac:=TRUE + ELSE + IF status=L_INIT + t:=line + status:=L_SPACED + ENDIF + to++ + ENDIF + ENDSELECT + IF special + special:=FALSE + ELSEIF line[]="\\" + special:=TRUE + to-- + ENDIF + line++ + ENDWHILE +ENDPROC t,line,foundbrac diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt_v2.readme b/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt_v2.readme new file mode 100644 index 0000000..a7e449f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Ag2Txt/Ag2Txt_v2.readme @@ -0,0 +1,40 @@ +Short: AmigaGuide to text (v2). E & C source. +Type: text/hyper +Uploader: m88jrh@uk.ac.ox.ecs (Jason R. Hulance) +Author: m88jrh@uk.ac.ox.ecs (Jason R. Hulance) + +Ag2Txt (v2) +=========== +Ag2Txt converts AmigaGuide files to highlighted text. This text may be +read using a standard text reader, or may be sent to a suitable printer. +(The Amiga printer drivers handle the ANSI codes produced.) + +There are three different versions of this program in the archive: two +written in E (one for AmigaDOS 1.3 and one for 2.0+), and one in C. All +three versions have the following syntax: + + ag2txt [ ] + +The is an optional output file. If it is not specified or +cannot be opened then the output is written to the terminal (stdout). + +Version 2 of Ag2Txt knows a lot more AmigaGuide codes and handles them a +lot better than version 1. Also, version 1 omitted the C version, which +was subsequently requested by a number of people. + +You can customise the output by fiddling with the source. The ansi codes +used are confined to the function 'write_ansi' near the top of the source. +One list is for turning on the appropriate attribute, and the second is +for turning it off. The C version is particularly dumb because the Xterms +I use at work don't understand the 'turn off' codes so I took them out +(and used just the 'set to plain' code, '\e[0m'). + +The AmigaDOS 2.0+ version uses the buffered I/O functions to gain a huge +performance increase compared to the unbuffered I/O used in the AmigaDOS +1.3 version. Also, the 2.0+ version uses Michael Zucchi's excellent +'async' module that comes with E v3.0 to get an extra 1/3 speed up (for +reading, since 'async' doesn't do writes... yet??). + +Legal stuff: +The programs in this archive are Copyright (C) 1994, Jason R. Hulance. +Apart from that the GNU Public License (Version 2) holds. diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/AgSplit/AGSplit.readme b/amigae33a/E_v3.3a/Src/Src/Utils/AgSplit/AGSplit.readme new file mode 100644 index 0000000..60450ed --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/AgSplit/AGSplit.readme @@ -0,0 +1,80 @@ +Short: Intelligent AmigaGuide splitter +Type: text/hyper +Uploader: jason@fsel.com (Jason R. Hulance) +Author: jason@fsel.com (Jason R. Hulance) + +AGSplit +======= +AGSPlit is an intelligent AmigaGuide file splitter. By "intelligent" +I mean that each of the resulting pieces is a complete, stand-alone +AmigaGuide file. Needless to say, the pieces are all interlinked and +behave as if they were in one big AmigaGuide file. + +Why would you want to split an AmigaGuide file? Well, the smaller the +file is the faster it loads into AmigaGuide/Multiview. The trade-off +is that it is marginally slower to go between links that are not in +the same AmigaGuide file (but this is hardly noticeable if the pieces +are small!). + +In particular, I wrote this program to split up my "Beginner's Guide +to Amiga E" which I write in TeXinfo format and so produce using the +excellent MakeGuide utility (and the version of MakeGuide I use can +only make one large file). + +Usage +----- +The template is: + + GUIDEFILE/A,SPLITFILE/A,DESTDIR + +"GUIDEFILE" is the file to split. +"SPLITFILE" is a short file to show the split positions (see below). +"DESTDIR" is an optional directory name to store the pieces (default + is the current directory). + +Split Files +----------- +A split file consists of node/filename pairs which describe the +positions where the AmigaGuide file is to be split. The nodes must be +specified in the order in which they appear in the AmigaGuide file. +For example: + +Main +Contents.guide +FirstNode +Chapter1.guide +AnotherNode +Appendix.guide + +This split file specifies that *all* nodes from "Main" up to +"FirstNode" (but not including "FirstNode") will be split into the +file "Contents.guide". + +All nodes from "FirstNode" up to "AnotherNode" (but not including +"AnotherNode") will be split into "Chapter1.guide". + +All nodes from "AnotherNode" to the end of the original AmigaGuide +file will be split into "Appendix.guide". + +If this split file were called "mysplitfile" and the AmigaGuide file +to be split were called "myagfile.guide", then: + + AGSplit myagfile.guide mysplitfile ram: + +would split "myagfile.guide" into the specified pieces +("Contents.guide", "Chapter1.guide" and "Appendix.guide") and put the +pieces into the "ram:" directory. + +Examples +-------- +Two supplied example split files can be used to split my "Beginner's +Guide to Amiga E" and the "E Reference Guide" (both available in the +current Amiga E distribution in dev/e). + +To Do +----- +I might make a better interface than "split files", but they are +simple enough to use... + +It's a bit slow at the moment (I'm using a quite general engine), but +it's not something you'd do very often... diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/AgSplit/AGSplit_EBeginnersGuide b/amigae33a/E_v3.3a/Src/Src/Utils/AgSplit/AGSplit_EBeginnersGuide new file mode 100644 index 0000000..5ee7a40 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/AgSplit/AGSplit_EBeginnersGuide @@ -0,0 +1,36 @@ +main +Contents.guide +Introduction to Amiga E +Introduction.guide +Format and Layout +Format.guide +Procedures and Functions +Procedures.guide +Constants +Constants.guide +Types +Types.guide +More About Statements and Expressions +MoreExpressions.guide +E Built-In Constants Variables and Functions +BuiltIns.guide +Modules +Modules.guide +Exception Handling +Exceptions.guide +Memory Allocation +Memory.guide +Floating-Point Numbers +FloatingPoint.guide +Recursion +Recursion.guide +Object Oriented E +OOE.guide +Introduction to the Examples +Examples.guide +Common Problems +Appendices.guide +E Language Index +EIndex.guide +Main Index +Index.guide diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/AgSplit/AGSplit_EGuide b/amigae33a/E_v3.3a/Src/Src/Utils/AgSplit/AGSplit_EGuide new file mode 100644 index 0000000..5a1b520 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/AgSplit/AGSplit_EGuide @@ -0,0 +1,28 @@ +MAIN +E-Contents.guide +CH_0A +E-Intro.guide +CH_1A +E-Basics.guide +CH_5A +E-Statements.guide +CH_6A +E-Functions.guide +CH_7A +E-Types.guide +CH_9A +E-Built-Ins.guide +CH_10A +E-Modules.guide +CH_11A +E-OtherExprs.guide +CH_13A +E-Exceptions.guide +CH_14A +E-OOP.guide +CH_15A +E-Technical.guide +CH_17A +E-Utilities.guide +CH_18A +E-Appendices.guide diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Build/.build example 1 b/amigae33a/E_v3.3a/Src/Src/Utils/Build/.build example 1 new file mode 100644 index 0000000..eac2e0c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Build/.build example 1 @@ -0,0 +1,12 @@ +testfile=build +bla=build +target=blo + +all:$(testfile) + echo 1 + echo $target + echo 2 + +build:$(bla).e + echo $target + echo YeP! diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Build/.build example 2 b/amigae33a/E_v3.3a/Src/Src/Utils/Build/.build example 2 new file mode 100644 index 0000000..1b35543 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Build/.build example 2 @@ -0,0 +1,8 @@ +testfile=.build +bla=build + +blak:$(testfile) + echo 1 + cat $(testfile) + echo 2 + diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Build/.build example 3 b/amigae33a/E_v3.3a/Src/Src/Utils/Build/.build example 3 new file mode 100644 index 0000000..c445622 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Build/.build example 3 @@ -0,0 +1,108 @@ +#programs and dirs +ec=EMODULES:oomodules/oodoc/scripts/compile +docs=EMODULES:oomodules/oodoc/scripts/gendoc + +# objects to compile +OBJECTX=char +OBJECT2=int +OBJECT3=long +OBJECT4=list +OBJECT5=string +OBJECT6=pchar +OBJECT7=pint +OBJECT8=plong +OBJECT9=plist +OBJECT10=pstring +OBJECT11=float +OBJECT12=pfloat +OBJECT13=association + + +ALLOBJECTS=char.m int.m float.m long.m list.m string.m pchar.m pint.m plist.m plong.m pstring.m pfloat.m association.m + +TESTS=testpint testpfloat testpstring testfloat testlist teststring + +#dependencies +DEPS=/object.m /primitive.m + +#compiler options: don't use cache and BE QUIET! +OPTS=IGNORECACHE QUIET + +objects: $(ALLOBJECTS) + +all: + build binaries NOHEAD + build doc NOHEAD + +binaries: + build objects NOHEAD + build test NOHEAD + +#build the documentation +doc: + $(docs) + + +$(OBJECTX).m: $(OBJECTX).e $(DEPS) + $(ec) $(OBJECTX).e $(target) $(OPTS) + +$(OBJECT2).m: $(OBJECT2).e $(DEPS) + $(ec) $(OBJECT2).e $(target) $(OPTS) + +$(OBJECT3).m: $(OBJECT3).e $(DEPS) + $(ec) $(OBJECT3).e $(target) $(OPTS) + +$(OBJECT4).m: $(OBJECT4).e $(DEPS) + $(ec) $(OBJECT4).e $(target) $(OPTS) + +$(OBJECT5).m: $(OBJECT5).e $(DEPS) + $(ec) $(OBJECT5).e $(target) $(OPTS) + +$(OBJECT6).m: $(OBJECT6).e $(DEPS) + $(ec) $(OBJECT6).e $(target) $(OPTS) + +$(OBJECT7).m: $(OBJECT7).e $(DEPS) + $(ec) $(OBJECT7).e $(target) $(OPTS) + +$(OBJECT8).m: $(OBJECT8).e $(DEPS) + $(ec) $(OBJECT8).e $(target) $(OPTS) + +$(OBJECT9).m: $(OBJECT9).e $(DEPS) + $(ec) $(OBJECT9).e $(target) $(OPTS) + +$(OBJECT10).m: $(OBJECT10).e $(DEPS) + $(ec) $(OBJECT10).e $(target) $(OPTS) + +$(OBJECT11).m: $(OBJECT11).e $(DEPS) + $(ec) $(OBJECT11).e $(target) $(OPTS) + +$(OBJECT12).m: $(OBJECT12).e $(DEPS) + $(ec) $(OBJECT12).e $(target) $(OPTS) + +$(OBJECT13).m: $(OBJECT13).e $(DEPS) + $(ec) $(OBJECT13).e $(target) $(OPTS) + + +#build the test programs +test: $(TESTS) + Echo "Compiled test programs." + +test$(OBJECT7): test$(OBJECT7).e $(OBJECT7).m + $(ec) test$(OBJECT7).e $(target) $(OPTS) + +test$(OBJECT11): test$(OBJECT11).e $(OBJECT11).m + $(ec) test$(OBJECT11).e $(target) $(OPTS) + +test$(OBJECT12): test$(OBJECT12).e $(OBJECT12).m + $(ec) test$(OBJECT12).e $(target) $(OPTS) + +test$(OBJECT10): test$(OBJECT10).e $(OBJECT10).m + $(ec) test$(OBJECT10).e $(target) $(OPTS) + +test$(OBJECT4): test$(OBJECT4).e $(OBJECT4).m + $(ec) test$(OBJECT4).e $(target) $(OPTS) + +test$(OBJECT5): test$(OBJECT5).e $(OBJECT5).m + $(ec) test$(OBJECT5).e $(target) $(OPTS) + + diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Build/EBuild.guide b/amigae33a/E_v3.3a/Src/Src/Utils/Build/EBuild.guide new file mode 100644 index 0000000..9f64305 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Build/EBuild.guide @@ -0,0 +1,290 @@ +@database EBuild.guide + +@Master ebuild.texi + +@Width 72 + + +This is the AmigaGuide® file EBuild.guide, produced by Makeinfo-1.64 from +the input file ebuild.texi. + + EBuild Copyright 1997 Glauschwuffel, Wouter, Rob + + +@Node Main "EBuild.guide" +@Prev "(dir)" +@Toc "(dir)" + +EBuild +The Make clone +Copyright 1997 Glauschwuffel, Wouter, Rob + + @{" Introduction " Link "Introduction"} + @{" Invoking EBuild " Link "Invoking EBuild"} + @{" Build Files " Link "Build Files"} + @{" Misc " Link "Misc"} + @{" History " Link "History"} + @{" The Authors " Link "The Authors"} + + +@EndNode + +@Node "Introduction" "EBuild.guide/Introduction" +@Next "Invoking EBuild" +@Toc "Main" + +1 Introduction +************** + + EBuild is a "Make" clone, and it functions likewise. It is a tool +that helps you in recompiling necessary parts of a large application +after modification. + + You write a file `.build' in the directory that contains the sources +of your project. The file contains info about which sources depend on +which, and what actions need to be performed if a module or exe needs +to be rebuilt. + + EBuild checks the dates of the files to see if a source has been +modified after the last compilation, and if the source uses modules +that also have been modified, it will compile these first. + + +@EndNode + +@Node "Invoking EBuild" "EBuild.guide/Invoking EBuild" +@Next "Build Files" +@Prev "Introduction" +@Toc "Main" + +2 Invoking EBuild +***************** + + EBuild can be run from any shell. It's arguments are: + + TARGET,FROM/K,FORCE/S,VERBOSE/S,NOHEAD/S,CONSTANTS/S: + + If you supply a `TARGET', this way build will start with another +target. `FROM' allows you to use another file than `.build', and +`FORCE' will rebuild everything, regardless of whether it was really +necessary. + + `VERBOSE' makes the program print each action it executes. `NOHEAD' +doesn't print the heading line and the `CONSTANTS' switch forces EBuild +to tell you what symbolic constants are there. + + +@EndNode + +@Node "Build Files" "EBuild.guide/Build Files" +@Next "Misc" +@Prev "Invoking EBuild" +@Toc "Main" + +3 Build Files +************* + + + @{" Symbolic Constants " Link "Symbolic Constants"} + + Build files are normally named `.build'. This is the file EBuild +looks for when it is run. + + The syntax of build files equals that of unix-make. In general, `#' +precedes lines with comments, and: + + target: dep1 dep2 ... + action1 + action2 + ... + + `target' is the resulting file we're talking about, in most cases an +exe or module, but may be anything. Following the `:' you write all +files that it depends upon, most notably its source, and other modules. + + The actions on the following lines are normal AmigaDos commands, and +need to be preceded by at least one space or tab to distinquish them +from targets. + + bla: bla.e defs.m + ec bla quiet + + This simple example will only recompile `bla.e' if it was modified, +or if the `defs.m' which it uses was modified. + + If you type `build' with no args, build will ensure the first target +in the file to be up to date. + + A longer example: + + # test build file + + all: bla burp + + defs.m: defs.e + ec defs quiet + + bla: bla.e defs.m + ec bla quiet + + burp: burp.e + ec burp quiet + + clean: + delete defs.m bla burp + + This build file is about two programs, `bla' and `burp', of which +`bla' also depends on a module `defs.m'. An extra fake target `clean' +has been added so you can type `build clean' to delete all results. + + It's okay to have fake targets, however, these cannot be used as +module dependencies. + + Other dependencies and actions are easily added. For example, if +your project uses a parser generated by E-Yacc: + + yyparse.m: parser.y + eyacc parser.y + ec yyparse quiet + + Or incorporates macro-assembly code as often used tool module: + + blerk.m: blerk.s + a68k blerk.s + o2m blerk + copy blerk.m emodules:tools + flushcache tools/blerk + + +@EndNode + +@Node "Symbolic Constants" "EBuild.guide/Symbolic Constants" +@Toc "Build Files" + +3.1 Symbolic Constants +====================== + + EBuild v3.3 has symbolic constants. Before writing the rules you can +set a symbol to any value. Those symbols can be used in rules and +actions. The text of a symbol will be inserted wherever the symbol is +found. + + Example: + + options=IGNORECACHE LINEDEBUG DEBUG + test: test.e + ec test.e $(options) + + or even + + testfile=bla + $(testfile):$(testfile).e + ec $(testfile).e + + There is one special symbol in EBuild: `target'. It holds the name of +the target the current action belongs to. In the example above we can +tell EC to compile the target instead of writing the actual name: + + options=IGNORECACHE LINEDEBUG DEBUG + test: test.e + ec $(target).e $(options) + + This may seem to be not too useful, but take a look at this example: + + options=IGNORECACHE LINEDEBUG DEBUG + test: test.e + ec $(target) $(options) + if warn + echo "Error: compile failed" + else + echo "Compiled OK... running" + $(target) + endif + + It's largely equivalent to the old code below, but allows more. + + options=IGNORECACHE LINEDEBUG DEBUG + all: test + echo "ok, running:" + test + + test: test.e + ec -q test $(options) + + All symbols except `$(target)' may be used in rules as well as in +actions. `$(target)', however, may only be used in actions. It's safe +to have it in rules, EBuild just aborts with a message that tells you +that it doesn't know this symbol. + + +@EndNode + +@Node "Misc" "EBuild.guide/Misc" +@Next "History" +@Prev "Build Files" +@Toc "Main" + +4 Misc +****** + + Once you get to know build, you'll discover you can use it for more +purposes than just this. See it as an intelligent script tool. + + If you want to find out the details of what build can do, read the +documentation of some unix-make, as build should be somewhat compatible +with this. What it doesn't do for now, is: + + - allow "\" at the end of a line for longer rules + + When EBuild discovers a cyclic dependancy it just aborts, i.e. this +won't be executed: + + bla: defs.m blurp.m bla + ec $(target).e + + since the target `bla.e' has the dependancy `bla.e'. EBuild used to +crash with an infinite loop on this one. + + +@EndNode + +@Node "History" "EBuild.guide/History" +@Next "The Authors" +@Prev "Misc" +@Toc "Main" + +5 History +********* + + For v3.1 it was updated by Jason Hulance, to fix the bug that +executed actions in reverse order. Also he introduced the local variable +$target in actions. + + EBuild was updated for v3.3 by Gregor Goldbach to support symbolic +constants and to stop on cyclic dependancies. The $target behaviour was +expanded to match other symbols: $(target) is legal, too. + + +@EndNode + +@Node "The Authors" "EBuild.guide/The Authors" +@Prev "History" +@Toc "Main" + +6 The Authors +************* + + Wouter van Oortmerssen is the creator of E. He has studied computer +sciences and lives in England where he occasionally destroys monitors. + + Gregor Goldbach loves E, starts studying computer sciences very soon +and lives in Germany. He met Wouter but his monitor is still running. + + Jason R Hulance is an Englishman and they say he has met Wouter +several times. He coded some tools for E of which one will work +together with EDBG in the next E release. + + Rob is just Rob. + +@EndNode + diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Build/build.e b/amigae33a/E_v3.3a/Src/Src/Utils/Build/build.e new file mode 100644 index 0000000..4b3f261 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Build/build.e @@ -0,0 +1,437 @@ +/* build in E. + +TODO: - cyclic structure check (part) + - (amigados?) constants (part) + +*/ + +OPT OSVERSION=37 + +MODULE 'tools/file', 'dos/dosextens', 'dos/dos' + +/* + symbol=object + object: dep1 dep2 .... + act1 + act2 + + $(symbol): $(symbol)bla .... + act1 + ... +*/ + +/* +history: + +(Version 0.8 by Rob and Wouter) + +When Who What +23.07.97 Glauschwuffel - Added symbolic constants. Constants are allowed everywhere +26.07.97 Glauschwuffel - Removed bug in constants: The part after the last constant + wouldn't be copied. $(test): $(test).e crashed in cyclic + dependancy. :( + - Used source that Jason mailed me to get right order of actions. + - Minor modification in traverse(): "circ" is raised when object + and a dependancy have the same name. + - Added version facility :) + - local constant $(target) is now available in actions + - Added QUIET arg +27.07.97 Glauschwuffel - Changed QUIET to VERBOSE since quiet was default for v3.1 +(between Glauschwuffel - Used EBuild with new oomodules/ objects. *Very* stable, no errrors + at all. I tend to say it's error-free ) +09.08.97 Glauschwuffel - Actions of a target are now collected in a script again. + EBuild now acts as described in the Ev3.2 doc (except of the + modified $target). Bumped version to 0.9. +10.08.97 Glauschwuffel - Added script variable $target for reasons of consistency. Now + $(target) and $target are possible. + Discovered a potential bug: if build is called without a target and + the first target in the buildfile is not a filename (e.g. a symbolic + target like `all' or `clean') the actions for this target are + executed anyway (0.8 does this, too). +05.09.97 Glauschwuffel - BUG: the temporary script in T: won't be closed on exceptions + Fixed. +13.09.97 Glauschwuffel - ADD: commandline option CONSTANTS. Lists the constants before executing + anything. Modified `dumpC()' for this. +12.10.97 Glauschwuffel - BUG: EBuild would cause an enforcer hit when no dependent objects are + specified (as with symbolic targets like 'clean'). target was only set + when there were dependencies, moved the statement two lines higher. + Fixed. Bumped version. Thanks to Nuno for the report. +*/ + +OBJECT object + next:PTR TO object + name:PTR TO CHAR + firstdep:PTR TO dependancy + firstaction:PTR TO action + child + lastaction:PTR TO action +ENDOBJECT + +OBJECT dependancy + next:PTR TO dependancy + object:PTR TO object +ENDOBJECT + +OBJECT action + next:PTR TO action + comstring:PTR TO CHAR +ENDOBJECT + +OBJECT arg + target,buildfile,force,verbose,nohead,constants +ENDOBJECT + +OBJECT constant + next:PTR TO constant + name:PTR TO CHAR + subst:PTR TO CHAR +ENDOBJECT + +DEF curline=0, curstring, uptodate=TRUE, args:PTR TO arg, + constants:PTR TO constant, -> global list of constants in reverse order + target:PTR TO CHAR -> holds name of current target + +PROC main() HANDLE + DEF m,l,buildfile[200]:STRING,rdargs=NIL + NEW args + IF (rdargs:=ReadArgs('TARGET,FROM/K,FORCE/S,VERBOSE/S,NOHEAD/S,CONSTANTS/S',args,NIL))=NIL THEN Raise("barg") + IF args.buildfile THEN StrCopy(buildfile,args.buildfile) + StrAdd(buildfile,'.build') + IF (args.nohead = 0) -> be VERY quiet + PrintF({versionString}) + PrintF(' (processing "\s")\n', buildfile) + ENDIF + m,l:=readfile(buildfile) + buildtree(parse(stringsinfile(m,l,countstrings(m,l)))) + IF uptodate THEN PrintF('All files are up to date.\n') + Raise() +EXCEPT + IF rdargs THEN FreeArgs(rdargs) + IF exception=0 THEN RETURN + PrintF('Error: ') + SELECT exception + CASE "OPEN" + PrintF('couldn''t open "\s".\n',exceptioninfo) + CASE "MEM" + PrintF('not enough memory.\n') + CASE "IN" + PrintF('couldn''t read file.\n') + CASE "nobj" + PrintF('action without object.\n') + CASE "fexp" + PrintF('filename expected.\n') + CASE "dexp" + PrintF('":" or "=" expected.\n') + CASE "empt" + PrintF('nothing to build.\n') + CASE "circ" + PrintF('circular dependancies at file "\s".\n', exceptioninfo) + CASE "bada" + PrintF('action failed to build "\s".\n',exceptioninfo) + CASE "badd" + PrintF('dependancy "\s" not available.\n',exceptioninfo) + CASE "derr" + PrintF('child process failed.\n') + CASE "ntar" + PrintF('no such target: "\s".\n',args.target) + CASE "ndep" + PrintF('no dependancies for object "\s".\n',exceptioninfo) + CASE "clos" + PrintF('missing closing brace: "\s".\n',exceptioninfo) + CASE "cons" + PrintF('unknown constant: "\s".\n',exceptioninfo) + CASE "barg" + PrintFault(IoErr(),NIL) + CASE "scrp" + PrintF ('unable to create temporary script.\n') + DEFAULT + PrintF('burp.\n') + ENDSELECT + IF curline THEN PrintF('at line: (\d) "\s"\n',curline,curstring) + IF exception THEN PrintF('Build terminated\n') + RETURN 10 +ENDPROC + +PROC parse(list:PTR TO LONG) + DEF l=NIL:PTR TO object, s, c, i, t, const=NIL:PTR TO constant,str:PTR TO CHAR + FOR curline:=0 TO ListLen(list)-1 + s:=list[curline] + curstring:=s + c:=s[] + IF (c<>"#") AND (c<>"\0") -> ignore? + IF (c=" ") OR (c="\t") -> action + s:=eatwhite(s) + IF s[] + IF l=NIL THEN Raise("nobj") + -> was: l.firstaction:=NEW [l.firstaction,s]:action + -> replaced by the following IF (Rob through Glauschwuffel) + IF l.lastaction + l.lastaction.next:=NEW [NIL,s]:action + l.lastaction:=l.lastaction.next + ELSE + l.firstaction:=NEW [NIL,s]:action + l.lastaction:=l.firstaction + ENDIF + ENDIF + ELSE -> object rule or constant + i:=s + s:=eatname(s) + IF s=i THEN Raise("fexp") + t:=s + + IF (s[]<>":") AND (s[]<>"=") THEN Raise("dexp") + IF s[]=":" + + -> check object rule for use of constants + str:=String(1024) -> dyn. alloc., free if no constants + IF str=NIL THEN Raise("MEM") +/* IF (substituteConstants (i, str)<>0) ->update vars if there were constants + i := str; s:=eatname(str) -> these were copied from above + IF s=i THEN Raise("fexp") + t:=s + ELSE + Dispose(str) + ENDIF +*/ + substituteConstants (i, str) + i := str; s:=eatname(str) + IF s=i THEN Raise("fexp") + t:=s + + + t[]:="\0" + s++ + s:=eatwhite(s) + l:=NEW [l,i,NIL,NIL,0]:object + s:=eatwhite(s) + IF s[]<>"\0" + REPEAT + i:=s + s:=eatname(s) + t:=s + IF t=i THEN Raise("fexp") + s:=eatwhite(s) + t[]:="\0" + l.firstdep:=NEW [l.firstdep,i]:dependancy + UNTIL s[]="\0" + ENDIF + ELSE -> we have a constant + s++ + s:=eatwhite(s) + t[]:="\0" -> terminate name + const:=NEW[const,i,s]:constant + constants:=const -> have to do it here so consts in rules are recognized + ENDIF + ENDIF + ENDIF + ENDFOR + curline:=0 + IF args.constants THEN dumpC() + IF l=NIL THEN Raise("empt") +ENDPROC l + + +PROC eatwhite(s) + WHILE (s[]=" ") OR (s[]="\t") DO s++ +ENDPROC s + +PROC eatname(s) + WHILE (s[]<>" ") AND (s[]<>"\t") AND (s[]<>"\0") AND (s[]<>":") AND (s[]<>"=") DO s++ +ENDPROC s + +/* obsolete +PROC execute(c) +DEF s[1024]:STRING + uptodate:=FALSE + substituteConstants (c, s) + IF args.verbose THEN PrintF('\t\s\n', s) +-> PrintF('\t\s\n',IF substituteConstants (c, s) THEN s ELSE c) + IF Execute(s,NIL,stdout)=NIL THEN Raise("derr") +ENDPROC */ + +PROC filetime(name:PTR TO CHAR) + DEF l:PTR TO filelock, fib:fileinfoblock, date:PTR TO datestamp + IF l:=Lock(name,ACTION_READ) + IF Examine(l,fib) + date:=fib.datestamp + IF fib.direntrytype<0 + UnLock(l) + RETURN date.days, Shl(date.minute,12)+date.tick + ENDIF + ENDIF + UnLock(l) + ENDIF +ENDPROC -1 + +PROC timelater(day1,tick1,day2,tick2) + IF day1>day2 + RETURN TRUE + ELSEIF day1=day2 + RETURN tick1>tick2 + ENDIF +ENDPROC FALSE + +/*----------------rob's-stuff-------------------*/ + +PROC buildtree(list:PTR TO object) -> returns root of tree + DEF dep:PTR TO dependancy, + obj:PTR TO object + + obj:=list + WHILE obj -> traverse objects + dep:=obj.firstdep + WHILE dep -> traverse dependencies + dep.object:=findobject(dep.object,list) + dep:=dep.next + ENDWHILE + obj:=obj.next + ENDWHILE + + -> CHECK CYCLES!!! + + obj:=list + IF args.target + WHILE obj + IF StrCmp(args.target,obj.name) THEN JUMP out + obj:=obj.next + ENDWHILE + Raise("ntar") + out: + ELSE + IF obj THEN WHILE obj.next DO obj:=obj.next + ENDIF + traverse(obj) +ENDPROC + + +-> find object in list of objects by name +PROC findobject(name:PTR TO CHAR,list:PTR TO object) + WHILE list + IF StrCmp(name,list.name) + -> remove object from root list + list.child:=TRUE; + RETURN list + ENDIF + list:=list.next + ENDWHILE +ENDPROC NEW [NIL,name,NIL,NIL]:object + +-> child-first traversal of dependancy tree +PROC traverse(obj:PTR TO object) -> executes actions in tree + DEF dep:PTR TO dependancy,maxtime1=0,maxtime2=0,time1,time2,action:PTR TO action + + IF obj.firstdep OR obj.firstaction -> object with dependancies/actions + -> traverse children and get maximum timestamp + dep:=obj.firstdep + WHILE dep + IF OstrCmp (dep.object.name, obj.name) = 0 THEN Throw("circ",obj.name) -> cyclic check by Glauschwuffel + target := obj.name + time1,time2:=traverse(dep.object) + IF timelater(time1,time2,maxtime1,maxtime2) + maxtime1:=time1 + maxtime2:=time2 + ENDIF + dep:=dep.next + ENDWHILE + time1,time2:=filetime (obj.name) + IF time1<0 OR timelater(maxtime1,maxtime2,time1,time2) OR args.force + -> dependancy file(s) more recent: build object + -> execute actions + action:=obj.firstaction + + buildAndExecuteScript (action) + + time1,time2:=filetime(obj.name) + IF (time1<0) AND (obj.child=TRUE) THEN Throw("bada",obj.name) + ENDIF + RETURN time1,time2 + ENDIF + -> object requires no action: return timestamp + time1,time2:=filetime(obj.name); + IF time1<0 THEN Throw("badd",obj.name) +ENDPROC time1,time2 + +/* - glauschwuffel's stuff --- */ + + +PROC dumpC() +DEF co:PTR TO constant + co:=constants + WriteF ('Constants are:\n') + WHILE co + WriteF('\t<\s> with <\s>.\n', co.name, co.subst) + co:=co.next + ENDWHILE +ENDPROC + +PROC substituteConstants(c:PTR TO CHAR, s:PTR TO CHAR) +-> search c for constants and substitute them +DEF dollar, bclose=-1,sub=NIL + REPEAT + bclose++ + dollar := InStr (c,'$(',bclose) + IF (dollar<>-1) -> found it? + StrAdd (s, c+bclose, dollar-bclose) + bclose := InStr (c,')',dollar+2) + IF bclose=-1 THEN Throw("clos",c) + sub := findConstant(c,dollar+2,bclose-1) + IF sub=NIL THEN Throw("cons",c+dollar) + StrAdd (s,sub) + ELSE -> copy rest of the line to buffer + StrAdd (s, c+bclose) + ENDIF + UNTIL (dollar=-1) OR (bclose=-1) + RETURN sub -> did we substitute something at all? +ENDPROC + +PROC findConstant(c,start,end) +-> find constant of given position in list +-> add 27.07.97: returns global target on target +DEF co:PTR TO constant + IF OstrCmp('target',c+start,end-start+1)=0 THEN RETURN target + co:=constants + WHILE co + EXIT (OstrCmp(co.name,c+start,end-start+1)=0) + co:=co.next + ENDWHILE + RETURN IF co THEN co.subst ELSE NIL +ENDPROC + +PROC buildAndExecuteScript (action:PTR TO action) HANDLE +DEF s[1024]:STRING, + handle + + handle := Open ('T:Ebuild_actions', MODE_NEWFILE) -> open script file + IF (handle = NIL) THEN Raise ("scrp") + + /* create script variable TARGET */ + StrCopy (s, 'Set target ') + StrAdd (s, target) + StrAdd (s, '\n') -> add newline + + Write (handle, s, StrLen (s)) + IF args.verbose THEN PrintF('\t\s', s) + + WHILE action + uptodate:=FALSE + SetStr (s, 0) -> "delete" the string of the last action + substituteConstants (action.comstring, s) -> expand action + StrAdd (s, '\n') -> add newline + IF args.verbose THEN PrintF('\t\s', s) + Write (handle, s, StrLen (s)) + action:=action.next + ENDWHILE + + Close (handle) + IF Execute('Execute T:Ebuild_actions', NIL, stdout)=NIL THEN Raise("derr") + DeleteFile ('T:EBuild_actions') + +EXCEPT + IF handle THEN Close(handle) + ReThrow() +ENDPROC + + +versionTag: CHAR 0,'$VER:' +versionString: CHAR 'EBuild 0.92 (12.10.97) ©1997 Rob, Wouter and Glauschwuffel',0 + diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/D.e b/amigae33a/E_v3.3a/Src/Src/Utils/D.e new file mode 100644 index 0000000..5b43a76 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/D.e @@ -0,0 +1,297 @@ +/* recursive directory tool + +needs v37. + +Universal directory lister. called with no arguments, by just typing +"d", it lists the current directory. template: + +DIR,REC/S,WIDTH/K/N,COL/K/N,SIZE/S,NOSORT/S,NOFILES/S,NODIRS/S,FULL/S,NOANSI/S, +TARGET/K,DO/K/F + +DIR specifies an optional path to the dir you wish to list. + may contain standard wildcard patterns like #?~[]%() etc. +REC specifies that subdirectories should be listed recursively. +WIDTH max width of one line of output. if not present, D will + infer this from the current width of the console. + NOTE: currently it just takes WIDTH=77 as default. does anyone + have code that gets the width from the console? +COL where n=1..10, by default, D will try and fit as many + columns as allowed by WIDTH. +SIZE reports the size of each dir as it is being listed. note that + combined with REC gives sizes of whole dir (sub-)trees. +NOSORT by default, dirs are sorted before display. disable this with + the NOSORT switch. +NOFILES displays just dirs +NODIRS displays just files +FULL lists full path instead of just filename +NOANSI doesn't use ansi display codes while printing +TARGET

specifies a target directory for use with DO. should + end in either "/" or ":" +DO specifies a commandline for automatic script generation. + note that this uses up the rest of D's commandline. + +something should be said on the script feature: it enables you +to perform repetitive tasks on whole dirs, or dir-trees. existing +utilities that enabled you to do such tasks where mostly not +flexible enough; d enables you to use the REC keyword in combination +with scripts, allows for variable extensions: use .o if +the original name was .s, and the spec. of a target: +resulting files from the operation are placed in another dir, which +can be a complete mirror image of another dir-tree. makedir +statements are inserted if target: is empty. + +following format codes may be used in : + +%s is file (filename+path) +%f is file WITHOUT extension +%r is file without extension, but with leading replaced by + (usefull if allows for an outputfile) +%> or %< %>> etc. prevents the shell from thinking ">" is a redirection + for D, instead of + +a complex example: +you wish to have a complete ascii reference of the emodules: +directory, recursively, and with the resulting .txt files +as a mirror-image directory structure somewhere else. + +1> D >ram:script emodules: REC TARGET=t:mods/ DO showmodule %>%r.txt %s +1> execute ram:script + +will do that for you. +for any file like "emodules:exec/io.m" D will make a line like: +"showmodule >t:mods/exec/io.txt emodules:exec/io.m" + +other examples: D >mydirlist dh0: WIDTH=100 SIZE REC NOANSI + D docs: DO type >prt: %s + D asm: TARGET=obj: DO genam %s -o%r.o + D emodules: REC TARGET=ram: DO showmodule %>%r.txt %s + +*/ + +OPT OSVERSION=37 + +CONST MAXPATH=250 + +ENUM ER_NONE,ER_BADARGS,ER_MEM,ER_UTIL,ER_ITARG,ER_COML +ENUM ARG_DIR,ARG_REC,ARG_WIDTH,ARG_COL,ARG_SIZE,ARG_NOSORT,ARG_NOFILES, + ARG_NODIRS,ARG_FULL,ARG_NOANSI,ARG_TARGET,ARG_COMMAND,NUMARGS + +MODULE 'dos/dosasl', 'dos/dos', 'utility', 'intuition/intuitionbase', + 'intuition/intuition', 'graphics/gfxbase', 'graphics/text' + +RAISE ER_MEM IF New()=NIL, /* set common exceptions: */ + ER_MEM IF String()=NIL, /* every call to these functions will be */ + ERROR_BREAK IF CtrlC()=TRUE /* automatically checked against NIL, */ + /* and the exception ER_MEM is raised */ + +DEF dir,command,target, + recf=FALSE,col=3,calccolf=TRUE,comf=FALSE,sizef=FALSE,sortf=TRUE,filesf=TRUE, + fullf=FALSE,ansif=TRUE,dirsf=TRUE,dirw[100]:STRING, + rdargs=NIL,work[250]:STRING,work2[250]:STRING,dirno=0, + prtab[25]:LIST,prcopy[25]:LIST,workdir[250]:STRING, + consolewidth=0 + +PROC main() HANDLE + DEF args[NUMARGS]:LIST,templ,x,lock,fib:fileinfoblock,s + IF (utilitybase:=OpenLibrary('utility.library',37))=NIL THEN Raise(ER_UTIL) + FOR x:=0 TO NUMARGS-1 DO args[x]:=0 + templ:='DIR,REC/S,WIDTH/K/N,COL/K/N,SIZE/S,NOSORT/S,NOFILES/S,NODIRS/S,' + + 'FULL/S,NOANSI/S,TARGET/K,DO/K/F' + rdargs:=ReadArgs(templ,args,NIL) + IF rdargs=NIL THEN Raise(ER_BADARGS) /* initialise flags */ + IF args[ARG_SIZE] THEN sizef:=TRUE /* from command line args */ + consolewidth:=Bounds(IF args[ARG_WIDTH] THEN Long(args[ARG_WIDTH]) ELSE findconsolewidth(),1,1000) + IF args[ARG_COL] THEN (calccolf:=FALSE) BUT col:=Long(args[ARG_COL]) + col:=Bounds(col,1,100) + IF args[ARG_NOSORT] THEN sortf:=FALSE + IF args[ARG_NOANSI] THEN ansif:=FALSE + IF args[ARG_NOFILES] THEN filesf:=FALSE + IF args[ARG_NODIRS] THEN dirsf:=FALSE + IF args[ARG_REC] THEN recf:=TRUE + IF args[ARG_FULL] THEN fullf:=TRUE + target:=args[ARG_TARGET] + command:=args[ARG_COMMAND] + IF command THEN comf:=TRUE + IF target + x:=target+StrLen(target)-1 + IF (x":") AND (x[]<>"/")) THEN Raise(ER_ITARG) + ENDIF + IF comf + sortf:=FALSE /* read and convert commandline for scripts */ + col:=1 + filesf:=FALSE + dirsf:=FALSE + IF command[]=0 THEN Raise(ER_COML) + s:=command + WHILE x:=s[]++ + IF x="%" + x:=s[] + SELECT x + CASE "s"; ListAdd(prtab,[1],1) /* %s = fullpath */ + CASE "f"; ListAdd(prtab,NEW [work],1); s[]:="s" /* %f = work */ + CASE "r"; ListAdd(prtab,NEW [work2],1); s[]:="s" /* %r = work2 */ + DEFAULT; s[-1]:=" " + ENDSELECT + ENDIF + ENDWHILE + ENDIF + dir:=args[ARG_DIR] + IF dir THEN StrCopy(dirw,dir,ALL) + lock:=Lock(dirw,-2) + IF lock /* if yes, the prob. dir, else wildcard */ + IF Examine(lock,fib) AND (fib.direntrytype>0) + AddPart(dirw,'#?',100) + ENDIF + UnLock(lock) + ENDIF + recdir(dirw) + Raise(ER_NONE) +EXCEPT + IF rdargs THEN FreeArgs(rdargs) + IF utilitybase THEN CloseLibrary(utilitybase) + SELECT exception + CASE ER_BADARGS; PrintF('Bad Arguments for D!\n') + CASE ER_MEM; PrintF('No mem!\n') + CASE ER_COML; PrintF('No commandline specified\n') + CASE ER_ITARG; PrintF('Illegal target\n') + CASE ER_UTIL; PrintF('Could not open "utility.library" v37\n') + CASE ERROR_BREAK; PrintF('User terminated D\n') + CASE ERROR_BUFFER_OVERFLOW; PrintF('Internal error\n') + DEFAULT; PrintFault(exception,'Dos Error') + ENDSELECT +ENDPROC + +PROC recdir(dirr) HANDLE + DEF er,i:PTR TO fileinfoblock,size=0,anchor=NIL:PTR TO anchorpath,fullpath, + flist=NIL,first,entries=0,ascii,w,x,y,z,flist2=NIL, + isfirst=0,maxfilename=1,maxfilesize=-1,lcol + anchor:=New(SIZEOF anchorpath+MAXPATH) + anchor.breakbits:=4096 + anchor.strlen:=MAXPATH-1 + er:=MatchFirst(dirr,anchor) /* collect all strings */ + WHILE er=0 + fullpath:=anchor+SIZEOF anchorpath + i:=anchor.info + ascii:=IF fullf THEN fullpath ELSE i.filename + IF i.direntrytype>0 + StringF(work,'\s\l\s[30] ',IF ansif THEN '\e' ELSE '',ascii) + ELSE + StringF(work,'\l\s[30] \r\d[8]',ascii,i.size) + IF i.size>maxfilesize THEN maxfilesize:=i.size + ENDIF + x:=StrLen(ascii) + IF x>maxfilename THEN maxfilename:=x + IF IF i.direntrytype>0 THEN dirsf ELSE filesf + first:=String(EstrLen(work)) + StrCopy(first,work,ALL) + flist:=Link(first,flist) + INC entries + ENDIF + IF i.direntrytype<0 THEN size:=size+i.size + IF (i.direntrytype<0) AND comf /* execute commandline */ + ListCopy(prcopy,prtab,ALL) + IF comf THEN MapList({x},prcopy,prcopy,`IF x=1 THEN fullpath ELSE x) + StrCopy(work,fullpath,ALL) + x:=InStr(work,'.',0) + IF x<>-1 THEN SetStr(work,x) /* find f% */ + IF target + StrCopy(work2,target,ALL) + x:=work; y:=dirw /* was dirr */ + WHILE x[]++=y[]++ DO NOP + DEC x + StrAdd(work2,x,ALL) /* find r% */ + ELSE + StrCopy(work2,work,ALL) + ENDIF + IF isfirst++=0 + StrCopy(workdir,work2,ALL) /* see if makedir is needed */ + SetStr(workdir,PathPart(work2)-work2) + x:=Lock(workdir,-2) + IF x THEN UnLock(x) ELSE PrintF('makedir \s\n',workdir) + ENDIF + Flush(stdout); VfPrintf(stdout,command,prcopy); Flush(stdout) + PrintF('\n') + ENDIF + IF recf AND (i.direntrytype>0) /* do recursion(=tail) */ + x:=StrLen(fullpath) + IF x+5ERROR_NO_MORE_ENTRIES THEN Raise(er) + MatchEnd(anchor) + Dispose(anchor) + anchor:=NIL + maxfilesize:=IF maxfilesize>=0 THEN sillylog10(maxfilesize) ELSE 0 + lcol:=Bounds(IF calccolf THEN consolewidth+1/(maxfilesize+maxfilename+2) ELSE col,1,100) + flist:=Link(String(1),flist) + IF entries>2 AND sortf THEN flist:=sort(flist) + IF comf=FALSE /* display dir */ + IF dirno THEN PrintF('\n') + PrintF(IF ansif THEN '\e[1mDirectory of: "\s"\e[0m\n' ELSE 'Directory of: "\s"\n',dirr) + ENDIF + first:=flist + x:=entries/lcol /* put dirlist in columns */ + IF x*lcollcol THEN PrintF(' ') + ENDIF + ENDFOR + PrintF('\n') + CtrlC() + ENDFOR + IF sizef THEN PrintF('BYTE SIZE: \d\n',size) + DisposeLink(flist) + INC dirno +EXCEPT /* nested exception handlers! */ + IF anchor THEN MatchEnd(anchor) + Raise(exception) /* this way, we call _all_ handlers in the recursion */ +ENDPROC size /* and thus calling MatchEnd() on all hanging anchors */ + +PROC sort(flist) + DEF sortdone,prev,first,next,nnext + REPEAT + sortdone:=TRUE /* sort dirlist */ + prev:=first:=flist + WHILE first:=Next(first) + IF next:=Next(first) + IF Stricmp(first,next)>0 + nnext:=Next(next) + Link(prev,first:=Link(next,Link(first,nnext))) + sortdone:=FALSE + ENDIF + ENDIF + prev:=first + ENDWHILE + CtrlC() + UNTIL sortdone +ENDPROC flist + +PROC findconsolewidth() + DEF ib:PTR TO intuitionbase,gb:PTR TO gfxbase,w,fw + ib:=intuitionbase + gb:=gfxbase + Forbid() + w:=ib.activewindow.width + fw:=gb.defaultfont.xsize + Permit() +ENDPROC Bounds(w-24/fw,5,250) + +PROC sillylog10(n) IS IF n<10 THEN 1 ELSE sillylog10(Div(n,10))+1 diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/DirQuick.e b/amigae33a/E_v3.3a/Src/Src/Utils/DirQuick.e new file mode 100644 index 0000000..d3fdf43 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/DirQuick.e @@ -0,0 +1,26 @@ +/* nice directory command in E ! */ + +MODULE 'dos/dos' + +PROC main() + DEF info:fileinfoblock,lock,c=0 + IF lock:=Lock(arg,-2) + IF Examine(lock,info) + IF info.direntrytype>0 + WriteF('Directory of: \s\n',info.filename) + WHILE ExNext(lock,info) + WriteF(IF info.direntrytype>0 THEN + '\e[1;32m\l\s[25]\e[0;31m' ELSE '\l\s[17] \r\d[7]', + info.filename,info.size) + WriteF(IF c++=2 THEN (c:=0) BUT '\n' ELSE ' ') + ENDWHILE + IF c THEN WriteF('\n') + ELSE + WriteF('No Dir!\n') + ENDIF + ENDIF + UnLock(lock) + ELSE + WriteF('What ?!?\n') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/README_IMPORTANT b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/README_IMPORTANT new file mode 100644 index 0000000..2e36ff4 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/README_IMPORTANT @@ -0,0 +1,28 @@ +TERMS AND CONDITIONS FOR USING THE EDBG SOURCECODE + +* modifying or reusing part or whole of the EDBG code for your + own project is always allowed: giving credit is encouraged. +* making new versions of EDBG public is discouraged in + general. if you still feel that need, try in this order: + - suggest the extension to the maintainer of the "official" + EDBG, currently Jason Hulance. + - cooperate with other people that may be working on a + custom EDBG (try discussing this on the E mailing list). + - the EDBG core (eexe.e) has been programmed to be + used by various different programs/user-interfaces. + Try making your own debugging tool that uses eexe.e + unmodified. + - if you HAVE to start your own spin-off project, make sure + your release is heavily marked as being different from the + official version while still giving credit. e.g. + "Harry's TurboDebug v1.0a featuring runtime type analysis, + based on Wouter and Jason's original EDBG v3.3a". + After you start your own version, don't come and + bother us about making it the official version. + Doing your own commercial version or anything else related + to money won't be tolerated at all. + +The purpose of this release is first and foremost educational. + +If you intend to do something with this code which doesn't +seem to be covered by the above, ask me (Wouter) or Jason first. diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/edbg.e b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/edbg.e new file mode 100644 index 0000000..fcfb563 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/edbg.e @@ -0,0 +1,1424 @@ +-> Yes! A real E debugger! + +OPT OSVERSION=37, LARGE + +MODULE 'tools/clonescreen', 'tools/macros', 'tools/arexx', + 'tools/EasyGUI', 'tools/constructors', 'tools/exceptions', + 'tools/iterators', + '*eexe', 'class/sc', '*sctext', '*schex', '*screg', 'other/sendexplorer', + 'dos/dostags', 'exec/lists', 'exec/nodes', + 'gadtools', 'libraries/gadtools', + 'intuition/intuition', 'intuition/screens', 'intuition/gadgetclass', + 'graphics/text', 'graphics/rastport', + 'rexx/storage', 'rexxsyslib' + +OBJECT dbgwin + next:PTR TO dbgwin,type +ENDOBJECT + +OBJECT srcwin OF dbgwin + scwin:PTR TO scrolltext,src:PTR TO e_source +ENDOBJECT + +OBJECT memwin OF dbgwin + scwin:PTR TO scrollhex,addr +ENDOBJECT + +OBJECT regwin OF dbgwin + scwin:PTR TO scrollreg +ENDOBJECT + +OBJECT varwin OF dbgwin + scwin:PTR TO scrolltext +ENDOBJECT + +OBJECT wvar OF ln + v:PTR TO CHAR +ENDOBJECT + +CONST RXSTR_SIZE=250 + +DEF exe=NIL:PTR TO e_exe,frame:PTR TO stackframe, + oscr=NIL,scr=NIL:PTR TO screen,font=NIL:PTR TO textfont,depth,xsize,ysize, + title,doabout=TRUE,dorefresh=TRUE,dosavewindowpos=TRUE,dosavevars=TRUE,argstring[100]:STRING, + dwins=NIL:PTR TO dbgwin,numsrc=0,wrapsrc=FALSE,maxsrcs=0,stackwin=NIL:PTR TO memwin, + vwin=NIL:PTR TO varwin,varlist=NIL:PTR TO LONG,vars:PTR TO lh, + rwin=NIL:PTR TO regwin, + visual=NIL,menu=NIL,whatstep,evgh=NIL:PTR TO guihandle, + followgh=NIL:PTR TO guihandle,followspeed=30,repeatcount=0,repeatover=TRUE, + toolwin=NIL:PTR TO window,toolgads=NIL:PTR TO LONG, + currentwin:PTR TO srcwin, -> active intuition + activewin:PTR TO srcwin, -> where (pc) is + lastsec=0,lastmic=0,findstr[100]:STRING,offstr[12]:STRING, + ocon=NIL,reqtitle,oldi,oldo, + first_step_done=FALSE,unreachablea7, + srcport=NIL,rexxport=NIL,rexxname,startExp=FALSE,oldvy=-1, + fx=0,fy=0,fxs=0,fys=0,explorer[RXSTR_SIZE]:STRING,pubname[100]:STRING, + rxs1[RXSTR_SIZE]:STRING,rxs2[RXSTR_SIZE]:STRING,rxs3[RXSTR_SIZE]:STRING + +ENUM STEP_NONE,STEP_IN,STEP_OVER,STEP_RUN,STEP_THROW,STEP_FOLLOW + +CONST MAX_WATCH=250, MAX_WLINE=100 + +RAISE "MEM" IF String()=NIL + +PROC main() HANDLE + DEF options:PTR TO LONG,rdargs=NIL,exename[100]:STRING,e:PTR TO dbgwin, + pubconname[200]:STRING, i + title:='EDBG v3.3a, The E Debugger! © 1994-1997 Wouter (and Jason)' + reqtitle:='EDBG' + vars:=newlist() + options:=[0,0,0] + IF rdargs:=ReadArgs('EXECUTABLE/A,PUBSCREEN/K,ARG/K',options,NIL) + StrCopy(exename,options[0]) + IF options[2] THEN StrCopy(argstring,options[2]) + IF options[1] + StrCopy(pubname,options[1]) + IF scr:=LockPubScreen(pubname) THEN font:=scr.rastport::rastport.font + ENDIF + FreeArgs(rdargs) + ELSE + Raise("ARGS") + ENDIF + WriteF('\s.\nLoading "\s"...\n',title,exename) + NEW exe.load(exename) + IF scr=NIL + StrCopy(pubname,'EDBG') + IF options[1] THEN StrAdd(pubname,options[1]) + scr,font:=openclonescreen('Workbench',title,2,pubname) + oscr:=scr + PubScreenStatus(scr,0) -> TEMP!! + ENDIF + rexxname:=IF oscr THEN pubname ELSE 'EDBG' + depth,xsize,ysize:=getcloneinfo(scr) + IF (gadtoolsbase:=OpenLibrary('gadtools.library',37))=NIL THEN Raise("GT") + IF (visual:=GetVisualInfoA(scr,NIL))=NIL THEN Raise("MENU") + createmenus() + createtoolbar() + IF (srcport:=CreateMsgPort())=NIL THEN Raise("PORT") + rexxport:=rx_OpenPort(rexxname) + StrCopy(pubconname,'CON:0/900/640/50/Standard Input and Output:/SCREEN ') + StrAdd(pubconname,pubname) + IF ocon:=Open(pubconname,NEWFILE) + oldi:=SelectInput(ocon) + oldo:=SelectOutput(ocon) + ELSE + Throw("OPEN",'CON:') + ENDIF + exe.edebug({step},argstring) +EXCEPT DO + IF followgh OR repeatcount THEN Delay(6) BUT request1('Program completed execution','_OK',"o") + IF startExp + quitExplorer() + FOR i:=1 TO 20 + EXIT isExplorerRunning()=FALSE + Delay(6) + ENDFOR + ENDIF + removefollow() + WHILE dwins + e:=dwins + dwins:=dwins.next + END e + ENDWHILE + IF ocon + SelectInput(oldi) + SelectOutput(oldo) + Close(ocon) + ENDIF + rx_ClosePort(rexxport) + rexxport:=NIL + IF srcport THEN DeleteMsgPort(srcport) + deletetoolbar() -> no request()s after this + IF menu THEN FreeMenus(menu) + IF visual THEN FreeVisualInfo(visual) + IF gadtoolsbase THEN CloseLibrary(gadtoolsbase) + IF oscr + IF closeclonescreen(oscr,font)=FALSE + Delay(20) + WHILE closeclonescreen(oscr,font)=FALSE + request1('Please close other windows on this screen!','_OK',"o") + ENDWHILE + ENDIF + ELSEIF scr + UnlockPubScreen(NIL,scr) + ENDIF + END exe + SELECT exception + CASE "MEM"; WriteF('Aaargh! no mem!\n') + CASE "ARGS"; WriteF('Bad Args! (try "edbg ?")\n') + CASE "OPEN"; WriteF('Failed to open "\s".\n',exceptioninfo) + CASE "IN"; WriteF('Problems while reading file.\n') + CASE "eexe"; WriteF('Not a valid E executable\n') + CASE "eexd"; WriteF('Try compiling with "EC DEBUG" first\n') + CASE "SCR"; WriteF('no screen!\n') + CASE "GT"; WriteF('no "gadtools.library"!\n') + CASE "MENU"; WriteF('no menus!\n') + CASE "WIN"; WriteF('no window!\n') + CASE "DOUB"; WriteF('port with same name already exists! (another EDBG running?)\n') + CASE "SIG"; WriteF('could not allocate signal!\n') + DEFAULT; report_exception() + ENDSELECT +ENDPROC + +PROC createmenus() + IF (menu:=CreateMenusA([ + 1,0,'Project',0,0,0,0, + 2,0,'About...', 0 ,0,0,0, + 2,0,'Settings...', 'P',0,0,0, + 2,0,'Save Settings', 'W',0,0,0, + 2,0,'Quit', 'Q',0,0,0, + 1,0,'Windows',0,0,0,0, + 2,0,'Source', 'S',0,0,0, + 2,0,'Registers', 'D',0,0,0, + 2,0,'Memory', 'M',0,0,0, + 2,0,'Stack', 'T',0,0,0, + 2,0,'Variables', 'X',0,0,0, + 1,0,'Debug',0,0,0,0, + 2,0,'Step In (left)', 'I',0,0,0, + 2,0,'Step Over (down)', 'O',0,0,0, + 2,0,'Step Follow', 0 ,0,0,0, + 2,0,'Repeat Step', 0 ,0,0,0, + 2,0,'Watch Variable', 0 ,0,0,0, + 2,0,'Set Breakpoint', 0 ,0,0,0, + 2,0,'Memory Breakpoint', 'B',0,0,0, + 2,0,'Clear Breakpoints', 'C',0,0,0, + 2,0,'Run upto Breakpoint','R',0,0,0, + 2,0,'Raise Exception', 'E',0,0,0, + 1,0,'Tools',0,0,0,0, + 2,0,'Eval E Expression', 'K',0,0,0, + 2,0,'Modify Variable', 0 ,0,0,0, + 2,0,'Refresh Views', 'V',0,0,0, + 2,0,'Find in Source', 'F',0,0,0, + 2,0,'Locate Offset', 'L',0,0,0, + 1,0,'Rexx',0,0,0,0, + 2,0,'Execute script 1', 0 ,0,0,0, + 2,0,'Execute script 2', 0 ,0,0,0, + 2,0,'Execute script 3', 0 ,0,0,0, + 0,0,0,0,0,0,0]:newmenu,NIL))=NIL THEN Raise("MENU") + IF LayoutMenusA(menu,visual,[GTMN_NEWLOOKMENUS,TRUE,NIL])=FALSE THEN Raise("MENU") +ENDPROC + +/*-----------------------------------------------------------------------*/ + +ENUM T_SRC,T_MEM,T_STACK,T_REG,T_VAR + +PROC message() OF dbgwin + IF self.next THEN self.next.message() +ENDPROC + +PROC refresh() OF dbgwin + IF self.next THEN self.next.refresh() +ENDPROC + +PROC end() OF dbgwin + DEF x:PTR TO dbgwin + IF (x:=dwins)=self + dwins:=self.next + ELSE + WHILE x.next + EXIT x.next=self + x:=x.next + ENDWHILE + IF x.next THEN x.next:=self.next + ENDIF +ENDPROC + +/*----------------------------------------------------------------------*/ + +PROC srcwin(src:PTR TO e_source) OF srcwin + DEF x:PTR TO scrolltext,a + self.next:=dwins + dwins:=self + self.type:=T_SRC + self.src:=src + self.scwin:=NEW x.settext(src.lines(),120) + IF (fx>=xsize) OR (fy>=ysize) OR (fxs>=xsize) OR (fys>=ysize) OR (fxs<40) OR (fys<20) + a:=(numsrc+1)*(font.ysize+3)+IF wrapsrc THEN 5 ELSE 0 + IF maxsrcs=0 + IF ysize-a<(10*font.ysize) + maxsrcs:=numsrc + numsrc:=0 + wrapsrc:=TRUE + a:=font.ysize+3+5 + ENDIF + ENDIF + fx:=numsrc*10+49+IF wrapsrc THEN 5 ELSE 0 + fy:=a + fxs:=500 + fys:=Min(ysize-a,400) + ENDIF + x.open(src.name(),fx,fy,fxs,fys,scr,IDCMP_MENUPICK OR IDCMP_MOUSEBUTTONS OR IDCMP_RAWKEY,{handlesrc},srcport,self) + IF SetMenuStrip(x.window,menu)=FALSE THEN Raise("MENU") + IF (numsrc++>=maxsrcs) AND maxsrcs + numsrc:=0 + wrapsrc:=(wrapsrc=FALSE) + ENDIF + fx:=fy:=fxs:=fys:=0 +ENDPROC + +PROC end() OF srcwin + DEF sc:PTR TO scrolltext + sc:=self.scwin + IF sc.window THEN ClearMenuStrip(sc.window) + END sc + SUPER self.end() + IF 0>numsrc-- THEN numsrc:=maxsrcs +ENDPROC + +/*----------------------------------------------------------------------*/ + +PROC memwin(addr,type) OF memwin + DEF x:PTR TO scrollhex,a + self.next:=dwins + dwins:=self + self.type:=type + self.addr:=addr + IF type=T_STACK THEN stackwin:=self + self.scwin:=NEW x.setmem(addr) + a:=40*font.xsize+20 + x.open(IF type=T_MEM THEN 'Memory View' ELSE 'Stack View', + xsize-a,font.ysize+3,a,ysize/3,scr,IDCMP_MENUPICK,{handlesrc}) + IF SetMenuStrip(x.window,menu)=FALSE THEN Raise("MENU") +ENDPROC + +PROC message() OF memwin + self.scwin.setmem(self.addr) + IF self.next THEN self.next.message() + IF self.scwin.handle() THEN END self +ENDPROC + +PROC refresh() OF memwin + self.scwin.setmem(self.addr) + self.scwin.refreshwindow() + IF self.next THEN self.next.refresh() +ENDPROC + +PROC end() OF memwin + DEF sc:PTR TO scrolltext + sc:=self.scwin + IF self.type=T_STACK THEN stackwin:=NIL + IF sc.window THEN ClearMenuStrip(sc.window) + END sc + SUPER self.end() +ENDPROC + +/*----------------------------------------------------------------------*/ + +PROC regwin() OF regwin + DEF x:PTR TO scrollreg,a + self.next:=dwins + dwins:=self + self.type:=T_REG + self.scwin:=NEW x.scrollreg(frame) + a:=13*font.xsize+20 + x.open('Register View',xsize-a,font.ysize+3,a,ysize/2,scr,IDCMP_MENUPICK,{handlesrc}) + IF SetMenuStrip(x.window,menu)=FALSE THEN Raise("MENU") + rwin:=self +ENDPROC + +PROC message() OF regwin + IF self.next THEN self.next.message() + IF self.scwin.handle() THEN END self +ENDPROC + +PROC refresh() OF regwin + self.scwin.refreshreg(frame) + IF self.next THEN self.next.refresh() +ENDPROC + +PROC end() OF regwin + DEF sc:PTR TO scrolltext + rwin:=NIL + sc:=self.scwin + IF sc.window THEN ClearMenuStrip(sc.window) + END sc + SUPER self.end() +ENDPROC + +/*----------------------------------------------------------------------*/ + +PROC varwin() OF varwin + DEF x:PTR TO scrolltext + self.next:=dwins + dwins:=self + self.type:=T_VAR + IF varlist=NIL THEN IF (varlist:=List(MAX_WATCH))=NIL THEN Raise("MEM") + constructvars() + self.scwin:=NEW x.settext(varlist,MAX_WLINE) + IF (fx>=xsize) OR (fy>=ysize) OR (fxs>=xsize) OR (fys>=ysize) OR (fxs<40) OR (fys<20) + fx:=xsize/8 + fy:=ysize/2 + fxs:=xsize-(xsize/4) + fys:=ysize/4 + ENDIF + x.open('Variable View',fx,fy,fxs,fys,scr,IDCMP_MENUPICK OR IDCMP_MOUSEBUTTONS OR IDCMP_RAWKEY,{handlevar}) + IF SetMenuStrip(x.window,menu)=FALSE THEN Raise("MENU") + vwin:=self + fx:=fy:=fxs:=fys:=0 +ENDPROC + +PROC message() OF varwin + IF self.next THEN self.next.message() + IF self.scwin.handle() THEN END self +ENDPROC + +PROC refresh() OF varwin + varrefresh(self) + IF self.next THEN self.next.refresh() +ENDPROC + +PROC varrefresh(win:PTR TO varwin) + constructvars() + win.scwin.settext(varlist,MAX_WLINE) + win.scwin.refreshwindow() +ENDPROC + +PROC end() OF varwin + DEF sc:PTR TO scrolltext + vwin:=NIL + sc:=self.scwin + IF sc.window THEN ClearMenuStrip(sc.window) + END sc + SUPER self.end() +ENDPROC + +PROC actionvar(y) + DEF wv:PTR TO wvar,n=0,s[100]:STRING,v,vptr,type,r + wv:=vars.head + WHILE wv.succ + v,vptr,type:=getvarval(wv.v) + IF type + IF y=n++ + StringF(s,'Variable "\s" selected.',wv.v) + r:=request3(s,'_Remove','_Modify','_Cancel',"r","m","c") + IF r=1 + Remove(wv) + varrefresh(vwin) + ELSEIF r=2 + StringF(s, IF (v>4096) OR (v<-4096) THEN '$\h' ELSE '\d', v) + r:=easyguiA(reqtitle, + [ROWS, + [TEXT,'New contents of variable?',NIL,FALSE,3], + [STR,1,'_Value:',s,100,10,0,0,"v"], + [COLS,[TEXT,'(Examples: 0,$0,var,{var})',NIL,FALSE,3],[BUTTON,{ehelp},'_Help',0,"h"]], + [BAR], + [COLS, + [BUTTON,1,'_OK',0,"o"], + [SPACEH], + [BUTTON,0,'_Cancel',0,"c"] + ] + ], + [EG_SCRN,scr,NIL]) + IF r=1 + r,v:=extval(s) + IF r + SELECT 8 OF type + CASE 3 TO 7 + frame.regs[type]:=v + CASE 1,2 + ^vptr:=v + ENDSELECT + varrefresh(vwin) + ENDIF + ENDIF + ENDIF + RETURN + ENDIF + ENDIF + wv:=wv.succ + ENDWHILE +ENDPROC + +PROC addvar(var,shift=FALSE) + DEF wv:PTR TO wvar + IF openvarwin() + IF shift THEN getvarval(var,TRUE) + IF findtracedvar(var) + request1('You''re already watching this variable','_Indeed!',"i") + ELSE + AddTail(vars,NEW wv) + wv.v:=StrCopy(String(EstrLen(var)),var) + wv.name:=String(MAX_WLINE) + IF wv.name=NIL THEN Raise("MEM") + varrefresh(vwin) + ENDIF + ENDIF +ENDPROC + +PROC addval(s,v) + DEF vl:PTR TO LONG,a,c,t[20]:STRING + IF TypeOfMem(v) + vl:=v + StrAdd(s,' [') + FOR a:=1 TO 4 DO StrAdd(s,StringF(t,'\z\h[8] ',vl[]++)) + StrAdd(s,' \q') + FOR a:=1 TO 16 DO (c:=v[]++) BUT StrAdd(s,IF (c>32) AND (c<127) THEN [c,0]:CHAR ELSE '.') + StrAdd(s,'\q]') + ENDIF +ENDPROC + +PROC findtracedvar(n) + DEF wv:PTR TO wvar + wv:=vars.head + WHILE wv.succ + IF StrCmp(n,wv.v) THEN RETURN wv + wv:=wv.succ + ENDWHILE +ENDPROC NIL + +PROC constructvars() + DEF wv:PTR TO wvar,num=0,v,vptr,type,t[30]:STRING + wv:=vars.head + WHILE wv.succ + v,vptr,type:=getvarval(wv.v) + IF type + StrCopy(wv.name,wv.v) + StrAdd(wv.name,StringF(t,IF (v>-1000) AND (v<1000) THEN ' = \d ' ELSE ' = $\h ',v)) + SELECT 8 OF type + CASE 3 TO 7 + StrAdd(wv.name,StringF(t,'(local reg D\d)',type)) + CASE 1,2 + StrAdd(wv.name,StringF(t,'(\s at $\z\h[8])',IF type=2 THEN 'global' ELSE 'local',vptr)) + ENDSELECT + addval(wv.name,v) + varlist[num++]:=wv.name + ENDIF + EXIT num=MAX_WATCH + wv:=wv.succ + ENDWHILE + SetList(varlist,num) +ENDPROC + +/*-------------------------------------------------------------------*/ + +PROC showsrcwin(src:PTR TO e_source,i=NIL) + DEF w:PTR TO srcwin,n:PTR TO srcwin,sc:PTR TO scrolltext + w:=dwins + WHILE IF w THEN (IF w.type=T_SRC THEN w.src<>src ELSE w) ELSE w DO w:=w.next + IF w=NIL + NEW n.srcwin(src) + ELSE + n:=w + IF fxs + ChangeWindowBox(n.scwin.window,fx,fy,fxs,fys) + fx:=fy:=fxs:=fys:=0 + ENDIF + ENDIF + sc:=n.scwin + IF i + sc.active(i) + activewin:=n + ENDIF + IF w THEN WindowToFront(sc.window) +ENDPROC + +PROC quit() + DEF a + a:=request3('Sure to leave the debugged program halfway?','_Quit','_Run','_Oops!',"q","r","o") + IF a=1 + Raise() + ELSEIF a=2 + whatstep:=STEP_RUN + ENDIF +ENDPROC + +PROC newmem() + DEF w:PTR TO memwin,a + IF (a:=getmem())<>-1 THEN NEW w.memwin(a,T_MEM) +ENDPROC + +PROC newreg() IS IF rwin THEN WindowToFront(rwin.scwin.window) ELSE NEW rwin.regwin() +PROC openstackwin() IS IF stackwin=NIL THEN NEW stackwin.memwin(frame.stack,T_STACK) ELSE WindowToFront(stackwin.scwin.window) +PROC openvarwin() IS IF vwin THEN (WindowToFront(vwin.scwin.window) BUT TRUE) ELSE NEW vwin.varwin() +PROC dum(p,q) IS EMPTY +PROC modifyvar() IS request13('You can modify a variable','by clicking on it','in the variable view','_Great!',"g") +PROC watchvar() IS request13('You can watch a variable','by double-clicking on it','in a source-window','_Great!',"g") +PROC breakpoint() IS request13('You can set a breakpoint','by double-clicking on a line','in a source-window','_Great!',"g") + +PROC breakpointvar() + DEF m + IF (m:=getmem())<>-1 THEN setmembreak(m) +ENDPROC + +PROC clearbreakpoints() + setbreak(NIL) + setmembreak(NIL) +ENDPROC + +PROC raiseexception() + DEF e[20]:STRING,ei[20]:STRING,ev,eiv,n + StrCopy(e,'"HALT"') + StrCopy(ei,'0') + LOOP + IF easyguiA(reqtitle, + [EQROWS, + [TEXT,'Enter exception values:',NIL,FALSE,3], + [STR,{dum},'_exception:',e,100,5,0,0,"e"], + [STR,{dum},'e_xceptioninfo:',ei,100,5,0,0,"x"], + [COLS,[TEXT,'(Examples: 0,$0,var,{var})',NIL,FALSE,3],[BUTTON,{ehelp},'_Help',0,"h"]], + [BAR], + [COLS, + [BUTTON,1,'_OK',0,"o"], + [SPACEH], + [BUTTON,0,'_Cancel',0,"c"] + ] + ], + [EG_SCRN,scr,NIL]) + n,ev:=extval(e) + IF n + n,eiv:=extval(ei) + IF n + setthrow(ev,eiv) + whatstep:=STEP_THROW + RETURN + ENDIF + ENDIF + request1('Illegal value(s)','_Sorry',"s") + ELSE + RETURN + ENDIF + ENDLOOP +ENDPROC + +PROC repeatstep() + DEF str[20]:STRING,n + StrCopy(str,'1') + LOOP + IF easyguiA(reqtitle, + [EQROWS, + [TEXT,'Enter number and type of steps:',NIL,FALSE,3], + [COLS, + [STR,{dum},'_Steps:',str,100,5,0,0,"s"], + [CHECK,{mrepeattype},'Step _Over?',repeatover,TRUE,0,"o"] + ], + [COLS,[TEXT,'(Examples: 10,$2F,var,^var)',NIL,FALSE,3],[BUTTON,{ehelp},'_Help',0,"h"]], + [BAR], + [COLS, + [BUTTON,1,'_OK',0,"o"], + [SPACEH], + [BUTTON,0,'_Cancel',0,"c"] + ] + ], + [EG_SCRN,scr,NIL]) + n,repeatcount:=extval(str) + IF n AND (repeatcount>0) + repeatcount-- + whatstep:=STEP_OVER + RETURN + ENDIF + request1('Illegal value(s)','_Sorry',"s") + ELSE + RETURN + ENDIF + ENDLOOP +ENDPROC + +PROC mrepeattype(p,x) IS repeatover:=x + +PROC evalexps() + DEF r,s[100]:STRING + easyguiA(reqtitle, + [EQROWS, + [TEXT,'Enter E Expression:',NIL,FALSE,3], + [STR,{evexp},'_Exp:',s,100,10,0,0,"e"], + r:=[TEXT,s,'Result:',TRUE,1], + [COLS,[TEXT,'(Examples: 0,$0,var,{var})',NIL,FALSE,3],[BUTTON,{ehelp},'_Help',0,"h"]], + [BAR], + [COLS,[SPACEH],[BUTTON,0,'_OK',0,"o"],[SPACEH]] + ], + [EG_INFO,r, EG_SCRN,scr, EG_GHVAR,{evgh}, NIL]) +ENDPROC + +PROC evexp(rgad,s) + DEF v,r,f[20]:STRING + r,v:=extval(s) + IF r + StringF(f,IF v<10000 THEN '\d' ELSE '$\h',v) + ELSE + StrCopy(f,'') + ENDIF + settext(evgh,rgad,f) +ENDPROC + +PROC ehelp(p) + easyguiA(reqtitle, + [ROWS, + [TEXT,'Values: 123, $ABC, %010101, "FORM"',NIL,FALSE,3], + [TEXT,'Variables: a, {a}, ^a',NIL,FALSE,3], + [TEXT,'Operators: +, -, *, /, ()',NIL,FALSE,3], + [BAR], + [BUTTON,0,'_OK',0,"o"] + ], + [EG_SCRN,scr,NIL]) +ENDPROC + +PROC search() + DEF lines:PTR TO LONG,n,max,st:PTR TO scrolltext + max:=n:=ListLen(lines:=currentwin.src.lines()) + st:=currentwin.scwin + IF easyguiA(reqtitle, + [ROWS, + [TEXT,'Enter text to find (case sensitive)',NIL,FALSE,3], + [STR,1,'_Text:',findstr,100,10,0,0,"t"], + [BAR], + [COLS, + [BUTTON,1,'_Find',0,"f"], + [SPACEH], + [BUTTON,0,'_Cancel',0,"c"] + ] + ], + [EG_SCRN,scr,NIL]) + WHILE n>0 + EXIT InStr(lines[],findstr,0)<>-1 + lines++ + n-- + ENDWHILE +-> IF n THEN st.settop(max-n) ELSE request1('Could not find text','_Hmmm',"h") + IF n THEN st.active(max-n) ELSE request1('Could not find text','_Hmmm',"h") + ENDIF +ENDPROC + +PROC handlemenu(imsg:PTR TO intuimessage) + DEF c,menu,item,sub + c:=imsg.code + menu:=menunum(c) + item:=itemnum(c) + sub:=subnum(c) + SELECT menu + CASE 0 + SELECT item + CASE 0; about() -> About + CASE 1; setprefs() -> Settings... + CASE 2; saveprefs() -> Save Settings + CASE 3; quit() -> Quit + ENDSELECT + CASE 1 + SELECT item + CASE 0; choose_source() -> Source + CASE 1; newreg() -> Registers + CASE 2; newmem() -> Memory + CASE 3; openstackwin() -> Stack + CASE 4; openvarwin() -> Variables + ENDSELECT + CASE 2 + SELECT item + CASE 0; whatstep:=STEP_IN -> Step In + CASE 1; whatstep:=STEP_OVER -> Step Over + CASE 2; whatstep:=STEP_FOLLOW -> Step Follow + CASE 3; repeatstep() -> Repeat Step + CASE 4; watchvar() -> Watch Variable + CASE 5; breakpoint() -> Set Breakpoint on Sourceline + CASE 6; breakpointvar() -> Set Breakpoint on Memory + CASE 7; clearbreakpoints() -> Clear all Breakpoints + CASE 8; whatstep:=STEP_RUN -> Run to Breakpoint + CASE 9; raiseexception() -> Raise Exception + ENDSELECT + CASE 3 + SELECT item + CASE 0; evalexps() -> Eval E Expressions + CASE 1; modifyvar() -> Modify Variable + CASE 2; dwins.refresh() -> Refresh + CASE 3; search() -> Find in Source + CASE 4; offset() -> Locate Offset + ENDSELECT + CASE 4 + SELECT item + CASE 0; exe_arexx_cmd(rxs1) + CASE 1; exe_arexx_cmd(rxs2) + CASE 2; exe_arexx_cmd(rxs3) + ENDSELECT + ENDSELECT +ENDPROC + +PROC offset() + DEF v,r,i + IF easyguiA(reqtitle, + [ROWS, + [TEXT,'Enter offset to locate',NIL,FALSE,3], + [STR,1,'_Offset:',offstr,12,10,0,0,"o"], + [BAR], + [COLS, + [BUTTON,1,'_Locate',0,"l"], + [SPACEH], + [BUTTON,0,'_Cancel',0,"c"] + ] + ], + [EG_SCRN,scr,NIL]) + v,r:=Val(offstr) + IF r + v,r,i:=exe.findoffset(v) + IF v + showsrcwin(v,r) + IF i THEN Delay(6) BUT request13('This might actually be an', + 'E internal function, such', + 'as Char() or WriteF()','_Oh',"o") + ELSE + request1('No line for this offset','_Oh',"o") + ENDIF + ELSE + request1('Bad offset','_Oh',"o") + ENDIF + ENDIF +ENDPROC + +PROC handlekey(c) + IF c=77 THEN whatstep:=STEP_OVER ELSE IF c=78 THEN whatstep:=STEP_IN +ENDPROC + +PROC handlesrc(data,imsg:PTR TO intuimessage) + DEF cl,vx,vy + IF data THEN currentwin:=data + IF (cl:=imsg.class)=IDCMP_MENUPICK + handlemenu(imsg) + ELSEIF cl=IDCMP_RAWKEY + handlekey(imsg.code) + ELSEIF cl=IDCMP_MOUSEBUTTONS + IF imsg.code=SELECTUP + IF DoubleClick(lastsec,lastmic,imsg.seconds,imsg.micros) + vx,vy:=currentwin.scwin.where(imsg.mousex,imsg.mousey) + IF vx<>-1 THEN dovar(vx,vy,imsg.qualifier) + ELSE + lastsec:=imsg.seconds + lastmic:=imsg.micros + ENDIF + ENDIF + ENDIF +ENDPROC + +PROC handlevar(imsg:PTR TO intuimessage) + DEF cl,vx,vy + IF (cl:=imsg.class)=IDCMP_MENUPICK + handlemenu(imsg) + ELSEIF cl=IDCMP_RAWKEY + handlekey(imsg.code) + ELSEIF cl=IDCMP_MOUSEBUTTONS + IF vwin + vx,vy:=vwin.scwin.where(imsg.mousex,imsg.mousey) + IF imsg.code=SELECTDOWN + oldvy:=vy + ELSEIF imsg.code=SELECTUP + IF (vx<>-1) AND (oldvy=vy) THEN actionvar(vy) + oldvy:=-1 + ENDIF + ENDIF + ENDIF +ENDPROC + +PROC getvarval(var,send=FALSE) + DEF isglob,v,vptr,x,type=0,mess[256]:STRING,evar:PTR TO e_var + IF (x:=activewin.scwin.getactive())<>-1 + evar,isglob:=activewin.src.findvar(var,activewin.src.findproc(x)) + IF evar + IF type:=evar.regno + v:=frame.regs[type] + vptr:=0 + ELSEIF evar.offs + v:=Long(vptr:=frame.regs[IF isglob THEN 12 ELSE 13]+evar.offs) + type:=IF isglob THEN 2 ELSE 1 + ENDIF + IF send + x:=evar.type + StringF(mess,'[\s] \s',IF isglob THEN 'Global' ELSE 'Local', var) + IF x + StrAdd(mess,':PTR TO ') + StrAdd(mess,x) + ENDIF + SelectOutput(NIL) + IF sendExplorer(v,x,NIL,mess,TRUE)=FALSE + IF runExplorer()=0 + FOR send:=1 TO 20 + Delay(6) + EXIT isExplorerRunning() + ENDFOR + IF send<=20 + sendExplorer(v,x,NIL,mess,TRUE) + startExp:=TRUE + ENDIF + ENDIF + ENDIF + SelectOutput(ocon) + ENDIF + ENDIF + ENDIF +ENDPROC v,vptr,type + +PROC runExplorer() + DEF cmd[256]:STRING + StrCopy(cmd,IF explorer[] THEN explorer ELSE 'explorer') + IF pubname[] + StrAdd(cmd,' SCREEN="') + StrAdd(cmd,pubname) + StrAdd(cmd,'"') + ENDIF +ENDPROC SystemTagList(cmd,[SYS_ASYNCH,TRUE, SYS_INPUT,NIL, SYS_OUTPUT,NIL, NIL]) + +PROC dovar(vx,vy,qual) + DEF var[50]:STRING,v,vptr,reg=0 + vy:=currentwin.src.locate(vx,vy,var) + IF var[] THEN v,vptr,reg:=getvarval(var) + IF reg + addvar(var,qual AND 3) + ELSEIF vy>=0 + v:=request3('Put breakpoint here?','_OK','OK and _Run','_Cancel',"o","r","c") + IF v>0 + setbreak(currentwin.src.findpc(vy,exe)) + IF v>1 THEN whatstep:=STEP_RUN + ENDIF + ENDIF +ENDPROC + +PROC makefollow() + IF followgh=NIL + followgh:=guiinitA('** EDBG ** Following Execution ** Close Me to Stop! **', + [SPACEH], + [EG_LEFT,0, EG_TOP,0, EG_MAXW,TRUE, EG_SCRN,scr, + EG_WTYPE,WTYPE_NOSIZE, NIL]) + ENDIF +ENDPROC + +PROC removefollow() + IF followgh + cleangui(followgh) + followgh:=NIL + ENDIF +ENDPROC + +PROC step(fr:PTR TO stackframe) + DEF pc,src,i + IF repeatcount + repeatcount-- + IF repeatover + stepover(fr,fr.regs[13]) + ELSE + stepover() + ENDIF + ELSE + frame:=fr + IF stackwin THEN stackwin.addr:=fr.stack + pc:=fr.returnpc-2 + src,i,pc:=exe.findline(pc) + IF src=NIL + removefollow() + request13('Your program caused a guru!', + 'It may not be safe to continue running this program,', + 'you might even need to reboot!', + '_Oops!',"o") + -> Try it now with last known PC + src,i:=exe.findline(pc) + ENDIF + IF src THEN showsrcwin(src,i) + whatstep:=STEP_NONE + IF dorefresh THEN dwins.refresh() + IF followgh + WindowToFront(followgh.wnd) + ActivateWindow(followgh.wnd) + Delay(followspeed) + IF guimessage(followgh)<0 + stepover() + ELSE + removefollow() + ENDIF + ENDIF + IF followgh=NIL + IF first_step_done=FALSE + unreachablea7:=fr+100000 -> imp! beyond main stack level + first_step_done:=TRUE + exe_arexx_cmd('.edbg-startup.rexx') + IF doabout THEN Delay(6) BUT about() + ENDIF + REPEAT + Wait(-1) + srcmessage() + IF dwins THEN dwins.message() + rexxmessage() + toolmessage() + UNTIL whatstep + SELECT whatstep + CASE STEP_IN; stepover() + CASE STEP_OVER; stepover(fr,fr.regs[13]) + CASE STEP_RUN; stepover(unreachablea7,unreachablea7) + CASE STEP_THROW; stepover(); RETURN TRUE + CASE STEP_FOLLOW + makefollow() + stepover() + ENDSELECT + ENDIF + ENDIF +ENDPROC FALSE + +PROC srcmessage() + DEF s:PTR TO scrollwin, srcwin:PTR TO srcwin + WHILE s:=handleIDCMP(srcport) + srcwin:=s.data + END srcwin + ENDWHILE +ENDPROC + +/*--------------------------------------------------------------------*/ + +CONST TOOL_NUM=6,TOOL_ONEH=32,TOOL_W=37,TOOL_SP=2 +CONST TOOL_HEIGHT=TOOL_ONEH+TOOL_SP*TOOL_NUM-TOOL_SP +CONST TOOL_SIZE=TOOL_HEIGHT*12 + +PROC toolmessage() + DEF imsg:PTR TO intuimessage,cl + WHILE imsg:=GetMsg(toolwin.userport) + cl:=imsg.class + SELECT cl + CASE IDCMP_MENUPICK + handlemenu(imsg) + CASE IDCMP_GADGETUP + SELECT 7 OF imsg.iaddress::gadget.gadgetid + CASE 1; whatstep:=STEP_OVER + CASE 2; whatstep:=STEP_IN + CASE 3; newmem() + CASE 4; newreg() + CASE 5; openvarwin() + CASE 6; quit() + ENDSELECT + ENDSELECT + ReplyMsg(imsg) + ENDWHILE +ENDPROC + +PROC createtoolbar() + DEF m,i,a,b=1,gads=NIL:PTR TO gadget,aw,ah,al,at,ab,ar,wpos + wpos:=font.ysize+scr.wbortop+1 + al:=scr.wborleft+2 + at:=wpos+2 + ab:=scr.wborbottom+2 + ar:=scr.wborright+2 + aw:=al+ar+TOOL_W + ah:=at+ab+TOOL_HEIGHT + IF (toolgads:=List(TOOL_NUM))=NIL THEN Raise("MEM") + SetList(toolgads,TOOL_NUM) + CopyMem({tooldata},m:=NewM(TOOL_SIZE,2),TOOL_SIZE) + i:=[0,0,TOOL_W,TOOL_HEIGHT,2,m,%11,0,NIL]:image + MapList({a},toolgads,toolgads, + `gads:=NEW [gads,al,b-1*(TOOL_ONEH+TOOL_SP)+at,TOOL_W,TOOL_ONEH, + GFLG_GADGHCOMP,GACT_RELVERIFY,GTYP_BOOLGADGET, + NIL,NIL,NIL,0,NIL,b++,0]:gadget) + IF ForAll({a},toolgads,`a)=FALSE THEN Raise("MEM") + IF (toolwin:=OpenW(0,wpos,aw,Min(ah,ysize-wpos), + IDCMP_GADGETUP OR IDCMP_MENUPICK, + 6 OR WFLG_NEWLOOKMENUS,' Toolbar',scr,15,gads))=NIL THEN Raise("WIN") + DrawImage(toolwin.rport,i,al,at) + IF SetMenuStrip(toolwin,menu)=FALSE THEN Raise("MENU") + RefreshWindowFrame(toolwin) + Dispose(m) +ENDPROC + +PROC deletetoolbar() + IF toolwin THEN ClearMenuStrip(toolwin) + CloseW(toolwin) + toolwin:=NIL +ENDPROC + +tooldata: INCBIN 'pix/toolbar.raw' + +/*-----------------------------------------------------------------*/ + +aboutdata: INCBIN 'pix/about.raw' + +CONST ABOUT_SIZE=7872,ABOUT_HEIGHT=164,ABOUT_WIDTH=182 + +PROC about() + DEF m,i,win=NIL:PTR TO window,aw,ah,al,at,ab,ar + al:=scr.wborleft+2 + at:=font.ysize+scr.wbortop+1+2 + ab:=scr.wborbottom+2 + ar:=scr.wborright+2 + aw:=al+ar+ABOUT_WIDTH + ah:=at+ab+ABOUT_HEIGHT + CopyMem({aboutdata},m:=NewM(ABOUT_SIZE,2),ABOUT_SIZE) + i:=[0,0,ABOUT_WIDTH,ABOUT_HEIGHT,2,m,%11,0,NIL]:image + IF win:=OpenW(xsize-ABOUT_WIDTH/2,ysize-ABOUT_HEIGHT/2,aw,ah, + IDCMP_CLOSEWINDOW OR IDCMP_RAWKEY OR IDCMP_MOUSEBUTTONS,$100E,'About...',scr,15,NIL) + DrawImage(win.rport,i,al,at) + WaitIMessage(win) + CloseW(win) + ENDIF + Dispose(m) +ENDPROC + +/*-----------------------------------------------------------------*/ + +PROC request1(body,gadget,key) IS easyguiA(reqtitle,[ROWS,[TEXT,body,NIL,FALSE,3],[BAR],[BUTTON,0,gadget,0,key]],[EG_SCRN,scr,NIL]) +PROC request13(b1,b2,b3,gadget,key) IS easyguiA(reqtitle,[ROWS,[TEXT,b1,NIL,FALSE,3],[TEXT,b2,NIL,FALSE,3],[TEXT,b3,NIL,FALSE,3],[BAR],[BUTTON,0,gadget,0,key]],[EG_SCRN,scr,NIL]) +PROC request3(body,g1,g2,g3,k1,k2,k3) IS easyguiA(reqtitle,[ROWS,[TEXT,body,NIL,FALSE,3],[BAR],[COLS,[BUTTON,1,g1,0,k1],[SPACEH],[BUTTON,2,g2,0,k2],[SPACEH],[BUTTON,0,g3,0,k3]]],[EG_SCRN,scr,NIL]) + +PROC getmem() + DEF ok,s[100]:STRING,r,v,p + REPEAT + ok:=1 + r:=easyguiA(reqtitle, + [ROWS, + [TEXT,'Which memory location?',NIL,FALSE,3], + [STR,1,'_Addr:',s,100,10,0,0,"a"], + [COLS,[TEXT,'(Examples: 0,$0,var,{var})',NIL,FALSE,3],[BUTTON,{ehelp},'_Help',0,"h"]], + [BAR], + [COLS, + [BUTTON,1,'_OK',0,"o"], + [SPACEH], + [BUTTON,0,'_Cancel',0,"c"] + ] + ], + [EG_SCRN,scr,NIL]) + IF r + r,v:=extval(s) + IF r + IF TypeOfMem(v)=FALSE + ok:=request3('Not a valid ram-address','_Do it anyway','_Oops','_Cancel',"d","o","c") + ENDIF + ELSE + ok:=2 + ENDIF + ELSE + ok:=0 + ENDIF + UNTIL ok<2 +ENDPROC IF ok THEN v AND -2 ELSE -1 + +PROC extval(s) + DEF v + s,v:=exp(s) + IF s=0 THEN request1('Syntax Error in Expression','_Um',"u") +ENDPROC s,v + +PROC exp(s) + DEF v=0,o,v2 + s,v:=factor(s) + IF s + s:=whitesp(s) + WHILE o:=s[]++ + IF o=")" THEN RETURN s-1,v + s,v2:=factor(s) + IF s=0 THEN RETURN 0 + SELECT o + CASE "+"; v:=v+v2 + CASE "-"; v:=v-v2 + CASE "*"; v:=Mul(v,v2) + CASE "/"; v:=Div(v,v2) + DEFAULT; RETURN request1('Missing operator','_Oh',"o") + ENDSELECT + s:=whitesp(s) + ENDWHILE + ENDIF +ENDPROC s,v + +PROC factor(s) + DEF v,r,c,a,neg=FALSE + v,r:=Val(s) + IF r + s:=s+r + ELSE + s:=whitesp(s) + IF s[]="-" + s:=whitesp(s+1) + neg:=TRUE + ENDIF + IF s[]="\q" + s++ + a:=v:=0 + WHILE (c:=s[]++)<>"\q" + EXIT a++=4 + v:=Shl(v,8)+c + ENDWHILE + IF c<>"\q" THEN RETURN request1('Missing "','_Oh',"o") + ELSEIF s[]="{" + s++ + s:=whitesp(s) + s,r,v:=id(s,TRUE) + IF s + s:=whitesp(s) + IF s[]++<>"}" THEN RETURN request1('Missing "}"','_Oh',"o") + ENDIF + ELSEIF s[]="^" + s++ + s:=whitesp(s) + s,v:=id(s) + v:=^v + ELSEIF s[]="(" + s++ + s,v:=exp(s) + IF s THEN IF s[]++<>")" THEN RETURN request1('Missing ")"','_Oh',"o") + ELSE + s,v:=id(s) + ENDIF + ENDIF +ENDPROC s,IF neg THEN -v ELSE v + +PROC id(s,isaddr=FALSE) + DEF r,v,t,str[50]:STRING,c + WHILE (((c:=s[]++)>="a") AND (c<="z")) OR ((c>="A") AND (c<="Z")) OR (c="_") DO StrAdd(str,[c,0]:CHAR) + s-- + IF str[]=0 THEN RETURN 0 + v,r,t:=getvarval(str) + IF t=0 THEN RETURN request1('Unknown var','_Oops',"o") + IF isaddr THEN IF t>=3 THEN RETURN request13('You can''t take the address','of a register variable.','Recompile without OPTI/S or REG/K','_Sure',"s") +ENDPROC s,v,r + +PROC whitesp(s) + WHILE s[]=" " DO s++ +ENDPROC s + +PROC setprefs() + easyguiA('EDBG Preferences', + [ROWS, + [EQROWS, + [CHECK,{mdoabout},'_Show "About..." on startup',doabout,TRUE,0,"s"], + [CHECK,{mdorefresh},'_Refresh views each step',dorefresh,TRUE,0,"r"], + [CHECK,{mdowins},'Save _current window positions',dosavewindowpos,TRUE,0,"c"], + [CHECK,{mdovars},'Save _watched variable names',dosavevars,TRUE,0,"w"] + ], + [SLIDE,{mspeed},'Follow Delay (0.1sec): ',FALSE,0,30,followspeed/5,2,'%3ld'], + [BAR], + [EQROWS, + [STR,{dstr},'_Arexx script 1',rxs1,RXSTR_SIZE,4,0,0,"a"], + [STR,{dstr},'Arexx script 2',rxs2,RXSTR_SIZE,4], + [STR,{dstr},'Arexx script 3',rxs3,RXSTR_SIZE,4] + ], + [BAR], + [STR,{dstr},'_Explorer',explorer,RXSTR_SIZE,4,0,0,"e"], + [BAR], + [BUTTON,0,'_OK',0,"o"] + ], + [EG_SCRN,scr,NIL]) +ENDPROC + +PROC mdoabout(p,x) IS doabout:=x +PROC mdorefresh(p,x) IS dorefresh:=x +PROC mdowins(p,x) IS dosavewindowpos:=x +PROC mdovars(p,x) IS dosavevars:=x +PROC dstr(p,q) IS EMPTY +PROC mspeed(p,x) IS followspeed:=x*5 + +PROC saveprefs() + DEF fh,ofh,dw:PTR TO dbgwin,wv:PTR TO wvar,win:PTR TO window + IF fh:=Open('.edbg-startup.rexx',NEWFILE) + ofh:=SetStdOut(fh) + WriteF('/* generated by EDBG */\n\n/* address EDBG */\n\n') + IF doabout=FALSE THEN WriteF('''noabout''\n') + IF dorefresh=FALSE THEN WriteF('''norefresh''\n') + IF dosavewindowpos + dw:=dwins + WHILE dw + IF dw.type=T_VAR + win:=dw::varwin.scwin.window + WriteF('''variables \d \d \d \d''\n',win.leftedge,win.topedge,win.width,win.height) + ELSEIF dw.type=T_MEM + WriteF('''memory \d''\n',dw::memwin.addr) + ELSEIF dw.type=T_SRC + win:=dw::srcwin.scwin.window + WriteF('''srcwindow \s \d \d \d \d''\n',dw::srcwin.src.name(),win.leftedge,win.topedge,win.width,win.height) + ENDIF + dw:=dw.next + ENDWHILE + ENDIF + IF dosavevars + IF vars.tailpred<>vars + WriteF('''watch') + iterate_exec_list({wv},vars,`WriteF(' \s',wv.v)) + WriteF('''\n') + ENDIF + ENDIF + IF explorer[] THEN WriteF('''explorer \s''\n',explorer) + IF rxs1[] THEN WriteF('''rexx 1 \s''\n',rxs1) + IF rxs2[] THEN WriteF('''rexx 2 \s''\n',rxs2) + IF rxs3[] THEN WriteF('''rexx 3 \s''\n',rxs3) + SetStdOut(ofh) + Close(fh) + ELSE + request1('Unable to write prefs','_Hmmm...',"h") + ENDIF +ENDPROC + +PROC choose_source() HANDLE + DEF l,s:PTR TO e_source,a=0,num=-1 + s:=exe.sources() + l:=newlist() + WHILE s + AddTail(l,newnode(NIL,s.name())) + s:=s.next() + ENDWHILE + easyguiA(reqtitle, + [EQROWS, + [LISTV,{sourcenum},'Select Source:',12,5,l,FALSE,0,0], + [BAR], + [COLS,[SPACEH],[BUTTON,0,'_Cancel',0,"c"],[SPACEH]] + ], + [EG_INFO,{num}, EG_SCRN,scr, NIL]) +EXCEPT DO + IF num>=0 + s:=exe.sources() + WHILE s + EXIT a++=num + s:=s.next() + ENDWHILE + IF s THEN showsrcwin(s) + ENDIF +ENDPROC + +PROC sourcenum(i,n) + ^i:=n + Raise() +ENDPROC + +PROC rexxmessage() + DEF mes,rexxstr + IF rexxport + WHILE TRUE + mes,rexxstr:=rx_GetMsg(rexxport) + EXIT mes=NIL + rexxcontinue(rexxstr,mes) + ENDWHILE + ENDIF +ENDPROC + +PROC rexxcontinue(rexxstr,mes) HANDLE -> called from other spots too + DEF rc=0,rstr=NIL + rc,rstr:=processcmd(rexxstr) +EXCEPT DO + rx_ReplyMsg(mes,rc,rstr) + ReThrow() +ENDPROC + +PROC getword(s,dest) + DEF b,c + LOOP + SELECT 256 OF c:=s[]++ + CASE 0; request1('Argument to Arexx command expected','_Oh',"o"); Raise() + CASE " ", "\t" + CASE 33 TO 255 + b:=s-1 + WHILE (s[]>" ") AND (s[]<=255) DO s++ + StrCopy(dest,b,s-b) + WHILE (s[]=" ") OR (s[]="\t") DO s++ + RETURN s + DEFAULT + request1('Garbage in Arexx command','_Oh',"o"); Raise() + ENDSELECT + ENDLOOP +ENDPROC + +PROC getexp(s) + DEF v,dest[250]:STRING,sr + s:=getword(s,dest) + sr,v:=extval(dest) + IF sr=NIL THEN Raise() +ENDPROC s,v + +PROC processcmd(s) + DEF rc=0,rstr=NIL,ts[250]:STRING,a,b,esrc=NIL:PTR TO e_source,w:PTR TO memwin,vptr,type + s:=getword(s,ts) + UpperStr(ts) + IF StrCmp(ts,'QUIT') + quit() + ELSEIF StrCmp(ts,'RUN') + whatstep:=STEP_RUN + ELSEIF StrCmp(ts,'MEMORY') + s,a:=getexp(s) + NEW w.memwin(a,T_MEM) + ELSEIF StrCmp(ts,'EXPLORER') + s:=getword(s,explorer) + ELSEIF StrCmp(ts,'REXX') + s,a:=getexp(s) + IF a=1 + s:=getword(s,rxs1) + ELSEIF a=2 + s:=getword(s,rxs2) + ELSEIF a=3 + s:=getword(s,rxs3) + ENDIF + ELSEIF StrCmp(ts,'VARIABLES') + s,fx:=getexp(s) + s,fy:=getexp(s) + s,fxs:=getexp(s) + s,fys:=getexp(s) + openvarwin() + ELSEIF StrCmp(ts,'STEPIN') + whatstep:=STEP_IN + ELSEIF StrCmp(ts,'STEPOVER') + whatstep:=STEP_OVER + ELSEIF StrCmp(ts,'WATCH') + WHILE s[] + s:=getword(s,ts) + addvar(ts) + ENDWHILE + ELSEIF StrCmp(ts,'BREAKPOINT') + s,a:=getexp(s) + setbreak(currentwin.src.findpc(a,exe)) + ELSEIF StrCmp(ts,'EVAL') + s,rc:=getexp(s) + ELSEIF StrCmp(ts,'MEMORYBREAKPOINT') + s,a:=getexp(s) + setmembreak(a) + ELSEIF StrCmp(ts,'RAISE') + s,a:=getexp(s) + s,b:=getexp(s) + setthrow(a,b) + whatstep:=STEP_THROW + ELSEIF StrCmp(ts,'SRCWINDOW') + s:=getword(s,ts) + s,fx:=getexp(s) + s,fy:=getexp(s) + s,fxs:=getexp(s) + s,fys:=getexp(s) + IF esrc:=exe.sources() THEN esrc:=esrc.findsrc(ts) + IF esrc THEN showsrcwin(esrc) + ELSEIF StrCmp(ts,'NOABOUT') + doabout:=FALSE + ELSEIF StrCmp(ts,'NOREFRESH') + dorefresh:=FALSE + ELSEIF StrCmp(ts,'ASSIGN') + s:=getword(s,ts) + s,a:=getexp(s) + b,vptr,type:=getvarval(ts) + SELECT 8 OF type + CASE 3 TO 7 + frame.regs[type]:=a + CASE 1,2 + ^vptr:=a + ENDSELECT + ELSE + request13('Unknown Arexx command:',ts,'received','_Really?',"r") + s:='' + ENDIF + IF s[] THEN request13('Superfluous arguments:',ts,'in Arexx command','_Really?',"r") +ENDPROC rc,rstr + +PROC exe_arexx_cmd(cmdstr) HANDLE -> either a file name or a quoted string + DEF rexx,rmsg=NIL:PTR TO rexxmsg,rarg=NIL,forb,noreply=TRUE,rrmsg:PTR TO rexxmsg,cstr + rexxsysbase:=NIL + Forbid(); forb:=TRUE + IF (rexx:=FindPort('REXX'))=NIL THEN Raise() + IF (rexxsysbase:=OpenLibrary('rexxsyslib.library',0))=NIL THEN Raise() + IF (rmsg:=CreateRexxMsg(rexxport,'rexx',rexxname))=NIL THEN Raise() + IF (rarg:=CreateArgstring(cmdstr,StrLen(cmdstr)))=NIL THEN Raise() + rmsg.args[0]:=rarg + rmsg.action:=RXCOMM + PutMsg(rexx,rmsg) + Permit(); forb:=FALSE + WriteF('executing script \s\n',cmdstr) + WHILE noreply + Wait(-1) + WHILE TRUE + rrmsg,cstr:=rx_GetMsg(rexxport) + EXIT rrmsg=NIL + IF rrmsg::ln.type=NT_REPLYMSG + WriteF('done with script \s\n',cmdstr) + noreply:=FALSE + ELSE + rexxcontinue(cstr,rrmsg) + ENDIF + ENDWHILE + ENDWHILE +EXCEPT DO + IF forb THEN Permit() + IF rarg THEN DeleteArgstring(rarg) + IF rmsg THEN DeleteRexxMsg(rmsg) + IF rexxsysbase THEN CloseLibrary(rexxsysbase) +ENDPROC + +CHAR 0, '$VER: EDBG 3.3a', 0, 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/eexe.e b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/eexe.e new file mode 100644 index 0000000..906c464 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/eexe.e @@ -0,0 +1,498 @@ +/* E executable load and debug objects + +probs: all that uses task-structure +- Forbid(): broken by debugger? +etc. + +*/ + +OPT MODULE + +MODULE 'exec/tasks', 'dos/doshunks' +MODULE 'tools/file' + +/*---------------load-e-exe-functions------------------*/ + +EXPORT OBJECT e_exe PRIVATE + file,code,codelen,sources:PTR TO e_source +ENDOBJECT + +EXPORT OBJECT e_source PRIVATE + next:PTR TO e_source + lines:PTR TO LONG,numlines -> of LINEDEBUG info + sourcename,source + procs:PTR TO e_proc + globs:PTR TO e_var + sourcelines:PTR TO LONG +ENDOBJECT + +PROC sources() OF e_exe IS self.sources +PROC next() OF e_source IS self.next +PROC name() OF e_source IS self.sourcename +PROC lines() OF e_source IS self.sourcelines + +OBJECT e_proc PRIVATE + next:PTR TO e_proc + name:PTR TO CHAR + firstvarline + vars:PTR TO e_var +ENDOBJECT + +EXPORT OBJECT e_var PRIVATE + next:PTR TO e_var + name:PTR TO CHAR +PUBLIC + regno:INT,offs:INT -> if 0 then other + type:PTR TO CHAR +ENDOBJECT + +PROC findsrc(name) OF e_source + WHILE self + IF StrCmp(self.sourcename,name) THEN RETURN self + self:=self.next + ENDWHILE +ENDPROC NIL + +PROC locate(vx,vy,var) OF e_source + DEF l,l2,c + IF (vy<0) OR (vy>=ListLen(self.sourcelines)) + vy:=-1 + ELSE + l:=self.sourcelines[vy] + vx:=Bounds(vx,0,StrLen(l)) + l:=l+vx + IF isalnum(l[]) + l2:=l + WHILE isalnum(l[-1]) DO l-- + WHILE isalnum(l2[]) DO l2++ + IF ((c:=l[])>="_") AND (c<="z") THEN StrCopy(var,l,l2-l) + ENDIF + ENDIF +ENDPROC vy + +PROC isalnum(c) IS ((c>="A") AND (c<="Z")) OR ((c>="_") AND (c<="z")) OR ((c>="0") AND (c<="9")) + +PROC findproc(linenum) OF e_source + DEF pr:PTR TO e_proc + pr:=self.procs + WHILE pr + EXIT IF pr.vars THEN pr.firstvarline<=linenum ELSE FALSE + pr:=pr.next + ENDWHILE +ENDPROC pr + +PROC findvar(name,pr=NIL:PTR TO e_proc) OF e_source + DEF var=NIL:PTR TO e_var,isglob=FALSE + IF pr THEN var:=lookupvar(pr.vars,name) + IF var=NIL THEN (isglob:=TRUE) BUT var:=lookupvar(self.globs,name) +ENDPROC var,isglob + +PROC lookupvar(v:PTR TO e_var,name) + WHILE v + IF StrCmp(v.name,name) THEN RETURN v + v:=v.next + ENDWHILE +ENDPROC NIL + +PROC grabvarinfo(src:PTR TO e_source,o:PTR TO INT,end) + DEF pr=NIL:PTR TO e_proc,job,v + WHILE (job:=o[]++) BUT oWriteF('\nPROC \s:',o) + pr.name:=o + pr.firstvarline:=-1 + pr.next:=src.procs -> in reverse order, for line-search + src.procs:=pr + o:=o+v + CASE 5 + v:=o[]++ + newself(pr,o[],o[1]) + o:=o+v + DEFAULT + Raise("eexe") + ENDSELECT + ENDWHILE +->WriteF('\n') +ENDPROC + +CONST REGVARLIM=30000 + +PROC newself(pr:PTR TO e_proc,linenum,b) + DEF i,t + IF (i:=InStr(pr.name,':'))=-1 THEN Raise("eexe") + i++ + NEW t[i] + AstrCopy(t,pr.name,i) + pr.vars:=NEW [pr.vars,'self',IF b>=REGVARLIM THEN b-REGVARLIM ELSE 0, + IF b>=REGVARLIM THEN 0 ELSE b,t]:e_var + pr.firstvarline:=linenum +->WriteF('new self "\s"\n',t) +ENDPROC + +PROC collectvars(o:PTR TO INT,varlist,src:PTR TO e_source,pr:PTR TO e_proc,job) + DEF line,v:PTR TO e_var,num,a,b,s:PTR TO CHAR,st,t + v:=varlist + line:=o[]++ + s:=src.sourcelines[line] + num:=o[]++ + IF pr THEN IF pr.firstvarline<0 THEN pr.firstvarline:=line + FOR a:=1 TO num + b:=o[]++ + v:=NEW [v,NIL,IF b>=REGVARLIM THEN b-REGVARLIM ELSE 0,IF b>=REGVARLIM THEN 0 ELSE b,NIL]:e_var +->WriteF(' $\h ',b) + IF (a=1) AND (job=1) THEN WHILE s[]++<>"(" DO NOP + IF a>1 THEN WHILE s[]++<>"," DO NOP + WHILE ((b:=s[])<"_") OR (b>"z") DO s++ + st:=s + REPEAT + s++ + UNTIL isalnum(s[])=FALSE + b:=s-st+1 + NEW t[b] + AstrCopy(t,st,b) +->WriteF('(\s)',t) + v.name:=t + t:=FALSE + WHILE (b:=s[]) AND (b<>",") + EXIT t:=((b>="_") AND (b<="z")) + s++ + ENDWHILE + IF t + st:=s + REPEAT + s++ + UNTIL isalnum(s[])=FALSE + b:=s-st+1 + NEW t[b] + AstrCopy(t,st,b) + v.type:=t + ENDIF + ENDFOR +ENDPROC o,v + +PROC load(name) OF e_exe + DEF o:PTR TO LONG,l,cl,c,dbl,numrel,a,b:PTR TO LONG,src=NIL:PTR TO e_source,add + + -> read exe + + o,l:=readfile(name,0) + self.file:=o + + -> eat header + + IF (o[]++<>HUNK_HEADER) OR (o[]++<>0) OR (o[]++<>1) OR (o[]++<>0) OR (o[]++<>0) THEN Raise("eexe") + o++ + + -> eat code hunk + + IF o[]++<>HUNK_CODE THEN Raise("eexe") + self.codelen:=cl:=o[]++*4 + self.code:=c:=o + o:=o+cl + + -> eat and digest reloc + + IF o[]++<>HUNK_RELOC32 THEN Raise("eexe") + numrel:=o[]++ + IF o[]++<>0 THEN Raise("eexe") + IF numrel + FOR a:=1 TO numrel -> do own reloc! + b:=c+o[]++ + b[]:=b[]+c + ENDFOR + ENDIF + IF o[]++<>0 THEN Raise("eexe") + + -> skip symbol hunk if necessary + + IF o[]=HUNK_SYMBOL + o++ + WHILE a:=o[]++ DO o:=a*4+o+4 + ENDIF + + -> eat debug hunks + + IF o[]<>HUNK_DEBUG THEN Raise("eexd") + + WHILE (a:=o[]++)<>HUNK_END + IF a=HUNK_DEBUG + IF o[2]="EVAR" + IF src=NIL THEN Raise("eexe") + dbl:=o[]++ + grabvarinfo(src,o+8,o:=dbl*4+o) + ELSE + NEW src + dbl:=o[]++ + IF (o[]++<>0) THEN Raise("eexe") + IF o[]="LINE" + add:=0 + ELSEIF Char(o)="L" + add:=o[] AND $FFFFFF + ELSE + Raise("eexe") + ENDIF + o++ + src.numlines:=dbl:=dbl-(a:=o[]++)-3 + src.sourcename:=o + o:=a*4+o + src.lines:=o + make_illegal(c,o,dbl,add) + o:=dbl*4+o + src.next:=self.sources + self.sources:=src + src.load() + src.globs:=add_globs(src.globs) + ENDIF + ELSE + Raise("eexe") + ENDIF + ENDWHILE + + CacheClearU() -> important! + +ENDPROC + +PROC new_var(v,s,off,type=NIL) IS NEW [v,s,0,off,type]:e_var + +PROC add_globs(v) + v:=new_var(v,'stdout', -$8) + v:=new_var(v,'conout', -$C) + v:=new_var(v,'stdrast', -$10, 'rastport') + v:=new_var(v,'arg', -$20) + v:=new_var(v,'wbmessage', -$24, 'wbstartup') + v:=new_var(v,'execbase', -$28, 'execbase') + v:=new_var(v,'dosbase', -$2C, 'doslibrary') + v:=new_var(v,'intuitionbase',-$30, 'intuitionbase') + v:=new_var(v,'gfxbase', -$34, 'gfxbase') + v:=new_var(v,'exception', -$54) + v:=new_var(v,'stdin', -$5C) + v:=new_var(v,'exceptioninfo',-$60) +ENDPROC v + +CONST OPCODE_NOP=$4E71, OPCODE_ILLEGAL=$4AFC + +PROC make_illegal(code,dbg:PTR TO LONG,len,add) + DEF a,b:PTR TO INT + IF len + FOR a:=1 TO len STEP 2 + dbg++ + dbg[]++:=b:=dbg[]+add + b:=b+code + IF b[]<>OPCODE_NOP THEN Raise("eexd") + b[]:=OPCODE_ILLEGAL + ENDFOR + ENDIF +ENDPROC + +PROC end() OF e_exe + DEF p:PTR TO e_source + IF self.file THEN freefile(self.file) + p:=self.sources + END p +ENDPROC + +PROC load() OF e_source + DEF m,l,a,p + m,l:=readfile(self.sourcename) + self.source:=m + self.sourcelines:=stringsinfile(m,l,countstrings(m,l)) + p:=m + FOR a:=1 TO l DO IF p[]++="\t" THEN p[-1]:=" " +ENDPROC + +PROC end() OF e_source + DEF n:PTR TO e_source + n:=self.next + IF self.source THEN freefile(self.source) + END n +ENDPROC + +PROC findline(pc) OF e_exe + DEF l:PTR TO e_source,a,b,dbg:PTR TO LONG,num,c + l:=self.sources + c:=self.code + WHILE l + dbg:=l.lines + num:=l.numlines-1 + FOR a:=0 TO num STEP 2 + b:=dbg[]++-1 + IF dbg[]+++c=pc THEN RETURN l,b + ENDFOR + l:=l.next + ENDWHILE + MOVE.L lastpc(PC),a +ENDPROC NIL,NIL,a + +CONST STARTUP_SIZE=$196 + +PROC findoffset(off) OF e_exe + DEF l:PTR TO e_source,a,b,dbg:PTR TO LONG,num,best=0,src=NIL,line,start=0,largest=0 + IF (off<0) OR (off>=self.codelen) THEN RETURN NIL + l:=self.sources + WHILE l + dbg:=l.lines + num:=l.numlines-1 + IF largestbest + best:=dbg[] + line:=b + src:=l + ENDIF + dbg++ + ENDFOR + l:=l.next + ENDWHILE + IF (off(largest+8) + best:=TRUE + ELSE + best:=FALSE + ENDIF +ENDPROC src,line,best + +PROC findpc(line,exe:PTR TO e_exe) OF e_source + DEF a,dbg:PTR TO LONG,num,c + c:=exe.code + dbg:=self.lines + num:=self.numlines-1 + FOR a:=0 TO num STEP 2 DO IF dbg[]++-1=line THEN RETURN dbg[]+c ELSE dbg++ +ENDPROC NIL + +PROC edebug(do_at_break,cli_arg) OF e_exe + DEF mytask:PTR TO tc,code,alen + alen:=StrLen(cli_arg)+1 + mytask:=FindTask(NIL) + mytask.trapcode:={tcode} + LEA codejmp(PC),A0 + MOVE.L do_at_break,(A0) + LEA debuga4(PC),A0 + MOVE.L A4,(A0) + code:=self.code + MOVEM.L D0-D7/A0-A6,-(A7) + MOVE.L cli_arg,A0 + MOVE.L alen,D0 + MOVE.L code,A1 + JSR (A1) + MOVEM.L (A7)+,D0-D7/A0-A6 +ENDPROC + +EXPORT OBJECT stackframe PUBLIC + status:LONG + regs[15]:ARRAY OF LONG + returnpc:LONG + stack[1]:ARRAY OF LONG -> from here on +ENDOBJECT + +tcode: + CMP.L #3,(A7) + MOVEM.L A0,(A7) -> yeah! keep flags! + BGT.S noadjust + MOVE.L $4.W,A0 + BTST #0,297(A0) + BNE.S noadjust + MOVE.L (A7),8(A7) -> for 68000 long-format frames + ADDQ.L #8,A7 +noadjust: + LEA continue(PC),A0 -> finish superstate + MOVE.L 6(A7),-4(A0) + MOVE.W 4(A7),-6(A0) + MOVE.L A0,6(A7) + MOVE.L (A7)+,A0 + RTE + + LONG 0 +pcstore: + LONG 0 +continue: + SUBQ.L #4,A7 -> make space for return + MOVEM.L D0-D7/A0-A6,-(A7) + LEA continue(PC),A0 -> pc,sr on the stack + MOVE.L -(A0),D0 + MOVE.L -(A0),-(A7) + ADDQ.L #2,D0 + MOVE.L D0,64(A7) -> prepare return pc + + MOVE.L breakpoint(PC),D0 -> check for breakpoint + BEQ.S nobreak + CMP.L pcstore(PC),D0 + BEQ.S stophere + +nobreak: + MOVE.L breakpointmem(PC),D0 -> check for breakpoint on mem + BEQ.S nomembreak + MOVE.L D0,A0 + MOVE.L (A0),D0 + CMP.L memval(PC),D0 + BNE.S stophere + +nomembreak: + MOVE.L stepovera7(PC),D0 -> check for step over + BEQ.S stophere + CMPA.L stepovera5(PC),A5 + BEQ.S stophere + CMPA.L D0,A7 -> we compare TOP of frame, not actual A7 + BMI.S dontstop + +stophere: + MOVE.L debuga4(PC),A4 -> restore A4 + MOVE.L A7,-(A7) + MOVE.L codejmp(PC),A0 + JSR (A0) -> call E func with frame + ADDQ.L #4,A7 + TST.L D0 -> see if we need to raise an exception + BNE.S raise + +dontstop: + MOVE.L pcstore(PC), D0 + LEA lastpc(PC), A0 + MOVE.L D0, (A0) + MOVE.L (A7)+,D0 + MOVEQ #-1,D1 + MOVE.L $4.W,A6 + JSR -144(A6) -> SetSr(orig_sr,$FF) + MOVEM.L (A7)+,D0-D7/A0-A6 -> hold SR! + RTS -> retpc is on top! + +raise: + ADDQ.L #4,A7 -> remove sr + MOVEM.L (A7)+,D0-D7/A0-A6 -> registers back + MOVE.L exc(PC),-84(A4) -> fill programs' exception(-info) + MOVE.L excinfo(PC),-96(A4) + ReThrow() + +codejmp: LONG 0 +debuga4: LONG 0 + +stepovera7: LONG 0 +stepovera5: LONG 0 + +breakpoint: LONG 0 -> 0=no break, -1=run, other=break +breakpointmem: LONG 0 -> 0=no break, other=memaddress +memval: LONG 0 -> value for breakpointmem + +exc: LONG 0 +excinfo: LONG 0 + +-> Last known PC +lastpc: LONG 0 + +EXPORT PROC stepover(a7=NIL,a5=NIL) IS PutLong({stepovera7},a7) BUT PutLong({stepovera5},a5) +EXPORT PROC setbreak(a) IS PutLong({breakpoint},a) +EXPORT PROC setmembreak(a) IS PutLong({breakpointmem},a) BUT PutLong({memval},IF a THEN Long(a) ELSE NIL) +EXPORT PROC setthrow(e,ei) IS PutLong({exc},e) BUT PutLong({excinfo},ei) diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/about.iff2 b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/about.iff2 new file mode 100644 index 0000000..6750821 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/about.iff2 differ diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/about.raw b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/about.raw new file mode 100644 index 0000000..8907b19 Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/about.raw differ diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/toolbar.iff b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/toolbar.iff new file mode 100644 index 0000000..f3e4a2f Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/toolbar.iff differ diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/toolbar.raw b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/toolbar.raw new file mode 100644 index 0000000..e8fd0be Binary files /dev/null and b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/pix/toolbar.raw differ diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/schex.e b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/schex.e new file mode 100644 index 0000000..016f2e2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/schex.e @@ -0,0 +1,55 @@ +-> a memory-display window based on scrollwin + +OPT MODULE + +MODULE 'class/sc','intuition/intuition','graphics/rastport', + 'graphics/gfxbase','graphics/text' + +EXPORT OBJECT scrollhex OF scrollwin PRIVATE + addr,font:PTR TO textfont,osx,osy +ENDOBJECT + +CONST ONELINE=50 + +PROC setmem(addr) OF scrollhex + self.addr:=addr +ENDPROC + +PROC extra_refresh(x,y,xs,ys,xoff,yoff,win:PTR TO window) OF scrollhex + DEF fx,fy,a,b,c,d,e,ad,base,r:PTR TO rastport,bot,rnum,addr:PTR TO LONG,s[200]:ARRAY,t[10]:STRING + r:=stdrast:=win.rport + fx:=self.font.xsize + fy:=self.font.ysize + SetFont(r,self.font) + base:=self.font.baseline + bot:=win.height-win.borderbottom-1 + r.mask:=1 + IF (self.osx<>xs) OR (self.osy<>ys) THEN Box(xoff,yoff,win.width-win.borderright-1,bot,0) + Colour(1) + rnum:=Bounds(Abs(xs-13)/13,1,12) + addr:=rnum*4*y+self.addr AND -2 + FOR a:=1 TO ys + StringF(s,'\z\h[8]: ',addr) + ad:=addr + FOR b:=1 TO rnum DO StrAdd(s,StringF(t,'\z\h[8] ',addr[]++)) + StrAdd(s,' "') + c:=EstrLen(s) + e:=rnum*4+c-1 + FOR b:=c TO e DO s[b]:=IF ((d:=ad[]++)>31) AND (d<127) THEN d ELSE "." + SetStr(s,e+1) + StrAdd(s,'"') + Move(r,xoff,a-1*fy+yoff+base) + Text(r,s,Min(xs,StrLen(s))) + ENDFOR + self.osx:=xs + self.osy:=ys +ENDPROC + +PROC extra_init(screen) OF scrollhex + DEF gb:PTR TO gfxbase + gb:=gfxbase + self.font:=gb.defaultfont -> needs openfont? +ENDPROC + +PROC extra_unit() OF scrollhex IS self.font.xsize, self.font.ysize +PROC extra_max() OF scrollhex IS 1,1000 diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/screg.e b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/screg.e new file mode 100644 index 0000000..86226ad --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/screg.e @@ -0,0 +1,59 @@ +-> screg.e + +OPT MODULE + +MODULE '*sctext', '*eexe' + +EXPORT OBJECT scrollreg OF scrolltext PRIVATE + txt:PTR TO LONG, frame:stackframe +ENDOBJECT + +CONST LIST_SIZE=20 + +PROC scrollreg(stackframe:PTR TO stackframe) OF scrollreg + DEF m:PTR TO LONG,x + IF (m:=List(LIST_SIZE))=NIL THEN Raise("MEM") + SetList(m,LIST_SIZE) + self.txt:=m + MapList({x},m,m,`String(13)) + IF ForAll({x},m,`x)=FALSE THEN Raise("MEM") + copyframe(stackframe,self.frame) + pokeregs(m,stackframe,self.frame) + self.settext(m,13) +ENDPROC + +PROC copyframe(st:PTR TO stackframe,old:PTR TO stackframe) + CopyMem(st,old,SIZEOF stackframe-4) + old.stack[]:=st.stack +ENDPROC + +SET C, V, Z, N, X + +CONST S=$2000, T=$8000, I=$0E00 + +PROC pokeregs(t:PTR TO LONG,st:PTR TO stackframe,old:PTR TO stackframe) + DEF a, b, regs:PTR TO LONG + regs:=old.regs + FOR a:=0 TO 7 DO StringF(t[a],'D\d=$\z\h[8]\c',a,b:=st.regs[a],IF b=regs[a] THEN " " ELSE "*") + FOR a:=0 TO 6 DO StringF(t[a+9],'A\d=$\z\h[8]\c',a,b:=st.regs[a+8],IF b=regs[a+8] THEN " " ELSE "*") + StringF(t[16],'A7=$\z\h[8]\c',b:=st.stack,IF b=old.stack[] THEN " " ELSE "*") + StringF(t[18],'PC=$\z\h[8]\c',b:=st.returnpc,IF b=old.returnpc THEN " " ELSE "*") + b:=st.status + StringF(t[19],'ST=\c\c\c\c\c\c\c\c\c\c', + IF b AND T THEN "T" ELSE " ", + IF b AND S THEN "S" ELSE " ", + IF a:=Shr(b AND I,9) THEN "I" ELSE " ", + IF a THEN "0"+a ELSE " ", + IF b AND X THEN "X" ELSE " ", + IF b AND N THEN "N" ELSE " ", + IF b AND Z THEN "Z" ELSE " ", + IF b AND V THEN "V" ELSE " ", + IF b AND C THEN "C" ELSE " ", + IF b=old.status THEN " " ELSE "*") + copyframe(st,old) +ENDPROC + +PROC refreshreg(stackframe:PTR TO stackframe) OF scrollreg + pokeregs(self.txt,stackframe,self.frame) + self.refreshwindow() +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/sctext.e b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/sctext.e new file mode 100644 index 0000000..15af3ae --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/EDBG/sctext.e @@ -0,0 +1,107 @@ +-> implementation of textscrollerwindow class, subclass of scrollwin + +OPT MODULE + +MODULE 'class/sc' +MODULE 'intuition/intuition', 'intuition/screens', + 'graphics/rastport', 'graphics/gfxbase', 'graphics/text' + +EXPORT OBJECT scrolltext OF scrollwin PRIVATE + font:PTR TO textfont + lines, cols + tlist:PTR TO LONG + ox,oy,oxs,oys + current,ocurrent,curvis +ENDOBJECT + +PROC settext(textlist,width) OF scrolltext + self.lines:=ListLen(textlist) + self.cols:=width + self.tlist:=textlist + self.current:=-1 + self.ocurrent:=-1 + self.curvis:=FALSE +ENDPROC + +PROC refreshwindow() OF scrolltext + self.ox:=0 + self.oy:=0 + self.oxs:=0 + self.oys:=0 + SUPER self.refreshwindow() +ENDPROC + +PROC getactive() OF scrolltext IS self.current + +PROC active(cur,dorefresh=TRUE) OF scrolltext + self.current:=cur + IF dorefresh THEN IF (cur=0) AND self.curvis + a:=a-self.oy*fy+yoff + ClipBlit(r,xoff,a,r,xoff,a,xs*fx,fy,$50) + self.curvis:=FALSE + ENDIF + ny:=y; nys:=ys + IF (self.ox=x) AND (self.oxs=xs) AND (self.oys=ys) + IF (a:=self.oy-y)<>0 + IF ys>Abs(a) -> only max half display + IF a>0 -> scroll up + ClipBlit(r,xoff,yoff,r,xoff,a*fy+yoff,xs*fx,(b:=ys-a)*fy,$C0) + ys:=a + bot:=a*fy+yoff-1 + ELSE -> scroll down + a:=Abs(a) + ClipBlit(r,xoff,a*fy+yoff,r,xoff,yoff,xs*fx,(b:=ys-a)*fy,$C0) + y:=y+b + yoff:=b*fy+yoff + ys:=a + ENDIF + ENDIF + ELSE + de:=FALSE + ENDIF + ENDIF + IF de + Box(xoff,yoff,win.width-win.borderright-1,bot,0) + Colour(1) + FOR a:=0 TO ys-1 + yc:=a*fy+yoff + s:=IF a+y=0 + IF (a>=ny) AND (ny+nys>a) + a:=a-y*fy+yoff + ClipBlit(r,xoff,a,r,xoff,a,xs*fx,fy,$50) + self.curvis:=TRUE + ENDIF + ENDIF + self.ox:=x + self.oy:=ny + self.oxs:=xs + self.oys:=nys + self.ocurrent:=self.current +ENDPROC + +PROC extra_init(screen:PTR TO screen) OF scrolltext + DEF gb:PTR TO gfxbase + gb:=gfxbase + self.font:=gb.defaultfont -> needs openfont? +ENDPROC + +PROC extra_unit() OF scrolltext IS self.font.xsize, self.font.ysize +PROC extra_max() OF scrolltext IS self.cols, self.lines diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/FindString13.e b/amigae33a/E_v3.3a/Src/Src/Utils/FindString13.e new file mode 100644 index 0000000..5739eef --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/FindString13.e @@ -0,0 +1,360 @@ +OPT OSVERSION=37 + +MODULE 'tools/async', + 'tools/ctype', + 'tools/easygui', + 'amigalib/lists', + 'dos/dos', + 'exec/lists', + 'exec/nodes', + 'intuition/intuition', + 'libraries/asl', + 'asl' + +ENUM ERR_NONE, ERR_ADOS, ERR_ASL, ERR_EXAM, ERR_EXNEXT, ERR_GUI, + ERR_LIB, ERR_LOCK, ERR_OPEN, ERR_PATT, ERR_QUIT, ERR_STOP, + ERR_STR, NUM_ERRS + +RAISE ERR_ADOS IF AllocDosObject()=NIL, + ERR_ASL IF AllocAslRequest()=NIL, + ERR_EXAM IF Examine()=FALSE, + ERR_LIB IF OpenLibrary()=NIL, + ERR_LOCK IF Lock()=NIL, + ERR_PATT IF ParsePattern()=-1, + ERR_PATT IF ParsePatternNoCase()=-1, + ERR_STR IF String()=NIL + +CONST MAXSTR=100, BUFFERSIZE=1000 + +CONST MAXPATT=MAXSTR*2+2 + +-> String gadgets +DEF xfindstr[MAXSTR]:STRING, xdirstr[MAXSTR]:STRING, + findstr[MAXSTR]:STRING, dirstr[MAXSTR]:STRING, + findgad, dirgad, + xfpattstr[MAXSTR]:STRING, fpattstr[MAXSTR]:STRING, fpattgad, + fpattbuff[MAXPATT]:STRING + +-> Other gadgets +DEF reslist=NIL:PTR TO lh, resgad, gogad, + xrec=TRUE, xcase=TRUE, xword=FALSE, xbrief=FALSE, + rec, case, word, brief, + xpatt=FALSE, patt, pattbuff[MAXPATT]:STRING + +-> Other globals +DEF ready=TRUE, gh=NIL:PTR TO guihandle, path[MAXSTR]:STRING, + findfunc=NIL, freq=NIL:PTR TO filerequester + +PROC main() HANDLE + StrCopy(xfpattstr, '#?') + newList(NEW reslist) + easyguiA({prog}, + [EQROWS, + findgad:=[STR,{s_ignore},'_Find:',xfindstr,MAXSTR,10,0,0,"f"], + [COLS, + [SPACEH], + [CHECK,{c_patt},'P_attern?',xpatt,TRUE,0,"a"], + [CHECK,{c_case},'_Case sensitive?',xcase,TRUE,0,"c"], + [CHECK,{c_word},'_Whole word?',xword,TRUE,0,"w"] + ], + [BAR], + [COLS, + dirgad:=[STR,{s_ignore},'_Directory:',xdirstr,MAXSTR,10,0,0,"d"], + [BUTTON,{b_pick},'Pic_k...',0,"k"] + ], + [COLS, + fpattgad:=[STR,{s_ignore},'File _Pattern:',xfpattstr,MAXSTR,5,0,0,"p"], + [CHECK,{c_rec},'_Recursive?',xrec,TRUE,0,"r"], + [CHECK,{c_brief},'_Brief output?',xbrief,TRUE,0,"b"] + ], + [BAR], + [TEXT,'Results:',NIL,FALSE,5], + resgad:=[LISTV,{l_ignore},'',25,10,reslist,FALSE,0,0], + [BAR], + [COLS, + [SPACEH], + gogad:=[BUTTON,{b_go},'_GO!',0,"g",0,FALSE], + [SPACEH], + [BUTTON,{b_stop},'_Stop',0,"s"], + [SPACEH], + [BUTTON,{b_quit},'_Quit',0,"q"], + [SPACEH] + ] + ], + [EG_GHVAR,{gh}, NIL]) +EXCEPT DO + IF reslist + freeNodes(reslist) + END reslist + ENDIF + IF freq THEN FreeAslRequest(freq) + IF aslbase THEN CloseLibrary(aslbase) +ENDPROC + +PROC s_ignore(info, str) IS 0 +PROC l_ignore(info, x) IS 0 + +-> Action functions for option gadgets +PROC c_case(info,bool) IS xcase:=bool +PROC c_word(info,bool) IS xword:=bool +PROC c_rec(info,bool) IS xrec:=bool +PROC c_brief(info,bool) IS xbrief:=bool +PROC c_patt(info,bool) IS xpatt:=bool + +PROC b_pick(info) + IF aslbase=NIL + aslbase:=OpenLibrary('asl.library', 37) + -> Only initialise once so position, path, etc. remembered. + freq:=AllocAslRequest(ASL_FILEREQUEST, + [ASLFR_WINDOW, gh.wnd, + ASLFR_TITLETEXT, 'Pick a Directory', + ASLFR_DRAWERSONLY, TRUE, + NIL]) + ENDIF + IF RequestFile(freq) THEN setstr(gh, dirgad, freq.drawer) +ENDPROC + +PROC b_go(info) + -> Only go if not already going! + IF ready + ready:=FALSE + go() + ready:=TRUE + ENDIF +ENDPROC + +PROC b_stop(info) + -> Interrupt if going + IF ready=FALSE THEN Raise(ERR_STOP) +ENDPROC + +PROC b_quit(info) IS Raise(ERR_QUIT) + +-> Copy current gadget values. +PROC copygadgets() + -> Extract the current strings from the text gadgets. + getstr(gh,findgad); getstr(gh,dirgad) + StrCopy(findstr, xfindstr); StrCopy(dirstr, xdirstr) + rec:=xrec; case:=xcase; word:=xword; brief:=xbrief + getstr(gh,fpattgad) + StrCopy(fpattstr, xfpattstr) + patt:=xpatt +ENDPROC + +-> Just scan the selected directory. +PROC go() HANDLE + DEF tmp[MAXSTR]:STRING, p + setdisabled(gh,gogad) + -> Get a copy of current gadget values. + copygadgets() + -> Not much to do if the string is empty... + IF EstrLen(findstr)=0 THEN Raise() + -> Empty the list and redisplay it. + setlistvlabels(gh, resgad, -1) + freeNodes(reslist) + setlistvlabels(gh, resgad, reslist) + IF patt + p:=IF word THEN '((#?[~A-Za-z0-9])|%)' ELSE '#?' + StrCopy(tmp, p); StrAdd(tmp, findstr); StrAdd(tmp, p) + IF case + ParsePattern(tmp, pattbuff, MAXPATT) + findfunc:={find_patt_case} + ELSE + ParsePatternNoCase(tmp, pattbuff, MAXPATT) + findfunc:={find_patt_nocase} + ENDIF + ELSEIF case + findfunc:=IF word THEN {find_word_case} ELSE {find_case} + ELSE + -> Make the findstr lowercase if ignoring case differences. + LowerStr(findstr) + findfunc:=IF word THEN {find_word_nocase} ELSE {find_nocase} + ENDIF + -> Set up pattern buffer. + ParsePatternNoCase(fpattstr, fpattbuff, MAXPATT) + scandir(dirstr) +EXCEPT DO + -> Re-enable the 'Go!' gadget. + setdisabled(gh,gogad,FALSE) + IF exception=ERR_QUIT THEN ReThrow() +ENDPROC + +-> The start of the real work. +PROC scandir(s) HANDLE + DEF lock=NIL, fib=NIL:PTR TO fileinfoblock, oldlock, len + len:=EstrLen(path) + lock:=Lock(s, ACCESS_READ) + oldlock:=CurrentDir(lock) + fib:=AllocDosObject(DOS_FIB, NIL) + -> Examine the file. + Examine(lock, fib) + IF fib.direntrytype>=0 + -> It's a directory, so examine all the files it contains. + WHILE ExNext(lock, fib) + checkgui(gh) + IF fib.direntrytype<0 + IF MatchPatternNoCase(fpattbuff, fib.filename) + scanfile(fib.filename) + ENDIF + ELSEIF rec + -> If directory then call recursively. + StrAdd(path, fib.filename); StrAdd(path, '/') + scandir(fib.filename) + SetStr(path, len) + ENDIF + ENDWHILE + IF IoErr()<>ERROR_NO_MORE_ENTRIES THEN Raise(ERR_EXNEXT) + ENDIF +EXCEPT DO + SetStr(path, len) + IF fib THEN FreeDosObject(DOS_FIB, fib) + IF lock + CurrentDir(oldlock) + UnLock(lock) + ENDIF + SELECT NUM_ERRS OF exception + CASE ERR_ADOS, ERR_EXAM, ERR_EXNEXT, ERR_LOCK + DEFAULT + ReThrow() + ENDSELECT +ENDPROC + +-> The real work. Search the file for the findstr. +PROC scanfile(file) HANDLE + DEF fh=NIL, buffer[BUFFERSIZE]:STRING, line=1 + fh:=myopen(file, OLDFILE) + WHILE myreadstr(fh, buffer) + checkgui(gh) + IF findfunc(buffer) + report(file, buffer, line) + -> Stop here if being brief. + IF brief THEN Raise() + ENDIF + INC line + ENDWHILE +EXCEPT DO + IF fh THEN myclose(fh) + IF exception<>ERR_OPEN THEN ReThrow() +ENDPROC + +-> Use as_Open from tools/async +PROC myopen(file, mode) + DEF fh + IF fh:=as_Open(file, mode, 3, 5000) + RETURN fh + ELSE + Raise(ERR_OPEN) + ENDIF +ENDPROC + +-> Close the file opened with myopen(). +PROC myclose(fh) IS as_Close(fh) + +-> Return FALSE (or NIL) if failed to read string. +PROC myreadstr(fh, s) + DEF res + IF res:=as_FGetS(fh, s, StrMax(s)) THEN SetStr(s, StrLen(s)) +ENDPROC res + +-> Try to find findstr in s (case sensitive) +PROC find_case(s) IS InStr(s, findstr)<>-1 + +-> Try to find the word findstr in s (case sensitive) +PROC find_word_case(s) + DEF i=0, len + len:=EstrLen(s) + WHILE i Try to find findstr in s (not case sensitive) +PROC find_nocase(s) IS lower_find(s, {find_case}) + +-> Try to find the word findstr in s (not case sensitive) +PROC find_word_nocase(s) IS lower_find(s, {find_word_case}) + +PROC find_patt_case(s) IS MatchPattern(pattbuff, s) +PROC find_patt_nocase(s) IS MatchPatternNoCase(pattbuff, s) + +-> Try to find after lowercasing a copy of s. +PROC lower_find(s, real_find) + DEF tmp[MAXSTR]:STRING + StrCopy(tmp, s) + LowerStr(tmp) +ENDPROC real_find(tmp) + +-> Is the bit between i and i+len a complete word in s? +PROC isword(s, i, len) + IF i>0 THEN IF isalnum(s[i-1]) THEN RETURN FALSE + RETURN isalnum(s[i+len])=FALSE +ENDPROC + +-> Report the find and update list. +PROC report(f, s, n) + setlistvlabels(gh, resgad, -1) + addNode(reslist, f, s, n) + setlistvlabels(gh, resgad, reslist) +ENDPROC + +-> Add a new node to the list. +PROC addNode(list, f, s, n) HANDLE + DEF node=NIL:PTR TO ln, len + NEW node + len:=EstrLen(path)+StrLen(f)+10 + IF brief + node.name:=String(len) + StringF(node.name, '\s\s (\d)', path, f, n) + ELSE + filter(s) + node.name:=String(len+EstrLen(s)+4) + StringF(node.name, '\s\s (\d) -> \s', path, f, n, s) + ENDIF + AddTail(list, node) +EXCEPT + IF node + IF node.name THEN DisposeLink(node.name) + END node + ENDIF + ReThrow() +ENDPROC + +-> Free a list of nodes and empty it. +PROC freeNodes(list:PTR TO lh) + DEF worknode:PTR TO ln, nextnode + worknode:=list.head -> First node. + WHILE nextnode:=worknode.succ + IF worknode.name THEN DisposeLink(worknode.name) + END worknode + worknode:=nextnode + ENDWHILE + newList(list) +ENDPROC + +-> Convert non-printing chars to " " or ".". +PROC filter(s) + WHILE s[] + IF 0=(s[] AND $60) + SELECT $E OF s[] + CASE $0 + -> Leave this alone! + CASE $8, $A, $D + -> TAB, linefeed, carriage return. + s[]:=" " + DEFAULT + s[]:="." + ENDSELECT + ENDIF + s++ + ENDWHILE +ENDPROC + + CHAR 0, '$VER:' +prog: + CHAR ' FindString 1.3', 0, 0 diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/GDU.e b/amigae33a/E_v3.3a/Src/Src/Utils/GDU.e new file mode 100644 index 0000000..42c7f63 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/GDU.e @@ -0,0 +1,234 @@ +/* Graphical Recursive Disk Usage Program, remotely based on D.e + + displays whole harddiskpartitions and the like at once on screen, + and is able to zoom in/out, display info etc. [see requester] + +*/ + +OPT OSVERSION=37 + +MODULE 'class/stack', 'tools/clonescreen', + 'dos/dosasl', 'dos/dos', 'utility', 'intuition/intuition' + +CONST MAXPATH=250 + +ENUM ER_NONE,ER_BADARGS,ER_MEM,ER_UTIL,ER_COML +ENUM ARG_DIR,NUMARGS + +RAISE ER_MEM IF New()=NIL, ERROR_BREAK IF CtrlC()=TRUE, ER_MEM IF String()=NIL + +OBJECT dir + name,size,sub,x,y,xs,ys +ENDOBJECT + +DEF dir,dirw[100]:STRING,rdargs=NIL,dirno=0,s[200]:STRING,b:PTR TO dir, + screen=NIL,font=NIL,win=NIL,xsize,ysize,depth,st:PTR TO stack + +PROC consdir(name,size,sub) IS NEW [StrCopy(String(StrLen(name)),name),size,sub]:dir + +PROC main() HANDLE + DEF args[NUMARGS]:LIST,templ,x,lock,fib:fileinfoblock,do=TRUE,code,qual,mx,my + IF EasyRequestArgs(win,[20,0,'Welcome to GraphicDiskUsage', + 'cli usage = GDU \nleft mouse = display info\nright mouse = quit\nshift left mouse = zoom in\nshift right mouse = zoom out\nctrl c = quit [while scanning dir]\n', + 'Go and Scan|Cancel'],0,NIL)=1 + NEW st.stack() + IF (utilitybase:=OpenLibrary('utility.library',37))=NIL THEN Raise(ER_UTIL) + FOR x:=0 TO NUMARGS-1 DO args[x]:=0 + templ:='DIR' + rdargs:=ReadArgs(templ,args,NIL) + IF rdargs=NIL THEN Raise(ER_BADARGS) + dir:=args[ARG_DIR] + IF dir THEN StrCopy(dirw,dir,ALL) + lock:=Lock(dirw,-2) + IF lock /* if yes, the prob. dir, else wildcard */ + IF Examine(lock,fib) AND (fib.direntrytype>0) + AddPart(dirw,'#?',100) + ENDIF + UnLock(lock) + ENDIF + screen,font:=openclonescreen('Workbench','Graphic Disk Usage ($%#!)') + win:=backdropwindow(screen,$8,$10000) + depth,xsize,ysize:=getcloneinfo(screen) + WriteF('Scanning...\n') + b:=recdir(dirw) + SetTopaz(8) + refresh() + WHILE do + WaitIMessage(win) + code:=MsgCode() + qual:=MsgQualifier() + mx:=MouseX(win); my:=MouseY(win) + IF code=MENUDOWN + IF qual AND 1 + zoomout() + ELSE + IF EasyRequestArgs(win,[20,0,'Quit?','Zure, man?','Yez|Noo'],0,NIL)=1 THEN do:=FALSE + ENDIF + ELSEIF code=SELECTDOWN + IF qual AND 1 + zoomin(mx,my) + ELSE + findxy(b,mx,my) + ENDIF + ENDIF + ENDWHILE + ENDIF +EXCEPT DO + closeclonescreen(screen,font,win) + IF rdargs THEN FreeArgs(rdargs) + IF utilitybase THEN CloseLibrary(utilitybase) + SELECT exception + CASE "SCR"; WriteF('no screen!\n') + CASE "WIN"; WriteF('no window!\n') + CASE ER_BADARGS; WriteF('Bad Arguments for GDU!\n') + CASE ER_MEM; WriteF('No mem!\n') + CASE ER_COML; WriteF('No commandline specified\n') + CASE ER_UTIL; WriteF('Could not open "utility.library" v37\n') + CASE ERROR_BREAK; WriteF('User terminated GDU\n') + CASE ERROR_BUFFER_OVERFLOW; WriteF('Internal error\n') + DEFAULT; PrintFault(exception,'Dos Error') + ENDSELECT +ENDPROC + +PROC refresh() + SetRast(stdrast,0) + dogfx(b,5,20,xsize-10,ysize-30,TRUE) +ENDPROC + +PROC recdir(dirr) HANDLE + DEF er,i:PTR TO fileinfoblock,size=0,anchor=NIL:PTR TO anchorpath, + fullpath,x,num=0,l=NIL,rl:PTR TO dir + CtrlC() + anchor:=New(SIZEOF anchorpath+MAXPATH) + anchor.breakbits:=4096 + anchor.strlen:=MAXPATH-1 + er:=MatchFirst(dirr,anchor) /* collect all strings */ + WHILE er=0 + fullpath:=anchor+SIZEOF anchorpath + i:=anchor.info + IF i.direntrytype<0 + size:=size+Shr(i.size+1023,9) + num++ + ELSE + x:=StrLen(fullpath) + IF x+5l:=NEW [l,rl] + l:=addsorted(l,rl) + ENDIF + er:=MatchNext(anchor) + ENDWHILE + IF er<>ERROR_NO_MORE_ENTRIES THEN Raise(er) + MatchEnd(anchor) + Dispose(anchor) + anchor:=NIL + INC dirno +EXCEPT + IF anchor THEN MatchEnd(anchor) + Raise(exception) +ENDPROC consdir(dirr,IF size THEN size ELSE 1,l) + +PROC addsorted(l:PTR TO LONG,d:PTR TO dir) + DEF d2:PTR TO dir,p:PTR TO LONG,c:PTR TO LONG + IF l=NIL + RETURN NEW [NIL,d] + ELSE + d2:=l[1] + IF d.size>d2.size + RETURN NEW [l,d] + ELSE + c:=l + REPEAT + p:=c; c:=c[] + UNTIL IF c THEN (d2:=c[1]) BUT d.size>d2.size ELSE TRUE + p[]:=NEW [c,d] + ENDIF + ENDIF +ENDPROC l + +PROC dogfx(b:PTR TO dir,x,y,xs,ys,isx) + DEF l:PTR TO LONG,cs=0,sb:PTR TO dir,mc,last + b.x:=x; b.y:=y; b.xs:=xs; b.ys:=ys + IF (xs>2) AND (ys>2) + Line(x,y,x+xs,y) + Line(x,y,x,y+ys) + Line(x+xs,y,x+xs,y+ys) + Line(x,y+ys,x+xs,y+ys) + l:=b.sub + WHILE l + l <=> [l,sb] + dogfx(sb,IF isx THEN Div(Mul(cs,xs),b.size)+x ELSE x, + IF isx THEN y ELSE Div(Mul(cs,ys),b.size)+y, + IF isx THEN Div(Mul(sb.size,xs),b.size) ELSE xs, + IF isx THEN ys ELSE Div(Mul(sb.size,ys),b.size), + Not(isx)) + cs:=cs+sb.size + ENDWHILE + IF isx + x:=x+xs; xs:=xs-Div(Mul(cs,xs),b.size); x:=x-xs + ELSE + y:=y+ys; ys:=ys-Div(Mul(cs,ys),b.size); y:=y-ys + ENDIF + IF ys>10 + IF xs>20 + mc:=xs-4/8 + last:=b.name+EstrLen(b.name) + WHILE (last>b.name) AND (last[]<>"/") AND (last[]<>":") DO last-- + mc:=last-mc + IF mc=b2.x + IF y>=b2.y + IF x<(b2.x+b2.xs) + IF y<(b2.y+b2.ys) THEN st.push(b) BUT (b:=b2) BUT refresh() + ENDIF + ENDIF + ENDIF + l:=l[] + ENDWHILE +ENDPROC + +PROC zoomout() + IF st.is_empty() + DisplayBeep(screen) + ELSE + b:=st.pop() + refresh() + ENDIF +ENDPROC + +PROC findxy(b:PTR TO dir,x,y) + DEF f=FALSE,l:PTR TO LONG,numsub=0 + IF x>=b.x + IF y>=b.y + IF x<(b.x+b.xs) + IF y<(b.y+b.ys) + l:=b.sub + WHILE l + f:=f OR findxy(l[1],x,y) + l:=l[] + numsub++ + ENDWHILE + IF f=FALSE + f:=TRUE + StringF(s,IF numsub THEN '\s, \d bytes [including \d subdir(s)].' ELSE '\s, \d bytes.',b.name,Shl(b.size,9),numsub) + SetWindowTitles(win,s,s) + ENDIF + ENDIF + ENDIF + ENDIF + ENDIF +ENDPROC f diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Mem.e b/amigae33a/E_v3.3a/Src/Src/Utils/Mem.e new file mode 100644 index 0000000..b35fe20 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Mem.e @@ -0,0 +1,29 @@ +/* A very small util to dump memory in a shell. + usage: MEM + + simply dumps memory in a shell, usefull for hardcore-kamikaze + debugging and the like. + + try: + 1> mem $f80000 ; only if you have a non-moved kick2.0 or better + +*/ + +PROC main() + DEF adr,a,b,radr:PTR TO LONG,c,r + adr,r:=Val(arg) + IF r=0 + WriteF('Usage: MEM \n') + ELSE + adr:=adr AND -2 /* no odd adr */ + FOR a:=0 TO 7 + radr:=a*16+adr + WriteF('$\r\z\h[8]: ',radr) + FOR b:=0 TO 3 DO WriteF('\r\z\h[8] ',radr[b]) + WriteF(' "') + c:=radr + FOR b:=0 TO 15 DO Out(stdout,IF (c[b]<32) OR (c[b]>126) THEN "." ELSE c[b]) + WriteF('"\n') + ENDFOR + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Nkript.e b/amigae33a/E_v3.3a/Src/Src/Utils/Nkript.e new file mode 100644 index 0000000..435e98f --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Nkript.e @@ -0,0 +1,71 @@ +/* Nkript.e, very simple file (de)coder + USAGE: nkript + + nkript asks for a 4 letter key, and a 3 letter pincode. + as nkript uses EOR, you may use this program to code and + decode. the key and pincode are not stored anywhere, so it + _relatively_ safe. this has the effect that if you type the + wrong key, no error is given, but the file is simply + decoded wrong. + +*/ + +MODULE 'tools/file' + +ENUM ER_NONE,ER_FILE,ER_MEM,ER_USAGE,ER_OUT,ER_ILLEGAL,ER_NONUM + +PROC main() HANDLE + DEF flen,mem=NIL,key,keyadd,file[200]:STRING,p + WriteF('Nkript (c) 1992 $#%!\n') + IF StrCmp(arg,'',1) OR StrCmp(arg,'?',2) THEN Raise(ER_USAGE) + mem,flen:=readfile(arg) + key:=readpass('key',4,FALSE) + keyadd:=readpass('pin',3,TRUE) OR 3 + WriteF('Now (de)coding "\s".\n',arg) + MOVE.L flen,D7 + LSR.L #2,D7 /* D7 = #of LONGs */ + MOVE.L key,D6 + MOVE.L keyadd,D4 + MOVE.L mem,A0 + loop: + MOVE.L D4,D5 + SUB.L D6,D5 + LSL.L #3,D6 /* random alg. D6*7+keyadd (11) */ + ADD.L D5,D6 + EOR.L D6,(A0)+ + DBRA D7,loop + SUB.L #$10000,D7 + BCC.S loop /* DBRA.L emulation */ + p:=InStr(arg,'.',0) + StrCopy(file,arg,p) + IF StrCmp(arg+p,'.nkr',ALL)=FALSE THEN StrAdd(file,'.nkr',ALL) + writefile(file,mem,flen) +EXCEPT DO + IF mem THEN freefile(mem) + SELECT exception + CASE ER_NONE; WriteF('Done.\n') + CASE "OPEN"; WriteF('Could not access file "\s" !\n',exceptioninfo) + CASE "IN"; WriteF('Could not read from file "\s" !\n',exceptioninfo) + CASE "OUT"; WriteF('Could not write to file "\s" !\n',exceptioninfo) + CASE "MEM"; WriteF('No memory for loading file!\n') + CASE ER_USAGE; WriteF('USAGE: Nkript \n') + CASE ER_ILLEGAL; WriteF('Wrong #of chars\n') + CASE ER_NONUM; WriteF('not a decimal number\n') + ENDSELECT +ENDPROC + +PROC readpass(messy,numchars,decflag) + DEF s[25]:STRING,a,t,n=0,f=1 + WriteF('\s[\d]: ',messy,numchars) + ReadStr(stdout,s) + IF EstrLen(s)<>numchars THEN Raise(ER_ILLEGAL) + IF decflag + t:=s + FOR a:=1 TO numchars + n:=n+(t[]-"0"*f) + IF (t[]<"0") OR (t[]++>"9") THEN Raise(ER_NONUM) + f:=f*10 + ENDFOR + ^s:=n + ENDIF +ENDPROC ^s diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/ShowHunk.e b/amigae33a/E_v3.3a/Src/Src/Utils/ShowHunk.e new file mode 100644 index 0000000..3403b8a --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/ShowHunk.e @@ -0,0 +1,862 @@ +/* simple hunk-dump program with 680x0 disassembler for code hunks */ + +/* + WARNING: hunk_reloc32_short and hunk_relative_reloc hunks have not been + tested. If you find a file with this type of hunk, and this program + doesn't work with it, *PLEASE* contact the program authors so fixes may + be made. +*/ + +/* bugs left: + - link disasms wrong + - bset should give with bit > 31 +*/ + +OPT OSVERSION=37 + +ENUM HUNK_UNIT=$3E7, HUNK_NAME, HUNK_CODE, HUNK_DATA, HUNK_BSS, HUNK_RELOC32, + HUNK_RELOC16, HUNK_RELOC8, HUNK_EXT, HUNK_SYMBOL, HUNK_DEBUG, + HUNK_END, HUNK_HEADER, HUNK_OVERLAY=$3F5, HUNK_BREAK, HUNK_DRELOC32, + HUNK_DRELOC16, HUNK_DRELOC8, HUNK_LIB, HUNK_INDEX, HUNK_RELOC32_S, + HUNK_REL_RELOC32 + +ENUM EXT_SYM=0, EXT_DEF, EXT_ABS, EXT_RES, EXT_NEWCOMMON, EXT_REF32=129, + EXT_COMMON, EXT_REF16, EXT_REF8, EXT_DREF32, EXT_DREF16, EXT_DREF8 + +ENUM ER_NONE,ER_FILE,ER_MEM,ER_USAGE,ER_HUNKID,ER_BREAK,ER_FILETYPE + +DEF flen,o:PTR TO LONG,mem,handle=NIL,hunkid,noreloc=TRUE,hunknr=-1,f=TRUE +DEF pc:PTR TO INT,hibyte,eleven2nine,eight,seven2six,five2three,two2zero,isize +DEF tmp,fname[256]:STRING,disasm + +PROC main() + DEF options:PTR TO LONG,rdargs + + options:=[0,0] + IF rdargs:=ReadArgs('NAME/A,DISASM/S',options,NIL) + IF options[0] THEN StrCopy(fname,options[0]) + disasm:=options[1] + FreeArgs(rdargs) + ELSE + error(ER_USAGE) + ENDIF + + PutStr('ShowHunk v2.0 Copyright (c) 1993 Jim Cooper\n') + PutStr(' Original ShowHunk v0.1 (c) 1992 $#%!\n\n') + + flen:=FileLength(fname) + handle:=Open(fname,OLDFILE) + IF (flen<1) OR (handle=NIL) + error(ER_FILE) + ELSE + mem:=New(flen) + IF mem=NIL + error(ER_MEM) + ELSE + IF Read(handle,mem,flen)<>flen THEN error(ER_FILE) ELSE process() + ENDIF + ENDIF + error(ER_NONE) +ENDPROC + +PROC process() + DEF end,type + + o:=mem + end:=o+flen + IF (o[]<>HUNK_HEADER) AND (o[]<>HUNK_UNIT) AND (o[]<>HUNK_LIB) THEN error(ER_FILETYPE) + PrintF('Hunk layout of file "\s" (\d bytes)\n\n',fname,flen) + WHILE oHUNK_UNIT) AND (hunkid<>HUNK_HEADER) AND (hunkid<>HUNK_BREAK) AND (hunkid<>HUNK_LIB) AND (hunkid<>HUNK_INDEX) + IF f + PrintF('HUNK \d',hunknr) + INC hunknr + ENDIF + f:=FALSE + ENDIF + IF type + IF type=$4000 + PutStr('\t** hunk forced to CHIP-mem\n') + ELSE + PrintF('\t** type: \d\n',type) + ENDIF + ENDIF + SELECT hunkid + CASE HUNK_UNIT; PutStr('\thunk_unit: '); name() + CASE HUNK_NAME; PutStr('\thunk_name: '); name() + CASE HUNK_CODE; + PutStr('\thunk_code') + IF disasm + PutStr('\n'); code() + ELSE + PrintF(': \d bytes\n', skip()) + ENDIF + CASE HUNK_DATA; PrintF('\thunk_data: \d bytes\n',skip()) + CASE HUNK_BSS; PrintF('\thunk_bss: \d bytes\n',Mul(o[]++,4)) + CASE HUNK_RELOC32; PutStr('\thunk_reloc32\n'); reloc(4) + CASE HUNK_RELOC16; PutStr('\thunk_reloc16\n'); reloc(4) + CASE HUNK_RELOC8; PutStr('\thunk_reloc8\n'); reloc(4) + CASE HUNK_EXT; PutStr('\thunk_ext\n'); symbol() + CASE HUNK_SYMBOL; PutStr('\thunk_symbol\n'); symbol() + CASE HUNK_DEBUG; PrintF('\thunk_debug: \d bytes\n',skip()) + CASE HUNK_END; f:=TRUE + CASE HUNK_HEADER; PutStr('\thunk_header\n'); head() + CASE HUNK_OVERLAY; PutStr('\thunk_overlay\n'); overlay() + CASE HUNK_BREAK; PutStr('\thunk_break\n'); hunknr:=1; f:=TRUE + CASE HUNK_DRELOC32; PutStr('\thunk_data-reloc32\n'); reloc(4) + CASE HUNK_DRELOC16; PutStr('\thunk_data-reloc16\n'); reloc(4) + CASE HUNK_DRELOC8; PutStr('\thunk_data-reloc8\n'); reloc(4) + CASE HUNK_LIB; PrintF('\tlibrary_hunk: \d bytes\n',Mul(o[]++,4)); hunknr:=0 + CASE HUNK_INDEX; PrintF('\tlibrary_index: \d bytes\n\n',skip()) + CASE HUNK_RELOC32_S; PutStr('\thunk_reloc32_short\n'); reloc(2); + CASE HUNK_REL_RELOC32; PutStr('\thunk_relative_reloc32\n'); reloc(4); + DEFAULT + error(ER_HUNKID) + ENDSELECT + ENDWHILE + PutStr(IF noreloc THEN '\nPosition independant code!\n' ELSE '\n') +ENDPROC + +PROC overlay() + DEF m,ts + ts:=o[]++ + PrintF('\t tablesize = \d\n',ts) + m:=o[]++-2 + PrintF('\t max. level overlay tree uses = \d\n',m) + o:=ts*4+o + hunknr:=1; f:=TRUE +ENDPROC + +PROC symbol() + DEF t,l,s,c,r + t:=Char(o); l:=Int(o+2); o:=o+4 + WHILE l + IF CtrlC() THEN error(ER_BREAK) + IF t\n') + CASE ER_HUNKID; PrintF('Illegal hunk id: $\h !\n',hunkid) + CASE ER_BREAK; PutStr('** BREAK: ShowHunk\n') + CASE ER_FILETYPE; PutStr('Not an executable or object file.\n') + ENDSELECT + CleanUp() +ENDPROC + +PROC illegal() + PrintF('\n',pc[]) +ENDPROC + +PROC opsize(bit) RETURN ListItem(["b","w","l","?"],bit) + +PROC bitsize(bit) RETURN IF bit THEN "l" ELSE "w" + +PROC immed(val) + PrintF(IF val < 16 THEN '\d' ELSE '$\h',val) +ENDPROC + +PROC ccode(val,b) RETURN ListItem([IF b THEN 'ra' ELSE 't', + IF b THEN 'sr' ELSE 'f','hi','ls','cc','cs','ne','eq','vc', + 'vs','pl','mi','ge','lt','gt','le','??'],val) + +PROC ea(mode,reg,sd) + IF mode < 5 THEN + PrintF(ListItem(['d\d','a\d','(a\d)','(a\d)+','-(a\d)'],mode),reg) + SELECT mode + CASE 5; + PutStr('(') + immed(pc[1]++) + PrintF(',a\d)',reg) + CASE 6; + tmp:=pc[1]++ + PutStr('(') + immed(tmp AND $f) + PrintF(',a\d,\s\d\s',reg, + IF tmp AND $8000 THEN 'a' ELSE 'd', + (Shr(tmp,12) AND 7), + IF tmp AND $800 THEN '.L)' ELSE '.W)') + CASE 7; + SELECT reg + CASE 0; PrintF('(\d).W',pc[1]++) + CASE 1; immed(Long(pc+2)); pc:=pc+4 /* bug! was: immed(^pc++) */ + CASE 2; + PutStr('(') + immed(pc[1]++) + PutStr(',PC)') + CASE 3; + tmp:=pc[1]++ + PutStr('(') + immed(tmp AND $f) + PrintF(',PC,\c\d\s',IF tmp AND $8000 THEN "a" ELSE "d", + (Shr(tmp,12) AND 7), + IF tmp AND $800 THEN '.L)' ELSE '.W)') + CASE 4; + IF sd + PutStr('#') + immed(IF isize=2 THEN pc[1] ELSE Long(pc+2)) + pc:=pc+isize + ELSE + PutStr('SR') + ENDIF + DEFAULT; + PutStr('') + ENDSELECT + ENDSELECT +ENDPROC + +PROC movemregs(val,predec) + DEF index,first=1,regs:PTR TO LONG + + regs:=['d0','d1','d2','d3','d4','d5','d6','d7', + 'a0','a1','a2','a3','a4','a5','a6','a7'] + + IF predec + FOR index:=15 TO 0 STEP -1 + IF val AND Shl(1,index) + IF first = 0 THEN PutStr('/') + PutStr(regs[15-index]) + first:=0 + ENDIF + ENDFOR + ELSE + FOR index:=0 TO 15 STEP 1 + IF val AND Shl(1,index) + IF first = 0 THEN PutStr('/') + PutStr(regs[index]) + first:=0 + ENDIF + ENDFOR + ENDIF +ENDPROC + +PROC code0000() + DEF c,tmp2 + + IF (eleven2nine = 7) OR (seven2six = 3) + IF (eleven2nine = 7) AND (eight = 0) + tmp:=pc[1]++ + PrintF('moves.\c\t',opsize(seven2six)) + IF Shr(tmp,11) AND 1 + ea(five2three,two2zero,1) + PrintF(',\c\d\n',IF tmp AND $8000 THEN "a" ELSE "d",Shr(tmp,12) AND 7) + ELSE + PrintF('\c\d,',IF tmp AND $8000 THEN "a" ELSE "d",Shr(tmp,12) AND 7) + ea(five2three,two2zero,0) + PutStr('\n') + ENDIF + ELSEIF (eight = 0) AND (seven2six = 3) + tmp:=pc[1]++ + IF (five2three = 7) AND (two2zero = 4) + tmp2:=pc[1]++ + PrintF('cas2\td\d:d\d,d\d:d\d,\c\d:\c\d\n', + (tmp AND 7), (tmp2 AND 7), + (Shr(tmp,6) AND 7), (Shr(tmp2,6) AND 7), + IF tmp AND $8000 THEN "a" ELSE "d", (Shr(tmp,12) AND 7), + IF tmp2 AND $8000 THEN "a" ELSE "d", (Shr(tmp2,12) AND 7)) + ELSE + PrintF('cas\td\d,d\d,',tmp AND 7, Shr(tmp,6) AND 7) + ea(five2three,two2zero,0) + PutStr('\n') + ENDIF + ELSE + illegal() + ENDIF + ELSE + IF five2three = 1 + PrintF('movep.\c\t',bitsize(seven2six AND 1)) + IF seven2six AND 2 + PrintF('d\d,\d(a\d)\n',eleven2nine,pc[1]++,two2zero) + ELSE + PrintF('\d(a\d),d\d\n',pc[1]++,two2zero,eleven2nine) + ENDIF + ELSEIF (eight = 1) OR ((((eleven2nine AND 3) = 0) AND (eight = 0))) + PrintF(ListItem(['btst\t','bchg\t','bclr\t','bset\t'],seven2six)) + IF eight = 1 + PrintF('d\d,',eleven2nine) + ELSE + PrintF('#\d,',pc[1]++) + ENDIF + ea(five2three,two2zero,0) + PutStr('\n') + ELSE + IF seven2six = 3 + tmp:=pc[1]++ + PrintF('\s.\c\t',IF Shr(tmp,11) AND 1 THEN 'chk2' ELSE 'cmp2',opsize(eleven2nine)) + ea(five2three,two2zero,1) + PrintF(',\c\d\n',IF tmp AND $8000 THEN "d" ELSE "a",Shr(tmp,12) AND 3) + ELSE + c:=ListItem(['ori.','andi.','subi.','addi.',0,'eori.','cmpi.',0],eleven2nine) + IF c THEN PutStr(c) ELSE illegal() + PrintF('\c\t#',opsize(seven2six)) + immed(IF seven2six < 2 THEN pc[1]++ ELSE ^pc++) + PutStr(',') + ea(five2three,two2zero,0) + PutStr('\n') + ENDIF + ENDIF + ENDIF +ENDPROC + +PROC code0100() + DEF subfield,bitseven,bitsix,curcode + + bitseven:=Shr(seven2six,1) + bitsix:=seven2six AND 1 + + IF pc[] = $4afa + PutStr('bgnd\n') + ELSE + IF eight = 1 + IF bitsix = 1 + PutStr('lea\t') + ea(five2three,two2zero,1) + PrintF(',a\d\n',eleven2nine) + ELSE + PutStr('chk\t') + ea(five2three,two2zero,0) + PrintF(',d\d\n',eleven2nine) + ENDIF + ELSE + subfield:=Shl(eleven2nine,1)+eight + + SELECT subfield + CASE 0; + IF seven2six = 3 + PutStr('move.w\t') + ea(five2three,two2zero,1) + PutStr(',sr\n') + ELSE + PrintF('negx.\c\t',opsize(seven2six)) + ea(five2three,two2zero,0) + PutStr('\n') + ENDIF + CASE 1; + IF seven2six = 3 + PutStr('move.w\tccr,') + ea(five2three,two2zero,0) + PutStr('\n') + ELSE + illegal() + ENDIF + CASE 2; + PrintF('clr.\c\t',opsize(seven2six)) + ea(five2three,two2zero,0) + PutStr('\n') + CASE 4; + IF seven2six = 3 + PutStr('move.w\t') + ea(five2three,two2zero,1) + PutStr(',ccr\n') + ELSE + PrintF('neg.\c\t',opsize(seven2six)) + ea(five2three,two2zero,0) + PutStr('\n') + ENDIF + CASE 6; + IF seven2six = 3 + PutStr('move.w\tsr,') + ea(five2three,two2zero,0) + PutStr('\n') + ELSE + PrintF('not.\c\t',opsize(seven2six)) + ea(five2three,two2zero,0) + PutStr('\n') + ENDIF + CASE 8; + IF seven2six = 0 + IF five2three = 1 + PrintF('link.l\ta\d,#-$\h\n',two2zero,0-1-^pc++) + ELSE + PutStr('nbcd\t') + ea(five2three,two2zero,0) + PutStr('\n') + ENDIF + ELSEIF seven2six = 1 + IF five2three = 0 + PrintF('swap\td\d\n',two2zero) + ELSEIF five2three = 1 + PrintF('bkpt\t#\d\n',two2zero) + ELSE + PutStr('pea\t') + ea(five2three,two2zero,0) + PutStr('\n') + ENDIF + ELSE + IF five2three = 0 + IF (Shl(eight,2)+seven2six) = 7 THEN PrintF('extb.l\td\d\n',two2zero) ELSE PrintF('ext.\c\td\d\n',bitsize(bitsix),two2zero) + ELSE + PrintF('movem.\c\t',bitsize(bitsix)) + movemregs(pc[1]++, IF five2three = 4 THEN 1 ELSE 0) + PutStr(',') + ea(five2three,two2zero,0) + PutStr('\n') + ENDIF + ENDIF + CASE 10; + IF pc[] = $4afc + PutStr('illegal\n') + ELSE + IF seven2six = 3 + PutStr('tas\t') + ea(five2three,two2zero,0) + PutStr('\n') + ELSE + PrintF('tst.\c\t',opsize(seven2six)) + ea(five2three,two2zero,0) + PutStr('\n') + ENDIF + ENDIF + CASE 12; + tmp:=pc[1]++ + + IF (Shl(eight,2)+seven2six) < 2 + IF seven2six = 1 + PrintF('div\c',IF Shr(tmp,11) AND 1 THEN "s" ELSE "u") + IF ((Shr(tmp,10) AND 1) = 0) AND ((Shr(tmp,12) AND 7) <> (tmp AND 7)) + PutStr('l.l\t') + ea(five2three,two2zero,1) + PrintF(',d\d:d\d\n',Shr(tmp,12) AND 7,tmp AND 7) + ELSE + PutStr('.l\t') + ea(five2three,two2zero,1) + PrintF(',d\d',Shr(tmp,12) AND 7) + IF Shr(tmp,10) AND 1 THEN PrintF(':d\d',tmp AND 7) + PutStr('\n') + ENDIF + ELSE + PrintF('mul\c.l\t',IF Shr(tmp,11) AND 1 THEN "s" ELSE "u") + ea(five2three,two2zero,1) + PrintF(',d\d',Shr(tmp,12) AND 7) + IF Shr(tmp,10) AND 1 THEN PrintF(':d\d',tmp AND 7) + PutStr('\n') + ENDIF + ELSE + PrintF('movem.\c\t',bitsize(bitsix)) + ea(five2three,two2zero,0) + PutStr(',') + movemregs(tmp, IF five2three = 4 THEN 1 ELSE 0) + PutStr('\n') + ENDIF + CASE 14; + curcode:=pc[] + + SELECT curcode + CASE $4e70; + PutStr('reset\n') + CASE $4e71; + PutStr('nop\n') + CASE $4e72; + PutStr('stop\n') + CASE $4e73; + PutStr('rte\n') + CASE $4e74; + PrintF('rtd\t#\d\n',(Shl(pc[1]<32767+1,16)-pc[1]++)) + CASE $4e75; + PutStr('rts\n') + CASE $4e76; + PutStr('trapv\n') + CASE $4e77; + PutStr('rtr\n') + DEFAULT; + IF bitseven = 1 + PutStr(IF bitsix = 1 THEN 'jmp\t' ELSE 'jsr\t') + ea(five2three,two2zero,0) + PutStr('\n') + ELSE + IF bitsix = 1 + tmp:=Shr(five2three,1) + + SELECT tmp + CASE 0; + PrintF('trap\t\d\n',(Shl((five2three AND 1),2)+two2zero)) + CASE 1; + IF five2three AND 1 + PrintF('unlk\ta\d\n',two2zero) + ELSE + PrintF('link.w\ta\d,#-$\h\n',two2zero,65536-pc[1]); pc++ + + ENDIF + CASE 2; + PrintF(IF five2three AND 1 THEN 'move\tusp,a\d\n' ELSE 'move\ta\d,usp\n',two2zero) + CASE 3; + PrintF('rtm\t\c\d\n',IF five2three AND 1 THEN "a" ELSE "d",two2zero) + ENDSELECT + ELSE + illegal() + ENDIF + ENDIF + ENDSELECT + DEFAULT; illegal() + ENDSELECT + ENDIF + ENDIF +ENDPROC + +PROC code0101() + IF seven2six < 3 + PutStr(IF eight = 1 THEN 'subq.' ELSE 'addq.') + PrintF('\c\t#\d,',opsize(seven2six),eleven2nine) + ea(five2three,two2zero,0) + PutStr('\n') + ELSE + IF five2three = 1 + PrintF('db\s\td\d,L\z\h[8]\n', + ccode((Shl(eleven2nine,1)+eight),0), + two2zero, + pc-o-2-(Shl(pc[1]<32767+1,16)-pc[1])) + pc++ + ELSEIF five2three = 7 + PrintF('trap\s',ccode(Shl(eleven2nine,1)+eight,0)) + IF two2zero < 4 + IF two2zero AND 1 THEN PrintF('.w\t#\d',pc[1]++) ELSE PrintF('.l\t#\d',^pc++) + ENDIF + PutStr('\n') + ELSE + PrintF('s\s\t',ccode(Shl(eleven2nine,1)+eight,0)) + ea(five2three,two2zero,0) + PutStr('\n') + ENDIF + ENDIF +ENDPROC + +PROC code0110() + DEF tmp2,ctl:PTR TO LONG + + IF (pc[] AND $fffe) = $4e7a + tmp:=pc[1]++ + tmp2:= tmp AND $fff + IF tmp2 > 7 + ctl:=ListItem(['usp','vbr','caar','msp','isp','mmusr','urp','srp'],tmp2 - $800) + ELSE + ctl:=ListItem(['sfc','dfc','cacr','tc','itt0','itt1','dtt0','dtt1'],tmp2) + ENDIF + IF ctl + PutStr('movec\t') + IF pc[-1] AND 1 + PrintF('\s,\c\d\n',ctl,IF tmp AND $8000 THEN "a" ELSE "d",Shr(tmp,12) AND 7) + ELSE + PrintF('\c\d,\s\n',IF tmp AND $8000 THEN "a" ELSE "d",Shr(tmp,12) AND 7,ctl) + ENDIF + ELSE + illegal() + ENDIF + ELSE + PrintF('b\s',ccode((Shl(eleven2nine,1)+eight),1)) + tmp:=Char(pc+1) + IF tmp = 0 + PrintF('.w\tL\z\h[8]\n',pc-o-2-(Shl(pc[1]<32767+1,16)-pc[1])) + pc++ + ELSE + PrintF('.b\tL\z\h[8]\n',pc-o-2-(Shl(tmp<127+1,8)-tmp)) + ENDIF + ENDIF +ENDPROC + +PROC code1000() + IF Shr(pc[],4) AND %11111 = %10100 /* bug!: was Shr(five2three,1) = 0 */ + IF eight + IF seven2six + SELECT seven2six + CASE 1; PutStr('pack\t') + CASE 2; PutStr('unpk\t') + DEFAULT; illegal() + ENDSELECT + PrintF(IF five2three AND 1 THEN '-(a\d),-(a\d),#\d\n' ELSE 'd\d,d\d,#\d\n',two2zero,eleven2nine,pc[1]++) + ELSE + PrintF(IF five2three AND 1 THEN 'sbcd\t-(a\d),-(a\d)\n' ELSE 'sbcd\td\d,-d\d\n',two2zero,eleven2nine) + ENDIF + ELSE + illegal() + ENDIF + ELSE + IF seven2six = 3 + PutStr(IF eight = 1 THEN 'divs\t' ELSE 'divu\t') + ea(five2three,two2zero,1) + PrintF(',d\d\n',eleven2nine) + ELSE + PrintF('or.\c\t',opsize(seven2six)) + IF eight = 1 + PrintF('d\d,',eleven2nine) + ea(five2three,two2zero,0) + ELSE + ea(five2three,two2zero,1) + PrintF(',d\d',eleven2nine) + ENDIF + PutStr('\n') + ENDIF + ENDIF +ENDPROC + +PROC code1001() + IF seven2six = 3 + PrintF('suba.\c\t',bitsize(eight)) + ea(five2three,two2zero,1) + PrintF(',a\d\n',eleven2nine) + ELSE + IF (Shr(five2three,1) = 0) AND (eight = 1) + PrintF('subx.\c\t',opsize(seven2six)) + PrintF(IF five2three AND 1 THEN '-(a\d),-(a\d)\n' ELSE 'd\d,d\d\n',two2zero,eleven2nine) + ELSE + PrintF('sub.\c\t',opsize(seven2six)) + IF eight = 1 + PrintF('d\d,',eleven2nine) + ea(five2three,two2zero,0) + PutStr('\n') + ELSE + ea(five2three,two2zero,1) + PrintF(',d\d\n',eleven2nine) + ENDIF + ENDIF + ENDIF +ENDPROC + +PROC code1011() + IF seven2six = 3 + PrintF('cmpa.\c\t',bitsize(eight)) + ea(five2three,two2zero,1) + PrintF(',a\d\n',eleven2nine) + ELSE + IF five2three = 1 + PrintF('cmpm.\c\t(a\d)+,(a\d)+\n',opsize(seven2six),two2zero,eleven2nine) + ELSE + IF eight = 1 + PrintF('eor.\c\td\d,',opsize(seven2six),eleven2nine) + ea(five2three,two2zero,0) + PutStr('\n') + ELSE + PrintF('cmp.\c\t',opsize(seven2six)) + ea(five2three,two2zero,1) + PrintF(',d\d\n',eleven2nine) + ENDIF + ENDIF + ENDIF +ENDPROC + +PROC code1100() + IF seven2six = 3 + PutStr(IF eight = 1 THEN 'mulu.w\t' ELSE 'muls.w\t') + ea(five2three,two2zero,1) + PrintF(',d\d\n',eleven2nine) + ELSE + IF Shr(five2three,1) <> 0 + PrintF('and.\c\t',opsize(seven2six)) + IF eight = 1 + PrintF('d\d,',eleven2nine) + ea(five2three,two2zero,0) + PutStr('\n') + ELSE + ea(five2three,two2zero,1) + PrintF(',d\d\n',eleven2nine) + ENDIF + ELSE + IF seven2six = 0 + PrintF(IF five2three AND 1 THEN 'abcd\t-(a\d),-(a\d)\n' ELSE 'abcd\td\d,d\d\n',two2zero,eleven2nine) + ELSE + PutStr('exg\t') + tmp:=Shl(seven2six,3)+five2three + IF tmp = 8 + PrintF('d\d,d\d\n',two2zero,eleven2nine) + ELSEIF tmp = 9 + PrintF('a\d,a\d\n',two2zero,eleven2nine) + ELSEIF tmp = 17 + PrintF('a\d,d\d\n',two2zero,eleven2nine) + ELSE + illegal() + ENDIF + ENDIF + ENDIF + ENDIF +ENDPROC + +PROC code1101() + IF seven2six = 3 + PrintF('adda.\c\t',bitsize(eight)) + ea(five2three,two2zero,1) + PrintF(',a\d\n',eleven2nine) + ELSE + IF (Shr(five2three,1) = 0) AND (eight = 1) + PrintF('addx.\c\t',opsize(seven2six)) + PrintF(IF five2three AND 1 THEN '-(a\d),-(a\d)\n' ELSE 'd\d,d\d\n',two2zero,eleven2nine) + ELSE + PrintF('add.\c\t',opsize(seven2six)) + IF eight = 1 + PrintF('d\d,',eleven2nine) + ea(five2three,two2zero,0) + PutStr('\n') + ELSE + ea(five2three,two2zero,1) + PrintF(',d\d\n',eleven2nine) + ENDIF + ENDIF + ENDIF +ENDPROC + +PROC code1110() + DEF subfield,tmp2 + + IF seven2six = 3 + tmp:=pc[1]++ + tmp2:=tmp AND 31 + subfield:=Shl((eleven2nine AND 3),1)+eight + PutStr(ListItem(['bftst','bfextu','bfchg','bfexts','bfclr','bfffo','bfset','bfins'],subfield)) + PutStr('\t') + IF subfield = 7 THEN PrintF('d\d,',Shr(tmp,12) AND 7) + ea(five2three,two2zero,0) + PrintF(IF Shr(tmp,11) AND 1 THEN '{d\d:' ELSE '{\d:',Shr(tmp,6) AND 31) + PrintF(IF Shr(tmp,5) AND 1 THEN 'd\d}' ELSE '\d}',IF tmp2 THEN tmp2 ELSE 32) + + IF (subfield < 7) AND (subfield AND 1) THEN PrintF(',d\d',Shr(tmp,12) AND 7) + + PutStr('\n') + ELSE + PrintF('\s\c',ListItem(['as','ls','rox','ro'],IF seven2six=3 THEN eleven2nine ELSE five2three AND 3),IF eight=1 THEN "l" ELSE "r") + IF seven2six = 3 + PutStr('\t') + ea(five2three,two2zero,0) + PutStr('\n') + ELSE + PrintF(IF five2three AND 4 THEN '.\c\td\d,d\d\n' ELSE '\c\t#\d,d\d\n',opsize(seven2six),eleven2nine,two2zero) + ENDIF + ENDIF +ENDPROC + +PROC code() + DEF number + + isize:=2 + number:=Shl(o[],2)+o+4 + pc:=o+4 + + PutStr('\n') + + WHILE (pc < number) + hibyte:=Shr(Char(pc),4) + eleven2nine:=Shr(Char(pc),1) AND 7 + eight:=Char(pc) AND 1 + seven2six:=Shr(Char(pc+1),6) AND 3 + five2three:=Shr(Char(pc+1),3) AND 7 + two2zero:=Char(pc+1) AND 7 + + IF CtrlC() THEN error(ER_BREAK) /* essential! */ + + PrintF('L\z\h[8]:',pc-o-4) /* for offsets */ + + PutStr('\t') + + IF (hibyte > 0) AND (hibyte < 4) + PutStr(IF (eight=0) AND (seven2six=1) THEN 'movea.' ELSE 'move.') + SELECT hibyte + CASE 1; PutStr('b') + CASE 2; PutStr('l'); isize:=4 + CASE 3; PutStr('w') + ENDSELECT + PutStr('\t') + ea(five2three,two2zero,1) + PutStr(',') + ea(Shl(eight,2)+seven2six,eleven2nine,0) + PutStr('\n') + isize:=2 + ELSE + SELECT hibyte + CASE 0; /* Bit Manipulation/MOVEP/immediate */ + code0000() + CASE 4; /* Miscellaneous */ + code0100() + CASE 5; /* ADDQ/SUBQ/Scc/DBcc/TRAPcc */ + code0101() + CASE 6; /* Bcc/BSR/BRA/MOVEC */ + code0110() + CASE 7; /* MOVEQ */ + PutStr('moveq\t#') + immed(Char(pc+1)) + PrintF(',d\d\n',eleven2nine) + CASE 8; /* OR/DIV/SBCD */ + code1000() + CASE 9; /* SUB/SUBA/SUBX */ + code1001() + CASE 10; /* (unassigned, reserved) */ + illegal() + CASE 11; /* CMP/EOR */ + code1011() + CASE 12; /* AND/MUL/ABCD/EXG */ + code1100() + CASE 13; /* ADD/ADDX */ + code1101() + CASE 14; /* Shift/Rotate/Bit Field */ + code1110() + CASE 15; /* Coprocessor Interface */ + illegal() + ENDSELECT + ENDIF + pc++ + ENDWHILE + + PutStr('\n') + + o:=number +ENDPROC + diff --git a/amigae33a/E_v3.3a/Src/Src/Utils/Watch.e b/amigae33a/E_v3.3a/Src/Src/Utils/Watch.e new file mode 100644 index 0000000..979787c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Utils/Watch.e @@ -0,0 +1,48 @@ +/* Watch a file by notification + +pops up a requester when a file gets modified. +USAGE: watch +EXAMPLE: run >NIL: watch >NIL: s:startup-sequence + +needs v37 + +simply "watches" a file, using the new notification system +of kick2.0. note: does not _prevent_ files from being modified, +just tells you. usefull, for example, if you're installing a new +software package, and you want to know wether the installer +does something funny to your startup-sequence or user-startup. + +note that the only way to stop watching is asctually modifying +the file. (or rebooting :-) + +*/ + +OPT OSVERSION=37 + +MODULE 'dos/notify' + +PROC main() /* make sure file is there: else we'll */ + DEF nreq:PTR TO notifyrequest,sig,task + IF (FileLength(arg)=-1) OR (arg[0]=0) /* never be notified */ + WriteF('file "\s" does not exist\n',arg) + CleanUp(10) + ENDIF + nreq:=New(SIZEOF notifyrequest) /* memory is cleared */ + IF nreq=NIL THEN RETURN 20 + sig:=AllocSignal(-1) /* we want to be signalled */ + IF sig=-1 THEN RETURN 10 + task:=FindTask(0) + nreq.name:=arg /* fill in structure */ + nreq.flags:=NRF_SEND_SIGNAL + nreq.port:=task /* union port/task */ + nreq.signalnum:=sig + IF StartNotify(nreq) + WriteF('Now watching: "\s"\n',arg) + Wait(Shl(1,sig)) + EasyRequestArgs(0,[20,0,0,'File "\s" modified!','Damn!'],0,[arg]) + EndNotify(nreq) + ELSE + WriteF('Could not watch "\s".\n',arg) + ENDIF + FreeSignal(sig) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Various/2ndMousePort.e b/amigae33a/E_v3.3a/Src/Src/Various/2ndMousePort.e new file mode 100644 index 0000000..69187e7 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Various/2ndMousePort.e @@ -0,0 +1,28 @@ +-> switches mouseports + +OPT OSVERSION=37 + +MODULE 'devices/input', 'exec/io' + +PROC main() + DEF request=NIL:PTR TO iostd,port=NIL + IF port:=CreateMsgPort() + IF request:=CreateIORequest(port,SIZEOF iostd) + IF OpenDevice('input.device',0,request,0)=0 + request.command:=IND_SETMPORT + request.data:=[1]:CHAR -> 0 for original port, 1 for joyport + request.length:=1 + DoIO(request) + CloseDevice(request) + ELSE + PutStr('Could not open input device\n') + ENDIF + DeleteIORequest(request) + ELSE + PutStr('Could not create iorequest\n') + ENDIF + DeleteMsgPort(port) + ELSE + PutStr('Could not open port\n') + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Various/Pi.e b/amigae33a/E_v3.3a/Src/Src/Various/Pi.e new file mode 100644 index 0000000..1236830 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Various/Pi.e @@ -0,0 +1,79 @@ +/* Another pi-calc program. + A good example of what optimizing using inline assembly can do: + The E source is a translation of the original C source, + which did 48 seconds on 250 decimals, the E version did 30 seconds. + Then, the innermost loop was translated to inline assembly, + this version (E+Asm) timed only 10 seconds (all on 7mhz). + Only a small part needed to be translated to assembly, + as that is where 99% of the calculation is performed */ + +DEF m,k,n,p,i,max,nr,handle,out,num[50]:STRING,a:PTR TO LONG + +PROC main() + WriteF('PI calc\n#of decimals (try 50-250): ') + ReadStr(stdout,num) + IF (nr:=Val(num,NIL))=0 THEN stop('Illegal #!\n') + WriteF('Busy ... press CtrlC to abort.\n\n') + max:=nr*16 + IF (a:=New(max))=NIL THEN stop('No mem!\n') + m:=nr + k:=m!*3.321-1! + WriteF('\d\c',k,13) + FOR n:=k TO 1 STEP -1 + a[0]:=a[0]+2 + p:=n*2+1 + MOVEQ #0,D7 /* D7=c */ + MOVE.L a,A0 /* A0=a array */ + MOVE.L m,D4 /* D4=i counter */ + MOVE.L p,D2 + MOVE.L n,D3 +l: MOVE.L D7,D0 /* this loop is hyper-optimized. */ + LSL.L #3,D0 + ADD.L D7,D0 /* the following is the original E equivalent */ + ADD.L D7,D0 + MOVE.L (A0),D1 /* c:=0 */ + MULU D3,D1 /* x:=a */ + ADD.L D1,D0 /* FOR i:=0 TO m */ + DIVU D2,D0 /* c:=10*c+(n*^x) */ + MOVE.L D0,D7 /* ^x:=c/p */ + EXT.L D0 /* c:=c-(^x*p) */ + MOVE.L D0,(A0) /* x:=x+4 */ + SWAP D7 /* ENDFOR */ + EXT.L D7 + ADDQ.L #4,A0 + DBRA D4,l + IF (n AND $F)=0 /* not every loop */ + WriteF('\d \c',n,13) + IF CtrlC() THEN stop('\n*** Calculation interrupted!\n') + ENDIF + ENDFOR + FOR i:=m TO 1 STEP -1 + IF a[i]>9 + a[i]:=a[i]-10 + a[i-1]:=a[i-1]+1 + ENDIF + ENDFOR + handle:=Open('ram:pi.txt',1006) + IF handle<>NIL + out:=SetStdOut(handle) + writenum() + SetStdOut(out) + Close(handle) + WriteF('\n\nSee ram:pi.txt for output.\n') + ELSE + WriteF('Could not open file!\n') + ENDIF + WriteF('\n') + writenum() +ENDPROC + +PROC stop(messy) + WriteF(messy) + CleanUp(5) +ENDPROC + +PROC writenum() + WriteF('pi=3.') + FOR i:=1 TO m DO WriteF('\d',a[i]) + WriteF('\n') +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Various/Race.e b/amigae33a/E_v3.3a/Src/Src/Various/Race.e new file mode 100644 index 0000000..5ee4461 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Various/Race.e @@ -0,0 +1,301 @@ +/* computer version of autorace game + + Just play it too see how it works. The objective is to + balance speed so that you drive fast without bumping into + things. If you drive too fast to be able to take a curve, + you loose. This game is easy to play on paper, too. + Apart from that you can design some nice curves with it :-) + +*/ + +OPT OSVERSION=37 + +MODULE 'tools/clonescreen', 'gadtools', 'libraries/gadtools', + 'intuition/screens', 'graphics/text', 'intuition/intuition', + 'graphics/rastport' + +CONST MAXP=10, + MAXBOUND=1000, + MAXTRAS=50000, + OFF=7 +CONST MAXAREA=MAXBOUND*5+10, + OURIDCMP=IDCMP_MENUPICK+IDCMP_MOUSEMOVE+IDCMP_MOUSEBUTTONS + +DEF xres=60,yres=40,xpixel,ypixel,xoff=20,yoff,xsize,ysize,window=NIL, + curx[MAXP]:LIST, cury[MAXP]:LIST, lastx[MAXP]:LIST, lasty[MAXP]:LIST, + players=2,curp,stat,midx,midy,pointx,pointy,p[18]:LIST, + kx1,kx2,ky1,ky2,boundary[MAXBOUND]:LIST,area[MAXAREA]:ARRAY, + ainfo:areainfo,tras:tmpras,nogreen=FALSE + +PROC main() + DEF screen=NIL:PTR TO screen,font=NIL:PTR TO textfont,depth,title,menu,visual + title:='AutoRace v0.1' + IF gadtoolsbase:=OpenLibrary('gadtools.library',37) + screen,window,font:=openscreenwindow(title) + IF screen + font:=Long(stdrast+52) + depth,xsize,ysize:=getcloneinfo(screen) + yoff:=screen.wbortop+font.ysize+1+30 + xpixel:=xsize-10-xoff/xres + ypixel:=ysize-10-yoff/yres + SetColour(screen,0,$04,$C2,$73) + SetColour(screen,1,$00,$00,$00) + SetColour(screen,2,$DF,$DF,$DF) + SetColour(screen,3,$E1,$5A,$03) + IF window + Colour(3,2) + TextF(10,20,'\d \d',xpixel,ypixel) + IF menu:=CreateMenusA([1,0,'Project',0,0,0,0, + 2,0,'New','n',0,0,0, + 2,0,'No Green','g',0,0,0, + 2,0,'Quit','q',0,0,0, + 1,0,'Players',0,0,0,0, + 2,0,'One','1',0,0,0, + 2,0,'Two','2',0,0,0, + 2,0,'Three','3',0,0,0, + 2,0,'Four','4',0,0,0, + 2,0,'Five','5',0,0,0, + 0,0,0,0,0,0,0]:newmenu,NIL) + IF visual:=GetVisualInfoA(screen,NIL) + IF LayoutMenusA(menu,visual,NIL) + IF SetMenuStrip(window,menu) + loop() + ClearMenuStrip(window) + ELSE + WriteF('Could not set menustrip!\n') + ENDIF + ELSE + WriteF('Could not layout menus!\n') + ENDIF + FreeVisualInfo(visual) + ELSE + WriteF('Could not get visual infos!\n') + ENDIF + FreeMenus(menu) + ELSE + WriteF('Could not create menus!\n') + ENDIF + ELSE + WriteF('Could not open window!\n') + ENDIF + ELSE + WriteF('Could not open screen!\n') + ENDIF + closeclonescreen(screen,font,window) + CloseLibrary(gadtoolsbase) + ELSE + WriteF('Could not open gadtools v37+\n') + ENDIF +ENDPROC + +PROC openscreenwindow(t) HANDLE + DEF s=NIL,w=NIL,f=NIL + s,f:=openclonescreen('Workbench',t,3) + w:=backdropwindow(s,OURIDCMP,$1B00) +EXCEPT +ENDPROC s,w,f + + +PROC wait4message(window:PTR TO window) + DEF mes:PTR TO intuimessage,type,infos + REPEAT + type:=0 + IF mes:=Gt_GetIMsg(window.userport) + type:=mes.class + IF type=IDCMP_MENUPICK + infos:=mes.code + IF infos=-1 THEN type:=0 + ELSEIF type=IDCMP_MOUSEBUTTONS + IF mes.code<>SELECTUP THEN type:=0 + ELSEIF type=IDCMP_REFRESHWINDOW + Gt_BeginRefresh(window) + Gt_EndRefresh(window,TRUE) + type:=0 + ENDIF + Gt_ReplyIMsg(mes) + ELSE + Wait(-1) + ENDIF + UNTIL type +ENDPROC type,infos + +ENUM NO_ACTION,SELECTING,GAME_OVER -> stat +CONST BACKC=2,FRONTC=1,PLAYERC=3,GRASSC=0 + +PROC loop() HANDLE + DEF quit=FALSE,class,infos,menu,item,rast:PTR TO rastport + ListCopy(boundary,[11,7, 24,5, 42,10, 45,16, 43,26, 39,29, 25,33, 10,30, 7,23, 6,17, 11,7]) + + rast:=stdrast + rast.aolpen:=GRASSC + ->rast.flags:=rast.flags OR RPF_AREAOUTLINE + rast.tmpras:=InitTmpRas(tras,NewM(MAXTRAS,2),MAXTRAS) + InitArea(ainfo,area,MAXAREA) + rast.areainfo:=ainfo + + resetgame() + REPEAT + IF stat=NO_ACTION THEN startselection() + class,infos:=wait4message(window) ->WaitIMessage(window) -> crashes? + SELECT class + CASE IDCMP_MENUPICK + menu:=infos AND %11111 + item:=Shr(infos AND %11111100000,5) + SELECT menu + CASE 0 + SELECT item + CASE 0; nogreen:=FALSE; resetgame() + CASE 1; nogreen:=TRUE; resetgame() + CASE 2; quit:=TRUE + ENDSELECT + CASE 1 + players:=item+1 + resetgame() + ENDSELECT + CASE IDCMP_MOUSEMOVE + IF stat SrcGen bla +1> EC bla +1> bla + +"bla.e" contains the routines for opening your interface, as well +as some routines to handle idcmpmessages, errors etc., and a dummy +"main" that just waits for one selection. here you can put in +your own code. see the commandline template how to stop SrcGen from +generating these routines. + +That's all there's to it. If you have problems, just check the +source that has been generated. + +TODO: + - check and implement all possible tags + - open screen. + - Wait4Message <-> IDCMP + - Other fonts than topaz-8 as gadgettext + - hotkey support? + - In gen of OpeWindowTaglist(): tag "AUTO_ADJUST,1," generated twice. + - does not generate code for reverse bevel boxes +*/ + +OPT OSVERSION=37 + +ENUM NONE,NOMEM,BADARGS,NOGTXLIB,LOADGUI,NOGUI,NOWINDOWS,NOFILEOUT +SET HASGADGETS,HASMENUS + +MODULE 'gtx', 'gadtoolsbox/forms', 'gadtoolsbox/gui', 'gadtoolsbox/gtxbase', + 'nofrag', 'libraries/gadtools', 'utility', 'intuition/gadgetclass', + 'intuition/intuition' + +DEF guiptr:guidata, + wlist:windowlist, + kinds:PTR TO LONG, + gttags1:PTR TO LONG,gttags2:PTR TO LONG,gatags:PTR TO LONG, + pgatags:PTR TO LONG,latags:PTR TO LONG,strtags:PTR TO LONG, + watags:PTR TO LONG, + win[100]:LIST, + infile[100]:STRING,outfile[100]:STRING, + mainf=TRUE,erf=TRUE,mesf=TRUE,layoutf=TRUE, + lastkind,wname + +PROC main() HANDLE + DEF myargs:PTR TO LONG,rdargs=NIL,chain=NIL,gbase:PTR TO gtxbase,valid=NIL + myargs:=[0,0,0,0,0] + IF (rdargs:=ReadArgs('GUIFILE/A,NOMAIN/S,NOERR/S,NOMES/S,NOLAYOUT/S',myargs,NIL))=NIL THEN Raise(BADARGS) + WriteF('Amiga E GadToolsBox SourceGenerator v0.4 (c) 1993 $#%!\n') + IF (gtxbase:=OpenLibrary('gadtoolsbox.library',0))=NIL THEN Raise(NOGTXLIB) + IF myargs[1] THEN mainf:=FALSE /* generate no PROC main() */ + IF myargs[2] THEN erf:=FALSE /* no error report function */ + IF myargs[3] THEN mesf:=FALSE /* no wait4message() */ + IF myargs[4] THEN layoutf:=FALSE /* no layout: all tags on one line */ + StrCopy(infile,myargs[0],ALL) + StrCopy(outfile,infile,ALL) + StrAdd(infile,'.gui',ALL) + StrAdd(outfile,'.e',ALL) + gbase:=gtxbase + nofragbase:=gbase.nofragbase + utilitybase:=gbase.utilitybase + IF (chain:=GetMemoryChain(4096))=NIL THEN Raise(NOMEM) + IF GtX_LoadGUIA(chain,infile,[RG_GUI,guiptr,RG_WINDOWLIST,wlist,RG_VALID,{valid},NIL]) THEN Raise(LOADGUI) + IF (valid AND VLF_GUI)=0 THEN Raise(NOGUI) + IF (valid AND VLF_WINDOWLIST)=0 THEN Raise(NOWINDOWS) + WriteF('Generating source...\n\n') + generate() + Raise(NONE) +EXCEPT + IF valid AND VLF_WINDOWLIST THEN GtX_FreeWindows(chain,wlist) + IF chain THEN FreeMemoryChain(chain,TRUE) + IF gtxbase THEN CloseLibrary(gtxbase) + IF rdargs THEN FreeArgs(rdargs) + WriteF('\s!\n',ListItem(['Done', + 'Out of Memory', + 'Bad args', + 'Could not open gadtoolsbox library', + 'Problems reading GUI file', + 'missing GUI definition', + 'missing window definitions', + 'problems while writing E source'],exception)) +ENDPROC + +PROC generate() + DEF fh + IF ( fh:=Open(outfile,NEWFILE) )=NIL THEN Raise(NOFILEOUT) + fh:=SetStdOut(fh) + initlists() + WriteF('/* E Source generated by SRCGEN v0.1 */\n\nOPT OSVERSION=37\n\n' + + 'MODULE ''gadtools'',''libraries/gadtools'',''intuition/intuition' + + ''',\n ''intuition/screens'', ''intuition/gadgetclass'', ''graphics/text''\n\n'+ + 'ENUM NONE,NOCONTEXT,NOGADGET,NOWB,NOVISUAL,OPENGT,NOWINDOW,NOMENUS\n\n') + WriteF('DEF') + checkwindows() + IF mesf THEN WriteF('\tinfos:PTR TO gadget,\n') + WriteF('\tscr:PTR TO screen,\n\tvisual=NIL,\n\toffx,offy,tattr\n\n') + genscreenstuff() + genwindows() + genmain() + Close(SetStdOut(fh)) +ENDPROC + +PROC genwindows() + DEF w:PTR TO projectwindow,wnum=0 + w:=wlist.first + WHILE w.next + wname:=w.name + lastkind:=-1 + WriteF('PROC open\swindow()\n',wname) + WriteF(' DEF g:PTR TO gadget\n') + WriteF(' IF (g:=CreateContext({\sglist}))=NIL THEN RETURN NOCONTEXT\n',wname) + gengadgets(w) + IF win[wnum] AND HASMENUS + WriteF(' IF (\smenus:=CreateMenusA([',wname) + genmenus(w.menus) + WriteF('0,0,0,0,0,0,0]:newmenu,NIL))=NIL THEN RETURN NOMENUS\n') + WriteF(' IF LayoutMenusA(\smenus,visual,NIL)=FALSE THEN RETURN NOMENUS\n',wname) + ENDIF + WriteF(' IF (\swnd:=OpenWindowTagList(NIL,',wname) + WriteF(IF layoutf THEN '\n [' ELSE '[') + createtags(w.tags) + IF win[wnum] AND HASGADGETS + WriteF('WA_GADGETS,\sglist,',wname) + IF layoutf THEN WriteF('\n ') + ENDIF + WriteF('NIL]))=NIL THEN RETURN NOWINDOW\n') + IF w.windowtext THEN gentexts(w.windowtext) + genboxes(w) + IF win[wnum] AND HASMENUS + WriteF(' IF SetMenuStrip(\swnd,\smenus)=FALSE THEN RETURN NOMENUS\n',wname,wname) + ENDIF + WriteF(' Gt_RefreshWindow(\swnd,NIL)\n',wname) + WriteF('ENDPROC\n\nPROC close\swindow()\n',wname) + IF win[wnum] AND HASMENUS + WriteF(' IF \swnd THEN ClearMenuStrip(\swnd)\n',wname,wname) + WriteF(' IF \smenus THEN FreeMenus(\smenus)\n',wname,wname) + ENDIF + WriteF(' IF \swnd THEN CloseWindow(\swnd)\n',wname,wname) + WriteF(' IF \sglist THEN FreeGadgets(\sglist)\n',wname,wname) + WriteF('ENDPROC\n\n') + w:=w.next + INC wnum + ENDWHILE +ENDPROC + +PROC gengadgets(w:PTR TO projectwindow) + DEF egl:PTR TO extgadgetlist,eng:PTR TO extnewgadget,ng:PTR TO newgadget,kind + egl:=w.gadgets; eng:=egl.first + IF eng=NIL THEN RETURN + WHILE eng.next + ng:=eng.newgadget /* offx,offy */ + kind:=eng.kind + WriteF(' IF (g:=CreateGadgetA(\s,g,',kinds[kind]) + IF layoutf THEN WriteF('\n ') + WriteF('[offx+\d,offy+\d,\d,\d,''\s'',' + + 'tattr,\d,\d,visual,0]:newgadget,', + ng.leftedge,ng.topedge,ng.width,ng.height,ng.gadgettext, + ng.gadgetid,ng.flags) + WriteF(IF layoutf THEN '\n [' ELSE '[') + createtags(eng.tags) + WriteF('NIL]))=NIL THEN RETURN NOGADGET\n') + lastkind:=kind + eng:=eng.next + ENDWHILE +ENDPROC + +PROC genmenus(eml:PTR TO extmenulist) + DEF enm:PTR TO extnewmenu,nm:PTR TO newmenu,ckey[10]:STRING + enm:=eml.first + IF enm=NIL THEN RETURN + WHILE enm.next + nm:=enm.newmenu + IF nm.commkey THEN StringF(ckey,'''\s''',nm.commkey) ELSE StrCopy(ckey,'0',ALL) + WriteF('\d,0,',nm.type) + WriteF(IF StrCmp(enm.menutitle,'NM_BARLABEL') THEN '-1' ELSE '''\s''',enm.menutitle) + WriteF(',\s,$\h,\d,\d,',ckey,nm.flags,nm.mutualexclude,nm.userdata) + IF layoutf THEN WriteF('\n ') + IF enm.items THEN genmenus(enm.items) + enm:=enm.next + ENDWHILE +ENDPROC + +PROC gentexts(i:PTR TO intuitext) + WriteF(' PrintIText(\swnd.rport,',wname) + IF layoutf THEN WriteF('\n ') + WriteF('[\d,\d,\d,\d,\d,tattr,''\s'',NIL]' + + ':intuitext,offx,offy)\n',i.frontpen,i.backpen, + i.drawmode,i.leftedge,i.topedge,i.itext) + IF i.nexttext THEN gentexts(i.nexttext) +ENDPROC + +PROC genboxes(w:PTR TO projectwindow) + DEF bl:PTR TO bevellist,bb:PTR TO bevelbox + bl:=w.boxes; bb:=bl.first + IF bb=NIL THEN RETURN + WHILE bb.next + WriteF(' DrawBevelBoxA(\swnd.rport,\d+offx,\d+offy,\d,\d,',wname,bb.left,bb.top,bb.width,bb.height) + IF layoutf THEN WriteF('\n ') + WriteF('[GT_VISUALINFO,visual,') + IF bb.flags AND BBF_RECESSED THEN WriteF('GTBB_RECESSED,1,') + WriteF('NIL])\n') + bb:=bb.next + ENDWHILE +ENDPROC + +PROC createtags(taglist) + DEF tag:PTR TO LONG,item,str1=NIL,v:PTR TO LONG,type=0 + WHILE tag:=NextTagItem({taglist}) + item:=tag[0] + IF (item>GT_TAGBASE) AND (GT_TAGBASE+65>item) + item:=item-GT_TAGBASE + IF (item>=4) AND (item<=24) + item:=item-4*2 + str1:=gttags1[item] + type:=gttags1[item+1] + ELSEIF (item>=38) AND (item<=64) + item:=item-38*2 + str1:=gttags2[item] + type:=gttags2[item+1] + ENDIF + ELSEIF (item>GA_DUMMY) AND (GA_DUMMY+25>item) + item:=item-GA_DUMMY-1*2 + str1:=gatags[item] + type:=gatags[item+1] + ELSEIF (item>PGA_DUMMY) AND (PGA_DUMMY+11>item) + item:=item-PGA_DUMMY-1*2 + str1:=pgatags[item] + type:=pgatags[item+1] + ELSEIF (item>STRINGA_DUMMY) AND (STRINGA_DUMMY+$13>item) + item:=item-STRINGA_DUMMY-1*2 + str1:=strtags[item] + type:=strtags[item+1] + ELSEIF (item>LAYOUTA_DUMMY) AND (LAYOUTA_DUMMY+25>item) + item:=item-LAYOUTA_DUMMY-1*2 + str1:=latags[item] + type:=latags[item+1] + ELSEIF (item>=$80000064) AND (item<=$80000092) + item:=item-$80000064*2 + str1:=watags[item] + type:=watags[item+1] + ENDIF + WriteF(IF str1 THEN str1 ELSE '$\h',tag[0]) + WriteF(',') + v:=tag[1] + /* 0=num, 1=(list), 2=array of text, 3=text, 4="NIL", 5="tattr", 6="visual" + 7="g/NIL", 8=(ptr to menu), 9="scr", 10="_", 11="+offx", 12="+offy" */ + SELECT type + CASE 0 + WriteF(IF (v>=-100) AND (v<=500) THEN '\d' ELSE '$\h',v) + CASE 2 + WriteF('[') + WHILE v[] + WriteF('''\s'',',v[]) + v++ + ENDWHILE + WriteF('0]') + CASE 3; WriteF('''\s''',v) + CASE 5; WriteF('tattr') + CASE 6; WriteF('visual') + CASE 7; WriteF(IF lastkind=STRING_KIND THEN 'g' ELSE 'NIL') + CASE 9; WriteF('scr') + CASE 10; WriteF('"_"') + CASE 11; WriteF('offx+\d',v) + CASE 12; WriteF('offy+\d',v) + DEFAULT; WriteF('NIL') + ENDSELECT + WriteF(',') + IF layoutf THEN WriteF('\n ') + ENDWHILE +ENDPROC + +PROC checkwindows() + DEF w:PTR TO projectwindow,wname,fl,x + w:=wlist.first + WHILE w.next + wname:=w.name + LowerStr(wname) + fl:=0 + WriteF('\t\swnd:PTR TO window,\n',wname) + x:=Long(w.menus) + IF ^x + fl:=HASMENUS + WriteF('\t\smenus,\n',wname) + ENDIF + x:=Long(w.gadgets) + IF ^x + fl:=fl OR HASGADGETS + ENDIF + WriteF('\t\sglist,\n',wname) + ListAdd(win,[fl],ALL) + w:=w.next + ENDWHILE +ENDPROC + +PROC genscreenstuff() + WriteF('PROC setupscreen()\n IF (gadtoolsbase:=OpenLibrary(''gadtools' + + '.library'',37))=NIL THEN RETURN OPENGT\n IF (scr:=LockPubScreen(''' + + 'Workbench''))=NIL THEN RETURN NOWB\n IF (visual:=GetVisualInfoA(sc' + + 'r,NIL))=NIL THEN RETURN NOVISUAL\n offy:=scr.wbortop+Int(scr.rastp' + + 'ort+58)-10\n tattr:=[''topaz.font'',8,0,0]:textattr\nENDPROC\n\nPR' + + 'OC closedownscreen()\n IF visual THEN FreeVisualInfo(visual)\n IF' + + ' scr THEN UnlockPubScreen(NIL,scr)\n IF gadtoolsbase THEN CloseLib' + + 'rary(gadtoolsbase)\nENDPROC\n\n') +ENDPROC + +PROC genmain() + DEF w:PTR TO projectwindow,wname + IF mesf + WriteF('PROC wait4message(win:PTR TO window)\n' + + ' DEF mes:PTR TO intuimessage,type\n' + + ' REPEAT\n' + + ' type:=0\n' + + ' IF mes:=Gt_GetIMsg(win.userport)\n' + + ' type:=mes.class\n' + + ' IF type=IDCMP_MENUPICK\n' + + ' infos:=mes.code\n' + + ' ELSEIF (type=IDCMP_GADGETDOWN) OR (type=IDCMP_GADGETUP)\n' + + ' infos:=mes.iaddress\n' + + ' ELSEIF type=IDCMP_REFRESHWINDOW\n' + + ' Gt_BeginRefresh(win)\n' + + ' Gt_EndRefresh(win,TRUE)\n' + + ' type:=0\n' + + ' ELSEIF type<>IDCMP_CLOSEWINDOW /* remove these if you like */\n' + + ' type:=0\n' + + ' ENDIF\n' + + ' Gt_ReplyIMsg(mes)\n' + + ' ELSE\n' + + ' WaitPort(win.userport)\n' + + ' ENDIF\n' + + ' UNTIL type\n' + + 'ENDPROC type\n\n') + ENDIF + IF erf + WriteF('PROC reporterr(er)\n DEF erlist:PTR TO LONG\n IF er\n' + + ' erlist:=[''get context'',''create gadget'',''lock wb'',''get visual' + + ' infos'',\n ''open "gadtools.library" v37+'',''open window'',''create menus'']\n' + + ' EasyRequestArgs(0,[20,0,0,''Could not \\s!'',''ok''],0,[erlist[er-1]])\n' + + ' ENDIF\nENDPROC er\n\n') + ENDIF + IF mainf + WriteF('PROC main()\n ') + WriteF(IF erf THEN 'IF reporterr(setupscreen())=0\n' ELSE 'IF setupscreen()=0\n') + w:=wlist.first + WHILE w.next + wname:=w.name + WriteF(IF erf THEN ' reporterr(open\swindow())\n' ELSE ' open\swindow()\n',wname) + WriteF(IF mesf THEN ' wait4message(\swnd)\n' ELSE ' Delay(500)\n',wname) + WriteF(' close\swindow()\n',wname) + WriteF(' IF CtrlC() THEN BRA x\n') + w:=w.next + ENDWHILE + WriteF(' ENDIF\n x: closedownscreen()\nENDPROC\n\n') + ENDIF +ENDPROC + +PROC initlists() + + kinds:=['GENERIC_KIND','BUTTON_KIND','CHECKBOX_KIND','INTEGER_KIND', + 'LISTVIEW_KIND','MX_KIND','NUMBER_KIND','CYCLE_KIND','PALETTE_KIND', + 'SCROLLER_KIND','RESERVED_KIND','SLIDER_KIND','STRING_KIND','TEXT_KIND'] + + /* GT_TAGBASE 4-23 */ + + gttags1:=['GTCB_CHECKED',0,'GTLV_TOP',0,'GTLV_LABELS',1,'GTLV_READONLY',0, + 'GTLV_SCROLLWIDTH',0,'GTMX_LABELS',2,'GTMX_ACTIVE',0,'GTTX_TEXT',3, + 'GTTX_COPYTEXT',0,'GTNM_NUMBER',0,'GTCY_LABELS',2,'GTCY_ACTIVE',0, + 'GTPA_DEPTH',0,'GTPA_COLOR',0,'GTPA_COLOROFFSET',0, + 'GTPA_INDICATORWIDTH',0,'GTPA_INDICATORHEIGHT',0,'GTSC_TOP',0, + 'GTSC_TOTAL',0,'GTSC_VISIBLE',0] + + /* GT_TAGBASE 38-64 */ + + gttags2:=['GTSL_MIN',0,'GTSL_MAX',0,'GTSL_LEVEL',0,'GTSL_MAXLEVELLEN',0, + 'GTSL_LEVELFORMAT',3,'GTSL_LEVELPLACE',0,'GTSL_DISPFUNC',4, + 'GTST_STRING',3,'GTST_MAXCHARS',0,'GTIN_NUMBER',0, + 'GTIN_MAXCHARS',0,'GTMN_TEXTATTR',5,'GTMN_FRONTPEN',0, + 'GTBB_RECESSED',0,'GT_VISUALINFO',6,'GTLV_SHOWSELECTED',7, + 'GTLV_SELECTED',0,'GT_RESERVED0',0,'GT_RESERVED1',0, + 'GTTX_BORDER',0,'GTNM_BORDER',0,'GTSC_ARROWS',0,'GTMN_MENU',8, + 'GTMX_SPACING',0,'GTMN_FULLMENU',0,'GTMN_SECONDARYERROR',4, + 'GT_UNDERSCORE',10] + + /* GA_DUMMY 1-$24 */ + + gatags:=['GA_LEFT',0,'GA_RELRIGHT',0,'GA_TOP',0,'GA_RELBOTTOM',0, + 'GA_WIDTH',0,'GA_RELWIDTH',0,'GA_HEIGHT',0,'GA_RELHEIGHT',0, + 'GA_TEXT',0,'GA_IMAGE',0,'GA_BORDER',0,'GA_SELECTRENDER',0, + 'GA_HIGHLIGHT',0,'GA_DISABLED',0,'GA_GZZGADGET',0,'GA_ID',0, + 'GA_USERDATA',0,'GA_SPECIALINFO',0,'GA_SELECTED',0, + 'GA_ENDGADGET',0,'GA_IMMEDIATE',0,'GA_RELVERIFY',0, + 'GA_FOLLOWMOUSE',0,'GA_RIGHTBORDER',0,'GA_LEFTBORDER',0, + 'GA_TOPBORDER',0,'GA_BOTTOMBORDER',0,'GA_TOGGLESELECT',0, + 'GA_SYSGADGET',0,'GA_SYSGTYPE',0,'GA_PREVIOUS',0,'GA_NEXT',0, + 'GA_DRAWINFO',0,'GA_INTUITEXT',0,'GA_LABELIMAGE',0,'GA_TABCYCLE',0] + + /* PGADUMMY, 1-$A */ + + pgatags:=['PGA_FREEDOM',0,'PGA_BORDERLESS',0,'PGA_HORIZPOT',0, + 'PGA_HORIZBODY',0,'PGA_VERTPOT',0,'PGA_VERTBODY',0,'PGA_TOTAL',0, + 'PGA_VISIBLE',0,'PGA_TOP',0,'PGA_NEWLOOK',0] + + /* STRINGA_DUMMY, 1-$13 */ + + strtags:=['STRINGA_MAXCHARS',0,'STRINGA_BUFFER',0,'STRINGA_UNDOBUFFER',0, + 'STRINGA_WORKBUFFER',0,'STRINGA_BUFFERPOS',0,'STRINGA_DISPPOS',0, + 'STRINGA_ALTKEYMAP',0,'STRINGA_FONT',0,'STRINGA_PENS',0, + 'STRINGA_ACTIVEPENS',0,'STRINGA_EDITHOOK',0,'STRINGA_EDITMODES',0, + 'STRINGA_REPLACEMODE',0,'STRINGA_FIXEDFIELDMODE',0, + 'STRINGA_NOFILTERMODE',0,'STRINGA_JUSTIFICATION',0, + 'STRINGA_LONGVAL',0,'STRINGA_TEXTVAL',0,'STRINGA_EXITHELP',0] + + /* LAYOUTA_DUMMY 1-3 */ + + latags:=['LAYOUTA_LAYOUTOBJ',0,'LAYOUTA_SPACING',0,'LAYOUTA_ORIENTATION',0] + + /* $8000000, $64-$92 */ + + watags:=['WA_LEFT',0,'WA_TOP',0,'WA_WIDTH',11,'WA_HEIGHT',12,'WA_DETAILPEN',0, + 'WA_BLOCKPEN',0,'WA_IDCMP',0,'WA_FLAGS',0,'WA_GADGETS',0, + 'WA_CHECKMARK',0,'WA_TITLE',3,'WA_SCREENTITLE',0, + 'WA_CUSTOMSCREEN',9,'WA_SUPERBITMAP',0,'WA_MINWIDTH',0, + 'WA_MINHEIGHT',0,'WA_MAXWIDTH',0,'WA_MAXHEIGHT',0,'WA_INNERWIDTH',0, + 'WA_INNERHEIGHT',0,'WA_PUBSCREENNAME',0,'WA_PUBSCREEN',0, + 'WA_PUBSCREENFALLBACK',0,'WA_WINDOWNAME',0,'WA_COLORS',0, + 'WA_ZOOM',0,'WA_MOUSEQUEUE',0,'WA_BACKFILL',0,'WA_RPTQUEUE',0, + 'WA_SIZEGADGET',0,'WA_DRAGBAR',0,'WA_DEPTHGADGET',0, + 'WA_CLOSEGADGET',0,'WA_BACKDROP',0,'WA_REPORTMOUSE',0, + 'WA_NOCAREREFRESH',0,'WA_BORDERLESS',0,'WA_ACTIVATE',0, + 'WA_RMBTRAP',0,'WA_WBENCHWINDOW',0,'WA_SIMPLEREFRESH',0, + 'WA_SMARTREFRESH',0,'WA_SIZEBRIGHT',0,'WA_SIZEBBOTTOM',0, + 'WA_AUTOADJUST',0,'WA_GIMMEZEROZERO',0,'WA_MENUHELP',0] + +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Various/Trees.e b/amigae33a/E_v3.3a/Src/Src/Various/Trees.e new file mode 100644 index 0000000..56d3111 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Various/Trees.e @@ -0,0 +1,43 @@ +/* A different style of programming in E: + working with and building large dynamic datastructures + without using the keyword PTR + + / \ + / \ + / \ + / \ / \ + /\ /\ /\ /\ +1 2 3 4 5 6 7 8 + +*/ + +PROC main() + DEF tree,a + tree:=node( + node( + node(leaf(1),leaf(2)), + node(leaf(3),leaf(4)) + ), + node( + node(leaf(5),leaf(6)), + node(leaf(7),leaf(8)) + ) + ) + WriteF('sum = \d\n',sum(tree)) + FOR a:=1 TO 10 + tree:=node(leaf(100),tree) + WriteF('sum = \d\n',sum(tree)) + ENDFOR +ENDPROC + +PROC node(l,r) IS NEW ["node",l,r] +PROC leaf(n) IS NEW ["leaf",n] + +PROC sum(t) + DEF left,right,n + IF t <=> ["node",left,right] + RETURN sum(left)+sum(right) + ELSEIF t <=> ["leaf",n] + RETURN n + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Various/breukfind.e b/amigae33a/E_v3.3a/Src/Src/Various/breukfind.e new file mode 100644 index 0000000..32deef6 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Various/breukfind.e @@ -0,0 +1,35 @@ +/* find breuk + +try: 0.14159 -> 1/7 (22/7 = pi) +try: 0.618034 -> fibonacci +try: 0.1234568 -> 10/81 + +*/ + +PROC main() + DEF br[20]:STRING,b,max=1,a,best=2.0,bst,bsta,d,s[20]:STRING,t[20]:STRING,u[20]:STRING + b:=RealVal(arg) + WriteF('Ctrl-C to stop searching for \s ...\n',RealF(s,b,7)) + WHILE CtrlC()=FALSE + bst:=2.0 + FOR a:=0 TO max + d:=dist(a!/(max!),b) + IF !d DokkeNou! + +OPT OSVERSION=37, PREPROCESS + +MODULE 'tools/file', 'tools/ctype' + +DEF slist:PTR TO LONG,snum,scur=0,ofh=NIL,tabwidth=8, + detailstemp[1000]:STRING,style + +PROC main() HANDLE + DEF m=NIL,l,args:PTR TO LONG,rdargs=NIL,texf[100]:STRING,x + args:=[0,0,0,0,0,0] + IF (rdargs:=ReadArgs('TEXT/A,TEXFILE,TABWIDTH/K/N,STYLE,A4/S,A4COL/S',args,NIL))=NIL THEN Raise("ARGS") + IF args[1] + texf:=args[1] + ELSE + IF (x:=InStr(args[0],'.'))<1 THEN x:=ALL + StrCopy(texf,args[0],x) + StrAdd(texf,'.tex') + ENDIF + IF args[2] THEN tabwidth:=Long(args[2]) + style:=IF args[3] THEN args[3] ELSE '' + IF args[4] THEN style:='[a4din]' + IF args[5] THEN style:='[a4din,twocolumn]' + WriteF('DokkeNou! (c) 1994 Text2Tex conversion by Wouter\n' + + 'converting "\s" to "\s"\n',args[0],texf) + m,l:=readfile(args[0]) + snum:=countstrings(m,l) + slist:=stringsinfile(m,l,snum) + IF (ofh:=Open(texf,NEWFILE))=NIL THEN Raise("OPEN") + all() +EXCEPT DO + IF rdargs THEN FreeArgs(rdargs) + IF m THEN freefile(m) + IF ofh THEN Close(ofh) + SELECT exception + CASE "ARGS"; WriteF('Bad Args!\n') + CASE "EOF"; WriteF('Done.\n') + DEFAULT; WriteF('exception: "\s" (\h), info: "\s"\n', + [exception,0],exception,IF exceptioninfo THEN exceptioninfo ELSE '') + ENDSELECT +ENDPROC + +PROC next(n) IS IF scur+n" ") AND (c<>"\t") + +PROC spaces(s) + DEF n=0 + LOOP + IF s[]=" " + n++ + ELSEIF s[]="\t" + n:=n+tabwidth + ELSE + RETURN n,s + ENDIF + s++ + ENDLOOP +ENDPROC + +PROC all() HANDLE + DEF str[3]:ARRAY OF LONG,a=0,s,d + REPEAT + s:=GETCUR + d,s:=spaces(s) + IF s[] THEN str[a++]:=s + getnext() + UNTIL a=3 + put('% generated by DokkeNou! (tm) text2tex formatting utility (c) Wouter 1994\n\n') + put('\\documentstyle') + put(style) + put('{article}\n') + put('\\title{') + put(str[0]) + put('}\n\\author{') + put(str[1]) + put('}\n\\date{') + put(str[2]) + put('}\n') + put('\\begin{document}\\maketitle\n') + process() +EXCEPT DO + putln('\\end{document}') + ReThrow() +ENDPROC + +PROC process(indent=0) + DEF s,sn,sp,spn,numblank=0 + s:=GETCUR + LOOP + s[-1]:=" " + IF s[] + IF numblank>1 THEN putln('\\vskip .0cm\\noindent ') + numblank:=0 + ELSE + numblank++ + ENDIF + sp,s:=spaces(s) + IF spic) OR isnotwhite(s[1]) + BACK +EXCEPT DO + put('\\end{itemize}\n') + ReThrow() +ENDPROC + +PROC verbatim(s) HANDLE + DEF d + put('\\begin{verbatim}\n') + REPEAT + putln(s+1) + d,s:=spaces(getnext()) + UNTIL (s[]<>">") OR isnotwhite(s[1]) + BACK +EXCEPT DO + put('\\end{verbatim}\n') + ReThrow() +ENDPROC + +PROC details(s) + DEF r + IF StrLen(s)>500 THEN RETURN 'TOO LONG' + r:=detailstemp + s,r:=dodet(s,r,0) + r[]:=0 +ENDPROC detailstemp + +PROC dorange(s,r,end,text,c) + IF iswhite(s[-2]) + AstrCopy(r,text) + r:=r+StrLen(text) + s,r:=dodet(s,r,end) + r[]++:="}" + ELSE + r[]++:=c + ENDIF +ENDPROC s,r + +PROC dodet(s,r,stop) + DEF c + WHILE c:=s[]++ + IF c=stop THEN RETURN s,r + SELECT 128 OF c + CASE "#","$","%","&","~","^","\\","{","}" ->,"|",">","<" + r[]++:="\\" + r[]++:=c + CASE "[" + s,r:=dorange(s,r,"]",'\\footnote{',c) -> footnotes + CASE "_" + IF isgraph(s[]) + s,r:=dorange(s,r,"_",'{\\em ',c) -> emphasized + ELSE + r[]++:="\\" + r[]++:=c + ENDIF + CASE "*" + s,r:=dorange(s,r,"*",'{\\bf ',c) -> bold + CASE "`" + IF iswhite(s[-2]) -> inline verbatim + AstrCopy(r,'\\verb|') + r:=r+STRLEN + WHILE ((c:=s[]++)<>"'") AND (c<>0) DO r[]++:=c + IF c=0 THEN s-- + r[]++:="|" + ELSE + r[]++:=c + ENDIF + DEFAULT -> normal chars + r[]++:=c + ENDSELECT + ENDWHILE + s-- +ENDPROC s,r diff --git a/amigae33a/E_v3.3a/Src/Src/Various/dokkenou/dokkenou.tex b/amigae33a/E_v3.3a/Src/Src/Various/dokkenou/dokkenou.tex new file mode 100644 index 0000000..66b8046 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Various/dokkenou/dokkenou.tex @@ -0,0 +1,68 @@ +% generated by DokkeNou! (tm) text2tex formatting utility (c) Wouter 1994 + +\documentstyle{article} +\title{DokkeNou} +\author{Wouter van Oortmerssen} +\date{sept '94} +\begin{document}\maketitle + + +\vskip .0cm\noindent +\section{Marvelous Introduction} + +Dokkenou is a tool that enables you to write plain text documents with +certain 'style'-guidelines, and then later convert it to a beautifully +typesetted TeX document automatically. If you don't know what TeX is, +this utility is of little use to you. + +\subsection{even better subsection} +As an example, this document is written in dokkenou-style. If you translate +this with dokkenou from .txt to .tex, you'll see what each feature does: + +\begin{verbatim} + 1> dokkenou dokkenou.txt +\end{verbatim} + +the result will be a \verb|dokkenou.tex|, which can be translated to .dvi the +usual way. Commandline options: + +\begin{verbatim} + TEXT/A,TEXFILE,TABWIDTH/K/N,STYLE,A4/S,A4COL/S: +\end{verbatim} + +If \verb|TEXFILE| isn't given, dokkenou automatically replaces the .txt in \verb|TEXT| +into .tex. \verb|TABWIDTH| is important, since dokkenou has to calculate indents +for itemize etc. default is 8. With \verb|STYLE| you can set the TeX \verb|\documentstyle|, +and with \verb|A4| and \verb|A4COL| you can set page-size to A4 (with or without columns). + +\subsubsection{features of dokkenou} + +\begin{itemize} +\item auto-line layout a la TeX, paragraph splits by two linefeeds, heavy splits by +more than two linefeeds. +\item itemize, as demonstated by this feature list. also nested: +\begin{itemize} +\item even nested +\begin{itemize} +\item sub-nested +\item no big deal +\end{itemize} +\item if indented more than encapsulating itemize, and starting with \verb|*| or \verb|-| +in toggle-mode +\item itemize automatically ends if text follows with lower indentation level. +\end{itemize} +\item chapters, sections and subsections underlined with \verb|=====|, \verb|-----| and \verb|*****| +as shown by this text +\item verbatim for blocks of text, and inline \verb|verbatim| +\begin{verbatim} + for n=1 to 10 + print n + end +\end{verbatim} +\item footnotes: A gnu \footnote{a wonderful african animal} +\item {\em emphasized} and {\bf bold} +\item usage of TeX special chars without problems: \# \$ \% \& \~ \_ \^ \{ \} +\item title/author/date (3 lines, see top of this text) +\end{itemize} + +\end{document} diff --git a/amigae33a/E_v3.3a/Src/Src/Various/dokkenou/dokkenou.txt b/amigae33a/E_v3.3a/Src/Src/Various/dokkenou/dokkenou.txt new file mode 100644 index 0000000..e393bb2 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Various/dokkenou/dokkenou.txt @@ -0,0 +1,57 @@ + + + DokkeNou + + Wouter van Oortmerssen + + sept '94 + + +Marvelous Introduction +====================== + +Dokkenou is a tool that enables you to write plain text documents with +certain 'style'-guidelines, and then later convert it to a beautifully +typesetted TeX document automatically. If you don't know what TeX is, +this utility is of little use to you. + +even better subsection +---------------------- +As an example, this document is written in dokkenou-style. If you translate +this with dokkenou from .txt to .tex, you'll see what each feature does: + +> 1> dokkenou dokkenou.txt + +the result will be a `dokkenou.tex', which can be translated to .dvi the +usual way. Commandline options: + +> TEXT/A,TEXFILE,TABWIDTH/K/N,STYLE,A4/S,A4COL/S: + +If `TEXFILE' isn't given, dokkenou automatically replaces the .txt in `TEXT' +into .tex. `TABWIDTH' is important, since dokkenou has to calculate indents +for itemize etc. default is 8. With `STYLE' you can set the TeX `\documentstyle', +and with `A4' and `A4COL' you can set page-size to A4 (with or without columns). + +features of dokkenou +******************** + +* auto-line layout a la TeX, paragraph splits by two linefeeds, heavy splits by + more than two linefeeds. +* itemize, as demonstated by this feature list. also nested: + - even nested + * sub-nested + * no big deal + - if indented more than encapsulating itemize, and starting with `*' or `-' + in toggle-mode + - itemize automatically ends if text follows with lower indentation level. +* chapters, sections and subsections underlined with `=====', `-----' and `*****' + as shown by this text +* verbatim for blocks of text, and inline `verbatim' + > for n=1 to 10 + > print n + > end +* footnotes: A gnu [a wonderful african animal] +* _emphasized_ and *bold* +* usage of TeX special chars without problems: # $ % & ~ _ ^ { } +* title/author/date (3 lines, see top of this text) + diff --git a/amigae33a/E_v3.3a/Src/Src/Various/freq.e b/amigae33a/E_v3.3a/Src/Src/Various/freq.e new file mode 100644 index 0000000..19707be --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Various/freq.e @@ -0,0 +1,379 @@ +/* compute frequency of words in file. read in any ascii file, and spits + the result (as table) on stdout, or process on existing freqlist + + FILE/A,SERVER/S,FREQFILE/S,ENGLISHOPTI/S,HEAVY/S + + FILE: words to process + SERVER: go into server mode + FREQFILE: expect input to be in frequency list format or just any ascii text + ENGLISHOPTI: perform merges on english words (note: needs multiple passes) + HEAVY: do heavy english opti (does more damage to semantics :-) + FREQFACTOR: minimum factor of frequency for output words in server mode [default: 100] + +*/ + +OPT REG=5,OSVERSION=37 + +MODULE 'tools/file', 'tools/exceptions', 'class/hash', 'tools/ctype', 'tools/arexx', + 'tools/constructors', 'exec/nodes', 'exec/lists' + +OBJECT hlink OF hashlink + count, sig +ENDOBJECT + +CONST NUMTOP=1000 + +DEF ght:PTR TO hashtable,pht:PTR TO hashtable, -> silly + gsize,psize, -> number of words + isheavy=FALSE,iseng=FALSE, + minsig=100,top:PTR TO lh,largest + +PROC main() HANDLE + DEF m,l,ht=NIL:PTR TO hashtable,myargs:PTR TO LONG,rdargs=NIL + myargs:=[0,0,0,0,0,0] + IF (rdargs:=ReadArgs('FILE/A,SERVER/S,FREQFILE/S,ENGLISHOPTI/S,HEAVY/S,FREQFACTOR/N',myargs,NIL))=NIL THEN Raise("ARGS") + m,l:=readfile(myargs[0]) + ght:=NEW ht.hashtable(HASH_HEAVIER) + gsize:=IF iseng:=myargs[2] THEN process_fl(m,l,ht) ELSE process(m,l,ht) + IF gsize<1 THEN gsize:=1 + isheavy:=myargs[4] + IF myargs[5] THEN minsig:=Long(myargs[5]) + IF myargs[3] THEN ht.iterate({engfilter}) + IF myargs[1] THEN server() ELSE ht.iterate({print}) +EXCEPT DO + IF rdargs THEN FreeArgs(rdargs) + report_exception() +ENDPROC + +PROC process(mem,len,ht:PTR TO hashtable,listd=NIL) + DEF p,c,a,b,h,end,hl:PTR TO hlink,numw=0,list + end:=mem+len + p:=mem + LOOP + SELECT 128 OF c:=p[]++ + CASE "\n" + IF p>end THEN RETURN numw + CASE "A" TO "Z", "a" TO "z" + IF c<="Z" THEN p[-1]:=c+32 + a:=p-1 + WHILE isalpha(c:=p[]) + IF c<="Z" THEN p[]:=c+32 + p++ + ENDWHILE + hl,h:=ht.find(a,b:=p-a) + IF hl=NIL THEN ht.add(NEW hl,h,a,b) + hl.count:=hl.count+1 + numw++ + p[]++:=0 + IF listd + ^listd:=list:=NEW [NIL,hl]:LONG + listd:=list + ENDIF + ENDSELECT + ENDLOOP +ENDPROC + +PROC process_fl(m,l,ht:PTR TO hashtable) + DEF b,h,end,hl:PTR TO hlink,v,s,numw=0 + end:=m+l + s:=m + WHILE s"\n" DO b++ + b:=b-s + hl,h:=ht.find(s,b) + IF hl=NIL THEN ht.add(NEW hl,h,s,b) + hl.count:=hl.count+v + numw:=numw+v + s:=s+b + s[]++:=0 + ENDWHILE +ENDPROC numw + +/* + ["."=checked, "*"=sem_danger, "#"=not_impl] + + safe extension optimisations: + +.. Xed X | Xe conversed +. Xied Xy crucified +. XYYed XY crammed, abhorred +.. Xing X | Xe conspiring +. Xan Xa american, an + . Xian Xy | Xia hungarian, australian +. Xier Xy copier +. Xs X conveys, as?, this? +. Xous X courageous +. Xies Xy contemporaries +. Xness X remoteness + Xy Xe argueably +.# Xly X | Xe convincingly +. Xility Xle intangibility +. Xacy Xate indelicacy + + less safe extension optimisations: + + activities -> activity -> active -> act + +* Xic X alcoholic +* Xive X | Xe constructive +** Xable X | Xe argueable +### Xial X | Xe | Xia residential +# Xtial Xce consequential +* Xism X alcoholism +* Xion X | Xe damnation, deallocation +* Xor X | Xe coordinator +# Xious Xy ceremonious +## Xant X | Xe colorant +## Xment X | Xe containment +# Xlet X booklet +.*# Xily X | Xe | Xy particularily, family? +* Xity X actuality + + not used for now: + + Xves Xfe leaves + Xer X | Xe manager? + Xward X upward, awkward?, reward? + Xar X singular? + Xss + Xibly + Xend + + safe prefix optimisations: + + unX X unacceptable -> same as "not X" + imX X imperfect, image? + inX X incoherent + + less safe prefix optimisations: + + deX X decompression + reX X rebuilt + misX X misguided + + not used for now: + + overX X overflow? + preX X prefixed? + disX X dissatisfied, discover? + upX X uproar? + superX X superimpose? + nonX X nondeterministically? + +*/ + +PROC engfilter(tl:PTR TO hlink,d) + DEF l,s,hl=NIL:PTR TO hlink,v,w,x,y,z,t[100]:STRING,min=3 ->4? + l:=tl.len + s:=tl.data + z:=s[l-1] + IF l>1 + y:=s[l-2] + IF l>2 + x:=s[l-3] + IF l>3 + w:=s[l-4] + IF l>4 THEN v:=s[l-4] + ENDIF + ENDIF + ENDIF + SELECT 128 OF z + CASE "c" + IF y="i" THEN hl:=fh(s,l-2) -> ic + CASE "d" + IF y="e" + IF x="i" -> ied + hl:=suf(t,s,l-3,'y') + ELSEIF x=w -> XXed + hl:=f(s,l-3) + ELSE -> ed + IF (hl:=f(s,l-2))=NIL THEN hl:=f(s,l-1) + ENDIF + ENDIF + CASE "e" + IF (x="i") AND (y="v") -> ive + IF (hl:=fh(s,l-3))=NIL THEN hl:=sufh(t,s,l-3,'e') + ELSEIF (w="a") AND (x="b") AND (y="l") + IF (hl:=fh(s,l-4))=NIL THEN hl:=sufh(t,s,l-4,'e') + ENDIF + CASE "g" + IF (x="i") AND (y="n") -> ing + IF (hl:=f(s,l-3))=NIL THEN hl:=suf(t,s,l-3,'e') + ENDIF + CASE "m" + IF (x="i") AND (y="s") THEN hl:=fh(s,l-3) -> ism + CASE "n" + IF y="a" + IF x="i" -> ian + IF (hl:=suf(t,s,l-3,'y'))=NIL THEN hl:=f(s,l-1) + ELSE -> an + hl:=f(s,l-1) + ENDIF + ELSEIF (y="o") AND (x="i") -> ion + IF (hl:=fh(s,l-3))=NIL THEN hl:=sufh(t,s,l-3,'e') + ENDIF + CASE "r" + IF y="o" -> or + IF (hl:=fh(s,l-2))=NIL THEN hl:=sufh(t,s,l-2,'e') + ENDIF + CASE "s" + IF (x="o") AND (y="u") -> ous + hl:=f(s,l-3) + ELSEIF (x="i") AND (y="e") -> ies + hl:=suf(t,s,l-3,'y') + ELSEIF (w="n") AND (x="e") AND (y="s") -> ness + hl:=f(s,l-4) + ELSE -> s + hl:=f(s,l-1) + ENDIF + CASE "y" + IF y="l" + IF x="i" -> ily + IF (hl:=fh(s,l-3))=NIL THEN hl:=sufh(t,s,l-3,'e') + ELSE -> ly + hl:=f(s,l-2) + ENDIF + ELSEIF (y="t") AND (x="i") + IF (v="i") AND (w="l") -> ility + hl:=suf(t,s,l-5,'le') + ELSE -> ity + hl:=fh(s,l-3) + ENDIF + ELSEIF y="c" -> acy + hl:=suf(t,s,l-2,'te') + ELSE -> y + hl:=suf(t,s,l-1,'e') + ENDIF + ENDSELECT + IF hl=NIL + min:=4 + IF IF ((x:=s[])="u") THEN s[1]="n" ELSE IF x="i" THEN -> un/in/im + ((y:=s[1])="n") OR (y="m") ELSE FALSE + hl:=f(s+2,l-2) + ENDIF + ENDIF + IF hl + IF (hl.len>=min) AND ((hl.count>1) OR (hl.count=0)) + hl.count:=hl.count+tl.count + tl.count:=0 + ENDIF + ENDIF +ENDPROC + +PROC suf(dest,src,len,suf) + StrCopy(dest,src,len) + StrAdd(dest,suf) +ENDPROC ght.find(dest,EstrLen(dest)) + +PROC f(s,l) IS ght.find(s,l) +PROC fh(s,l) IS IF isheavy THEN ght.find(s,l) ELSE NIL +PROC sufh(d,s,l,su) IS IF isheavy THEN suf(d,s,l,su) ELSE NIL + +PROC print(l:PTR TO hlink,d) + PrintF('\d[8]\t\s\n',l.count,l.data) +ENDPROC + +PROC server() + WriteF('Starting Arexx Server, port: "FREQPORT", commands: "QUIT", "FREQ"\n') + rx_HandleAll({process_msg},'FREQPORT') +ENDPROC + +PROC process_msg(s) + DEF cl,a=NIL,q=FALSE + IF (cl:=InStr(s,' '))>0 THEN a:=s+cl+1 + IF StrCmp(s,'QUIT',cl) + WriteF('Terminating server.\n') + q:=TRUE + ELSEIF StrCmp(s,'FREQ',cl) + WriteF('Processing file "\s".\n',a) + do(a) + ELSE + WriteF('Unknown Command: "\s"\n',s) + ENDIF +ENDPROC q,0,NIL + +PROC do(filename) HANDLE + DEF m=NIL,l,ht=NIL:PTR TO hashtable,list=NIL + top:=pht:=NIL + m,l:=readfile(filename) + pht:=NEW ht.hashtable(HASH_HEAVY) + psize:=process(m,l,ht,{list}) + IF psize<1 THEN psize:=1 + IF iseng THEN ht.iterate({engfilter}) + WriteF('word ratio = \d:\d\n',gsize,psize) + largest:=0 + ht.iterate({significant}) + top:=newlist() + largest:=largest/127+1 + ht.iterate({sort}) + writenewfile(list,filename) + writetop(filename) +EXCEPT DO + END top + IF pht THEN pht.end_links(SIZEOF hlink) + END pht + IF m THEN freefile(m) + report_exception() +ENDPROC + +PROC significant(phl:PTR TO hlink,d) + DEF numg=1,nump,hl:PTR TO hlink,sig + nump:=phl.count + IF hl:=ght.find(phl.data,phl.len) THEN numg:=hl.count + IF numg<1 THEN numg:=1 + IF nump<1 THEN nump:=1 + phl.sig:=sig:=Div(Div(gsize,numg),Div(psize,nump)) + IF sig>largest THEN largest:=sig +ENDPROC + +PROC sort(phl:PTR TO hlink,d) + IF phl.sig>minsig THEN Enqueue(top,newnode(NIL,phl,0,phl.sig/largest)) +ENDPROC + +PROC writenewfile(list:PTR TO LONG,fn) + DEF hl:PTR TO hlink,o:PTR TO LONG,fh,nfn[200]:STRING,numc=0 + StrCopy(nfn,fn) + StrAdd(nfn,'.sig') + IF fh:=Open(nfn,NEWFILE) + WHILE o:=list + hl:=list[1] + list:=list[] + END o[2] + IF hl.sig>minsig + IF numc+hl.len+1>78 THEN (numc:=0) BUT FputC(fh,"\n") + Fputs(fh,hl.data) + FputC(fh," ") + numc:=numc+hl.len+1 + ENDIF + ENDWHILE + FputC(fh,"\n") + Close(fh) + ELSE + WriteF('Problem opening "\s"\n',nfn) + ENDIF +ENDPROC + +PROC writetop(fn) + DEF n:PTR TO ln,o,fh,nfn[200]:STRING,hl:PTR TO hlink,num,totsig=0,f + StrCopy(nfn,fn) + StrAdd(nfn,'.top') + IF fh:=Open(nfn,NEWFILE) + n:=top.head; num:=0 + WHILE o:=n.succ + hl:=n.name; num++; EXIT num=NUMTOP; totsig:=totsig+hl.sig; n:=o + ENDWHILE + f:=totsig/num/100+1 + WriteF('tot=\d,num=\d,f=\d\n',totsig,num,f) + n:=top.head; num:=0 + WHILE o:=n.succ + hl:=n.name; num++; EXIT num=NUMTOP; VfPrintf(fh,'\s:\d\n',[hl.data,hl.sig/f]:LONG); END n; n:=o + ENDWHILE + FputC(fh,"\n") + Close(fh) + ELSE + WriteF('Problem opening "\s"\n',nfn) + ENDIF +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Various/huff.e b/amigae33a/E_v3.3a/Src/Src/Various/huff.e new file mode 100644 index 0000000..164d342 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Various/huff.e @@ -0,0 +1,112 @@ +/* huffman crunching in E + + all it does is tell you how much gain you would have had + if crunching with huffman, it doesn't actually do it. + + sorry for the messy implementation here and there +*/ + +MODULE 'tools/file' + +PROC countfreq(adr,num,freq:PTR TO LONG) + DEF a,ch,list=NIL + FOR a:=0 TO 255 DO freq[a]:=0 + FOR a:=1 TO num + ch:=adr[]++ + freq[ch]:=freq[ch]+1 + ENDFOR + FOR a:=0 TO 255 DO list:=Link(c([freq[a],a]),list) +ENDPROC Link(c([]),list) + +PROC c(l) + DEF m + IF (m:=List(ListLen(l)))=NIL THEN Raise("MEM") + ListCopy(m,l) +ENDPROC m + +PROC takelowest(list:PTR TO LONG) + DEF l:PTR TO LONG,lf=1000000000,lp + WHILE l:=Next(list) + IF l[]1 + lowest:=takelowest(trees) + low:=takelowest(trees) + Link(trees,Link(c([lowest[]+low[],lowest,low]),Next(trees))) + DEC numtrees + ENDWHILE +ENDPROC Next(trees) + +PROC writetree(tree:PTR TO LONG,off=0) + DEF a + IF ListLen(tree)=2 + IF off THEN FOR a:=1 TO off DO WriteF(' ') + WriteF('[char=\d,freq=\d]\n',tree[1],tree[]) + ELSE + writetree(tree[1],off+1) + writetree(tree[2],off+1) + ENDIF +ENDPROC + +PROC computetree(tree:PTR TO LONG,res:PTR TO LONG,bit,depth=0) + DEF a,b,r:PTR TO LONG,t,ar + IF ListLen(tree)=2 + r:=36*tree[1]+res + r[0]:=depth + ar:=bit + FOR a:=1 TO 8 + t:=0 + FOR b:=0 TO 31 DO t:=t+IF ar[]++ THEN Shl(1,b) ELSE 0 + r[a]:=t + ENDFOR + ELSE + bit[depth]:=1 + computetree(tree[1],res,bit,depth+1) + bit[depth]:=0 + computetree(tree[2],res,bit,depth+1) + ENDIF +ENDPROC + +PROC writebits(b:PTR TO LONG) + DEF a,d,e + d:=b + FOR a:=0 TO 255 + WriteF('b=\d\td=\d\t',b-d/36,b[]++) + FOR e:=0 TO 7 DO WriteF('\h[8]',b[]++) + WriteF('\n') + ENDFOR +ENDPROC + +PROC crunch(adr,num) + DEF trees, huffbits, bitarray[256]:ARRAY OF CHAR, a,freq[256]:ARRAY OF LONG,t=0 + trees:=countfreq(adr,num,freq) + trees:=optimize(trees) + ->writetree(trees) + FOR a:=0 TO 255 DO bitarray[a]:=0 + computetree(trees,huffbits:=NewR(36*256),bitarray) + ->writebits(huffbits) + FOR a:=0 TO 255 DO t:=t+Mul(freq[a],Long(a*36+huffbits)) + WriteF('%crunched(gain)=\d%\n',100-Div(Mul(Div(t,8),100),num)) +ENDPROC + +PROC main() HANDLE + DEF m,l + m,l:=readfile(arg) + WriteF('crunching file \s length \d\n',arg,l) + crunch(m,l) +EXCEPT + SELECT exception + CASE "MEM"; WriteF('No Mem!\n') + CASE "OPEN"; WriteF('No File!\n') + ENDSELECT +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Various/prime.e b/amigae33a/E_v3.3a/Src/Src/Various/prime.e new file mode 100644 index 0000000..b6cf13c --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Various/prime.e @@ -0,0 +1,4 @@ +PROC main() + DEF i=9,j=99 + WHILE i-- DO IF Mod(j,i)=0 THEN IF i-- THEN i:=j-- ELSE WriteF('\d ',j) +ENDPROC diff --git a/amigae33a/E_v3.3a/Src/Src/Various/radix.e b/amigae33a/E_v3.3a/Src/Src/Various/radix.e new file mode 100644 index 0000000..a8a29c8 --- /dev/null +++ b/amigae33a/E_v3.3a/Src/Src/Various/radix.e @@ -0,0 +1,108 @@ +/* Super fast sort program. + whereas slow methods like quicksort/mergesort use O(n * log n) methods, + radixsort is a true O(n) method. Especially for large textfiles, it is a + LOT faster than other sorters (a log order of magnitude ;-). + Radixsort uses a 256 buckets at each level to put the strings in. arrays + of buckets are only allocated when the number of strings left to sort is + large. + Radix.e reads from a file, and outputs to stdout. +*/ + +MODULE 'tools/file', 'tools/exceptions' + +DEF rad1:PTR TO LONG,radsize:PTR TO LONG + +OBJECT str + next,data +ENDOBJECT + +PROC main() HANDLE + DEF m,l,n,list + m,l:=readfile(arg) + n:=countstrings(m,l) + list:=stringsinfilenolist(m,l,n) + doradix(NEW rad1[256],NEW radsize[256],list,n) + restradix(rad1,radsize) +EXCEPT + report_exception() +ENDPROC + +PROC doradix(table:PTR TO LONG,size:PTR TO LONG,str:PTR TO LONG,num) + DEF a,s,c + FOR a:=1 TO num + s:=str[]++ + c:=s[] + table[c]:=NEW [table[c],s]:str + size[c]:=size[c]+1 + ENDFOR +ENDPROC + +PROC restradix(table:PTR TO LONG,size:PTR TO LONG,level=1) + DEF a + FOR a:=0 TO 255 DO recradix(table[]++,size[]++,level) +ENDPROC + +PROC recradix(l:PTR TO str,num,level) + DEF tab:PTR TO LONG,size:PTR TO LONG,s,c,temp:PTR TO str + IF num + IF num<20 + straight(l,num) + ELSE + NEW tab[256],size[256] + WHILE l + s:=l.data + temp:=l + l:=l.next + c:=s[level] + temp.next:=tab[c] + tab[c]:=temp + size[c]:=size[c]+1 + ENDWHILE + restradix(tab,size,level+1) + END tab[256],size[256] + ENDIF + ENDIF +ENDPROC + +PROC straight(l:PTR TO str,num) -> sort these with a silly method + DEF a,tl:PTR TO str,best:PTR TO str,fbest + fbest:=[NIL,[$7F7F7F7F,$7F7F7F7F,$7F7F7F7F,0]:LONG]:str + FOR a:=1 TO num + tl:=l + best:=fbest + WHILE tl + IF tl.data THEN IF OstrCmp(best.data,tl.data)=-1 THEN best:=tl + tl:=tl.next + ENDWHILE + IF best<>fbest + PutStr(best.data) + FputC(stdout,"\n") + best.data:=NIL + ENDIF + ENDFOR +ENDPROC + +PROC stringsinfilenolist(mem,len,max) -> to eliminate 32k strings boundary + DEF list:PTR TO LONG,l + NEW list[max] + MOVE.L list,A1 + MOVE.L max,D3 + MOVE.L mem,A0 + MOVE.L A0,D1 + ADD.L len,D1 + MOVEQ #0,D0 + MOVEQ #10,D2 +stringsl: + CMP.L D3,D0 + BPL.S done + ADDQ.L #1,D0 + MOVE.L A0,(A1)+ +findstringl: + CMP.B (A0)+,D2 + BNE.S findstringl + CLR.B -1(A0) + CMPA.L D1,A0 + BMI.S stringsl +done: + MOVE.L D0,l +ENDPROC list,l