<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w

# CALLBACKS umwandeln:

use strict;

print "(*  (C)2000 by Tjabo Kloppenburg &lt;tjabo\@unix-ag.org&gt; *)\n";
print "(*  -+- This is the glade_c to FreePascal Converter -+-*)\n";

if ($#ARGV != 0) {
  print "Usage: gc2pas /glade/project/src/callbacks.c &gt;testapp.pas\n";
  print "       gi2pas /glade/project/src/interface.c &gt;&gt;testapp.pas\n";
  print "       ppc386 testapp.pas\n";
  exit;
}

my $infile = $ARGV[0];
my $firstfuncname = "";

# --------------------------------------------------------------------------

open(INFILE, "&lt;$infile") || die "Infile $infile nicht lesbar!";
my $zeile;
my ($fz1,$fz2,$callback,$widgettyp);

while($zeile = &lt;INFILE&gt;) {
  chop($zeile);
  if ($zeile !~ /^#.*$/) {

    if ($zeile =~ /^void.*$/) {
      chomp($fz1 = &lt;INFILE&gt;);
      chomp($fz2 = &lt;INFILE&gt;);

      if ($fz1 =~ /([^\ ]+)\ +\(([^\ ]+)\ +\*([^\ ]+),$/) {
        $callback  = $1;
        $widgettyp = $2;

        print "procedure $callback(widget : p$widgettyp;  data : pgpointer ); cdecl;\n";
        print "{ var ... }\n";
        print "begin\n";
        print "  (* automagic *)\n";
        print "end;\n\n";
      }

    }

  }
}
close(INFILE);

exit;
# -----------------------------------------------------------------------------
</pre></body></html>