Beispiel #1
0
 public CanCauseError <byte[]> GetDataUnit(IExpression <int>[] parameters, Func <string, int?> getSymbolValue, ScopeStructure <int> scope)
 {
     byte[] code = this.baseData.Clone() as byte[];
     localLabels.Clear();
     externLabels.Clear();
     for (int index = 0; index < parameters.Length; ++index)
     {
         TemplateParameter paramTemp = this[index];
         if (paramTemp.lenght > 0)
         {
             if (scope.GetRegisteredASMCLabels().Exists(o => o == parameters[index].ToString()) && !scope.IsLocalLabelExisted(parameters[index].ToString()))
             {
                 paramTemp.InsertValues(new int [1], code);
                 AddExternLabel(paramTemp.position / 8, parameters[index].ToString());
             }
             else
             {
                 CanCauseError <int[]> values = CodeTemplate.GetValues(parameters[index], paramTemp, getSymbolValue, this.pointerMaker);
                 if (values.CausedError)
                 {
                     return(values.ConvertError <byte[]>());
                 }
                 paramTemp.InsertValues(values.Result, code);
                 if (scope.IsLocalLabelExisted(parameters[index].ToString()))
                 {
                     localLabels.Add(paramTemp.position / 8, parameters[index].ToString());
                 }
             }
         }
     }
     return((CanCauseError <byte[]>)code);
 }
Beispiel #2
0
 private byte[] GetDataUnit(string[] text, ILog messageLog)
 {
     byte[] code = this.baseData.Clone() as byte[];
     for (int index1 = 1; index1 < text.Length; ++index1)
     {
         TemplateParameter templateParameter = this[index1 - 1];
         if (templateParameter.lenght > 0)
         {
             string[] strArray = text[index1].Trim('[', ']').Split(new char[1] {
                 ','
             }, templateParameter.maxDimensions, StringSplitOptions.RemoveEmptyEntries);
             int[] values = new int[strArray.Length];
             for (int index2 = 0; index2 < strArray.Length; ++index2)
             {
                 if (!strArray[index2].GetMathStringValue(out values[index2]))
                 {
                     messageLog.AddError(strArray[index2] + " is not a valid number.");
                 }
                 if (templateParameter.pointer)
                 {
                     values[index2] = this.pointerMaker.MakePointer(values[index2]);
                 }
             }
             templateParameter.InsertValues(values, code);
         }
     }
     return(code);
 }
 private CanCauseError <byte[]> GetDataUnit(IExpression <int>[] parameters, Func <string, int?> getSymbolValue)
 {
     byte[] code = this.baseData.Clone() as byte[];
     for (int index = 0; index < parameters.Length; ++index)
     {
         TemplateParameter paramTemp = this[index];
         if (paramTemp.lenght > 0)
         {
             CanCauseError <int[]> values = CodeTemplate.GetValues(parameters[index], paramTemp, getSymbolValue, this.pointerMaker);
             if (values.CausedError)
             {
                 return(values.ConvertError <byte[]>());
             }
             paramTemp.InsertValues(values.Result, code);
         }
     }
     return((CanCauseError <byte[]>)code);
 }