1 | /*
|
---|
2 | * Copyright (c) 2007 Martin Decky
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @addtogroup generic
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * @file
|
---|
35 | * @brief Objective C bindings.
|
---|
36 | *
|
---|
37 | * This file provides architecture independent binding
|
---|
38 | * functions which are needed to link with libobjc run-time
|
---|
39 | * library. Many of the functions are just dummy.
|
---|
40 | */
|
---|
41 |
|
---|
42 | #include <lib/objc_ext.h>
|
---|
43 | #include <panic.h>
|
---|
44 | #include <arch/memstr.h>
|
---|
45 | #include <mm/slab.h>
|
---|
46 |
|
---|
47 | void *stderr;
|
---|
48 |
|
---|
49 | static unsigned short __ctype_b[384] = {
|
---|
50 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
51 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
52 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
53 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
54 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
55 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
56 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
57 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
58 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
59 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
60 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
61 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
62 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
63 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
64 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
65 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
66 | 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
67 | 2, 8195, 8194, 8194, 8194, 8194, 2, 2,
|
---|
68 | 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
69 | 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
70 | 24577, 49156, 49156, 49156, 49156, 49156, 49156, 49156,
|
---|
71 | 49156, 49156, 49156, 49156, 49156, 49156, 49156, 49156,
|
---|
72 | 55304, 55304, 55304, 55304, 55304, 55304, 55304, 55304,
|
---|
73 | 55304, 55304, 49156, 49156, 49156, 49156, 49156, 49156,
|
---|
74 | 49156, 54536, 54536, 54536, 54536, 54536, 54536, 50440,
|
---|
75 | 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440,
|
---|
76 | 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440,
|
---|
77 | 50440, 50440, 50440, 49156, 49156, 49156, 49156, 49156,
|
---|
78 | 49156, 54792, 54792, 54792, 54792, 54792, 54792, 50696,
|
---|
79 | 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696,
|
---|
80 | 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696,
|
---|
81 | 50696, 50696, 50696, 49156, 49156, 49156, 49156, 2,
|
---|
82 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
83 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
84 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
85 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
86 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
87 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
88 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
89 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
90 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
91 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
92 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
93 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
94 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
95 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
96 | 0, 0, 0, 0, 0, 0, 0, 0,
|
---|
97 | 0, 0, 0, 0, 0, 0, 0, 0
|
---|
98 | };
|
---|
99 |
|
---|
100 | static const unsigned short *__ctype_b_ptr = __ctype_b + 128;
|
---|
101 |
|
---|
102 | void __assert_fail(const char *assertion, const char *file, unsigned int line, const char *function)
|
---|
103 | {
|
---|
104 | panic("Run-time assertion (%s:%u:%s) failed (%s)", file, line, function ? function : "", assertion);
|
---|
105 | }
|
---|
106 |
|
---|
107 | void abort(void)
|
---|
108 | {
|
---|
109 | panic("Run-time scheduled abort");
|
---|
110 | }
|
---|
111 |
|
---|
112 | void *fopen(const char *path, const char *mode)
|
---|
113 | {
|
---|
114 | return NULL;
|
---|
115 | }
|
---|
116 |
|
---|
117 | size_t fread(void *ptr, size_t size, size_t nmemb, void *stream)
|
---|
118 | {
|
---|
119 | return 0;
|
---|
120 | }
|
---|
121 |
|
---|
122 | size_t fwrite(const void *ptr, size_t size, size_t nmemb, void *stream)
|
---|
123 | {
|
---|
124 | return 0;
|
---|
125 | }
|
---|
126 |
|
---|
127 | int fflush(void *stream)
|
---|
128 | {
|
---|
129 | return 0;
|
---|
130 | }
|
---|
131 |
|
---|
132 | int feof(void *stream)
|
---|
133 | {
|
---|
134 | return 1;
|
---|
135 | }
|
---|
136 |
|
---|
137 | int fclose(void *stream)
|
---|
138 | {
|
---|
139 | return 0;
|
---|
140 | }
|
---|
141 |
|
---|
142 | int vfprintf(void *stream, const char *format, va_list ap)
|
---|
143 | {
|
---|
144 | return 0;
|
---|
145 | }
|
---|
146 |
|
---|
147 | int sscanf(const char *str, const char *format, ...)
|
---|
148 | {
|
---|
149 | return 0;
|
---|
150 | }
|
---|
151 |
|
---|
152 | const unsigned short **__ctype_b_loc(void)
|
---|
153 | {
|
---|
154 | return &__ctype_b_ptr;
|
---|
155 | }
|
---|
156 |
|
---|
157 | long int __strtol_internal(const char *__nptr, char **__endptr, int __base, int __group)
|
---|
158 | {
|
---|
159 | return 0;
|
---|
160 | }
|
---|
161 |
|
---|
162 | void *memset(void *s, int c, size_t n)
|
---|
163 | {
|
---|
164 | memsetb((uintptr_t) s, n, c);
|
---|
165 | return s;
|
---|
166 | }
|
---|
167 |
|
---|
168 | void *calloc(size_t nmemb, size_t size)
|
---|
169 | {
|
---|
170 | return malloc(nmemb * size, 0);
|
---|
171 | }
|
---|
172 |
|
---|
173 | /** @}
|
---|
174 | */
|
---|