Would you be interested in a monthly Zoom Meeting on everything coding on RISC OS?
GavinWraith (26) 1563 posts |
There are two sorts of library for programming in Lua: those written in Lua, and those written in C. The latter can be thought of as extensions to the Lua interpreter itself. Conventionally for RiscLua, the former are kept as text files in !rlua.lib and the latter as ELF files in !rlua.solib (N.B. their filenames must end in /so). The RiscLua interpreter (!rlua.bin.lua) is compiled from C sources in this zip archive. Libraries of either kind can be loaded using the require function. For example looks for a library called mylib and loads it as a table called x . The actual file loaded, if it exists, will either be !rlua.solib.mylib/soor !rlua.lib.mylib. The system variables LUA_PATH and LUA_CPATH, set in !rlua’s !boot, determine how require translates its argument into possible filenames. This mechanism means that the variablename your program uses for a library (the x ) is determined by you, not the author of the library. Note that the require-statement is idempotent ; that is, executing it twice is completely equivalent to executing it once, so unnecessary loads are not carried out. When Lua loads text from a file it tries to compile it as the body of a function of no arguments. So a library should contain a return statement . By convention a Lua library returns a single table. You can see examples in !rlua.lib. Section IV, the C API, in Programming in Lua, is about writing libraries for Lua in C. The examples, in !rlua.solib, are perhaps rather meagre fare and too obscure. So can anybody suggest some possibilities that are neither too complex nor too trivial, for further examples? In some sense the riscos library caters for any interaction with RISC OS that you might need, but not necessarily in the most efficient way. |
Paolo Fabio Zaino (28) 1882 posts |
@ Gavin
Sure, let me work some simple examples. In general what is truly important is learning how to write a C wrapper for Lua for an existsing ELF32 library. That is what makes the whole game work. In some experiments (althought if we do not want to use ASM), I have managed to access from Lua ObjASM written functions that were written for the C compiler and so I just needed to write the C wrapper for Lua, which means RiascLua can also access Assembly written code. |
GavinWraith (26) 1563 posts |
That is an important point. The sources do not have to be written in C. So long as they can be compiled to ELF files that can be linked to the C library that is enough. The classic RISC OS applications, Draw, Paint and Edit were written in C using the riscoslib library, described in RISC OS library reference section in the Manual ACORN ANSI C RELEASE 4. The memory management for these applications, and most of riscoslib, are based on the heap and flex libraries. A question that has been at the back of my mind for over two decades is: can they be based on the Lua library, and its memory management, instead? If this is a feasible exercise one would get profound advantages. Edit, for example, would acquire all the pattern matching provided by Lua and Lpeg, and powerful scripting facilities. Most of the heavy lifting in Edit is done by the txt library and its extensions, txtedit , txtwin , etc. It would be a question of going through the sources of txt and replacing its dependences on heap and flex by calls to the Lua library. Does ROOL have those sources? |
Paolo Fabio Zaino (28) 1882 posts |
@ Gavin
Do you mean these? https://gitlab.riscosopen.org/RiscOS/Sources/Apps/Draw https://gitlab.riscosopen.org/RiscOS/Sources/Apps/EditApp https://gitlab.riscosopen.org/RiscOS/Sources/Apps/Paint Flex sources should be included in those repos. I don’t know what ROOL wants to do with those apps, however, I believe !Edit should probably be left in ROM as an “emergency editor” in case of issues, so maybe you’d like to work on an enacted version outside the one in ROM? Draw should probably stay a Module, for instance in the future we may use it instead of sprites to have a more scalable desktop? Paint, IMHO has no need to live in ROM and should become (if it hasn’t already) an on disc app, so people can extend also its functionalities, given that at this point it’s way too basic even to create sprites for apps, so it would benefit a lot from becoming an on disc app. Just my 0.5c |
GavinWraith (26) 1563 posts |
No. I meant the sources to riscoslib. In particular there is probably a file txt.c somewhere. |
Chris Mahoney (1684) 2165 posts |
https://gitlab.riscosopen.org/RiscOS/Sources/Lib/RISC_OSLib https://gitlab.riscosopen.org/RiscOS/Sources/Lib/RISC_OSLib/-/blob/master/rlib/c/txt |
Steffen Huber (91) 1953 posts |
The list of people still active on RISC OS who ever did soomething serious in Ada has probably 1 1/2 entries…so choose wisely :-) More seriously, I cannot commit myself to such a venture in the coming months. Perhaps in a year or so. And the largest section of any talk about Ada on RISC OS would be “ah, there are those cool features, but you cannot use it on RISC OS because the compiler is buggy/does not support this, and you’d obviously like to use Ada 2012, but we only have Ada 95”. It would be a depressing talk. |
Paolo Fabio Zaino (28) 1882 posts |
Sure, but we should still document how to code in Ada on RISC OS (as well as Perl, TCL etc.), let’s put the “world domination” mode off for a while please, let’s just have fun with RO for what it is, again just my 0.5c |
Steffen Huber (91) 1953 posts |
Ah, I already documented (small parts of) it in 2001: And some failed plans of World (and RISC OS development languages) Domination: But I basically agree that I should put something together on my webpages for the current state of things. Things are scattered around a lot, like the ARMv8 pacthed runtime AND the 32bit compatibility package AND who knows if the original GCC/GNAT tandem is still downloadable somewhere…and the StrongEd Ada mode…and the Zap Ada mode never made it to 32bit… Let’s see if I can collect it all together somewhere.
A platform with development tools in a very depressing state? There is a lot of fun using RISC OS for certain things, but Ada development is probably the furthest away from “fun”. Let’s stick to the reasonable things. |
Steve Pampling (1551) 8172 posts |
I decided to see what Google translate made of the German text. Edit: I wonder if there’s a need for translations of the RO resources to a number of the main languages (English, French, German, Spanish…) |
Michael Grunditz (8594) 259 posts |
I can participate and give some talk about dual running os stuff. It will be difficult to share code , but I can explain how it works. |
Steve Fryatt (216) 2105 posts |
I don’t see why not… :-) There’s also what I’ve learned while getting all of my BBC BASIC applications under source control – first in Subversion, then later on Git and published on GitHub – if that would be of interest to anyone? |
Paolo Fabio Zaino (28) 1882 posts |
@ Steve Pampling
Yes there is, at least the small community in Italy would like that, but I think it’s not a priority anymore given that Google translator can help when resources are on-line. |
Paolo Fabio Zaino (28) 1882 posts |
@ Michael
Great! Thanks a lot :) |
Paolo Fabio Zaino (28) 1882 posts |
@ Steve Fryatt
Nice! thank you very much :)
Of course! SHowing how to use tools and your approach and workflow as well! It’s a meeting about everything coding on RISC OS, so definitely all the tools people use to help coding, versioning, testing, debugging, organise sources, measure performance, all absolutely welcome stuff! Also don’t forget we all have workflows and a lot of people may benefits from seeing multiple of them and then organise their own based on bits taken from everything they have liked. Also I may prepare a mini “course” in micro-benchmarking languages in order to squeeze performances, or how to use the NULL event to simulate a more preemptive behaviour of our Apps. Using DDT for C, C++ and ABC compiled code etc. there is so much we can talk about. Also will introduce (as they become ready) new compilers for RO 5 like my Forth and the Forth VM Jitter, Prolog compiler (it started to work recently on RO 5), Maybe in the future some new BASIC with OOP support. Also I wish to have space to talk about all the details of AIF Object Format and all the others. Again, everything coding on RISC OS. So thanks everyone for all the great feedback and ideas so far! :) As an action items: - I am collecting all the feedback and preparing a list to share and edit on GitHub I’ll share links on here so everyone can provide feedback and let me know who is going to present what :) P.S. given that quite a few people I know are coding also on (and for) older releases of RISC OS, I would like to extend the invitation to whoever is coding on (or for) older versions and older RISC OS platforms. |
Graeme (8815) 106 posts |
I would be interested. On the advanced section I would like to see someone show how we can build Risc OS from source code. What software do we need? How to download from github, how to compile and run everything. I want to make a change to the OS, how do we do this and test it. What happens when it goes wrong and doesn’t boot up? How do we revert? When we have finished, how do we send updates back to github/Risc OS for them to evaluate? I would definitely watch a series which includes this. It maybe needs someone to prepare some video first so the long boring bits can be fast forwarded. |
Theo Markettos (89) 919 posts |
I think this is a good idea… there’s so much that’s in the heads of relatively few people. I think some good ‘high level overview’ material would be especially useful: ‘there is X, there is Y (but nobody worked on that since 1992), we don’t currently have a Z. Here’s how to get started’. Doesn’t have to be comprehensive, even simply ‘this is my workflow and I use these tools’. It would be useful to keep as a repository of information.
I think this is not uncommon, especially for people who aren’t used to this kind of format. What I’d suggest is:
(something useful when writing this kind of material is that Powerpoint, and maybe other packages, can attach audio to a slide. So you have a series of slides, each with their own audio commentary. Then you can ‘compile’ the slides into a movie file, that displays each slide while the audio plays. This makes it much easier to change something, because you can just re-record the audio for a particular slide and recompile, rather than have to do the whole talk again) |
Andrew McCarthy (3688) 605 posts |
I’m pleased that Paolo has run with the idea and that it’s gained some traction. So I’m all in and happy to talk about my experiences. Forgive me at the moment, but I’m a bit busy with some private family matters, so I can’t currently catch up with all the information here and elsewhere. I’ll offer to help coordinate as soon as I’m free, and I’m up for hosting a few sessions. A suggestion, let’s also keep ROOL and ROD in the loop. Bye for now. |
Paolo Fabio Zaino (28) 1882 posts |
@ Graeme
Great idea and noted, thanks a lot! :) |
Paolo Fabio Zaino (28) 1882 posts |
@ Andrew
They have been invited from my very first message (look at the topic one). No answers so far, which is ok, I don’t want to apply pressure on any of them also considering this might be slightly in conflict with the “business” side orientation they both present, although if, in another side, it would be beneficial to both of them to have more people capable of getting into RISC OS coding and faster. So, I am expecting both of them to take some time to eventually provide an answer (if it will ever happen they would). |
Paolo Fabio Zaino (28) 1882 posts |
@ Theo
Very true, it would be totally fine to prepare a pre-recorded presentation if that helps some of us, no worries at all. Again the goal is to preserve knowledge and share it so everyone have an easier life coding on RO. And, beside, for things like Graeme idea we’ll need rep-recorded material anyway or the presentation may take a very long time! :) |
Theo Markettos (89) 919 posts |
A pre-recorded talk with the speaker there to do the Q&A/discussion live often works quite well. One neat trick if you’re on-camera for the talk is to wear the same shirt and have the same background during the Q&A as you did for the recording – that way they can’t tell it wasn’t live :) |
Steve Fryatt (216) 2105 posts |
I couldn’t see a convenient quote to grab from Theo’s post, so I’ve quoted Paolo’s response for context. I suspect that people may be overestimating the number of “off the cuff” presentations that take place in the RISC OS world (or any field). I may be wrong, but I strongly suspect that most of the apparently ad-libbed performances that we get at RISC OS shows and user group meetings are very much scripted and rehearsed. The ones that work well are very likely to have been written and then “performed” a couple of times – even if that’s only quietly in the head of the presenter. Unless you’re very good, just turning up to do a talk on something without preparation is a recipe for complete disaster – especially if there’s facts or processes involved. In fact, I’d venture to guess that the ones which look most “casual” and “laid back” are almost certainly the most tightly rehearsed ones of the lot.
I tend to write out the key points in paragraphs of short sentences, along with the steps that need to be taken in any demo that’s ongoing, whilst running through the full text in my head as I do it. This process is then repeated a couple of times, refining the written notes as required. After a couple of passes, this also gives a fair approximation of the timing for the talk. For the talk, the notes are printed out in “large print” and referred to at suitable pauses in order to make sure that I’m still on track. One other observation: it’s very different doing a talk on Zoom compared to doing one in person. In person, there’s feedback from the audience (even if it’s just eye contact and the fact that people aren’t visibly nodding off), which is useful when deciding whether to emphasise sections or skip through them quickly. On Zoom, there’s no feedback at all – it’s just a case of ploughing on to the end and hoping for the best… This is one reason why breaking the subject up into short chunks and doing questions after each one can be a valuable approach in an online presentation. |
Rick Murray (539) 13850 posts |
It’s a bit outdated, but the basic principles are there… https://heyrick.eu/blog/index.php?diary=20131105 It’s much faster on a more recent Pi, and if you’re a bit psycho you could try dumping the extracted files into a RAMdisc! |
Paolo Fabio Zaino (28) 1882 posts |
@ Rick
Are you proposing to give us a presentation for it? :) |