1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Linux fixes, misc fixes

This commit is contained in:
Brian Fiete 2019-10-09 16:20:09 -07:00
parent 609dbfa256
commit c97b074fee
12 changed files with 131 additions and 68 deletions

View file

@ -424,6 +424,15 @@ namespace Beefy.widgets
return mSubItems[columnIdx];
}
public ListViewItem GetOrCreateSubItem(int columnIdx)
{
if (mColumnIdx == columnIdx)
return this;
if ((mSubItems != null) && (columnIdx < mSubItems.Count))
return mSubItems[columnIdx];
return CreateSubItem(columnIdx);
}
public virtual void MakeParent()
{
if (mChildItems == null)

View file

@ -44,7 +44,7 @@ namespace System
{
Platform.GetStrHelper(outPath, scope (outPtr, outSize, outResult) =>
{
Platform.BfpDynLib_GetFilePath(null, outPtr, outSize, (Platform.BfpLibResult*)outResult);
Platform.BfpSystem_GetExecutablePath(outPtr, outSize, (Platform.BfpSystemResult*)outResult);
});
}

View file

@ -55,8 +55,6 @@ namespace System
[StdCall, CLink]
public static extern BfpTimeStamp BfpSystem_GetTimeStamp();
[StdCall, CLink]
public static extern void BfpSystem_GetEnvironmentStrings(char8* outStr, int32* inOutStrSize, BfpSystemResult* outResult);
[StdCall, CLink]
public static extern uint8 BfpSystem_InterlockedExchange8(uint8* ptr, uint8 val); /// Returns the initial value in 'ptr'
[StdCall, CLink]
public static extern uint16 BfpSystem_InterlockedExchange16(uint16* ptr, uint16 val); /// Returns the initial value in 'ptr'
@ -81,6 +79,10 @@ namespace System
[StdCall, CLink]
public static extern uint64 BfpSystem_InterlockedCompareExchange64(uint64* ptr, uint64 oldVal, uint64 newVal);
[StdCall, CLink]
public static extern void BfpSystem_GetExecutablePath(char8* outStr, int32* inOutStrSize, BfpSystemResult* outResult);
[StdCall, CLink]
public static extern void BfpSystem_GetEnvironmentStrings(char8* outStr, int32* inOutStrSize, BfpSystemResult* outResult);
[StdCall, CLink]
public static extern int32 BfpSystem_GetNumLogicalCPUs(BfpSystemResult* outResult);
[StdCall, CLink]
public static extern int64 BfpSystem_GetCPUTick();

View file

@ -416,7 +416,7 @@ void Beefy::BFFatalError(const StringImpl& message, const StringImpl& file, int
#endif
#ifdef _DEBUG
OutputDebugStrF("FATAL ERROR: %s\n", message.c_str());
OutputDebugStrF("FATAL ERROR: %s\n", message.c_str());
_wassert(UTF8Decode(message).c_str(), UTF8Decode(file).c_str(), line);
#else
String error = StrFormat("%s in %s:%d", message.c_str(), file.c_str(), line);

View file

@ -64,3 +64,14 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
{
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}
/* ===========================================================================
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
uLong ZEXPORT compressBound(sourceLen)
uLong sourceLen;
{
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
}

View file

@ -2,6 +2,10 @@
#include "CritSect.h"
#include "util/Dictionary.h"
#ifdef DEF_BF_ALLOCDEBUG
#define USE_BF_ALLOCDEBUG
#endif
#pragma warning(disable:4996)
#include <cstdio>
#include "AllocDebug.h"

View file

@ -111,7 +111,7 @@ public:
public:
Entry** mHashHeads;
const int cDefaultHashSize = 17;
static const int cDefaultHashSize = 17;
int mHashSize;
int mCount;

View file

@ -70,4 +70,4 @@ Path = "../../../temp/test.txt"
[[ProjectFolder.Items]]
Type = "Folder"
Path = "../../../temp/borf"
Source = ["a.txt"]
AutoInclude = true

View file

@ -153,14 +153,31 @@ namespace System
}
struct Pointer
[AlwaysInclude]
struct Pointer : IHashable
{
void* mVal;
public int GetHashCode()
{
return (int)mVal;
}
[AlwaysInclude]
Object GetBoxed()
{
return new box this;
}
}
struct Pointer<T> : Pointer
{
struct Pointer<T> : IHashable
{
T* mVal;
public int GetHashCode()
{
return (int)mVal;
}
}
struct MethodReference<T>

View file

@ -333,6 +333,16 @@ namespace System
}
}
public virtual int32 MaxValue
{
[Error("This property can only be accessed directly from a typeof() expression")]
get
{
return 0;
}
}
public int32 GetTypeId()
{
return (int32)mTypeId;

View file

@ -189,40 +189,27 @@ namespace Hey.Dude.Bro
[CRepr, CLink]
public static extern void* SetUnhandledExceptionFilter(function int32(void* p) func);
public static int GetHash<T>(T val) where T : IHashable
{
return val.GetHashCode();
}
public static int Main(String[] args)
{
/*IHashable ih = (int32)TypeCode.Boolean;
let hashCode = ih.GetHashCode();*/
Object obj = new Object();
int* iPtr = scope .();
int hash = GetHash(iPtr);
//Test2(1, 2, 3, 4);
//int a = Fartso;
#if ZLOG
PrintF("HEY!");
#endif
List<String> iList = scope .();
for (int i < 1000)
{
iList.Add("Zpops");
}
bool b = false;
//File file;
int len = args.Count;
int zog = 123;
int a = 0x1122334455667788;
void* prev = SetUnhandledExceptionFilter(=> SEHHandler);
PrintF("Prev: %p\n", prev);
//TestA();
Blurg.Hey();
for (int i < 100)
{
PrintF("Hello 2!\n");
Thread.Sleep(10);
}
return 1;
}

View file

@ -13,18 +13,15 @@ class ClassA
{
public virtual void ClassA0()
{
}
public virtual void ClassA1()
{
}
}
class ClassB
{
}
#if B
@ -71,13 +68,11 @@ class ClassE : ClassD
{
public void Zog2()
{
}
}
class ClassF : ClassE
{
}
[NoDiscard("Use this value!")]
@ -95,11 +90,10 @@ class Bloozer
enum Zorf : IDisposable
{
case A;
case B;
case B;
public void Dispose()
{
}
}
@ -107,7 +101,6 @@ class IFaceA
{
public static void Fart()
{
}
}
@ -115,7 +108,6 @@ class Zlips : IFaceA, IDisposable
{
static void Fart()
{
}
public void Dispose()
@ -129,9 +121,7 @@ class Testo
public this()
{
PrintF("Testo this %p\n", this);
}
public ~this()
} public ~this()
{
PrintF("Testo ~this %p\n", this);
}
@ -143,7 +133,7 @@ class Norg
public int32 mA;
public int32 mB;
public int32 GetIt(int32 a, int32 b, int32 c) mut
public int32 GetIt(int32 a, int32 b, int32 c)
{
return a + b + c + mA;
}
@ -157,10 +147,13 @@ class Norg
{
set
{
mA = (.)value;
}
get
{
return mA;
}
}
public virtual int GetVal()
@ -171,18 +164,47 @@ class Norg
class Norg2 : Norg
{
public override void Zorf
public int mVal2;
public int Zof => 123;
public int GetIt() => 234;
/*public override int Zorf
{
set
{
base.Zorf = 123;
}
}
}*/
}
enum TestEnumA
{
A,
B,
C
}
[AttributeUsage(.Field, .ReflectAttribute, ReflectUser=.All)]
struct FoofAttribute : Attribute
{
int32 mA;
int32 mB;
int32 mC;
public this(int32 a, int32 b, int32 c)
{
mA = a;
mB = b;
mC = c;
}
}
struct Blurg
{
[Foof(1, 2, 3)]
public String mVal;
public int32 mA;
public int32 mB;
@ -196,7 +218,6 @@ struct Blurg
void TestIt(String a, String b)
{
}
TestStruct GetTS()
@ -209,25 +230,28 @@ struct Blurg
PrintF("a0");
}
[Error("This property can only be accessed directly from a typeof() expression")]
static void Test(int a, int b, int c)
{
}
public static Result<int> GetMe()
{
return 123;
}
public static int32 Hey()
{
Result<int, float> res = .Ok(123);
let t = typeof(Self);
let field = t.GetField("mVal").Value;
var foofAttrib = field.GetCustomAttribute<FoofAttribute>();
Florg fl = .();
//for (TypeCode tc < .Boolean)
let f2 = fl;
//defer f2.Dispose();
//Test(1, 2, 3);
using (var f = fl)
{
}
/*TestEnumA ta = .A;
IHashable ih = ta;*/
return 123;
}
@ -240,7 +264,6 @@ struct Florg
public void Dispose() mut
{
}
}