Page 1 of 2

source code

Posted: Sat Dec 12, 2020 1:24 pm
by rochus
The Blackbox framework is a fascinating piece of work I first time came accross twenty years ago but never had the time to study in detail.

I would like to implement a couple of tools as I did e.g. for https://github.com/rochus-keller/oberon or https://github.com/rochus-keller/smalltalk/.

Is there an easy way to convert all Blackbox framework source code files to plain text (latin-1 or utf-8 or whatever), handling embedded components like folds etc. in a decent way?

Or if I would like to implement a parser which can read the odc source files, is there a byte level file format specification? In case I have to figure out myself in the source code, what modules do I have to look at?

Thanks.

Re: source code

Posted: Sat Dec 12, 2020 3:03 pm
by Ivan Denisov
There is the tool odcread
https://github.com/gertvv/odcread

It is described in wiki here to provide text facilities of git
https://wiki.blackboxframework.org/index.php?title=Diff

Re: source code

Posted: Sat Dec 12, 2020 4:24 pm
by rochus
Wow, that's great, thank you very much. I was able to compile and use the tool. Unfortunately there is no -h option, but apparently "./odcread Module.odc > Module.txt" seems to work (I want to use it without Diff or git).

Do you have by chance a similar tool which is able to read the Linz Oberon (ftp://ftp.ssw.uni-linz.ac.at/pub/Oberon ... oberon.tgz) file format? odcread makes a segfault when I try it there.

Re: source code

Posted: Sat Dec 12, 2020 5:00 pm
by adimetrius
Check out Dev/Spec/StoreFileFormat.odc - it is, well, the Stores file format. Typically, an .odc with source code will contain a Documents.Document containing a TextViews.View referencing a TextModels.Model. Each of these is externalized in Documents.StdDocument.Externalize, TextViews.StdView.Externalize, TextModels.StdModel.Externalize. Each of these types is an extension of Stores.Store, which is why StoreFileFormat may be of use.

And - keep us posted on your progress ))

P.S.

Dmitry V. Dagaev may be of deeper knowledge of this issue. He has implemented MultiOberon, and, afaik, as part of the project implemented an importer of texts from .odc containers that works outside of Blackbox.

PPS

I wonder what would be the most simplistic BB application that would read a text from within .odc and export it to, say, an array of chars. It seems it would be useful for a number of people if such an app were available as a DLL/.so

Re: source code

Posted: Sat Dec 12, 2020 7:28 pm
by rochus
Thanks for the hints. I actually had a look at StoresFileFormat before but didn't understand the context. With odcread I was able to generate plain text versions of all source files and I will continue with these for the next steps (looking at the source files and maybe extending my existing parser for CP).

If someone is interested how I converted the source files on my Linux machine, here are the steps:

1) in the blackbox directory, run "find . -path "*/Mod/*.odc" -printf './odcread %p > %h|%f.mod\n' > convert.sh"
2) edit convert.sh, replace ".odc.mod" by ".mod" and "/Mod|" by "/"
3) make convert.sh executable and run it (the script expects a copy of odcread to be in the blackbox directory)
4) collect all files in a ZIP, run "zip -R -Z bzip2 modules "*.mod""

I already saw the updated language report and the platform-specific issues, but there still seem to be syntax constructs for which I didn't find a specification yet (e.g. OUT [nil]).

Re: source code

Posted: Sat Dec 12, 2020 8:19 pm
by adimetrius
Since you mentioned Linux, I thought I'd mention there is a BlackBox for Linux - the linux build of the BlackBox Cross-Platform blackbox.oberon.org, there's an Eng page

Re: source code

Posted: Sat Dec 12, 2020 8:49 pm
by rochus
That's interesting, thanks for the hint. Here is the Github link: https://github.com/bbcb/bbcp. I just downloaded and tried the Linux archive version; looks impressive. As it seems a lot of code is platform specific; wonder whether one could save time by using e.g. something like Qt.

Re: source code

Posted: Sat Dec 12, 2020 10:21 pm
by adimetrius
Well, there's also https://blackbox.oberon.org/extension/Sdl2. I haven't tried it on either Win or Lin, but it's been mentioned in conversations a lot.

Re: source code

Posted: Sat Dec 12, 2020 10:54 pm
by rochus
Thanks for the hint. Looks interesting. It's not the proposed approach though. Qt covers all OS features including internationalization, threading, file system, networking and of course all GUI features including fonts and such, thus able to replace a lot of platform specific code in https://github.com/bbcb/bbcp. The Sdl2 extension in contrast is an alternative to the already implemented GUI for people who prefer the SDL API. But of course it's non of my business, just a thought.

Re: source code

Posted: Sun Dec 13, 2020 1:56 am
by Ivan Denisov
As I remember, Peter Kushnir made analysis for compatibility of BlackBox with Qt several years ago. So he said, that this will not have positive outcome, because Qt works like framework with hidden internal loop with it's own garbage collector etc. And there is no access to lowlevel Qt framework mechanisms, so BlackBox is not possible to port with Qt.