Forum / Source Help
compiling error
A community discussion post from the original code:zIRON forum.
Replies
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 :)
ok works fine , but i prefer the global version.
http://www.freewebs.com/ogremagic/index.htm
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
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);
}
:)
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