示例#1
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);
         }
     }
 }
示例#3
0
        /// <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);
        }
示例#4
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 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);
     }
 }
示例#6
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);
     }
 }
示例#7
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);
     }
 }
示例#8
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);
            }
        }
示例#9
0
 public void WriteInMicrosoftCPP(ICodeConverter converter)
 {
     converter.CurrentFunction.AddToSource(MicrosoftCPPConverter.Escape(this.defaultWriter) + ".Unindent();" + Environment.NewLine);
 }
示例#10
0
 public void WriteInMicrosoftCPP(ICodeConverter converter)
 {
     converter.CurrentFunction.AddToSource("$[left:" + MicrosoftCPPConverter.Escape(this.value.PrefixedName) + "] = this->GetArrayCount(wstring(L\"" + MicrosoftCPPConverter.Escape(this.tabName) + "\"));" + Environment.NewLine);
 }