Remove D tests
Move D tests to separate branch, since the bindings have an unstable API.
This commit is contained in:
parent
d03cc272be
commit
7c9d314076
7 changed files with 7 additions and 3187 deletions
15
.gitignore
vendored
15
.gitignore
vendored
|
|
@ -118,20 +118,18 @@
|
||||||
!/src/init
|
!/src/init
|
||||||
/src/init/*
|
/src/init/*
|
||||||
|
|
||||||
|
# /src/init/c
|
||||||
|
!/src/init/c/
|
||||||
|
/src/init/c/*
|
||||||
|
|
||||||
|
!/src/init/c/gdextension_interface.c
|
||||||
|
|
||||||
# /src/init/cpp
|
# /src/init/cpp
|
||||||
!/src/init/cpp/
|
!/src/init/cpp/
|
||||||
/src/init/cpp/*
|
/src/init/cpp/*
|
||||||
|
|
||||||
!/src/init/cpp/bind.cpp
|
!/src/init/cpp/bind.cpp
|
||||||
|
|
||||||
# /src/init/d
|
|
||||||
!/src/init/d/
|
|
||||||
/src/init/d/*
|
|
||||||
|
|
||||||
!/src/init/d/bind.d
|
|
||||||
|
|
||||||
!/src/init/d
|
|
||||||
|
|
||||||
# /res
|
# /res
|
||||||
!/res/
|
!/res/
|
||||||
/res/*
|
/res/*
|
||||||
|
|
@ -149,4 +147,3 @@
|
||||||
# Godot 4+ specific ignores
|
# Godot 4+ specific ignores
|
||||||
.godot/
|
.godot/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
name "spruce-basin"
|
|
||||||
description "Source material."
|
|
||||||
authors "AUTHORS"
|
|
||||||
copyright "Copyright © 2025, AUTHORS"
|
|
||||||
license "proprietary"
|
|
||||||
dependency "godot-dlang" version="~master"
|
|
||||||
configuration "spruce-basin" {
|
|
||||||
targetType "dynamicLibrary"
|
|
||||||
dflags "-dllimport=defaultLibsOnly" platform="windows-ldc2"
|
|
||||||
targetName "../../obj/spruce-basin"
|
|
||||||
mainSourceFile "../../../src/init/bind.d"
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"fileVersion": 1,
|
|
||||||
"versions": {
|
|
||||||
"godot-dlang": "~master",
|
|
||||||
"utf_bc": "0.2.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,286 +0,0 @@
|
||||||
/**
|
|
||||||
* @author : Aidan Mullen (git@acm.contact)
|
|
||||||
* @file : filesize
|
|
||||||
* @created : Wednesday Jun 19, 2024 21:10:14 EDT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "filesize.h"
|
|
||||||
|
|
||||||
/* Test FILENAME_MAX on different platforms. */
|
|
||||||
|
|
||||||
char filename[FILENAME_MAX];
|
|
||||||
char name[FILENAME_MAX];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ===========
|
|
||||||
* Buffer Size
|
|
||||||
* ===========
|
|
||||||
*
|
|
||||||
* Buffer size is chosen at compilation; it limits the block-size chosen by the
|
|
||||||
* user. When the block size is greater than the buffer, overflow occurs.
|
|
||||||
*
|
|
||||||
* The buffer size is defined in bytes.
|
|
||||||
*
|
|
||||||
* Larger buffer sizes are less accurate, which may be possible to fix if a
|
|
||||||
* position is set at the end of the read block, then the remaining area is
|
|
||||||
* read using a smaller buffer size.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This buffer size selection should be relegated to the options.ini file. */
|
|
||||||
|
|
||||||
#define BUFFER 1073741824
|
|
||||||
|
|
||||||
#if !defined(BUFFER) || BUFFER == 1
|
|
||||||
|
|
||||||
char buf[1]; /* 1B */
|
|
||||||
|
|
||||||
#elif BUFFER == 2
|
|
||||||
|
|
||||||
char buf[2]; /* 2B */
|
|
||||||
|
|
||||||
#elif BUFFER == 4
|
|
||||||
|
|
||||||
char buf[4]; /* 4B */
|
|
||||||
|
|
||||||
#elif BUFFER == 8
|
|
||||||
|
|
||||||
char buf[8]; /* 8B */
|
|
||||||
|
|
||||||
#elif BUFFER == 16
|
|
||||||
|
|
||||||
char buf[16]; /* 16B */
|
|
||||||
|
|
||||||
#elif BUFFER == 32
|
|
||||||
|
|
||||||
char buf[32]; /* 32B */
|
|
||||||
|
|
||||||
#elif BUFFER == 64
|
|
||||||
|
|
||||||
char buf[64]; /* 64B */
|
|
||||||
|
|
||||||
#elif BUFFER == 128
|
|
||||||
|
|
||||||
char buf[128]; /* 128B */
|
|
||||||
|
|
||||||
#elif BUFFER == 256
|
|
||||||
|
|
||||||
char buf[256]; /* 256B */
|
|
||||||
|
|
||||||
#elif BUFFER == 512
|
|
||||||
|
|
||||||
char buf[512]; /* 512B */
|
|
||||||
|
|
||||||
#elif BUFFER == 1024
|
|
||||||
|
|
||||||
char buf[1024]; /* 1KB */
|
|
||||||
|
|
||||||
#elif BUFFER == 2048
|
|
||||||
|
|
||||||
char buf[2048]; /* 2KB */
|
|
||||||
|
|
||||||
#elif BUFFER == 4096
|
|
||||||
|
|
||||||
char buf[4096]; /* 4KB */
|
|
||||||
|
|
||||||
#elif BUFFER == 8192
|
|
||||||
|
|
||||||
char buf[8192]; /* 8KB */
|
|
||||||
|
|
||||||
#elif BUFFER == 1048576
|
|
||||||
|
|
||||||
char buf[1048576]; /* 1MB */
|
|
||||||
|
|
||||||
#elif BUFFER == 536870912
|
|
||||||
|
|
||||||
char buf[536870912]; /* 512MB */
|
|
||||||
|
|
||||||
#elif BUFFER == 1073741824
|
|
||||||
|
|
||||||
char buf[1073741824]; /* 1GB */
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
char buf[BUFFER];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned long int bsize = BUFFER;
|
|
||||||
|
|
||||||
fpos_t pos;
|
|
||||||
fpos_t end;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ===============
|
|
||||||
* Fallback Reader
|
|
||||||
* ===============
|
|
||||||
*
|
|
||||||
* The reader counts each record in the file, then adds the value of the records
|
|
||||||
* (in bytes) in order to return the filesize.
|
|
||||||
*
|
|
||||||
* Fallback function in-case a platform solution is not present.
|
|
||||||
* Note that, depending on the buffer size, this method may be somewhat
|
|
||||||
* inaccurate, as a higher buffer size will only measure in records equivalent
|
|
||||||
* to its value, and may stop before reaching the end of the file; it may be
|
|
||||||
* possible to account for this by restarting the file-read at the endpoint
|
|
||||||
* found by fread with a lower buffer size, but this would require that fseek
|
|
||||||
* and ftell are not used, since these often use signed 32-bit integers that
|
|
||||||
* limit the maximum size they can read to ~2GB.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int get_size_fallback(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
unsigned long int size = 0;
|
|
||||||
unsigned long int record = 0;
|
|
||||||
*/
|
|
||||||
unsigned long size = 0;
|
|
||||||
unsigned long record = 0;
|
|
||||||
|
|
||||||
FILE * file;
|
|
||||||
|
|
||||||
/* If mode is CLI */
|
|
||||||
printf("Enter a filename: ");
|
|
||||||
|
|
||||||
fgets(filename, sizeof(filename), stdin);
|
|
||||||
|
|
||||||
/* Compare filename with \r\n and remove them. */
|
|
||||||
filename[strcspn(filename, "\r\n")] = 0;
|
|
||||||
|
|
||||||
strcpy(name, filename);
|
|
||||||
printf("Reading file \"%s\"...\n", name);
|
|
||||||
|
|
||||||
file = fopen(filename, "rb");
|
|
||||||
|
|
||||||
printf("Warning: Using fallback reader; process may be slow.\n");
|
|
||||||
printf("Initial buffer size: %lu\n", bsize);
|
|
||||||
|
|
||||||
if (file)
|
|
||||||
{
|
|
||||||
fgetpos(file, &pos);
|
|
||||||
|
|
||||||
printf("Attempting to read file...\n");
|
|
||||||
|
|
||||||
for
|
|
||||||
(
|
|
||||||
size = 0;
|
|
||||||
(fread(buf, sizeof * buf, bsize, file) == bsize);
|
|
||||||
(record = size)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
(size = size + bsize);
|
|
||||||
fgetpos(file, &end);
|
|
||||||
printf("Read: [ %luB ]\n", size);
|
|
||||||
|
|
||||||
if (record == size)
|
|
||||||
{
|
|
||||||
printf("No appropriately sized blocks remaining.\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ==============
|
|
||||||
* Small File Fix
|
|
||||||
* ==============
|
|
||||||
*
|
|
||||||
* If result is 0, try again with lower block size, as small
|
|
||||||
* files cannot be read when the selected size is larger than them.
|
|
||||||
*/
|
|
||||||
|
|
||||||
record = 0;
|
|
||||||
|
|
||||||
if (size == 0)
|
|
||||||
{
|
|
||||||
while (bsize > 1)
|
|
||||||
{
|
|
||||||
printf("Attempting to read with lower buffer size...\n");
|
|
||||||
|
|
||||||
bsize = (bsize/2);
|
|
||||||
/* bsize = 1; */
|
|
||||||
fsetpos(file, &pos);
|
|
||||||
printf("Buffer size lowered to %luB\n", bsize);
|
|
||||||
|
|
||||||
while (fread(buf, sizeof * buf, bsize, file) == bsize)
|
|
||||||
{
|
|
||||||
size = size + bsize;
|
|
||||||
fgetpos(file, &pos);
|
|
||||||
printf("Read: [ %luB ]\n", size);
|
|
||||||
|
|
||||||
if (record == size)
|
|
||||||
{
|
|
||||||
printf("No appropriately sized blocks remaining.\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
record = size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ==============
|
|
||||||
* Large File Fix
|
|
||||||
* ==============
|
|
||||||
*
|
|
||||||
* Using a large buffer to read large files quickly resulted in an
|
|
||||||
* inaccurate filesize.
|
|
||||||
*
|
|
||||||
* This block lowers the block size at the end of the reading, and
|
|
||||||
* attempts to read data after the current position in the file. It
|
|
||||||
* repeats this until the buffer size is one byte.
|
|
||||||
*
|
|
||||||
* The accuracy should be around plus-or-minus one byte when reading.
|
|
||||||
*/
|
|
||||||
|
|
||||||
while (size > 0)
|
|
||||||
{
|
|
||||||
printf("Checking for remaining data...\n");
|
|
||||||
|
|
||||||
bsize = (bsize/2);
|
|
||||||
|
|
||||||
fsetpos(file, &end);
|
|
||||||
|
|
||||||
while (fread(buf, sizeof * buf, bsize, file) == bsize)
|
|
||||||
{
|
|
||||||
size = size + bsize;
|
|
||||||
fgetpos(file, &end);
|
|
||||||
printf("Read: [ %luB ]\n", size);
|
|
||||||
|
|
||||||
if (record == size)
|
|
||||||
{
|
|
||||||
printf("No appropriately sized blocks remaining.\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
record = size;
|
|
||||||
}
|
|
||||||
if (bsize > 1)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Buffer at minimum size; stopping.\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("No further data to read; stopping.\n");
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
|
|
||||||
printf("Final buffer size: %luB\n", bsize);
|
|
||||||
printf("\nFilesize: %luB\n", size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Error: file not found.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- end of SIZE_C --- */
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,30 +0,0 @@
|
||||||
import godot;
|
|
||||||
// import godot.api.script; // for GodotScript!
|
|
||||||
// import godot.api.register; // for GodotNativeLibrary
|
|
||||||
// import godot.string; // for gs!
|
|
||||||
|
|
||||||
import godot.node;
|
|
||||||
|
|
||||||
// minimal class example with _ready method that will be invoked on creation
|
|
||||||
class init : GodotScript!Node {
|
|
||||||
@Property String name;
|
|
||||||
|
|
||||||
// this method is a special godot entry point when object is added to the scene
|
|
||||||
@Method
|
|
||||||
void _ready() {
|
|
||||||
// 'gs' is a string wrapper that converts D string to godot string
|
|
||||||
// usually there is helper functions that takes regular D strings and do this for you
|
|
||||||
print(gs!"Hello ", name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// register classes, initialize and terminate D runtime, only one per plugin
|
|
||||||
mixin GodotNativeLibrary!(
|
|
||||||
// this is a name prefix of the plugin to be acessible inside godot
|
|
||||||
// it must match the prefix in .gdextension file:
|
|
||||||
// entry_symbol = "mydplugin_gdextension_entry"
|
|
||||||
"libsb_init",
|
|
||||||
|
|
||||||
// here goes the list of classes you would like to expose in godot
|
|
||||||
init,
|
|
||||||
);
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
/* This file is included in the repository since using a Git submodule would
|
/* This file is included in the repository since using a Git submodule would
|
||||||
* requried cloning the entire Godot source. */
|
* requried cloning the entire Godot source. */
|
||||||
#include "gdextension_interface.h" /* GDExtension header for Godot. */
|
#include "./init/c/gdextension_interface.h" /* GDExtension header for Godot. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int main()
|
int main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue