Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Source Help

compiling error

A community discussion post from the original code:zIRON forum.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

compiling error

hi

when compiling the next code i got that error

[9,3]: Expected : but found { in [test.zir]

code:

{

program WIN32CUI 'test';

#include 'console.zir';

char buf = loadfs('.\\fpu_opcodes.txt')
char LineIn[1024];

function* GetNextLine(char* strbuf)
{
   Esi = @strbuf;
   Edi = @LineIn;
   while( char[Esi] != 0)
    {
       if(char[Esi] == 13) 
        {
          char[Edi] = 0; 
          break;
        }
       al = char[Esi]; 
       char[Edi] = al;  
       Esi++;
       Edi++;
   }
   return @LineIn; 
}


WriteLn(GetNextLine(@buf));

wait_key(nil);

ExitProcess(0);

any help please.

http://www.freewebs.com/ogremagic/index.htm

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

first mistake i see is

function* GetNextLine(char* strbuf)

the * is used to create a function prototype with pointer. Removing that from what i see else look ok

function GetNextLine(char* strbuf)
Colin admin
Posts
928
Threads
49
Location
Bulgaria

sorry 1 other thing i missed last night

char buf = loadfs('.\\fpu_opcodes.txt')

this should be a const

const buf = loadfs('.\\fpu_opcodes.txt');
Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , here is my updating code . but it refuses to compile.

program WIN32CUI 'test';

#include 'console.zir';

const  buf = loadfs('fpu_opcodes.txt');
char LineIn[1024];

function GetNextLine(char* strbuf)
{ 
   Eax = 0;
   Esi = strbuf;
   Edi = @LineIn;
   while( char[Esi] != 0)
    {
       if(char[Esi] == 13) 
        {
          char[Edi] = 0; 
          Eax++; 
          break;
        }
       bl = char[Esi]; 
       char[Edi] = bl; 
       Eax++; 
       Esi++;
       Edi++;
   }
   //return i; 
}

int32 k = GetNextLine(@buf);

repeat {
  WriteLn(@LineIn);
  Eax = @buf;
  add Eax , k   // ------------ this line give error
  k = GetNextLine(Eax);
} while (k > 0);

wait_key(nil);

ExitProcess(0);

also i tried the next code but it gave error

Eax = @buf + k;

http://www.freewebs.com/ogremagic/index.htm

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

this also does not compiled

print(GetNextLine(@buf), '\r\n');

http://www.freewebs.com/ogremagic/index.htm

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

this also gave error in return statement

function GetNextLine1(char* strbuf)
{
   Esi = strbuf;
   Edi = @LineIn;
   while( char[Esi] != 0)
    {
       if(char[Esi] == 13) 
        {
          char[Edi] = 0; 
          break;
        }
       al = char[Esi]; 
       char[Edi] = al;  
       Esi++;
       Edi++;
   }
   return @LineIn; 
}

http://www.freewebs.com/ogremagic/index.htm

Colin admin
Posts
928
Threads
49
Location
Bulgaria

ok first there seems to be a bug with moving @vars to eax so return @... is bug i will fix.

because maths functions are all on my extend and upgrade list, some do not work as planned, for now i would have to say to a mov, add mov

  ecx = k; //add Eax , k
  add eax, ecx
  k = eax;

once i fix these opcodes, it could then be changed, there was also a bug with repeat while and repeat until which i have just fixed.

try if it reports an error.

} while k > 0);

and finally, your functions that change esi, edi etc need uses clause.

function GetNextLine(char* strbuf)
{ 
   uses edi esi;

i will try to get an update out as soon as possible with more fixes.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

yes , it gave error.

http://www.freewebs.com/ogremagic/index.htm