| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#ifndef __GO_SEQ_DARWIN_HDR__ |
| 6 |
#define __GO_SEQ_DARWIN_HDR__ |
| 7 |
|
| 8 |
#include <Foundation/Foundation.h> |
| 9 |
#include "ref.h" |
| 10 |
#include "Universe.objc.h" |
| 11 |
|
| 12 |
#ifdef DEBUG |
| 13 |
#define LOG_DEBUG(...) NSLog(__VA_ARGS__); |
| 14 |
#else |
| 15 |
#define LOG_DEBUG(...) ; |
| 16 |
#endif |
| 17 |
|
| 18 |
#define LOG_INFO(...) NSLog(__VA_ARGS__); |
| 19 |
#define LOG_FATAL(...) \ |
| 20 |
{ \ |
| 21 |
NSLog(__VA_ARGS__); \ |
| 22 |
@throw \ |
| 23 |
[NSException exceptionWithName:NSInternalInconsistencyException \ |
| 24 |
reason:[NSString stringWithFormat:__VA_ARGS__] \ |
| 25 |
userInfo:NULL]; \ |
| 26 |
} |
| 27 |
|
| 28 |
|
| 29 |
typedef struct nstring { |
| 30 |
void *ptr; |
| 31 |
int len; |
| 32 |
} nstring; |
| 33 |
typedef struct nbyteslice { |
| 34 |
void *ptr; |
| 35 |
int len; |
| 36 |
} nbyteslice; |
| 37 |
typedef int nint; |
| 38 |
|
| 39 |
extern void init_seq(); |
| 40 |
|
| 41 |
|
| 42 |
extern void go_seq_dec_ref(int32_t refnum); |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
extern void go_seq_inc_ref(int32_t refnum); |
| 47 |
|
| 48 |
extern int32_t go_seq_to_refnum(id obj); |
| 49 |
|
| 50 |
extern int32_t go_seq_go_to_refnum(GoSeqRef *ref); |
| 51 |
|
| 52 |
extern GoSeqRef *go_seq_from_refnum(int32_t refnum); |
| 53 |
|
| 54 |
|
| 55 |
extern id go_seq_objc_from_refnum(int32_t refnum); |
| 56 |
|
| 57 |
extern nbyteslice go_seq_from_objc_bytearray(NSData *data, int copy); |
| 58 |
extern nstring go_seq_from_objc_string(NSString *s); |
| 59 |
|
| 60 |
extern NSData *go_seq_to_objc_bytearray(nbyteslice, int copy); |
| 61 |
extern NSString *go_seq_to_objc_string(nstring str); |
| 62 |
|
| 63 |
#endif |