!Copyright © 1993, MadGoat Software. All Rights Reserved. COMPILETIME _FLD_CUR_BYT = 0, _FLD_CUR_BIT = 0, _FLD_SAV_BYT = 0, _FLD_SAV_BIT = 0, _FLD_WRK_SIZE = 0, _FLD_WRK_BITS = 0, _FLD_FLD_COUNT = 0; MACRO _DEF (NAM) = %ASSIGN (_FLD_CUR_BYT, 0) %ASSIGN (_FLD_CUR_BIT, 0) %ASSIGN (_FLD_FLD_COUNT, 0) FIELD %QUOTENAME (NAM, '_FIELDS') = SET %, _ENDDEF (NAM) = TES; %IF _FLD_CUR_BIT GTR 0 %THEN %ASSIGN (_FLD_CUR_BYT, _FLD_CUR_BYT + 1) %FI LITERAL %NAME (NAM, '_S_', NAM, 'DEF') = _FLD_CUR_BYT; MACRO %NAME (NAM, 'DEF') = BLOCK [%NAME (NAM, '_S_', NAM, 'DEF'), BYTE] FIELD (%NAME (NAM, '_FIELDS')) %QUOTE % %, _FIELD (SIZ) = %ASSIGN (_FLD_FLD_COUNT, _FLD_FLD_COUNT+1) %ASSIGN (_FLD_WRK_BITS, %IF SIZ GTR 32 %THEN 0 %ELSE SIZ %FI) [_FLD_CUR_BYT,_FLD_CUR_BIT,_FLD_WRK_BITS,0] %ASSIGN (_FLD_WRK_BITS, _FLD_CUR_BYT * 8 + _FLD_CUR_BIT + SIZ) %ASSIGN (_FLD_CUR_BYT, _FLD_WRK_BITS / 8) %ASSIGN (_FLD_CUR_BIT, _FLD_WRK_BITS MOD 8) %, _BYTE = _ALIGN (BYTE) _FIELD (8) %, _BYTES (COUNT) = _ALIGN (BYTE) _FIELD ((COUNT) * 8) %, _WORD = _ALIGN (BYTE) _FIELD (16) %, _LONG = _ALIGN (BYTE) _FIELD (32) %, _QUAD = _ALIGN (BYTE) _FIELD (64) %, _BIT = _FIELD (1) %, _BITS (N) = _FIELD ((N)) %, _OVERLAY (NAM) = %ASSIGN (_FLD_SAV_BYT, _FLD_CUR_BYT) %ASSIGN (_FLD_SAV_BIT, _FLD_CUR_BIT) %ASSIGN (_FLD_CUR_BYT, %FIELDEXPAND (NAM, 0)) %ASSIGN (_FLD_CUR_BIT, %FIELDEXPAND (NAM, 1)) %, _ENDOVERLAY = %ASSIGN (_FLD_CUR_BYT, _FLD_SAV_BYT) %ASSIGN (_FLD_CUR_BIT, _FLD_SAV_BIT) %, _ALIGN (ATYPE) = %ASSIGN (_FLD_WRK_BITS, 0) %ASSIGN (_FLD_WRK_SIZE, %IF %IDENTICAL (ATYPE, BYTE) %THEN 1 %ELSE %IF %IDENTICAL (ATYPE, WORD) %THEN 2 %ELSE %IF %IDENTICAL (ATYPE, LONG) %THEN 4 %ELSE %IF %IDENTICAL (ATYPE, QUAD) %THEN 8 %ELSE ATYPE %FI %FI %FI %FI) %IF _FLD_CUR_BIT NEQ 0 %THEN %ASSIGN (_FLD_WRK_BITS, 8 - _FLD_CUR_BIT) %IF _FLD_CUR_BYT+1 MOD _FLD_WRK_SIZE NEQ 0 %THEN %ASSIGN (_FLD_WRK_BITS, _FLD_WRK_BITS + (_FLD_WRK_SIZE - (_FLD_CUR_BYT+1) MOD _FLD_WRK_SIZE) * 8) %FI %ELSE %IF _FLD_CUR_BYT MOD _FLD_WRK_SIZE NEQ 0 %THEN %ASSIGN (_FLD_WRK_BITS, (_FLD_WRK_SIZE - _FLD_CUR_BYT MOD _FLD_WRK_SIZE) * 8) %FI %FI %IF _FLD_WRK_BITS GTR 0 %THEN %ASSIGN (_FLD_WRK_BITS, _FLD_CUR_BYT * 8 + _FLD_CUR_BIT + _FLD_WRK_BITS) %ASSIGN (_FLD_CUR_BYT, _FLD_WRK_BITS / 8) %ASSIGN (_FLD_CUR_BIT, 0) %FI %;