Mercurial > repos > tabletprog
comparison modules/bytearray.tp @ 318:4c669942c30d
Add bindings for SDL_CreateTexture, SDL_LockTexture, SDL_SetBlendMode and SDL_GetBlendMode in SDL module
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 19 Mar 2015 22:40:43 -0700 |
parents | 2a0a88799737 |
children | ff7ea11b4b60 |
comparison
equal
deleted
inserted
replaced
317:6dfbf5691a7f | 318:4c669942c30d |
---|---|
1 #{ | 1 #{ |
2 includeSystemHeader: "unistd.h" | 2 includeSystemHeader: "unistd.h" |
3 includeSystemHeader: "sys/mman.h" | 3 includeSystemHeader: "sys/mman.h" |
4 | 4 |
5 normal <- :size { | 5 fromOpaque:withSize <- :opaque :size{ |
6 #{ | 6 #{ |
7 llProperty: bytes withType: uint32_t | 7 llProperty: bytes withType: uint32_t |
8 llProperty: buffer withType: (void ptr) | 8 llProperty: buffer withType: (void ptr) |
9 llMessage: _init_buf withVars: { | 9 llMessage: _init_buf withVars: { |
10 sz <- obj_int32 ptr | 10 sz <- obj_int32 ptr |
11 } andCode: :sz { | 11 opaque <- cpointer ptr |
12 } andCode: :opaque sz { | |
12 bytes <- sz num | 13 bytes <- sz num |
13 buffer <- GC_MALLOC_ATOMIC: bytes | 14 buffer <- (opaque val) |
14 self | 15 self |
15 } | 16 } |
16 | 17 |
17 llMessage: _buf_ptr withVars: { | 18 llMessage: _buf_ptr withVars: { |
18 ptrret <- cpointer ptr | 19 ptrret <- cpointer ptr |
87 } | 88 } |
88 if: notfound else else: { | 89 if: notfound else else: { |
89 found: i | 90 found: i |
90 } | 91 } |
91 } | 92 } |
92 } _init_buf: size | 93 } _init_buf: opaque size |
94 } | |
95 | |
96 normal <- :size { | |
97 helper <- #{ | |
98 llMessage: alloc withVars: { | |
99 size <- obj_int32 ptr | |
100 opaqueret <- cpointer ptr | |
101 } andCode: :size { | |
102 opaqueret <- make_object: (addr_of: cpointer_meta) NULL 0 | |
103 opaqueret val!: (GC_MALLOC_ATOMIC: (size num)) | |
104 opaqueret | |
105 } | |
106 } | |
107 fromOpaque: (helper alloc: size) withSize: size | |
93 } | 108 } |
94 | 109 |
95 executable <- :size { | 110 executable <- :size { |
96 buf <- #{ | 111 buf <- #{ |
97 llProperty: bytes withType: uint32_t | 112 llProperty: bytes withType: uint32_t |