Fun
0.41.5
The programming language that makes You have fun
Main Page
Data Structures
Files
File List
Globals
Loading...
Searching...
No Matches
src
vm
pcsc
establish.c
Go to the documentation of this file.
1
/*
2
* This file is part of the Fun programming language.
3
* https://fun-lang.xyz/
4
*
5
* Copyright 2025 Johannes Findeisen <you@hanez.org>
6
* Licensed under the terms of the Apache-2.0 license.
7
* https://opensource.org/license/apache-2-0
8
*/
9
19
25
26
/* PCSC establish */
27
case
OP_PCSC_ESTABLISH
: {
28
#ifdef FUN_WITH_PCSC
29
int
slot = pcsc_alloc_ctx_slot();
30
if
(!slot) {
31
push_value(vm,
make_int
(0));
32
break
;
33
}
34
pcsc_ctx_entry *e = pcsc_get_ctx(slot);
35
if
(!e) {
36
push_value(vm,
make_int
(0));
37
break
;
38
}
39
LONG rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &e->ctx);
40
if
(rv != SCARD_S_SUCCESS) {
41
e->in_use = 0;
42
push_value(vm,
make_int
(0));
43
break
;
44
}
45
push_value(vm,
make_int
(slot));
46
#else
47
push_value(vm,
make_int
(0));
48
#endif
49
break
;
50
}
OP_PCSC_ESTABLISH
@ OP_PCSC_ESTABLISH
Definition
bytecode.h:184
make_int
case make_int(0))
Generated on
for Fun by
1.16.1