Fun 0.41.5
The programming language that makes you have fun!
Loading...
Searching...
No Matches
get_int.c File Reference

VM opcode snippet for reading an integer from INI (OP_INI_GET_INT). More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 if (d &&sec &&key)
 free_value (vdef)
 free_value (vkey)
 free_value (vsec)
 free_value (vh)
 push_value (vm, make_int(outi))

Variables

case OP_INI_GET_INT
Value vkey = pop_value(vm)
Value vsec = pop_value(vm)
Value vh = pop_value(vm)
int def = (vdef.type == VAL_INT) ? (int)vdef.i : 0
const char * key = (vkey.type == VAL_STRING) ? vkey.s : NULL
const char * sec = (vsec.type == VAL_STRING) ? vsec.s : NULL
int h = (vh.type == VAL_INT) ? (int)vh.i : 0
dictionary * d = ini_get(h)
int outi = def
 break

Detailed Description

VM opcode snippet for reading an integer from INI (OP_INI_GET_INT).

Opcode: OP_INI_GET_INT Stack: [default:int] [key:string] [section:string] [handle:int] -> [out:int]

Behavior

  • Pops default, key, section, and handle; looks up "section:key" (and dotted fallback) and attempts to parse as base-10 integer using strtol().
  • If lookup or parsing fails, returns the provided default.

Errors

  • Invalid handle/args produce the default; no VM exception is raised.

Definition in file get_int.c.

Function Documentation

◆ free_value() [1/4]

free_value ( vdef )

◆ free_value() [2/4]

free_value ( vh )

◆ free_value() [3/4]

free_value ( vkey )

◆ free_value() [4/4]

free_value ( vsec )

◆ if()

if ( d &&sec && key)

Definition at line 39 of file get_int.c.

◆ push_value()

push_value ( vm ,
make_int(outi)  )

Variable Documentation

◆ break

break

Definition at line 80 of file get_int.c.

◆ d

dictionary* d = ini_get(h)

Definition at line 37 of file get_int.c.

◆ def

int def = (vdef.type == VAL_INT) ? (int)vdef.i : 0

Definition at line 33 of file get_int.c.

◆ h

int h = (vh.type == VAL_INT) ? (int)vh.i : 0

Definition at line 36 of file get_int.c.

◆ key

const char* key = (vkey.type == VAL_STRING) ? vkey.s : NULL

Definition at line 34 of file get_int.c.

◆ OP_INI_GET_INT

case OP_INI_GET_INT

Definition at line 28 of file get_int.c.

◆ outi

int outi = def

Definition at line 38 of file get_int.c.

◆ sec

const char* sec = (vsec.type == VAL_STRING) ? vsec.s : NULL

Definition at line 35 of file get_int.c.

◆ vh

Value vh = pop_value(vm)

Definition at line 32 of file get_int.c.

◆ vkey

Value vkey = pop_value(vm)

Definition at line 30 of file get_int.c.

◆ vsec

Value vsec = pop_value(vm)

Definition at line 31 of file get_int.c.