【中文版】

Introduction

MFP language introduction

MFP functions

deploy user functions

call MFP in your app

build Android APK

game programming

chart plotting

MFP math analysis

MFP file procession

number string and array

time date and system

Introduction of SCP

Scientific Calculator Plus Help : Create user's apk

The underlying math engine of Scientific Calculator Plus is MFP programming language. User is able to develop his or her own MFP functions and build it into an Android APK installation package, then install the APK file in Android devices, share it with friends or publish it in Android app distributing websites like google play.

Three steps are required to build an APK package. In the first step, user inputs application name, app package id and version. Note that app package id should be 20 characters long and unique. Otherwise, the app cannot be published. User can also select an icon and type help information for the app. If user selects to use default help information, MFP function help will be shown in the app's help page.

Step 2 is to set up function name and parameters to input. Note that the parameters here may not be exactly the same with function parameters. Parameters here are the input that the APK final user should type in. APK creator can set some default values for some of the function parameters so that save APK final user's input.

Please note that when creating an APK package, Scientific Calculator Plus does not copy all user defined .mfps files. Instead, it extracts related .mfps files which includes all referred functions and classes. In some situations, e.g. calling integrate or plot_exprs function, parameter is a string or string based variable so that Scientific Calculator Plus is not able to identify which function will be called in the run at compiling time. Also, if function parameter is an object, its class type is usually unknown before running. User, therefore, needs to add an annotation, @complusory_link, before the calling statement explicitly telling Scientific Calculator Plus what functions and classes should be linked into package. For instance

...

@compulsory_link get_functions("::abc::myf_expr1", "myf_expr2(2)")

integrated_result = integrate(expression_str, variable_str)

@compulsory_link get_classes("::def::hij::my_class1", "::my_class2", "my_class3")

...

In this example, ::abc::myf_expr1 and myf_expr2 are user-defined functions which may be called by function integrate to be integrated. All the functions with name ::abc::myf_expr1 will be compiled into APK package, no matter how many parameters they have. However, only function whose name is myf_expr2 and who is located in a used citingspace and who has exactly 2 parameters or has optional parameter(s) are compiled into APK package.

Similiarly, get_classes links user defined classes ::def::hij::my_class1, ::my_class2 and my_class3. Note that my_class3 doesn't include a full citingspace. compulsory_link statement therefore will search citingspace stack and link in the first matched class (if there is).

If user wants to include all user defined functions and classes, please use annotation statement

@compulsory_link get_all_referred_units()

. Scientific Calculator Plus will link-in all the functions and classes defined by user. But this takes much longer time and the compilation process may throw an error if a class or function is referred but not defined.

Note that get_functions, get_classes and get_all_referred_units are actually MFP functions. However, they are placed under the mfp_compiler citingspace and are only used when packaging APK files.

Also note that the @compulsory_link annotation should be located inside the body of the called function. If it is above function statement or below endf statement, it will not take any effect.

The final step is to set APK file name and determine how to sign the apk. If user selects test key, the generated APK file can be installed but cannot be published. User can use an existing public key or create his or her own key. All the created keys are stored in AnMath\signkeys folder.

After the above 3 steps finish, a dialog will be shown and ask user to install or share the app or simply exit. If user selects exit, he or she can still access the generated APK file stored in AnMath\apks folder later on.