perm filename LIBRA.FAI[HAK,ROB] blob sn#434341 filedate 1979-04-15 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00003 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	.ENTRY PutStr
C00003 00003	.ENTRY DATSTR
C00006 ENDMK
C⊗;
.ENTRY PutStr
;PUTSTR(source,dest)
;
; copies the ASCIZ string specified bt source to dest.
.ENTRY DATSTR
; str ← DATSTR(sysdat,format,↑string)
;
; This routine will take a date in system date format, and generate an
; ASCIZ string in the specified buffer.  Two formats are available,
; either:
;       Fri, 13-Apr-79  (or)    13-Apr-79.
; Both formats are of constant length (the former is always 14 characters
; long, the latter always 9 characters long).
;
; INPUTS:
;       -4(SP)  date (in system date format).  If -1, today's date is returned.
;       -3(SP)  if 0, format is "DAY, DD-MMM-YY", else "DD-MMM-YY"
;       -2(SP)  byte pointer to buffer to receive string (must be ≥ ?? words long)
;	-1(SP)  return address
;
; OUTPUTS:
;       AC1     byte pointer, pointing into specified buffer
;
Days:	ASCIZ	/Wed, /
	ASCIZ	/Thu, /
	ASCIZ	/Fri, /
	ASCIZ	/Sat, /
	ASCIZ	/Sun, /
	ASCIZ	/Mon, /
	ASCIZ	/Tue, /

DATSTR:                         ; Generate an ASCIZ string of the date
	PUSH	P,AC1
	PUSH	P,AC2
	PUSH	P,AC3
	CAMN	AC1,[-1]
	DATE	AC1,
	; AC1 now has the system date of interest
	JUMPE	AC2,NoDay
	MOVE	AC2,AC1
	DAYCNT	AC2,
	IDIVI	AC2,=7		; dummy - you just clobbered 
	MOVE	AC1,Days(AC2)
	PUSHJ	P,PutStr
	DATE	AC1,
NoDay:	IDIVI	AC1,=31
	AOS	AC2
	PUSHJ	P,DecStr	; output the date
	IDIVI	AC1,=12
	AOS	AC2
	MOVE	AC2,Months(AC2)
	PUSHJ	P,PutStr
;⊂     SETFORMAT(4,0);
;⊂     DateString ← DateString & CVS(sysdate DIV (31*12) + 1964);
	MOVE	AC2,AC1
	ADDI	AC2,=64		; number of years since (19)64
	PUSHJ	P,DecOut
;⊂     SETFORMAT(Wid,Dig);
;⊂     
;⊂     RETURN(DateString);
;⊂ 
;⊂     END "GenerateDateString";
;⊂ 
;⊂   END "DATESTR";