Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / General Discussion

end of line problem

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

end of line problem

sometimes the end of line is some space chars , so when test the end of line by Ziron_IsNextLineBreak it return false and that means we did not goto the end yet ,

so i use Ziron_GetNextToken to get the rest of line , but instead we get the token in the next line.

so can Ziron_IsNextLineBreak considers the tab , white space, that at the end of line as endline

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

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

it should already take tabs and spaces into consideration, can you make a small plugin that re-produces the problem?

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , when i extend my define plugin like this

function event_Define() 
{
    uses edi esi ecx ebx;
    char  buf[2048];
    char  idnt[255];
    char  val[255];
            
    eax = Ziron_ExpectNextToken(zirIdent); 
    if (eax == -1) {
        Ziron_FatalError('Expected identfire Name');
        return true;
    }
    H_strcpy(@idnt, Ziron_GetStringValue());
    
    eax = Ziron_GetNextToken();
    if( eax == zirHexadecimal)
     {  
        H_strcpy(@val, '0x');
        H_strcat(@val, Ziron_GetStringValue());
     }
    else
     {
       H_strcpy(@val, Ziron_GetStringValue());
       
       // here is my extension    
         eax = Ziron_IsNextLineBreak();
         while(!eax)
          {
                  Ziron_GetNextToken(); 
                  H_strcat(@val, Ziron_GetStringValue()); 
                  eax = Ziron_IsNextLineBreak();    
          }
     }    
    
    buf=0;    
    H_strjoin(@buf ,'const ', @idnt, ' = ', @val , ';');
    
    Ziron_Exec(@buf); 
    
    return true; 
}

and here is line makes the problem

#define DIK_BACKSPACE       DIK_BACK            /* backspace */
                                    ^^^^^^^^^^^^
                                        /\
                                     those whtespace are the problem    

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

OK i've uploaded new beta, i believe the problem is not the spaces, it was the block comment, it checked for only single line comments(//)

I have corrected this and it should work :) let me know.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

got strange error when compiling my plugin , her it is

[414,25]: Expected float number or segment or segment:offset or procedure/function call or [expression] or ) or number or hexadecimal or register or procedure address or data address or opcode or register pointer or constant string or constant or local variable or local parameter or local variable address or variable but found dw2str in [strings.zir] Code: eax = strLen(dw2str([ebx], @tmpBuf));

BTW, my plugin did not have dw2str function.

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

ok try opening includes/strings.zir and below the first include add

#include 'zirutils.zir';

it should look like:

//******************************************************//
//                                                      //
//    Ziron Run Time Library                            //
//    String Utilities (strings.zir)                    //
//                                                      //
//    Copyright (c) 2011-####, OverHertz OOD            //
//    Source Code (c) All rights Reserved.              //
//                                                      //
//******************************************************//

#include 'smm32.zir';
#include 'zirutils.zir';

//
// Macros First
//

...
Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

after changing got that error

[520,50]: Expected float number or segment or segment:offset or procedure/function call or [expression] or ) or number or hexadecimal or register or procedure address or data address or opcode or register pointer or constant string or constant or local variable or local parameter or local variable address or variable but found idMOVE_NEXT_CHAR in [zirplug/framework.zir] Code: Ziron_MoveNextChar = Ziron_Get(idMOVE_NEXT_CHAR);

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

brrrr lol ok open up includes/zirplug/framework.zir

search for "id_MOVE_NEXT_CHAR" i added a _ probably before saving and updating beta rar by accident.

just remove the _

	idMOVE_NEXT_CHAR = 5009,