Register | Login
Forum Index > General Discussion > ptr token
Author Message
Pages: 1 2 3
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1014] ptr token - posted: 2012-05-05 20:43:50

hi ,

is the term 'ptr' a keyword ?

and if so what is the enumeration value of it?


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1015] - posted: 2012-05-05 21:21:02
ptr is actually an internal macro so it does not have an enumeration value, what are you trying to do? maybe I can give some ideas smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1016] - posted: 2012-05-05 21:38:34

ok , i was playing with my old basic plugin and fount that in my to-do section

Code:
// to-do-list
//dim kk% = -20
//DIM  Ea[10,10] as int32
//Dim h As Byte ptr
//Dim s1 As String * 10


so i was trying to implement this

Code:
Dim h As Byte ptr


Ziron refused to accept 'ptr' as zirIdent token.

any help ,please ?


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1017] - posted: 2012-05-05 22:48:03
OK, i have an idea for a solution for the next release, for now you could do a pass on source to replace the type ptr

ie, if a data type is hit, you can do a manual check of the source line and if ptr follows the datatype you can internally replace "type ptr" with type*.

Code:
dim a as byte ptr
dim b as dword ptr


in this example, if a type such as byte is found in your dim handler, you can extract the line and check for "type ptr"

replace the " ptr" with "* "

as the following:

Code:
dim a as byte*
dim b as dword*


and of course into:

Code:
byte* a;
dword* b;


hope this helps smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1018] - posted: 2012-05-05 23:15:55

ok , thanks.

but how can i do a manual check of the source line ?

here is a part of my code
Code:
function event_Dim() {
    uses edi;  
    Dword Len;
    char var[255];  
    char buf[1024]; 
    char tmp[255];  
  repeat {         
    buf = 0; //make sure buf is initialized otherwise it may be filled with junk
    
    // get the variable name and hold it in Var 
    eax = Ziron_ExpectNextToken(zirIdent);
    if (eax == -1) {
      Ziron_FatalError('Expected Variable Name');
      return true;
    }
    H_strcpy(@var,Ziron_GetStringValue());   
  
    // get whatever after variable name
    eax = Ziron_GetNextToken();
       
    // let's parse it
    // it can be one of those  
    // As % $ ! # [] 
    case (eax) {
    
      /*********   Dim Var as int32;      **************/     
      /*********   Dim Var as int32 ptr;  **************/      
      state zirAs:
        
        eax = Ziron_ExpectNextToken(zirDATA_TYPE);
        if (eax == -1) {
          Ziron_FatalError('Expected data type');
          return true;
        }
        H_strcpy(@tmp,Ziron_GetStringValue());
        // if end of line the exit
        eax = Ziron_IsNextLineBreak(); 
        if (eax) {
             goto @doit;
         }
        // check if next token is 'ptr'  
        eax = Ziron_PeekNextToken(); 
        if ( eax ==  zirIdent) 
         {
            Dbg(eax); // used for debug purpose
            //Ziron_GetNextToken(); 
            strCmp('ptr',strLower(Ziron_GetStringValue()));
            if(eax)
             {
                H_strcat(@tmp,'*');
             } 
         }    
       @doit:
        H_strjoin(@buf, @tmp, ' ', @var, ';');          
        eax = Ziron_Exec(@buf);
        if (eax == false) {
          Ziron_FatalError('Dim plugin is not compatible with this version of Ziron');
          return true;
        }  

        break;       


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1019] - posted: 2012-05-06 00:57:35
I suggest you take a look through the "plugin/plugin_interface.rtf" file for a list of api functions. You will probably need the following function: Ziron_ExtractLine smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1021] - posted: 2012-05-06 18:42:29
using the latest release you can now set a custom token so, register keyword "ptr"

in the callback, if the next token is a new line for example, then use the new pf function Ziron_SetTokenType as so:

Code:
Ziron_SetTokenType(zirUserIdent, 'ptr');


return as handled if set, else false, then in your other code you can do a ziron get id and string to check if the token is a user token and if the text is ptr smile

good luck smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1022] - posted: 2012-05-06 21:49:01

thanks for the new release of Ziron.

but could you please , give me a Little working example to show me your new function.

http://www.freewebs.com/ogremagic/index.htm
Pages: 1 2 3
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 2 user(s) online. 0 member(s) and 2 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd