mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-09 13:33:26 +00:00
Merge branch 'master' of https://github.com/dschmenk/PLASMA
This commit is contained in:
commit
cf2d90b4cb
@ -1,3 +1,4 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "tokens.h"
|
||||
@ -258,10 +259,10 @@ int fixup_new(int tag, int type, int size)
|
||||
#define INIT 16
|
||||
#define SYSFLAGS 32
|
||||
static int outflags = 0;
|
||||
static char *DB = ".BYTE";
|
||||
static char *DW = ".WORD";
|
||||
static char *DS = ".RES";
|
||||
static char LBL = ':';
|
||||
static const char *DB = ".BYTE";
|
||||
static const char *DW = ".WORD";
|
||||
static const char *DS = ".RES";
|
||||
static char LBL = (char) ':';
|
||||
char *supper(char *s)
|
||||
{
|
||||
static char su[80];
|
||||
@ -467,7 +468,7 @@ int emit_data(int vartype, int consttype, long constval, int constsize)
|
||||
else if (consttype & STRING_TYPE)
|
||||
{
|
||||
datasize = constsize;
|
||||
str = (char *)constval;
|
||||
str = (char *)(uintptr_t)constval;
|
||||
printf("\t%s\t$%02X\n", DB, --constsize);
|
||||
while (constsize-- > 0)
|
||||
{
|
||||
@ -518,7 +519,7 @@ int emit_data(int vartype, int consttype, long constval, int constsize)
|
||||
}
|
||||
return (datasize);
|
||||
}
|
||||
void emit_def(char *name, int is_bytecode)
|
||||
void emit_def(const char *name, int is_bytecode)
|
||||
{
|
||||
if (!(outflags & MODULE))
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ void emit_idlocal(char *name, int value);
|
||||
void emit_idglobal(int value, int size, char *name);
|
||||
void emit_idfunc(int tag, int type, char *name);
|
||||
void emit_idconst(char *name, int value);
|
||||
void emit_def(char *name, int is_bytecode);
|
||||
void emit_def(const char *name, int is_bytecode);
|
||||
int emit_data(int vartype, int consttype, long constval, int constsize);
|
||||
void emit_codetag(int tag);
|
||||
void emit_const(int cval);
|
||||
|
@ -8,6 +8,7 @@
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
@ -15,7 +16,7 @@
|
||||
#include "tokens.h"
|
||||
#include "symbols.h"
|
||||
|
||||
char *statement, *tokenstr, *scanpos = "";
|
||||
char *statement, *tokenstr, *scanpos = (char*) "";
|
||||
t_token scantoken, prevtoken;
|
||||
int tokenlen;
|
||||
long constval;
|
||||
@ -65,7 +66,7 @@ t_token keywords[] = {
|
||||
EOL_TOKEN
|
||||
};
|
||||
|
||||
void parse_error(char *errormsg)
|
||||
void parse_error(const char *errormsg)
|
||||
{
|
||||
char *error_carrot = statement;
|
||||
|
||||
@ -229,7 +230,7 @@ t_token scan(void)
|
||||
* String constant.
|
||||
*/
|
||||
scantoken = STRING_TOKEN;
|
||||
constval = (long)++scanpos;
|
||||
constval = (long)(uintptr_t)(++scanpos);
|
||||
while (*scanpos && *scanpos != '\"')
|
||||
{
|
||||
if (*scanpos == '\\')
|
||||
@ -418,7 +419,7 @@ int next_line(void)
|
||||
if (inputfile == NULL) {
|
||||
// First-time init
|
||||
inputfile = stdin;
|
||||
filename = "<stdin>";
|
||||
filename = (char*) "<stdin>";
|
||||
}
|
||||
if (*scanpos == ';')
|
||||
{
|
||||
@ -470,8 +471,8 @@ int next_line(void)
|
||||
outer_inputfile = inputfile;
|
||||
outer_filename = filename;
|
||||
outer_lineno = lineno;
|
||||
new_filename = malloc(tokenlen-1);
|
||||
strncpy(new_filename, (char*)constval, tokenlen-2);
|
||||
new_filename = (char*) malloc(tokenlen-1);
|
||||
strncpy(new_filename, (char*)(uintptr_t)constval, tokenlen-2);
|
||||
new_filename[tokenlen-2] = 0;
|
||||
inputfile = fopen(new_filename, "r");
|
||||
if (inputfile == NULL) {
|
||||
|
@ -3,7 +3,7 @@ extern t_token scantoken, prevtoken;
|
||||
extern int tokenlen;
|
||||
extern long constval;
|
||||
extern char inputline[];
|
||||
void parse_error(char *errormsg);
|
||||
void parse_error(const char *errormsg);
|
||||
int next_line(void);
|
||||
void scan_rewind(char *backptr);
|
||||
int scan_lookahead(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user