Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Requests and Feedback

data section.

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

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

searching for . is not enough, since

#include 'console.zir';

contains a "."... you could use strOffset to do this...

esi = strCode;

esi = strOffset(esi, '.DATA');
while (char[esi] <> 0) {
    char[esi] = '_';

    esi = strOffset(esi, '.DATA');
}

this is untested but should work.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

no it search for '.' in the first position of trimed line.

so the code get the next line from buffer , then it removes unwanted char by H_Trim , then it check the first char of the line if it is '.' then it replace it with '_'

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

yes, i see i did not read correctly, however the way i posted would be much more efficient, and would not be strict on being the first in line....

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , but what about the main problem?

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

well, the main file's handle may not always be 0.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

so , how to know it's size , or detect the end of it?

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

look at this function

function FileEntry(DWord handle; char* strCode)
{   
   //preprocess the main file
   if (handle == 0)
    {       
      esi = strCode;
      esi = strOffset(esi, '.DATA');
      while (char[esi] != 0)
       {
           char[esi] = "_";
           esi = strOffset(esi, '.DATA');
       }
      Ziron_ShowMessage(strCode);   
       //set the buffer
      DWord Len;
      Len = H_strlen(strCode);
      Ziron_SetFileBuffer(handle, strCode, Len);  
    }
}

it must show the modified source code befor setfilebuffer function , but it does not

it give this error

Unknown Identifier "." in [testprg.zir] Code: .DATA var DB 64 //;

and that mean that the problem is not only the end of main file.

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria
   //preprocess the main file
   if (handle == 0)

as i said before, the main file handle might not be 0

and you wont need Ziron_SetFileBuffer since you directly update the buffer