diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2020-12-04 15:20:28 -0500 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2020-12-04 15:20:28 -0500 |
commit | 96393257a43ac52f2b911594d106741245dec5f0 (patch) | |
tree | 6b9d11c50ed3cd1920444c4dd0ee4027814ef4bd /lexer/symbol.c | |
parent | 83ce1151ee1f06ae6b1c5c1018cc2489494e5ea4 (diff) |
- Started work on writing the new version of the
assembler.
- Did alot of stuff in the emulator.
- Did alot of stuff in the SuB Suite.
Diffstat (limited to 'lexer/symbol.c')
-rw-r--r-- | lexer/symbol.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/lexer/symbol.c b/lexer/symbol.c new file mode 100644 index 0000000..7a8001f --- /dev/null +++ b/lexer/symbol.c @@ -0,0 +1,42 @@ +/* Name: make_local_label() + * Desc: Constructs a local label of the form: + * " " + global_name + " " + local_name + * Args: + * global: Global label name. + * global_len: Length of Global label name. + * local: Local label name. + * local_len: Length of Local label name. + * Return value: Returns the constructed local label. + */ + +char make_local_label(char *global, int global_len, char *local, int local_len) { + char *name; + char *p; + + if (!global_len) { + /* Use last defined global. */ + global = last_global; + global_len = strlen(last_global); + } + name = malloc(local_len+global_len+3); + p = name; + *p++ = ' '; + if (global_len) { + memcpy(p, global, global_len); + p += global_len; + } + *p++ = ' '; + memcpy(p, local, local_len); + p[local_len] = '\0'; + return name; +} + +/* Name: + * Desc: + * Args: + * + * + * + * + * Return value: + */ |