Register | Login
Forum Index > Bugs and Fixes > Expected identifier error
Author Message
Pages: 1 2
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[113] Expected identifier error - posted: 2011-10-24 20:46:23

hi

when compiling GuestMode.zpr that in projects section i got that error,

Ziron Compiler 1.1.23.0a
Copyright (C) 2011. OverHertz OOD. All rights reserved.
[41,23]: Expected identifier or calling metho but found strLunarize in [zirutils.zir]
code:
procedure strLunarize(char* str) {


Emil.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[117] - posted: 2011-10-25 18:06:11
because that project is old, i have updated RoleX' code.

Code:
program WIN32DLL 'AutoMode';

#cpu 486;

#include 'messages.zir';
#include 'ziron32.zir';
#include 'smm32.zir';
#include 'zirutils.zir';
#include 'inifiles.zir';

#resource 'GuestMode.res';

function* GetFunction(Pointer sFunc): Pointer; stdcall;
function* SetMode(DWord iUser; Pointer sMode): DWord; stdcall;
function* GetAccountId(DWord iUser): DWord; stdcall;
function* GetHubWindow: DWord; stdcall;

const IDD_MODEDLG = 1000;
const IDC_MODEBTN = 1001;
const IDC_MODEEDT = 1002;

const sPlug = 'Guest mode plugin written in zIRON';
const sAbout = '2011, Bulldozer™';

DWord iHandle;
Char sMode[5];

entry function DLLMain(DWord iDLL; DWord iReason; Pointer iResult) {
  if (iReason == DLL_PROCESS_ATTACH) {
    iHandle = iDLL;
    return true;
  }

  return false;
}

function DialogFunc(DWord iDlg; DWord iMsg; DWord wPar; DWord lPar) {
  if (iMsg == WM_COMMAND) {
    if (wPar == IDC_MODEBTN) {
      GetDlgItemText(iDlg, IDC_MODEEDT, @sMode, 4);
      EndDialog(iDlg, 0);
    }
  } elseif (iMsg == WM_CLOSE) {
    GetDlgItemText(iDlg, IDC_MODEEDT, @sMode, 4);
    EndDialog(iDlg, 0);
  } elseif (iMsg == WM_INITDIALOG) {
    SetDlgItemText(iDlg, IDC_MODEEDT, @sMode);
    ShowWindow(iDlg, SW_SHOWNORMAL);
  }

  return false;
}

procedure LoadSettings {
  eax = Ini_ReadString('.\\GuestMode.ini', @sMode, 'Main', 'Mode', 'd', 5);
  ret;
}

procedure SaveSettings {
  eax = Ini_WriteString('.\\GuestMode.ini', 'Main', 'Mode', @sMode);
  ret;
}

function InitPlugin(Pointer sFunc) {
  GetFunction = sFunc;
  SetMode = GetFunction('SetMode');
  GetAccountId = GetFunction('GetAccountId');
  GetHubWindow = GetFunction('GetHubWindow');
  LoadSettings;
  return sPlug;
}

procedure UnloadPlugin {
  SaveSettings;
  ret;
}

function GetAboutText {
  return sAbout;
}

procedure GetConfig(DWord iParent) {
  DialogBoxParamA(iHandle, IDD_MODEDLG, iParent, @DialogFunc, 0);
  ret;
}

function onNicklistChange(DWord iUser; Boolean bAdded) {
  if (bAdded == true) {
    GetAccountId(iUser);

    if (EAX == 0) {
      SetMode(iUser, @sMode);
    }
  }

  return true;
}

exports
  InitPlugin, UnloadPlugin, onNicklistChange, GetAboutText, GetConfig, SaveSettings;


this i have compiled and it works correctly, a few changes have been made that prevented the older version from compiling.

1 thing to note is macros, any inline macro function returns whatever is returned from the macro

so

Code:
Ini_WriteString('.\\GuestMode.ini', 'Main', 'Mode', @sMode);


actually becomes

Code:
eax;


so by writing eax = ...., the eax = eax will never happen, therefore canceling it out.

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
[118] - posted: 2011-10-25 20:08:23

now compiler gives this error

Access violation at address 004DE556 in module 'Ziron,exe'. Read of address 00000000

thanks for macro explanation.

Emil.



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

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[120] - posted: 2011-10-25 20:18:02

i have removed all eax= from macro , also removed ret; instruction from end of procedures,

but got that error

Expected >> or << or = or as or ++ or -- but found ; in [GuestMode.zpr]
Code:
Ini_ReadString('.\\GuestMode.ini', @sMode, 'Main', 'Mode', 'd', 5);

here is the code
Code:
program WIN32DLL 'AutoMode';

#cpu 486;

#include 'messages.zir';
#include 'ziron32.zir';
#include 'smm32.zir';
#include 'zirutils.zir';
#include 'inifiles.zir';

#resource 'GuestMode.res';

function* GetFunction(Pointer sFunc): Pointer; stdcall;
function* SetMode(DWord iUser; Pointer sMode): DWord; stdcall;
function* GetAccountId(DWord iUser): DWord; stdcall;
function* GetHubWindow: DWord; stdcall;

const IDD_MODEDLG = 1000;
const IDC_MODEBTN = 1001;
const IDC_MODEEDT = 1002;

const sPlug = 'Guest mode plugin written in zIRON';
const sAbout = '2011, Bulldozer™';

DWord iHandle;
Char sMode[5];

entry function DLLMain(DWord iDLL; DWord iReason; Pointer iResult) {
  if (iReason == DLL_PROCESS_ATTACH) {
    iHandle = iDLL;
    return true;
  }

  return false;
}

function DialogFunc(DWord iDlg; DWord iMsg; DWord wPar; DWord lPar) {
  if (iMsg == WM_COMMAND) {
    if (wPar == IDC_MODEBTN) {
      GetDlgItemText(iDlg, IDC_MODEEDT, @sMode, 4);
      EndDialog(iDlg, 0);
    }
  } elseif (iMsg == WM_CLOSE) {
    GetDlgItemText(iDlg, IDC_MODEEDT, @sMode, 4);
    EndDialog(iDlg, 0);
  } elseif (iMsg == WM_INITDIALOG) {
    SetDlgItemText(iDlg, IDC_MODEEDT, @sMode);
    ShowWindow(iDlg, SW_SHOWNORMAL);
  }

  return false;
}

procedure LoadSettings {
  Ini_ReadString('.\\GuestMode.ini', @sMode, 'Main', 'Mode', 'd', 5);
}

procedure SaveSettings {
  Ini_WriteString('.\\GuestMode.ini', 'Main', 'Mode', @sMode);
}

function InitPlugin(Pointer sFunc) {
  GetFunction = sFunc;
  SetMode = GetFunction('SetMode');
  GetAccountId = GetFunction('GetAccountId');
  GetHubWindow = GetFunction('GetHubWindow');
  LoadSettings;
  return sPlug;
}

procedure UnloadPlugin {
  SaveSettings;
}

function GetAboutText {
  return sAbout;
}

procedure GetConfig(DWord iParent) {
  DialogBoxParamA(iHandle, IDD_MODEDLG, iParent, @DialogFunc, 0);
}

function onNicklistChange(DWord iUser; Boolean bAdded) {
  if (bAdded == true) {
    GetAccountId(iUser);

    if (EAX == 0) {
      SetMode(iUser, @sMode);
    }
  }

  return true;
}

exports
  InitPlugin, UnloadPlugin, onNicklistChange, GetAboutText, GetConfig, SaveSettings;


so what is the problem here ?

Emil.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[121] - posted: 2011-10-25 20:28:16
The 2 following functions are calling a return macro

Code:
procedure LoadSettings {
  Ini_ReadString('.\\GuestMode.ini', @sMode, 'Main', 'Mode', 'd', 5);
}

procedure SaveSettings {
  Ini_WriteString('.\\GuestMode.ini', 'Main', 'Mode', @sMode);
}


which are becoming

Code:
procedure LoadSettings {
  eax;
}

procedure SaveSettings {
  eax;
}


what is needed is to return the value so they need to be

Code:
procedure LoadSettings {
  eax = Ini_ReadString('.\\GuestMode.ini', @sMode, 'Main', 'Mode', 'd', 5);
}

procedure SaveSettings {
  eax = Ini_WriteString('.\\GuestMode.ini', 'Main', 'Mode', @sMode);
}


or you can use return

Code:
  return Ini_ReadString('.\\GuestMode.ini', @sMode, 'Main', 'Mode', 'd', 5);


I will try come up with a better solution for this. But for now this should work fine 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
[124] - posted: 2011-10-25 20:45:23

oh.......

when change it like that
Code:
procedure LoadSettings {
  eax = Ini_ReadString('.\\GuestMode.ini', @sMode, 'Main', 'Mode', 'd', 5);
}

procedure SaveSettings {
  eax = Ini_WriteString('.\\GuestMode.ini', 'Main', 'Mode', @sMode);
}


i got that error

Access violation at address 004DE556 in module 'Ziron,exe'. Read of address 00000000

Emil.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[125] - posted: 2011-10-25 20:46:36
can you try comment out the resource file (lets see if it is a problem related to that)

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
[126] - posted: 2011-10-25 20:52:18

cemented it and have the same error.


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


Quick reply:

Message:



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