[fpc-pascal] Error when translating a C header

Luciano de Souza luchyanus at gmail.com
Wed Oct 5 01:28:17 CEST 2011


It's almost unblievable, but with your tip, I need to solve one line to 
compile 3744 lines!

iupkey.pp(248,25) Error: Illegal expression
isxkey = iup_isXkey;

Do you have any idea why this error comes up?


Em 04-10-2011 05:11, Ludo Brands escreveu:
> The problem is in line 20: replace
> #define K_apostrophe  '\''  /* 39 */
> with
> #define K_apostrophe  ' '  /* 39 */
> and h2pas will create iupkey.pp. Then, in iupkey.pp replace K_apostrophe = '
> ' with K_apostrophe = ''''
> The problems aren't over yet. You'll need to replace K_quotedbl = '\"' with
> K_quotedbl = '"' as well as other escaped characters such as K_backslash,
> K_BS, etc. C escapes special characters with "\".
> The main problem is that C mixes chars and integers freely while pascal
> can't do that. So the functions generated for IUPcxCODE, etc won't work.
> You'll need to check in IUP how the character codes are used, as characters
> or as integers. Only then can the header file be translated.
>
> Ludo
>
>> -----Message d'origine-----
>> De : fpc-pascal-bounces at lists.freepascal.org
>> [mailto:fpc-pascal-bounces at lists.freepascal.org] De la part
>> de Luciano de Souza
>> Envoyé : mardi 4 octobre 2011 03:12
>> À : fpc-pascal at lists.freepascal.org
>> Objet : [fpc-pascal] Error when translating a C header
>>
>>
>> Hi listers,
>>
>> I tried to translate a C header with:
>>
>> h2pas -e -d -p iupkey.h
>>
>> I got the following error:
>>
>> at line 21 error : syntax error
>> at line 41 error : syntax error
>> Illegal character in line 45
>> "#define K_at          '@'   /* 64 */"
>> Illegal character in line 73
>> "#define K_backslash   '\\'  /* 92 */"
>> Illegal character in line 73
>> "#define K_backslash   '\\'  /* 92 */"
>> Illegal character in line 75
>> "#define K_circum      '^'   /* 94 */"
>> Illegal character in line 77
>> "#define K_grave       '`'   /* 96 */"
>> Illegal character in line 113
>> "#define K_BS     '\b'       /* 8 */"
>> Illegal character in line 114
>> "#define K_TAB    '\t'       /* 9 */"
>> Illegal character in line 115
>> "#define K_LF     '\n'       /* 10 (0x0A) not a real key, is a
>> combination of CR with a modifier, just to document */"
>> Illegal character in line 116
>> "#define K_CR     '\r'       /* 13 (0x0D) */"
>> LexLib: yytext overflow
>>
>> I could understand if the Pascal unit was generated, but not
>> compiled.
>> What I can't understand is that even the Pascal unit, h2pas
>> was not able
>> to produce.
>>
>> I am trying to translate it becouse it is very important for me.
>> Actually, I don't know C, but I hope I can complete the task.
>>
>> I am blind and I am trying to create graphical interfaces. It
>> seems to
>> be so curious, but I can make sure the idea is reasonable and
>> suitable.
>> Of course, I cwon't conceive beautiful interfaces. But with
>> the help of
>> IUP, a graphical interface library which supports automatic layout, I
>> will produce dialogs  interacting very good with screen readers.
>>
>> As my objective is to program to blind people, beauty is not
>> properly a
>> requirement. Having used IUP with Lua, I know it works, but
>> now, to use
>> it with Pascal, I need to overcome this initial difficulties.
>>
>> Does someone know how to convert it? Why the unit, even wrong, is not
>> created?
>>
>> Luciano
>>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: iupkey.pp
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111004/7329c0a8/attachment.ksh>


More information about the fpc-pascal mailing list