summaryrefslogtreecommitdiff
path: root/2.3-1/macros/CCodeGeneration/C_IfElseBlocks.sci
diff options
context:
space:
mode:
Diffstat (limited to '2.3-1/macros/CCodeGeneration/C_IfElseBlocks.sci')
-rw-r--r--2.3-1/macros/CCodeGeneration/C_IfElseBlocks.sci68
1 files changed, 68 insertions, 0 deletions
diff --git a/2.3-1/macros/CCodeGeneration/C_IfElseBlocks.sci b/2.3-1/macros/CCodeGeneration/C_IfElseBlocks.sci
new file mode 100644
index 00000000..92ac94f7
--- /dev/null
+++ b/2.3-1/macros/CCodeGeneration/C_IfElseBlocks.sci
@@ -0,0 +1,68 @@
+function SharedInfo = C_IfElseBlocks(FileInfo,SharedInfo,InOutStatements)
+// function SharedInfo = C_IfElseBlocks(FileInfo,SharedInfo,InOutStatements)
+// -----------------------------------------------------------------
+// //NUT: add description here
+//
+// Input data:
+// //NUT: add description here
+//
+// Output data:
+// //NUT: add description here
+//
+// Status:
+// 27-Oct-2007 -- Raffaele Nutricato: Author.
+//
+// Copyright 2007 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),3,3);
+
+// -----------------------
+// --- Initialization. ---
+// -----------------------
+nxtscifunname = SharedInfo.NextSCIFunName;
+nxtscifunnumber = SharedInfo.NextSCIFunNumber;
+
+ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName;
+CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName;
+
+IndentLevel = SharedInfo.NIndent;
+
+// #RNU_RES_B
+PrintStringInfo(' ',ReportFileName,'file','y');
+PrintStringInfo(' Generate ""{"" or ""}"" code for if/else statement',ReportFileName,'file','y');
+// #RNU_RES_E
+CCall = '';
+// ---------------------------
+// --- End Initialization. ---
+// ---------------------------
+
+// #RNU_RES_B
+// -----------------------------------------------------
+// --- Generate the C call/Update indentation level. ---
+// -----------------------------------------------------
+// #RNU_RES_E
+if (InOutStatements=='in')
+ CCall = CCall+'{';
+ PrintStringInfo(' '+CCall,ReportFileName,'file','y');
+ PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y');
+ IndentLevel = IndentLevel + 1;
+elseif (InOutStatements=='out')
+ CCall = CCall+'}';
+ IndentLevel = IndentLevel - 1;
+ PrintStringInfo(' '+CCall,ReportFileName,'file','y');
+ PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y');
+else
+ error(9999, 'Unknown setting for InOutStatements: '+InOutStatements+'.');
+end
+
+// #RNU_RES_B
+PrintStringInfo(' Updating indentation level to:'+string(IndentLevel),ReportFileName,'file','y');
+// #RNU_RES_E
+SharedInfo.NIndent = IndentLevel;
+
+endfunction