1. Translator Issues
- Posted by Greg Haberek <g.haberek at comcast.net> Feb 27, 2003
- 449 views
I'm getting an error when I translate the following code to C. (code is from Jordah Ferguson's binary.e) since I'm not fluent in C, I need a little help with this. is it a problem with Euphoria, C, or the Translator? please note: 'first' is not used *anywhere* in my Euphoria code from binary.err: binary.c(25): Error! E1031: Name 'first' not found in struct/union s1 -- begin eu code -- type string(sequence s) for i = 1 to length(s) do x = s[i] if integer(x) then if x < 0 or x > #FF then return 0 end if else return 0 end if end for return 1 end type -- end eu code -- /* begin c code */ int _0string(int _s) { int _32 = 0; int _27 = 0; int _26; int _0, _1, _2, _3; // for i = 1 to length(s) do _26 = SEQ_PTR(_s)->length; { int _i; _i = 1; L0: if (_i > _26) goto L1; // x = s[i] DeRef(_0x); _1 = _i - 1; _2 = (int)SEQ_PTR(_s); _0x = (int)*(_1 + ((s1_ptr)_2)->first); // herein lies the error, 'first' not defined Ref(_0x); // if integer(x) then DeRef(_27); if (IS_ATOM_INT(_0x)) _27 = 1; else if (IS_ATOM_DBL(_0x)) _27 = IS_ATOM_INT(DoubleToInt(_0x)); else _27 = 0; if (_27 == 0) goto L2; // if x < 0 or x > #FF then if (IS_ATOM_INT(_0x)) { _27 = (_0x < 0); } else { _27 = binary_op(LESS, _0x, 0); } if (IS_ATOM_INT(_27)) { if (_27 != 0) { goto L3; } } else { if (DBL_PTR(_27)->dbl != 0.0) { goto L3; } } DeRef(_32); if (IS_ATOM_INT(_0x)) { _32 = (_0x > 255); } else { _32 = binary_op(GREATER, _0x, 255); } L4: if (_32 == 0) goto L5; else if (!IS_ATOM_INT(_32) && DBL_PTR(_32)->dbl == 0.0) goto L5; L3: // return 0 DeRefDS(_s); DeRef(_32); DeRef(_27); return 0; L6: goto L5; L2: // return 0 DeRefDS(_s); DeRef(_32); DeRef(_27); return 0; L5: // end for _i = _i + 1; goto L0; L1: ; } // return 1 DeRefDS(_s); DeRef(_32); DeRef(_27); return 1; ; } /* end c code */ thanks, ~Greg g.haberek at comcast.net
2. Re: Translator Issues
- Posted by Greg Haberek <g.haberek at comcast.net> Feb 28, 2003
- 434 views
Actually I did download the 2.4 Translator, but never installed it! Silly me... Thanks for the help Rob. ----- Original Message ----- From: Robert Craig <rds at RapidEuphoria.com> To: <EUforum at topica.com> Subject: Re: Translator Issues Greg Haberek wrote: > from binary.err: binary.c(25): > Error! E1031: Name 'first' not found in struct/union s1 The 2.4 alpha interpreter contains a new version of euphoria.h in euphoria\include. The 2.3 interpreter did not have euphoria.h - you had to get it from one of the 2.3 Translator packages. The 2.4 alpha euphoria.h, and 2.4 alpha Translator now use the structure field "base", where the 2.3 euphoria.h and Translator used "first". These are not your symbols. They are internal symbols used to access sequences. It looks like you ran the 2.3 Translator, and it tried to use the new 2.4 euphoria.h, and gave you a bunch of errors. Solution: install the 2.4 alpha Complete Edition Translator (for whatever platform) to match your 2.4 alpha Interpreter. You were on the list for a free Translator upgrade. If you didn't get the e-mail, let me know. I think 2.4 alpha is stable enough that you won't regret installing both the Translator and Interpreter. The Translator is just 2 extra files in most cases. You could also overwrite the 2.4 euphoria.h with the old 2.3 euphoria.h for the time being. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com TOPICA - Start your own email discussion group. FREE!