bug-gnustep
[Top][All Lists]
Advanced

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

Re: NSMenu menu position saving bug (PATCH)


From: Richard Frith-Macdonald
Subject: Re: NSMenu menu position saving bug (PATCH)
Date: Sat, 10 Jan 2004 09:52:28 +0000


On 10 Jan 2004, at 16:23, Michael Hanni wrote:

Hi,

On 2004-01-10 01:59:05 -0700 Richard Frith-Macdonald <richard@brainstorm.co.uk> wrote:

On 10 Jan 2004, at 15:13, Michael Hanni wrote:
so the key was always nil (interestingly enough, if I manually edited the key in the defaults to be \033Info it worked properly). I changed this to:
So it sounds like the escape character was not saved into the defaults ... either a problem with the escape in the string, or a problem with converting it back to the four character sequence ('\\', '0', '3', '3') it should be coded as in the defaults database.

If I change this to \\033 instead of \033 it works ok... Is it that when you give \033Info to NSString in a cstring it tries to come up with a character with value 033I?

When given a string literal '@"\033%@"' in the source code, the Objective-C compiler (gcc) produces an NSConstantString object pointing to a four byte sequence - escape, percent, at, nul

At runtime, the GSFormat() function should initialise an NSString from this to contain 5 unicode characters - escape, I, n, f, o

When storing the key into the defaults database, the PString() function should convert this to 8 ascii characters - backslash, 0, 3, 3, I, n, f, o

With the current code, minus my modification, my defaults are always this:

        NSMenuLocations = {
            "\000" = "136 379 77 233 0 0  960 768 ";
            "\000Edit" = "626 325 79 128 0 0  960 768 ";
        };

Notice the key is "\000" not "\033". So on the console I see "dit".

So something is going very wrong! If you could step through the code under gdb and examine what's going on, you could perhaps track this down.

More importantly, if something is going wrong with strings containing escape characters, you may have much more fundamental problems than just losing your menu location!

I'm guessing \033I is not a valid escape character?

\033 means the octal value 033, which is the decimal value 27, which is the ascii 'escape' control character.

Two places to look ... The string is initialised by code in base/Source/GSFormat.m The output conversion for the defaults database is in GSCompatibility.m (the PString() function)

I looked at this code, but it is way over my head.

It's hard to figure things out just by looking at the source ... I think stepping through the relevant parts in gdb and examining the data as it is modified is probably the way to go ... that's likely to help figure out why your system is behaving differently from other peoples.

Anyhow, using "+" or even "\\033" the defaults are saved correctly. With only "\033" it fails everytime on my machine.

This is on a powerpc machine, debian linux, gcc 3.3.3-0pre1, and libc6 2.3.2.ds1-10.

Any ideas?

Just one ... I think powerpc systems use a different byte order from intel systems ... maybe there is some problem with accessing the wrong byte of the 16-bit unicode characters.
I'll look and see if I can spot anything in the source.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]