diff --git a/Makefile.am b/Makefile.am index 7283c670d..a213a2ab4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ AUTOMAKE_OPTIONS = foreign -SUBDIRS = ac automation FexTrackerSource csri aegisub locale +SUBDIRS = ac auto3 automation FexTrackerSource csri aegisub locale lua51/src/liblua.a: make -C lua51/src CC=$(CXX) a diff --git a/aegisub/Makefile.am b/aegisub/Makefile.am index 730413b62..119617d4e 100644 --- a/aegisub/Makefile.am +++ b/aegisub/Makefile.am @@ -8,7 +8,7 @@ SUBDIRS = bitmaps posix bin_PROGRAMS = aegisub -SVNREV := $(shell svnversion | sed 's/[^0-9]//') +SVNREV := $(shell svnversion | sed 's/[^0-9].*//') DARCSREV := $(strip $(shell head -n 1 ../_darcs/inventory 2>/dev/null)) REVISION := $(if $(SVNREV),-DBUILD_SVN_REVISION=$(SVNREV)) $(if $(DARCSREV),-DBUILD_DARCS) BUILDINFO := -DBUILD_CREDIT="\"$(shell whoami)\"" $(REVISION) @@ -44,7 +44,7 @@ aegisub_LDADD += ../lua51/src/liblua.a endif if WITH_AUTO3 AUTOMATION += auto4_auto3.cpp -## FIXME: also link to whatever lib here +aegisub_LDADD += ../auto3/libaegisub-auto3.la endif if WITH_AUTO4_RUBY AUTOMATION += auto4_ruby_assfile.cpp auto4_ruby.cpp auto4_ruby_dialog.cpp diff --git a/aegisub/auto4_auto3.cpp b/aegisub/auto4_auto3.cpp index 6fe4f2e5b..1f54805ea 100644 --- a/aegisub/auto4_auto3.cpp +++ b/aegisub/auto4_auto3.cpp @@ -562,7 +562,7 @@ namespace Automation4 { if (script) Destroy(); } - void Auto3Script::TextExtents(void *cbdata, char *text, char *fontname, int fontsize, int bold, int italic, int spacing, + void Auto3Script::TextExtents(void *cbdata, const char *text, const char *fontname, int fontsize, int bold, int italic, int spacing, float scale_x, float scale_y, int encoding, float *out_width, float *out_height, float *out_descent, float *out_extlead) { double resx, resy, resd, resl; @@ -622,7 +622,7 @@ namespace Automation4 { wfn[wfnlen] = 0; return wfn; #else - return Auto3Strdup(fname.GetFullPath().mb_str(wxConvFilename)); + return Auto3Strdup(fname.GetFullPath().fn_str()); #endif } @@ -673,7 +673,7 @@ namespace Automation4 { cb.ms_from_frame = MsFromFrame; char *errormsg = 0; - script = CreateAuto3Script((const filename_t)GetFilename().fn_str(), GetPrettyFilename().mb_str(wxConvUTF8), &cb, &errormsg); + script = CreateAuto3Script((const filename_t)GetFilename().fn_str().data(), GetPrettyFilename().mb_str(wxConvUTF8).data(), &cb, &errormsg); if (script) { assert(errormsg == 0); diff --git a/aegisub/auto4_auto3.h b/aegisub/auto4_auto3.h index cff77ad45..ced63766a 100644 --- a/aegisub/auto4_auto3.h +++ b/aegisub/auto4_auto3.h @@ -150,7 +150,7 @@ namespace Automation4 { Auto3Interpreter *script; static filename_t ResolveInclude(void *cbdata, const char *incname); - static void TextExtents(void *cbdata, char *text, char *fontname, int fontsize, int bold, int italic, + static void TextExtents(void *cbdata, const char *text, const char *fontname, int fontsize, int bold, int italic, int spacing, float scale_x, float scale_y, int encoding, float *out_width, float *out_height, float *out_descent, float *out_extlead); static int FrameFromMs(void *cbdata, int ms); diff --git a/auto3/auto3.c b/auto3/auto3.c index d62ee27da..297c34ce3 100644 --- a/auto3/auto3.c +++ b/auto3/auto3.c @@ -34,12 +34,12 @@ // -#include "auto3.h" - #include #include #include +#include "auto3.h" + // Win32 DLL entry point #ifdef WIN32 @@ -67,11 +67,11 @@ struct script_reader_data { static const char *script_reader_func(lua_State *L, void *data, size_t *size) { struct script_reader_data *self; - char *b; + unsigned char *b; FILE *f; self = (struct script_reader_data *)(data); - b = self->databuf; + b = (unsigned char *)self->databuf; f = self->f; if (feof(f)) { @@ -100,7 +100,7 @@ static const char *script_reader_func(lua_State *L, void *data, size_t *size) // can't support these files *size = 0; self->isfirst = -1; - strcpy(b, "File is an unsupported UTF"); + strcpy(self->databuf, "File is an unsupported UTF"); return NULL; } // assume utf8 without bom, and rewind file diff --git a/auto3/auto3.h b/auto3/auto3.h index 83e82acf8..24a26cb31 100644 --- a/auto3/auto3.h +++ b/auto3/auto3.h @@ -35,6 +35,7 @@ #pragma once +#include #ifdef AUTO3LIB #include "lua/include/lua.h" #include "lua/include/lualib.h" @@ -61,10 +62,18 @@ typedef char* filename_t; #ifndef AUTO3LIB // Definitions used when building Aegisub (ie. importing the symbols) // I believe GCC also knows about __declspec(dllimport) etc. and does something sensible with it -#define AUTO3_API __declspec(dllimport) +# ifdef _MSC_VER +# define AUTO3_API __declspec(dllimport) +# else +# define AUTO3_API +# endif #else // Otherwise we're exporting the symbols -#define AUTO3_API __declspec(dllexport) +# ifdef _MSC_VER +# define AUTO3_API __declspec(dllexport) +# else +# define AUTO3_API +# endif #endif @@ -146,7 +155,7 @@ struct Auto3Callbacks { // The result must be allocated with Auto3Malloc and will be free'd by the lib filename_t (*resolve_include)(void *cbdata, const char *incname); // Get sizing information for a text string given a style - void (*text_extents)(void *cbdata, char *text, char *fontname, int fontsize, int bold, int italic, + void (*text_extents)(void *cbdata, const char *text, const char *fontname, int fontsize, int bold, int italic, int spacing, float scale_x, float scale_y, int encoding, float *out_width, float *out_height, float *out_descent, float *out_extlead); // Convert a time in milliseconds to a video frame number diff --git a/configure.ac b/configure.ac index edf3fe284..576fe9d0c 100644 --- a/configure.ac +++ b/configure.ac @@ -14,7 +14,7 @@ CHECK_GNU_MAKE AC_PROG_CC AC_PROG_CXX AC_LANG(C++) -AC_PROG_RANLIB +AC_PROG_LIBTOOL AC_PATH_PROGS(CONVERT, [convert], []) if test -z "$CONVERT"; then @@ -213,11 +213,12 @@ dnl but the lib isn't detected.) AM_CONDITIONAL([WITH_AUTO4_RUBY], [test "$with_ruby" != "no"]) AM_CONDITIONAL([WITH_AUTO4_LUA], [true]) dnl TODO: Make the auto3 lib build on non-Win32 so this can be true -AM_CONDITIONAL([WITH_AUTO3], [false]) +AM_CONDITIONAL([WITH_AUTO3], [true]) AC_OUTPUT([ Makefile ac/Makefile + auto3/Makefile automation/Makefile FexTrackerSource/Makefile locale/Makefile