On Thu, Jul 24, 2003 at 11:17:53AM +0200, Michael Van Canneyt wrote: > > > On Thu, 24 Jul 2003, James Mills wrote: > > > On Wed, Jul 23, 2003 at 08:50:35AM +0200, Michael Van Canneyt wrote: > > > > > > > > > On Wed, 23 Jul 2003, James Mills wrote: > > > > > > > On Wed, Jul 23, 2003 at 03:28:55AM +0200, Marco van de Voort wrote: > > > > > > I can successully compile and test the plugin source listed at > > > > > > http://xchat.org/docs/plugin20.html written in C. > > > > > > > > > > > > However I don't like C much and am wondering if it's possible to do the > > > > > > same thing in pascal... ? I know it has to be possible, but I need > > > > > > someone to start me off in the right direction... > > > > > > > > > > Probably yes, but you'll need to convert headers of xchat-plugin.h. The > > > > > "h2pas" util can be handy for this. (or at least it can save a lot of time) > > > > > > > > Okay I've converted the headers (step 1) :P > > > > > > > > $ h2pas -S -D -p -l xchat xchat-plugin.h > > > > at line 6 error : syntax error > > > > Illegal character in line 6 > > > > "#define XCHAT_IFACE_VERSION ((XCHAT_IFACE_MAJOR * 10000) + \" > > > > at line 7 error : syntax error > > > > Illegal character in line 7 > > > > " (XCHAT_IFACE_MINOR * 100) + \" > > > > > > > > > > > > > > > > What do I do with these errors though ? > > > > > > run the file through the gcc preprocessor: > > > > > > gcc -E xchat-plugin.h -o xchat-plugin.hp > > > h2pas -S -D -p -l xchat xchat-plugin.hp > > > > > > Note that this destroys all '#define' constants, so you'll have to > > > run h2pas a second time to get all constants. > > > > > > Michael. > > > > > > > > > _______________________________________________ > > > fpc-pascal maillist - [EMAIL PROTECTED] > > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > > > I've sucessfully now done all this and now have the headers converted... > > I have a problem though when trying to compiling a test plugin: > > > > $ fpc test > > Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 > > Copyright (c) 1993-2002 by Florian Klaempfl > > Target OS: Linux for i386 > > Compiling test.pas > > Compiling xchatplugin.pas > > xchatplugin.pas(49,24) Error: Identifier not found XCHAT_PLUGIN > > xchatplugin.pas(49,36) Error: Error in type definition > > xchatplugin.pas(50,22) Error: Identifier not found XCHAT_LIST > > xchatplugin.pas(50,32) Error: Error in type definition > > xchatplugin.pas(51,22) Error: Identifier not found XCHAT_HOOK > > xchatplugin.pas(51,32) Error: Error in type definition > > xchatplugin.pas(55,25) Error: Identifier not found XCHAT_CONTEXT > > xchatplugin.pas(55,38) Error: Error in type definition > > xchatplugin.pas(61,24) Error: Duplicate identifier _XCHAT_PLUGIN > > xchatplugin.pas(61,24) Error: Duplicate identifier _XCHAT_PLUGIN > > xchatplugin.pas(62,60) Error: Identifier not found PXCHAT_PLUGIN > > xchatplugin.pas(62,96) Error: Type identifier expected > > xchatplugin.pas(62,96) Fatal: Syntax error, ) expected but FUNCTION found > > > > > > What's going on here ? > > The unit is not correct. There are things that h2pas doesn't 'know' > about. C is case sensitive. Pascal is not. so duplicate identifiers can > exist. the C construct "xchat_plugin *" is translated to > 'Pxchat_plugin', but that may or may not be defined already. > > In general, a generated file may still need some manual editing before > it is compilable. This is perfectly normal.
I'm a little confused as to what manual editing is necessary... What about the: const External_library='xchat'; {Setup as you need} What does this need to be ? Does the unit need to be linked with anything ? (There are no xchat libraries I am aware of). Help me out here :P (please) cheers James > > Michael. > > > _______________________________________________ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- - - James Mills Zero Defect Software Engineers Group - ZDSEG _______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal