|
META TOPICPARENT |
name="FRCVLabMLSA" |
|
|
< < | <meta name="robots" content="noindex" /> |
> > | <meta name="robots" content="noindex" /> |
| |
|
< < | Future Work |
> > | Future Work |
| |
|
< < | - Handling other ways of calling Python
|
> > | - Extension of the RDA analysis for more complex interoperability aPIs, including use of DATALOG for analysis |
| |
|
< < | PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *fp, const char *filename, int, PyCompilerFlags *);
- Also PyRun_AnyFile or PyRun_AnyFileEx or PyRun_AnyFileFlags
- if FP is associated with an interactive device, return PyRun_InteractiveLoop(); else return the result of PyRun_SimpleFile().
- IF filename is NULL, the function uses "???" as the filename
PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char * command, PyCompilerFlags *);
- also PyRun_SimpleString
- "command" is the python command(s) to be executed. The function will create a main function to add and run what is defined in "command"
- the string can be filtered to find default Python functions
- using a default name for this kind of python call to represent it in the graph (numbered default name to differ calls)
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *);
- also PyRun_InteractiveOne
- fp is an interactive device (console, terminal) and filename is the name of the file
- executes only ONE statement from "filename"
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *);
- Also PyRun_InteractiveLoop
- fp is an interactive device (console, terminal) and filename is the name of the file
- executes statements from "filename"
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *str, int start, PyObject *globals, PyObject *locals, PyCompilerFlags *);
- Also PyRun_String
- runs "str" in the context specified by "globals" and "locals"
- create a default function name for this kind of call, then use it as nodes in the graph
PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, PyObject *, PyObject *, int, PyCompilerFlags *);
- Also PyRun_File or PyRun_FileExFlags or PyRun_FileExFlags
- Python source code is read from fp, and filename is the name of the file.
|
> > | - More extensive testing and comparisons of the CGs generated with those for existing CG tools |
| |
|
< < | All these methods use a string as identifier to modules or commands. It should not be difficult to identify functions and analyze them. They are also similar to "PyRun_SimpleFile", which is already implemented . |
> > | - Handling other ways of calling Python |
| |
|
< < | Pure Embedding (most safe and complete way of calling python)
- see for the original code: https://docs.python.org/3/extending/embedding.html

- Process:
- pModule = PyImport_Import(PyObject *pName);
- pName comes from converting C string to Python Object using Python.h interface. It is the name of the module(file) to open.
- pFunc = PyObject_GetAttrString(PyObject *pModule, const char *func);
- func is the name of the function inside the module.
- pValue = PyObject_CallObject(PyObject *pFunc, PyObject *pArgs);
- pArgs is the list of arguments. pValue is the return value of the function. It must be converted to a C type
|
> > |
- PyAPI _FUNC(int) PyRun _AnyFileExFlags(FILE *fp, const char *filename, int, PyCompilerFlags *);
- Also PyRun _AnyFile or PyRun _AnyFileEx or PyRun _AnyFileFlags
- if FP is associated with an interactive device, return PyRun _InteractiveLoop(); else return the result of PyRun _SimpleFile().
- IF filename is NULL, the function uses "???" as the filename
- PyAPI _FUNC(int) PyRun _SimpleStringFlags(const char * command, PyCompilerFlags *);
- also PyRun _SimpleString
- "command" is the python command(s) to be executed. The function will create a main function to add and run what is defined in "command"
- the string can be filtered to find default Python functions
- using a default name for this kind of python call to represent it in the graph (numbered default name to differ calls)
- PyAPI _FUNC(int) PyRun _InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *);
- also PyRun _InteractiveOne
- fp is an interactive device (console, terminal) and filename is the name of the file
- executes only ONE statement from "filename"
- PyAPI _FUNC(int) PyRun _InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *);
- Also PyRun _InteractiveLoop
- fp is an interactive device (console, terminal) and filename is the name of the file
- executes statements from "filename"
- PyAPI _FUNC(PyObject *) PyRun _StringFlags(const char *str, int start, PyObject *globals, PyObject *locals, PyCompilerFlags *);
- Also PyRun _String
- runs "str" in the context specified by "globals" and "locals"
- create a default function name for this kind of call, then use it as nodes in the graph
- PyAPI _FUNC(PyObject *) PyRun _FileExFlags(FILE *, const char *, int, PyObject *, PyObject *, int, PyCompilerFlags *);
- Also PyRun _File or PyRun _FileExFlags or PyRun _FileExFlags
- Python source code is read from fp, and filename is the name of the file.
|
| |
|
< < |
|
> > | All these methods use a string as identifier to modules or commands. It should not be difficult to identify functions and analyze them. They are also similar to "PyRun_SimpleFile", which is already implemented . |
| |
|
> > |
- Pure Embedding (most safe and complete way of calling python)
- pFunc = PyObject _GetAttrString(PyObject *pModule, const char *func);
- func is the name of the function inside the module.
- pValue = PyObject _CallObject(PyObject *pFunc, PyObject *pArgs);
- pArgs is the list of arguments. pValue is the return value of the function. It must be converted to a C type
|
|
The problem with this approach is that there are multiple conversions and attributions before getting the reference to the function. A Reaching Definition Analysis is necessary to find the intermediate values. |
|
The problem with this approach is that there are multiple conversions and attributions before getting the reference to the function. A Reaching Definition Analysis is necessary to find the intermediate values. |
|
< < | |
| There is a pattern for the steps to be performed, and it also gives more information about the function and the module. So it will make it easier to resolve scoping issues. |
|
< < | |
| Permissions
- Persons/group who can view/change the page:
|
|
-- (c) Fordham University Robotics and Computer Vision |
|
> > |
META FILEATTACHMENT |
attachment="MLSA_logo.png" attr="" comment="" date="1499887779" name="MLSA_logo.png" path="MLSA_logo.png" size="39428" user="AnneMarieBogar" version="1" |
|