Help understanding complaint

Here you can talk about anything related to BBC BASIC, not covered in another category
User avatar
JeremyNicoll
Posts: 72
Joined: Sun 26 Jul 2020, 22:22
Location: Edinburgh

Re: Help understanding complaint

Post by JeremyNicoll »

When earlier I tried:
JeremyNicoll wrote: Sun 19 Mar 2023, 18:12 C:\>"C:\Users\--myuser--\Downloads\bbcbasic_console_win64\bbcbasic.exe" -quit jn_simple.bbc < %temp%\name.txt > %temp%\out1.txt 2> %temp%\out2.txt
... it turns out I was an idiot. I forgot to provide a path to "jn_simple.bbc" ... and apparently bbcbasic.exe doesn't default to looking in the folder it itself is running from.


This WORKED, with redirection:

C:\>"C:\Users\--myuser--\Downloads\bbcbasic_console_win64\bbcbasic.exe" -quit "C:\Users\--myuser--\Downloads\bbcbasic_console_win64\jn_simple.bbc" < %temp%\njim.txt > %temp%\out11.txt 2> %temp%\out12.txt

C:\>type %temp%\out11.txt
↨? Jim

Hello Jim


C:\>type %temp%\out12.txt

C:\>

I've also tried this is a terminal emulator. I used the topmost release described here: https://github.com/Maximus5/ConEmu/releases

and downloaded "ConEmuPack.221218.7z". I unpacked it and ran ConEmu64.exe which popped-up a panel asking me to make some choices. I left all of them at defaults. I've successfully run the 8queens program in that console, and also my own very simple one, with redirection. See screenshot.
You do not have the required permissions to view the files attached to this post.
Hated Moron

Re: Help understanding complaint

Post by Hated Moron »

JeremyNicoll wrote: Sun 19 Mar 2023, 19:13 apparently bbcbasic.exe doesn't default to looking in the folder it itself is running from.
I would expect it to look in the Current Directory (which isn't necessarily where bbcbasic was loaded from) by default. That's the standard behaviour of applications in Windows, and is the basis of the 'relative path' terminology (where .. represents the parent of the Current Directory, for example). Is that not what you are finding?

In order to reference, in a BBC BASIC program, the directory from which bbcbasic.exe itself was loaded, you could use @lib$ + "..", i.e. the parent of the lib directory.
User avatar
JeremyNicoll
Posts: 72
Joined: Sun 26 Jul 2020, 22:22
Location: Edinburgh

Re: Help understanding complaint

Post by JeremyNicoll »

Hated Moron wrote: Sun 19 Mar 2023, 23:37
JeremyNicoll wrote: Sun 19 Mar 2023, 19:13 apparently bbcbasic.exe doesn't default to looking in the folder it itself is running from.
I would expect it to look in the Current Directory (which isn't necessarily where bbcbasic was loaded from) by default. That's the standard behaviour of applications in Windows, and is the basis of the 'relative path' terminology (where .. represents the parent of the Current Directory, for example). Is that not what you are finding?

In order to reference, in a BBC BASIC program, the directory from which bbcbasic.exe itself was loaded, you could use @lib$ + "..", i.e. the parent of the lib directory.
I think I didn't get as far as having a BBC BASIC program execute.

Some applications I use have a long list of folders that they will search in for resource files etc, starting - it's true - with the 'current directory'', sometimes looking on PATH, sometimes looking in application-specific folders/paths defined by environment variables, and sometimes looking in the application .exe's own directory or ones with relative paths. It's rarely just one place.

But it was carelessness on my part, as I put together long command lines to issue. When I write scripts to issue commands I always give files full paths so there's no dependence on where commands are issued from (and usually verify that every such input path refers to a path/folder that actually exists with a leafname file that also actually exists in it (and for output files that the folder/file does or doesn't exist according to what the script's going to do with each one).

[I also rarely call eg just "curl.exe" (especially as later versions of Windows apparently have curl installed), but when I install my copies I usually rename them to specify their versions AND invoke them with full paths... I used to just place them all in a folder where I keep lots of CLI utilities - so eg I would have had curl-7-57-0.exe and several other curl-n-nn-n.exe variants - but unfortunately curl.exe stopped having certain DLLs (or their code) fully linked into the exe's and started using several accompanying DLLs loaded from the same folder ... and that doesn't allow different versions of those, so I changed to have a separate folder for each version, eg

C:\Dropbox\Programs--ALL-\~open-source curl V7-57-0

which contains one specific instance of curl.exe and its matching DLLs.

Likewise when I used to use the get_iplayer perl program, I had a set of modifications to that code so for every released version I had the 'original' and my modified 'stable' version and sometimes test ones as well ... and they all had different names so I could easily compare what they did.

As a Dropbox user, when I "install" stuff (portable no-install versions as much as possible) things go into "Programs--ALL-" folders if any of my machines could run them, or \Programs-<machinid>\ folders if not.]



Anyway... Here I was c&p stuff from one place to another ...

In this case the first programs I tried to run were a couple of your samples in the same folder as the just-downloaded most recent copy of the console application. My commands were like:

C:\>"C:\Users\--myuserid--\Downloads\bbcbasic_console_win64\bbcbasic.exe" "sortdemo.bbc"

and it was ages before I realised they should have been

C:\>"C:\Users\--myuserid--\Downloads\bbcbasic_console_win64\bbcbasic.exe" "C:\Users\--myuserid--\Downloads\bbcbasic_console_win64\sortdemo.bbc"

It wasn't apparent that bbcbasic.exe hadn't found the sortdemo.bbc program as I couldn't tell anything meaningful from the gibberish that was produced. And when I did try a fully-pathed program name later on, that also produced gibberish presumably because the program was found and loaded, but the terminal couldn't cope.


It was only when I saw in this experiment

C:\>echo Fred > %temp%\name.txt

C:\>type %temp%\name.txt
Fred

C:\>"C:\Users\--myuser--\Downloads\bbcbasic_console_win64\bbcbasic.exe" -quit jn_simple.bbc < %temp%\name.txt > %temp%\out1.txt 2> %temp%\out2.txt

C:\>
C:\>type %temp%\out1.txt
?BBC BASIC for Win64 Console v0.42
(C) Copyright R. T. Russell, 2023
>Fred

Mistake
>
>
C:\>

that the redirected input text "Fred" looked as if it was seen by the interpreter's command prompt rather than my .bbc program that I realised a possible/probable reason was that the interpreter hadn't loaded any program at all.


With hindsight it's easy to recognise what happened. Presumably bbcbasic.exe looked for "jn_simple.bbc" in the root of C:\, but I think I expected to see an error saying "program not found", or something. If that "Mistake" in my redirected output file is that error ... then it's a little terse, I feel... and I say that with my background in IBM OSes which took uppercase terseness to extremes.
Hated Moron

Re: Help understanding complaint

Post by Hated Moron »

JeremyNicoll wrote: Mon 20 Mar 2023, 02:34 If that "Mistake" in my redirected output file is that error ... then it's a little terse, I feel... and I say that with my background in IBM OSes which took uppercase terseness to extremes.
I've asked this question before, but not received an answer. Why do you frequent this forum when it is obvious that you are not a BBC BASIC enthusiast and, I would guess from some of your comments, rarely if ever write or run BBC BASIC programs? What's the attraction?
User avatar
JeremyNicoll
Posts: 72
Joined: Sun 26 Jul 2020, 22:22
Location: Edinburgh

Re: Help understanding complaint

Post by JeremyNicoll »

Hated Moron wrote: Mon 20 Mar 2023, 09:15 I've asked this question before, but not received an answer. Why do you frequent this forum when it is obvious that you are not a BBC BASIC enthusiast and, I would guess from some of your comments, rarely if ever write or run BBC BASIC programs? What's the attraction?
I was pretty sure I had addressed this, perhaps in some of our private emails, but maybe not.

I don't currently write any BBC BASIC, but quite a long time ago I did wite a small commercial package for BBC B micros - I was working for a teacher-training college, mainly on their small mainframe, but in this case was handed a bug-ridden package written by someone-else and asked to fix it; it got a total rewrite.

I also wrote code in Waterloo BASIC there (and tutored students on programming and helped them with their individual programming projects). I even wrote a translator(which ran as scripts within the mainframe text editor) that allowed the more competent students to think they were writing code in a friendlier flavour of BASIC (no line numbers, named functions/procedures, maybe other changes - can't remember now) which stored their code in the cruder BASIC but as they started to edit it translated it to the friendly version on the fly, and as they saved it reversed that. It made their work easier, except that runtime error messages reflected the actual code being run, not what they always saw in the editor - which is why only the better programmers got to use it.

Before that real job one of my summer jobs was working in a fertiliser works in Edinburgh, for the plant's chemical engineers. They had a new toy - a Commodore Pet - but no time to spend on making it do anything useful. I wrote code in its BASIC. I failed to make it do what they wanted it to, but did determine that Commodore had shipped disk drives with faulty firmware. Contact with Commodore was - in those primitive days - by telex - and it took weeks before they finally admitted that the drives wouldn't do the seeks required for random access into files held on them, despite their manuals showing sample code demonstrating how to do it.

I've also written code for myself in RO BASIC and for a while (until I found I couldn't sustain the effort because of illness) was maintainer of a RO application.

.

I think I did say quite a while ago that I was attracted to the idea of experimenting with BBC BASIC on a mobile phone, and I still am. But I've no idea when I'll find the time and/or energy to do it - maybe never. And my mobile, although Android, is so old that it's grossly insecure and can't run any modern apps. I don't actually use it as a /smart/phone, at all, except that its virtual keyboard (and sometimes a BT-connected external keyboard) makes sending SMSes easier than on my previous phone with tiny real buttons.

Not since the RO days have I written any GUI applications. I already have more on my programming wishlists than I can cope with in plain text file processing (in ooREXX) and some pretty complex editor scripts (thousands of lines of KEXX [nearly the same as 'classic' REXX] issuing editor commands to manipulate data that's - by then - already in multiple editor buffers so there's no extra I/O - and it's a lot more powerful than editors whose only flexibility is to save a temporary copy of a current file, shell out to some external utility to interrogate or change that file, then reload the buffer from the external file (though of course I can do that too if I want to).

I write in KEXX (in the editor) because that's the only language that its scripts can be written in, and in ooREXX outwith the editor (because I programmed for a living partly in IBM's REXX) and it's still a whole lot easier to program in a language that I'm fluent in (well, at least the 'classic' REXX support within ooREXX, not the OO part) than to use a language I'm less familiar with.

.

I've also told you before that I'm somewhere between bed- and house-bound, with nearly no face-to-face social contacts. I was already isolated before the pandemic lockdowns, which didn't in fact make much difference to me socially, but the health risks of contact with anything or anyone (eg the bloke who comes to service the boiler) certainly complicate life. I still, like many other unwell people, regard myself as "shielding" ...

So, social contact is mainly online. I lurk on many mail-lists because I like to find interesting discussions, for example on people's approaches to programming issues (and OS internals etc), not necessarily language-specific. The BBC BASIC discussions /are/ teaching me stuff about Windows API use and to some extent also the inner workings of GUI stuff, neither of which I've ever found decent textbooks on.
Hated Moron

Re: Help understanding complaint

Post by Hated Moron »

JeremyNicoll wrote: Mon 20 Mar 2023, 11:16 I was pretty sure I had addressed this, perhaps in some of our private emails, but maybe not.
I can't say one way or the other, my memory is extremely poor and even if you had told me in a private email I wouldn't remember. Heck, I don't even remember ever receiving a private email from you! :(

Thanks for the info anyway, I hope you will get an opportunity to use BBC BASIC more, then you will be less surprised by some of the things it does, and has done for the last (nearly) 42 years! :lol: