A2osX/BIN/CC.S.TYPE.txt
2022-01-30 22:47:08 +01:00

188 lines
3.1 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
CC.TYPE.Decl >ENTER 2
lda #0
sta (pStack) Type
ldy #1
sta (pStack),y Qual
jsr .7
bcs .99
ldy #1
lda (pStack),y
pha
lda (pStack)
tay Y = Type
pla A = Qual
clc
.99 >LEAVE
rts
.7 jmp (J.CC.TYPEQUAL,x)
*--------------------------------------
* Type Declaration keywords
*--------------------------------------
CC.TYPE.CONST lda #SYM.Q.CONST
bra CC.TYPE.VOLATILE.1
*--------------------------------------
CC.TYPE.VOLATILE
lda #SYM.Q.VOLATILE
CC.TYPE.VOLATILE.1
ldy #1
ora (pStack),y
sta (pStack),y
jsr CC.CheckSpace
bcs .9
>LDYA L.CC.TYPESPEC
jsr CC.LookupID
bcs .9
jmp (J.CC.TYPESPEC,x)
.9 lda #E.CSYN
sec
rts
*--------------------------------------
CC.TYPE.SIGNED sec
.HS 90 BCC
*--------------------------------------
CC.TYPE.UNSIGNED
clc
php
jsr CC.CheckSpace
bcs .9
>LDYA L.CC.TYPES
jsr CC.LookupID
bcs .9
cpx #SYM.T.UCHAR
bcc .9 void
cpx #SYM.T.SLONG+1 only char int long allowed
bcs .9
plp
bcs .8
jmp (J.CC.UTYPES-2,x)
.8 jmp (J.CC.STYPES-2,x)
.9 plp
lda #E.CSYN
sec
rts
*--------------------------------------
CC.TYPE.SHORT jsr CC.CheckSpace
bcs .9
>LDYA L.CC.TYPES
jsr CC.LookupID
bcs CC.TYPE.UCHAR
cpx #4 only int allowed
beq CC.TYPE.SCHAR
.9 lda #E.CSYN
sec
rts
*--------------------------------------
CC.TYPE.VOID lda #SYM.T.VOID
bra CC.TYPE
CC.TYPE.CHAR
CC.TYPE.UCHAR lda #SYM.T.UCHAR
bra CC.TYPE
CC.TYPE.SCHAR lda #SYM.T.SCHAR
bra CC.TYPE
CC.TYPE.UINT lda #SYM.T.UINT
bra CC.TYPE
CC.TYPE.INT
CC.TYPE.SINT lda #SYM.T.SINT
bra CC.TYPE
CC.TYPE.ULONG lda #SYM.T.ULONG
bra CC.TYPE
CC.TYPE.LONG
CC.TYPE.SLONG lda #SYM.T.SLONG
bra CC.TYPE
CC.TYPE.FLOAT lda #SYM.T.FLOAT
CC.TYPE sta (pStack) T
jsr CC.GetCharNB
bcs .9
.1 cmp #'*'
bne .10
ldy #1 Q
lda (pStack),y
clc
adc #SYM.Q.POINTER
bcs .9 more than ***
sta (pStack),y
jsr CC.GetNextCharNB
bcc .1
.9 lda #E.CSYN
sec
.99 rts
.10 jsr CC.IsLetter
bcs .8
>LDYA L.CC.FTYPES
jsr CC.LookupID
bcs .8 next char is an identifier
ldy #1
lda (pStack),y
ora #SYM.Q.FUNC+SYM.Q.FASTCALL
sta (pStack),y
jsr CC.GetNextCharNB
bcs .9 next char is an identifier, ",", "(",")"
.8 clc
rts
*--------------------------------------
* in : Y,A = type/qual
* out : X = size
*--------------------------------------
CC.TYPE.SizeOf bit #SYM.Q.PPPOINTER
bne .2
ldx CC.TYPESIZE-1,y
clc
rts
.2 ldx #2 pointer
sec +1 for hMem Storage
rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.type
LOAD usr/src/bin/cc.s
ASM