Register | Login
Forum Index > Plugins > Ziron_GetStringValue Eaxmple
Author Message
Pages: 1 2 3
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[332] - posted: 2011-11-04 22:49:06
no problem, i am happy to help 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
[333] - posted: 2011-11-04 22:53:30
your function that i tested with just now

Code:
function event_Dim() {
  char var[255];  
  char buf[1024]; 
  buf = 0; //make sure buf is initialized otherwise it may be filled with junk
       
  eax = Ziron_ExpectNextToken(zirIdent);
  if (eax == -1) {
    Ziron_FatalError('Expected Variable Name');
    return true;
  }
    
  H_strcpy(@var,Ziron_GetStringValue()); 
         
  eax = Ziron_ExpectNextToken(zirAs);
  if (eax == -1) {
    Ziron_FatalError('Expected as Keyword');
    return true;
  }
  
  eax = Ziron_ExpectNextToken(zirDATA_TYPE);
  if (eax == -1) {
    Ziron_FatalError('Expected data type');
    return true;
  }
  eax = Ziron_GetStringValue();

  strAppend(@buf,eax,1023);
  if (eax == false) {
    Ziron_FatalError('strAppend failed\r\n');
  }
  strAppend(@buf,' ',1023);
  if (eax == false) {
    Ziron_FatalError('strAppend failed\r\n');
  }
  strAppend(@buf,@var,1023);
  if (eax == false) {
    Ziron_FatalError('strAppend failed\r\n');
  }
  strAppend(@buf,';',1023);
  if (eax == false) {
    Ziron_FatalError('strAppend failed\r\n');
  }
        
  Ziron_Execute(@buf, strLen(@buf));
  
  return true;
}


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
[334] - posted: 2011-11-04 22:59:24

yes , and here is a test program , works as expected.
Code:
program WIN32CUI 'test';

#include 'console.zir';

eax = 1;
print('eax = ', eax:int, '\r\n');

Dim Var as int32;

Var = 1000;

print('Var = ', Var, '\r\n');

wait_key(nil);
ExitProcess(0);


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[335] - posted: 2011-11-04 23:01:45
note that if you want to enforce the semi colon ";" you will also need to do a expectNextToken, however in such case i don't think it is required, usually enforcement of semi colon is only useful when there is several different uses of a keyword, e.g. for mov opcode,

anyways, looking good, look forward to see what else you add 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
[336] - posted: 2011-11-04 23:03:35

ok , i got it.

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


Quick reply:

Message:



Currently Active Users:
There are currently 1 user(s) online. 0 member(s) and 1 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