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

VM opcode snippet for reading a string from INI (OP_INI_GET_STRING). 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_string(res))

Variables

case OP_INI_GET_STRING
Value vkey = pop_value(vm)
Value vsec = pop_value(vm)
Value vh = pop_value(vm)
const char * def = (vdef.type == VAL_STRING && vdef.s) ? vdef.s : ""
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)
const char * res = def
 break

Detailed Description

VM opcode snippet for reading a string from INI (OP_INI_GET_STRING).

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

Behavior

  • Pops default string, key, section, and handle; looks up "section:key" and a dotted fallback. If not found, uses the provided default.
  • Pushes the resulting string (copied into a VM Value).

Errors

  • Invalid handle/args result in pushing the default (or empty string).

Definition in file get_string.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_string.c.

◆ push_value()

push_value ( vm ,
make_string(res)  )

Variable Documentation

◆ break

break

Definition at line 65 of file get_string.c.

◆ d

dictionary* d = ini_get(h)

Definition at line 37 of file get_string.c.

◆ def

const char* def = (vdef.type == VAL_STRING && vdef.s) ? vdef.s : ""

Definition at line 33 of file get_string.c.

◆ h

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

Definition at line 36 of file get_string.c.

◆ key

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

Definition at line 34 of file get_string.c.

◆ OP_INI_GET_STRING

case OP_INI_GET_STRING

Definition at line 28 of file get_string.c.

◆ res

void map_set & res = def

Definition at line 38 of file get_string.c.

◆ sec

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

Definition at line 35 of file get_string.c.

◆ vh

Value vh = pop_value(vm)

Definition at line 32 of file get_string.c.

◆ vkey

Value vkey = pop_value(vm)

Definition at line 30 of file get_string.c.

◆ vsec

Value vsec = pop_value(vm)

Definition at line 31 of file get_string.c.