projects
/
cycript.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Bridge.hpp to clean, grr!
[cycript.git]
/
sig
/
parse.cpp
diff --git
a/sig/parse.cpp
b/sig/parse.cpp
index 57e5a10669b166aae90e027b51167c516a30b35a..7fc663fc0eb18df671b81d98daae1e5ced11cd45 100644
(file)
--- a/
sig/parse.cpp
+++ b/
sig/parse.cpp
@@
-1,4
+1,4
@@
-/* Cycript -
Remove Execution Server and Disassemb
ler
+/* Cycript -
Inlining/Optimizing JavaScript Compi
ler
* Copyright (C) 2009 Jay Freeman (saurik)
*/
* Copyright (C) 2009 Jay Freeman (saurik)
*/
@@
-37,17
+37,13
@@
*/
/* }}} */
*/
/* }}} */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include "minimal/stdlib.h"
-
#include <apr_strings.h>
#include <apr_strings.h>
-
-#include <string.h>
-
#include "sig/parse.hpp"
#include "sig/parse.hpp"
+#include "Error.hpp"
+
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
namespace sig {
namespace sig {
@@
-85,7
+81,7
@@
void Parse_(apr_pool_t *pool, struct Signature *signature, const char **name, ch
if (**name != '"')
element->name = NULL;
else {
if (**name != '"')
element->name = NULL;
else {
- char *quote = strchr(++*name, '"');
+ c
onst c
har *quote = strchr(++*name, '"');
element->name = apr_pstrmemdup(pool, *name, quote - *name);
*name = quote + 1;
}
element->name = apr_pstrmemdup(pool, *name, quote - *name);
*name = quote + 1;
}
@@
-130,7
+126,7
@@
struct Type *Parse_(apr_pool_t *pool, const char **name, char eos, bool named, C
case '@':
if (**name == '"') {
case '@':
if (**name == '"') {
- char *quote = strchr(*name + 1, '"');
+ c
onst c
har *quote = strchr(*name + 1, '"');
if (!named || quote[1] == eos || quote[1] == '"') {
type->name = apr_pstrmemdup(pool, *name + 1, quote - *name - 1);
*name = quote + 1;
if (!named || quote[1] == eos || quote[1] == '"') {
type->name = apr_pstrmemdup(pool, *name + 1, quote - *name - 1);
*name = quote + 1;
@@
-205,17
+201,8
@@
struct Type *Parse_(apr_pool_t *pool, const char **name, char eos, bool named, C
// XXX: this types thing is a throwback to JocStrap
// XXX: this types thing is a throwback to JocStrap
- char *types;
- if (next != '=') {
- types = NULL;
- } else {
- const char *temp(*name);
+ if (next == '=')
Parse_(pool, &type->data.signature, name, end, callback);
Parse_(pool, &type->data.signature, name, end, callback);
- types = (char *) apr_pstrmemdup(pool, temp, *name - temp - 1);
- }
-
- if (callback != NULL)
- (*callback)(pool, type->name, types, type);
} break;
case 'N': type->flags |= JOC_TYPE_INOUT; goto next;
} break;
case 'N': type->flags |= JOC_TYPE_INOUT; goto next;
@@
-236,6
+223,9
@@
struct Type *Parse_(apr_pool_t *pool, const char **name, char eos, bool named, C
_assert(false);
}
_assert(false);
}
+ if (callback != NULL)
+ (*callback)(pool, type);
+
return type;
}
return type;
}
@@
-275,11
+265,11
@@
const char *Unparse(apr_pool_t *pool, struct Type *type) {
case array_P: {
const char *value = Unparse(pool, type->data.data.type);
case array_P: {
const char *value = Unparse(pool, type->data.data.type);
- return apr_psprintf(pool, "[%
lu
%s]", type->data.data.size, value);
+ return apr_psprintf(pool, "[%
"APR_SIZE_T_FMT"
%s]", type->data.data.size, value);
} break;
case pointer_P: return apr_psprintf(pool, "^%s", type->data.data.type == NULL ? "v" : Unparse(pool, type->data.data.type));
} break;
case pointer_P: return apr_psprintf(pool, "^%s", type->data.data.type == NULL ? "v" : Unparse(pool, type->data.data.type));
- case bit_P: return apr_psprintf(pool, "b%
zu
", type->data.data.size);
+ case bit_P: return apr_psprintf(pool, "b%
"APR_SIZE_T_FMT"
", type->data.data.size);
case char_P: return "c";
case double_P: return "d";
case float_P: return "f";
case char_P: return "c";
case double_P: return "d";
case float_P: return "f";