Somewhat working auto3 on Linux, still needs some minor fixing

Originally committed to SVN as r1167.
This commit is contained in:
Niels Martin Hansen 2007-05-07 16:44:26 +00:00
parent d3bf280993
commit b3c15d8d2e
7 changed files with 27 additions and 17 deletions

View file

@ -1,5 +1,5 @@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
SUBDIRS = ac automation FexTrackerSource csri aegisub locale SUBDIRS = ac auto3 automation FexTrackerSource csri aegisub locale
lua51/src/liblua.a: lua51/src/liblua.a:
make -C lua51/src CC=$(CXX) a make -C lua51/src CC=$(CXX) a

View file

@ -8,7 +8,7 @@ SUBDIRS = bitmaps posix
bin_PROGRAMS = aegisub 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)) DARCSREV := $(strip $(shell head -n 1 ../_darcs/inventory 2>/dev/null))
REVISION := $(if $(SVNREV),-DBUILD_SVN_REVISION=$(SVNREV)) $(if $(DARCSREV),-DBUILD_DARCS) REVISION := $(if $(SVNREV),-DBUILD_SVN_REVISION=$(SVNREV)) $(if $(DARCSREV),-DBUILD_DARCS)
BUILDINFO := -DBUILD_CREDIT="\"$(shell whoami)\"" $(REVISION) BUILDINFO := -DBUILD_CREDIT="\"$(shell whoami)\"" $(REVISION)
@ -44,7 +44,7 @@ aegisub_LDADD += ../lua51/src/liblua.a
endif endif
if WITH_AUTO3 if WITH_AUTO3
AUTOMATION += auto4_auto3.cpp AUTOMATION += auto4_auto3.cpp
## FIXME: also link to whatever lib here aegisub_LDADD += ../auto3/libaegisub-auto3.la
endif endif
if WITH_AUTO4_RUBY if WITH_AUTO4_RUBY
AUTOMATION += auto4_ruby_assfile.cpp auto4_ruby.cpp auto4_ruby_dialog.cpp AUTOMATION += auto4_ruby_assfile.cpp auto4_ruby.cpp auto4_ruby_dialog.cpp

View file

@ -562,7 +562,7 @@ namespace Automation4 {
if (script) Destroy(); 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) 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; double resx, resy, resd, resl;
@ -622,7 +622,7 @@ namespace Automation4 {
wfn[wfnlen] = 0; wfn[wfnlen] = 0;
return wfn; return wfn;
#else #else
return Auto3Strdup(fname.GetFullPath().mb_str(wxConvFilename)); return Auto3Strdup(fname.GetFullPath().fn_str());
#endif #endif
} }
@ -673,7 +673,7 @@ namespace Automation4 {
cb.ms_from_frame = MsFromFrame; cb.ms_from_frame = MsFromFrame;
char *errormsg = 0; 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) { if (script) {
assert(errormsg == 0); assert(errormsg == 0);

View file

@ -150,7 +150,7 @@ namespace Automation4 {
Auto3Interpreter *script; Auto3Interpreter *script;
static filename_t ResolveInclude(void *cbdata, const char *incname); 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, int spacing, float scale_x, float scale_y, int encoding,
float *out_width, float *out_height, float *out_descent, float *out_extlead); float *out_width, float *out_height, float *out_descent, float *out_extlead);
static int FrameFromMs(void *cbdata, int ms); static int FrameFromMs(void *cbdata, int ms);

View file

@ -34,12 +34,12 @@
// //
#include "auto3.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "auto3.h"
// Win32 DLL entry point // Win32 DLL entry point
#ifdef WIN32 #ifdef WIN32
@ -67,11 +67,11 @@ struct script_reader_data {
static const char *script_reader_func(lua_State *L, void *data, size_t *size) static const char *script_reader_func(lua_State *L, void *data, size_t *size)
{ {
struct script_reader_data *self; struct script_reader_data *self;
char *b; unsigned char *b;
FILE *f; FILE *f;
self = (struct script_reader_data *)(data); self = (struct script_reader_data *)(data);
b = self->databuf; b = (unsigned char *)self->databuf;
f = self->f; f = self->f;
if (feof(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 // can't support these files
*size = 0; *size = 0;
self->isfirst = -1; self->isfirst = -1;
strcpy(b, "File is an unsupported UTF"); strcpy(self->databuf, "File is an unsupported UTF");
return NULL; return NULL;
} }
// assume utf8 without bom, and rewind file // assume utf8 without bom, and rewind file

View file

@ -35,6 +35,7 @@
#pragma once #pragma once
#include <stdlib.h>
#ifdef AUTO3LIB #ifdef AUTO3LIB
#include "lua/include/lua.h" #include "lua/include/lua.h"
#include "lua/include/lualib.h" #include "lua/include/lualib.h"
@ -61,10 +62,18 @@ typedef char* filename_t;
#ifndef AUTO3LIB #ifndef AUTO3LIB
// Definitions used when building Aegisub (ie. importing the symbols) // Definitions used when building Aegisub (ie. importing the symbols)
// I believe GCC also knows about __declspec(dllimport) etc. and does something sensible with it // 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 #else
// Otherwise we're exporting the symbols // 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 #endif
@ -146,7 +155,7 @@ struct Auto3Callbacks {
// The result must be allocated with Auto3Malloc and will be free'd by the lib // The result must be allocated with Auto3Malloc and will be free'd by the lib
filename_t (*resolve_include)(void *cbdata, const char *incname); filename_t (*resolve_include)(void *cbdata, const char *incname);
// Get sizing information for a text string given a style // 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, int spacing, float scale_x, float scale_y, int encoding,
float *out_width, float *out_height, float *out_descent, float *out_extlead); float *out_width, float *out_height, float *out_descent, float *out_extlead);
// Convert a time in milliseconds to a video frame number // Convert a time in milliseconds to a video frame number

View file

@ -14,7 +14,7 @@ CHECK_GNU_MAKE
AC_PROG_CC AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
AC_LANG(C++) AC_LANG(C++)
AC_PROG_RANLIB AC_PROG_LIBTOOL
AC_PATH_PROGS(CONVERT, [convert], []) AC_PATH_PROGS(CONVERT, [convert], [])
if test -z "$CONVERT"; then 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_RUBY], [test "$with_ruby" != "no"])
AM_CONDITIONAL([WITH_AUTO4_LUA], [true]) AM_CONDITIONAL([WITH_AUTO4_LUA], [true])
dnl TODO: Make the auto3 lib build on non-Win32 so this can be 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([ AC_OUTPUT([
Makefile Makefile
ac/Makefile ac/Makefile
auto3/Makefile
automation/Makefile automation/Makefile
FexTrackerSource/Makefile FexTrackerSource/Makefile
locale/Makefile locale/Makefile