Added some missing license headers and some cosmetic changes.
This commit is contained in:
parent
4345fc6f0c
commit
ff155b6a31
9 changed files with 56 additions and 4 deletions
|
|
@ -1,5 +1,14 @@
|
||||||
#!/usr/bin/env fun
|
#!/usr/bin/env fun
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Fun programming language.
|
||||||
|
* https://hanez.org/project/fun/
|
||||||
|
*
|
||||||
|
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||||
|
* Licensed under the terms of the ISC license.
|
||||||
|
* https://opensource.org/license/isc-license-txt
|
||||||
|
*/
|
||||||
|
|
||||||
// Environment variables via env(name):
|
// Environment variables via env(name):
|
||||||
// - Returns the value as a string.
|
// - Returns the value as a string.
|
||||||
// - If the variable is not set, returns an empty string.
|
// - If the variable is not set, returns an empty string.
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,8 @@
|
||||||
* https://opensource.org/license/isc-license-txt
|
* https://opensource.org/license/isc-license-txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "bytecode.h"
|
#include "bytecode.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
Bytecode *bytecode_new(void) {
|
Bytecode *bytecode_new(void) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
* https://opensource.org/license/isc-license-txt
|
* https://opensource.org/license/isc-license-txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef FUN_BYTECODE_H
|
#ifndef FUN_BYTECODE_H
|
||||||
#define FUN_BYTECODE_H
|
#define FUN_BYTECODE_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@
|
||||||
* @date 2025-10-16
|
* @date 2025-10-16
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef FUN_VALUE_H
|
#ifndef FUN_VALUE_H
|
||||||
#define FUN_VALUE_H
|
#define FUN_VALUE_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
|
/**
|
||||||
|
* This file is part of the Fun programming language.
|
||||||
|
* https://hanez.org/project/fun/
|
||||||
|
*
|
||||||
|
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||||
|
* Licensed under the terms of the ISC license.
|
||||||
|
* https://opensource.org/license/isc-license-txt
|
||||||
|
*/
|
||||||
|
|
||||||
case OP_LINE: {
|
case OP_LINE: {
|
||||||
/* operand holds the source line number */
|
/* operand holds the source line number */
|
||||||
vm->current_line = inst.operand;
|
vm->current_line = inst.operand;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,14 @@
|
||||||
|
/**
|
||||||
|
* This file is part of the Fun programming language.
|
||||||
|
* https://hanez.org/project/fun/
|
||||||
|
*
|
||||||
|
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||||
|
* Licensed under the terms of the ISC license.
|
||||||
|
* https://opensource.org/license/isc-license-txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Get environment variables of the operation system.
|
||||||
|
|
||||||
case OP_ENV: {
|
case OP_ENV: {
|
||||||
Value key = pop_value(vm);
|
Value key = pop_value(vm);
|
||||||
if (key.type != VAL_STRING) {
|
if (key.type != VAL_STRING) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
|
/**
|
||||||
|
* This file is part of the Fun programming language.
|
||||||
|
* https://hanez.org/project/fun/
|
||||||
|
*
|
||||||
|
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||||
|
* Licensed under the terms of the ISC license.
|
||||||
|
* https://opensource.org/license/isc-license-txt
|
||||||
|
*/
|
||||||
|
|
||||||
case OP_SCLAMP: {
|
case OP_SCLAMP: {
|
||||||
/* Clamp/wrap to signed N-bit range: [-2^(N-1), 2^(N-1)-1] */
|
/* Clamp/wrap to signed N-bit range: [-2^(N-1), 2^(N-1)-1] */
|
||||||
Value v = pop_value(vm);
|
Value v = pop_value(vm);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
|
/**
|
||||||
|
* This file is part of the Fun programming language.
|
||||||
|
* https://hanez.org/project/fun/
|
||||||
|
*
|
||||||
|
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||||
|
* Licensed under the terms of the ISC license.
|
||||||
|
* https://opensource.org/license/isc-license-txt
|
||||||
|
*/
|
||||||
|
|
||||||
case OP_TYPEOF: {
|
case OP_TYPEOF: {
|
||||||
Value v = pop_value(vm);
|
Value v = pop_value(vm);
|
||||||
const char *tname = "Unknown";
|
const char *tname = "Unknown";
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
|
/**
|
||||||
|
* This file is part of the Fun programming language.
|
||||||
|
* https://hanez.org/project/fun/
|
||||||
|
*
|
||||||
|
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||||
|
* Licensed under the terms of the ISC license.
|
||||||
|
* https://opensource.org/license/isc-license-txt
|
||||||
|
*/
|
||||||
|
|
||||||
case OP_UCLAMP: {
|
case OP_UCLAMP: {
|
||||||
/* Clamp/wrap the integer on top of the stack to 'bits' width (unsigned) */
|
/* Clamp/wrap the integer on top of the stack to 'bits' width (unsigned) */
|
||||||
Value v = pop_value(vm);
|
Value v = pop_value(vm);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue