Beispiel #1
0
 public void Convert(ICodeConverter converter, IProcessInstance proc, FinalFile file)
 {
     this.cachedProc = proc;
     if (proc.CurrentScope.Exists("CrLf"))
     {
         this.crlf = proc.CurrentScope.GetVariable("CrLf");
     }
     else
     {
         this.crlf       = new Variable(proc.Name, true);
         this.crlf.Value = @"\r\n";
     }
     if (proc.CurrentScope.Exists(proc.DefaultWriter))
     {
         this.defaultWriter = proc.CurrentScope.GetVariable(proc.DefaultWriter);
         if (!this.defaultWriter.IsGlobal)
         {
             this.cachedComp.UpdateParameters(converter, proc, this.defaultWriter.Name, true);
         }
         if (this.parts != null)
         {
             foreach (ICompiler c in this.parts)
             {
                 c.Convert(converter, proc, file);
             }
         }
         else
         {
             converter.Convert(this);
         }
     }
 }
 public void WriteInPowerShell(ICodeConverter converter)
 {
     if (this.isFromDict)
     {
         if (!this.defaultWriter.IsGlobal)
         {
             converter.CurrentFunction.AddToSource("WriteToFile S[byvalue:" + PowerShellConverter.Escape(this.defaultWriter.Name) + "] $theDict.GetString(\"" + PowerShellConverter.Escape(this.varName) + "\")" + Environment.NewLine);
         }
         else
         {
             converter.CurrentFunction.AddToSource("WriteToFile $" + PowerShellConverter.Escape(this.defaultWriter.Name) + " $theDict.GetString(\"" + PowerShellConverter.Escape(this.varName) + "\")" + Environment.NewLine);
         }
     }
     else
     {
         if (!this.defaultWriter.IsGlobal)
         {
             converter.CurrentFunction.AddToSource("WriteToFile S[byvalue:" + PowerShellConverter.Escape(this.defaultWriter.Name) + "] (S[byvalue:" + PowerShellConverter.Escape(this.varName) + "])" + Environment.NewLine);
         }
         else
         {
             converter.CurrentFunction.AddToSource("WriteToFile $" + PowerShellConverter.Escape(this.defaultWriter.Name) + " (S[byvalue:" + PowerShellConverter.Escape(this.varName) + "])" + Environment.NewLine);
         }
     }
 }
Beispiel #3
0
        public void WriteInMicrosoftCPP(ICodeConverter converter)
        {
            string currentDir = "wstring(L\"" + FinalFile.BuildDirectory.Replace("\\", "\\\\\\\\") + "\")";

            this.directories.ForEach(new Action <string>(delegate(string dir)
            {
                converter.CurrentFunction.AddToSource("this->CreateDirectoryIfNotExists(" + currentDir + " + " + dir.Replace("\\", "\\\\\\\\") + ");" + Environment.NewLine);
                currentDir += " + " + dir.Replace("\\", "\\\\\\\\") + " + wstring(L\"" + MicrosoftCPPConverter.Escape(Path.DirectorySeparatorChar.ToString()) + "\")";
            }));
            string completeFileName = "";
            bool   first            = true;

            this.fileName.ForEach(new Action <string>(delegate(string s)
            {
                if (!first)
                {
                    completeFileName += " + wstring(L\".\") + ";
                }
                else
                {
                    first = false;
                }
                completeFileName += s.Replace("\\", "\\\\\\\\");
            }));
            converter.CurrentFunction.AddToSource("this->EraseFile(" + currentDir + " + " + completeFileName + ");" + Environment.NewLine);
            converter.CurrentFunction.AddToSource("$[left:" + MicrosoftCPPConverter.Escape(this.newWriter.PrefixedName) + "] = writer(" + currentDir + " + " + completeFileName + ");" + Environment.NewLine);
            converter.CurrentFunction.AddToSource("$[ifptr:" + MicrosoftCPPConverter.Escape(this.newWriter.PrefixedName) + "]Start();" + Environment.NewLine);
        }
 public void WriteInMicrosoftCPP(ICodeConverter converter)
 {
     if (this.isFromDict)
     {
         if (!this.defaultWriter.IsGlobal)
         {
             converter.CurrentFunction.AddToSource("$[ifptr:" + MicrosoftCPPConverter.Escape(this.defaultWriter.PrefixedName) + "]WriteToFile(this->GetString(wstring(L\"" + MicrosoftCPPConverter.Escape(this.varName) + "\")));" + Environment.NewLine);
         }
         else
         {
             converter.CurrentFunction.AddToSource(MicrosoftCPPConverter.Escape(this.defaultWriter.PrefixedName) + ".WriteToFile(this->GetString(wstring(L\"" + MicrosoftCPPConverter.Escape(this.varName) + "\")));" + Environment.NewLine);
         }
     }
     else
     {
         if (!this.defaultWriter.IsGlobal)
         {
             converter.CurrentFunction.AddToSource("$[ifptr:" + MicrosoftCPPConverter.Escape(this.defaultWriter.PrefixedName) + "]WriteToFile($[byvalue:" + MicrosoftCPPConverter.Escape(this.value.PrefixedName) + "]);" + Environment.NewLine);
         }
         else
         {
             converter.CurrentFunction.AddToSource(MicrosoftCPPConverter.Escape(this.defaultWriter.PrefixedName) + ".WriteToFile($[byvalue:" + MicrosoftCPPConverter.Escape(this.value.PrefixedName) + "]);" + Environment.NewLine);
         }
     }
 }
        public void WriteInVBScript(ICodeConverter converter)
        {
            IFunction f = converter.ImplementedFunctions.Find(new Predicate <IFunction>(delegate(IFunction func)
            {
                return(func.Name == this.cachedProc.FunctionName);
            }));

            if (!converter.CallingFunctions.Exists(new Predicate <IFunction>(delegate(IFunction func) { return(func.StrictName == CallSkeleton.SpecialChars(this.Name) && func.InstanceNumber == f.InstanceNumber); })))
            {
                converter.CallingFunctions.Add(f);
            }
            converter.CurrentFunction.AddToSource((f.IsMacro ? "macro_" : f.IsJob ? "job_" : "func_") + f.Name + " ");
            bool          first = true;
            List <string> names = new List <string>();

            foreach (IParameter p in f.Parameters)
            {
                if (!names.Contains(p.VariableName))
                {
                    if (!first)
                    {
                        converter.CurrentFunction.AddToSource(", ");
                    }
                    else
                    {
                        first = false;
                    }
                    converter.CurrentFunction.AddToSource(p.VariableName);
                    names.Add(p.VariableName);
                }
            }
            converter.CurrentFunction.AddToSource(Environment.NewLine);
        }
Beispiel #6
0
        public void WriteInVBScript(ICodeConverter converter)
        {
            string currentDir = "\"" + FinalFile.BuildDirectory + "\"";

            this.directories.ForEach(new Action <string>(delegate(string dir)
            {
                converter.CurrentFunction.AddToSource("CreateDirectoryIfNotExists " + currentDir + " & " + dir + Environment.NewLine);
                currentDir += " & " + dir + " & \"" + Path.DirectorySeparatorChar + "\"";
            }));
            string completeFileName = "";
            bool   first            = true;

            this.fileName.ForEach(new Action <string>(delegate(string s)
            {
                if (!first)
                {
                    completeFileName += " & \".\" & ";
                }
                else
                {
                    first = false;
                }
                completeFileName += s;
            }));
            converter.CurrentFunction.AddToSource("EraseFile " + currentDir + " & " + completeFileName + Environment.NewLine);
            converter.CurrentFunction.AddToSource(this.newWriter.Name + " = Array(" + currentDir + " & " + completeFileName + ", 0, true)" + Environment.NewLine);
        }
        /// <summary>
        /// Special function for CPP conversion
        /// It's needed to confirm for each data type of formal parameters to be the same than the effective parameters
        /// if not, variable have to be converted in the good data type
        /// </summary>
        /// <param name="proc">process</param>
        /// <param name="converter">language converter instance</param>
        /// <param name="newFunc">new function</param>
        /// <returns>sequence call statement in CPP</returns>
        public static string MakeNewMethodForCPP(IProcess proc, ICodeConverter converter, IFunction newFunc)
        {
            string callStatement = String.Empty;

            callStatement = MicrosoftCPPConverter.Escape((newFunc.IsMacro ? "macro_" : newFunc.IsJob ? "job_" : "func_") + newFunc.Name + "(");
            bool first = true;

            foreach (IParameter p in newFunc.Parameters)
            {
                if (!first)
                {
                    callStatement += ", ";
                }
                else
                {
                    first = false;
                }
                if (p.IsMutableParameter)
                {
                    callStatement += "$[byref:" + p.EffectiveParameter + "]";
                }
                else
                {
                    callStatement += "$[byvalue:" + p.EffectiveParameter + "]";
                }
            }
            callStatement += ");" + Environment.NewLine;
            return(callStatement);
        }
Beispiel #8
0
        public void WriteInPowerShell(ICodeConverter converter)
        {
            string currentDir = "\"" + FinalFile.BuildDirectory + "\"";

            this.directories.ForEach(new Action <string>(delegate(string dir)
            {
                converter.CurrentFunction.AddToSource("CreateDirectoryIfNotExists (" + currentDir + " + " + dir + ")" + Environment.NewLine);
                currentDir += " + " + dir + " + \"" + PowerShellConverter.Escape(Path.DirectorySeparatorChar.ToString()) + "\"";
            }));
            string completeFileName = "";
            bool   first            = true;

            this.fileName.ForEach(new Action <string>(delegate(string s)
            {
                if (!first)
                {
                    completeFileName += " + \".\" + ";
                }
                else
                {
                    first = false;
                }
                completeFileName += s;
            }));
            converter.CurrentFunction.AddToSource("EraseFile (" + currentDir + " + " + completeFileName + ")" + Environment.NewLine);
            converter.CurrentFunction.AddToSource("S[left:" + PowerShellConverter.Escape(this.newWriter.Name) + "] = @((" + currentDir + " + " + completeFileName + ")" + ", 0, \"\", $true)" + Environment.NewLine);
        }
        /// <summary>
        /// Make a new function with the incremented instance number
        /// </summary>
        /// <param name="converter">language converter</param>
        /// <param name="proc">process object</param>
        /// <returns>a new function</returns>
        public static IFunction MakeNewMethod(ICodeConverter converter, IProcess proc)
        {
            IFunction f;
            string    funName = Process.ProcessAsFunction(proc.Name);

            if (Helper.NeedNewMethod(converter, proc, funName))
            {
                f                = new Function();
                f.StrictName     = funName;
                f.InstanceNumber = converter.ImplementedFunctions.FindAll(new Predicate <IFunction>(delegate(IFunction func)
                {
                    return(func.StrictName == funName);
                })).Count;
                converter.ImplementedFunctions.Add(f);
            }
            else
            {
                f = converter.ImplementedFunctions.FindLast(new Predicate <IFunction>(delegate(IFunction func)
                {
                    return(func.StrictName == funName);
                }));
                // je recrée la fonction
                Helper.ClearMethod(f);
            }
            return(f);
        }
 /// <summary>
 /// Verify if the function need to be renewed
 /// </summary>
 /// <param name="converter">language converter</param>
 /// <param name="curProc">process</param>
 /// <param name="newFunc">new function</param>
 /// <returns>true or false</returns>
 public static bool CheckNewMethod(ICodeConverter converter, IProcess curProc, IFunction newFunc)
 {
     return(curProc.HasChanged || !converter.ImplementedFunctions.Exists(new Predicate <IFunction>(delegate(IFunction func)
     {
         return newFunc.Equals(func) && newFunc.InstanceNumber != func.InstanceNumber;
     })));
 }
 /// <summary>
 /// Verify if a variable already exists in locals
 /// </summary>
 /// <param name="converter">language converter</param>
 /// <param name="f">funcion</param>
 /// <param name="var">variable object</param>
 /// <returns>true if is local</returns>
 public static bool IsLocal(ICodeConverter converter, IFunction f, IData var)
 {
     return(f.LocalVariables.Exists(new Predicate <IStructure>(delegate(IStructure st)
     {
         return (converter.IsStronglyTyped && st.PrefixedFieldName == var.PrefixedName) || (!converter.IsStronglyTyped && st.FieldName == var.Name);
     })));
 }
 /// <summary>
 /// Convert a newer variable or an existing variable.
 /// Keeps the current value of this variable.
 /// </summary>
 /// <param name="proc">process object</param>
 /// <param name="converter">converter object</param>
 /// <param name="varName">name of the variable</param>
 /// <param name="desiredDataType">data type to convert</param>
 /// <returns>the conversion string result</returns>
 public static string ConvertVariableType(IProcessInstance proc, ICodeConverter converter, string varName, EnumDataType desiredDataType)
 {
     // store the result in the scope with the varName parameter
     if (proc.CurrentScope.Exists(varName))
     {
         string result = String.Empty;
         // get the variable infos
         IData myVar = proc.CurrentScope.GetVariable(varName);
         // specific prefix is used with desired data type
         if (myVar.TypeExists(desiredDataType))
         {
             // if the desired data type is not the current type
             if (myVar.DataType != desiredDataType)
             {
                 TypedVariable tv = new TypedVariable(myVar.Name, myVar.Prefix, myVar.DataType, desiredDataType);
                 result = tv.MoveType(converter, proc.CurrentScope);
             }
         }
         else
         {
             TypedVariable tv = new TypedVariable(myVar.Name, myVar.Prefix, myVar.DataType, desiredDataType);
             result = tv.MoveType(converter, proc.CurrentScope);
         }
         return(result);
     }
     else
     {
         throw new ArgumentException("La variable '" + varName + "' n'existe pas dans le scope");
     }
 }
 /// <summary>
 /// Converts a newer variable or an existing variable
 /// The variable will be non computable after these changes
 /// </summary>
 /// <param name="proc">process object</param>
 /// <param name="converter">converter object</param>
 /// <param name="varName">name of the variable</param>
 /// <param name="desiredDataType">data type to convert</param>
 /// <returns>the variable (assumes to be present in the scope)</returns>
 private static IData ConvertNonComputableVariableType(IProcessInstance proc, ICodeConverter converter, string varName, EnumDataType desiredDataType)
 {
     // store the result in the scope with the varName parameter
     if (proc.CurrentScope.Exists(varName))
     {
         // get the variable infos
         IData myVar = proc.CurrentScope.GetVariable(varName);
         // specific prefix is used with desired data type
         if (myVar.TypeExists(desiredDataType))
         {
             // update variable, don't use value and assumes to be non-computable
             proc.CurrentScope.Update(varName, "0", myVar.PrefixInfo(desiredDataType).BelongsTo, false, desiredDataType);
         }
         else
         {
             // update variable, don't use value and assumes to be non-computable
             proc.CurrentScope.Update(varName, "0", myVar.BelongsTo, false, desiredDataType);
         }
         return(myVar);
     }
     else
     {
         // create variable, don't use value and assumes to be non-computable
         IData added = proc.CurrentScope.Add(varName, "0", proc.Name, false, desiredDataType);
         Helper.AddIntoLocal(converter, added);
         return(added);
     }
 }
 /// <summary>
 /// Add into the current local variable list (if not exists)
 /// </summary>
 /// <param name="converter">language converter</param>
 /// <param name="f">function</param>
 /// <param name="var">variable object</param>
 public static void AddIntoLocal(ICodeConverter converter, IFunction f, IData var)
 {
     if (!Helper.IsLocal(converter, f, var))
     {
         IStructure st = converter.CreateNewField(converter.RootStructureInstance, var, false);
         f.LocalVariables.Add(st);
     }
 }
 /// <summary>
 /// Verify if the function need to be renewed
 /// </summary>
 /// <param name="converter">language converter</param>
 /// <param name="proc">process object</param>
 /// <param name="funName">function name</param>
 /// <returns>true or false</returns>
 public static bool NeedNewMethod(ICodeConverter converter, IProcess proc, string funName)
 {
     return(proc.HasChanged ||
            !converter.ImplementedFunctions.Exists(new Predicate <IFunction>(delegate(IFunction func)
     {
         return func.StrictName == funName;
     })));
 }
        public CodeConverterShould()
        {
            var serviceProvider = new ServiceCollection()
                                  .AddCSharpToTypeScript()
                                  .BuildServiceProvider();

            _codeConverter = serviceProvider.GetRequiredService <ICodeConverter>();
        }
Beispiel #17
0
        public void Convert(ICodeConverter converter, IProcessInstance proc, FinalFile file)
        {
            // pas de test sur l'existence du tableau dans le dictionnaire
            IData res = Helper.ConvertNewExpression(this.cachedComp, proc, converter, this.expression);

            this.index = res.ValueString;
            // add a new variable or change an existing variable
            this.value = Helper.ConvertNewDictionaryArray(this.cachedComp, proc, converter, this.varName);
            converter.Convert(this);
        }
 public void Convert(ICodeConverter converter, IProcessInstance proc, FinalFile file)
 {
     if (converter.ImplementedFunctions.Exists(new Predicate <IFunction>(delegate(IFunction f) { return(f.StrictName == this.processName); })))
     {
         converter.Convert(this);
     }
     else
     {
         throw new Exception("Pour convertir le programme, les processus doivent être implémentés avant leur exécution; le processus '" + this.processName + "' n'a pas été déclaré.");
     }
 }
Beispiel #19
0
 public void WriteInPowerShell(ICodeConverter converter)
 {
     if (!this.defaultWriter.IsGlobal)
     {
         converter.CurrentFunction.AddToSource("WriteToFile S[byvalue:" + PowerShellConverter.Escape(this.defaultWriter.Name) + "] $" + PowerShellConverter.Escape(this.crlf.Name) + Environment.NewLine);
     }
     else
     {
         converter.CurrentFunction.AddToSource("WriteToFile $" + PowerShellConverter.Escape(this.defaultWriter.Name) + " $" + PowerShellConverter.Escape(this.crlf.Name) + Environment.NewLine);
     }
 }
Beispiel #20
0
 public void WriteInMicrosoftCPP(ICodeConverter converter)
 {
     if (!this.defaultWriter.IsGlobal)
     {
         converter.CurrentFunction.AddToSource("$[ifptr:" + MicrosoftCPPConverter.Escape(this.defaultWriter.PrefixedName) + "]WriteToFile(" + MicrosoftCPPConverter.Escape(this.crlf.PrefixedName) + ");" + Environment.NewLine);
     }
     else
     {
         converter.CurrentFunction.AddToSource(MicrosoftCPPConverter.Escape(this.defaultWriter.PrefixedName) + ".WriteToFile(" + MicrosoftCPPConverter.Escape(this.crlf.PrefixedName) + ");" + Environment.NewLine);
     }
 }
 public void WriteInPowerShell(ICodeConverter converter)
 {
     if (!this.result.IsGlobal)
     {
         converter.CurrentFunction.AddToSource("S[left:" + PowerShellConverter.Escape(this.varName) + "] = " + this.result.ValueString + Environment.NewLine);
     }
     else
     {
         converter.CurrentFunction.AddToSource("$" + PowerShellConverter.Escape(this.varName) + " = " + this.result.ValueString + Environment.NewLine);
     }
 }
 public void WriteInMicrosoftCPP(ICodeConverter converter)
 {
     if (!this.result.IsGlobal)
     {
         converter.CurrentFunction.AddToSource("$[left:" + MicrosoftCPPConverter.Escape(this.result.PrefixedName) + "] = " + this.result.ValueString + ";" + Environment.NewLine);
     }
     else
     {
         converter.CurrentFunction.AddToSource(MicrosoftCPPConverter.Escape(this.result.PrefixedName) + " = " + this.result.ValueString + ";" + Environment.NewLine);
     }
 }
Beispiel #23
0
 public void WriteInMicrosoftCPP(ICodeConverter converter)
 {
     if (!this.defaultWriter.IsGlobal)
     {
         converter.CurrentFunction.AddToSource("$[ifptr:" + MicrosoftCPPConverter.Escape(this.defaultWriter.PrefixedName) + "]WriteToFile(this->GetField(wstring(L\"" + MicrosoftCPPConverter.Escape(this.tabName) + "\"), " + this.index + ", wstring(L\"" + MicrosoftCPPConverter.Escape(this.fieldName) + "\")));" + Environment.NewLine);
     }
     else
     {
         converter.CurrentFunction.AddToSource(MicrosoftCPPConverter.Escape(this.defaultWriter.PrefixedName) + ".WriteToFile(this->GetField(wstring(L\"" + MicrosoftCPPConverter.Escape(this.tabName) + "\"), " + this.index + ", wstring(L\"" + MicrosoftCPPConverter.Escape(this.fieldName) + "\")));" + Environment.NewLine);
     }
 }
Beispiel #24
0
 public void WriteInPowerShell(ICodeConverter converter)
 {
     if (!this.defaultWriter.IsGlobal)
     {
         converter.CurrentFunction.AddToSource("WriteToFile S[byvalue:" + PowerShellConverter.Escape(this.defaultWriter.Name) + "] $theDict.GetArray(\"" + PowerShellConverter.Escape(this.tabName) + "\").Item(" + this.index + ").GetString(\"" + PowerShellConverter.Escape(this.fieldName) + "\")" + Environment.NewLine);
     }
     else
     {
         converter.CurrentFunction.AddToSource("WriteToFile $" + PowerShellConverter.Escape(this.defaultWriter.Name) + " $theDict.GetArray(\"" + PowerShellConverter.Escape(this.tabName) + "\").Item(" + this.index + ").GetString(\"" + PowerShellConverter.Escape(this.fieldName) + "\")" + Environment.NewLine);
     }
 }
Beispiel #25
0
 public void WriteInPowerShell(ICodeConverter converter)
 {
     if (!this.value.IsGlobal)
     {
         converter.CurrentFunction.AddToSource("S[left:" + PowerShellConverter.Escape(this.varName) + "] = $theDict.GetString(\"" + PowerShellConverter.Escape(this.stringName) + "\")" + Environment.NewLine);
     }
     else
     {
         converter.CurrentFunction.AddToSource("$" + PowerShellConverter.Escape(this.varName) + " = $theDict.GetString(\"" + PowerShellConverter.Escape(this.stringName) + "\")" + Environment.NewLine);
     }
 }
Beispiel #26
0
 public void WriteInMicrosoftCPP(ICodeConverter converter)
 {
     if (!this.value.IsGlobal)
     {
         converter.CurrentFunction.AddToSource("$[left:" + MicrosoftCPPConverter.Escape(value.PrefixedName) + "] = this->GetString(wstring(L\"" + MicrosoftCPPConverter.Escape(this.stringName) + "\"));" + Environment.NewLine);
     }
     else
     {
         converter.CurrentFunction.AddToSource(MicrosoftCPPConverter.Escape(value.PrefixedName) + " = this->GetString(wstring(L\"" + MicrosoftCPPConverter.Escape(this.stringName) + "\"));" + Environment.NewLine);
     }
 }
 public void WriteInVBScript(ICodeConverter converter)
 {
     if (this.isFromDict)
     {
         converter.CurrentFunction.AddToSource("WriteToFile " + this.defaultWriter.Name + ", theDict.GetString(\"" + this.varName + "\")" + Environment.NewLine);
     }
     else
     {
         converter.CurrentFunction.AddToSource("WriteToFile " + this.defaultWriter.Name + ", " + this.varName + Environment.NewLine);
     }
 }
        /// <summary>
        /// Call coding process
        /// </summary>
        /// <param name="comp">compilation</param>
        /// <param name="converter">language converter</param>
        /// <param name="ut">UseTemplate object</param>
        /// <param name="codingName">process name of coding</param>
        /// <param name="file">writing in</param>
        public static void CallCoding(ICompilateurInstance comp, ICodeConverter converter, UseTemplate ut, string codingName, FinalFile file)
        {
            Coding coding = ut.GetCoding(codingName);

            if (coding != null)
            {
                IProcess proc = comp.GetCodingProcess(coding.UniqueCodingName);
                proc.FunctionName = converter.ProcessAsFunction;
                comp.Convert(converter, proc, file);
                comp.RemoveCodingProcess(coding.UniqueCodingName);
            }
        }
Beispiel #29
0
        public void WriteInPowerShell(ICodeConverter converter)
        {
            string printed = this.text.Replace("\\", "\\\\").Replace("\"", "\"\"").Replace("S[", "\\S[").Replace("\r\n", "").Replace(" ", "").Replace("\t", "").Replace('·', ' ').Replace('¬', '\t').Replace("¶", "\" + $" + this.crlf.Name + " + \"");

            if (!this.defaultWriter.IsGlobal)
            {
                converter.CurrentFunction.AddToSource("WriteToFile S[byvalue:" + PowerShellConverter.Escape(this.defaultWriter.Name) + "] (\"" + printed + "\")" + Environment.NewLine);
            }
            else
            {
                converter.CurrentFunction.AddToSource("WriteToFile $" + PowerShellConverter.Escape(this.defaultWriter.Name) + " (\"" + printed + "\")" + Environment.NewLine);
            }
        }
Beispiel #30
0
        public void WriteInMicrosoftCPP(ICodeConverter converter)
        {
            string printed = this.text.Replace("\\", "\\\\").Replace("\"", "\\\"").Replace("\r\n", "").Replace("$[", "\\$[").Replace(" ", "").Replace("\t", "").Replace('·', ' ').Replace('¬', '\t').Replace("¶", "\") + " + this.crlf.PrefixedName + " + wstring(L\"");

            if (!this.defaultWriter.IsGlobal)
            {
                converter.CurrentFunction.AddToSource("$[ifptr:" + MicrosoftCPPConverter.Escape(this.defaultWriter.PrefixedName) + "]WriteToFile(wstring(L\"" + printed + "\"));" + Environment.NewLine);
            }
            else
            {
                converter.CurrentFunction.AddToSource(MicrosoftCPPConverter.Escape(this.defaultWriter.PrefixedName) + ".WriteToFile(wstring(L\"" + printed + "\"));" + Environment.NewLine);
            }
        }