Skip to content

Commit

Permalink
more on unicode support. Simplify syshs and sysid code, dropping geth…
Browse files Browse the repository at this point in the history
…ost.c as part of that.
  • Loading branch information
daveshields committed Feb 14, 2013
1 parent 1b7fb84 commit 74db883
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 176 deletions.
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ SYSOBJS=sysax.o sysbs.o sysbx.o syscm.o sysdt.o sysea.o \

# Other C objects:
COBJS = break.o checkfpu.o compress.o cpys2sc.o \
doset.o dosys.o fakexit.o float.o flush.o gethost.o getshell.o \
doset.o dosys.o fakexit.o float.o flush.o getshell.o \
int.o lenfnm.o math.o optfile.o osclose.o \
osopen.o ospipe.o osread.o oswait.o oswrite.o prompt.o rdenv.o \
st2d.o stubs.o swcinp.o swcoup.o syslinux.o testty.o\
Expand Down
93 changes: 0 additions & 93 deletions osint/gethost.c

This file was deleted.

4 changes: 0 additions & 4 deletions osint/osint.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ STMCS,
STMCT,
TICBLK,
TSCBLK,
ID1,
ID2BLK,
INPBUF,
TTYBUF,
END_MIN_DATA;
Expand All @@ -199,8 +197,6 @@ extern void S_YYY();


// Some shorthand notations
#define pID1 GET_DATA_OFFSET(ID1,struct scblk *)
#define pID2BLK GET_DATA_OFFSET(ID2BLK,struct scblk *)
#define pINPBUF GET_DATA_OFFSET(INPBUF,struct bfblk *)
#define pTTYBUF GET_DATA_OFFSET(TTYBUF,struct bfblk *)
#define pTICBLK GET_DATA_OFFSET(TICBLK,struct icblk *)
Expand Down
9 changes: 0 additions & 9 deletions osint/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,19 +307,10 @@ typedef long IATYPE;
/ in structure 'tscblk'. 'tscblk' is defined in
/ file inter.s.
/
/ ID2BLK_LENGTH the maximum length of a string that can be stored
/ in structure 'id2blk'. 'id2blk' is defined in
/ inter.c. ID2BLK_LENGTH should be long enough
/ to hold the computer name type string (htype)
/ plus the date/time and a few blanks (typically
/ 20 characters). It should also be a multiple of
/ the word size.
/
*/
#ifndef TSCBLK_LENGTH
#define TSCBLK_LENGTH 512
#endif
#define ID2BLK_LENGTH 52

/*
/ The following manifest constants determine the default environment
Expand Down
1 change: 0 additions & 1 deletion osint/save.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ struct svfilehdr {
short int spare; // spare cells to dword boundary
char serial[8]; // compiler serial number
char headv[8]; // version string
char iov[12]; // i/o version string
unsigned long timedate; // date and time of creation
long flags; // spitflag word
uword stacksiz; // total size of stack area
Expand Down
2 changes: 0 additions & 2 deletions osint/sproto.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ extern word * get_fp ( void );
extern char ** getargs (int argc, char *argv[]);
extern double get_ra ( void );
extern FILEPOS geteof ( struct ioblk *ioptr );
extern void gethost ( struct scblk *scptr, word maxlen );
extern int getint ( struct icblk *icp, IATYPE *pword );
extern char *getnum ( char *cp, uword *ip );
extern File_handle getprfd ( void );
Expand All @@ -88,7 +87,6 @@ extern struct ioblk * getrdiob ( void );
extern int getsave (File_handle fd);
extern char * getshell ( void );
extern char * getstring ( struct scblk *scp, char *cp );
extern void gettype ( struct scblk *scptr, word maxlen );
extern char * heapAlloc ( void *minAdr, word size );
extern void heapmove ( void );
extern int host386 ( int hostno );
Expand Down
44 changes: 19 additions & 25 deletions osint/sysdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ This file is part of Macro SPITBOL.
#include <stdio.h>
#include <time.h>

static int datecvt ( char *cp, int type );
static int timeconv ( char *tp, struct tm *tm );
static char * getdate (int type );
static void timeconv ( char *tp, struct tm *tm );

// conv() rewritten to avoid dependence on library remainder routine
void conv (dest, value)
Expand All @@ -65,39 +65,29 @@ zysdt()
char dt[20];

uc_init(0);
datecvt(dt, dtscb->val);
uc_strcpy(0,dt);
uc_strcat(0, getdate(dtscb->val));
uc_decode(0);
SET_XL(uc_scblk(0));
return NORMAL_RETURN;
}

/*
* Write date/time in SPITBOL form to a string
* Return date/time in several different forms to a string
*/
int storedate( cp, maxlen )
char *cp;
word maxlen;
{
if (maxlen < 18)
return 0;

return datecvt(cp, 0);
}

/*
* Write date/time in several different forms to a string
*/
int datecvt( cp, type )
char *cp;
char * getdate(type )
int type;
{


char *cp;
time_t tod;

register struct tm *tm;
tm = localtime( &tod );

uc_init(2);
cp = uc_str(2);

switch (type)
{
default:
Expand All @@ -107,7 +97,8 @@ int type;
conv( cp+3, tm->tm_mday );
cp[5] = '/';
conv( cp+6, tm->tm_year % 100 ); // Prepare for year 2000!
return 8 + timeconv(&cp[8], tm);
timeconv(&cp[8], tm);
break;

case 1: // "MM/DD/YYYY hh:mm:ss"
conv( cp, tm->tm_mon+1 );
Expand All @@ -116,7 +107,8 @@ int type;
cp[5] = '/';
conv( cp+6, (tm->tm_year + 1900) / 100 );
conv( cp+8, tm->tm_year % 100 ); // Prepare for year 2000!
return 10 + timeconv(&cp[10], tm);
timeconv(&cp[10], tm);
break;

case 2: // "YYYY-MM-DD/YYYY hh:mm:ss"
conv( cp+0, (tm->tm_year + 1900) / 100 );
Expand All @@ -125,11 +117,13 @@ int type;
conv( cp+5, tm->tm_mon+1 );
cp[7] = '-';
conv( cp+8, tm->tm_mday );
return 10 + timeconv(&cp[10], tm);
timeconv(&cp[10], tm);
break;
}
return uc_str(2);
}

static int timeconv( tp, tm)
static void timeconv( tp, tm)
char *tp;
struct tm *tm;
{
Expand All @@ -140,6 +134,6 @@ struct tm *tm;
tp[6] = ':';
conv( tp+7, tm->tm_sec );
*(tp+9) = '\0';
return 9;
return;
}

8 changes: 4 additions & 4 deletions osint/syshs.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ zyshs()
scp = WA (struct scblk *);
if (scp->typ == TYPE_SCL && !scp->len)
{
gethost( pTSCBLK, TSCBLK_LENGTH );
if ( pTSCBLK->len == 0 )
return EXIT_4;
SET_XL( pTSCBLK );
uc_init(0);
uc_strcpy(0,HOST_STRING);
uc_decode(0);
SET_XL(uc_scblk(0));
return EXIT_3;
}

Expand Down
15 changes: 8 additions & 7 deletions osint/sysid.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ zysid()
{
register char *cp;

SET_XR( pID1 );
gettype( pID2BLK, ID2BLK_LENGTH );
cp = pID2BLK->str + pID2BLK->len;
*cp++ = ' ';
*cp++ = ' ';
pID2BLK->len += 2 + storedate(cp, ID2BLK_LENGTH - pID2BLK->len);
SET_XL( pID2BLK );
uc_init(1);
SET_XR(uc_scblk(1));
uc_init(0);
uc_strcpy(0,HOST_STRING);
uc_strcat(0," ");
uc_strcat(0,getdate(0));
uc_decode(0);
SET_XL(uc_scblk(0));
return NORMAL_RETURN;
}
1 change: 1 addition & 0 deletions osint/systype.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ This file is part of Macro SPITBOL.
#define EXECFILE 0
#define FLTHDWR 0 // Change to 1 when do floating ops inline
#define GCCi32 1
#define HOST_STRING "x32:Linux:Macro SPITBOL 13.01"
2 changes: 0 additions & 2 deletions osint/sysxi.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ word *stkbase, stklen;
svfheader.system = SYSVERSION;
svfheader.spare = 0;
hcopy(vscb->str, svfheader.headv, vscb->len, sizeof(svfheader.headv));
hcopy(pID1->str, svfheader.iov, pID1->len, sizeof(svfheader.iov));
svfheader.timedate = time((time_t *)0);
svfheader.flags = spitflag;
svfheader.stacksiz = (uword)stacksiz;
Expand Down Expand Up @@ -653,7 +652,6 @@ int fd;
write( STDERRFD, ((svfheader.version>>VWBSHFT) & 0xF)==2 ? "32" : "64", 2);
write( STDERRFD, "-bit SPITBOL release ", 21);
write( STDERRFD, svfheader.headv, length(svfheader.headv) );
write( STDERRFD, svfheader.iov, length(svfheader.iov) );
cp = " to load file ";
goto reload_err;
reload_ioerr:
Expand Down
14 changes: 0 additions & 14 deletions x32.s
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,6 @@ minimal_id: D_WORD 0 ; id for call to minimal from C. See proc minimal below.
; Setup a number of internal addresses in the compiler that cannot
; be directly accessed from within C because of naming difficulties.

global ID1
ID1: dd 0
%if SETREAL == 1
D_WORD 2

D_WORD 1
db "1x\x00\x00\x00"
%endif

global ID2BLK
ID2BLK D_WORD 52
D_WORD 0
times 52 db 0

global TICBLK
TICBLK: D_WORD 0
D_WORD 0
Expand Down
14 changes: 0 additions & 14 deletions x64.s
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,6 @@ minimal_id: D_WORD 0 ; id for call to minimal from C. See proc minimal below.
; Setup a number of internal addresses in the compiler that cannot
; be directly accessed from within C because of naming difficulties.

global ID1
ID1: dd 0
%if SETREAL == 1
D_WORD 2

D_WORD 1
db "1x\x00\x00\x00"
%endif

global ID2BLK
ID2BLK D_WORD 52
D_WORD 0
times 52 db 0

global TICBLK
TICBLK: D_WORD 0
D_WORD 0
Expand Down

0 comments on commit 74db883

Please sign in to comment.