Author image Dongxu Ma
and 1 contributors

NAME

Parse::QTEDI - Parse QT/KDE preprocessed headers

SYNOPSIS

  use Parse::QTEDI qw($parser);
  defined $parser->begin($in) or warn "parse failed";

COMMANDLINE USAGE

  $cp header.h header.h.bak                                 # backup
  $sed -i -e 's/#include/ d' -e 's/#error/ d' header.h      # strip
  $gcc -E -imacros config.h -DBLAH_BLAH header.h > header.i # pre-process
  $parse_qtedi_header header.i > production.qtedi           # parse
  # optional 
  # format into a binding-make-specific spec
  $format_qtedi_production production.qtedi > formatted.txt # format

DESCRIPTION

Parse QT/KDE preprocessed headers to generate interface information.

WHAT IS INPUT

input stream should be the output of a preprocessor like `gcc -E -DBLAH_BLAH'.

NOTE: Normally one should strip #include and #error directives before invoking preprocessor, or else preprocessor will expand all include directives encountered and croak on error progma.

WHAT IS OUTPUT

YAML-ish output to STDOUT; debug info to STDERR if $DEBUG defined.

WHY IS PREPROCESSED

To solve macro, basically. There are both arch-specific and feature-specific macros. One should decide which feature-specific ones to enable. Besides, modern libtool normally records compile-time commandline options for later reference.

HOW TO DEBUG

Defining $Parse::QTEDI::DEBUG to true will enable parse-level debug information to STDERR.

NOTE: set at the BEGIN section of your code before using this module.

WHAT ABOUT THE NAME

QTEDI is QT and QT-basEd Desktop environment Interface ;-)

EXPORT

An instance of Parse::RecDescent on demand

BUG AND TODO

1. handle of __attribute__ pragma in expression

SEE ALSO

output spec and other dev info http://code.google.com/p/dongxu/wiki/QTEDI

my Perl QT4 binding project page http://code.google.com/p/dongxu/wiki/PerlQT

AUTHOR

Dongxu Ma, <dongxu.ma@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2007 by Dongxu Ma <dongxu@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/artistic.html