fix readme and remove unrelated library, no idea how it got here
This commit is contained in:
parent
ab44742443
commit
5df7a32a7f
|
|
@ -712,7 +712,9 @@ public class Runner : IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.Is(T.Native)) {
|
if (value.Is(T.Native)) {
|
||||||
return InvokeNative(value.Ptr.As<NativeFunction>(), argumentCount);
|
if (value.Ptr.As<NativeFunction>() is NativeFunction native)
|
||||||
|
return InvokeNative(native, argumentCount);
|
||||||
|
return false; // unlikely edge case, natives are always set directly via the global registry
|
||||||
} else if (value.Is(T.Method)) {
|
} else if (value.Is(T.Method)) {
|
||||||
Method method = value.Ptr.As<Method>()!;
|
Method method = value.Ptr.As<Method>()!;
|
||||||
_stack.Set(_cursor - method.Function.ArgumentCount - 1, method.Receiver);
|
_stack.Set(_cursor - method.Function.ArgumentCount - 1, method.Receiver);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
[assembly: ThemeInfo(
|
|
||||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
|
||||||
//(used if a resource is not found in the page,
|
|
||||||
// or application resource dictionaries)
|
|
||||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
|
||||||
//(used if a resource is not found in the page,
|
|
||||||
// app, or any theme specific resource dictionaries)
|
|
||||||
)]
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWPF>true</UseWPF>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Attachments\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
# TilingFrames
|
|
||||||
## Tiling (Docking) window manager library for WPF
|
|
||||||
### Qrakhen.TilingFramess
|
|
||||||
|
|
||||||
Cool Library to have tiling panels.
|
|
||||||
Is that not cool?
|
|
||||||
I think it very much is cool.
|
|
||||||
Very nice, yes. Alpha & Beta. No Gamma or Delta. Just Alpha-Beta.
|
|
||||||
|
|
||||||
Data structure resembles a binary tree with uniform branch- and end-nodes (TilingPanels & TilingHosts).
|
|
||||||
|
|
||||||
### Node
|
|
||||||
|
|
||||||
### Panel
|
|
||||||
|
|
||||||
### Host
|
|
||||||
|
|
||||||
### Frame
|
|
||||||
|
|
||||||
### Window
|
|
||||||
|
|
||||||
### Node Structure
|
|
||||||
```cs
|
|
||||||
RootPanel
|
|
||||||
/ \
|
|
||||||
A B
|
|
||||||
/ \
|
|
||||||
Panel Host
|
|
||||||
/ \ |-Frame (Single Frame)
|
|
||||||
/ \
|
|
||||||
Panel Host
|
|
||||||
/ \ |-Frame (Tab)
|
|
||||||
/ . |-Frame (Tab)
|
|
||||||
Host
|
|
||||||
|-Frame (Tab)
|
|
||||||
|-Frame (Tab)
|
|
||||||
|-Frame (Tab)
|
|
||||||
```
|
|
||||||
Key Behaviours:
|
|
||||||
- All Panels have information about how and where their content is split in two.
|
|
||||||
- Every panel may have up to two children (Alpha/Beta), where Alpha is never null.
|
|
||||||
- Beta may not be set (In a case of a single frame with no splits, for example).
|
|
||||||
- If a child located at Alpha is detached, Beta will move to alpha, to ensure the 'Alpha is always set' paradigm.
|
|
||||||
- If a child is detached and both alpha and beta result in being null, the entire Panel is detached from its parent.
|
|
||||||
- Hosts are always at the end of the branches, everything above a Node is a Panel.
|
|
||||||
- The things you're dragging around to re-order, separate and split panels are Frames.
|
|
||||||
- Hosts contain Frames, which will be displayed as tabs if stacked atop each other, or as a single frame if only one is present.
|
|
||||||
- All mutations of the tree structure expect the root node as their first argument.
|
|
||||||
That is done so there's no two-way referencing and to keep stuff simple.
|
|
||||||
92
README.md
92
README.md
|
|
@ -91,25 +91,91 @@ which should be located within your `./Build/` folder after building as describe
|
||||||
Here's a quick example of how you would implement virtually any library:
|
Here's a quick example of how you would implement virtually any library:
|
||||||
```cs
|
```cs
|
||||||
using Qrakhen.Qamp.Core;
|
using Qrakhen.Qamp.Core;
|
||||||
using System.Math;
|
|
||||||
|
|
||||||
Value Sqrt(Value number)
|
// This is an intentionally bad implementation of a linked list.
|
||||||
|
[ExportType("llist")]
|
||||||
|
public class LinkedListNode : Obj
|
||||||
{
|
{
|
||||||
Assert.IsNumber(number);
|
[HideProperty]
|
||||||
|
public LinkedListNode? Next { get; private set; }
|
||||||
|
|
||||||
if (number.IsDecimal)
|
public Value Value { get; private set; }
|
||||||
return Math.Sqrt(number.AsDecimal);
|
|
||||||
if (number.IsSigned)
|
public LinkedList(Value value) {
|
||||||
return Math.Sqrt(number.AsSigned);
|
// ...internal setup
|
||||||
if (number.IsUnsigned)
|
this.Value = value;
|
||||||
return Math.Sqrt(number.Unsigned);
|
|
||||||
throw new Qrakhen.Qamp.Core.QampException($"Unsupported value type {value}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Injector injector = new();
|
// Q& constructors, if needed, have to be explicitely declared to return a value type.
|
||||||
injector.Register(scope: Scope.Global, name: "sqrt", params: [ ("number", ValueType.Number) ], returns: ValueType.Number);
|
[ExportConstructor]
|
||||||
injector.Export("desiredPath.sqi");
|
public static Value Ctor(params Value[] args) {
|
||||||
|
current = this;
|
||||||
|
while (current.Next != null)
|
||||||
|
current = current.Next;
|
||||||
|
|
||||||
|
// This simply returns a new pointer to an already existing
|
||||||
|
// oject inside the heap, rather than actually create a new one.
|
||||||
|
// It wraps a pointer to the provided object inside a value that
|
||||||
|
// has the 'Ptr' type flag, passing it to the Q& runtime.
|
||||||
|
return Obj.Create(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tell the type mapper to export this method
|
||||||
|
[ExportMethod]
|
||||||
|
public Value Last() {
|
||||||
|
// This simply returns a new pointer to an already existing type.
|
||||||
|
// The call ddoes not actually create a new object.
|
||||||
|
var current = this;
|
||||||
|
while (current.Next != null) {
|
||||||
|
current = current.Next;
|
||||||
|
return Obj.Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Value is the base type of anything in Q&.
|
||||||
|
// An object is just a value of type 'Ptr' (value.IsPtr),
|
||||||
|
// and primitives have their value stored in the 8 byte
|
||||||
|
// buffer of the value itself (value.Data).
|
||||||
|
[ExportMethod]
|
||||||
|
public void Add(Value value) {
|
||||||
|
var current = this;
|
||||||
|
while (current.Next != null)
|
||||||
|
current = current.Next;
|
||||||
|
current.Next = new LinkedList(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Methods that accept a primitive will automatically try
|
||||||
|
// retrieve that type from the provided arguments as Values.
|
||||||
|
// You may always simply declare to accept Values aswell,
|
||||||
|
// which gives you some dynamic flexibility if needed.
|
||||||
|
[ExportMethod]
|
||||||
|
public Value? GetItem(long index) {
|
||||||
|
long current = 0;
|
||||||
|
var node = this;
|
||||||
|
while (current < index) {
|
||||||
|
current++;
|
||||||
|
node = node.Next;
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You may manually register all types inside an assembly by calling
|
||||||
|
```
|
||||||
|
Library:Load("mylib.dll");
|
||||||
|
```
|
||||||
|
directly in Q&.
|
||||||
|
Usage of the type described above would look somewhat like this:
|
||||||
|
```
|
||||||
|
*~ list = new llist();
|
||||||
|
list.Add(5);
|
||||||
|
list.Add('test');
|
||||||
|
list.Add([1, 2, 3]);
|
||||||
|
print(list.GetItem(1)); // 'test'
|
||||||
|
print(list.Last()); // [ 1, 2, 3 ]
|
||||||
|
*~ protected = list.Value; // will throw an exception, as we did not expose that property.
|
||||||
|
```
|
||||||
|
|
||||||
That's it - although this being a very simple example, more is possible.
|
That's it - although this being a very simple example, more is possible.
|
||||||
I will add a few basic implementations of very common libraries in a separate repository soon.
|
I will add a few basic implementations of very common libraries in a separate repository soon.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue