1
0
Fork 0
forked from fun/fun

Doxygen code comment cleanups and new blog post. No code changes. (0.41.5)

This commit is contained in:
Johannes Findeisen 2026-05-01 15:15:42 +02:00
commit 4309ec2a52
212 changed files with 423 additions and 476 deletions

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -30,9 +30,6 @@
* // Bytecode: OP_ADD
* // Stack before: [2, 3]
* // Stack after: [5]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_ADD: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -31,9 +31,6 @@
* // Stack after: [5]
* // Stack before: [5.0, 2]
* // Stack after: [2.5]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_DIV: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -30,9 +30,6 @@
* // Stack after: [12]
* // Stack before: [2.5, 4]
* // Stack after: [10.0]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_MUL: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -30,9 +30,6 @@
* // Stack after: [6]
* // Stack before: [10.0, 3]
* // Stack after: [7.0]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_SUB: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -27,9 +27,6 @@
* // Bytecode: OP_APOP
* // Stack before: [[10, 20, 30]]
* // Stack after: [30]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_APOP: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -27,9 +27,6 @@
* // Bytecode: OP_CLEAR
* // Stack before: [[10, 20, 30]]
* // Stack after: [0]
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_CLEAR: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -26,9 +26,6 @@
* // Bytecode: OP_CONTAINS
* // Stack before: [20, [10, 20, 30]]
* // Stack after: [1]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_CONTAINS: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -26,9 +26,6 @@
* // Bytecode: OP_ENUMERATE
* // Stack before: [[10, 20, 30]]
* // Stack after: [[[0, 10], [1, 20], [2, 30]]]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_ENUMERATE: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -28,9 +28,6 @@
* // Bytecode: OP_INDEX_GET
* // Stack before: [1, [10, 20, 30]]
* // Stack after: [20]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_INDEX_GET: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -26,9 +26,6 @@
* // Bytecode: OP_INDEX_OF
* // Stack before: [20, [10, 20, 30]]
* // Stack after: [1]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_INDEX_OF: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -27,9 +27,6 @@
* // Bytecode: OP_INDEX_SET
* // Stack before: [42, 1, [10, 20, 30]]
* // Stack after: [[10, 42, 30]]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_INDEX_SET: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -28,9 +28,6 @@
* // Bytecode: OP_INSERT
* // Stack before: [42, 1, [10, 20, 30]]
* // Stack after: [4]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_INSERT: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -27,9 +27,6 @@
* // Bytecode: OP_JOIN
* // Stack before: [", ", ["a", "b", "c"]]
* // Stack after: ["a, b, c"]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_JOIN: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -27,9 +27,6 @@
* // Bytecode: OP_MAKE_ARRAY 3
* // Stack before: [1, 2, 3]
* // Stack after: [[1, 2, 3]]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_MAKE_ARRAY: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -28,9 +28,6 @@
* // Bytecode: OP_PUSH
* // Stack before: [42, [10, 20, 30]]
* // Stack after: [4]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_PUSH: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -28,9 +28,6 @@
* // Bytecode: OP_REMOVE
* // Stack before: [1, [10, 20, 30]]
* // Stack after: [20]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_REMOVE: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -28,9 +28,6 @@
* // Bytecode: OP_SET
* // Stack before: [42, 1, [10, 20, 30]]
* // Stack after: [42]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_SET: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -27,9 +27,6 @@
* // Bytecode: OP_SLICE
* // Stack before: [3, 1, [10,20,30,40]]
* // Stack after: [[20,30]]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_SLICE: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -27,9 +27,6 @@
* // Bytecode: OP_ZIP
* // Stack before: [[1,2], ['a','b']]
* // Stack after: [[[1,'a'], [2,'b']]]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_ZIP: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -9,25 +9,22 @@
/**
* @file band.c
* @brief Implements the OP_BAND opcode (bitwise AND).
* @brief Implements the OP_BAND opcode bitwise AND (uint32).
*
* Opcode snippet included by vm.c. Performs a 32-bit unsigned bitwise AND
* on two integer operands from the VM stack.
*
* Stack effects:
* - pops: b, a
* - pushes: (uint32_t)(a & b)
*
* Notes:
* - Operands are interpreted as 32-bit unsigned when of type VAL_INT;
* non-integer values are treated as 0.
* - The result is pushed as VAL_INT with the 32-bit value preserved in the
* low bits.
*/
/**
* OP_BAND: bitwise AND (uint32)
*
* Stack effects:
* - pops: b, a
* - pushes: (uint32_t)(a & b)
*
* Notes:
* - Operands are interpreted as 32-bit unsigned when of type VAL_INT;
* non-integer values are treated as 0.
* - The result is pushed as VAL_INT with the 32-bit value preserved in the
* low bits.
*/
case OP_BAND: {
Value vb = pop_value(vm);
Value va = pop_value(vm);

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -9,25 +9,22 @@
/**
* @file bnot.c
* @brief Implements the OP_BNOT opcode (bitwise NOT).
* @brief Implements the OP_BNOT opcode bitwise NOT (uint32).
*
* Opcode snippet included by vm.c. Performs a 32-bit unsigned bitwise NOT
* on a single integer operand from the VM stack.
*
* Stack effects:
* - pops: a
* - pushes: (uint32_t)(~a)
*
* Notes:
* - Operand is interpreted as 32-bit unsigned when of type VAL_INT;
* non-integer values are treated as 0.
* - The result is pushed as VAL_INT with the 32-bit value preserved in the
* low bits.
*/
/**
* OP_BNOT: bitwise NOT (uint32)
*
* Stack effects:
* - pops: a
* - pushes: (uint32_t)(~a)
*
* Notes:
* - Operand is interpreted as 32-bit unsigned when of type VAL_INT;
* non-integer values are treated as 0.
* - The result is pushed as VAL_INT with the 32-bit value preserved in the
* low bits.
*/
case OP_BNOT: {
Value va = pop_value(vm);
uint32_t a = (va.type == VAL_INT) ? (uint32_t)va.i : 0u;

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -9,25 +9,22 @@
/**
* @file bor.c
* @brief Implements the OP_BOR opcode (bitwise OR).
* @brief Implements the OP_BOR opcode bitwise OR (uint32).
*
* Opcode snippet included by vm.c. Performs a 32-bit unsigned bitwise OR
* on two integer operands from the VM stack.
*
* Stack effects:
* - pops: b, a
* - pushes: (uint32_t)(a | b)
*
* Notes:
* - Operands are interpreted as 32-bit unsigned when of type VAL_INT;
* non-integer values are treated as 0.
* - The result is pushed as VAL_INT with the 32-bit value preserved in the
* low bits.
*/
/**
* OP_BOR: bitwise OR (uint32)
*
* Stack effects:
* - pops: b, a
* - pushes: (uint32_t)(a | b)
*
* Notes:
* - Operands are interpreted as 32-bit unsigned when of type VAL_INT;
* non-integer values are treated as 0.
* - The result is pushed as VAL_INT with the 32-bit value preserved in the
* low bits.
*/
case OP_BOR: {
Value vb = pop_value(vm);
Value va = pop_value(vm);

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -9,15 +9,11 @@
/**
* @file bxor.c
* @brief Implements the OP_BXOR opcode (bitwise XOR).
* @brief Implements the OP_BXOR opcode bitwise XOR (uint32).
*
* This file is an opcode snippet included by vm.c. It implements a
* 32-bit unsigned bitwise XOR of two integer operands from the VM stack.
*/
/**
* OP_BXOR: bitwise XOR (uint32)
*
*
* Stack effects:
* - pops: b, a
* - pushes: (uint32_t)(a ^ b)
@ -28,6 +24,7 @@
* - Result is pushed back as VAL_INT, preserving 32-bit value in the
* low bits of the 64-bit integer storage.
*/
case OP_BXOR: {
Value vb = pop_value(vm);
Value va = pop_value(vm);

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -9,15 +9,11 @@
/**
* @file rol.c
* @brief Implements the OP_ROTL opcode (rotate-left).
* @brief Implements the OP_ROTL opcode rotate-left (uint32).
*
* Opcode snippet included by vm.c. Performs a 32-bit unsigned rotate-left of
* an integer operand by a masked rotation count.
*/
/**
* OP_ROTL: rotate left (uint32)
*
*
* Stack effects:
* - pops: s, a
* - pushes: (a << s) | (a >> (32 - s)), with s masked to 0..31
@ -27,6 +23,7 @@
* - The rotation count is masked to 0..31. A zero rotation returns a unchanged.
* - Result is pushed as VAL_INT with the 32-bit value preserved in the low bits.
*/
case OP_ROTL: {
Value vs = pop_value(vm);
Value va = pop_value(vm);

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -9,15 +9,11 @@
/**
* @file ror.c
* @brief Implements the OP_ROTR opcode (rotate-right).
* @brief Implements the OP_ROTR opcode rotate-right (uint32).
*
* Opcode snippet included by vm.c. Performs a 32-bit unsigned rotate-right of
* an integer operand by a masked rotation count.
*/
/**
* OP_ROTR: rotate right (uint32)
*
*
* Stack effects:
* - pops: s, a
* - pushes: (a >> s) | (a << (32 - s)), with s masked to 0..31
@ -27,6 +23,7 @@
* - The rotation count is masked to 0..31. A zero rotation returns a unchanged.
* - Result is pushed as VAL_INT with the 32-bit value preserved in the low bits.
*/
case OP_ROTR: {
Value vs = pop_value(vm);
Value va = pop_value(vm);

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -9,15 +9,11 @@
/**
* @file shl.c
* @brief Implements the OP_SHL opcode (logical left shift).
* @brief Implements the OP_SHL opcode logical left shift (uint32).
*
* Opcode snippet included by vm.c. Performs a 32-bit unsigned logical left
* shift of an integer operand by a masked shift count.
*/
/**
* OP_SHL: logical left shift (uint32)
*
*
* Stack effects:
* - pops: s, a
* - pushes: (uint32_t)(a << (s & 31))
@ -27,6 +23,7 @@
* - The shift count is masked to 0..31. A zero shift returns a unchanged.
* - Result is pushed as VAL_INT with the 32-bit value preserved in the low bits.
*/
case OP_SHL: {
Value vs = pop_value(vm);
Value va = pop_value(vm);

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -9,15 +9,11 @@
/**
* @file shr.c
* @brief Implements the OP_SHR opcode (logical right shift).
* @brief Implements the OP_SHR opcode logical right shift (uint32).
*
* Opcode snippet included by vm.c. Performs a 32-bit unsigned logical right
* shift of an integer operand by a masked shift count.
*/
/**
* OP_SHR: logical right shift (uint32)
*
*
* Stack effects:
* - pops: s, a
* - pushes: (uint32_t)(a >> (s & 31))
@ -28,6 +24,7 @@
* - Logical (zero-filling) right shift is used (no sign extend).
* - Result is pushed as VAL_INT with the 32-bit value preserved in the low bits.
*/
case OP_SHR: {
Value vs = pop_value(vm);
Value va = pop_value(vm);

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -22,9 +22,6 @@
* Error Handling:
* - Exits with error if not enough args
* - Exits if function isn't callable
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_CALL: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -25,9 +25,6 @@
* // Bytecode: OP_DUP
* // Stack before: [42]
* // Stack after: [42, 42]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_DUP: {

View file

@ -1,12 +1,10 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
* Copyright 2025 Johannes Findeisen <you@hanez.org>
* Licensed under the terms of the Apache-2.0 license.
* https://opensource.org/license/apache-2-0
*
* Added: 2025-10-04
*/
/**

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -21,9 +21,6 @@
* // Bytecode: OP_HALT
* // Stack before: [42]
* // Stack after: [42]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_HALT:

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -22,9 +22,6 @@
* - Loops
* - Function returns
* - Conditional control flow
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_JUMP: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -23,9 +23,6 @@
* - If statements
* - While loops
* - Logical expressions
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_JUMP_IF_FALSE: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -20,9 +20,6 @@
*
* Error Handling:
* - Exits if invalid constant index
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_LOAD_CONST: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -25,9 +25,6 @@
* // Bytecode: OP_LOAD_GLOBAL 0
* // Stack before: []
* // Stack after: [global_value]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_LOAD_GLOBAL: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -25,9 +25,6 @@
* // Bytecode: OP_LOAD_LOCAL 0
* // Stack before: []
* // Stack after: [local_value]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_LOAD_LOCAL: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -21,9 +21,6 @@
* // Bytecode: OP_NOP
* // Stack before: [42]
* // Stack after: [42]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_NOP:

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -23,9 +23,6 @@
* // Bytecode: OP_POP
* // Stack before: [42]
* // Stack after: []
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_POP: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -26,9 +26,6 @@
* // Bytecode: OP_RETURN
* // Stack before: [42]
* // Stack after: [42]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_RETURN: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -25,9 +25,6 @@
* // Bytecode: OP_STORE_GLOBAL 0
* // Stack before: [42]
* // Stack after: []
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_STORE_GLOBAL: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -25,9 +25,6 @@
* // Bytecode: OP_STORE_LOCAL 0
* // Stack before: [42]
* // Stack after: []
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_STORE_LOCAL: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -20,9 +20,6 @@
*
* Error Handling:
* - Exits if stack underflow
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_SWAP: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -19,6 +19,11 @@
* - Pops: path:string, url:string (values are converted via value_to_string_alloc)
* - Pushes: int (1 on success, 0 on error or when CURL is disabled)
*
* Pops a destination path and URL, streams the HTTP response body
* into the file, and pushes 1 on success or 0 on any error. Without
* FUN_WITH_CURL, behaves as a no-op that consumes two values and
* pushes 0.
*
* Error handling:
* - Returns 0 if URL/path conversion fails, file open fails, CURL init
* or perform fails.
@ -29,14 +34,7 @@
* - All temporary allocations (URL, path) are freed; FILE* is closed.
* - On builds without FUN_WITH_CURL, consumes two values and pushes 0.
*/
/**
* @brief Opcode handler for OP_CURL_DOWNLOAD.
*
* Pops a destination path and URL, streams the HTTP response body
* into the file, and pushes 1 on success or 0 on any error. Without
* FUN_WITH_CURL, behaves as a no-op that consumes two values and
* pushes 0.
*/
case OP_CURL_DOWNLOAD: {
#ifdef FUN_WITH_CURL
Value vpath = pop_value(vm);

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -21,6 +21,11 @@
* - Pops: url:string (any value is converted via value_to_string_alloc)
* - Pushes: body:string ("" on error or when CURL is disabled)
*
* Converts the top stack value to a URL string, issues a GET request
* using libcurl, and pushes the response body as a string. When
* compiled without FUN_WITH_CURL, the opcode becomes a no-op that
* consumes one value and pushes an empty string.
*
* Error handling:
* - If URL conversion fails or CURL initialization/performance fails,
* the opcode pushes an empty string.
@ -30,14 +35,7 @@
* - Uses FunCurlBuf and fun_curl_write_cb from the curl extension helpers.
* - Memory allocated for temporary strings and buffers is freed before exit.
*/
/**
* @brief Opcode handler for OP_CURL_GET.
*
* Converts the top stack value to a URL string, issues a GET request
* using libcurl, and pushes the response body as a string. When
* compiled without FUN_WITH_CURL, the opcode becomes a no-op that
* consumes one value and pushes an empty string.
*/
case OP_CURL_GET: {
#ifdef FUN_WITH_CURL
Value vurl = pop_value(vm);

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -21,6 +21,10 @@
* - Pops: body:string, url:string (values are converted via value_to_string_alloc)
* - Pushes: body:string (server response; "" on error or when CURL is disabled)
*
* Pops the POST body and URL, performs an HTTP POST, and pushes the
* response as a string. Without FUN_WITH_CURL, consumes two values and
* pushes an empty string.
*
* Error handling:
* - If URL conversion fails, the opcode pushes an empty string and discards
* any converted body.
@ -31,13 +35,7 @@
* - Uses FunCurlBuf and fun_curl_write_cb from the curl extension helpers.
* - All temporary allocations (URL, body, response buffer) are freed.
*/
/**
* @brief Opcode handler for OP_CURL_POST.
*
* Pops the POST body and URL, performs an HTTP POST, and pushes the
* response as a string. Without FUN_WITH_CURL, consumes two values and
* pushes an empty string.
*/
case OP_CURL_POST: {
#ifdef FUN_WITH_CURL
Value vbody = pop_value(vm);

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -29,6 +29,7 @@
* See also
* - ini_alloc_handle(), ini_free_handle() in src/vm/ini/handles.c
*/
/* OP_INI_FREE: pops handle; pushes 1/0 */
#ifdef FUN_WITH_INI
case OP_INI_FREE: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -28,6 +28,7 @@
* Errors
* - Invalid handle or arguments simply yield the default value; no exception.
*/
/* OP_INI_GET_BOOL */
#ifdef FUN_WITH_INI
case OP_INI_GET_BOOL: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -22,6 +22,7 @@
* Errors
* - Invalid handle/args simply produce the default; no exception raised.
*/
/* OP_INI_GET_DOUBLE */
#ifdef FUN_WITH_INI
case OP_INI_GET_DOUBLE: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -22,6 +22,7 @@
* Errors
* - Invalid handle/args produce the default; no VM exception is raised.
*/
/* OP_INI_GET_INT */
#ifdef FUN_WITH_INI
case OP_INI_GET_INT: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -22,6 +22,7 @@
* Errors
* - Invalid handle/args result in pushing the default (or empty string).
*/
/* OP_INI_GET_STRING */
#ifdef FUN_WITH_INI
case OP_INI_GET_STRING: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -11,6 +11,7 @@
* @file handles.h
* @brief INI handle registry for iniparser 4.2.6 used by INI VM opcodes.
*/
#pragma once
#ifdef FUN_WITH_INI

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -23,6 +23,7 @@
* - The returned handle must later be released with OP_INI_FREE to avoid
* leaking dictionary objects.
*/
/* OP_INI_LOAD: pops path string; pushes handle (>0) or 0 */
#ifdef FUN_WITH_INI
case OP_INI_LOAD: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -22,6 +22,7 @@
* Errors
* - Failing fopen() or invalid handle simply return 0; no exception is thrown.
*/
/* OP_INI_SAVE */
#ifdef FUN_WITH_INI
case OP_INI_SAVE: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -23,6 +23,7 @@
* Errors
* - No VM exception is thrown; failures return 0.
*/
/* OP_INI_SET */
#ifdef FUN_WITH_INI
case OP_INI_SET: {

View file

@ -1,3 +1,12 @@
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
* Copyright 2025 Johannes Findeisen <you@hanez.org>
* Licensed under the terms of the Apache-2.0 license.
* https://opensource.org/license/apache-2-0
*/
/**
* @file stubs.c
* @brief Stub opcode implementations for INI support when FUN_WITH_INI is disabled.

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -23,6 +23,7 @@
* - iniparser 4.2.6 dictionary_unset() returns void; we assume success when
* called with valid parameters.
*/
/* OP_INI_UNSET */
#ifdef FUN_WITH_INI
case OP_INI_UNSET: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -48,6 +48,7 @@
* // Stack before (bit0=1): ["Enter password: "]
* // Stack after: ["user-typed-line"]
*/
case OP_INPUT_LINE: {
/* operand bit flags:
* bit0 (1): has prompt (string or any value convertible to string) top of stack holds prompt when set

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -26,9 +26,6 @@
* // Bytecode: OP_READ_FILE
* // Stack before: ["file.txt"]
* // Stack after: ["file contents"]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_READ_FILE: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
@ -26,9 +26,6 @@
* // Bytecode: OP_WRITE_FILE
* // Stack before: ["file.txt", "data"]
* // Stack after: [1]
*
* @author Johannes Findeisen
* @date 2025-10-16
*/
case OP_WRITE_FILE: {

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

View file

@ -1,4 +1,4 @@
/**
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*

Some files were not shown because too many files have changed in this diff Show more