slang-users mailing list

[2001 Date Index] [2001 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Possible bug...


Richard van Zon <rvanzon@xxxxxxxxxxxx> wrote:
>The error I get is :
>S-Lang Error: Internal Error: Byte-Code 0x70 is not valid
>S-Lang Error: Internal Error: Error while executing onKeyDown

The reason I think that memory is being trashed is that if you compile
a simple program embedding slang, and have it load the following file as
input, then I am sure that you will not see the error.

   variable yvel=-1,xvel=1, x=0, y=0;   % or some other values
   define onKeyDown(key)
   {
     if (key==276) { yvel=-1.0;y--; }    % this one works fine
     if (key==275) { yvel=-1.0;y--; }    % yvel=-1.0 is not valid here ?!
     if (key==273) { xvel=1.0;x--; }     % this one works fine
     if (key==274) { xvel=-1.0;x++; }    % this one works fine
   }
   onKeyDown(275);


Here is a simple C program that could be used for testing this:

#include <stdio.h>
#include <stdlib.h>
#include <slang.h>
int main (int argc, char **argv)
{
  if (-1 == SLang_init_all ())
    return EXIT_FAILURE:
    
  if (argc > 1)
    SLang_load_file (argv[1]);
    
  if (SLang_Error)
    return EXIT_FAILURE;

  return EXIT_SUCESS;
}

--John


[2001 date index] [2001 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]