If a type is a int128, a long_double_t or a void, some placeholders need
        to be in the generated code to be valid.
490435
def enable_fundamental_type_wrappers(self):
        
        # 2015-01 reactivating header templates
        #log.warning('enable_fundamental_type_wrappers deprecated - replaced by generate_headers')
        # return # FIXME ignore
        self.enable_fundamental_type_wrappers = lambda: True
        import pkgutil
        headers = pkgutil.get_data(
            'ctypeslib',
            'data/fundamental_type_name.tpl').decode()
        from clang.cindex import TypeKind
        size = str(self.parser.get_ctypes_size(TypeKind.LONGDOUBLE) // 8)
        headers = headers.replace('__LONG_DOUBLE_SIZE__', size)
        print(headers, file=self.imports)
        return
1253758
static boolean isCOctetStringValid(String value, int maxLength) {
        if (value == null)
            return true;
        if (value.length() >= maxLength)
            return false;
        return true;

    }
1269095
final void validateColumnType(int columnIndex, VoltType... types) {
        if (m_position < 0)
            throw new RuntimeException("VoltTableRow is in an invalid state. Consider calling advanceRow().");

        if ((columnIndex >= getColumnCount()) || (columnIndex < 0)) {
            throw new IndexOutOfBoundsException("Column index " + columnIndex + " is greater than the number of columns");
        }
        final VoltType columnType = getColumnType(columnIndex);
        for (VoltType type : types)
            if (columnType == type)
                return;
        throw new IllegalArgumentException("Column index " + columnIndex + " is type " + columnType);
    }
886835
private boolean checkForMapValue(TabularType pType) {
        CompositeType rowType = pType.getRowType();
        // Two entries in the row: "key" and "value"
        return rowType.containsKey(TD_KEY_VALUE) && rowType.containsKey(TD_KEY_KEY) && rowType.keySet().size() == 2;
    }
698426
def _pretty_const_type_val(typecode, val):
    

    if typecode == CONST_Utf8:
        typestr = "Utf8"  # formerly Asciz, which was considered Java bug
        if not isinstance(val, str):  # Py2, val is 'unicode'
            val = repr(val)[2:-1]  # trim off the surrounding u"" (HACK)
        else:
            val = repr(val)[1:-1]  # trim off the surrounding "" (HACK)
    elif typecode == CONST_Integer:
        typestr = "int"
    elif typecode == CONST_Float:
        typestr = "float"
        val = "%ff" % val
    elif typecode == CONST_Long:
        typestr = "long"
        val = "%il" % val
    elif typecode == CONST_Double:
        typestr = "double"
        val = "%fd" % val
    elif typecode == CONST_Class:
        typestr = "class"
        val = "#%i" % val
    elif typecode == CONST_String:
        typestr = "String"
        val = "#%i" % val
    elif typecode == CONST_Fieldref:
        typestr = "Field"
        val = "#%i.#%i" % val
    elif typecode == CONST_Methodref:
        typestr = "Method"
        val = "#%i.#%i" % val
    elif typecode == CONST_InterfaceMethodref:
        typestr = "InterfaceMethod"
        val = "#%i.#%i" % val
    elif typecode == CONST_NameAndType:
        typestr = "NameAndType"
        val = "#%i:#%i" % val
    elif typecode == CONST_ModuleId:
        typestr = "ModuleId"
        val = "#%i@#%i" % val
    elif typecode == CONST_MethodHandle:
        typestr = "MethodHandle"
        val = repr(val)
    elif typecode == CONST_MethodType:
        typestr = "MethodType"
        val = repr(val)
    elif typecode == CONST_InvokeDynamic:
        typestr = "InvokeDynamic"
        val = repr(val)
    else:
        raise Unimplemented("unknown constant type %r" % typecode)

    return typestr, val
1011941
def _isvalid(self, datatype):
        ''''''
        if datatype in self.meta:
            return bool(Dap._meta_valid[datatype].match(self.meta[datatype]))
        else:
            return datatype in Dap._optional_meta
843915
private boolean isDatatype( DdlTokenStream tokens,
                                int type ) throws ParsingException {
        // Loop through the registered statement start string arrays and look for exact matches.

        switch (type) {
            case DataTypes.DTYPE_CODE_CHAR_STRING: {
                for (String[] stmts : basicCharStringTypes) {
                    if (tokens.matches(stmts)) return true;
                }
            }
                break;
            case DataTypes.DTYPE_CODE_NCHAR_STRING: {
                for (String[] stmts : basicNationalCharStringTypes) {
                    if (tokens.matches(stmts)) return true;
                }
            }
                break;
            case DataTypes.DTYPE_CODE_BIT_STRING: {
                for (String[] stmts : basicBitStringTypes) {
                    if (tokens.matches(stmts)) return true;
                }
            }
                break;
            case DataTypes.DTYPE_CODE_EXACT_NUMERIC: {
                for (String[] stmts : basicExactNumericTypes) {
                    if (tokens.matches(stmts)) return true;
                }
            }
                break;
            case DataTypes.DTYPE_CODE_APROX_NUMERIC: {
                for (String[] stmts : basicApproxNumericStringTypes) {
                    if (tokens.matches(stmts)) return true;
                }
            }
                break;
            case DataTypes.DTYPE_CODE_DATE_TIME: {
                for (String[] stmts : basicDateTimeTypes) {
                    if (tokens.matches(stmts)) return true;
                }
            }
                break;
            case DataTypes.DTYPE_CODE_MISC: {
                for (String[] stmts : basicMiscTypes) {
                    if (tokens.matches(stmts)) return true;
                }
            }
                break;
        }

        return false;
    }
909235
private static void validateTypes(byte[] types) {
        if (types == null) {
            throw new IllegalArgumentException("types is null");
        }
        for (int i = 0; i < types.length; ++i) {
            if (types[i] < TYPE_MIN || types[i] > TYPE_MAX) {
                throw new IllegalArgumentException("illegal type value at " + i + ": " + types[i]);
            }
        }
        for (int i = 0; i < types.length - 1; ++i) {
            if (types[i] == B) {
                throw new IllegalArgumentException("B type before end of paragraph at index: " + i);
            }
        }
    }
469496
private final static boolean checkExpand(TypedArrayDecoder tad)
    {
        if (tad instanceof ValueDecoderFactory.BaseArrayDecoder) {
            ((ValueDecoderFactory.BaseArrayDecoder) tad).expand();
            return true;
        }
        return false;
    }
792399
@Override
  public boolean validateSegmentBoundary(Object o) throws IOException {
    if (o instanceof Double) {
      return validateWithSegmentBoundary((Double) o);
    } else {
      throw new IOException("incorrect type");
    }
  }
279323
@Override
    public void setDType(DataType dtype) {
        assert dtype == DataType.DOUBLE || dtype == DataType.FLOAT
                        || dtype == DataType.INT : "Invalid opType passed, must be float or double";
        // this.dtype = dtype;
    }
22794
@Override
    public void sawOpcode(int seen) {
        boolean sawSBToString = false;
        try {

            stack.precomputation(this);
            if ((seen >= Const.IRETURN) && (seen <= Const.ARETURN)) {
                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item item = stack.getStackItem(0);

                    Integer register = Integer.valueOf(item.getRegisterNumber());
                    Object constant = registerConstants.get(register);
                    if (CONSTANT_DOESNT_EXIST.equals(constant)) {
                        throw new StopOpcodeParsingException();
                    }

                    String returnSig = item.getSignature();
                    if ((returnSig != null) && returnSig.startsWith(Values.SIG_ARRAY_PREFIX)) {
                        XField f = item.getXField();
                        if ((f == null) || (!f.isStatic())) {
                            throw new StopOpcodeParsingException();
                        }
                    }

                    constant = item.getConstant();
                    if (constant == null) {
                        throw new StopOpcodeParsingException();
                    }
                    if (Boolean.TRUE.equals(item.getUserValue()) && ("".equals(constant))) {
                        throw new StopOpcodeParsingException();
                    }
                    if ((returnConstant != null) && (!returnConstant.equals(constant))) {
                        throw new StopOpcodeParsingException();
                    }

                    returnRegister = Integer.valueOf(item.getRegisterNumber());
                    returnConstant = constant;
                    returnPC = getPC();
                }
            } else if ((seen == Const.GOTO) || (seen == Const.GOTO_W)) {
                if (stack.getStackDepth() > 0) {
                    // Ternaries confuse us too much, if the code has a ternary well - oh well
                    throw new StopOpcodeParsingException();
                }
            } else if (seen == Const.ATHROW) {
                throw new StopOpcodeParsingException();
            } else if (seen == Const.INVOKEVIRTUAL) {
                String clsName = getClassConstantOperand();
                if (SignatureUtils.isPlainStringConvertableClass(clsName)) {
                    sawSBToString = Values.TOSTRING.equals(getNameConstantOperand());
                }
            } else if (((seen >= Const.ISTORE) && (seen <= Const.ASTORE_3)) || (seen == Const.IINC)) {
                Integer register = Integer.valueOf(getRegisterOperand());
                if ((returnRegister.intValue() != -1) && (register.equals(returnRegister))) {
                    throw new StopOpcodeParsingException();
                }

                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item item = stack.getStackItem(0);
                    Object constant = item.getConstant();

                    Object regConstant = registerConstants.get(register);
                    if (regConstant != null) {
                        if ((constant == null) || !constant.equals(regConstant)) {
                            registerConstants.put(register, CONSTANT_DOESNT_EXIST);
                        }
                    } else {
                        if (item.getSignature().contains(Values.SIG_ARRAY_PREFIX)) {
                            registerConstants.put(register, CONSTANT_DOESNT_EXIST);
                        } else {
                            registerConstants.put(register, constant == null ? CONSTANT_DOESNT_EXIST : constant);
                        }
                    }
                } else {
                    registerConstants.put(register, CONSTANT_DOESNT_EXIST);
                }

                if (returnRegister.equals(register)) {
                    Object constant = registerConstants.get(returnRegister);
                    if (CONSTANT_DOESNT_EXIST.equals(constant)) {
                        throw new StopOpcodeParsingException();
                    }
                }
            }

        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if (sawSBToString && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                item.setUserValue(Boolean.TRUE);
            }
        }
    }
659201
private void validateType(DynamicType<?> dynamicType) {
        int size = dynamicType.getMetadata().size();
        if (size == 1) {
            if (dynamicType.isAbstract()) {
                throw new XOException("Cannot create an instance of a single abstract type " + dynamicType);
            }
        } else if (dynamicType.isFinal()) {
            throw new XOException("Cannot create an instance overriding a final type " + dynamicType);
        }
    }
1166770
private void checkPrimitiveType(int accessor, int typeCode) throws JMFUninitializedAccessException, JMFSchemaViolationException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.entry(this, tc, "checkPrimitiveType", new Object[] { Integer.valueOf(accessor), Integer.valueOf(typeCode) });

        JSField field = getFieldDef(accessor, true);

        if (field == null) {
            JMFUninitializedAccessException e = new JMFUninitializedAccessException("Value at accessor " + accessor + " should not be present");
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                JmfTr.exit(this, tc, "checkPrimitiveType", e);
            throw e;
        }

        if (field instanceof JSPrimitive) {
            if (((JSPrimitive) field).getTypeCode() != typeCode) {
                JMFSchemaViolationException e = new JMFSchemaViolationException("Value at accessor " + accessor + " is incorrect type");
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    JmfTr.exit(this, tc, "checkPrimitiveType", e);
                throw e;
            }
            else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    JmfTr.exit(this, tc, "checkPrimitiveType");
                return;
            }
        }
        else if (field instanceof JSEnum && (typeCode == JMFPrimitiveType.INT)) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                JmfTr.exit(this, tc, "checkPrimitiveType");
            return;
        }
        else {
            JMFSchemaViolationException e = new JMFSchemaViolationException("Value at accessor " + accessor + " is incorrect");
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                JmfTr.exit(this, tc, "checkPrimitiveType", e);
            throw e;
        }
    }
1149774
private static void validateTypeStr(String typeStr) {
    if (typeStr.contains("[") || typeStr.contains("]")) {
      throw new IllegalArgumentException(
          String.format(
              "Cannot convert array types (%s), please build them using getType()", typeStr));
    }
    if (typeStr.contains("<") || typeStr.contains(">")) {
      throw new IllegalArgumentException(
          String.format(
              "Cannot convert generic types (%s), please build them using getType()", typeStr));
    }
  }
332803
private void writeTypedUInt(final int type, final long value)
    {
        if (value <= 0xFFL)
        {
            updateLength(2);
            buffer.writeUInt8(type | 0x01);
            buffer.writeUInt8(value);
        }
        else if (value <= 0xFFFFL)
        {
            updateLength(3);
            buffer.writeUInt8(type | 0x02);
            buffer.writeUInt16(value);
        }
        else if (value <= 0xFFFFFFL)
        {
            updateLength(4);
            buffer.writeUInt8(type | 0x03);
            buffer.writeUInt24(value);
        }
        else if (value <= 0xFFFFFFFFL)
        {
            updateLength(5);
            buffer.writeUInt8(type | 0x04);
            buffer.writeUInt32(value);
        }
        else if (value <= 0xFFFFFFFFFFL)
        {
            updateLength(6);
            buffer.writeUInt8(type | 0x05);
            buffer.writeUInt40(value);
        }
        else if (value <= 0xFFFFFFFFFFFFL)
        {
            updateLength(7);
            buffer.writeUInt8(type | 0x06);
            buffer.writeUInt48(value);
        }
        else if (value <= 0xFFFFFFFFFFFFFFL)
        {
            updateLength(8);
            buffer.writeUInt8(type | 0x07);
            buffer.writeUInt56(value);
        }
        else
        {
            updateLength(9);
            buffer.writeUInt8(type | 0x08);
            buffer.writeUInt64(value);
        }
    }
959781
function checkArrayTypes() {
  var t, i;
  for (i = 0; i < arguments.length; i++) {
     if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]')
       throw new TypeError('unexpected type ' + t + ', use Uint8Array');
  }
}