Register | Login
Forum Index > Plugins > PlugIn Example in C
Author Message
Pages: 1 2 3 4 5 6 7 8 9 10 11
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[984] - posted: 2011-12-09 20:21:23
first problem i see is that you are using edi without protecting the contents...

Code:
procedure FileEntry(DWord handle; char* strCode) 
{
    int32 len = H_strlen(strCode);
    if(len > 0)
     {
       pointer mem = H_GetTmpMem(len); //allocate memory
       char tmp[1024];
       edi = strGetLine(strCode, @tmp);
       while(edi > 0)
        {    
           H_strcat(mem,@tmp);          
           edi = strGetLine(edi, @tmp);
        }
       if(Ziron_SetFileBuffer(handle, mem ,H_strlen(mem)) == false)
        {
          Ziron_FatalError('error when set File Buffer');
       }  
     }
}


I have made some further updates to Ziron which i will upload too.

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
[985] - posted: 2011-12-09 21:01:06
i have updated the beta and it works OK

Code:
procedure FileEntry(DWord handle; char* strCode) {
  uses edi;

  edi = strLen(strCode);
  if (eax > 0) {
    char* mem = new edi;
    char tmp[2048];
    
    edi = strGetLine(strCode, @tmp);
    while(edi <> 0) {    
      H_strJoin(mem, @tmp);
      edi = strGetLine(edi, @tmp);
    }
    if (Ziron_SetFileBuffer(handle, mem, strLen(mem)) == false) {
      Ziron_FatalError('error when set File Buffer');
    }
    
    delete mem;
  }
}


used this code to test, but note that because you are not added newlines, some lines will become messed up due to comments.. everything is put onto 1 line...

you have 2 options, add newlines after each actual line, or 2... delete new lines as they are processed.

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
[986] - posted: 2011-12-09 21:41:12

i have downloaded the beta ,and test you new code.

it keeps printing source code then crashed, BTW i did not see any commend to print the lines
of the code in your last FileEntry but ziron print them.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[988] - posted: 2011-12-09 21:44:37
sorry that was some old debug code, i've removed it in latest beta, as for crash i suggest you check other parts of your code, step by step add bit at a time to find where it crashes.

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
[990] - posted: 2011-12-09 21:58:09

oh , plugin compiled okay , when test it with any code ziron crashed.

here is the log file

Ziron Compiler 1.1.29.3
Copyright (C) 2011. OverHertz Ltd. All rights reserved.
--------------------------------------------
12/9/2011 10:02:06 PM
--------------------------------------------

PlugSys: Emit plugin has loaded!
PlugSys: test plugin has loaded!


and the editor print that

Exception EInOutError in module Ziron.exe at 000C2248


http://www.freewebs.com/ogremagic/index.htm
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[991] - posted: 2011-12-09 22:11:09
Code:
procedure FileEntry(DWord handle; char* strCode) {
  uses edi;
  
  edi = strLen(strCode);
  if (eax > 0) {
    char* mem = new edi;
    char tmp[2048];
    
    edi = strGetLine(strCode, @tmp);
    while(edi <> 0) {    
      H_strJoin(mem, @tmp,'\r\n');
      Ziron_ShowMessage(@tmp);
      edi = strGetLine(edi, @tmp);
    }
    if (Ziron_SetFileBuffer(handle, mem, strLen(mem)) == false) {
      Ziron_FatalError('error when set File Buffer');
    }
    
    delete mem;
  }
  Ziron_ShowMessage('Ended');  // this does not printed ,crashed before came here
}


http://www.freewebs.com/ogremagic/index.htm
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[992] - posted: 2011-12-09 22:15:17
Code:
procedure FileEntry(DWord handle; char* strCode) {
  uses edi;
  
  edi = strLen(strCode);
  if (eax > 0) {
    char* mem = new edi;
    char tmp[2048];
    
    edi = strGetLine(strCode, @tmp);
    while(edi <> 0) {    
      H_strJoin(mem, @tmp,'\r\n');
      Ziron_ShowMessage(@tmp);
      edi = strGetLine(edi, @tmp);
    }
    Ziron_ShowMessage('test here'); // works well when added this line
    if (Ziron_SetFileBuffer(handle, mem, strLen(mem)) == false) {
      Ziron_FatalError('error when set File Buffer');
    }
    
    delete mem;
  }
  Ziron_ShowMessage('Ended');
}


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[993] - posted: 2011-12-10 01:00:46
check if there is enough storage allocated

Code:
  edi = strLen(strCode);
  edi += 1024; //if it works with this let me know,.
  if (eax > 0) {
    char* mem = new edi;


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1 2 3 4 5 6 7 8 9 10 11
create new reply


Quick reply:

Message:



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