Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2002:
[Freeciv-Dev] Re: Generator script
Home

[Freeciv-Dev] Re: Generator script

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Generator script
From: Billy Naylor <banjo@xxxxxxxxxx>
Date: Sun, 8 Sep 2002 15:59:31 +1200
Reply-to: banjo@xxxxxxxxxx

[snip]

> > use Inline;
> >  ... and the second way is easier.
> >
> >
> > use Inline (C => Config =>
> >         ENABLE => AUTOWRAP,
> >         INC => '-I/src/freeciv-1.13.0/client',
> >       );
> > use Inline C => <<'END_OF_C_CODE';
> >
> >
> >
> > #include "control.h"
> >
> > void end_turn(void)
> > {
> >   send_turn_done();
> > }
> >
> > void move_unit_direction( struct unit *punit, int dir ){
> >
> >     request_move_unit_direction( *punit, dir)
> > }
> >
> > /* etc */
> >
> > END_OF_C_CODE
>
> And what does this mean? I only know the basic perl features.
>
>       Raimar

Inline is a wrapper around the SWIG, to inline code from other languages...
( C, C++, Java, TCL, Python, Scheme, Octave, Basic, Befunge...)

Here is a simple example.

    use Inline C;
    
    print "9 + 16 = ", add(9, 16), "\n";
    print "9 - 16 = ", subtract(9, 16), "\n";
 
    __END__
    __C__
    int add(int x, int y) {
      return x + y;
    }
 
    int subtract(int x, int y) {
      return x - y;
    }


The Inline pod is here...
  http://search.cpan.org/author/INGY/Inline-0.43/Inline.pod
and Inline::C ...
  http://search.cpan.org/author/INGY/Inline-0.43/C/C.pod



[Prev in Thread] Current Thread [Next in Thread]