CAMLprim value brlapiml_acceptKeys(value handle, value rt, value camlKeys) { CAMLparam3(handle, rt, camlKeys); unsigned int i, size = Wosize_val(camlKeys); brlapi_keyCode_t keys[size]; for (i=0; i<size; i++) keys[i] = Int64_val(Field(camlKeys, i)); brlapiCheckError(acceptKeys, Int_val(rt), keys, size); CAMLreturn(Val_unit); }
CAMLprim value brlapiml_writeDots(value handle, value camlDots) { CAMLparam2(handle, camlDots); int size = Wosize_val(camlDots); unsigned char dots[size]; packDots(camlDots, dots, size); brlapiCheckError(writeDots, dots); CAMLreturn(Val_unit); }
CAMLprim value brlapiml_enterTtyModeWithPath(value handle, value ttyPathCaml, value driverName) { CAMLparam3(handle, ttyPathCaml, driverName); int i, size = Wosize_val(ttyPathCaml); int ttyPath[size]; for (i=0; i<size; i++) ttyPath[i] = Int_val(Field(ttyPathCaml, i)); brlapiCheckError(enterTtyModeWithPath, ttyPath, size, String_val(driverName)); CAMLreturn(Val_unit); }
CAMLprim value brlapiml_getDisplaySize(value handle, value unit) { CAMLparam2(handle, unit); CAMLlocal1(size); unsigned int x, y; brlapiCheckError(getDisplaySize, &x, &y); size = caml_alloc_tuple(2); Store_field(size, 0, Val_int(x)); Store_field(size, 1, Val_int(y)); CAMLreturn(size); }
CAMLprim value brlapiml_expandKeyCode(value handle, value camlKeyCode) { CAMLparam2(handle, camlKeyCode); CAMLlocal1(result); brlapi_expandedKeyCode_t ekc; brlapiCheckError(expandKeyCode, Int64_val(camlKeyCode), &ekc); result = caml_alloc_tuple(4); Store_field(result, 0, caml_copy_int32(ekc.type)); Store_field(result, 1, caml_copy_int32(ekc.command)); Store_field(result, 2, caml_copy_int32(ekc.argument)); Store_field(result, 2, caml_copy_int32(ekc.flags)); CAMLreturn(result); }
CAMLprim value brlapiml_acceptKeyRanges(value handle, value camlRanges) { CAMLparam2(handle, camlRanges); CAMLlocal1(r); unsigned int i, size = Wosize_val(camlRanges); brlapi_range_t ranges[size]; for (i=0; i<size; i++) { r = Field(camlRanges, i); ranges[i].first = Int64_val(Field(r, 0)); ranges[i].last = Int64_val(Field(r, 1)); } brlapiCheckError(acceptKeyRanges, ranges, size); CAMLreturn(Val_unit); }
CAMLprim value brlapiml_write(value handle, value writeArguments) { CAMLparam2(handle, writeArguments); int andSize = Wosize_val(Field(writeArguments, 4)); int orSize = Wosize_val(Field(writeArguments, 5)); unsigned char andMask[andSize], orMask[orSize]; brlapi_writeArguments_t wa; wa.displayNumber = Val_int(Field(writeArguments, 0)); wa.regionBegin = Val_int(Field(writeArguments, 1)); wa.regionSize = Val_int(Field(writeArguments, 2)); wa.text = String_val(Field(writeArguments, 3)); packDots(Field(writeArguments, 4), andMask, andSize); wa.andMask = andMask; packDots(Field(writeArguments, 5), orMask, orSize); wa.orMask = orMask; wa.cursor = Val_int(Field(writeArguments, 6)); wa.charset = String_val(Field(writeArguments, 7)); brlapiCheckError(write, &wa); CAMLreturn(Val_unit); }
CAMLprim value brlapiml_suspendDriver(value handle, value driverName) { CAMLparam2(handle, driverName); brlapiCheckError(suspendDriver, String_val(driverName)); CAMLreturn(Val_unit); }
CAMLprim value brlapiml_enterRawMode(value handle, value driverName) { CAMLparam2(handle, driverName); brlapiCheckError(enterRawMode, String_val(driverName)); CAMLreturn(Val_unit); }
CAMLprim value brlapiml_acceptAllKeys(value handle, value unit) { CAMLparam2(handle, unit); brlapiCheckError(acceptAllKeys); CAMLreturn(Val_unit); }
CAMLprim value brlapiml_writeText(value handle, value cursor, value text) { CAMLparam3(handle, cursor, text); brlapiCheckError(writeText, Int_val(cursor), String_val(text)); CAMLreturn(Val_unit); }
CAMLprim value brlapiml_setFocus(value handle, value tty) { CAMLparam2(handle, tty); brlapiCheckError(setFocus, Int_val(tty)); CAMLreturn(Val_unit); }