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

VM opcode snippet for setting an INI value (OP_INI_SET). 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 (vval)
 free_value (vkey)
 free_value (vsec)
 free_value (vh)
 push_value (vm, make_int(ok))

Variables

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

Detailed Description

VM opcode snippet for setting an INI value (OP_INI_SET).

Opcode: OP_INI_SET Stack: [value:any] [key:string] [section:string] [handle:int] -> [ok:int]

Behavior

  • Pops value, key, section, and handle. Converts the value to a string using value_to_string_alloc() and stores it under "section:key" (and a dotted fallback) via dictionary_set().
  • Pushes 1 on success, 0 on failure (invalid args/handle or allocation fail).

Errors

  • No VM exception is thrown; failures return 0.

Definition in file set.c.

Function Documentation

◆ free_value() [1/4]

free_value ( vh )

◆ free_value() [2/4]

free_value ( vkey )

◆ free_value() [3/4]

free_value ( vsec )

◆ free_value() [4/4]

free_value ( vval )

◆ if()

if ( d &&sec && key)

Definition at line 38 of file set.c.

◆ push_value()

push_value ( vm ,
make_int(ok)  )

Variable Documentation

◆ break

break

Definition at line 65 of file set.c.

◆ d

dictionary* d = ini_get((vh.type == VAL_INT) ? (int)vh.i : 0)

Definition at line 34 of file set.c.

◆ key

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

Definition at line 35 of file set.c.

◆ ok

int ok = 0

Definition at line 37 of file set.c.

◆ OP_INI_SET

case OP_INI_SET

Definition at line 29 of file set.c.

◆ sec

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

Definition at line 36 of file set.c.

◆ vh

Value vh = pop_value(vm)

Definition at line 33 of file set.c.

◆ vkey

Value vkey = pop_value(vm)

Definition at line 31 of file set.c.

◆ vsec

Value vsec = pop_value(vm)

Definition at line 32 of file set.c.