help-smalltalk
[Top][All Lists]
Advanced

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

[Help-smalltalk] smalltalk-2.0.5: gst core dump


From: Bruno Haible
Subject: [Help-smalltalk] smalltalk-2.0.5: gst core dump
Date: Mon, 2 Sep 2002 13:50:15 +0200 (CEST)

Hi,

After seeing that the Character class is basically a "byte" class only,
I tried to enter a multibyte character with $ syntax. With moderate success:

In a de_DE.UTF-8 locale, enter

  gst -Q
  st> $รค printNl !
stdin:1: Segmentation violation
stdin:1: Error occurred while not in byte code interpreter!!
Speicherzugriffsfehler

Here is the backtrace:
#0  0x7020676e in ?? ()
#1  0x08053fb0 in _gst_yyparse () at /usr/share/bison.simple:432
#2  0x0805540d in _gst_parse_stream () at lex.c:1063
#3  0x08051fa4 in gst_top_level_loop () at lib.c:607
#4  0x08051b03 in main (argc=2, argv=0xbffff464) at main.c:51

The bug is that my_getc is returning negative numbers. As always, converting
a 'char' to 'int' must be done via 'unsigned char', otherwise you cannot
distinguish the character 255 and EOF.

Bruno


2002-09-01  Bruno Haible  <address@hidden>

        * libgst/input.c (my_getc): Return 8-bit characters as values in the
        range 128..255, not -128..-1.

*** smalltalk-2.0.5/libgst/input.c.bak  2002-07-14 13:45:51.000000000 +0200
--- smalltalk-2.0.5/libgst/input.c      2002-09-01 12:53:30.000000000 +0200
***************
*** 341,347 ****
    switch (stream->type)
      {
      case STREAM_STRING:
!       ic = *stream->st_str.str++;
        return ((ic == '\0') ? EOF : ic);
  
      case STREAM_OOP:
--- 341,347 ----
    switch (stream->type)
      {
      case STREAM_STRING:
!       ic = (unsigned char) *stream->st_str.str++;
        return ((ic == '\0') ? EOF : ic);
  
      case STREAM_OOP:
***************
*** 363,369 ****
        }
  
        return (stream->st_oop.ptr == stream->st_oop.end)
!       ? EOF : *stream->st_oop.ptr++;
  
      case STREAM_FILE:
        /* Refill the buffer... */
--- 363,369 ----
        }
  
        return (stream->st_oop.ptr == stream->st_oop.end)
!       ? EOF : (unsigned char) *stream->st_oop.ptr++;
  
      case STREAM_FILE:
        /* Refill the buffer... */
***************
*** 384,390 ****
        }
  
        return (stream->st_file.ptr == stream->st_file.end)
!       ? EOF : *stream->st_file.ptr++;
  
  #ifdef HAVE_READLINE
      case STREAM_READLINE:
--- 384,390 ----
        }
  
        return (stream->st_file.ptr == stream->st_file.end)
!       ? EOF : (unsigned char) *stream->st_file.ptr++;
  
  #ifdef HAVE_READLINE
      case STREAM_READLINE:
***************
*** 394,400 ****
  
        if (stream->st_str.strBase)
          {
!           ic = *stream->st_str.str++;
            if (ic)
              return (ic);
  
--- 394,400 ----
  
        if (stream->st_str.strBase)
          {
!           ic = (unsigned char) *stream->st_str.str++;
            if (ic)
              return (ic);
  
***************
*** 432,438 ****
            r_line[r_len] = '\n';
            r_line[r_len + 1] = '\0';
            stream->st_str.str = stream->st_str.strBase = r_line;
!           ic = *stream->st_str.str++;
          }
  
        break;
--- 432,438 ----
            r_line[r_len] = '\n';
            r_line[r_len + 1] = '\0';
            stream->st_str.str = stream->st_str.strBase = r_line;
!           ic = (unsigned char) *stream->st_str.str++;
          }
  
        break;




reply via email to

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