Compare commits
10 Commits
9909e03dc3
...
ea83025455
Author | SHA1 | Date |
---|---|---|
Mike Nolan | ea83025455 | |
Mike Nolan | c726d6c0bb | |
Mike Nolan | 5dbe7a6604 | |
Mike Nolan | 1f578e25fa | |
Mike Nolan | ff2140ddd8 | |
Mike Nolan | c5bc5bc9ce | |
Mike Nolan | b229826e14 | |
Mike Nolan | fde7c6b5ab | |
Mike Nolan | 82fef9c699 | |
Mike Nolan | bcbd2f124c |
|
@ -3,3 +3,12 @@ project(TLangInterperter)
|
|||
|
||||
add_subdirectory(libtlang)
|
||||
add_subdirectory(tlang)
|
||||
install(TARGETS tlang RUNTIME DESTINATION bin)
|
||||
set(CPACK_PACKAGE_NAME "tlang")
|
||||
set(CPACK_PROJECT_NAME "tlang")
|
||||
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR 0)
|
||||
set(CPACK_PACKAGE_VERSION_MINOR 0)
|
||||
set(CPACK_PACKAGE_VERSION_PATCH 0)
|
||||
set(CPACK_PACKAGE_VERSION_PATCH 1)
|
||||
include(CPack)
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
# TLang Scripting Language
|
||||
# TLang Scripting Language
|
||||
|
||||
## Please don't use yet (still in buggy state and will probably change)
|
|
@ -0,0 +1,7 @@
|
|||
FROM devkitpro/devkitppc:20230501
|
||||
RUN dkp-pacman --noconfirm -Su && dkp-pacman --noconfirm -S libfat-ogc ppc-zlib ppc-jansson
|
||||
WORKDIR "/tmp"
|
||||
RUN wget https://gitlab.com/4TU/wii-packages/uploads/686f898638fb96af55e3754b92c5aaa7/libwiisocket-0.1-1-any.pkg.tar.zst https://gitlab.com/4TU/wii-packages/uploads/fc3378553929e58a397df6ec6204a1c0/wii-mbedtls-2.16.6-1-any.pkg.tar.zst https://gitlab.com/4TU/wii-packages/uploads/2b19acc728140dcfbbf7e18f9d9e312a/wii-curl-7.75.0-1-any.pkg.tar.zst && dkp-pacman --noconfirm -U libwiisocket-0.1-1-any.pkg.tar.zst wii-mbedtls-2.16.6-1-any.pkg.tar.zst wii-curl-7.75.0-1-any.pkg.tar.zst
|
||||
WORKDIR "/usr/local/bin"
|
||||
COPY run.sh run.sh
|
||||
ENTRYPOINT ["bash","/usr/local/bin/run.sh"]
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<app version="1">
|
||||
<name>TLang Scripting Language</name>
|
||||
<version>0.0.0.1</version>
|
||||
<release_date>20230510000000</release_date>
|
||||
<coder>Tesses</coder>
|
||||
<short_description>TLang Wii Version</short_description>
|
||||
<long_description>My Scripting Language Created In 2023
|
||||
</long_description>
|
||||
</app>
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
mkdir /project
|
||||
cd /project
|
||||
git clone https://gitlab.tesses.net/tesses50/tlang-c .
|
||||
cd libtlang
|
||||
make -f Makefile.wii
|
||||
mkdir -p /out/apps/TLang/
|
||||
cp boot.dol /out/apps/TLang/
|
||||
cp /project/docker/Wii/meta.xml /out/apps/TLang/
|
||||
cp /project/docker/Wii/icon.png /out/apps/TLang/
|
|
@ -1,6 +1,7 @@
|
|||
project(tlanginterp)
|
||||
add_library(tlanginterp STATIC src/addnode.c src/bit.c src/bitwiseand.c src/bitwiseor.c src/breaknode.c src/bwnot.c src/closurenode.c src/constnode.c src/curl.c src/dict.c src/dirittr.c src/dividenode.c src/eachnode.c src/eq.c src/forloop.c src/fs.c src/functioncallnode.c src/getarraynode.c src/getmembernode.c src/getvariablenode.c src/getvariablenode.c src/greaterthan.c src/greaterthanequal.c src/if.c src/ittr.c src/json.c src/leftshift.c src/lessthan.c src/lessthanequal.c src/lexer.c src/lextokenlist.c src/listittr.c src/logicaland.c src/logicalor.c src/mbed.c src/methodcallnode.c src/modulonode.c src/multiplynode.c src/neg.c src/neq.c src/net.c src/nodetwo.c src/not.c src/parser.c src/postfixdecrementnode.c src/postfixincrementnode.c src/rand.c src/returnnode.c src/rightshift.c src/runtime.c src/scope.c src/scopenode.c src/sdl2.c src/setvariablenode.c src/stream.c src/string.c src/stringittr.c src/subnode.c src/switch.c src/threading.c src/tobject.c src/whileloop.c src/wpad-wii.c src/xor.c include/FreeMonoBold.h include/myfeatures.h include/tlang_version.h include/tlang.h)
|
||||
add_definitions(-DCMAKE_TLANG_BUILD)
|
||||
add_library(tlanginterp STATIC src/addnode.c src/bit.c src/bitwiseand.c src/bitwiseor.c src/breaknode.c src/bwnot.c src/closurenode.c src/constnode.c src/curl.c src/dict.c src/dirittr.c src/dividenode.c src/eachnode.c src/eq.c src/forloop.c src/fs.c src/functioncallnode.c src/getarraynode.c src/getmembernode.c src/getvariablenode.c src/getvariablenode.c src/greaterthan.c src/greaterthanequal.c src/if.c src/ittr.c src/json.c src/leftshift.c src/lessthan.c src/lessthanequal.c src/lexer.c src/lextokenlist.c src/listittr.c src/logicaland.c src/logicalor.c src/mbed.c src/methodcallnode.c src/modulonode.c src/multiplynode.c src/neg.c src/neq.c src/net.c src/nodetwo.c src/not.c src/parser.c src/postfixdecrementnode.c src/postfixincrementnode.c src/rand.c src/returnnode.c src/rightshift.c src/runtime.c src/scope.c src/scopenode.c src/sdl2.c src/setvariablenode.c src/stream.c src/string.c src/stringittr.c src/subnode.c src/switch.c src/threading.c src/tobject.c src/whileloop.c src/wpad-wii.c src/xor.c include/FreeMonoBold.h include/myfeatures.h include/tlang_version.h include/tlang.h)
|
||||
|
||||
option(USE_SDL "Enable SDL2" ON)
|
||||
option(USE_NETWORK "Enable Networking" ON)
|
||||
option(USE_CURL "Enable curl" ON)
|
||||
|
|
|
@ -285,7 +285,7 @@ void list_create(runtime_t* rt,list_tobject_t* ls,int count);
|
|||
void list_add(list_tobject_t* a,tobject_t* item);
|
||||
void string_appendn(string_t* s,double val);
|
||||
bool string_samep(string_t* s,const char* text);
|
||||
string_t* string_replace(string_t* text,string_t* old,string_t* new);
|
||||
string_t* string_replace(string_t* text,string_t* old,string_t*);
|
||||
tobject_t* string_split(runtime_t* rt,string_t* text,string_t* del,int max,bool empty);
|
||||
bool string_startswith(string_t* haystack,string_t* needle);
|
||||
bool string_endswith(string_t* haystack,string_t* needle);
|
||||
|
|
|
@ -96,7 +96,7 @@ tobject_t* __node_getarray_execute(node_t* n,scope_t* s,retarg_t* retArg)
|
|||
}
|
||||
void __kvp_set(tobject_t* parent_obj,tobject_t* argument_obj,tobject_t* variable)
|
||||
{
|
||||
if(parent_obj->type != tdict) return NULL;
|
||||
if(parent_obj->type != tdict) return;
|
||||
if(argument_obj->type == tstring)
|
||||
{
|
||||
char* p = string_dupp(argument_obj->data.string);
|
||||
|
|
|
@ -44,7 +44,7 @@ tobject_t* __node_method_call_execute(node_t* n,scope_t* s,retarg_t* retArg)
|
|||
o->type = tchar;
|
||||
o->data.chr= parent_obj->data.boolean ? 'y' : 'n';
|
||||
}
|
||||
if(strcmp(name,'toNumber') == 0)
|
||||
if(strcmp(name,"toNumber") == 0)
|
||||
{
|
||||
o = tobject_create(s->rt);
|
||||
o->type = tnumber;
|
||||
|
|
|
@ -123,7 +123,7 @@ tobject_t* __fs_readalltext_external_method(runtime_t* rt,void* ptr,list_tobject
|
|||
if(f)
|
||||
{
|
||||
string_t* str = string_create();
|
||||
string_read(str,f,fread);
|
||||
string_read(str,f,(size_t (*)(void*,size_t,size_t,void*))fread);
|
||||
free(fileName);
|
||||
fclose(f);
|
||||
return tobject_string(rt,str);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "tlang.h"
|
||||
extern void __node_two_free(node_t* n);
|
||||
extern void __node_single_free(node_t* n);
|
||||
node_t* __case_node_exec(node_t* n,scope_t* s,retarg_t* retArg)
|
||||
tobject_t* __case_node_exec(node_t* n,scope_t* s,retarg_t* retArg)
|
||||
{
|
||||
return n->data.two_node_node.right->execute(n->data.two_node_node.right,s,retArg);
|
||||
}
|
||||
node_t* __default_node_exec(node_t* n,scope_t* s,retarg_t* retArg)
|
||||
tobject_t* __default_node_exec(node_t* n,scope_t* s,retarg_t* retArg)
|
||||
{
|
||||
return n->data.single_node_node->execute(n->data.single_node_node,s,retArg);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "tlang.h"
|
||||
extern tobject_t* __loop_exec2(node_t* n,scope_t* s,retarg_t* retArg);
|
||||
extern bool __loop_bool(node_t* n,scope_t* s,retarg_t* retArg);
|
||||
node_t* __while_loop_exec(node_t* n,scope_t* s,retarg_t* retArg)
|
||||
tobject_t* __while_loop_exec(node_t* n,scope_t* s,retarg_t* retArg)
|
||||
{
|
||||
|
||||
s=scope_begin(s);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
project(tlang)
|
||||
add_executable(tlang src/main.c)
|
||||
target_link_libraries(tlang tlanginterp)
|
||||
|
||||
target_link_libraries(tlang tlanginterp)
|
||||
|
||||
|
|
|
@ -4,63 +4,12 @@ void register_funcs(runtime_t* rt)
|
|||
{
|
||||
|
||||
}
|
||||
#if defined(GEKKO)
|
||||
#include <fat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <gccore.h>
|
||||
|
||||
void init_ogc(runtime_t* rt)
|
||||
{
|
||||
#if defined(HW_RVL)
|
||||
__reg_wpad(rt);
|
||||
#endif
|
||||
VIDEO_Init();
|
||||
|
||||
fatInitDefault();
|
||||
// Obtain the preferred video mode from the system
|
||||
// This will correspond to the settings in the Wii menu
|
||||
rmode = VIDEO_GetPreferredMode(NULL);
|
||||
|
||||
// Allocate memory for the display in the uncached region
|
||||
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
|
||||
// Initialise the console, required for printf
|
||||
console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
|
||||
|
||||
// Set up the video registers with the chosen mode
|
||||
VIDEO_Configure(rmode);
|
||||
|
||||
// Tell the video hardware where our display memory is
|
||||
VIDEO_SetNextFramebuffer(xfb);
|
||||
|
||||
// Make the display visible
|
||||
VIDEO_SetBlack(FALSE);
|
||||
|
||||
// Flush the video register changes to the hardware
|
||||
VIDEO_Flush();
|
||||
|
||||
// Wait for Video setup to complete
|
||||
VIDEO_WaitVSync();
|
||||
if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
|
||||
|
||||
// The console understands VT terminal escape codes
|
||||
// This positions the cursor on row 2, column 0
|
||||
// we can use variables for this with format codes too
|
||||
// e.g. printf ("\x1b[%d;%dH", row, column );
|
||||
printf("\x1b[2;0H");
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
runtime_t* rt = runtime_init();
|
||||
runtime_register_std(rt);
|
||||
runtime_register(rt,register_funcs);
|
||||
#if defined(GEKKO)
|
||||
init_ogc(rt);
|
||||
#endif
|
||||
|
||||
if(argc < 2)
|
||||
{
|
||||
string_t* cmd=string_create();
|
||||
|
@ -88,7 +37,7 @@ int main(int argc,char** argv)
|
|||
|
||||
FILE* f = fopen(argv[1],"r");
|
||||
if(f != NULL){
|
||||
string_read(cmd,f,fread);
|
||||
string_read(cmd,f,(size_t (*)(void*,size_t,size_t,void*))fread);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue