Very useful Richard.
Will you include this new library in future BBCSDL and BB4W releases?
Proposal for a 'listlib' library
- hellomike
- Posts: 194
- Joined: Sat 09 Jun 2018, 09:47
- Location: Amsterdam
-
- Posts: 457
- Joined: Tue 18 Jun 2024, 09:32
Re: Proposal for a 'listlib' library
Currently the listlib library is BBCSDL only (it's not compatible with BB4W because of calling SDL2 memory-management functions). In principle a BB4W version could be produced, but that's not something I've given any serious thought to.
In any case, new releases of BB4W are so infrequent - it's entirely possible that there won't be any more - that should a BB4W version of the library be developed it would probably best be made available another way (e.g. by direct download).
There's also the complication of the Console Mode editions of BBC BASIC (BBCTTY) because they would need yet another version of the library, for the same reason (memory management functions).
One approach would be to develop a 'universal' library which detects which version of BBC BASIC it is running on and uses the appropriate functions for that platform. But that could add a run-time overhead because of the version-testing code, and hit performance.
Another approach would be to adopt the technique I used in the classlib library, which is not to call OS memory-management functions at all but to leverage BBC BASIC's built-in string-management functions. But that would limit the size of list to what fits in BBC BASIC's heap.
I'm open to suggestions. Perhaps the most practical approach is to be led by demand: if nobody expresses any interest in using the library - and they haven't so far - it's all moot!

-
- Posts: 457
- Joined: Tue 18 Jun 2024, 09:32
Re: Proposal for a 'listlib' library
Yet another approach would be to adopt the technique I used in gpiolib.bbc which is to point a function at a different function, so that thereafter that alternative function is called instead. Here's how it's used in gpiolib:Richard Russell wrote: ↑Sun 27 Jul 2025, 14:57 Another approach would be to adopt the technique I used in the classlib library, which is not to call OS memory-management functions at all but to leverage BBC BASIC's built-in string-management functions. But that would limit the size of list to what fits in BBC BASIC's heap.
Code: Select all
PTR(PROC_gpio_inp()) = PTR(PROC_gpio_inp_5())
-
- Posts: 457
- Joined: Tue 18 Jun 2024, 09:32
Re: Proposal for a 'listlib' library
This is what that looks like in practice, when applied to listlib:Richard Russell wrote: ↑Sun 27 Jul 2025, 20:12 Yet another approach would be to adopt the technique I used in gpiolib.bbc which is to point a function at a different function, so that thereafter that alternative function is called instead.
Code: Select all
1890 DEF PROC_listredim(RETURN l%%,D%)
1900 CASE TRUE OF
1910 WHEN INKEY(-256)=&57: PTR(PROC_listredim()) = PTR(PROC_listredim_win())
1920 WHEN (@platform%>>8)=0: PTR(PROC_listredim()) = PTR(PROC_listredim_tty())
1930 OTHERWISE: PTR(PROC_listredim()) = PTR(PROC_listredim_sdl())
1940 ENDCASE
1950 PROC_listredim(l%%,D%)
1960 ENDPROC
- hellomike
- Posts: 194
- Joined: Sat 09 Jun 2018, 09:47
- Location: Amsterdam
Re: Proposal for a 'listlib' library
I fully understand your reasoning about BB4W and therefor I'm fine with a direct download.
Also, I wouldn't mind in having a go converting the BBCSDL one myself into using Windows memory-management functions.
Also, I wouldn't mind in having a go converting the BBCSDL one myself into using Windows memory-management functions.