Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
error: expected ';' before '(' token

 
Post new topic   Reply to topic    Forum Index -> ZBasic Native Mode
Author Message
ndudman



Joined: 25 Dec 2008
Posts: 79

Posted: 28 September 2009, 7:48 AM    Post subject: error: expected ';' before '(' token Reply with quote

Hi

I'm getting the following internal error, the test case is provided below.
    test28_9_09.c:71: error: expected ';' before '(' token
    test28_9_09.c:71: error: expected ';' before '}' token
    test28_9_09.c:71: error: expected statement before ')' token
    test28_9_09.c:75: error: expected ')' before 'else'
    test28_9_09.c:82: error: expected ';' before '}' token
    test28_9_09.c:104: error: expected declaration or statement at end of input
    test28_9_09.c:97: warning: unused variable 'stringTbl'
    Error: one or more errors occurred in the back-end build process for "test28-9-09.zxb"
    >Exit code: 1


Code:

Declare Sub wait4userInput(byVal str as String) Based wait4userInputAddr
private wait4userInputAddr as Long Attribute(used)
public waiting4UserInput as byte = 0

'~ Called from Menu_imp.c menu definition
public sub SetTime() Attribute(Used)
   '~ Procedure for getting key input   
   waiting4UserInput = 1

   '~ 2) register the call back routine
   wait4userInputAddr = SetTimeDOIT.CodeAddress
   '~ call displayMsg("FMT HH:MM")   
   '~ call DisplaySetPos(1, 5)
end sub

dim kbReadTask(1 to 260) as Byte

Dim keyVal as UnsignedInteger   
Dim keyStr as String
Dim inputStr as String
sub kbRead()
      do
         '~ keyVal = kb_get()
         '~ KeyStr = Chr(kb_decode(keyVal, 0))
         KeyStr = "f"
      
         '~ if (menuActive = 1) then
            '~ if (waiting4UserInput = 1) then   
               select case keyVal
                  case 0 'We have finished, passed keys to waiting sub
                     Call wait4userInput(inputStr)   
                     waiting4UserInput = 0
                     inputStr = ""                                             
                  case else
                     if (Asc(keyStr) <> 0) then
                        inputStr = inputStr & keyStr
                        '~ call showUserKey(keyStr)
                        '~ call showUserKey(inputStr)
                     end if
                  end select                                    
            '~ end if         
         '~ end if
         call delay(0.3)
      loop
end sub

sub SetTimeDOIT(Byval s as String)   
end sub

Sub Main()   
   callTask kbRead(), kbReadTask   
end sub

project file is
Code:

--verbose
--keep-files
test28-9-09.bas


The generated c file test28-9-09.c is
Code:

#include "test28_9_09.h"

#define HEAP_LIMIT         (uint8_t *)0
#define HEAP_SIZE         512

PersistData sysData EEMEM = { 0, ZX_TRUE };

// default Com1 speed
#define DEF_COM1_SPEED      19200

// transmit and receive queues for Com1
uint8_t txQueue[25] NO_INIT;
uint8_t rxQueue[50] NO_INIT;

static int32_t mzv_wait4userInputAddr USED;
static uint8_t mzv_kbReadTask[260];
static uint16_t mzv_keyVal;
static String mzv_keyStr;
static String mzv_inputStr;

uint8_t zv_waiting4UserInput;

ZX_INIT_MAIN(init_test28_9_09, HEAP_LIMIT, HEAP_SIZE)
{
   initHeap();
   initQueue((Queue *)txQueue, sizeof(txQueue));
   initQueue((Queue *)rxQueue, sizeof(rxQueue));
   zxInit(BAUD_FACTOR_2X(DEF_COM1_SPEED));
#if defined(ENABLE_SW_UART)
   enableSerialSW();
#endif
   strInit(&mzv_keyStr, AN_STR);
   strInit(&mzv_inputStr, AN_STR);
}

int
main(void)
{
#if defined(ZX_INIT)
   ZX_INIT;
#endif
   startMainTask(zf_Main);
   for(;;);
}

void
zf_Main(void)
{
   taskStart(zf_kbRead, mzv_kbReadTask, 260, 0);
}

void
zf_SetTime(void)
{
   zv_waiting4UserInput = 1;
   mzv_wait4userInputAddr = flashAddr(&zf_SetTimeDOIT);
}

void
zf_kbRead(void)
{
   while (1)
   {
      strCopy(&mzv_keyStr, STRTBL(0));
      {
         uint16_t _zv_selectValTemp02;

         _zv_selectValTemp02 = mzv_keyVal;
         if (_zv_selectValTemp02 == 0)
         {
            IC0((void (*)(String))(uint16_t)(mzv_wait4userInputAddr), mzv_inputStr);
            zv_waiting4UserInput = 0;
            strCopy(&mzv_inputStr, STRTBL(2));
         }
         else
         {
            if ((strChar(mzv_keyStr, 1)))
            {
               strCopy(&mzv_inputStr, strCat(mzv_inputStr, mzv_keyStr));
            }
         }
      }
      taskDelay(0.3);
   }
}

void
zf_SetTimeDOIT(String zp_s)
{
   uint8_t strTypeSave1;
   FIX_PARM_STR(strTypeSave1, zp_s);

   FREE_PARM_STR(strTypeSave1, zp_s);
}

// string table
prog_char stringTbl[] =
{
   // STRTBL(0) - "f"
   0x01, 0x66,

   // STRTBL(2) - ""
   0x00,
};
Back to top
mikep



Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX

Posted: 28 September 2009, 8:18 AM    Post subject: Reply with quote

Thanks. Now Don has something to debug with.

It looks like the code generation for the C function call with parameters is putting the closing ')' in the wrong place. It should be after the parameters, not after the function name.

I have not found a need for based procedures before. Any reason for making it based?
Back to top
ndudman



Joined: 25 Dec 2008
Posts: 79

Posted: 28 September 2009, 13:10 PM    Post subject: Reply with quote

Thanks

Using based procedures _ I like to try everything out Smile... but really I have an LCD and keyboard interface, data can be set via the keyboard at different points within a menu or data display screens, validation is triggered via a generic ENTER key handler which calls back to the registered handler for user input which is set up when the user was initially prompted for question, data, y/n, etc.

A GOOD question, I had to go back and look at the code and see how it worked Smile

Neil
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 29 September 2009, 2:54 AM    Post subject: Reply with quote

ndudman wrote:
I'm getting the following internal error...
What version of the compiler are you using? I can reproduce the error with the current release v2.8.7. However, the experimental version v2.8.9 compiles your test case without a problem (other than a warning about indeterminate task stack size).

http://www.zbasic.net/download/ZBasic/2.8/ZBasic_2-8-9.zip
Back to top
ndudman



Joined: 25 Dec 2008
Posts: 79

Posted: 29 September 2009, 7:17 AM    Post subject: Reply with quote

I was using the latest stable From webpages which I downloaded about 2 days ago.

Will give the new experimental one a try.

Thanks
Neil
Back to top
ndudman



Joined: 25 Dec 2008
Posts: 79

Posted: 29 September 2009, 12:50 PM    Post subject: Reply with quote

Thanks

My test case now compiles.

Not sure if its related, as I've not seen this before, I get

    avr-gcc -c -DF_CPU=14745600UL -Dzx24n -mmcu=atmega644p -I"C:/Program Files/ZBasic/zxlib" -I. -gdwarf-2 -Os -Wall -funsigned-char -fpack-struct -Wstrict-prototypes -std=gnu99 -fgnu89-inline I:/source/swapper/ntc_convert.c -o I:/source/swapper/ntc_convert.o
    avr-gcc -c -o
    avr-gcc: argument to '-o' is missing

I wanted to look at the generated make file... I tried the undocumented --diag=x100 which was mentioned about a year ago... but perhaps this is different now, I can't find the make file to see closer to understanding what the problem is.

Thanks
Neil
Back to top
ndudman



Joined: 25 Dec 2008
Posts: 79

Posted: 29 September 2009, 16:10 PM    Post subject: Reply with quote

I found the make file, its a bat file

    @echo off
    set TARG_BASE=swapper
    set TARGET=swapper.bin
    set MCU=atmega644p
    set F_CPU=14745600
    set DEVICE=zx24n
    set ZXLIBDIR=C:/Program Files/ZBasic/zxlib
    set ZXLIB=%DEVICE%
    set LDSCRIPT=%ZXLIBDIR%/zx_avr5.lds
    set BFLAGS=-D%DEVICE% -mmcu=%MCU% -I"%ZXLIBDIR%" -I.
    set FLAGS=-DF_CPU=%F_CPU%UL %BFLAGS% -gdwarf-2 -Os -Wall -funsigned-char -fpack-struct
    set CFLAGS=%FLAGS% -Wstrict-prototypes -std=gnu99 -fgnu89-inline
    set LDFLAGS=-mmcu=%MCU% -L"%ZXLIBDIR%" -Wl,-T,"%LDSCRIPT%"
    set LDFLAGS=%LDFLAGS% -u rtc_ISR
    set LDFLAGS=%LDFLAGS% -u int0_ISR
    set LDFLAGS=%LDFLAGS% -u int1_ISR
    set LDFLAGS=%LDFLAGS% -u int2_ISR
    set LDFLAGS=%LDFLAGS% -u pcint0_ISR
    set LDFLAGS=%LDFLAGS% -u pcint1_ISR
    set LDFLAGS=%LDFLAGS% -u pcint2_ISR
    set LDFLAGS=%LDFLAGS% -u pcint3_ISR
    set LDFLAGS=%LDFLAGS% -u anaComp_ISR
    set LDFLAGS=%LDFLAGS% -u default_ISR
    set LDLIBS=-l%ZXLIB% -lm
    set CC=avr-gcc
    set AR=avr-ar
    set OBJCOPY=avr-objcopy
    set NM=avr-nm
    set OBJDUMP=avr-objdump
    set ECHO=echo
    set REMOVE=rm -f
    set IFILE=%TARG_BASE%.i1
    set EXTOBJ=
    set ERRCODE=0
    set OBJ=sensors.o LedFlasher.o LCD_4P.o MAX6957.o MAX1202.o guicmd.o myTime.o debug.o Glabals.o DS1305.o swapper.o relay.o I:/source/swapper/ntc_convert.o I:/source/swapper/keyboard.o I:/source/swapper/keymap_hd44780_en.o I:/source/swapper/Menu.o

    cd "zxTempDir\swapper"

    set CMD=%CC% -c %CFLAGS% sensors.c -o sensors.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% LedFlasher.c -o LedFlasher.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% LCD_4P.c -o LCD_4P.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% MAX6957.c -o MAX6957.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% MAX1202.c -o MAX1202.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% guicmd.c -o guicmd.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% myTime.c -o myTime.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% debug.c -o debug.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% Glabals.c -o Glabals.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% DS1305.c -o DS1305.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% swapper.c -o swapper.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% relay.c -o relay.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% I:/source/swapper/ntc_convert.c -o I:/source/swapper/ntc_convert.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% I:/source/swapper/keyboard.c -o I:/source/swapper/keyboard.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% I:/source/swapper/keymap_hd44780_en.c -o I:/source/swapper/keymap_hd44780_en.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %CFLAGS% I:/source/swapper/Menu.c -o I:/source/swapper/Menu.o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %AFLAGS% -o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %AFLAGS% -o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %AFLAGS% -o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -c %AFLAGS% -o
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error

    set CMD=%CC% -o %IFILE% %LDFLAGS% %OBJ% %EXTOBJ% %LDLIBS%
    echo %CMD%
    %CMD%
    if ERRORLEVEL 1 goto error
    %OBJCOPY% -R .eeprom -R .zx_eeprom -O binary %IFILE% %TARG_BASE%.bin
    if ERRORLEVEL 1 goto error
    %OBJCOPY% -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O binary %IFILE% %TARG_BASE%.eeb
    if ERRORLEVEL 1 goto error
    %NM% -n %IFILE% > %TARG_BASE%.sym
    %OBJDUMP% -h -S %IFILE% > %TARG_BASE%.lss

    goto done

    :error
    set ERRCODE=1

    :done
    %REMOVE% %IFILE% %OBJ%
    exit %ERRCODE%


I think those I:/ paths need to be quoted ? I did that to the bat file as well as added the avr-gcc to the PATH variable and it worked more, but still was missing something. There are also some blank

Any help ?

Neil[/list]
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 29 September 2009, 23:25 PM    Post subject: Reply with quote

ndudman wrote:
I found the make file, its a bat file
You're running on Linux, yes?

I see that the issue is related to assembly language files. I'll take a look at it to see why is isn't working correctly.
Back to top
ndudman



Joined: 25 Dec 2008
Posts: 79

Posted: 30 September 2009, 2:00 AM    Post subject: Reply with quote

Thanks

Thats right I'm using linux.

Neil
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 30 September 2009, 20:04 PM    Post subject: Reply with quote

dkinzer wrote:
I see that the issue is related to assembly language files.
This issue has been corrected in an experimental release of the compiler:
http://www.zbasic.net/download/ZBasic/2.8/ZBasic_2-8-10.zip
Back to top
ndudman



Joined: 25 Dec 2008
Posts: 79

Posted: 01 October 2009, 17:01 PM    Post subject: Reply with quote

Thanks

I have it compiling now

Neil
Back to top
ndudman



Joined: 25 Dec 2008
Posts: 79

Posted: 01 October 2009, 19:50 PM    Post subject: Reply with quote

Hi

With the experiemental version there seems to be a problem with initialised variables, following code, dosn't print 1.0 on the experiemental version (Version 2.8.10)
, but does on my older version (. Version 2.6.12, which I had from when I was last working on the project in the spring)
Code:
private lcdUpdateInterval as Single = 1.0 ' in seconds, to update LCD

Sub Main()

   Debug.print "debug lcdUpdateInterval=" ; lcdUpdateInterval
End Sub


Thanks
Neil
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 01 October 2009, 23:17 PM    Post subject: Reply with quote

ndudman wrote:
With the experiemental version there seems to be a problem with initialised variables
Thank you for supplying a concise test case. We have confirmed the issue, determined its cause and formulated a solution. Further testing is needed to confirm its efficacy.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Native Mode Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group