Dongxu Ma > Parse-QTEDI > bin/format_qtedi_production

Download:
Parse-QTEDI-0.20.1.tar.gz

Annotate this POD

View/Report Bugs
Source  

DESCIPTION ^

Format production from Parse::QTEDI into more binding-make-specific look. This will both strip unrelevant entry and renew the structure of other interested entries.

NOTE: All new hash keys inserted here will be uppercase to differentiate with QTEDI output, except meta field such as 'subtype'.

ELEMENTS ^

Format functions.

$FUNCTION_PROPERTIES

Keep all known C++ function and QT-specific property keywords.

Function format will firstly filter out them from prototype line.

NOTE: Some properties are stored inside 'PROPERTY' field array for futher reference.

NOTE: Q_DECL_EXPORT == __attribute((visibility(default)))__ in gcc.

__format_macro

Keep Q_OBJECT and Q_PROPERTY for further consideration.

Each property field inside a Q_PROPERTY will be stored as a new key/value pair.

  # spec of Q_PROPERTY

  ---
  name : [from_QTEDI]
  type : macro
  NAME : [name]
  TYPE : [type]
  READ : [read function]
  WRITE: [write function]
  ...
__format_class

Extract class name string and store as new field. Recursively process class body, strip private part.

Format inheritance line if has.

  # spec

  ---
  type     : class
  PROPERTY :
     - [class property1]
     ...
  NAME     : [name]
  ISA      :
     - NAME         : [parent class name]
       RELATIONSHIP : public/private/protected
     ...
  BODY     :
     ...
  VARIABLE :
     - [variable1]
     ...
__format_struct

Similar as __format_class.

NOTE: As defined in C++, top entries not covered by any public/private/protected keyword will be treated private.

See __format_class above regarding output spec.

__format_union

Similar as __format_struct.

See __format_class above regarding output spec.

__normalize

Normalize type or function pointer string.

__format_fpointer

Format a function pointer entry.

  # spec

  ---
  type          : fpointer
  PROPERTY      :
     - [function property1]
     ...
  NAME          : [T_FPOINTER_BLAH]
  NAME_ORIGIN   : [BLAH]
  PROTOTYPE     : [prototype string]
  DEFAULT_VALUE : [default value, mostly 0]
  FPOINTERINFO  :
     - NAME      : [same as NAME above]
                   [could be a ref to inner FPOINTERINFO structure
                    in case of function pointer which returns
                    another function pointer                      ]
     - RETURN    : [similar as in function]
     - PARAMETER : [similar as in function]
__format_function

Format a function entry. Extract return type, function name and all parameters from function entry from QTEDI.

  # spec

  ---
  type      : function
  subtype   : 1/0 [is operator or not]
  PROPERTY  :
     - [function property1]
     ...
  NAME      : [name]
  RETURN    : [return type]
  PARAMETER :
     - TYPE          : [param1 type]
                       [NOTE: could be '...' in ansi]
       NAME          : [param1 name]
       DEFAULT_VALUE : [param1 default value]
     ...
__format_enum

Format enum, normalize name, property and enum value entries.

  # spec

  ---
  type     : enum
  NAME     : [name]
  PROPERTY :
     - [enum property1]
     ...
  VALUE    :
     - [enum value1]
     ...
  VARIABLE :
     - [variable1]
     ...
__format_accessibility

Format accessibility, normalize value entries.

NOTE: private type should not appear here since being stripped.

  # spec

  ---
  type     : accessibility
  VALUE    :
     - [accessibility keyword1]
     ...
__format_typedef

Format typedef, normalize value entry.

Value entry could be of type:

  1. typedef simple type C<< typedef A B; >>
  2. typedef (anonymous) class/struct/enum/union C<< typdef enum A { } B; >>
  3. typedef function pointer C<< typedef void (*P)(int, uint); >>
  4. typedef an array C<< typedef unsigned char Digest[16]; >>

  # spec

  ---
  type      : typedef
  subtype   : class/struct/enum/union/fpointer/simple
  FROM      : [from type name for simple typedef    ]
              [a hashref for class/struct/enum/union]
              [type alias for function pointer      ]
  TO        : [to type name]
              [original name of function pointer    ]
  PROTOTYPE : [prototype string of function pointer ]
__format_extern

Format extern type body.

  # spec

  ---
  type    : extern
  subtype : C/function/expression/class/struct/union/enum
  BODY    :
     ...

NOTE: For subtype C, there will be more than one entry in BODY field array. For others, just one.

__format_namespace

Format namespace code block. Normalize name and recursively format body entries.

  # spec

  ---
  type     : namespace
  NAME     : [namespace name]
  PROPERTY :
     - [property1]
     ...
  BODY     :
     ...
__format_expression

Format expression.

NOTE: currently expression is stripped.

  # spec

  ---
  type  : expression
  value : [expression line]

COPYRIGHT AND LICENSE ^

Copyright (C) 2007 - 2011 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

syntax highlighting: