fix: windows build, added visual studio project files
This commit is contained in:
@@ -16,8 +16,13 @@ void api_put() {
|
||||
if (mode != 1 && mode != 2) return;
|
||||
|
||||
int f = fstream;
|
||||
#ifdef _WIN32
|
||||
if (f == _fileno(stderr))
|
||||
f = _fileno(stdout);
|
||||
#else
|
||||
if (f == fileno(stderr))
|
||||
f = fileno(stdout);
|
||||
f = fileno(stdout);
|
||||
#endif
|
||||
|
||||
if (mode == 1) {
|
||||
char c = state->STACK[state->STACK_IDX--];
|
||||
|
||||
@@ -24,7 +24,11 @@ int read_script(const char *filename, char ***buf, size_t *lines) {
|
||||
if (line[length - 1] == '\n') {
|
||||
line[length - 1] = '\0';
|
||||
}
|
||||
char *line_copy = strdup(line);
|
||||
#ifdef _WIN32
|
||||
char *line_copy = _strdup(line);
|
||||
#else
|
||||
char *line_copy = strdup(line);
|
||||
#endif
|
||||
char **temp = realloc(*buf, (line_count + 1) * sizeof(char*));
|
||||
if (temp == NULL) {
|
||||
dprintf(fstream, "Error allocating memory.\n");
|
||||
|
||||
@@ -196,7 +196,7 @@ void _sqrt() {
|
||||
return;
|
||||
}
|
||||
|
||||
*get_reg(state->args->arg1) = sqrt(get_value(state->args->arg1));
|
||||
*get_reg(state->args->arg1) = (int)sqrt(get_value(state->args->arg1));
|
||||
}
|
||||
|
||||
void neg() {
|
||||
|
||||
@@ -85,7 +85,11 @@ LABEL_ERR add_label(char *label, int line) {
|
||||
if (strcmp(label, state->labels[i]) == 0)
|
||||
return LABEL_ALREADY_EXISTS;
|
||||
|
||||
#ifdef _WIN32
|
||||
char *line_copy = _strdup(label);
|
||||
#else
|
||||
char *line_copy = strdup(label);
|
||||
#endif
|
||||
if (line_copy == NULL) {
|
||||
dprintf(fstream, "Error allocating memory.\n");
|
||||
return LABEL_ERROR;
|
||||
@@ -125,7 +129,11 @@ int parse_arguments(char *line) {
|
||||
strcpy(state->args->arg1, "");
|
||||
strcpy(state->args->arg2, "");
|
||||
|
||||
#ifdef _WIN32
|
||||
char *line_cpy = _strdup(line);
|
||||
#else
|
||||
char *line_cpy = strdup(line);
|
||||
#endif
|
||||
char *ptr = strstr(line_cpy, " ");
|
||||
char *arg = 0;
|
||||
if (!ptr) {
|
||||
|
||||
@@ -90,7 +90,11 @@ int pasm_run_script(const char *filename, char **file, size_t lines, int _fstrea
|
||||
for (state->curr_line = 0; state->curr_line < (int)lines && get_exit_state() == 0 ; ++state->curr_line) {
|
||||
if (pasm_debug_mode && found_main)
|
||||
debug_input(file[state->curr_line]);
|
||||
#ifdef _WIN32
|
||||
char* line = _strdup(file[state->curr_line]);
|
||||
#else
|
||||
char *line = strdup(file[state->curr_line]);
|
||||
#endif
|
||||
if (line[0] == ';' || line[0] == '\0') {
|
||||
free(line);
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user