#! /usr/bin/env python

from Synopsis import config
from Synopsis.process import process
from Synopsis.Processor import *
from Synopsis.Processors import *
from Synopsis.Parsers import Cxx

from distutils import sysconfig
import sys, os, os.path

srcdir = '@srcdir@'
topdir = os.path.dirname(srcdir)

cppflags = ['-I.',
            '-I%s'%(srcdir + '/Synopsis/gc/include'),
            '-I%s'%(srcdir),
            '-I%s'%(sysconfig.get_python_inc())]

cxx = Cxx.Parser(base_path = srcdir + os.sep,
                 cppflags = cppflags,
                 sxr_prefix = 'sxr')

cxx_sxr = Cxx.Parser(base_path = topdir + os.sep,
                     cppflags = cppflags,
                     sxr_prefix = 'sxr')

link = Linker(MacroFilter(pattern=r'^Synopsis_(.*)_hh_$'),
              Comments.Translator(markup='rst',
                                  filter = Comments.SSDFilter()),
              sxr_prefix = 'sxr')

process(cxx = cxx,
        cxx_sxr = cxx_sxr,
        link = link)
