// 1 "runtime/wrap-around.j"
// 1 "<built-in>"
// 1 "<command-line>"
// 31 "<command-line>"
// 1 "/usr/include/stdc-predef.h" 1 3 4
// 32 "<command-line>" 2
// 1 "runtime/wrap-around.j"



globals
    integer JHCR_Wrap_p = 0
    trigger JHCR_Wrap_t1 = CreateTrigger()
    trigger JHCR_Wrap_t2 = CreateTrigger()
    code JHCR_Wrap_ret = null


    integer JHCR_Wrap_args = 0


    integer JHCR_Wrap_name2id = 0
endglobals

function JHCR_Wrap_i2code takes integer JHCR_Wrap_i returns code
    set JHCR_Wrap_p = JHCR_Wrap_i
    call TriggerEvaluate(JHCR_Wrap_t2)
    return JHCR_Wrap_ret
endfunction

function JHCR_Wrap_call_anything_around takes integer JHCR_Wrap_i returns nothing
    set JHCR_Wrap_p = JHCR_Wrap_i
    call TriggerEvaluate(JHCR_Wrap_t1)
endfunction

function JHCR_Wrap_ExecuteFunc takes string JHCR_Wrap_s returns nothing
    local integer JHCR_Wrap_id = JHCR_StringTable_get(JHCR_Wrap_name2id, JHCR_Wrap_s)
    if JHCR_Wrap_id < 0 then
        call ExecuteFunc("JHCR_Auto_dummyFunction_" + I2S(-JHCR_Wrap_id))
    else
        call ExecuteFunc(JHCR_Wrap_s)
    endif
endfunction

function JHCR_Wrap_init takes nothing returns nothing
    set JHCR_Wrap_args = JHCR_Table_alloc()
    set JHCR_Wrap_name2id = JHCR_Table_alloc()
endfunction