cleanup and implementation of builtin functions
This commit is contained in:
parent
78bb3321d8
commit
06f385d6b0
11 changed files with 621 additions and 302 deletions
59
src/callframe.h
Normal file
59
src/callframe.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* This code is part of the programming language flup
|
||||
* flup comes with ABSOLUTELY NO WARRANTY and is licensed under AGPL-3.0 or later.
|
||||
* Copyright (C) 2024 VegOwOtenks
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef FLUP_CALLFRAME_H
|
||||
#define FLUP_CALLFRAME_H
|
||||
|
||||
#include "function.h"
|
||||
#include "variable.h"
|
||||
#include "value.h"
|
||||
#include "dynamicarray/dynamicarray.h"
|
||||
#include "StringView/StringView.h"
|
||||
#include "Scratchpad/Scratchpad.h"
|
||||
|
||||
typedef struct CallFrame_s {
|
||||
size_t instruction_pointer;
|
||||
/* ip = condition start : start
|
||||
* ip = condition_end + 1 : done
|
||||
*
|
||||
*/
|
||||
FlupFunction* self_function;
|
||||
FlupFunctionAlternative* alternative;
|
||||
FlupFunction* functions; // functions defined in this callframe
|
||||
FlupVariable* variables; // variables defined in this callframe
|
||||
DynamicArray stack; // Value
|
||||
Scratchpad memory_pad;
|
||||
} CallFrame;
|
||||
|
||||
int CallFrame_Create(CallFrame* self, FlupFunction* self_function);
|
||||
void CallFrame_Destroy(CallFrame* self);
|
||||
|
||||
int CallFrame_DefineVariable(CallFrame* self, StringView name, Value value);
|
||||
int CallFrame_StackPop(CallFrame* self, Value* dest);
|
||||
int CallFrame_StackPush(CallFrame* self, Value* value);
|
||||
FlupVariable* CallFrame_FindVariable(CallFrame* self, StringView name);
|
||||
void* CallFrame_Reserve(CallFrame* self, size_t amount, size_t alignment);
|
||||
bool CallFrame_IsExecutingCondition(CallFrame* frame);
|
||||
bool CallFrame_IsSelectingCondition(CallFrame* frame);
|
||||
bool CallFrame_IsExecutingBody(CallFrame* frame);
|
||||
bool CallFrame_IsReturningBody(CallFrame* frame);
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue