#include <netinet/in.h>
#include <sys/un.h>
-#include <apr-1/apr_thread_proc.h>
+#include <apr_thread_proc.h>
#include <fcntl.h>
#include <unistd.h>
*/
/* }}} */
-#define _GNU_SOURCE
-
#include "cycript.hpp"
#include <cstdio>
if (optind == argc)
script = NULL;
else {
+#ifdef CY_EXECUTE
// XXX: const_cast?! wtf gcc :(
CYSetArgs(argc - optind - 1, const_cast<const char **>(argv + optind + 1));
+#endif
script = argv[optind];
if (strcmp(script, "-") == 0)
script = NULL;
all += Cycript.$(dll) #cyrver
arch := iphoneos-arm
+ldid := ldid -S
+link += -framework UIKit
Cycript.$(dll): Connector.o
$(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
-lobjc -lapr-1 -lsubstrate \
-framework CoreFoundation
ldid -S $@
+
+cyrver: Server.o
+ $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
+ -lapr-1 -lsubstrate -framework CFNetwork
+ $(ldid) $@
-dll := dylib
-
# XXX: objective-c exists on non-Darwin
+dll := dylib
header += Struct.hpp ObjectiveC.hpp
code += ObjectiveC.o Library.o
filters += ObjC
flags += -DCY_ATTACH -DCY_EXECUTE
+flags += -lobjc -framework CoreFoundation
+link += -framework Foundation
+library += -install_name /usr/lib/libcycript.$(dll)
+library += -framework Foundation -framework CFNetwork
+library += -framework JavaScriptCore -framework WebCore
Struct.hpp:
$$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
-export PATH :=/usr/local/bin:$(PATH)
-
+export PATH := /usr/local/bin:$(PATH)
flags += -I/usr/local/include -I/usr/local/include/webkit-1.0
#include "Parser.hpp"
#include "Cycript.tab.hh"
-#include <apr-1/apr_thread_proc.h>
+#include <apr_thread_proc.h>
#undef _assert
#undef _trace
@end
-CYRange DigitRange_ (0x3ff000000000000LLU, 0x000000000000000LLU); // 0-9
-CYRange WordStartRange_(0x000001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$
-CYRange WordEndRange_ (0x3ff001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$0-9
-
#define CYTry \
@try
#define CYCatch \
{NULL, NULL, 0}
};
-CYDriver::CYDriver(const std::string &filename) :
- state_(CYClear),
- data_(NULL),
- size_(0),
- file_(NULL),
- strict_(false),
- filename_(filename),
- program_(NULL)
-{
- ScannerInit();
-}
-
-CYDriver::~CYDriver() {
- ScannerDestroy();
-}
-
-void CYDriver::Warning(const cy::location &location, const char *message) {
- if (!strict_)
- return;
-
- CYDriver::Error error;
- error.warning_ = true;
- error.location_ = location;
- error.message_ = message;
- errors_.push_back(error);
-}
-
-void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
- CYDriver::Error error;
- error.warning_ = false;
- error.location_ = location;
- error.message_ = message;
- driver.errors_.push_back(error);
-}
-
void CYSetArgs(int argc, const char *argv[]) {
JSContextRef context(CYGetJSContext());
JSValueRef args[argc];
--- /dev/null
+export PATH := /usr/local/bin:$(PATH)
+flags += -I/usr/include/webkit-1.0
+flags += -fPIC
--- /dev/null
+#include "Parser.hpp"
+#include "Cycript.tab.hh"
+
+CYRange DigitRange_ (0x3ff000000000000LLU, 0x000000000000000LLU); // 0-9
+CYRange WordStartRange_(0x000001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$
+CYRange WordEndRange_ (0x3ff001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$0-9
+
+CYDriver::CYDriver(const std::string &filename) :
+ state_(CYClear),
+ data_(NULL),
+ size_(0),
+ file_(NULL),
+ strict_(false),
+ filename_(filename),
+ program_(NULL)
+{
+ ScannerInit();
+}
+
+CYDriver::~CYDriver() {
+ ScannerDestroy();
+}
+
+void CYDriver::Warning(const cy::location &location, const char *message) {
+ if (!strict_)
+ return;
+
+ CYDriver::Error error;
+ error.warning_ = true;
+ error.location_ = location;
+ error.message_ = message;
+ errors_.push_back(error);
+}
+
+void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
+ CYDriver::Error error;
+ error.warning_ = false;
+ error.location_ = location;
+ error.message_ = message;
+ driver.errors_.push_back(error);
+}
#ifndef CYPOOLING_HPP
#define CYPOOLING_HPP
-#include <apr-1/apr_pools.h>
-#include <apr-1/apr_strings.h>
+#include <apr_pools.h>
+#include <apr_strings.h>
#include <minimal/stdlib.h>
#include <Pooling.hpp>
-#include <apr-1/apr_thread_proc.h>
+#include <apr_thread_proc.h>
#include <CoreFoundation/CFLogUtilities.h>
#include <CFNetwork/CFNetwork.h>
#include <JavaScriptCore/JavaScript.h>
-#include <apr-1/apr_pools.h>
+#include <apr_pools.h>
#include <ffi.h>
#include <sig/types.hpp>
#flags := -g3 -O0 -DYYDEBUG=1
flags := -g0 -O3
-flags += -Wall -Werror -I. -fno-common
+flags += -Wall -Werror -Wno-parentheses -I. -fno-common
+flags += -I$(shell apr-1-config --includedir)
svn := $(shell svnversion)
-filters := C
-
all:
all := libcycript.plist cycript
endif
header := Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
-code := ffi_type.o parse.o Replace.o Output.o Cycript.tab.o lex.cy.o Network.o
+code := ffi_type.o parse.o
+code += Replace.o Output.o
+code += Cycript.tab.o lex.cy.o
+code += Network.o Parser.o
+filters := C
+ldid := echo
dll := so
+apr := $(shell apr-1-config --link-ld)
+library := $(apr) -lffi #-lsubstrate
+link := $(apr) -lreadline
uname_s := $(shell uname -s)
uname_p := $(shell uname -p)
%.o: %.mm $(header)
$(target)g++ $(flags) -c -o $@ $<
-cyrver: Server.o
- $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
- -lobjc -lapr-1 -lsubstrate \
- -framework CoreFoundation -framework CFNetwork
- ldid -S $@
-
libcycript.$(dll): $(code)
- $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
- -install_name /usr/lib/libcycript.$(dll) \
- -lobjc -lapr-1 -lffi -lsubstrate \
- -framework CoreFoundation -framework Foundation \
- -framework CFNetwork \
- -framework JavaScriptCore -framework WebCore
- ldid -S $@
+ $(target)g++ $(flags) -shared -dynamiclib -o $@ $(filter %.o,$^) $(library)
+ $(ldid) -S $@
cycript: Console.o libcycript.$(dll)
- $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
- -lobjc -lapr-1 -lreadline \
- -L. -lcycript \
- -framework Foundation -framework CoreFoundation \
- -framework JavaScriptCore -framework UIKit
- ldid -S cycript
+ $(target)g++ $(flags) -o $@ $(filter %.o,$^) -L. -lcycript $(link)
+ $(ldid) -S cycript
package: $(deb)
#ifndef SIG_FFI_TYPE_H
#define SIG_FFI_TYPE_H
-#include <apr-1/apr_pools.h>
+#include <apr_pools.h>
#include <ffi.h>
#include "sig/types.hpp"
#include "minimal/stdlib.h"
-#include <apr-1/apr_strings.h>
+#include <apr_strings.h>
#include <string.h>
#include "sig/types.hpp"
-#include <apr-1/apr_pools.h>
+#include <apr_pools.h>
namespace sig {