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__ |
| dictionary | PM_FEATURES |
| 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 | CO_IMG_FIXEDPART_SIZE = 7 |
| 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_NUM_LOCALS = 8 |
| string | MODULE_IDENTIFIER = "?" |
| list | UNIMPLEMENTED_BCODES |
| string | IMG_LIST_TERMINATOR = "\xFF" |
| nativemods | |
| nativetable | |
| imgtarget | |
| General filter ensure values fit within S8 type size. | |
| nfcount | |
| imgDict | |
See the source docstring for more details.
| def pmImgCreator::co_to_str | ( | self, | ||
| co | ||||
| ) |
Convert 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.
| 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.
| 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.
| 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.
| def pmImgCreator::format_native_table | ( | self | ) |
format_native_table() --> string Format native table to a C file containing native functions and a function table.
| 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.
| def pmImgCreator::parse_cmdline | ( | ) |
Parses the command line for options.
| def pmImgCreator::write_image_file | ( | self | ) |
Writes an image file
| def pmImgCreator::write_native_file | ( | self | ) |
Writes native functions if filename was given
| string pmImgCreator::__usage__ |
Initial value:
"""USAGE: pmImgCreator.py [-b|c] [-s|u] [OPTIONS] -o imgfilename file0.py [files...] -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") """
| dictionary pmImgCreator::NATIVE_TABLE_NAME |
Initial value:
{"std": "std_nat_fxn_table",
"usr": "usr_nat_fxn_table"
}
| dictionary pmImgCreator::PM_FEATURES |
Initial value:
{
"HAVE_PRINT": True, # This flag currently has no effect in this file
"HAVE_GC": True, # This flag currently has no effect in this file
"HAVE_FLOAT": True,
"HAVE_DEL": True,
"HAVE_IMPORTS": True,
"HAVE_ASSERT": True,
"HAVE_DEFAULTARGS": True,
"HAVE_REPLICATION": True, # This flag currently has no effect in this file
"HAVE_CLASSES": True,
"HAVE_GENERATORS": True,
"HAVE_BACKTICK": True,
"HAVE_CLOSURES": True,
}
| 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",
]
1.5.9