|
@@ -29,28 +29,49 @@ typedef struct asmsh_s asmsh_t;
|
29
|
29
|
|
30
|
30
|
struct asmsh_s
|
31
|
31
|
{
|
|
32
|
+ ///! Compilation context
|
32
|
33
|
asmsh_asmc_ctx_t *cctx;
|
|
34
|
+ ///! Child process environment
|
33
|
35
|
asmsh_env_t *env;
|
34
|
36
|
|
|
37
|
+ /** Stores the child process exec path
|
|
38
|
+ * @warning Can be NULL if a temporary file is used
|
|
39
|
+ * @deprecated
|
|
40
|
+ */
|
35
|
41
|
char *child_path;
|
|
42
|
+ /** May store the last executed instruction ? not sure if used or not */
|
36
|
43
|
char *last_instr;
|
|
44
|
+ /** Last executed bytecode ? */
|
37
|
45
|
asmsh_bytecode_t last_bcode;
|
38
|
46
|
|
39
|
47
|
};
|
40
|
48
|
|
|
49
|
+/** Initialize a shell environment
|
|
50
|
+ * @param asmsh_t* Pointer on the shell environment
|
|
51
|
+ * @param const char* The child process executable path (NULL is recommended
|
|
52
|
+ * in order to use the embed executable)
|
|
53
|
+ * @return 0 if no error else -1 and set errno
|
|
54
|
+ */
|
41
|
55
|
int asmsh_init(asmsh_t *sh, const char *child_path);
|
|
56
|
+
|
|
57
|
+/** Free all ressources holded by a shell environment
|
|
58
|
+ * @param asmsh_t* Pointer on the shell environment
|
|
59
|
+ */
|
42
|
60
|
void asmsh_cleanup(asmsh_t *sh);
|
43
|
61
|
|
44
|
|
-/** @return <0 on error 0 on ok 1 on exit */
|
|
62
|
+/**
|
|
63
|
+ * @return <0 on error 0 on ok 1 on exit */
|
45
|
64
|
int asmsh_exec(asmsh_t *sh, const char *cmd);
|
46
|
65
|
|
47
|
|
-/** Parse all symbols found in given command
|
|
66
|
+/** Replace all labels found in given command by their relative offset
|
48
|
67
|
* @param asmsh_t* The shell
|
49
|
68
|
* @param char The prefix character before a symbol name
|
50
|
69
|
* @param const char* The string we want to parse
|
51
|
70
|
* @param char* A pointer on a buffer large enough to store the parsed string
|
52
|
71
|
* @param size_t The buffer size
|
53
|
72
|
* @return 0 on error else return the needed buffer size
|
|
73
|
+ * @todo move in asm_env.*
|
|
74
|
+ * @todo Enhance !!! Add support for relative or absolute address replacement
|
54
|
75
|
*/
|
55
|
76
|
size_t asmsh_parse_labels(asmsh_t *sh, char preffix, const char *cmd,
|
56
|
77
|
char *buf, size_t buf_sz);
|