Classes | |
class | PmImgCreator |
Functions | |
def | convert_files |
def | co_to_str |
def | no_to_str |
def | write_image_file |
def | write_native_file |
def | format_img_as_bin |
def | format_img_as_c |
def | format_native_table |
def | parse_cmdline |
def | main |
Variables | |
string | __usage__ |
int | EX_USAGE = 64 |
REMOVE_DOC_STR = False | |
int | OBJ_TYPE_NON = 0x00 |
int | OBJ_TYPE_INT = 0x01 |
int | OBJ_TYPE_FLT = 0x02 |
int | OBJ_TYPE_STR = 0x03 |
int | OBJ_TYPE_TUP = 0x04 |
int | OBJ_TYPE_COB = 0x05 |
int | OBJ_TYPE_MOD = 0x06 |
int | OBJ_TYPE_CLO = 0x07 |
int | OBJ_TYPE_FXN = 0x08 |
int | OBJ_TYPE_CLI = 0x09 |
int | OBJ_TYPE_CIM = 0x0A |
int | OBJ_TYPE_NIM = 0x0B |
int | OBJ_TYPE_NOB = 0x0C |
int | NATIVE_IMG_SIZE = 4 |
int | MAX_TUPLE_LEN = 253 |
int | MAX_STRING_LEN = 999 |
int | MAX_IMG_LEN = 32767 |
int | CO_OPTIMIZED = 0x0001 |
int | CO_NEWLOCALS = 0x0002 |
int | CO_VARARGS = 0x0004 |
int | CO_VARKEYWORDS = 0x0008 |
int | CO_NESTED = 0x0010 |
int | CO_GENERATOR = 0x0020 |
int | CO_NOFREE = 0x0040 |
string | NATIVE_INDICATOR = "__NATIVE__" |
tuple | NATIVE_INDICATOR_LENGTH = len(NATIVE_INDICATOR) |
dictionary | NATIVE_TABLE_NAME |
string | NATIVE_FUNC_PREFIX = "nat_" |
int | NATIVE_MAX_NUM_LOCALS = 8 |
string | MODULE_IDENTIFIER = "?" |
string | IMG_LIST_TERMINATOR = "\xFF" |
int | CO_IMG_FIXEDPART_SIZE = 7 |
list | UNIMPLEMENTED_BCODES |
nativemods | |
nativetable | |
imgtarget | |
General filter ensure values fit within U8 type size. | |
nfcount | |
imgDict |
See the source docstring for more details.
def pmImgCreator::co_to_str | ( | self, | ||
co | ||||
) |
Converts a Python code object to a PyMite image. The code image is relocatable and goes in the device's memory. Return string shows type in the leading byte.
Definition at line 435 of file pmImgCreator.py.
def pmImgCreator::convert_files | ( | self | ) |
Attempts to convert all source files. Creates a dict whose keys are the filenames and values are the code object string.
Definition at line 289 of file pmImgCreator.py.
def pmImgCreator::format_img_as_bin | ( | self | ) |
format_img_as_bin() --> string Write image bytes to raw binary string. The resulting string is suitable to write to a file.
Definition at line 743 of file pmImgCreator.py.
def pmImgCreator::format_img_as_c | ( | self | ) |
format_img_as_c() --> string Format image bytes to a string that is a C byte array. The C byte array can be located in RAM or program memory. The byte array is named lib_img.
Definition at line 754 of file pmImgCreator.py.
def pmImgCreator::format_native_table | ( | self | ) |
format_native_table() --> string Format native table to a C file containing native functions and a function table.
Definition at line 831 of file pmImgCreator.py.
def pmImgCreator::no_to_str | ( | self, | ||
co | ||||
) |
Convert a native code object to a PyMite image. The native image is relocatable and goes in the device's memory. Return string shows type in the leading byte.
Definition at line 520 of file pmImgCreator.py.
def pmImgCreator::parse_cmdline | ( | ) |
def pmImgCreator::write_image_file | ( | self | ) |
def pmImgCreator::write_native_file | ( | self | ) |
string pmImgCreator::__usage__ |
Initial value:
"""USAGE: pmImgCreator.py -f pmfeaturesfilename [-b|c] [-s|u] [OPTIONS] -o imgfilename file0.py [files...] -f <fn> Specify the file containing the PM_FEATURES dict to use -b Generates a raw binary file of the image -c Generates a C file of the image (default) -s Place native functions in the PyMite standard library (default) -u Place native functions in the user library OPTIONS: --native-file=filename If specified, pmImgCreator will write a C source file with native functions from the python files. --memspace=ram|flash Sets the memory space in which the image will be placed (default is "ram") """
Definition at line 46 of file pmImgCreator.py.
General filter ensure values fit within U8 type size.
Bcode filter bcode string Native code filter if this CO is intended to be a native func.
Definition at line 302 of file pmImgCreator.py.
dictionary pmImgCreator::NATIVE_TABLE_NAME |
Initial value:
{"std": "std_nat_fxn_table", "usr": "usr_nat_fxn_table" }
Definition at line 120 of file pmImgCreator.py.
list pmImgCreator::UNIMPLEMENTED_BCODES |
Initial value:
[ "SLICE+1", "SLICE+2", "SLICE+3", "STORE_SLICE+0", "STORE_SLICE+1", "STORE_SLICE+2", "STORE_SLICE+3", "DELETE_SLICE+0", "DELETE_SLICE+1", "DELETE_SLICE+2", "DELETE_SLICE+3", "PRINT_ITEM_TO", "PRINT_NEWLINE_TO", "WITH_CLEANUP", "EXEC_STMT", "END_FINALLY", "SETUP_EXCEPT", "SETUP_FINALLY", "BUILD_SLICE", "CALL_FUNCTION_VAR", "CALL_FUNCTION_KW", "CALL_FUNCTION_VAR_KW", "EXTENDED_ARG", ]
Definition at line 149 of file pmImgCreator.py.