[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: yabasic problem



Hi,

Richard Owlett wrote:
> With a good filename, nothing printed.
> With a bad filename, it reports file not found.

But it does not abort at that point, does it ?

When the file name is bad, is the resulting filenumber 0 ?
If not: Can you read or write to that filenumber ?

I cling so massively to the theory of a sticky error indicator because
that is exactly what the indicator variable "errno" does in C and what
is described in man 3 errno.


Read The Source Luke:

peek$("error") is probably implemented in
  https://sources.debian.org/src/yabasic/1:2.79.2-1/function.c/#L1582
which hands out a copy of variable "errorstring".

A search for "errorstring" by
  https://codesearch.debian.net/search?q=package%3Ayabasic+errorstring
yields only one match where this variable's content is reset. That's
when it gets created at yabasic startup:
  https://sources.debian.org/src/yabasic/1:2.79.2-1/main.c/?hl=116#L117

All other occasions fill it with new error texts or put it out.
So it does not get cleared when command "open" succeeds.

See its implementation in
  https://sources.debian.org/src/yabasic/1:2.79.2-1/io.c/?hl=683#L683
The message
  "No such file or directory"
probably stems from the C function strerror(3) via my_strerror()
  https://sources.debian.org/src/yabasic/1:2.79.2-1/io.c/?hl=683#L804
  https://sources.debian.org/src/yabasic/1:2.79.2-1/main.c/?hl=2402#L2406

To fix this stickiness of error indicators, i would insert at the start of
myopen() around
  https://sources.debian.org/src/yabasic/1:2.79.2-1/io.c/?hl=683#L701
the statement

  errorstring[0] = 0;
  errorcode = 0;

... or somewhere more upwards, in the big interpreter loop ...


Hey, that's something HP BASIC never allowed us. Peeking into its code
and making perky proposals.

-------------------------------------------------------------------------

> This project started out in Tcl, which I visualize as a super-BASIC.

How that ?
Tcl is a strange script language with the only adavantage that together
with its sibling Tk it is the GUI toolkit with the least dependencies.
But as procedural language it is really substandard.
It was an exercise in stubbornness to finish
  https://dev.lovelyhq.com/libburnia/libisoburn/raw/master/frontend/xorriso-tcltk
and i had to build a text parser into xorriso's C code because doing
proper unquoting in Tcl was flatly impossible to me.


> Due to inexperience I got lost in how Tcl handled my JSON data.

You perhaps used some of these ?
  https://wiki.tcl-lang.org/13419
Their number raises suspicion. Why so many of them ?


> Now that I have yabasic reading/writing files I've solved my program logic
> problems.

So you want a decent procedural language. That's a healthy wish.
But Tcl is really not such a language.


Have a nice day :)

Thomas


Reply to: