FAdd PC compatibility
This commit is contained in:
15
.gitignore
vendored
15
.gitignore
vendored
@@ -48,6 +48,8 @@
|
||||
Temp/
|
||||
*.tmp
|
||||
|
||||
*.res
|
||||
|
||||
# Delphi autogenerated files (duplicated info)
|
||||
*.cfg
|
||||
*.hpp
|
||||
@@ -68,4 +70,15 @@ __recovery/
|
||||
# Castalia statistics file (since XE7 Castalia is distributed with Delphi)
|
||||
*.stat
|
||||
|
||||
!FasmDll/
|
||||
#FPC
|
||||
backup/
|
||||
*.compiled
|
||||
*.ppu
|
||||
*.o
|
||||
*.or
|
||||
FPCTests/*.ico
|
||||
*.ini
|
||||
|
||||
Tests/Win32
|
||||
!FasmDll/*
|
||||
!FasmDll/DEMO/*
|
||||
79
FPCTests/fpcunitproject1.lpi
Normal file
79
FPCTests/fpcunitproject1.lpi
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="10"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="fpcunitproject1"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<Item1>
|
||||
<PackageName Value="fpcunittestrunner"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="FCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
<Filename Value="fpcunitproject1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="testcase1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="TestCase1"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\Source\Fasm4Delphi.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="..\Source"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
||||
13
FPCTests/fpcunitproject1.lpr
Normal file
13
FPCTests/fpcunitproject1.lpr
Normal file
@@ -0,0 +1,13 @@
|
||||
program fpcunitproject1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Interfaces, Forms, GuiTestRunner, fpcunittestrunner, TestCase1;
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TGuiTestRunner, TestRunner);
|
||||
Application.Run;
|
||||
end.
|
||||
|
||||
46
FPCTests/fpcunitproject1.lps
Normal file
46
FPCTests/fpcunitproject1.lps
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="10"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
<Filename Value="fpcunitproject1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<CursorPos X="66" Y="6"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="testcase1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="TestCase1"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="21"/>
|
||||
<CursorPos X="62" Y="41"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\Source\Fasm4Delphi.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
<UsageCount Value="20"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
<JumpHistory Count="2" HistoryIndex="1">
|
||||
<Position1>
|
||||
<Filename Value="fpcunitproject1.lpr"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="testcase1.pas"/>
|
||||
<Caret Line="8" Column="66"/>
|
||||
</Position2>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
||||
51
FPCTests/testcase1.pas
Normal file
51
FPCTests/testcase1.pas
Normal file
@@ -0,0 +1,51 @@
|
||||
unit TestCase1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, fpcunit, testutils, testregistry,Fasm4Delphi;
|
||||
|
||||
type
|
||||
|
||||
TTestCase1= class(TTestCase)
|
||||
published
|
||||
procedure TestHookUp;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
const
|
||||
CompliterMemSize=$10000;
|
||||
|
||||
var
|
||||
CompliterMem:PFASM_STATE;
|
||||
|
||||
procedure TTestCase1.TestHookUp;
|
||||
begin
|
||||
if fasm_AssembleFile('..\Tests\Test1.asm',CompliterMem,CompliterMemSize)<>FASM_OK then
|
||||
Fail('Error in test1:'+sLineBreak+
|
||||
'Condition: '+CompliterMem^.condition.ToString+sLineBreak+
|
||||
'Error Code: '+CompliterMem^.error_code.ToString);
|
||||
if fasm_Assemble('add eax,0',CompliterMem,CompliterMemSize)<>FASM_OK then
|
||||
writeln('Error in test2:'+sLineBreak+
|
||||
'Condition: '+CompliterMem^.condition.ToString+sLineBreak+
|
||||
'Error Code: '+CompliterMem^.error_code.ToString);
|
||||
if fasm_AssembleFile('..\FasmDll\FASM.ASH',CompliterMem,CompliterMemSize)=FASM_OK then
|
||||
Fail('Error in test3:'+sLineBreak+
|
||||
'FASM is compiling something that it is can not compile at all.');
|
||||
if fasm_Assemble('call -100',CompliterMem,CompliterMemSize)<>FASM_OK then
|
||||
Fail('Error in test4:'+sLineBreak+
|
||||
'Condition: '+CompliterMem^.condition.ToString+sLineBreak+
|
||||
'Error Code: '+CompliterMem^.error_code.ToString);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
initialization
|
||||
LoadFASM('..\FasmDll\FASM.DLL');
|
||||
GetMem(CompliterMem,CompliterMemSize);
|
||||
RegisterTest(TTestCase1);
|
||||
end.
|
||||
|
||||
BIN
FasmDll/DEMO/ASMDEMO.EXE
Normal file
BIN
FasmDll/DEMO/ASMDEMO.EXE
Normal file
Binary file not shown.
BIN
FasmDll/DEMO/FASM.DLL
Normal file
BIN
FasmDll/DEMO/FASM.DLL
Normal file
Binary file not shown.
BIN
FasmDll/DEMO/FEDIT.DLL
Normal file
BIN
FasmDll/DEMO/FEDIT.DLL
Normal file
Binary file not shown.
BIN
FasmDll/FASM.DLL
Normal file
BIN
FasmDll/FASM.DLL
Normal file
Binary file not shown.
@@ -69,21 +69,24 @@ type
|
||||
TLINE_HEADER=record
|
||||
file_path:PAnsiChar;
|
||||
line_number:cardinal;
|
||||
file_offset:cardinal;
|
||||
macro_calling_line:^TLINE_HEADER;
|
||||
//macro_line:^TLINE_HEADER;
|
||||
case byte of
|
||||
0:(file_offset:cardinal);
|
||||
1:(macro_calling_line:^TLINE_HEADER;
|
||||
macro_line:^TLINE_HEADER;);
|
||||
end;
|
||||
PLINE_HEADER=^TLINE_HEADER;
|
||||
|
||||
{$EXTERNALSYM TLINE_HEADER}
|
||||
|
||||
TFASM_STATE=record
|
||||
condition:Int32;
|
||||
error_code:Int32;
|
||||
error_line:PLINE_HEADER;
|
||||
//output_data:pointer;
|
||||
//output_length:cardinal;
|
||||
condition:Int32;
|
||||
case byte of
|
||||
0:(error_code:Int32;
|
||||
error_line:PLINE_HEADER;);
|
||||
1:(output_length:cardinal;
|
||||
output_data:pointer; );
|
||||
end;
|
||||
PFASM_STATE=^TFASM_STATE;
|
||||
//{$EXTERNALSYM TFASM_STATE}
|
||||
{$EXTERNALSYM TFASM_STATE}
|
||||
|
||||
const
|
||||
FASMDLLName='FASM.DLL';
|
||||
@@ -158,7 +161,7 @@ var
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF FasmStaticLink}
|
||||
procedure LoadFASM(Name:string);
|
||||
procedure LoadFASM(Name:string=FASMDLLName);
|
||||
procedure FreeFASM;
|
||||
{$ENDIF}
|
||||
|
||||
@@ -168,14 +171,21 @@ implementation
|
||||
var
|
||||
&Library:THandle=0;
|
||||
|
||||
procedure LoadFASM(Name:string);
|
||||
procedure LoadFASM(Name:string=FASMDLLName);
|
||||
begin
|
||||
if &Library<>0 then
|
||||
FreeFasm;
|
||||
&Library:=LoadLibrary(PWideChar(Name));
|
||||
{$IFDEF FPC}
|
||||
&Library:=LoadLibrary(PChar(Name));
|
||||
Pointer(fasm_GetVersion):=GetProcAddress(&Library,'fasm_GetVersion');
|
||||
Pointer(fasm_Assemble):=GetProcAddress(&Library,'fasm_Assemble');
|
||||
Pointer(fasm_AssembleFile):=GetProcAddress(&Library,'fasm_AssembleFile');
|
||||
{$ELSE}
|
||||
&Library:=LoadLibrary(PChar(Name));
|
||||
fasm_GetVersion:=GetProcAddress(&Library,'fasm_GetVersion');
|
||||
fasm_Assemble:=GetProcAddress(&Library,'fasm_Assemble');
|
||||
fasm_AssembleFile:=GetProcAddress(&Library,'fasm_AssembleFile');
|
||||
fasm_AssembleFile:=GetProcAddress(&Library,'fasm_AssembleFile');
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure FreeFASM;
|
||||
|
||||
BIN
Tests/Tester.res
BIN
Tests/Tester.res
Binary file not shown.
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<test-results name="W:\Fasm4Delphi\Tests\Win32\Debug\Tester.exe" total="4" errors="0" failures="0" ignored="0" inconclusive="0" not-run="0" skipped="0" invalid="0" date="2018-02-11" time="0.001">
|
||||
<culture-info current-culture="en" current-uiculture="en" />
|
||||
<test-suite type="Assembly" name="Tester.exe" executed="true" result="Success" success="True" time="0.001" asserts="0">
|
||||
<results>
|
||||
<test-suite type="Namespace" name="TesterMain" executed="true" result="Success" success="True" time="0.001" asserts="0" >
|
||||
<results>
|
||||
<test-suite type="Fixture" name="TMyTestObject" executed="True" result="Success" success="True" time="0.001" >
|
||||
<results>
|
||||
<test-case name="Test1" executed="True" result="Success" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="Test2" executed="True" result="Success" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="Test3" executed="True" result="Success" success="True" time="0.000" asserts="0" />
|
||||
<test-case name="Test4" executed="True" result="Success" success="True" time="0.000" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</test-results>
|
||||
Reference in New Issue
Block a user