Re: [Ql-Users] SMSQE instr_case QLIB
On 08/04/2022 14:56, Tobias Fröschle via Ql-Users wrote: The main reason, I believe, is that INSTR_CASE is a global setting and so shouldnt be set by a program, but only by the user in the main console That's actually not the problem: INSTR_CASE seems to work "local" to each instance of the SBASIC interpreter (I just checked). Youre right, of course. I dont know where I got that idea. I thought Id read it somewhere long ago. The stupid thing is that I did some half-hearted tests myself before I posted but my results were inconclusive, so I ignored them. Also there is a lack of detail in the documentation (eg the online Reference Manual) It seems to me that this is important information, especially since (perhaps) at some time this may have been documented as a global setting. Turbo happily compiles programs that contain INSTR_CASE statements, but does seem to be using its own INSTR implementation (that will, obviously, not switch according to INSTR_CASE). So, compiled programs simply don't react on the INSTR_CASE settings. QLiberator does exactly the same. Yes, it doesnt work in Turbo nor in Qlib, as I stated. In up to date versions of Qlib you also get a warning message. It is possible that it might not be too hard to fix, if anyone wants to have a go. But any compiled program using it would still only work under SMSQ/E. INSTR is part of the S*BASIC language and couldnt be altered in Qdos without creating a new ROM. A workaround might be to add internal INSTR code to Qlib and Turbo, that is aware of the INSTR_CASE setting, but that seems to me to be a lot of code and trouble for a rare and minor issue. Just use INSTR% instead! Per ___ QL-Users Mailing List
Re: [Ql-Users] SMSQE instr_case QLIB
> > The main reason, I believe, is that INSTR_CASE is a global setting and so > shouldnt be set by a program, but only by the user in the main console That's actually not the problem: INSTR_CASE seems to work "local" to each instance of the SBASIC interpreter (I just checked). Turbo happily compiles programs that contain INSTR_CASE statements, but does seem to be using its own INSTR implementation (that will, obviously, not switch according to INSTR_CASE). So, compiled programs simply don't react on the INSTR_CASE settings. QLiberator does exactly the same. ___ QL-Users Mailing List
Re: [Ql-Users] SMSQE instr_case QLIB
On 08/04/2022 09:07, desin via Ql-Users wrote: Hi all how can we use instr_case in a Qliberated program ? At present you cant. If you use the latest Qlib (V3.45) youll even get a warning message. It wont work in Turbo either. There was a discussion about this on QL forum (see https://www.qlforum.co.uk/viewtopic.php?f=3&t=3166&hilit=instr_case&start=30) The main reason, I believe, is that INSTR_CASE is a global setting and so shouldnt be set by a program, but only by the user in the main console. You could use a toolkit command instead, such as Knoware's INSTR%() function in the Str3TK toolkit, which allows for both a case dependent and case-agnostic INSTR. See www.Knoware.no/htm/toolkits.htm#strings. 100 CLEAR 110 a%= FOPEN ("con") 120 OUTL 130 OUTL #a%,500,200,0,30 140 WINDOW#a%,500,200,0,30 150 CLS#a% 160 : 170 a$ = "hello" : b$ = "Hello": c$ = "hELLO" 180 : 190 PRINT#a% 200 PRINT#a%,,"instr_case truth table " 210 PRINT#a% 220 : 230 INSTR_CASE 1 240 PRINT#a%,,"instr_case 1" 250 PRINT#a% 260 PRINT#a%,, a$,a$,a$ INSTR a$ 270 PRINT#a%,, b$,b$,b$ INSTR b$ 280 PRINT#a%,, a$,b$,a$ INSTR b$ 290 PRINT#a%,, b$,a$,b$ INSTR a$ 300 PRINT#a%,, b$,c$,b$ INSTR c$ 310 PRINT#a%,, c$,a$,c$ INSTR a$ 320 PAUSE#a% 330 CLS#a% 340 CLOSE#a% Greetings from Switzerland Markus Per ___ QL-Users Mailing List
[Ql-Users] SMSQE instr_case QLIB
Hi all how can we use instr_case in a Qliberated program ? 100 CLEAR 110 a%= FOPEN ("con") 120 OUTL 130 OUTL #a%,500,200,0,30 140 WINDOW#a%,500,200,0,30 150 CLS#a% 160 : 170 a$ = "hello" : b$ = "Hello": c$ = "hELLO" 180 : 190 PRINT#a% 200 PRINT#a%,,"instr_case truth table " 210 PRINT#a% 220 : 230 INSTR_CASE 1 240 PRINT#a%,,"instr_case 1" 250 PRINT#a% 260 PRINT#a%,, a$,a$,a$ INSTR a$ 270 PRINT#a%,, b$,b$,b$ INSTR b$ 280 PRINT#a%,, a$,b$,a$ INSTR b$ 290 PRINT#a%,, b$,a$,b$ INSTR a$ 300 PRINT#a%,, b$,c$,b$ INSTR c$ 310 PRINT#a%,, c$,a$,c$ INSTR a$ 320 PAUSE#a% 330 CLS#a% 340 CLOSE#a% Greetings from Switzerland Markus ___ QL-Users Mailing List