DrawGen
jim lesurf (2082) 1438 posts |
Some RO users may recall the “DrawGen” system I wrote some years ago. For those who don’t: It provides a ‘programming language agnostic’ way to generate simple drawfiles from other programs. I’m posting now, in the hope someone may be interested in helping some further development of DrawGen… FWIW You can find the ‘current’ (i.e. quite old) version here http://jcgl.orpheusweb.co.uk/DrawGen/dgen.html I’ve just been revisiting this because I wanted to add some new features and do an updated version. However I’ve run into snags for two reasons: 1) I’m a lousy programmer. 2) The source are in ABC Basic for use with the ABC compiler. i.e. Almost but not exactly standard BASIC. And I’ve not used BASIC for well over a decade. I can say more about what prompted this, but I’d be happy to make the source code, etc, openly available so someone else can improved it, update it, and give it useful features it lacks. For simplicity I’ll post this, then add more in a later posting. |
jim lesurf (2082) 1438 posts |
Continued… What prompted this now was that I want to create an equivalent to a program I’ve written for Linux. This analyses data and then uses ‘Vesuz’ to produce a page of graphics. The new aim being to have a RO program that creates a similar DrawFile with various graphs and values, etc, on a ‘page’. DrawGen will do most of what is needed. But there is one awkward omission. As it stands, DrawGen will only print horizontal text. However something like a rectangular XY graph tends to need some vertical text to label a Y-axis. Looking at the source code I now find I’m struggling to make sense of the BASIC! I think I know the format for a rotated text object in DrawFile, but can’t get it to work, so I’ve clearly forgotten key points. To make things worse, the !ABC compiler I have (on my ARMX6) seems to alternate between throwing an error and working, for the same source code. Which makes me wonder what else might be wrong and causing problems. (Again, I’ve not used !ABC for a long time.) Thus what looked like a simple task is baffling me. And, given the decision to add features, it occurred to me that more than one person has asked for the ability to include sprites and jpegs to be added. In practice, for years now, I’ve just used DrawGen via a ‘C’ library I wrote and include. (I also did have a FORTRAN set like this.) So the hope is to add the new features, but do it consistently with being compatable with the ‘scripting language’ that DrawGen reads and is generated for it. Thus ensuring all older programs that use DrawGen would still work. Anyone interested? |
Chris Hall (132) 3554 posts |
Have a look at MakeDraw – it has a routine for rotated text:
|
nemo (145) 2546 posts |
There was also DrawBasic by Joe Taylor, which was extremely extensive. Did that make it to the 32b world? |
Rick Murray (539) 13840 posts |
What error? The exact same source? The same environment? |
Steve Pampling (1551) 8170 posts |
DrawScriot certainly did, I’ve not seen a 32bit DrawBasic. |
jim lesurf (2082) 1438 posts |
Afraid I can’t recall what the error messages was. But… I’d drag the source file to the ABC icon and it offered an output dragbox file. I’d then drag and drop that… and get the error. I’d repeat the process having cancelled the error, and this time it would work. The next time, I’d get the error, recurse until curse. 8-] The problem with the other suggestions thus far is that any knowledge I had of BASIC has evaporated AND I want to expand what DrawGen does while ensuring the usefulness of existing programs and libraries that rely on generating the file which the module reads to generate a DrawFile. To dodge the particular bullet that prompted this I can use a bodge. I’ve written a routine that reads the text string I want displayed, and it then places one character at a time in a vertical line. L T It means I need to use something like Courier to avoid it looking too ragged. But does the job. However it seems more sensible to me in the long run if DrawGen could plot angled text and include sprites/jpegs because more than one person has asked for them. BTW when looking at this I realised that the demos supplied with !DrawGen now don’t run on current OS/hardware and need to be recompiled from the ‘C’ sources supplied. And that the HTML on one of the pages has a bug I need to fix! So I’ll sort those points and put a current set of examples up. But the bottom line is as before. I really would welcome one or t’other of: 1) Someone who knows BASIC well who’d be willing to add the new features to the ABCBasic module code. 2) Re-write it in ‘C’. (I never was able to work out how to do this for modules.) If someone will have a go, I’m happy to supply the existing code and make it open source. But for me, backwards compatability with existing ‘C’/BASIC/FORTRAN programs that use DrawGen is important. |
Steve Drain (222) 1620 posts |
A bit late now, and maybe not what you need, but my DrawIt BASIC library can also be used to produce DrawFiles with fairly complex specifications. It will do angled text and sprites/jpegs. More to the point, it might provide examples of the algorithms needed. |
Rick Murray (539) 13840 posts |
Toss me a copy and I’ll see how it behaves with my ABC. I can do BASIC, but don’t expect me to have anything resembling the remotest inkling of a clue when it comes to mathematics more complex than a 6502 could handle natively… |
Steve Drain (222) 1620 posts |
This problem shows up one of the real limitations of ABC. Native BASIC can do dot products of arrays, necessary for tranformations such as rotated text, but these cannot be compiled, so have to be written in long-form. As for the mathematics, there is a page, Procedures>Transforms>set_affine>Examples, in the StrongHelp manual for DrawIt that shows the algorithms required. |
jim lesurf (2082) 1438 posts |
OK, Steve/Rick/anyone else interested… :-) Here is the source code as is/was http://jcgl.orpheusweb.co.uk/temp/DrGen_V200 Note it is the BASIC file, I’ve not bothered to zip it or anything, so you’ll just need to filetype it as BASIC. Ignore the ancient ‘copyright’ line. That was just a sort of protection against seeing incompatable versions in the long-past era when I shoved it together. At present I don’t need arbitrary rotations. Just 90deg to have text read along the edge of an xy graph. So to get it I was trying to write a ‘vertext’ token (1) and process that uses DrawFile object type 12 with specific values in the transformation matrix to give the desired result. If arb rotations are needed we could poke them in via a suitable library proceedure. Hmmm… maybe I should also put up my standard ‘C’ drawlib library so you can see how I use it. However that is, I think supplied in the standard package I’ve had available. (1) The idea being that it would – for the user – work just like the existing ‘text’ token, but print the result with vertical text going up the page like you usually see on the left-hand side of an xy graph. I’ll have a look at DrawIt. Thanks. |
Bernard Boase (169) 208 posts |
Well it would have been Gavin Wraith who long ago had worked closely with Joe, but in recent years Joe was not in good enough health to respond on RISC OS matters. |
David Pitt (3386) 1248 posts |
The source code as provided does compile without error with !ABC 4.19 from DDE28. However there is a “Hex number too large” error at line 322, darkgrey%. |
nemo (145) 2546 posts |
What a shame. There’s a huge amount of work in DrawBasic, but it’s all Basic – the only modules are just a wrapper for some ResourceFS files. The greatest impediment is that it was not “free” software – it was shareware and cost £15 from an address in Brighton. I doubt that still exists, so I wonder if Joe would be content to release it as freeware? It would be trivial to make the module(s) 32b. |
Steve Pampling (1551) 8170 posts |
One thing I do recall from those forum posts1 was that Joe was particularly concerned that many years of his passionate work might simply fade away because of some new hardware generated incompatibility. (26bit modules being just one aspect) 1 Was that Gavin as suggested above? I so then perhaps he can enlighten people as to current status. |
nemo (145) 2546 posts |
DrawBasic is a substantial piece of work and it would be a shame to see it fade away. The 26b module thing is trivially easy to fix, so I’ve made 32b versions here – please note that this is only the modules and not any of DrawBasic itself. As I understand it it’s just some !Edit support. These update the modules shipped with version 1.3 of DrawBasic in 1994. There may well be a more recent version. |
jim lesurf (2082) 1438 posts |
The version I have of !ABC is ‘younger’ than 4.19. Where can I get the most recent version? I’d also like to add a polite reminder that I started this thread to ask for ‘open’ help with improving DrawGen. :-) I realise there are other ways to skin a cat. But here, DrawGen is what I’m requesting help with. The key reasons being: 1) It can be used from any programming language that can write characters to a file, and thus build the ‘script’ file the module uses to generate a DrawFile. (Hence for almost two decades since I abandoned FORTRAN to use it, all my programs that use it are in ‘C’. And I assume it would also be easy to use from Python, etc, however users prefer.) 2) There are already programs that use it so any improvement/extension needs to be compatable with them. I’ve already had a couple of emails about this, so it makes sense to try and co-ordinate any development in some way. I’ve been assuming this forum would be best for an ‘open’ project. But would email be preferred? |
John Williams (567) 768 posts |
4.20 is in today’s beta Hard Disc image. |
David Pitt (3386) 1248 posts |
That is the ABCLibrary run time module, not be confused with the compiler which comes as part of the DDE and remains as 4.19 though there may be an update for that as well pending. |
jim lesurf (2082) 1438 posts |
Where do I get the DDE or 4.20 of !ABC, though? I can’t recall where I got the version I’m using but I think it may have come with my old ARMiniX or current ARMX6. Not used it for ages for reasons given above! FWIW it would probably make sense for the DrawGen module to be redone in ‘C’, but againm, as earlier, I was never able to work out how to write modules that way, whereas !ABC made it easy… when I could write/understand BASIC! 8-] |
GavinWraith (26) 1563 posts |
Yes. I remembered DrawBasic but I was puzzled by its absence from my RISC OS storage media. So this morning I telephoned Joe Taylor and had a long chat. He explained that a short while before he was stricken down he rewrote DrawBasic, whose title he had long considered to be misleading, as DrawScript.
He went on to affirm that he was quite happy for people to treat DrawScript as freeware. His problem is that his physical condition and eyesight make it impossible for him to access or use his old computing equipment. But he repeated that if anybody were able to modify what is out there they would be more than welcome. |
David Pitt (3386) 1248 posts |
The full DDE is here, at a price. It has been asked before if the compiler is available separately and I don’t remember if it was or not. |
Mike Freestone (2564) 131 posts |
bq It has been asked before if the compiler is available separately and I don’t remember if it was or not. From David Feugey assuming the offer is still on |
nemo (145) 2546 posts |
Where is it? I’d be happy to polish anything that isn’t already shiny. |
Chris Johnson (125) 825 posts |
Just to say that last night I offered to try to help Jim out with his DrawGen problem. I am not sure if there are any other volunteers around – it would not be sensible to duplicate effort. |