@@ -154,57 +154,57 @@ export class CallContext {
154
154
155
155
/** @hidden */
156
156
[ ENV ] = {
157
- extism_alloc : ( n : bigint ) : bigint => {
157
+ alloc : ( n : bigint ) : bigint => {
158
158
return this . alloc ( n ) ;
159
159
} ,
160
160
161
- extism_free : ( addr : number ) => {
161
+ free : ( addr : number ) => {
162
162
this . #blocks[ Block . addressToIndex ( addr ) ] = null ;
163
163
} ,
164
164
165
- extism_load_u8 : ( addr : bigint ) : number => {
165
+ load_u8 : ( addr : bigint ) : number => {
166
166
const blockIdx = Block . addressToIndex ( addr ) ;
167
167
const offset = Block . maskAddress ( addr ) ;
168
168
const block = this . #blocks[ blockIdx ] ;
169
169
return block ?. view . getUint8 ( Number ( offset ) ) as number ;
170
170
} ,
171
171
172
- extism_load_u64 : ( addr : bigint ) : bigint => {
172
+ load_u64 : ( addr : bigint ) : bigint => {
173
173
const blockIdx = Block . addressToIndex ( addr ) ;
174
174
const offset = Block . maskAddress ( addr ) ;
175
175
const block = this . #blocks[ blockIdx ] ;
176
176
return block ?. view . getBigUint64 ( Number ( offset ) , true ) as bigint ;
177
177
} ,
178
178
179
- extism_store_u8 : ( addr : bigint , n : number ) => {
179
+ store_u8 : ( addr : bigint , n : number ) => {
180
180
const blockIdx = Block . addressToIndex ( addr ) ;
181
181
const offset = Block . maskAddress ( addr ) ;
182
182
const block = this . #blocks[ blockIdx ] ;
183
183
block ?. view . setUint8 ( Number ( offset ) , Number ( n ) ) ;
184
184
} ,
185
185
186
- extism_store_u64 : ( addr : bigint , n : bigint ) => {
186
+ store_u64 : ( addr : bigint , n : bigint ) => {
187
187
const blockIdx = Block . addressToIndex ( addr ) ;
188
188
const offset = Block . maskAddress ( addr ) ;
189
189
const block = this . #blocks[ blockIdx ] ;
190
190
block ?. view . setBigUint64 ( Number ( offset ) , n , true ) ;
191
191
} ,
192
192
193
- extism_input_length : ( ) => {
193
+ input_length : ( ) => {
194
194
return BigInt ( this . #input?. byteLength ?? 0 ) ;
195
195
} ,
196
196
197
- extism_input_load_u8 : ( addr : bigint ) : number => {
197
+ input_load_u8 : ( addr : bigint ) : number => {
198
198
const offset = Block . maskAddress ( addr ) ;
199
199
return this . #input?. view . getUint8 ( Number ( offset ) ) as number ;
200
200
} ,
201
201
202
- extism_input_load_u64 : ( addr : bigint ) : bigint => {
202
+ input_load_u64 : ( addr : bigint ) : bigint => {
203
203
const offset = Block . maskAddress ( addr ) ;
204
204
return this . #input?. view . getBigUint64 ( Number ( offset ) , true ) as bigint ;
205
205
} ,
206
206
207
- extism_output_set : ( addr : bigint , length : bigint ) => {
207
+ output_set : ( addr : bigint , length : bigint ) => {
208
208
const blockIdx = Block . addressToIndex ( addr ) ;
209
209
const block = this . #blocks[ blockIdx ] ;
210
210
if ( ! block ) {
@@ -218,7 +218,7 @@ export class CallContext {
218
218
this . #stack[ this . #stack. length - 1 ] [ 1 ] = blockIdx ;
219
219
} ,
220
220
221
- extism_error_set : ( addr : bigint ) => {
221
+ error_set : ( addr : bigint ) => {
222
222
const blockIdx = Block . addressToIndex ( addr ) ;
223
223
const block = this . #blocks[ blockIdx ] ;
224
224
if ( ! block ) {
@@ -228,7 +228,7 @@ export class CallContext {
228
228
this . #stack[ this . #stack. length - 1 ] [ 2 ] = blockIdx ;
229
229
} ,
230
230
231
- extism_config_get : ( addr : bigint ) : bigint => {
231
+ config_get : ( addr : bigint ) : bigint => {
232
232
const item = this . read ( addr ) ;
233
233
234
234
if ( item === null ) {
@@ -244,7 +244,7 @@ export class CallContext {
244
244
return 0n ;
245
245
} ,
246
246
247
- extism_var_get : ( addr : bigint ) : bigint => {
247
+ var_get : ( addr : bigint ) : bigint => {
248
248
const item = this . read ( addr ) ;
249
249
250
250
if ( item === null ) {
@@ -255,7 +255,7 @@ export class CallContext {
255
255
return this . #vars. has ( key ) ? Block . indexToAddress ( this . #vars. get ( key ) as number ) : 0n ;
256
256
} ,
257
257
258
- extism_var_set : ( addr : bigint , valueaddr : bigint ) => {
258
+ var_set : ( addr : bigint , valueaddr : bigint ) => {
259
259
const item = this . read ( addr ) ;
260
260
261
261
if ( item === null ) {
@@ -271,17 +271,17 @@ export class CallContext {
271
271
this . #vars. set ( key , Block . addressToIndex ( valueaddr ) ) ;
272
272
} ,
273
273
274
- extism_http_request : ( _requestOffset : bigint , _bodyOffset : bigint ) : bigint => {
274
+ http_request : ( _requestOffset : bigint , _bodyOffset : bigint ) : bigint => {
275
275
this . #logger. error ( 'http_request is not enabled' ) ;
276
276
return 0n ;
277
277
} ,
278
278
279
- extism_http_status_code : ( ) : number => {
279
+ http_status_code : ( ) : number => {
280
280
this . #logger. error ( 'http_status_code is not enabled' ) ;
281
281
return 0 ;
282
282
} ,
283
283
284
- extism_length : ( addr : bigint ) : bigint => {
284
+ length : ( addr : bigint ) : bigint => {
285
285
const blockIdx = Block . addressToIndex ( addr ) ;
286
286
const block = this . #blocks[ blockIdx ] ;
287
287
if ( ! block ) {
@@ -290,7 +290,7 @@ export class CallContext {
290
290
return BigInt ( block . buffer . byteLength ) ;
291
291
} ,
292
292
293
- extism_log_warn : ( addr : bigint ) => {
293
+ log_warn : ( addr : bigint ) => {
294
294
const blockIdx = Block . addressToIndex ( addr ) ;
295
295
const block = this . #blocks[ blockIdx ] ;
296
296
if ( ! block ) {
@@ -302,7 +302,7 @@ export class CallContext {
302
302
this . #logger. warn ( text ) ;
303
303
} ,
304
304
305
- extism_log_info : ( addr : bigint ) => {
305
+ log_info : ( addr : bigint ) => {
306
306
const blockIdx = Block . addressToIndex ( addr ) ;
307
307
const block = this . #blocks[ blockIdx ] ;
308
308
if ( ! block ) {
@@ -314,7 +314,7 @@ export class CallContext {
314
314
this . #logger. info ( text ) ;
315
315
} ,
316
316
317
- extism_log_debug : ( addr : bigint ) => {
317
+ log_debug : ( addr : bigint ) => {
318
318
const blockIdx = Block . addressToIndex ( addr ) ;
319
319
const block = this . #blocks[ blockIdx ] ;
320
320
if ( ! block ) {
@@ -326,7 +326,7 @@ export class CallContext {
326
326
this . #logger. debug ( text ) ;
327
327
} ,
328
328
329
- extism_log_error : ( addr : bigint ) => {
329
+ log_error : ( addr : bigint ) => {
330
330
const blockIdx = Block . addressToIndex ( addr ) ;
331
331
const block = this . #blocks[ blockIdx ] ;
332
332
if ( ! block ) {
0 commit comments