################################################################# # # # Copyright 2001, 2011 Fidelity Information Services, Inc # # # # This source code contains the intellectual property # # of its copyright holder(s), and is made available # # under a license. If you do not know the terms of # # the license, please stop and do not read further. # # # ################################################################# .sbttl mval_def.si # PAGE + # ------------------------------------------- # mval_def.si # # This is an include file for # SCO Unix 80386 masm assembler containing # the macros for mval-related assembly routines. # ------------------------------------------- mval_v_nm = 0 mval_v_int = 1 mval_v_str = 2 mval_v_num_approx = 3 mval_v_canonical = 4 mval_v_sym = 5 mval_v_sublit = 6 mval_v_retarg = 7 mval_v_utflen = 8 mval_v_aliascont = 9 mval_m_nm = 0x001 mval_m_int_without_nm = 0x002 mval_m_int = 0x003 mval_m_str = 0x004 mval_m_num_approx = 0x008 mval_m_canonical = 0x010 mval_m_sym = 0x020 mval_m_sublit = 0x040 mval_m_retarg = 0x080 mval_m_utflen = 0x100 mval_m_aliascont = 0x200 #smw 99/7/12 Now using MS VC 5.0 so the following paragraph should # be replaced. # NOTE: The SCO C compiler pads out bit fields to the length of # the underlying type. For example, a series of "unsigned int" # bit fields will be padded out to a multiple of 4 bytes, even if # they require less than one byte total, because the underlying # type is "int". Similarly, a series of "unsigned short" bit # fields will be padded out to a multiple of 2 bytes, and a # series of "unsigned char" will be padded out to a byte boundary. # Also note the padding is not related to alignment, only to # total length. # #smw 99/10/19 gcc on Linux doesn't do the above # # Length of mval in bytes mval_byte_len = 24 # Offsets of type, exp, strlen, stradd, num in mval structure mval_w_mvtype = 0 mval_b_exp = 2 mval_l_strlen = 16 mval_a_straddr = 20 # Address offset of number in mval mvalnm_offs = 4 mval_l_m0 = 4 mval_l_m1 = 8 mval_esign_mask = 0x080 MV_BIAS = 1000 # 10**3 MANT_LO = 100000000 # 10**8 MANT_HI = 1000000000 # 10**9 INT_HI = 1000000 # 10**6 # Stringpool structure offsets base = 0 free = 4 top = 8 # mvals passed to these macros must be registers .sbttl mval_def.si mv_force_defined # --------------------------------------- # mv_force_defined(mval, label) # --------------------------------------- .macro mv_force_defined mval, label testw $(mval_m_str+mval_m_nm),mval_w_mvtype(\mval) jne \label pushl \mval call underr addl $4,%esp movl %eax, \mval \label: .endm .sbttl mval_def.si mv_force_str # --------------------------------------- # mv_force_str(mval, label) # --------------------------------------- .macro mv_force_str mval, label testw $mval_m_str,mval_w_mvtype(\mval) jne \label pushl \mval call n2s addl $4,%esp \label: .endm .sbttl mval_def.si mv_force_num # --------------------------------------- # mv_force_num(mval, label) # --------------------------------------- .macro mv_force_num mval, label testw $mval_m_nm,mval_w_mvtype(\mval) jne \label pushl \mval call s2n addl $4,%esp \label: .endm .sbttl mval_def.si mv_force_str_if_num_approx # --------------------------------------- # mv_force_str_if_num_approx(mval, label) # --------------------------------------- .macro mv_force_str_if_num_approx mval, label testw $mval_m_num_approx,mval_w_mvtype(\mval) je \label pushl \mval call n2s addl $4,%esp \label: .endm .sbttl mval_def.si mv_i2mval # --------------------------------------- # mv_i2mval(int, mval) # --------------------------------------- .macro mv_i2mval int, mval movw $mval_m_int,mval_w_mvtype(\mval) movl \int,%eax imull $MV_BIAS,%eax,%eax movl %eax,mval_l_m1(\mval) .endm .sbttl mval_def.si mv_if_string # --------------------------------------- # mv_if_string(mval,label) # --------------------------------------- .macro mv_if_string mval, label testw $mval_m_str,mval_w_mvtype(\mval) jne \label .endm .sbttl mval_def.si mv_if_number # --------------------------------------- # mv_if_number(mval,label) # --------------------------------------- .macro mv_if_number mval, label testw $mval_m_nm,mval_w_mvtype(\mval) jne \label .endm .sbttl mval_def.si mv_if_int # --------------------------------------- # mv_if_int(mval,label) # --------------------------------------- .macro mv_if_int mval, label testw $mval_m_int_without_nm,mval_w_mvtype(\mval) jne \label .endm .sbttl mval_def.si mv_if_notstring # --------------------------------------- # mv_if_notstring(mval,label) # --------------------------------------- .macro mv_if_notstring mval, label testw $mval_m_str,mval_w_mvtype(\mval) je \label .endm .sbttl mval_def.si mv_if_notnumber # --------------------------------------- # mv_if_notnumber(mval,label) # --------------------------------------- .macro mv_if_notnumber mval, label testw $mval_m_nm,mval_w_mvtype(\mval) je \label .endm .sbttl mval_def.si mv_if_notint # --------------------------------------- # mv_if_notint(mval,label) # --------------------------------------- .macro mv_if_notint mval, label testw $mval_m_int_without_nm,mval_w_mvtype(\mval) je \label .endm .sbttl mval_def.si mv_if_defined # --------------------------------------- # mv_if_defined(mval,label) # --------------------------------------- .macro mv_if_defined mval, label testw $(mval_m_str+mval_m_nm),mval_w_mvtype(\mval) jne \label .endm .sbttl mval_def.si mv_if_notdefined # --------------------------------------- # mv_if_notdefined(mval,label) # --------------------------------------- .macro mv_if_notdefined mval, label testw $(mval_m_str+mval_m_nm),mval_w_mvtype(\mval) je \label .endm .sbttl mval_def.si mv_if_canonical # ------------------------------------------------------------- # WARNING: # Following macro needs to be supplied with 2 extra labels that # are used by local branch instructions, tmp_label1 and tmp_label2 # ------------------------------------------------------------- # mv_if_canonical(mval,mainlabel, tmp_label1, tmp_label2) # ------------------------------------------------------------- .macro mv_if_canonical mval, mainlabel, tmp_label1, tmp_label2 testw $mval_m_nm,mval_w_mvtype(\mval) je \tmp_label1 testw $mval_m_num_approx,mval_w_mvtype(\mval) jne \tmp_label2 jmp \mainlabel \tmp_label1: pushl \mval call val_iscan addl $4,%esp cmpl $0,%eax jne \mainlabel \tmp_label2: .endm