Skip to content

Commit

Permalink
Merge pull request #83 from z88dk/sccz80_cleanup
Browse files Browse the repository at this point in the history
Sccz80 cleanup + Fix #81 - const support
  • Loading branch information
suborb committed Feb 25, 2017
2 parents 1a115a3 + a2bf656 commit b97e4c5
Show file tree
Hide file tree
Showing 37 changed files with 1,739 additions and 1,020 deletions.
80 changes: 40 additions & 40 deletions src/sccz80/Makefile
Expand Up @@ -42,71 +42,71 @@ clean :
$(RM) -rf Debug Release

# Dependencies (gcc -MM)
callfunc.o: callfunc.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \
callfunc.o: callfunc.c ccdefs.h define.h codegen.h \
const.h data.h declvar.h declfunc.h declinit.h error.h expr.h \
io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \
io.h lex.h main.h misc.h preproc.h primary.h stmt.h sym.h \
while.h
codegen.o: codegen.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \
codegen.o: codegen.c ccdefs.h define.h codegen.h \
const.h data.h declvar.h declfunc.h declinit.h error.h expr.h \
io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \
io.h lex.h main.h misc.h preproc.h primary.h stmt.h sym.h \
while.h
const.o: const.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \
const.o: const.c ccdefs.h define.h codegen.h const.h \
data.h declvar.h declfunc.h declinit.h error.h expr.h io.h \
lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
data.o: data.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \
lex.h main.h misc.h preproc.h primary.h stmt.h sym.h while.h
data.o: data.c ccdefs.h define.h codegen.h const.h \
data.h declvar.h declfunc.h declinit.h error.h expr.h io.h \
lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
declfunc.o: declfunc.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \
lex.h main.h misc.h preproc.h primary.h stmt.h sym.h while.h
declfunc.o: declfunc.c ccdefs.h define.h codegen.h \
const.h data.h declvar.h declfunc.h declinit.h error.h expr.h \
io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \
io.h lex.h main.h misc.h preproc.h primary.h stmt.h sym.h \
while.h
declinit.o: declinit.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \
declinit.o: declinit.c ccdefs.h define.h codegen.h \
const.h data.h declvar.h declfunc.h declinit.h error.h expr.h \
io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \
io.h lex.h main.h misc.h preproc.h primary.h stmt.h sym.h \
while.h
declvar.o: declvar.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \
declvar.o: declvar.c ccdefs.h define.h codegen.h \
const.h data.h declvar.h declfunc.h declinit.h error.h expr.h \
io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \
io.h lex.h main.h misc.h preproc.h primary.h stmt.h sym.h \
while.h
error.o: error.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \
error.o: error.c ccdefs.h define.h codegen.h const.h \
data.h declvar.h declfunc.h declinit.h error.h expr.h io.h \
lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
expr.o: expr.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \
lex.h main.h misc.h preproc.h primary.h stmt.h sym.h while.h
expr.o: expr.c ccdefs.h define.h codegen.h const.h \
data.h declvar.h declfunc.h declinit.h error.h expr.h io.h \
lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
goto.o: goto.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \
lex.h main.h misc.h preproc.h primary.h stmt.h sym.h while.h
goto.o: goto.c ccdefs.h define.h codegen.h const.h \
data.h declvar.h declfunc.h declinit.h error.h expr.h io.h \
lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
io.o: io.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h data.h \
lex.h main.h misc.h preproc.h primary.h stmt.h sym.h while.h
io.o: io.c ccdefs.h define.h codegen.h const.h data.h \
declvar.h declfunc.h declinit.h error.h expr.h io.h lex.h \
main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
lex.o: lex.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \
main.h misc.h preproc.h primary.h stmt.h sym.h while.h
lex.o: lex.c ccdefs.h define.h codegen.h const.h \
data.h declvar.h declfunc.h declinit.h error.h expr.h io.h \
lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
main.o: main.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \
lex.h main.h misc.h preproc.h primary.h stmt.h sym.h while.h
main.o: main.c ccdefs.h define.h codegen.h const.h \
data.h declvar.h declfunc.h declinit.h error.h expr.h io.h \
lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
misc.o: misc.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \
lex.h main.h misc.h preproc.h primary.h stmt.h sym.h while.h
misc.o: misc.c ccdefs.h define.h codegen.h const.h \
data.h declvar.h declfunc.h declinit.h error.h expr.h io.h \
lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
plunge.o: plunge.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \
lex.h main.h misc.h preproc.h primary.h stmt.h sym.h while.h
plunge.o: plunge.c ccdefs.h define.h codegen.h \
const.h data.h declvar.h declfunc.h declinit.h error.h expr.h \
io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \
io.h lex.h main.h misc.h preproc.h primary.h stmt.h sym.h \
while.h
preproc.o: preproc.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \
preproc.o: preproc.c ccdefs.h define.h codegen.h \
const.h data.h declvar.h declfunc.h declinit.h error.h expr.h \
io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \
io.h lex.h main.h misc.h preproc.h primary.h stmt.h sym.h \
while.h
primary.o: primary.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \
primary.o: primary.c ccdefs.h define.h codegen.h \
const.h data.h declvar.h declfunc.h declinit.h error.h expr.h \
io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \
io.h lex.h main.h misc.h preproc.h primary.h stmt.h sym.h \
while.h
stmt.o: stmt.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \
stmt.o: stmt.c ccdefs.h define.h codegen.h const.h \
data.h declvar.h declfunc.h declinit.h error.h expr.h io.h \
lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
sym.o: sym.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \
lex.h main.h misc.h preproc.h primary.h stmt.h sym.h while.h
sym.o: sym.c ccdefs.h define.h codegen.h const.h \
data.h declvar.h declfunc.h declinit.h error.h expr.h io.h \
lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
while.o: while.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \
lex.h main.h misc.h preproc.h primary.h stmt.h sym.h while.h
while.o: while.c ccdefs.h define.h codegen.h const.h \
data.h declvar.h declfunc.h declinit.h error.h expr.h io.h \
lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h
lex.h main.h misc.h preproc.h primary.h stmt.h sym.h while.h
17 changes: 9 additions & 8 deletions src/sccz80/callfunc.c
Expand Up @@ -14,6 +14,7 @@

static int SetWatch(char* sym, int* isscanf);
static int SetMiniFunc(unsigned char* arg, uint32_t* format_option_ptr);
static int ForceArgs(char dest, char src, int expr, char functab);

/*
* External variables used
Expand Down Expand Up @@ -90,7 +91,7 @@ void callfunction(SYMBOL* ptr)

/* Don't rewrite expressions whilst we are evaluating */
save_fps_num = buffer_fps_num;
save_fps = mymalloc(buffer_fps_num * sizeof(buffer_fps[0]));
save_fps = MALLOC(buffer_fps_num * sizeof(buffer_fps[0]));
memcpy(save_fps, buffer_fps, save_fps_num * sizeof(buffer_fps[0]));
buffer_fps_num = 0;
while ( tmpfiles[argnumber+1] ) {
Expand Down Expand Up @@ -163,7 +164,7 @@ void callfunction(SYMBOL* ptr)
}
memcpy(buffer_fps, save_fps, save_fps_num * sizeof(buffer_fps[0]));
buffer_fps_num = save_fps_num ;
free(save_fps);
FREENULL(save_fps);

if (ptr)
debug(DBG_ARG2, "arg %d proto %d", argnumber, ptr->args[1]);
Expand Down Expand Up @@ -202,7 +203,7 @@ void callfunction(SYMBOL* ptr)
printflevel = minifunc;
}
outname(ptr->name, dopref(ptr));
if ((ptr->flags & SHARED) && useshare)
if ((ptr->flags & SHARED) && c_useshared)
outstr("_sl");
else if (ptr->flags & SHAREDC)
outstr("_rst");
Expand All @@ -217,16 +218,16 @@ void callfunction(SYMBOL* ptr)
*
* We should modify stack if:
* - __CALLEE__ isn't set
* - Function is __LIB__ even if compactcode is set
* - compactcode isn't set and __CALLEE__ isn't set
* - Function is __LIB__ even if c_compact_code is set
* - c_compact_code isn't set and __CALLEE__ isn't set
*/

if ((ptr && ptr->flags & CALLEE) || (compactcode && ptr == NULL) || (compactcode && ((ptr->flags & LIBRARY) == 0))) {
if ((ptr && ptr->flags & CALLEE) || (c_compact_code && ptr == NULL) || (c_compact_code && ((ptr->flags & LIBRARY) == 0))) {
Zsp += nargs;
} else {
/* If we have a frame pointer then ix holds it */
#ifdef USEFRAME
if (useframe) {
if (c_useframepointer) {
if (nargs)
RestoreSP(preserve);
Zsp += nargs;
Expand Down Expand Up @@ -277,7 +278,7 @@ static int SetWatch(char* sym, int* type)
* djm routine to force arguments to switch type
*/

int ForceArgs(char dest, char src, int expr, char functab)
static int ForceArgs(char dest, char src, int expr, char functab)
{
char did, dtype, disfar, dissign;
char sid, stype, sisfar, sissign;
Expand Down
4 changes: 0 additions & 4 deletions src/sccz80/callfunc.h

This file was deleted.

24 changes: 17 additions & 7 deletions src/sccz80/ccdefs.h
Expand Up @@ -7,18 +7,15 @@
* $Id: ccdefs.h,v 1.5 2016-08-26 05:44:47 aralbrec Exp $
*/

/*
* System wide definitions
*/

#ifndef CCDEFS_H
#define CCDEFS_H

#include <sys/types.h>
//#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>

#include "define.h"
#include "lvalue.h"

/*
* Now the fix for HP-UX
Expand All @@ -45,7 +42,8 @@
* Prototypes
*/

#include "callfunc.h"
extern void callfunction(SYMBOL *ptr);

#include "codegen.h"
#include "const.h"
#include "data.h"
Expand All @@ -54,14 +52,26 @@
#include "declinit.h"
#include "error.h"
#include "expr.h"
extern GOTO_TAB *gotoq; /* Pointer for gotoq */
extern int dolabel(void);
extern void dogoto(void);
extern void goto_cleanup(void);
#include "io.h"
#include "lex.h"
#include "main.h"
#include "misc.h"
#include "plunge.h"

/* plunge.c */
extern int skim(char *opstr, void (*testfuncz)(LVALUE* lval, int label), void (*testfuncq)(int label), int dropval, int endval, int (*heir)(LVALUE* lval), LVALUE *lval);
extern void dropout(int k, void (*testfuncz)(LVALUE* lval, int label), void (*testfuncq)(int label), int exit1, LVALUE *lval);
extern int plnge1(int (*heir)(LVALUE* lval), LVALUE *lval);
extern void plnge2a(int (*heir)(LVALUE* lval), LVALUE *lval, LVALUE *lval2, void (*oper)(LVALUE *lval), void (*doper)(LVALUE *lval));
extern void plnge2b(int (*heir)(LVALUE* lval), LVALUE *lval, LVALUE *lval2, void (*oper)(LVALUE *lval));

#include "preproc.h"
#include "primary.h"
#include "stmt.h"
#include "sym.h"
#include "while.h"

#endif

0 comments on commit b97e4c5

Please sign in to comment.