Page 1 of 1

delete char C of word W of ...

Posted: Wed Nov 08, 2023 5:25 am
by udi

Code: Select all

put "abc def" into tStr
delete char 1 of word 2 of tStr
It crashed on Linux32 but OK on Linux64.
also
delete char C of line L of ...

solution:

Code: Select all

get word 2 of tStr
delete char 1 of it
put it into word 2 of tStr
Is it bug or my fault?

Re: delete char C of word W of ...

Posted: Wed Nov 08, 2023 10:06 am
by Klaus
Hi udi,

welcome to the forum!

Code: Select all

put "abc def" into tStr
delete char 1 of word 2 of tStr
works here (LC 9.6.10 on a Mac Mini) without problems. If this is reproducable, it might be a bug.

Best

Klaus

P.S.
A little "Hello" or something would not have hurt for the very first posting.

Re: delete char C of word W of ...

Posted: Wed Nov 08, 2023 10:24 am
by richmond62
I suspect the problem might lie in that awkward thing: 'it'.

Code: Select all

put "abc def" into tStr
   delete char 1 of word 2 of tStr
   put tStr
this works perfectly on MacOS.

It also works perfectly on 'Linux 32' [Debian 12, XFCE, LC 9.6.3, Dad's old 20 year old 32-bit Toshiba laptop].

I have put Linux in quotation marks because, unlike Windows or Macintosh, Linux is NOT a single, monolithic system; a GNU-Linux system is a collection of bits-n-bobs assembled on top of a central Linux 'engine'.

So: Please do NOT write 'Linux', but be quite a bit more specific.

My own experience with LC on 'Linux' has been confined to Xubuntu, Kali Linux, Debian XFCE, MX Linux, Ubuntu LXDE where (with the odd exception of being unable to focus on the messageBox) LC has worked.

With several other Linux distros, having installed them and seen that LC did not 'play ball' on them, I have wondered why I wasted my time installing them when I knew, already, of 5 distros that LC did work with.
-
lesson.jpg
lesson.jpg (13.88 KiB) Viewed 3429 times

Re: delete char C of word W of ...

Posted: Wed Nov 08, 2023 1:53 pm
by udi
Hellow everyone :)

Hi Klaus

Thanks for your advice. I'm so shy..


Hi richmond62

Thanks for your testing.

My test system are :
Mageia 9 MATE 32bit / Celeron M / LC905 & LC963 = Crashed
debian 11 MATE 32bit / Celeron M / LC905 & LC963 = Crashed

PCLinuxOS MATE 64bit / Core i5 / LC905 & LC951 = OK
debian 11 MATE 64bit / Core i5 / LC905 & LC951 = OK
EndeavourOS MATE 64bit / Core i5 / LC905 & LC951 = OK

PCLinuxOS MATE 64bit / Core2Duo / LC905 = OK
debian 11 MATE 32bit / Core2Duo / LC905 = Crashed!
debian 11 XFCE 32bit / Core2Duo / LC905 = Crashed!


Ummm.. It seems because of 32bit engine.

BTY For some reason '9 dot 6 dot 3' won't accept here. I wrote '963' instead.


Thanks for all and sorry to my poor English.
udi

Re: delete char C of word W of ...

Posted: Wed Nov 08, 2023 2:04 pm
by richmond62
My Dad's old Toshiba laptop is 32-bit and runs LC 9.6.3 32-bit on Debian 12 XFCE perfectly.

So, no, I don't think it has anything to do with either your 32-bit computer, or a 32-bit version of LiveCode: perhaps it is best to look in the middle: and by that I mean the Desktop environment that sits on top of whichever Linux distro you are using.

Re: delete char C of word W of ...

Posted: Wed Nov 08, 2023 2:29 pm
by richmond62
I just had a look at your "shopping list" and the one thing I noticed that made me ask questions was about LC 905 and XFCE: so I am installing LC 905 [the 'You Only' setting] onto Debian 12 XFCE 32-bit to see if that crashes.

No, worked perfectly.

So, my first question is did you install using the 'You Only' setting? The other 2 alternatives have caused problems all over the place.

Re: delete char C of word W of ...

Posted: Wed Nov 08, 2023 3:33 pm
by udi
Thanks richmond62

All the time, I've installed LC with setting [ All Users ].

I'm going to try LC963 with [ You Only ] and test it.


Thanks for all and sorry to my poor English.
udi

Re: delete char C of word W of ...

Posted: Wed Nov 08, 2023 3:37 pm
by richmond62
I am an EFL teacher, so I have spent about 35 years learning how to understand poor English: otherwise I would have to help people improve their English. 8)

More importantly: let's get your system sorted out so there are not these crashes.

Re: delete char C of word W of ...

Posted: Thu Nov 09, 2023 1:59 pm
by udi
WOW

debian 12 MATE 32bit / Celeron M / LC963 [ You Only ] = OK !

I will change some conditions and continue testing.

Thanks for all and sorry to my poor English.
udi

Re: delete char C of word W of ...

Posted: Fri Nov 10, 2023 2:58 am
by udi
Sorry, I was confused, apparently.
The script that causes the problem is as follows

Code: Select all

put "abc def" into tStr
delete BYTE 1 of word 2 of tStr
When I test this, both [All Users] and [You Only] get a crash with some LC16bit engines.

I wonder if "byte" and "word" should not be mixed ?

Thanks for all and sorry to my poor English.
udi

Re: delete char C of word W of ...

Posted: Fri Nov 10, 2023 4:35 am
by stam
udi wrote:
Fri Nov 10, 2023 2:58 am
I wonder if "byte" and "word" should not be mixed ?
Yeah don’t think you should be mixing chunk keywords (like “word”) with binary keywords (like “byte”).
Not sure why you’d want to?

Code: Select all

Delete char 1 of word 2 of tStr
should suffice. Doesn’t that work for you?

Re: delete char C of word W of ...

Posted: Fri Nov 10, 2023 6:58 am
by udi
Hi stam

Yes, char C of word W of.. works correctly. But,

'char' can be multi-byte, so if you want to be sure to specify a single byte, you have to use 'byte' instead of 'char'

I understood it that way, but was wrong?

Curiously, this seems to work correctly except for LC for Linux32.

Thanks for all and sorry to my poor English.
udi

Re: delete char C of word W of ...

Posted: Fri Nov 10, 2023 10:14 am
by LCMark
@udi: This is a bug in older versions which was fixed in 9.6.9 - https://quality.livecode.com/show_bug.cgi?id=24040.

The difference between 'byte' and 'char' is that 'byte' is for binary data, and 'char' is for text - and you shouldn't really mix the two without encoding the text in some encoding first (the engine does have a default conversion from text->binary, it converts the text to the 'native' encoding which is always one byte per char, any characters which cannot be represented are replaced by '?') - and the number of bytes a character will map to depends on both the character and the encoding you choose.

If you are just wanting to delete the first character of a word - then use char 1 of - deleting the first byte of a string chunk doesn't really make much sense.

Re: delete char C of word W of ...

Posted: Fri Nov 10, 2023 12:13 pm
by udi
Hi LCMark

Thanks. I now understand the difference between 'byte' and 'char'. So far I have 'automatically' rewritten 'char' to 'byte'. But I have to take into account how LC is going to handle that data.

Thanks for all and sorry to my poor English.
udi