📄 bintoken.h
字号:
/***************************************************************************
Title: bintoken.h
Version: 2.00
Date: 10/19/2000
Author(s): Ed Lay
----------------------------------------------------------------------------
Change log:
Date Rev Who Description
--------- ----- ----- --------------------------------------------
04/24/1998 EBL Creation
09/15/1999 EBL Adding final Expression tokens
10/19/2000 EBL Add TURBO LOCK, UNLOCK, SETPHASE
***************************************************************************/
//****************************************************************************
// Second Pass Token/Data Structure & Token Codes
//
//****************************************************************************
//****************************************************************************
//
// Defines for different types:
// 1. Operatee Types ( In, Mn, Pn, Qn, Functions )
// 2. Operator Types ( +, -, *, /, %, |, &, ^, OR, AND )
// 3. Command Types
// a. Single( Types: 0A, 0B, 1A, 1B, 1C, 1D, 1E, 1F )
// b. Expression( IF, WHILE
// I,M,P,Qnn = ( EXPRESSION )
// I,M,P,Q(Exp) = ( EXPRESSION )
// Mnn ==, |=, &= ^= ( EXPRESSION )
// M(Exp) = ==, |=, &= ^= ( EXPRESSION )
// All Type 0 A( Exp. ) .. Z( Exp. ) .. CALL( Exp. )
// TA( Exp. ) .. CCR( Exp. )
//****************************************************************************
#define OpI 0
#define OpM 2
#define OpP 4
#define OpQ 6
#define Constant 8
#define OpL 0xA
#define OpF 0xC
#define OpMTRNum 0xE
#define OpMI 0x10
#define OpMM 0x12
#define OpMP 0x14
#define OpIMPQMask 0x1E
//****************************************************************************
// Token Types and Control Codes
//****************************************************************************
#define OpMaskType 0x80 // Operator/Operatee Type Mask
#define OperatorType 0x80 // Operator Type
#define OperateeType 0x00 // Operatee Type
#define CmdType 0x100 // Command Type
#define OpCmdMask 0x180 // Operator/Operatee & Cmd Type Mask
#define Exp 0x200 // Expression Token
#define CmdExp CmdType+Exp
#define CmdIfWhmtch 0x400 // If or While Cmd Match ( only PLCC )
#define CmdElsemtch 0x800 // Else matched on this If( only PLCC )
#define OpNegate 0x01 // Operator/Operatee Negate
#define Ope 0x20 // Operatee Not Function Type
#define OpeFuncType 0x40 // Operatee Function Type
#define OprHIType 0x2 // HI priority Operator Type
#define OprCondType 0x20 // Operator Conditional Type
#define OprCompType 0x10 // Operator Comparison Type Operator
#define OprCondNOTType 0x8 // Operator Conditional NOT Type
#define OprCondCompType OprCompType+OprCondType+OperatorType // Conditional Comparison Operator
#define OprCmpdCondType OprCondType+OperatorType // Compound Conditional
#define CmdSingle 0x40
#define CmdNULL 0 // NULL Command for init
//****************************************************************************
// Operatee Types Allowed within an Expression
// OperatorType 0x80 // Operator Type
// OperateeType 0x00 // Operatee Type
// CmdType 0x100 // Command Type
// OpCmdMask 0x180 // Operator/Operatee & Cmd Type
// Ope 0x20 // Operatee Not Function Type
// OpeFuncType 0x40 // Operatee Function Type
// if(token & OpCmdMask == OperateeType)
//****************************************************************************
//****************************************************************************
// Operatee Types Allowed within an Expression & Not Functions
// if((token & OpCmdMask == OperateeType) && ( token & OpeFuncType == 0 ))
// Range 0 - 1E total of 16 ( bit 0 = "-" )
//****************************************************************************
#define OpeInn Ope +OpI // Operatee Inn 0000100000
#define OpeMnn Ope +OpM // Operatee Mnn 0000100010
#define OpePnn Ope +OpP // Operatee Pnn 0000100100
#define OpeQnn Ope +OpQ // Operatee Qnn 0000100110
#define OpeConst Ope +Constant // Operatee Constant Values 0000101000
#define OpeLnn Ope +OpL // Operatee Lnn 0000101010
#define OpeFnn Ope +OpF // Operatee Fnn 0000101100
#define OpeMTRNum Ope +OpMTRNum // Operatee MTRNum 0000101110
#define OpeMInn Ope +OpMI // Operatee Inn 0000110000
#define OpeMMnn Ope +OpMM // Operatee Mnn 0000110010
#define OpeMPnn Ope +OpMP // Operatee Pnn 0000110100
// Spare
// Remaining 0000111110
//****************************************************************************
// Operatee Types Allowed within an Expression & Functions
// if((token & OpCmdMask == OperateeType) && ( token & OpeFuncType == OpeFuncType ))
// Range 0 - 3E total of 32 ( bit 0 = "-" )
//****************************************************************************
#define OpFuncAddrMsk 0x1F // Operatee Function Address Mask
#define OpeFuncI OpI+OpeFuncType // Operatee Function I 000100000x
#define OpeFuncM OpM+OpeFuncType // Operatee Function M 000100001x
#define OpeFuncP OpP+OpeFuncType // Operatee Function P 000100010x
#define OpeFuncQ OpQ+OpeFuncType // Operatee Function Q 000100011x
#define OpeFuncSIN 0x08+OpeFuncType // Operatee Function SIN 000100100x
#define OpeFuncCOS 0x0A+OpeFuncType // Operatee Function COS 000100101x
#define OpeFuncTAN 0x0C+OpeFuncType // Operatee Function TAN 000100110x
#define OpeFuncABS 0x0E+OpeFuncType // Operatee Function ABS 000100111x
#define OpeFuncASIN 0x10+OpeFuncType // Operatee Function ASIN 000101000x
#define OpeFuncACOS 0x12+OpeFuncType // Operatee Function ACOS 000101001x
#define OpeFuncATAN 0x14+OpeFuncType // Operatee Function ATAN 000101010x
#define OpeFuncSQRT 0x16+OpeFuncType // Operatee Function SQRT 000101011x
#define OpeFuncEXP 0x18+OpeFuncType // Operatee Function EXP 000101100x
#define OpeFuncLN 0x1A+OpeFuncType // Operatee Function LN 000101101x
#define OpeFuncINT 0x1C+OpeFuncType // Operatee Function INT 000101110x
#define OpeFuncATAN2 0x1E+OpeFuncType // Operatee Funct ATAN2 000101111x
#define OpeFuncLp 0x20+OpeFuncType // Operatee Function '(' 000110000x
#define OpeFuncRp 0x22+OpeFuncType // Operatee Function ')' 000110001x
#define OpeFuncLpEq 0x24+OpeFuncType // Operatee Function 000110010x
// BinRot Array Assignment
#define OpeFuncLnn 0x26+OpeFuncType // Operatee Func. Lnn[ 000110011x
#define OpeFuncFnn 0x28+OpeFuncType // Operatee Func. Fnn[ 000110100x
#define OpeFuncLb 0x2A+OpeFuncType // Operatee Function '[' 000110101x
#define OpeFuncRb 0x2C+OpeFuncType // Operatee Function '[' 000110110x
#define OpeFuncFTOI 0x2E+OpeFuncType // Operatee Func. FTOI( 000110111x
#define OpeFuncITOF 0x30+OpeFuncType // Operatee Func. ITOF( 000111000x
#define OpeFuncFLIMIT 0x32+OpeFuncType // Operatee Func. FLIMIT( 000111001x
#define OpeFuncMI 0x34+OpeFuncType // Operatee Function MI 000111010x
#define OpeFuncMM 0x36+OpeFuncType // Operatee Function MM 000111011x
#define OpeFuncMP 0x38+OpeFuncType // Operatee Function MP 000111100x
// Spare
// Remaining 000011111x
//****************************************************************************
// Operator Types Allowed within an Expression
//
// OprCondType 0x20 // Conditional Type 00100000
// OprCompType 0x10 // Comparison Operator 00010000
// OprCondNOTType 0x8 // Conditional NOT Type 00000100
// OprCondCompType OprCompType+OprCondType+OperatorType 1011xxxx
// OprCmpdCondType OprCondType+OperatorType 1010xxxx
// OperatorType 0x80 // Operator Type
// CmdType 0x100 // Command Type
// OpCmdMask 0x180 // Operator/Operatee & Cmd Type
// if(token & OpCmdMask == OperatorType)
//****************************************************************************
#define OprADD 0x00+OperatorType // Operator '+' 0010000000
#define OprSUB 0x01+OperatorType // Operator '-' 0010000001
#define OprMPY 0x02+OperatorType // Operator '*' 0010000010
#define OprDIV 0x03+OperatorType // Operator '/' 0010000011
#define OprOR 0x04+OperatorType // Operator '|' 0010000100
#define OprXOR 0x05+OperatorType // Operator '^' 0010000101
#define OprAND 0x06+OperatorType // Operator '&' 0010000110
#define OprMOD 0x07+OperatorType // Operator '%' 0010000111
#define OprADDRMSK 0x07 // Mask for addr table
#define OprComma 0x08+OperatorType // Operator ',' 0010001000
// Remaining to here 0010001111
// Following for "M(Exp) &=" and "IMPQ(Exp)="
#define OprExpOREQ Exp+0x08+OperatorType // Opr M(Exp) |=- 101000100x
#define OprExpXOREQ Exp+0x0A+OperatorType // Opr M(Exp) ^=- 101000101x
#define OprExpANDEQ Exp+0x0C+OperatorType // Opr M(Exp) &=- 101000110x
// *** Above Bits 1-3 must match bits 0-2 of OprOR, XOR, and AND ***
#define OprExpEQ Exp+0x0E+OperatorType // Opr IMPQ(Exp.)=- 101000111x
#define OprLOR 0x08+OprCmpdCondType // Operator OR, OR- 001010100x
#define OprLAND 0x0A+OprCmpdCondType // Operator AND, AND- 001010101x
#define OprlogMSK 0x0F // Logical BIN MASK
// Spare - could start at 000x
// Remaining 001010111x
#define AEQ 6
#define OprEQ 0x00+OprCondCompType // Operator '=',"!=" 001011x00x
#define OprGT 0x02+OprCondCompType // Operator '>',"!>" 001011x01x
#define OprLT 0x04+OprCondCompType // Operator '<',"!<" 001011x10x
#define OprAEQ AEQ+OprCondCompType // Operator '~',"!~" 001011x11x
// B0 'x' is '-'
// B3 'x' is '!'
#define OprCondMSK 0x1F // Mask for Binary Expression
//****************************************************************************
// Command Types:
// a. Single( Types: 0A, 0B, 1A, 1B, 1C, 1D, 1E, 1F )
// These are the ORIGINAL non expressions commands.
// b. Expression( IF, WHILE
// I,M,P,Qnn = ( EXPRESSION )
// Mnn ==, |=, &= ^= ( EXPRESSION )
// Type 0 A( Exp. ) .. Z( Exp. ) .. CALL( Exp. ) etc.
//
// CmdType 0x100 // Command Type
// OpCmdMask 0x180 // Operator/Operatee & Cmd Type Mask
// Exp 0x200 // Expression Token
// CmdExp 0x300 // IMPQ(Exp)= Types & MSync(Exp)== Types
// CmdIfWhmtch 0x400 // If or While Cmd Match ( only PLCC )
// CmdElsemtch 0x800 // Else matched on this If( only PLCC )
// OprCondType 0x20 // Conditional Type 100000
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -