]> git.saurik.com Git - cycript.git/blob - Bridge.sh
Support __NSCFBoolean, the iOS version of NSCFBoolean.
[cycript.git] / Bridge.sh
1 #!/usr/bin/env bash
2
3 cat << EOF
4 %{
5 #include <cstring>
6 #include "Execute.hpp"
7 %}
8
9 %language=ANSI-C
10
11 %define lookup-function-name CYBridgeHash_
12 %define slot-name name_
13
14 %struct-type
15 %omit-struct-type
16
17 %pic
18
19 struct CYBridgeEntry {
20 int name_;
21 const char *value_;
22 void *cache_;
23 };
24
25 %%
26 EOF
27
28 grep '^[CFV]' "$1" | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$/\1\2, "\3", NULL/';
29 grep '^[EST]' "$1" | sed -e 's/^S/3/;s/^T/4/;s/^E/5/' | sed -e 's/^5\(.*\)$/4\1 i/;s/"/\\"/g' | sed -e 's/^\([^ ]*\) \([^ ]*\) \(.*\)$/\1\2, "\3", NULL/';
30 grep '^:' "$1" | sed -e 's/^: \([^ ]*\) \(.*\)/6\1, "\2", NULL/';