c

package
v0.0.0-...-27647ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2023 License: BSD-3-Clause, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CTCC_CDECL = iota
	CTCC_THISCALL
	CTCC_FASTCALL
	CTCC_STDCALL
)

Calling conventions. ORDER CC

View Source
const (
	CTA_NONE    = iota // Ignored attribute. Must be zero.
	CTA_QUAL           // Unmerged qualifiers.
	CTA_ALIGN          // Alignment override.
	CTA_SUBTYPE        // Transparent sub-type.
	CTA_REDIR          // Redirected symbol name.
	CTA_BAD            // To catch bad IDs.
	CTA__MAX
)

Attribute numbers.

View Source
const (
	CTOK_OFS = iota + 255

	CTOK_IDENT
	CTOK_STRING
	CTOK_INTEGER
	CTOK_EOF
	CTOK_OROR
	CTOK_ANDAND
	CTOK_EQ
	CTOK_NE
	CTOK_LE
	CTOK_GE
	CTOK_SHL
	CTOK_SHR
	CTOK_DEREF

	CTOK_VOID
	CTOK_BOOL
	CTOK_CHAR
	CTOK_INT
	CTOK_FP
	CTOK_LONG
	CTOK_LONGLONG
	CTOK_SHORT
	CTOK_COMPLEX
	CTOK_SIGNED
	CTOK_UNSIGNED
	CTOK_CONST
	CTOK_VOLATILE
	CTOK_RESTRICT
	CTOK_INLINE
	CTOK_TYPEDEF
	CTOK_EXTERN
	CTOK_STATIC
	CTOK_AUTO
	CTOK_REGISTER

	CTOK_EXTENSION
	CTOK_ASM
	CTOK_ATTRIBUTE
	CTOK_DECLSPEC
	CTOK_CCDECL
	CTOK_PTRSZ
	CTOK_STRUCT
	CTOK_UNION
	CTOK_ENUM
	CTOK_SIZEOF
	CTOK_ALIGNOF

	CTOK_FIRSTDECL    = CTOK_VOID
	CTOK_FIRSTSCL     = CTOK_TYPEDEF
	CTOK_LASTDECLFLAG = CTOK_REGISTER
	CTOK_LASTDECL     = CTOK_ENUM
)

C token numbers.

View Source
const (
	CDF_VOID = CPscl(1) << iota
	CDF_BOOL
	CDF_CHAR
	CDF_INT
	CDF_FP
	CDF_LONG
	CDF_LONGLONG
	CDF_SHORT
	CDF_COMPLEX
	CDF_SIGNED
	CDF_UNSIGNED
	CDF_CONST
	CDF_VOLATILE
	CDF_RESTRICT
	CDF_INLINE
	CDF_TYPEDEF
	CDF_EXTERN
	CDF_STATIC
	CDF_AUTO
	CDF_REGISTER
)

Declaration specifier flags.

View Source
const (
	CTID_NONE = iota
	CTID_VOID
	CTID_CVOID
	CTID_BOOL
	CTID_CCHAR
	CTID_INT8
	CTID_UINT8
	CTID_INT16
	CTID_UINT16
	CTID_INT32
	CTID_UINT32
	CTID_INT64
	CTID_UINT64
	CTID_FLOAT
	CTID_DOUBLE
	CTID_COMPLEX_FLOAT
	CTID_COMPLEX_DOUBLE
	CTID_P_VOID
	CTID_P_CVOID
	CTID_P_CCHAR
	CTID_P_UINT8
	CTID_A_CCHAR
	CTID_CTYPEID
	CTID_MAX = 65536
)

Public predefined type IDs.

View Source
const CPARSE_MAX_BUF = 32768 // Max. token buffer size.

C parser limits.

View Source
const CPARSE_MAX_DECLDEPTH = 20 // Max. recursive declaration depth.
View Source
const CPARSE_MAX_DECLSTACK = 100 // Max. declaration stack depth.
View Source
const CPARSE_MAX_PACKSTACK = 7 // Max. pack pragma stack depth.
View Source
const CPNS_DEFAULT = (1 << CT_KW) | (1 << CT_TYPEDEF) | (1 << CT_FUNC) | (1 << CT_EXTERN) | (1 << CT_CONSTVAL)
View Source
const CPNS_STRUCT = (1 << CT_KW) | (1 << CT_STRUCT) | (1 << CT_ENUM)
View Source
const CTALIGN_PTR = 8
View Source
const CTBSZ_FIELD = 127 // Temp. marker for regular field.
View Source
const CTBSZ_MAX = 32 // Max. size of bitfield is 32 bit.

Info bits for BITFIELD. Max. size of bitfield is 64 bits.

View Source
const CTFP_ALIGNED = 0x00000001 // cp->attr + ALIGN

Flags used in parser. .F.Ammvf cp->attr

View Source
const CTFP_CCONV = 0x00000001 // cp->fattr + CCONV/[SSE]REGPARM

...C...f cp->fattr

View Source
const CTFP_PACKED = 0x00000002 // cp->attr
View Source
const CTF_UCHAR = 0 // ((char)-1 > 0 ? CTF_UNSIGNED: 0)
View Source
const CTHASH_MASK = CTHASH_SIZE - 1
View Source
const CTHASH_SIZE = 128 // Number of hash anchors.
View Source
const CTID_INT_PSZ = CTID_INT64
View Source
const CTID_UINT_PSZ = CTID_UINT64
View Source
const CTID_WCHAR = CTID_INT32
View Source
const CTMASK_ALIGN = 15 // Max. alignment is 2^15.
View Source
const CTMASK_ATTRIB = 255 // Max. 256 attributes.
View Source
const CTMASK_BITBSZ = 127
View Source
const CTMASK_BITCSZ = 127
View Source
const CTMASK_BITPOS = 127
View Source
const CTMASK_CCONV = 3 // Max. 4 calling conventions.
View Source
const CTMASK_MSIZEP = 255 // Max. type size (via mode) is 128.
View Source
const CTMASK_NUM = 0xf0000000 // Max. 16 type numbers.
View Source
const CTMASK_REGPARM = 3 // Max. 0-3 regparms.
View Source
const CTMASK_VSIZEP = 15 // Max. vector size is 2^15.

Bitfields only used in parser.

View Source
const CTSHIFT_ALIGN = 16
View Source
const CTSHIFT_ATTRIB = 16
View Source
const CTSHIFT_BITBSZ = 8
View Source
const CTSHIFT_BITCSZ = 16
View Source
const CTSHIFT_BITPOS = 0
View Source
const CTSHIFT_CCONV = 16
View Source
const CTSHIFT_MSIZEP = 8
View Source
const CTSHIFT_NUM = 28
View Source
const CTSHIFT_REGPARM = 18
View Source
const CTSHIFT_VSIZEP = 4
View Source
const CTSIZE_INVALID = 0xffffffff

Special sizes.

View Source
const CTSIZE_PTR = 8

Variables

View Source
var CTTYPEINFO_NUM int

Functions

This section is empty.

Types

type CPChar

type CPChar = rune // C parser character. Unsigned ext. from char.

type CPDecl

type CPDecl struct {
	// contains filtered or unexported fields
}

Type declaration context.

type CPDeclIdx

type CPDeclIdx = CTypeID // Index into declaration stack.

type CPState

type CPState struct {
	// contains filtered or unexported fields
}

C parser state.

type CPToken

type CPToken = int // C parser token.

type CPValue

type CPValue struct {
	// contains filtered or unexported fields
}

C parser internal value representation.

type CPscl

type CPscl uint32 // Storage class flags.
const (
	CPARSE_MODE_MULTI      CPscl = 1  // Process multiple declarations.
	CPARSE_MODE_ABSTRACT   CPscl = 2  // Accept abstract declarators.
	CPARSE_MODE_DIRECT     CPscl = 4  // Accept direct declarators.
	CPARSE_MODE_FIELD      CPscl = 8  // Accept field width in bits, too.
	CPARSE_MODE_NOIMPLICIT CPscl = 16 // Reject implicit declarations.
	CPARSE_MODE_SKIP       CPscl = 32 // Skip definitions, ignore errors.
)

Flags for C parser mode.

type CTInfo

type CTInfo uint32 // Type info.
const (
	// Externally visible types.
	CT_NUM     CTInfo = iota // Integer or floating-point numbers.
	CT_STRUCT                // Struct or union.
	CT_PTR                   // Pointer or reference.
	CT_ARRAY                 // Array or complex type.
	CT_VOID                  // Void type.
	CT_ENUM                  // Enumeration.
	CT_FUNC                  // Function.
	CT_TYPEDEF               // Typedef.
	CT_ATTRIB                // Miscellaneous attributes.
	// Internal element types.
	CT_FIELD    // Struct/union field or function parameter.
	CT_BITFIELD // Struct/union bitfield.
	CT_CONSTVAL // Constant value.
	CT_EXTERN   // External reference.
	CT_KW       // Keyword.

	CT_MAYCONVERT = CT_ARRAY
	CT_HASSIZE    = CT_ENUM // Last type where ct->size holds the actual size.
)

C type numbers. Highest 4 bits of C type info. ORDER CT.

const (
	CTF_BOOL       CTInfo = 0x08000000 // Boolean: NUM, BITFIELD.
	CTF_FP         CTInfo = 0x04000000 // Floating-point: NUM.
	CTF_CONST      CTInfo = 0x02000000 // Const qualifier.
	CTF_VOLATILE   CTInfo = 0x01000000 // Volatile qualifier.
	CTF_UNSIGNED   CTInfo = 0x00800000 // Unsigned: NUM, BITFIELD.
	CTF_LONG       CTInfo = 0x00400000 // Long: NUM.
	CTF_VLA        CTInfo = 0x00100000 // Variable-length: ARRAY, STRUCT.
	CTF_REF        CTInfo = 0x00800000 // Reference: PTR.
	CTF_VECTOR     CTInfo = 0x08000000 // Vector: ARRAY.
	CTF_COMPLEX    CTInfo = 0x04000000 // Complex: ARRAY.
	CTF_UNION      CTInfo = 0x00800000 // Union: STRUCT.
	CTF_VARARG     CTInfo = 0x00800000 // Vararg: FUNC.
	CTF_SSEREGPARM CTInfo = 0x00400000 // SSE register parameters: FUNC.

	CTF_QUAL  = CTInfo(CTF_CONST | CTF_VOLATILE)
	CTF_ALIGN = CTInfo(CTMASK_ALIGN << CTSHIFT_ALIGN)
)

C type info flags. TFFArrrr

const CTMASK_CID CTInfo = 0x0000ffff // Max. 65536 type IDs.

C type info bitfields.

func CTALIGNi

func CTALIGNi(al int) CTInfo

func CTATTRIB

func CTATTRIB(at int) CTInfo

func CTF_INSERT

func CTF_INSERT(info, mask, shift, val CTInfo) CTInfo

#define CTF_INSERT(info, field, val) \ info = (info & ~(CTMASK_##field<<CTSHIFT_##field)) | (((CTSize)(val) & CTMASK_##field) << CTSHIFT_##field)

func CTINFO

func CTINFO(ct, flags CTInfo) CTInfo

func CTINFO_REF

func CTINFO_REF(ref CTInfo) CTInfo

type CTInfoSize

type CTInfoSize struct {
	// contains filtered or unexported fields
}

type CTSize

type CTSize uint32 // Type size.

func CTALIGN

func CTALIGN(al int) CTSize

type CTState

type CTState struct {
	// contains filtered or unexported fields
}

C type state.

type CType

type CType struct {
	// contains filtered or unexported fields
}

C type table element.

type CTypeID

type CTypeID uint32 // Type ID.

type CTypeID1

type CTypeID1 = uint16 // Minimum-sized type ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL