BASIC Developer & Support Resources > Translators

MBC

<< < (2/9) > >>

John:
I tried to compile the regextest.bas example and received the following errors.


MBC Version 4.0-Beta3 (2018/12/09)
MBC4: Based on Linux BCX by Mike Henning (c) 2009
(c) 2009-2018 Armando Rivera with additional code (c) 2009 John Jacques


********************
** 64 BIT VERSION **
********************

[Lines In:20] [Lines Out:185] [Statements:12] [Time:0.01 sec's]
BCX translated regextest.bas to regextest.cc
Shelling Out To: g++  -Wformat -D_FORTIFY_SOURCE=2 -Wno-write-strings regextest.cc -ldl  -o regextest
regextest.cc: In function ‘int main(int, char**)’:
regextest.cc:170:12: error: ‘REGEX’ does not name a type; did you mean ‘REG_ERR’?
   static   REGEX  hits;
            ^~~~~
            REG_ERR
regextest.cc:171:11: error: ‘hits’ was not declared in this scope
   memset(&hits,0,sizeof(hits));
           ^~~~
regextest.cc:171:11: note: suggested alternative: ‘puts’
   memset(&hits,0,sizeof(hits));
           ^~~~
           puts
regextest.cc:177:6: error: ‘bcxregex’ was not declared in this scope
   if(bcxregex(Src,"( )", &hits))
      ^~~~~~~~
jrs@jrs-laptop:~/MBC$


AIR:
Give me a few minutes....

AIR:
Sorry, the problem is here:


--- Code: C --- if(bcxregex(Src,"( )", &hits))
I changed that function to 'regmatch'.

You also need to put in something to search for, as is it will search for a space.

John:
Could you please post your working version? I'm still getting errors.

AIR:

--- Code: Text ---$EXECON$NOMAIN FUNCTION main(argc as integer, argv as PCHAR*) as integer    dim hits as REGEX    LOCAL Src$,j     Src$ = "Hello, World! This is Armando"    IF regmatch(Src$,"(H.+,).+(man)",&hits) THEN        FOR j = 1 TO hits.count            IF LEN(hits.results[j]) THEN                PRINT hits.results[j]$,SPC$;            END IF        NEXT        PRINT    END IFEND FUNCTION 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version