You've already forked lazarus-ccr
Improves the android sdk bindings generator
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1749 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -39,7 +39,7 @@
|
|||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="16">
|
<Units Count="18">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="android_bindings_generator.pas"/>
|
<Filename Value="android_bindings_generator.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -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="29"/>
|
<UsageCount Value="32"/>
|
||||||
<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="33" Y="38"/>
|
<CursorPos X="34" Y="38"/>
|
||||||
<UsageCount Value="29"/>
|
<UsageCount Value="32"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
@ -107,23 +107,22 @@
|
|||||||
</Unit6>
|
</Unit6>
|
||||||
<Unit7>
|
<Unit7>
|
||||||
<Filename Value="../../../p-tools/turbochessclock4android/android/src/com/pascal/turbochessclock/AndroidMenu.java"/>
|
<Filename Value="../../../p-tools/turbochessclock4android/android/src/com/pascal/turbochessclock/AndroidMenu.java"/>
|
||||||
<EditorIndex Value="5"/>
|
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="27"/>
|
<TopLine Value="54"/>
|
||||||
<CursorPos X="1" Y="29"/>
|
<CursorPos X="87" Y="37"/>
|
||||||
<UsageCount Value="15"/>
|
<UsageCount Value="16"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
<DefaultSyntaxHighlighter Value="Java"/>
|
<DefaultSyntaxHighlighter Value="Java"/>
|
||||||
</Unit7>
|
</Unit7>
|
||||||
<Unit8>
|
<Unit8>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="android_sdk_bindings_gen"/>
|
<UnitName Value="android_sdk_bindings_gen"/>
|
||||||
|
<IsVisibleTab Value="True"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="2"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="79"/>
|
<TopLine Value="150"/>
|
||||||
<CursorPos X="47" Y="110"/>
|
<CursorPos X="54" Y="169"/>
|
||||||
<UsageCount Value="29"/>
|
<UsageCount Value="32"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit8>
|
</Unit8>
|
||||||
<Unit9>
|
<Unit9>
|
||||||
@ -152,31 +151,30 @@
|
|||||||
</Unit11>
|
</Unit11>
|
||||||
<Unit12>
|
<Unit12>
|
||||||
<Filename Value="../../../p-tools/turbochessclock4android/android/src/com/pascal/turbochessclock/AndroidView.java"/>
|
<Filename Value="../../../p-tools/turbochessclock4android/android/src/com/pascal/turbochessclock/AndroidView.java"/>
|
||||||
<EditorIndex Value="4"/>
|
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="177"/>
|
<TopLine Value="177"/>
|
||||||
<CursorPos X="39" Y="177"/>
|
<CursorPos X="39" Y="177"/>
|
||||||
<UsageCount Value="15"/>
|
<UsageCount Value="15"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
<DefaultSyntaxHighlighter Value="Java"/>
|
<DefaultSyntaxHighlighter Value="Java"/>
|
||||||
</Unit12>
|
</Unit12>
|
||||||
<Unit13>
|
<Unit13>
|
||||||
<Filename Value="../../../p-tools/systeminfo4android/androidpipescomm.pas"/>
|
<Filename Value="../../../p-tools/systeminfo4android/androidpipescomm.pas"/>
|
||||||
<UnitName Value="androidpipescomm"/>
|
<UnitName Value="androidpipescomm"/>
|
||||||
|
<EditorIndex Value="5"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="114"/>
|
<TopLine Value="127"/>
|
||||||
<CursorPos X="115" Y="3"/>
|
<CursorPos X="17" Y="161"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="11"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
</Unit13>
|
</Unit13>
|
||||||
<Unit14>
|
<Unit14>
|
||||||
<Filename Value="sdk_level_7/android_all.pas"/>
|
<Filename Value="sdk_level_7/android_all.pas"/>
|
||||||
<UnitName Value="android_all"/>
|
<UnitName Value="android_all"/>
|
||||||
<IsVisibleTab Value="True"/>
|
|
||||||
<EditorIndex Value="3"/>
|
<EditorIndex Value="3"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="5"/>
|
<TopLine Value="1"/>
|
||||||
<CursorPos X="92" Y="5"/>
|
<CursorPos X="82" Y="15"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="11"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit14>
|
</Unit14>
|
||||||
<Unit15>
|
<Unit15>
|
||||||
@ -187,128 +185,142 @@
|
|||||||
<CursorPos X="1" Y="1"/>
|
<CursorPos X="1" Y="1"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit15>
|
</Unit15>
|
||||||
|
<Unit16>
|
||||||
|
<Filename Value="../../../p-tools/systeminfo4android/androidtimer.pas"/>
|
||||||
|
<UnitName Value="androidtimer"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<CursorPos X="3" Y="20"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit16>
|
||||||
|
<Unit17>
|
||||||
|
<Filename Value="sdk_level_7/AndroidAll.java"/>
|
||||||
|
<EditorIndex Value="4"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="251"/>
|
||||||
|
<CursorPos X="48" Y="251"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
<DefaultSyntaxHighlighter Value="Java"/>
|
||||||
|
</Unit17>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="29" HistoryIndex="28">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="309" Column="32" TopLine="305"/>
|
<Caret Line="438" Column="51" TopLine="433"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="26" Column="35" TopLine="1"/>
|
<Caret Line="403" Column="65" TopLine="379"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="305" Column="54" TopLine="305"/>
|
<Caret Line="391" Column="22" TopLine="379"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="sdk_level_7/android_all.pas"/>
|
||||||
<Caret Line="24" Column="59" TopLine="1"/>
|
<Caret Line="363" Column="24" TopLine="333"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="22" Column="27" TopLine="1"/>
|
<Caret Line="122" Column="21" TopLine="97"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="23" Column="17" TopLine="1"/>
|
<Caret Line="138" Column="4" TopLine="98"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="mainform.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="32" Column="22" TopLine="1"/>
|
<Caret Line="432" Column="91" TopLine="386"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="mainform.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="38" Column="33" TopLine="1"/>
|
<Caret Line="416" Column="64" TopLine="392"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="../../../p-tools/systeminfo4android/androidpipescomm.pas"/>
|
||||||
<Caret Line="209" Column="25" TopLine="194"/>
|
<Caret Line="161" Column="17" TopLine="127"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="mainform.pas"/>
|
||||||
<Caret Line="27" Column="26" TopLine="2"/>
|
<Caret Line="38" Column="34" TopLine="1"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="25" Column="29" TopLine="1"/>
|
<Caret Line="532" Column="35" TopLine="515"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="326" Column="6" TopLine="301"/>
|
<Caret Line="293" Column="3" TopLine="287"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="22" Column="81" TopLine="12"/>
|
<Caret Line="439" Column="1" TopLine="393"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="90" Column="37" TopLine="64"/>
|
<Caret Line="448" Column="1" TopLine="414"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="28" Column="17" TopLine="1"/>
|
<Caret Line="399" Column="77" TopLine="384"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="22" Column="19" TopLine="3"/>
|
<Caret Line="478" Column="23" TopLine="451"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="27" Column="19" TopLine="1"/>
|
<Caret Line="460" Column="27" TopLine="430"/>
|
||||||
</Position17>
|
</Position17>
|
||||||
<Position18>
|
<Position18>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="354" Column="1" TopLine="352"/>
|
<Caret Line="462" Column="97" TopLine="438"/>
|
||||||
</Position18>
|
</Position18>
|
||||||
<Position19>
|
<Position19>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="102" Column="5" TopLine="72"/>
|
<Caret Line="27" Column="30" TopLine="1"/>
|
||||||
</Position19>
|
</Position19>
|
||||||
<Position20>
|
<Position20>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="98" Column="1" TopLine="72"/>
|
<Caret Line="604" Column="42" TopLine="569"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="27" Column="15" TopLine="1"/>
|
<Caret Line="602" Column="1" TopLine="577"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="../../../p-tools/turbochessclock4android/android/src/com/pascal/turbochessclock/AndroidMenu.java"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="90" Column="15" TopLine="53"/>
|
<Caret Line="601" Column="55" TopLine="577"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="438" Column="51" TopLine="433"/>
|
<Caret Line="389" Column="1" TopLine="356"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="403" Column="65" TopLine="379"/>
|
<Caret Line="25" Column="15" TopLine="12"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="391" Column="22" TopLine="379"/>
|
<Caret Line="302" Column="31" TopLine="289"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="sdk_level_7/android_all.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="363" Column="24" TopLine="333"/>
|
<Caret Line="399" Column="67" TopLine="367"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="122" Column="21" TopLine="97"/>
|
<Caret Line="641" Column="54" TopLine="637"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="sdk_level_7/android_all.pas"/>
|
||||||
<Caret Line="138" Column="4" TopLine="98"/>
|
<Caret Line="459" Column="85" TopLine="442"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="432" Column="91" TopLine="386"/>
|
<Caret Line="641" Column="8" TopLine="617"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
<Position30>
|
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
|
||||||
<Caret Line="416" Column="64" TopLine="392"/>
|
|
||||||
</Position30>
|
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -22,7 +22,7 @@ type
|
|||||||
procedure ProcessModelFile(ASourceFile, APasOutputFile, AJavaOutputFile: string);
|
procedure ProcessModelFile(ASourceFile, APasOutputFile, AJavaOutputFile: string);
|
||||||
procedure ProcessModelLine(ASourceLine: string);
|
procedure ProcessModelLine(ASourceLine: string);
|
||||||
procedure ProcessModelClass(ASourceLine: string);
|
procedure ProcessModelClass(ASourceLine: string);
|
||||||
procedure ProcessModelMethod(ASourceLine: string);
|
procedure ProcessModelMethod(ASourceLine: string; AIsField: Boolean);
|
||||||
procedure ProcessModelConstructor(ASourceLine: string);
|
procedure ProcessModelConstructor(ASourceLine: string);
|
||||||
procedure ProcessModelConst(ASourceLine: string);
|
procedure ProcessModelConst(ASourceLine: string);
|
||||||
procedure ProcessModelCallbackSetterCaller(ASourceLine: string);
|
procedure ProcessModelCallbackSetterCaller(ASourceLine: string);
|
||||||
@ -121,12 +121,83 @@ begin
|
|||||||
|
|
||||||
lPasOutputFile.SaveToFile(APasOutputFile);
|
lPasOutputFile.SaveToFile(APasOutputFile);
|
||||||
|
|
||||||
// Now save the Java file
|
lJavaOutputFile.Add('package com.pascal.androidlcl;');
|
||||||
|
lJavaOutputFile.Add('');
|
||||||
|
lJavaOutputFile.Add('import android.app.*;');
|
||||||
|
lJavaOutputFile.Add('import android.view.*;');
|
||||||
|
lJavaOutputFile.Add('import android.os.*;');
|
||||||
|
lJavaOutputFile.Add('import android.util.*;');
|
||||||
|
lJavaOutputFile.Add('import android.content.*;');
|
||||||
|
lJavaOutputFile.Add('import android.view.*;');
|
||||||
|
lJavaOutputFile.Add('import android.widget.*;');
|
||||||
|
lJavaOutputFile.Add('import java.util.*;');
|
||||||
|
lJavaOutputFile.Add('import java.lang.*;');
|
||||||
|
lJavaOutputFile.Add('');
|
||||||
|
lJavaOutputFile.Add('public class AndroidAll');
|
||||||
|
lJavaOutputFile.Add('{');
|
||||||
|
lJavaOutputFile.Add(' // info from other classes');
|
||||||
|
lJavaOutputFile.Add(' Activity activity;');
|
||||||
|
lJavaOutputFile.Add(' AndroidPipesComm MyAndroidPipesComm;');
|
||||||
|
lJavaOutputFile.Add(' JavaLang MyJavaLang;');
|
||||||
|
lJavaOutputFile.Add(' // lists of variables');
|
||||||
|
lJavaOutputFile.Add(' ArrayList ViewElements;');
|
||||||
|
lJavaOutputFile.Add('');
|
||||||
|
lJavaOutputFile.Add(' public AndroidAll(AndroidPipesComm AAndroidPipesComm, Activity AActivity, JavaLang AJavaLang)');
|
||||||
|
lJavaOutputFile.Add(' {');
|
||||||
|
lJavaOutputFile.Add(' activity = AActivity;');
|
||||||
|
lJavaOutputFile.Add(' MyAndroidPipesComm = AAndroidPipesComm;');
|
||||||
|
lJavaOutputFile.Add(' MyJavaLang = AJavaLang;');
|
||||||
|
lJavaOutputFile.Add(' ViewElements = new ArrayList();');
|
||||||
|
lJavaOutputFile.Add(' }');
|
||||||
|
lJavaOutputFile.Add('');
|
||||||
|
lJavaOutputFile.Add(' public void DebugOut(String Str)');
|
||||||
|
lJavaOutputFile.Add(' {');
|
||||||
|
lJavaOutputFile.Add(' MyAndroidPipesComm.DebugOut(Str);');
|
||||||
|
lJavaOutputFile.Add(' }');
|
||||||
lJavaOutputFile.Add('');
|
lJavaOutputFile.Add('');
|
||||||
lJavaOutputFile.AddStrings(FJavaOutputIDs);
|
lJavaOutputFile.AddStrings(FJavaOutputIDs);
|
||||||
lJavaOutputFile.Add('');
|
lJavaOutputFile.Add('');
|
||||||
|
lJavaOutputFile.Add(' public boolean ProcessCommand(int Buffer)');
|
||||||
|
lJavaOutputFile.Add(' {');
|
||||||
|
lJavaOutputFile.Add(' //DebugOut("AndroidUI.ProcessCommand Command=" + java.lang.Integer.toHexString(Buffer));');
|
||||||
|
lJavaOutputFile.Add(' // basic types');
|
||||||
|
lJavaOutputFile.Add(' int lInt, lIndex, lPascalPointer;');
|
||||||
|
lJavaOutputFile.Add(' // Self params');
|
||||||
|
lJavaOutputFile.Add(' View param_self_View;');
|
||||||
|
lJavaOutputFile.Add(' ViewGroup param_self_ViewGroup;');
|
||||||
|
lJavaOutputFile.Add(' TextView param_self_TextView;');
|
||||||
|
lJavaOutputFile.Add(' Button param_self_Button;');
|
||||||
|
lJavaOutputFile.Add(' EditText param_self_EditText;');
|
||||||
|
lJavaOutputFile.Add(' LinearLayout param_self_LinearLayout;');
|
||||||
|
lJavaOutputFile.Add(' TimePicker param_self_TimePicker;');
|
||||||
|
lJavaOutputFile.Add(' Display param_self_Display;');
|
||||||
|
lJavaOutputFile.Add(' DisplayMetrics param_self_DisplayMetrics;');
|
||||||
|
lJavaOutputFile.Add(' CompoundButton param_self_CompoundButton;');
|
||||||
|
lJavaOutputFile.Add(' WindowManager param_self_WindowManager;');
|
||||||
|
lJavaOutputFile.Add(' // Params');
|
||||||
|
lJavaOutputFile.Add(' ViewGroup.LayoutParams lLayoutParams_1;');
|
||||||
|
lJavaOutputFile.Add(' DisplayMetrics lDisplayMetrics_1;');
|
||||||
|
lJavaOutputFile.Add(' CharSequence lCharSequence_1;');
|
||||||
|
lJavaOutputFile.Add(' int lint_1, lint_2, lint_3, lint_4;');
|
||||||
|
lJavaOutputFile.Add(' float lfloat_1, lfloat_2;');
|
||||||
|
lJavaOutputFile.Add(' boolean lboolean_1;');
|
||||||
|
lJavaOutputFile.Add(' // Results');
|
||||||
|
lJavaOutputFile.Add(' float lResult_float;');
|
||||||
|
lJavaOutputFile.Add(' int lResult_int;');
|
||||||
|
lJavaOutputFile.Add(' boolean lResult_boolean;');
|
||||||
|
lJavaOutputFile.Add(' Display lResult_Display;');
|
||||||
|
lJavaOutputFile.Add('');
|
||||||
|
lJavaOutputFile.Add(' switch (Buffer)');
|
||||||
|
lJavaOutputFile.Add(' {');
|
||||||
|
lJavaOutputFile.Add('');
|
||||||
lJavaOutputFile.AddStrings(FJavaOutputMethods);
|
lJavaOutputFile.AddStrings(FJavaOutputMethods);
|
||||||
lJavaOutputFile.Add('');
|
lJavaOutputFile.Add('');
|
||||||
|
lJavaOutputFile.Add(' default:');
|
||||||
|
lJavaOutputFile.Add(' return false;');
|
||||||
|
lJavaOutputFile.Add(' }');
|
||||||
|
lJavaOutputFile.Add(' return true;');
|
||||||
|
lJavaOutputFile.Add(' }');
|
||||||
|
lJavaOutputFile.Add('}');
|
||||||
|
|
||||||
lJavaOutputFile.SaveToFile(AJavaOutputFile);
|
lJavaOutputFile.SaveToFile(AJavaOutputFile);
|
||||||
finally
|
finally
|
||||||
@ -157,7 +228,7 @@ begin
|
|||||||
// Adding methods to a class
|
// Adding methods to a class
|
||||||
if lCurWord = 'method' then
|
if lCurWord = 'method' then
|
||||||
begin
|
begin
|
||||||
ProcessModelMethod(ASourceLine);
|
ProcessModelMethod(ASourceLine, False);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -180,6 +251,13 @@ begin
|
|||||||
ProcessModelCallbackSetterCaller(ASourceLine);
|
ProcessModelCallbackSetterCaller(ASourceLine);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Fields
|
||||||
|
if lCurWord = 'field' then
|
||||||
|
begin
|
||||||
|
ProcessModelMethod(ASourceLine, True);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAndroidSDKBindingsGen.ProcessModelClass(ASourceLine: string);
|
procedure TAndroidSDKBindingsGen.ProcessModelClass(ASourceLine: string);
|
||||||
@ -214,7 +292,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAndroidSDKBindingsGen.ProcessModelMethod(
|
procedure TAndroidSDKBindingsGen.ProcessModelMethod(
|
||||||
ASourceLine: string);
|
ASourceLine: string; AIsField: Boolean);
|
||||||
var
|
var
|
||||||
lReaderPos: Integer = 1;
|
lReaderPos: Integer = 1;
|
||||||
lParamNum: Integer = 1;
|
lParamNum: Integer = 1;
|
||||||
@ -287,7 +365,8 @@ begin
|
|||||||
until lParamName = '';
|
until lParamName = '';
|
||||||
|
|
||||||
// Remove the last ; for the parameters, if necessary
|
// Remove the last ; for the parameters, if necessary
|
||||||
if TmpStr[Length(TmpStr)-1] = ';' then TmpStr := System.Copy(TmpStr, 0, Length(TmpStr)-2);
|
if (Length(TmpStr) > 0) and (TmpStr[Length(TmpStr)-1] = ';') then
|
||||||
|
TmpStr := System.Copy(TmpStr, 0, Length(TmpStr)-2);
|
||||||
// And for Java params too
|
// And for Java params too
|
||||||
lJavaParams := System.Copy(lJavaParams, 0, Length(lJavaParams)-2);
|
lJavaParams := System.Copy(lJavaParams, 0, Length(lJavaParams)-2);
|
||||||
|
|
||||||
@ -309,7 +388,12 @@ begin
|
|||||||
FPasOutputImpl.Add('');
|
FPasOutputImpl.Add('');
|
||||||
|
|
||||||
FJavaOutputMethods.Add(' //');
|
FJavaOutputMethods.Add(' //');
|
||||||
if lMethodReturn = 'void' then
|
if AIsField then
|
||||||
|
begin
|
||||||
|
FJavaOutputMethods.Add(' lResult_' + lMethodReturn + ' = ' + lJavaParamSelf + '.' + lMethodName + ';');
|
||||||
|
FJavaOutputMethods.Add(' MyAndroidPipesComm.' + GetJavaResultFunction(lMethodReturn) + '(lResult_' + lMethodReturn + ');');
|
||||||
|
end
|
||||||
|
else if lMethodReturn = 'void' then
|
||||||
begin
|
begin
|
||||||
FJavaOutputMethods.Add(' ' + lJavaParamSelf + '.' + lMethodName + '(' + lJavaParams + ');');
|
FJavaOutputMethods.Add(' ' + lJavaParamSelf + '.' + lMethodName + '(' + lJavaParams + ');');
|
||||||
FJavaOutputMethods.Add(' MyAndroidPipesComm.SendResult();');
|
FJavaOutputMethods.Add(' MyAndroidPipesComm.SendResult();');
|
||||||
@ -330,8 +414,10 @@ var
|
|||||||
lCurWord: string;
|
lCurWord: string;
|
||||||
lParamNum: Integer = 1;
|
lParamNum: Integer = 1;
|
||||||
lMethodName, lParamType, lParamTypePas, lParamName: string;
|
lMethodName, lParamType, lParamTypePas, lParamName: string;
|
||||||
DeclarationBase, TmpStr, lIDString: string;
|
lConstructorPasParams, lConstructorJavaParams, lParamPrefix, lJavaParamVar: string;
|
||||||
|
DeclarationBase, lIDString: string;
|
||||||
FPasOutputImplCurLine: Integer;
|
FPasOutputImplCurLine: Integer;
|
||||||
|
HasActivityParam: Boolean = False;
|
||||||
begin
|
begin
|
||||||
if ASourceLine = '' then Exit;
|
if ASourceLine = '' then Exit;
|
||||||
|
|
||||||
@ -342,20 +428,70 @@ begin
|
|||||||
|
|
||||||
lIDString := GetIDString(lMethodName);
|
lIDString := GetIDString(lMethodName);
|
||||||
|
|
||||||
|
AddOutputIDs(lIDString);
|
||||||
|
|
||||||
FPasOutputClasses.Add(' constructor ' + lMethodName + '();');
|
FPasOutputClasses.Add(' constructor ' + lMethodName + '();');
|
||||||
|
|
||||||
FPasOutputImpl.Add('constructor ' + FClassNamePas + '.' + lMethodName + '();');
|
FPasOutputImpl.Add('constructor ' + FClassNamePas + '.' + lMethodName + '();');
|
||||||
FPasOutputImpl.Add('begin');
|
FPasOutputImpl.Add('begin');
|
||||||
FPasOutputImpl.Add(' vAndroidPipesComm.SendByte(ShortInt(amkUICommand));');
|
FPasOutputImpl.Add(' vAndroidPipesComm.SendByte(ShortInt(amkUICommand));');
|
||||||
FPasOutputImpl.Add(' vAndroidPipesComm.SendInt(' + lIDString + ');');
|
FPasOutputImpl.Add(' vAndroidPipesComm.SendInt(' + lIDString + ');');
|
||||||
FPasOutputImpl.Add(' Index := vAndroidPipesComm.WaitForIntReturn();');
|
|
||||||
FPasOutputImpl.Add('end;');
|
|
||||||
|
|
||||||
AddOutputIDs(lIDString);
|
|
||||||
|
|
||||||
FJavaOutputMethods.Add(' case ' + lIDString + ':');
|
FJavaOutputMethods.Add(' case ' + lIDString + ':');
|
||||||
FJavaOutputMethods.Add(' DebugOut("' + lIDString + '");');
|
FJavaOutputMethods.Add(' DebugOut("' + lIDString + '");');
|
||||||
FJavaOutputMethods.Add(' ViewElements.add(new ' + FClassName + '(activity));');
|
|
||||||
|
// Constructor parameters
|
||||||
|
lConstructorJavaParams := '';
|
||||||
|
lConstructorPasParams := '';
|
||||||
|
|
||||||
|
repeat
|
||||||
|
lParamType := GetNextWord(ASourceLine, lReaderPos);
|
||||||
|
|
||||||
|
// Method modifiers
|
||||||
|
if (lParamType = 'virtual') or (lParamType = 'override') then Continue;
|
||||||
|
|
||||||
|
// The Activity global object doesn't appear in the Pascal side and
|
||||||
|
//comes as a single word in the txt file
|
||||||
|
if (lParamType = 'Activity') then
|
||||||
|
begin
|
||||||
|
HasActivityParam := True;
|
||||||
|
Continue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
lParamTypePas := GetPascalTypeName(lParamType);
|
||||||
|
lParamName := GetNextWord(ASourceLine, lReaderPos);
|
||||||
|
if PassByReference(lParamType) then lParamPrefix := 'var '
|
||||||
|
else lParamPrefix := '';
|
||||||
|
|
||||||
|
if lParamName = '' then Break;
|
||||||
|
|
||||||
|
lConstructorPasParams := lConstructorPasParams + lParamPrefix + lParamName + ': ' + lParamTypePas + '; ';
|
||||||
|
|
||||||
|
// Pascal parameter sending
|
||||||
|
FPasOutputImpl.Add(' vAndroidPipesComm.SendInt(Integer(' + lParamName + '));');
|
||||||
|
|
||||||
|
// Java parameter reading
|
||||||
|
lJavaParamVar := 'l' + lParamType + '_' + IntToStr(lParamNum);
|
||||||
|
FJavaOutputMethods.Add(' ' + lJavaParamVar + ' = MyAndroidPipesComm.' + GetJavaTypeReader(lParamType) + '();');
|
||||||
|
lConstructorJavaParams := lConstructorJavaParams + lJavaParamVar + ', ';
|
||||||
|
|
||||||
|
Inc(lParamNum);
|
||||||
|
until lParamName = '';
|
||||||
|
|
||||||
|
if HasActivityParam then lConstructorJavaParams := 'activity, ' + lConstructorJavaParams;
|
||||||
|
|
||||||
|
// Remove the last ; for the parameters, if necessary
|
||||||
|
if (Length(lConstructorPasParams) > 0) and (lConstructorPasParams[Length(lConstructorPasParams)-1] = ';') then
|
||||||
|
lConstructorPasParams := System.Copy(lConstructorPasParams, 0, Length(lConstructorPasParams)-2);
|
||||||
|
// And for Java params too
|
||||||
|
lConstructorJavaParams := System.Copy(lConstructorJavaParams, 0, Length(lConstructorJavaParams)-2);
|
||||||
|
|
||||||
|
// Finalization of the constructor
|
||||||
|
|
||||||
|
FPasOutputImpl.Add(' Index := vAndroidPipesComm.WaitForIntReturn();');
|
||||||
|
FPasOutputImpl.Add('end;');
|
||||||
|
|
||||||
|
FJavaOutputMethods.Add(' ViewElements.add(new ' + FClassName + '(' + lConstructorJavaParams + '));');
|
||||||
FJavaOutputMethods.Add(' MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);');
|
FJavaOutputMethods.Add(' MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);');
|
||||||
FJavaOutputMethods.Add(' break;');
|
FJavaOutputMethods.Add(' break;');
|
||||||
|
|
||||||
@ -492,7 +628,11 @@ begin
|
|||||||
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
|
||||||
|
begin
|
||||||
|
Result := 'T' + ABaseName;
|
||||||
|
Result := StringReplace(Result, '.', '_', [rfReplaceAll]);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TAndroidSDKBindingsGen.PassByReference(ABaseName: string): Boolean;
|
function TAndroidSDKBindingsGen.PassByReference(ABaseName: string): Boolean;
|
||||||
@ -509,6 +649,7 @@ function TAndroidSDKBindingsGen.GetJavaResultFunction(AReturnType: string
|
|||||||
): string;
|
): string;
|
||||||
begin
|
begin
|
||||||
if AReturnType = 'boolean' then Result := 'SendBoolResult'
|
if AReturnType = 'boolean' then Result := 'SendBoolResult'
|
||||||
|
else if AReturnType = 'float' then Result := 'SendFloatResult'
|
||||||
else Result := 'SendIntResult';
|
else Result := 'SendIntResult';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -521,6 +662,7 @@ end;
|
|||||||
function TAndroidSDKBindingsGen.GetIDString(AMethodName: string): string;
|
function TAndroidSDKBindingsGen.GetIDString(AMethodName: string): string;
|
||||||
begin
|
begin
|
||||||
Result := 'amkUI_' + FClassNamePas + '_' + AMethodName;;
|
Result := 'amkUI_' + FClassNamePas + '_' + AMethodName;;
|
||||||
|
Result := StringReplace(Result, '.', '_', [rfReplaceAll]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAndroidSDKBindingsGen.AddOutputIDs(AIDString: string);
|
procedure TAndroidSDKBindingsGen.AddOutputIDs(AIDString: string);
|
||||||
@ -570,7 +712,7 @@ procedure TAndroidSDKBindingsGen.GenerateAllBindings(AInputDir, APasOutputDir,
|
|||||||
begin
|
begin
|
||||||
ProcessModelFile(IncludeTrailingPathDelimiter(AInputDir) + 'android_all.txt',
|
ProcessModelFile(IncludeTrailingPathDelimiter(AInputDir) + 'android_all.txt',
|
||||||
IncludeTrailingPathDelimiter(APasOutputDir) + 'android_all.pas',
|
IncludeTrailingPathDelimiter(APasOutputDir) + 'android_all.pas',
|
||||||
IncludeTrailingPathDelimiter(AJavaOutputDir) + 'android_all.java');
|
IncludeTrailingPathDelimiter(AJavaOutputDir) + 'AndroidAll.java');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
@ -10,13 +10,13 @@
|
|||||||
#
|
#
|
||||||
[DisplayMetrics] TJavaObject
|
[DisplayMetrics] TJavaObject
|
||||||
constructor Create()
|
constructor Create()
|
||||||
method float density()
|
field float density
|
||||||
method int densityDpi()
|
field int densityDpi
|
||||||
method int heightPixels()
|
field int heightPixels
|
||||||
method float scaledDensity()
|
field float scaledDensity
|
||||||
method int widthPixels()
|
field int widthPixels
|
||||||
method float xdpi()
|
field float xdpi
|
||||||
method float ydpi()
|
field float ydpi
|
||||||
|
|
||||||
#
|
#
|
||||||
# android.app.*
|
# android.app.*
|
||||||
@ -30,7 +30,7 @@ method Display getDefaultDisplay()
|
|||||||
#
|
#
|
||||||
# android.view
|
# android.view
|
||||||
#
|
#
|
||||||
[LayoutParams] TJavaObject
|
[ViewGroup.LayoutParams] TJavaObject
|
||||||
constructor Create(int width, int height);
|
constructor Create(int width, int height);
|
||||||
const FILL_PARENT = $FFFFFFFF;
|
const FILL_PARENT = $FFFFFFFF;
|
||||||
|
|
||||||
@ -46,35 +46,35 @@ procedure addView(View child, LayoutParams params);
|
|||||||
procedure addView(View child);
|
procedure addView(View child);
|
||||||
|
|
||||||
[LinearLayout] ViewGroup
|
[LinearLayout] ViewGroup
|
||||||
constructor Create();
|
constructor Create(Activity);
|
||||||
procedure setOrientation(int orientation);
|
procedure setOrientation(int orientation);
|
||||||
const HORIZONTAL = 0;
|
const HORIZONTAL = 0;
|
||||||
const VERTICAL = 1;
|
const VERTICAL = 1;
|
||||||
|
|
||||||
[AbsoluteLayout] ViewGroup
|
[AbsoluteLayout] ViewGroup
|
||||||
constructor Create();
|
constructor Create(Activity);
|
||||||
|
|
||||||
[AbsoluteLayout_LayoutParams] LayoutParams
|
[AbsoluteLayout_LayoutParams] LayoutParams
|
||||||
constructor Create(int param_width, int param_height, int param_x, int param_y);
|
constructor Create(int param_width, int param_height, int param_x, int param_y);
|
||||||
|
|
||||||
[TextView] View
|
[TextView] View
|
||||||
constructor Create(); virtual;
|
constructor Create(Activity); virtual;
|
||||||
method void setText(CharSequence AText); virtual;
|
method void setText(CharSequence AText); virtual;
|
||||||
callbacksettercaller setOnClickListener callOnClickListener OnClickListener = procedure (v: TView) of object;
|
callbacksettercaller setOnClickListener callOnClickListener OnClickListener = procedure (v: TView) of object;
|
||||||
method void setTextSize(int unit_; float size);
|
method void setTextSize(int unit_; float size);
|
||||||
|
|
||||||
[EditText] TextView
|
[EditText] TextView
|
||||||
constructor Create(); override;
|
constructor Create(Activity); override;
|
||||||
method void setText(CharSequence AText); override;
|
method void setText(CharSequence AText); override;
|
||||||
|
|
||||||
[Button] TextView
|
[Button] TextView
|
||||||
constructor Create(); override;
|
constructor Create(Activity); override;
|
||||||
method void setText(CharSequence AText); override;
|
method void setText(CharSequence AText); override;
|
||||||
|
|
||||||
[FrameLayout] ViewGroup
|
[FrameLayout] ViewGroup
|
||||||
|
|
||||||
[TimePicker] FrameLayout
|
[TimePicker] FrameLayout
|
||||||
constructor Create();
|
constructor Create(Activity);
|
||||||
method int getCurrentHour();
|
method int getCurrentHour();
|
||||||
method void setCurrentHour(int currentHour);
|
method void setCurrentHour(int currentHour);
|
||||||
method int getCurrentMinute;
|
method int getCurrentMinute;
|
||||||
@ -83,9 +83,10 @@ method boolean is24HourView;
|
|||||||
method void setIs24HourView(boolean AIs24HourView);
|
method void setIs24HourView(boolean AIs24HourView);
|
||||||
|
|
||||||
[ScrollView] FrameLayout
|
[ScrollView] FrameLayout
|
||||||
constructor Create();
|
constructor Create(Activity);
|
||||||
|
|
||||||
[CompoundButton] Button
|
[CompoundButton] Button
|
||||||
|
constructor Create(Activity)
|
||||||
method boolean isChecked()
|
method boolean isChecked()
|
||||||
method boolean performClick()
|
method boolean performClick()
|
||||||
method void setChecked(boolean checked)
|
method void setChecked(boolean checked)
|
||||||
@ -93,5 +94,5 @@ method void setChecked(boolean checked)
|
|||||||
method void toggle()
|
method void toggle()
|
||||||
|
|
||||||
[CheckBox] CompoundButton
|
[CheckBox] CompoundButton
|
||||||
constructor Create()
|
constructor Create(Activity)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user