summaryrefslogtreecommitdiff
path: root/macros/CCodeGeneration/C_FinalizeCode.sci
diff options
context:
space:
mode:
authorSiddhesh Wani2015-05-25 14:46:31 +0530
committerSiddhesh Wani2015-05-25 14:46:31 +0530
commitdb464f35f5a10b58d9ed1085e0b462689adee583 (patch)
treede5cdbc71a54765d9fec33414630ae2c8904c9b8 /macros/CCodeGeneration/C_FinalizeCode.sci
downloadScilab2C_fossee_old-db464f35f5a10b58d9ed1085e0b462689adee583.tar.gz
Scilab2C_fossee_old-db464f35f5a10b58d9ed1085e0b462689adee583.tar.bz2
Scilab2C_fossee_old-db464f35f5a10b58d9ed1085e0b462689adee583.zip
Original Version
Diffstat (limited to 'macros/CCodeGeneration/C_FinalizeCode.sci')
-rw-r--r--macros/CCodeGeneration/C_FinalizeCode.sci87
1 files changed, 87 insertions, 0 deletions
diff --git a/macros/CCodeGeneration/C_FinalizeCode.sci b/macros/CCodeGeneration/C_FinalizeCode.sci
new file mode 100644
index 0000000..5c26dd8
--- /dev/null
+++ b/macros/CCodeGeneration/C_FinalizeCode.sci
@@ -0,0 +1,87 @@
+function C_FinalizeCode(FileInfo,SharedInfo)
+// function C_FinalizeCode(FileInfo,SharedInfo)
+// -----------------------------------------------------------------
+// //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),2,2);
+
+// -----------------------
+// --- Initialization. ---
+// -----------------------
+// --- Load File Info Structure. ---
+load(FileInfoDatFile,'FileInfo');
+
+// --- Load Shared Info Structure. ---
+load(FileInfo.SharedInfoDatFile,'SharedInfo');
+
+CPass2FileName = FileInfo.Funct(SharedInfo.NextSCIFunNumber).CPass2FileName;
+FinalCFileName = FileInfo.Funct(SharedInfo.NextSCIFunNumber).FinalCFileName;
+Pass1HeaderFileName = FileInfo.Funct(SharedInfo.NextSCIFunNumber).Pass1HeaderFileName;
+FinalHeaderFileName = FileInfo.Funct(SharedInfo.NextSCIFunNumber).FinalHeaderFileName;
+// #RNU_RES_B
+PrintStringInfo('Generating the final C code in:'+FinalCFileName,...
+ FileInfo.Funct(SharedInfo.NextSCIFunNumber).ReportFileName,'file','y');
+// #RNU_RES_E
+// ---------------------------
+// --- End Initialization. ---
+// ---------------------------
+
+// ---------------------------------
+// --- Finalize the header file. ---
+// ---------------------------------
+PrintStringInfo('/*',Pass1HeaderFileName,'file','y');
+PrintStringInfo('** ---------------------------- ',Pass1HeaderFileName,'file','y');
+PrintStringInfo('** --- End USER2C Includes. --- ',Pass1HeaderFileName,'file','y');
+PrintStringInfo('** ---------------------------- ',Pass1HeaderFileName,'file','y');
+PrintStringInfo('*/',Pass1HeaderFileName,'file','y');
+PrintStringInfo('#endif',Pass1HeaderFileName,'file','y');
+// -------------------------------------
+// --- End Finalize the header file. ---
+// -------------------------------------
+
+[tmphdrpath,tmphdrname,tmphdrext] = fileparts(Pass1HeaderFileName);
+
+// #RNU_RES_B
+// --------------------------------------------------
+// --- Copy the C code into the C code directory. ---
+// --------------------------------------------------
+// #RNU_RES_E
+C_SCI2CHeader(FinalCFileName);
+PrintStringInfo('/*',FinalCFileName,'file','y');
+PrintStringInfo('** ----------------- ',FinalCFileName,'file','y');
+PrintStringInfo('** --- Includes. --- ',FinalCFileName,'file','y');
+PrintStringInfo('** ----------------- ',FinalCFileName,'file','y');
+PrintStringInfo('*/',FinalCFileName,'file','y');
+PrintStringInfo('#include ""'+tmphdrname+tmphdrext+'""',...
+ FinalCFileName,'file','y');
+PrintStringInfo('/*',FinalCFileName,'file','y');
+PrintStringInfo('** --------------------- ',FinalCFileName,'file','y');
+PrintStringInfo('** --- End Includes. --- ',FinalCFileName,'file','y');
+PrintStringInfo('** --------------------- ',FinalCFileName,'file','y');
+PrintStringInfo('*/',FinalCFileName,'file','y');
+PrintStringInfo(' ',FinalCFileName,'file','y');
+PrintStringInfo(' ',FinalCFileName,'file','y');
+PrintStringInfo(' ',FinalCFileName,'file','y');
+SCI2Ccopyfile(CPass2FileName,...
+ FinalCFileName,'append');
+SCI2Ccopyfile(Pass1HeaderFileName,...
+ FinalHeaderFileName,'append');
+
+
+endfunction