1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-24 00:08:52 -05:00

More PoC code

This commit is contained in:
Merlijn Wajer 2010-03-26 12:22:08 +01:00
parent d73592eb23
commit 03fd6b25e2
3 changed files with 121 additions and 65 deletions

View File

@ -42,12 +42,12 @@
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="libmml"/> <UnitName Value="libmml"/>
<CursorPos X="15" Y="24"/> <CursorPos X="45" Y="32"/>
<TopLine Value="1"/> <TopLine Value="20"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<IsVisibleTab Value="True"/> <IsVisibleTab Value="True"/>
<UsageCount Value="23"/> <UsageCount Value="26"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
@ -60,11 +60,11 @@
<Unit2> <Unit2>
<Filename Value="../../Units/MMLCore/client.pas"/> <Filename Value="../../Units/MMLCore/client.pas"/>
<UnitName Value="Client"/> <UnitName Value="Client"/>
<CursorPos X="40" Y="33"/> <CursorPos X="7" Y="50"/>
<TopLine Value="23"/> <TopLine Value="33"/>
<EditorIndex Value="4"/> <EditorIndex Value="5"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
@ -72,9 +72,9 @@
<UnitName Value="IOManager"/> <UnitName Value="IOManager"/>
<CursorPos X="59" Y="30"/> <CursorPos X="59" Y="30"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="2"/> <EditorIndex Value="3"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
@ -104,10 +104,12 @@
<Unit7> <Unit7>
<Filename Value="../../Units/MMLCore/os_linux.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<UnitName Value="os_linux"/> <UnitName Value="os_linux"/>
<CursorPos X="21" Y="85"/> <CursorPos X="75" Y="32"/>
<TopLine Value="68"/> <TopLine Value="56"/>
<IsVisibleTab Value="True"/> <EditorIndex Value="1"/>
<UsageCount Value="10"/> <WindowIndex Value="0"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
<Filename Value="../../../fpc/packages/x11/src/xlib.pp"/> <Filename Value="../../../fpc/packages/x11/src/xlib.pp"/>
@ -154,9 +156,9 @@
<UnitName Value="bitmaps"/> <UnitName Value="bitmaps"/>
<CursorPos X="29" Y="122"/> <CursorPos X="29" Y="122"/>
<TopLine Value="100"/> <TopLine Value="100"/>
<EditorIndex Value="3"/> <EditorIndex Value="4"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit13> </Unit13>
<Unit14> <Unit14>
@ -164,9 +166,9 @@
<UnitName Value="Graphics"/> <UnitName Value="Graphics"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="23"/> <TopLine Value="23"/>
<EditorIndex Value="1"/> <EditorIndex Value="2"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit14> </Unit14>
<Unit15> <Unit15>
@ -182,9 +184,9 @@
<UnitName Value="mufasabase"/> <UnitName Value="mufasabase"/>
<CursorPos X="2" Y="6"/> <CursorPos X="2" Y="6"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="5"/> <EditorIndex Value="6"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
@ -200,9 +202,9 @@
<UnitName Value="MufasaTypes"/> <UnitName Value="MufasaTypes"/>
<CursorPos X="19" Y="72"/> <CursorPos X="19" Y="72"/>
<TopLine Value="55"/> <TopLine Value="55"/>
<EditorIndex Value="6"/> <EditorIndex Value="7"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
@ -318,119 +320,127 @@
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit32> </Unit32>
</Units> </Units>
<JumpHistory Count="28" HistoryIndex="27"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="10" Column="1" TopLine="5"/> <Caret Line="10" Column="6" TopLine="6"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="38" Column="1" TopLine="5"/> <Caret Line="6" Column="10" TopLine="1"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="26" Column="12" TopLine="5"/> <Caret Line="7" Column="12" TopLine="1"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="10" Column="20" TopLine="5"/> <Caret Line="12" Column="11" TopLine="1"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="28" Column="65" TopLine="5"/> <Caret Line="7" Column="15" TopLine="1"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="10" Column="6" TopLine="6"/> <Caret Line="24" Column="76" TopLine="1"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="6" Column="10" TopLine="1"/> <Caret Line="7" Column="8" TopLine="1"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="7" Column="12" TopLine="1"/> <Caret Line="12" Column="11" TopLine="1"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="12" Column="11" TopLine="1"/> <Caret Line="6" Column="15" TopLine="1"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="7" Column="15" TopLine="1"/> <Caret Line="31" Column="25" TopLine="1"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="24" Column="76" TopLine="1"/> <Caret Line="30" Column="2" TopLine="4"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="7" Column="8" TopLine="1"/> <Caret Line="6" Column="17" TopLine="1"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="libmml.lpr"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="12" Column="11" TopLine="1"/> <Caret Line="30" Column="80" TopLine="12"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="libmml.lpr"/> <Filename Value="../../Units/MMLCore/mufasabase.pas"/>
<Caret Line="6" Column="15" TopLine="1"/> <Caret Line="1" Column="1" TopLine="1"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="31" Column="25" TopLine="1"/> <Caret Line="6" Column="23" TopLine="1"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="libmml.lpr"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="30" Column="2" TopLine="4"/> <Caret Line="122" Column="11" TopLine="105"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="libmml.lpr"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="6" Column="17" TopLine="1"/> <Caret Line="30" Column="59" TopLine="1"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="30" Column="80" TopLine="12"/> <Caret Line="123" Column="7" TopLine="100"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="../../Units/MMLCore/mufasabase.pas"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="1" Column="1" TopLine="1"/> <Caret Line="122" Column="29" TopLine="100"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="../../Units/MMLCore/mufasatypes.pas"/> <Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="1" Column="1" TopLine="12"/> <Caret Line="33" Column="40" TopLine="23"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="6" Column="23" TopLine="1"/> <Caret Line="6" Column="18" TopLine="1"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="libmml.lpr"/>
<Caret Line="122" Column="11" TopLine="105"/> <Caret Line="19" Column="19" TopLine="1"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="../../Units/MMLCore/iomanager.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="30" Column="59" TopLine="1"/> <Caret Line="85" Column="21" TopLine="68"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="123" Column="7" TopLine="100"/> <Caret Line="26" Column="79" TopLine="1"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="libmml.lpr"/>
<Caret Line="122" Column="29" TopLine="100"/> <Caret Line="27" Column="32" TopLine="1"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="../../Units/MMLCore/client.pas"/> <Filename Value="libmml.lpr"/>
<Caret Line="33" Column="40" TopLine="23"/> <Caret Line="44" Column="42" TopLine="13"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="libmml.lpr"/> <Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="6" Column="18" TopLine="1"/> <Caret Line="79" Column="5" TopLine="52"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="libmml.lpr"/> <Filename Value="libmml.lpr"/>
<Caret Line="19" Column="19" TopLine="1"/> <Caret Line="44" Column="65" TopLine="26"/>
</Position28> </Position28>
<Position29>
<Filename Value="libmml.lpr"/>
<Caret Line="6" Column="51" TopLine="1"/>
</Position29>
<Position30>
<Filename Value="libmml.lpr"/>
<Caret Line="44" Column="57" TopLine="26"/>
</Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
@ -439,7 +449,7 @@
<Filename Value="libmml"/> <Filename Value="libmml"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="$(ProjPath)/;$(ProjPath)../../Units/MMLCore/;$(ProjPath)../../Units/Misc/;$(ProjPath)../../Units/Linux/"/> <OtherUnitFiles Value="$(ProjPath)/;$(ProjPath)../../Units/MMLCore/;$(ProjPath)../../Units/Misc/;$(ProjPath)../../Units/Linux/;$(LazarusDir)/components/mouseandkeyinput/"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
<LCLWidgetType Value="gtk2"/> <LCLWidgetType Value="gtk2"/>
</SearchPaths> </SearchPaths>

View File

@ -3,10 +3,13 @@ library libmml;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
uses uses
cmem,Classes,interfaces,graphics,client; cmem,Classes,interfaces,graphics,client,sysutils;
{$R *.res} {$R *.res}
type
PTPoint = ^TPoint;
var var
C: TClient; C: TClient;
function test: pchar; function test: pchar;
@ -24,12 +27,35 @@ begin
C.IOManager.GetMousePos(result.x,result.y); C.IOManager.GetMousePos(result.x,result.y);
end; end;
function returnpoints: PTPoint;
begin
result := AllocMem(sizeof(TPoint) * 2);
result[0].x := 5;
result[0].y := 10;
result[1].x := 20;
result[1].y := 30;
end;
function printpoints(b: PTPoint; len: integer): boolean;
var i:integer;
begin
for i := 0 to len - 1 do
writeln('X, Y: (' + inttostr(b[i].x) + ', ' + inttostr(b[i].y) + ')');
end;
procedure hoi(var i: integer);
begin
i := i + 1;
end;
exports exports
test, test,
init, init,
getmousepos; getmousepos,
returnpoints,
printpoints,
hoi;
begin begin

View File

@ -17,3 +17,23 @@ dll.getmousepos.restype = POINT
b = dll.getmousepos() b = dll.getmousepos()
print b.x, b.y print b.x, b.y
PPOINT = POINTER(POINT)
dll.returnpoints.restype = PPOINT
c = dll.returnpoints()
print c[0].x
dll.printpoints.restype = c_int
dll.printpoints.argtypes = [PPOINT, c_int]
d = dll.printpoints(c, 2)
dll.hoi.restype = None
dll.hoi.argtypes = [POINTER(c_int)]
e = c_int(5)
dll.hoi(byref(e))
print e