From c4f379204733f3f245d6b8a59d4636a4b06f6ac9 Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 07:52:22 +0400 Subject: [PATCH 01/22] add ctags --- .gitignore | 1 + makefile | 6 ++++-- oberon.ctags | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 oberon.ctags diff --git a/.gitignore b/.gitignore index 22c5a97d..27d956ae 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ /triage/BasicTypeSize.md /triage/Roadmap.md triage/system/* +tags diff --git a/makefile b/makefile index 5c0ee241..7bc29843 100644 --- a/makefile +++ b/makefile @@ -91,8 +91,10 @@ usage: @echo " make bootstrap - Update bootstrap C source directories." @echo " make revertbootstrap - Use git checkout to restore bootstrap C source directories" - - +# Code navigation helper +.PHONY: tags +tags: + ctags -R --options=oberon.ctags --extras=+q # Generate config files Configuration.Make and Configuration.Mod FORCE: diff --git a/oberon.ctags b/oberon.ctags new file mode 100644 index 00000000..de5a1cf8 --- /dev/null +++ b/oberon.ctags @@ -0,0 +1,32 @@ +# ctags -R --options=oberon.ctags --extras=+q + +--langdef=Oberon{_autoFQTag} + +--map-Oberon=+.mod +--map-Oberon=+.Mod + +--kinddef-Oberon=m,module,modules +--kinddef-Oberon=p,procedure,procedures + +--regex-Oberon=/^\s*MODULE\s+([a-zA-Z][a-zA-Z0-9]*)\s*;/\1/m/{scope=push} +--regex-Oberon=/^\s*END\s+([a-zA-Z][a-zA-Z0-9]*)\s*\./\1/m/{scope=pop} +--regex-Oberon=/^\s*PROCEDURE(\s*\^|-)?\s*([a-zA-Z][a-zA-Z0-9]*)/\2/p/{scope=ref} +# NOTE Oberon-2 receiver procedures not supported + +### using ctags with vim +# examples: +# vim -t "Compiler" +# vim -t "OPS.Get" +# vim -c ":ts Platform.Read" +# +# when inside the editor you need to jump to the fully qualified tag, +# not just procedure name e.g. when you have Platform.Write, you +# can't just place cursor on W then and expect it to resolve +# correctly all the time. +# your better options are +# autocmd FileType oberon setlocal iskeyword+=. +# autocmd FileType modula2 setlocal iskeyword+=. +# :ta Platform.Write +# v 3e +# :ts Platform.Write +# g From e936f7d7b0b4921528df0fd79285ec1681250792 Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 07:52:59 +0400 Subject: [PATCH 02/22] fix typo in ReadMe --- ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index 933b0681..fa8f5143 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -295,7 +295,7 @@ Also, Vishaps are known in tales, fiction. [This page](http://blog.fogus.me/2015 ###### Links - [Niklaus Wirth's personal page at ETH Zurich](https://www.inf.ethz.ch/personal/wirth/) - [ETH Zurich's Wirth publications page](http://www.ethoberon.ethz.ch/WirthPubl/) - - [Joseph Templ's ofront on github](https://hithub.com/jtempl/ofront) + - [Joseph Templ's ofront on github](https://github.com/jtempl/ofront) - [Software Templ OG](http://www.software-templ.com) - [Oberon: Steps beyond Pascal and Modula](http://fruttenboel.verhoeven272.nl/Oberon/) From 233761e7fa055d0605c499e744661af12f728ec3 Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 08:16:27 +0400 Subject: [PATCH 03/22] more matches --- oberon.ctags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oberon.ctags b/oberon.ctags index de5a1cf8..dac4e685 100644 --- a/oberon.ctags +++ b/oberon.ctags @@ -10,7 +10,7 @@ --regex-Oberon=/^\s*MODULE\s+([a-zA-Z][a-zA-Z0-9]*)\s*;/\1/m/{scope=push} --regex-Oberon=/^\s*END\s+([a-zA-Z][a-zA-Z0-9]*)\s*\./\1/m/{scope=pop} ---regex-Oberon=/^\s*PROCEDURE(\s*\^|-)?\s*([a-zA-Z][a-zA-Z0-9]*)/\2/p/{scope=ref} +--regex-Oberon=/^\s*PROCEDURE\s*(\^|-)?\s*([a-zA-Z][a-zA-Z0-9]*)/\2/p/{scope=ref} # NOTE Oberon-2 receiver procedures not supported ### using ctags with vim From 9084ca288bfaeaf47250837492700c1a45536a56 Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 16:29:13 +0400 Subject: [PATCH 04/22] rewording ceveats on oberon.ctags --- oberon.ctags | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/oberon.ctags b/oberon.ctags index dac4e685..c7b57dc7 100644 --- a/oberon.ctags +++ b/oberon.ctags @@ -1,3 +1,4 @@ +# universal tags # ctags -R --options=oberon.ctags --extras=+q --langdef=Oberon{_autoFQTag} @@ -19,14 +20,14 @@ # vim -t "OPS.Get" # vim -c ":ts Platform.Read" # -# when inside the editor you need to jump to the fully qualified tag, -# not just procedure name e.g. when you have Platform.Write, you -# can't just place cursor on W then and expect it to resolve -# correctly all the time. -# your better options are -# autocmd FileType oberon setlocal iskeyword+=. -# autocmd FileType modula2 setlocal iskeyword+=. -# :ta Platform.Write -# v 3e -# :ts Platform.Write -# g +# you need to jump to the fully qualified name, since procedure names alone +# sometimes resolve to an incorrect module. that is to say putting cursor on +# W in Platform.Write and jumping will probably not work as expected, so you +# might have to do some of these +# autocmd FileType oberon,modula2 setlocal iskeyword+=. +# select the name fully +# v 3e +# :ta Platform.Write +# resolve ambiguities interactively +# :ts Write +# g From 9e9bbe7581a20cf0ba9be6c5a58c1465d74bbe7f Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 19:00:09 +0400 Subject: [PATCH 05/22] fix empty link in ReadMe --- ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index fa8f5143..ab4dfbce 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -2,7 +2,7 @@ # Ѵishap Oberon -[Ѵishap Oberon](http://oberon.vishap.am) is a free and open source (GPLv3) +[Ѵishap Oberon](https://vishap.oberon.am/) is a free and open source (GPLv3) implementation of the Oberon-2 language and libraries for use on conventional operating systems such as Linux, BSD, Android, Mac and Windows. From cb098d448dd392f5cd872f3a839e4710256c54aa Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 19:20:01 +0400 Subject: [PATCH 06/22] update deaed links in ReadMe --- ReadMe.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index ab4dfbce..95d7f840 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -278,13 +278,13 @@ Also, Vishaps are known in tales, fiction. [This page](http://blog.fogus.me/2015 ###### Oberon - [The History of Modula-2 and Oberon](http://people.inf.ethz.ch/wirth/Articles/Modula-Oberon-June.pdf) - [The Programming Language Oberon](https://www.inf.ethz.ch/personal/wirth/Oberon/Oberon.Report.pdf) - - [Project Oberon: The Design of an Operating System and Compiler ](http://www.ethoberon.ethz.ch/WirthPubl/ProjectOberon.pdf) - - [Oberon - the Overlooked Jewel](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.90.7173&rep=rep1&type=pdf) + - [Project Oberon: The Design of an Operating System and Compiler ](https://people.inf.ethz.ch/wirth/ProjectOberon1992.pdf) + - [Oberon - the Overlooked Jewel](http://pascal.hansotten.com/uploads/oberonpi/Oberon%20article.pdf) ###### Oberon 2 - - [Differences between Oberon and Oberon-2](http://members.home.nl/jmr272/Oberon/Oberon2.Differences.pdf) + - [Differences between Oberon and Oberon-2](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=89e5bd3cf006bde4821599cdc57a37de5dc84bcd) - [The Programming Language Oberon-2](http://www.ssw.uni-linz.ac.at/Research/Papers/Oberon2.pdf) - - [Programming in Oberon. Steps beyond Pascal and Modula](http://www.ethoberon.ethz.ch/WirthPubl/ProgInOberonWR.pdf) + - [Programming in Oberon. Steps beyond Pascal and Modula](https://people.inf.ethz.ch/wirth/ProgInOberonWR.pdf) - [The Oakwood Guidelines for Oberon-2 Compiler Developers](http://www.math.bas.bg/bantchev/place/oberon/oakwood-guidelines.pdf) ###### Oberon 07 @@ -294,10 +294,10 @@ Also, Vishaps are known in tales, fiction. [This page](http://blog.fogus.me/2015 ###### Links - [Niklaus Wirth's personal page at ETH Zurich](https://www.inf.ethz.ch/personal/wirth/) - - [ETH Zurich's Wirth publications page](http://www.ethoberon.ethz.ch/WirthPubl/) + - [Selected articles by Niklaus Wirth](https://people.inf.ethz.ch/wirth/SelectedArticles.pdf) + - [ETH Oberon publications page](https://web.archive.org/web/20191207155011/http://www.ethoberon.ethz.ch/books.html) - [Joseph Templ's ofront on github](https://github.com/jtempl/ofront) - [Software Templ OG](http://www.software-templ.com) - - [Oberon: Steps beyond Pascal and Modula](http://fruttenboel.verhoeven272.nl/Oberon/) ## History From ac829590928189f05ea2d022cbbc319a521fdd41 Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 20:05:37 +0400 Subject: [PATCH 07/22] add stuff to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 27d956ae..ba12dfc3 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ /*.sym /*.asm /*.mod +/Errors.Txt /Errors.txt /olang /src/test/**/*.exe @@ -40,3 +41,4 @@ /triage/Roadmap.md triage/system/* tags +voc From e64d4c4d441d45303f458bd33b2eca844070d190 Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 20:14:24 +0400 Subject: [PATCH 08/22] add test binaries to .gitignore --- .gitignore | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.gitignore b/.gitignore index ba12dfc3..521c9a36 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,17 @@ /src/test/confidence/**/*.asm /src/test/confidence/**/*.s /src/test/confidence/**/*.map +/src/test/confidence/arrayassignment/aa +/src/test/confidence/hello/hello +/src/test/confidence/in/intest +/src/test/confidence/isptest/isptest +/src/test/confidence/language/TestLanguage +/src/test/confidence/library/TestLibrary +/src/test/confidence/lola/Lola +/src/test/confidence/math/mathtest +/src/test/confidence/out/outtest +/src/test/confidence/signal/SignalTest +/src/test/confidence/texts/testTexts /bootstrap/*/SYSTEM.[ch] /bootstrap/*/Errors.Txt /bootstrap/*/WindowsWrapper.h From a25b44ae2145dd35ce9f28d91c5fa7c07e6abf32 Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 20:38:12 +0400 Subject: [PATCH 09/22] exclude all confidence test files without extension except expect --- .gitignore | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 521c9a36..19fc1ede 100644 --- a/.gitignore +++ b/.gitignore @@ -21,23 +21,14 @@ /src/test/**/*.obj /src/test/**/*.sym **/*.stackdump +!/src/test/confidence/**/expected /src/test/confidence/**/input /src/test/confidence/**/result /src/test/confidence/**/result-* +/src/test/confidence/**/*[^.]* /src/test/confidence/**/*.asm /src/test/confidence/**/*.s /src/test/confidence/**/*.map -/src/test/confidence/arrayassignment/aa -/src/test/confidence/hello/hello -/src/test/confidence/in/intest -/src/test/confidence/isptest/isptest -/src/test/confidence/language/TestLanguage -/src/test/confidence/library/TestLibrary -/src/test/confidence/lola/Lola -/src/test/confidence/math/mathtest -/src/test/confidence/out/outtest -/src/test/confidence/signal/SignalTest -/src/test/confidence/texts/testTexts /bootstrap/*/SYSTEM.[ch] /bootstrap/*/Errors.Txt /bootstrap/*/WindowsWrapper.h From d00531742414e2676d1b71be7826e03b07b96693 Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 20:57:00 +0400 Subject: [PATCH 10/22] address more caveats in oberon.ctags --- oberon.ctags | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/oberon.ctags b/oberon.ctags index c7b57dc7..6af0745a 100644 --- a/oberon.ctags +++ b/oberon.ctags @@ -24,10 +24,15 @@ # sometimes resolve to an incorrect module. that is to say putting cursor on # W in Platform.Write and jumping will probably not work as expected, so you # might have to do some of these -# autocmd FileType oberon,modula2 setlocal iskeyword+=. -# select the name fully +# add this to yout .vimrc +# autocmd FileType oberon,modula2 setlocal iskeyword+=. +# select the qualified name # v 3e # :ta Platform.Write # resolve ambiguities interactively # :ts Write # g +# +# if you need upward searching for tags file, so you can access them from +# project root subdirectories, then add this to your .vimrc +# set tags=./tags;~ From 7691293a5b3d490efcb74c66d2b8eb9870187352 Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 21:05:42 +0400 Subject: [PATCH 11/22] replace egrep with grep -E for less warnings --- src/tools/make/sourcechanges.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/make/sourcechanges.sh b/src/tools/make/sourcechanges.sh index e20e6841..86aa9542 100644 --- a/src/tools/make/sourcechanges.sh +++ b/src/tools/make/sourcechanges.sh @@ -14,8 +14,8 @@ changes="0" find "$1" -type f -print0 | while IFS= read -r -d '' f; do fn=$(basename "$f") - egrep -v -f ../../src/tools/make/ignore "$f" >$fn.old - egrep -v -f ../../src/tools/make/ignore $fn >$fn.new + grep -E -v -f ../../src/tools/make/ignore "$f" >$fn.old + grep -E -v -f ../../src/tools/make/ignore $fn >$fn.new if ! diff -U 2 -b $fn.old $fn.new >$fn.diff; then echo "" echo "" From cd06cd32b1b658a941b686756aacaab2e4ba9b07 Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 22:09:20 +0400 Subject: [PATCH 12/22] ignore common warnings in gcc and clang --- src/tools/make/configure.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tools/make/configure.c b/src/tools/make/configure.c index 2cd37b13..3ff41948 100644 --- a/src/tools/make/configure.c +++ b/src/tools/make/configure.c @@ -137,7 +137,8 @@ void determineCCompiler() { } #elif defined(__clang__) compiler = "clang"; - cc = "clang -fPIC -g" optimize; + // FIXME ignoring warnings + cc = "clang -fPIC -g -Wno-deprecated-non-prototype" optimize; #elif defined(__TINYC__) compiler = "tcc"; cc = "tcc -g"; @@ -146,9 +147,11 @@ void determineCCompiler() { compiler = "gcc"; if (strncasecmp(os, "cygwin", 6) == 0) { // Avoid cygwin specific warning that -fPIC is ignored. - cc = "gcc -g" optimize; + // FIXME ignoring warnings + cc = "gcc -g -Wno-stringop-overflow" optimize; } else { - cc = "gcc -fPIC -g" optimize; + // FIXME ignoring warnings + cc = "gcc -fPIC -g -Wno-stringop-overflow" optimize; } #elif defined(_MSC_VER) compiler = "msc"; From b12029e3ed5618f3c43e5c1cfeec522799cb68ba Mon Sep 17 00:00:00 2001 From: sevoves Date: Thu, 3 Apr 2025 22:26:20 +0400 Subject: [PATCH 13/22] remove warning floods for MinGW compiler --- src/tools/make/configure.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/make/configure.c b/src/tools/make/configure.c index 3ff41948..87591d63 100644 --- a/src/tools/make/configure.c +++ b/src/tools/make/configure.c @@ -131,9 +131,11 @@ void determineCCompiler() { #if defined(__MINGW32__) compiler = "mingw"; if (sizeof (void*) == 4) { - cc = "i686-w64-mingw32-gcc -g" optimize; + // FIXME ignoring warnings + cc = "i686-w64-mingw32-gcc -g -Wno-stringop-overflow" optimize; } else { - cc = "x86_64-w64-mingw32-gcc -g" optimize; + // FIXME ignoring warnings + cc = "x86_64-w64-mingw32-gcc -g -Wno-stringop-overflow" optimize; } #elif defined(__clang__) compiler = "clang"; From 089ca94207638feecdf6ae7ac03d326e72f4fc2d Mon Sep 17 00:00:00 2001 From: sevoves Date: Fri, 4 Apr 2025 00:38:41 +0400 Subject: [PATCH 14/22] remove scope pop in ctag since file is the scope --- oberon.ctags | 1 - 1 file changed, 1 deletion(-) diff --git a/oberon.ctags b/oberon.ctags index 6af0745a..d400018f 100644 --- a/oberon.ctags +++ b/oberon.ctags @@ -10,7 +10,6 @@ --kinddef-Oberon=p,procedure,procedures --regex-Oberon=/^\s*MODULE\s+([a-zA-Z][a-zA-Z0-9]*)\s*;/\1/m/{scope=push} ---regex-Oberon=/^\s*END\s+([a-zA-Z][a-zA-Z0-9]*)\s*\./\1/m/{scope=pop} --regex-Oberon=/^\s*PROCEDURE\s*(\^|-)?\s*([a-zA-Z][a-zA-Z0-9]*)/\2/p/{scope=ref} # NOTE Oberon-2 receiver procedures not supported From 3460b9f78ad639486585c562579ba20bca766044 Mon Sep 17 00:00:00 2001 From: sevoves Date: Fri, 4 Apr 2025 15:37:41 +0400 Subject: [PATCH 15/22] create macros for ignoring flood warnings --- src/tools/make/configure.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/tools/make/configure.c b/src/tools/make/configure.c index 87591d63..a5e699f6 100644 --- a/src/tools/make/configure.c +++ b/src/tools/make/configure.c @@ -125,22 +125,22 @@ void determineOS() { } #define optimize "" // " -O1" +// FIXME ignoring flood warnings that possibly are problems +#define ignore_gcc_flood_warning " -Wno-stringop-overflow" +#define ignore_clang_flood_warning " -Wno-deprecated-non-prototype" void determineCCompiler() { snprintf(libspec, sizeof(libspec), " -l%s", oname); #if defined(__MINGW32__) compiler = "mingw"; if (sizeof (void*) == 4) { - // FIXME ignoring warnings - cc = "i686-w64-mingw32-gcc -g -Wno-stringop-overflow" optimize; + cc = "i686-w64-mingw32-gcc -g" ignore_gcc_flood_warning optimize; } else { - // FIXME ignoring warnings - cc = "x86_64-w64-mingw32-gcc -g -Wno-stringop-overflow" optimize; + cc = "x86_64-w64-mingw32-gcc -g" ignore_gcc_flood_warning optimize; } #elif defined(__clang__) compiler = "clang"; - // FIXME ignoring warnings - cc = "clang -fPIC -g -Wno-deprecated-non-prototype" optimize; + cc = "clang -fPIC -g" ignore_clang_flood_warning optimize; #elif defined(__TINYC__) compiler = "tcc"; cc = "tcc -g"; @@ -149,11 +149,9 @@ void determineCCompiler() { compiler = "gcc"; if (strncasecmp(os, "cygwin", 6) == 0) { // Avoid cygwin specific warning that -fPIC is ignored. - // FIXME ignoring warnings - cc = "gcc -g -Wno-stringop-overflow" optimize; + cc = "gcc -g" ignore_gcc_flood_warning optimize; } else { - // FIXME ignoring warnings - cc = "gcc -fPIC -g -Wno-stringop-overflow" optimize; + cc = "gcc -fPIC -g" ignore_gcc_flood_warning optimize; } #elif defined(_MSC_VER) compiler = "msc"; From e298d10d99ca9db6bb55f6da6d43501d8caa6901 Mon Sep 17 00:00:00 2001 From: sevoves Date: Fri, 4 Apr 2025 15:43:44 +0400 Subject: [PATCH 16/22] rewording in configure.c --- src/tools/make/configure.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tools/make/configure.c b/src/tools/make/configure.c index a5e699f6..79059bd7 100644 --- a/src/tools/make/configure.c +++ b/src/tools/make/configure.c @@ -125,22 +125,22 @@ void determineOS() { } #define optimize "" // " -O1" -// FIXME ignoring flood warnings that possibly are problems -#define ignore_gcc_flood_warning " -Wno-stringop-overflow" -#define ignore_clang_flood_warning " -Wno-deprecated-non-prototype" +// FIXME ignoring warning floods that possibly are problems +#define ignore_gcc_warning_flood " -Wno-stringop-overflow" +#define ignore_clang_warning_flood " -Wno-deprecated-non-prototype" void determineCCompiler() { snprintf(libspec, sizeof(libspec), " -l%s", oname); #if defined(__MINGW32__) compiler = "mingw"; if (sizeof (void*) == 4) { - cc = "i686-w64-mingw32-gcc -g" ignore_gcc_flood_warning optimize; + cc = "i686-w64-mingw32-gcc -g" ignore_gcc_warning_flood optimize; } else { - cc = "x86_64-w64-mingw32-gcc -g" ignore_gcc_flood_warning optimize; + cc = "x86_64-w64-mingw32-gcc -g" ignore_gcc_warning_flood optimize; } #elif defined(__clang__) compiler = "clang"; - cc = "clang -fPIC -g" ignore_clang_flood_warning optimize; + cc = "clang -fPIC -g" ignore_clang_warning_flood optimize; #elif defined(__TINYC__) compiler = "tcc"; cc = "tcc -g"; @@ -149,9 +149,9 @@ void determineCCompiler() { compiler = "gcc"; if (strncasecmp(os, "cygwin", 6) == 0) { // Avoid cygwin specific warning that -fPIC is ignored. - cc = "gcc -g" ignore_gcc_flood_warning optimize; + cc = "gcc -g" ignore_gcc_warning_flood optimize; } else { - cc = "gcc -fPIC -g" ignore_gcc_flood_warning optimize; + cc = "gcc -fPIC -g" ignore_gcc_warning_flood optimize; } #elif defined(_MSC_VER) compiler = "msc"; From 5e52f8c23151684cc8d1119f59887b47229778fc Mon Sep 17 00:00:00 2001 From: sevoves Date: Fri, 4 Apr 2025 21:39:45 +0400 Subject: [PATCH 17/22] add ctags doc and remove comments from oberon.ctags --- doc/ctags.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++ oberon.ctags | 23 --------------- 2 files changed, 82 insertions(+), 23 deletions(-) create mode 100644 doc/ctags.md diff --git a/doc/ctags.md b/doc/ctags.md new file mode 100644 index 00000000..34319208 --- /dev/null +++ b/doc/ctags.md @@ -0,0 +1,82 @@ +## Code navigation with ctags + +[`ctags`](https://github.com/universal-ctags/ctags) is a tool that creates an index file for names (symbols) in various programming langauges, which helps code comprehension by giving information to text editors to search, locate, and interactively suggest names. Particularly for Oberon, the `oberon.ctags` file, located in the project root, contains definitions for Oberon modules and procedures (but not receiver procedures). + +Below you can find installation instructions and usage examples for `ctags`, in particular, using the universal tags implementation (not tested with other implementations), with `vim` (you can find or add guides for your text editor), with examples that deal with Oberon source code. + +## Install universal tags + +#### Use your package manager + +`pacman -S ctags` (arch linux) +`apt install universal-ctags` (debian, ubuntu) +`brew install universal-ctags` (macOS) +... + +#### Compile from source + +`git clone https://github.com/universal-ctags/ctags.git` +follow [build instructions](https://github.com/universal-ctags/ctags/blob/master/README.md#how-to-build-and-install) + +## Using ctags with vim and Oberon + +the following instructions are for POSIX systems, but can be easily adapted to other systems + +#### Configuration + +First, generate tags in project root +`make tags` + +When you add or change names in source files, you have to regenerate the `tags` file. That can be done by running `make tags` again. Optionally, use a `vim` plugin such as [vim-gutentags](https://github.com/ludovicchabant/vim-gutentags) to automate this process. Install it (or skip this step): +``` +git clone https://github.com/ludovicchabant/vim-gutentags ~/.vim/plugin/ +``` +or wherever your vim global plugin directory is specified in `:h plugin`. + +Add this to your `~/.vimrc` +``` +" search upwards for tags file until home directory +set tags=./tags;~ +" qualified name metadata for plugin +let g:gutentags_ctags_extra_args = ['--extras=+q'] +``` + +To use `oberon.ctags` with a plugin or for Oberon language detection outside its directory: +`cp oberon.ctags ~/.config/ctags/` +or +`cp oberon.ctags $XDG_CONFIG_HOME/ctags/` + +#### Usage examples + +tags documentation is in vim +`:h tags` + +some examples: +``` +vim -t "Compiler" +vim -t "OPS.Get" +vim -c ":ts Platform.Read" +vim -c ":ta BrowserCmd.ShowDef" +``` + +Inside vim when you have cursor on the first letter `M` of `Module.Procedure`, do this to jump to procedure definition: +`v 3e ` *(visually select the fully qualified name)* +module definition: +`` +To come back: +`` + +Putting cursor on `P` of `Module.Procedure` is not guaranteed to resolve correctly to the correct module, so choose the fully qualified name. This is a [known limitation](https://docs.ctags.io/en/latest/man/ctags-faq.7.html#how-do-i-jump-to-the-tag-i-want-instead-of-the-wrong-one-by-the-same-name) of `ctags` (any suggestions for to handle this better are welcome). + +To address this, you can visually select as in the above examples, or resolve ambiguities interactively: +`g ` +`:ts Write` +`:ts Platform.Write` +or make vim see the qualified name as a complete keyword: +`iskeyword+=.` +in `.vimrc` +`autocmd FileType oberon,modula2 setlocal iskeyword+=.` + +**TODO** +There is some auto-completion, with but it doesn't work well. One idea is to define a custom `omnifunc` that suggests only exported symbols (`*`) from a file (module scope is file), so that when you type `OPS.` and press `` you can have useful suggestions (similar to `showdef`). + diff --git a/oberon.ctags b/oberon.ctags index d400018f..f0ef512f 100644 --- a/oberon.ctags +++ b/oberon.ctags @@ -11,27 +11,4 @@ --regex-Oberon=/^\s*MODULE\s+([a-zA-Z][a-zA-Z0-9]*)\s*;/\1/m/{scope=push} --regex-Oberon=/^\s*PROCEDURE\s*(\^|-)?\s*([a-zA-Z][a-zA-Z0-9]*)/\2/p/{scope=ref} -# NOTE Oberon-2 receiver procedures not supported -### using ctags with vim -# examples: -# vim -t "Compiler" -# vim -t "OPS.Get" -# vim -c ":ts Platform.Read" -# -# you need to jump to the fully qualified name, since procedure names alone -# sometimes resolve to an incorrect module. that is to say putting cursor on -# W in Platform.Write and jumping will probably not work as expected, so you -# might have to do some of these -# add this to yout .vimrc -# autocmd FileType oberon,modula2 setlocal iskeyword+=. -# select the qualified name -# v 3e -# :ta Platform.Write -# resolve ambiguities interactively -# :ts Write -# g -# -# if you need upward searching for tags file, so you can access them from -# project root subdirectories, then add this to your .vimrc -# set tags=./tags;~ From 7dafb02d1ed593d36da35c31f4aacb2638722296 Mon Sep 17 00:00:00 2001 From: sevoves Date: Fri, 4 Apr 2025 21:40:59 +0400 Subject: [PATCH 18/22] add ctags doc --- makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/makefile b/makefile index 7bc29843..08b69845 100644 --- a/makefile +++ b/makefile @@ -92,6 +92,7 @@ usage: @echo " make revertbootstrap - Use git checkout to restore bootstrap C source directories" # Code navigation helper +# doc/ctags.md .PHONY: tags tags: ctags -R --options=oberon.ctags --extras=+q From bb7a7311979938bf2eac19900dd416f9cd0f0def Mon Sep 17 00:00:00 2001 From: sevoves Date: Fri, 4 Apr 2025 21:44:46 +0400 Subject: [PATCH 19/22] small change in ctags.md --- doc/ctags.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/ctags.md b/doc/ctags.md index 34319208..ed646ee2 100644 --- a/doc/ctags.md +++ b/doc/ctags.md @@ -28,9 +28,9 @@ First, generate tags in project root `make tags` When you add or change names in source files, you have to regenerate the `tags` file. That can be done by running `make tags` again. Optionally, use a `vim` plugin such as [vim-gutentags](https://github.com/ludovicchabant/vim-gutentags) to automate this process. Install it (or skip this step): -``` -git clone https://github.com/ludovicchabant/vim-gutentags ~/.vim/plugin/ -``` + +`git clone https://github.com/ludovicchabant/vim-gutentags ~/.vim/plugin/` + or wherever your vim global plugin directory is specified in `:h plugin`. Add this to your `~/.vimrc` From 9846292b85056a3f4f1978e6993fb2669a3cdcf7 Mon Sep 17 00:00:00 2001 From: sevoves Date: Fri, 4 Apr 2025 21:51:30 +0400 Subject: [PATCH 20/22] minor changes in docs --- doc/ctags.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/ctags.md b/doc/ctags.md index ed646ee2..aab16dee 100644 --- a/doc/ctags.md +++ b/doc/ctags.md @@ -66,7 +66,7 @@ module definition: To come back: `` -Putting cursor on `P` of `Module.Procedure` is not guaranteed to resolve correctly to the correct module, so choose the fully qualified name. This is a [known limitation](https://docs.ctags.io/en/latest/man/ctags-faq.7.html#how-do-i-jump-to-the-tag-i-want-instead-of-the-wrong-one-by-the-same-name) of `ctags` (any suggestions for to handle this better are welcome). +Putting cursor on `P` of `Module.Procedure` is not guaranteed to resolve correctly to the correct module, so choose the fully qualified name. This is a [known limitation](https://docs.ctags.io/en/latest/man/ctags-faq.7.html#how-do-i-jump-to-the-tag-i-want-instead-of-the-wrong-one-by-the-same-name) of `ctags` (any suggestions for handling this better are welcome). To address this, you can visually select as in the above examples, or resolve ambiguities interactively: `g ` @@ -77,6 +77,6 @@ or make vim see the qualified name as a complete keyword: in `.vimrc` `autocmd FileType oberon,modula2 setlocal iskeyword+=.` -**TODO** -There is some auto-completion, with but it doesn't work well. One idea is to define a custom `omnifunc` that suggests only exported symbols (`*`) from a file (module scope is file), so that when you type `OPS.` and press `` you can have useful suggestions (similar to `showdef`). +**TODO** +There is some auto-completion, but it doesn't work well. One idea is to define a custom `omnifunc` that suggests only exported symbols (`*`) from a file (module scope is file), so that when you type `OPS.` and press `` you can have useful suggestions (similar to `showdef`). From 1fbbb68dc7f72196dd59db1bd8e24529b8adb89c Mon Sep 17 00:00:00 2001 From: sevoves Date: Fri, 4 Apr 2025 21:56:16 +0400 Subject: [PATCH 21/22] rewording ctags doc --- doc/ctags.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ctags.md b/doc/ctags.md index aab16dee..30680898 100644 --- a/doc/ctags.md +++ b/doc/ctags.md @@ -2,7 +2,7 @@ [`ctags`](https://github.com/universal-ctags/ctags) is a tool that creates an index file for names (symbols) in various programming langauges, which helps code comprehension by giving information to text editors to search, locate, and interactively suggest names. Particularly for Oberon, the `oberon.ctags` file, located in the project root, contains definitions for Oberon modules and procedures (but not receiver procedures). -Below you can find installation instructions and usage examples for `ctags`, in particular, using the universal tags implementation (not tested with other implementations), with `vim` (you can find or add guides for your text editor), with examples that deal with Oberon source code. +Below you can find installation instructions and usage examples for `ctags` to navigate Oberon source code, in particular, using the universal tags implementation (not tested with other implementations), with `vim` (you can find or add guides for your text editor). ## Install universal tags From 378de4327444f79c5a8797b592fd53c51500d74e Mon Sep 17 00:00:00 2001 From: sevoves Date: Fri, 4 Apr 2025 22:00:31 +0400 Subject: [PATCH 22/22] rewording doc/ctags.md --- doc/ctags.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ctags.md b/doc/ctags.md index 30680898..d6e8a40d 100644 --- a/doc/ctags.md +++ b/doc/ctags.md @@ -1,6 +1,6 @@ ## Code navigation with ctags -[`ctags`](https://github.com/universal-ctags/ctags) is a tool that creates an index file for names (symbols) in various programming langauges, which helps code comprehension by giving information to text editors to search, locate, and interactively suggest names. Particularly for Oberon, the `oberon.ctags` file, located in the project root, contains definitions for Oberon modules and procedures (but not receiver procedures). +[`ctags`](https://github.com/universal-ctags/ctags) is a tool that creates an index file for names in various programming langauges, which helps code comprehension by giving information to text editors to search, locate, and interactively suggest names, identifiers, symbols etc. Particularly for Oberon, the `oberon.ctags` file, located in the project root, contains definitions for Oberon modules and procedures (but not receiver procedures). Below you can find installation instructions and usage examples for `ctags` to navigate Oberon source code, in particular, using the universal tags implementation (not tested with other implementations), with `vim` (you can find or add guides for your text editor).