summaryrefslogtreecommitdiff
path: root/2.3-1/macros/CCodeGeneration
diff options
context:
space:
mode:
authorukashanoor2017-06-27 16:51:16 +0530
committerukashanoor2017-06-27 16:51:16 +0530
commit07340fdb9cf47753da9a30dd691d105757eaefd5 (patch)
tree891353df5f5f14b30dc97ecf16c526227f342010 /2.3-1/macros/CCodeGeneration
parentdf47b2d32bec63d0b2be8ed5bb1dba216be3bcfa (diff)
downloadScilab2C-07340fdb9cf47753da9a30dd691d105757eaefd5.tar.gz
Scilab2C-07340fdb9cf47753da9a30dd691d105757eaefd5.tar.bz2
Scilab2C-07340fdb9cf47753da9a30dd691d105757eaefd5.zip
matrix complete1
Diffstat (limited to '2.3-1/macros/CCodeGeneration')
-rw-r--r--2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.binbin24932 -> 29588 bytes
-rw-r--r--2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.sci67
2 files changed, 50 insertions, 17 deletions
diff --git a/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.bin b/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.bin
index ab05955d..7a4ed870 100644
--- a/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.bin
+++ b/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.bin
Binary files differ
diff --git a/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.sci b/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.sci
index 46d9de78..ab32ff1c 100644
--- a/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.sci
+++ b/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.sci
@@ -85,28 +85,61 @@ if (ArgStruct.Dimension > 0)
computedSizeField = computedSizeField + ', ' + ArgStruct.Size(sizeIterator);
end
Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+' '+ArgStruct.Name+'['+computedSize+']={';
- if com_type == 0
- for i = 1:NInArg-1
- Cdeclaration(1) = Cdeclaration(1)+InArg(i).Name+',';
- end
- Cdeclaration(1) = Cdeclaration(1)+InArg(NInArg).Name+'};';
- else
- for i=1:NInArg-1
- if InArg(i).Type <> 'z'
- Cdeclaration(1) = Cdeclaration(1)+InArg(i).Name+',0,';
- else
- Cdeclaration(1) = Cdeclaration(1)+InArg(i).Name+',';
- end
- end
- if InArg(NInArg).Type <> 'z'
- Cdeclaration(1) = Cdeclaration(1) + InArg(NInArg).Name + ',0};'
+ row = eval(ArgStruct.Size(1))
+ col = eval(ArgStruct.Size(2))
+ if row == 1
+ if com_type == 0
+ for i = 1:NInArg-1
+ Cdeclaration(1) = Cdeclaration(1)+InArg(i).Name+',';
+ end
+ Cdeclaration(1) = Cdeclaration(1)+InArg(NInArg).Name+'};';
else
- Cdeclaration(1) = Cdeclaration(1) + InArg(NInArg).Name + '};'
+ for i=1:NInArg-1
+ if InArg(i).Type <> 'z'
+ Cdeclaration(1) = Cdeclaration(1)+InArg(i).Name+',0,';
+ else
+ Cdeclaration(1) = Cdeclaration(1)+InArg(i).Name+',';
+ end
+ end
+ if InArg(NInArg).Type <> 'z'
+ Cdeclaration(1) = Cdeclaration(1) + InArg(NInArg).Name + ',0};'
+ else
+ Cdeclaration(1) = Cdeclaration(1) + InArg(NInArg).Name + '};'
+ end
end
+ else
+ if com_type == 0
+ for i = 1:col
+ for j = 0:row-1
+ if (j*col)+i ~= row*col
+ Cdeclaration(1) = Cdeclaration(1) + InArg(((j*col)+i)).Name + ',';
+ end
+ end
+ end
+ Cdeclaration(1) = Cdeclaration(1) + InArg(NInArg).Name + '};';
+ else
+ disp("hello")
+ for i = 1:col
+ for j = 0:row-1
+ if (j*col)+i ~= row*col
+ if InArg(((j*col)+i)).Type <> 'z'
+ Cdeclaration(1) = Cdeclaration(1) + InArg(((j*col)+i)).Name + ',0,';
+ else
+ Cdeclaration(1) = Cdeclaration(1) + InArg(((j*col)+i)).Name + ',';
+ end
+ end
+ end
+ end
+ if InArg(NInArg).Type <> 'z'
+ Cdeclaration(1) = Cdeclaration(1) + InArg(NInArg).Name + ',0};';
+ else
+ Cdeclaration(1) = Cdeclaration(1) + InArg(NInArg).Name + '};';
+ end
+ end
end
Cdeclaration(2) = Cdeclaration(2)+C_Type('i')+' __'+ArgStruct.Name+'Size['+string(computedSizeLength)+']';
if (FlagExt <> 1)
- Cdeclaration(2) = Cdeclaration(2)+' = {'+computedSizeField+'};';
+ Cdeclaration(2) = Cdeclaration(2)+' = {'+computedSizeField+'}';
end
Cdeclaration(2) = Cdeclaration(2)+';';
end