You've already forked lazarus-ccr
android-sdk: Adds more classes and support for constants, for ; and for ignoring method modifiers
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1742 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -48,7 +48,7 @@
|
|||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<CursorPos X="15" Y="14"/>
|
<CursorPos X="15" Y="14"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
@ -60,8 +60,8 @@
|
|||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<CursorPos X="22" Y="32"/>
|
<CursorPos X="33" Y="38"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
@ -130,9 +130,9 @@
|
|||||||
<IsVisibleTab Value="True"/>
|
<IsVisibleTab Value="True"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="2"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="263"/>
|
<TopLine Value="307"/>
|
||||||
<CursorPos X="55" Y="286"/>
|
<CursorPos X="72" Y="331"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit8>
|
</Unit8>
|
||||||
<Unit9>
|
<Unit9>
|
||||||
@ -175,123 +175,123 @@
|
|||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="157" Column="85" TopLine="124"/>
|
<Caret Line="18" Column="26" TopLine="1"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="127" Column="88" TopLine="104"/>
|
<Caret Line="124" Column="120" TopLine="101"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="151" Column="31" TopLine="129"/>
|
<Caret Line="66" Column="44" TopLine="40"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="24" Column="24" TopLine="1"/>
|
<Caret Line="21" Column="27" TopLine="1"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="25" Column="34" TopLine="1"/>
|
<Caret Line="88" Column="3" TopLine="80"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="123" Column="82" TopLine="97"/>
|
<Caret Line="128" Column="3" TopLine="66"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="18" Column="26" TopLine="1"/>
|
<Caret Line="19" Column="61" TopLine="1"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="124" Column="120" TopLine="101"/>
|
<Caret Line="21" Column="37" TopLine="2"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="66" Column="44" TopLine="40"/>
|
<Caret Line="39" Column="18" TopLine="38"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="21" Column="27" TopLine="1"/>
|
<Caret Line="301" Column="70" TopLine="267"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="88" Column="3" TopLine="80"/>
|
<Caret Line="22" Column="35" TopLine="1"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="128" Column="3" TopLine="66"/>
|
<Caret Line="237" Column="100" TopLine="196"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="19" Column="61" TopLine="1"/>
|
<Caret Line="189" Column="3" TopLine="148"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="21" Column="37" TopLine="2"/>
|
<Caret Line="247" Column="65" TopLine="219"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="39" Column="18" TopLine="38"/>
|
<Caret Line="246" Column="49" TopLine="223"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="301" Column="70" TopLine="267"/>
|
<Caret Line="154" Column="16" TopLine="145"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="22" Column="35" TopLine="1"/>
|
<Caret Line="211" Column="20" TopLine="188"/>
|
||||||
</Position17>
|
</Position17>
|
||||||
<Position18>
|
<Position18>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="237" Column="100" TopLine="196"/>
|
<Caret Line="26" Column="63" TopLine="1"/>
|
||||||
</Position18>
|
</Position18>
|
||||||
<Position19>
|
<Position19>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="189" Column="3" TopLine="148"/>
|
<Caret Line="309" Column="32" TopLine="305"/>
|
||||||
</Position19>
|
</Position19>
|
||||||
<Position20>
|
<Position20>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="247" Column="65" TopLine="219"/>
|
<Caret Line="26" Column="35" TopLine="1"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="246" Column="49" TopLine="223"/>
|
<Caret Line="305" Column="54" TopLine="305"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="154" Column="16" TopLine="145"/>
|
<Caret Line="24" Column="59" TopLine="1"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="211" Column="20" TopLine="188"/>
|
<Caret Line="22" Column="27" TopLine="1"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="26" Column="63" TopLine="1"/>
|
<Caret Line="23" Column="17" TopLine="1"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="mainform.pas"/>
|
||||||
<Caret Line="309" Column="32" TopLine="305"/>
|
<Caret Line="32" Column="22" TopLine="1"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="mainform.pas"/>
|
||||||
<Caret Line="26" Column="35" TopLine="1"/>
|
<Caret Line="38" Column="33" TopLine="1"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="305" Column="54" TopLine="305"/>
|
<Caret Line="209" Column="25" TopLine="194"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="24" Column="59" TopLine="1"/>
|
<Caret Line="27" Column="26" TopLine="2"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="22" Column="27" TopLine="1"/>
|
<Caret Line="25" Column="29" TopLine="1"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
<Position30>
|
<Position30>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="23" Column="17" TopLine="1"/>
|
<Caret Line="326" Column="6" TopLine="301"/>
|
||||||
</Position30>
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
|
@ -13,7 +13,7 @@ type
|
|||||||
|
|
||||||
TAndroidSDKBindingsGen = class
|
TAndroidSDKBindingsGen = class
|
||||||
private
|
private
|
||||||
FSourceFile, FPasOutputClasses, FPasOutputIDs, FPasOutputImpl: TStringList;
|
FSourceFile, FPasOutputClasses, FPasOutputConsts, FPasOutputIDs, FPasOutputImpl: TStringList;
|
||||||
FJavaOutputIDs, FJavaOutputMethods: TStringList;
|
FJavaOutputIDs, FJavaOutputMethods: TStringList;
|
||||||
FClassName, FClassNamePas: string; // Class name of the class currently being parsed
|
FClassName, FClassNamePas: string; // Class name of the class currently being parsed
|
||||||
FClassNum, FMethodNum: Integer;
|
FClassNum, FMethodNum: Integer;
|
||||||
@ -22,10 +22,14 @@ type
|
|||||||
procedure ProcessModelClass(ASourceLine: string);
|
procedure ProcessModelClass(ASourceLine: string);
|
||||||
procedure ProcessModelMethod(ASourceLine: string);
|
procedure ProcessModelMethod(ASourceLine: string);
|
||||||
procedure ProcessModelConstructor(ASourceLine: string);
|
procedure ProcessModelConstructor(ASourceLine: string);
|
||||||
|
procedure ProcessModelConst(ASourceLine: string);
|
||||||
function GetNextWord(ALine: string; var AStartPos: Integer): string;
|
function GetNextWord(ALine: string; var AStartPos: Integer): string;
|
||||||
function GetPascalTypeName(ABaseName: string): string;
|
function GetPascalTypeName(ABaseName: string): string;
|
||||||
|
function PassByReference(ABaseName: string): Boolean;
|
||||||
function GetJavaResultFunction(AReturnType: string): string;
|
function GetJavaResultFunction(AReturnType: string): string;
|
||||||
function GetJavaTypeReader(AType: string): string;
|
function GetJavaTypeReader(AType: string): string;
|
||||||
|
function GetIDString(AMethodName: string): string;
|
||||||
|
procedure AddOutputIDs(AIDString: string);
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -60,7 +64,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Now save the Pascal file
|
// Now save the Pascal file
|
||||||
lPasOutputFile.Add('unit ;');
|
lPasOutputFile.Add(Format('unit %s;', [ChangeFileExt(ExtractFileName(ASourceFile), '')]));
|
||||||
lPasOutputFile.Add('');
|
lPasOutputFile.Add('');
|
||||||
lPasOutputFile.Add('interface');
|
lPasOutputFile.Add('interface');
|
||||||
lPasOutputFile.Add('');
|
lPasOutputFile.Add('');
|
||||||
@ -71,6 +75,8 @@ begin
|
|||||||
lPasOutputFile.Add('implementation');
|
lPasOutputFile.Add('implementation');
|
||||||
lPasOutputFile.Add('');
|
lPasOutputFile.Add('');
|
||||||
lPasOutputFile.Add('const');
|
lPasOutputFile.Add('const');
|
||||||
|
lPasOutputFile.AddStrings(FPasOutputConsts);
|
||||||
|
lPasOutputFile.Add('');
|
||||||
lPasOutputFile.AddStrings(FPasOutputIDs);
|
lPasOutputFile.AddStrings(FPasOutputIDs);
|
||||||
lPasOutputFile.Add('');
|
lPasOutputFile.Add('');
|
||||||
lPasOutputFile.AddStrings(FPasOutputImpl);
|
lPasOutputFile.AddStrings(FPasOutputImpl);
|
||||||
@ -124,6 +130,13 @@ begin
|
|||||||
ProcessModelConstructor(ASourceLine);
|
ProcessModelConstructor(ASourceLine);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
if lCurWord = 'const' then
|
||||||
|
begin
|
||||||
|
ProcessModelConst(ASourceLine);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAndroidSDKBindingsGen.ProcessModelClass(ASourceLine: string);
|
procedure TAndroidSDKBindingsGen.ProcessModelClass(ASourceLine: string);
|
||||||
@ -153,6 +166,7 @@ begin
|
|||||||
|
|
||||||
FPasOutputIDs.Add(' // ' + FClassNamePas);
|
FPasOutputIDs.Add(' // ' + FClassNamePas);
|
||||||
FJavaOutputIDs.Add(' // ' + FClassName);
|
FJavaOutputIDs.Add(' // ' + FClassName);
|
||||||
|
FPasOutputConsts.Add(' { ' + FClassNamePas + ' }');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAndroidSDKBindingsGen.ProcessModelMethod(
|
procedure TAndroidSDKBindingsGen.ProcessModelMethod(
|
||||||
@ -180,7 +194,7 @@ begin
|
|||||||
|
|
||||||
// Beginning of the implementation part
|
// Beginning of the implementation part
|
||||||
FPasOutputImplCurLine := FPasOutputImpl.Count;
|
FPasOutputImplCurLine := FPasOutputImpl.Count;
|
||||||
lIDString := 'amkUI_' + FClassNamePas + '_' + lMethodName;
|
lIDString := GetIDString(lMethodName);
|
||||||
|
|
||||||
FPasOutputImpl.Add('begin');
|
FPasOutputImpl.Add('begin');
|
||||||
FPasOutputImpl.Add(' vAndroidPipesComm.SendByte(ShortInt(amkUICommand));');
|
FPasOutputImpl.Add(' vAndroidPipesComm.SendByte(ShortInt(amkUICommand));');
|
||||||
@ -197,16 +211,22 @@ begin
|
|||||||
FJavaOutputMethods.Add(' // params');
|
FJavaOutputMethods.Add(' // params');
|
||||||
|
|
||||||
// Lists of constants for the IDs
|
// Lists of constants for the IDs
|
||||||
FPasOutputIDs.Add(' ' + lIDString + ' = $' + IntToHex(FClassNum*$1000+FMethodNum, 8) + ';');
|
AddOutputIDs(lIDString);
|
||||||
FJavaOutputIDs.Add(' static final int ' + lIDString + ' = 0x' + IntToHex(FClassNum*$1000+FMethodNum, 8) + ';');
|
|
||||||
|
|
||||||
// Add all parameters
|
// Add all parameters
|
||||||
TmpStr := lMethodName + '(';
|
TmpStr := lMethodName + '(';
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
lParamType := GetNextWord(ASourceLine, lReaderPos);
|
lParamType := GetNextWord(ASourceLine, lReaderPos);
|
||||||
|
|
||||||
|
// Method modifiers
|
||||||
|
if (lParamType = 'virtual') or (lParamType = 'override') then Continue;
|
||||||
|
|
||||||
lParamTypePas := GetPascalTypeName(lParamType);
|
lParamTypePas := GetPascalTypeName(lParamType);
|
||||||
lParamName := GetNextWord(ASourceLine, lReaderPos);
|
if PassByReference(lParamType) then
|
||||||
|
lParamName := 'var ' + GetNextWord(ASourceLine, lReaderPos)
|
||||||
|
else
|
||||||
|
lParamName := GetNextWord(ASourceLine, lReaderPos);
|
||||||
|
|
||||||
if lParamName = '' then Break;
|
if lParamName = '' then Break;
|
||||||
|
|
||||||
@ -277,7 +297,7 @@ begin
|
|||||||
// Method type and name
|
// Method type and name
|
||||||
lMethodName := GetNextWord(ASourceLine, lReaderPos);
|
lMethodName := GetNextWord(ASourceLine, lReaderPos);
|
||||||
|
|
||||||
lIDString := 'amkUI_' + FClassNamePas + '_' + lMethodName;
|
lIDString := GetIDString(lMethodName);
|
||||||
|
|
||||||
FPasOutputClasses.Add(' constructor ' + lMethodName + '();');
|
FPasOutputClasses.Add(' constructor ' + lMethodName + '();');
|
||||||
|
|
||||||
@ -288,8 +308,7 @@ begin
|
|||||||
FPasOutputImpl.Add(' Index := vAndroidPipesComm.WaitForIntReturn();');
|
FPasOutputImpl.Add(' Index := vAndroidPipesComm.WaitForIntReturn();');
|
||||||
FPasOutputImpl.Add('end;');
|
FPasOutputImpl.Add('end;');
|
||||||
|
|
||||||
FPasOutputIDs.Add(' ' + lIDString + ' = $' + IntToHex(FClassNum*$1000+FMethodNum, 8) + ';');
|
AddOutputIDs(lIDString);
|
||||||
FJavaOutputIDs.Add(' static final int ' + lIDString + ' = 0x' + IntToHex(FClassNum*$1000+FMethodNum, 8) + ';');
|
|
||||||
|
|
||||||
FJavaOutputMethods.Add(' case ' + lIDString + ':');
|
FJavaOutputMethods.Add(' case ' + lIDString + ':');
|
||||||
FJavaOutputMethods.Add(' DebugOut("' + lIDString + '");');
|
FJavaOutputMethods.Add(' DebugOut("' + lIDString + '");');
|
||||||
@ -300,12 +319,29 @@ begin
|
|||||||
Inc(FMethodNum);
|
Inc(FMethodNum);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TAndroidSDKBindingsGen.ProcessModelConst(ASourceLine: string);
|
||||||
|
var
|
||||||
|
lReaderPos: Integer = 1;
|
||||||
|
lCurWord: string;
|
||||||
|
lConstName, lConstValue: string;
|
||||||
|
begin
|
||||||
|
if ASourceLine = '' then Exit;
|
||||||
|
|
||||||
|
lConstName := GetNextWord(ASourceLine, lReaderPos);
|
||||||
|
lConstName := GetNextWord(ASourceLine, lReaderPos);
|
||||||
|
lConstValue := GetNextWord(ASourceLine, lReaderPos);
|
||||||
|
lConstValue := GetNextWord(ASourceLine, lReaderPos);
|
||||||
|
|
||||||
|
// Method type and name
|
||||||
|
FPasOutputConsts.Add(Format(' %s = %s;', [lConstName, lConstValue]));
|
||||||
|
end;
|
||||||
|
|
||||||
{ Reads one word in a string, starting at AStartPos (1-based index)
|
{ Reads one word in a string, starting at AStartPos (1-based index)
|
||||||
and going up to a space or comma or ( or ) or another separator }
|
and going up to a space or comma or ( or ) or another separator }
|
||||||
function TAndroidSDKBindingsGen.GetNextWord(ALine: string;
|
function TAndroidSDKBindingsGen.GetNextWord(ALine: string;
|
||||||
var AStartPos: Integer): string;
|
var AStartPos: Integer): string;
|
||||||
const
|
const
|
||||||
WordSeparators = [' ','(',')','[',']',',',#9];
|
WordSeparators = [' ','(',')','[',']',',',';',#9{TAB}];
|
||||||
var
|
var
|
||||||
lState: Integer = 0;
|
lState: Integer = 0;
|
||||||
begin
|
begin
|
||||||
@ -343,12 +379,23 @@ begin
|
|||||||
|
|
||||||
if ABaseName = 'int' then Result := 'Integer'
|
if ABaseName = 'int' then Result := 'Integer'
|
||||||
else if ABaseName = 'boolean' then Result := 'Boolean'
|
else if ABaseName = 'boolean' then Result := 'Boolean'
|
||||||
|
else if ABaseName = 'float' then Result := 'Single'
|
||||||
else if ABaseName = 'void' then Result := ABaseName
|
else if ABaseName = 'void' then Result := ABaseName
|
||||||
else if ABaseName = 'CharSequence' then Result := 'string'
|
else if ABaseName = 'CharSequence' then Result := 'string'
|
||||||
else if ABaseName = 'TJavaObject' then Result := ABaseName
|
else if ABaseName = 'TJavaObject' then Result := ABaseName
|
||||||
else Result := 'T' + ABaseName;
|
else Result := 'T' + ABaseName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TAndroidSDKBindingsGen.PassByReference(ABaseName: string): Boolean;
|
||||||
|
begin
|
||||||
|
if ABaseName = '' then Exit(False);
|
||||||
|
|
||||||
|
if ABaseName = 'int' then Result := False
|
||||||
|
else if ABaseName = 'boolean' then Result := False
|
||||||
|
else if ABaseName = 'float' then Result := False
|
||||||
|
else Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
function TAndroidSDKBindingsGen.GetJavaResultFunction(AReturnType: string
|
function TAndroidSDKBindingsGen.GetJavaResultFunction(AReturnType: string
|
||||||
): string;
|
): string;
|
||||||
begin
|
begin
|
||||||
@ -362,6 +409,17 @@ begin
|
|||||||
else Exit('GetInt');
|
else Exit('GetInt');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TAndroidSDKBindingsGen.GetIDString(AMethodName: string): string;
|
||||||
|
begin
|
||||||
|
Result := 'amkUI_' + FClassNamePas + '_' + AMethodName;;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TAndroidSDKBindingsGen.AddOutputIDs(AIDString: string);
|
||||||
|
begin
|
||||||
|
FPasOutputIDs.Add(' ' + AIDString + ' = $' + IntToHex(FClassNum*$1000+FMethodNum, 8) + ';');
|
||||||
|
FJavaOutputIDs.Add(' static final int ' + AIDString + ' = 0x' + IntToHex(FClassNum*$1000+FMethodNum, 8) + ';');
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TAndroidSDKBindingsGen.Create;
|
constructor TAndroidSDKBindingsGen.Create;
|
||||||
begin
|
begin
|
||||||
FSourceFile := TStringList.Create;
|
FSourceFile := TStringList.Create;
|
||||||
@ -369,6 +427,7 @@ begin
|
|||||||
FPasOutputImpl := TStringList.Create;
|
FPasOutputImpl := TStringList.Create;
|
||||||
FPasOutputIDs := TStringList.Create;
|
FPasOutputIDs := TStringList.Create;
|
||||||
|
|
||||||
|
FPasOutputConsts := TStringList.Create;
|
||||||
FJavaOutputIDs := TStringList.Create;
|
FJavaOutputIDs := TStringList.Create;
|
||||||
FJavaOutputMethods := TStringList.Create;
|
FJavaOutputMethods := TStringList.Create;
|
||||||
|
|
||||||
@ -382,6 +441,7 @@ begin
|
|||||||
FPasOutputImpl.Free;
|
FPasOutputImpl.Free;
|
||||||
FPasOutputIDs.Free;
|
FPasOutputIDs.Free;
|
||||||
|
|
||||||
|
FPasOutputConsts.Free;
|
||||||
FJavaOutputIDs.Free;
|
FJavaOutputIDs.Free;
|
||||||
FJavaOutputMethods.Free;
|
FJavaOutputMethods.Free;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ object Form1: TForm1
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object editInputPath: TDirectoryEdit
|
object editInputPath: TDirectoryEdit
|
||||||
Left = 64
|
Left = 88
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 72
|
Top = 72
|
||||||
Width = 312
|
Width = 312
|
||||||
@ -31,8 +31,8 @@ object Form1: TForm1
|
|||||||
Left = 7
|
Left = 7
|
||||||
Height = 18
|
Height = 18
|
||||||
Top = 73
|
Top = 73
|
||||||
Width = 43
|
Width = 69
|
||||||
Caption = 'Label2'
|
Caption = 'Input Path:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Button1: TButton
|
object Button1: TButton
|
||||||
|
@ -5,13 +5,97 @@
|
|||||||
#[Menu] TJavaObject
|
#[Menu] TJavaObject
|
||||||
#method MenuItem add(int groupId, int itemId, int order, CharSequence title)
|
#method MenuItem add(int groupId, int itemId, int order, CharSequence title)
|
||||||
|
|
||||||
[CompoundButton] Button 110
|
#
|
||||||
|
# android.util.*
|
||||||
|
#
|
||||||
|
[DisplayMetrics] TJavaObject
|
||||||
|
constructor Create()
|
||||||
|
method float density()
|
||||||
|
method int densityDpi()
|
||||||
|
method int heightPixels()
|
||||||
|
method float scaledDensity()
|
||||||
|
method int widthPixels()
|
||||||
|
method float xdpi()
|
||||||
|
method float ydpi()
|
||||||
|
|
||||||
|
#
|
||||||
|
# android.app.*
|
||||||
|
#
|
||||||
|
[Display] TJavaObject
|
||||||
|
method void getMetrics(DisplayMetrics outMetrics)
|
||||||
|
|
||||||
|
[WindowManager] TJavaObject
|
||||||
|
method Display getDefaultDisplay()
|
||||||
|
|
||||||
|
#
|
||||||
|
# android.view
|
||||||
|
#
|
||||||
|
[LayoutParams] TJavaObject
|
||||||
|
constructor Create(int width, int height);
|
||||||
|
const FILL_PARENT = $FFFFFFFF;
|
||||||
|
|
||||||
|
[View] TJavaObject
|
||||||
|
method void setLayoutParams(LayoutParams params);
|
||||||
|
method void setVisibility(int visibility);
|
||||||
|
const VISIBLE = 0;
|
||||||
|
const INVISIBLE = 4;
|
||||||
|
const GONE = 8;
|
||||||
|
|
||||||
|
[ViewGroup] View
|
||||||
|
procedure addView(View child, LayoutParams params);
|
||||||
|
procedure addView(View child);
|
||||||
|
|
||||||
|
[LinearLayout] TViewGroup
|
||||||
|
constructor Create();
|
||||||
|
procedure setOrientation(int orientation);
|
||||||
|
const HORIZONTAL = 0;
|
||||||
|
const VERTICAL = 1;
|
||||||
|
|
||||||
|
[AbsoluteLayout] TViewGroup
|
||||||
|
constructor Create();
|
||||||
|
|
||||||
|
[AbsoluteLayout_LayoutParams] LayoutParams
|
||||||
|
constructor Create(int param_width, int param_height, int param_x, int param_y);
|
||||||
|
# TOnClickCallback = procedure (v: TView) of object;
|
||||||
|
|
||||||
|
[TextView] View
|
||||||
|
# protected
|
||||||
|
# OnClickListener: TOnClickCallback;
|
||||||
|
constructor Create(); virtual;
|
||||||
|
method void setText(CharSequence AText); virtual;
|
||||||
|
# procedure setOnClickListener(ACallback: TOnClickCallback);
|
||||||
|
# procedure callOnClickListener();
|
||||||
|
method void setTextSize(int unit_; float size);
|
||||||
|
|
||||||
|
[EditText] TextView
|
||||||
|
constructor Create(); override;
|
||||||
|
method void setText(CharSequence AText); override;
|
||||||
|
|
||||||
|
[Button] TextView
|
||||||
|
constructor Create(); override;
|
||||||
|
method void setText(CharSequence AText); override;
|
||||||
|
|
||||||
|
[FrameLayout] ViewGroup
|
||||||
|
|
||||||
|
[TimePicker] FrameLayout
|
||||||
|
constructor Create();
|
||||||
|
method int getCurrentHour();
|
||||||
|
method void setCurrentHour(int currentHour);
|
||||||
|
method int getCurrentMinute: Integer;
|
||||||
|
method void setCurrentMinute(int currentMinute);
|
||||||
|
method boolean is24HourView: Boolean;
|
||||||
|
method void setIs24HourView(boolean AIs24HourView);
|
||||||
|
|
||||||
|
[ScrollView] FrameLayout
|
||||||
|
constructor Create();
|
||||||
|
|
||||||
|
[CompoundButton] Button
|
||||||
method boolean isChecked()
|
method boolean isChecked()
|
||||||
method boolean performClick()
|
method boolean performClick()
|
||||||
method void setChecked(boolean checked)
|
method void setChecked(boolean checked)
|
||||||
#method void setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener listener)
|
#method void setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener listener)
|
||||||
method void toggle()
|
method void toggle()
|
||||||
|
|
||||||
[CheckBox] CompoundButton 111
|
[CheckBox] CompoundButton
|
||||||
constructor Create
|
constructor Create()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user