gnustep-dev
[Top][All Lists]
Advanced

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

Range from String / String from Range problem


From: Riccardo Mottola
Subject: Range from String / String from Range problem
Date: Thu, 12 Nov 2015 16:32:27 +0100
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33.1

Hi,

on FreeBSD/Clang I noticed that ProjectCenter is not scrolling to the classes / methods parsed. Strange, since I extra fixed the parser! Also, on my Linux computer it works.

The code, in PCEditor, is fairly simple:

  classNameRange = NSMakeRange(0, 0);
  enumerator = [parserClasses objectEnumerator];
  while ((class = [enumerator nextObject]))
    {
      if ([[class objectForKey:@"ClassName"] isEqualToString:className])
    {
NSLog(@"range string: %@",[class objectForKey:@"ClassNameRange"]);
      classNameRange =
        NSRangeFromString([class objectForKey:@"ClassNameRange"]);
      break;
    }
    }

  NSLog(@"classNameRange: %@", NSStringFromRange(classNameRange));

the range is re-created from they dictionary value which is a string. Perhaps it is not the most efficient way to put ranges in a Dictionary? In any case I suppose it should work. Here is the output of the two NSLogs:

2015-11-12 15:25:01.236 ProjectCenter[3684:100116] SCROLL to class: "@AppController" 2015-11-12 15:25:01.237 ProjectCenter[3684:100116] range string: {location=256, length=13} 2015-11-12 15:25:01.237 ProjectCenter[3684:100116] classNameRange: {location=34359738624, length=34359738381}

This means that the parser worked and that the value inside the dictionary is sane. However, once a String is re-extracted and re-printed, the value is havoc. A breakpoint in the debugger doesn't work, strangely... I will investigate futher with a test program.
Do we have a testcase for this in base I can eventually extend?

Riccardo



reply via email to

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