--- /dev/null
+/* Cycript - Optimizing JavaScript Compiler/Runtime
+ * Copyright (C) 2009-2015 Jay Freeman (saurik)
+*/
+
+/* GNU Affero General Public License, Version 3 {{{ */
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
+#include "cycript.hpp"
+
+#include "Driver.hpp"
+#include "Cycript.tab.hh"
+#include "Replace.hpp"
+#include "String.hpp"
+
+static CYExpression *ParseExpression(CYUTF8String code) {
+ std::stringstream stream;
+ stream << '(' << code << ')';
+ CYDriver driver(stream);
+
+ cy::parser parser(driver);
+ if (parser.parse() != 0 || !driver.errors_.empty())
+ return NULL;
+
+ CYOptions options;
+ CYContext context(options);
+
+ CYStatement *statement(driver.program_->code_);
+ _assert(statement != NULL);
+ _assert(statement->next_ == NULL);
+
+ CYExpress *express(dynamic_cast<CYExpress *>(driver.program_->code_));
+ _assert(express != NULL);
+
+ CYParenthetical *parenthetical(dynamic_cast<CYParenthetical *>(express->expression_));
+ _assert(parenthetical != NULL);
+
+ return parenthetical->expression_;
+}
+
+_visible char **CYComplete(const char *word, const std::string &line, CYUTF8String (*run)(CYPool &pool, const std::string &)) {
+ CYLocalPool pool;
+
+ std::istringstream stream(line);
+ CYDriver driver(stream);
+
+ driver.auto_ = true;
+
+ cy::parser parser(driver);
+ if (parser.parse() != 0 || !driver.errors_.empty())
+ return NULL;
+
+ if (driver.mode_ == CYDriver::AutoNone)
+ return NULL;
+
+ CYExpression *expression;
+
+ CYOptions options;
+ CYContext context(options);
+
+ std::ostringstream prefix;
+
+ switch (driver.mode_) {
+ case CYDriver::AutoPrimary:
+ expression = $ CYThis();
+ break;
+
+ case CYDriver::AutoDirect:
+ expression = driver.context_;
+ break;
+
+ case CYDriver::AutoIndirect:
+ expression = $ CYIndirect(driver.context_);
+ break;
+
+ case CYDriver::AutoMessage: {
+ CYDriver::Context &thing(driver.contexts_.back());
+ expression = $M($C1($V("object_getClass"), thing.context_), $S("messages"));
+ for (CYDriver::Context::Words::const_iterator part(thing.words_.begin()); part != thing.words_.end(); ++part)
+ prefix << (*part)->word_ << ':';
+ } break;
+
+ default:
+ _assert(false);
+ }
+
+ std::string begin(prefix.str());
+
+ driver.program_ = $ CYProgram($ CYExpress($C3(ParseExpression(
+ " function(object, prefix, word) {\n"
+ " var names = [];\n"
+ " var before = prefix.length;\n"
+ " prefix += word;\n"
+ " var entire = prefix.length;\n"
+ " for (var name in object)\n"
+ " if (name.substring(0, entire) == prefix)\n"
+ " names.push(name.substr(before));\n"
+ " return names;\n"
+ " }\n"
+ ), expression, $S(begin.c_str()), $S(word))));
+
+ driver.program_->Replace(context);
+
+ std::stringbuf str;
+ CYOutput out(str, options);
+ out << *driver.program_;
+
+ std::string code(str.str());
+ CYUTF8String json(run(pool, code));
+ // XXX: if this fails we should not try to parse it
+
+ CYExpression *result(ParseExpression(json));
+ if (result == NULL)
+ return NULL;
+
+ CYArray *array(dynamic_cast<CYArray *>(result->Primitive(context)));
+ if (array == NULL)
+ return NULL;
+
+ // XXX: use an std::set?
+ typedef std::vector<std::string> Completions;
+ Completions completions;
+
+ std::string common;
+ bool rest(false);
+
+ CYForEach (element, array->elements_) {
+ CYString *string(dynamic_cast<CYString *>(element->value_));
+ _assert(string != NULL);
+
+ std::string completion;
+ if (string->size_ != 0)
+ completion.assign(string->value_, string->size_);
+ else if (driver.mode_ == CYDriver::AutoMessage)
+ completion = "]";
+ else
+ continue;
+
+ completions.push_back(completion);
+
+ if (!rest) {
+ common = completion;
+ rest = true;
+ } else {
+ size_t limit(completion.size()), size(common.size());
+ if (size > limit)
+ common = common.substr(0, limit);
+ else
+ limit = size;
+ for (limit = 0; limit != size; ++limit)
+ if (common[limit] != completion[limit])
+ break;
+ if (limit != size)
+ common = common.substr(0, limit);
+ }
+ }
+
+ size_t count(completions.size());
+ if (count == 0)
+ return NULL;
+
+ size_t colon(common.find(':'));
+ if (colon != std::string::npos)
+ common = common.substr(0, colon + 1);
+ if (completions.size() == 1)
+ common += ' ';
+
+ char **results(reinterpret_cast<char **>(malloc(sizeof(char *) * (count + 2))));
+
+ results[0] = strdup(common.c_str());
+ size_t index(0);
+ for (Completions::const_iterator i(completions.begin()); i != completions.end(); ++i)
+ results[++index] = strdup(i->c_str());
+ results[count + 1] = NULL;
+
+ return results;
+}
#include <dlfcn.h>
#include "Display.hpp"
-#include "Replace.hpp"
-
-#include "Cycript.tab.hh"
#include "Driver.hpp"
+#include "Highlight.hpp"
+#include "Replace.hpp"
static volatile enum {
Working,
}
}
-#if YYDEBUG
static bool bison_;
-#endif
static bool strict_;
static bool pretty_;
-void Setup(CYDriver &driver, cy::parser &parser) {
-#if YYDEBUG
+void Setup(CYDriver &driver) {
if (bison_)
- parser.set_debug_level(1);
-#endif
+ driver.debug_ = 1;
if (strict_)
driver.strict_ = true;
}
-void Setup(CYOutput &out, CYDriver &driver, CYOptions &options, bool lower) {
+void Setup(CYPool &pool, CYOutput &out, CYDriver &driver, CYOptions &options, bool lower) {
out.pretty_ = pretty_;
- CYContext context(options);
if (lower)
- driver.program_->Replace(context);
+ driver.Replace(pool, options);
}
static CYUTF8String Run(CYPool &pool, int client, CYUTF8String code) {
static std::string command_;
-static CYExpression *ParseExpression(CYUTF8String code) {
- std::stringstream stream;
- stream << '(' << code << ')';
- CYDriver driver(stream);
-
- cy::parser parser(driver);
- Setup(driver, parser);
-
- if (parser.parse() != 0 || !driver.errors_.empty())
- return NULL;
-
- CYOptions options;
- CYContext context(options);
-
- CYStatement *statement(driver.program_->code_);
- _assert(statement != NULL);
- _assert(statement->next_ == NULL);
-
- CYExpress *express(dynamic_cast<CYExpress *>(driver.program_->code_));
- _assert(express != NULL);
-
- CYParenthetical *parenthetical(dynamic_cast<CYParenthetical *>(express->expression_));
- _assert(parenthetical != NULL);
+static int client_;
- return parenthetical->expression_;
+static CYUTF8String Run(CYPool &pool, const std::string &code) {
+ return Run(pool, client_, code);
}
-static int client_;
-
static char **Complete(const char *word, int start, int end) {
rl_attempted_completion_over = ~0;
-
- CYLocalPool pool;
-
std::string line(rl_line_buffer, start);
- std::istringstream stream(command_ + line);
- CYDriver driver(stream);
-
- driver.auto_ = true;
-
- cy::parser parser(driver);
- Setup(driver, parser);
-
- if (parser.parse() != 0 || !driver.errors_.empty())
- return NULL;
-
- if (driver.mode_ == CYDriver::AutoNone)
- return NULL;
-
- CYExpression *expression;
-
- CYOptions options;
- CYContext context(options);
-
- std::ostringstream prefix;
-
- switch (driver.mode_) {
- case CYDriver::AutoPrimary:
- expression = $ CYThis();
- break;
-
- case CYDriver::AutoDirect:
- expression = driver.context_;
- break;
-
- case CYDriver::AutoIndirect:
- expression = $ CYIndirect(driver.context_);
- break;
-
- case CYDriver::AutoMessage: {
- CYDriver::Context &thing(driver.contexts_.back());
- expression = $M($C1($V("object_getClass"), thing.context_), $S("messages"));
- for (CYDriver::Context::Words::const_iterator part(thing.words_.begin()); part != thing.words_.end(); ++part)
- prefix << (*part)->word_ << ':';
- } break;
-
- default:
- _assert(false);
- }
-
- std::string begin(prefix.str());
-
- driver.program_ = $ CYProgram($ CYExpress($C3(ParseExpression(
- " function(object, prefix, word) {\n"
- " var names = [];\n"
- " var before = prefix.length;\n"
- " prefix += word;\n"
- " var entire = prefix.length;\n"
- " for (var name in object)\n"
- " if (name.substring(0, entire) == prefix)\n"
- " names.push(name.substr(before));\n"
- " return names;\n"
- " }\n"
- ), expression, $S(begin.c_str()), $S(word))));
-
- driver.program_->Replace(context);
-
- std::stringbuf str;
- CYOutput out(str, options);
- out << *driver.program_;
-
- std::string code(str.str());
- CYUTF8String json(Run(pool, client_, code));
- // XXX: if this fails we should not try to parse it
-
- CYExpression *result(ParseExpression(json));
- if (result == NULL)
- return NULL;
-
- CYArray *array(dynamic_cast<CYArray *>(result->Primitive(context)));
- if (array == NULL) {
- *out_ << '\n';
- Output(false, json, out_);
- rl_forced_update_display();
- return NULL;
- }
-
- // XXX: use an std::set?
- typedef std::vector<std::string> Completions;
- Completions completions;
-
- std::string common;
- bool rest(false);
-
- CYForEach (element, array->elements_) {
- CYString *string(dynamic_cast<CYString *>(element->value_));
- _assert(string != NULL);
-
- std::string completion;
- if (string->size_ != 0)
- completion.assign(string->value_, string->size_);
- else if (driver.mode_ == CYDriver::AutoMessage)
- completion = "]";
- else
- continue;
-
- completions.push_back(completion);
-
- if (!rest) {
- common = completion;
- rest = true;
- } else {
- size_t limit(completion.size()), size(common.size());
- if (size > limit)
- common = common.substr(0, limit);
- else
- limit = size;
- for (limit = 0; limit != size; ++limit)
- if (common[limit] != completion[limit])
- break;
- if (limit != size)
- common = common.substr(0, limit);
- }
- }
-
- size_t count(completions.size());
- if (count == 0)
- return NULL;
-
- size_t colon(common.find(':'));
- if (colon != std::string::npos)
- common = common.substr(0, colon + 1);
- if (completions.size() == 1)
- common += ' ';
-
- char **results(reinterpret_cast<char **>(malloc(sizeof(char *) * (count + 2))));
-
- results[0] = strdup(common.c_str());
- size_t index(0);
- for (Completions::const_iterator i(completions.begin()); i != completions.end(); ++i)
- results[++index] = strdup(i->c_str());
- results[count + 1] = NULL;
-
- return results;
+ return CYComplete(word, command_ + line, &Run);
}
// need char *, not const char *
if (bypass)
code = command_;
else {
- CYLocalPool pool;
-
std::istringstream stream(command_);
CYDriver driver(stream);
+ Setup(driver);
- cy::parser parser(driver);
- Setup(driver, parser);
+ CYPool pool;
+ bool failed(driver.Parse(pool));
- if (parser.parse() != 0 || !driver.errors_.empty()) {
+ if (failed || !driver.errors_.empty()) {
for (CYDriver::Errors::const_iterator error(driver.errors_.begin()); error != driver.errors_.end(); ++error) {
CYPosition begin(error->location_.begin);
if (begin.line != lines.size() + 1 || error->warning_) {
std::stringbuf str;
CYOutput out(str, options);
- Setup(out, driver, options, lower);
+ Setup(pool, out, driver, options, lower);
out << *driver.program_;
code = str.str();
}
if (false);
else if (strcmp(optarg, "rename") == 0)
options.verbose_ = true;
-#if YYDEBUG
else if (strcmp(optarg, "bison") == 0)
bison_ = true;
-#endif
else {
fprintf(stderr, "invalid name for -g\n");
return 1;
if (script == NULL && tty)
Console(options);
else {
- CYLocalPool pool;
-
std::istream *stream;
if (script == NULL) {
stream = &std::cin;
}
CYDriver driver(*stream, script);
- cy::parser parser(driver);
- Setup(driver, parser);
+ Setup(driver);
+
+ CYPool pool;
+ bool failed(driver.Parse(pool));
- if (parser.parse() != 0 || !driver.errors_.empty()) {
+ if (failed || !driver.errors_.empty()) {
for (CYDriver::Errors::const_iterator i(driver.errors_.begin()); i != driver.errors_.end(); ++i)
std::cerr << i->location_.begin << ": " << i->message_ << std::endl;
} else if (driver.program_ != NULL) {
std::stringbuf str;
CYOutput out(str, options);
- Setup(out, driver, options, true);
+ Setup(pool, out, driver, options, true);
out << *driver.program_;
std::string code(str.str());
if (compile)
CYDriver::CYDriver(std::istream &data, const std::string &filename) :
state_(CYClear),
data_(data),
+ debug_(0),
strict_(false),
commented_(false),
filename_(filename),
ScannerDestroy();
}
+bool CYDriver::Parse(CYPool &pool) {
+ CYLocal<CYPool> local(&pool);
+ cy::parser parser(*this);
+#ifdef YYDEBUG
+ parser.set_debug_level(debug_);
+#endif
+ return parser.parse() != 0;
+}
+
+void CYDriver::Replace(CYPool &pool, CYOptions &options) {
+ CYLocal<CYPool> local(&pool);
+ CYContext context(options);
+ program_->Replace(context);
+}
+
void CYDriver::Warning(const cy::parser::location_type &location, const char *message) {
if (!strict_)
return;
CYNewLine
};
-class CYDriver {
+class _visible CYDriver {
public:
void *scanner_;
std::istream &data_;
+ int debug_;
bool strict_;
bool commented_;
CYDriver(std::istream &data, const std::string &filename = "");
~CYDriver();
+ bool Parse(CYPool &pool);
+ void Replace(CYPool &pool, CYOptions &options);
+
Condition GetCondition();
void SetCondition(Condition condition);
};
#endif
-struct CYPoolError :
+struct _visible CYPoolError :
CYException
{
CYPool pool_;
class CYPool;
-struct CYException {
+struct _visible CYException {
virtual ~CYException() {
}
static void (*JSSynchronousGarbageCollectForDebugging$)(JSContextRef);
-void CYGarbageCollect(JSContextRef context) {
+_visible void CYGarbageCollect(JSContextRef context) {
(JSSynchronousGarbageCollectForDebugging$ ?: &JSGarbageCollect)(context);
}
static JSObjectRef (*JSObjectMakeArray$)(JSContextRef, size_t, const JSValueRef[], JSValueRef *);
-void CYSetArgs(int argc, const char *argv[]) {
+_visible void CYSetArgs(int argc, const char *argv[]) {
JSContextRef context(CYGetJSContext());
JSValueRef args[argc];
for (int i(0); i != argc; ++i)
return cancel_;
}
-const char *CYExecute(JSContextRef context, CYPool &pool, CYUTF8String code) {
+_visible const char *CYExecute(JSContextRef context, CYPool &pool, CYUTF8String code) {
JSValueRef exception(NULL);
if (false) error:
return CYPoolCString(pool, context, CYJSString(context, exception));
return json;
}
-void CYCancel() {
+_visible void CYCancel() {
cancel_ = true;
}
return reinterpret_cast<Context *>(JSObjectGetPrivate(CYCastJSObject(context, CYGetProperty(context, CYGetGlobalObject(context), cy_s))))->context_;
}
-extern "C" bool CydgetMemoryParse(const uint16_t **data, size_t *size);
-
void *CYMapFile(const char *path, size_t *psize) {
int fd(_syscall_(open(path, O_RDONLY), 1, ENOENT));
if (fd == -1)
static JSGlobalContextRef context_;
-JSGlobalContextRef CYGetJSContext() {
+_visible JSGlobalContextRef CYGetJSContext() {
CYInitializeDynamic();
if (context_ == NULL) {
return context_;
}
-void CYDestroyContext() {
+_visible void CYDestroyContext() {
if (context_ == NULL)
return;
JSGlobalContextRelease(context_);
return NULL;
}
-extern "C" void CYHandleClient(int socket) {
+void CYHandleClient(int socket) {
// XXX: this leaks memory... really?
CYPool *pool(new CYPool());
CYClient *client(new(*pool) CYClient(socket));
CYHandleClient(socket);
}
-extern "C" void CYHandleServer(pid_t pid) { try {
+_extern void CYHandleServer(pid_t pid) { try {
char path[1024];
sprintf(path, "/tmp/.s.cy.%u", pid);
CYHandleSocket(path);
fprintf(stderr, "%s\n", error.PoolCString(pool));
} }
-extern "C" char *MSmain0(int argc, char *argv[]) { try {
+_extern char *MSmain0(int argc, char *argv[]) { try {
_assert(argc == 2);
CYHandleSocket(argv[1]);
return NULL;
}
-extern "C" void CYListenServer(short port) {
+_extern void CYListenServer(short port) {
CYInitializeDynamic();
CYServer *server(new CYServer(port));
}
};
-void CYLexerHighlight(const char *data, size_t size, std::ostream &output, bool ignore) {
+_visible void CYLexerHighlight(const char *data, size_t size, std::ostream &output, bool ignore) {
CYStream stream(data, data + size);
CYDriver driver(stream);
driver.commented_ = true;
return pool;
}
-void CYThrow(const char *format, ...) {
+_visible void CYThrow(const char *format, ...) {
va_list args;
va_start(args, format);
throw CYPoolError(format, args);
AM_CPPFLAGS = -DYYDEBUG=1
AM_CPPFLAGS += -include config.h -include $(srcdir)/unconfig.h
-AM_OBJCXXFLAGS = -fobjc-exceptions
+AM_CFLAGS = -fvisibility=hidden
+AM_CXXFLAGS = -fvisibility=hidden
+AM_OBJCXXFLAGS = -fvisibility=hidden
+AM_LDFLAGS = -fvisibility=hidden
+
+AM_OBJCXXFLAGS += -fobjc-exceptions
CY_LDFLAGS = -no-undefined -avoid-version -export-dynamic
bin_PROGRAMS = cycript
cycript_SOURCES = Console.cpp Display.cpp
cycript_LDADD = libcycript.la $(LTLIBREADLINE) $(LTLIBTERMCAP) $(LTLIBGCC) $(PTHREAD_CFLAGS) -ldl
+libcycript_la_SOURCES += Complete.cpp
endif
if CY_EXECUTE
build_triplet = @build@
host_triplet = @host@
@CY_CONSOLE_TRUE@bin_PROGRAMS = cycript$(EXEEXT)
-@CY_EXECUTE_TRUE@am__append_1 = sig/ffi_type.cpp sig/parse.cpp \
+@CY_CONSOLE_TRUE@am__append_1 = Complete.cpp
+@CY_EXECUTE_TRUE@am__append_2 = sig/ffi_type.cpp sig/parse.cpp \
@CY_EXECUTE_TRUE@ sig/copy.cpp Bridge.cpp Execute.cpp \
@CY_EXECUTE_TRUE@ JavaScriptCore.cpp
-@CY_EXECUTE_TRUE@am__append_2 = $(LTJAVASCRIPTCORE)
-@CY_EXECUTE_TRUE@am__append_3 = -DCY_EXECUTE
-@CY_EXECUTE_TRUE@am__append_4 = C
-@CY_EXECUTE_TRUE@am__append_5 = Bridge.gperf Bridge.hpp
-@CY_JAVA_TRUE@am__append_6 = Java
-@CY_JAVA_TRUE@am__append_7 = Java/Execute.cpp
-@CY_JAVA_TRUE@am__append_8 = $(LTJAVA)
-@CY_OBJECTIVEC_TRUE@am__append_9 = ObjectiveC
-@CY_OBJECTIVEC_TRUE@am__append_10 = ObjectiveC/Output.cpp ObjectiveC/Replace.cpp ObjectiveC/Library.mm
-@CY_OBJECTIVEC_TRUE@am__append_11 = $(LTOBJECTIVEC)
-@CY_ATTACH_TRUE@am__append_12 = Handler.cpp
-@CY_ATTACH_TRUE@@CY_CONSOLE_TRUE@am__append_13 = Inject.cpp
-@CY_ATTACH_TRUE@@CY_CONSOLE_TRUE@am__append_14 = -DCY_ATTACH
+@CY_EXECUTE_TRUE@am__append_3 = $(LTJAVASCRIPTCORE)
+@CY_EXECUTE_TRUE@am__append_4 = -DCY_EXECUTE
+@CY_EXECUTE_TRUE@am__append_5 = C
+@CY_EXECUTE_TRUE@am__append_6 = Bridge.gperf Bridge.hpp
+@CY_JAVA_TRUE@am__append_7 = Java
+@CY_JAVA_TRUE@am__append_8 = Java/Execute.cpp
+@CY_JAVA_TRUE@am__append_9 = $(LTJAVA)
+@CY_OBJECTIVEC_TRUE@am__append_10 = ObjectiveC
+@CY_OBJECTIVEC_TRUE@am__append_11 = ObjectiveC/Output.cpp ObjectiveC/Replace.cpp ObjectiveC/Library.mm
+@CY_OBJECTIVEC_TRUE@am__append_12 = $(LTOBJECTIVEC)
+@CY_ATTACH_TRUE@am__append_13 = Handler.cpp
+@CY_ATTACH_TRUE@@CY_CONSOLE_TRUE@am__append_14 = Inject.cpp
+@CY_ATTACH_TRUE@@CY_CONSOLE_TRUE@am__append_15 = -DCY_ATTACH
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
$(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4)
am__libcycript_la_SOURCES_DIST = ConvertUTF.c Decode.cpp Driver.cpp \
Highlight.cpp Library.cpp Network.cpp Output.cpp Parser.cpp \
- Replace.cpp Cycript.tab.cc lex.cy.cpp sig/ffi_type.cpp \
- sig/parse.cpp sig/copy.cpp Bridge.cpp Execute.cpp \
- JavaScriptCore.cpp Java/Execute.cpp ObjectiveC/Output.cpp \
- ObjectiveC/Replace.cpp ObjectiveC/Library.mm Handler.cpp
+ Replace.cpp Cycript.tab.cc lex.cy.cpp Complete.cpp \
+ sig/ffi_type.cpp sig/parse.cpp sig/copy.cpp Bridge.cpp \
+ Execute.cpp JavaScriptCore.cpp Java/Execute.cpp \
+ ObjectiveC/Output.cpp ObjectiveC/Replace.cpp \
+ ObjectiveC/Library.mm Handler.cpp
+@CY_CONSOLE_TRUE@am__objects_1 = Complete.lo
am__dirstamp = $(am__leading_dot)dirstamp
-@CY_EXECUTE_TRUE@am__objects_1 = sig/ffi_type.lo sig/parse.lo \
+@CY_EXECUTE_TRUE@am__objects_2 = sig/ffi_type.lo sig/parse.lo \
@CY_EXECUTE_TRUE@ sig/copy.lo Bridge.lo Execute.lo \
@CY_EXECUTE_TRUE@ JavaScriptCore.lo
-@CY_JAVA_TRUE@am__objects_2 = Java/Execute.lo
-@CY_OBJECTIVEC_TRUE@am__objects_3 = ObjectiveC/Output.lo \
+@CY_JAVA_TRUE@am__objects_3 = Java/Execute.lo
+@CY_OBJECTIVEC_TRUE@am__objects_4 = ObjectiveC/Output.lo \
@CY_OBJECTIVEC_TRUE@ ObjectiveC/Replace.lo \
@CY_OBJECTIVEC_TRUE@ ObjectiveC/Library.lo
-@CY_ATTACH_TRUE@am__objects_4 = Handler.lo
+@CY_ATTACH_TRUE@am__objects_5 = Handler.lo
am_libcycript_la_OBJECTS = ConvertUTF.lo Decode.lo Driver.lo \
Highlight.lo Library.lo Network.lo Output.lo Parser.lo \
Replace.lo Cycript.tab.lo lex.cy.lo $(am__objects_1) \
- $(am__objects_2) $(am__objects_3) $(am__objects_4)
+ $(am__objects_2) $(am__objects_3) $(am__objects_4) \
+ $(am__objects_5)
libcycript_la_OBJECTS = $(am_libcycript_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
$(OBJCXXFLAGS) $(libcycript_la_LDFLAGS) $(LDFLAGS) -o $@
PROGRAMS = $(bin_PROGRAMS)
am__cycript_SOURCES_DIST = Console.cpp Display.cpp Inject.cpp
-@CY_ATTACH_TRUE@@CY_CONSOLE_TRUE@am__objects_5 = Inject.$(OBJEXT)
+@CY_ATTACH_TRUE@@CY_CONSOLE_TRUE@am__objects_6 = Inject.$(OBJEXT)
@CY_CONSOLE_TRUE@am_cycript_OBJECTS = Console.$(OBJEXT) \
-@CY_CONSOLE_TRUE@ Display.$(OBJEXT) $(am__objects_5)
+@CY_CONSOLE_TRUE@ Display.$(OBJEXT) $(am__objects_6)
cycript_OBJECTS = $(am_cycript_OBJECTS)
@CY_CONSOLE_TRUE@cycript_DEPENDENCIES = libcycript.la \
@CY_CONSOLE_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = subdir-objects
-CLEANFILES = $(am__append_5) Cycript.yy Cycript.l lex.cy.cpp \
+CLEANFILES = $(am__append_6) Cycript.yy Cycript.l lex.cy.cpp \
Cycript.tab.cc Cycript.tab.hh stack.hh Cycript.output
SUBDIRS =
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -DYYDEBUG=1 -include config.h -include \
- $(srcdir)/unconfig.h $(am__append_3) $(am__append_14)
-AM_OBJCXXFLAGS = -fobjc-exceptions
+ $(srcdir)/unconfig.h $(am__append_4) $(am__append_15)
+AM_CFLAGS = -fvisibility=hidden
+AM_CXXFLAGS = -fvisibility=hidden
+AM_OBJCXXFLAGS = -fvisibility=hidden -fobjc-exceptions
+AM_LDFLAGS = -fvisibility=hidden
CY_LDFLAGS = -no-undefined -avoid-version -export-dynamic
lib_LTLIBRARIES = libcycript.la
libcycript_la_LDFLAGS = $(CY_LDFLAGS)
-libcycript_la_LIBADD = $(LTLIBFFI) $(LTLIBGCC) -ldl $(am__append_2) \
- $(am__append_8) $(am__append_11)
+libcycript_la_LIBADD = $(LTLIBFFI) $(LTLIBGCC) -ldl $(am__append_3) \
+ $(am__append_9) $(am__append_12)
libcycript_la_SOURCES = ConvertUTF.c Decode.cpp Driver.cpp \
Highlight.cpp Library.cpp Network.cpp Output.cpp Parser.cpp \
Replace.cpp Cycript.tab.cc lex.cy.cpp $(am__append_1) \
- $(am__append_7) $(am__append_10) $(am__append_12)
-filters = $(am__append_4) $(am__append_6) $(am__append_9)
+ $(am__append_2) $(am__append_8) $(am__append_11) \
+ $(am__append_13)
+filters = $(am__append_5) $(am__append_7) $(am__append_10)
@CY_CONSOLE_TRUE@cycript_SOURCES = Console.cpp Display.cpp \
-@CY_CONSOLE_TRUE@ $(am__append_13)
+@CY_CONSOLE_TRUE@ $(am__append_14)
@CY_CONSOLE_TRUE@cycript_LDADD = libcycript.la $(LTLIBREADLINE) $(LTLIBTERMCAP) $(LTLIBGCC) $(PTHREAD_CFLAGS) -ldl
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Bridge.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Complete.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Console.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConvertUTF.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cycript.tab.Plo@am__quote@
#include "Error.hpp"
-bool CYRecvAll_(int socket, uint8_t *data, size_t size) {
+_visible bool CYRecvAll_(int socket, uint8_t *data, size_t size) {
while (size != 0) if (size_t writ = _syscall(recv(socket, data, size, 0))) {
data += writ;
size -= writ;
return true;
}
-bool CYSendAll_(int socket, const uint8_t *data, size_t size) {
+_visible bool CYSendAll_(int socket, const uint8_t *data, size_t size) {
while (size != 0) if (size_t writ = _syscall(send(socket, data, size, 0))) {
data += writ;
size -= writ;
CYRegisterHook CYObjectiveC(&CYObjectiveCHook);
-extern "C" void CydgetSetupContext(JSGlobalContextRef context) { CYObjectiveTry_ {
+_extern void CydgetSetupContext(JSGlobalContextRef context) { CYObjectiveTry_ {
CYSetupContext(context);
} CYObjectiveCatch }
-extern "C" void CydgetMemoryParse(const uint16_t **data, size_t *size) { try {
+_extern void CydgetMemoryParse(const uint16_t **data, size_t *size) { try {
CYPool pool;
CYUTF8String utf8(CYPoolUTF8String(pool, CYUTF16String(*data, *size)));
#define _noreturn \
__attribute__((__noreturn__))
+#define _visible \
+ __attribute__((__visibility__("default")))
+#define _extern \
+ extern "C" _visible
+
#endif/*CYCRIPT_STANDARD_HPP*/
#ifndef CYCRIPT_STRING_HPP
#define CYCRIPT_STRING_HPP
-#include "cycript.hpp"
#include "Pooling.hpp"
#include <iostream>
#include <sstream>
#include "Pooling.hpp"
+#include "String.hpp"
bool CYRecvAll_(int socket, uint8_t *data, size_t size);
bool CYSendAll_(int socket, const uint8_t *data, size_t size);
double CYCastDouble(const char *value, size_t size);
double CYCastDouble(const char *value);
-extern "C" void CYHandleClient(int socket);
+void CYHandleClient(int socket);
template <typename Type_>
bool CYRecvAll(int socket, Type_ *data, size_t size) {
CYPool &CYGetGlobalPool();
+char **CYComplete(const char *word, const std::string &line, CYUTF8String (*run)(CYPool &pool, const std::string &));
+
#endif/*CYCRIPT_HPP*/
_CYListenServer
+.objc_class_name_CY*