Exemplo n.º 1
0
        public void Add(int functionIndex, String functionName, int minParams, int maxParams,
                byte returnClassCode, byte[] parameterClassCodes, bool hasFootnote)
        {
            FunctionMetadata fm = new FunctionMetadata(functionIndex, functionName, minParams, maxParams,
                    returnClassCode, parameterClassCodes);

            int indexKey = functionIndex;


            if (functionIndex > _maxFunctionIndex)
            {
                _maxFunctionIndex = functionIndex;
            }
            // allow function definitions to Change only if both previous and the new items have footnotes
            FunctionMetadata prevFM;
            prevFM = (FunctionMetadata)_functionDataByName[functionName];
            if (prevFM != null)
            {
                if (!hasFootnote || !_mutatingFunctionIndexes.Contains(indexKey))
                {
                    throw new Exception("Multiple entries for function name '" + functionName + "'");
                }
                _functionDataByIndex.Remove(prevFM.Index);
            }
            prevFM = (FunctionMetadata)_functionDataByIndex[indexKey];
            if (prevFM != null)
            {
                if (!hasFootnote || !_mutatingFunctionIndexes.Contains(indexKey))
                {
                    throw new Exception("Multiple entries for function index (" + functionIndex + ")");
                }
                _functionDataByName.Remove(prevFM.Name);
            }
            if (hasFootnote)
            {
                _mutatingFunctionIndexes.Add(indexKey);
            }
            _functionDataByIndex[indexKey]=fm;
            _functionDataByName[functionName]=fm;
        }
Exemplo n.º 2
0
        public FunctionMetadataRegistry Build()
        {

            FunctionMetadata[] jumbledArray = new FunctionMetadata[_functionDataByName.Count];
            IEnumerator values = _functionDataByName.Values.GetEnumerator();
            FunctionMetadata[] fdIndexArray = new FunctionMetadata[_maxFunctionIndex + 1];
            while (values.MoveNext())
            {
                FunctionMetadata fd = (FunctionMetadata)values.Current;
                fdIndexArray[fd.Index] = fd;
            }

            return new FunctionMetadataRegistry(fdIndexArray, _functionDataByName);
        }
Exemplo n.º 3
0
 private FuncPtg(int funcIndex, FunctionMetadata fm):
     base(funcIndex, fm.ReturnClassCode, fm.ParameterClassCodes, fm.MinParams)  // minParams same as max since these are not var-arg funcs {
 {
 }
 /* package */
 public FunctionMetadataRegistry(FunctionMetadata[] functionDataByIndex, Hashtable functionDataByName)
 {
     _functionDataByIndex = functionDataByIndex;
     _functionDataByName = functionDataByName;
 }