mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 16:52:25 +00:00
added newt example with buttons. updated newt wrapper. -- noch.
Former-commit-id: 0aecdbd935
This commit is contained in:
parent
ae02654300
commit
7de984b46a
5 changed files with 143 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ VOC = /opt/voc/bin/voc
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(VOC) -s newt.Mod newttest.Mod -m
|
$(VOC) -s newt.Mod newttest.Mod -m
|
||||||
|
$(VOC) -s newt.Mod newttest2.Mod -m
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm *.h
|
rm *.h
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,21 @@ NEWTvARGvAPPEND*= -1;
|
||||||
TYPE Int32* = INTEGER;
|
TYPE Int32* = INTEGER;
|
||||||
Int64* = LONGINT;
|
Int64* = LONGINT;
|
||||||
|
|
||||||
|
ComponentStruct* = RECORD
|
||||||
|
height*, width*,
|
||||||
|
top*, left*,
|
||||||
|
takesFocus*,
|
||||||
|
isMapped*: Int32
|
||||||
|
END;
|
||||||
|
|
||||||
|
Component* = POINTER TO ComponentStruct;
|
||||||
|
|
||||||
|
ExitStruct* = RECORD
|
||||||
|
reason*: Int32;
|
||||||
|
watch*, key*: Int32;
|
||||||
|
co* : Component;
|
||||||
|
END;
|
||||||
|
|
||||||
PROCEDURE -newtInit(): Int32
|
PROCEDURE -newtInit(): Int32
|
||||||
"newtInit()";
|
"newtInit()";
|
||||||
|
|
||||||
|
|
@ -123,6 +138,22 @@ BEGIN
|
||||||
newtPopHelpLine();
|
newtPopHelpLine();
|
||||||
END PopHelpLine;
|
END PopHelpLine;
|
||||||
|
|
||||||
|
PROCEDURE -newtSuspend()
|
||||||
|
"newtSuspend()";
|
||||||
|
|
||||||
|
PROCEDURE Suspend*();
|
||||||
|
BEGIN
|
||||||
|
newtSuspend()
|
||||||
|
END Suspend;
|
||||||
|
|
||||||
|
PROCEDURE -newtResume()
|
||||||
|
"newtResume()";
|
||||||
|
|
||||||
|
PROCEDURE Resume*;
|
||||||
|
BEGIN
|
||||||
|
newtResume()
|
||||||
|
END Resume;
|
||||||
|
|
||||||
PROCEDURE -newtBell()
|
PROCEDURE -newtBell()
|
||||||
"newtBell()";
|
"newtBell()";
|
||||||
|
|
||||||
|
|
@ -137,6 +168,86 @@ BEGIN
|
||||||
newtGetScreenSize(cols, rows)
|
newtGetScreenSize(cols, rows)
|
||||||
END GetScreenSize;
|
END GetScreenSize;
|
||||||
|
|
||||||
|
PROCEDURE -newtCenteredWindow(width, height: Int32; title: ARRAY OF CHAR): Int32
|
||||||
|
"newtCenteredWindow(width, height, title)";
|
||||||
|
|
||||||
|
PROCEDURE CenteredWindow*(width, height: Int32; title: ARRAY OF CHAR): Int32;
|
||||||
|
BEGIN
|
||||||
|
RETURN newtCenteredWindow(width, height, title)
|
||||||
|
END CenteredWindow;
|
||||||
|
|
||||||
|
PROCEDURE -newtOpenWindow(left, top, width, height: Int32; title: ARRAY OF CHAR): Int32
|
||||||
|
"newtOpenWindow(left, top, width, height, title)";
|
||||||
|
|
||||||
|
PROCEDURE OpenWindow*(left, top, width, height: Int32; title: ARRAY OF CHAR): Int32;
|
||||||
|
BEGIN
|
||||||
|
RETURN newtOpenWindow(left, top, width, height, title)
|
||||||
|
END OpenWindow;
|
||||||
|
|
||||||
|
PROCEDURE -newtPopWindow()
|
||||||
|
"newtPopWindow()";
|
||||||
|
|
||||||
|
PROCEDURE PopWindow*();
|
||||||
|
BEGIN
|
||||||
|
newtPopWindow
|
||||||
|
END PopWindow;
|
||||||
|
|
||||||
|
PROCEDURE -newtForm(vertBar: Component; help: ARRAY OF CHAR; flags: Int32): Component
|
||||||
|
"newtForm(vertBar, help, flags)";
|
||||||
|
|
||||||
|
PROCEDURE Form*(vertBar: Component; help: ARRAY OF CHAR; flags: Int32): Component;
|
||||||
|
BEGIN
|
||||||
|
RETURN newtForm(vertBar, help, flags);
|
||||||
|
END Form;
|
||||||
|
|
||||||
|
PROCEDURE -newtFormAddComponent(form, co: Component)
|
||||||
|
"newtFormAddComponent(form, co)";
|
||||||
|
|
||||||
|
PROCEDURE FormAddComponent*(form, co: Component);
|
||||||
|
BEGIN
|
||||||
|
newtFormAddComponent(form, co);
|
||||||
|
END FormAddComponent;
|
||||||
|
|
||||||
|
PROCEDURE -newtRunForm(form: Component): Component
|
||||||
|
"newtRunForm(form)";
|
||||||
|
|
||||||
|
PROCEDURE RunForm*(form: Component): Component; (* obsolete *)
|
||||||
|
BEGIN
|
||||||
|
RETURN newtRunForm(form)
|
||||||
|
END RunForm;
|
||||||
|
|
||||||
|
PROCEDURE -newtFormRun(co: Component; VAR es: ExitStruct)
|
||||||
|
"newtFormRun(co, es)";
|
||||||
|
|
||||||
|
PROCEDURE FormRun*(co: Component; VAR es: ExitStruct);
|
||||||
|
BEGIN
|
||||||
|
newtFormRun(co, es)
|
||||||
|
END FormRun;
|
||||||
|
|
||||||
|
PROCEDURE -newtFormDestroy(form: Component)
|
||||||
|
"newtFormDestroy(form)";
|
||||||
|
|
||||||
|
PROCEDURE FormDestroy*(form: Component);
|
||||||
|
BEGIN
|
||||||
|
newtFormDestroy(form)
|
||||||
|
END FormDestroy;
|
||||||
|
|
||||||
|
PROCEDURE -newtButton(left, top: Int32; text: ARRAY OF CHAR): Component
|
||||||
|
"newtButton(left, top, text)";
|
||||||
|
|
||||||
|
PROCEDURE Button*(left, top: Int32; text: ARRAY OF CHAR): Component;
|
||||||
|
BEGIN
|
||||||
|
RETURN newtButton(left, top, text)
|
||||||
|
END Button;
|
||||||
|
|
||||||
|
PROCEDURE -newtCompactButton(left, top: Int32; text: ARRAY OF CHAR): Component
|
||||||
|
"newtCompactButton(left, top, text)";
|
||||||
|
|
||||||
|
PROCEDURE CompactButton*(left, top: Int32; text: ARRAY OF CHAR): Component;
|
||||||
|
BEGIN
|
||||||
|
RETURN newtCompactButton(left, top, text);
|
||||||
|
END CompactButton;
|
||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ MODULE newttest;
|
||||||
IMPORT newt, oocIntStr, Unix;
|
IMPORT newt, oocIntStr, Unix;
|
||||||
VAR i, j, k : newt.Int32;
|
VAR i, j, k : newt.Int32;
|
||||||
str : ARRAY 32 OF CHAR;
|
str : ARRAY 32 OF CHAR;
|
||||||
|
fo, co : newt.Component;
|
||||||
BEGIN
|
BEGIN
|
||||||
i := newt.Init();
|
i := newt.Init();
|
||||||
newt.Cls();
|
newt.Cls();
|
||||||
|
|
@ -28,7 +29,9 @@ newt.PopHelpLine();
|
||||||
newt.Refresh();
|
newt.Refresh();
|
||||||
i := Unix.Sleep(1);
|
i := Unix.Sleep(1);
|
||||||
|
|
||||||
|
fo := newt.Form(NIL, "aaa", 0);
|
||||||
|
co := newt.Button(15, 15, "OK");
|
||||||
|
newt.FormAddComponent(fo, co);
|
||||||
newt.WaitForKey();
|
newt.WaitForKey();
|
||||||
newt.Delay(30);
|
newt.Delay(30);
|
||||||
i := newt.Finished();
|
i := newt.Finished();
|
||||||
|
|
|
||||||
26
src/test/newt/newttest2.Mod
Normal file
26
src/test/newt/newttest2.Mod
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
MODULE newttest2;
|
||||||
|
|
||||||
|
IMPORT newt, oocIntStr, Unix;
|
||||||
|
VAR i, j, k : newt.Int32;
|
||||||
|
str : ARRAY 32 OF CHAR;
|
||||||
|
form, b1, b2, comp: newt.Component;
|
||||||
|
BEGIN
|
||||||
|
i := newt.Init();
|
||||||
|
newt.Cls();
|
||||||
|
|
||||||
|
str := "hello world!";
|
||||||
|
i := newt.OpenWindow(10, 5, 40, 6, "Button Sample");
|
||||||
|
|
||||||
|
b1 := newt.Button(10, 1, "OK");
|
||||||
|
b2 := newt.CompactButton(22, 2, "Cancel");
|
||||||
|
|
||||||
|
|
||||||
|
form := newt.Form(NIL, "aaa", 0);
|
||||||
|
newt.FormAddComponent(form, b1);
|
||||||
|
newt.FormAddComponent(form, b2);
|
||||||
|
comp := newt.RunForm(form);
|
||||||
|
newt.WaitForKey();
|
||||||
|
newt.Delay(30);
|
||||||
|
newt.FormDestroy(form);
|
||||||
|
i := newt.Finished();
|
||||||
|
END newttest2.
|
||||||
|
|
@ -1 +1 @@
|
||||||
7ce73aa13bfab8e21eda71e0e351d5d5395e6bd3
|
6ba9f2d70e2bad97118512d33e656f8d3430596c
|
||||||
Loading…
Add table
Add a link
Reference in a new issue