From 95b512baf4639a2b304fc765cc87f59454607bbe Mon Sep 17 00:00:00 2001 From: Antranig Vartanian Date: Sat, 11 May 2024 19:17:23 +0400 Subject: [PATCH] post rebranding --- README.md | 30 ++++---- build/obe | Bin 0 -> 34480 bytes build/obe.c | 44 ++++++++++++ build/obe.dSYM/Contents/Info.plist | 20 ++++++ build/obe.dSYM/Contents/Resources/DWARF/obe | Bin 0 -> 10282 bytes .../Resources/Relocations/aarch64/obe.yml | 10 +++ .../unixstyle_oberon_traditional/makefile | 0 .../unixstyle_oberon_traditional/partest.Mod | 0 .../partest.Mod.ob2 | 63 ++++++++++++++++ .../unixstyle_oberon_traditional/readme.md | 0 {arrays => examples/arrays}/Arrays.Mod | 0 examples/arrays/Arrays.Mod.ob2 | 42 +++++++++++ {arrays => examples/arrays}/Makefile | 0 {case => examples/case}/Case.Mod | 0 examples/case/Case.Mod.ob2 | 14 ++++ {case => examples/case}/Makefile | 0 .../constants}/Constants.Mod | 0 examples/constants/Constants.Mod.ob2 | 14 ++++ {constants => examples/constants}/Makefile | 0 .../enums_example}/0/Days.Mod | 0 examples/enums_example/0/Days.Mod.ob2 | 68 ++++++++++++++++++ .../enums_example}/0/readme.md | 0 .../enums_example}/0/test.Mod | 0 .../enums_example/0/test.Mod.ob2 | 0 .../enums_example}/1/Days.Mod | 0 examples/enums_example/1/Days.Mod.ob2 | 33 +++++++++ .../enums_example}/1/readme.md | 0 examples/enums_example/1/test.Mod | 22 ++++++ examples/enums_example/1/test.Mod.ob2 | 22 ++++++ {for => examples/for}/For.Mod | 0 examples/for/For.Mod.ob2 | 19 +++++ {for => examples/for}/Makefile | 0 .../hello-world}/Console/Hello.Mod | 0 examples/hello-world/Console/Hello.Mod.ob2 | 10 +++ .../hello-world}/Console/Makefile | 0 .../hello-world}/Out/Hello.Mod | 0 examples/hello-world/Out/Hello.Mod.ob2 | 9 +++ .../hello-world}/Out/Makefile | 0 {ifelse => examples/ifelse}/IfElse.Mod | 0 examples/ifelse/IfElse.Mod.ob2 | 49 +++++++++++++ {ifelse => examples/ifelse}/Makefile | 0 .../procedures}/function-procedure/Makefile | 0 .../procedures}/function-procedure/Square.Mod | 0 .../function-procedure/Square.Mod.ob2 | 20 ++++++ .../procedures}/procedure/Makefile | 0 .../procedures}/procedure/Procedure.Mod | 0 .../procedures/procedure/Procedure.Mod.ob2 | 15 ++++ .../procedures}/var-parameter/Makefile | 0 .../procedures}/var-parameter/VarParam.Mod | 0 .../procedures/var-parameter/VarParam.Mod.ob2 | 24 +++++++ {records => examples/records}/Records.Mod | 0 examples/records/Records.Mod.ob2 | 53 ++++++++++++++ {recursion => examples/recursion}/Fib.Mod | 0 examples/recursion/Fib.Mod.ob2 | 33 +++++++++ {recursion => examples/recursion}/Gcd.Mod | 0 examples/recursion/Gcd.Mod.ob2 | 31 ++++++++ .../value-types}/Makefile | 0 .../value-types}/Values.Mod | 0 examples/value-types/Values.Mod.ob2 | 12 ++++ {variables => examples/variables}/Makefile | 0 .../variables}/Variables.Mod | 0 examples/variables/Variables.Mod.ob2 | 31 ++++++++ {while => examples/while}/Makefile | 0 {while => examples/while}/While.Mod | 0 examples/while/While.Mod.ob2 | 17 +++++ src/obe.Mod | 26 +++++++ 66 files changed, 716 insertions(+), 15 deletions(-) create mode 100755 build/obe create mode 100644 build/obe.c create mode 100644 build/obe.dSYM/Contents/Info.plist create mode 100644 build/obe.dSYM/Contents/Resources/DWARF/obe create mode 100644 build/obe.dSYM/Contents/Resources/Relocations/aarch64/obe.yml rename {arguments => examples/arguments}/unixstyle_oberon_traditional/makefile (100%) rename {arguments => examples/arguments}/unixstyle_oberon_traditional/partest.Mod (100%) create mode 100644 examples/arguments/unixstyle_oberon_traditional/partest.Mod.ob2 rename {arguments => examples/arguments}/unixstyle_oberon_traditional/readme.md (100%) rename {arrays => examples/arrays}/Arrays.Mod (100%) create mode 100644 examples/arrays/Arrays.Mod.ob2 rename {arrays => examples/arrays}/Makefile (100%) rename {case => examples/case}/Case.Mod (100%) create mode 100644 examples/case/Case.Mod.ob2 rename {case => examples/case}/Makefile (100%) rename {constants => examples/constants}/Constants.Mod (100%) create mode 100644 examples/constants/Constants.Mod.ob2 rename {constants => examples/constants}/Makefile (100%) rename {enums_example => examples/enums_example}/0/Days.Mod (100%) create mode 100644 examples/enums_example/0/Days.Mod.ob2 rename {enums_example => examples/enums_example}/0/readme.md (100%) rename {enums_example => examples/enums_example}/0/test.Mod (100%) rename enums_example/1/test.Mod => examples/enums_example/0/test.Mod.ob2 (100%) rename {enums_example => examples/enums_example}/1/Days.Mod (100%) create mode 100644 examples/enums_example/1/Days.Mod.ob2 rename {enums_example => examples/enums_example}/1/readme.md (100%) create mode 100644 examples/enums_example/1/test.Mod create mode 100644 examples/enums_example/1/test.Mod.ob2 rename {for => examples/for}/For.Mod (100%) create mode 100644 examples/for/For.Mod.ob2 rename {for => examples/for}/Makefile (100%) rename {hello-world => examples/hello-world}/Console/Hello.Mod (100%) create mode 100644 examples/hello-world/Console/Hello.Mod.ob2 rename {hello-world => examples/hello-world}/Console/Makefile (100%) rename {hello-world => examples/hello-world}/Out/Hello.Mod (100%) create mode 100644 examples/hello-world/Out/Hello.Mod.ob2 rename {hello-world => examples/hello-world}/Out/Makefile (100%) rename {ifelse => examples/ifelse}/IfElse.Mod (100%) create mode 100644 examples/ifelse/IfElse.Mod.ob2 rename {ifelse => examples/ifelse}/Makefile (100%) rename {procedures => examples/procedures}/function-procedure/Makefile (100%) rename {procedures => examples/procedures}/function-procedure/Square.Mod (100%) create mode 100644 examples/procedures/function-procedure/Square.Mod.ob2 rename {procedures => examples/procedures}/procedure/Makefile (100%) rename {procedures => examples/procedures}/procedure/Procedure.Mod (100%) create mode 100644 examples/procedures/procedure/Procedure.Mod.ob2 rename {procedures => examples/procedures}/var-parameter/Makefile (100%) rename {procedures => examples/procedures}/var-parameter/VarParam.Mod (100%) create mode 100644 examples/procedures/var-parameter/VarParam.Mod.ob2 rename {records => examples/records}/Records.Mod (100%) create mode 100644 examples/records/Records.Mod.ob2 rename {recursion => examples/recursion}/Fib.Mod (100%) create mode 100644 examples/recursion/Fib.Mod.ob2 rename {recursion => examples/recursion}/Gcd.Mod (100%) create mode 100644 examples/recursion/Gcd.Mod.ob2 rename {value-types => examples/value-types}/Makefile (100%) rename {value-types => examples/value-types}/Values.Mod (100%) create mode 100644 examples/value-types/Values.Mod.ob2 rename {variables => examples/variables}/Makefile (100%) rename {variables => examples/variables}/Variables.Mod (100%) create mode 100644 examples/variables/Variables.Mod.ob2 rename {while => examples/while}/Makefile (100%) rename {while => examples/while}/While.Mod (100%) create mode 100644 examples/while/While.Mod.ob2 create mode 100644 src/obe.Mod diff --git a/README.md b/README.md index a51173b..5d316d3 100644 --- a/README.md +++ b/README.md @@ -8,21 +8,21 @@ Oberon By Example is a hands-on introduction to Oberon-2 using examples. This repository is under heavy modification to make it better for beginners. -To start, make sure you have [Vishap Oberon Compiler](https://github.com/vishaps/voc) +To start, make sure you have [Vishap Oberon Compiler](https://github.com/vishapoberon/voc) -Check out the [hello-world](https://github.com/vishaps/oberonbyexample/tree/master/hello-world) example or browse the full list below. +Check out the [hello-world](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/hello-world) example or browse the full list below. -- [Hello World](https://github.com/vishaps/oberonbyexample/tree/master/hello-world) -- [Types](https://github.com/vishaps/oberonbyexample/tree/master/value-types) -- [Variables](https://github.com/vishaps/oberonbyexample/tree/master/variables) -- [Constants](https://github.com/vishaps/oberonbyexample/tree/master/constants) -- [For](https://github.com/vishaps/oberonbyexample/tree/master/for) -- [While](https://github.com/vishaps/oberonbyexample/tree/master/while) -- [If/Else](https://github.com/vishaps/oberonbyexample/tree/master/ifelse) -- [Case](https://github.com/vishaps/oberonbyexample/tree/master/case) -- [Arrays](https://github.com/vishaps/oberonbyexample/tree/master/arrays) -- [Procedures](https://github.com/vishaps/oberonbyexample/tree/master/procedures) - - [Procedure](https://github.com/vishaps/oberonbyexample/tree/master/procedures/procedure) - - [Functions](https://github.com/vishaps/oberonbyexample/tree/master/procedures/function-procedure) - - [VAR-Parameters](https://github.com/vishaps/oberonbyexample/tree/master/procedures/var-parameter) +- [Hello World](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/hello-world) +- [Types](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/value-types) +- [Variables](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/variables) +- [Constants](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/constants) +- [For](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/for) +- [While](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/while) +- [If/Else](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/ifelse) +- [Case](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/case) +- [Arrays](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/arrays) +- [Procedures](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/procedures) + - [Procedure](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/procedures/procedure) + - [Functions](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/procedures/function-procedure) + - [VAR-Parameters](https://github.com/vishapoberon/oberonbyexample/tree/master/examples/procedures/var-parameter) - TODO diff --git a/build/obe b/build/obe new file mode 100755 index 0000000000000000000000000000000000000000..bcc41eb1783d721b2107800bd7051a459c7d0087 GIT binary patch literal 34480 zcmeI5Yitx%6vyvuixjD}0Tn@|ivm6Zo!WwckGh2}&{*20VA81Mx{ql)>2`OW-7SSy zT~jfL4`@P&A2jg6q%GkkAp~L!L=vNkN+9tOO$_yeipEDwG!(7t|J<2rr%MowUo<%< zIeX9lKF;3zo4fn%-Z_2ohd+yj&;-l}p8@~5P>3zUk4T7F@HKELn`%}E9}PA)Qtd=j zgC|y9qA1T+bd+*^ux0(kW;H%Au}(O85~|5DC1p~kjqbD~P~_)ZSZyz+(3uozTGyBr zitJd7K+04)6Hbj)<>#w-$j%pYdXV9u;=;Uj0l90~N;WVj&p2MqfDQj!i*T|KP4eRWu5pXsEN@aOv z0V>G}YbjjHwuI*~TsB`5`YH?9;~gcgK`_M?C@0R#(~!-Zm#2wB@4QG$8BUEqO?REt z;#k(sSLAAxl*2V=+qlxR|Lf}-9uC&lxqJ6y-n_E*kVCXE80GQiS}a7CxY6z_LPM3K zi=Gvt0@d`)Zh{A(=c3%xCqy^;(LQk*-hh~#`p$%33%{H-VLbho^KBX`{BYW@dM0J* zF*B@3H^rjRWH-ZU9+@|{eYLw{$?dPdRn$;dWo)QKoga=V!H}hJnu-;>;#&*vMy*<( zY8T>8tdH{0@6T)Wz02U#=G~`yBAM2^5)m~Y%n9M5#>#Tc%nZ}`{Bgc$4gMCi@im~| zx=pFH(OJG?e3TFiFqY=E>{)O}d6%P!Guf?hYWHsuVu!srs%B#XOn?b60Vco%m;e)C z0!)AjFaajO1egF5U;<2l2`~XBzyz286JP>NfC(@GCcp%k025#WOn?b60Vco%m;e)C z0!)AjFaajO1egF5U;<2l2`~XBzyz4U|AIj7lsGfm;~N_76aC*7XnUuKZ1edNas0%o zvSWMt%8m`MMEz7TvZqfT3ktCl=R9{l2&edd_$v5v_;5+!I2OD^B&++W56+4n!coqV z$%v=J7s1b=&uGtzA$({5$pZOFu8+Q38ydxT;xTNqL6)?Kxo_Mw=p5uvcv*SeA z5Xnq9W=8CDx0s7EZ%Jop>5OdvB{`i>Ckv?0@eewuTMWphaL3#u^^m1myS6k-`ADmC zy(sNYrCA)dRrU7q=F%*lmC|6RO6M$hR!RO~0!)AjFaajO1egF5U;<2l2`~XBzyz28 z6JP>NfC(@GCcp%k025#WOn?b60Vco%m;e)C0!)AjFaajO1egF5U;<2l2`~XBzyz28 z6JP>NfC(@GCcp%k025#WOn?b60Vco%{xJbRMl`{@;q*@Nu^R#q+volf!04UbuBkYH z+W-P?jXh4o1p*oxHM}rftB1G3v+&p8hw;wuv+&6t}#MM zxvH+AroP@0bqy<n%<AoGmexm1-1XAk7m(DX><)Z-_2N8TlcyW<^kaG2 z%+u*S{hY1sYcde;%F{EU>9;WpJ{yj^Nd(QA-ZMW3UIxFKK7RBg^JBYSx(%h;hX1Lb zki=~za%H;_>8Ld=Ba%*7rjZh=cC`_&i${%ap{8BlDfCBDhLzGo@w63+n{8cstn~d&IXEJ8!;fxuJ>H^i}5uqn7vn!M~^sbPlw zsc(ET-nHbOCEfQ%t12tnH+L>gFI}2!ZL=z1ZE<})WnHv9R2i)9b?UEVW*vCFE zep!4HJ8TCk+&ygZptSNIC)|AO|y<8XJ&<0_Obe!mabtz4A_++G@HCsG~T<_-)W z{@{UIv_JNqy>t8gVXOPc-IcqK9trNX1~MD>KeO*}OXA)0ttSgVJ#(hR*Vr;C*L$RQ z^On!wesRqU3kR;$zICzn-jlz)(DKtGUmH&xefsssn@{wW9h|fMtKS2kzV!Zq+=lb( z4m|zMEBDRV|MC|vP3_(D!2Igj#_56Q559c=;1^%+dg@B~|84tk+bTY2pI`NBN^bo~ ZyXo8;3zx-f>u3F(+%PkEx@FmS+Fz`@euDr2 literal 0 HcmV?d00001 diff --git a/build/obe.c b/build/obe.c new file mode 100644 index 0000000..d604519 --- /dev/null +++ b/build/obe.c @@ -0,0 +1,44 @@ +/* voc 2.1.0 [2022/05/16] for clang LP64 on darwin xtpam */ + +#define SHORTINT INT8 +#define INTEGER INT16 +#define LONGINT INT32 +#define SET UINT32 + +#include "SYSTEM.h" +#include "Files.h" +#include "Out.h" +#include "Platform.h" + + + + +static void obe_CheckDirectories (void); +static void obe_GenIndex (void); + + +static void obe_CheckDirectories (void) +{ + Files_File fd = NIL; + fd = Files_New((CHAR*)"public", 7); +} + +static void obe_GenIndex (void) +{ + Files_File outputfd = NIL, templfd = NIL, examplesfd = NIL; + Files_Rider outputrd, templrd, examplesrd; +} + + +export int main(int argc, char **argv) +{ + __INIT(argc, argv); + __MODULE_IMPORT(Files); + __MODULE_IMPORT(Out); + __MODULE_IMPORT(Platform); + __REGMAIN("obe", 0); +/* BEGIN */ + obe_CheckDirectories(); + obe_GenIndex(); + __FINI; +} diff --git a/build/obe.dSYM/Contents/Info.plist b/build/obe.dSYM/Contents/Info.plist new file mode 100644 index 0000000..204e264 --- /dev/null +++ b/build/obe.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.obe + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/build/obe.dSYM/Contents/Resources/DWARF/obe b/build/obe.dSYM/Contents/Resources/DWARF/obe new file mode 100644 index 0000000000000000000000000000000000000000..456f4bd8ae59c17920d5a9211dbb3c289ee1e95a GIT binary patch literal 10282 zcmeHNZ)_Xo8Gq0AIhVS2lBSe&jLBUKYq!pJnue9a+PY2Jn50RT7|}A&)qk#uTl;MM zk5tRnXb}h)8z4kMfsG1{Eg!}QCWM4oCnP4eF-@RO8~w0;sSul{O-!1m4Tie?es}LV zj+0KAw2$}7&-?s&pZnc&&%J)m_r8ATOJ zw|@6^Z8Xtm+`CKKtpi0!2p@;_z?JJ5V@|8$Bzu&JvcE2rKQ7W$hx1;SU3amWL!TqHacnFjRSHrfv?uQFp`*7Obx^}RcyKq z&{xMBhp*Fkywf;UIcJ^5`LPt2V+EgEdt5w9*VC1yyGfmKaYVK`8&7j|@aDLhrj6yX zH2+5uqr-y(31{xUA>(2)*d*sQuo0&ji#R{Xc6+x4Cv2NPF9U3Y%J`gI z>3Y^k*QWG*&NS$GExZK|vW2bwnw^7}DyPgTqp|{TLBbNwcn}N~OG^ zo2de_w=%xuZ*9ECrGN6K{{gR*%CyG!zQo%mVcuUOUiD0A)%djE+3{VK*Q?#Uw)l$a zQyF@;#^=9e<2mv9xBquMcht>*n*lciZU)>8xEXLW;AUWL8Q?o!2*24D<@;`r)GtY$ zKjT7t$(pl&k3}GMD4pnS{h*}_;k+;7ms~Mz=!d3_%;|w#*~nCj2{UWV z2)&TXnUMm1^%bUdW5&qTs)jyoq_RfY9<%V>&dq?E0XG9~2HXs|8E`Y;X28vWn*lci zZU)>8xEc8WWZ)cNeBuatMN$403X*XP2c$%crE0WZ%tUuZb7m%A%VMVxukjIU!)EgM zWODFmWSX9bb9tj;i`ZfGIBNmkEsE+{=h@ypKR>U1`6t7}s_>rDZdZfrURT@xrmFrs zRK*YD1z5C~)ElAiq-n$xLl`>|1y?78u(vQB)aD&|Ygl&wL?Av()~qX7FQU-;K{@Hc zedcDAMxe78Pzo=x-_i#d?~fsVo$A(hue0*u^E@&0O2ftHd93p_OWTVBgzEn(dcV^4 zCYaWyJq`9A$nypNWiVCqU*Uk#?yR$LA5CrGgND$Ro7xzk}RiY>d<)WEBW6Y!qh%cJ1 zm<)jd%Vsq$2YU0r0RQ&`y3;}a9{tay5wqMkOQk zQn_A@*{oL%PUN^WS;j)9Q9Q}0`*w+gV`C$O@lk4fM04yzlkp+UQL7rUB02x*p-mB7 zOeM$U1pOQB&l4Zr^Y@Dnp4jlJN1QslFgp(W2~Y_%2eK*v_%A_hR@DH1(b9xqwIbfI z)U84Wd6(3kc<95{8V_S|e1aG!aUGbA@iS&G{yn9N03-Og^pF97L5zTyX_Txx0c>gW8_s8ZQ3Oofl6Mky8Ke{mc;%&nV7hc%2Qe*m%UFt4nAoA9mq;L?38O8ACR z#DHK)!$+{b!TiWG=iZ>1#f4_p931$`w!)J%vxw8o+6S}wvo2~@jikV04D;#aoj;(N z^^|7Tux&zofBRl5*DPl=vkt<$U4rnDK{HDzyzhGNYt||Gz@VAW5SVv-FlU)r2x(>k z1<2;BZ&sj*^U}-$3Gd#swF@-!IYe(3NSNQ5AF=}EQ;6p8+2)P+z5F;N;oN-=v8^^k F{sT6kEFb^? literal 0 HcmV?d00001 diff --git a/build/obe.dSYM/Contents/Resources/Relocations/aarch64/obe.yml b/build/obe.dSYM/Contents/Resources/Relocations/aarch64/obe.yml new file mode 100644 index 0000000..ada74a5 --- /dev/null +++ b/build/obe.dSYM/Contents/Resources/Relocations/aarch64/obe.yml @@ -0,0 +1,10 @@ +--- +triple: 'arm64-apple-darwin' +binary-path: obe +relocations: + - { offsetInCU: 0x26, offset: 0x26, size: 0x8, addend: 0x0, symName: _main, symObjAddr: 0x0, symBinAddr: 0x100003E2C, symSize: 0x7C } + - { offsetInCU: 0x33, offset: 0x33, size: 0x8, addend: 0x0, symName: _main, symObjAddr: 0x0, symBinAddr: 0x100003E2C, symSize: 0x7C } + - { offsetInCU: 0x58, offset: 0x58, size: 0x8, addend: 0x0, symName: _main.m, symObjAddr: 0xA00, symBinAddr: 0x100008000, symSize: 0x0 } + - { offsetInCU: 0xA6, offset: 0xA6, size: 0x8, addend: 0x0, symName: _obe_CheckDirectories, symObjAddr: 0x7C, symBinAddr: 0x100003EA8, symSize: 0x30 } + - { offsetInCU: 0xCA, offset: 0xCA, size: 0x8, addend: 0x0, symName: _obe_GenIndex, symObjAddr: 0xAC, symBinAddr: 0x100003ED8, symSize: 0x58 } +... diff --git a/arguments/unixstyle_oberon_traditional/makefile b/examples/arguments/unixstyle_oberon_traditional/makefile similarity index 100% rename from arguments/unixstyle_oberon_traditional/makefile rename to examples/arguments/unixstyle_oberon_traditional/makefile diff --git a/arguments/unixstyle_oberon_traditional/partest.Mod b/examples/arguments/unixstyle_oberon_traditional/partest.Mod similarity index 100% rename from arguments/unixstyle_oberon_traditional/partest.Mod rename to examples/arguments/unixstyle_oberon_traditional/partest.Mod diff --git a/examples/arguments/unixstyle_oberon_traditional/partest.Mod.ob2 b/examples/arguments/unixstyle_oberon_traditional/partest.Mod.ob2 new file mode 100644 index 0000000..b15b545 --- /dev/null +++ b/examples/arguments/unixstyle_oberon_traditional/partest.Mod.ob2 @@ -0,0 +1,63 @@ +MODULE partest; + +IMPORT Oberon, Texts; + +CONST + argStr0 = "str"; (* we only have two types of args, one string and one int *) + argInt0 = "int"; (* i. e. -str somestring -int somenumber *) + +VAR + W: Texts.Writer; (* for console output *) + S: Texts.Scanner; T: Texts.Text; +BEGIN + Texts.OpenWriter(W); + Texts.WriteString(W, "hello, world, let's see which arguments do we get"); Texts.WriteLn(W); + + (* open arguments scanner *) + Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); + + WHILE ~S.eot DO + Texts.Scan(S); + + IF S.class = Texts.Char THEN (* do we get '-' sign ? *) + IF S.c = "-" THEN + Texts.Scan(S); + IF S.class = Texts.Name THEN (* we got the key *) + Texts.WriteString(W, "key: "); Texts.WriteString(W, S.s); Texts.WriteLn(W); + (* now get the value *) + IF S.s = argStr0 THEN + Texts.Scan(S); + IF S.class = Texts.Name THEN + Texts.WriteString(W, "value: "); Texts.WriteString (W, S.s); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf); + ELSE + Texts.WriteString(W, "string expected"); Texts.WriteLn(W); + Texts.Append(Oberon.Log, W.buf); + HALT(1); + END; + ELSIF S.s = argInt0 THEN + Texts.Scan(S); + IF S.class = Texts.Int THEN + Texts.WriteString(W, "value: "); Texts.WriteInt (W, S.i, 0); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf); + ELSE + Texts.WriteString(W, "integer expected"); Texts.WriteLn(W); + Texts.Append(Oberon.Log, W.buf); + HALT(1); + END; + END; + ELSE + (* we were expecting characters after the '-' sign *) + Texts.WriteString(W, "key name expected"); Texts. WriteLn(W); + Texts.Append(Oberon.Log, W.buf); + HALT(1); + END; + END + ELSE + Texts.WriteString(W, "key option must start with '-' sign "); Texts.WriteLn(W); + HALT(1); + END; (* if got '-' *) + Oberon.Par.pos := Texts.Pos(S); + Texts.Append(Oberon.Log, W.buf) + END; (* while *) + + +END partest. diff --git a/arguments/unixstyle_oberon_traditional/readme.md b/examples/arguments/unixstyle_oberon_traditional/readme.md similarity index 100% rename from arguments/unixstyle_oberon_traditional/readme.md rename to examples/arguments/unixstyle_oberon_traditional/readme.md diff --git a/arrays/Arrays.Mod b/examples/arrays/Arrays.Mod similarity index 100% rename from arrays/Arrays.Mod rename to examples/arrays/Arrays.Mod diff --git a/examples/arrays/Arrays.Mod.ob2 b/examples/arrays/Arrays.Mod.ob2 new file mode 100644 index 0000000..50ef185 --- /dev/null +++ b/examples/arrays/Arrays.Mod.ob2 @@ -0,0 +1,42 @@ +MODULE arrays; + +IMPORT Out; + +VAR + tmp : INTEGER; + matrix : ARRAY 3 OF ARRAY 3 OF INTEGER; + i, v, k : INTEGER; + +BEGIN + v := 1; + FOR i := 0 TO LEN(matrix) - 1 DO + FOR k := 0 TO LEN(matrix[i]) - 1 DO + matrix[i][k] := v; + INC(v); + END; + END; + + FOR i := 0 TO LEN(matrix) - 1 DO + FOR k := 0 TO LEN(matrix[i]) - 1 DO + Out.Int(matrix[i][k], 0); Out.String(" "); + END; + Out.Ln; + END; + + FOR i := 0 TO LEN(matrix) - 1 DO + FOR k := i + 1 TO LEN(matrix[i]) - 1 DO + tmp := matrix[i][k]; + matrix[i][k] := matrix[k][i]; + matrix[k][i] := tmp; + END; + END; + + Out.Ln; Out.Ln; + + FOR i := 0 TO LEN(matrix) - 1 DO + FOR k := 0 TO LEN(matrix[i]) - 1 DO + Out.Int(matrix[i][k], 0); Out.String(" "); + END; + Out.Ln; + END; +END arrays. diff --git a/arrays/Makefile b/examples/arrays/Makefile similarity index 100% rename from arrays/Makefile rename to examples/arrays/Makefile diff --git a/case/Case.Mod b/examples/case/Case.Mod similarity index 100% rename from case/Case.Mod rename to examples/case/Case.Mod diff --git a/examples/case/Case.Mod.ob2 b/examples/case/Case.Mod.ob2 new file mode 100644 index 0000000..ab6ad5b --- /dev/null +++ b/examples/case/Case.Mod.ob2 @@ -0,0 +1,14 @@ +MODULE case; + + +IMPORT Out, Modules; + + +BEGIN + CASE Modules.ArgCount - 1 OF + 0 : Out.String("There are no arguments"); + | 1 : Out.String("There is one argument"); + | 2 : Out.String("There are two arguments"); + ELSE Out.String("There are more than two arguments") END; + Out.Ln; +END case. diff --git a/case/Makefile b/examples/case/Makefile similarity index 100% rename from case/Makefile rename to examples/case/Makefile diff --git a/constants/Constants.Mod b/examples/constants/Constants.Mod similarity index 100% rename from constants/Constants.Mod rename to examples/constants/Constants.Mod diff --git a/examples/constants/Constants.Mod.ob2 b/examples/constants/Constants.Mod.ob2 new file mode 100644 index 0000000..47dc4c4 --- /dev/null +++ b/examples/constants/Constants.Mod.ob2 @@ -0,0 +1,14 @@ +MODULE constants; + +IMPORT Out; + +CONST + s = "if it moves, compile it!"; + n = 42; + m = n * 2; + +BEGIN + Out.String(s); Out.Ln; + Out.Int(n, 0); Out.Ln; + Out.Int(m, 0); Out.Ln; +END constants. diff --git a/constants/Makefile b/examples/constants/Makefile similarity index 100% rename from constants/Makefile rename to examples/constants/Makefile diff --git a/enums_example/0/Days.Mod b/examples/enums_example/0/Days.Mod similarity index 100% rename from enums_example/0/Days.Mod rename to examples/enums_example/0/Days.Mod diff --git a/examples/enums_example/0/Days.Mod.ob2 b/examples/enums_example/0/Days.Mod.ob2 new file mode 100644 index 0000000..8611a21 --- /dev/null +++ b/examples/enums_example/0/Days.Mod.ob2 @@ -0,0 +1,68 @@ +MODULE Days; + + TYPE + Day* = POINTER TO DayDesc; + DayDesc = RECORD + next, prev : Day + END; + Week = ARRAY 7 OF Day; + + VAR + sun*, mon*, tue*, wed*, thu*, fri*, sat* : Day; + week: Week; + + PROCEDURE Next*(d : Day): Day; + BEGIN + RETURN d.next + END Next; + + PROCEDURE Prev*(d: Day): Day; + BEGIN + RETURN d.prev; + END Prev; + + PROCEDURE inc(VAR j: SHORTINT); + BEGIN + IF j = 6 THEN + j := 0 + ELSE + INC(j) + END + END inc; + + PROCEDURE dec(VAR j: SHORTINT); + BEGIN + IF j = 0 THEN + j := 6 + ELSE + DEC(j) + END + END dec; + + PROCEDURE init(VAR w : Week); + VAR + i,j : SHORTINT; + BEGIN + i := 0; + REPEAT + j := i; inc(j); + w[i].next := w[j]; + j := i; dec(j); + w[i].prev := w[j]; + INC(i) + UNTIL i > 6; + END init; + +BEGIN + NEW(sun); NEW(mon); NEW(tue); NEW(wed); NEW(thu); NEW(fri); NEW(sat); + week[0] := sun; + week[1] := mon; + week[2] := tue; + week[3] := wed; + week[4] := thu; + week[5] := fri; + week[6] := sat; + + init(week); + +END Days. diff --git a/enums_example/0/readme.md b/examples/enums_example/0/readme.md similarity index 100% rename from enums_example/0/readme.md rename to examples/enums_example/0/readme.md diff --git a/enums_example/0/test.Mod b/examples/enums_example/0/test.Mod similarity index 100% rename from enums_example/0/test.Mod rename to examples/enums_example/0/test.Mod diff --git a/enums_example/1/test.Mod b/examples/enums_example/0/test.Mod.ob2 similarity index 100% rename from enums_example/1/test.Mod rename to examples/enums_example/0/test.Mod.ob2 diff --git a/enums_example/1/Days.Mod b/examples/enums_example/1/Days.Mod similarity index 100% rename from enums_example/1/Days.Mod rename to examples/enums_example/1/Days.Mod diff --git a/examples/enums_example/1/Days.Mod.ob2 b/examples/enums_example/1/Days.Mod.ob2 new file mode 100644 index 0000000..a8ab1ad --- /dev/null +++ b/examples/enums_example/1/Days.Mod.ob2 @@ -0,0 +1,33 @@ +MODULE Days; + + TYPE + Day* = POINTER TO DayDesc; + DayDesc = RECORD + num: INTEGER + END; + Week* = ARRAY 7 OF Day; + VAR + sun*, mon*, tue*, wed*, thu*, fri*, sat* : Day; + week: Week; + + PROCEDURE Next*(d : Day): Day; + BEGIN RETURN week[(d.num + 1) MOD 7]; + END Next; + + PROCEDURE Prev*(d: Day): Day; + BEGIN RETURN week[(d.num - 1) MOD 7]; + END Prev; + + PROCEDURE day(VAR d: Day; num: INTEGER); + BEGIN NEW(d); d.num := num; week[num] := d; + END day; + +BEGIN + day(sun, 0); + day(mon, 1); + day(tue, 2); + day(wed, 3); + day(thu, 4); + day(fri, 5); + day(sat, 6); +END Days. diff --git a/enums_example/1/readme.md b/examples/enums_example/1/readme.md similarity index 100% rename from enums_example/1/readme.md rename to examples/enums_example/1/readme.md diff --git a/examples/enums_example/1/test.Mod b/examples/enums_example/1/test.Mod new file mode 100644 index 0000000..8d49b34 --- /dev/null +++ b/examples/enums_example/1/test.Mod @@ -0,0 +1,22 @@ +MODULE test; + +IMPORT Days, Out; + +VAR today, yesterday, tomorrow: Days.Day; + +BEGIN + today := Days.mon; (*init*) + + yesterday := Days.Prev(today); + IF yesterday = Days.sun + THEN + Out.String("it works!"); Out.Ln + END; + tomorrow := Days.Next(today); + + IF tomorrow = Days.tue + THEN + Out.String("it works!"); Out.Ln + END; + +END test. diff --git a/examples/enums_example/1/test.Mod.ob2 b/examples/enums_example/1/test.Mod.ob2 new file mode 100644 index 0000000..8d49b34 --- /dev/null +++ b/examples/enums_example/1/test.Mod.ob2 @@ -0,0 +1,22 @@ +MODULE test; + +IMPORT Days, Out; + +VAR today, yesterday, tomorrow: Days.Day; + +BEGIN + today := Days.mon; (*init*) + + yesterday := Days.Prev(today); + IF yesterday = Days.sun + THEN + Out.String("it works!"); Out.Ln + END; + tomorrow := Days.Next(today); + + IF tomorrow = Days.tue + THEN + Out.String("it works!"); Out.Ln + END; + +END test. diff --git a/for/For.Mod b/examples/for/For.Mod similarity index 100% rename from for/For.Mod rename to examples/for/For.Mod diff --git a/examples/for/For.Mod.ob2 b/examples/for/For.Mod.ob2 new file mode 100644 index 0000000..8e110bd --- /dev/null +++ b/examples/for/For.Mod.ob2 @@ -0,0 +1,19 @@ +MODULE for; + +IMPORT Out; + +VAR + i : INTEGER; + + +BEGIN + Out.String("i is "); Out.Int(i, 0); Out.Ln; + Out.String("For loop started"); Out.Ln; + FOR i := 0 TO 10 DO + Out.String("i : "); Out.Int(i, 0); Out.Ln; + END; + Out.String("For-By loop started"); Out.Ln; + FOR i := 0 TO 10 BY 2 DO + Out.String("i : "); Out.Int(i, 0); Out.Ln; + END; +END for. diff --git a/for/Makefile b/examples/for/Makefile similarity index 100% rename from for/Makefile rename to examples/for/Makefile diff --git a/hello-world/Console/Hello.Mod b/examples/hello-world/Console/Hello.Mod similarity index 100% rename from hello-world/Console/Hello.Mod rename to examples/hello-world/Console/Hello.Mod diff --git a/examples/hello-world/Console/Hello.Mod.ob2 b/examples/hello-world/Console/Hello.Mod.ob2 new file mode 100644 index 0000000..479a6ea --- /dev/null +++ b/examples/hello-world/Console/Hello.Mod.ob2 @@ -0,0 +1,10 @@ +MODULE hello; + + +IMPORT Console; + + +BEGIN + Console.String("Hello World!"); + Console.Ln +END hello. diff --git a/hello-world/Console/Makefile b/examples/hello-world/Console/Makefile similarity index 100% rename from hello-world/Console/Makefile rename to examples/hello-world/Console/Makefile diff --git a/hello-world/Out/Hello.Mod b/examples/hello-world/Out/Hello.Mod similarity index 100% rename from hello-world/Out/Hello.Mod rename to examples/hello-world/Out/Hello.Mod diff --git a/examples/hello-world/Out/Hello.Mod.ob2 b/examples/hello-world/Out/Hello.Mod.ob2 new file mode 100644 index 0000000..80346a2 --- /dev/null +++ b/examples/hello-world/Out/Hello.Mod.ob2 @@ -0,0 +1,9 @@ +MODULE hello; + + +IMPORT Out; + + +BEGIN + Out.String("Hello, World"); Out.Ln +END hello. diff --git a/hello-world/Out/Makefile b/examples/hello-world/Out/Makefile similarity index 100% rename from hello-world/Out/Makefile rename to examples/hello-world/Out/Makefile diff --git a/ifelse/IfElse.Mod b/examples/ifelse/IfElse.Mod similarity index 100% rename from ifelse/IfElse.Mod rename to examples/ifelse/IfElse.Mod diff --git a/examples/ifelse/IfElse.Mod.ob2 b/examples/ifelse/IfElse.Mod.ob2 new file mode 100644 index 0000000..81ca1d7 --- /dev/null +++ b/examples/ifelse/IfElse.Mod.ob2 @@ -0,0 +1,49 @@ +MODULE ifelse; + + +IMPORT Out; + +VAR n, m : INTEGER; + + +BEGIN + n := 8; m := 4; + + IF n MOD m = 0 THEN + Out.Int(n,0); Out.String(" is divisible by "); Out.Int(m,0); Out.Ln; + END; + + n := 7; m := 6; + + IF n * m = 42 THEN + Out.Int(n,0); Out.String(" times "); Out.Int(m,0); Out.String(" equals 42"); Out.Ln; + END; + + IF n # m THEN Out.Int(n,0); Out.String(" does not equal "); Out.Int(m,0); Out.Ln; END; + + IF ODD(n) + THEN + Out.Int(n,0); Out.String(" is odd"); Out.Ln; + ELSE + Out.Int(n,0); Out.String(" is even"); Out.Ln; + END; + + IF ~ODD(m) + THEN + Out.Int(m,0); Out.String(" is even"); Out.Ln; + ELSE + Out.Int(m,0); Out.String(" is odd"); Out.Ln; + END; + + n := 9; + + IF n < 0 + THEN + Out.Int(n, 0); Out.String(" is negative"); Out.Ln; + ELSIF n < 10 + THEN + Out.Int(n, 0); Out.String(" has 1 digit"); Out.Ln; + ELSE + Out.Int(n, 0); Out.String(" has multiple digits"); Out.Ln; + END; +END ifelse. diff --git a/ifelse/Makefile b/examples/ifelse/Makefile similarity index 100% rename from ifelse/Makefile rename to examples/ifelse/Makefile diff --git a/procedures/function-procedure/Makefile b/examples/procedures/function-procedure/Makefile similarity index 100% rename from procedures/function-procedure/Makefile rename to examples/procedures/function-procedure/Makefile diff --git a/procedures/function-procedure/Square.Mod b/examples/procedures/function-procedure/Square.Mod similarity index 100% rename from procedures/function-procedure/Square.Mod rename to examples/procedures/function-procedure/Square.Mod diff --git a/examples/procedures/function-procedure/Square.Mod.ob2 b/examples/procedures/function-procedure/Square.Mod.ob2 new file mode 100644 index 0000000..f972edf --- /dev/null +++ b/examples/procedures/function-procedure/Square.Mod.ob2 @@ -0,0 +1,20 @@ +MODULE square; + + +IMPORT Out; + + +VAR s : INTEGER; + + +PROCEDURE squared(x : INTEGER): INTEGER; +BEGIN + RETURN x * x +END squared; + + +BEGIN + s := squared(7); + Out.Int(s, 0); Out.Ln; + Out.Int(squared(8), 0); Out.Ln; +END square. diff --git a/procedures/procedure/Makefile b/examples/procedures/procedure/Makefile similarity index 100% rename from procedures/procedure/Makefile rename to examples/procedures/procedure/Makefile diff --git a/procedures/procedure/Procedure.Mod b/examples/procedures/procedure/Procedure.Mod similarity index 100% rename from procedures/procedure/Procedure.Mod rename to examples/procedures/procedure/Procedure.Mod diff --git a/examples/procedures/procedure/Procedure.Mod.ob2 b/examples/procedures/procedure/Procedure.Mod.ob2 new file mode 100644 index 0000000..c832008 --- /dev/null +++ b/examples/procedures/procedure/Procedure.Mod.ob2 @@ -0,0 +1,15 @@ +MODULE proc; + + +IMPORT Out; + + +PROCEDURE printSum(a, b : INTEGER); +BEGIN + Out.Int(a + b, 0); Out.Ln +END printSum; + + +BEGIN + printSum(6, 9) +END proc. diff --git a/procedures/var-parameter/Makefile b/examples/procedures/var-parameter/Makefile similarity index 100% rename from procedures/var-parameter/Makefile rename to examples/procedures/var-parameter/Makefile diff --git a/procedures/var-parameter/VarParam.Mod b/examples/procedures/var-parameter/VarParam.Mod similarity index 100% rename from procedures/var-parameter/VarParam.Mod rename to examples/procedures/var-parameter/VarParam.Mod diff --git a/examples/procedures/var-parameter/VarParam.Mod.ob2 b/examples/procedures/var-parameter/VarParam.Mod.ob2 new file mode 100644 index 0000000..19d1d8a --- /dev/null +++ b/examples/procedures/var-parameter/VarParam.Mod.ob2 @@ -0,0 +1,24 @@ +MODULE varparam; + + +IMPORT Out; + + +VAR a, b : INTEGER; + + +PROCEDURE swapVals(VAR x, y : INTEGER); +VAR tmp : INTEGER; +BEGIN + tmp := x; x := y; y := tmp; +END swapVals; + + +BEGIN + a := 6; b := 9; + Out.String("initial "); Out.Ln; + Out.String("a : "); Out.Int(a, 0); Out.String("; b : "); Out.Int(b, 0); Out.Ln; + swapVals(a, b); + Out.String("after swap"); Out.Ln; + Out.String("a : "); Out.Int(a, 0); Out.String("; b : "); Out.Int(b, 0); Out.Ln; +END varparam. diff --git a/records/Records.Mod b/examples/records/Records.Mod similarity index 100% rename from records/Records.Mod rename to examples/records/Records.Mod diff --git a/examples/records/Records.Mod.ob2 b/examples/records/Records.Mod.ob2 new file mode 100644 index 0000000..8dc22a2 --- /dev/null +++ b/examples/records/Records.Mod.ob2 @@ -0,0 +1,53 @@ +MODULE record; + + +IMPORT Out; + + +CONST + Male = 1; + Female = 2; + + +TYPE + SexDesc = INTEGER; + Person = RECORD + Name : ARRAY 32 OF CHAR; + Age : INTEGER; + Title : ARRAY 64 OF CHAR; + Sex : SexDesc; + END; + + +VAR + i : INTEGER; + employer : Person; + employee : ARRAY 2 OF Person; + + +PROCEDURE dumpPerson ( p : Person ); +BEGIN + Out.String("Meet "); Out.String(p.Name); + IF p.Sex = Male THEN Out.String(". He is ") END; + IF p.Sex = Female THEN Out.String(". She is ") END; + Out.Int(p.Age, 0); Out.String(" years old and a "); Out.String(p.Title); Out.Ln; +END dumpPerson; + + + +BEGIN + (* define people *) + employer.Name := "Bing"; employer.Age := 42; employer.Title := "CEO"; employer.Sex := Male; + + employee[0].Name := "Bob"; employee[0].Age := 26; + employee[0].Title := "SysAdmin"; employee[0].Sex := Male; + + employee[1].Name := "Alice" ; employee[1].Age := 22; + employee[1].Title := "Programmer"; employee[1].Sex := Female; + + (* print people *) + dumpPerson(employer); + FOR i := 0 TO LEN(employee) - 1 DO + dumpPerson(employee[i]); + END; +END record. diff --git a/recursion/Fib.Mod b/examples/recursion/Fib.Mod similarity index 100% rename from recursion/Fib.Mod rename to examples/recursion/Fib.Mod diff --git a/examples/recursion/Fib.Mod.ob2 b/examples/recursion/Fib.Mod.ob2 new file mode 100644 index 0000000..e5f5a27 --- /dev/null +++ b/examples/recursion/Fib.Mod.ob2 @@ -0,0 +1,33 @@ +MODULE fibonacci; + + +IMPORT Out, Modules; + + +VAR + n : LONGINT; + Arg0 : LONGINT; + + +PROCEDURE getFib (n : LONGINT) : LONGINT; + VAR result : LONGINT; +BEGIN + IF n = 0 THEN + result := 0 + ELSIF n = 1 THEN + result:= 1 + ELSE + result := getFib(n-1) + getFib(n-2) + END; + RETURN result +END getFib; + + +BEGIN + IF Modules.ArgCount # 2 THEN + Out.String("one argument needed"); Out.Ln; + HALT(1); + END; + Modules.GetIntArg(1, Arg0); + Out.Int(getFib(Arg0), 0); Out.Ln; +END fibonacci. diff --git a/recursion/Gcd.Mod b/examples/recursion/Gcd.Mod similarity index 100% rename from recursion/Gcd.Mod rename to examples/recursion/Gcd.Mod diff --git a/examples/recursion/Gcd.Mod.ob2 b/examples/recursion/Gcd.Mod.ob2 new file mode 100644 index 0000000..2cc283d --- /dev/null +++ b/examples/recursion/Gcd.Mod.ob2 @@ -0,0 +1,31 @@ +MODULE gcd; + + +IMPORT Out, Modules; + + +VAR + gcd : INTEGER; + arg0, arg1 : LONGINT; + + +PROCEDURE getGCD(a, b : INTEGER): INTEGER; +VAR ret : INTEGER; +BEGIN + IF a = 0 THEN ret := b; + ELSIF b = 0 THEN ret := a; + ELSIF b > a THEN ret := getGCD(b, a); + ELSE ret := getGCD(b, a MOD b) END; + RETURN ret; +END getGCD; + + +BEGIN + IF Modules.ArgCount # 3 THEN + Out.String("enter two integers to get GCD"); Out.Ln; + HALT(1) + END; + Modules.GetIntArg(1, arg0); Modules.GetIntArg(2, arg1); + gcd := getGCD(SHORT(arg0), SHORT(arg1)); + Out.Int(gcd, 0); Out.Ln; +END gcd. diff --git a/value-types/Makefile b/examples/value-types/Makefile similarity index 100% rename from value-types/Makefile rename to examples/value-types/Makefile diff --git a/value-types/Values.Mod b/examples/value-types/Values.Mod similarity index 100% rename from value-types/Values.Mod rename to examples/value-types/Values.Mod diff --git a/examples/value-types/Values.Mod.ob2 b/examples/value-types/Values.Mod.ob2 new file mode 100644 index 0000000..b8b976b --- /dev/null +++ b/examples/value-types/Values.Mod.ob2 @@ -0,0 +1,12 @@ +MODULE values; + + +IMPORT Out; + + +BEGIN + Out.String("Oberon has types, for example, I am a string type (ARRAY OF CHAR);"); Out.Ln; + Out.String("There are also other types, e.g. INTEGERs and BOOLEANs"); Out.Ln; + Out.Int(42, 0); + Out.Ln +END values. diff --git a/variables/Makefile b/examples/variables/Makefile similarity index 100% rename from variables/Makefile rename to examples/variables/Makefile diff --git a/variables/Variables.Mod b/examples/variables/Variables.Mod similarity index 100% rename from variables/Variables.Mod rename to examples/variables/Variables.Mod diff --git a/examples/variables/Variables.Mod.ob2 b/examples/variables/Variables.Mod.ob2 new file mode 100644 index 0000000..3630f19 --- /dev/null +++ b/examples/variables/Variables.Mod.ob2 @@ -0,0 +1,31 @@ +MODULE variables; + +IMPORT Out; + + +VAR + s : ARRAY 32 OF CHAR; + i : REAL; + n, m : INTEGER; + + +BEGIN + s := "Initial"; + Out.String(s); Out.Ln; + i := 3.14; + n := 64; + m := 42; + Out.Int(m, 0); Out.Ln; + Out.Int(n, 0); Out.Ln; + Out.Real(i, 0); Out.Ln; + + s := "assigning new values"; + Out.String(s); Out.Ln; + i := 2.71; + n := 128; + m := 84; + Out.Int(m, 0); Out.Ln; + Out.Int(n, 0); Out.Ln; + Out.Real(i, 0); + Out.Ln +END variables. diff --git a/while/Makefile b/examples/while/Makefile similarity index 100% rename from while/Makefile rename to examples/while/Makefile diff --git a/while/While.Mod b/examples/while/While.Mod similarity index 100% rename from while/While.Mod rename to examples/while/While.Mod diff --git a/examples/while/While.Mod.ob2 b/examples/while/While.Mod.ob2 new file mode 100644 index 0000000..30946f2 --- /dev/null +++ b/examples/while/While.Mod.ob2 @@ -0,0 +1,17 @@ +MODULE while; + +IMPORT Out; + + +VAR + i : INTEGER; + + +BEGIN + i := 0; + Out.String("WHILE loop started"); Out.Ln; + WHILE i < 10 DO + i := i + 1; + Out.Int(i, 0); Out.Ln; + END; +END while. diff --git a/src/obe.Mod b/src/obe.Mod new file mode 100644 index 0000000..8026b9e --- /dev/null +++ b/src/obe.Mod @@ -0,0 +1,26 @@ +MODULE obe; + +IMPORT + Files, + Platform, + Out; + +PROCEDURE CheckDirectories; +BEGIN +END CheckDirectories; + +PROCEDURE GenIndex; +CONST + templpath = "../templates/index.html"; + outputpath = "../public/index.html"; + examplespath = "../examples.txt"; +VAR + outputfd, templfd, examplesfd: Files.File; + outputrd, templrd, examplesrd: Files.Rider; +BEGIN +END GenIndex; + +BEGIN + CheckDirectories; + GenIndex; +END obe.