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

VM opcode snippet for saving an INI dictionary to a file (OP_INI_SAVE). More...

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

Go to the source code of this file.

Functions

 if (d &&path)
 free_value (vpath)
 free_value (vh)
 push_value (vm, make_int(ok))

Variables

case OP_INI_SAVE
Value vh = pop_value(vm)
const char * path = (vpath.type == VAL_STRING) ? vpath.s : NULL
dictionary * d = ini_get((vh.type == VAL_INT) ? (int)vh.i : 0)
int ok = 0
 break

Detailed Description

VM opcode snippet for saving an INI dictionary to a file (OP_INI_SAVE).

Opcode: OP_INI_SAVE Stack: [path:string] [handle:int] -> [ok:int]

Behavior

  • Pops a path and a handle. If the handle is valid, opens the path for writing and dumps the dictionary in INI format. Pushes 1 on success, otherwise 0.

Errors

  • Failing fopen() or invalid handle simply return 0; no exception is thrown.

Definition in file save.c.

Function Documentation

◆ free_value() [1/2]

free_value ( vh )

◆ free_value() [2/2]

free_value ( vpath )

◆ if()

if ( d && path)

Definition at line 34 of file save.c.

◆ push_value()

push_value ( vm ,
make_int(ok)  )

Variable Documentation

◆ break

break

Definition at line 45 of file save.c.

◆ d

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

Definition at line 32 of file save.c.

◆ ok

int ok = 0

Definition at line 33 of file save.c.

◆ OP_INI_SAVE

case OP_INI_SAVE

Definition at line 28 of file save.c.

◆ path

const char* path = (vpath.type == VAL_STRING) ? vpath.s : NULL

Definition at line 31 of file save.c.

◆ vh

Value vh = pop_value(vm)

Definition at line 30 of file save.c.