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

VM opcode snippet for reading a floating-point value from INI (OP_INI_GET_DOUBLE). 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_float(outd))

Variables

case OP_INI_GET_DOUBLE
Value vkey = pop_value(vm)
Value vsec = pop_value(vm)
Value vh = pop_value(vm)
double def = (vdef.type == VAL_FLOAT) ? vdef.d : (vdef.type == VAL_INT ? (double)vdef.i : 0.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)
double outd = def
 break

Detailed Description

VM opcode snippet for reading a floating-point value from INI (OP_INI_GET_DOUBLE).

Opcode: OP_INI_GET_DOUBLE Stack: [default:float|int] [key:string] [section:string] [handle:int] -> [out:float]

Behavior

  • Pops default, key, section, and handle; looks up "section:key" (and dotted fallback) and attempts to parse as double using strtod().
  • If lookup or parsing fails, pushes the provided default.

Errors

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

Definition in file get_double.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_double.c.

◆ push_value()

push_value ( vm ,
make_float(outd)  )

Variable Documentation

◆ break

break

Definition at line 78 of file get_double.c.

◆ d

dictionary* d = ini_get(h)

Definition at line 37 of file get_double.c.

◆ def

double def = (vdef.type == VAL_FLOAT) ? vdef.d : (vdef.type == VAL_INT ? (double)vdef.i : 0.0)

Definition at line 33 of file get_double.c.

◆ h

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

Definition at line 36 of file get_double.c.

◆ key

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

Definition at line 34 of file get_double.c.

◆ OP_INI_GET_DOUBLE

case OP_INI_GET_DOUBLE

Definition at line 28 of file get_double.c.

◆ outd

double outd = def

Definition at line 38 of file get_double.c.

◆ sec

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

Definition at line 35 of file get_double.c.

◆ vh

Value vh = pop_value(vm)

Definition at line 32 of file get_double.c.

◆ vkey

Value vkey = pop_value(vm)

Definition at line 30 of file get_double.c.

◆ vsec

Value vsec = pop_value(vm)

Definition at line 31 of file get_double.c.