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.

Replies

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

windows 7

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

ohhhh my mistake

push edi
ecx = @buf;
edi = GetNextLine(ecx); //my mistake :P

while(edi > 0) {
	WriteLn(@LineIn);
 
	add ecx, edi  
	edi = GetNextLine(ecx);
} 

int32 k = edi;
pop edi

that will work :)

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok works fine , but i prefer the global version.

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

pk , here is the final version of GetNextLine function.

program WIN32CUI 'test';

#include 'console.zir';
#include 'ch.zir';

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

/*************************************************************************/
// return value is the length of line
// strbuf is the source buffer
// dest is the buffer that hold the line extracted from source buffer  
function GetNextLine(char* strbuf; pointer dest)
{ 
  global int32 incr;

  uses esi edi;
  eax = xor;
  
  ecx = incr;
  esi = strbuf;  
  add esi, ecx
  edi = dest;
  
  while(char[esi] != 0)
   {
      if (word[esi] == "\r\n")
       {
         eax += 2; 
         break;
       }
      bl = char[Esi]; 
      char[edi] = bl; 
      eax++; 
      esi++;
      edi++;
   }
  char[edi] = 0; 
  
  add ecx, eax
  incr = ecx;
}
/*************************************************************************/

push edi
edi = GetNextLine(@buf,@LineIn);
while(edi > 0) 
 {
    print('length of line = ', edi:int, '\r\n');
    WriteLn(@LineIn);
    edi = GetNextLine(@buf,@LineIn);
 } 

pop edi

wait_key(nil);

ExitProcess(0);

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

since the value from getnextline is just checking whether to continue or not, you can use eax

eax = GetNextLine(@buf,@LineIn);
while(eax) {
    print('length of line = ', eax:int, '\r\n');
    WriteLn(@LineIn);
    eax = GetNextLine(@buf, @LineIn);
} 

:)

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

actually , in the plugin we get a line from Source Buffer then we will start parsing it.

so may we use the line length returned from GetNextLine function in our coming parsing.

i think the next function we can use is the Trim Function, i will try to implement it.

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