very weird macro problem... leads to Empty character constant error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

very weird macro problem... leads to Empty character constant error

Julien Boeuf

I'm having a very weird problem with swig 1.32rc1 python. I tried to
reduce the problems as much as possible but the only thing I could get
to is the following.

Here's my example.h file:

typedef unsigned long AP4_UI32;

#define AP4_ATOM_TYPE(a,b,c,d)  \
   ((((AP4_UI32)a)<<24) |  \
    (((AP4_UI32)b)<<16) |  \
    (((AP4_UI32)c)<< 8) |  \
    (((AP4_UI32)d)    ))

|   atom types
//const AP4_UI32 AP4_ATOM_TYPE_UDTA = AP4_ATOM_TYPE('u','d','t','a');
const AP4_UI32 AP4_ATOM_TYPE_URL  = AP4_ATOM_TYPE('u','r','l',' ');
const AP4_UI32 AP4_ATOM_TYPE_TRAK = AP4_ATOM_TYPE('t','r','a','k');
const AP4_UI32 AP4_ATOM_TYPE_TKHD = AP4_ATOM_TYPE('t','k','h','d');
const AP4_UI32 AP4_ATOM_TYPE_STTS = AP4_ATOM_TYPE('s','t','t','s');
const AP4_UI32 AP4_ATOM_TYPE_STSZ = AP4_ATOM_TYPE('s','t','s','z');
const AP4_UI32 AP4_ATOM_TYPE_STSS = AP4_ATOM_TYPE('s','t','s','s');
const AP4_UI32 AP4_ATOM_TYPE_STSD = AP4_ATOM_TYPE('s','t','s','d');
const AP4_UI32 AP4_ATOM_TYPE_STSC = AP4_ATOM_TYPE('s','t','s','c');
const AP4_UI32 AP4_ATOM_TYPE_STCO = AP4_ATOM_TYPE('s','t','c','o');
//const AP4_UI32 AP4_ATOM_TYPE_CO64 = AP4_ATOM_TYPE('c','o','6','4');
const AP4_UI32 AP4_ATOM_TYPE_STBL = AP4_ATOM_TYPE('s','t','b','l');
const AP4_UI32 AP4_ATOM_TYPE_SINF = AP4_ATOM_TYPE('s','i','n','f');
//const AP4_UI32 AP4_ATOM_TYPE_SCHM = AP4_ATOM_TYPE('s','c','h','m');
//const AP4_UI32 AP4_ATOM_TYPE_SCHI = AP4_ATOM_TYPE('s','c','h','i');
const AP4_UI32 AP4_ATOM_TYPE_MVHD = AP4_ATOM_TYPE('m','v','h','d');
const AP4_UI32 AP4_ATOM_TYPE_MP4S = AP4_ATOM_TYPE('m','p','4','s');
const AP4_UI32 AP4_ATOM_TYPE_MP4A = AP4_ATOM_TYPE('m','p','4','a');

and here's my example.i file:
%module example

#include "example.h"

%include "example.h"

Now if I uncomment the first atom type line: AP4_ATOM_TYPE_UDTA, I get
the following error:

$ swig -o -python -c++ -Wall -Werror example.i
example.h:12: Error: Empty character constant
example.h:12: Error: Syntax error in input(1).

Now, if I replace the (a,b,c,d) parameters in the macro by
(c1,c2,c3,c4), I can uncomment all the atom types and it will work
without any problem.

Does anybody have an idea about what's going on?

Thanks much,


PS I tried to find some kind of pattern for those constants that don't
work with the (a,b,c,d) params in the macro but without much success.
The only thing I was able to find was that they at least contain the
letter 'a', 'b', 'c' or 'd'

This email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>
Swig-user mailing list
[hidden email]