Skip to content

Commit

Permalink
feat(gui): dropping ui because it would require pthreads.
Browse files Browse the repository at this point in the history
It's possible, but there are too many dependencies, not worth it.
  • Loading branch information
razshare committed Mar 24, 2024
1 parent f2f087d commit ac18c8b
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 891 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
],
"scripts": {
"load": "composer dump-autoload -o && pre-commit autoupdate",
"prod:start:gui": "./prod-gui-example.sh",
"prod:build:go": "./prod_build_go.sh",
"prod:start": "php -dphar.readonly=0 -dopcache.enable_cli=1 -dopcache.jit_buffer_size=100M ./bin/start --libraries='./src/lib' --entry='./src/main.php'",
"prod:build": "@prod:start --build --environment='./build.yaml' --build-optimize",
"prod:test": [
Expand All @@ -31,7 +31,6 @@
"php vendor/bin/phpunit tests"
],
"prod:fix": "php -dxdebug.mode=off ./vendor/bin/php-cs-fixer fix .",
"dev:start:gui": "./dev-gui-example.sh",
"dev:start": "php -dxdebug.mode=debug -dxdebug.start_with_request=yes -dphar.readonly=0 ./bin/start --libraries='./src/lib' --entry='./src/main.php'",
"dev:build": "@dev:start --build --environment='./build.yaml'",
"dev:test": [
Expand Down
8 changes: 0 additions & 8 deletions dev-gui-example.sh

This file was deleted.

8 changes: 0 additions & 8 deletions prod-gui-example.sh

This file was deleted.

6 changes: 6 additions & 0 deletions prod_build_go.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

pushd src/lib/Go/lib &&\
go build -o main.so -buildmode=c-shared main.go &&\
cpp -P ./main.h ./main.static.h &&\
popd || exit
66 changes: 0 additions & 66 deletions src/gui-example.php

This file was deleted.

17 changes: 17 additions & 0 deletions src/lib/Go/Contract.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
namespace CatPaw\Go;

interface Contract {
// #################################
// #################################
// #################################
// #################################
// #################################
// ======================[START]===> Utilities
/**
* Destroy a reference from memory.
* @param mixed $key Reference key.
* @return void
*/
function destroy(mixed $key):void;
}
File renamed without changes.
3 changes: 3 additions & 0 deletions src/lib/Go/lib/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module gui

go 1.22.0
Empty file added src/lib/Go/lib/go.sum
Empty file.
56 changes: 56 additions & 0 deletions src/lib/Go/lib/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package main

import "C"

// Framework stuff

type stringC = *C.char

func toString(value stringC) string {
return C.GoString(value)
}

func toStringC(value string) stringC {
return C.CString(value)
}

type Global struct {
items map[uint64]*any
index uint64
}

var global = &Global{
items: make(map[uint64]*any),
index: 1,
}

func ref(item any) uint64 {
key := global.index
global.index++
global.items[key] = &item
return key
}

func unref[T any](key uint64) *T {
item := global.items[key]
result := (*item).(T)
return &result
}

// #################################
// #################################
// #################################
// #################################
// #################################
// ======================[START]===> Utilities

//export destroy
func destroy(key uint64) {
delete(global.items, key)
}

// Library stuff

func main() {

}
163 changes: 0 additions & 163 deletions src/lib/Gui/Contract.php

This file was deleted.

19 changes: 0 additions & 19 deletions src/lib/Gui/lib/go.mod

This file was deleted.

Loading

0 comments on commit ac18c8b

Please sign in to comment.