What is CPP? Holy shit... (0.38.4)
This commit is contained in:
parent
d39ef1a58e
commit
d79815e366
10 changed files with 158 additions and 4 deletions
28
src/vm/cpp/add.cpp
Normal file
28
src/vm/cpp/add.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* This file is part of the Fun programming language.
|
||||
* https://fun-lang.xyz/
|
||||
*
|
||||
* Copyright 2026 Johannes Findeisen <you@hanez.org>
|
||||
* Licensed under the terms of the Apache-2.0 license.
|
||||
* https://opensource.org/license/apache-2-0
|
||||
*
|
||||
* Added: 2026-01-29
|
||||
*/
|
||||
|
||||
/*
|
||||
* Minimal C++ opcode for Fun VM — cpp_add
|
||||
* Build is gated by -DFUN_WITH_CPP=ON (see CMake).
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
extern "C" {
|
||||
#include "vm.h" // C header; provides VM, vm_pop_i64, vm_push_i64
|
||||
}
|
||||
|
||||
extern "C" int fun_op_cpp_add(VM *vm) {
|
||||
int64_t b = vm_pop_i64(vm);
|
||||
int64_t a = vm_pop_i64(vm);
|
||||
vm_push_i64(vm, a + b);
|
||||
return 0; // success
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue