This example both shows the new enum literal facility, and is a regression

test against the enum scoping problem I had.

Ocaml.cxx: Accidentally reintroduced the enum scoping problem, so I added
an example that will fail if this is ever broken again.

I encountered the actual problem in avifile.h


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5478 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Art Yerkes 2003-12-04 06:57:57 +00:00
commit 87f4bcef2e
6 changed files with 67 additions and 6 deletions

View file

@ -0,0 +1,33 @@
TOP = ../..
SWIG = $(TOP)/../swig
SRCS =
TARGET = example
INTERFACE = example.i
MLFILE = example.ml
PROGFILE = example_prog.ml
OBJS =
all:: static
dynamic::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic_cpp
static::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp
toplevel::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp_toplevel
clean::
$(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean
check: all

View file

@ -0,0 +1 @@
This tests our handling of scoped enums. Run with argument Tag1 or Tag2.

View file

@ -0,0 +1,7 @@
%module example
%{
#include "foo.h"
%}
%include "foo.h"

View file

@ -0,0 +1,4 @@
open Swig
open Example
let _ = _f (match Sys.argv.(1) with "Tag1" -> ``Tag1 | "Tag2" -> ``Tag2)

View file

@ -0,0 +1,5 @@
namespace foo {
enum Bar { Tag1, Tag2 };
static void f( Bar b ) { printf( "b = %d\n", (int)b ); }
}