From 8b44229ef44f0558ce045e46ff833fb44df913c9 Mon Sep 17 00:00:00 2001 From: jofret Date: Mon, 21 Jun 2010 06:24:38 +0000 Subject: Tagging the 2.0 release of scilab2c --- macros/ASTManagement/%comment_string.sci | 7 + macros/ASTManagement/%cste_string.sci | 26 + macros/ASTManagement/%equal_string.sci | 16 + macros/ASTManagement/%for_string.sci | 15 + macros/ASTManagement/%funcall_string.sci | 15 + macros/ASTManagement/%ifthenel_string.sci | 27 + macros/ASTManagement/%operatio_string.sci | 13 + macros/ASTManagement/%program_p.sci | 4 + macros/ASTManagement/%program_string.sci | 19 + macros/ASTManagement/%variable_string.sci | 26 + macros/ASTManagement/%while_string.sci | 14 + macros/ASTManagement/AST2Ccode.sci | 246 ++ macros/ASTManagement/AST_CheckCommonInOutArgs.sci | 88 + macros/ASTManagement/AST_CheckLastFunc.sci | 77 + macros/ASTManagement/AST_CheckLineLength.sci | 29 + macros/ASTManagement/AST_CheckPrecSpecifier.sci | 82 + macros/ASTManagement/AST_DisplayStack.sci | 42 + macros/ASTManagement/AST_ExtractNameAndScope.sci | 93 + macros/ASTManagement/AST_GetASTFile.sci | 59 + macros/ASTManagement/AST_GetFuncallPrm.sci | 54 + macros/ASTManagement/AST_GetPrecAndLhsArg.sci | 99 + macros/ASTManagement/AST_HandleEOL.sci | 63 + macros/ASTManagement/AST_HandleEndFor.sci | 78 + macros/ASTManagement/AST_HandleEndGenFun.sci | 443 +++ macros/ASTManagement/AST_HandleEndProgram.sci | 62 + macros/ASTManagement/AST_HandleEndWhile.sci | 76 + macros/ASTManagement/AST_HandleFor.sci | 84 + macros/ASTManagement/AST_HandleForStatem.sci | 87 + macros/ASTManagement/AST_HandleHeader.sci | 245 ++ macros/ASTManagement/AST_HandleIfElse.sci | 92 + macros/ASTManagement/AST_HandleWhileExpr.sci | 80 + macros/ASTManagement/AST_HandleWhileStatem.sci | 119 + macros/ASTManagement/AST_ParseEqualStruct.sci | 168 + macros/ASTManagement/AST_ParseFuncallStruct.sci | 116 + macros/ASTManagement/AST_ParseIfExprStruct.sci | 119 + macros/ASTManagement/AST_ParseOperStruct.sci | 127 + macros/ASTManagement/AST_PopASTStack.sci | 40 + macros/ASTManagement/AST_PushASTStack.sci | 36 + macros/ASTManagement/AST_ReadASTHeader.sci | 90 + macros/ASTManagement/AST_ReadEqualRhsNames.sci | 61 + macros/ASTManagement/GenOutArgNames.sci | 89 + macros/ASTManagement/Operator2FunName.sci | 119 + macros/ASTManagement/SciFile2ASTFile.sci | 36 + macros/ASTManagement/buildmacros.sce | 15 + macros/ASTManagement/objectlist2string.sci | 13 + macros/CCodeGeneration/C_FinalizeCode.sci | 87 + macros/CCodeGeneration/C_ForExpression.sci | 217 ++ macros/CCodeGeneration/C_Funcall.sci | 395 +++ macros/CCodeGeneration/C_GenDeclarations.sci | 133 + macros/CCodeGeneration/C_GenerateFunName.sci | 45 + macros/CCodeGeneration/C_GenerateLaunchScript.sci | 86 + macros/CCodeGeneration/C_GenerateMakefile.sci | 133 + macros/CCodeGeneration/C_GenerateMakefile_msvc.sci | 110 + macros/CCodeGeneration/C_IfElseBlocks.sci | 68 + macros/CCodeGeneration/C_IfExpression.sci | 91 + macros/CCodeGeneration/C_IndentBlanks.sci | 31 + macros/CCodeGeneration/C_InitHeader.sci | 68 + macros/CCodeGeneration/C_MemAllocOutTempVars.sci | 64 + macros/CCodeGeneration/C_SCI2CHeader.sci | 41 + macros/CCodeGeneration/C_Type.sci | 41 + macros/CCodeGeneration/C_WhileExpression.sci | 93 + macros/CCodeGeneration/GenCFunDatFiles.sci | 73 + macros/CCodeGeneration/GetClsFileName.sci | 95 + macros/CCodeGeneration/GetSymbolDimension.sci | 70 + macros/CCodeGeneration/GetWhileCondVariable.sci | 72 + macros/CCodeGeneration/JoinDeclarAndCcode.sci | 168 + macros/CCodeGeneration/SCI2CMakefileTemplate.bkp | 230 ++ macros/CCodeGeneration/SCI2CMakefileTemplate.bkp1 | 230 ++ macros/CCodeGeneration/SCI2CMakefileTemplate.bkp2 | 126 + macros/CCodeGeneration/SCI2CMakefileTemplate.rc | 548 +++ macros/CCodeGeneration/Sci2AnnotationFile.sci | 55 + macros/CCodeGeneration/buildmacros.sce | 15 + macros/CFiles/sci2ccode/ConvertPrecision.c | 41 + macros/CFiles/sci2ccode/FileManagement.c | 12 + macros/CFiles/sci2ccode/OpEqual.c | 90 + macros/CFiles/sci2ccode/OpExt.c | 11 + macros/CFiles/sci2ccode/OpIns.c | 11 + macros/CFiles/sci2ccode/OpLogAnd.c | 38 + macros/CFiles/sci2ccode/OpLogGe.c | 37 + macros/CFiles/sci2ccode/OpLogGt.c | 37 + macros/CFiles/sci2ccode/OpLogLe.c | 37 + macros/CFiles/sci2ccode/OpLogLt.c | 37 + macros/CFiles/sci2ccode/OpLogOr.c | 38 + macros/CFiles/sci2ccode/RealToComplex.c | 134 + macros/CFiles/sci2ccode/SCI2Cconvol.c | 2 + macros/CFiles/sci2ccode/SCI2Cfft.c | 13 + macros/CFiles/sci2cincludes/ConvertPrecision.h | 18 + macros/CFiles/sci2cincludes/FileManagement.h | 13 + macros/CFiles/sci2cincludes/OpEqual.h | 33 + macros/CFiles/sci2cincludes/OpExt.h | 108 + macros/CFiles/sci2cincludes/OpLogAnd.h | 23 + macros/CFiles/sci2cincludes/OpLogGe.h | 36 + macros/CFiles/sci2cincludes/OpLogLe.h | 37 + macros/CFiles/sci2cincludes/OpLogLt.h | 35 + macros/CFiles/sci2cincludes/OpLogOr.h | 23 + macros/CFiles/sci2cincludes/RealToComplex.h | 33 + macros/CFiles/sci2cincludes/SCI2CMacroInterface.h | 281 ++ macros/CFiles/sci2cincludes/SCI2Cconvol.h | 15 + macros/CFiles/sci2cincludes/SCI2Cfft.h | 16 + macros/CFiles/sci2cincludes/notFound.h | 18 + macros/CFiles/sci2cobj/readme.txt | 2 + macros/ErrorMessages/EM_NanSize.sci | 82 + macros/ErrorMessages/EM_UnknownStep.sci | 70 + macros/ErrorMessages/EM_ZeroSize.sci | 27 + macros/ErrorMessages/buildmacros.sce | 15 + macros/FunctionAnnotation/FA_ADD.sci | 43 + macros/FunctionAnnotation/FA_DIV.sci | 41 + .../FunctionAnnotation/FA_GetDefaultPrecision.sci | 86 + macros/FunctionAnnotation/FA_GetFunAnn.sci | 206 ++ macros/FunctionAnnotation/FA_GetOutArgInfo.sci | 142 + macros/FunctionAnnotation/FA_GetResizeApproach.sci | 79 + macros/FunctionAnnotation/FA_INT.sci | 40 + macros/FunctionAnnotation/FA_MAX.sci | 52 + macros/FunctionAnnotation/FA_MIN.sci | 45 + macros/FunctionAnnotation/FA_MUL.sci | 42 + macros/FunctionAnnotation/FA_REAL.sci | 50 + macros/FunctionAnnotation/FA_SUB.sci | 41 + macros/FunctionAnnotation/FA_SZ_1.sci | 20 + macros/FunctionAnnotation/FA_SZ_2.sci | 20 + macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci | 36 + macros/FunctionAnnotation/FA_SZ_OPAPEX.sci | 26 + macros/FunctionAnnotation/FA_SZ_OPBACKSLASH.sci | 39 + macros/FunctionAnnotation/FA_SZ_OPCC.sci | 40 + macros/FunctionAnnotation/FA_SZ_OPDOTAPEX.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPDOTBACKSLASH.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPDOTHAT.sci | 43 + macros/FunctionAnnotation/FA_SZ_OPDOTSLASH.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPDOTSTAR.sci | 32 + macros/FunctionAnnotation/FA_SZ_OPHAT.sci | 43 + macros/FunctionAnnotation/FA_SZ_OPLOGAND.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPLOGEQ.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPLOGGE.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPLOGGT.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPLOGLE.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPLOGLT.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPLOGNE.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPLOGNOT.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPLOGOR.sci | 16 + macros/FunctionAnnotation/FA_SZ_OPMINUS.sci | 51 + macros/FunctionAnnotation/FA_SZ_OPPLUS.sci | 93 + macros/FunctionAnnotation/FA_SZ_OPPLUSA.sci | 66 + macros/FunctionAnnotation/FA_SZ_OPRC.sci | 40 + macros/FunctionAnnotation/FA_SZ_OPSLASH.sci | 37 + macros/FunctionAnnotation/FA_SZ_OPSTAR.sci | 68 + macros/FunctionAnnotation/FA_SZ_SEL1.sci | 48 + macros/FunctionAnnotation/FA_SZ_SEL2.sci | 44 + macros/FunctionAnnotation/FA_TP_C.sci | 32 + macros/FunctionAnnotation/FA_TP_COMPLEX.sci | 42 + macros/FunctionAnnotation/FA_TP_D.sci | 32 + macros/FunctionAnnotation/FA_TP_I.sci | 32 + macros/FunctionAnnotation/FA_TP_MAX.sci | 45 + macros/FunctionAnnotation/FA_TP_MIN_REAL.sci | 35 + macros/FunctionAnnotation/FA_TP_REAL.sci | 38 + macros/FunctionAnnotation/FA_TP_S.sci | 32 + macros/FunctionAnnotation/FA_TP_USER.sci | 38 + macros/FunctionAnnotation/FA_TP_Z.sci | 32 + macros/FunctionAnnotation/buildmacros.sce | 15 + macros/FunctionList/FL_ExistCFunction.sci | 106 + macros/FunctionList/FL_ExtractFuncList.sci | 62 + macros/FunctionList/FL_GetFunctionClass.sci | 54 + macros/FunctionList/FL_InOutArgs2CFunNames.sci | 52 + macros/FunctionList/FL_UpdateConverted.sci | 46 + macros/FunctionList/FL_UpdateToBeConv.sci | 114 + macros/FunctionList/buildmacros.sce | 15 + macros/GeneralFunctions/Array2String.sci | 40 + macros/GeneralFunctions/ConvertPathMat2C.sci | 61 + macros/GeneralFunctions/File2StringArray.sci | 54 + macros/GeneralFunctions/FunName2SciFileName.sci | 56 + macros/GeneralFunctions/IsNanSize.sci | 39 + macros/GeneralFunctions/KeyStr2FileStrPos.sci | 83 + macros/GeneralFunctions/PrintStepInfo.sci | 71 + macros/GeneralFunctions/PrintStringInfo.sci | 69 + macros/GeneralFunctions/ReadStringCard.sci | 61 + macros/GeneralFunctions/SCI2CCreateDir.sci | 31 + macros/GeneralFunctions/SCI2CFindFile.sci | 41 + macros/GeneralFunctions/SCI2CNInArgCheck.sci | 28 + macros/GeneralFunctions/SCI2COpenFileRead.sci | 30 + macros/GeneralFunctions/SCI2COpenFileWrite.sci | 30 + macros/GeneralFunctions/SCI2CTemplate.sci | 32 + macros/GeneralFunctions/SCI2Ccopyfile.sci | 49 + macros/GeneralFunctions/SCI2Cerror.sci | 28 + macros/GeneralFunctions/SCI2CerrorFile.sci | 29 + macros/GeneralFunctions/SCI2Cfileexist.sci | 38 + macros/GeneralFunctions/SCI2Cflipud.sci | 40 + macros/GeneralFunctions/SCI2Cmdelete.sci | 33 + macros/GeneralFunctions/SCI2Cresize.sci | 33 + macros/GeneralFunctions/SCI2Cstring.sci | 34 + macros/GeneralFunctions/SCI2Cstrncmp.sci | 27 + macros/GeneralFunctions/SCI2Cstrncmps1size.sci | 32 + macros/GeneralFunctions/SizeInByte.sci | 41 + macros/GeneralFunctions/buildmacros.sce | 15 + macros/GeneralFunctions/dispina.sci | 31 + macros/GeneralFunctions/filenamefprintf.sci | 48 + macros/GeneralFunctions/float.sci | 26 + macros/GeneralFunctions/squeezestrings.sci | 31 + macros/SymbolTable/ST_AnalyzeScope.sci | 124 + macros/SymbolTable/ST_Del.sci | 41 + macros/SymbolTable/ST_FindPos.sci | 46 + macros/SymbolTable/ST_Get.sci | 66 + macros/SymbolTable/ST_GetInArgInfo.sci | 162 + macros/SymbolTable/ST_GetSymbolInfo.sci | 99 + macros/SymbolTable/ST_InsForCntVars.sci | 191 + macros/SymbolTable/ST_InsOutArg.sci | 187 + macros/SymbolTable/ST_Load.sci | 36 + macros/SymbolTable/ST_MatchSymbol.sci | 70 + macros/SymbolTable/ST_Save.sci | 44 + macros/SymbolTable/ST_Set.sci | 49 + macros/SymbolTable/buildmacros.sce | 15 + macros/ToolInitialization/INIT_CreateDirs.sci | 65 + .../ToolInitialization/INIT_FillSCI2LibCDirs.sci | 3645 ++++++++++++++++++++ .../ToolInitialization/INIT_GenAnnFLFunctions.sci | 28 + macros/ToolInitialization/INIT_GenFileInfo.sci | 112 + macros/ToolInitialization/INIT_GenLibraries.sci | 61 + macros/ToolInitialization/INIT_GenSharedInfo.sci | 118 + macros/ToolInitialization/INIT_LoadLibraries.sci | 64 + macros/ToolInitialization/INIT_RemoveDirs.sci | 71 + macros/ToolInitialization/INIT_SCI2C.sci | 151 + macros/ToolInitialization/INIT_SCI2CLoader.sce | 72 + macros/ToolInitialization/INIT_SharedInfoEqual.sci | 43 + macros/ToolInitialization/ManageNextConversion.sci | 87 + macros/ToolInitialization/SCI2CInputParameters.bkp | 87 + macros/ToolInitialization/SCI2CInputParameters.sce | 87 + macros/ToolInitialization/UpdateSCI2CInfo.sci | 203 ++ macros/ToolInitialization/buildmacros.sce | 15 + macros/ToolInitialization/doublecomplex.sci | 26 + macros/ToolInitialization/floatcomplex.sci | 26 + macros/buildmacros.sce | 32 + macros/cb_sci2c_gui.sci | 135 + macros/findDeps/Scilab2CDeps.sci | 749 ++++ macros/findDeps/buildmacros.sce | 15 + macros/findDeps/findDeps.sci | 44 + macros/findDeps/getAllHeaders.sci | 123 + macros/findDeps/getAllInterfaces.sci | 117 + macros/findDeps/getAllSources.sci | 607 ++++ macros/full_reset.sce | 22 + macros/runsci2c.sci | 176 + macros/runscicode.sci | 67 + macros/sci2c_gui.sci | 421 +++ macros/scilab2c.sci | 130 + 239 files changed, 20934 insertions(+) create mode 100644 macros/ASTManagement/%comment_string.sci create mode 100644 macros/ASTManagement/%cste_string.sci create mode 100644 macros/ASTManagement/%equal_string.sci create mode 100644 macros/ASTManagement/%for_string.sci create mode 100644 macros/ASTManagement/%funcall_string.sci create mode 100644 macros/ASTManagement/%ifthenel_string.sci create mode 100644 macros/ASTManagement/%operatio_string.sci create mode 100644 macros/ASTManagement/%program_p.sci create mode 100644 macros/ASTManagement/%program_string.sci create mode 100644 macros/ASTManagement/%variable_string.sci create mode 100644 macros/ASTManagement/%while_string.sci create mode 100644 macros/ASTManagement/AST2Ccode.sci create mode 100644 macros/ASTManagement/AST_CheckCommonInOutArgs.sci create mode 100644 macros/ASTManagement/AST_CheckLastFunc.sci create mode 100644 macros/ASTManagement/AST_CheckLineLength.sci create mode 100644 macros/ASTManagement/AST_CheckPrecSpecifier.sci create mode 100644 macros/ASTManagement/AST_DisplayStack.sci create mode 100644 macros/ASTManagement/AST_ExtractNameAndScope.sci create mode 100644 macros/ASTManagement/AST_GetASTFile.sci create mode 100644 macros/ASTManagement/AST_GetFuncallPrm.sci create mode 100644 macros/ASTManagement/AST_GetPrecAndLhsArg.sci create mode 100644 macros/ASTManagement/AST_HandleEOL.sci create mode 100644 macros/ASTManagement/AST_HandleEndFor.sci create mode 100644 macros/ASTManagement/AST_HandleEndGenFun.sci create mode 100644 macros/ASTManagement/AST_HandleEndProgram.sci create mode 100644 macros/ASTManagement/AST_HandleEndWhile.sci create mode 100644 macros/ASTManagement/AST_HandleFor.sci create mode 100644 macros/ASTManagement/AST_HandleForStatem.sci create mode 100644 macros/ASTManagement/AST_HandleHeader.sci create mode 100644 macros/ASTManagement/AST_HandleIfElse.sci create mode 100644 macros/ASTManagement/AST_HandleWhileExpr.sci create mode 100644 macros/ASTManagement/AST_HandleWhileStatem.sci create mode 100644 macros/ASTManagement/AST_ParseEqualStruct.sci create mode 100644 macros/ASTManagement/AST_ParseFuncallStruct.sci create mode 100644 macros/ASTManagement/AST_ParseIfExprStruct.sci create mode 100644 macros/ASTManagement/AST_ParseOperStruct.sci create mode 100644 macros/ASTManagement/AST_PopASTStack.sci create mode 100644 macros/ASTManagement/AST_PushASTStack.sci create mode 100644 macros/ASTManagement/AST_ReadASTHeader.sci create mode 100644 macros/ASTManagement/AST_ReadEqualRhsNames.sci create mode 100644 macros/ASTManagement/GenOutArgNames.sci create mode 100644 macros/ASTManagement/Operator2FunName.sci create mode 100644 macros/ASTManagement/SciFile2ASTFile.sci create mode 100644 macros/ASTManagement/buildmacros.sce create mode 100644 macros/ASTManagement/objectlist2string.sci create mode 100644 macros/CCodeGeneration/C_FinalizeCode.sci create mode 100644 macros/CCodeGeneration/C_ForExpression.sci create mode 100644 macros/CCodeGeneration/C_Funcall.sci create mode 100644 macros/CCodeGeneration/C_GenDeclarations.sci create mode 100644 macros/CCodeGeneration/C_GenerateFunName.sci create mode 100644 macros/CCodeGeneration/C_GenerateLaunchScript.sci create mode 100644 macros/CCodeGeneration/C_GenerateMakefile.sci create mode 100644 macros/CCodeGeneration/C_GenerateMakefile_msvc.sci create mode 100644 macros/CCodeGeneration/C_IfElseBlocks.sci create mode 100644 macros/CCodeGeneration/C_IfExpression.sci create mode 100644 macros/CCodeGeneration/C_IndentBlanks.sci create mode 100644 macros/CCodeGeneration/C_InitHeader.sci create mode 100644 macros/CCodeGeneration/C_MemAllocOutTempVars.sci create mode 100644 macros/CCodeGeneration/C_SCI2CHeader.sci create mode 100644 macros/CCodeGeneration/C_Type.sci create mode 100644 macros/CCodeGeneration/C_WhileExpression.sci create mode 100644 macros/CCodeGeneration/GenCFunDatFiles.sci create mode 100644 macros/CCodeGeneration/GetClsFileName.sci create mode 100644 macros/CCodeGeneration/GetSymbolDimension.sci create mode 100644 macros/CCodeGeneration/GetWhileCondVariable.sci create mode 100644 macros/CCodeGeneration/JoinDeclarAndCcode.sci create mode 100644 macros/CCodeGeneration/SCI2CMakefileTemplate.bkp create mode 100644 macros/CCodeGeneration/SCI2CMakefileTemplate.bkp1 create mode 100644 macros/CCodeGeneration/SCI2CMakefileTemplate.bkp2 create mode 100644 macros/CCodeGeneration/SCI2CMakefileTemplate.rc create mode 100644 macros/CCodeGeneration/Sci2AnnotationFile.sci create mode 100644 macros/CCodeGeneration/buildmacros.sce create mode 100644 macros/CFiles/sci2ccode/ConvertPrecision.c create mode 100644 macros/CFiles/sci2ccode/FileManagement.c create mode 100644 macros/CFiles/sci2ccode/OpEqual.c create mode 100644 macros/CFiles/sci2ccode/OpExt.c create mode 100644 macros/CFiles/sci2ccode/OpIns.c create mode 100644 macros/CFiles/sci2ccode/OpLogAnd.c create mode 100644 macros/CFiles/sci2ccode/OpLogGe.c create mode 100644 macros/CFiles/sci2ccode/OpLogGt.c create mode 100644 macros/CFiles/sci2ccode/OpLogLe.c create mode 100644 macros/CFiles/sci2ccode/OpLogLt.c create mode 100644 macros/CFiles/sci2ccode/OpLogOr.c create mode 100644 macros/CFiles/sci2ccode/RealToComplex.c create mode 100644 macros/CFiles/sci2ccode/SCI2Cconvol.c create mode 100644 macros/CFiles/sci2ccode/SCI2Cfft.c create mode 100644 macros/CFiles/sci2cincludes/ConvertPrecision.h create mode 100644 macros/CFiles/sci2cincludes/FileManagement.h create mode 100644 macros/CFiles/sci2cincludes/OpEqual.h create mode 100644 macros/CFiles/sci2cincludes/OpExt.h create mode 100644 macros/CFiles/sci2cincludes/OpLogAnd.h create mode 100644 macros/CFiles/sci2cincludes/OpLogGe.h create mode 100644 macros/CFiles/sci2cincludes/OpLogLe.h create mode 100644 macros/CFiles/sci2cincludes/OpLogLt.h create mode 100644 macros/CFiles/sci2cincludes/OpLogOr.h create mode 100644 macros/CFiles/sci2cincludes/RealToComplex.h create mode 100644 macros/CFiles/sci2cincludes/SCI2CMacroInterface.h create mode 100644 macros/CFiles/sci2cincludes/SCI2Cconvol.h create mode 100644 macros/CFiles/sci2cincludes/SCI2Cfft.h create mode 100644 macros/CFiles/sci2cincludes/notFound.h create mode 100644 macros/CFiles/sci2cobj/readme.txt create mode 100644 macros/ErrorMessages/EM_NanSize.sci create mode 100644 macros/ErrorMessages/EM_UnknownStep.sci create mode 100644 macros/ErrorMessages/EM_ZeroSize.sci create mode 100644 macros/ErrorMessages/buildmacros.sce create mode 100644 macros/FunctionAnnotation/FA_ADD.sci create mode 100644 macros/FunctionAnnotation/FA_DIV.sci create mode 100644 macros/FunctionAnnotation/FA_GetDefaultPrecision.sci create mode 100644 macros/FunctionAnnotation/FA_GetFunAnn.sci create mode 100644 macros/FunctionAnnotation/FA_GetOutArgInfo.sci create mode 100644 macros/FunctionAnnotation/FA_GetResizeApproach.sci create mode 100644 macros/FunctionAnnotation/FA_INT.sci create mode 100644 macros/FunctionAnnotation/FA_MAX.sci create mode 100644 macros/FunctionAnnotation/FA_MIN.sci create mode 100644 macros/FunctionAnnotation/FA_MUL.sci create mode 100644 macros/FunctionAnnotation/FA_REAL.sci create mode 100644 macros/FunctionAnnotation/FA_SUB.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_1.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_2.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPAPEX.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPBACKSLASH.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPCC.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPDOTAPEX.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPDOTBACKSLASH.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPDOTHAT.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPDOTSLASH.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPDOTSTAR.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPHAT.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPLOGAND.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPLOGEQ.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPLOGGE.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPLOGGT.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPLOGLE.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPLOGLT.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPLOGNE.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPLOGNOT.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPLOGOR.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPMINUS.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPPLUS.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPPLUSA.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPRC.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPSLASH.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_OPSTAR.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_SEL1.sci create mode 100644 macros/FunctionAnnotation/FA_SZ_SEL2.sci create mode 100644 macros/FunctionAnnotation/FA_TP_C.sci create mode 100644 macros/FunctionAnnotation/FA_TP_COMPLEX.sci create mode 100644 macros/FunctionAnnotation/FA_TP_D.sci create mode 100644 macros/FunctionAnnotation/FA_TP_I.sci create mode 100644 macros/FunctionAnnotation/FA_TP_MAX.sci create mode 100644 macros/FunctionAnnotation/FA_TP_MIN_REAL.sci create mode 100644 macros/FunctionAnnotation/FA_TP_REAL.sci create mode 100644 macros/FunctionAnnotation/FA_TP_S.sci create mode 100644 macros/FunctionAnnotation/FA_TP_USER.sci create mode 100644 macros/FunctionAnnotation/FA_TP_Z.sci create mode 100644 macros/FunctionAnnotation/buildmacros.sce create mode 100644 macros/FunctionList/FL_ExistCFunction.sci create mode 100644 macros/FunctionList/FL_ExtractFuncList.sci create mode 100644 macros/FunctionList/FL_GetFunctionClass.sci create mode 100644 macros/FunctionList/FL_InOutArgs2CFunNames.sci create mode 100644 macros/FunctionList/FL_UpdateConverted.sci create mode 100644 macros/FunctionList/FL_UpdateToBeConv.sci create mode 100644 macros/FunctionList/buildmacros.sce create mode 100644 macros/GeneralFunctions/Array2String.sci create mode 100644 macros/GeneralFunctions/ConvertPathMat2C.sci create mode 100644 macros/GeneralFunctions/File2StringArray.sci create mode 100644 macros/GeneralFunctions/FunName2SciFileName.sci create mode 100644 macros/GeneralFunctions/IsNanSize.sci create mode 100644 macros/GeneralFunctions/KeyStr2FileStrPos.sci create mode 100644 macros/GeneralFunctions/PrintStepInfo.sci create mode 100644 macros/GeneralFunctions/PrintStringInfo.sci create mode 100644 macros/GeneralFunctions/ReadStringCard.sci create mode 100644 macros/GeneralFunctions/SCI2CCreateDir.sci create mode 100644 macros/GeneralFunctions/SCI2CFindFile.sci create mode 100644 macros/GeneralFunctions/SCI2CNInArgCheck.sci create mode 100644 macros/GeneralFunctions/SCI2COpenFileRead.sci create mode 100644 macros/GeneralFunctions/SCI2COpenFileWrite.sci create mode 100644 macros/GeneralFunctions/SCI2CTemplate.sci create mode 100644 macros/GeneralFunctions/SCI2Ccopyfile.sci create mode 100644 macros/GeneralFunctions/SCI2Cerror.sci create mode 100644 macros/GeneralFunctions/SCI2CerrorFile.sci create mode 100644 macros/GeneralFunctions/SCI2Cfileexist.sci create mode 100644 macros/GeneralFunctions/SCI2Cflipud.sci create mode 100644 macros/GeneralFunctions/SCI2Cmdelete.sci create mode 100644 macros/GeneralFunctions/SCI2Cresize.sci create mode 100644 macros/GeneralFunctions/SCI2Cstring.sci create mode 100644 macros/GeneralFunctions/SCI2Cstrncmp.sci create mode 100644 macros/GeneralFunctions/SCI2Cstrncmps1size.sci create mode 100644 macros/GeneralFunctions/SizeInByte.sci create mode 100644 macros/GeneralFunctions/buildmacros.sce create mode 100644 macros/GeneralFunctions/dispina.sci create mode 100644 macros/GeneralFunctions/filenamefprintf.sci create mode 100644 macros/GeneralFunctions/float.sci create mode 100644 macros/GeneralFunctions/squeezestrings.sci create mode 100644 macros/SymbolTable/ST_AnalyzeScope.sci create mode 100644 macros/SymbolTable/ST_Del.sci create mode 100644 macros/SymbolTable/ST_FindPos.sci create mode 100644 macros/SymbolTable/ST_Get.sci create mode 100644 macros/SymbolTable/ST_GetInArgInfo.sci create mode 100644 macros/SymbolTable/ST_GetSymbolInfo.sci create mode 100644 macros/SymbolTable/ST_InsForCntVars.sci create mode 100644 macros/SymbolTable/ST_InsOutArg.sci create mode 100644 macros/SymbolTable/ST_Load.sci create mode 100644 macros/SymbolTable/ST_MatchSymbol.sci create mode 100644 macros/SymbolTable/ST_Save.sci create mode 100644 macros/SymbolTable/ST_Set.sci create mode 100644 macros/SymbolTable/buildmacros.sce create mode 100644 macros/ToolInitialization/INIT_CreateDirs.sci create mode 100644 macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci create mode 100644 macros/ToolInitialization/INIT_GenAnnFLFunctions.sci create mode 100644 macros/ToolInitialization/INIT_GenFileInfo.sci create mode 100644 macros/ToolInitialization/INIT_GenLibraries.sci create mode 100644 macros/ToolInitialization/INIT_GenSharedInfo.sci create mode 100644 macros/ToolInitialization/INIT_LoadLibraries.sci create mode 100644 macros/ToolInitialization/INIT_RemoveDirs.sci create mode 100644 macros/ToolInitialization/INIT_SCI2C.sci create mode 100644 macros/ToolInitialization/INIT_SCI2CLoader.sce create mode 100644 macros/ToolInitialization/INIT_SharedInfoEqual.sci create mode 100644 macros/ToolInitialization/ManageNextConversion.sci create mode 100644 macros/ToolInitialization/SCI2CInputParameters.bkp create mode 100644 macros/ToolInitialization/SCI2CInputParameters.sce create mode 100644 macros/ToolInitialization/UpdateSCI2CInfo.sci create mode 100644 macros/ToolInitialization/buildmacros.sce create mode 100644 macros/ToolInitialization/doublecomplex.sci create mode 100644 macros/ToolInitialization/floatcomplex.sci create mode 100644 macros/buildmacros.sce create mode 100644 macros/cb_sci2c_gui.sci create mode 100644 macros/findDeps/Scilab2CDeps.sci create mode 100644 macros/findDeps/buildmacros.sce create mode 100644 macros/findDeps/findDeps.sci create mode 100644 macros/findDeps/getAllHeaders.sci create mode 100644 macros/findDeps/getAllInterfaces.sci create mode 100644 macros/findDeps/getAllSources.sci create mode 100644 macros/full_reset.sce create mode 100644 macros/runsci2c.sci create mode 100644 macros/runscicode.sci create mode 100644 macros/sci2c_gui.sci create mode 100644 macros/scilab2c.sci (limited to 'macros') diff --git a/macros/ASTManagement/%comment_string.sci b/macros/ASTManagement/%comment_string.sci new file mode 100644 index 00000000..a963507d --- /dev/null +++ b/macros/ASTManagement/%comment_string.sci @@ -0,0 +1,7 @@ +function txt=%comment_string(e) +//overloading function for "comment" type tlist string function +//fields: +// text: a string +//this is a leaf of the AST + txt=['Comment : '+e.text] +endfunction diff --git a/macros/ASTManagement/%cste_string.sci b/macros/ASTManagement/%cste_string.sci new file mode 100644 index 00000000..ba9971d2 --- /dev/null +++ b/macros/ASTManagement/%cste_string.sci @@ -0,0 +1,26 @@ +function txt=%cste_string(c) +//overloading function for "cste" type tlist string function +//this is a leaf of the AST +//fields: +// value : a number or a string +//NUT: added cste I also need "" for strings in order to be sure that the blanks are +//NUT: correctly considered and not mistaken with additional blanks present in the ast text file. + stringcvalue = string(c.value); + if (stringcvalue == "%T" | ... + stringcvalue == "%t" | ... + stringcvalue == "%F" | ... + stringcvalue == "%f" | ... + stringcvalue == "%nan" | ... + stringcvalue == "%inf" | ... + stringcvalue == "%e" | ... + stringcvalue == "%pi") + txt=['Number_x: '+stringcvalue]; + elseif (isnum(stringcvalue)) + //NUT needed to convert format 1D-14 into 1d-14 + txt=['Number_x: '+strsubst(stringcvalue,'D','e')]; + elseif (stringcvalue == "%i") + txt=['Number_X: '+stringcvalue]; + else + txt=['String: ""'+stringcvalue+'""']; + end +endfunction \ No newline at end of file diff --git a/macros/ASTManagement/%equal_string.sci b/macros/ASTManagement/%equal_string.sci new file mode 100644 index 00000000..9678f0e0 --- /dev/null +++ b/macros/ASTManagement/%equal_string.sci @@ -0,0 +1,16 @@ +function txt=%equal_string(e) +//overloading function for "equal" type tlist string function +//this is a node of the AST + +//fields: +// expression: "expression" type tlist (the right hand side) +// lhs : list of "variable" type tlist and "operation" type tlist // (the assignment) +// endsymbol : string (the orginal end-of-instruction symbol (, ; )) + txt=['Equal' + ' Expression: ' + ' '+string(e.expression) + ' Lhs : ' + ' '+objectlist2string(e.lhs) + 'EndEqual' + ] +endfunction \ No newline at end of file diff --git a/macros/ASTManagement/%for_string.sci b/macros/ASTManagement/%for_string.sci new file mode 100644 index 00000000..0ed9ca28 --- /dev/null +++ b/macros/ASTManagement/%for_string.sci @@ -0,0 +1,15 @@ +function txt=%for_string(F) +//overloading function for "for" type tlist string function +//this is a node of the AST +//fields: +// expression : "expression" type tlist (the loop expression) +// statements : list of "equal" type tlist and list('EOL') (the +// for instructions list) +//NUT: raf cambiato ForExpression e ForStatements + txt=['For' + ' ForExpression:' + ' '+string(F.expression) + ' ForStatements:' + ' '+objectlist2string(F.statements) + 'EndFor'] +endfunction \ No newline at end of file diff --git a/macros/ASTManagement/%funcall_string.sci b/macros/ASTManagement/%funcall_string.sci new file mode 100644 index 00000000..faeb81d9 --- /dev/null +++ b/macros/ASTManagement/%funcall_string.sci @@ -0,0 +1,15 @@ +function txt=%funcall_string(F) +//overloading function for "funcall" type tlist string function +//this is a node of the AST +//fields: +// rhs : a list +// name : string, the name of the function +// lhsnb: number, the number of function lhs + +txt=['Funcall : '+F.name + ' #lhs : '+string(F.lhsnb) + ' Rhs : ' + ' '+objectlist2string(F.rhs) + 'EndFuncall' + ] +endfunction diff --git a/macros/ASTManagement/%ifthenel_string.sci b/macros/ASTManagement/%ifthenel_string.sci new file mode 100644 index 00000000..6787a87c --- /dev/null +++ b/macros/ASTManagement/%ifthenel_string.sci @@ -0,0 +1,27 @@ +function txt=%ifthenel_string(I) +//overloading function for "ifthenel" type tlist string function +//this is a node of the AST +//fields: +// expression : "expression" type tlist (the if expression) +// then : list of "equal" type tlist and list('EOL') (the +// then instructions list) +// elseifs : a list of tlists +// else : list of "equal" type tlist and list('EOL') (the +// else instructions list) + txt=['If ' + ' Expression:' + ' '+string(I.expression) + ' If Statements' + ' '+objectlist2string(I.then)] + for e=I.elseifs + txt=[txt; + ' Else If Expression' + ' '+string(e.expression) + ' Else If Statements' + ' '+objectlist2string(e.then)] + end + txt=[txt; + ' Else Statements' + ' '+objectlist2string(I.else) + 'EndIf'] +endfunction diff --git a/macros/ASTManagement/%operatio_string.sci b/macros/ASTManagement/%operatio_string.sci new file mode 100644 index 00000000..8421a3f4 --- /dev/null +++ b/macros/ASTManagement/%operatio_string.sci @@ -0,0 +1,13 @@ +function txt=%operatio_string(O) +//overloading function for "operation" type tlist string function +//this is a node of the AST +//fields: +// operands: a list +// operator: a string + txt=['Operation' + ' Operands:' + ' '+objectlist2string(O.operands) + ' Operator: '+O.operator + 'EndOperation' + ] +endfunction \ No newline at end of file diff --git a/macros/ASTManagement/%program_p.sci b/macros/ASTManagement/%program_p.sci new file mode 100644 index 00000000..f45ed69a --- /dev/null +++ b/macros/ASTManagement/%program_p.sci @@ -0,0 +1,4 @@ +function %program_p(p) + //overloading function for "program" type tlist display + mprintf("%s\n",string(p)) +endfunction diff --git a/macros/ASTManagement/%program_string.sci b/macros/ASTManagement/%program_string.sci new file mode 100644 index 00000000..93486992 --- /dev/null +++ b/macros/ASTManagement/%program_string.sci @@ -0,0 +1,19 @@ +function txt=%program_string(p) +//overloading function for "program" type tlist string function +//main (root) node of the Abstract Formal Tree +//fields: +// name : string (the function name) +// outputs : list of "variable" type tlist (the output arg names) +// inputs : list of "variable" type tlist (the intput arg names) +// statements: list of "equal" type tlist and list('EOL') (the +// instructions list) +// nblines : number (the number of lines in the scilab function) + txt=['Program' + 'Name : '+p.name + 'Outputs: '+strcat(objectlist2string(p.outputs),' ') + 'Inputs : '+strcat(objectlist2string(p.inputs),' ') + 'Statements ' + ' '+objectlist2string(p.statements) + 'EndProgram' + ] +endfunction diff --git a/macros/ASTManagement/%variable_string.sci b/macros/ASTManagement/%variable_string.sci new file mode 100644 index 00000000..86507957 --- /dev/null +++ b/macros/ASTManagement/%variable_string.sci @@ -0,0 +1,26 @@ +function txt=%variable_string(v) + global anscounter; //NUT: just to fix problem with ans variables. +//overloading function for "variable" type tlist string function +//fields: name +//this is a leaf of the AST +//NUT: changed here. For me %i is a number not a variable. + if (v.name == "%T" | ... + v.name == "%t" | ... + v.name == "%F"| ... + v.name == "%f"| ... + v.name == "%nan"| ... + v.name == "%inf"| ... + v.name == "%e" | ... + v.name == "%pi") + txt=['Number_x: '+v.name]; + elseif (v.name == "%i") + txt=['Number_X: '+v.name]; + else + if (v.name == 'ans') + anscounter = anscounter + 1; + txt=['Variable: '+v.name+string(anscounter)]; + else + txt=['Variable: '+v.name]; + end + end +endfunction \ No newline at end of file diff --git a/macros/ASTManagement/%while_string.sci b/macros/ASTManagement/%while_string.sci new file mode 100644 index 00000000..7d5e6223 --- /dev/null +++ b/macros/ASTManagement/%while_string.sci @@ -0,0 +1,14 @@ +function txt=%while_string(W) +//overloading function for "while" type tlist string function +//this is a node of the AST +//fields: +// expression : "expression" type tlist (the loop expression) +// statements : list of "equal" type tlist and list('EOL') (the +// while instructions list) + txt=['While' + ' WhileExpression:' + ' '+string(W.expression) + ' WhileStatements:' + ' '+objectlist2string(W.statements) + 'EndWhile'] +endfunction diff --git a/macros/ASTManagement/AST2Ccode.sci b/macros/ASTManagement/AST2Ccode.sci new file mode 100644 index 00000000..4600f3c3 --- /dev/null +++ b/macros/ASTManagement/AST2Ccode.sci @@ -0,0 +1,246 @@ +function AST2Ccode(FileInfoDatFile) +// function AST2Ccode(FileInfoDatFile) +// ----------------------------------------------------------------- +// Read the AST and call the corresponding handlers. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-May-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + + +//NUT: questa funzione e' da sistemare meglio + +// --------------------- +// --- Load section. --- +// --------------------- +// --- Load File Info Structure. --- +load(FileInfoDatFile,'FileInfo'); + +// --- Load Shared Info Structure. --- +load(FileInfo.SharedInfoDatFile,'SharedInfo'); +// ------------------------- +// --- End load section. --- +// ------------------------- + +// --------------------------------------------------- +// --- Extraction of the function name and number. --- +// --------------------------------------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; + +// --------------------------------- +// --- Parameter Initialization. --- +// --------------------------------- +global SCI2CSTACK +SCI2CSTACK = ['EMPTYSTACK']; + +global StackPosition; +StackPosition = 1; + +global STACKDEDUG +STACKDEDUG = 0; // 1 -> Every Pop and Push operation on the stack, the stack content will be printed on screen. +// ------------------------------------- +// --- End parameter Initialization. --- +// ------------------------------------- + +ASTFileName = FileInfo.Funct(nxtscifunnumber).ASTFileName; + +// ----------------------- +// --- Initialization. --- +// ----------------------- +// --- Open AST file. --- +SharedInfo.ASTReader.fidAST = SCI2COpenFileRead(ASTFileName); +fidAST = SharedInfo.ASTReader.fidAST; + +OrigWorkAreaUsedBytes = SharedInfo.WorkAreaUsedBytes; +OrigUsedTempScalarVars = SharedInfo.UsedTempScalarVars; + +PrintStepInfo('Generate C code in '+FileInfo.Funct(nxtscifunnumber).FinalCFileName,... + FileInfo.GeneralReport,'both'); +// --------------------------- +// --- End initialization. --- +// --------------------------- + +// ------------------------ +// --- Parse AST header. --- +// ------------------------ +ASTHeader = AST_ReadASTHeader(fidAST,ReportFileName); +SharedInfo = AST_HandleHeader(ASTHeader,FileInfo,SharedInfo); +//NUT: le metto per ora perche' quando provo a cercare lo specifier di precisione al termine +//NUT: del programma non ho piu' nulla da poppare se lo specifier e' assente. Al limite posso mettere la program e i nomi +//NUT: al posto di dummy. +AST_PushASTStack('Dummy'); +AST_PushASTStack('Dummy'); +AST_PushASTStack('Dummy'); +AST_PushASTStack('Dummy'); +AST_PushASTStack('Dummy'); +AST_PushASTStack('Dummy'); +AST_PushASTStack('Dummy'); +AST_PushASTStack('Dummy'); +//NUT: Se ne tolgo qualcuno ottengo errori +// ---------------------------- +// --- End Parse AST header. --- +// ---------------------------- + //NUT: better to have a function. + + // --- Reset TempVars Structure. --- + TempVars = []; + // Reset info related to temp variables used in the C code. + SharedInfo.WorkAreaUsedBytes = OrigWorkAreaUsedBytes; + SharedInfo.UsedTempScalarVars = OrigUsedTempScalarVars; + //NUT: put here a manageeol so that you can have all the save and load you want. + SharedInfo.ASTReader.UsedTempVars = 0; + +// ---------------------------------- +// --- Main loop to read the AST. --- +// ---------------------------------- +//NUT: file ottenuto con m2sci se hai tempo prova a vedere se ci sono inesattezze. +//NUT: inoltre per maggiore eleganza si puo' pensare di introdurre piu' funzioni + +while ~meof(fidAST) + // Read a line from the AST + tline = mgetl(fidAST,1); + AST_CheckLineLength(tline); + treeline = stripblanks(tline); + + if STACKDEDUG == 1 + disp('Read AST Line: '+treeline); + end + + // Analyze line. + select treeline + + // ------------------ + // --- Functions. --- + // ------------------ + //NUT: qui puoi anche aggiunger piu' case per specificare meglio la struttura della funcall + //NUT: i case aggiunti ovviamente faranno solo il push della treeline. + case 'EndOperation' then + [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Operation'); + case 'EndFuncall' then + [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Funcall'); + + // -------------- + // --- Equal. --- + // -------------- + case 'EndEqual' then + //NUT: prima di lanciare l'analisi della equal puoi mettere degli argomenti dummy + //NUT: per fare in modo di coprire le ins, anche se ci puo' essere qualche rischio quando + //NUT: ho miste ins e variabili, per esempio [c(1,1), a] = twooutfun(); + //NUT: in questo caso solo una delle due equal va scartata. + [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Equal'); + SharedInfo = INIT_SharedInfoEqual(SharedInfo); + case 'Equal' then + SharedInfo.Equal.Enabled = 1; // 1 means enabled -> we are inside an equal AST block. + AST_PushASTStack(treeline); + case 'Lhs :' then + SharedInfo.Equal.Lhs = 1; // 1 means that we are inside the Lhs block of the Equal + [EqualInArgName,EqualInArgScope,EqualNInArg] = AST_ReadEqualRhsNames(FileInfo,SharedInfo); + SharedInfo.Equal.NInArg = EqualNInArg; + for tmpcnt = 1:SharedInfo.Equal.NInArg + SharedInfo.Equal.InArg(tmpcnt).Name = EqualInArgName(tmpcnt); + SharedInfo.Equal.InArg(tmpcnt).Scope = EqualInArgScope(tmpcnt); + end + AST_PushASTStack(treeline); + + // ---------------- + // --- If/Else. --- + // ---------------- + //NUT: da verificare la gestione dello stack + case 'If Statements' then + [FileInfo,SharedInfo] = AST_HandleIfElse(FileInfo,SharedInfo,'if'); + case 'Else If Expression' then + AST_PushASTStack(treeline); + [FileInfo,SharedInfo] = AST_HandleIfElse(FileInfo,SharedInfo,'else'); + case 'Else If Statements' then + [FileInfo,SharedInfo] = AST_HandleIfElse(FileInfo,SharedInfo,'elseif'); + case 'Else Statements' then + [FileInfo,SharedInfo] = AST_HandleIfElse(FileInfo,SharedInfo,'else'); + case 'EndIf' then + for counter=1:SharedInfo.CountNestedIf+1 + SharedInfo = C_IfElseBlocks(FileInfo,SharedInfo,'out'); + end + SharedInfo.CountNestedIf = 0; + + // -------------- + // --- Dummy. --- + // -------------- + case 'Comment :' then + AST_HandleEOL(FileInfo,SharedInfo); //NUT: si potrebbe differenziare comment da EOL + case '' then + AST_HandleEOL(FileInfo,SharedInfo); + + // ----------------- + // --- Epilogue. --- + // ----------------- + case 'EndProgram' + SharedInfo = AST_HandleEndProgram(FileInfo,SharedInfo); + //NUT: per essere precisi si puo' pensare di mettere un check + //NUT: alla fine dell'albero per accertarsi che c'e' end program li' dove ce lo aspettiamo + + // ------------ + // --- For. --- + // ------------ + case 'For' then + SharedInfo.For.Level = SharedInfo.For.Level + 1; + FileInfo = AST_HandleFor(FileInfo,SharedInfo); + case 'ForExpression:' + AST_PushASTStack(treeline); + SharedInfo.ForExpr.OnExec = SharedInfo.ForExpr.OnExec + 1; + case 'ForStatements:' + [FileInfo,SharedInfo] = AST_HandleForStatem(FileInfo,SharedInfo); + case 'EndFor' then + SharedInfo = AST_HandleEndFor(FileInfo,SharedInfo); + SharedInfo.For.Level = SharedInfo.For.Level - 1; + + // -------------- + // --- While. --- + // -------------- + case 'While' then + AST_PushASTStack(treeline); + SharedInfo.While.Level = SharedInfo.While.Level + 1; + case 'WhileExpression:' + AST_PushASTStack(treeline); + [FileInfo,SharedInfo] = AST_HandleWhileExpr(FileInfo,SharedInfo); + case 'WhileStatements:' + [FileInfo,SharedInfo] = AST_HandleWhileStatem(FileInfo,SharedInfo); + case 'EndWhile' then + SharedInfo = AST_HandleEndWhile(FileInfo,SharedInfo); + SharedInfo.While.Level = SharedInfo.While.Level - 1; + + // ---------------- + // --- Default. --- + // ---------------- + else + AST_PushASTStack(treeline); + end +end +// -------------------------------------- +// --- End main loop to read the AST. --- +// -------------------------------------- + +mclose(fidAST); +// --------------------- +// --- Save section. --- +// --------------------- +// --- Save Shared Info Structure. --- +save(SharedInfoDatFile,SharedInfo); +// ------------------------- +// --- End save section. --- +// ------------------------- +endfunction diff --git a/macros/ASTManagement/AST_CheckCommonInOutArgs.sci b/macros/ASTManagement/AST_CheckCommonInOutArgs.sci new file mode 100644 index 00000000..952514cc --- /dev/null +++ b/macros/ASTManagement/AST_CheckCommonInOutArgs.sci @@ -0,0 +1,88 @@ +function AST_CheckCommonInOutArgs(InArg,NInArg,OutArg,NOutArg,ReportFileName) +// function AST_CheckCommonInOutArgs(InArg,NInArg,OutArg,NOutArg,ReportFileName) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Compares input and output arguments names and issues and error +// when at least one output argument is equal to the one of the +// input arguments. The error is issued only when the common argument +// is not a scalar value. This is a safe approach that prevents error +// when the same matrix is used as both input and output argument of +// a function. +// #RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 08-Jan-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),5,5); + +ncommonstrings = 0; +commonstrings = ''; + +//RNU non mi ricordo per quale motivo avevo commentato il seguente codice +//RNU e decommentato l'altro a seguire. Sembra che avessi deciso che anche +//RNU le variabili scalari non potessero essere usate nella stessa expr +//RNU contemporaneamente come input e come output +for cnt1 = 1:NInArg + for cnt2 = 1:NOutArg + if ((InArg(cnt1).Name == OutArg(cnt2).Name) & ... + (InArg(cnt1).Dimension > 0)) + ncommonstrings = ncommonstrings + 1; + commonstrings(ncommonstrings) = InArg(cnt1).Name; + end + end +end + +// for cnt1 = 1:NInArg +// for cnt2 = 1:NOutArg +// if ((InArg(cnt1).Name == OutArg(cnt2).Name)) +// ncommonstrings = ncommonstrings + 1; +// commonstrings(ncommonstrings) = InArg(cnt1).Name; +// end +// end +// end + +if (ncommonstrings > 0) + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Found '+string(ncommonstrings)+' input/output 2-D arguments',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: with the same name: ',ReportFileName,'both','y'); + for cntstr = 1:ncommonstrings + PrintStringInfo('SCI2CERROR: Arg('+string(cntstr)+'): '+commonstrings(cntstr),ReportFileName,'both','y'); + end + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: This approach is not allowed because it is not safe',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: due to the fact that arrays are passed by reference to functions.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: For example if A is a squared matrix then the following code,',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: A = A'';',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: could generate incorrect results.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Please consider renaming input or output arguments.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: See examples below:',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: // Example 1: Function call.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: A = zeros(10,9);',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: A = sin(A); // Not Allowed',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: // The previous line must be rewritten as:',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: MYTMP = A; // Allowed',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: A = sin(MYTMP); // Allowed',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: // Example 2: Function definition.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: function d = myfun(a,b,c,d) // Not Allowed',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: // The previous line must be rewritten as:',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: function e = myfun(a,b,c,d) // Not Allowed',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); +end + +endfunction diff --git a/macros/ASTManagement/AST_CheckLastFunc.sci b/macros/ASTManagement/AST_CheckLastFunc.sci new file mode 100644 index 00000000..0fff6b22 --- /dev/null +++ b/macros/ASTManagement/AST_CheckLastFunc.sci @@ -0,0 +1,77 @@ +function [LhsArgNames,LhsArgScope,NLhsArg] = AST_CheckLastFunc(fidAST,SearchLevel) +// function [LhsArgNames,LhsArgScope,NLhsArg] = AST_CheckLastFunc(fidAST,SearchLevel) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +astfilepos = mtell(fidAST); +NLhsArg = 0; +LhsArgNames = ''; +LhsArgScope = ''; +FlagLastFunc = 0; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +//NUT: non capisco come mai tu non faccia il flipud degli argometi letti. +//NUT: Level 1 e' quando abbiamo una equal float fun +//NUT: level 0 quando abbiamo equal fun +tline = mgetl(fidAST,1); +AST_CheckLineLength(tline); +LhsField = stripblanks(tline); +if ((SearchLevel == 1) & (LhsField == 'EndFuncall')) + SearchLevel = 0; + tline = mgetl(fidAST,1); + AST_CheckLineLength(tline); + LhsField = stripblanks(tline); +end +if ((SearchLevel == 0) & (LhsField == 'Lhs :')) + tline = mgetl(fidAST,1); + AST_CheckLineLength(tline); + LhsField = stripblanks(tline); + while(LhsField ~= 'EndEqual') + NLhsArg = NLhsArg + 1; + if (LhsField == '') + SCI2Cerror('Found before EndEqual'); + elseif (LhsField == 'EndProgram') + SCI2Cerror('Found EndProgram before EndEqual'); + end + if (LhsField == 'Operation') + // if (LhsField == 'Operator: ins') + // It means that we have to store the results of the function in temp vars. + LhsField = 'EndEqual'; // Force the exit from the while. + NLhsArg = 0; + LhsArgNames = ''; + LhsArgScope = ''; + else + [LhsArgNames(NLhsArg),LhsArgScope(NLhsArg)] = AST_ExtractNameAndScope(LhsField); + tline = mgetl(fidAST,1); + AST_CheckLineLength(tline); + LhsField = stripblanks(tline); + end + end +end +mseek(astfilepos,fidAST,'set'); + +endfunction diff --git a/macros/ASTManagement/AST_CheckLineLength.sci b/macros/ASTManagement/AST_CheckLineLength.sci new file mode 100644 index 00000000..d74cf26b --- /dev/null +++ b/macros/ASTManagement/AST_CheckLineLength.sci @@ -0,0 +1,29 @@ +function AST_CheckLineLength(instring) +// function AST_CheckLineLength(instring) +// ----------------------------------------------------------------- +// "Fixes" the AST generator bug. When a line of code is greater +// than 80 chars the generated AST is wrong. +// +// Input data: +// instring: string read from the AST. +// +// Output data: +// --- +// +// Status: +// 15-May-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +//if length(instring) > 77 +// SCI2Cerror('Line too long: please reduce the length of the current line.'); +//end + +endfunction diff --git a/macros/ASTManagement/AST_CheckPrecSpecifier.sci b/macros/ASTManagement/AST_CheckPrecSpecifier.sci new file mode 100644 index 00000000..e8ffbf1f --- /dev/null +++ b/macros/ASTManagement/AST_CheckPrecSpecifier.sci @@ -0,0 +1,82 @@ +function AnnotationFnc = AST_CheckPrecSpecifier(FunctionName,FileInfo,SharedInfo); +// function AnnotationFnc = AST_CheckPrecSpecifier(FunctionName,FileInfo,SharedInfo); +// ----------------------------------------------------------------- +// #RNU_RES_B +// Searches for one of the following data annotation functions: +// Funcall : int +// Funcall : float +// Funcall : double +// Note: remember to execute this function before pushing the output +// argument names into the stack. +// #RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 13-Apr-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; +PrintStringInfo(' ',ReportFileName,'file','y'); +// #RNU_RES_B +PrintStringInfo(' Checking presence of precision specifier',ReportFileName,'file','y'); +//NUT: da sistemare senza le global +// #RNU_RES_E +global SCI2CSTACK +global StackPosition; +global STACKDEDUG + +AnnotationFnc = 'default'; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +Pop1 = AST_PopASTStack(); // Rhs : +if (mtlb_strcmp(stripblanks(Pop1),'Rhs :')) + Pop2 = AST_PopASTStack(); // #lhs : 1 + if (mtlb_strcmp(stripblanks(Pop2),'#lhs : 1')) + Pop3 = AST_PopASTStack(); // Funcall : double + FunctionName = stripblanks(part(Pop3,12:length(Pop3))); + for counterdataprec = 1:max(size(SharedInfo.Annotations.DataPrec)) + if (mtlb_strcmp(FunctionName,SharedInfo.Annotations.DataPrec(counterdataprec))) + AnnotationFnc = FunctionName; + end + end + // --- Repush strings into the AST stack. --- + AST_PushASTStack(Pop3); + end + // --- Repush strings into the AST stack. --- + AST_PushASTStack(Pop2); +end +// --- Repush strings into the AST stack. --- +AST_PushASTStack(Pop1); + +if mtlb_strcmp(AnnotationFnc,'default') + // #RNU_RES_B + PrintStringInfo('Function is not annotated',ReportFileName,'file','y'); + PrintStringInfo('The ""'+SharedInfo.DefaultPrecision+'"" default precision will be used.',ReportFileName,'file','y'); + // #RNU_RES_E +else + // #RNU_RES_B + PrintStringInfo('Function is annotated with ""'+AnnotationFnc+'"" specifier',ReportFileName,'file','y'); + // #RNU_RES_E +end + +endfunction diff --git a/macros/ASTManagement/AST_DisplayStack.sci b/macros/ASTManagement/AST_DisplayStack.sci new file mode 100644 index 00000000..8543e2e0 --- /dev/null +++ b/macros/ASTManagement/AST_DisplayStack.sci @@ -0,0 +1,42 @@ +function AST_DisplayStack() +// function AST_DisplayStack() +// ----------------------------------------------------------------- +// Displays the AST stack content. The AST stack is used to read the +// AST. +// +// Input data: +// --- +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + +global SCI2CSTACK +global StackPosition; +global STACKDEDUG + +disp('*********************') +disp('*********************') + +if (STACKDEDUG == 1) + for counterposition = 1:StackPosition + disp(SCI2CSTACK(counterposition,1)) + end +end +disp('---------------------') +disp('---------------------') +disp(' ');disp(' ');disp('Press return to continue'); halt; + +endfunction diff --git a/macros/ASTManagement/AST_ExtractNameAndScope.sci b/macros/ASTManagement/AST_ExtractNameAndScope.sci new file mode 100644 index 00000000..7e71f75a --- /dev/null +++ b/macros/ASTManagement/AST_ExtractNameAndScope.sci @@ -0,0 +1,93 @@ +function [ArgName,ArgScope] = AST_ExtractNameAndScope(ASTField) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 27-Dec-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +ArgName = ''; +ArgScope = ''; + +cnttag = 0; +cnttag = cnttag + 1; +tagname(cnttag) = 'Number_'; +taglength(cnttag) = length(tagname(cnttag)); + +cnttag = cnttag + 1; +tagname(cnttag) = 'String:'; +taglength(cnttag) = length(tagname(cnttag)); + +cnttag = cnttag + 1; +tagname(cnttag) = 'Variable:'; +taglength(cnttag) = length(tagname(cnttag)); + +cnttag = cnttag + 1; +tagname(cnttag) = 'Global:'; +taglength(cnttag) = length(tagname(cnttag)); + +cnttag = cnttag + 1; +tagname(cnttag) = 'Local:'; +taglength(cnttag) = length(tagname(cnttag)); + +cnttag = cnttag + 1; +tagname(cnttag) = 'Temp:'; +taglength(cnttag) = length(tagname(cnttag)); + +cnttag = cnttag + 1; +tagname(cnttag) = ''; +taglength(cnttag) = length(tagname(cnttag)); + +fieldlength = length(ASTField); + +//NUT: il seguente codice e' poco elegante. +if (SCI2Cstrncmps1size(tagname(1),ASTField)) + // Here we can have: + // Number_x: it means default precision. + // Number_s: it means float real type. + // Number_d: it means double real type. + // Number_c: it means float complex type. + // Number_z: it means double complex type. + ArgName = stripblanks(part(ASTField,taglength(1)+3:fieldlength)); + ArgScope = stripblanks(part(ASTField,1:taglength(1)+1)); +elseif (SCI2Cstrncmps1size(tagname(2),ASTField)) + ArgName = stripblanks(part(ASTField,taglength(2)+1:fieldlength)); + ArgName = part(ArgName,2:length(ArgName)-1); // I remove also the first and the last " + ArgScope = 'String'; +elseif (SCI2Cstrncmps1size(tagname(3),ASTField)) + ArgName = stripblanks(part(ASTField,taglength(3)+1:fieldlength)); + ArgScope = 'Variable'; +elseif (SCI2Cstrncmps1size(tagname(4),ASTField)) + ArgName = stripblanks(part(ASTField,taglength(4)+1:fieldlength)); + ArgScope = 'Global'; +elseif (SCI2Cstrncmps1size(tagname(5),ASTField)) + ArgName = stripblanks(part(ASTField,taglength(5)+1:fieldlength)); + ArgScope = 'Local'; +elseif (SCI2Cstrncmps1size(tagname(6),ASTField)) + ArgName = stripblanks(part(ASTField,taglength(6)+1:fieldlength)); + ArgScope = 'Temp'; +elseif (SCI2Cstrncmps1size(tagname(7),ASTField)) + ArgName = ''; + ArgScope = 'None'; +else + SCI2Cerror('Argument specifier not found in the AST field: '+ASTField); +end + +endfunction diff --git a/macros/ASTManagement/AST_GetASTFile.sci b/macros/ASTManagement/AST_GetASTFile.sci new file mode 100644 index 00000000..025aca74 --- /dev/null +++ b/macros/ASTManagement/AST_GetASTFile.sci @@ -0,0 +1,59 @@ +function AST_GetASTFile(FileInfoDatFile) +// function AST_GetASTFile(FileInfoDatFile) +// ----------------------------------------------------------------- +// Generates the AST file starting from the .sci file specified +// in SharedInfo.NextSCIFileName. +// +// Input data: +// FileInfoDatFile: name of the .dat file containing the FileInfo structure. +// +// Output data: +// --- +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// --------------------------------- +// --- Load File Info Structure. --- +// --------------------------------- +clear FileInfo +load(FileInfoDatFile,'FileInfo'); + +// ----------------------------------- +// --- Load Shared Info Structure. --- +// ----------------------------------- +clear SharedInfo +load(FileInfo.SharedInfoDatFile,'SharedInfo'); + +// --------------------------------------------------- +// --- Extraction of the function name and number. --- +// --------------------------------------------------- +funname = SharedInfo.NextSCIFunName; +funnumber = SharedInfo.NextSCIFunNumber; + +PrintStepInfo('Generate the AST in '+FileInfo.Funct(funnumber).ASTFileName,... + FileInfo.GeneralReport,'both'); + +// --- Generation of the AST file. --- +SciFile2ASTFile(FileInfo.Funct(funnumber).SCIFileName,... + FileInfo.Funct(funnumber).ASTFileName); + +// --------------------- +// --- Save section. --- +// --------------------- +// --- Save File Info Structure. --- +// save(FileInfoDatFile,FileInfo); +// ------------------------- +// --- End save section. --- +// ------------------------- + +endfunction diff --git a/macros/ASTManagement/AST_GetFuncallPrm.sci b/macros/ASTManagement/AST_GetFuncallPrm.sci new file mode 100644 index 00000000..aa5ab62c --- /dev/null +++ b/macros/ASTManagement/AST_GetFuncallPrm.sci @@ -0,0 +1,54 @@ +function [FunctionName,InArg,NInArg,OutArg,NOutArg] = ... + AST_GetFuncallPrm(FileInfo,SharedInfo,ASTFunType) +// function [FunctionName,InArg,NInArg,NOutArg] = ... +// AST_GetFuncallPrm(FileInfo,SharedInfo,ASTFunType) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-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; +//#RNU_RES_B +PrintStringInfo('***Retrieving '+ASTFunType+' Parameters from AST***',ReportFileName,'file','y'); +//#RNU_RES_E +OutArg = []; +NOutArg = 0; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// ------------------------------------------------------ +// --- Get Parameters from the AST Funcall structure. --- +// ------------------------------------------------------ +if (ASTFunType=='Funcall') + [FunctionName,InArg,NInArg,NOutArg] = AST_ParseFuncallStruct(FileInfo,SharedInfo); +elseif (ASTFunType=='Operation') + [FunctionName,InArg,NInArg,NOutArg] = AST_ParseOperStruct(FileInfo,SharedInfo); +elseif (ASTFunType=='Equal') + [FunctionName,InArg,NInArg,OutArg,NOutArg] = AST_ParseEqualStruct(FileInfo,SharedInfo); +else + SCI2CerrorFile('Unknown Function type: '+ASTFunType+'.',ReportFileName); +end + +endfunction diff --git a/macros/ASTManagement/AST_GetPrecAndLhsArg.sci b/macros/ASTManagement/AST_GetPrecAndLhsArg.sci new file mode 100644 index 00000000..feb8a6ec --- /dev/null +++ b/macros/ASTManagement/AST_GetPrecAndLhsArg.sci @@ -0,0 +1,99 @@ +function [LhsArg,NLhsArg,PrecisionSpecifier,SharedInfo] = AST_GetPrecAndLhsArg(OutArg,NOutArg,FunctionName,FunTypeAnnot,FunSizeAnnot,ASTFunType,FileInfo,SharedInfo); +// function [LhsArg,NLhsArg,PrecisionSpecifier,SharedInfo] = AST_GetPrecAndLhsArg(OutArg,NOutArg,FunctionName,FunTypeAnnot,FunSizeAnnot,ASTFunType,FileInfo,SharedInfo); +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),8,8); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +// #RNU_RES_B +PrintStringInfo('***Search for Equal Lhs and precision specifier to be applied to the current function.***',ReportFileName,'file','y'); +// #RNU_RES_E +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// #RNU_RES_B +// --------------------------------------- +// --- Search for Precision Specifier. --- +// --------------------------------------- +// #RNU_RES_E +if (NOutArg == 1 & FunTypeAnnot == 'FA_TP_USER') + PrecisionSpecifier = AST_CheckPrecSpecifier(FunctionName,FileInfo,SharedInfo); + if (PrecisionSpecifier == 'default') + SearchLevel = 0; + else + SearchLevel = 1; + SharedInfo.SkipNextPrec = 1; + end +else + PrecisionSpecifier = ''; + SearchLevel = 0; +end + +// #RNU_RES_B +// ------------------------------------------------------------- +// --- Check Last Function Condition and update LhsArg info. --- +// ------------------------------------------------------------- +// #RNU_RES_E +if (ASTFunType~='Equal') + // #RNU_RES_B + PrintStringInfo(' ',ReportFileName,'file','y'); + PrintStringInfo(' Checking presence of Equal after the current function...',ReportFileName,'file','y'); + // #RNU_RES_E + [LhsArgNames,LhsArgScope,NLhsArg] = AST_CheckLastFunc(SharedInfo.ASTReader.fidAST,SearchLevel); +else + LhsArgNames = ''; + LhsArgScope = ''; + NLhsArg = 0; +end + +// --- Generate the LhsArg structure. --- +LhsArg = []; +for cntarg = 1:NLhsArg + LhsArg(cntarg).Name = LhsArgNames(cntarg); + LhsArg(cntarg).Scope = LhsArgScope(cntarg); +end + +// #RNU_RES_B +// ------------------------- +// --- Check on NLhsArg. --- +// ------------------------- +// #RNU_RES_E +if (NLhsArg > 0) + // #RNU_RES_B + PrintStringInfo('...Found Equal.',ReportFileName,'file','y'); + PrintStringInfo('OutArg Names will be replaced with Lhs Names of the Equal.',ReportFileName,'file','y'); + // #RNU_RES_E + SharedInfo.SkipNextEqual = 1; // 1 = the next equal in the AST will not produce C code. + if (NLhsArg ~= NOutArg) + SCI2CerrorFile('NLhsArg='+string(NLhsArg)+' must be equal to NOutArg='+string(NOutArg)+'.',ReportFileName); + end +else + // #RNU_RES_B + PrintStringInfo('...Equal not found.',ReportFileName,'file','y'); + // #RNU_RES_E +end + +endfunction diff --git a/macros/ASTManagement/AST_HandleEOL.sci b/macros/ASTManagement/AST_HandleEOL.sci new file mode 100644 index 00000000..0f55457e --- /dev/null +++ b/macros/ASTManagement/AST_HandleEOL.sci @@ -0,0 +1,63 @@ +function AST_HandleEOL(FileInfo,SharedInfo) +// function AST_HandleEOL(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// Handles the EOL tag of the AST. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + + +//#RNU_RES_B +//NUT: questa parte e' molto interessante perche' ti puo' aiutare per fare confronti +//NUT: incrociati tra le annotazioni della funzione e gli argomenti in uscita. +//NUT: in particolare una volta messi nella tabella dei simboli anche gli argomenti +//NUT: di uscita puoi benissimo verificare che li stai utilizzando bene nel corpo della funzione stessa. +//#RNU_RES_E + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName; +SciFileFid = FileInfo.Funct(nxtscifunnumber).SCICopyFileFid; +IndentLevel = SharedInfo.NIndent; + +PrintStepInfo('Handling EOL',ReportFileName,'file'); +sciline = mgetl(SciFileFid,1); + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y','n'); +PrintStringInfo('##################'+'################'+'##################'+'##################'+'##################',ReportFileName,'file','y','n'); +PrintStringInfo('##################'+'################'+'##################'+'##################'+'##################',ReportFileName,'file','y','n'); +PrintStringInfo('### Scilab code: '+sciline+' ###',ReportFileName,'file','y','n'); +PrintStringInfo('##################'+'################'+'##################'+'##################'+'##################',ReportFileName,'file','y','n'); +PrintStringInfo('##################'+'################'+'##################'+'##################'+'##################',ReportFileName,'file','y','n'); +// #RNU_RES_E +PrintStringInfo(' ',CPass1FileName,'file','y'); +// RNU BRUNO modeprintstringinfo MUST BE AN EXTERNAL PARAMETER! +modeprintstringinfo = 'both'; +if (SharedInfo.CopySciCodeIntoCCode == 1) + modeprintstringinfo = 'both'; +end +PrintStringInfo(C_IndentBlanks(IndentLevel)+'/*SCI2C: #############'+'############'+'##############'+'###############'+'############',CPass1FileName,modeprintstringinfo,'y','n'); +PrintStringInfo(C_IndentBlanks(IndentLevel)+' SCI2C: '+sciline,CPass1FileName,modeprintstringinfo,'y','n'); +PrintStringInfo(C_IndentBlanks(IndentLevel)+' SCI2C: #############'+'############'+'##############'+'###############'+'############*/',CPass1FileName,modeprintstringinfo,'y','n'); + +endfunction diff --git a/macros/ASTManagement/AST_HandleEndFor.sci b/macros/ASTManagement/AST_HandleEndFor.sci new file mode 100644 index 00000000..dc6c4126 --- /dev/null +++ b/macros/ASTManagement/AST_HandleEndFor.sci @@ -0,0 +1,78 @@ +function SharedInfo = AST_HandleEndFor(FileInfo,SharedInfo) +// function SharedInfo = AST_HandleEndFor(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Handles the EndFor tag of the AST. +// overloading function for "for" type tlist string function +// this is a node of the AST +// fields: +// expression : "expression" type tlist (the loop expression) +// statements : list of "equal" type tlist and list('EOL') (the +// for instructions list) +// txt=['For' +// ' ForExpression:' +// ' '+string(F.expression) +// ' ForStatements:' +// ' '+objectlist2string(F.statements) +// 'EndFor'] +// +// #RNU_RES_E +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 15-Nov-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; + +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName; +CPass1ForProlFileName = FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level); +CPass1ForEpilFileName = FileInfo.Funct(nxtscifunnumber).CPass1ForEpilFileName(SharedInfo.For.Level); + +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Handling EndFor***',ReportFileName,'file','y'); +CCall =''; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// ---------------------------- +// --- Generate the C code. --- +// ---------------------------- +// --- Copy Epilogue into C code (Pass1) file. --- +[CLinesArray,N_Lines] = File2StringArray(CPass1ForEpilFileName); +CLinesArray = stripblanks(CLinesArray); + +for tmpcnt = 1:N_Lines-1 + PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CLinesArray(tmpcnt),CPass1FileName,'file','y'); +end +PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent-1)+CLinesArray(N_Lines),CPass1FileName,'file','y'); + +// -------------------------- +// --- Update SharedInfo. --- +// -------------------------- +SharedInfo.NIndent = SharedInfo.NIndent - 1; + +// ------------------------------- +// --- Delete temporary files. --- +// ------------------------------- +SCI2Cmdelete(FileInfo.Funct(nxtscifunnumber).CPass1ForEpilFileName(SharedInfo.For.Level)); + +endfunction diff --git a/macros/ASTManagement/AST_HandleEndGenFun.sci b/macros/ASTManagement/AST_HandleEndGenFun.sci new file mode 100644 index 00000000..3db11733 --- /dev/null +++ b/macros/ASTManagement/AST_HandleEndGenFun.sci @@ -0,0 +1,443 @@ +function [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,ASTFunType) +// function [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,ASTFunType) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Handles the EndFuncall, EndOperation and EndEqual tags of the AST. +// ASTFunType can be 'Funcall', 'Operation', 'Equal' +// Structure of Funcall: +// overloading function for "funcall" type tlist string function +// this is a node of the AST +// fields: +// rhs : a list +// name : string, the name of the function +// lhsnb: number, the number of function lhs +// txt=['Funcall : '+F.name +// ' #lhs : '+string(F.lhsnb) +// ' Rhs : ' +// ' '+objectlist2string(F.rhs) +// 'EndFuncall' +// ] +// #RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-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; +Pass1HeaderFileName = FileInfo.Funct(nxtscifunnumber).Pass1HeaderFileName; +FunInfoDatDir = FileInfo.FunctionList.FunInfoDatDir; +CGblDeclarFileName = FileInfo.Funct(nxtscifunnumber).CGblDeclarFileName; + +Flag_FunAlreadyCalled = 0; +// #RNU_RES_B +PrintStepInfo('Handling Funcall/Operation/Equal',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); +// #RNU_RES_E +//NUT: da sistemare senza le global +global SCI2CSTACK +global StackPosition; +global STACKDEDUG +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// #RNU_RES_B +// --------------------------------------------- +// --- Retrieve FunCall Parameters from AST. --- +// --------------------------------------------- +//NUT: verifica se ASTFunType e' veramente importante +// #RNU_RES_E +[ASTFunName,InArg,NInArg,OutArg,NOutArg] = AST_GetFuncallPrm(FileInfo,SharedInfo,ASTFunType); +if (ASTFunName == 'OpIns') + SharedInfo.SkipNextEqual = 1; + SharedInfo.Equal.Nins = SharedInfo.Equal.Nins + 1; + //NUT: Force ins to have 0 args. Double check it. + NOutArg = 0; + // #RNU_RES_B + //NUT: io aumenterei qui gli argomenti in ingresso della ins cosi qui vengono fatte tutte le modifiche del + //NUT: caso e la C_FunCall non se ne deve preoccupare, vedi se lo stesso vale per le altre funzioni + //NUT: speciali presenti nell C_FunCall. + + // 1 more input argument containing the values to be inserted in the matrix. + // #RNU_RES_E + NInArg = NInArg + 1; + InArg(NInArg).Name = SharedInfo.Equal.InArg(SharedInfo.Equal.Nins).Name; + InArg(NInArg).Scope = SharedInfo.Equal.InArg(SharedInfo.Equal.Nins).Scope; +elseif (ASTFunName == 'global') + SharedInfo.SkipNextEqual = 1; + SharedInfo.SkipNextFun = 1; + if (NInArg ~= 1) + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Multiple declaration of global variables is not allowed.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: See example below:',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: global var1 var2; //NOT ALLOWED',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: global var1; //ALLOWED',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: global var2; //ALLOWED',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); + end + if (NOutArg ~= 1) + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Unexpected number of output arguments for global function.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Please report this error to:',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: raffaele.nutricato@tiscali.it',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); + end +end + +// #RNU_RES_B +// -------------------------------------- +// --- Read the function annotations. --- +// -------------------------------------- +// #RNU_RES_E +if (ASTFunName == 'OpEqual') + FunTypeAnnot = ''; + FunSizeAnnot = ''; +else + [FunTypeAnnot,FunSizeAnnot] = FA_GetFunAnn(NInArg,NOutArg,ASTFunName,FileInfo,SharedInfo); +end + +// #RNU_RES_B +// ------------------------------------------------------------------------------------------- +// --- Search for Equal Lhs and precision specifier to be applied to the current function. --- +// ------------------------------------------------------------------------------------------- +// #RNU_RES_E +[LhsArg,NLhsArg,FunPrecSpecifier,SharedInfo] = AST_GetPrecAndLhsArg(OutArg,NOutArg,ASTFunName,FunTypeAnnot,FunSizeAnnot,ASTFunType,FileInfo,SharedInfo); +//NUT: questa funzione contiene troppi parametri e mi sembra disordinata. + +// #RNU_RES_B +// -------------------------------- +// --- Input Arguments Section. --- +// -------------------------------- +// --- Get Input Arguments info from their numerical value or from the symbol table. --- +// #RNU_RES_E +if (ASTFunName == 'global') + [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension,TBScope] = ... + ST_GetSymbolInfo(InArg(1).Name,FileInfo,SharedInfo); + if (TBFlagfound == 1) + InArg(1).Type = TBType; + InArg(1).Size = TBSize; + InArg(1).Value = TBValue; + InArg(1).FindLike = TBFindLike; + InArg(1).Dimension = TBDimension; + InArg(1).Scope = TBScope; + IndentLevelGlobal = 0; //NUT: forced always to 1 + FlagExt = 1; + C_GenDeclarations(InArg(1),CGblDeclarFileName,IndentLevelGlobal,ReportFileName,FlagExt,SharedInfo.ResizeApproach); + else + // #RNU_RES_B + // That means it is the first time we encounter + // this global variable and in C this means that + // we don't have to do nothing. + // #RNU_RES_E + // SharedInfo.SkipNextFun = SharedInfo.SkipNextFun + 1; + SharedInfo.SkipNextFun = 1; + + InArg(1).Type = 'GBLToBeDefined'; + InArg(1).Size(1) = 'GBLToBeDefined'; + InArg(1).Size(2) = 'GBLToBeDefined'; + InArg(1).Value = %nan; + InArg(1).FindLike = %nan; + InArg(1).Dimension = %nan; + InArg(1).Scope = 'Global'; + + // #RNU_RES_B + PrintStringInfo('***Putting global variable in the symbol table***',ReportFileName,'file','y'); + PrintStringInfo(' Symbol ""'+InArg(1).Name+'""',ReportFileName,'file','y'); + + PrintStringInfo(' Type: '+InArg(1).Type,ReportFileName,'file','y'); + PrintStringInfo(' Size(1): '+string(InArg(1).Size(1)),ReportFileName,'file','y'); + PrintStringInfo(' Size(2): '+string(InArg(1).Size(2)),ReportFileName,'file','y'); + PrintStringInfo(' Value: '+string(InArg(1).Value),ReportFileName,'file','y'); + PrintStringInfo(' FindLike: '+string(InArg(1).FindLike),ReportFileName,'file','y'); + PrintStringInfo(' Dimension: '+string(InArg(1).Dimension),ReportFileName,'file','y'); + PrintStringInfo(' Scope: '+string(InArg(1).Scope),ReportFileName,'file','y'); + PrintStringInfo(' ',ReportFileName,'file','y'); + // #RNU_RES_E + + ST_Set(InArg(1).Name,... + InArg(1).Type,... + InArg(1).Size,... + InArg(1).Value,... + InArg(1).FindLike,... + InArg(1).Dimension,... + FileInfo.GlobalVarFileName); + end +else + [InArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo); +end + +// #RNU_RES_B +// ------------------------------------------------------------------- +// --- Change info of Input Argument according to resize approach. --- +// ------------------------------------------------------------------- +//RNU toglimi nella versione da dare ad hartes. +//RNU per ora gestisco solo la resize all con tutte realloc. +//RNU global variables are still coded with fixed size. +// #RNU_RES_E +if (SharedInfo.ResizeApproach=='REALLOC_ALL_RESIZE_ALL') + for cntin = 1:NInArg + if ((InArg(cntin).Dimension > 0)) + // if ((InArg(cntin).Dimension > 0) & (InArg(cntin).Scope ~= 'Global')) + InArg(cntin).Size(1) = '__'+InArg(cntin).Name+'Size[0]'; + InArg(cntin).Size(2) = '__'+InArg(cntin).Name+'Size[1]'; + end + //#RNUREM_MERNU vedi se la seguente fa casino l'ho aggiunta in modo che agia=ones(1,3) sia generata come realloc ma non ho verificato. + tmpscope = InArg(cntin).Scope; + lengthNumber = length('Number_'); + if (part(tmpscope,1:lengthNumber) == 'Number_') + //#RNUREM_ME RNU il problema e' che ones(3,1) allora l'output e' 3,1 e come faccio a trasformare 3 e 1 in simboli in modo tale che realloco anziche' allocare + InArg(cntin).Value = %nan; //RNU non va bene dove per esempio hai problemi di 1:3:4 se al posto dei numeri metti nan ti impalli + //#RNUREM_ME Credo che dove c'e' uan allocazione secca ones(3,1) non vada lasciata cosi' ma tutto vada ricondotto a realloc + //#RNUREM_ME quindi devo vedere nella dichiarazione delle variabili come forzare la dichiarazione dei null pointer. + //#RNUREM_ME successivamente devo vedere come fare a riscrivere la size dell'output. + else + end + end +end + +// #RNU_RES_B +// --------------------------------- +// --- Output Arguments Section. --- +// --------------------------------- +// --- Update Out arg structure with info stored in the function annotations. --- +// #RNU_RES_E +if (ASTFunName == 'OpEqual') + for cntin = 1:NInArg + OutArg(cntin).Type = InArg(cntin).Type; + OutArg(cntin).Size = InArg(cntin).Size; + OutArg(cntin).Dimension = InArg(cntin).Dimension; + OutArg(cntin).Value = InArg(cntin).Value; + OutArg(cntin).FindLike = InArg(cntin).FindLike; + //NUT: forse qui occorre aggiungere lo scope che dovrebbe essere local or global. + //NUT: per ora lo scope viene settato da AST_ParseEqualStruct + end +elseif ((ASTFunName == 'OpMinus') & (NInArg == 1) & (InArg(1).Dimension == 0)&(InArg(1).Scope == 'Number')) + // #RNU_RES_B + // --- Manage OpMinus when applied to scalars. --- + // -1 is not translated as tmp = OpMinus(1), but + // it is considered as a single entity "-1" + // #RNU_RES_E + SharedInfo.SkipNextFun = 1; //RN: SISTEMAMI + OutArg(1).Type = InArg(1).Type; + OutArg(1).Size = InArg(1).Size; + OutArg(1).Dimension = InArg(1).Dimension; + OutArg(1).Value = -InArg(1).Value; + OutArg(1).FindLike = InArg(1).FindLike; + OutArg(1).Scope = 'Number_'+InArg(1).Type; +elseif ((ASTFunName == 'float') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) + // #RNU_RES_B + // --- Manage OpMinus when applied to scalars. --- + // -1 is not translated as tmp = OpMinus(1), but + // it is considered as a single entity "-1" + // #RNU_RES_E + SharedInfo.SkipNextFun = 1; //RN: SISTEMAMI + OutArg(1).Type = InArg(1).Type; + OutArg(1).Size = InArg(1).Size; + OutArg(1).Dimension = InArg(1).Dimension; + OutArg(1).Value = InArg(1).Value; + OutArg(1).FindLike = InArg(1).FindLike; + OutArg(1).Scope = 'Number_s'; +elseif ((ASTFunName == 'double') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) + // #RNU_RES_B + // --- Manage OpMinus when applied to scalars. --- + // -1 is not translated as tmp = OpMinus(1), but + // it is considered as a single entity "-1" + // #RNU_RES_E + SharedInfo.SkipNextFun = 1; + //RN: SISTEMAMI + SharedInfo.SkipNextFun = 1; //RN: SISTEMAMI + OutArg(1).Type = InArg(1).Type; + OutArg(1).Size = InArg(1).Size; + OutArg(1).Dimension = InArg(1).Dimension; + OutArg(1).Value = InArg(1).Value; + OutArg(1).FindLike = InArg(1).FindLike; + OutArg(1).Scope = 'Number_d'; +else + OutArg = FA_GetOutArgInfo(InArg,NInArg,OutArg,NOutArg,SharedInfo,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,ReportFileName); +end + +// #RNU_RES_B +// --- Generate the names for the output arguments. --- +// Update of OutArg.Name and OutArg.Scope fields. +// #RNU_RES_E +if ((ASTFunName == 'OpMinus') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) + OutArg(1).Name = string(OutArg(1).Value); +elseif ((ASTFunName == 'float') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) + OutArg(1).Name = string(OutArg(1).Value); +elseif ((ASTFunName == 'double') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) + OutArg(1).Name = string(OutArg(1).Value); +else + [OutArg,SharedInfo] = GenOutArgNames(ASTFunName,InArg,NInArg,OutArg,NOutArg,LhsArg,NLhsArg,FileInfo,SharedInfo); +end + +// #RNU_RES_B +// --- Push in the AST stack the Output arguments. --- +// #RNU_RES_E +if (ASTFunName == 'OpEqual') + // Do nothing +else + for counteroutargs = 1:NOutArg + tmppushstack = OutArg(counteroutargs).Scope+': '+OutArg(counteroutargs).Name; + // #RNU_RES_B + PrintStringInfo(' Pushing in the AST stack: ""'+tmppushstack+'"".',ReportFileName,'file','y'); + // #RNU_RES_E + AST_PushASTStack(tmppushstack); + end +end + +// #RNU_RES_B +//NUT: verificare se si puo' accorpare qualcosa qui sotto +//RN: non capisco come mai analizzo lo scope dopo che faccio il push nello stack dove lo utilizzo!!! +// --- Scope analysis of the output arguments. --- +// #RNU_RES_E +if (ASTFunName == 'OpMinus' & NInArg == 1 & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) + // Scope already set above. +elseif (ASTFunName == 'float' & NInArg == 1 & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) + // Scope already set above. +elseif (ASTFunName == 'double' & NInArg == 1 & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) + // Scope already set above. +else + OutArg = ST_AnalyzeScope(OutArg,NOutArg,FileInfo,SharedInfo); +end + +//#RNUREM_ME --- Check if the current function is handling for counter variables. --- +[OutArg,SharedInfo] = ST_InsForCntVars(InArg,NInArg,OutArg,NOutArg,ASTFunName,FileInfo,SharedInfo); + +//#RNUREM_ME --- Store the while condition variable (if any). --- +SharedInfo = GetWhileCondVariable(OutArg,NOutArg,ASTFunName,FileInfo,SharedInfo); + +//#RNUREM_ME --- Update Symbol Table with output arguments. --- +if ((ASTFunName == 'OpMinus') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) + //#RNUREM_ME A number is not inserted in the symbol table. +elseif ((ASTFunName == 'float') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) + //#RNUREM_ME A number is not inserted in the symbol table. +elseif ((ASTFunName == 'double') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) + //#RNUREM_ME A number is not inserted in the symbol table. +else + ST_InsOutArg(OutArg,NOutArg,FileInfo,SharedInfo,'all'); +end +//#RNUREM_ME NUT: per risparmiare tempo di esecuzione puoi mettere delle if sulle funzioni che devono +//#RNUREM_ME NUT: essere skippate. + +//#RNU_RES_B +// -------------------------------------------- +// --- Generate the C name of the function. --- +// -------------------------------------------- +//#RNU_RES_E + +CFunName = C_GenerateFunName(ASTFunName,InArg,NInArg,OutArg,NOutArg); +//#RNU_RES_B +PrintStringInfo(' C Function Name: '+CFunName,ReportFileName,'file','y'); +// ------------------------------------------------------------------------- +// --- Determine which library the function belongs to: USER2C or SCI2C. --- +// ------------------------------------------------------------------------- +//#RNU_RES_E +if SCI2Cfileexist(FileInfo.SCI2CLibCAnnFun,ASTFunName+'.ann') + LibTypeInfo = 'SCI2C'; +else + LibTypeInfo = 'USER2C'; +end + +//#RNU_RES_B +// ------------------------------------------------------------------------------------ +// --- Check whether the function has been already called in the current .sci file. --- +// ------------------------------------------------------------------------------------ +//#RNU_RES_E +if (sum(SharedInfo.CFunctsAlreadyCalled == CFunName) == 1) + Flag_FunAlreadyCalled = 1; +else + + //#RNUREM_ME Add the C function name to the list of C functions called in the current .sci file. + SharedInfo.CFunctsAlreadyCalled(size(SharedInfo.CFunctsAlreadyCalled,1)+1) = CFunName; +end + +//#RNU_RES_B +// ---------------------------------- +// --- Generate FunInfo dat file. --- +// ---------------------------------- +//NUT: questo .dat deve essere generato sempre perche' cambiano i nomi degli argomenti mentre il resto dovrebbe +//NUT: essere tutto uguale +//NUT: magari posso fare una funzione che inserisce solo i campi diversi e fa un check su quelli che +//NUT: dovrebbero essere identici. +//#RNU_RES_E +GenCFunDatFiles(ASTFunName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,CFunName,LibTypeInfo,FunInfoDatDir); + +//#RNU_RES_B +// ----------------------------------- +// --- Update SCI2C Function List. --- +// ----------------------------------- +// Functions that are not already available in C are stored +// in the SCI2C Function List and converted in C at the end of +// the translation of the current .sci file. +//NUT: il problema della d0d0OpEqual dovrebbe essere legato al fatto che cerco di fare la opequal legata alla ins... +//NUT: devo evitare di scriveral dentro la lsista delle funzioni da tradurre. +//#RNU_RES_E +SharedInfo = FL_UpdateToBeConv(ASTFunName,CFunName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,FileInfo,SharedInfo); + +//#RNU_RES_B +// ----------------------------------------------- +// --- Check on common input/output arguments. --- +// ----------------------------------------------- +//#RNU_RES_E +if (((ASTFunName=='OpEqual') & (SharedInfo.SkipNextEqual == 1)) | ... + SharedInfo.SkipNextFun > 0 | ... + ((sum(mtlb_strcmp(ASTFunName,SharedInfo.Annotations.DataPrec)) > 0) & (SharedInfo.SkipNextPrec == 1))) + // Do nothing +else + AST_CheckCommonInOutArgs(InArg,NInArg,OutArg,NOutArg,ReportFileName); +end + +//#RNU_RES_B +// ----------------------------- +// --- C Generation Section. --- +// ----------------------------- +// --- Load FunInfo structure. --- +//#RNU_RES_E +FunInfoDatFileName = fullfile(FunInfoDatDir,CFunName+'.dat'); +load(FunInfoDatFileName,'FunInfo'); + +//#RNU_RES_B +// --- Generate include. --- +//#RNU_RES_E +if ((Flag_FunAlreadyCalled == 0) & (FunInfo.LibTypeInfo == 'USER2C') & (SharedInfo.NextCFunName ~= CFunName)) + // (SharedInfo.NextCFunName ~= CFunName) I don't want an include in the same file. Ex. in main.h I don't want include "main.h" + // #RNU_RES_B + PrintStringInfo('Adding include',ReportFileName,'file','y'); + PrintStringInfo('#include ""'+CFunName+'.h""',... + ReportFileName,'file','y'); + // #RNU_RES_E + PrintStringInfo('#include ""'+CFunName+'.h""',... + Pass1HeaderFileName,'file','y'); +end + +//#RNU_RES_B +// --- Generate the C code for the current function. --- +//#RNU_RES_E +FlagCall = 1; +SharedInfo = C_Funcall(FunInfo,FileInfo,SharedInfo,FlagCall); +//#RNU_RES_B +//NUT: anziche farla fare alla cfuncall l'aggiornamento delle skip metti qui una funzione dedicata a cio' +//NUT: e' piu' ordinato. +//#RNU_RES_E + +endfunction diff --git a/macros/ASTManagement/AST_HandleEndProgram.sci b/macros/ASTManagement/AST_HandleEndProgram.sci new file mode 100644 index 00000000..2d6d77a9 --- /dev/null +++ b/macros/ASTManagement/AST_HandleEndProgram.sci @@ -0,0 +1,62 @@ +function SharedInfo = AST_HandleEndProgram(FileInfo,SharedInfo) +// function SharedInfo = AST_HandleEndProgram(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// Handles the EndProgram tag of the AST. +// +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 12-Jun-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName + +IndentLevel = SharedInfo.NIndent; +CCall = ''; +PrintStepInfo('Handling EndProgram',ReportFileName,'file'); +tmpposfirstscalar = SharedInfo.CurrentFunInfo.PosFirstOutScalar; + +if (1==2) + //NUT: disabled because at the moment I am able to decode the return instruction. + if (SharedInfo.CurrentFunInfo.CFunctionName == SharedInfo.CMainFunName) + CCall = CCall+'return(0);'; + else + if (SharedInfo.CurrentFunInfo.PosFirstOutScalar > 0) + CCall = CCall+'return('+SharedInfo.CurrentFunInfo.OutArg(tmpposfirstscalar).Name+');' + end + end + + PrintStringInfo(' '+CCall,ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y'); +end + + +SharedInfo.NIndent = SharedInfo.NIndent - 1; +IndentLevel = SharedInfo.NIndent; +PrintStringInfo(' }',ReportFileName,'file','y'); +PrintStringInfo(C_IndentBlanks(IndentLevel)+'}',CPass1FileName,'file','y'); + +// --- Close the copy of the scilab file. --- +PrintStringInfo(' Closing: '+FileInfo.Funct(nxtscifunnumber).SCICopyFileName,ReportFileName,'file','y'); +mclose(FileInfo.Funct(nxtscifunnumber).SCICopyFileFid); + +endfunction diff --git a/macros/ASTManagement/AST_HandleEndWhile.sci b/macros/ASTManagement/AST_HandleEndWhile.sci new file mode 100644 index 00000000..94649b10 --- /dev/null +++ b/macros/ASTManagement/AST_HandleEndWhile.sci @@ -0,0 +1,76 @@ +function SharedInfo = AST_HandleEndWhile(FileInfo,SharedInfo) +// function SharedInfo = AST_HandleEndWhile(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +//#RNU_RES_B +// Handles the EndWhile tag of the AST. +// +// txt=['While' +// ' WhileExpression:' +// ' '+string(W.expression) +// ' WhileStatements:' +// ' '+objectlist2string(W.statements) +// 'EndWhile'] +//#RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 15-Nov-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; + +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName; +CPass1WhileEpilFileName = FileInfo.Funct(nxtscifunnumber).CPass1WhileEpilFileName(SharedInfo.While.Level); + +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Handling EndWhile***',ReportFileName,'file','y'); +CCall =''; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +//#RNU_RES_B +// ---------------------------- +// --- Generate the C code. --- +// ---------------------------- +// --- Copy Epilogue into C code (Pass1) file. --- +//#RNU_RES_E +[CLinesArray,N_Lines] = File2StringArray(CPass1WhileEpilFileName); +CLinesArray = stripblanks(CLinesArray); + +for tmpcnt = 1:N_Lines-1 + PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CLinesArray(tmpcnt),CPass1FileName,'file','y'); +end +PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent-1)+CLinesArray(N_Lines),CPass1FileName,'file','y'); + +//#RNU_RES_B +// -------------------------- +// --- Update SharedInfo. --- +// -------------------------- +//#RNU_RES_E +SharedInfo.NIndent = SharedInfo.NIndent - 1; + +// ------------------------------- +// --- Delete temporary files. --- +// ------------------------------- +SCI2Cmdelete(CPass1WhileEpilFileName); + +endfunction diff --git a/macros/ASTManagement/AST_HandleFor.sci b/macros/ASTManagement/AST_HandleFor.sci new file mode 100644 index 00000000..e96edd4c --- /dev/null +++ b/macros/ASTManagement/AST_HandleFor.sci @@ -0,0 +1,84 @@ +function FileInfo = AST_HandleFor(FileInfo,SharedInfo) +// function FileInfo = AST_HandleFor(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +//#RNU_RES_B +// Handles the For tag of the AST. +// +// overloading function for "for" type tlist string function +// this is a node of the AST +// fields: +// expression : "expression" type tlist (the loop expression) +// statements : list of "equal" type tlist and list('EOL') (the +// for instructions list) +// txt=['For' +// ' Expression:' +// ' '+string(F.expression) +// ' Statements:' +// ' '+objectlist2string(F.statements) +// 'EndFor'] +// +//#RNU_RES_E +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 10-Nov-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +PfxP1ForProlFileName = FileInfo.Funct(nxtscifunnumber).PfxP1ForProlFileName; +PfxP1ForEpilFileName = FileInfo.Funct(nxtscifunnumber).PfxP1ForEpilFileName; +PrintStepInfo('Handling For',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +//#RNU_RES_B +// --- Signal the entrance in a for expression. --- +//#RNU_RES_E +SharedInfo.ForExpr.OnExec = SharedInfo.ForExpr.OnExec + 1; + +//#RNU_RES_B +// --- Generate the file names for the prologue and epilogue files. --- +//#RNU_RES_E +FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level) = ... + PfxP1ForProlFileName+string(SharedInfo.For.Level)+'.c'; +FileInfo.Funct(nxtscifunnumber).CPass1ForEpilFileName(SharedInfo.For.Level) = ... + PfxP1ForEpilFileName+string(SharedInfo.For.Level)+'.c'; + +//#RNU_RES_B +// --------------------------------------------------------- +// --- Create a copy of the For Prologue/Epilogue Files. --- +// --------------------------------------------------------- +//#RNU_RES_E +PrintStringInfo(' ',FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level),'file'); +PrintStringInfo(' ',FileInfo.Funct(nxtscifunnumber).CPass1ForEpilFileName(SharedInfo.For.Level),'file'); + +//#RNU_RES_B +// ------------------------------------------------------ +// --- Replace the CPass1V1 file with a temp ForFile. --- +// ------------------------------------------------------ +// From now up to Expression: all the C code will be written in a for temporary file. +//#RNU_RES_E +tmpfilename = FileInfo.Funct(nxtscifunnumber).CPass1FileName; +FileInfo.Funct(nxtscifunnumber).CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level); +FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level) = tmpfilename; +PrintStringInfo('Redirecting C code to: '+FileInfo.Funct(nxtscifunnumber).CPass1FileName,FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + +endfunction diff --git a/macros/ASTManagement/AST_HandleForStatem.sci b/macros/ASTManagement/AST_HandleForStatem.sci new file mode 100644 index 00000000..f47538a6 --- /dev/null +++ b/macros/ASTManagement/AST_HandleForStatem.sci @@ -0,0 +1,87 @@ +function [FileInfo,SharedInfo] = AST_HandleForStatem(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +//#RNU_RES_B +// Handles the ForStatements tag of the AST. +// overloading function for "for" type tlist string function +// this is a node of the AST +// fields: +// expression : "expression" type tlist (the loop expression) +// statements : list of "equal" type tlist and list('EOL') (the +// for instructions list) +// txt=['For' +// ' ForExpression:' +// ' '+string(F.expression) +// ' ForStatements:' +// ' '+objectlist2string(F.statements) +// 'EndFor'] +// +//#RNU_RES_E +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 15-Nov-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(2,2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +PrintStepInfo('Handling ForStatements',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +//#RNU_RES_B +// --------------------------------------------- +// --- Resume the correct name for CPass1V1. --- +// --------------------------------------------- +//#RNU_RES_E +tmpfilename = FileInfo.Funct(nxtscifunnumber).CPass1FileName; +FileInfo.Funct(nxtscifunnumber).CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level); +FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level) = tmpfilename; +PrintStringInfo(' Redirecting C code to: '+FileInfo.Funct(nxtscifunnumber).CPass1FileName,FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + +//#RNU_RES_B +// ------------------------ +// --- Generate C code. --- +// ------------------------ +//#RNU_RES_E +SharedInfo = C_ForExpression(FileInfo,SharedInfo); + +//#RNU_RES_B +// -------------------------- +// --- Update SharedInfo. --- +// -------------------------- +// Signal the exit from a for expression. +//#RNU_RES_E +SharedInfo.ForExpr.OnExec = SharedInfo.ForExpr.OnExec - 1; +SharedInfo.ForExpr.IntCntArg = []; +SharedInfo.ForExpr.MtxValCntArg = []; +SharedInfo.ForExpr.SclValCntArg = []; +SharedInfo.ForExpr.OpColonInfoIn1 = ''; +SharedInfo.ForExpr.OpColonInfoIn2 = ''; +SharedInfo.ForExpr.OpColonInfoIn3 = ''; + + +SharedInfo.ForExpr.AssignmentFun = 0; + +// ------------------------------- +// --- Delete temporary files. --- +// ------------------------------- +SCI2Cmdelete(FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level)); + +endfunction diff --git a/macros/ASTManagement/AST_HandleHeader.sci b/macros/ASTManagement/AST_HandleHeader.sci new file mode 100644 index 00000000..7439b784 --- /dev/null +++ b/macros/ASTManagement/AST_HandleHeader.sci @@ -0,0 +1,245 @@ +function SharedInfo = AST_HandleHeader(ASTHeader,FileInfo,SharedInfo) +// function SharedInfo = AST_HandleHeader(ASTHeader,FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// Handles the Header of the AST. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-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; + +FunctionName = ASTHeader.Name; +if (mtlb_strcmp(ASTHeader.Name,SharedInfo.NextSCIFunName) == %F) + SCI2CerrorFile('Very strange! AST Name field ""'+ASTHeader.Name+... + '""is different from function name ""'+SharedInfo.NextSCIFunName+'"".',ReportFileName); +end +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// ------------------------------------- +// --- Extract info from AST header. --- +// ------------------------------------- +TmpInNames = tokens(ASTHeader.Inputs,' '); +TmpOutNames = tokens(ASTHeader.Outputs,' '); + +//#RNU_RES_B +// Remove Variable: Number: or String: specifier. +//#RNU_RES_E +NInArg = 0; +for tmpcnt = 1:size(TmpInNames,1) + TmpSingleName = TmpInNames(tmpcnt); + if ((TmpSingleName == 'Variable:') | ... + (TmpSingleName == 'String:') | ... + (TmpSingleName == 'Number:')) + // Skip the specifier. + else + NInArg = NInArg + 1; + InNames(NInArg) = TmpSingleName; + end +end + +//#RNU_RES_B +// Remove Variable: Number: or String: specifier. +//#RNU_RES_E +NOutArg = 0; +for tmpcnt = 1:size(TmpOutNames,1) + TmpSingleName = TmpOutNames(tmpcnt); + if ((TmpSingleName == 'Variable:') | ... + (TmpSingleName == 'String:') | ... + (TmpSingleName == 'Number_x:') | ... + (TmpSingleName == 'Number_s:') | ... + (TmpSingleName == 'Number_d:') | ... + (TmpSingleName == 'Number_c:') | ... + (TmpSingleName == 'Number_z:')) + // Skip the specifier. + else + NOutArg = NOutArg + 1; + OutNames(NOutArg) = TmpSingleName; + end +end + +if (mtlb_strcmp(InNames(1),'')) + NInArg = 0; +else + NInArg = size(InNames,1); +end + +if ((OutNames(1)=='') | (FunctionName == 'ins')) + //#RNU_RES_B + //NUT: Force ins to have 0 args. Double check it. + //#RNU_RES_E + + NOutArg = 0; +else + NOutArg = size(OutNames,1); +end + + +//#RNU_RES_B +// ------------------------------------- +// --- Load the C function dat file. --- +// ------------------------------------- +//NUT: This load is useful expecially for the second approach. In this case we are not using +//NUT: the size info. +//#RNU_RES_E +load(fullfile(FileInfo.FunctionList.FunInfoDatDir,SharedInfo.NextCFunName+'.dat'),'FunInfo'); + +SharedInfo.CurrentFunInfo = FunInfo; +clear FunInfo + +//#RNU_RES_B +// ----------------------------------------------------------------------------- +// --- Check coherence between In/Out names and In/Out Arg structure loaded. --- +// ----------------------------------------------------------------------------- +//#RNU_RES_E +if (length(SharedInfo.CurrentFunInfo.InArg(1).Name) > 0) + NInArgDat = size(SharedInfo.CurrentFunInfo.InArg,1); +else + NInArgDat = 0; +end + +if (NInArgDat == NInArg) + for tmpcnt = 1:NInArg + SharedInfo.CurrentFunInfo.InArg(tmpcnt).Name = InNames(tmpcnt); + if (SharedInfo.CurrentFunInfo.InArg(tmpcnt).Dimension == 0) + SharedInfo.CurrentFunInfo.InArg(tmpcnt).Size(1) = '1'; + SharedInfo.CurrentFunInfo.InArg(tmpcnt).Size(2) = '1'; + SharedInfo.CurrentFunInfo.InArg(tmpcnt).Value = %nan; + else + //#RNU_RES_B + //NUT: using approach 1: Setting for input and output arguments symbolic sizes. + //#RNU_RES_E + SharedInfo.CurrentFunInfo.InArg(tmpcnt).Size(1) = '__'+SharedInfo.CurrentFunInfo.InArg(tmpcnt).Name+'Size[0]'; + SharedInfo.CurrentFunInfo.InArg(tmpcnt).Size(2) = '__'+SharedInfo.CurrentFunInfo.InArg(tmpcnt).Name+'Size[1]'; + SharedInfo.CurrentFunInfo.InArg(tmpcnt).Value = %nan; + end + end +else + SCI2CerrorFile('Number of input arguments specified in AST is different from the number specified in .dat file.',ReportFileName); +end + + +if (SharedInfo.CurrentFunInfo.NOutArg == NOutArg) + for tmpcnt = 1:NOutArg + SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Name = OutNames(tmpcnt); + end +else + //#RNU_RES_B + PrintStringInfo('N. of output arguments found in the AST: '+string(NOutArg),ReportFileName,'both','y'); + PrintStringInfo('N. of output arguments found in the call (FunInfo structure): '+string(SharedInfo.CurrentFunInfo.NOutArg),ReportFileName,'both','y'); + //#RNU_RES_E + SCI2CerrorFile('Number of output arguments specified in AST is different from the number specified in .dat file.',ReportFileName); +end +//#RNU_RES_B +//NUT: using approach 1: Setting for input and output arguments symbolic sizes. +//#RNU_RES_E +SharedInfo.CurrentFunInfo.OutArg = ... + FA_GetOutArgInfo(SharedInfo.CurrentFunInfo.InArg,NInArg,... + SharedInfo.CurrentFunInfo.OutArg,NOutArg,... + SharedInfo,... + SharedInfo.CurrentFunInfo.FunPrecSpecifier,... + SharedInfo.CurrentFunInfo.FunTypeAnnot,SharedInfo.CurrentFunInfo.FunSizeAnnot,ReportFileName); + +//#RNU_RES_B +// ------------------------------------------------------------------------- +// --- Stores InArg structure into the temporary variables symbol table. --- +// ------------------------------------------------------------------------- +//#RNU_RES_E +SymbTableFileName = FileInfo.Funct(nxtscifunnumber).LocalVarFileName; + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Putting Input and Output arguments in the local symbol table***',ReportFileName,'file','y'); +// #RNU_RES_E +for tmpcnt = 1:NInArg + //#RNU_RES_B + PrintStringInfo(' Symbol ""'+SharedInfo.CurrentFunInfo.InArg(tmpcnt).Name+'""',ReportFileName,'file','y'); + PrintStringInfo(' Setting symbol ""'+SharedInfo.CurrentFunInfo.InArg(tmpcnt).Name+'"" in '+SymbTableFileName+'.',ReportFileName,'file','y'); + //#RNU_RES_E + + ST_Set(SharedInfo.CurrentFunInfo.InArg(tmpcnt).Name,... + SharedInfo.CurrentFunInfo.InArg(tmpcnt).Type,... + SharedInfo.CurrentFunInfo.InArg(tmpcnt).Size,... + SharedInfo.CurrentFunInfo.InArg(tmpcnt).Value,... + SharedInfo.CurrentFunInfo.InArg(tmpcnt).FindLike,... + SharedInfo.CurrentFunInfo.InArg(tmpcnt).Dimension,... + SymbTableFileName); + //#RNU_RES_B + PrintStringInfo(' Type: '+SharedInfo.CurrentFunInfo.InArg(tmpcnt).Type,ReportFileName,'file','y'); + PrintStringInfo(' Size(1): '+string(SharedInfo.CurrentFunInfo.InArg(tmpcnt).Size(1)),ReportFileName,'file','y'); + PrintStringInfo(' Size(2): '+string(SharedInfo.CurrentFunInfo.InArg(tmpcnt).Size(2)),ReportFileName,'file','y'); + PrintStringInfo(' Value: '+string(SharedInfo.CurrentFunInfo.InArg(tmpcnt).Value),ReportFileName,'file','y'); + PrintStringInfo(' FindLike: '+string(SharedInfo.CurrentFunInfo.InArg(tmpcnt).FindLike),ReportFileName,'file','y'); + PrintStringInfo(' Dimension: '+string(SharedInfo.CurrentFunInfo.InArg(tmpcnt).Dimension),ReportFileName,'file','y'); + PrintStringInfo(' ',ReportFileName,'file','y'); + //#RNU_RES_E +end + +// -------------------------------------------------------------------------- +// --- Stores OutArg structure into the temporary variables symbol table. --- +// -------------------------------------------------------------------------- +//NUT: verifica se puoi usare l'outarg2symboltable qui. +for tmpcnt = 1:NOutArg + //#RNU_RES_B + PrintStringInfo(' Symbol ""'+SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Name+'""',ReportFileName,'file','y'); + + PrintStringInfo(' Setting symbol ""'+SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Name+'"" in '+SymbTableFileName+'.',ReportFileName,'file','y'); + //#RNU_RES_E + + ST_Set(SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Name,... + SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Type,... + SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Size,... + SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Value,... + SharedInfo.CurrentFunInfo.OutArg(tmpcnt).FindLike,... + SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Dimension,... + SymbTableFileName); + //#RNU_RES_B + PrintStringInfo(' Type: '+SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Type,ReportFileName,'file','y'); + PrintStringInfo(' Size(1): '+string(SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Size(1)),ReportFileName,'file','y'); + PrintStringInfo(' Size(2): '+string(SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Size(2)),ReportFileName,'file','y'); + PrintStringInfo(' Value: '+string(SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Value),ReportFileName,'file','y'); + PrintStringInfo(' FindLike: '+string(SharedInfo.CurrentFunInfo.OutArg(tmpcnt).FindLike),ReportFileName,'file','y'); + PrintStringInfo(' Dimension: '+string(SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Dimension),ReportFileName,'file','y'); + PrintStringInfo(' ',ReportFileName,'file','y'); + //#RNU_RES_E + +end + +//#RNU_RES_B +// ----------------------------------------------- +// --- Check on common input/output arguments. --- +// ----------------------------------------------- +//#RNU_RES_E +AST_CheckCommonInOutArgs(SharedInfo.CurrentFunInfo.InArg,NInArg,SharedInfo.CurrentFunInfo.OutArg,NOutArg,ReportFileName); + +//#RNU_RES_B +// ------------------------ +// --- Generate C code. --- +// ------------------------ +//#RNU_RES_E +FlagCall = 0; +SharedInfo = C_Funcall(SharedInfo.CurrentFunInfo,FileInfo,SharedInfo,FlagCall); +SharedInfo.NIndent = SharedInfo.NIndent+1; // Increase indentation level. + +endfunction diff --git a/macros/ASTManagement/AST_HandleIfElse.sci b/macros/ASTManagement/AST_HandleIfElse.sci new file mode 100644 index 00000000..5373adf6 --- /dev/null +++ b/macros/ASTManagement/AST_HandleIfElse.sci @@ -0,0 +1,92 @@ +function [FileInfo,SharedInfo] = AST_HandleIfElse(FileInfo,SharedInfo,ASTIfExpType) +// function [FileInfo,SharedInfo] = AST_HandleIfElse(FileInfo,SharedInfo,ASTIfExpType) +// ----------------------------------------------------------------- +//#RNU_RES_B +// Handles the Else If tag of the AST. +// +// overloading function for "ifthenel" type tlist string function +// this is a node of the AST +// fields: +// expression : "expression" type tlist (the if expression) +// then : list of "equal" type tlist and list('EOL') (the +// then instructions list) +// elseifs : a list of tlists +// else : list of "equal" type tlist and list('EOL') (the +// else instructions list) +// txt=['If ' +// ' Expression:' +// ' '+string(I.expression) +// ' If Statements' +// ' '+objectlist2string(I.then)] +// for e=I.elseifs +// txt=[txt; +// ' Else If Expression' +// ' '+string(e.expression) +// ' Else If Statements' +// ' '+objectlist2string(e.then)] +// end +// txt=[txt; +// ' Else Statements' +// ' '+objectlist2string(I.else) +// 'EndIf'] +// +// Input data: +// ASTIfExpType: it specifies if we are handling a if condition (ASTIfExpType='if') +// or an elseif condition (ASTIfExpType='elseif') or else statement (ASTIfExpType='else') +//#RNU_RES_E +// //NUT: add description here +// +// +// Output data: +// //NUT: add description here +// +// +// Status: +// 11-Apr-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; +PrintStepInfo('Handling If Statements',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + +global SCI2CSTACK +global StackPosition; +global STACKDEDUG +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +//#RNU_RES_B +// --------------------------------------------------- +// --- Retrieve If Expression Parameters from AST. --- +// --------------------------------------------------- +//#RNU_RES_E +if (ASTIfExpType~='else') + [IfCondArg,NIfCondArg] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType); +else + // "else" type doesn't contain any condition to test. + IfCondArg = ''; + NIfCondArg = 0; +end + +//#RNU_RES_B +// ----------------------------- +// --- C Generation Section. --- +// ----------------------------- +// --- Generate the C code for if/elseif Expression. --- +//#RNU_RES_E +SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo,SharedInfo); + +endfunction diff --git a/macros/ASTManagement/AST_HandleWhileExpr.sci b/macros/ASTManagement/AST_HandleWhileExpr.sci new file mode 100644 index 00000000..ffcf2f45 --- /dev/null +++ b/macros/ASTManagement/AST_HandleWhileExpr.sci @@ -0,0 +1,80 @@ +function [FileInfo,SharedInfo] = AST_HandleWhileExpr(FileInfo,SharedInfo) +// function [FileInfo,SharedInfo] = AST_HandleWhileExpr(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +//#RNU_RES_B +// Handles the WhileExpression tag of the AST. +// +// txt=['While' +// ' WhileExpression:' +// ' '+string(W.expression) +// ' WhileStatements:' +// ' '+objectlist2string(W.statements) +// 'EndWhile'] +// +//#RNU_RES_E +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 29-Dec-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +PfxP1WhileProlFileName = FileInfo.Funct(nxtscifunnumber).PfxP1WhileProlFileName; +PfxP1WhileEpilFileName = FileInfo.Funct(nxtscifunnumber).PfxP1WhileEpilFileName; +PrintStepInfo('Handling While',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +//#RNU_RES_B +// --- Signal the entrance in a while expression. --- +//#RNU_RES_E +SharedInfo.WhileExpr.OnExec = SharedInfo.WhileExpr.OnExec + 1; + +//#RNU_RES_B +// --- Generate the file names for the prologue and epilogue files. --- +//#RNU_RES_E +FileInfo.Funct(nxtscifunnumber).CPass1WhileProlFileName(SharedInfo.While.Level) = ... + PfxP1WhileProlFileName+string(SharedInfo.While.Level)+'.c'; +FileInfo.Funct(nxtscifunnumber).CPass1WhileEpilFileName(SharedInfo.While.Level) = ... + PfxP1WhileEpilFileName+string(SharedInfo.While.Level)+'.c'; + +//#RNU_RES_B +// ----------------------------------------------------------- +// --- Create a copy of the While Prologue/Epilogue Files. --- +// ----------------------------------------------------------- +//#RNU_RES_E +PrintStringInfo(' ',FileInfo.Funct(nxtscifunnumber).CPass1WhileProlFileName(SharedInfo.While.Level),'file'); +PrintStringInfo(' ',FileInfo.Funct(nxtscifunnumber).CPass1WhileEpilFileName(SharedInfo.While.Level),'file'); + +//#RNU_RES_B +// -------------------------------------------------------- +// --- Replace the CPass1V1 file with a temp WhileFile. --- +// -------------------------------------------------------- +// From now up to Expression: all the C code will be written in a while temporary file. +//#RNU_RES_E +tmpfilename = FileInfo.Funct(nxtscifunnumber).CPass1FileName; +FileInfo.Funct(nxtscifunnumber).CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1WhileProlFileName(SharedInfo.While.Level); +FileInfo.Funct(nxtscifunnumber).CPass1WhileProlFileName(SharedInfo.While.Level) = tmpfilename; +//#RNU_RES_B +PrintStringInfo('Redirecting C code to: '+FileInfo.Funct(nxtscifunnumber).CPass1FileName,FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); +//#RNU_RES_E + +endfunction diff --git a/macros/ASTManagement/AST_HandleWhileStatem.sci b/macros/ASTManagement/AST_HandleWhileStatem.sci new file mode 100644 index 00000000..5c823ab3 --- /dev/null +++ b/macros/ASTManagement/AST_HandleWhileStatem.sci @@ -0,0 +1,119 @@ +function [FileInfo,SharedInfo] = AST_HandleWhileStatem(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +//#RNU_RES_B +// Handles the WhileStatements tag of the AST. +// +// txt=['While' +// ' WhileExpression:' +// ' '+string(W.expression) +// ' WhileStatements:' +// ' '+objectlist2string(W.statements) +// 'EndWhile'] +// +//#RNU_RES_E +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 20-Jan-2008 -- Edoardo Nutricato: Author. +// 20-Jan-2008 -- Rubby Nutricato: Minor Changes. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +//#RNU_RES_B + +//NUT: accertati che l'epilogo e il prologo del while siano effettivamente differenti o se +//NUT: si puo' avere un solo file utilizzato sia per il prologo che per l'epilogo. + +//NUT: da sistemare senza le global +//#RNU_RES_E +global SCI2CSTACK +global StackPosition; +global STACKDEDUG + + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +CPass1WhileProlFileName = FileInfo.Funct(nxtscifunnumber).CPass1WhileProlFileName(SharedInfo.While.Level); +PrintStepInfo('Handling WhileStatements',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +//#RNU_RES_B +// ----------------------------------------------- +// --- Resume the correct name while CPass1V1. --- +// ----------------------------------------------- +//#RNU_RES_E +tmpfilename = FileInfo.Funct(nxtscifunnumber).CPass1FileName; +FileInfo.Funct(nxtscifunnumber).CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1WhileProlFileName(SharedInfo.While.Level); +FileInfo.Funct(nxtscifunnumber).CPass1WhileProlFileName(SharedInfo.While.Level) = tmpfilename; +CPass1WhileProlFileName = FileInfo.Funct(nxtscifunnumber).CPass1WhileProlFileName(SharedInfo.While.Level); +PrintStringInfo(' Redirecting C code to: '+FileInfo.Funct(nxtscifunnumber).CPass1FileName,FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + +//#RNU_RES_B +// ------------------------ +// --- Generate C code. --- +// ------------------------ +//#RNU_RES_E +if(SharedInfo.WhileExpr.CondVar == '') + //#RNU_RES_B + // It means that we are handling something like while(a) or while(1) + // The while condition variable is generated by the HandleEndGenFun. + //#RNU_RES_E + + // --- Pop the name of the condition variable or number. --- + Pop1 = AST_PopASTStack(); + + [ArgName,ArgScope] = AST_ExtractNameAndScope(Pop1); + if (length(ArgName) == 0) + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Expected while(variable) or while(number).','','stdout','y'); + PrintStringInfo('SCI2CERROR: Expected a variable or number in the AST while expression.','','stdout','y'); + PrintStringInfo('SCI2CERROR: Report this error to raffaele.nutricato@tiscali.it.','','stdout','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); + SCI2Cerror('Expected a conditional variable in the while expression'); + end + + SharedInfo.WhileExpr.CondVar = ArgName; + //#RNU_RES_B + // --- Repush strings into the AST stack. --- + //#RNU_RES_E + + AST_PushASTStack(Pop1); + +elseif (SharedInfo.WhileExpr.DimCondVar > 0) + SCI2CerrorFile('Cannot manage while with matrix conditions',ReportFileName); +end +SharedInfo = C_WhileExpression(FileInfo,SharedInfo); + +// -------------------------- +// --- Update SharedInfo. --- +// -------------------------- +// Signal the exit from a while expression. +SharedInfo.WhileExpr.OnExec = SharedInfo.WhileExpr.OnExec - 1; +SharedInfo.WhileExpr.CondVar = ''; +SharedInfo.WhileExpr.DimCondVar = -1; +SharedInfo.WhileExpr.AssignmentFun = 0; //NUT: siamo sicuri che serva? + +// ------------------------------- +// --- Delete temporary files. --- +// ------------------------------- +SCI2Cmdelete(CPass1WhileProlFileName); + +endfunction diff --git a/macros/ASTManagement/AST_ParseEqualStruct.sci b/macros/ASTManagement/AST_ParseEqualStruct.sci new file mode 100644 index 00000000..3d917682 --- /dev/null +++ b/macros/ASTManagement/AST_ParseEqualStruct.sci @@ -0,0 +1,168 @@ +function [FunctionName,InArg,NInArg,OutArg,NOutArg] = AST_ParseEqualStruct(FileInfo,SharedInfo) +// function [FunctionName,InArg,NInArg,OutArg,NOutArg] = AST_ParseEqualStruct(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +//#RNU_RES_B +// Parses the Equal structure of the AST. +// Structure of Equal: +// txt=['Equal' +// ' Expression: ' +// ' '+string(e.expression) +// ' Lhs : ' +// ' '+objectlist2string(e.lhs) +// 'EndEqual' +// ] +//#RNU_RES_E +// +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; + +global SCI2CSTACK +global StackPosition; +global STACKDEDUG + +//#RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y','n'); +PrintStringInfo('***Reading AST***',ReportFileName,'file','y','n'); +//#RNU_RES_E + +// ------------------------------- +// --- Read Output parameters. --- +// ------------------------------- +LhsField = AST_PopASTStack(); +NOutArg = 0; +OutputArgumentNames = []; +OutputArgumentScope = []; +while (LhsField ~= 'Lhs :') + NOutArg = NOutArg + 1; + [OutputArgumentNames(NOutArg),OutputArgumentScope(NOutArg)] = AST_ExtractNameAndScope(LhsField); + LhsField = AST_PopASTStack(); + if (LhsField == 'Expression:') + SCI2Cerror('Found Expression: before Lhs'); + elseif (LhsField == 'Equal') + SCI2Cerror('Found Equal before Lhs'); + end +end +OutputArgumentNames = SCI2Cflipud(OutputArgumentNames); +OutputArgumentScope = SCI2Cflipud(OutputArgumentScope); + +// ------------------------------ +// --- Read input parameters. --- +// ------------------------------ +ExprField = AST_PopASTStack(); +NInArg = 0; +InputArgumentNames = []; +while (ExprField ~= 'Expression:') + NInArg = NInArg + 1; + [InputArgumentNames(NInArg),InputArgumentScope(NInArg)] = AST_ExtractNameAndScope(ExprField); + ExprField = AST_PopASTStack(); + if (ExprField == 'Equal') + SCI2Cerror('Found Equal before Lhs'); + end +end +InputArgumentNames = SCI2Cflipud(InputArgumentNames); +InputArgumentScope = SCI2Cflipud(InputArgumentScope); + +//#RNU_RES_B +// ------------------------------ +// --- Extract function name. --- +// ------------------------------ +//#RNU_RES_E +FunctionName = AST_PopASTStack(); +if (FunctionName ~= 'Equal') then + SCI2Cerror('Problems with Equal, Expected Equal tag.'); +end +FunctionName = 'OpEqual'; + +//#RNU_RES_B +// ------------------------------------- +// --- Generate the InArg structure. --- +// ------------------------------------- +//#RNU_RES_E +InArg = []; +for counterinputargs = 1:NInArg + InArg(counterinputargs).Name=InputArgumentNames(counterinputargs); + InArg(counterinputargs).Scope=InputArgumentScope(counterinputargs); +end + +//#RNU_RES_B +// ------------------------------------- +// --- Generate the InArg structure. --- +// ------------------------------------- +//#RNU_RES_E +OutArg = []; +for counteroutputargs = 1:NOutArg + OutArg(counteroutputargs).Name=OutputArgumentNames(counteroutputargs); + OutArg(counteroutputargs).Scope=OutputArgumentScope(counteroutputargs); +end + +// ------------------------ +// --- Print Some Info. --- +// ------------------------ +//#RNU_RES_B +PrintStringInfo('Function Name: '+FunctionName,ReportFileName,'file','y','n'); +PrintStringInfo('N Intput Arguments: '+string(NInArg),ReportFileName,'file','y','n'); +//#RNU_RES_E +if (SharedInfo.Equal.Nins > 0) + //#RNU_RES_B + PrintStringInfo('N ins functions: '+string(SharedInfo.Equal.Nins),ReportFileName,'file','y'); + //#RNU_RES_E + for counterinputargs = 1:NInArg + //#RNU_RES_B + PrintStringInfo('Input Argument Number '+string(counterinputargs)+': '+InArg(counterinputargs).Name,... + ReportFileName,'file','y'); + PrintStringInfo(' Scope: '+InArg(counterinputargs).Scope,... + ReportFileName,'file','y'); + //#RNU_RES_E + end + if (NInArg ~= SharedInfo.Equal.Nins) + SCI2CerrorFile('Number of input arguments must be equal to number of ins functions.',ReportFileName); + end +else + //#RNU_RES_B + PrintStringInfo('N Output Arguments: '+string(NOutArg),ReportFileName,'file','y'); + //#RNU_RES_E + for counterinputargs = 1:NInArg + //#RNU_RES_B + PrintStringInfo('Input Argument Number '+string(counterinputargs)+': '+InArg(counterinputargs).Name,... + ReportFileName,'file','y','n'); + PrintStringInfo(' Scope: '+InArg(counterinputargs).Scope,... + ReportFileName,'file','y','n'); + //#RNU_RES_E + end + for counteroutputargs = 1:NOutArg + //#RNU_RES_B + PrintStringInfo('Output Argument Number '+string(counteroutputargs)+': '+OutArg(counteroutputargs).Name,... + ReportFileName,'file','y','n'); + PrintStringInfo(' Scope: '+OutArg(counterinputargs).Scope,... + ReportFileName,'file','y','n'); + //#RNU_RES_E + end + if (NInArg ~= NOutArg) + SCI2CerrorFile('Number of input arguments must be equal to number of output arguments.',ReportFileName); + end +end + +endfunction diff --git a/macros/ASTManagement/AST_ParseFuncallStruct.sci b/macros/ASTManagement/AST_ParseFuncallStruct.sci new file mode 100644 index 00000000..5840c05e --- /dev/null +++ b/macros/ASTManagement/AST_ParseFuncallStruct.sci @@ -0,0 +1,116 @@ +function [FunctionName,InArg,NInArg,NOutArg] = AST_ParseFuncallStruct(FileInfo,SharedInfo) +// function [FunctionName,InArg,NInArg,NOutArg] = AST_ParseFuncallStruct(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +//#RNU_RES_B +// Extracts Input Arguments, Output Arguments and Function Name +// from the AST. +// +// Structure of Funcall: +// overloading function for "funcall" type tlist string function +// this is a node of the AST +// fields: +// rhs : a list +// name : string, the name of the function +// lhsnb: number, the number of function lhs +// txt=['Funcall : '+F.name +// ' #lhs : '+string(F.lhsnb) +// ' Rhs : ' +// ' '+objectlist2string(F.rhs) +// 'EndFuncall' +// ] +// +//#RNU_RES_E +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +// #RNU_RES_B +PrintStringInfo(' Parsing Funcall structure',ReportFileName,'file','y'); +// #RNU_RES_E +global SCI2CSTACK +global StackPosition; +global STACKDEDUG + + +// ------------------------------ +// --- Read input parameters. --- +// ------------------------------ +RhsField = AST_PopASTStack(); +NInArg = 0; +while (RhsField ~= 'Rhs :') + NInArg = NInArg + 1; + [InputArgumentNames(NInArg),InputArgumentScope(NInArg)] = AST_ExtractNameAndScope(RhsField); + RhsField = AST_PopASTStack(); + if (RhsField == '#lhs :') + SCI2Cerror('Found #lhs before Rhs'); + elseif (RhsField == 'Funcall :') + SCI2Cerror('Found Funcall before Rhs'); + end +end +if (stripblanks(InputArgumentNames(NInArg)) == '') + NInArg = 0; + InputArgumentNames = []; + InputArgumentScope = []; +end +InputArgumentNames = SCI2Cflipud(InputArgumentNames); +InputArgumentScope = SCI2Cflipud(InputArgumentScope); + +// -------------------------------------------- +// --- Extract number of output parameters. --- +// -------------------------------------------- +buffstring = AST_PopASTStack(); +NOutArg = eval(stripblanks(part(buffstring,10:length(buffstring)))); + +// ------------------------------ +// --- Extract function name. --- +// ------------------------------ +buffstring = AST_PopASTStack(); +FunctionName = stripblanks(part(buffstring,12:length(buffstring))); + +// ------------------------------------- +// --- Generate the InArg structure. --- +// ------------------------------------- +InArg = []; +for counterinputargs = 1:NInArg + if (InputArgumentNames(counterinputargs) == 'r') + InputArgumentNames(counterinputargs) = 'rr'; //NUT: per ora cerco di risolvere cosi' il baco sulla 'r' + end + InArg(counterinputargs).Name=InputArgumentNames(counterinputargs); + InArg(counterinputargs).Scope=InputArgumentScope(counterinputargs); +end + +//#RNU_RES_B +PrintStringInfo('Function Name: '+FunctionName,ReportFileName,'file','y','n'); +PrintStringInfo('N Intput Arguments: '+string(NInArg),ReportFileName,'file','y','n'); +PrintStringInfo('N Output Arguments: '+string(NOutArg),ReportFileName,'file','y','n'); +//#RNU_RES_E +for counterinputargs = 1:NInArg + //#RNU_RES_B + PrintStringInfo('Input Argument Number '+string(counterinputargs)+': '+InArg(counterinputargs).Name,... + ReportFileName,'file','y','n'); + PrintStringInfo(' Scope: '+InArg(counterinputargs).Scope,... + ReportFileName,'file','y','n'); + //#RNU_RES_E +end + +endfunction diff --git a/macros/ASTManagement/AST_ParseIfExprStruct.sci b/macros/ASTManagement/AST_ParseIfExprStruct.sci new file mode 100644 index 00000000..12ad077a --- /dev/null +++ b/macros/ASTManagement/AST_ParseIfExprStruct.sci @@ -0,0 +1,119 @@ +function [IfCondArg,NIfCondArg] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType) +// function [IfCondArg,NIfCondArg] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType) +// ----------------------------------------------------------------- +//#RNU_RES_B +// Parses the IfExpression structure of the AST. +// +// txt=['If ' +// ' Expression:' +// ' '+string(I.expression) +// ' If Statements' +// ' '+objectlist2string(I.then)] +// for e=I.elseifs +// txt=[txt; +// ' Else If Expression' +// ' '+string(e.expression) +// ' Else If Statements' +// ' '+objectlist2string(e.then)] +// end +// txt=[txt; +// ' Else Statements' +// ' '+objectlist2string(I.else) +// 'EndIf'] +// +//#RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-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; +//#RNU_RES_B +PrintStringInfo('***Retrieving '+ASTIfExpType+' expression parameters from AST***',ReportFileName,'file','y'); +//#RNU_RES_E +IfCondArg = []; +NIfCondArg = 0; + +global SCI2CSTACK +global StackPosition; +global STACKDEDUG +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// ------------------------------------ +// --- Read if condition variables. --- +// ------------------------------------ +flagendpop = 0; +IfExprField = AST_PopASTStack(); +if (ASTIfExpType=='if') + if (IfExprField=='Expression:') + flagendpop = 1; + // Pop Again the If tag from the AST. + IfExprField = AST_PopASTStack(); + end +elseif (ASTIfExpType=='elseif') + if (IfExprField=='Else If Expression') + flagendpop = 1; + end +else + SCI2CerrorFile('Unknown ASTIfExpType ""'+ASTIfExpType+'"".',ReportFileName); +end + +while (flagendpop == 0) + if (IfExprField~='') + if (ASTIfExpType=='if') + if (IfExprField=='Expression:') + flagendpop = 1; + // Pop Again the If tag from the AST. + IfExprField = AST_PopASTStack(); + else + NIfCondArg = NIfCondArg + 1; + [IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField); + end + elseif (ASTIfExpType=='elseif') + if (IfExprField=='Else If Expression') + flagendpop = 1; + else + NIfCondArg = NIfCondArg + 1; + IfCondArg(NIfCondArg) = IfExprField; + [IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField); + end + end + end + IfExprField = AST_PopASTStack(); +end + +//#RNU_RES_B +// ------------------------------------------- +// --- Print some info in the report file. --- +// ------------------------------------------- +PrintStringInfo('N '+ASTIfExpType+' Condition Arguments: '+string(NIfCondArg),ReportFileName,'file','y'); +//#RNU_RES_E +for counterifcondargs = 1:NIfCondArg + //#RNU_RES_B + PrintStringInfo(ASTIfExpType+' Condition Argument Number '+string(counterifcondargs)+': '+IfCondArg(counterifcondargs),... + ReportFileName,'file','y'); + //#RNU_RES_E +end + +endfunction diff --git a/macros/ASTManagement/AST_ParseOperStruct.sci b/macros/ASTManagement/AST_ParseOperStruct.sci new file mode 100644 index 00000000..179c5578 --- /dev/null +++ b/macros/ASTManagement/AST_ParseOperStruct.sci @@ -0,0 +1,127 @@ +function [FunctionName,InArg,NInArg,NOutArg] = AST_ParseOperStruct(FileInfo,SharedInfo) +// function [FunctionName,InArg,NInArg,NOutArg] = AST_ParseOperStruct(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +//#RNU_RES_B +// Parses the Operation structure of the AST. +// +// Structure of Operation: +//overloading function for "operation" type tlist string function +//this is a node of the AST +//fields: +// operands: a list +// operator: a string +// txt=['Operation' +// ' Operands:' +// ' '+objectlist2string(O.operands) +// ' Operator: '+O.operator +// 'EndOperation' +// ] +// +//#RNU_RES_E +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Reading AST***',ReportFileName,'file','y'); + +global SCI2CSTACK +global StackPosition; +global STACKDEDUG +// --------------------------- +// --- End Initialization. --- +// --------------------------- + + +// ------------------------------ +// --- Extract function name. --- +// ------------------------------ +buffstring = AST_PopASTStack(); +LabelFunctName = 'Operator: '; +FunctionName = stripblanks(part(buffstring,length(LabelFunctName)+1:length(buffstring))); +// Generate the proper function name. +FunctionName = Operator2FunName(FunctionName); + +// ------------------------------ +// --- Read input parameters. --- +// ------------------------------ +RhsField = AST_PopASTStack(); +NInArg = 0; +while (RhsField ~= 'Operands:') + NInArg = NInArg + 1; + [InputArgumentNames(NInArg),InputArgumentScope(NInArg)] = AST_ExtractNameAndScope(RhsField); + RhsField = AST_PopASTStack(); + if (RhsField == 'Operation') + SCI2Cerror('Found Operation before Rhs'); + end +end + +if (stripblanks(InputArgumentNames(NInArg)) == '') + //NUT: forse non serve per l'operation + NInArg = 0; + InputArgumentNames = []; + InputArgumentScope = []; +end +InputArgumentNames = SCI2Cflipud(InputArgumentNames); +InputArgumentScope = SCI2Cflipud(InputArgumentScope); + +//#RNU_RES_B +// Remove tag "Operation" from the stack. +//#RNU_RES_E +OperationField = AST_PopASTStack(); +if (OperationField ~= 'Operation') then + SCI2Cerror('Problems with Operation, Expected Operation tag.'); +end + +// -------------------------------------------- +// --- Extract number of output parameters. --- +// -------------------------------------------- +if (FunctionName == 'ins') + NOutArg = 0; // It is always 1. Double check it! +else + NOutArg = 1; // It is always 1. Double check it! +end +// ------------------------------------- +// --- Generate the InArg structure. --- +// ------------------------------------- +InArg = []; +for counterinputargs = 1:NInArg + InArg(counterinputargs).Name=InputArgumentNames(counterinputargs); + InArg(counterinputargs).Scope=InputArgumentScope(counterinputargs); +end + +//#RNU_RES_B +PrintStringInfo('Operation Name: '+FunctionName,ReportFileName,'file','y'); +PrintStringInfo('N Intput Arguments: '+string(NInArg),ReportFileName,'file','y'); +PrintStringInfo('N Output Arguments: '+string(NOutArg),ReportFileName,'file','y'); +//#RNU_RES_E +for counterinputargs = 1:NInArg + //#RNU_RES_B + PrintStringInfo('Input Argument Number '+string(counterinputargs)+': '+InArg(counterinputargs).Name,... + ReportFileName,'file','y'); + PrintStringInfo(' Scope: '+InArg(counterinputargs).Scope,... + ReportFileName,'file','y'); + //#RNU_RES_E +end + +endfunction diff --git a/macros/ASTManagement/AST_PopASTStack.sci b/macros/ASTManagement/AST_PopASTStack.sci new file mode 100644 index 00000000..bff1d9fa --- /dev/null +++ b/macros/ASTManagement/AST_PopASTStack.sci @@ -0,0 +1,40 @@ +function stackelement = AST_PopASTStack() +// function stackelement = AST_PopASTStack() +// ----------------------------------------------------------------- +// Pop the AST stack. +// +// Input data: +// --- +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Aug-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + +global SCI2CSTACK; +global StackPosition; +global STACKDEDUG; + +if StackPosition == 1 + SCI2Cerror('Stack empty. Cannot pop from stack.'); +end + +stackelement = SCI2CSTACK(StackPosition,1); +SCI2CSTACK = SCI2CSTACK(1:StackPosition-1); +StackPosition = StackPosition - 1; + +if (STACKDEDUG == 1) + AST_DisplayStack(); +end + +endfunction diff --git a/macros/ASTManagement/AST_PushASTStack.sci b/macros/ASTManagement/AST_PushASTStack.sci new file mode 100644 index 00000000..34cd883b --- /dev/null +++ b/macros/ASTManagement/AST_PushASTStack.sci @@ -0,0 +1,36 @@ +function AST_PushASTStack(stackelement) +// function AST_PushASTStack(stackelement) +// ----------------------------------------------------------------- +// Push the AST stack. +// +// Input data: +// --- +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Aug-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + + +global SCI2CSTACK +global StackPosition; +global STACKDEDUG + +StackPosition = StackPosition + 1; +SCI2CSTACK(StackPosition,1) = stackelement; + +if (STACKDEDUG == 1) + AST_DisplayStack(); +end + +endfunction diff --git a/macros/ASTManagement/AST_ReadASTHeader.sci b/macros/ASTManagement/AST_ReadASTHeader.sci new file mode 100644 index 00000000..3df6cd28 --- /dev/null +++ b/macros/ASTManagement/AST_ReadASTHeader.sci @@ -0,0 +1,90 @@ +function ASTHeader = AST_ReadASTHeader(fidAST,ReportFileName) +// function ASTHeader = AST_ReadASTHeader(fidAST,ReportFileName) +// ----------------------------------------------------------------- +// Reads the AST header +// txt=['Program' +// 'Name : '+p.name +// 'Outputs: '+strcat(objectlist2string(p.outputs),' ') +// 'Inputs : '+strcat(objectlist2string(p.inputs),' ') +// 'Statements ' +// +// Input data: +// //NUT: add description here +// +// +// Output data: +// //NUT: add description here +// +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + + +ASTHeader = []; + +tline = mgetl(fidAST,1); +AST_CheckLineLength(tline); +treeline = stripblanks(tline); +if STACKDEDUG == 1 + disp('Read AST Line: '+treeline); +end +if (SCI2Cstrncmps1size('Program',treeline) == %F) + SCI2CerrorFile('Expected ""Program"" label in the AST',ReportFileName); +end + +tline = mgetl(fidAST,1); +AST_CheckLineLength(tline); +treeline = stripblanks(tline); +if STACKDEDUG == 1 + disp('Read AST Line: '+treeline); +end +if (SCI2Cstrncmps1size('Name : ',treeline) == %F) + SCI2CerrorFile('Expected ""Name : "" label in the AST',ReportFileName); +else + ASTHeader.Name = stripblanks(part(treeline,length('Name : ')+1:length(treeline))); +end + +tline = mgetl(fidAST,1); +AST_CheckLineLength(tline); +treeline = stripblanks(tline); +if STACKDEDUG == 1 + disp('Read AST Line: '+treeline); +end +if (SCI2Cstrncmps1size('Outputs: ',treeline) == %F) + SCI2CerrorFile('Expected ""Outputs: "" label in the AST',ReportFileName); +else + ASTHeader.Outputs = stripblanks(part(treeline,length('Outputs: ')+1:length(treeline))); +end + +tline = mgetl(fidAST,1); +AST_CheckLineLength(tline); +treeline = stripblanks(tline); +if STACKDEDUG == 1 + disp('Read AST Line: '+treeline); +end +if (SCI2Cstrncmps1size('Inputs : ',treeline) == %F) + SCI2CerrorFile('Expected ""Inputs : "" label in the AST',ReportFileName); +else + ASTHeader.Inputs = stripblanks(part(treeline,length('Inputs : ')+1:length(treeline))); +end + +tline = mgetl(fidAST,1); +AST_CheckLineLength(tline); +treeline = stripblanks(tline); +if STACKDEDUG == 1 + disp('Read AST Line: '+treeline); +end +if (SCI2Cstrncmps1size('Statements ',treeline) == %F) + SCI2CerrorFile('Expected ""Statements "" label in the AST',ReportFileName); +end + +endfunction diff --git a/macros/ASTManagement/AST_ReadEqualRhsNames.sci b/macros/ASTManagement/AST_ReadEqualRhsNames.sci new file mode 100644 index 00000000..96ec3ebe --- /dev/null +++ b/macros/ASTManagement/AST_ReadEqualRhsNames.sci @@ -0,0 +1,61 @@ +function [RhsNames,RhsScope,NRhs] = AST_ReadEqualRhsNames(FileInfo,SharedInfo) +// function [RhsNames,RhsScope,NRhs] = AST_ReadEqualRhsNames(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; + +global SCI2CSTACK +global StackPosition; +global STACKDEDUG + +//#RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Reading Equal Rhs Names***',ReportFileName,'file','y'); +//#RNU_RES_E + +// ------------------------------- +// --- Read Output parameters. --- +// ------------------------------- +cntpop = 1; +NRhs = 0; +RhsField(cntpop) = AST_PopASTStack(); +RhsNames = []; +while (RhsField(cntpop) ~= 'Expression:') + NRhs = NRhs + 1; + [RhsNames(NRhs),RhsScope(NRhs)] = AST_ExtractNameAndScope(RhsField(cntpop)); + cntpop = cntpop + 1; + RhsField(cntpop) = AST_PopASTStack(); +end +RhsNames = SCI2Cflipud(RhsNames); +RhsScope = SCI2Cflipud(RhsScope); + +// --- Repush everything into the stack. --- +for cntpush = cntpop:-1:1 + AST_PushASTStack(RhsField(cntpush)); +end + +endfunction diff --git a/macros/ASTManagement/GenOutArgNames.sci b/macros/ASTManagement/GenOutArgNames.sci new file mode 100644 index 00000000..d31d4ca5 --- /dev/null +++ b/macros/ASTManagement/GenOutArgNames.sci @@ -0,0 +1,89 @@ +function [OutArg,SharedInfo] = GenOutArgNames(FunctionName,InArg,NInArg,OldOutArg,NOutArg,LhsArg,NLhsArg,FileInfo,SharedInfo) +// function [OutArg,SharedInfo] = GenOutArgNames(FunctionName,OutArg,NOutArg,LhsArg,NLhsArg,FileInfo,SharedInfo) +// ----------------------------------------------------------------- +//#RNU_RES_B +// Generate the names for the temporary variables that store the +// output arguments. +//#RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// OutArg: is the Output arguments structure containing the field +// name that specifies the output argument names. +// //NUT: add description here +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),9,9); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +// #RNU_RES_B +PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y'); +// #RNU_RES_E +OutArg = OldOutArg; + +//#RNU_RES_B +// --------------------------------------------------------------------------------------- +// --- Generate the names for the temporary variables that store the output arguments. --- +// --------------------------------------------------------------------------------------- +// At this step only the name of the output arguments can be generated. --- +//#RNU_RES_E +if (NLhsArg > 0) + //#RNU_RES_B + // Use the equal Lhs names. + PrintStringInfo('Using Equal Lhs names.',ReportFileName,'file','y'); + //#RNU_RES_E + if (NLhsArg ~= NOutArg) + SCI2CerrorFile('NLhsArg='+string(NLhsArg)+' must be equal to NOutArg='+string(NOutArg)+'.',ReportFileName); + end + for counteroutputargs = 1:NOutArg + OutArg(counteroutputargs).Name=LhsArg(counteroutputargs).Name; + OutArg(counteroutputargs).Scope=LhsArg(counteroutputargs).Scope; + end +else + //#RNU_RES_B + // Generate temporary variables. + PrintStringInfo('Generating temporary variables.',ReportFileName,'file','y'); + //#RNU_RES_E + if ((sum(mtlb_strcmp(FunctionName,SharedInfo.Annotations.DataPrec)) > 0) & ... + (SharedInfo.SkipNextPrec == 1)) + //#RNU_RES_B + PrintStringInfo(' Skipping code generating because already generated in the previous function.',ReportFileName,'file','y'); + //#RNU_RES_E + for counteroutputargs = 1:NOutArg + OutArg(counteroutputargs).Name = InArg(counteroutputargs).Name; + end + elseif (mtlb_strcmp(FunctionName,'OpEqual')) + // do nothing. + //NUT: verifica questa parte di codice. e' sicuro che se ho equal gli oldoutarg contengono gia' il nome? + else + for counteroutputargs = 1:NOutArg + if ((SharedInfo.ASTReader.EnableTempVarsReuse == 1) & ... + (length(SharedInfo.ASTReader.ReusableTempVars) > 0)) + TmpOutArgName = strcat([SharedInfo.ASTReader.TempVarsName,string(SharedInfo.ASTReader.ReusableTempVars(1))]); + SharedInfo.ASTReader.ReusableTempVars = SharedInfo.ASTReader.ReusableTempVars(2:$); + else + SharedInfo.ASTReader.UsedTempVars = SharedInfo.ASTReader.UsedTempVars + 1; + TmpOutArgName = strcat([SharedInfo.ASTReader.TempVarsName,string(SharedInfo.ASTReader.UsedTempVars)]); + end + OutArg(counteroutputargs).Name=TmpOutArgName; + end + end +end + +endfunction diff --git a/macros/ASTManagement/Operator2FunName.sci b/macros/ASTManagement/Operator2FunName.sci new file mode 100644 index 00000000..1ca5825b --- /dev/null +++ b/macros/ASTManagement/Operator2FunName.sci @@ -0,0 +1,119 @@ +function FunName = Operator2FunName(OperatorName); +// ----------------------------------------------------------------- +// Returns the function name corresponding to the input operator. +// From intmacr2tree.c we have: +// char *operators[]={"+","-","*",".*","*.",".*.","/","./","/.","./.", +// "\\",".\\","\\.",".\\.","^","==","<",">","<=",">=","~=", +// ":","rc","ins","ext","'","cc","|","&","~",".^",".'","cceol"}; +// I also added "<>". +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 29-May-2007 -- Nutricato Raffaele: Changed code into a function. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +//NUT: non e' inserito il "\" verifica come mai. +//NUT: il ".\" l'ho inserito io + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +FuncPrefix = 'Op'; +FuncSuffix = ''; + +if (OperatorName == '+') + FunName = FuncPrefix+'Plus'+FuncSuffix; +elseif (OperatorName == '-') + FunName = FuncPrefix+'Minus'+FuncSuffix; +elseif (OperatorName == '*') + FunName = FuncPrefix+'Star'+FuncSuffix; +elseif (OperatorName == '.*') + FunName = FuncPrefix+'DotStar'+FuncSuffix; +elseif (OperatorName == '*.') + PrintStringInfo('SCI2CERROR: Operator ""'+OperatorName+'"" not supported.','','stout','y'); + SCI2Cerror(' '); +elseif (OperatorName == '.*.') + PrintStringInfo('SCI2CERROR: Operator ""'+OperatorName+'"" not supported.','','stout','y'); + SCI2Cerror(' '); +elseif (OperatorName == '/') + FunName = FuncPrefix+'Slash'+FuncSuffix; +elseif (OperatorName == './') + FunName = FuncPrefix+'DotSlash'+FuncSuffix; +elseif (OperatorName == '/.') + PrintStringInfo('SCI2CERROR: Operator ""'+OperatorName+'"" not supported.','','stout','y'); + SCI2Cerror(' '); +elseif (OperatorName == './.') + PrintStringInfo('SCI2CERROR: Operator ""'+OperatorName+'"" not supported.','','stout','y'); + SCI2Cerror(' '); +elseif (OperatorName == '.\') + FunName = FuncPrefix+'DotBackSlash'+FuncSuffix; +elseif (OperatorName == '\') + //PrintStringInfo('SCI2CERROR: Operator ""'+OperatorName+'"" not supported.','','stout','y'); + //SCI2Cerror(' '); + FunName = FuncPrefix+'BackSlash'+FuncSuffix; +elseif (OperatorName == '.\') + PrintStringInfo('SCI2CERROR: Operator ""'+OperatorName+'"" not supported.','','stout','y'); + SCI2Cerror(' '); +elseif (OperatorName == '\.') + PrintStringInfo('SCI2CERROR: Operator ""'+OperatorName+'"" not supported.','','stout','y'); + SCI2Cerror(' '); +elseif (OperatorName == '.\.') + PrintStringInfo('SCI2CERROR: Operator ""'+OperatorName+'"" not supported.','','stout','y'); + SCI2Cerror(' '); +elseif (OperatorName == '^') + FunName = FuncPrefix+'Hat'+FuncSuffix; +elseif (OperatorName == '.^') + FunName = FuncPrefix+'DotHat'+FuncSuffix; +elseif (OperatorName == '''') + FunName = FuncPrefix+'Apex'+FuncSuffix; +elseif (OperatorName == '.''') + FunName = FuncPrefix+'DotApex'+FuncSuffix; +elseif (OperatorName == '==') + FunName = FuncPrefix+'LogEq'+FuncSuffix; +elseif (OperatorName == '<') + FunName = FuncPrefix+'LogLt'+FuncSuffix; +elseif (OperatorName == '>') + FunName = FuncPrefix+'LogGt'+FuncSuffix; +elseif (OperatorName == '<=') + FunName = FuncPrefix+'LogLe'+FuncSuffix; +elseif (OperatorName == '>=') + FunName = FuncPrefix+'LogGe'+FuncSuffix; +elseif (OperatorName == '~=') + FunName = FuncPrefix+'LogNe'+FuncSuffix; +elseif (OperatorName == '<>') + FunName = FuncPrefix+'LogNe'+FuncSuffix; +elseif (OperatorName == '|') + FunName = FuncPrefix+'LogOr'+FuncSuffix; +elseif (OperatorName == '&') + FunName = FuncPrefix+'LogAnd'+FuncSuffix; +elseif (OperatorName == '~') + FunName = FuncPrefix+'LogNot'+FuncSuffix; +elseif (OperatorName == ':') + FunName = FuncPrefix+'Colon'+FuncSuffix; +elseif (OperatorName == 'rc') + FunName = 'OpRc'; +elseif (OperatorName == 'cc') + FunName = 'OpCc'; +elseif (OperatorName == 'ins') + FunName = 'OpIns'; +elseif (OperatorName == 'ext') + FunName = 'OpExt'; +elseif (OperatorName == 'cceol') + PrintStringInfo('SCI2CERROR: Operator ""'+OperatorName+'"" not supported.','','stout','y'); + SCI2Cerror(' '); +else + PrintStringInfo('SCI2CERROR: Unknown Operator ""'+OperatorName+'.','','stout','y'); + SCI2Cerror(' '); +end + +endfunction diff --git a/macros/ASTManagement/SciFile2ASTFile.sci b/macros/ASTManagement/SciFile2ASTFile.sci new file mode 100644 index 00000000..be978c57 --- /dev/null +++ b/macros/ASTManagement/SciFile2ASTFile.sci @@ -0,0 +1,36 @@ +function SciFile2ASTFile(SciFile,ASTFile); +// function SciFile2ASTFile(SciFile,ASTFile); +// ----------------------------------------------------------------- +// This function makes use of the macr2tree function to generate +// the ASTFile containing the AST (Abstract Syntactic Tree) of the +// input Scilab function (SciFile). +// +// Input data: +// SciFile: full path of the input function. +// ASTFile: full path of the file that will store the AST. +// +// Output data: +// --- +// +// Status: +// 12-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +exec(SciFile); +[tmppath,ScilabFunName,tmpext] = fileparts(SciFile); +AST=eval('macr2tree('+ScilabFunName+')'); + + +[ASTx,ASTierr]=fileinfo(ASTFile); +if ASTierr == 0 + mdelete(ASTFile); +end + +fd = mopen(ASTFile, "wt"); +mputl(string(AST), fd); +mclose(fd); + +endfunction diff --git a/macros/ASTManagement/buildmacros.sce b/macros/ASTManagement/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/macros/ASTManagement/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/ASTManagement/objectlist2string.sci b/macros/ASTManagement/objectlist2string.sci new file mode 100644 index 00000000..26a38962 --- /dev/null +++ b/macros/ASTManagement/objectlist2string.sci @@ -0,0 +1,13 @@ +function txt=objectlist2string(L) +//auxiliary function for conversion of a list of objects +//into a string vector + txt=[]; + for o=L, + if type(o)==15 then //EOL case + txt=[txt;'<'+o(1)+'>'], + else + txt=[txt; string(o)], + end + end + if txt==[] then txt='',end +endfunction diff --git a/macros/CCodeGeneration/C_FinalizeCode.sci b/macros/CCodeGeneration/C_FinalizeCode.sci new file mode 100644 index 00000000..5c26dd85 --- /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 diff --git a/macros/CCodeGeneration/C_ForExpression.sci b/macros/CCodeGeneration/C_ForExpression.sci new file mode 100644 index 00000000..4e75c066 --- /dev/null +++ b/macros/CCodeGeneration/C_ForExpression.sci @@ -0,0 +1,217 @@ +function SharedInfo = C_ForExpression(FileInfo,SharedInfo) +// function SharedInfo = C_ForExpression(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// Get function for a generic SCI2C table. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 15-Nov-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; + +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName; +CPass1ForProlFileName = FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level); +CDeclarationFileName = FileInfo.Funct(nxtscifunnumber).CDeclarationFileName; +CPass1ForEpilFileName = FileInfo.Funct(nxtscifunnumber).CPass1ForEpilFileName(SharedInfo.For.Level); + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Generating C code***',ReportFileName,'file','y','n'); +// #RNU_RES_E +CCall =''; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// ---------------------------- +// --- Generate the C call. --- +// ---------------------------- + +// ------------------------- +// --- Manage all cases. --- +// ------------------------- +if (SharedInfo.ForExpr.AssignmentFun == SharedInfo.CFunId.EqScalar) + // #RNU_RES_B + // --------------- + // --- Case 1. --- + // --------------- + PrintStringInfo(' Handling For Expression with scalar equal.',ReportFileName,'file','y'); + + // for a = 10 or for a = sin(tan(b)) where b is scalar: + // In this case non for loops are needed.--> Do nothing! + + // ------------------------------------------------------------------------------------- + // --- Generate Prologue and Epilogue -> Copy the first N-1 lines of the for.c code. --- + // ------------------------------------------------------------------------------------- + // #RNU_RES_E + [C_Strings,NumCStrings] = File2StringArray(FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level)); + C_Strings = stripblanks(C_Strings); + + for cntstr = 1:NumCStrings + // #RNU_RES_B + // Prologue + // #RNU_RES_E + PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+C_Strings(cntstr),CPass1FileName,'file','y'); + end + // #RNU_RES_B + // Epilogue + // #RNU_RES_E + PrintStringInfo(' ',CPass1ForEpilFileName ,'file','y'); + +elseif (SharedInfo.ForExpr.AssignmentFun == SharedInfo.CFunId.OpColon) + // #RNU_RES_B + // --------------- + // --- Case 2. --- + // --------------- + // for a = 1:10 + PrintStringInfo(' Handling For Expression with OpColon.',ReportFileName,'file','y'); + // #RNU_RES_E + + // #RNU_RES_B + // ------------------------------------------------------------------------------------- + // --- Generate Prologue and Epilogue -> Copy the first N-1 lines of the for.c code. --- + // ------------------------------------------------------------------------------------- + // #RNU_RES_E + [C_Strings,NumCStrings] = File2StringArray(FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level)); + C_Strings = stripblanks(C_Strings); + for cntstr = 1:NumCStrings + // #RNU_RES_B + // Prologue + // #RNU_RES_E + PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+C_Strings(cntstr),CPass1FileName,'file','y','n'); + // #RNU_RES_B + // Epilogue + // #RNU_RES_E + if (length(C_Strings(cntstr)) == 0) + C_Strings(cntstr) = ' '; // RNU for Bruno: If I don't do that I get a PrintStringInfo error related to mputstr. + // Function not defined for given argument type(s), + // check arguments or define function %0_mputstr for overloading. + end + PrintStringInfo(string(C_Strings(cntstr)),CPass1ForEpilFileName ,'file','y','n'); + end + // #RNU_RES_B + // ---------------------------------------- + // --- Insert "}" in the epilogue file. --- + // ---------------------------------------- + // #RNU_RES_E + PrintStringInfo('}',CPass1ForEpilFileName ,'file','y'); + + // #RNU_RES_B + // ------------------------------ + // --- Insert for expression. --- + // ------------------------------ + // #RNU_RES_E + CCall = 'for('+SharedInfo.ForExpr.SclValCntArg.Name+' = '+SharedInfo.ForExpr.OpColonInfoIn1+'; '... + +SharedInfo.ForExpr.SclValCntArg.Name+' <= '+SharedInfo.ForExpr.OpColonInfoIn3+'; '... + +SharedInfo.ForExpr.SclValCntArg.Name+' += '+SharedInfo.ForExpr.OpColonInfoIn2+')'; + PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); + + // #RNU_RES_B + // ------------------- + // --- Insert "{". --- + // ------------------- + // #RNU_RES_E + CCall = '{'; + PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); + + // --------------------------------- + // --- Update Indentation Level. --- + // --------------------------------- + SharedInfo.NIndent = SharedInfo.NIndent + 1; + +elseif (SharedInfo.ForExpr.AssignmentFun == SharedInfo.CFunId.EqMatrix | ... + SharedInfo.ForExpr.AssignmentFun == SharedInfo.CFunId.GenFunMtx) + // #RNU_RES_B + // --------------- + // --- Case 3. --- + // --------------- + PrintStringInfo(' Handling For Expression with Matrix Equal/Function.',ReportFileName,'file','y'); + + // for cnt = TMP where TMP is a matrix + // for cnt = fun(TMP) where TMP is a matrix + // Conversion is performed as shown in the following example: + // init code for temp vars --> copy all for.c code (up to last-1 line) into C pass1 code. + // intSCI2C __forcnt1; --> declaration file. + // replace in the last C line CntArg.Name with '__TmpVal'+CntArg.Name + // for (__forcnt1 = 0; __forcnt1 < CntArg.Size(1)*CntArg.Size(2); __forcnt1++) + // { + // CntArg.Name = '__TmpVal'+CntArg.Name[__forcnt1]; + // init code for temp vars + // } + + // ------------------------------------------------------------------------------------- + // --- Generate Prologue and Epilogue -> Copy the first N-1 lines of the for.c code. --- + // ------------------------------------------------------------------------------------- + // #RNU_RES_E + [C_Strings,NumCStrings] = File2StringArray(FileInfo.Funct(nxtscifunnumber).CPass1ForProlFileName(SharedInfo.For.Level)); + C_Strings = stripblanks(C_Strings); + + for cntstr = 1:NumCStrings + // Prologue + PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+C_Strings(cntstr),CPass1FileName,'file','y'); + // Epilogue + PrintStringInfo(C_Strings(cntstr),CPass1ForEpilFileName ,'file','y'); + end + + // #RNU_RES_B + // ---------------------------------------- + // --- Insert "}" in the epilogue file. --- + // ---------------------------------------- + // #RNU_RES_E + PrintStringInfo('}',CPass1ForEpilFileName ,'file','y'); + + // ------------------------------ + // --- Insert for expression. --- + // ------------------------------ + CCall = 'for('+SharedInfo.ForExpr.IntCntArg.Name+' = 0'+'; '+... + SharedInfo.ForExpr.IntCntArg.Name+' < '+SharedInfo.ForExpr.MtxValCntArg.Size(1)+'*'+SharedInfo.ForExpr.MtxValCntArg.Size(2)+'; '+... + SharedInfo.ForExpr.IntCntArg.Name+'++)'; + PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); + + // ------------------- + // --- Insert "{". --- + // ------------------- + CCall = '{'; + PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); + + // --------------------------------- + // --- Update Indentation Level. --- + // --------------------------------- + SharedInfo.NIndent = SharedInfo.NIndent + 1; + + // #RNU_RES_B + // ---------------------------------------------------- + // --- Add code to read the element of CntArg.Name. --- + // ---------------------------------------------------- + // #RNU_RES_E + CCall = SharedInfo.ForExpr.SclValCntArg.Name+' = '+SharedInfo.ForExpr.MtxValCntArg.Name+'['+SharedInfo.ForExpr.IntCntArg.Name+'];'; + PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); + +else + // --------------- + // --- Case 5. --- + // --------------- + + SCI2Cerror('Could not manage the for expression.'); +end + +endfunction diff --git a/macros/CCodeGeneration/C_Funcall.sci b/macros/CCodeGeneration/C_Funcall.sci new file mode 100644 index 00000000..456fe1e4 --- /dev/null +++ b/macros/CCodeGeneration/C_Funcall.sci @@ -0,0 +1,395 @@ +function SharedInfo = C_Funcall(FunInfo,FileInfo,SharedInfo,FlagCall) +// function SharedInfo = C_Funcall(FunInfo,FileInfo,SharedInfo,FlagCall) +// ----------------------------------------------------------------- +// Get function for a generic SCI2C table. +// +// 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),4,4); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; + +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName; +CPass1FreeFileName = FileInfo.Funct(nxtscifunnumber).CPass1FreeFileName; +HeaderFileName = FileInfo.Funct(nxtscifunnumber).Pass1HeaderFileName; +CDeclarationFileName = FileInfo.Funct(nxtscifunnumber).CDeclarationFileName; +CInitVarsFileName = FileInfo.Funct(nxtscifunnumber).CInitVarsFileName; +IndentLevel = SharedInfo.NIndent; +CCall = ''; + +// --- Extract Function Info. --- +FunctionName = FunInfo.SCIFunctionName; +CFunName = FunInfo.CFunctionName; +InArg = FunInfo.InArg; +NInArg = FunInfo.NInArg; +OutArg = FunInfo.OutArg; +NOutArg = FunInfo.NOutArg; +PosFirstOutScalar = FunInfo.PosFirstOutScalar; + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Generating C code***',ReportFileName,'file','y'); +// #RNU_RES_E +// --------------------------- +// --- End Initialization. --- +// --------------------------- + + +// -------------------------------------------------- +// --- Manage anticipated exit from the function. --- +// -------------------------------------------------- +if (SharedInfo.SkipNextFun > 0) + SharedInfo.SkipNextFun = SharedInfo.SkipNextFun - 1; + return; +end + +// #RNU_RES_B +// Exit if the function is a precision specifier and the corresponding flag is 1. +// #RNU_RES_E +if ((sum(mtlb_strcmp(FunctionName,SharedInfo.Annotations.DataPrec)) > 0) & ... + (SharedInfo.SkipNextPrec == 1)) + // #RNU_RES_B + PrintStringInfo(' Skipping code generating because already generated in the previous function.',ReportFileName,'file','y'); + // #RNU_RES_E + SharedInfo.SkipNextPrec = SharedInfo.SkipNextPrec - 1; + return; +end + +// #RNU_RES_B +// Exit if the function is OpEqual and the corresponding skip flag is enabled. +// #RNU_RES_E +if ((mtlb_strcmp(FunctionName,'OpEqual')) & ... + (SharedInfo.SkipNextEqual == 1)) + // #RNU_RES_B + PrintStringInfo(' Skipping code generating because already generated in the previous function.',ReportFileName,'file','y'); + // #RNU_RES_E + SharedInfo.SkipNextEqual = SharedInfo.SkipNextEqual - 1; + return; +end + +// #BJ +// size should be managed as other functions +// otherwise size(4) will lead to a C variable __4Size reference +// wich will never exists + +// #RNU_RES_B +// Exit if the function is size. +// #RNU_RES_E +// if ((mtlb_strcmp(FunctionName,'size'))) +// // #RNU_RES_B +// PrintStringInfo(' Anticipated exit for the size function.',ReportFileName,'file','y'); +// // #RNU_RES_E +// CCall =''; +// if (NInArg == 1) +// if (NOutArg == 1) +// CCall = CCall+OutArg(1).Name+'[0] = __'+InArg(1).Name+'Size[0];'; +// // #RNU_RES_B +// PrintStringInfo(' '+CCall,ReportFileName,'file','y'); +// // #RNU_RES_E +// PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y'); + +// CCall =''; +// CCall = CCall+OutArg(1).Name+'[1] = __'+InArg(1).Name+'Size[1];'; +// // #RNU_RES_B +// PrintStringInfo(' '+CCall,ReportFileName,'file','y'); +// // #RNU_RES_E +// PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y'); +// elseif (NOutArg == 2) +// CCall = CCall+OutArg(1).Name+' = __'+InArg(1).Name+'Size[0];'; +// // #RNU_RES_B +// PrintStringInfo(' '+CCall,ReportFileName,'file','y'); +// // #RNU_RES_E +// PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y'); + +// CCall =''; +// CCall = CCall+OutArg(2).Name+' = __'+InArg(1).Name+'Size[1];'; +// // #RNU_RES_B +// PrintStringInfo(' '+CCall,ReportFileName,'file','y'); +// // #RNU_RES_E +// PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y'); +// else +// SCI2Cerror('Don''t know how to manage size function with number of output args different from 1 and 2.'); +// end +// elseif (NInArg == 2) +// if (NOutArg == 1) +// if (InArg(2).Value == 1) +// CCall = CCall+OutArg(1).Name+' = __'+InArg(1).Name+'Size[0];'; +// // #RNU_RES_B +// PrintStringInfo(' '+CCall,ReportFileName,'file','y'); +// // #RNU_RES_E +// PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y'); +// elseif (InArg(2).Value == 2) +// CCall = CCall+OutArg(1).Name+' = __'+InArg(1).Name+'Size[1];'; +// // #RNU_RES_B +// PrintStringInfo(' '+CCall,ReportFileName,'file','y'); +// // #RNU_RES_E +// PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y'); +// else +// SCI2Cerror('Not known the value of the second input arg for the size function.'); +// end +// else +// SCI2Cerror('Don''t know how to manage size function with number of output args different from 1.'); +// end +// else +// SCI2Cerror('Don''t know how to manage size function with number of input args different from 1 and 2.'); +// end +// return; +// end +// ------------------------------------------------------ +// --- End Manage anticipated exit from the function. --- +// ------------------------------------------------------ + +// #RNU_RES_B +// ------------------------------------------------------------ +// --- Allocate memory and size array for output arguments. --- +// ------------------------------------------------------------ +// #RNU_RES_E +if (FlagCall == 1) +// #RNU_RES_B +//RNU qui va tolto tutto una volta sicuri che la memallocout puo' essere fatta dentro la st_insoutarg +// C_MemAllocOutTempVars(OutArg,NOutArg,CPass1FileName,CPass1FreeFileName,IndentLevel,ReportFileName); +// #RNU_RES_E +end + +// ---------------------------- +// --- Generate the C call. --- +// ---------------------------- +CCall =''; +if (FunInfo.CFunctionName == SharedInfo.CMainFunName) + if (FlagCall == 1) + SCI2Cerror('main function called in a source code!'); + else + CCall =CCall+'SCI2Cint '; + end +else + if (PosFirstOutScalar >= 1) + if (FlagCall == 1) + CCall = CCall+OutArg(PosFirstOutScalar).Name+' = '; + else + CCall = CCall+C_Type(OutArg(PosFirstOutScalar).Type)+' '; + end + else + if (FlagCall == 0) + CCall = CCall+'void '; + end + end +end + + +CCall = CCall+CFunName+'('; +// #RNU_RES_B +PrintStringInfo(' C call after output scalar args check: '+CCall,ReportFileName,'file','y'); +// #RNU_RES_E +clear counterin +for counterin = 1:NInArg + + if (InArg(counterin).Type == 'g' & InArg(counterin).Scope == 'String') + TmpInArgName = '""'+InArg(counterin).Name+'""'; + elseif (InArg(counterin).Type == 'z' & (InArg(counterin).Scope == 'Number')) + TmpInArgName = 'DoubleComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; + elseif (InArg(counterin).Type == 'c' & (InArg(counterin).Scope == 'Number')) + TmpInArgName = 'FloatComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; + else + TmpInArgName = InArg(counterin).Name; + end + + TmpInArgType = C_Type(InArg(counterin).Type); + + //if (FunctionName == 'OpEqual') + // TmpInArgSizeVar = '__'+OutArg(counterin).Name+'Size'; + // else + TmpInArgSizeVar = '__'+InArg(counterin).Name+'Size'; + //end + + if (InArg(counterin).Dimension == 0) + if (FlagCall == 0) + CCall = CCall+TmpInArgType+' '; + end + CCall = CCall+TmpInArgName+','; + else + if (FlagCall == 0) + CCall = CCall+TmpInArgType+'* '+TmpInArgName+', SCI2Cint* __'+TmpInArgName+'Size,'; + else + CCall = CCall+TmpInArgName+', '+TmpInArgSizeVar+','; + end + end +end +// #RNU_RES_B +PrintStringInfo(' C call after input args analysis: '+CCall,ReportFileName,'file','y'); +// #RNU_RES_E +for counterout = 1:NOutArg + TmpOutArgName = OutArg(counterout).Name; + TmpOutArgType = C_Type(OutArg(counterout).Type); + if (counterout == PosFirstOutScalar) + if (FlagCall == 0) + // #RNU_RES_B + // --- Write in the declaration file the returned output scalar (if any). --- + // #RNU_RES_E + outscalardeclaration = TmpOutArgType+' '+TmpOutArgName+';'; + // #RNU_RES_B + PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); + // #RNU_RES_E + PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CDeclarationFileName,'file','y'); + PrintStringInfo(' ',CDeclarationFileName,'file','y'); + end + else + if (OutArg(counterout).Dimension == 0) + if (FlagCall == 0) + // --- Write in the declaration file the returned output scalar (if any). --- + outscalardeclaration = TmpOutArgType+' '+TmpOutArgName+';'; + PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CDeclarationFileName,'file','y'); + PrintStringInfo(' ',CDeclarationFileName,'file','y'); + CCall = CCall+TmpOutArgType+'* __ptr'+TmpOutArgName+', '; + else + CCall = CCall+'&'+TmpOutArgName+', ';//NUT: verifica se ci vuole l'& + end + else + if (FlagCall == 0) + CCall = CCall+TmpOutArgType+'* '+TmpOutArgName+','; + if (OutArg(counterout).FindLike == 1) + CCall = CCall+'SCI2Cint* __'+TmpOutArgName+'Size'+','; + end + // #RNU_RES_B + //NUT prova a sostituire le variabili strutture con variabili dichiarate all'inizio del codice. + // --- Declare the size of the output arguments. --- + // #RNU_RES_E + outscalardeclaration = 'SCI2Cint __'+TmpOutArgName+'Size[2];'; + PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CDeclarationFileName,'file','y'); + outscalardeclaration = '__'+TmpOutArgName+'Size[0] = '+(OutArg(counterout).Size(1))+';'; + PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CInitVarsFileName,'file','y'); + outscalardeclaration = '__'+TmpOutArgName+'Size[1] = '+(OutArg(counterout).Size(2))+';'; + PrintStringInfo(outscalardeclaration,ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+outscalardeclaration,CInitVarsFileName,'file','y'); + PrintStringInfo(' ',CInitVarsFileName,'file','y'); + else + CCall = CCall+OutArg(counterout).Name+','; + if (OutArg(counterout).FindLike == 1) + CCall = CCall+'(SCI2Cint* ) __'+TmpOutArgName+'Size'+','; + end + end + end + end +end +PrintStringInfo(' C call after output args analysis: '+CCall,ReportFileName,'file','y'); +// Remove the last " " and "," +if (part(CCall,length(CCall):length(CCall)) == ' ') + CCall = part(CCall,1:length(CCall)-1); +end +if (part(CCall,length(CCall):length(CCall)) == ',') + CCall = part(CCall,1:length(CCall)-1); +end + +CCall = CCall+')'; +if (FlagCall == 1) + CCall = CCall+';'; +end +//NUT: la parte di generazione della C call va inserita in una funzione a parte. +//NUT: tale funzione deve avere anche uno switch che consenta di generare differenti versioni +//NUT: delle chiamate C in accordo con la libreria disponibile, fermo restando che +//NUT: e' sempre possibile fornire la lista delle macro. +if mtlb_strcmp(FunctionName,'return') + // Here I introduce the pointer assignment for output scalar arguments. + for cntout = 1:SharedInfo.CurrentFunInfo.NOutArg + if (cntout ~= SharedInfo.CurrentFunInfo.PosFirstOutScalar & ... + SharedInfo.CurrentFunInfo.OutArg(cntout).Dimension == 0) + CCall = ''; + CCall = CCall+'*__ptr'+SharedInfo.CurrentFunInfo.OutArg(cntout).Name+' = '+... + SharedInfo.CurrentFunInfo.OutArg(cntout).Name+';'; + PrintStringInfo(' '+CCall,ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y'); + end + end + // --- Then I free the memory dinamically allocated. --- + // ---------------------------- + // --- Handle Free section. --- + // ---------------------------- + PrintStringInfo(C_IndentBlanks(1)+'/*',CPass1FreeFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+'** ------------------------- ',CPass1FreeFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+'** --- End Free Section. --- ',CPass1FreeFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+'** ------------------------- ',CPass1FreeFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+'*/',CPass1FreeFileName,'file','y'); + PrintStringInfo(' ',CPass1FreeFileName,'file','y'); + SCI2Ccopyfile(CPass1FreeFileName,... + CPass1FileName,'append'); + // -------------------------------- + // --- End Handle Free section. --- + // -------------------------------- + + // --- Then I introduce the return to the first scalar output arguments. --- + CCall = ''; + // #RNU_RES_B + //NUT: non capisco questo skip a questo punto. + //NUT: perche' la return finale la sto gestendo nella AST_HandleEndProgram. + PrintStringInfo(' return function of the AST is skipped.',ReportFileName,'file','y'); + //RN provo a non skippare e a mettere la return. + // #RNU_RES_E + if (SharedInfo.CurrentFunInfo.CFunctionName == SharedInfo.CMainFunName) + CCall = CCall+'return(0);'; + else + if (SharedInfo.CurrentFunInfo.PosFirstOutScalar > 0) + CCall = CCall+'return('+SharedInfo.CurrentFunInfo.OutArg(SharedInfo.CurrentFunInfo.PosFirstOutScalar).Name+');' + end + end + // #RNU_RES_B + PrintStringInfo(' '+CCall,ReportFileName,'file','y'); + // #RNU_RES_E + PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y'); +else + // #RNU_RES_B + PrintStringInfo(' '+CCall,ReportFileName,'file','y'); + // #RNU_RES_E + PrintStringInfo(C_IndentBlanks(IndentLevel)+CCall,CPass1FileName,'file','y'); + if (FlagCall == 0) + // Add prototype to the header file + + C_InitHeader(CCall+';',HeaderFileName,SharedInfo.Sci2CLibMainHeaderFName); + + // Add { at the beginning of the function. + PrintStringInfo(' {',ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(IndentLevel)+'{',CPass1FileName,'file','y'); + + end +end + +// #RNU_RES_B +// Add in the C code the new size of the output argument when SCI2Cresize function is called. +// #RNU_RES_E +if (FunctionName == 'SCI2Cresize') + // #RNU_RES_B + PrintStringInfo(' Found SCI2Cresize -> Changing the size of the output argument.',ReportFileName,'file','y'); + // #RNU_RES_E + OutArgName = OutArg(counterout).Name; + tmpcode = '__'+OutArgName+'Size[0]='+OutArg(counterout).Size(1)+';'; + PrintStringInfo(C_IndentBlanks(IndentLevel)+tmpcode,CPass1FileName,'file','y'); + // #RNU_RES_B + PrintStringInfo(' '+tmpcode,ReportFileName,'file','y'); + // #RNU_RES_E + tmpcode = '__'+OutArgName+'Size[1]='+OutArg(counterout).Size(2)+';'; + PrintStringInfo(C_IndentBlanks(IndentLevel)+tmpcode,CPass1FileName,'file','y'); + // #RNU_RES_B + PrintStringInfo(' '+tmpcode,ReportFileName,'file','y'); + // #RNU_RES_E +end +endfunction diff --git a/macros/CCodeGeneration/C_GenDeclarations.sci b/macros/CCodeGeneration/C_GenDeclarations.sci new file mode 100644 index 00000000..936280b8 --- /dev/null +++ b/macros/CCodeGeneration/C_GenDeclarations.sci @@ -0,0 +1,133 @@ +function Cdeclaration = C_GenDeclarations(ArgStruct,CDeclarationFileName,IndentLevel,ReportFileName,FlagExt,ResizeApproach) +// function Cdeclaration = C_GenDeclarations(ArgStruct,CDeclarationFileName,IndentLevel,ReportFileName,FlagExt,ResizeApproach) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 27-Oct-2007 -- Raffaele Nutricato: Author. +// 10-Jun-2008 -- Raffaele Nutricato: adapted to work with realloc function. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),6,6); + +// #RNU_RES_B +//NUT: ilnome di questa funzione va cambiato perche' le dichiarazioni le fanno anche i for e i while. + +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Generating C declaration***',ReportFileName,'file','y'); +// #RNU_RES_E + +Cdeclaration = ''; +NDeclarations = 0; +if (ArgStruct.Dimension > 0) + if (FlagExt == 1) + Cdeclaration(1) = 'extern '; + Cdeclaration(2) = 'extern '; + else + Cdeclaration(1) = ''; + Cdeclaration(2) = ''; + end + // #RNU_RES_B + //NUT: vedi Mem_Alloc_Out per maggiori info sulla rimozione della temp nella if + // if ((ArgStruct.Scope=='Temp') | (ArgStruct.FindLike == -1) | (isnum(ArgStruct.Size(1))==%F) | (isnum(ArgStruct.Size(2))==%F)) + // #RNU_RES_E + if (ArgStruct.Type=='g') + // if (isnan(ArgStruct.Value) ) + if ((isnum(ArgStruct.Size(1))==%F) | (isnum(ArgStruct.Size(2))==%F) ) + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+... + ' * '+ArgStruct.Name+';'; + else + if ((FlagExt == 1) | (isnan(ArgStruct.Value))) + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+... + ' '+ArgStruct.Name+'['+ArgStruct.Size(1)+'*'+ArgStruct.Size(2)+'];'; + else + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+... + ' '+ArgStruct.Name+'['+ArgStruct.Size(1)+'*'+ArgStruct.Size(2)+'] = {'+ArgStruct.Value+'};'; + end + end + Cdeclaration(2) = Cdeclaration(2)+C_Type('i')+' __'+ArgStruct.Name+'Size[2] = {'+ArgStruct.Size(1)+','+ArgStruct.Size(2)+'};'; + NDeclarations = 2; + elseif ((ArgStruct.FindLike == -1) | ... + (isnum(ArgStruct.Size(1))==%F) | (isnum(ArgStruct.Size(2))==%F) | ... + (ResizeApproach=='REALLOC_ALL_RESIZE_ALL' & ArgStruct.Type~='g')) + // #RNU_RES_B + //RNU sulle stringhe non ho ancora deciso se applicare la realloc. + // Generate only the pointer that will be used by the malloc function. + // #RNU_RES_E + if (FlagExt == 1) + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+'* '+... + ArgStruct.Name+';'; + else + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+'* '+... + ArgStruct.Name+' = NULL;'; + end + // Declare the Size array + Cdeclaration(2) = Cdeclaration(2)+C_Type('i')+' __'+ArgStruct.Name+'Size[2];'; + NDeclarations = 2; + else + // Declare the array with its size. + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+... + ' '+ArgStruct.Name+'['+ArgStruct.Size(1)+'*'+ArgStruct.Size(2)+'];'; + if (FlagExt == 1) + Cdeclaration(2) = Cdeclaration(2)+C_Type('i')+' __'+ArgStruct.Name+'Size[2];'; + else + Cdeclaration(2) = Cdeclaration(2)+C_Type('i')+' __'+ArgStruct.Name+'Size[2] = {'+ArgStruct.Size(1)+','+ArgStruct.Size(2)+'};'; + end + NDeclarations = 2; + end +else + if (FlagExt == 1) + Cdeclaration(1) = 'extern '; + else + Cdeclaration(1) = ''; + end + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+' '+ArgStruct.Name; + if (~isnan(ArgStruct.Value) & (FlagExt == 0)) + if isreal(ArgStruct.Value) + Cdeclaration(1) = Cdeclaration(1)+' = '+SCI2Cstring(ArgStruct.Value); + else + if (ArgStruct.Type == 'z') + Cdeclaration(1) = Cdeclaration(1)+' = DoubleComplex('+SCI2Cstring(real(ArgStruct.Value))+','+SCI2Cstring(imag(ArgStruct.Value))+')'; + else + Cdeclaration(1) = Cdeclaration(1)+' = FloatComplex('+SCI2Cstring(real(ArgStruct.Value))+','+SCI2Cstring(imag(ArgStruct.Value))+')'; + end + end + end + Cdeclaration(1) = Cdeclaration(1)+';'; + NDeclarations = 1; +end + + +// -------------------------------------------- +// --- Write C declaration into the C file. --- +// -------------------------------------------- +for cntdecl = 1:NDeclarations + // #RNU_RES_B + PrintStringInfo(' '+Cdeclaration(cntdecl),ReportFileName,'file','y'); + // #RNU_RES_E +end +// #RNU_RES_B +PrintStringInfo(' Writing C declaration in: '+CDeclarationFileName,ReportFileName,'file','y'); +// #RNU_RES_E +for cntdecl = 1:NDeclarations + PrintStringInfo(C_IndentBlanks(IndentLevel)+Cdeclaration(cntdecl),CDeclarationFileName,'file','y'); +end +PrintStringInfo(' ',CDeclarationFileName,'file','y'); + +endfunction +// #RNU_RES_B +//NUT: dove sta il controllo che verifica se dopo aver dichiarato una local A[10] essa viene utilizzata +//NUT: per memorizzare un A = sin(B) dove B[11]?? +// #RNU_RES_E diff --git a/macros/CCodeGeneration/C_GenerateFunName.sci b/macros/CCodeGeneration/C_GenerateFunName.sci new file mode 100644 index 00000000..b5b8c12d --- /dev/null +++ b/macros/CCodeGeneration/C_GenerateFunName.sci @@ -0,0 +1,45 @@ +function CFunName = C_GenerateFunName(FunctionName,InArg,NInArg,OutArg,NOutArg) +// function CFunName = C_GenerateFunName(FunctionName,InArg,NInArg,OutArg,NOutArg) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// 11-Nov-2007 -- Raffaele Nutricato: changed naming rule. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),5,5); +CFunName = ''; + +for tmpcnt = 1:NInArg + if (InArg(tmpcnt).Dimension == 1) + CFunName = CFunName+InArg(tmpcnt).Type+'2'; + else + CFunName = CFunName+InArg(tmpcnt).Type+SCI2Cstring(InArg(tmpcnt).Dimension); + end +end + +CFunName = CFunName+FunctionName; + +for tmpcnt = 1:NOutArg + if (OutArg(tmpcnt).Dimension == 1) + CFunName = CFunName+OutArg(tmpcnt).Type+'2'; + else + CFunName = CFunName+OutArg(tmpcnt).Type+SCI2Cstring(OutArg(tmpcnt).Dimension); + end +end + +endfunction diff --git a/macros/CCodeGeneration/C_GenerateLaunchScript.sci b/macros/CCodeGeneration/C_GenerateLaunchScript.sci new file mode 100644 index 00000000..027d4c70 --- /dev/null +++ b/macros/CCodeGeneration/C_GenerateLaunchScript.sci @@ -0,0 +1,86 @@ +function C_GenerateLaunchScript(OutDir,ListSCI2CInputPrmFiles) +// function C_GenerateLaunchScript(OutDir,ListSCI2CInputPrmFiles) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Generate the script that can be used to compile all the regression +// tests and to run them and finally to write results in the report +// file. +// #RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Jan-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +ScriptFileName = fullfile(OutDir,'LaunchRegressionTests.rc'); +NTranslations = size(ListSCI2CInputPrmFiles,1); +// --------------------------- +// --- End Initialization. --- +// --------------------------- +SCI2Cmdelete(ScriptFileName); +PrintStringInfo('#! /bin/bash ',ScriptFileName,'file','y'); +PrintStringInfo(' ',ScriptFileName,'file','y'); +PrintStringInfo('maindir=$PWD',ScriptFileName,'file','y'); +PrintStringInfo(' ',ScriptFileName,'file','y'); +PrintStringInfo('INTIALIZE()',ScriptFileName,'file','y'); +PrintStringInfo('{',ScriptFileName,'file','y'); +PrintStringInfo(' reportfile=$maindir/RegressionTestsReport.txt',ScriptFileName,'file','y'); +PrintStringInfo(' echo ""#############'+'#################"" > $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo ""REPORT OF THE REGRESSION TESTS"" > $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo ""#############'+'#################"" > $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo ""Author: Raffaele Nutricato"" > $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo ""Copyright 2008 Raffaele Nutricato"" > $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo "" "" > $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' cd $maindir ',ScriptFileName,'file','y'); +PrintStringInfo('}',ScriptFileName,'file','y'); +PrintStringInfo(' ',ScriptFileName,'file','y'); +PrintStringInfo('EXECUTE()',ScriptFileName,'file','y'); +PrintStringInfo('{',ScriptFileName,'file','y'); +PrintStringInfo(' echo ""xxxxxxxxxxxxxx'+'xxxxxxxxxxxxxxxxxx'+'xxxxxxxxxxxx""',ScriptFileName,'file','y'); +PrintStringInfo(' echo "" "" >> $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo "" "" >> $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo "" "" >> $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo ""xxxxxxxxxxxxxx'+'xxxxxxxxxxxxxxxxxxxxxxx'+'xxxxxxx"" >> $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo $testname ',ScriptFileName,'file','y'); +PrintStringInfo(' echo $testname >> $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo ""xxxxxxxxxxxxxxx'+'xxxxxxxxxxxxxxxxx'+'xxxxxxxxxxxx"" ',ScriptFileName,'file','y'); +PrintStringInfo(' echo ""xxxxxxxxxxxxxxxx'+'xxxxxxxxxxxxxxxxxxxx'+'xxxxxxxx"" >> $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' cd $testname/C_Code',ScriptFileName,'file','y'); +PrintStringInfo(' make >> $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' cd $maindir',ScriptFileName,'file','y'); +PrintStringInfo(' echo "" "" >> $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo "" "" >> $reportfile',ScriptFileName,'file','y'); +PrintStringInfo(' echo "" "" >> $reportfile',ScriptFileName,'file','y'); +PrintStringInfo('}',ScriptFileName,'file','y'); +PrintStringInfo(' ',ScriptFileName,'file','y'); +PrintStringInfo('#############'+'##############',ScriptFileName,'file','y'); +PrintStringInfo('### ADD YOUR TESTS HERE ###',ScriptFileName,'file','y'); +PrintStringInfo('##############'+'#############',ScriptFileName,'file','y'); +PrintStringInfo('INTIALIZE',ScriptFileName,'file','y'); +PrintStringInfo(' ',ScriptFileName,'file','y'); + +for cnttransl = 1:NTranslations + [testpath,tmpname,tmpext] = fileparts(ListSCI2CInputPrmFiles(cnttransl)); + testpath = ConvertPathMat2C(testpath,'cygwin'); + PrintStringInfo('testname=""'+testpath+'""',ScriptFileName,'file','y'); + PrintStringInfo('EXECUTE $testname',ScriptFileName,'file','y'); + PrintStringInfo(' ',ScriptFileName,'file','y'); +end + +endfunction diff --git a/macros/CCodeGeneration/C_GenerateMakefile.sci b/macros/CCodeGeneration/C_GenerateMakefile.sci new file mode 100644 index 00000000..3914d4dc --- /dev/null +++ b/macros/CCodeGeneration/C_GenerateMakefile.sci @@ -0,0 +1,133 @@ +function C_GenerateMakefile(FileInfo,SharedInfo) +// function C_GenerateMakefile(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// Generate the makefile. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Jan-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +PrintStepInfo('Generating Builder '+FileInfo.MakefileFilename,... + FileInfo.GeneralReport,'both'); +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +PrintStringInfo('# SCI2C Makefile',FileInfo.MakefileFilename,'file','y'); +PrintStringInfo('# hArtes EU Project.',FileInfo.MakefileFilename,'file','y'); +PrintStringInfo('# Authors: PoliBa & Inria',FileInfo.MakefileFilename,'file','y'); +PrintStringInfo('# -----------------------',FileInfo.MakefileFilename,'file','y'); +PrintStringInfo('# --- USER PARAMETERS ---',FileInfo.MakefileFilename,'file','y'); +PrintStringInfo('# -----------------------',FileInfo.MakefileFilename,'file','y'); +PrintStringInfo('# --- DIRECTORIES AND FILES ---',FileInfo.MakefileFilename,'file','y'); + +makecsrcdir = pathconvert('src/c', %f, %f, 'u'); +// makecsrcdir = FileInfo.CStyleSCI2CMainDir+'\CFiles\sci2ccode'; +makehsrcdir = pathconvert('includes', %f, %f, 'u'); +// makehsrcdir = FileInfo.CStyleSCI2CMainDir+'\CFiles\sci2cincludes'; +makeisrcdir = pathconvert('interfaces', %f, %f, 'u'); +// makeisrcdir = FileInfo.CStyleSCI2CMainDir+'\CFiles\sci2cinterfaces'; +makesci2cdir = FileInfo.CStyleOutCCCodeDir; +// makesci2cdir = FileInfo.CStyleOutCCCodeDir; + + +PrintStringInfo('CSRCDIR = '+makecsrcdir,FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('HSRCDIR = '+makehsrcdir,FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('ISRCDIR = '+makeisrcdir,FileInfo.MakefileFilename,'file','y','y'); +//PrintStringInfo('SCI2CDIR = '+makesci2cdir,FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('SCI2CDIR = .',FileInfo.MakefileFilename,'file','y','y'); + +// Compiler definition +PrintStringInfo('CC = gcc',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('CFLAGS = -Wall -pedantic -I $(HSRCDIR) -I $(ISRCDIR) -lm',FileInfo.MakefileFilename,'file','y','y'); + +// Binary definition +PrintStringInfo('EXEFILENAME = mytest.exe',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('EXEFILE = $(SCI2CDIR)/$(EXEFILENAME)', FileInfo.MakefileFilename,'file','y','y'); + +// Sources +PrintStringInfo('SRC = \\', FileInfo.MakefileFilename,'file','y','y'); +allSources = getAllSources(); +nbSources = size(allSources); +for i = 1:(nbSources(1) - 1) + [tmppath,tmpfile,tmpext] = fileparts(allSources(i)); + PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', FileInfo.MakefileFilename,'file','y','y'); +end +[tmppath,tmpfile,tmpext] = fileparts(allSources(nbSources(1))); +PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext, FileInfo.MakefileFilename,'file','y','y'); + +// Objects +PrintStringInfo('OBJ = $(SRC:.c=.o)', FileInfo.MakefileFilename,'file','y','y'); + +// Rules +PrintStringInfo('# ---------------',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('# --- TARGETS ---',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('# ---------------',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('compileexecute: $(OBJ)',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""============================""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""Generation of the executable""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""============================""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t$(CC) $(CFLAGS) $(OBJ) *.c -llapack -lblas -o $(EXEFILE)',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""==============""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""Executing code""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""==============""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t$(EXEFILE)',FileInfo.MakefileFilename,'file','y','y'); + +PrintStringInfo('clean:',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""=============================""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""Removing only exe + obj files""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""=============================""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\trm -rf $(EXEFILE)',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\trm -rf $(OBJ)',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y'); + +PrintStringInfo('distclean: clean',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""==========================""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""Removing only the exe file""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""==========================""',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\trm -rf $(EXEFILE)',FileInfo.MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y'); + +if getos() == 'Windows' then + C_GenerateMakefile_msvc(FileInfo,SharedInfo); +end + + +// ------------------------------- +// --- Open template makefile. --- +// ------------------------------- +//fidfile = SCI2COpenFileRead(FileInfo.MakefileTemplate); + +// ------------------- +// --- Read lines. --- +// ------------------- +//tmpline = mgetl(fidfile,1); +//while (meof(fidfile) == 0) +// PrintStringInfo(tmpline,FileInfo.MakefileFilename,'file','y'); +// tmpline = mgetl(fidfile,1); +//end + +//mclose(fidfile); + +endfunction \ No newline at end of file diff --git a/macros/CCodeGeneration/C_GenerateMakefile_msvc.sci b/macros/CCodeGeneration/C_GenerateMakefile_msvc.sci new file mode 100644 index 00000000..b49a2c31 --- /dev/null +++ b/macros/CCodeGeneration/C_GenerateMakefile_msvc.sci @@ -0,0 +1,110 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2010-2010 - DIGITEO - Allan CORNET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +function C_GenerateMakefile_msvc(FileInfo, SharedInfo) +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +MakefileFilename = FileInfo.MakefileFilename + '.mak'; + +// ----------------------- +// --- Initialization. --- +// ----------------------- +PrintStepInfo('Generating Builder '+MakefileFilename,... + FileInfo.GeneralReport,'both'); + +PrintStringInfo('# SCI2C Makefile (Visual Studio 2008)',MakefileFilename,'file','y','y'); +PrintStringInfo('# hArtes EU Project.',MakefileFilename,'file','y','y'); +PrintStringInfo('# Authors: PoliBa & Inria & DIGITEO',MakefileFilename,'file','y','y'); +PrintStringInfo('# -----------------------',MakefileFilename,'file','y','y'); +PrintStringInfo('# --- USER PARAMETERS ---',MakefileFilename,'file','y','y'); +PrintStringInfo('# -----------------------',MakefileFilename,'file','y','y'); +PrintStringInfo('# --- DIRECTORIES AND FILES ---',MakefileFilename,'file','y','y'); + +makecsrcdir = pathconvert('src/c', %f, %f, 'u'); +makehsrcdir = pathconvert('includes', %f, %f, 'u'); +makeisrcdir = pathconvert('interfaces', %f, %f, 'u'); +makesci2cdir = FileInfo.CStyleOutCCCodeDir; +PrintStringInfo('CSRCDIR = '+makecsrcdir,MakefileFilename,'file','y','y'); +PrintStringInfo('HSRCDIR = '+makehsrcdir,MakefileFilename,'file','y','y'); +PrintStringInfo('ISRCDIR = '+makeisrcdir,MakefileFilename,'file','y','y'); +PrintStringInfo('SCI2CDIR = .',MakefileFilename,'file','y','y'); + +PrintStringInfo('DIR_OBJ=Release',MakefileFilename,'file','y','y'); +PrintStringInfo('LAPACK_LIB =$(SCI2CDIR)/external-libs/lapack.lib',MakefileFilename,'file','y','y'); +PrintStringInfo('BLAS_LIB = $(SCI2CDIR)/external-libs/blasplus.lib',MakefileFilename,'file','y','y'); +PrintStringInfo('CC = cl',MakefileFilename,'file','y','y'); +PrintStringInfo('LINKER = link',MakefileFilename,'file','y','y'); +PrintStringInfo('LINKER_OPTIMISATION_MODE=/RELEASE ',MakefileFilename,'file','y','y'); +PrintStringInfo('CC__OPTIMISATION_MODE=-Z7 -O2 -MD',MakefileFilename,'file','y','y'); +PrintStringInfo('CC_OPTIONS = $(CC_COMMON) -W3 -Gd $(CC__OPTIMISATION_MODE) /Fo""$(DIR_OBJ)/"" /Fd""$(DIR_OBJ)/"" ',MakefileFilename,'file','y','y'); +PrintStringInfo('CFLAGS = $(CC_OPTIONS) -I""$(HSRCDIR)"" -I""$(ISRCDIR)"" /EHsc /TP ',MakefileFilename,'file','y','y'); +PrintStringInfo('EXEFILENAME = mytest',MakefileFilename,'file','y','y'); +PrintStringInfo('EXEFILE = $(SCI2CDIR)\\$(EXEFILENAME)',MakefileFilename,'file','y','y'); +PrintStringInfo('MAIN_SRC = $(SCI2CDIR)/main.c',MakefileFilename,'file','y','y'); + +// Sources +PrintStringInfo('SRC = \\', MakefileFilename,'file','y','y'); +allSources = getAllSources(); +nbSources = size(allSources); +for i = 1:(nbSources(1) - 1) + [tmppath,tmpfile,tmpext] = fileparts(allSources(i)); + PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', MakefileFilename,'file','y','y'); +end +[tmppath,tmpfile,tmpext] = fileparts(allSources(nbSources(1))); +PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext, MakefileFilename,'file','y','y'); + +PrintStringInfo('OBJ = $(SRC:.c=.obj) $(MAIN_SRC:.c=.obj)',MakefileFilename,'file','y','y'); +PrintStringInfo('# ---------------',MakefileFilename,'file','y','y'); +PrintStringInfo('# --- TARGETS ---',MakefileFilename,'file','y','y'); +PrintStringInfo('# ---------------',MakefileFilename,'file','y','y'); +PrintStringInfo('compileexecute: ',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""============================""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""Generation of the executable""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""============================""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-IF NOT EXIST $(DIR_OBJ) mkdir $(DIR_OBJ)',MakefileFilename,'file','y','y'); +PrintStringInfo('\t$(CC) $(CFLAGS) $(SRC) $(MAIN_SRC) /link $(LAPACK_LIB) $(BLAS_LIB) /out:$(EXEFILE).exe',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""==============""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""Executing code""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""==============""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t$(EXEFILE).exe',MakefileFilename,'file','y','y'); +PrintStringInfo('clean:',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""=============================""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""Removing only exe + obj files""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""=============================""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-del ""$(DIR_OBJ)\*.obj""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-rmdir ""$(DIR_OBJ)""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-del $(EXEFILE).exe',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-del $(EXEFILE).exp',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-del $(EXEFILE).lib',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-del $(EXEFILE).pdb',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-del $(EXEFILE).ilk',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',MakefileFilename,'file','y','y'); +PrintStringInfo('distclean: clean',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""==========================""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""Removing only the exe file""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo ""==========================""',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-del $(EXEFILE).exe',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-del $(EXEFILE).exp',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-del $(EXEFILE).lib',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-del $(EXEFILE).pdb',MakefileFilename,'file','y','y'); +PrintStringInfo('\t-del $(EXEFILE).ilk',MakefileFilename,'file','y','y'); +PrintStringInfo('\t@echo "" ""',MakefileFilename,'file','y','y'); + + +endfunction \ No newline at end of file diff --git a/macros/CCodeGeneration/C_IfElseBlocks.sci b/macros/CCodeGeneration/C_IfElseBlocks.sci new file mode 100644 index 00000000..71b45966 --- /dev/null +++ b/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 + SCI2CerrorFile('Unknown setting for InOutStatements: '+InOutStatements'.',ReportFileName); +end + +// #RNU_RES_B +PrintStringInfo(' Updating indentation level to:'+string(IndentLevel),ReportFileName,'file','y'); +// #RNU_RES_E +SharedInfo.NIndent = IndentLevel; + +endfunction diff --git a/macros/CCodeGeneration/C_IfExpression.sci b/macros/CCodeGeneration/C_IfExpression.sci new file mode 100644 index 00000000..772f24ff --- /dev/null +++ b/macros/CCodeGeneration/C_IfExpression.sci @@ -0,0 +1,91 @@ +function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo,SharedInfo) +// function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,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),5,5); + +// --- Check NIfCondArg value. --- +if ((NIfCondArg ~= 1) & (ASTIfExpType~='else')) + SCI2CerrorFile('Cannot manage ""if/elseif"" with a number of condition variables not equal to 1.',ReportFileName); +end + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; + +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName; + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Generating C code***',ReportFileName,'file','y'); +// #RNU_RES_E +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// -------------------------------------------- +// --- Generate the C name of the function. --- +// -------------------------------------------- +if (ASTIfExpType=='if') + CFunName = 'if'; +elseif (ASTIfExpType=='elseif') + CFunName = 'if'; +elseif (ASTIfExpType=='else') + CFunName = 'else'; +else + SCI2CerrorFile('Unknown ASTIfExpType ""'+ASTIfExpType+'"".',ReportFileName); +end + +// ---------------------------- +// --- Generate the C call. --- +// ---------------------------- +if SCI2Cstrncmps1size(ASTIfExpType,'else') + // #RNU_RES_B + // before opening a new C block, closes the previous one. + // #RNU_RES_E + SharedInfo = C_IfElseBlocks(FileInfo,SharedInfo,'out'); +end + +CCall =''; +CCall = CCall+CFunName; +if (ASTIfExpType~='else') + CCall = CCall+'('+IfCondArg(1)+')'; +end +PrintStringInfo(' '+CCall,ReportFileName,'file','y'); +PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); + +SharedInfo = C_IfElseBlocks(FileInfo,SharedInfo,'in'); + +// #RNU_RES_B +// --------------------------------- +// --- Update counter nested if. --- +// --------------------------------- +// #RNU_RES_E +if (ASTIfExpType=='elseif') + // #RNU_RES_B + // every elseif statement a new } is required. + // #RNU_RES_E + SharedInfo.CountNestedIf = SharedInfo.CountNestedIf + 1; +end + +endfunction diff --git a/macros/CCodeGeneration/C_IndentBlanks.sci b/macros/CCodeGeneration/C_IndentBlanks.sci new file mode 100644 index 00000000..9304aefb --- /dev/null +++ b/macros/CCodeGeneration/C_IndentBlanks.sci @@ -0,0 +1,31 @@ +function OutBlanksString = C_IndentBlanks(IndentLevel) +// function OutBlanksString = C_IndentBlanks(IndentLevel) +// ----------------------------------------------------------------- +// Delete function for a generic SCI2C table. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +OutBlanksString = ''; +BlanksPerLevel = ' '; +for cntind = 1:IndentLevel + OutBlanksString = OutBlanksString + BlanksPerLevel; +end + +endfunction diff --git a/macros/CCodeGeneration/C_InitHeader.sci b/macros/CCodeGeneration/C_InitHeader.sci new file mode 100644 index 00000000..7d794127 --- /dev/null +++ b/macros/CCodeGeneration/C_InitHeader.sci @@ -0,0 +1,68 @@ +function C_InitHeader(C_Prototype,HeaderFileName,Sci2CLibMainHeaderFName) +// function C_InitHeader(C_Prototype,HeaderFileName,Sci2CLibMainHeaderFName) +// ----------------------------------------------------------------- +// //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. --- +// ----------------------- +// --------------------------- +// --- End Initialization. --- +// --------------------------- + + +C_SCI2CHeader(HeaderFileName); +[tmppath,tmpfname,tmpextension]=fileparts(HeaderFileName); +PrintStringInfo('#ifndef '+tmpfname+'_h',HeaderFileName,'file','y'); +PrintStringInfo('#define '+tmpfname+'_h',HeaderFileName,'file','y'); +PrintStringInfo('/*',HeaderFileName,'file','y'); +PrintStringInfo('** ----------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('** --- SCI2C Includes. --- ',HeaderFileName,'file','y'); +PrintStringInfo('** ----------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('*/',HeaderFileName,'file','y'); +PrintStringInfo('#include ""'+Sci2CLibMainHeaderFName+'""',HeaderFileName,'file','y'); +PrintStringInfo('/*',HeaderFileName,'file','y'); +PrintStringInfo('** --------------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('** --- End SCI2C Includes. --- ',HeaderFileName,'file','y'); +PrintStringInfo('** --------------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('*/',HeaderFileName,'file','y'); +PrintStringInfo(' ',HeaderFileName,'file','y'); +PrintStringInfo(' ',HeaderFileName,'file','y'); +PrintStringInfo('/*',HeaderFileName,'file','y'); +PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('** --- Prototypes. --- ',HeaderFileName,'file','y'); +PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('*/',HeaderFileName,'file','y'); +PrintStringInfo(C_IndentBlanks(0)+C_Prototype,HeaderFileName,'file','y'); +PrintStringInfo('/*',HeaderFileName,'file','y'); +PrintStringInfo('** ----------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('** --- End Prototypes. --- ',HeaderFileName,'file','y'); +PrintStringInfo('** ----------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('*/',HeaderFileName,'file','y'); +PrintStringInfo(' ',HeaderFileName,'file','y'); +PrintStringInfo(' ',HeaderFileName,'file','y'); +PrintStringInfo('/*',HeaderFileName,'file','y'); +PrintStringInfo('** ------------------------ ',HeaderFileName,'file','y'); +PrintStringInfo('** --- USER2C Includes. --- ',HeaderFileName,'file','y'); +PrintStringInfo('** ------------------------ ',HeaderFileName,'file','y'); +PrintStringInfo('*/',HeaderFileName,'file','y'); + +endfunction diff --git a/macros/CCodeGeneration/C_MemAllocOutTempVars.sci b/macros/CCodeGeneration/C_MemAllocOutTempVars.sci new file mode 100644 index 00000000..dedcfd33 --- /dev/null +++ b/macros/CCodeGeneration/C_MemAllocOutTempVars.sci @@ -0,0 +1,64 @@ +function C_MemAllocOutTempVars(OutArg,NOutArg,CPass1FileName,CPass1FreeFileName,IndentLevel,ReportFileName,ResizeApproach) +// function C_MemAllocOutTempVars(OutArg,NOutArg,CPass1FileName,CPass1FreeFileName,IndentLevel,ReportFileName,ResizeApproach) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 27-Oct-2007 -- Raffaele Nutricato: Author. +// 10-Jun-2008 -- Raffaele Nutricato: replaced malloc with realloc. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),7,7); + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Allocating memory for temp variables***',ReportFileName,'file','y'); +// #RNU_RES_E + +// #RNU_RES_B +// --- Allocate memory and size array for output arguments. --- +// #RNU_RES_E +for counterout = 1:NOutArg + if (OutArg(counterout).Dimension > 0) + // #RNU_RES_B + // if ((OutArg(counterout).Scope == 'Temp') | (OutArg(counterout).FindLike == -1) | ... + // (isnum(OutArg(counterout).Size(1))==%F) | (isnum(OutArg(counterout).Size(2))==%F)) + //NUT: qui forse ci vuole un check per verificare se per caso la variabile e' globale e non se ne conosce la size numerica. + //NUT infatti. Per ora se la size numerica assumo che la variabile globale e' da reallocare. Secondo me occorre aggiungere + //NUT un campo negli argomenti che specifichi la presenza di realloc da fare. + //NUT: ho tolto il check sulle temp perche' se una temp ha size numerica non voglio fare malloc. + //RNU sulle stringhe ancora non applico realloc + // #RNU_RES_E + if ((OutArg(counterout).FindLike == -1) | ... + (isnum(OutArg(counterout).Size(1))==%F) | (isnum(OutArg(counterout).Size(2))==%F)| ... + (ResizeApproach=='REALLOC_ALL_RESIZE_ALL' & OutArg(counterout).Type ~= 'g')) + OutArgName = OutArg(counterout).Name; + tmpcode = '__'+OutArgName+'Size[0]='+OutArg(counterout).Size(1)+';'; + PrintStringInfo(C_IndentBlanks(IndentLevel)+tmpcode,CPass1FileName,'file','y'); + PrintStringInfo(' '+tmpcode,ReportFileName,'file','y'); + tmpcode = '__'+OutArgName+'Size[1]='+OutArg(counterout).Size(2)+';'; + PrintStringInfo(C_IndentBlanks(IndentLevel)+tmpcode,CPass1FileName,'file','y'); + PrintStringInfo(' '+tmpcode,ReportFileName,'file','y'); + //a->val = (double *) malloc(nnz * sizeof(double)); + // numbers = (int*) realloc (numbers, count * sizeof(int)); + tmpcode = OutArgName+' = ('+C_Type(OutArg(counterout).Type)+'*) realloc('+OutArgName+',('+OutArg(counterout).Size(1)+')*('+OutArg(counterout).Size(2)+')*sizeof('+C_Type(OutArg(counterout).Type)+'));'; + PrintStringInfo(C_IndentBlanks(IndentLevel)+tmpcode,CPass1FileName,'file','y'); + PrintStringInfo(' '+tmpcode,ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(1)+'free('+OutArgName+');',CPass1FreeFileName,'file','y'); + end + end +end + +endfunction diff --git a/macros/CCodeGeneration/C_SCI2CHeader.sci b/macros/CCodeGeneration/C_SCI2CHeader.sci new file mode 100644 index 00000000..5e8acd5d --- /dev/null +++ b/macros/CCodeGeneration/C_SCI2CHeader.sci @@ -0,0 +1,41 @@ +function C_SCI2CHeader(FileName) +// function C_SCI2CHeader(FileName) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 21-Dec-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +// --------------------------- +// --- End Initialization. --- +// --------------------------- + + +PrintStringInfo('/*',FileName,'file','y'); +PrintStringInfo('** ************************************************',FileName,'file','y'); +PrintStringInfo('** hArtes/POLIBA SCILAB2C',FileName,'file','y'); +PrintStringInfo('** Contact: raffaele.nutricato@tiscali.it',FileName,'file','y'); +PrintStringInfo('** ************************************************',FileName,'file','y'); +PrintStringInfo('*/',FileName,'file','y'); +PrintStringInfo(' ',FileName,'file','y'); +PrintStringInfo(' ',FileName,'file','y'); + +endfunction diff --git a/macros/CCodeGeneration/C_Type.sci b/macros/CCodeGeneration/C_Type.sci new file mode 100644 index 00000000..f49dd9b1 --- /dev/null +++ b/macros/CCodeGeneration/C_Type.sci @@ -0,0 +1,41 @@ +function OutC_Type = C_Type(ArgType) +// function OutC_Type = C_Type(ArgType) +// ----------------------------------------------------------------- +// //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),1,1); + +if (ArgType == 's') + OutC_Type = 'float'; +elseif (ArgType == 'd') + OutC_Type = 'double'; +elseif (ArgType == 'c') + OutC_Type = 'floatComplex'; +elseif (ArgType == 'z') + OutC_Type = 'doubleComplex'; +elseif (ArgType == 'i') + OutC_Type = 'SCI2Cint'; +elseif (ArgType == 'g') + OutC_Type = 'char'; +elseif (ArgType == 'f') + OutC_Type = 'SCI2CFILEID'; +else + SCI2Cerror('Unknown Argument Type: ""'+ArgType+'"".'); +end +endfunction diff --git a/macros/CCodeGeneration/C_WhileExpression.sci b/macros/CCodeGeneration/C_WhileExpression.sci new file mode 100644 index 00000000..edd2830e --- /dev/null +++ b/macros/CCodeGeneration/C_WhileExpression.sci @@ -0,0 +1,93 @@ +function SharedInfo = C_WhileExpression(FileInfo,SharedInfo) +// function SharedInfo = C_WhileExpression(FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 15-Nov-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; + +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName; + +CPass1WhileProlFileName = FileInfo.Funct(nxtscifunnumber).CPass1WhileProlFileName(SharedInfo.While.Level); +CPass1WhileEpilFileName = FileInfo.Funct(nxtscifunnumber).CPass1WhileEpilFileName(SharedInfo.While.Level); +CDeclarationFileName = FileInfo.Funct(nxtscifunnumber).CDeclarationFileName; + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Generating C code***',ReportFileName,'file','y'); +// #RNU_RES_E +CCall =''; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// ---------------------------- +// --- Generate the C call. --- +// ---------------------------- + +// ------------------------- +// --- Manage all cases. --- +// ------------------------- +PrintStringInfo(' Handling While Expression with OpColon.',ReportFileName,'file','y'); //NUT: sistema il commento. + +// ------------------------------------------------------------------------------------- +// --- Generate Prologue and Epilogue -> Copy the first N-1 lines of the for.c code. --- +// ------------------------------------------------------------------------------------- +[C_Strings,NumCStrings] = File2StringArray(CPass1WhileProlFileName); +C_Strings = stripblanks(C_Strings); +for cntstr = 1:NumCStrings + // Prologue + PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+C_Strings(cntstr),CPass1FileName,'file','y','n'); + // Epilogue + if (length(C_Strings(cntstr)) == 0) + C_Strings(cntstr) = ' '; // RNU for Bruno: If I don't do that I get a PrintStringInfo error related to mputstr. + // Function not defined for given argument type(s), + // check arguments or define function %0_mputstr for overloading. + end + PrintStringInfo(C_Strings(cntstr),CPass1WhileEpilFileName ,'file','y','n'); +end +// ---------------------------------------- +// --- Insert "}" in the epilogue file. --- +// ---------------------------------------- +PrintStringInfo('}',CPass1WhileEpilFileName ,'file','y'); + +// ------------------------------ +// --- Insert for expression. --- +// ------------------------------ +CCall = 'while('+SharedInfo.WhileExpr.CondVar+')'; +PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); + +// ------------------- +// --- Insert "{". --- +// ------------------- +CCall = '{'; +PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); + +// --------------------------------- +// --- Update Indentation Level. --- +// --------------------------------- +SharedInfo.NIndent = SharedInfo.NIndent + 1; + +endfunction diff --git a/macros/CCodeGeneration/GenCFunDatFiles.sci b/macros/CCodeGeneration/GenCFunDatFiles.sci new file mode 100644 index 00000000..62c8f4bc --- /dev/null +++ b/macros/CCodeGeneration/GenCFunDatFiles.sci @@ -0,0 +1,73 @@ +function GenCFunDatFiles(FunctionName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,CFunName,LibTypeInfo,FunInfoDatDir) +// function GenCFunDatFiles(FunctionName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,CFunName,LibTypeInfo,FunInfoDatDir) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 30-Oct-2007 -- Raffaele Nutricato: Author. +// 30-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// #RNU_RES_B +//NUT Nella fun info posso mettere le size simboliche per out arg e non quelle numeriche +//NUT che non usero' mai, anche perche' se un giorno decidero' di cambiare approccio e usero' funzioni +//NUT differenti per size differenti allora dovro' cambiare anche il loro nome per distinguerle +//NUT e di conseguenza avro' funinfo differenti. +// #RNU_RES_E +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),11,11); + + +// ----------------------- +// --- Initialization. --- +// ----------------------- +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// #RNU_RES_B +// ---------------------------------------------------------- +// --- Find Position of the first output scalar argument. --- +// ---------------------------------------------------------- +// #RNU_RES_E +PosFirstOutScalar = 0; +FoundOutScalar = 0; +for counterout = 1:NOutArg + if (OutArg(counterout).Dimension == 0) + if (FoundOutScalar==0) + PosFirstOutScalar = counterout; + FoundOutScalar = 1; + end + end +end + +// ------------------------------------ +// --- Update C function dat files. --- +// ------------------------------------ +clear FunInfo +FunInfo.SCIFunctionName = FunctionName; +FunInfo.CFunctionName = CFunName; +FunInfo.FunPrecSpecifier = FunPrecSpecifier; +FunInfo.FunTypeAnnot = FunTypeAnnot; +FunInfo.FunSizeAnnot = FunSizeAnnot; +FunInfo.InArg = InArg; +FunInfo.NInArg = NInArg; +FunInfo.OutArg = OutArg; +FunInfo.NOutArg = NOutArg; +FunInfo.PosFirstOutScalar = PosFirstOutScalar; +FunInfo.LibTypeInfo = LibTypeInfo; +save(fullfile(FunInfoDatDir,CFunName+'.dat'),FunInfo); +clear FunInfo + +endfunction diff --git a/macros/CCodeGeneration/GetClsFileName.sci b/macros/CCodeGeneration/GetClsFileName.sci new file mode 100644 index 00000000..ec9ce5b9 --- /dev/null +++ b/macros/CCodeGeneration/GetClsFileName.sci @@ -0,0 +1,95 @@ +function SCI2CClassFileName = GetClsFileName(FunName,FileInfo,SharedInfo) +// function SCI2CClassFileName = GetClsFileName(FunName,FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Jul-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),3,3); + +// //NUT: verifica che il nome sia accettabile e che non +// //NUT: occorra spezzettarla in piu funzioni. + +// --- Extraction of the function name and number. --- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; + +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; + +// --- Initialization. --- +tmpannfilename = FunName+'.ann'; +tmpscifilename = FunName+'.sci'; +AnnFileName = ''; +ClsFileName = '' + +SCI2CClassSpecifier = SharedInfo.Annotations.FUNCLASS; +FlagFoundAnnFile = 0; +// #RNU_RES_B +//NUT: qui e' presente la lista delle priorita' di accesso alle annotazioni. +// #RNU_RES_E +if SCI2Cfileexist(FileInfo.USER2CLibCAnnFun,tmpannfilename) + // #RNU_RES_B + // It is a C function of the USER2C library. + // #RNU_RES_E + FlagFoundAnnFile = 1; + AnnFileName = fullfile(FileInfo.USER2CLibCAnnFun,tmpannfilename); + SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); + SCI2CClassFileName = fullfile(FileInfo.USER2CLibCAnnCls,SCI2CClassName+'.acls'); +elseif SCI2Cfileexist(FileInfo.USER2CLibSCIAnnFun,tmpannfilename) + // #RNU_RES_B + // It is a scilab function of the USER2C library. + // #RNU_RES_E + FlagFoundAnnFile = 1; + AnnFileName = fullfile(FileInfo.USER2CLibSCIAnnFun,tmpannfilename); + SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); + SCI2CClassFileName = fullfile(FileInfo.USER2CLibSCIAnnCls,SCI2CClassName+'.acls'); +elseif (SCI2Cfileexist(FileInfo.SCI2CLibCAnnFun,tmpannfilename)) + // #RNU_RES_B + // It is a C function of the SCI2C library. + // #RNU_RES_E + FlagFoundAnnFile = 1; + AnnFileName = fullfile(FileInfo.SCI2CLibCAnnFun,tmpannfilename); + SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); + SCI2CClassFileName = fullfile(FileInfo.SCI2CLibCAnnCls,SCI2CClassName+'.acls'); +elseif (SCI2Cfileexist(FileInfo.SCI2CLibSCIAnnFun,tmpannfilename)) + // #RNU_RES_B + // It is a scilab function of the SCI2C library. + // #RNU_RES_E + FlagFoundAnnFile = 1; + AnnFileName = fullfile(FileInfo.SCI2CLibSCIAnnFun,tmpannfilename); + SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); + SCI2CClassFileName = fullfile(FileInfo.SCI2CLibSCIAnnCls,SCI2CClassName+'.acls'); +end + +if (FlagFoundAnnFile == 0) + [FlagFoundAnnFile,fullpathscifilename] = SCI2CFindFile(FileInfo.UserSciFilesPaths,FunName+'.sci'); + if (FlagFoundAnnFile == 0) + // #RNU_RES_B + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Missing function annotation. Could not find',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: an associated .sci or .ann file for function: '+FunName,ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + // #RNU_RES_E + SCI2Cerror(' '); + end + AnnFileName = fullfile(FileInfo.USER2CLibSCIAnnFun,tmpannfilename); + SCI2CClassName = FunName; + SCI2CClassFileName = fullfile(FileInfo.USER2CLibSCIAnnCls,SCI2CClassName+'.acls'); + Sci2AnnotationFile(fullpathscifilename,SCI2CClassFileName,AnnFileName,... + SharedInfo.Annotations.USERFUN,ReportFileName); +end +endfunction diff --git a/macros/CCodeGeneration/GetSymbolDimension.sci b/macros/CCodeGeneration/GetSymbolDimension.sci new file mode 100644 index 00000000..4fe3cc8d --- /dev/null +++ b/macros/CCodeGeneration/GetSymbolDimension.sci @@ -0,0 +1,70 @@ +function symboldimension = GetSymbolDimension(Field_Size) +// function symboldimension = GetSymbolDimension(Field_Size) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Get the dimesion (0D,1D,2D) of a symbol given its size. +// +// Input data: +// Field_Size: it is the Size field of the InArg or OutArg structures. +// It is a 2-element array. N-dim array are not supported +// in this release. +// +// Output data: +// symboldimension: number specifying the dimension of the symbol. +// 0 = scalar; 1 = column or row; 2 = matrix. +// +// #RNU_RES_E +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// Size is expressed as an array of two strings. +Nelem = max(size(Field_Size)); +if (Nelem < 2) + SCI2Cerror('The size of a symbol cannot be expressed with one or zero numbers.'); +end +for countersize = 1:Nelem + // #RNU_RES_B + // Field_Type = 1; if Size is Symbol or a number > 1 + // Field_Type = 0; if Size is a number == 1 + // error if Size is 0. + // A symbol is scalar if the sum of the Field_Type elements is zero. + // A symbol is column or row if the sum of the Field_Type elements is one. + // A symbol is a matrix if the sum of the Field_Type elements is > 1. + // #RNU_RES_E + if (isnum(Field_Size(countersize))) + tmpnum = eval(Field_Size(countersize)); + if (tmpnum == 0) + SCI2Cerror('Found a symbol that has zeros elements. 0xN or Nx0 matrices are not allowed.'); + elseif (tmpnum == 1) + Field_Type(countersize) = 0; + else + Field_Type(countersize) = 1; + end + else + Field_Type(countersize) = 1; + end +end + +Sum_Field_Type = sum(Field_Type); +if (Sum_Field_Type == 0) + symboldimension = 0; +elseif (Sum_Field_Type == 1) + // #RNU_RES_B + // symboldimension = 1; //NUT for this release there will not be difference between vectors and matrices. + // #RNU_RES_E + symboldimension = 2; +else + symboldimension = 2; +end + +endfunction diff --git a/macros/CCodeGeneration/GetWhileCondVariable.sci b/macros/CCodeGeneration/GetWhileCondVariable.sci new file mode 100644 index 00000000..ba4c7e92 --- /dev/null +++ b/macros/CCodeGeneration/GetWhileCondVariable.sci @@ -0,0 +1,72 @@ +function SharedInfo = GetWhileCondVariable(OutArg,NOutArg,FunctionName,FileInfo,SharedInfo) +// function SharedInfo = GetWhileCondVariable(OutArg,NOutArg,FunctionName,FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +//NUT: secondo me questa funzione non serve a nulla + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),5,5); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Checking if the current function is handling while counter variables.***',ReportFileName,'file','y'); +// #RNU_RES_E + +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// #RNU_RES_B +// ----------------------------------------------- +// --- Initial Check on While counter variables. --- +// ----------------------------------------------- +// #RNU_RES_E +if ((SharedInfo.WhileExpr.OnExec > 0) & (NOutArg==1)) + // #RNU_RES_B + //NUT: se sono in una while expression devo memorizzarmi l'ultima variabile di output + //NUT: perche' e' quella che contiene la condizione da testare, + //NUT: allora io me le salvo tutte e l'ultima salvata sara' quella che andra' a finire + //NUT: nella while. + // #RNU_RES_E + SharedInfo.WhileExpr.CondVar = OutArg(1).Name; + // #RNU_RES_B + //if (SharedInfo.WhileExpr.AssignmentFun == 0) + //NUT: Test also that SharedInfo.WhileExpr.AssignmentFun because sometimes Equal are dummy! + //NUT: verifica se e' giusta questa mia affermazione. + //RNU il seguente test e' stato spostato nella AST_HandleWhileStatem.c perche' + //RNU: secondo me la matrice finale non e' supportata dalla while, ma while(det(M)>0) + //RNU: puo' essere benissimo supportato. + // if (OutArg.Dimension > 0) + // SCI2CerrorFile('Cannot manage while with matrix conditions',ReportFileName); + // SharedInfo.SkipNextFun = 0; //NUT verifica se serve + // end + // #RNU_RES_E + SharedInfo.WhileExpr.DimCondVar = OutArg(1).Dimension; + ///end +end + +endfunction diff --git a/macros/CCodeGeneration/JoinDeclarAndCcode.sci b/macros/CCodeGeneration/JoinDeclarAndCcode.sci new file mode 100644 index 00000000..ebbf0023 --- /dev/null +++ b/macros/CCodeGeneration/JoinDeclarAndCcode.sci @@ -0,0 +1,168 @@ +function JoinDeclarAndCcode(FileInfoDatFile) +// function JoinDeclarAndCcode(FileInfoDatFile) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 07-Nov-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// --------------------- +// --- Load section. --- +// --------------------- +// --- Load File Info Structure. --- +load(FileInfoDatFile,'FileInfo'); + +// --- Load Shared Info Structure. --- +load(FileInfo.SharedInfoDatFile,'SharedInfo'); +// ------------------------- +// --- End load section. --- +// ------------------------- + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +funnumber = SharedInfo.NextSCIFunNumber; + +CPass1FileName = FileInfo.Funct(funnumber).CPass1FileName; +CPass2FileName = FileInfo.Funct(funnumber).CPass2FileName; +CDeclarationFileName = FileInfo.Funct(funnumber).CDeclarationFileName; +CGblDeclarFileName = FileInfo.Funct(funnumber).CGblDeclarFileName; +CInitVarsFileName = FileInfo.Funct(funnumber).CInitVarsFileName; +ReportFileName = FileInfo.Funct(funnumber).ReportFileName; + +CPass1V1FileFid = SCI2COpenFileRead(CPass1FileName); +CDeclarationFileFid = SCI2COpenFileRead(CDeclarationFileName); +CGblDeclarFileFid = SCI2COpenFileRead(CGblDeclarFileName); +CInitVarsFileFid = SCI2COpenFileRead(CInitVarsFileName); +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +PrintStepInfo('Joining declaration and C-call files',ReportFileName,'file'); + +PrintStringInfo('/*',CPass2FileName,'file','y'); +PrintStringInfo('** -------------------------------------',CPass2FileName,'file','y'); +PrintStringInfo('** --- Global Variables Declaration. ---',CPass2FileName,'file','y'); +PrintStringInfo('** -------------------------------------',CPass2FileName,'file','y'); +PrintStringInfo('*/',CPass2FileName,'file','y'); +// #RNU_RES_B +// --- Copy in V2 the global declaration file. --- +// #RNU_RES_E +while (~meof(CGblDeclarFileFid)) + // Read a line from C Global Declaration file. + tmpcline = mgetl(CGblDeclarFileFid,1); + if (length(tmpcline) == 0) + tmpcline = ' '; + end + + noblkstmpcline = stripblanks(tmpcline); + PrintStringInfo(tmpcline,CPass2FileName,'file','y'); +end +PrintStringInfo('/*',CPass2FileName,'file','y'); +PrintStringInfo('** -----------------------------------------',CPass2FileName,'file','y'); +PrintStringInfo('** --- End Global Variables Declaration. ---',CPass2FileName,'file','y'); +PrintStringInfo('** -----------------------------------------',CPass2FileName,'file','y'); +PrintStringInfo('*/',CPass2FileName,'file','y'); +PrintStringInfo(' ',CPass2FileName,'file','y'); + +// #RNU_RES_B +// --- Copy in V2 the first part of V1 up to "{". --- +// #RNU_RES_E +FoundCurlyBracket = 0; +while ((~meof(CPass1V1FileFid)) & (FoundCurlyBracket == 0)) + // Read a line from C Pass1 file. + tmpcline = mgetl(CPass1V1FileFid,1); + noblkstmpcline = stripblanks(tmpcline); + if (length(noblkstmpcline) > 0) + if (SCI2Cstrncmps1size('{',noblkstmpcline)) + FoundCurlyBracket = 1; + end + else + tmpcline = ' '; + end + PrintStringInfo(tmpcline,CPass2FileName,'file','y'); +end + +if (FoundCurlyBracket == 0) + SCI2CerrorFile('""{"" char not found in:'+CPass1FileName,ReportFileName); +end + +PrintStringInfo('/*',CPass2FileName,'file','y'); +PrintStringInfo('** -----------------------------',CPass2FileName,'file','y'); +PrintStringInfo('** --- Variable Declaration. ---',CPass2FileName,'file','y'); +PrintStringInfo('** -----------------------------',CPass2FileName,'file','y'); +PrintStringInfo('*/',CPass2FileName,'file','y'); +// --- Copy in V2 the declaration file. --- +while (~meof(CDeclarationFileFid)) + // Read a line from C Declaration file. + tmpcline = mgetl(CDeclarationFileFid,1); + if (length(tmpcline) == 0) + tmpcline = ' '; + end + + noblkstmpcline = stripblanks(tmpcline); + PrintStringInfo(tmpcline,CPass2FileName,'file','y'); +end + +// #RNU_RES_B +// --- Copy in V2 the variable initialization file. --- +// #RNU_RES_E +while (~meof(CInitVarsFileFid)) + // Read a line from C Declaration file. + tmpcline = mgetl(CInitVarsFileFid,1); + if (length(tmpcline) == 0) + tmpcline = ' '; + end + + noblkstmpcline = stripblanks(tmpcline); + PrintStringInfo(tmpcline,CPass2FileName,'file','y'); +end +PrintStringInfo('/*',CPass2FileName,'file','y'); +PrintStringInfo('** ---------------------------------',CPass2FileName,'file','y'); +PrintStringInfo('** --- End Variable Declaration. ---',CPass2FileName,'file','y'); +PrintStringInfo('** ---------------------------------',CPass2FileName,'file','y'); +PrintStringInfo('*/',CPass2FileName,'file','y'); + + +PrintStringInfo('/*',CPass2FileName,'file','y'); +PrintStringInfo('** ---------------',CPass2FileName,'file','y'); +PrintStringInfo('** --- C code. ---',CPass2FileName,'file','y'); +PrintStringInfo('** ---------------',CPass2FileName,'file','y'); +PrintStringInfo('*/',CPass2FileName,'file','y'); +// --- Copy the remaining part of V1 in V2. --- +while (~meof(CPass1V1FileFid)) + // #RNU_RES_B + // Read a line from C Pass1 file. + // #RNU_RES_E + tmpcline = mgetl(CPass1V1FileFid,1); + if (length(tmpcline) == 0) + tmpcline = ' '; + end + PrintStringInfo(tmpcline,CPass2FileName,'file','y'); +end + +// -------------------- +// --- Close Files. --- +// -------------------- +mclose(CPass1V1FileFid); +mclose(CDeclarationFileFid); +mclose(CGblDeclarFileFid); +mclose(CInitVarsFileFid); + +endfunction diff --git a/macros/CCodeGeneration/SCI2CMakefileTemplate.bkp b/macros/CCodeGeneration/SCI2CMakefileTemplate.bkp new file mode 100644 index 00000000..65184df1 --- /dev/null +++ b/macros/CCodeGeneration/SCI2CMakefileTemplate.bkp @@ -0,0 +1,230 @@ + +# --- C COMPILER --- +CC = gcc +CFLAGS = -Wall -pedantic -O3 -I $(HSRCDIR) +# --------------------------- +# --- END USER PARAMETERS --- +# --------------------------- + +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# DON'T TOUCH ANYTHING BELOW THIS LINE +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ + +ELEMENTARY_FUNCTIONS_DIR = $(CSRCDIR)/src/elementaryFunctions +CFLAGS_ELEMENTARY_FUNCTIONS = -I $(ELEMENTARY_FUNCTIONS_DIR)/includes -I $(ELEMENTARY_FUNCTIONS_DIR)/interfaces + + +EXEFILE = $(SCI2CDIR)/$(EXEFILENAME) + +objects = \ + $(OBJDIR)/doubleComplex.o \ + $(OBJDIR)/floatComplex.o \ + $(OBJDIR)/RealToComplex.o \ + $(OBJDIR)/conj.o \ + $(OBJDIR)/disp.o \ + $(OBJDIR)/ones.o \ + $(OBJDIR)/zeros.o \ + $(OBJDIR)/OpApex.o \ + $(OBJDIR)/OpColon.o \ + $(OBJDIR)/OpDotStar.o \ + $(OBJDIR)/OpDotHat.o \ + $(OBJDIR)/OpDotSlash.o \ + $(OBJDIR)/OpEqual.o \ + $(OBJDIR)/OpPlus.o \ + $(OBJDIR)/OpMinus.o \ + $(OBJDIR)/OpStar.o \ + $(OBJDIR)/OpIns.o \ + $(OBJDIR)/OpExt.o \ + $(OBJDIR)/OpRc.o \ + $(OBJDIR)/OpCc.o \ + $(OBJDIR)/cos.o \ + $(OBJDIR)/cosh.o \ + $(OBJDIR)/sin.o \ + $(OBJDIR)/sinh.o \ + $(OBJDIR)/FileManagement.o \ + $(OBJDIR)/OpLogLt.o \ + $(OBJDIR)/OpLogGt.o \ + $(OBJDIR)/OpLogGe.o \ + $(OBJDIR)/OpLogLe.o \ + $(OBJDIR)/OpLogEq.o \ + $(OBJDIR)/Find.o \ + $(OBJDIR)/ConvertPrecision.o \ + $(OBJDIR)/SCI2Cfft.o \ + $(OBJDIR)/SCI2Cconvol.o \ + $(OBJDIR)/ssqrts.o \ + $(OBJDIR)/dsqrts.o \ + $(OBJDIR)/csqrts.o \ + $(OBJDIR)/zsqrts.o \ + $(OBJDIR)/ssqrta.o \ + $(OBJDIR)/dsqrta.o \ + $(OBJDIR)/csqrta.o \ + $(OBJDIR)/zsqrta.o + +# --------------- +# --- TARGETS --- +# --------------- +compileexecute: $(objects) + @echo " " + @echo "============================" + @echo "Generation of the executable" + @echo "============================" + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) $(objects) $(SCI2CDIR)/*.c -o $(EXEFILE) + @echo " " + @echo "==============" + @echo "Executing code" + @echo "==============" + $(EXEFILE) + +clean: + @echo " " + @echo "=============================" + @echo "Removing only exe + obj files" + @echo "=============================" + rm -rf $(EXEFILE) + rm -rf $(objects) + @echo " " + +cleanexe: + @echo " " + @echo "==========================" + @echo "Removing only the exe file" + @echo "==========================" + rm -rf $(EXEFILE) + @echo " " + +$(OBJDIR)/doubleComplex.o: $(CSRCDIR)/doubleComplex.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/doubleComplex.c -o $(OBJDIR)/doubleComplex.o + +$(OBJDIR)/floatComplex.o: $(CSRCDIR)/floatComplex.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/floatComplex.c -o $(OBJDIR)/floatComplex.o + +$(OBJDIR)/RealToComplex.o: $(CSRCDIR)/RealToComplex.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/RealToComplex.c -o $(OBJDIR)/RealToComplex.o + +$(OBJDIR)/conj.o: $(CSRCDIR)/conj.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/conj.c -o $(OBJDIR)/conj.o + +$(OBJDIR)/disp.o: $(CSRCDIR)/disp.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/disp.c -o $(OBJDIR)/disp.o + +$(OBJDIR)/zeros.o: $(CSRCDIR)/zeros.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/zeros.c -o $(OBJDIR)/zeros.o + +$(OBJDIR)/ones.o: $(CSRCDIR)/ones.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/ones.c -o $(OBJDIR)/ones.o + +$(OBJDIR)/OpApex.o: $(CSRCDIR)/OpApex.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpApex.c -o $(OBJDIR)/OpApex.o + +$(OBJDIR)/OpColon.o: $(CSRCDIR)/OpColon.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpColon.c -o $(OBJDIR)/OpColon.o + +$(OBJDIR)/OpDotStar.o: $(CSRCDIR)/OpDotStar.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpDotStar.c -o $(OBJDIR)/OpDotStar.o + +$(OBJDIR)/OpDotHat.o: $(CSRCDIR)/OpDotHat.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpDotHat.c -o $(OBJDIR)/OpDotHat.o + +$(OBJDIR)/OpDotSlash.o: $(CSRCDIR)/OpDotSlash.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpDotSlash.c -o $(OBJDIR)/OpDotSlash.o + +$(OBJDIR)/OpEqual.o: $(CSRCDIR)/OpEqual.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpEqual.c -o $(OBJDIR)/OpEqual.o + +$(OBJDIR)/OpPlus.o: $(CSRCDIR)/OpPlus.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpPlus.c -o $(OBJDIR)/OpPlus.o + +$(OBJDIR)/OpMinus.o: $(CSRCDIR)/OpMinus.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpMinus.c -o $(OBJDIR)/OpMinus.o + +$(OBJDIR)/OpStar.o: $(CSRCDIR)/OpStar.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpStar.c -o $(OBJDIR)/OpStar.o + +$(OBJDIR)/OpIns.o: $(CSRCDIR)/OpIns.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpIns.c -o $(OBJDIR)/OpIns.o + +$(OBJDIR)/OpExt.o: $(CSRCDIR)/OpExt.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpExt.c -o $(OBJDIR)/OpExt.o + +$(OBJDIR)/OpRc.o: $(CSRCDIR)/OpRc.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpRc.c -o $(OBJDIR)/OpRc.o + +$(OBJDIR)/OpCc.o: $(CSRCDIR)/OpCc.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpCc.c -o $(OBJDIR)/OpCc.o + +$(OBJDIR)/cos.o: $(CSRCDIR)/cos.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/cos.c -o $(OBJDIR)/cos.o + +$(OBJDIR)/cosh.o: $(CSRCDIR)/cosh.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/cosh.c -o $(OBJDIR)/cosh.o + +$(OBJDIR)/sin.o: $(CSRCDIR)/sin.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/sin.c -o $(OBJDIR)/sin.o + +$(OBJDIR)/sinh.o: $(CSRCDIR)/sinh.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/sinh.c -o $(OBJDIR)/sinh.o + +$(OBJDIR)/FileManagement.o: $(CSRCDIR)/FileManagement.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/FileManagement.c -o $(OBJDIR)/FileManagement.o + +$(OBJDIR)/OpLogLt.o: $(CSRCDIR)/OpLogLt.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpLogLt.c -o $(OBJDIR)/OpLogLt.o + +$(OBJDIR)/OpLogGt.o: $(CSRCDIR)/OpLogGt.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpLogGt.c -o $(OBJDIR)/OpLogGt.o + +$(OBJDIR)/OpLogLe.o: $(CSRCDIR)/OpLogLe.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpLogLe.c -o $(OBJDIR)/OpLogLe.o + +$(OBJDIR)/OpLogGe.o: $(CSRCDIR)/OpLogGe.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpLogGe.c -o $(OBJDIR)/OpLogGe.o + +$(OBJDIR)/OpLogEq.o: $(CSRCDIR)/OpLogEq.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpLogEq.c -o $(OBJDIR)/OpLogEq.o + +$(OBJDIR)/Find.o: $(CSRCDIR)/Find.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/Find.c -o $(OBJDIR)/Find.o + +$(OBJDIR)/ConvertPrecision.o: $(CSRCDIR)/ConvertPrecision.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/ConvertPrecision.c -o $(OBJDIR)/ConvertPrecision.o + +$(OBJDIR)/SCI2Cfft.o: $(CSRCDIR)/SCI2Cfft.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/SCI2Cfft.c -o $(OBJDIR)/SCI2Cfft.o + +$(OBJDIR)/SCI2Cconvol.o: $(CSRCDIR)/SCI2Cconvol.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/SCI2Cconvol.c -o $(OBJDIR)/SCI2Cconvol.o + +$(OBJDIR)/sqrt.o: $(CSRCELEMFUNDIR)/sqrt/*sqrt*.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCELEMFUNDIR)/sqrt/*sqrt*.c -o $(OBJDIR)/sqrt.o + +$(OBJDIR)/ssqrts.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/ssqrts.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/ssqrts.c -o $(OBJDIR)/ssqrts.o + +$(OBJDIR)/dsqrts.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/dsqrts.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/dsqrts.c -o $(OBJDIR)/dsqrts.o + +$(OBJDIR)/csqrts.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/csqrts.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/csqrts.c -o $(OBJDIR)/csqrts.o + +$(OBJDIR)/zsqrts.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/zsqrts.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/zsqrts.c -o $(OBJDIR)/zsqrts.o + +$(OBJDIR)/ssqrta.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/ssqrta.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/ssqrta.c -o $(OBJDIR)/ssqrta.o + +$(OBJDIR)/dsqrta.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/dsqrta.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/dsqrta.c -o $(OBJDIR)/dsqrta.o + +$(OBJDIR)/csqrta.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/csqrta.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/csqrta.c -o $(OBJDIR)/csqrta.o + +$(OBJDIR)/zsqrta.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/zsqrta.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/zsqrta.c -o $(OBJDIR)/zsqrta.o diff --git a/macros/CCodeGeneration/SCI2CMakefileTemplate.bkp1 b/macros/CCodeGeneration/SCI2CMakefileTemplate.bkp1 new file mode 100644 index 00000000..65184df1 --- /dev/null +++ b/macros/CCodeGeneration/SCI2CMakefileTemplate.bkp1 @@ -0,0 +1,230 @@ + +# --- C COMPILER --- +CC = gcc +CFLAGS = -Wall -pedantic -O3 -I $(HSRCDIR) +# --------------------------- +# --- END USER PARAMETERS --- +# --------------------------- + +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# DON'T TOUCH ANYTHING BELOW THIS LINE +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ + +ELEMENTARY_FUNCTIONS_DIR = $(CSRCDIR)/src/elementaryFunctions +CFLAGS_ELEMENTARY_FUNCTIONS = -I $(ELEMENTARY_FUNCTIONS_DIR)/includes -I $(ELEMENTARY_FUNCTIONS_DIR)/interfaces + + +EXEFILE = $(SCI2CDIR)/$(EXEFILENAME) + +objects = \ + $(OBJDIR)/doubleComplex.o \ + $(OBJDIR)/floatComplex.o \ + $(OBJDIR)/RealToComplex.o \ + $(OBJDIR)/conj.o \ + $(OBJDIR)/disp.o \ + $(OBJDIR)/ones.o \ + $(OBJDIR)/zeros.o \ + $(OBJDIR)/OpApex.o \ + $(OBJDIR)/OpColon.o \ + $(OBJDIR)/OpDotStar.o \ + $(OBJDIR)/OpDotHat.o \ + $(OBJDIR)/OpDotSlash.o \ + $(OBJDIR)/OpEqual.o \ + $(OBJDIR)/OpPlus.o \ + $(OBJDIR)/OpMinus.o \ + $(OBJDIR)/OpStar.o \ + $(OBJDIR)/OpIns.o \ + $(OBJDIR)/OpExt.o \ + $(OBJDIR)/OpRc.o \ + $(OBJDIR)/OpCc.o \ + $(OBJDIR)/cos.o \ + $(OBJDIR)/cosh.o \ + $(OBJDIR)/sin.o \ + $(OBJDIR)/sinh.o \ + $(OBJDIR)/FileManagement.o \ + $(OBJDIR)/OpLogLt.o \ + $(OBJDIR)/OpLogGt.o \ + $(OBJDIR)/OpLogGe.o \ + $(OBJDIR)/OpLogLe.o \ + $(OBJDIR)/OpLogEq.o \ + $(OBJDIR)/Find.o \ + $(OBJDIR)/ConvertPrecision.o \ + $(OBJDIR)/SCI2Cfft.o \ + $(OBJDIR)/SCI2Cconvol.o \ + $(OBJDIR)/ssqrts.o \ + $(OBJDIR)/dsqrts.o \ + $(OBJDIR)/csqrts.o \ + $(OBJDIR)/zsqrts.o \ + $(OBJDIR)/ssqrta.o \ + $(OBJDIR)/dsqrta.o \ + $(OBJDIR)/csqrta.o \ + $(OBJDIR)/zsqrta.o + +# --------------- +# --- TARGETS --- +# --------------- +compileexecute: $(objects) + @echo " " + @echo "============================" + @echo "Generation of the executable" + @echo "============================" + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) $(objects) $(SCI2CDIR)/*.c -o $(EXEFILE) + @echo " " + @echo "==============" + @echo "Executing code" + @echo "==============" + $(EXEFILE) + +clean: + @echo " " + @echo "=============================" + @echo "Removing only exe + obj files" + @echo "=============================" + rm -rf $(EXEFILE) + rm -rf $(objects) + @echo " " + +cleanexe: + @echo " " + @echo "==========================" + @echo "Removing only the exe file" + @echo "==========================" + rm -rf $(EXEFILE) + @echo " " + +$(OBJDIR)/doubleComplex.o: $(CSRCDIR)/doubleComplex.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/doubleComplex.c -o $(OBJDIR)/doubleComplex.o + +$(OBJDIR)/floatComplex.o: $(CSRCDIR)/floatComplex.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/floatComplex.c -o $(OBJDIR)/floatComplex.o + +$(OBJDIR)/RealToComplex.o: $(CSRCDIR)/RealToComplex.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/RealToComplex.c -o $(OBJDIR)/RealToComplex.o + +$(OBJDIR)/conj.o: $(CSRCDIR)/conj.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/conj.c -o $(OBJDIR)/conj.o + +$(OBJDIR)/disp.o: $(CSRCDIR)/disp.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/disp.c -o $(OBJDIR)/disp.o + +$(OBJDIR)/zeros.o: $(CSRCDIR)/zeros.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/zeros.c -o $(OBJDIR)/zeros.o + +$(OBJDIR)/ones.o: $(CSRCDIR)/ones.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/ones.c -o $(OBJDIR)/ones.o + +$(OBJDIR)/OpApex.o: $(CSRCDIR)/OpApex.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpApex.c -o $(OBJDIR)/OpApex.o + +$(OBJDIR)/OpColon.o: $(CSRCDIR)/OpColon.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpColon.c -o $(OBJDIR)/OpColon.o + +$(OBJDIR)/OpDotStar.o: $(CSRCDIR)/OpDotStar.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpDotStar.c -o $(OBJDIR)/OpDotStar.o + +$(OBJDIR)/OpDotHat.o: $(CSRCDIR)/OpDotHat.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpDotHat.c -o $(OBJDIR)/OpDotHat.o + +$(OBJDIR)/OpDotSlash.o: $(CSRCDIR)/OpDotSlash.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpDotSlash.c -o $(OBJDIR)/OpDotSlash.o + +$(OBJDIR)/OpEqual.o: $(CSRCDIR)/OpEqual.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpEqual.c -o $(OBJDIR)/OpEqual.o + +$(OBJDIR)/OpPlus.o: $(CSRCDIR)/OpPlus.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpPlus.c -o $(OBJDIR)/OpPlus.o + +$(OBJDIR)/OpMinus.o: $(CSRCDIR)/OpMinus.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpMinus.c -o $(OBJDIR)/OpMinus.o + +$(OBJDIR)/OpStar.o: $(CSRCDIR)/OpStar.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpStar.c -o $(OBJDIR)/OpStar.o + +$(OBJDIR)/OpIns.o: $(CSRCDIR)/OpIns.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpIns.c -o $(OBJDIR)/OpIns.o + +$(OBJDIR)/OpExt.o: $(CSRCDIR)/OpExt.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpExt.c -o $(OBJDIR)/OpExt.o + +$(OBJDIR)/OpRc.o: $(CSRCDIR)/OpRc.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpRc.c -o $(OBJDIR)/OpRc.o + +$(OBJDIR)/OpCc.o: $(CSRCDIR)/OpCc.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpCc.c -o $(OBJDIR)/OpCc.o + +$(OBJDIR)/cos.o: $(CSRCDIR)/cos.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/cos.c -o $(OBJDIR)/cos.o + +$(OBJDIR)/cosh.o: $(CSRCDIR)/cosh.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/cosh.c -o $(OBJDIR)/cosh.o + +$(OBJDIR)/sin.o: $(CSRCDIR)/sin.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/sin.c -o $(OBJDIR)/sin.o + +$(OBJDIR)/sinh.o: $(CSRCDIR)/sinh.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/sinh.c -o $(OBJDIR)/sinh.o + +$(OBJDIR)/FileManagement.o: $(CSRCDIR)/FileManagement.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/FileManagement.c -o $(OBJDIR)/FileManagement.o + +$(OBJDIR)/OpLogLt.o: $(CSRCDIR)/OpLogLt.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpLogLt.c -o $(OBJDIR)/OpLogLt.o + +$(OBJDIR)/OpLogGt.o: $(CSRCDIR)/OpLogGt.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpLogGt.c -o $(OBJDIR)/OpLogGt.o + +$(OBJDIR)/OpLogLe.o: $(CSRCDIR)/OpLogLe.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpLogLe.c -o $(OBJDIR)/OpLogLe.o + +$(OBJDIR)/OpLogGe.o: $(CSRCDIR)/OpLogGe.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpLogGe.c -o $(OBJDIR)/OpLogGe.o + +$(OBJDIR)/OpLogEq.o: $(CSRCDIR)/OpLogEq.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/OpLogEq.c -o $(OBJDIR)/OpLogEq.o + +$(OBJDIR)/Find.o: $(CSRCDIR)/Find.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/Find.c -o $(OBJDIR)/Find.o + +$(OBJDIR)/ConvertPrecision.o: $(CSRCDIR)/ConvertPrecision.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/ConvertPrecision.c -o $(OBJDIR)/ConvertPrecision.o + +$(OBJDIR)/SCI2Cfft.o: $(CSRCDIR)/SCI2Cfft.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/SCI2Cfft.c -o $(OBJDIR)/SCI2Cfft.o + +$(OBJDIR)/SCI2Cconvol.o: $(CSRCDIR)/SCI2Cconvol.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCDIR)/SCI2Cconvol.c -o $(OBJDIR)/SCI2Cconvol.o + +$(OBJDIR)/sqrt.o: $(CSRCELEMFUNDIR)/sqrt/*sqrt*.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) -c $(CSRCELEMFUNDIR)/sqrt/*sqrt*.c -o $(OBJDIR)/sqrt.o + +$(OBJDIR)/ssqrts.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/ssqrts.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/ssqrts.c -o $(OBJDIR)/ssqrts.o + +$(OBJDIR)/dsqrts.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/dsqrts.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/dsqrts.c -o $(OBJDIR)/dsqrts.o + +$(OBJDIR)/csqrts.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/csqrts.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/csqrts.c -o $(OBJDIR)/csqrts.o + +$(OBJDIR)/zsqrts.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/zsqrts.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/zsqrts.c -o $(OBJDIR)/zsqrts.o + +$(OBJDIR)/ssqrta.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/ssqrta.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/ssqrta.c -o $(OBJDIR)/ssqrta.o + +$(OBJDIR)/dsqrta.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/dsqrta.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/dsqrta.c -o $(OBJDIR)/dsqrta.o + +$(OBJDIR)/csqrta.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/csqrta.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/csqrta.c -o $(OBJDIR)/csqrta.o + +$(OBJDIR)/zsqrta.o: $(CSRCDIR)/src/elementaryFunctions/sqrt/zsqrta.c $(HSRCDIR)/*.h + $(CC) $(CFLAGS) $(CFLAGS_ELEMENTARY_FUNCTIONS) -c $(ELEMENTARY_FUNCTIONS_DIR)/sqrt/zsqrta.c -o $(OBJDIR)/zsqrta.o diff --git a/macros/CCodeGeneration/SCI2CMakefileTemplate.bkp2 b/macros/CCodeGeneration/SCI2CMakefileTemplate.bkp2 new file mode 100644 index 00000000..c6ba2a9c --- /dev/null +++ b/macros/CCodeGeneration/SCI2CMakefileTemplate.bkp2 @@ -0,0 +1,126 @@ + +# --- C COMPILER --- +CC = gcc +CFLAGS = -Wall -pedantic -O3 -I $(HSRCDIR) -I $(ISRCDIR) +# --------------------------- +# --- END USER PARAMETERS --- +# --------------------------- + +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# DON'T TOUCH ANYTHING BELOW THIS LINE +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ + +EXEFILE = $(SCI2CDIR)/$(EXEFILENAME) + +SWSRCS = \ + $(CSRCDIR)/doubleComplex.c \ + $(CSRCDIR)/floatComplex.c \ + $(CSRCDIR)/RealToComplex.c \ + $(CSRCDIR)/conj.c \ + $(CSRCDIR)/disp.c \ + $(CSRCDIR)/ones.c \ + $(CSRCDIR)/zeros.c \ + $(CSRCDIR)/OpApex.c \ + $(CSRCDIR)/OpColon.c \ + $(CSRCDIR)/OpDotStar.c \ + $(CSRCDIR)/OpDotHat.c \ + $(CSRCDIR)/OpDotSlash.c \ + $(CSRCDIR)/OpEqual.c \ + $(CSRCDIR)/OpPlus.c \ + $(CSRCDIR)/OpMinus.c \ + $(CSRCDIR)/OpStar.c \ + $(CSRCDIR)/OpIns.c \ + $(CSRCDIR)/OpExt.c \ + $(CSRCDIR)/OpRc.c \ + $(CSRCDIR)/OpCc.c \ + $(CSRCDIR)/cos.c \ + $(CSRCDIR)/cosh.c \ + $(CSRCDIR)/sin.c \ + $(CSRCDIR)/sinh.c \ + $(CSRCDIR)/FileManagement.c \ + $(CSRCDIR)/OpLogLt.c \ + $(CSRCDIR)/OpLogGt.c \ + $(CSRCDIR)/OpLogGe.c \ + $(CSRCDIR)/OpLogLe.c \ + $(CSRCDIR)/OpLogEq.c \ + $(CSRCDIR)/OpLogOr.c \ + $(CSRCDIR)/OpLogAnd.c \ + $(CSRCDIR)/Find.c \ + $(CSRCDIR)/ConvertPrecision.c \ + $(CSRCDIR)/SCI2Cfft.c \ + $(CSRCDIR)/SCI2Cconvol.c \ + $(CSRCDIR)/ssqrts.c \ + $(CSRCDIR)/dsqrts.c \ + $(CSRCDIR)/csqrts.c \ + $(CSRCDIR)/zsqrts.c \ + $(CSRCDIR)/ssqrta.c \ + $(CSRCDIR)/dsqrta.c \ + $(CSRCDIR)/csqrta.c \ + $(CSRCDIR)/zsqrta.c \ + $(CSRCDIR)/sabss.c \ + $(CSRCDIR)/dabss.c \ + $(CSRCDIR)/cabss.c \ + $(CSRCDIR)/zabss.c \ + $(CSRCDIR)/sabsa.c \ + $(CSRCDIR)/dabsa.c \ + $(CSRCDIR)/cabsa.c \ + $(CSRCDIR)/zabsa.c \ + $(CSRCDIR)/sexps.c \ + $(CSRCDIR)/dexps.c \ + $(CSRCDIR)/cexps.c \ + $(CSRCDIR)/zexps.c \ + $(CSRCDIR)/sexpa.c \ + $(CSRCDIR)/dexpa.c \ + $(CSRCDIR)/cexpa.c \ + $(CSRCDIR)/zexpa.c + +SWOBJS = $(SWSRCS:.c=.o) + +# --------------- +# --- TARGETS --- +# --------------- +compileexecute: $(SWOBJS) + @echo " " + @echo "============================" + @echo "Generation of the executable" + @echo "============================" + $(CC) $(CFLAGS) $(SWOBJS) $(SCI2CDIR)/*.c -o $(EXEFILE) + @echo " " + @echo "==============" + @echo "Executing code" + @echo "==============" + $(EXEFILE) + +clean: + @echo " " + @echo "=============================" + @echo "Removing only exe + obj files" + @echo "=============================" + rm -rf $(EXEFILE) + rm -rf $(SWOBJS) + @echo " " + +cleanexe: + @echo " " + @echo "==========================" + @echo "Removing only the exe file" + @echo "==========================" + rm -rf $(EXEFILE) + @echo " " + +# how to compile object code .o from C source files .c (general rule) +# space between -o and filename for SUN make +.c.o: + $(CC) $(CFLAGS) -c -o $(@) $< + +# Make object code from source +swobjs: $(SWOBJS) + diff --git a/macros/CCodeGeneration/SCI2CMakefileTemplate.rc b/macros/CCodeGeneration/SCI2CMakefileTemplate.rc new file mode 100644 index 00000000..6d459829 --- /dev/null +++ b/macros/CCodeGeneration/SCI2CMakefileTemplate.rc @@ -0,0 +1,548 @@ + +# --- C COMPILER --- +CC = gcc +CFLAGS = -Wall -pedantic -O3 -I $(HSRCDIR) -I $(ISRCDIR) -lm +# --------------------------- +# --- END USER PARAMETERS --- +# --------------------------- + +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# DON'T TOUCH ANYTHING BELOW THIS LINE +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ +# ------------------------------------ + +EXEFILE = $(SCI2CDIR)/$(EXEFILENAME) + +SWSRCS = \ + $(CSRCDIR)/doubleComplex.c \ + $(CSRCDIR)/floatComplex.c \ + $(CSRCDIR)/ssqrts.c \ + $(CSRCDIR)/dsqrts.c \ + $(CSRCDIR)/csqrts.c \ + $(CSRCDIR)/zsqrts.c \ + $(CSRCDIR)/ssqrta.c \ + $(CSRCDIR)/dsqrta.c \ + $(CSRCDIR)/csqrta.c \ + $(CSRCDIR)/zsqrta.c \ + $(CSRCDIR)/sabss.c \ + $(CSRCDIR)/dabss.c \ + $(CSRCDIR)/cabss.c \ + $(CSRCDIR)/zabss.c \ + $(CSRCDIR)/sabsa.c \ + $(CSRCDIR)/dabsa.c \ + $(CSRCDIR)/cabsa.c \ + $(CSRCDIR)/zabsa.c \ + $(CSRCDIR)/smeana.c \ + $(CSRCDIR)/dmeana.c \ + $(CSRCDIR)/cmeana.c \ + $(CSRCDIR)/zmeana.c \ + $(CSRCDIR)/slog1ps.c \ + $(CSRCDIR)/dlog1ps.c \ + $(CSRCDIR)/slog1pa.c \ + $(CSRCDIR)/dlog1pa.c \ + $(CSRCDIR)/dfinda.c \ + $(CSRCDIR)/sfinda.c \ + $(CSRCDIR)/cfinda.c \ + $(CSRCDIR)/zfinda.c\ + $(CSRCDIR)/dfind2da.c \ + $(CSRCDIR)/sfind2da.c \ + $(CSRCDIR)/cfind2da.c \ + $(CSRCDIR)/zfind2da.c\ + $(CSRCDIR)/scats.c \ + $(CSRCDIR)/scata.c \ + $(CSRCDIR)/dcats.c \ + $(CSRCDIR)/dcata.c \ + $(CSRCDIR)/ccats.c \ + $(CSRCDIR)/ccata.c \ + $(CSRCDIR)/zcats.c \ + $(CSRCDIR)/zcata.c \ + $(CSRCDIR)/sdisps.c \ + $(CSRCDIR)/sdispa.c \ + $(CSRCDIR)/ddisps.c \ + $(CSRCDIR)/ddispa.c\ + $(CSRCDIR)/cdisps.c \ + $(CSRCDIR)/cdispa.c\ + $(CSRCDIR)/zdisps.c \ + $(CSRCDIR)/zdispa.c\ + $(CSRCDIR)/cmuls.c\ + $(CSRCDIR)/cmula.c \ + $(CSRCDIR)/dmuls.c\ + $(CSRCDIR)/dmula.c \ + $(CSRCDIR)/smuls.c\ + $(CSRCDIR)/smula.c \ + $(CSRCDIR)/zmuls.c\ + $(CSRCDIR)/zmula.c \ + $(CSRCDIR)/cadds.c\ + $(CSRCDIR)/cadda.c \ + $(CSRCDIR)/dadds.c\ + $(CSRCDIR)/dadda.c \ + $(CSRCDIR)/sadds.c\ + $(CSRCDIR)/sadda.c \ + $(CSRCDIR)/zadds.c\ + $(CSRCDIR)/zadda.c\ + $(CSRCDIR)/cdiffs.c\ + $(CSRCDIR)/cdiffa.c \ + $(CSRCDIR)/ddiffs.c\ + $(CSRCDIR)/ddiffa.c \ + $(CSRCDIR)/sdiffs.c\ + $(CSRCDIR)/sdiffa.c \ + $(CSRCDIR)/zdiffs.c\ + $(CSRCDIR)/zdiffa.c \ + $(CSRCDIR)/cfilla.c\ + $(CSRCDIR)/dfilla.c\ + $(CSRCDIR)/sfilla.c\ + $(CSRCDIR)/zfilla.c \ + $(CSRCDIR)/conesa.c\ + $(CSRCDIR)/donesa.c\ + $(CSRCDIR)/sonesa.c\ + $(CSRCDIR)/zonesa.c\ + $(CSRCDIR)/crdivs.c\ + $(CSRCDIR)/crdiva.c \ + $(CSRCDIR)/drdivs.c\ + $(CSRCDIR)/drdiva.c \ + $(CSRCDIR)/srdivs.c\ + $(CSRCDIR)/srdiva.c \ + $(CSRCDIR)/zrdivs.c\ + $(CSRCDIR)/zrdiva.c\ + $(CSRCDIR)/cldivs.c\ + $(CSRCDIR)/cldiva.c \ + $(CSRCDIR)/dldivs.c\ + $(CSRCDIR)/dldiva.c \ + $(CSRCDIR)/sldivs.c\ + $(CSRCDIR)/sldiva.c \ + $(CSRCDIR)/zldivs.c\ + $(CSRCDIR)/zldiva.c\ + $(CSRCDIR)/cconjs.c\ + $(CSRCDIR)/cconja.c\ + $(CSRCDIR)/zconjs.c\ + $(CSRCDIR)/zconja.c\ + $(CSRCDIR)/ceyea.c\ + $(CSRCDIR)/deyea.c\ + $(CSRCDIR)/seyea.c\ + $(CSRCDIR)/zeyea.c\ + $(CSRCDIR)/ctracea.c\ + $(CSRCDIR)/dtracea.c\ + $(CSRCDIR)/stracea.c\ + $(CSRCDIR)/ztracea.c\ + $(CSRCDIR)/srowmeana.c \ + $(CSRCDIR)/drowmeana.c \ + $(CSRCDIR)/crowmeana.c \ + $(CSRCDIR)/zrowmeana.c \ + $(CSRCDIR)/scolumnmeana.c \ + $(CSRCDIR)/dcolumnmeana.c \ + $(CSRCDIR)/ccolumnmeana.c \ + $(CSRCDIR)/zcolumnmeana.c \ + $(CSRCDIR)/ssuma.c \ + $(CSRCDIR)/dsuma.c \ + $(CSRCDIR)/csuma.c \ + $(CSRCDIR)/zsuma.c \ + $(CSRCDIR)/srowsuma.c \ + $(CSRCDIR)/drowsuma.c \ + $(CSRCDIR)/crowsuma.c \ + $(CSRCDIR)/zrowsuma.c \ + $(CSRCDIR)/scolumnsuma.c \ + $(CSRCDIR)/dcolumnsuma.c \ + $(CSRCDIR)/ccolumnsuma.c \ + $(CSRCDIR)/zcolumnsuma.c\ + $(CSRCDIR)/cmulma.c\ + $(CSRCDIR)/dmulma.c\ + $(CSRCDIR)/smulma.c\ + $(CSRCDIR)/zmulma.c\ + $(CSRCDIR)/svariancea.c \ + $(CSRCDIR)/dvariancea.c \ + $(CSRCDIR)/cvariancea.c \ + $(CSRCDIR)/zvariancea.c \ + $(CSRCDIR)/srowvariancea.c \ + $(CSRCDIR)/drowvariancea.c \ + $(CSRCDIR)/crowvariancea.c \ + $(CSRCDIR)/zrowvariancea.c \ + $(CSRCDIR)/scolumnvariancea.c \ + $(CSRCDIR)/dcolumnvariancea.c \ + $(CSRCDIR)/ccolumnvariancea.c \ + $(CSRCDIR)/zcolumnvariancea.c \ + $(CSRCDIR)/cpows.c \ + $(CSRCDIR)/cpowa.c \ + $(CSRCDIR)/dpows.c \ + $(CSRCDIR)/dpowa.c \ + $(CSRCDIR)/spows.c \ + $(CSRCDIR)/spowa.c \ + $(CSRCDIR)/zpows.c \ + $(CSRCDIR)/zpowa.c \ + $(CSRCDIR)/ctransposea.c \ + $(CSRCDIR)/dtransposea.c \ + $(CSRCDIR)/stransposea.c \ + $(CSRCDIR)/ztransposea.c \ + $(CSRCDIR)/clogs.c \ + $(CSRCDIR)/cloga.c \ + $(CSRCDIR)/dlogs.c \ + $(CSRCDIR)/dloga.c \ + $(CSRCDIR)/slogs.c \ + $(CSRCDIR)/sloga.c \ + $(CSRCDIR)/zlogs.c \ + $(CSRCDIR)/zloga.c \ + $(CSRCDIR)/cpythags.c\ + $(CSRCDIR)/dpythags.c \ + $(CSRCDIR)/spythags.c\ + $(CSRCDIR)/zpythags.c \ + $(CSRCDIR)/cacoss.c \ + $(CSRCDIR)/cacosa.c \ + $(CSRCDIR)/dacoss.c \ + $(CSRCDIR)/dacosa.c \ + $(CSRCDIR)/sacoss.c \ + $(CSRCDIR)/sacosa.c \ + $(CSRCDIR)/zacoss.c \ + $(CSRCDIR)/zacosa.c \ + $(CSRCDIR)/catans.c \ + $(CSRCDIR)/catana.c \ + $(CSRCDIR)/datans.c \ + $(CSRCDIR)/datana.c \ + $(CSRCDIR)/satans.c \ + $(CSRCDIR)/satana.c \ + $(CSRCDIR)/zatans.c \ + $(CSRCDIR)/zatana.c \ + $(CSRCDIR)/dlnp1m1s.c \ + $(CSRCDIR)/slnp1m1s.c\ + $(CSRCDIR)/cacoshs.c \ + $(CSRCDIR)/cacosha.c \ + $(CSRCDIR)/dacoshs.c \ + $(CSRCDIR)/dacosha.c \ + $(CSRCDIR)/sacoshs.c \ + $(CSRCDIR)/sacosha.c \ + $(CSRCDIR)/zacoshs.c \ + $(CSRCDIR)/zacosha.c\ + $(CSRCDIR)/crdivma.c \ + $(CSRCDIR)/drdivma.c \ + $(CSRCDIR)/srdivma.c \ + $(CSRCDIR)/zrdivma.c\ + $(CSRCDIR)/cldivma.c \ + $(CSRCDIR)/dldivma.c \ + $(CSRCDIR)/sldivma.c \ + $(CSRCDIR)/zldivma.c \ + $(CSRCDIR)/cinverma.c \ + $(CSRCDIR)/dinverma.c \ + $(CSRCDIR)/sinverma.c \ + $(CSRCDIR)/zinverma.c \ + $(CSRCDIR)/cexps.c \ + $(CSRCDIR)/dexps.c \ + $(CSRCDIR)/sexps.c \ + $(CSRCDIR)/zexps.c \ + $(CSRCDIR)/cexpa.c \ + $(CSRCDIR)/dexpa.c \ + $(CSRCDIR)/sexpa.c \ + $(CSRCDIR)/zexpa.c \ + $(CSRCDIR)/cexpma.c \ + $(CSRCDIR)/dexpma.c \ + $(CSRCDIR)/sexpma.c \ + $(CSRCDIR)/zexpma.c \ + $(CSRCDIR)/dfrexps.c \ + $(CSRCDIR)/sfrexps.c \ + $(CSRCDIR)/cinfnorma.c \ + $(CSRCDIR)/dinfnorma.c \ + $(CSRCDIR)/sinfnorma.c \ + $(CSRCDIR)/zinfnorma.c \ + $(CSRCDIR)/csigns.c \ + $(CSRCDIR)/csigna.c \ + $(CSRCDIR)/dsigns.c \ + $(CSRCDIR)/dsigna.c \ + $(CSRCDIR)/ssigns.c \ + $(CSRCDIR)/ssigna.c \ + $(CSRCDIR)/zsigns.c \ + $(CSRCDIR)/zsigna.c \ + $(CSRCDIR)/cdeterma.c \ + $(CSRCDIR)/ddeterma.c \ + $(CSRCDIR)/sdeterma.c \ + $(CSRCDIR)/zdeterma.c \ + $(CSRCDIR)/csins.c \ + $(CSRCDIR)/csina.c \ + $(CSRCDIR)/dsins.c \ + $(CSRCDIR)/dsina.c \ + $(CSRCDIR)/ssins.c \ + $(CSRCDIR)/ssina.c \ + $(CSRCDIR)/zsins.c \ + $(CSRCDIR)/zsina.c \ + $(CSRCDIR)/csinhs.c \ + $(CSRCDIR)/csinha.c \ + $(CSRCDIR)/dsinhs.c \ + $(CSRCDIR)/dsinha.c \ + $(CSRCDIR)/ssinhs.c \ + $(CSRCDIR)/ssinha.c \ + $(CSRCDIR)/zsinhs.c \ + $(CSRCDIR)/zsinha.c \ + $(CSRCDIR)/ccoshs.c \ + $(CSRCDIR)/ccosha.c \ + $(CSRCDIR)/dcoshs.c \ + $(CSRCDIR)/dcosha.c \ + $(CSRCDIR)/scoshs.c \ + $(CSRCDIR)/scosha.c \ + $(CSRCDIR)/zcoshs.c \ + $(CSRCDIR)/zcosha.c\ + $(CSRCDIR)/ccoss.c \ + $(CSRCDIR)/ccosa.c \ + $(CSRCDIR)/dcoss.c \ + $(CSRCDIR)/dcosa.c \ + $(CSRCDIR)/scoss.c \ + $(CSRCDIR)/scosa.c \ + $(CSRCDIR)/zcoss.c \ + $(CSRCDIR)/zcosa.c \ + $(CSRCDIR)/casins.c \ + $(CSRCDIR)/casina.c \ + $(CSRCDIR)/dasins.c \ + $(CSRCDIR)/dasina.c \ + $(CSRCDIR)/sasins.c \ + $(CSRCDIR)/sasina.c \ + $(CSRCDIR)/zasins.c \ + $(CSRCDIR)/zasina.c \ + $(CSRCDIR)/casinhs.c \ + $(CSRCDIR)/casinha.c \ + $(CSRCDIR)/dasinhs.c \ + $(CSRCDIR)/dasinha.c \ + $(CSRCDIR)/sasinhs.c \ + $(CSRCDIR)/sasinha.c \ + $(CSRCDIR)/zasinhs.c \ + $(CSRCDIR)/zasinha.c \ + $(CSRCDIR)/datan2s.c \ + $(CSRCDIR)/datan2a.c \ + $(CSRCDIR)/satan2s.c \ + $(CSRCDIR)/satan2a.c \ + $(CSRCDIR)/catanhs.c \ + $(CSRCDIR)/catanha.c \ + $(CSRCDIR)/datanhs.c \ + $(CSRCDIR)/datanha.c \ + $(CSRCDIR)/satanhs.c \ + $(CSRCDIR)/satanha.c \ + $(CSRCDIR)/zatanhs.c \ + $(CSRCDIR)/zatanha.c \ + $(CSRCDIR)/clog10s.c \ + $(CSRCDIR)/clog10a.c \ + $(CSRCDIR)/dlog10s.c \ + $(CSRCDIR)/dlog10a.c \ + $(CSRCDIR)/slog10s.c \ + $(CSRCDIR)/slog10a.c \ + $(CSRCDIR)/zlog10s.c \ + $(CSRCDIR)/zlog10a.c \ + $(CSRCDIR)/ctans.c \ + $(CSRCDIR)/ctana.c \ + $(CSRCDIR)/dtans.c \ + $(CSRCDIR)/dtana.c \ + $(CSRCDIR)/stans.c \ + $(CSRCDIR)/stana.c \ + $(CSRCDIR)/ztans.c \ + $(CSRCDIR)/ztana.c \ + $(CSRCDIR)/ctanhs.c \ + $(CSRCDIR)/ctanha.c \ + $(CSRCDIR)/dtanhs.c \ + $(CSRCDIR)/dtanha.c \ + $(CSRCDIR)/stanhs.c \ + $(CSRCDIR)/stanha.c \ + $(CSRCDIR)/ztanhs.c \ + $(CSRCDIR)/ztanha.c \ + $(CSRCDIR)/cisnans.c \ + $(CSRCDIR)/cisnana.c \ + $(CSRCDIR)/disnans.c \ + $(CSRCDIR)/disnana.c \ + $(CSRCDIR)/sisnans.c \ + $(CSRCDIR)/sisnana.c \ + $(CSRCDIR)/zisnans.c \ + $(CSRCDIR)/zisnana.c \ + $(CSRCDIR)/cconva.c \ + $(CSRCDIR)/dconva.c \ + $(CSRCDIR)/sconva.c \ + $(CSRCDIR)/zconva.c \ + $(CSRCDIR)/cconv2da.c \ + $(CSRCDIR)/dconv2da.c \ + $(CSRCDIR)/sconv2da.c \ + $(CSRCDIR)/zconv2da.c \ + $(CSRCDIR)/sfftma.c \ + $(CSRCDIR)/dfftma.c \ + $(CSRCDIR)/cfftma.c \ + $(CSRCDIR)/zfftma.c \ + $(CSRCDIR)/dfft2.c \ + $(CSRCDIR)/dfftbi.c \ + $(CSRCDIR)/dfftmx.c \ + $(CSRCDIR)/fft842.c \ + $(CSRCDIR)/r2tx.c \ + $(CSRCDIR)/r4tx.c \ + $(CSRCDIR)/r8tx.c \ + $(CSRCDIR)/sifftma.c \ + $(CSRCDIR)/difftma.c \ + $(CSRCDIR)/cifftma.c \ + $(CSRCDIR)/zifftma.c \ + $(CSRCDIR)/difft2.c \ + $(CSRCDIR)/difftbi.c \ + $(CSRCDIR)/difftmx.c \ + $(CSRCDIR)/ifft842.c \ + $(CSRCDIR)/ir2tx.c \ + $(CSRCDIR)/ir4tx.c \ + $(CSRCDIR)/ir8tx.c \ + $(CSRCDIR)/cchola.c \ + $(CSRCDIR)/dchols.c \ + $(CSRCDIR)/dchola.c \ + $(CSRCDIR)/schols.c \ + $(CSRCDIR)/schola.c \ + $(CSRCDIR)/zchola.c \ + $(CSRCDIR)/cleva.c \ + $(CSRCDIR)/dleva.c \ + $(CSRCDIR)/sleva.c \ + $(CSRCDIR)/zleva.c \ + $(CSRCDIR)/cleva2.c \ + $(CSRCDIR)/dleva2.c \ + $(CSRCDIR)/sleva2.c \ + $(CSRCDIR)/zleva2.c \ + $(CSRCDIR)/cimplicitLists.c \ + $(CSRCDIR)/dimplicitLists.c \ + $(CSRCDIR)/simplicitLists.c \ + $(CSRCDIR)/zimplicitLists.c \ + $(CSRCDIR)/czerosa.c \ + $(CSRCDIR)/dzerosa.c \ + $(CSRCDIR)/szerosa.c \ + $(CSRCDIR)/zzerosa.c \ + $(CSRCDIR)/cspeca.c \ + $(CSRCDIR)/dspeca.c \ + $(CSRCDIR)/sspeca.c \ + $(CSRCDIR)/zspeca.c \ + $(CSRCDIR)/cspec2a.c \ + $(CSRCDIR)/dspec2a.c \ + $(CSRCDIR)/sspec2a.c \ + $(CSRCDIR)/zspec2a.c \ + $(CSRCDIR)/smina.c \ + $(CSRCDIR)/smaxa.c \ + $(CSRCDIR)/srowmina.c \ + $(CSRCDIR)/srowmaxa.c \ + $(CSRCDIR)/scolumnmina.c \ + $(CSRCDIR)/scolumnmaxa.c \ + $(CSRCDIR)/dmina.c \ + $(CSRCDIR)/dmaxa.c \ + $(CSRCDIR)/drowmina.c \ + $(CSRCDIR)/drowmaxa.c \ + $(CSRCDIR)/dcolumnmina.c \ + $(CSRCDIR)/dcolumnmaxa.c \ + $(CSRCDIR)/cpowma.c \ + $(CSRCDIR)/dpowma.c \ + $(CSRCDIR)/spowma.c \ + $(CSRCDIR)/zpowma.c \ + $(CSRCDIR)/cfftshifta.c \ + $(CSRCDIR)/dfftshifta.c \ + $(CSRCDIR)/sfftshifta.c \ + $(CSRCDIR)/zfftshifta.c \ + $(CSRCDIR)/crowfftshifta.c \ + $(CSRCDIR)/drowfftshifta.c \ + $(CSRCDIR)/srowfftshifta.c \ + $(CSRCDIR)/zrowfftshifta.c \ + $(CSRCDIR)/ccolumnfftshifta.c \ + $(CSRCDIR)/dcolumnfftshifta.c \ + $(CSRCDIR)/scolumnfftshifta.c \ + $(CSRCDIR)/zcolumnfftshifta.c \ + $(CSRCDIR)/cceils.c \ + $(CSRCDIR)/cceila.c \ + $(CSRCDIR)/dceils.c \ + $(CSRCDIR)/dceila.c \ + $(CSRCDIR)/sceils.c \ + $(CSRCDIR)/sceila.c \ + $(CSRCDIR)/zceils.c \ + $(CSRCDIR)/zceila.c \ + $(CSRCDIR)/cfixs.c \ + $(CSRCDIR)/cfixa.c \ + $(CSRCDIR)/dfixs.c \ + $(CSRCDIR)/dfixa.c \ + $(CSRCDIR)/sfixs.c \ + $(CSRCDIR)/sfixa.c \ + $(CSRCDIR)/zfixs.c \ + $(CSRCDIR)/zfixa.c \ + $(CSRCDIR)/cfloors.c \ + $(CSRCDIR)/cfloora.c \ + $(CSRCDIR)/dfloors.c \ + $(CSRCDIR)/dfloora.c \ + $(CSRCDIR)/sfloors.c \ + $(CSRCDIR)/sfloora.c \ + $(CSRCDIR)/zfloors.c \ + $(CSRCDIR)/zfloora.c \ + $(CSRCDIR)/cints.c \ + $(CSRCDIR)/cinta.c \ + $(CSRCDIR)/dints.c \ + $(CSRCDIR)/dinta.c \ + $(CSRCDIR)/sints.c \ + $(CSRCDIR)/sinta.c \ + $(CSRCDIR)/zints.c \ + $(CSRCDIR)/zinta.c \ + $(CSRCDIR)/crounds.c \ + $(CSRCDIR)/crounda.c \ + $(CSRCDIR)/drounds.c \ + $(CSRCDIR)/drounda.c \ + $(CSRCDIR)/srounds.c \ + $(CSRCDIR)/srounda.c \ + $(CSRCDIR)/zrounds.c \ + $(CSRCDIR)/zrounda.c + + + + +# $(CSRCDIR)/RealToComplex.c \ +# $(CSRCDIR)/OpIns.c \ +# $(CSRCDIR)/OpExt.c \ +# $(CSRCDIR)/FileManagement.c \ +# $(CSRCDIR)/OpLogLt.c \ +# $(CSRCDIR)/OpLogGt.c \ +# $(CSRCDIR)/OpLogGe.c \ +# $(CSRCDIR)/OpLogLe.c \ +# $(CSRCDIR)/OpLogOr.c \ +# $(CSRCDIR)/OpLogAnd.c \ +# $(CSRCDIR)/ConvertPrecision.c \ + + + + + +# $(CSRCDIR)/clog1ps.c \ +# $(CSRCDIR)/zlog1ps.c \ +# $(CSRCDIR)/clog1pa.c \ +# $(CSRCDIR)/zlog1pa.c + +SWOBJS = $(SWSRCS:.c=.o) + +# --------------- +# --- TARGETS --- +# --------------- +compileexecute: $(SWOBJS) + @echo " " + @echo "============================" + @echo "Generation of the executable" + @echo "============================" + $(CC) $(CFLAGS) $(SWOBJS) *.c -llapack -lblas -o $(EXEFILE) + @echo " " + @echo "==============" + @echo "Executing code" + @echo "==============" + $(EXEFILE) + +clean: + @echo " " + @echo "=============================" + @echo "Removing only exe + obj files" + @echo "=============================" + rm -rf $(EXEFILE) + rm -rf $(SWOBJS) + @echo " " + +cleanexe: + @echo " " + @echo "==========================" + @echo "Removing only the exe file" + @echo "==========================" + rm -rf $(EXEFILE) + @echo " " + +# how to compile object code .o from C source files .c (general rule) +# space between -o and filename for SUN make +.c.o: + $(CC) $(CFLAGS) -c -o $(@) $< + +# Make object code from source +swobjs: $(SWOBJS) + diff --git a/macros/CCodeGeneration/Sci2AnnotationFile.sci b/macros/CCodeGeneration/Sci2AnnotationFile.sci new file mode 100644 index 00000000..001ed250 --- /dev/null +++ b/macros/CCodeGeneration/Sci2AnnotationFile.sci @@ -0,0 +1,55 @@ +function Sci2AnnotationFile(SciFileName,ClsFileName,AnnFileName,AnnSpecifier,ReportFileName) +// function Sci2AnnotationFile(SciFileName,ClsFileName,AnnFileName,AnnSpecifier,ReportFileName) +// -------------------------------------------------------------------------------- +// #RNU_RES_B +// This function reads the .sci input file and generates the correspondig .ann +// and .acls files. +// #RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 25-Jun-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),5,5); + +[tmppath,tmpfunname,tmpext] = fileparts(SciFileName); + +// --------------------------------------- +// --- Open the .sci file (read only). --- +// --------------------------------------- +inscifid = SCI2COpenFileRead(SciFileName); + +// ---------------------------------------------- +// --- Loop over the lines of the input file. --- +// ---------------------------------------------- +line_position = 0; +L_AnnSpecifierP1 = length(AnnSpecifier)+1; +while (meof(inscifid) == 0) + check_string = stripblanks(mgetl(inscifid,1)); + line_position = line_position + 1; + L_string = length(check_string); + if (L_string >= 1) + if (SCI2Cstrncmps1size(AnnSpecifier,check_string)) + tmpannotation = stripblanks(part(check_string,L_AnnSpecifierP1:L_string)); + PrintStringInfo(tmpannotation,ClsFileName,'file','y'); + end + end +end +mclose(inscifid); +// -------------------------------------------------- +// --- End loop over the lines of the input file. --- +// -------------------------------------------------- +PrintStringInfo('CLASS: '+tmpfunname,AnnFileName,'file','y'); +endfunction diff --git a/macros/CCodeGeneration/buildmacros.sce b/macros/CCodeGeneration/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/macros/CCodeGeneration/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/CFiles/sci2ccode/ConvertPrecision.c b/macros/CFiles/sci2ccode/ConvertPrecision.c new file mode 100644 index 00000000..ee3ecc3a --- /dev/null +++ b/macros/CFiles/sci2ccode/ConvertPrecision.c @@ -0,0 +1,41 @@ +/* +** -*- C -*- +** +** ConvertPrecision.c +** Made by Raffaele Nutricato +** +** Copyright Raffaele Nutricato 2008 +*/ + + +double s0doubled0(float in) +{ + double out; + out = (double) in; + return (out); +} + +void s2doubled2(float* in, int* inSize, double* out) +{ + int i; + for (i=0; i +** +** +** Copyright Rubby Nutricato 2007 +*/ + +#include "FileManagement.h" + diff --git a/macros/CFiles/sci2ccode/OpEqual.c b/macros/CFiles/sci2ccode/OpEqual.c new file mode 100644 index 00000000..70f3d504 --- /dev/null +++ b/macros/CFiles/sci2ccode/OpEqual.c @@ -0,0 +1,90 @@ +/* +** -*- C -*- +** +** OpEqual.c +** Made by Raffaele Nutricato +** +** +** Copyright Raffaele Nutricato 2007 +*/ + +#include "OpEqual.h" + +float sOpEquals1(float x) +{ + return (x); +} + +double dOpEquals1(double x) +{ + return x; +} + +floatComplex c0OpEqualc0(floatComplex x) +{ + return x; +} + +doubleComplex z0OpEqualz0(doubleComplex x) +{ + return x; +} + +char g0OpEqualg0(char x) +{ + return x; +} + +void sOpEquala1(float* x, int size, float* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = x[i]; + } +} + +void dOpEquala1(double* x, int size, double* y) +{ + int i = 0; + for (i = 0; i < size; ++i) + { + y[i] = x[i]; + } +} + +void c2OpEqualc2(floatComplex* x, int* xSize, floatComplex* y) +{ + int i = 0; + int size; + size = xSize[0]*xSize[1]; + + for (i = 0; i < size; ++i) + { + y[i] = x[i]; + } +} + +void z2OpEqualz2(doubleComplex* x, int* xSize, doubleComplex* y) +{ + int i = 0; + int size; + size = xSize[0]*xSize[1]; + + for (i = 0; i < size; ++i) + { + y[i] = x[i]; + } +} + +void g2OpEqualg2(char* x, int* xSize, char* y) +{ + int i = 0; + int size; + size = xSize[0]*xSize[1]; + + for (i = 0; i < size; ++i) + { + y[i] = x[i]; + } +} diff --git a/macros/CFiles/sci2ccode/OpExt.c b/macros/CFiles/sci2ccode/OpExt.c new file mode 100644 index 00000000..0b137b14 --- /dev/null +++ b/macros/CFiles/sci2ccode/OpExt.c @@ -0,0 +1,11 @@ +/* +** -*- C -*- +** +** +** Made by Raffaele.Nutricato@tiscali.it +** +** Copyright Raffaele Nutricato +*/ + +#include "OpExt.h" + diff --git a/macros/CFiles/sci2ccode/OpIns.c b/macros/CFiles/sci2ccode/OpIns.c new file mode 100644 index 00000000..df386894 --- /dev/null +++ b/macros/CFiles/sci2ccode/OpIns.c @@ -0,0 +1,11 @@ +/* +** -*- C -*- +** +** +** Made by Raffaele.Nutricato@tiscali.it +** +** Copyright Raffaele Nutricato +*/ + +#include "OpIns.h" + diff --git a/macros/CFiles/sci2ccode/OpLogAnd.c b/macros/CFiles/sci2ccode/OpLogAnd.c new file mode 100644 index 00000000..86deee72 --- /dev/null +++ b/macros/CFiles/sci2ccode/OpLogAnd.c @@ -0,0 +1,38 @@ +/* +** -*- C -*- +** +** OpLogAnd.c +** Made by Raffaele Nutricato +** +** +** Copyright Raffaele Nutricato 2007 +*/ + +#include "OpLogAnd.h" + +void s2s0OpLogAnds2(float* in1, int* in1Size, float in2, float* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (float) (in1[rows*in1Size[1]+cols] && in2); + } + } +} + +void d2d0OpLogAndd2(double* in1, int* in1Size, double in2, double* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (double) (in1[rows*in1Size[1]+cols] && in2); + } + } +} + diff --git a/macros/CFiles/sci2ccode/OpLogGe.c b/macros/CFiles/sci2ccode/OpLogGe.c new file mode 100644 index 00000000..3664f2e1 --- /dev/null +++ b/macros/CFiles/sci2ccode/OpLogGe.c @@ -0,0 +1,37 @@ +/* +** -*- C -*- +** +** OpDotSlash.c +** Made by Raffaele Nutricato +** +** +** Copyright Raffaele Nutricato 2007 +*/ + +#include "OpLogGe.h" + +void s2s0OpLogGes2(float* in1, int* in1Size, float in2, float* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (float) (in1[rows*in1Size[1]+cols] >= in2); + } + } +} + +void d2d0OpLogGed2(double* in1, int* in1Size, double in2, double* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (double) (in1[rows*in1Size[1]+cols] >= in2); + } + } +} diff --git a/macros/CFiles/sci2ccode/OpLogGt.c b/macros/CFiles/sci2ccode/OpLogGt.c new file mode 100644 index 00000000..25e4bd96 --- /dev/null +++ b/macros/CFiles/sci2ccode/OpLogGt.c @@ -0,0 +1,37 @@ +/* +** -*- C -*- +** +** OpDotSlash.c +** Made by Raffaele Nutricato +** +** +** Copyright Raffaele Nutricato 2007 +*/ + +#include "OpLogGt.h" + +void s2s0OpLogGts2(float* in1, int* in1Size, float in2, float* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (float) (in1[rows*in1Size[1]+cols] > in2); + } + } +} + +void d2d0OpLogGtd2(double* in1, int* in1Size, double in2, double* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (double) (in1[rows*in1Size[1]+cols] > in2); + } + } +} diff --git a/macros/CFiles/sci2ccode/OpLogLe.c b/macros/CFiles/sci2ccode/OpLogLe.c new file mode 100644 index 00000000..a1544489 --- /dev/null +++ b/macros/CFiles/sci2ccode/OpLogLe.c @@ -0,0 +1,37 @@ +/* +** -*- C -*- +** +** OpDotSlash.c +** Made by Raffaele Nutricato +** +** +** Copyright Raffaele Nutricato 2007 +*/ + +#include "OpLogLe.h" + +void s2s0OpLogLes2(float* in1, int* in1Size, float in2, float* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (float) (in1[rows*in1Size[1]+cols] <= in2); + } + } +} + +void d2d0OpLogLed2(double* in1, int* in1Size, double in2, double* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (double) (in1[rows*in1Size[1]+cols] <= in2); + } + } +} diff --git a/macros/CFiles/sci2ccode/OpLogLt.c b/macros/CFiles/sci2ccode/OpLogLt.c new file mode 100644 index 00000000..a7e6d774 --- /dev/null +++ b/macros/CFiles/sci2ccode/OpLogLt.c @@ -0,0 +1,37 @@ +/* +** -*- C -*- +** +** OpDotSlash.c +** Made by Raffaele Nutricato +** +** +** Copyright Raffaele Nutricato 2007 +*/ + +#include "OpLogLt.h" + +void s2s0OpLogLts2(float* in1, int* in1Size, float in2, float* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (float) (in1[rows*in1Size[1]+cols] < in2); + } + } +} + +void d2d0OpLogLtd2(double* in1, int* in1Size, double in2, double* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (double) (in1[rows*in1Size[1]+cols] < in2); + } + } +} diff --git a/macros/CFiles/sci2ccode/OpLogOr.c b/macros/CFiles/sci2ccode/OpLogOr.c new file mode 100644 index 00000000..eb553b33 --- /dev/null +++ b/macros/CFiles/sci2ccode/OpLogOr.c @@ -0,0 +1,38 @@ +/* +** -*- C -*- +** +** OpLogOr.c +** Made by Raffaele Nutricato +** +** +** Copyright Raffaele Nutricato 2007 +*/ + +#include "OpLogOr.h" + +void s2s0OpLogOrs2(float* in1, int* in1Size, float in2, float* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (float) (in1[rows*in1Size[1]+cols] || in2); + } + } +} + +void d2d0OpLogOrd2(double* in1, int* in1Size, double in2, double* out) +{ + int rows = 0; + int cols = 0; + for (rows = 0; rows < in1Size[0];rows++) + { + for (cols = 0; cols < in1Size[1];cols++) + { + out[rows*in1Size[1]+cols] = (double) (in1[rows*in1Size[1]+cols] || in2); + } + } +} + diff --git a/macros/CFiles/sci2ccode/RealToComplex.c b/macros/CFiles/sci2ccode/RealToComplex.c new file mode 100644 index 00000000..dd7b5ecf --- /dev/null +++ b/macros/CFiles/sci2ccode/RealToComplex.c @@ -0,0 +1,134 @@ +/* +** -*- C -*- +** +** +** Made by Raffaele.Nutricato@tiscali.it +** +** Copyright Raffaele Nutricato +*/ + +#include "RealToComplex.h" + +floatComplex s0floatcomplexc0(float in) +{ + floatComplex out; + out = FloatComplex(in,0); + return out; +} + +floatComplex d0floatcomplexc0(double in) +{ + floatComplex out; + out = FloatComplex(in,0); + return out; +} + +floatComplex c0floatcomplexc0(floatComplex in) +{ + return in; +} + +floatComplex z0floatcomplexc0(doubleComplex in) +{ + floatComplex out; + out = FloatComplex((float)zreals(in),(float)zimags(in)); + return out; +} + +void s2floatcomplexc2(float* in, int* inSize, floatComplex* out) +{ + int i = 0; + for (i=0;i +** +** +** Copyright Raffaele Nutricato 2007 +*/ + +#include "SCI2Cfft.h" + + diff --git a/macros/CFiles/sci2cincludes/ConvertPrecision.h b/macros/CFiles/sci2cincludes/ConvertPrecision.h new file mode 100644 index 00000000..0546432d --- /dev/null +++ b/macros/CFiles/sci2cincludes/ConvertPrecision.h @@ -0,0 +1,18 @@ +/* +** -*- C -*- +** +** ConvertPrecision.h +** Made by Raffaele Nutricato +** +** Copyright Raffaele Nutricato 2008 +*/ + +#ifndef __ConvertPrecision_H__ +#define __ConvertPrecision_H__ + + +double s0doubled0(float in); +void s2doubled2(float* in, int* inSize, double* out); +float d0floats0(double in); +void d2floats2(double* in, int* inSize, float* out); +#endif /* !__ConvertPrecision_H__ */ diff --git a/macros/CFiles/sci2cincludes/FileManagement.h b/macros/CFiles/sci2cincludes/FileManagement.h new file mode 100644 index 00000000..937a66ef --- /dev/null +++ b/macros/CFiles/sci2cincludes/FileManagement.h @@ -0,0 +1,13 @@ +/* +** -*- C -*- +** +** FileManagement.c +** Made by Raffaele Nutricato +** +** +** Copyright Rubby Nutricato 2007 +** 31-dec-2007 +*/ + +#include +#include diff --git a/macros/CFiles/sci2cincludes/OpEqual.h b/macros/CFiles/sci2cincludes/OpEqual.h new file mode 100644 index 00000000..da36059a --- /dev/null +++ b/macros/CFiles/sci2cincludes/OpEqual.h @@ -0,0 +1,33 @@ +/* +** -*- C -*- +** +** OpEqual.h +** Made by Raffaele Nutricato +** +** +*/ + +#ifndef __OPEQUAL_H__ +#define __OPEQUAL_H__ + +#include +#include "floatComplex.h" +#include "doubleComplex.h" + +/* +** Compute Opequal for different types . +*/ + +float sOpEquals1(float x); +double dOpEquals1(double x); +floatComplex c0OpEqualc0(floatComplex x); +doubleComplex z0OpEqualz0(doubleComplex x); +char g0OpEqualg0(char x); + +void sOpEquala1(float* x, int size, float* y); +void dOpEquala1(double* x, int size, double* y); +void c2OpEqualc2(floatComplex* x, int* xSize, floatComplex* y); +void z2OpEqualz2(doubleComplex* x, int* xSize, doubleComplex* y); +void g2OpEqualg2(char* x, int* xSize, char* y); + +#endif /* !__OPEQUAL_H__ */ diff --git a/macros/CFiles/sci2cincludes/OpExt.h b/macros/CFiles/sci2cincludes/OpExt.h new file mode 100644 index 00000000..7d8a77f7 --- /dev/null +++ b/macros/CFiles/sci2cincludes/OpExt.h @@ -0,0 +1,108 @@ +/* +** -*- C -*- +** +** +** Made by Raffaele.Nutricato@tiscali.it +** +** Copyright Raffaele Nutricato +*/ + +/* + Modify by Arnaud Torset : 20/02/09 +*/ + +#ifndef __OPEXT_H__ +#define __OPEXT_H__ + +#define s2s0OpExts0(in1,size,in2) in1[in2-1]; +#define d2d0OpExtd0(in1,size,in2) in1[in2-1]; +#define c2s0OpExtc0(in1,size,in2) in1[in2-1]; +#define z2d0OpExtz0(in1,size,in2) in1[in2-1]; + + +#define s2s0s0OpExts0(in1,size,row,col) in1[(col-1)*size[0]+row-1]; +#define d2d0d0OpExtd0(in1,size,row,col) in1[(col-1)*size[0]+row-1]; +#define c2s0s0OpExtc0(in1,size,row,col) in1[(col-1)*size[0]+row-1]; +#define z2d0d0OpExtz0(in1,size,row,col) in1[(col-1)*size[0]+row-1]; + + +#define s2s2OpExts2(in1,size1,in2,size2,out) {int i;\ + for (i=0;i= in2) +void s2s0OpLogGes2(float* in1, int* in1Size, float in2, float* out); + +#define d0d0OpLogGed0(in1,in2) \ + (double) (in1 >= in2) +void d2d0OpLogGed2(double* in1, int* in1Size, double in2, double* out); + +/* we must have size1=size2 */ + +#define s2s2OpLogGes2(in1,size1,in2,size2,out) {int i;\ + for (i=0;i +** +** +** Copyright Raffaele Nutricato 2007 +*/ + +#ifndef __CONVOL_H__ +#define __CONVOL_H__ + +#include "SCI2CMacroInterface.h" +#endif /* !__CONVOL_H__ */ diff --git a/macros/CFiles/sci2cincludes/SCI2Cfft.h b/macros/CFiles/sci2cincludes/SCI2Cfft.h new file mode 100644 index 00000000..f82b74b4 --- /dev/null +++ b/macros/CFiles/sci2cincludes/SCI2Cfft.h @@ -0,0 +1,16 @@ +/* +** -*- C -*- +** +** OpDotSlash.c +** Made by Raffaele Nutricato +** +** +** Copyright Raffaele Nutricato 2007 +*/ + +#ifndef __SCI2CFFT_H__ +#define __SCI2CFFT_H__ + +#include "SCI2CMacroInterface.h" + +#endif /* !__SCI2CFFT_H__ */ diff --git a/macros/CFiles/sci2cincludes/notFound.h b/macros/CFiles/sci2cincludes/notFound.h new file mode 100644 index 00000000..59d8c2fe --- /dev/null +++ b/macros/CFiles/sci2cincludes/notFound.h @@ -0,0 +1,18 @@ +/* +** -*- C -*- +** +** notFound.h +** Made by Bruno JOFRET +** +** Started on Thu Feb 8 10:12:17 2007 jofret +** Last update Tue Feb 13 17:16:47 2007 jofret +** +** Copyright INRIA 2007 +*/ + +#ifndef __NOT_FOUND_H__ +#define __NOT_FOUND_H__ + +#define NOT_FOUND -1 + +#endif /* !__NOT_FOUND_H__ */ diff --git a/macros/CFiles/sci2cobj/readme.txt b/macros/CFiles/sci2cobj/readme.txt new file mode 100644 index 00000000..54f467f7 --- /dev/null +++ b/macros/CFiles/sci2cobj/readme.txt @@ -0,0 +1,2 @@ +for the moment the makefile generates the obj files in +the source directory where .c files are stored. \ No newline at end of file diff --git a/macros/ErrorMessages/EM_NanSize.sci b/macros/ErrorMessages/EM_NanSize.sci new file mode 100644 index 00000000..2595a32b --- /dev/null +++ b/macros/ErrorMessages/EM_NanSize.sci @@ -0,0 +1,82 @@ +function EM_NanSize(ReportFileName) +// function EM_NanSize(ReportFileName) +// ----------------------------------------------------------------- +// +// Input data: +// //NUT: Add description here +// +// Output data: +// //NUT: Add description here +// +// Status: +// 13-Feb-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +PrintStringInfo(' ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Cannot initialize a local or global variable with a variable value',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: coming from a function or an operation.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: See code below:',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: a = 10;',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: b = 10;',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: c = a+b;',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: D = zeros(a,b); // Allowed',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: E = zeros(10,b); // Allowed',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: F = zeros(10,5); // Allowed',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: G = zeros(10,c); // Not Allowed because c value is not known at transation time.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: H = 10:c:9;// Not Allowed because c value is not known at transation time.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: The same problem arises in for loops.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: SCI2C forbids use of step values in ""for"" loops which come from ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: a function or an operation.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Always specify its value.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Example: ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Scilab Code:',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: unkstep = 2*cos(0); // It means that unkstep is not known at translation time.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for cnt=10:unkstep:1',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: end',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: The code above is not allowed. You can change it as shown below:',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: unkstep = 2; // This time the value of unkstep is known at translation time.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for cnt=10:unkstep:1',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: end',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: The reason for this limitation is related to the impossibility to generate optimized C code.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: when the step is unknown.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Look at the following example for more details,',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Scilab Code:;',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for cnt=10:unkstep:1',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: end',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: If unkstep variable value is unkwnown it is not possible to generate',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: optimized C code.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Infact, if unkstep is >= 0, the correct C code is:',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for (cnt=10;cnt<=1;cnt+=unkstep)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt);',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: If unkstep is < 0 the correct C code is:',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for (cnt=10; cnt>=1; cnt+=unkstep)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt);',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Note how the condition cnt<=1 changes to cnt>=1.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: In order to take into account of this possibility ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: SCI2C translator should generate both codes and then ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: insert them into an if/else block as shown here: ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: if (unkstep >= 0)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: {',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for (cnt=10;cnt<=1;cnt+=unkstep)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt);',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: }',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: else{',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: {',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for (cnt=10;cnt<=1;cnt+=unkstep)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt);',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: }',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Of course it is not optimized C code.',ReportFileName,'both','y'); +PrintStringInfo(' ',ReportFileName,'both','y'); +SCI2Cerror(' '); +endfunction diff --git a/macros/ErrorMessages/EM_UnknownStep.sci b/macros/ErrorMessages/EM_UnknownStep.sci new file mode 100644 index 00000000..9f8d39e7 --- /dev/null +++ b/macros/ErrorMessages/EM_UnknownStep.sci @@ -0,0 +1,70 @@ +function EM_UnknownStep(ReportFileName) +// function EM_UnknownStep(ReportFileName) +// ----------------------------------------------------------------- +// +// Input data: +// //NUT: Add description here +// +// Output data: +// //NUT: Add description here +// +// Status: +// 13-Feb-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +PrintStringInfo(' ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: SCI2C forbids use of step values in ""for"" loops which come from ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: a function or an operation.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Always specify its value.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Example: ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Scilab Code:',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: unkstep = 2*cos(0); // It means that unkstep is not known at translation time.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for cnt=10:unkstep:1',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: end',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: The code above is not allowed. You can change it as shown below:',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: unkstep = 2; // This time the value of unkstep is known at translation time.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for cnt=10:unkstep:1',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: end',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: The reason for this limitation is related to the impossibility to generate optimized C code.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: when the step is unknown.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Look at the following example for more details,',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Scilab Code:;',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for cnt=10:unkstep:1',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: end',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: If unkstep variable value is unkwnown it is not possible to generate',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: optimized C code.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Infact, if unkstep is >= 0, the correct C code is:',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for (cnt=10;cnt<=1;cnt+=unkstep)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt);',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: If unkstep is < 0 the correct C code is:',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for (cnt=10; cnt>=1; cnt+=unkstep)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt);',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Note how the condition cnt<=1 changes to cnt>=1.',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: In order to take into account of this possibility ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: SCI2C translator should generate both codes and then ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: insert them into an if/else block as shown here: ',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: if (unkstep >= 0)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: {',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for (cnt=10;cnt<=1;cnt+=unkstep)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt);',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: }',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: else{',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: {',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: for (cnt=10;cnt<=1;cnt+=unkstep)',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: disp(cnt);',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: }',ReportFileName,'both','y'); +PrintStringInfo('SCI2CERROR: Of course it is not optimized C code.',ReportFileName,'both','y'); +PrintStringInfo(' ',ReportFileName,'both','y'); +SCI2Cerror(' '); +endfunction diff --git a/macros/ErrorMessages/EM_ZeroSize.sci b/macros/ErrorMessages/EM_ZeroSize.sci new file mode 100644 index 00000000..fede8f0d --- /dev/null +++ b/macros/ErrorMessages/EM_ZeroSize.sci @@ -0,0 +1,27 @@ +function EM_ZeroSize(ReportFileName) +// function EM_ZeroSize(ReportFileName) +// ----------------------------------------------------------------- +// +// Input data: +// //NUT: Add description here +// +// Output data: +// //NUT: Add description here +// +// Status: +// 13-Feb-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +PrintStringInfo('SCI2CERROR: Cannot handle zero-size arrays.',ReportFileName,'both','y'); +PrintStringInfo(' ',ReportFileName,'both','y'); +SCI2Cerror(' '); + +endfunction diff --git a/macros/ErrorMessages/buildmacros.sce b/macros/ErrorMessages/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/macros/ErrorMessages/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/FunctionAnnotation/FA_ADD.sci b/macros/FunctionAnnotation/FA_ADD.sci new file mode 100644 index 00000000..4193422b --- /dev/null +++ b/macros/FunctionAnnotation/FA_ADD.sci @@ -0,0 +1,43 @@ +function opout = FA_ADD(in1,in2) +// function opout = FA_ADD(in1,in2) +// ----------------------------------------------------------------- +// Addition function for Function Annotations. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying a number or a symbol. +// +// Output data: +// opout: string containing the computed result. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (isnum(in1) & isnum(in2)) + in1num = eval(in1); + in2num = eval(in2); + outnum = in1num+in2num; + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end +else + opout = string('('+in1+'+'+in2+')'); +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_DIV.sci b/macros/FunctionAnnotation/FA_DIV.sci new file mode 100644 index 00000000..d4ec0ccd --- /dev/null +++ b/macros/FunctionAnnotation/FA_DIV.sci @@ -0,0 +1,41 @@ +function opout = FA_DIV(in1,in2) +// function opout = FA_DIV(in1,in2) +// ----------------------------------------------------------------- +// Division function for Function Annotations. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying a number or a symbol. +// +// Output data: +// opout: string containing the computed result. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (isnum(in1) & isnum(in2)) + in1num = eval(in1); + in2num = eval(in2); + outnum = in1num/in2num; + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end +else + opout = '('+string(in1)+'/'+string(in2)+')'; +end +endfunction diff --git a/macros/FunctionAnnotation/FA_GetDefaultPrecision.sci b/macros/FunctionAnnotation/FA_GetDefaultPrecision.sci new file mode 100644 index 00000000..3afe2648 --- /dev/null +++ b/macros/FunctionAnnotation/FA_GetDefaultPrecision.sci @@ -0,0 +1,86 @@ +function defaultprecision = FA_GetDefaultPrecision(scifilename,ReportFileName) +// function defaultprecision = FA_GetDefaultPrecision(scifilename,ReportFileName) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Extracts the default precision for the file .sci passed in input. +// The following annotation will be searched in the scilab code: +// //SCI2C: DEFAULT_PRECISION= FLOAT +// //SCI2C: DEFAULT_PRECISION= DOUBLE +// If the annotation is missing the default DOUBLE precision will be +// implicitly used. +// #RNU_RES_E +// +// Input data: +// --- +// +// Output data: +// defaultprecision: string which specifies the default precision to be +// used in the translation of scifilename. +// +// Status: +// 12-Feb-2008 -- Raffaele Nutricato: Author. +// 12-Feb-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +defaultprecision = 'd'; +annotationstring = '//SCI2C: DEFAULT_PRECISION=' +// #RNU_RES_B +PrintStringInfo('***Get default precision from: '+scifilename,ReportFileName,'file','y'); +// #RNU_RES_E +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// --- Open the .sci file (read only). --- +scifid = SCI2COpenFileRead(scifilename); + +// #RNU_RES_B +// --- Loop over the lines of the input file. --- +// Position file pointer to the desired NInArg/NOutArg section, +// and read the NOutArg annotation. +// #RNU_RES_E +foundannotation = 0; +line_position = 0; +while ((meof(scifid) == 0) & (foundannotation == 0)) + check_string = stripblanks(mgetl(scifid,1)); + line_position = line_position + 1; + if (~isempty(check_string)) + + if (SCI2Cstrncmps1size(annotationstring,check_string)) + tmpprecision = stripblanks(part(check_string,length(annotationstring)+1:length(check_string))); + // #RNU_RES_B + PrintStringInfo(' Line '+string(line_position)+... + ' - Found annotation for default precision'+' ""'+check_string+' ""',... + ReportFileName,'file','y'); + // #RNU_RES_E + foundannotation = 1; + end + end +end + +if (foundannotation == 0) + // #RNU_RES_B + PrintStringInfo('Annotation for default precision not found.',ReportFileName,'file','y'); + PrintStringInfo('Using the ""DOUBLE"" default precision.',ReportFileName,'file','y'); + // #RNU_RES_E +else + if (tmpprecision == 'FLOAT') + defaultprecision = 's'; + elseif (tmpprecision == 'DOUBLE') + defaultprecision = 'd'; + end +end + +mclose(scifid); +endfunction diff --git a/macros/FunctionAnnotation/FA_GetFunAnn.sci b/macros/FunctionAnnotation/FA_GetFunAnn.sci new file mode 100644 index 00000000..b3d842ab --- /dev/null +++ b/macros/FunctionAnnotation/FA_GetFunAnn.sci @@ -0,0 +1,206 @@ +function [FunTypeAnnot,FunSizeAnnot] = ... + FA_GetFunAnn(NInArg,NOutArg,FunName,FileInfo,SharedInfo) +// function [FunTypeAnnot,FunSizeAnnot] = ... +// FA_GetFunAnn(NInArg,NOutArg,FunName,FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// #RNU_RES_B +// This function extracts the TYPE and SIZE annotations from the +// input .ann file. +// No blank lines are allowed between function annotations. +// +// #RNU_RES_E +// Input data: +// //NUT: Add description here +// +// Output data: +// //NUT: Add description here +// +// Status: +// 11-Jul-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +//NUT: consider the possibility to split this function into more functions. + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),5,5); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Reading function annotations***',ReportFileName,'file','y'); +// #RNU_RES_E +SCI2CClassFileName = GetClsFileName(FunName,FileInfo,SharedInfo); +FunTypeAnnot = ''; +FunSizeAnnot = ''; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + + +// --------------------------------------------- +// --- Read the annotations of the function. --- +// --------------------------------------------- +// --- Open the .sci file (read only). --- +inclsfid = SCI2COpenFileRead(SCI2CClassFileName); + +// #RNU_RES_B +// --- Loop over the lines of the input file. --- +// Position file pointer to the desired NInArg/NOutArg section, +// and read the NOutArg annotation. +// #RNU_RES_E +FoundNIn = 0; +FoundNOut = 0; +line_position = 0; +while ((meof(inclsfid) == 0) & (FoundNIn == 0) & (FoundNOut == 0)) + check_string = stripblanks(mgetl(inclsfid,1)); + line_position = line_position + 1; + if (~isempty(check_string)) + + // #RNU_RES_B + // --- Search for the NIN annotation. --- + // #RNU_RES_E + if (SCI2Cstrncmps1size(SharedInfo.Annotations.FUNNIN,check_string)) + FUNNINAnnot = part(check_string,length(SharedInfo.Annotations.FUNNIN)+1:length(check_string)); + // #RNU_RES_B + // --- Check NIN value. --- + // #RNU_RES_E + if (eval(FUNNINAnnot) == NInArg) + // #RNU_RES_B + PrintStringInfo(' Line '+string(line_position)+' - Function NInArg Annotation: '+' ""'+check_string+' ""',... + ReportFileName,'file','y'); + // #RNU_RES_E + FoundNIn = 1; + check_string = stripblanks(mgetl(inclsfid,1)); + line_position = line_position + 1; + if (~isempty(check_string)) + + // #RNU_RES_B + // --- Search for the NOUT annotation. --- + // #RNU_RES_E + if (SCI2Cstrncmps1size(SharedInfo.Annotations.FUNNOUT,check_string)) + FUNNOUTAnnot = part(check_string,length(SharedInfo.Annotations.FUNNOUT)+1:length(check_string)); + + // #RNU_RES_B + // --- Check NOUT value. --- + // #RNU_RES_E + if (eval(FUNNOUTAnnot) == NOutArg) + // #RNU_RES_B + PrintStringInfo(' Line '+string(line_position)+' - Function NOutArg Annotation: '+' ""'+check_string+' ""',... + ReportFileName,'file','y'); + // #RNU_RES_E + FoundNOut = 1; + else + FoundNIn = 0; + end + else + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Incorrect format for function annotation.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Expected '+SharedInfo.Annotations.FUNNIN+' field in the annotations of the function.',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); + end + else + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Incorrect format for function annotation.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Expected '+SharedInfo.Annotations.FUNNIN+' field in the annotations of the function.',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); + end + end + end + end +end + +if (FoundNOut*FoundNIn == 0) + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Please check file: '+SCI2CClassFileName,ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Incorrect function annotation.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: There are two possibilities:',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: 1. Syntax error in function annotations.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: 2. Missing the right combination of NIN/NOUT annotations: ""'+SharedInfo.Annotations.FUNNIN+string(NInArg)+','+SharedInfo.Annotations.FUNNOUT+' '+string(NOutArg)+'"".',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); +else + for cntout = 1:NOutArg + SCI2C_nout=cntout; // Useful for eval. + + // #RNU_RES_B + // Read the Fun type annotation. + // #RNU_RES_E + check_string = stripblanks(mgetl(inclsfid,1)); + line_position = line_position + 1; + if (isempty(check_string) == %F) + tmpannstring = eval(SharedInfo.Annotations.FUNTYPE); + if (SCI2Cstrncmps1size(tmpannstring,check_string)) + // #RNU_RES_B + PrintStringInfo(' Line '+string(line_position)+' - Function Type Annotation: '+' ""'+check_string+' ""',... + ReportFileName,'file','y'); + // #RNU_RES_E + FunTypeAnnot(cntout) = ... + stripblanks(part(check_string,length(tmpannstring)+1:length(check_string))); + end + else + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Line '+string(line_position)+' Function type annotation not found in file: '+SCI2CClassFileName,ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); + end + + // #RNU_RES_B + // --- Read the Fun size annotation. --- + // #RNU_RES_E + SCI2C_nelem = 1; // Useful for eval. + line_position = line_position + 1; + if (isempty(check_string) == %F) + tmpannstring = eval(SharedInfo.Annotations.FUNSIZE); + check_string = stripblanks(mgetl(inclsfid,1)); + if (SCI2Cstrncmps1size(tmpannstring,check_string)) + // #RNU_RES_B + PrintStringInfo(' Line '+string(line_position)+' - Function Size Annotation: '+' ""'+check_string+' ""',... + ReportFileName,'file','y'); + // #RNU_RES_E + FunSizeAnnot(cntout,1) = ... + stripblanks(part(check_string,length(tmpannstring)+1:length(check_string))); + end + else + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Line '+string(line_position)+' Function size annotation not found in file: '+SCI2CClassFileName,ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); + end + SCI2C_nelem = 2; // Useful for eval. + line_position = line_position + 1; + if (isempty(check_string) == %F) + tmpannstring = eval(SharedInfo.Annotations.FUNSIZE); + check_string = stripblanks(mgetl(inclsfid,1)); + if (SCI2Cstrncmps1size(tmpannstring,check_string)) + PrintStringInfo(' Line '+string(line_position)+' - Function Size Annotation: '+' ""'+check_string+' ""',... + ReportFileName,'file','y'); + FunSizeAnnot(cntout,2) = ... + stripblanks(part(check_string,length(tmpannstring)+1:length(check_string))); + end + else + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Line '+string(line_position)+' Function type annotation (//_SCI2C_FUNSIZE:) not found in file: '+SCI2CClassFileName,ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); + end + end +end +// --- End loop over the lines of the input file. --- +mclose(inclsfid); +// ------------------------------------------------- +// --- End Read the annotations of the function. --- +// ------------------------------------------------- + +endfunction diff --git a/macros/FunctionAnnotation/FA_GetOutArgInfo.sci b/macros/FunctionAnnotation/FA_GetOutArgInfo.sci new file mode 100644 index 00000000..0cdba234 --- /dev/null +++ b/macros/FunctionAnnotation/FA_GetOutArgInfo.sci @@ -0,0 +1,142 @@ +function UpdatedOutArg = ... + FA_GetOutArgInfo(InArg,NInArg,OutArg,NOutArg,SharedInfo,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,ReportFileName) +// function UpdatedOutArg = ... +// FA_GetOutArgInfo(InArg,NInArg,OutArg,NOutArg,SharedInfo,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,ReportFileName) +// ----------------------------------------------------------------- +// #RNU_RES_B +// InArg is used by eval don't remove it from the function call. +// +// #RNU_RES_E +// Input data: +// //NUT: Add description here +// +// Output data: +// //NUT: Add description here +// +// Status: +// 25-Oct-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),9,9); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +UpdatedOutArg = OutArg; +for cntin = 1:NInArg + IN(cntin).TP = InArg(cntin).Type; + IN(cntin).SZ(1) = InArg(cntin).Size(1); + IN(cntin).SZ(2) = InArg(cntin).Size(2); + if ((isnan(InArg(cntin).Value)) & (GetSymbolDimension(InArg(cntin).Size) == 0)) + // #RNU_RES_B + // IN(cntin).VAL = '__SCI2CNANSIZE'; //RNU: toglimi + //RNU: Replace the value of the variable with its name, in case it is a scalar variable. + // #RNU_RES_E + IN(cntin).VAL = InArg(cntin).Name; + else + IN(cntin).VAL = string(InArg(cntin).Value); + end +end +DefaultPrecision = SharedInfo.DefaultPrecision; + +// --------------------------- +// --- End Initialization. --- +// --------------------------- +if (mtlb_strcmp(FunTypeAnnot(1),'')) + NOutArg = 0; +else + NOutArg = max(size(FunTypeAnnot)); +end + +flagfindlike = 0; +for counterin = 1:NInArg + if (InArg(counterin).FindLike == 1 | InArg(counterin).FindLike == -1) + // #RNU_RES_B + // Then we must assume that the output will be findlike + // 0 = no find-like + // 1 = pure find-like + //-1 = similar to find-like (out=fun(in)) where in is find-like. + // #RNU_RES_E + flagfindlike = -1; + end +end + +for counterout = 1:NOutArg + if(mtlb_strcmp(FunTypeAnnot,'FA_TP_USER')) + UpdatedOutArg(counterout).Type = FA_TP_USER(FunPrecSpecifier,DefaultPrecision); + else + UpdatedOutArg(counterout).Type = eval(FunTypeAnnot(counterout)); + end + UpdatedOutArg(counterout).FindLike = 0; + lengthFA_SZ_RTMAX = length('FA_SZ_RTMAX'); + + if (SCI2Cstrncmps1size('FA_SZ_RTMAX',FunSizeAnnot(counterout,1))) + UpdatedOutArg(counterout).FindLike = 1; + FunSizeAnnot(counterout,1) = part(FunSizeAnnot(counterout,1),lengthFA_SZ_RTMAX+1:length(FunSizeAnnot(counterout,1))); + end + + if (SCI2Cstrncmps1size('FA_SZ_RTMAX',FunSizeAnnot(counterout,2))) + UpdatedOutArg(counterout).FindLike = 1; + FunSizeAnnot(counterout,2) = part(FunSizeAnnot(counterout,2),lengthFA_SZ_RTMAX+1:length(FunSizeAnnot(counterout,2))); + end + + if (flagfindlike == -1) + UpdatedOutArg(counterout).FindLike = -1; + end + + // #RNU_RES_B + // When the size is given by e IN(x).VAL annotation we can have two cases: + // IN(x).VAL is a number or IN(x).VAL is %nan. When it is %nan the + // size is equal to the name of IN(x). + // This is a dynamic memory extension of a local variable and for the moment + // we issue an error according to SCI2C specifications + // #RNU_RES_E + tmpeval = eval(FunSizeAnnot(counterout,1)); + if (IsNanSize(tmpeval)) + if SharedInfo.ForExpr.OnExec == 0 + EM_NanSize(ReportFileName); + else + UpdatedOutArg(counterout).Size(1) = string(tmpeval); + end + elseif(isnum(tmpeval)) + if (eval(tmpeval) <= 0) + EM_ZeroSize(ReportFileName); + else + UpdatedOutArg(counterout).Size(1) = string(tmpeval); + end + else + UpdatedOutArg(counterout).Size(1) = string(tmpeval); + end + + tmpeval = eval(FunSizeAnnot(counterout,2)); + if (IsNanSize(tmpeval)) + if SharedInfo.ForExpr.OnExec == 0 + EM_NanSize(ReportFileName); + else + // #RNU_RES_B + // If we are in for expression I prefer to issue the error later. + // #RNU_RES_E + UpdatedOutArg(counterout).Size(2) = string(tmpeval); + end + elseif(isnum(tmpeval)) + if (eval(tmpeval) <= 0) + EM_ZeroSize(ReportFileName); + else + UpdatedOutArg(counterout).Size(2) = string(tmpeval); + end + else + UpdatedOutArg(counterout).Size(2) = string(tmpeval); + end + + UpdatedOutArg(counterout).Value = %nan; + UpdatedOutArg(counterout).Dimension = GetSymbolDimension(UpdatedOutArg(counterout).Size); + UpdatedOutArg(counterout).Scope = 'Temp';//NUT anche su questo si puo' ragionare verifica anche la handleoperation. +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_GetResizeApproach.sci b/macros/FunctionAnnotation/FA_GetResizeApproach.sci new file mode 100644 index 00000000..95427001 --- /dev/null +++ b/macros/FunctionAnnotation/FA_GetResizeApproach.sci @@ -0,0 +1,79 @@ +function ResizeApproach = FA_GetResizeApproach(scifilename,ReportFileName) + +// function ResizeApproach = FA_GetResizeApproach(scifilename,ReportFileName) +// ----------------------------------------------------------------- +// Extracts the resize approach from the file .sci passed in input. +// The following annotation will be searched in the scilab code: +// //SCI2C: RESIZE_APPROACH= NO_RESIZE +// //SCI2C: RESIZE_APPROACH= RESIZE_ALL +// //SCI2C: RESIZE_APPROACH= REALLOC_ALL_RESIZE_ALL +// //SCI2C: RESIZE_APPROACH= RESIZE_TEMP +// //SCI2C: RESIZE_APPROACH= RESIZE_LOCAL +// //SCI2C: RESIZE_APPROACH= RESIZE_GLOBAL +// If the annotation is missing the default NO_RESIZE approach will be +// implicitly used. +// +// Input data: +// --- +// +// Output data: +// ResizeApproach: string which specifies the resize approach +// used in the translation of scifilename. +// +// Status: +// 12-Jul-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +ResizeApproach = 'NO_RESIZE'; +annotationstring = '//SCI2C: RESIZE_APPROACH=' +PrintStringInfo('***Get resize approach from: '+scifilename,ReportFileName,'file','y'); // #RNUREM_ME +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// --- Open the .sci file (read only). --- +scifid = SCI2COpenFileRead(scifilename); + +// --- Loop over the lines of the input file. --- +// Position file pointer to the desired NInArg/NOutArg section, +// and read the NOutArg annotation. +foundannotation = 0; +line_position = 0; + +while ((meof(scifid) == 0) & (foundannotation == 0)) + check_string = stripblanks(mgetl(scifid,1)); + line_position = line_position + 1; + if (~isempty(check_string)) + if (SCI2Cstrncmps1size(annotationstring,check_string)) + tmpresize = stripblanks(part(check_string,length(annotationstring)+1:length(check_string))); + // #RNU_RES_B + PrintStringInfo(' Line '+string(line_position)+... + ' - Found annotation for resize approach'+' ""'+check_string+' ""',... + ReportFileName,'file','y'); + // #RNU_RES_E + foundannotation = 1; + end + end +end + +if (foundannotation == 0) + // #RNU_RES_B + PrintStringInfo('Annotation for resize approach not found.',ReportFileName,'file','y'); + PrintStringInfo('Using the ''NO_RESIZE'' resize approach.',ReportFileName,'file','y'); + // #RNU_RES_E +else + ResizeApproach = tmpresize; +end +mclose(scifid); +endfunction diff --git a/macros/FunctionAnnotation/FA_INT.sci b/macros/FunctionAnnotation/FA_INT.sci new file mode 100644 index 00000000..e1bdba33 --- /dev/null +++ b/macros/FunctionAnnotation/FA_INT.sci @@ -0,0 +1,40 @@ +function opout = FA_INT(in1) +// function opout = FA_INT(in1) +// ----------------------------------------------------------------- +// Int function for Function Annotations. +// When in1 is a number opout = int(in1); where int truncates in1 +// to integer. If in1 is string opout = in1. +// +// Input data: +// in1: string specifying a number or a symbol. +// +// Output data: +// opout: string containing the computed result. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (isnum(in1)) + outnum = int(eval(in1)); + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end +else + opout = in1; +end +endfunction diff --git a/macros/FunctionAnnotation/FA_MAX.sci b/macros/FunctionAnnotation/FA_MAX.sci new file mode 100644 index 00000000..c725dd23 --- /dev/null +++ b/macros/FunctionAnnotation/FA_MAX.sci @@ -0,0 +1,52 @@ +function opout = FA_MAX(in1,in2) +// function opout = FA_MAX(in1,in2) +// ----------------------------------------------------------------- +// Maximum function for Function Annotations. +// When in1 and in2 are both symbols this function returns +// in1. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying a number or a symbol. +// +// Output data: +// opout: string containing the computed result. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +//SCI2Cerror('Not allowed to use FA_MAX in this release.'); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (isnum(in1)) + in1num = eval(in1); + if (isnum(in2)) + in2num = eval(in2); + outnum = max(in1num,in2num); + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end + else + if (in1num == 1) + opout = string(in2); + end + end +else + opout = string(in1); +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_MIN.sci b/macros/FunctionAnnotation/FA_MIN.sci new file mode 100644 index 00000000..e1539103 --- /dev/null +++ b/macros/FunctionAnnotation/FA_MIN.sci @@ -0,0 +1,45 @@ +function opout = FA_MIN(in1,in2) +// function opout = FA_MIN(in1,in2) +// ----------------------------------------------------------------- +// Minimum function for Function Annotations. +// When in1 and in2 are both symbols this function returns +// in1. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying a number or a symbol. +// +// Output data: +// opout: string containing the computed result. + +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (isnum(in1)) + in1num = eval(in1); + if (isnum(in2)) + in2num = eval(in2); + outnum = min(in1num,in2num); + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end + else + if (in1num == 1) + opout = string(in2); + end + end +else + opout = string(in1); +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_MUL.sci b/macros/FunctionAnnotation/FA_MUL.sci new file mode 100644 index 00000000..8c9a930a --- /dev/null +++ b/macros/FunctionAnnotation/FA_MUL.sci @@ -0,0 +1,42 @@ +function opout = FA_MUL(in1,in2) +// function opout = FA_MUL(in1,in2) +// ----------------------------------------------------------------- +// Multiplication function for Function Annotations. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying a number or a symbol. +// +// Output data: +// opout: string containing the computed result. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (isnum(in1) & isnum(in2)) + in1num = eval(in1); + in2num = eval(in2); + outnum = in1num*in2num; + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end +else + opout = '('+string(in1)+'*'+string(in2)+')'; +end +endfunction diff --git a/macros/FunctionAnnotation/FA_REAL.sci b/macros/FunctionAnnotation/FA_REAL.sci new file mode 100644 index 00000000..7b8c0fda --- /dev/null +++ b/macros/FunctionAnnotation/FA_REAL.sci @@ -0,0 +1,50 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// +function opout = FA_REAL(in1, in2) +// function opout = FA_REAL(in1, in2) +// ----------------------------------------------------------------- +// Real function for Function Annotations. +// When in1 is a number opout = real(in1); where real returns in1 +// real part. If in1 is string opout = in1. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying in1 type +// +// Output data: +// opout: string containing the computed result. +// +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (isnum(in1)) + outnum = real(eval(in1)); + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end +else + if (in1 == "%i") + opout = " 0 "; + else + opout = in2+"0real"+FA_TP_REAL(in2)+"0"+"("+in1+")"; + end +end +endfunction diff --git a/macros/FunctionAnnotation/FA_SUB.sci b/macros/FunctionAnnotation/FA_SUB.sci new file mode 100644 index 00000000..1ef0ad46 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SUB.sci @@ -0,0 +1,41 @@ +function opout = FA_SUB(in1,in2) +// function opout = FA_SUB(in1,in2) +// ----------------------------------------------------------------- +// Subtraction function for Function Annotations. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying a number or a symbol. +// +// Output data: +// opout: string containing the computed result. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (isnum(in1) & isnum(in2)) + in1num = eval(in1); + in2num = eval(in2); + outnum = in1num-in2num; + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end +else + opout = '('+string(in1)+'-'+string(in2)+')'; +end +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_1.sci b/macros/FunctionAnnotation/FA_SZ_1.sci new file mode 100644 index 00000000..d9a481ce --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_1.sci @@ -0,0 +1,20 @@ +function outsize = FA_SZ_1(insize) +// function outsize = FA_SZ_1(insize) +// ----------------------------------------------------------------- +// Returns the first element of the size array. +// +// Input data: +// insize: size of input argument. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Output data: +// outsize: first element of the insize array. +// +// Status: +// 08-Dec-2007 -- Raffaele Nutricato: Author. +// 08-Dec-2007 -- Alberto Morea: Test Ok. +// ----------------------------------------------------------------- + +outsize = insize(1); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_2.sci b/macros/FunctionAnnotation/FA_SZ_2.sci new file mode 100644 index 00000000..64fdac10 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_2.sci @@ -0,0 +1,20 @@ +function outsize = FA_SZ_2(insize) +// function outsize = FA_SZ_2(insize) +// ----------------------------------------------------------------- +// Returns the second element of the size array. +// +// Input data: +// insize: size of input argument. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Output data: +// outsize: second element of the insize array. +// +// Status: +// 08-Dec-2007 -- Raffaele Nutricato: Author. +// 08-Dec-2007 -- Alberto Morea: Test Ok. +// ----------------------------------------------------------------- + +outsize = insize(2); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci b/macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci new file mode 100644 index 00000000..c3cae536 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci @@ -0,0 +1,36 @@ +function opout = FA_SZ_FROM_VAL(in1,in2) +// function opout = FA_SZ_FROM_VAL(in1,in2) +// ----------------------------------------------------------------- +// Return a size according to the floored value of the first argument +// +// Input data: +// in1: string specifying a number . +// +// Output data: +// opout: string containing the computed result. +// +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); + + +if (isnum(in1)) + in1num = eval(in1) ; + if isnan(in1num) + opout = '__SCI2CNANSIZE'; + elseif ( in1num < 0 ) + opout= '0' ; + else + opout = string ( floor (abs(in1num))) ; + + end + + +else + opout = in2+"0floor"+in2+"0"+"("+in1+")"; + opout = in2+"0abs"+in2+"0"+"("+opout+")"; + +end + + +endfunction: diff --git a/macros/FunctionAnnotation/FA_SZ_OPAPEX.sci b/macros/FunctionAnnotation/FA_SZ_OPAPEX.sci new file mode 100644 index 00000000..a93e8c50 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPAPEX.sci @@ -0,0 +1,26 @@ +function opoutsize = FA_SZ_OPAPEX(in1size) +// function opoutsize = FA_SZ_OPAPEX(in1size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPAPEX operator. +// +// +// Status: +// 08-Jan-2008 -- Raffaele Nutricato: Author. +// 08-Jan-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +opoutsize(1) = string(in1size(2)); +opoutsize(2) = string(in1size(1)); + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPBACKSLASH.sci b/macros/FunctionAnnotation/FA_SZ_OPBACKSLASH.sci new file mode 100644 index 00000000..9d0625bd --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPBACKSLASH.sci @@ -0,0 +1,39 @@ +function opoutsize = FA_SZ_OPBACKSLASH(in1size,in2size) +// function opoutsize = FA_SZ_OPBACKSLASH(in1size,in2size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPBACKSLASH operator. +// +// +// Status: +// 08-Mar-2008 -- Alberto Morea: Author. +// 08-Mar-2008 -- Raffaele Nutricato: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +in1size=string(in1size); +in2size=string(in2size); + +// --- Get dimensions of input arguments. --- +in1dim = GetSymbolDimension(in1size); +in2dim = GetSymbolDimension(in2size); + +if (in1dim == 0) + opoutsize = in2size; +elseif (in2dim == 0) + opoutsize = in1size; +else + opoutsize(1) = in1size(2); + opoutsize(2) = in2size(2); +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPCC.sci b/macros/FunctionAnnotation/FA_SZ_OPCC.sci new file mode 100644 index 00000000..50527771 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPCC.sci @@ -0,0 +1,40 @@ +function opoutsize = FA_SZ_OPCC(in1size,in2size) +// function opoutsize = FA_SZ_OPCC(in1size,in2size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPCC operator. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +in1size = string(in1size); +in2size = string(in2size); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +// --- Get dimensions of input arguments. --- +in1dim = GetSymbolDimension(in1size); +in2dim = GetSymbolDimension(in2size); + +if (isnum(in1size(1)) & isnum(in2size(1))) + in1num = eval(in1size(1)); + in2num = eval(in2size(1)); + opoutsize(1) = string(in1num+in2num); +else + opoutsize(1) = '('+string(in1size(1))+'+'+string(in2size(1))+')'; +end + +opoutsize(2) = in1size(2); + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPDOTAPEX.sci b/macros/FunctionAnnotation/FA_SZ_OPDOTAPEX.sci new file mode 100644 index 00000000..64e8030e --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPDOTAPEX.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPDOTAPEX(in1size) +// function opoutsize = FA_SZ_OPDOTAPEX(in1size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTAPEX. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTAPEX(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPDOTBACKSLASH.sci b/macros/FunctionAnnotation/FA_SZ_OPDOTBACKSLASH.sci new file mode 100644 index 00000000..75f4d5c3 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPDOTBACKSLASH.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPDOTBACKSLASH(in1size,in2size) +// function opoutsize = FA_SZ_OPDOTBACKSLASH(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPDOTHAT.sci b/macros/FunctionAnnotation/FA_SZ_OPDOTHAT.sci new file mode 100644 index 00000000..af522bac --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPDOTHAT.sci @@ -0,0 +1,43 @@ +function opoutsize = FA_SZ_OPDOTHAT(in1size,in2size) +// function opoutsize = FA_SZ_OPDOTHAT(in1size,in2size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPDOTHAT operator. +// +// Assuming: +// size(in1) = [in1r,in1c] +// size(in2) = [in2r,in2c] +// size(out) = [outr,outc] +// +// we have the following combinations: +// in1 in2 outr outc +// ----------------------- +// S S in2r in2c +// S M in2r in2c +// M S in1r in1c +// M M in1r in1c +// +// Where S means that the input is a scalar +// and M means that the input is a matrix. +// +// Input data: +// in1size: size of input number 1. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// in2size: size of input number 2. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Output data: +// opoutsize: size of output. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Status: +// 10-Dec-2007 -- Raffaele Nutricato: Author. +// 10-Dec-2007 -- Alberto Morea: Test Ok. +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPDOTSLASH.sci b/macros/FunctionAnnotation/FA_SZ_OPDOTSLASH.sci new file mode 100644 index 00000000..2a071f27 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPDOTSLASH.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPDOTSLASH(in1size,in2size) +// function opoutsize = FA_SZ_OPDOTSLASH(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPDOTSTAR.sci b/macros/FunctionAnnotation/FA_SZ_OPDOTSTAR.sci new file mode 100644 index 00000000..3fbae19a --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPDOTSTAR.sci @@ -0,0 +1,32 @@ +function opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size) +// function opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPDOTSTAR operator. +// +// +// Status: +// 08-Jan-2008 -- Raffaele Nutricato: Author. +// 08-Jan-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +// --- Get dimensions of input arguments. --- +in1dim = GetSymbolDimension(in1size); + +if (in1dim == 0) + opoutsize = string(in2size); +else + opoutsize = string(in1size); +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPHAT.sci b/macros/FunctionAnnotation/FA_SZ_OPHAT.sci new file mode 100644 index 00000000..31174511 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPHAT.sci @@ -0,0 +1,43 @@ +function opoutsize = FA_SZ_OPHAT(in1size,in2size) +// function opoutsize = FA_SZ_OPHAT(in1size,in2size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPHAT operator. +// +// Assuming: +// size(in1) = [in1r,in1c] +// size(in2) = [in2r,in2c] +// size(out) = [outr,outc] +// +// we have the following combinations: +// in1 in2 outr outc +// ----------------------- +// S S in2r in2c +// S M in2r in2c +// M S in1r in1c +// M M in1r in1c +// +// Where S means that the input is a scalar +// and M means that the input is a matrix. +// +// Input data: +// in1size: size of input number 1. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// in2size: size of input number 2. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Output data: +// opoutsize: size of output. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Status: +// 10-Dec-2007 -- Raffaele Nutricato: Author. +// 10-Dec-2007 -- Alberto Morea: Test Ok. +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPLOGAND.sci b/macros/FunctionAnnotation/FA_SZ_OPLOGAND.sci new file mode 100644 index 00000000..099bb9ac --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPLOGAND.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGAND(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGAND(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPLOGEQ.sci b/macros/FunctionAnnotation/FA_SZ_OPLOGEQ.sci new file mode 100644 index 00000000..4ade6a0f --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPLOGEQ.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGEQ(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGEQ(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPLOGGE.sci b/macros/FunctionAnnotation/FA_SZ_OPLOGGE.sci new file mode 100644 index 00000000..c6d6ee3f --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPLOGGE.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGGE(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGGE(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPLOGGT.sci b/macros/FunctionAnnotation/FA_SZ_OPLOGGT.sci new file mode 100644 index 00000000..0f6493c9 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPLOGGT.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGGT(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGGT(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPLOGLE.sci b/macros/FunctionAnnotation/FA_SZ_OPLOGLE.sci new file mode 100644 index 00000000..edda359f --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPLOGLE.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGLE(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGLE(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPLOGLT.sci b/macros/FunctionAnnotation/FA_SZ_OPLOGLT.sci new file mode 100644 index 00000000..81b1b256 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPLOGLT.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGLT(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGLT(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPLOGNE.sci b/macros/FunctionAnnotation/FA_SZ_OPLOGNE.sci new file mode 100644 index 00000000..ff62abbf --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPLOGNE.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGNE(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGNE(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPLOGNOT.sci b/macros/FunctionAnnotation/FA_SZ_OPLOGNOT.sci new file mode 100644 index 00000000..3b0c6549 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPLOGNOT.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGNOT(in1size) +// function opoutsize = FA_SZ_OPLOGNOT(in1size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTAPEX. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTAPEX(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPLOGOR.sci b/macros/FunctionAnnotation/FA_SZ_OPLOGOR.sci new file mode 100644 index 00000000..f28eec2f --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPLOGOR.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGOR(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGOR(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPMINUS.sci b/macros/FunctionAnnotation/FA_SZ_OPMINUS.sci new file mode 100644 index 00000000..5f7fc96a --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPMINUS.sci @@ -0,0 +1,51 @@ +function opoutsize = FA_SZ_OPMINUS(in1size,in2size) +// function opoutsize = FA_SZ_OPMINUS(in1size,in2size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPMINUS operator. +// +// Assuming: +// size(in1) = [in1r,in1c] +// size(in2) = [in2r,in2c] +// size(out) = [outr,outc] +// +// we have the following combinations: +// in1 in2 outr outc +// ----------------------- +// S S in2r in2c +// S M in2r in2c +// M S in1r in1c +// M M in1r in1c +// +// Where S means that the input is a scalar +// and M means that the input is a matrix. +// +// Input data: +// in1size: size of input number 1. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// in2size: size of input number 2. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Output data: +// opoutsize: size of output. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Status: +// 08-Dec-2007 -- Raffaele Nutricato: Author. +// 08-Dec-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +opoutsize = FA_SZ_OPPLUSA(in1size,in2size); + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPPLUS.sci b/macros/FunctionAnnotation/FA_SZ_OPPLUS.sci new file mode 100644 index 00000000..aae50af6 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPPLUS.sci @@ -0,0 +1,93 @@ +function opoutsize = FA_SZ_OPPLUS(in1size,in2size,in1type,in2type) +// function opoutsize = FA_SZ_OPPLUS(in1size,in2size,in1type,in2type) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPPLUS operator, +// including the string operations. +// +// Assuming: +// size(in1) = [in1r,in1c] +// size(in2) = [in2r,in2c] +// size(out) = [outr,outc] +// +// we have the following combinations: +// in1 in2 outr outc +// ----------------------- +// S S in2r in2c +// S M in2r in2c +// M S in1r in1c +// M M in1r in1c +// +// Where S means that the input is a scalar +// and M means that the input is a matrix. +// There is also the case related to the string catenation! +// This is the main difference between - and + operators. +// +// Input data: +// in1size: size of input number 1. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// in2size: size of input number 2. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Output data: +// opoutsize: size of output. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Status: +// 08-Dec-2007 -- Raffaele Nutricato: Author. +// 08-Dec-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),4,4); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +// --- Get dimensions of input arguments. --- +in1size = string(in1size); +in2size = string(in2size); +in1type = string(in1type); +in2type = string(in2type); +in1dim = GetSymbolDimension(in1size); + +if ((in1type ~= 'g') & (in2type ~= 'g')) + opoutsize = FA_SZ_OPPLUSA(in1size,in2size); +elseif ((in1type == 'g') & (in2type == 'g')) + opoutsize(1) = '1'; + if (isnum(in1size(1)) & isnum(in2size(1))) + in1num = eval(in1size(1)); + in2num = eval(in2size(1)); + if (in1num > 1 | in2num > 1) + SCI2Cerror('String catenation can be performed only on strings of 1 x N size not N x 1 size'); + //NUT: mi pare che non possano proprio esistere stringe di dimensione Nx1 perche' in + //NUT: scilab esiste il tipo string che e' di size 1x1 e sono io a trasformarlo in + //NUT: 1xN per cui se uso sempre questa convenzione non sbaglio mai. + //NUT: ho provato in scilab a fare la trasposta di una stringa e ottengo sempre 1x1. + end + end + if (isnum(in1size(2)) & isnum(in2size(2))) + in1num = eval(in1size(2)); + in2num = eval(in2size(2)); + opoutsize(2) = string(in1num+in2num-1); + if isnan(opoutsize(2)) + opoutsize(2) = '__SCI2CNANSIZE'; + else + opoutsize(2) = string(opoutsize(2)); + end + else + opoutsize(2) = '('+string(in1size(2))+'+'+string(in2size(2))+'-1)'; + end +else + SCI2Cerror('Unexpected type combination for ""+"" operator (type1,type2): ('+in1type+in2type+').'); +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPPLUSA.sci b/macros/FunctionAnnotation/FA_SZ_OPPLUSA.sci new file mode 100644 index 00000000..42ba90d5 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPPLUSA.sci @@ -0,0 +1,66 @@ +function opoutsize = FA_SZ_OPPLUSA(in1size,in2size) +// function opoutsize = FA_SZ_OPPLUSA(in1size,in2size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPPLUS operator +// restricted to arithmetic operations (string operations not supported.) +// +// Assuming: +// size(in1) = [in1r,in1c] +// size(in2) = [in2r,in2c] +// size(out) = [outr,outc] +// +// we have the following combinations: +// in1 in2 outr outc +// ----------------------- +// S S in2r in2c +// S M in2r in2c +// M S in1r in1c +// M M in1r in1c +// +// Where S means that the input is a scalar +// and M means that the input is a matrix. +// There is also the case related to the string catenation! +// This is the main difference between - and + operators. +// +// Input data: +// in1size: size of input number 1. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// in2size: size of input number 2. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Output data: +// opoutsize: size of output. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Status: +// 18-Mar-2008 -- Raffaele Nutricato: Author. +// 18-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +// --- Get dimensions of input arguments. --- +in1size = string(in1size); +in2size = string(in2size); +in1dim = GetSymbolDimension(in1size); + +if (in1dim == 0) + opoutsize = in2size; +else + opoutsize = in1size; +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPRC.sci b/macros/FunctionAnnotation/FA_SZ_OPRC.sci new file mode 100644 index 00000000..c4da4a0f --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPRC.sci @@ -0,0 +1,40 @@ +function opoutsize = FA_SZ_OPRC(in1size,in2size) +// function opoutsize = FA_SZ_OPRC(in1size,in2size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPRC operator. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +in1size = string(in1size); +in2size = string(in2size); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +// --- Get dimensions of input arguments. --- +in1dim = GetSymbolDimension(in1size); +in2dim = GetSymbolDimension(in2size); + +opoutsize(1) = in1size(1); + +if (isnum(in1size(2)) & isnum(in2size(2))) + in1num = eval(in1size(2)); + in2num = eval(in2size(2)); + opoutsize(2) = string(in1num+in2num); +else + opoutsize(2) = '('+string(in1size(2))+'+'+string(in2size(2))+')'; +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPSLASH.sci b/macros/FunctionAnnotation/FA_SZ_OPSLASH.sci new file mode 100644 index 00000000..a44057d9 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPSLASH.sci @@ -0,0 +1,37 @@ +function opoutsize = FA_SZ_OPSLASH(in1size,in2size) +// function opoutsize = FA_SZ_OPSLASH(in1size,in2size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPSLASH operator. +// +// Assuming: +// size(in1) = [in1r,in1c] +// size(in2) = [in2r,in2c] +// size(out) = [outr,outc] +// + + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +in1size = string(in1size); +in2size = string(in2size); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +// --- Get dimensions of input arguments. --- +in1dim = GetSymbolDimension(in1size); +in2dim = GetSymbolDimension(in2size); + +if (in1dim == 0) + opoutsize = in2size; +elseif (in2dim == 0) + opoutsize = in1size; +else + opoutsize(1) = in1size(1); + opoutsize(2) = in2size(1); +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_OPSTAR.sci b/macros/FunctionAnnotation/FA_SZ_OPSTAR.sci new file mode 100644 index 00000000..12190d38 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_OPSTAR.sci @@ -0,0 +1,68 @@ +function opoutsize = FA_SZ_OPSTAR(in1size,in2size) +// function opoutsize = FA_SZ_OPSTAR(in1size,in2size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPSTAR operator. +// +// Assuming: +// size(in1) = [in1r,in1c] +// size(in2) = [in2r,in2c] +// size(out) = [outr,outc] +// +// we have the following combinations: +// in1 in2 outr outc +// ----------------------- +// S S in2r in2c +// S M in2r in2c +// M S in1r in1c +// M M in1r in2c +// +// Where S means that the input is a scalar +// and M means that the input is a matrix. +// +// Input data: +// in1size: size of input number 1. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// in2size: size of input number 2. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Output data: +// opoutsize: size of output. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Status: +// 08-Dec-2007 -- Raffaele Nutricato: Author. +// 08-Dec-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +in1size = string(in1size); +in2size = string(in2size); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +// --- Get dimensions of input arguments. --- +in1dim = GetSymbolDimension(in1size); +in2dim = GetSymbolDimension(in2size); + +if (in1dim == 0) + opoutsize = in2size; +elseif (in2dim == 0) + opoutsize = in1size; +else + opoutsize(1) = in1size(1); + opoutsize(2) = in2size(2); +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_SEL1.sci b/macros/FunctionAnnotation/FA_SZ_SEL1.sci new file mode 100644 index 00000000..ccafe2d9 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_SEL1.sci @@ -0,0 +1,48 @@ +function opout = FA_SZ_SEL1(in1,in2) +// function opout = FA_SZ_SEL1(in1,in2) +// ----------------------------------------------------------------- +// Determines the number of rows of the output arguments +// according to the number of rows of the first input argument and +// the specifier in2 which can be 1,2 or 'r','c' and 'm'. +// In this release the 'm' specifier is not supported so when it is +// used SCI2C will issue an error. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying a number or a symbol. +// +// Output data: +// opout: string containing the computed result. +// +// Status: +// 16-Mar-2008 -- Raffaele Nutricato: Author. +// 16-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ + + +SCI2CNInArgCheck(argn(2),2,2); +ReportFileName = ''; +in2 = string(in2); + +if (in2 == '1' | in2 == '""rr""' ) // Where can r become rr ??? + opout = '1'; +elseif (in2 == '2' | in2 == '""c""' ) + opout = in1; + + +else + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Cannot associate the second input argument to a known specifier.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Please rearrange your code by using one of the following specifiers:',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: 1 or 2.',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); +end +endfunction diff --git a/macros/FunctionAnnotation/FA_SZ_SEL2.sci b/macros/FunctionAnnotation/FA_SZ_SEL2.sci new file mode 100644 index 00000000..69b38fd1 --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_SEL2.sci @@ -0,0 +1,44 @@ +function opout = FA_SZ_SEL2(in1,in2) +// function opout = FA_SZ_SEL2(in1,in2) +// ----------------------------------------------------------------- +// Determines the number of columns of the output arguments +// according to the number of columns of the first input argument and +// the specifier in2 which can be 1,2 or 'r','c' and 'm'. +// In this release the 'm' specifier is not supported so when it is +// used SCI2C will issue an error. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying a number or a symbol. +// +// Output data: +// opout: string containing the computed result. +// +// Status: +// 16-Mar-2008 -- Raffaele Nutricato: Author. +// 16-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); +ReportFileName = ''; +in2 = string(in2); + +if (in2 == '1'| in2 == '""rr""') + opout = in1; +elseif (in2 == '2'| in2 == '""c""') + opout = '1'; +else + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Cannot associate the second input argument to a known specifier.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Please rearrange your code by using one of the following specifiers:',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: 1 or 2.',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); +end +endfunction diff --git a/macros/FunctionAnnotation/FA_TP_C.sci b/macros/FunctionAnnotation/FA_TP_C.sci new file mode 100644 index 00000000..b383b5ac --- /dev/null +++ b/macros/FunctionAnnotation/FA_TP_C.sci @@ -0,0 +1,32 @@ +function typeout = FA_TP_C() +// function typeout = FA_TP_C() +// ----------------------------------------------------------------- +// Returns the "single complex" type specifier +// for Function Annotations. +// +// Input data: +// --- +// +// Output data: +// typeout: string containing the type specifier. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +typeout = 'c'; + +endfunction diff --git a/macros/FunctionAnnotation/FA_TP_COMPLEX.sci b/macros/FunctionAnnotation/FA_TP_COMPLEX.sci new file mode 100644 index 00000000..bf3f2f9f --- /dev/null +++ b/macros/FunctionAnnotation/FA_TP_COMPLEX.sci @@ -0,0 +1,42 @@ +function typeout = FA_TP_COMPLEX(in1) +// function typeout = FA_TP_COMPLEX(in1) +// ----------------------------------------------------------------- +// Converts into complex data type the input argument, by preserving +// the precision of the input argument. +// See following examples: +// FA_TP_COMPLEX('s') = 'c' +// FA_TP_COMPLEX('d') = 'z' +// FA_TP_COMPLEX('c') = 'c' +// FA_TP_COMPLEX('z') = 'z' +// +// Input data: +// in1: string specifying the data type number 1. +// +// Output data: +// typeout: string containing the type specifier. +// +// Status: +// 26-Jan-2008 -- Raffaele Nutricato: Author. +// 26-Jan-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (in1 == 's') + typeout = 'c'; +elseif (in1 == 'd') + typeout = 'z'; +else + typeout = in1; +end +endfunction diff --git a/macros/FunctionAnnotation/FA_TP_D.sci b/macros/FunctionAnnotation/FA_TP_D.sci new file mode 100644 index 00000000..788a03fe --- /dev/null +++ b/macros/FunctionAnnotation/FA_TP_D.sci @@ -0,0 +1,32 @@ +function typeout = FA_TP_D() +// function typeout = FA_TP_D() +// ----------------------------------------------------------------- +// Returns the "double" type specifier +// for Function Annotations. +// +// Input data: +// --- +// +// Output data: +// typeout: string containing the type specifier. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +typeout = 'd'; + +endfunction diff --git a/macros/FunctionAnnotation/FA_TP_I.sci b/macros/FunctionAnnotation/FA_TP_I.sci new file mode 100644 index 00000000..94f383f4 --- /dev/null +++ b/macros/FunctionAnnotation/FA_TP_I.sci @@ -0,0 +1,32 @@ +function typeout = FA_TP_I() +// function typeout = FA_TP_I() +// ----------------------------------------------------------------- +// Returns the "int" type specifier +// for Function Annotations. +// +// Input data: +// --- +// +// Output data: +// typeout: string containing the type specifier. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +typeout = 'i'; + +endfunction diff --git a/macros/FunctionAnnotation/FA_TP_MAX.sci b/macros/FunctionAnnotation/FA_TP_MAX.sci new file mode 100644 index 00000000..0b78f9e3 --- /dev/null +++ b/macros/FunctionAnnotation/FA_TP_MAX.sci @@ -0,0 +1,45 @@ +function opout = FA_TP_MAX(in1,in2) +// function opout = FA_TP_MAX(in1,in2) +// ----------------------------------------------------------------- +// Type-Maximum function for Function Annotations. +// Returns the maximum between the two data types in input according +// to a predefined priority. For example z(double complex) is +// greater that c(single complex). +// +// Input data: +// in1: string specifying the data type number 1. +// in2: string specifying the data type number 2. +// +// Output data: +// opout: string containing the computed result. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +in1Pin2 = in1+in2; +opout = in1; + +if (in2 == 'z') + opout = 'z'; +elseif (in1Pin2 == 'sd') + opout = 'd'; +elseif (in1Pin2 == 'sc') + opout = 'c'; +elseif (in1Pin2 == 'dc') + opout = 'z'; +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_TP_MIN_REAL.sci b/macros/FunctionAnnotation/FA_TP_MIN_REAL.sci new file mode 100644 index 00000000..43fc7926 --- /dev/null +++ b/macros/FunctionAnnotation/FA_TP_MIN_REAL.sci @@ -0,0 +1,35 @@ +function opout = FA_TP_MIN_REAL(in1,in2) +// Status: +// 2009 -- Arnaud Torset: Author. +// +// ----------------------------------------------------------------- +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) INRIA +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +//SCI2CNInArgCheck(argn(2),2,2); + +in1Pin2 = in1+in2; +opout = in1; + +if (opout == 'c') + opout = 's'; +elseif (opout == 'z') + opout = 'd'; +end + +if (in2 == 'c') + opout = 's'; +elseif (in2 == 's') + opout = 's'; +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_TP_REAL.sci b/macros/FunctionAnnotation/FA_TP_REAL.sci new file mode 100644 index 00000000..67a946dc --- /dev/null +++ b/macros/FunctionAnnotation/FA_TP_REAL.sci @@ -0,0 +1,38 @@ +function opout = FA_TP_REAL(in1) +// function opout = FA_TP_REAL(in1) +// ----------------------------------------------------------------- +// Type-Real function for Function Annotations. +// Returns the real precision corresponding to the precision of +// the input operand. +// +// Input data: +// in1: string specifying the data type number 1. +// +// Output data: +// opout: string containing the computed result. +// +// Status: +// 26-Mar-2008 -- Raffaele Nutricato: Author. +// 26-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +opout = in1; + +if (in1 == 'c') + opout = 's'; +elseif (in1 == 'z') + opout = 'd'; +end + +endfunction diff --git a/macros/FunctionAnnotation/FA_TP_S.sci b/macros/FunctionAnnotation/FA_TP_S.sci new file mode 100644 index 00000000..3de4c20c --- /dev/null +++ b/macros/FunctionAnnotation/FA_TP_S.sci @@ -0,0 +1,32 @@ +function typeout = FA_TP_S() +// function typeout = FA_TP_S() +// ----------------------------------------------------------------- +// Returns the "float" type specifier +// for Function Annotations. +// +// Input data: +// --- +// +// Output data: +// typeout: string containing the type specifier. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +typeout = 's'; + +endfunction diff --git a/macros/FunctionAnnotation/FA_TP_USER.sci b/macros/FunctionAnnotation/FA_TP_USER.sci new file mode 100644 index 00000000..3b306a9f --- /dev/null +++ b/macros/FunctionAnnotation/FA_TP_USER.sci @@ -0,0 +1,38 @@ +function type_out = FA_TP_USER(PrecisionSpecifier,DefaultType) +// function type_out = FA_TP_USER(PrecisionSpecifier,DefaultType) +// ----------------------------------------------------------------- +// Generate the output type of the output argument by using the +// output (AnnotationFnc) generated by CheckAnnotationFunction. +// double and float functions can be used to specify the type +// of the output argument. They are typically used in combination +// with zeros-like function. +// +// Input data: +// PrecisionSpecifier: it can be 'double' or 'float'. +// +// Output data: +// type_out: specifies the type of the output argument. It can be +// 's' for float precision or 'd' for double precision. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +if (mtlb_strcmp(PrecisionSpecifier,'int')) + type_out = 'i'; +elseif (mtlb_strcmp(PrecisionSpecifier,'float')) + type_out = 's'; +elseif (mtlb_strcmp(PrecisionSpecifier,'double')) + type_out = 'd'; +elseif (mtlb_strcmp(PrecisionSpecifier,'default')) + type_out = DefaultType; +else + SCI2Cerror('Unknown precision function: ""'+AnnotationFnc+'"".'); +end +endfunction diff --git a/macros/FunctionAnnotation/FA_TP_Z.sci b/macros/FunctionAnnotation/FA_TP_Z.sci new file mode 100644 index 00000000..2ac18dea --- /dev/null +++ b/macros/FunctionAnnotation/FA_TP_Z.sci @@ -0,0 +1,32 @@ +function typeout = FA_TP_Z() +// function typeout = FA_TP_Z() +// ----------------------------------------------------------------- +// Returns the "double complex" type specifier +// for Function Annotations. +// +// Input data: +// --- +// +// Output data: +// typeout: string containing the type specifier. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +typeout = 'z'; + +endfunction diff --git a/macros/FunctionAnnotation/buildmacros.sce b/macros/FunctionAnnotation/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/macros/FunctionAnnotation/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/FunctionList/FL_ExistCFunction.sci b/macros/FunctionList/FL_ExistCFunction.sci new file mode 100644 index 00000000..5b63ec5b --- /dev/null +++ b/macros/FunctionList/FL_ExistCFunction.sci @@ -0,0 +1,106 @@ +function flagexist = FL_ExistCFunction(CFunName,USER2CAvailableCDat,SCI2CAvailableCDat,ConvertedDat,ToBeConvertedDat,ReportFileName) +// function flagexist = FL_ExistCFunction(CFunName,USER2CAvailableCDat,SCI2CAvailableCDat,ConvertedDat,ToBeConvertedDat,ReportFileName) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 30-Oct-2007 -- Raffaele Nutricato: Author. +// 30-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),6,6); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +flagexist = %F; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + + +AvailableDat = USER2CAvailableCDat; +load(AvailableDat,'Available'); +NAvail = size(Available,1); + +tmpcnt = 1; +while ((tmpcnt <=NAvail) & (flagexist == %F)) + if mtlb_strcmp(Available(tmpcnt),CFunName) + flagexist = %T; + // #RNU_RES_B + PrintStringInfo(' Found C Function Name in : '+AvailableDat,ReportFileName,'file','y'); + // #RNU_RES_E + end + tmpcnt = tmpcnt + 1; +end +clear Available + +if (flagexist == %F) + AvailableDat = SCI2CAvailableCDat; + load(AvailableDat,'Available'); + NAvail = size(Available,1); + + tmpcnt = 1; + while ((tmpcnt <=NAvail) & (flagexist == %F)) + if mtlb_strcmp(Available(tmpcnt),CFunName) + flagexist = %T; + // #RNU_RES_B + PrintStringInfo(' Found C Function Name in : '+AvailableDat,ReportFileName,'file','y'); + // #RNU_RES_E + end + tmpcnt = tmpcnt + 1; + end + clear Available +end + +if (flagexist == %F) + load(ConvertedDat,'Converted'); + NConv = size(Converted,1); + tmpcnt = 1; + while ((tmpcnt <=NConv) & (flagexist == %F)) + if mtlb_strcmp(Converted(tmpcnt),CFunName) + flagexist = %T; + // #RNU_RES_B + PrintStringInfo(' Found C Function Name in : '+ConvertedDat,ReportFileName,'file','y'); + // #RNU_RES_E + end + tmpcnt = tmpcnt + 1; + end + clear Converted +end + +if (flagexist == %F) + load(ToBeConvertedDat,'ToBeConverted'); + NToBeConv = size(ToBeConverted,1); + tmpcnt = 1; + while ((tmpcnt <=NToBeConv) & (flagexist == %F)) + if mtlb_strcmp(ToBeConverted(tmpcnt).CFunctionName,CFunName) + flagexist = %T; + // #RNU_RES_B + PrintStringInfo(' Found C Function Name in : '+ToBeConvertedDat,ReportFileName,'file','y'); + // #RNU_RES_E + end + tmpcnt = tmpcnt + 1; + end + clear ToBeConverted +end + +if (flagexist == %F) + // #RNU_RES_B + PrintStringInfo(' C Function Name not found in the ""Available"" , ""Converted"" and ""ToBeConverted"" function lists.',ReportFileName,'file','y'); + // #RNU_RES_E +end + +endfunction diff --git a/macros/FunctionList/FL_ExtractFuncList.sci b/macros/FunctionList/FL_ExtractFuncList.sci new file mode 100644 index 00000000..9e951d9c --- /dev/null +++ b/macros/FunctionList/FL_ExtractFuncList.sci @@ -0,0 +1,62 @@ +function [CFuncList,NElements] = FL_ExtractFuncList(FunctionDir,ClassDir,SCI2CClassSpecifier,ExtFLCls,ReportFileName) +// function [CFuncList,NElements] = FL_ExtractFuncList(FunctionDir,ClassDir,SCI2CClassSpecifier,ExtFLCls,ReportFileName) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Extracts the list of the C functions available. To do that +// this function enters in the directories where the .clst and +// .lst files are stored. +// #RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 05-Jan-2008 -- Nutricato Raffaele: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),5,5); + +// #RNU_RES_B +// --------------------------------------------------------- +// --- Extract the list of files in Functions directory. --- +// --------------------------------------------------------- +// #RNU_RES_E +tmppwd = pwd(); +cd(FunctionDir); +// funfiles = ls(); +funfiles = listfiles(); +cd(tmppwd); +NFunFiles = size(funfiles,1); + +// #RNU_RES_B +// ----------------------------------------------------------- +// --- Extract the C function list from Classes directory. --- +// ----------------------------------------------------------- +// #RNU_RES_E +CFuncList = ''; +NElements = 0; + +for cntfun = 1:NFunFiles + FunFileName = fullfile(FunctionDir,funfiles(cntfun)); + ClassName = FL_GetFunctionClass(FunFileName,SCI2CClassSpecifier,ReportFileName); + ClassFileName = fullfile(ClassDir,ClassName); + [tmpfunlist,tmpnelem] = File2StringArray(ClassFileName+ExtFLCls); + [tmppath,tmpfunname,tmpext] = fileparts(FunFileName); + tmpfunlist = FL_InOutArgs2CFunNames(tmpfunname,tmpfunlist,tmpnelem); + for cnttmpfun = 1:tmpnelem + NElements = NElements + 1; + CFuncList(NElements) = tmpfunlist(cnttmpfun); + end +end + +endfunction diff --git a/macros/FunctionList/FL_GetFunctionClass.sci b/macros/FunctionList/FL_GetFunctionClass.sci new file mode 100644 index 00000000..41ec2ea4 --- /dev/null +++ b/macros/FunctionList/FL_GetFunctionClass.sci @@ -0,0 +1,54 @@ +function SCI2CClassName = FL_GetFunctionClass(FunFileName,SCI2CClassSpecifier,ReportFileName) +// function SCI2CClassName = FL_GetFunctionClass(FunFileName,SCI2CClassSpecifier,ReportFileName) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Jul-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),3,3); + +// --------------------------------------- +// --- Read the class of the function. --- +// --------------------------------------- +// --- Open the .sci file (read only). --- +inannfid = SCI2COpenFileRead(FunFileName); + +FoundClass = 0; +if (meof(inannfid) == 0) + check_string = stripblanks(mgetl(inannfid,1)); + if (~isempty(check_string)) + if (SCI2Cstrncmps1size(SCI2CClassSpecifier,check_string)) + SCI2CClassName = part(check_string,length(SCI2CClassSpecifier)+1:length(check_string)); + // #RNU_RES_B + PrintStringInfo(' Function belongs to class: '+SCI2CClassName+'.',ReportFileName,'file','y'); + // #RNU_RES_E + FoundClass = 1; + else + SCI2CerrorFile('Could not find ""'+SCI2CClassSpecifier+'"" in '+FunFileName+'.',ReportFileName); + end + end +end +mclose(inannfid); +if (FoundClass == 0) + SCI2CerrorFile('Could not find ""'+SCI2CClassSpecifier+'"" specifier.',ReportFileName); +end + +// ------------------------------------------- +// --- End read the class of the function. --- +// ------------------------------------------- +endfunction + \ No newline at end of file diff --git a/macros/FunctionList/FL_InOutArgs2CFunNames.sci b/macros/FunctionList/FL_InOutArgs2CFunNames.sci new file mode 100644 index 00000000..9305c48e --- /dev/null +++ b/macros/FunctionList/FL_InOutArgs2CFunNames.sci @@ -0,0 +1,52 @@ +function FunNameCFuncList = FL_InOutArgs2CFunNames(FunctionName,CommaSepCFuncList,CFuncListNElem) +// function FunNameCFuncList = FL_InOutArgs2CFunNames(FunctionName,CommaSepCFuncList,CFuncListNElem) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Reads a Comma Separated Function List and converts it into the +// corresponding list of C function. In the Comma Separated +// Function List only input and output arguments are specified +// and they are separated by a comma. +// #RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 05-Jan-2008 -- Nutricato Raffaele: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),3,3); + + +FunNameCFuncList = ''; +SepChar = ','; +for cntelem = 1:CFuncListNElem + tmptokens = tokens(CommaSepCFuncList(cntelem),SepChar); + if (size(tmptokens,1) == 0) + FunNameCFuncList(cntelem) = FunctionName; + elseif (size(tmptokens,1) == 1) + if part(tmptokens,1:1) == ',' + FunNameCFuncList(cntelem) = FunctionName+tmptokens(2); + else + FunNameCFuncList(cntelem) = tmptokens(1)+FunctionName; + end + elseif (size(tmptokens,1) == 2) + FunNameCFuncList(cntelem) = tmptokens(1)+FunctionName+tmptokens(2); + else + disp('Incorrect format for the function list class.'); + disp('Check the following function list class item: ""'+CommaSepCFuncList(cntelem)+'"".'); + SCI2Cerror(' '); + end +end + +endfunction diff --git a/macros/FunctionList/FL_UpdateConverted.sci b/macros/FunctionList/FL_UpdateConverted.sci new file mode 100644 index 00000000..5f4637e8 --- /dev/null +++ b/macros/FunctionList/FL_UpdateConverted.sci @@ -0,0 +1,46 @@ +function Converted = FL_UpdateConverted(NFilesToTranslate,ConvertedDatFile) +// function Converted = FL_UpdateConverted(NFilesToTranslate,ConvertedDatFile) +// ----------------------------------------------------------------- +// //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 Converted .dat file. --- +load(ConvertedDatFile,'Converted'); +// --------------------------- +// --- End Initialization. --- +// --------------------------- + + +if (NFilesToTranslate >= 1) + // --------------------------------------- + // --- Update Converted Function List. --- + // --------------------------------------- + // --- Insert the current function into the converted function list. --- + NConvP1 = size(Converted,1)+1; + Converted(NConvP1) = SharedInfo.NextCFunName; + // ------------------------------------------- + // --- End Update Converted Function List. --- + // ------------------------------------------- +end + +endfunction diff --git a/macros/FunctionList/FL_UpdateToBeConv.sci b/macros/FunctionList/FL_UpdateToBeConv.sci new file mode 100644 index 00000000..456467da --- /dev/null +++ b/macros/FunctionList/FL_UpdateToBeConv.sci @@ -0,0 +1,114 @@ +function SharedInfo = FL_UpdateToBeConv(ASTFunName,CFunName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,FileInfo,SharedInfo) +// function SharedInfo = FL_UpdateToBeConv(ASTFunName,CFunName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,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),11,11); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; + +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +SCI2CAvailableCDat = FileInfo.FunctionList.SCI2CAvailableCDat; +USER2CAvailableCDat = FileInfo.FunctionList.USER2CAvailableCDat; +ConvertedDat = FileInfo.FunctionList.ConvertedDat; +ToBeConvertedDat = FileInfo.FunctionList.ToBeConvertedDat; +FunInfoDatDir = FileInfo.FunctionList.FunInfoDatDir; + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Updating C Function List***',ReportFileName,'file','y'); +PrintStringInfo(' C Function Name: '+CFunName,ReportFileName,'file','y'); +// #RNU_RES_E +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// #RNU_RES_B +// -------------------------------------------------- +// --- Manage anticipated exit from the function. --- +// -------------------------------------------------- +//NUT: questo codice e' identico quasi a quello della CFunCall, si pu0 pensare di +//NUT: di fare un'unica funzione. +// #RNU_RES_E + +if (SharedInfo.SkipNextFun > 0) + // #RNU_RES_B + PrintStringInfo(' Current function will not be inserted in the Function List.',ReportFileName,'file','y'); + // #RNU_RES_E + return; +end + +// #RNU_RES_B +// Exit if the function is a precision specifier and the corresponding flag is 1. +// #RNU_RES_E +if ((sum(mtlb_strcmp(ASTFunName,SharedInfo.Annotations.DataPrec)) > 0) & ... + (SharedInfo.SkipNextPrec == 1)) + // #RNU_RES_B + PrintStringInfo(' Current function will not be inserted in the Function List.',ReportFileName,'file','y'); + // #RNU_RES_E + return; +end + +// #RNU_RES_B +// Exit if the function is OpEqual and the corresponding skip flag is enabled. +// #RNU_RES_E +if ((mtlb_strcmp(ASTFunName,'OpEqual')) & ... + (SharedInfo.SkipNextEqual == 1)) + // #RNU_RES_B + PrintStringInfo(' Current function will not be inserted in the Function List.',ReportFileName,'file','y'); + // #RNU_RES_E + return; +end + +// #RNU_RES_B +// --------------------------------------- +// --- If the function is not skipped. --- +// --------------------------------------- +// --- Check existence of the C function. --- +// #RNU_RES_E +flagexist = FL_ExistCFunction(CFunName,USER2CAvailableCDat,SCI2CAvailableCDat,ConvertedDat,ToBeConvertedDat,ReportFileName); + +// #RNU_RES_B +// --- Update C function list and dat files. --- +// #RNU_RES_E +if (flagexist == %F) + + // #RNU_RES_B + // --- Add C function to the "ToBeConverted" function list. --- + // #RNU_RES_E + load(ToBeConvertedDat,'ToBeConverted'); + + NToConvP1 = size(ToBeConverted,1)+1; + ToBeConverted(NToConvP1).SCIFunctionName = ASTFunName; + ToBeConverted(NToConvP1).CFunctionName = CFunName; + + save(ToBeConvertedDat,ToBeConverted); + SharedInfo.NFilesToTranslate = SharedInfo.NFilesToTranslate + 1; + + // #RNU_RES_B + // --- Generate C Function dat file. --- + PrintStringInfo(' Add C Function ""'+CFunName+'"" to: '+ToBeConvertedDat,ReportFileName,'file','y'); + // #RNU_RES_E +end + +endfunction diff --git a/macros/FunctionList/buildmacros.sce b/macros/FunctionList/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/macros/FunctionList/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/GeneralFunctions/Array2String.sci b/macros/GeneralFunctions/Array2String.sci new file mode 100644 index 00000000..27e9aa15 --- /dev/null +++ b/macros/GeneralFunctions/Array2String.sci @@ -0,0 +1,40 @@ +function [StringArray] = Array2String(InArray); +// function [StringArray] = Array2String(InArray); +// ----------------------------------------------------------------- +// #RNU_RES_B +// Converts an input array into a string. Maximum 2D array are allowed. +// Ex.: InArray = [10, 4]; +// StringArray = "[10, 4]"; +// #RNU_RES_E +// +// Input data: +// InArray: Input array. +// +// Output data: +// StringArray: array converted into a string. +// +// Status: +// 13-May-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +[Nrows,Ncols] = size(InArray); + +StringArray = '['; +for counterrows = 1:Nrows + for countercols = 1:Ncols + StringArray = StringArray + string(InArray(counterrows,countercols)) + ','; + end + StringArray = part(StringArray,1:(length(StringArray)-1)); // Remove the last ',' + StringArray = StringArray+';'; +end +StringArray = part(StringArray,1:(length(StringArray)-1)); // Remove the last ';' +StringArray = StringArray+']'; +endfunction diff --git a/macros/GeneralFunctions/ConvertPathMat2C.sci b/macros/GeneralFunctions/ConvertPathMat2C.sci new file mode 100644 index 00000000..d73d22c7 --- /dev/null +++ b/macros/GeneralFunctions/ConvertPathMat2C.sci @@ -0,0 +1,61 @@ +function OutPath = ConvertPathMat2C(InPath,CPathStyle) +// function OutPath = ConvertPathMat2C(InPath,CPathStyle) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Converts the input path InPath into a path by using the path +// style specified by CPathStyle. +// #RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Jan-2008 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); +if (CPathStyle == 'windows') + OutPath=strsubst(InPath,'/','\'); +elseif (CPathStyle == 'unix') + OutPath=strsubst(InPath,'\','/'); +elseif (CPathStyle == 'cygwin') + OutPath=strsubst(InPath,'\','/'); + OutPath=strsubst(OutPath,'A:','/cygdrive/a'); + OutPath=strsubst(OutPath,'B:','/cygdrive/b'); + OutPath=strsubst(OutPath,'C:','/cygdrive/c'); + OutPath=strsubst(OutPath,'D:','/cygdrive/d'); + OutPath=strsubst(OutPath,'E:','/cygdrive/e'); + OutPath=strsubst(OutPath,'F:','/cygdrive/f'); + OutPath=strsubst(OutPath,'G:','/cygdrive/g'); + OutPath=strsubst(OutPath,'H:','/cygdrive/h'); + OutPath=strsubst(OutPath,'I:','/cygdrive/i'); + OutPath=strsubst(OutPath,'J:','/cygdrive/j'); + OutPath=strsubst(OutPath,'K:','/cygdrive/k'); + OutPath=strsubst(OutPath,'L:','/cygdrive/l'); + OutPath=strsubst(OutPath,'M:','/cygdrive/m'); + OutPath=strsubst(OutPath,'N:','/cygdrive/n'); + OutPath=strsubst(OutPath,'O:','/cygdrive/o'); + OutPath=strsubst(OutPath,'P:','/cygdrive/p'); + OutPath=strsubst(OutPath,'Q:','/cygdrive/q'); + OutPath=strsubst(OutPath,'R:','/cygdrive/r'); + OutPath=strsubst(OutPath,'S:','/cygdrive/s'); + OutPath=strsubst(OutPath,'T:','/cygdrive/t'); + OutPath=strsubst(OutPath,'U:','/cygdrive/u'); + OutPath=strsubst(OutPath,'V:','/cygdrive/v'); + OutPath=strsubst(OutPath,'W:','/cygdrive/w'); + OutPath=strsubst(OutPath,'X:','/cygdrive/x'); + OutPath=strsubst(OutPath,'Y:','/cygdrive/y'); + OutPath=strsubst(OutPath,'Z:','/cygdrive/z'); +else + OutPath = InPath; +end +endfunction diff --git a/macros/GeneralFunctions/File2StringArray.sci b/macros/GeneralFunctions/File2StringArray.sci new file mode 100644 index 00000000..626cb6ce --- /dev/null +++ b/macros/GeneralFunctions/File2StringArray.sci @@ -0,0 +1,54 @@ +function [String_Array,N_Strings] = File2StringArray(InFileName) +// function [String_Array,N_Strings] = File2StringArray(InFileName) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Reads a text file and stores every line into a string array. +// #RNU_RES_E +// +// Input data: +// InFileName: path+filename of the input file. +// +// Output data: +// String_Array: array of strings containing the lines of the input +// text file. +// N_Strings: number of strings stored in String_Array. +// +// Status: +// 10-Nov-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + + +// ----------------------- +// --- Initialization. --- +// ----------------------- +N_Strings = 0; +String_Array = ''; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// -------------------- +// --- Open C file. --- +// -------------------- +fidfile = SCI2COpenFileRead(InFileName); + +// ------------------- +// --- Read lines. --- +// ------------------- +tmpline = mgetl(fidfile,1); +while (meof(fidfile) == 0) + N_Strings = N_Strings + 1; + String_Array(N_Strings) = tmpline; + tmpline = mgetl(fidfile,1); +end + +mclose(fidfile); +endfunction diff --git a/macros/GeneralFunctions/FunName2SciFileName.sci b/macros/GeneralFunctions/FunName2SciFileName.sci new file mode 100644 index 00000000..8c473001 --- /dev/null +++ b/macros/GeneralFunctions/FunName2SciFileName.sci @@ -0,0 +1,56 @@ +function ScilabFileName = FunName2SciFileName(DirList,InFunName); +// function ScilabFileName = FunName2SciFileName(DirList,InFunName); +// ----------------------------------------------------------------- +// #RNU_RES_B +// This function generates the full path of the scilab file +// related to the function name (InFunName) specified. +// In more detail the file "eval(InFunName).sci" file is searched +// in the directories specified in DirList. +// #RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 16-Apr-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +if (prod(size(DirList)) == 0) + SCI2Cerror('Incorrect DirList parameter.'); +end + +if (prod(size(InFunName)) == 0) + SCI2Cerror('Incorrect InFunName parameter.'); +end + +// --- Generate the PathList. --- +for tmpcounter = 1:max(size(DirList)) + PathList(tmpcounter) = fullfile(DirList(tmpcounter),(InFunName+'.sci')); +end + +// --- Search the .sci file. --- +ScilabFileName = listfiles(PathList); + +// --- Check on the number of .sci files found. --- +if ((prod(size(ScilabFileName))) > 1) + disp(ScilabFileName); + SCI2Cerror('Found more than one scilab file.'); +end + +if ((prod(size(ScilabFileName))) < 1) + disp(ScilabFileName); + SCI2Cerror('Scilab file ""'+InFunName+'.sci"", not found'); +end + +endfunction diff --git a/macros/GeneralFunctions/IsNanSize.sci b/macros/GeneralFunctions/IsNanSize.sci new file mode 100644 index 00000000..486f6fcc --- /dev/null +++ b/macros/GeneralFunctions/IsNanSize.sci @@ -0,0 +1,39 @@ +function outbool = IsNanSize(instring) +// function outbool = IsNanSize(instring) +// ----------------------------------------------------------------- +// #RNU_RES_B +// It searches for __SCI2CNANSIZE string in the string which specifies the +// size of the argument. Useful to find if a given size contains +// a nan value. In this case an error is issued. +// IsNanSize = '__SCI2CNANSIZE' -> True +// IsNanSize = 'c*__SCI2CNANSIZE' -> True +// IsNanSize = 'c+b' -> False +// #RNU_RES_E +// +// Input data: +// instring: string to analyze. +// +// Output data: +// outbool: %T if nan string has been found. +// +// Status: +// 11-Feb-2008 -- Nutricato Raffaele: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + + +outbool = %F; +indexval = strindex(instring,'__SCI2CNANSIZE'); + +if(length(indexval)>=1) + outbool = %T; +end + +endfunction diff --git a/macros/GeneralFunctions/KeyStr2FileStrPos.sci b/macros/GeneralFunctions/KeyStr2FileStrPos.sci new file mode 100644 index 00000000..e9fb1c48 --- /dev/null +++ b/macros/GeneralFunctions/KeyStr2FileStrPos.sci @@ -0,0 +1,83 @@ +function [flag_found,requested_line,line_position] = KeyStr2FileStrPos(filename,key_string,method) +// function [flag_found,requested_line,line_position] = KeyStr2FileStrPos(filename,key_string,method) +// -------------------------------------------------------------------------------- +// #RNU_RES_B +// This function returns a line and its position from a specified ASCII file. +// The line and the position returned starts with a key string specified in the +// input parameters. +// +// Input data: +// filename: path + name of the ASCII file. +// key_string: string that specifies the initial portion of the line to return. +// method: 'cut': in the returned line will be removed the key_string +// 'no_cut': (default), in the returned line will not be removed the key_string +// +// Output data: +// flag_found: 0 if the line is not found or an error occured. +// 1 if the search succeed. +// requested_line: is the line in the file which contains as first characters those +// specified in the key_string. +// line_position: position of the line in the file; the first line in the file +// is the line number 1. +// #RNU_RES_E +// +// +// Status: +// 08-Jul-2002 -- Author: Raffaele Nutricato +// 08-Jul-2002 -- Raffaele Nutricato: Revision OK +// 23-Nov-2004 -- Raffaele Nutricato: Changed disp to warning in if (flag_found == 0). +// It allows to disable the message it generates +// by using warning off. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,3); + + +if (argn(2) == 2) + method = 'no_cut'; +end +method = convstr(method, 'u'); + +// Initialize output parameters +flag_found = 0; +requested_line = ''; +line_position = 0; + +// Open the text file (read only) +[fid,mess] = mopen(filename,'r'); +if ( fid == -1 ) + disp(['Cannot open: '+filename]) + disp(mess); + flag_found = 0; + return; +end + +// loop on the lines of the file +num_chars = length(key_string); +while (meof(fid) == 0) + check_string = fgetl(fid); + line_position = line_position + 1; + if (key_string == check_string) & (key_string == num_chars) then + flag_found = 1; + requested_line = check_string; + if (method =='cut') then + requested_line(1:num_chars) = []; + end + mclose(fid); + return; + end +end + +if (flag_found == 0) + warning('Warning: string ' + key_string + ' not found in file: ' + filename); + mclose(fid); +end + +mclose(fid); +endfunction diff --git a/macros/GeneralFunctions/PrintStepInfo.sci b/macros/GeneralFunctions/PrintStepInfo.sci new file mode 100644 index 00000000..2550e327 --- /dev/null +++ b/macros/GeneralFunctions/PrintStepInfo.sci @@ -0,0 +1,71 @@ +function PrintStepInfo(inputstring,filename,outputtype,formattedstring) +// function PrintStepInfo(inputstring,filename,outputtype,formattedstring) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Prints a string by using a predefined format into a file or on +// the stdout. +// +// Input data: +// filename: optional parameter, that specifies the output file. +// If filename is '' or it is not provided to the function, +// the string will be printed on the stdout. +// outputtype: 'file' -> prints only on file. +// 'stdout' -> prints only on the stdout. +// 'both' -> prints on both file and stdoud. +// Default is 'stdout'. +// formattedstring: if 'n' (default) it means that str is considered as a simple string (mputstr). +// if 'y' then str is considered formatted according to mfprint syntax +// Output data: +// +// #RNU_RES_E +// Status: +// 02-Jan-2006 -- Nutricato Raffaele: Author. +// 02-Jan-2006 -- Nutricato Raffaele: TEST OK. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,4); + +if argn(2) < 4 + formattedstring = 'n'; + if argn(2) < 3 + bothout = 'n'; + if argn(2) < 2 + filename = ''; + end + end +end +if (length(filename) == 0) + outputtype = 'stdout'; // Prints only on the stdout. +end + +Nstars = length(inputstring); +starstring = []; +for counterstars = 1:Nstars + starstring = starstring+'*'; +end +blankstring = [' ']; + +if ((outputtype=='both') | (outputtype=='stdout')) + // disp(' ') + // disp(' ') + disp(blankstring+' '+starstring); + disp(blankstring+'==> '+inputstring); + disp(blankstring+' '+starstring); + // disp(' ') +end + +if ((outputtype=='both') | (outputtype=='file')) + filenamefprintf(filename,'y',' ',formattedstring); + filenamefprintf(filename,'y',' ',formattedstring); + filenamefprintf(filename,'y',blankstring+' '+starstring,formattedstring); + filenamefprintf(filename,'y',blankstring+'==> '+inputstring,formattedstring); + filenamefprintf(filename,'y',blankstring+' '+starstring,formattedstring); + filenamefprintf(filename,'y',' ',formattedstring); +end +endfunction diff --git a/macros/GeneralFunctions/PrintStringInfo.sci b/macros/GeneralFunctions/PrintStringInfo.sci new file mode 100644 index 00000000..a554d122 --- /dev/null +++ b/macros/GeneralFunctions/PrintStringInfo.sci @@ -0,0 +1,69 @@ +function PrintStringInfo(str, filename, outputtype, ennewline,formattedstring) +// function PrintStringInfo(str,filename,outputtype,ennewline,formattedstring) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Prints a string into a file or on the stdout or on both. +// +// Input data: +// filename: optional parameter, that specifies the output file. +// If filename is '' or it is not provided to the function, +// the string will be printed on the stdout. +// outputtype: 'file' -> prints only on file. +// 'stdout' -> prints only on the stdout. +// 'both' -> prints on both file and stdout. +// Default is 'stdout'. +// ennewline: optional (default = 'y'); If y adds a newline character +// at the end of the input string. +// formattedstring: if 'n' (default) it means that str is considered as a simple string (mputstr). +// if 'y' then str is considered formatted according to mfprint syntax +// +// Output data: +// --- +// #RNU_RES_E +// +// Status: +// 02-Jan-2006 -- Nutricato Raffaele: Author. +// 02-Jan-2006 -- Nutricato Raffaele: TEST OK. +// 02-May-2006 -- Nutricato Raffaele: Added ennewline. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,5); + +if argn(2) < 5 + formattedstring = 'n'; + if argn(2) < 4 + ennewline = 'y'; + if argn(2) < 3 + outputtype = 'stdout'; + if argn(2) < 2 + filename = ''; + if argn(2) < 1 + str = ''; + end + end + end + end +end +if (length(filename) == 0) then + outputtype = 'stdout'; // Prints only on the stdout. +end + +if (outputtype=='both') | (outputtype=='stdout') + disp(str) +end + +if (outputtype=='both') | (outputtype=='file') + if (ennewline=='y') + filenamefprintf(filename,'y',str,formattedstring); + else + filenamefprintf(filename,'n',str,formattedstring); + end +end + +endfunction diff --git a/macros/GeneralFunctions/ReadStringCard.sci b/macros/GeneralFunctions/ReadStringCard.sci new file mode 100644 index 00000000..5d9358ba --- /dev/null +++ b/macros/GeneralFunctions/ReadStringCard.sci @@ -0,0 +1,61 @@ +function cardvalue = ReadStringCard(filename,cardname,commentdelim,enableerror) +// function cardvalue = ReadStringCard(filename,cardname,commentdelim,enableerror) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Reads the string associated to the card cardname placed +// in filename. +// The value of cardname is assumed to be a string. +// If the card is not found an error will occur. +// +// Input data: +// filename: full path + name of the file where the card +// is being searched. +// cardname: string with the name of the card. +// commentdelim: specifies a character for an eventual comment +// (to be discarded) after the card value. +// enableerror: 'y' enable error message. +// 'n' enable warning message. +// +// Output data: +// cardvalue: string associated to the card. Blanks characters +// are discarded. +// #RNU_RES_E +// +// Status: +// 06-Feb-2004 -- Nutricato Raffaele: Author. +// 06-Feb-2004 -- Nutricato Raffaele: TEST OK. +// 25-Jun-2004 -- Nutricato Raffaele: Added Comment delimiter +// and enableerror as input parameter. +// 13-Apr-2007 -- Intelligente Fabio: Rewritten from Matlab to Scilab. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,3); + +if argn(2) == 2 then + commentdelim = ' '; + enableerror = 'y'; + +elseif argn(2) == 3 then + enableerror = 'y'; +end + +[flag_found,requested_line,dummy2] = ... + KeyString2FileStringPos(filename,cardname,'cut'); +cardvalue = stripblanks(strtok(requested_line,commentdelim)); +clear requested_line dummy2 + +if (flag_found == 0) then + if (enableerror == 'y') then + SCI2Cerror([cardname,' not found']); + else + warning([cardname,' not found']); + end +end + +endfunction diff --git a/macros/GeneralFunctions/SCI2CCreateDir.sci b/macros/GeneralFunctions/SCI2CCreateDir.sci new file mode 100644 index 00000000..cc152462 --- /dev/null +++ b/macros/GeneralFunctions/SCI2CCreateDir.sci @@ -0,0 +1,31 @@ +function SCI2CCreateDir(OutDir) +// function SCI2CCreateDir(OutDir) +// ----------------------------------------------------------------- +// Create the dir OutDir. +// +// Input data: +// OutDir: full path (absolute or relative) of the directory to be created. +// +// Output data: +// --- +// +// Status: +// 25-Jun-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +[tmppath,tmpfname,tmpextension]=fileparts(OutDir) ; + +status_dir = mkdir(tmppath,tmpfname+tmpextension) ; +if (status_dir == 0) + SCI2Cerror('Cannot create: '+OutDir); +end + +endfunction diff --git a/macros/GeneralFunctions/SCI2CFindFile.sci b/macros/GeneralFunctions/SCI2CFindFile.sci new file mode 100644 index 00000000..912a72a8 --- /dev/null +++ b/macros/GeneralFunctions/SCI2CFindFile.sci @@ -0,0 +1,41 @@ +function [FlagFound,SCIFileName] = SCI2CFindFile(PathList,FileName) +// function [FlagFound,SCIFileName] = SCI2CFindFile(PathList,FileName) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 11-Jul-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +FlagFound = 0; +SCIFileName = ''; + +// Perform the search in the user .sci files. +Nscipaths = size(PathList,1); +counterscipaths = 1; +while ((FlagFound == 0) & (counterscipaths <= Nscipaths)) + dirscifilename = PathList(counterscipaths); + fullpathscifilename = fullfile(dirscifilename,FileName); + if (SCI2Cfileexist(dirscifilename,FileName)) + // It is a function of the USER2C library. + FlagFound = 1; + SCIFileName = fullpathscifilename; + end + counterscipaths = counterscipaths + 1; +end + +endfunction diff --git a/macros/GeneralFunctions/SCI2CNInArgCheck.sci b/macros/GeneralFunctions/SCI2CNInArgCheck.sci new file mode 100644 index 00000000..23886fed --- /dev/null +++ b/macros/GeneralFunctions/SCI2CNInArgCheck.sci @@ -0,0 +1,28 @@ +function SCI2CNInArgCheck(NInArgs,MinNArgs,MaxNArgs) +// function SCI2CNInArgCheck(NInArgs,MinNArgs,MaxNArgs) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Check that NInArgs is in the range specified by MinNArgs and +// MaxNArgs. +// +// Input data: +// NInArgs: number of input arguments of the function under test. +// MinNArgs: minimum number of input arguments allowed. +// MaxNArgs: maximum number of input arguments allowed. +// +// Output data: +// --- +// #RNU_RES_E +// +// Status: +// 23-Nov-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato +// ----------------------------------------------------------------- + +if ((NInArgs < MinNArgs) | (NInArgs > MaxNArgs)) + SCI2Cerror('Incorrect number of input arguments.'); +end + + +endfunction diff --git a/macros/GeneralFunctions/SCI2COpenFileRead.sci b/macros/GeneralFunctions/SCI2COpenFileRead.sci new file mode 100644 index 00000000..1ad60ce5 --- /dev/null +++ b/macros/GeneralFunctions/SCI2COpenFileRead.sci @@ -0,0 +1,30 @@ +function fidnumber = SCI2COpenFileRead(filename) +// function fidnumber = SCI2COpenFileRead(filename) +// -------------------------------------------------------------------------------- +// Open a file in read mode. +// +// Input data: +// filename: path + name of the file to read. +// +// Output data: +// fidnumber: file identifier. +// +// Status: +// 27-Oct-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// --- Open the .sci file (read only). --- +[fidnumber,fiderror] = mopen(filename,'r'); +if (fiderror < 0) + SCI2Cerror(['Cannot open (in read mode): '+filename]); +end + +endfunction diff --git a/macros/GeneralFunctions/SCI2COpenFileWrite.sci b/macros/GeneralFunctions/SCI2COpenFileWrite.sci new file mode 100644 index 00000000..8a816b92 --- /dev/null +++ b/macros/GeneralFunctions/SCI2COpenFileWrite.sci @@ -0,0 +1,30 @@ +function fidnumber = SCI2COpenFileWrite(filename) +// function fidnumber = SCI2COpenFileWrite(filename) +// -------------------------------------------------------------------------------- +// Open a file in write mode. +// +// Input data: +// filename: path + name of the file to be written. +// +// Output data: +// fidnumber: file identifier. +// +// Status: +// 27-Oct-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// --- Open the .sci file (write mode). --- +[fidnumber,fiderror] = mopen(filename,'w'); +if (fiderror < 0) + SCI2Cerror(['Cannot open (in write mode): '+filename]); +end + +endfunction diff --git a/macros/GeneralFunctions/SCI2CTemplate.sci b/macros/GeneralFunctions/SCI2CTemplate.sci new file mode 100644 index 00000000..e47bdd00 --- /dev/null +++ b/macros/GeneralFunctions/SCI2CTemplate.sci @@ -0,0 +1,32 @@ +function out = SCI2CTemplate(in1,in2) +// function out = SCI2CTemplate(in1,in2) +// ----------------------------------------------------------------- +// This is a template function which shows how to comment functions. +// +// Input data: +// in1: input argument number 1 +// in2: input argument number 2 +// +// Output data: +// out: output argument number 1 +// +// Status: +// 03-Jan-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +endfunction diff --git a/macros/GeneralFunctions/SCI2Ccopyfile.sci b/macros/GeneralFunctions/SCI2Ccopyfile.sci new file mode 100644 index 00000000..f95c29ef --- /dev/null +++ b/macros/GeneralFunctions/SCI2Ccopyfile.sci @@ -0,0 +1,49 @@ +function SCI2Ccopyfile(InFileName,OutFileName,CopyMode) +// function SCI2Ccopyfile(InFileName,OutFileName,CopyMode) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Copy the contents of infile into outfile. Append mode is used. +// +// Input data: +// InFileName: path+filename of the input file. +// OutFileName: path+filename of the input file. +// CopyMode: 'append' or 'overwrite' +// #RNU_RES_E +// +// Output data: +// --- +// +// Status: +// 23-Nov-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),3,3); + +if (CopyMode == 'append') + // ------------------------ + // --- Open Input file. --- + // ------------------------ + fidIn = SCI2COpenFileRead(InFileName); + + // ------------------- + // --- Read lines. --- + // ------------------- + tmpline = mgetl(fidIn,1); + while (meof(fidIn) == 0) + PrintStringInfo(tmpline, OutFileName, 'file', 'y'); + tmpline = mgetl(fidIn,1); + end + mclose(fidIn); +elseif (CopyMode == 'overwrite') + PrintStringInfo(' ', OutFileName, 'file', 'y'); // Cannot use scilab copyfile when the directory is empty!. + copyfile(InFileName,OutFileName); +else + SCI2Cerror('Unknown CopyMode: ""'+CopyMode+'""'); +end + +endfunction diff --git a/macros/GeneralFunctions/SCI2Cerror.sci b/macros/GeneralFunctions/SCI2Cerror.sci new file mode 100644 index 00000000..25851a2a --- /dev/null +++ b/macros/GeneralFunctions/SCI2Cerror.sci @@ -0,0 +1,28 @@ +function SCI2Cerror(errorstring) +// function SCI2Cerror(errorstring) +// ----------------------------------------------------------------- +// It is the error function but before issuing the error, performs +// the mclose('all'); +// +// Input data: +// errorstring: string which specifies the error message. +// +// Output data: +// --- +// +// Status: +// 02-May-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + + +mclose('all') +error('###SCI2CERROR: '+errorstring); +endfunction diff --git a/macros/GeneralFunctions/SCI2CerrorFile.sci b/macros/GeneralFunctions/SCI2CerrorFile.sci new file mode 100644 index 00000000..29488876 --- /dev/null +++ b/macros/GeneralFunctions/SCI2CerrorFile.sci @@ -0,0 +1,29 @@ +function SCI2CerrorFile(errorstring,filename); +// function SCI2CerrorFile(errorstring,filename); +// ----------------------------------------------------------------- +// It is the error function but before issuing the error, performs +// the mclose('all'); It also write the error string into the +// file specified by filename. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 02-May-2006 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +mclose('all') +PrintStringInfo('Error: '+errorstring,filename,'both'); +error('####SCI2C_ERROR -> Read File: '+filename+'.'); +endfunction diff --git a/macros/GeneralFunctions/SCI2Cfileexist.sci b/macros/GeneralFunctions/SCI2Cfileexist.sci new file mode 100644 index 00000000..05dbf590 --- /dev/null +++ b/macros/GeneralFunctions/SCI2Cfileexist.sci @@ -0,0 +1,38 @@ +function ExistTest = SCI2Cfileexist(InDir,FileName) +// function ExistTest = SCI2Cfileexist(InDir,FileName) +// ----------------------------------------------------------------- +// Searches for the file FileName in the directory InDir. +// Return %F if it doesn't exist. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 12-Jun-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +tmppwd = pwd(); +cd(InDir); +allfiles = ls(FileName); +cd(tmppwd); + +if (size(allfiles,1) == 0) + ExistTest = %F; +elseif (size(allfiles,1) == 1) + ExistTest = %T; +else + SCI2Cerror('Very Strange! Found more than one file with the same name.'); +end + +endfunction diff --git a/macros/GeneralFunctions/SCI2Cflipud.sci b/macros/GeneralFunctions/SCI2Cflipud.sci new file mode 100644 index 00000000..2e988c1b --- /dev/null +++ b/macros/GeneralFunctions/SCI2Cflipud.sci @@ -0,0 +1,40 @@ +function OutputData = SCI2Cflipud(InputData) +// function OutputData = SCI2Cflipud(InputData) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Inverts (flips) the position of the arguments of InputData. +// Input data can be a struct or an array. +// Ex.: +// A(1) = 'one'; +// A(2) = 'two'; +// A(3) = 'three'; +// B = SCI2Cflipud(A); +// B(1) = 'three'; +// B(2) = 'two'; +// B(3) = 'one'; +// +// Input data: +// InputData: input array or structure. +// +// Output data: +// OutputData: flipped version of the input array. +// +// #RNU_RES_E +// Status: +// 12-May-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +NInputs = size(InputData,1); +OutputData = InputData; // To be sure that they will have the same structure. +for cnt = 1:NInputs + OutputData(cnt) = InputData(NInputs-cnt+1); +end +endfunction diff --git a/macros/GeneralFunctions/SCI2Cmdelete.sci b/macros/GeneralFunctions/SCI2Cmdelete.sci new file mode 100644 index 00000000..d19233dc --- /dev/null +++ b/macros/GeneralFunctions/SCI2Cmdelete.sci @@ -0,0 +1,33 @@ +function SCI2Cmdelete(InFile) +// function SCI2Cmdelete(InFile) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Deletes the input files only if the file really exists. +// This avoids the issuing of the error generated by mdelete. +// +// Input data: +// InFile: full path of the file to be deleted. +// +// Output data: +// #RNU_RES_E +// +// Status: +// 12-Apr-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +[Inx,Inierr]=fileinfo(InFile); +if Inierr == 0 + mdelete(InFile);//NUT: questa stampa a video il file che sta cancellando. + //NUT ho fatto delle altre prove e mi funzionava tutto. solo che quando + //NUT eseguo il codice scilab to c mi stampa a video tutto il nome del file. +end + +endfunction diff --git a/macros/GeneralFunctions/SCI2Cresize.sci b/macros/GeneralFunctions/SCI2Cresize.sci new file mode 100644 index 00000000..ba78fde0 --- /dev/null +++ b/macros/GeneralFunctions/SCI2Cresize.sci @@ -0,0 +1,33 @@ +function out = SCI2Cresize(in) +// function out = SCI2Cresize(in) +// ----------------------------------------------------------------- +// #RNU_RES_B +// It is a dummy function used by the programmer to specify at a given +// point that a variable is changing its size. This will be translated +// into C code by re-assigning the size array. +// Next releases of this function will include check to avoid +// increment of the size outside the limits specified by the first +// initialization of the variable. +// +// Input data: +// in: input variable to be resized +// +// Output data: +// out: resized variable +// +// #RNU_RES_E +// Status: +// 10-Jun-2008 -- Nutricato Raffaele: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +out = in; + +endfunction diff --git a/macros/GeneralFunctions/SCI2Cstring.sci b/macros/GeneralFunctions/SCI2Cstring.sci new file mode 100644 index 00000000..cf6d4370 --- /dev/null +++ b/macros/GeneralFunctions/SCI2Cstring.sci @@ -0,0 +1,34 @@ +function outstring = SCI2Cstring(innum) +// function outstring = SCI2Cstring(innum) +// ----------------------------------------------------------------- +// #RNU_RES_B +// It fixes the bug of string function when applied to +// exponential formats: +// Example: +// -->string(10e-10) +// ans = +// 1.000D-09 +// Note how the "D" is syntactically wrong. +// +// Input data: +// innnum: input number to be converted into string. +// +// Output data: +// outstring: string containing the conversion. +// #RNU_RES_E +// +// Status: +// 07-May-2008 -- Nutricato Raffaele: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +outstring=strsubst(string(innum),'D','e'); + +endfunction diff --git a/macros/GeneralFunctions/SCI2Cstrncmp.sci b/macros/GeneralFunctions/SCI2Cstrncmp.sci new file mode 100644 index 00000000..54a5e148 --- /dev/null +++ b/macros/GeneralFunctions/SCI2Cstrncmp.sci @@ -0,0 +1,27 @@ +function res = SCI2Cstrncmp(s1,s2,n) +// function res = SCI2Cstrncmp(s1,s2,n) +// ----------------------------------------------------------------- +// This function compares first n characters of strings s1 and s2. +// SCI2Cstrncmp(s1,s2,n) returns 1logical T (true) if the first n characters of +// the strings s1 and s2 are the same and logical 0 (false) otherwise. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 16-Apr-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),3,3); + +res = (part(s1,1:n) == part(s2,1:n)); +endfunction diff --git a/macros/GeneralFunctions/SCI2Cstrncmps1size.sci b/macros/GeneralFunctions/SCI2Cstrncmps1size.sci new file mode 100644 index 00000000..38e8c371 --- /dev/null +++ b/macros/GeneralFunctions/SCI2Cstrncmps1size.sci @@ -0,0 +1,32 @@ +function res = SCI2Cstrncmps1size(s1,s2); +// function res = SCI2Cstrncmps1size(s1,s2); +// ----------------------------------------------------------------- +// #RNU_RES_B +// This function compares first n characters of strings s1 and s2. +// n is the size of the string s1. +// SCI2Cstrncmps1size returns logical T (true) if the first n characters of +// the strings s1 and s2 are the same and logical 0 (false) otherwise. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// #RNU_RES_E +// Status: +// 16-Apr-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +n = length(s1); +res = (part(s1,1:n) == part(s2,1:n)); + +endfunction diff --git a/macros/GeneralFunctions/SizeInByte.sci b/macros/GeneralFunctions/SizeInByte.sci new file mode 100644 index 00000000..fa2d4f94 --- /dev/null +++ b/macros/GeneralFunctions/SizeInByte.sci @@ -0,0 +1,41 @@ +function SizeIn = SizeInByte(InDataType) +// function SizeIn = SizeInByte(InDataType) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Returns the size in bytes of the input data type. +// +// Input data: +// InDataType: input data type. It can be: +// 'float' +// 'double' +// 'floatComplex*' +// 'doubleComplex*' +// +// Output data: +// SizeIn: size in bytes of the input data type. +// +// #RNU_RES_E +// Status: +// 12-May-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +if (InDataType == 'float') + SizeIn = 4; +elseif (InDataType == 'double') + SizeIn = 8; +elseif (InDataType == 'floatComplex*') + SizeIn = 8; +elseif (InDataType == 'doubleComplex*') + SizeIn = 16; +else + error('Unknown data type: '+InDataType); +end +endfunction diff --git a/macros/GeneralFunctions/buildmacros.sce b/macros/GeneralFunctions/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/macros/GeneralFunctions/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/GeneralFunctions/dispina.sci b/macros/GeneralFunctions/dispina.sci new file mode 100644 index 00000000..dc07cddc --- /dev/null +++ b/macros/GeneralFunctions/dispina.sci @@ -0,0 +1,31 @@ +function dispina(instring); +// function dispina(instring); +// ----------------------------------------------------------------- +// Quista sacciu sulu iou comu funziona e a ce me serve. +// +// Input data: +// +// Output data: +// +// Status: +// 12-Apr-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +disp('++++++++++++++++++++++++++++++++++++++++++++++++++') +disp('++++++++++++++++++++++++++++++++++++++++++++++++++') +disp('++++++++++++++++++++++++++++++++++++++++++++++++++') +disp('++++++++++++++++++++++++++++++++++++++++++++++++++') +disp(instring); +disp('++++++++++++++++++++++++++++++++++++++++++++++++++') +disp('++++++++++++++++++++++++++++++++++++++++++++++++++') +disp('++++++++++++++++++++++++++++++++++++++++++++++++++') +disp('++++++++++++++++++++++++++++++++++++++++++++++++++') +endfunction diff --git a/macros/GeneralFunctions/filenamefprintf.sci b/macros/GeneralFunctions/filenamefprintf.sci new file mode 100644 index 00000000..0b64bd88 --- /dev/null +++ b/macros/GeneralFunctions/filenamefprintf.sci @@ -0,0 +1,48 @@ +function filenamefprintf(filename,ennewline,str,formattedstring) +// function filenamefprintf(filename,ennewline,str,formattedstring) +// -------------------------------------------------------------------------------- +// Uses the printf to print the string specified by varargin. filenamefprintf +// uses the filename instead of the fid parameter used by fprintf. +// Everytime filenamefprintf is called it +// opens the file, prints the string in it and then closes it. +// Opening is performed in read/append mode (at+). +// +// Input data: +// filename: string that specifies the name of the file. +// varargin are the input arguments for the printf. +// formattedstring: if 'n' (default) it means that str is considered as a simple string (mputstr). +// if 'y' then str is considered formatted according to mfprint syntax +// +// Output data: +// --- +// +// Status: +// 31-Jan-2006 -- Nutricato Raffaele: Author. +// 31-Jan-2006 -- Nutricato Raffaele: TEST OK. +// +// Copyright 2006 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),4,4); + + +// [FidReportFile, mess] = mopen(deblank(filename),'at+'); + [FidReportFile, mess] = mopen(filename,'a+'); + if (FidReportFile == -1) then + SCI2Cerror(mess); + end + if formattedstring == 'n' + mputstr(str,FidReportFile); + else + mfprintf(FidReportFile, str); + end + if ennewline=='y' then + mfprintf(FidReportFile,'\n'); + end + mclose(FidReportFile); + +endfunction diff --git a/macros/GeneralFunctions/float.sci b/macros/GeneralFunctions/float.sci new file mode 100644 index 00000000..634950b1 --- /dev/null +++ b/macros/GeneralFunctions/float.sci @@ -0,0 +1,26 @@ +function y = float(x) +// ----------------------------------------------------------------- +// Dummy function for float precision specifier. +// +// Input data: +// x: input array or scalar. +// +// Output data: +// y: output array or scalar. +// +// Status: +// 12-Apr-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + + +y = x; + +endfunction diff --git a/macros/GeneralFunctions/squeezestrings.sci b/macros/GeneralFunctions/squeezestrings.sci new file mode 100644 index 00000000..049476d1 --- /dev/null +++ b/macros/GeneralFunctions/squeezestrings.sci @@ -0,0 +1,31 @@ +function OutString = squeezestrings(InStringArray) +// function OutString = squeezestrings(InStringArray) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Converts an array of strings into a single string. +// +// Input data: +// InStringArray: Array of strings. +// +// Output data: +// OutString: Output string. +// +// #RNU_RES_E +// Status: +// 12-Apr-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +OutString = []; +for counterstrings = 1:max(size(InStringArray)) + OutString = OutString+InStringArray(counterstrings); +end + +endfunction diff --git a/macros/SymbolTable/ST_AnalyzeScope.sci b/macros/SymbolTable/ST_AnalyzeScope.sci new file mode 100644 index 00000000..bb38ea73 --- /dev/null +++ b/macros/SymbolTable/ST_AnalyzeScope.sci @@ -0,0 +1,124 @@ +function OutArg = ST_AnalyzeScope(OldOutArg,NOutArg,FileInfo,SharedInfo); +// function OutArg = ST_AnalyzeScope(OldOutArg,NOutArg,FileInfo,SharedInfo); +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),4,4); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Getting output arguments info from the symbol table***',ReportFileName,'file','y'); +// #RNU_RES_E + +OutArg = OldOutArg; +GlobalVarsFileName = FileInfo.GlobalVarFileName; +LocalVarsFileName = FileInfo.Funct(nxtscifunnumber).LocalVarFileName; +TempVarsFileName = FileInfo.Funct(nxtscifunnumber).TempVarFileName; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// #RNU_RES_B +// ------------------------------------------------------------------ +// --- Check if the out variables already exist in symbol tables. --- +// ------------------------------------------------------------------ +// #RNU_RES_E +for cntout = 1:NOutArg + // #RNU_RES_B + PrintStringInfo(' Symbol ""'+OutArg(cntout).Name+'""',ReportFileName,'file','y'); + // #RNU_RES_E + TBName = OutArg(cntout).Name; + + // #RNU_RES_B + // --- Check in temporary symbol table. --- + // #RNU_RES_E + SymbolTableFileName = TempVarsFileName; + [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension] = ... + ST_Get(TBName,SymbolTableFileName); + if (TBFlagfound == 0) + // #RNU_RES_B + PrintStringInfo(' ...not found in: '+SymbolTableFileName+'.',ReportFileName,'file','y'); + // #RNU_RES_E + else + SCI2CerrorFile('Found a temp symbol in '+SymbolTableFileName+... + ' with the same name of the equal output argument ""'+TBName+'"".',ReportFileName); + end + + // #RNU_RES_B + // --- Check in local symbol table. --- + // #RNU_RES_E + SymbolTableFileName = LocalVarsFileName; + [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension] = ... + ST_Get(TBName,SymbolTableFileName); + if (TBFlagfound == 0) + // #RNU_RES_B + PrintStringInfo(' ...not found in: '+SymbolTableFileName+'.',ReportFileName,'file','y'); + // #RNU_RES_E + else + // #RNU_RES_B + PrintStringInfo(' ...found in: '+SymbolTableFileName+'.',ReportFileName,'file','y'); + // #RNU_RES_E + OutArg(cntout).Scope = 'Local'; + end + + // #RNU_RES_B + // --- Check in global symbol table. --- + // #RNU_RES_E + if (TBFlagfound == 0) + // Local wins over global. + SymbolTableFileName = GlobalVarsFileName; + [TBFlagfound2,TBType,TBSize,TBValue,TBFindLike,TBDimension] = ... + ST_Get(TBName,SymbolTableFileName); + if (TBFlagfound2 == 0) + // #RNU_RES_B + PrintStringInfo(' ...not found in: '+SymbolTableFileName+'.',ReportFileName,'file','y'); + // #RNU_RES_E + if SCI2Cstrncmps1size(SharedInfo.ASTReader.TempVarsName,OutArg(cntout).Name) + OutArg(cntout).Scope = 'Temp'; + else + OutArg(cntout).Scope = 'Local'; + end + else + // #RNU_RES_B + PrintStringInfo(' ...found in: '+SymbolTableFileName+'.',ReportFileName,'file','y'); + // #RNU_RES_E + OutArg(cntout).Scope = 'Global'; + end + end + + // #RNU_RES_B + PrintStringInfo(' Type: '+OutArg(cntout).Type,ReportFileName,'file','y'); + PrintStringInfo(' Size(1): '+string(OutArg(cntout).Size(1)),ReportFileName,'file','y'); + PrintStringInfo(' Size(2): '+string(OutArg(cntout).Size(2)),ReportFileName,'file','y'); + PrintStringInfo(' Value: '+string(OutArg(cntout).Value),ReportFileName,'file','y'); + PrintStringInfo(' FindLike: '+string(OutArg(cntout).FindLike),ReportFileName,'file','y'); + PrintStringInfo(' Dimension: '+string(OutArg(cntout).Dimension),ReportFileName,'file','y'); + PrintStringInfo(' Scope: '+string(OutArg(cntout).Scope),ReportFileName,'file','y'); + PrintStringInfo(' ',ReportFileName,'file','y'); + // #RNU_RES_E +end + +endfunction diff --git a/macros/SymbolTable/ST_Del.sci b/macros/SymbolTable/ST_Del.sci new file mode 100644 index 00000000..6401a2b5 --- /dev/null +++ b/macros/SymbolTable/ST_Del.sci @@ -0,0 +1,41 @@ +function ST_Del(TBName,SymbolTableFileName) +// function ST_Del(TBName,SymbolTableFileName) +// ----------------------------------------------------------------- +// Delete function for the symbol table. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// --- Load symbol table. --- +SCI2CSymbolTable = ST_Load(SymbolTableFileName); + +// --- Find symbol position. --- +[TBFlagfound,TBPosition] = ST_FindPos(TBName,SymbolTableFileName); + +if (TBFlagfound == 0) + SCI2Cerror('Missing symbol: trying to del a non existing symbol ""'+TBName+'"".'); +elseif (TBFlagfound == 1) + // --- Update symbol table. --- + SCI2CSymbolTable(TBPosition) = []; + + // --- Save symbol table. --- + ST_Save(SymbolTableFileName,SCI2CSymbolTable); +end + +endfunction diff --git a/macros/SymbolTable/ST_FindPos.sci b/macros/SymbolTable/ST_FindPos.sci new file mode 100644 index 00000000..bfba11d1 --- /dev/null +++ b/macros/SymbolTable/ST_FindPos.sci @@ -0,0 +1,46 @@ +function [TBFlagfound,TBPosition] = ST_FindPos(TBName,SymbolTableFileName) +// function [TBFlagfound,TBPosition] = ST_FindPos(TBName,SymbolTableFileName) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Finds position of symbol TBName in the symbol table. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// #RNU_RES_E +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// --- Load symbol table. --- +SCI2CSymbolTable = ST_Load(SymbolTableFileName); + +// --- Find position of the line to be removed. --- +TBFlagfound = 0; +TBPosition = 0; +NEntries = max(size(SCI2CSymbolTable)); +for countertable = 1:NEntries + if (mtlb_strcmp(TBName,SCI2CSymbolTable(countertable).Name)) + TBFlagfound = TBFlagfound + 1; + TBPosition = countertable; + end +end + +if (TBFlagfound > 1) + SCI2Cerror('Symbol table conflict: found two symbols with the same name ""'+TBName+'"".'); +end + +endfunction diff --git a/macros/SymbolTable/ST_Get.sci b/macros/SymbolTable/ST_Get.sci new file mode 100644 index 00000000..ca53fc07 --- /dev/null +++ b/macros/SymbolTable/ST_Get.sci @@ -0,0 +1,66 @@ +function [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension] = ... + ST_Get(Field_Name,SymbolTableFileName) +// function [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension] = ... +// ST_Get(Field_Name,SymbolTableFileName) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Get function for the symbol table. +// +// #RNU_RES_E +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// -------------------------- +// --- Load Symbol Table. --- +// -------------------------- +[tmpnams,tmptyps,tmpdims,tmpvols]=listvarinfile(SymbolTableFileName); +if (max(size(tmpnams)) > 1) + SCI2Cerror('More than one variable found in ""'+SymbolTableFileName+'"".'); +end +load(SymbolTableFileName,tmpnams); +SCI2CSymbolTable = eval(tmpnams); +// ------------------------------ +// --- End Load Symbol Table. --- +// ------------------------------ + +TBFlagfound = 0; +TBType = ''; +TBSize(1) = ''; +TBSize(2) = ''; +TBValue = %nan; +TBFindLike = %nan; +TBDimension = %nan; +if (TBFlagfound == 0) + NEntries = max(size(SCI2CSymbolTable)); + for countertable = 1:NEntries + if (mtlb_strcmp(Field_Name,SCI2CSymbolTable(countertable).Name)) + TBFlagfound = TBFlagfound + 1; + TBType = SCI2CSymbolTable(countertable).Type; // String + TBSize = SCI2CSymbolTable(countertable).Size; // String + TBValue = SCI2CSymbolTable(countertable).Value; + TBFindLike = SCI2CSymbolTable(countertable).FindLike; // Number: 0 or 1. + TBDimension = SCI2CSymbolTable(countertable).Dimension; // Number: 0 or 1 or 2. + end + end +end + +if (TBFlagfound > 1) + SCI2Cerror('Symbol table conflict: found two symbols with the same name ""'+TBName+'"".'); +end +endfunction diff --git a/macros/SymbolTable/ST_GetInArgInfo.sci b/macros/SymbolTable/ST_GetInArgInfo.sci new file mode 100644 index 00000000..56997e54 --- /dev/null +++ b/macros/SymbolTable/ST_GetInArgInfo.sci @@ -0,0 +1,162 @@ +function [UpdatedInArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo) +// function UpdatedInArg = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Generate all the info concerning the input arguments. +// +// Input data: +// InArg: InArg structure containing only the names of the input +// arguments. +// //NUT: add description here +// +// Output data: +// UpdatedInArg: InArg structure with all the info on the input +// arguments. +// FileInfoDatFile: name of the .dat file containing the FileInfo +// structure. +// #RNU_RES_E +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),4,4); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Analyzing Input Arguments***',ReportFileName,'file','y'); +// #RNU_RES_E + +UpdatedInArg = InArg; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +for cntinarg = 1:NInArg + tmpname = InArg(cntinarg).Name; + tmpscope = InArg(cntinarg).Scope; + lengthNumber = length('Number_'); + if (part(tmpscope,1:lengthNumber) == 'Number_') + // #RNU_RES_B + PrintStringInfo('Input Argument '+string(cntinarg)+' is a number: '+tmpname+'.',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + // #RNU_RES_E + UpdatedInArg(cntinarg).Type = part(tmpscope,lengthNumber+1:lengthNumber+1); + if (UpdatedInArg(cntinarg).Type == 'x') + UpdatedInArg(cntinarg).Type = SharedInfo.DefaultPrecision; // It is the default. + elseif (UpdatedInArg(cntinarg).Type == 'X') + if (SharedInfo.DefaultPrecision == 's') + UpdatedInArg(cntinarg).Type = 'c'; // It is the default. + elseif (SharedInfo.DefaultPrecision == 'd') + UpdatedInArg(cntinarg).Type = 'z'; // It is the default. + else + SCI2Cerror('Unexpected value for SharedInfo.DefaultPrecision: ""'+SharedInfo.DefaultPrecision+'""'); + end + end + if (tmpname == '%pi') + UpdatedInArg(cntinarg).Name = 'SCI2C_PI'; + numvalue = %pi; + elseif (tmpname == '%e') + UpdatedInArg(cntinarg).Name = 'SCI2C_E'; + numvalue = %e; + elseif (tmpname == '%T' | tmpname == '%t') + UpdatedInArg(cntinarg).Name = 'SCI2C_T'; + numvalue = 1; + elseif (tmpname == '%F' | tmpname == '%f') + UpdatedInArg(cntinarg).Name = 'SCI2C_F'; + numvalue = 0; + elseif (tmpname == '%nan') + UpdatedInArg(cntinarg).Name = 'SCI2C_NAN'; + numvalue = %nan; + elseif (tmpname == '%inf') + UpdatedInArg(cntinarg).Name = 'SCI2C_INF'; + numvalue = %nan; // Otherwise it will put in the C code Inf value. + elseif (tmpname == '%i') + // #RNU_RES_B + //NUT: Other complex numbers are always + //NUT: stored in variables, and don't appear as immediate numbers. + // #RNU_RES_E + UpdatedInArg(cntinarg).Name = 'SCI2C_IMG_'+convstr(UpdatedInArg(cntinarg).Type,'u'); + numvalue = %i; + else + numvalue = eval(tmpname); + //UpdatedInArg(cntinarg).Type = 'd'; // it is the default. + end + + UpdatedInArg(cntinarg).Size(1) = '1'; + UpdatedInArg(cntinarg).Size(2) = '1'; + UpdatedInArg(cntinarg).Value = numvalue; + UpdatedInArg(cntinarg).FindLike = 0; + UpdatedInArg(cntinarg).Dimension = 0; + UpdatedInArg(cntinarg).Scope = 'Number'; + + elseif (tmpscope == 'String') + // #RNU_RES_B + PrintStringInfo('Input Argument '+string(cntinarg)+' is a string: '+tmpname+'.',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + // #RNU_RES_E + SharedInfo.ASTReader.UsedTempVars = SharedInfo.ASTReader.UsedTempVars + 1; + TmpOutArgName = strcat([SharedInfo.ASTReader.TempVarsName,string(SharedInfo.ASTReader.UsedTempVars)]); + + UpdatedInArg(cntinarg).Name = TmpOutArgName; // Change the name. + UpdatedInArg(cntinarg).Type = 'g'; // it is the default. + UpdatedInArg(cntinarg).Size(1) = '1'; + UpdatedInArg(cntinarg).Size(2) = string(length(tmpname)+1); //+1 = (\0) + UpdatedInArg(cntinarg).Value = '""'+tmpname+'""'; + UpdatedInArg(cntinarg).FindLike = 0; + UpdatedInArg(cntinarg).Dimension = 2; //NUT: in future releases you can set this field to 1. + UpdatedInArg(cntinarg).Scope = 'Temp'; + + // #RNU_RES_B + // Add the new symbol in the symbol table. + // #RNU_RES_E + ST_InsOutArg(UpdatedInArg(cntinarg),1,FileInfo,SharedInfo,'all'); + + elseif (tmpscope == 'Variable' | tmpscope == 'Global' | tmpscope == 'Local' | tmpscope == 'Temp') + // #RNU_RES_B + //NUT: nelle future versioni qui si puo' fare una utile differenziazione per rendere piu' intelligente il tutto. + PrintStringInfo('Input Argument '+string(cntinarg)+' is a symbol: '+tmpname+'.',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + // #RNU_RES_E + [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension,TBScope] = ST_GetSymbolInfo(tmpname,FileInfo,SharedInfo); + if (TBFlagfound == 0) + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Unknown symbol ""'+tmpname+'"".',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Be sure to initialize every symbol you are using.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Before running the SCI2C translator, remember to run the code you are trying',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: to translate in order to check syntax errors.',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); + end + UpdatedInArg(cntinarg).Type = TBType; + UpdatedInArg(cntinarg).Size = TBSize; + UpdatedInArg(cntinarg).Value = TBValue; + UpdatedInArg(cntinarg).FindLike = TBFindLike; + UpdatedInArg(cntinarg).Dimension = TBDimension; + UpdatedInArg(cntinarg).Scope = TBScope; + + else + SCI2Cerror('Unknown scope identifier ""'+tmpscope+'"" for variable ""'+tmpname+'"".'); + end + // #RNU_RES_B + PrintStringInfo(' Type: '+UpdatedInArg(cntinarg).Type,FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + PrintStringInfo(' Size(1): '+string(UpdatedInArg(cntinarg).Size(1)),FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + PrintStringInfo(' Size(2): '+string(UpdatedInArg(cntinarg).Size(2)),FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + PrintStringInfo(' Value: '+string(UpdatedInArg(cntinarg).Value),FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + PrintStringInfo(' FindLike: '+string(UpdatedInArg(cntinarg).FindLike),FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + PrintStringInfo(' Dimension: '+string(UpdatedInArg(cntinarg).Dimension),FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + PrintStringInfo(' Scope: '+UpdatedInArg(cntinarg).Scope,FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + // #RNU_RES_E +end + +endfunction diff --git a/macros/SymbolTable/ST_GetSymbolInfo.sci b/macros/SymbolTable/ST_GetSymbolInfo.sci new file mode 100644 index 00000000..1fb2f3de --- /dev/null +++ b/macros/SymbolTable/ST_GetSymbolInfo.sci @@ -0,0 +1,99 @@ +function [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension,TBScope] = ST_GetSymbolInfo(TBName,FileInfo,SharedInfo) +// function [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension,TBScope] = ST_GetSymbolInfo(TBName,FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),3,3); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +// --- Extraction of the function name and number. --- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; + +GlobalVarsFileName = FileInfo.GlobalVarFileName; +LocalVarsFileName = FileInfo.Funct(nxtscifunnumber).LocalVarFileName; +TempVarsFileName = FileInfo.Funct(nxtscifunnumber).TempVarFileName; + +TBFlagfound = 0; +TBType = ''; +TBSize(1) = ''; +TBSize(2) = ''; +TBValue = %nan +TBFindLike = %nan +TBDimension = %nan; +TBScope = ''; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// #RNU_RES_B +// ------------------------------------------------ +// --- Search in the temporary variables table. --- +// ------------------------------------------------ +PrintStringInfo('Searching ""'+TBName+'"" in '+FileInfo.Funct(nxtscifunnumber).TempVarFileName+'.',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); +// #RNU_RES_E +[TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension] = ... + ST_Get(TBName,TempVarsFileName); +if (TBFlagfound == 1); + // #RNU_RES_B + PrintStringInfo('...Found in: ""'+FileInfo.Funct(nxtscifunnumber).TempVarFileName+'.',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + // #RNU_RES_E + TBScope = 'Temp'; +end + +// -------------------------------------------- +// --- Search in the local variables table. --- +// -------------------------------------------- +if (TBFlagfound == 0); + // #RNU_RES_B + PrintStringInfo('Searching ""'+TBName+'"" in '+FileInfo.Funct(nxtscifunnumber).LocalVarFileName+'.',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + // #RNU_RES_E + [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension] = ... + ST_Get(TBName,LocalVarsFileName); + if (TBFlagfound == 1); + // #RNU_RES_B + PrintStringInfo('...Found in: ""'+FileInfo.Funct(nxtscifunnumber).LocalVarFileName+'.',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + // #RNU_RES_E + TBScope = 'Local'; + end +end + +// #RNU_RES_B +// --------------------------------------------- +// --- Search in the global variables table. --- +// --------------------------------------------- +// #RNU_RES_E +if (TBFlagfound == 0); + // #RNU_RES_B + PrintStringInfo('Searching ""'+TBName+'"" in '+FileInfo.GlobalVarFileName+'.',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + // #RNU_RES_E + [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension] = ... + ST_Get(TBName,GlobalVarsFileName); + if (TBFlagfound == 1); + // #RNU_RES_B + PrintStringInfo('...Found in: ""'+FileInfo.GlobalVarFileName+'.',FileInfo.Funct(nxtscifunnumber).ReportFileName,'file'); + // #RNU_RES_E + TBScope = 'Global'; + end +end + +endfunction diff --git a/macros/SymbolTable/ST_InsForCntVars.sci b/macros/SymbolTable/ST_InsForCntVars.sci new file mode 100644 index 00000000..b0e6f356 --- /dev/null +++ b/macros/SymbolTable/ST_InsForCntVars.sci @@ -0,0 +1,191 @@ +function [OutArg,SharedInfo] = ST_InsForCntVars(InArg,NInArg,OutArg,NOutArg,FunctionName,FileInfo,SharedInfo) +// function [OutArg,SharedInfo] = ST_InsForCntVars(InArg,NInArg,OutArg,NOutArg,FunctionName,FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),7,7); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Checking if the current function is handling for counter variables.***',ReportFileName,'file','y'); +// #RNU_RES_E + +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// ----------------------------------------------- +// --- Initial Check on For counter variables. --- +// ----------------------------------------------- +if ((SharedInfo.ForExpr.OnExec > 0) & (NOutArg==1) & (OutArg.Scope~='Temp')) + // #RNU_RES_B + // If we are here, for sure we are in the last assignment of a for loop expression. + // + // All the following cases must be handled: + // OpColon (1,10,cnt) or Opcolon (1,1,10,cnt) --> cnt must be redefined to dim=0 + // cnt = a; where a is scalar + // OpEqual(TMP,cnt); where TMP is matrix --> cnt must be redefined to dim=0, a SCI2Cint counter must be generated + // Fun(TMP,cnt); where TMP is matrix.--> cnt must be redefined to dim=0, a SCI2Cint counter must be generated, CNT must be generated where CNT is a Matrix + // #RNU_RES_E + if (FunctionName == 'OpColon') + // #RNU_RES_B + PrintStringInfo(' The for expression is using an OpColon-based assignment',ReportFileName,'file','y'); + // #RNU_RES_E + SharedInfo.SkipNextFun = 1; + + OutArg.Size(1) = '1'; + OutArg.Size(2) = '1'; + OutArg.Value = %nan; + OutArg.FindLike = 0; + OutArg.Dimension = 0; + SharedInfo.ForExpr.OpColonInfoIn1 = InArg(1).Name; + + if (NInArg == 2) + SharedInfo.ForExpr.OpColonInfoIn2 = '1'; + SharedInfo.ForExpr.OpColonInfoIn3 = InArg(2).Name; + else + SharedInfo.ForExpr.OpColonInfoIn2 = InArg(2).Name; + if isnan(InArg(2).Value) + EM_UnknownStep(ReportFileName); + end + + SharedInfo.ForExpr.OpColonInfoIn3 = InArg(3).Name; + end + + // #RNU_RES_B + // Generate all info to generate the C for expression + // #RNU_RES_E + SharedInfo.ForExpr.AssignmentFun = SharedInfo.CFunId.OpColon; + SharedInfo.ForExpr.IntCntArg = []; + SharedInfo.ForExpr.MtxValCntArg = []; + SharedInfo.ForExpr.SclValCntArg = OutArg; + + elseif ((FunctionName == 'OpEqual') & (SharedInfo.ForExpr.AssignmentFun == 0)) + // #RNU_RES_B + //NUT: Test also that SharedInfo.ForExpr.AssignmentFun because sometimes Equal are dummy! + //NUT: verifica se e' giusta questa mia affermazione. + // #RNU_RES_E + if (OutArg.Dimension > 0) + // #RNU_RES_B + PrintStringInfo(' The for expression is using a Matrix-Equal-based assignment',ReportFileName,'file','y'); + // #RNU_RES_E + SharedInfo.SkipNextFun = 1; //NUT: forse qui sarebbe meglio mettere uno skipnextequal per precisione. + // #RNU_RES_B + //NUT: a dire il vero occorre capire se c'e' differenza tra i vari skip. + // #RNU_RES_E + OutArg.Size(1) = '1'; + OutArg.Size(2) = '1'; + OutArg.Value = %nan; + OutArg.FindLike = 0; + OutArg.Dimension = 0; + + // #RNU_RES_B + // Introduce the int counter variable. + // #RNU_RES_E + NNewArg = 1; + NewArg(NNewArg).Name = SharedInfo.ASTReader.TempForCntVarsName+string(SharedInfo.CountForTempVars); + SharedInfo.CountForTempVars = SharedInfo.CountForTempVars + 1; + NewArg(NNewArg).Size(1) = '1'; + NewArg(NNewArg).Size(2) = '1'; + NewArg(NNewArg).Type = 'i'; + NewArg(NNewArg).Value = 0; + NewArg(NNewArg).FindLike = 0; + NewArg(NNewArg).Dimension = 0; + NewArg(NNewArg).Scope = 'Temp'; + + // #RNU_RES_B + // Insert New Arguments in the symbol table. + // #RNU_RES_E + NNewArg = 1; + ST_InsOutArg(NewArg,NNewArg,FileInfo,SharedInfo,'all'); + + // #RNU_RES_B + // Generate all info to generate the C for expression + // #RNU_RES_E + SharedInfo.ForExpr.AssignmentFun = SharedInfo.CFunId.EqMatrix; + SharedInfo.ForExpr.IntCntArg = NewArg(1); + SharedInfo.ForExpr.MtxValCntArg = InArg(1); + SharedInfo.ForExpr.SclValCntArg = OutArg; + else + // #RNU_RES_B + PrintStringInfo(' The for expression is using a Scalar-Equal-based assignment',ReportFileName,'file','y'); + // #RNU_RES_E + SharedInfo.ForExpr.AssignmentFun = SharedInfo.CFunId.EqScalar; + end + else + if (OutArg.Dimension > 0) + // #RNU_RES_B + PrintStringInfo(' The for expression is using a Matrix-Function-based assignment',ReportFileName,'file','y'); + + // Introduce the val counter variable. + // #RNU_RES_E + NewArg = OutArg; + OutArg.Name = SharedInfo.ASTReader.TempForValVarsName+OutArg.Name; + + // #RNU_RES_B + // Set the counter variable to scalar. + // #RNU_RES_E + NNewArg = 1; + NewArg(NNewArg).Size(1) = '1'; + NewArg(NNewArg).Size(2) = '1'; + NewArg(NNewArg).Value = %nan; + NewArg(NNewArg).FindLike = 0; + NewArg(NNewArg).Dimension = 0; + + // #RNU_RES_B + // Introduce the int counter variable. + // #RNU_RES_E + NNewArg = 2; + NewArg(NNewArg).Name = SharedInfo.ASTReader.TempForCntVarsName+string(SharedInfo.CountForTempVars); + SharedInfo.CountForTempVars = SharedInfo.CountForTempVars + 1; + NewArg(NNewArg).Size(1) = '1'; + NewArg(NNewArg).Size(2) = '1'; + NewArg(NNewArg).Type = 'i'; + NewArg(NNewArg).Value = 0; + NewArg(NNewArg).FindLike = 0; + NewArg(NNewArg).Dimension = 0; + NewArg(NNewArg).Scope = 'Temp'; + + // #RNU_RES_B + // Insert New Arguments in the symbol table. + // #RNU_RES_E + NNewArg = 2; + ST_InsOutArg(NewArg,NNewArg,FileInfo,SharedInfo,'all'); + + // #RNU_RES_B + // Generate all info to generate the C for expression + // #RNU_RES_E + SharedInfo.ForExpr.AssignmentFun = SharedInfo.CFunId.GenFunMtx; + SharedInfo.ForExpr.IntCntArg = NewArg(2); + SharedInfo.ForExpr.MtxValCntArg = OutArg(1); + SharedInfo.ForExpr.SclValCntArg = NewArg(1); + end + end +end + +endfunction diff --git a/macros/SymbolTable/ST_InsOutArg.sci b/macros/SymbolTable/ST_InsOutArg.sci new file mode 100644 index 00000000..c6051772 --- /dev/null +++ b/macros/SymbolTable/ST_InsOutArg.sci @@ -0,0 +1,187 @@ +function ST_InsOutArg(OutArg,NOutArg,FileInfo,SharedInfo,MatchRule) +// function ST_InsOutArg(OutArg,NOutArg,FileInfo,SharedInfo,MatchRule) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),5,5); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +CDeclarationFileName = FileInfo.Funct(nxtscifunnumber).CDeclarationFileName; +CGblDeclarFileName = FileInfo.Funct(nxtscifunnumber).CGblDeclarFileName; + +GlobalVarsFileName = FileInfo.GlobalVarFileName; +LocalVarsFileName = FileInfo.Funct(nxtscifunnumber).LocalVarFileName; +TempVarsFileName = FileInfo.Funct(nxtscifunnumber).TempVarFileName; + +CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName; +CPass1FreeFileName = FileInfo.Funct(nxtscifunnumber).CPass1FreeFileName; + + +// #RNU_RES_B +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Putting output arguments in the symbol table***',ReportFileName,'file','y','n'); +// #RNU_RES_E +// --------------------------- +// --- End Initialization. --- +// --------------------------- + + +for counteroutput = 1:NOutArg + // #RNU_RES_B + PrintStringInfo(' Symbol ""'+OutArg(counteroutput).Name+'""',ReportFileName,'file','y','n'); + PrintStringInfo(' Type: '+OutArg(counteroutput).Type,ReportFileName,'file','y','n'); + PrintStringInfo(' Size(1): '+string(OutArg(counteroutput).Size(1)),ReportFileName,'file','y','n'); + PrintStringInfo(' Size(2): '+string(OutArg(counteroutput).Size(2)),ReportFileName,'file','y','n'); + PrintStringInfo(' Value: '+string(OutArg(counteroutput).Value),ReportFileName,'file','y','n'); + PrintStringInfo(' FindLike: '+string(OutArg(counteroutput).FindLike),ReportFileName,'file','y','n'); + PrintStringInfo(' Dimension: '+string(OutArg(counteroutput).Dimension),ReportFileName,'file','y','n'); + PrintStringInfo(' Scope: '+string(OutArg(counteroutput).Scope),ReportFileName,'file','y','n'); + PrintStringInfo(' ',ReportFileName,'file','y','n'); + // #RNU_RES_E + + if mtlb_strcmp(OutArg(counteroutput).Scope,'Temp') + SymbTableFileName = TempVarsFileName; + elseif mtlb_strcmp(OutArg(counteroutput).Scope,'Local') + SymbTableFileName = LocalVarsFileName; + elseif mtlb_strcmp(OutArg(counteroutput).Scope,'Global') + SymbTableFileName = GlobalVarsFileName; + else + SCI2Cerror('Unknown scope ""'+OutArg(counteroutput).Scope+'"" for symbol: '+OutArg(counteroutput).Name); + end + // #RNU_RES_B + PrintStringInfo(' Setting symbol ""'+OutArg(counteroutput).Name+'"" in '+SymbTableFileName+'.',ReportFileName,'file','y'); + // #RNU_RES_E + + // #RNU_RES_B + // Check existence and conflicts in the symbol table. + // Here we have four possibilities: + // 1. the symbol is a global variable not initialized yet -> we have to initialize it. + // 2. the symbol already exists with different settings -> we have to issue an error. + // 3. the symbol already exists with the same settings -> ok, we don't have to do nothing. + // 4. the symbol doesn't exist -> we have to insert it into the table. + // #RNU_RES_E + [TBFlagfound,TBFlagEqualSymbols] = ... + ST_MatchSymbol(OutArg(counteroutput).Name,... + OutArg(counteroutput).Type,... + OutArg(counteroutput).Size,... + OutArg(counteroutput).Value,... + OutArg(counteroutput).FindLike,... + OutArg(counteroutput).Dimension,... + SymbTableFileName,MatchRule); + + if (TBFlagfound == 1) + if (TBFlagEqualSymbols == 0) + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Symbol Table Conflict. Trying to insert again symbol ""'+... + OutArg(counteroutput).Name+'"" with different settings',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Please check that you are not using variable ""'+OutArg(counteroutput).Name+'""',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: with different sizes and/or types.',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); + else + // #RNU_RES_B + // It's ok symbols do match. + //NUT: forse occorre un altro check sulla size per capire se occore fare il malloc. + //NUT: qui entro anche quando ho una variabile global gia' dichiarata tale in un altro + //NUT: per cui devo dichiararala come external. + //RNU qui ci puoi mettere una warning quando stai riallocando uno stesso simbolo con size simbolica. + //RNU puoi anche aggiungere del codice in c o un semplice commento. per esempio una funzione c del tipo checksize che controlla il valore + //RNU prima dopo delle size di una data variabile. Cosa succede se cambio la size anche nel caso di array e approccio + //RNU di resize non attivo? L'unica cosa e' che molte size numeriche scompaiono e incomincio a creare numerose variabili + //RNU con size simbolica. + + // If the symbol is scalar we update its value if it is an array we update its size + // only in case we are using the 'REALLOC_ALL_RESIZE_ALL' resize approach + // #RNU_RES_E + if ((GetSymbolDimension(OutArg(counteroutput).Size)) == 0 | (SharedInfo.ResizeApproach=='REALLOC_ALL_RESIZE_ALL')) + ST_Set(OutArg(counteroutput).Name,... + OutArg(counteroutput).Type,... + OutArg(counteroutput).Size,... + OutArg(counteroutput).Value,... + OutArg(counteroutput).FindLike,... + OutArg(counteroutput).Dimension,... + SymbTableFileName); + end + end + elseif (TBFlagfound == 2) + // #RNU_RES_B + // We have a non-initialized global variable. + // Set the non-initialized global variable. + PrintStringInfo(' Found a non-initialized global variable.',ReportFileName,'file','y'); + // #RNU_RES_E + ST_Set(OutArg(counteroutput).Name,... + OutArg(counteroutput).Type,... + OutArg(counteroutput).Size,... + OutArg(counteroutput).Value,... + OutArg(counteroutput).FindLike,... + OutArg(counteroutput).Dimension,... + SymbTableFileName); + IndentLevel = 0; //NUT: forced always to 1 + FlagExt = 0; + C_GenDeclarations(OutArg(counteroutput),CGblDeclarFileName,IndentLevel,ReportFileName,FlagExt,SharedInfo.ResizeApproach); + IndentLevelMalloc = SharedInfo.NIndent; + // #RNU_RES_B + //RNU da verificare bene qui. Cio' che si verifica e' che se la size della globale e' simbolica + //RNU allora si assume che essa sia da allocare come puntatore e poi realloc. + // #RNU_RES_E + C_MemAllocOutTempVars(OutArg(counteroutput),1,CPass1FileName,CPass1FreeFileName,IndentLevelMalloc,ReportFileName,SharedInfo.ResizeApproach); + else + if (OutArg(counteroutput).FindLike == 1) + // #RNU_RES_B + // In presence of find-like functions the size must be always symbolic. + // Don't change here the value of OutArg.Size because the first time + // I need them to declare the OutArg variable with the values assumed by OutArg.Size. + // #RNU_RES_E + TmpOutArgSize(1) = '__'+OutArg(counteroutput).Name+'Size[0]'; + TmpOutArgSize(2) = '__'+OutArg(counteroutput).Name+'Size[1]'; + else + TmpOutArgSize(1) = OutArg(counteroutput).Size(1); + TmpOutArgSize(2) = OutArg(counteroutput).Size(2); + end + // #RNU_RES_B + // Set a new symbol. + // #RNU_RES_E + ST_Set(OutArg(counteroutput).Name,... + OutArg(counteroutput).Type,... + TmpOutArgSize,... + OutArg(counteroutput).Value,... + OutArg(counteroutput).FindLike,... + OutArg(counteroutput).Dimension,... + SymbTableFileName); + IndentLevelDeclaration = 1; //NUT: per ora lo forzo sempre a 1 + IndentLevelMalloc = SharedInfo.NIndent; + FlagExt = 0; + C_GenDeclarations(OutArg(counteroutput),CDeclarationFileName,IndentLevelDeclaration,ReportFileName,FlagExt,SharedInfo.ResizeApproach); + // #RNU_RES_B + //RNU aggiunta qui in modo che le malloc saranno fatte una sola volta: + //RNU verifica che tutto funzioni e chi altro usa la C_MemAlloc per capire se si puo' ottimizzare per questo stadio. + // #RNU_RES_E + C_MemAllocOutTempVars(OutArg(counteroutput),1,CPass1FileName,CPass1FreeFileName,IndentLevelMalloc,ReportFileName,SharedInfo.ResizeApproach); + end + +end + +endfunction diff --git a/macros/SymbolTable/ST_Load.sci b/macros/SymbolTable/ST_Load.sci new file mode 100644 index 00000000..fc99ff3c --- /dev/null +++ b/macros/SymbolTable/ST_Load.sci @@ -0,0 +1,36 @@ +function SCI2CSymbolTable = ST_Load(SymbolTableFileName) +// function SCI2CSymbolTable = ST_Load(SymbolTableFileName) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Load a symbol table stored into a .dat file. +// #RNU_RES_E +// +// Input data: +// //NUT: add description here +// +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// -------------------------- +// --- Load Symbol Table. --- +// -------------------------- +[tmpnams,tmptyps,tmpdims,tmpvols]=listvarinfile(SymbolTableFileName); +if (max(size(tmpnams)) > 1) + SCI2Cerror('More than one variable found in ""'+SymbolTableFileName+'"".'); +end +load(SymbolTableFileName,tmpnams); +SCI2CSymbolTable = eval(tmpnams); +// ------------------------------ +// --- End Load Symbol Table. --- +// ------------------------------ + +endfunction diff --git a/macros/SymbolTable/ST_MatchSymbol.sci b/macros/SymbolTable/ST_MatchSymbol.sci new file mode 100644 index 00000000..20f0bbe8 --- /dev/null +++ b/macros/SymbolTable/ST_MatchSymbol.sci @@ -0,0 +1,70 @@ +function [TBFlagfound,TBFlagEqualSymbols] = ST_MatchSymbol(TBName,TBType,TBSize,TBValue,TBFindLike,TBDimension,SymbolTableFileName,MatchRule) +// function [TBFlagfound,TBFlagEqualSymbols] = ST_MatchSymbol(TBName,TBType,TBSize,TBValue,TBFindLike,TBDimension,SymbolTableFileName,MatchRule) +// ----------------------------------------------------------------- +// Match function for the symbol table. +// +// Input data: +// MatchRule: can be 'all','type','size','none' +// //NUT: add description here +// +// Output data: +// TBFlagfound: 0 = if the symbol doesn't exits. +// 1 = the symbol exits. +// 2 = the symbol exists but it is a non-initialized global variable. +// TBFlagEqualSymbols: 0 if the two symbols don't have the same settings, +// 1 if the two symbols have the same settings. +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),8,8); + +TBFlagfound = 0; +TBFlagEqualSymbols = 0; + +// --- Find symbol (If exists). --- +[TBFlagfound,tmpType,tmpSize,tmpValue,tmpFindLike,tmpDimension] = ... + ST_Get(TBName,SymbolTableFileName); + +if (TBFlagfound == 1) + if (tmpType == 'GBLToBeDefined') + TBFlagfound = 2; + TBFlagEqualSymbols = 0; // I don't want to force the error issue in ST_InsOutArg.sci + else + // Symbol already exists. Check that it has the same settings of the current output argument. + TBFlagEqualSymbols = 1; + if (MatchRule == 'type' | MatchRule == 'all') + if (mtlb_strcmp(tmpType,TBType) == %F) + TBFlagEqualSymbols = 0; + end + end + if (MatchRule == 'size' | MatchRule == 'all') + // First check the dimension. + if (tmpDimension ~= TBDimension) + TBFlagEqualSymbols = 0; + end + // Then if the size is a number also its value is compared. + if (isnum(tmpSize(1))) & (isnum(TBSize(1))) + if (mtlb_strcmp(tmpSize(1),TBSize(1)) == %F) + TBFlagEqualSymbols = 0; + end + end + if (isnum(tmpSize(2))) & (isnum(TBSize(2))) + if (mtlb_strcmp(tmpSize(2),TBSize(2)) == %F) + TBFlagEqualSymbols = 0; + end + end + end + end +end + +endfunction diff --git a/macros/SymbolTable/ST_Save.sci b/macros/SymbolTable/ST_Save.sci new file mode 100644 index 00000000..f2109591 --- /dev/null +++ b/macros/SymbolTable/ST_Save.sci @@ -0,0 +1,44 @@ +function ST_Save(SymbolTableFileName,SCI2CSymbolTable) +// function ST_Save(SymbolTableFileName,SCI2CSymbolTable) +// ----------------------------------------------------------------- +// Save into a .dat file a symbol table. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +[tmpnams,tmptyps,tmpdims,tmpvols]=listvarinfile(SymbolTableFileName); +if (max(size(tmpnams)) > 1) + SCI2Cerror('More than one variable found in ""'+SymbolTableFileName+'"".'); +end + +// Identifies the Table name and save it into the .dat file. +if (mtlb_strcmp(tmpnams,'GlobalVars')) + GlobalVars = SCI2CSymbolTable; + save(SymbolTableFileName,GlobalVars); +elseif (mtlb_strcmp(tmpnams,'LocalVars')) + LocalVars = SCI2CSymbolTable; + save(SymbolTableFileName,LocalVars); +elseif (mtlb_strcmp(tmpnams,'TempVars')) + TempVars = SCI2CSymbolTable; + save(SymbolTableFileName,TempVars); +else + SCI2Cerror('Unknow table: ""'+tmpnams+'"".'); +end + +endfunction diff --git a/macros/SymbolTable/ST_Set.sci b/macros/SymbolTable/ST_Set.sci new file mode 100644 index 00000000..778f91aa --- /dev/null +++ b/macros/SymbolTable/ST_Set.sci @@ -0,0 +1,49 @@ +function ST_Set(TBName,TBType,TBSize,TBValue,TBFindLike,TBDimension,SymbolTableFileName) +// function ST_Set(TBName,TBType,TBSize,TBValue,TBFindLike,TBDimension,SymbolTableFileName) +// ----------------------------------------------------------------- +// Set function for the symbol table. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),7,7); + +// --- Load symbol table. --- +SCI2CSymbolTable = ST_Load(SymbolTableFileName); + +// --- Find symbol position (If exists). --- +[TBFlagfound,TBPosition] = ST_FindPos(TBName,SymbolTableFileName); + +if (TBFlagfound == 0) + TBPosition = max(size(SCI2CSymbolTable))+1; +end + +// --- Update symbol table. --- +SCI2CSymbolTable(TBPosition).Name = TBName; // string. +SCI2CSymbolTable(TBPosition).Type = TBType; // char. +SCI2CSymbolTable(TBPosition).Size = TBSize; // structure of two strings (Size(1) and Size(2)). +SCI2CSymbolTable(TBPosition).Value = TBValue; // int/real/complex number. %nan when the value is not available or isn't a scalar. +SCI2CSymbolTable(TBPosition).FindLike = TBFindLike; // int number. FindLike = 1, when the symbol comes from a find-like function. + // FindLike = -1 when the function is not find-like but it is making use of input arguments that are find-like. + // FindLike = 0 in all other cases. +SCI2CSymbolTable(TBPosition).Dimension = TBDimension; // int number. + +// --- Save symbol table. --- +ST_Save(SymbolTableFileName,SCI2CSymbolTable); + +endfunction diff --git a/macros/SymbolTable/buildmacros.sce b/macros/SymbolTable/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/macros/SymbolTable/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/ToolInitialization/INIT_CreateDirs.sci b/macros/ToolInitialization/INIT_CreateDirs.sci new file mode 100644 index 00000000..e6ef184e --- /dev/null +++ b/macros/ToolInitialization/INIT_CreateDirs.sci @@ -0,0 +1,65 @@ +function INIT_CreateDirs(FileInfo) +// function INIT_CreateDirs(FileInfo) +// ----------------------------------------------------------------- +// Create directories. +// +// Input data: +// FileInfo: structure containing all info about SCI2C files. +// +// Output data: +// --- +// +// Status: +// 03-Jan-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// --------------------------- +// --- Create Directories. --- +// --------------------------- +// --- Main directories. --- +SCI2CCreateDir(FileInfo.WorkingDir); +SCI2CCreateDir(FileInfo.OutCCCodeDir); + +// --- SCI2C Library. --- +SCI2CCreateDir(FileInfo.SCI2CLibDir); +SCI2CCreateDir(FileInfo.SCI2CLibSCIAnnDir); +SCI2CCreateDir(FileInfo.SCI2CLibSCIAnnFun); +SCI2CCreateDir(FileInfo.SCI2CLibSCIAnnCls); +SCI2CCreateDir(FileInfo.SCI2CLibSCIFunListDir); +SCI2CCreateDir(FileInfo.SCI2CLibSCIFLFun); +SCI2CCreateDir(FileInfo.SCI2CLibSCIFLCls); +SCI2CCreateDir(FileInfo.SCI2CLibCAnnDir); +SCI2CCreateDir(FileInfo.SCI2CLibCAnnFun); +SCI2CCreateDir(FileInfo.SCI2CLibCAnnCls); +SCI2CCreateDir(FileInfo.SCI2CLibCFunListDir); +SCI2CCreateDir(FileInfo.SCI2CLibCFLFun); +SCI2CCreateDir(FileInfo.SCI2CLibCFLCls); + +// --- USER2C Library. --- +SCI2CCreateDir(FileInfo.USER2CLibDir); +SCI2CCreateDir(FileInfo.USER2CLibSCIAnnDir); +SCI2CCreateDir(FileInfo.USER2CLibSCIAnnFun); +SCI2CCreateDir(FileInfo.USER2CLibSCIAnnCls); +SCI2CCreateDir(FileInfo.USER2CLibSCIFunListDir); +SCI2CCreateDir(FileInfo.USER2CLibSCIFLFun); +SCI2CCreateDir(FileInfo.USER2CLibSCIFLCls); +SCI2CCreateDir(FileInfo.USER2CLibCAnnDir); +SCI2CCreateDir(FileInfo.USER2CLibCAnnFun); +SCI2CCreateDir(FileInfo.USER2CLibCAnnCls); +SCI2CCreateDir(FileInfo.USER2CLibCFunListDir); +SCI2CCreateDir(FileInfo.USER2CLibCFLFun); +SCI2CCreateDir(FileInfo.USER2CLibCFLCls); + +// --- Function List. --- +SCI2CCreateDir(FileInfo.FunctionList.MainDir); +SCI2CCreateDir(FileInfo.FunctionList.FunInfoDatDir); + +endfunction diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci new file mode 100644 index 00000000..459e3639 --- /dev/null +++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -0,0 +1,3645 @@ +function INIT_FillSCI2LibCDirs(FileInfo,SharedInfoExtension) +// function INIT_FillSCI2LibCDirs(FileInfo,SharedInfoExtension) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Generates files for the SCI2CLib CFunctionList and CAnnotations +// directories. +// +// Input data: +// FileInfo: structure containing all info about SCI2C files. +// SharedInfoExtension: structure containing the file extensions. +// +// Output data: +// --- +// +// #RNU_RES_E +// Status: +// 24-Dec-2007 -- Raffaele Nutricato: Author. +// 24-Dec-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +SCI2CLibCAnnClsDir = FileInfo.SCI2CLibCAnnCls; +ExtensionCAnnCls = SharedInfoExtension.AnnotationClasses; + +SCI2CLibCAnnFunDir = FileInfo.SCI2CLibCAnnFun; +ExtensionCAnnFun = SharedInfoExtension.AnnotationFunctions; + +SCI2CLibCFLClsDir = FileInfo.SCI2CLibCFLCls; +ExtensionCFuncListCls = SharedInfoExtension.FuncListClasses; + +SCI2CLibCFLFunDir = FileInfo.SCI2CLibCFLFun; +ExtensionCFuncListFun = SharedInfoExtension.FuncListFunctions; + +GeneralReport = FileInfo.GeneralReport; +ArgSeparator = ','; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// -------------------------------------------------------------------------------- +// --- Generate Function List class files for C functions of the SCI2C library. --- +// -------------------------------------------------------------------------------- +//NUT old call to INIT_GenSCI2CLibCFLCls +// INIT_GenSCI2CLibCFLCls(SCI2CLibCFLClsDir,ExtensionCFuncListCls,GeneralReport) +// SCI2CLibCFLClsDir,ExtensionCFLCls,GeneralReport + +//NUT verifica le annotazioni di tutte le classi. + +// ----------------------------------------------------------------------------------------- +// --- Generate Function List and Annotation files for C functions of the SCI2C library. --- +// ----------------------------------------------------------------------------------------- + + +// --------------------- +// --- Class Global. --- +// --------------------- +ClassName = 'Global'; +// #RNU_RES_B +//NUT: global function can work with a generic number of input arguments. +//NUT: we force the global function to work with one input argument only. +// --- Class Annotation. --- +// #RNU_RES_E +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('g2'+ArgSeparator+'d0',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'global'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// --------------------- +// --- Class Float. --- +// --------------------- +ClassName = 'Float'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''s''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'s0',ClassFileName,'file','y'); +//PrintStringInfo('c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +//PrintStringInfo('z0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'s2',ClassFileName,'file','y'); +//PrintStringInfo('c2'+ArgSeparator+'s2',ClassFileName,'file','y'); +//PrintStringInfo('z2'+ArgSeparator+'s2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'float'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// --------------------- +// --- Class Double. --- +// --------------------- +ClassName = 'Double'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +//PrintStringInfo('c0'+ArgSeparator+'d0',ClassFileName,'file','y'); +//PrintStringInfo('z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +//PrintStringInfo('c2'+ArgSeparator+'d2',ClassFileName,'file','y'); +//PrintStringInfo('z2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'double'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ---------------------------- +// --- Class FloatComplex. --- +// ---------------------------- +//NUT sulla complex c'e' da capire se servono due o un solo argomento. +//NUT secondo me ne va bene uno perche' serve per fare il casting di una variabile +//NUT reale in una variabile complessa +ClassName = 'FloatComplex'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''c''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'c2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'floatcomplex'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ---------------------------- +// --- Class DoubleComplex. --- +// ---------------------------- +//NUT sulla complex c'e' da capire se servono due o un solo argomento. +//NUT secondo me ne va bene uno perche' serve per fare il casting di una variabile +//NUT reale in una variabile complessa +ClassName = 'DoubleComplex'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''z''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'doublecomplex'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------ +// --- Class Sin. --- +// ------------------ +ClassName = 'Sin'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'sin'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'sinh'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'asinh'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'cos'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'cosh'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'tan'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'tanh'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'exp'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'conj'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//NUT verifica +FunctionName = 'inv'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'ceil'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'fix'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'floor'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'round'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'int'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'OpLogNot'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'SCI2Cresize'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'sign'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'chol'; //BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------- +// --- Class Atan. --- +// ------------------- +ClassName = 'Atan'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +// PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +// PrintStringInfo('z0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +// PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +// PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'atan'; //BJ : atan AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------- +// --- Class Sqrt. --- +// ------------------- +ClassName = 'Sqrt'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +//Was FA_TP_USER +//Cause some trouble if user specify some precision and if input(and also output) is complex. +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'asin'; //BJ : Works but not able to generate all cases , AS : same for float + //--> asin(%pi). +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'acos'; //BJ : Works but not able to generate all cases , AS : same for float + //--> acos(%pi) +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'acosh'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'atanh'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'sqrt'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'log'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'log10'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'log1p'; // BJ : Ok AS : Float_Done + //--> log1p(%i) Not implemented in Scilab. + //WARNING z0log1pz0 will never happened. +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// -------------------- +// --- Class Zeros. --- +// -------------------- +ClassName = 'Zeros'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 0',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +//Was FA_TP_USER +//Cause some trouble if user specify some precision and if input(and also output) is complex. +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +//Was FA_TP_USER +//Cause some trouble if user specify some precision and if input(and also output) is complex. +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(IN(1).SZ)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(IN(1).SZ)',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +//Was FA_TP_USER +//Cause some trouble if user specify some precision and if input(and also output) is complex. +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_FROM_VAL(IN(1).VAL,IN(1).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_FROM_VAL(IN(2).VAL,IN(2).TP)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo(ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo(ArgSeparator+'d0',ClassFileName,'file','y'); + +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +//NUT: no mixed input types are allowed. +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s0s0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s0s0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'zeros'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'ones'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'eye'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//NUT rand function doesn't behave like zeros and ones functions. +FunctionName = 'rand'; // BJ : Done => rien pour f loat +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// -------------------- +// --- Class Sum. --- +// -------------------- +ClassName = 'Sum'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_SEL1(IN(1).SZ(1),IN(2).VAL)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_SEL2(IN(1).SZ(2),IN(2).VAL)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2s0'+ArgSeparator+'s0',ClassFileName,'file','y'); //* possible ? */ +PrintStringInfo('d2d0'+ArgSeparator+'d0',ClassFileName,'file','y'); //* possible ? */ +PrintStringInfo('c2s0'+ArgSeparator+'c0',ClassFileName,'file','y'); //* possible ? */ +PrintStringInfo('z2d0'+ArgSeparator+'z0',ClassFileName,'file','y'); //* possible ? */ +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0g2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0g2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0g2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0g2'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2g2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d2g2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c2g2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z2g2'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2g2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2g2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2g2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2g2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'sum'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'prod'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'mean'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'st_deviation'; // BJ : Not implemented +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'variance'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + + +// -------------------- +// --- Class Max. --- +// -------------------- +ClassName = 'Max'; + + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(FA_SZ_OPPLUS(IN(1).SZ,IN(2).SZ,IN(1).TP,IN(2).TP))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(FA_SZ_OPPLUS(IN(1).SZ,IN(2).SZ,IN(1).TP,IN(2).TP))',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d0',ClassFileName,'file','y'); + + +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); + +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +FunctionName = 'max'; // BJ : Done AS : Float_Done + // WARNING : Complex case will never be + // WARNING : max(x, 2) <=> max(x, 2 * ones(x)) nothing to do with 'r' nor 'c' +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'min'; // BJ : Done AS : Float_Done + // WARNING : Complex case will never be + // WARNING : max(x, 2) <=> max(x, 2 * ones(x)) nothing to do with 'r' nor 'c' +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + + + + +// -------------------- +// --- Class Abs. --- +// -------------------- +ClassName = 'Abs'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_REAL(IN(1).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'abs'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'real'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'imag'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------------ +// --- Class OpDotStar. --- +// ------------------------ +ClassName = 'OpDotStar'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(FA_SZ_OPDOTSTAR(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(FA_SZ_OPDOTSTAR(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('s0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('s2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpDotStar'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'OpDotSlash'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + +// ------------------------ +// --- Class OpDotHat. --- +// ------------------------ +ClassName = 'OpDotHat'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(FA_SZ_OPDOTSTAR(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(FA_SZ_OPDOTSTAR(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpDotHat'; // BJ : Done AS : Float_Done but poor precision +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//NUT verifica l'hat se e' ben annotato. L'input deve essere una matrice quadrata +FunctionName = 'OpHat'; // BJ : Done AS : Float_Done but poor precision + // WARNING : d2d2 / z2z2 / d2z2 / z2d2 Not implemented in Scilab ... +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'OpDotBackSlash'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'OpLogLt'; // BJ : Done AS : Float_Done + // WARNING : Complex cases are useless. +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'OpLogLe'; // BJ : Done AS : Float_Done + // WARNING : Complex cases are useless. +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'OpLogGt'; // BJ : Done AS : Float_Done + // WARNING : Complex cases are useless. +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'OpLogGe'; // BJ : Done AS : Float_Done + // WARNING : Complex cases are useless. +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + + +// ---------------------- +// --- Class OpLogEq. --- +// ---------------------- +ClassName = 'OpLogEq'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MIN_REAL(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); //RNU +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(FA_SZ_OPDOTSTAR(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(FA_SZ_OPDOTSTAR(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('g0g0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('g0g0'+ArgSeparator+'d0',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('g2g0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('g2g0'+ArgSeparator+'d2',ClassFileName,'file','y'); + +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('g0g2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('g0g2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('g2g2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('g2g2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +//mixed types +PrintStringInfo('c2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2c0'+ArgSeparator+'s2',ClassFileName,'file','y'); + +PrintStringInfo('z0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s0c0'+ArgSeparator+'s0',ClassFileName,'file','y'); + +PrintStringInfo('c0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s0c2'+ArgSeparator+'s2',ClassFileName,'file','y'); + +PrintStringInfo('c2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2c2'+ArgSeparator+'s2',ClassFileName,'file','y'); + + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpLogEq'; // BJ : Done AS : Float_Done + // WARNING : Unable to generate g2 nor g0 code ... +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'OpLogNe'; // BJ : Done AS : Float_Done + // WARNING : Unable to generate g2 nor g0 code ... +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'OpLogAnd'; // AS : Double and Float_Done + // ERROR : z0z0OpLogAndz0 -> z0z0OpLogAndd0 +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'OpLogOr'; // AS : Double and Float_Done + // ERROR : z0z0OpLogAndz0 -> z0z0OpLogAndd0 +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// --------------------- +// --- Class OpStar. --- +// --------------------- +ClassName = 'OpStar'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(FA_SZ_OPSTAR(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(FA_SZ_OPSTAR(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s2c2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z0',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpStar'; // BJ : Done AS : Float_Done + +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); +//NUT vedi che la opstar non funziona quando faccio scalare*matrice. o matrice*scalare. +//NUT la lista delle funzioni disponibili e' identica a quella della classe 3. + + +// --------------------- +// --- Class OpSlash. --- +// --------------------- +ClassName = 'OpSlash'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(FA_SZ_OPSLASH(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(FA_SZ_OPSLASH(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s2c2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z0',ClassFileName,'file','y'); + + +FunctionName = 'OpSlash'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// --------------------- +// --- Class OpApex. --- +// --------------------- +ClassName = 'OpApex'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(1)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpApex'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'OpDotApex'; // BJ : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + +// --------------------- +// --- Class IsNan. --- +// --------------------- +ClassName = 'IsNan'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_REAL(IN(1).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(1)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'d2',ClassFileName,'file','y'); + + +FunctionName = 'isnan'; // BJ : Done AS : Float_Done + // ERROR : z2isnanz2 must be z2isnand2 // z0isnanz0 must be z0isnand0 +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// --------------------- +// --- Class OpPlus. --- +// --------------------- +ClassName = 'OpPlus'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(FA_SZ_OPPLUS(IN(1).SZ,IN(2).SZ,IN(1).TP,IN(2).TP))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(FA_SZ_OPPLUS(IN(1).SZ,IN(2).SZ,IN(1).TP,IN(2).TP))',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('g0g0'+ArgSeparator+'g2',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('g2g0'+ArgSeparator+'g2',ClassFileName,'file','y'); + +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('g0g2'+ArgSeparator+'g2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('g2g2'+ArgSeparator+'g2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpPlus'; // BJ : Done AS : Float_Done + // ERROR : Strings are not correctly allowed. +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + + + + +// ---------------------- +// --- Class OpMinus. --- +// ---------------------- +ClassName = 'OpMinus'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(FA_SZ_OPMINUS(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(FA_SZ_OPMINUS(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpMinus'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------- +// --- Class OpRc. --- +// ------------------- +ClassName = 'OpRc'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_ADD(IN(1).SZ(2),IN(2).SZ(2))',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types considered +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); + +PrintStringInfo('d0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +PrintStringInfo('c0c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); + +PrintStringInfo('z0z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('z0d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); + +PrintStringInfo('s0c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('s2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpRc'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------- +// --- Class OpCc. --- +// ------------------- +ClassName = 'OpCc'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_ADD(IN(1).SZ(1),IN(2).SZ(1))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types considered +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); + +PrintStringInfo('d0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +PrintStringInfo('c0c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); + +PrintStringInfo('z0z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('z0d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); + +PrintStringInfo('s0c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('s2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpCc'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + +// ------------------- +// --- Class Find. --- +// ------------------- +ClassName = 'Find'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_RTMAX(FA_MUL(IN(1).SZ(1),IN(1).SZ(2)))',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_RTMAX(FA_MUL(IN(1).SZ(1),IN(1).SZ(2)))',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= FA_SZ_RTMAX(FA_MUL(IN(1).SZ(1),IN(1).SZ(2)))',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_FROM_VAL(FA_MIN( IN(2).VAL ,FA_MUL(IN(1).SZ(1),IN(1).SZ(2))) ,IN(2).TP)',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_FROM_VAL(FA_MIN( IN(2).VAL ,FA_MUL(IN(1).SZ(1),IN(1).SZ(2))) ,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= FA_SZ_FROM_VAL(FA_MIN( IN(2).VAL ,FA_MUL(IN(1).SZ(1),IN(1).SZ(2))) ,IN(2).TP)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +PrintStringInfo('s0'+ArgSeparator+'s0s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0d0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2d2',ClassFileName,'file','y'); + +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); + +PrintStringInfo('s0s0'+ArgSeparator+'s0s0',ClassFileName,'file','y'); +PrintStringInfo('s2s0'+ArgSeparator+'s2s2',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0d0',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2d2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'find'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// --------------------- +// --- Class Length. --- +// --------------------- +ClassName = 'Length'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_USER',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('g0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('g0'+ArgSeparator+'d0',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('g2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('g2'+ArgSeparator+'d0',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'length'; // AS : done AS : Float_Done + // warning for string input , the length is +1 than scilab because + // in C we must take in account the ending '\0' +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'type'; // AS : done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------- +// --- Class Size. --- +// ------------------- +ClassName = 'Size'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_REAL(IN(1).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''2''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_REAL(IN(1).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= FA_TP_REAL(IN(1).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_REAL(IN(1).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'d2',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +PrintStringInfo('s0'+ArgSeparator+'s0s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'s0s0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'d0d0',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'s0s0',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d0d0',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'s0s0',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'d0d0',ClassFileName,'file','y'); + +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'d0',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'size'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// --------------------- +// --- Class Return. --- +// --------------------- +ClassName = 'Return'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 0',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 0',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo(ArgSeparator,ClassFileName,'file','y'); + +//NUT anche se metto Return funziona bene comunque! cerca di capire il motivo. +//NUT limited use to zero in and out args only. +// --- Annotation Function And Function List Function. --- +FunctionName = 'return'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ---------------------- +// --- Class OpColon. --- +// ---------------------- +ClassName = 'OpColon'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MIN_REAL(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_FROM_VAL(FA_ADD(FA_SUB(FA_REAL(IN(2).VAL,IN(2).TP),FA_REAL(IN(1).VAL,IN(1).TP)),''1''),FA_TP_REAL(IN(2).TP))',ClassFileName,'file','y'); +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MIN_REAL(IN(1).TP,FA_TP_MIN_REAL(IN(2).TP,IN(3).TP))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_FROM_VAL(FA_ADD(FA_DIV(FA_SUB(FA_REAL(IN(3).VAL,IN(3).TP),FA_REAL(IN(1).VAL, IN(1).TP)),FA_REAL(IN(2).VAL,IN(2).TP)),''1''),FA_TP_REAL(IN(3).TP))',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'d0',ClassFileName,'file','y'); + +PrintStringInfo('s0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'d2',ClassFileName,'file','y'); + + +PrintStringInfo('s0c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); + + +PrintStringInfo('s0c0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); + + + + +PrintStringInfo('s0s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0c0c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z0z0z0'+ArgSeparator+'d0',ClassFileName,'file','y'); + +PrintStringInfo('s0s0c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s0c0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s0c0c0'+ArgSeparator+'s0',ClassFileName,'file','y'); + +PrintStringInfo('c0s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('c0c0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('c0s0c0'+ArgSeparator+'s0',ClassFileName,'file','y'); + +PrintStringInfo('d0z0z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d0d0z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d0z0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); + +PrintStringInfo('z0d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('z0z0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('z0d0z0'+ArgSeparator+'d0',ClassFileName,'file','y'); + + +PrintStringInfo('s0s0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c0c0c0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z0z0z0'+ArgSeparator+'d2',ClassFileName,'file','y'); + + +PrintStringInfo('s0s0c0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s0c0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s0c0c0'+ArgSeparator+'s2',ClassFileName,'file','y'); + +PrintStringInfo('c0s0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('c0c0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('c0s0c0'+ArgSeparator+'s2',ClassFileName,'file','y'); + +PrintStringInfo('d0z0z0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d0d0z0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d0z0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); + +PrintStringInfo('z0d0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('z0z0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('z0d0z0'+ArgSeparator+'d2',ClassFileName,'file','y'); + + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpColon'; // AS : done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ---------------------- +// --- Class IsEmpty. --- +// ---------------------- +ClassName = 'IsEmpty'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_USER',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'d0',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'isempty'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ---------------------- +// --- Class Trace. --- +// ---------------------- +ClassName = 'Trace'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z0',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'trace'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//NUT det is a little bit complex but for the moment we assume that +//NUT that det works as trace function. +FunctionName = 'det'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// -------------------- +// --- Class OpIns. --- +// -------------------- +ClassName = 'OpIns'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 0',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 4',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 0',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s2s0s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2s2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s0s0s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s0s2s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2s0s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2s2s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s0s2s2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2s0s2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2s2s2'+ArgSeparator,ClassFileName,'file','y'); + +PrintStringInfo('d2d0d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2d2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d0d0d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d0d2d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2d0d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2d2d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d0d2d2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2d0d2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2d2d2'+ArgSeparator,ClassFileName,'file','y'); + +PrintStringInfo('c2s0c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2c2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s0s0c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s0s2c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2s0c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2s2c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s0s2c2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2s0c2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2s2c2'+ArgSeparator,ClassFileName,'file','y'); + +PrintStringInfo('z2d0z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2z2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d0d0z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d0d2z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2d0z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2d2z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d0d2z2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2d0z2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2d2z2'+ArgSeparator,ClassFileName,'file','y'); + +//Mixed input arguments +PrintStringInfo('s2s0c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2c2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s0s0c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s0s2c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2s0c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2s2c0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s0s2c2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2s0c2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2s2s2c2'+ArgSeparator,ClassFileName,'file','y'); + +PrintStringInfo('d2d0z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2z2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d0d0z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d0d2z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2d0z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2d2z0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d0d2z2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2d0z2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2d2d2z2'+ArgSeparator,ClassFileName,'file','y'); + +PrintStringInfo('c2s0s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2s2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s0s0s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s0s2s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2s0s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2s2s0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s0s2s2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2s0s2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('c2s2s2s2'+ArgSeparator,ClassFileName,'file','y'); + +PrintStringInfo('z2d0d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2d2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d0d0d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d0d2d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2d0d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2d2d0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d0d2d2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2d0d2'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('z2d2d2d2'+ArgSeparator,ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpIns'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// -------------------- +// --- Class OpExt. --- +// -------------------- +ClassName = 'OpExt'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_MUL(IN(2).SZ(1),IN(2).SZ(2))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_MUL(IN(2).SZ(1),IN(2).SZ(2))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_MUL(IN(3).SZ(1),IN(3).SZ(2))',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s2s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s2s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); + +PrintStringInfo('d2d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d2d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +PrintStringInfo('c2s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c2s2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s0s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); + +PrintStringInfo('z2d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z2d2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d0d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpExt'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------- +// --- Class Disp. --- +// ------------------- +ClassName = 'Disp'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('g0'+ArgSeparator+'d0',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('g2'+ArgSeparator+'d0',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'disp'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ---------------------- +// --- Class OpEqual. --- +// ---------------------- +ClassName = 'OpEqual'; +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(IN(1).SZ)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(IN(1).SZ)',ClassFileName,'file','y'); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(IN(1).SZ)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(IN(1).SZ)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= IN(2).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= FA_SZ_1(IN(2).SZ)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= FA_SZ_2(IN(2).SZ)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('g0'+ArgSeparator+'g0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('g2'+ArgSeparator+'g2',ClassFileName,'file','y'); +//NUT per ora non considero le equal con nin != 1 + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpEqual'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + +// -------------------- +// --- Class Mopen. --- +// -------------------- +ClassName = 'Mopen'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''f''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''f''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= FA_TP_USER',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''f''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''f''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= FA_TP_USER',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''f''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''f''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= FA_TP_USER',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('g2'+ArgSeparator+'f0',ClassFileName,'file','y'); +PrintStringInfo('g2'+ArgSeparator+'f0s0',ClassFileName,'file','y'); +PrintStringInfo('g2'+ArgSeparator+'f0d0',ClassFileName,'file','y'); +PrintStringInfo('g2g2'+ArgSeparator+'f0',ClassFileName,'file','y'); +PrintStringInfo('g2g2'+ArgSeparator+'f0s0',ClassFileName,'file','y'); +PrintStringInfo('g2g2'+ArgSeparator+'f0d0',ClassFileName,'file','y'); +PrintStringInfo('g2g2s0'+ArgSeparator+'f0s0',ClassFileName,'file','y'); +PrintStringInfo('g2g2s0'+ArgSeparator+'f0d0',ClassFileName,'file','y'); +PrintStringInfo('g2g2d0'+ArgSeparator+'f0s0',ClassFileName,'file','y'); +PrintStringInfo('g2g2d0'+ArgSeparator+'f0d0',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'mopen'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------- +// --- Class Mput. --- +// ------------------- +ClassName = 'Mput'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 0 ',ClassFileName,'file','y'); +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''i''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0g2f0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s2g2f0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d0g2f0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('d2g2f0'+ArgSeparator,ClassFileName,'file','y'); +PrintStringInfo('s0g2f0'+ArgSeparator+'i0',ClassFileName,'file','y'); //NUT la mput e' strana +PrintStringInfo('s2g2f0'+ArgSeparator+'i0',ClassFileName,'file','y'); +PrintStringInfo('d0g2f0'+ArgSeparator+'i0',ClassFileName,'file','y'); +PrintStringInfo('d2g2f0'+ArgSeparator+'i0',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'mput'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------- +// --- Class Mget. --- +// ------------------- +ClassName = 'Mget'; +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_USER',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_RTMAX(FA_SZ_FROM_VAL(IN(1).VAL,IN(1).TP))',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0g2f0'+ArgSeparator+'s0',ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('s0g2f0'+ArgSeparator+'d0',ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('d0g2f0'+ArgSeparator+'s0',ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('d0g2f0'+ArgSeparator+'d0',ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('s0g2f0'+ArgSeparator+'s2',ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('s0g2f0'+ArgSeparator+'d2',ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('d0g2f0'+ArgSeparator+'s2',ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('d0g2f0'+ArgSeparator+'d2',ClassFileName,'file','y'); //NUT da chiarire + +// --- Annotation Function And Function List Function. --- +FunctionName = 'mget'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// --------------------- +// --- Class Mclose. --- +// --------------------- +ClassName = 'Mclose'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 0',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''i''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('f0'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('f0'+ArgSeparator+'i0',ClassFileName,'file','y'); //NUT da chiarire + +// --- Annotation Function And Function List Function. --- +FunctionName = 'mclose'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// --------------------- +// --- Class Mseek. --- +// --------------------- +ClassName = 'Mseek'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 0 ',ClassFileName,'file','y'); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 0 ',ClassFileName,'file','y'); +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 0 ',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('s0f0'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('s0f0g2'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire + +PrintStringInfo('d0'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('d0f0'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire +PrintStringInfo('d0f0g2'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire + +// --- Annotation Function And Function List Function. --- +FunctionName = 'mseek'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// --------------------- +// --- Class Convol. --- +// --------------------- +ClassName = 'Convol'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SUB(FA_ADD(IN(1).SZ(2),IN(2).SZ(2)),''1'')',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(2).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= FA_SUB(FA_ADD(IN(1).SZ(2),IN(2).SZ(2)),''1'')',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(FA_TP_MAX(IN(1).TP,IN(2).TP),IN(3).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(2).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= FA_TP_MAX(FA_TP_MAX(IN(1).TP,IN(2).TP),IN(3).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= FA_SUB(FA_ADD(IN(1).SZ(2),IN(2).SZ(2)),''1'')',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s0'+ArgSeparator+'s0s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0d0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'c0c0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'z0z0',ClassFileName,'file','y'); + +PrintStringInfo('s0s2'+ArgSeparator+'s2s2',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2d2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'c2c2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'z2z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2d2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'c2c2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z2z2',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s2s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2d2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2c2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s0s0'+ArgSeparator+'s0s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0d0'+ArgSeparator+'d0d0',ClassFileName,'file','y'); +PrintStringInfo('c0c0c0'+ArgSeparator+'c0c0',ClassFileName,'file','y'); +PrintStringInfo('z0z0z0'+ArgSeparator+'z0z0',ClassFileName,'file','y'); + +PrintStringInfo('s0s2s0'+ArgSeparator+'s2s0',ClassFileName,'file','y'); +PrintStringInfo('d0d2d0'+ArgSeparator+'d2d0',ClassFileName,'file','y'); +PrintStringInfo('c0c2c0'+ArgSeparator+'c2c0',ClassFileName,'file','y'); +PrintStringInfo('z0z2z0'+ArgSeparator+'z2z0',ClassFileName,'file','y'); + +PrintStringInfo('s2s2s2'+ArgSeparator+'s2s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2d2'+ArgSeparator+'d2d2',ClassFileName,'file','y'); +PrintStringInfo('c2c2c2'+ArgSeparator+'c2c2',ClassFileName,'file','y'); +PrintStringInfo('z2z2z2'+ArgSeparator+'z2z2',ClassFileName,'file','y'); + +PrintStringInfo('s0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +//added combination + +PrintStringInfo('d2d0'+ArgSeparator+'d0d2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z0z2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'z2z2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z0z2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'z0z2',ClassFileName,'file','y'); + + +// --- Annotation Function And Function List Function. --- +FunctionName = 'convol'; // AS : done except 2 ouputs cases and 3 inputs cases AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------- +// --- Class IFFT. --- +// ------------------- +ClassName = 'IFFT'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +//Was FA_TP_USER +//Cause some trouble if user specify some precision and if input(and also output) is complex. +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'ifft'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------ +// --- Class FFT. --- +// ------------------ +ClassName = 'FFT'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('NIN= 4',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('s0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// scilab2c doesn't handle multidimensionnal Fft + +//PrintStringInfo('s0s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +//PrintStringInfo('d0d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +//PrintStringInfo('s0s0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +//PrintStringInfo('d0d0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +//PrintStringInfo('c0s0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +//PrintStringInfo('z0d0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +//PrintStringInfo('s2s0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +//PrintStringInfo('d2d0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +//PrintStringInfo('s2s0s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +//PrintStringInfo('d2d0d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +//PrintStringInfo('c2s0s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +//PrintStringInfo('z2d0d0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +//PrintStringInfo('s0s0s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +//PrintStringInfo('d0d0d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +//PrintStringInfo('s0s0s0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +//PrintStringInfo('d0d0d0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +//PrintStringInfo('c0s0s0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +//PrintStringInfo('z0d0d0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +//PrintStringInfo('s2s0s0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +//PrintStringInfo('d2d0d0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +//PrintStringInfo('s2s0s0s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +//PrintStringInfo('d2d0d0d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +//PrintStringInfo('c2s0s0s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +//PrintStringInfo('z2d0d0d0'+ArgSeparator+'z2',ClassFileName,'file','y'); + + +//NUT non metto tutte le combinazioni ma prima cerco di capire cosa mi offre INRIA +//NUT come libreria a disposizione. +// --- Annotation Function And Function List Function. --- +FunctionName = 'fft'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ----------------------- +// --- Class FFTShift. --- +// ----------------------- +ClassName = 'FFTShift'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s0g2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d0g2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0g2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0g2'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2g2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2g2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2g2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2g2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'fftshift'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + +// -------------------- +// --- Class Meanf. --- +// -------------------- +ClassName = 'Meanf'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP, IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP, IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_SEL1(IN(1).SZ(1),IN(3).VAL)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_SEL2(IN(1).SZ(2),IN(3).VAL)',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2s2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s0s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0s0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0d0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2s2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2d2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +// +PrintStringInfo('s0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2c2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s0c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('c0c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('c2c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +// +PrintStringInfo('s0c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'d0',ClassFileName,'file','y'); + +PrintStringInfo('s2c2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'d0',ClassFileName,'file','y'); + +PrintStringInfo('s0c0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('d0z0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('c0c0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('z0z0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); + +PrintStringInfo('s2c2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2z2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2c2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('z2z2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'meanf'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'variancef'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +FunctionName = 'stdevf'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// -------------------- +// --- Class Frmag. --- +// -------------------- +ClassName = 'Frmag'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(2).VAL',ClassFileName,'file','y'); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(2).VAL',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= IN(2).VAL',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(3).VAL',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(3).VAL',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= IN(3).VAL',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2d2',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'d0d0',ClassFileName,'file','y'); +PrintStringInfo('d2d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d2d0'+ArgSeparator+'d2d2',ClassFileName,'file','y'); +PrintStringInfo('d0d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d0d0d0'+ArgSeparator+'d0d0',ClassFileName,'file','y'); + +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s0'+ArgSeparator+'s2s2',ClassFileName,'file','y'); +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s0s0'+ArgSeparator+'s0s0',ClassFileName,'file','y'); +PrintStringInfo('s2s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s2s0'+ArgSeparator+'s2s2',ClassFileName,'file','y'); +PrintStringInfo('s0s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s0s0s0'+ArgSeparator+'s0s0',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'frmag'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------ +// --- Class Lev. --- +// ------------------ +ClassName = 'Lev'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SUB(FA_ADD(IN(1).SZ(1),IN(1).SZ(2)),''2'')',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SUB(FA_ADD(IN(1).SZ(1),IN(1).SZ(2)),''2'')',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 3',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SUB(FA_ADD(IN(1).SZ(1),IN(1).SZ(2)),''2'')',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(3).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(3).SZ(1)= FA_SUB(FA_ADD(IN(1).SZ(1),IN(1).SZ(2)),''2'')',ClassFileName,'file','y'); +PrintStringInfo('OUT(3).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2s0',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'s2s0s2',ClassFileName,'file','y'); + +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2d0',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2d0d2',ClassFileName,'file','y'); + +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2c0',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2c0c2',ClassFileName,'file','y'); + +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2z0',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2z0z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'lev'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// -------------------------- +// --- Class OpBackSlash. --- +// -------------------------- +ClassName = 'OpBackSlash'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP) ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(FA_SZ_OPBACKSLASH(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(FA_SZ_OPBACKSLASH(IN(1).SZ,IN(2).SZ))',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('s0s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y'); + +PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('d0d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +PrintStringInfo('s0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); + +PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c0c2'+ArgSeparator+'c2',ClassFileName,'file','y'); + +PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('s2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c0'+ArgSeparator+'c2',ClassFileName,'file','y'); + +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); + +PrintStringInfo('d0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('z0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z0z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('d2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z0'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'OpBackSlash'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ----------------------- +// --- Class Cepstrum. --- +// ----------------------- +ClassName = 'Cepstrum'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP) ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= FA_MUL(IN(1).SZ(1),IN(1).SZ(2))',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo('s0s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s0c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0z0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('s2s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + + +// --- Annotation Function And Function List Function. --- +FunctionName = 'Cepstrum'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------- +// --- Class Spec. --- +// ------------------- +ClassName = 'Spec'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_COMPLEX(IN(1).TP)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); + +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 2',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= FA_TP_COMPLEX(IN(1).TP)',ClassFileName,'file','y'); //FOR INRIA FA_TP_MAX NEEDS 2 Input args +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).TP= FA_TP_COMPLEX(IN(1).TP)',ClassFileName,'file','y'); //FOR INRIA FA_TP_MAX NEEDS 2 Input args +PrintStringInfo('OUT(2).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo('s0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'z0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'z2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +PrintStringInfo('s0'+ArgSeparator+'c0c0',ClassFileName,'file','y'); +PrintStringInfo('d0'+ArgSeparator+'z0z0',ClassFileName,'file','y'); +PrintStringInfo('c0'+ArgSeparator+'c0c0',ClassFileName,'file','y'); +PrintStringInfo('z0'+ArgSeparator+'z0z0',ClassFileName,'file','y'); + +PrintStringInfo('s2'+ArgSeparator+'s2s2',ClassFileName,'file','y'); +PrintStringInfo('s2'+ArgSeparator+'c2c2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2d2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'z2z2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'spec'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ------------------- +// --- Class Part. --- +// ------------------- +ClassName = 'Part'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''g''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_RTMAX(IN(1).SZ(2))',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo('g2s0'+ArgSeparator+'g2',ClassFileName,'file','y'); +PrintStringInfo('g2d0'+ArgSeparator+'g2',ClassFileName,'file','y'); +PrintStringInfo('g2s2'+ArgSeparator+'g2',ClassFileName,'file','y'); +PrintStringInfo('g2d2'+ArgSeparator+'g2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'part'; // to code +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ----------------------- +// --- Class Strindex. --- +// ----------------------- +ClassName = 'Strindex'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 2',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''g''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_RTMAX(IN(1).SZ(2))',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo('g2g2'+ArgSeparator+'s0',ClassFileName,'file','y'); +PrintStringInfo('g2g2'+ArgSeparator+'d0',ClassFileName,'file','y'); +PrintStringInfo('g2g2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('g2g2'+ArgSeparator+'d2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'strindex'; // to code +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +// ----------------------- +// --- Class StrSubSt. --- +// ----------------------- +ClassName = 'StrSubSt'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 3',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= ''g''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= FA_SZ_RTMAX(FA_MUL(IN(1).SZ(2),IN(3).SZ(2)))',ClassFileName,'file','y'); + +// --- Function List Class. --- +//NUT: no mixed data types +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); + +PrintStringInfo('g2g2g2'+ArgSeparator+'g2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'strsubst'; // to code +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + + +// ------------------ +// --- Class Expm. --- +// ------------------ +ClassName = 'Expm'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + +// --- Annotation Function And Function List Function. --- +FunctionName = 'expm'; // AS : Done AS : Float_Done +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + + + +// //////////////////////////////////////////// +// /////PARTE INTRODOTTA DA ALBERTO MOREA +// ///////////////////////////////////////////// +// /////////////////////////////////////////////// + +// // DOMAINS DEFINITION FOR EVERY CLASS-LEADER IN SCI2C LIBRARY + +// // In the following lets: +// // N,R ,C are the standard sets of integer,real ,complex numbers +// // I,J c R are intervals of real numbers +// // {} the empty set +// // Sel={'r','c'} or {0,1} are the selection sets r=row,c=column +// // B={T,F} is Boolean set +// // F is the standard set of File IDentify files +// // G is the standard alphanumeric string domain + +// // For every sci2c function library class we reported +// // the domains , annotations only for the class-leader + +// // Example [y1,y2]=Fun(x1,x2,x3) : scilab library function call + +// // Domain RxNxSel->{R,R} :the first input element is real number ,the second is integer , +// // the last is in the selection set +// // The first output and the second are real numbers + +// // Notice : only default (double) precision are considered for real and complex data +// // The dimension of the input/output data are provided in the mapping schema + +// // d0 = double real scalar +// // d2 = double real vector or matrix +// // z0= double complex scalar +// // z2= double complex vector or matrix + +// // --------------------- +// // --- Class Global. --- +// // --------------------- + +// // DOMAINS G -> R + +// ////////////////////////////////// + + +// // --------------------- +// // --- Class Float. --- +// // --------------------- + +// // DOMAINS R -> R + +// ////////////////////////////////// + + +// // --------------------- +// // --- Class Double. --- +// // --------------------- + +// // DOMAINS R -> R + +// ////////////////////////////////// + +// // ---------------------------- +// // --- Class FloatComplex. --- +// // ---------------------------- + +// // DOMAINS 1)R -> C +// // 2)C -> C + +// ///////////////////////////////// + +// // ---------------------------- +// // --- Class DoubleComplex. --- +// // ---------------------------- + +// // DOMAINS 1) R -> C +// // 2) C -> C + +// ///////////////////////////////// + +// // ------------------ +// // --- Class Sin. --- +// // ------------------ + +// // DOMAINS 1) IcR -> JcR +// // 2) C -> C + +// ///////////////////////////////// + +// // ------------------- +// // --- Class Atan. --- +// // ------------------- + +// // DOMAINS 1) IcR -> JcR +// // 2) C -> C +// // 3) RxR -> JcR + +// ///////////////////////////////// + +// // ------------------- +// // --- Class Sqrt. --- +// // ------------------- + +// // DOMAINS 1) IcR -> JcR +// // 2) R -> R +// // 3) C -> C + + // ///////////////////////////////// + +// // -------------------- +// // --- Class Zeros. --- +// // -------------------- + +// // DOMAINS 1) {}->R +// // 2) NxN -> R +// // 3) R -> R +// // 4) C -> R + +// ///////////////////////////////// + +// // -------------------- +// // --- Class Sum. --- +// // -------------------- + +// // DOMAINS 1) R -> R +// // 2) C -> C +// // 3) RxSel -> R +// // 4) CxSel -> R + + // ///////////////////////////////// + +// // -------------------- +// // --- Class Abs. --- +// // -------------------- + +// // DOMAINS 1) R -> R+ +// // 2) C -> R+ + +// ///////////////////////////////// + +// // ------------------------ +// // --- Class OpDotStar. --- +// // ------------------------ + +// // DOMAINS 1) RxR -> R +// // 2) CxC -> C +// // 3) RxC -> C +// // 4) CxR -> C + +// ///////////////////////////////// + +// // ------------------------ +// // --- Class OpDotHat. --- +// // ------------------------ + +// // DOMAINS 1) RxR -> R +// // 2) CxC -> C + +// ///////////////////////////////// + +// // ---------------------- +// // --- Class OpLogEq. --- +// // ---------------------- + +// // DOMAINS 1) RxR -> B +// // 2) CxC -> B +// // 3) GxG -> B + +// ///////////////////////////////// + +// // --------------------- +// // --- Class OpStar. --- +// // --------------------- + +// // DOMAINS 1) RxR -> R +// // 2) CxC -> C +// // 3) RxC -> C +// // 4) CxR -> C + +// ///////////////////////////////// + +// // --------------------- +// // --- Class OpApex. --- +// // --------------------- + +// // DOMAINS 1) R -> R +// // 2) C -> C + +// ///////////////////////////////// + +// // --------------------- +// // --- Class OpPlus. --- +// // --------------------- + +// // DOMAINS 1) R -> R +// // 2) C -> C +// // 3) RxR -> R +// // 4) CxC -> C +// // 5) RxC -> C +// // 6) CxR -> C +// // 7) GxG -> G + +// ///////////////////////////////// + +// // ---------------------- +// // --- Class OpMinus. --- +// // ---------------------- + +// // DOMAINS 1) R -> R +// // 2) C -> C +// // 3) RxR -> R +// // 4) CxC -> C +// // 5) RxC -> C +// // 6) CxR -> C + + +// ///////////////////////////////// + +// // ------------------- +// // --- Class OpRc. --- +// // ------------------- + +// // DOMAINS 1) RxR -> R +// // 2) CxC -> C + +// ///////////////////////////////// + +// // ------------------- +// // --- Class OpCc. --- +// // ------------------- + +// // DOMAINS 1) RxR -> R +// // 2) CxC -> C + +// ///////////////////////////////// + +// // ------------------- +// // --- Class Find. --- +// // ------------------- + +// // DOMAINS 1) R -> N +// // 2) R -> {N,N} +// // 3) RxN -> N +// // 4) RxN ->{N,N} + +// ///////////////////////////////// + +// // --------------------- +// // --- Class Length. --- +// // --------------------- + +// // DOMAINS 1) R -> N +// // 2) C -> N +// // 3) G -> N + +// ///////////////////////////////// + +// // ------------------- +// // --- Class Size. --- +// // ------------------- + +// // DOMAINS 1) R -> {N,N} +// // 2) C -> {N,N} +// // 3) RxSel -> {N,N} +// // 4) CxSel -> {N,N} + +// ///////////////////////////////// + +// // --------------------- +// // --- Class Return. --- +// // --------------------- +// // DOMAINS 1) {} -> {} + +// ///////////////////////////////// + +// // ---------------------- +// // --- Class OpColon. --- +// // ---------------------- + +// // DOMAINS 1) RxR -> R +// // 2) RxRxR -> R + +// ///////////////////////////////// + +// // ---------------------- +// // --- Class IsEmpty. --- +// // ---------------------- + +// // DOMAINS 1) R -> B +// // 2) C -> B + +// ///////////////////////////////// + +// // ---------------------- +// // --- Class Trace. --- +// // ---------------------- + +// // DOMAINS 1) R -> R +// // 2) C -> C + +// //////////////////////////////// + +// // -------------------- +// // --- Class OpIns. --- +// // -------------------- + +// // DOMAINS 1) RxRxR -> {} +// // 2) RxRxRxR -> {} +// // 3) CxRxR -> {} +// // 4) CxRxRxC -> {} +// // 5) CxRxC -> {} + +// //////////////////////////////// + +// // -------------------- +// // --- Class OpExt. --- +// // -------------------- + +// // DOMAINS 1) RxR -> R +// // 2) CxR -> C +// // 3) CxRxR -> C + +// //////////////////////////////// + +// // ------------------- +// // --- Class Disp. --- +// // ------------------- + +// // DOMAINS 1) R -> R +// // 2) C -> R +// // 3) G -> R + +// //////////////////////////////// + +// // ---------------------- +// // --- Class OpEqual. --- +// // ---------------------- + +// // DOMAINS 1) R -> R +// // 2) C -> C +// // 3) G -> G + +// //////////////////////////////// + +// // -------------------- +// // --- Class Mopen. --- +// // -------------------- + +// // DOMAINS 1) G -> F +// // 2) GxG -> F +// // 3) GxGxR -> {F,R} +// // 4) G -> {F,R} +// // 5) GxG -> {F,R} + +// //////////////////////////////// + +// // ------------------- +// // --- Class Mput. --- +// // ------------------- + +// // DOMAINS 1) RxGxF -> {} +// // 2) RxGxF -> N + +// //////////////////////////////// + +// // ------------------- +// // --- Class Mget. --- +// // ------------------- + +// // DOMAINS 1) RxGxF -> N + +// //////////////////////////////// + +// // --------------------- +// // --- Class Mclose. --- +// // --------------------- + +// // DOMAINS 1) {} -> N +// // 2) F -> N + +// //////////////////////////////// + +// // --------------------- +// // --- Class Mseek. --- +// // --------------------- + +// // DOMAINS 1) R -> {} +// // 2) RxF -> {} +// // 3) RxFxG -> {} + +// //////////////////////////////// + +// // --------------------- +// // --- Class Convol. --- +// // --------------------- + +// // DOMAINS 1) RxR->R + // 2) CxC->C + // 3) RxC->C + // 4) CxR->C + // 5) RxR->{R,R} + // 6) CxC->{C,C} + // 7) RxC->{C,C} + // 8) CxR->{C,C} + // 9) CxC->{C,C} + // 10) RxRxR->{R,R} + // 11) RxCxC->{C,C} + // and so on ….. + + +// //////////////////////////////// + + +// // ------------------- +// // --- Class IFFT. --- +// // ------------------- + +// // DOMAINS 1) R->C + // 2) C->C + + // //////////////////////////////// + +// // ------------------ +// // --- Class FFT. --- +// // ------------------ + +// // DOMAINS 1) R->C + // 2) RxN->C + // 3) C->C + // 4) CxN->C + // 5) RxNxN->C + // 6) CxNxN->C + // 7) RxNxNxN->C + // 8) CxNxNxN->C + +// //////////////////////////////// + +// // ----------------------- +// // --- Class FFTShift. --- +// // ----------------------- + +// // DOMAINS 1) R->R + // 2) C->C + // 3) RxR->R + // 4) RxG->R + // 5) CxR->C + // 6) CxG->C + +// //////////////////////////////// + +// // -------------------- +// // --- Class Meanf. --- +// // -------------------- + +// // DOMAINS 1) R->R + // 2) C->C + // 3) CxSel->C + // 4) RxSel->R + +// //////////////////////////////// + +// // -------------------- +// // --- Class Frmag. --- +// // -------------------- + +// // DOMAINS 1) RxN->R + // 2) RxN->{R,R} + // 3) RxRxN->R + // 4) RxRxN->{R,R} + +// //////////////////////////////// + +// // ------------------ +// // --- Class Lev. --- +// // ------------------ + +// // DOMAINS 1) R->R + // 2) R->{R,R} + // 3) R->{R,R,R} + // 4) C->C + // 5) C->{C,C} + // 6) C->{C,C,C} + +// //////////////////////////////// + +// // -------------------------- +// // --- Class OpBackSlash. --- +// // -------------------------- + +// // DOMAINS 1) RxR->R + // 2) CxC->C + // 3) RxC->C + // 4) CxR->C + +// //////////////////////////////// + +// // ----------------------- +// // --- Class Cepstrum. --- +// // ----------------------- + +// // DOMAINS 1) RxR->C + // 2) RxC->C + +// //////////////////////////////// + +// // ----------------------- +// // --- Class Spec. --- +// // ----------------------- + +// // DOMAINS 1) R->R + // 2) C->C + // 3) R->{R,R} + // 4) C->{C,C} + +// //////////////////////////////// + +// // ------------------- +// // --- Class Part. --- +// // ------------------- + +// // DOMAINS 1) GxN->G + +// //////////////////////////////// + +// // ----------------------- +// // --- Class Strindex. --- +// // ----------------------- + +// // DOMAINS 1) GxG->N + +// //////////////////////////////// + +// // ----------------------- +// // --- Class StrSubSt. --- +// // ----------------------- + +// // DOMAINS 1) GxGxG->G + +// //////////////////////////////// + + +// //////////////////////////////// +// //////////////////////////////// +// // fine parte introdotta alberto +// //////////////////////////////// +// //////////////////////////////// + +// //RNU se puoi sistema meglio la parte introdotta da al. +endfunction diff --git a/macros/ToolInitialization/INIT_GenAnnFLFunctions.sci b/macros/ToolInitialization/INIT_GenAnnFLFunctions.sci new file mode 100644 index 00000000..4f83814d --- /dev/null +++ b/macros/ToolInitialization/INIT_GenAnnFLFunctions.sci @@ -0,0 +1,28 @@ +function INIT_GenAnnFLFunctions(FunctionName,FunctionsOutDir,ClassName,ReportFile,ExtensionCAnnFun) +// function INIT_GenAnnFLFunctions(FunctionName,FunctionsOutDir,ClassName,ReportFile,ExtensionCAnnFun) +// ----------------------------------------------------------------- +// Generates annotation or file list files. +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 17-Jun-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),5,5); + +FunctionExtension = ExtensionCAnnFun; +FunctionFileName = fullfile(FunctionsOutDir,FunctionName+FunctionExtension); +PrintStringInfo('CLASS: '+ClassName,FunctionFileName,'file','y'); + +endfunction diff --git a/macros/ToolInitialization/INIT_GenFileInfo.sci b/macros/ToolInitialization/INIT_GenFileInfo.sci new file mode 100644 index 00000000..62131838 --- /dev/null +++ b/macros/ToolInitialization/INIT_GenFileInfo.sci @@ -0,0 +1,112 @@ +function FileInfo = INIT_GenFileInfo(WorkingDir,OutCCCodeDir,UserSciFilesPaths) +// function FileInfo = INIT_GenFileInfo(WorkingDir,OutCCCodeDir,UserSciFilesPaths) +// ----------------------------------------------------------------- +// #RNU_RES_B +// This function creates and initializes FileInfo structure. +// +// Input data: +// WorkingDir: see description in the SCI2CInputParameters.sce file. +// OutCCCodeDir: see description in the SCI2CInputParameters.sce file. +// UserSciFilesPaths: see description in the SCI2CInputParameters.sce file. +// +// Output data: +// FileInfo: structure containing all info about SCI2C files. +// +// #RNU_RES_E +// Status: +// 03-Jan-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),3,3); + + +// ------------------------- +// --- Main directories. --- +// ------------------------- +FileInfo.SCI2CMainDir = pwd(); +FileInfo.WorkingDir = WorkingDir; +FileInfo.OutCCCodeDir = OutCCCodeDir; +FileInfo.UserSciFilesPaths = UserSciFilesPaths; + +// ------------------- +// --- .dat Files. --- +// ------------------- +FileInfo.FileInfoDatFile = fullfile(FileInfo.WorkingDir,'FileInfo.dat'); +FileInfo.SharedInfoDatFile = fullfile(FileInfo.WorkingDir,'SharedInfo.dat'); +FileInfo.GlobalVarFileName = fullfile(FileInfo.WorkingDir,'GBLVAR.dat'); +FileInfo.ASTStackDataFile = fullfile(FileInfo.WorkingDir,'ASTStack.dat'); + +// ---------------------- +// --- SCI2C Library. --- +// ---------------------- +FileInfo.SCI2CLibDir = fullfile(FileInfo.WorkingDir,'SCI2CLib'); + +FileInfo.SCI2CLibSCIAnnDir = fullfile(FileInfo.SCI2CLibDir,'SCIAnnotations'); +FileInfo.SCI2CLibSCIAnnFun = fullfile(FileInfo.SCI2CLibSCIAnnDir,'Functions'); +FileInfo.SCI2CLibSCIAnnCls = fullfile(FileInfo.SCI2CLibSCIAnnDir,'Classes'); + +FileInfo.SCI2CLibSCIFunListDir = fullfile(FileInfo.SCI2CLibDir,'SCIFunctionList'); +FileInfo.SCI2CLibSCIFLFun = fullfile(FileInfo.SCI2CLibSCIFunListDir,'Functions'); +FileInfo.SCI2CLibSCIFLCls = fullfile(FileInfo.SCI2CLibSCIFunListDir,'Classes'); + +FileInfo.SCI2CLibCAnnDir = fullfile(FileInfo.SCI2CLibDir,'CAnnotations'); +FileInfo.SCI2CLibCAnnFun = fullfile(FileInfo.SCI2CLibCAnnDir,'Functions'); +FileInfo.SCI2CLibCAnnCls = fullfile(FileInfo.SCI2CLibCAnnDir,'Classes'); + +FileInfo.SCI2CLibCFunListDir = fullfile(FileInfo.SCI2CLibDir,'CFunctionList'); +FileInfo.SCI2CLibCFLFun = fullfile(FileInfo.SCI2CLibCFunListDir,'Functions'); +FileInfo.SCI2CLibCFLCls = fullfile(FileInfo.SCI2CLibCFunListDir,'Classes'); + + +// ----------------------- +// --- USER2C Library. --- +// ----------------------- +FileInfo.USER2CLibDir = fullfile(FileInfo.WorkingDir,'USER2CLib'); + +FileInfo.USER2CLibSCIAnnDir = fullfile(FileInfo.USER2CLibDir,'SCIAnnotations'); +FileInfo.USER2CLibSCIAnnFun = fullfile(FileInfo.USER2CLibSCIAnnDir,'Functions'); +FileInfo.USER2CLibSCIAnnCls = fullfile(FileInfo.USER2CLibSCIAnnDir,'Classes'); + +FileInfo.USER2CLibSCIFunListDir = fullfile(FileInfo.USER2CLibDir,'SCIFunctionList'); +FileInfo.USER2CLibSCIFLFun = fullfile(FileInfo.USER2CLibSCIFunListDir,'Functions'); +FileInfo.USER2CLibSCIFLCls = fullfile(FileInfo.USER2CLibSCIFunListDir,'Classes'); + +FileInfo.USER2CLibCAnnDir = fullfile(FileInfo.USER2CLibDir,'CAnnotations'); +FileInfo.USER2CLibCAnnFun = fullfile(FileInfo.USER2CLibCAnnDir,'Functions'); +FileInfo.USER2CLibCAnnCls = fullfile(FileInfo.USER2CLibCAnnDir,'Classes'); + +FileInfo.USER2CLibCFunListDir = fullfile(FileInfo.USER2CLibDir,'CFunctionList'); +FileInfo.USER2CLibCFLFun = fullfile(FileInfo.USER2CLibCFunListDir,'Functions'); +FileInfo.USER2CLibCFLCls = fullfile(FileInfo.USER2CLibCFunListDir,'Classes'); + +// ---------------------- +// --- Function List. --- +// ---------------------- +FileInfo.FunctionList.MainDir = fullfile(FileInfo.WorkingDir,'FunctionList'); +FileInfo.FunctionList.SCI2CAvailableCDat = fullfile(FileInfo.FunctionList.MainDir,'SCI2CAvailableC.dat'); +FileInfo.FunctionList.USER2CAvailableCDat = fullfile(FileInfo.FunctionList.MainDir,'USER2CAvailableC.dat'); +FileInfo.FunctionList.ConvertedDat = fullfile(FileInfo.FunctionList.MainDir,'Converted.dat'); +FileInfo.FunctionList.ToBeConvertedDat = fullfile(FileInfo.FunctionList.MainDir,'ToBeConverted.dat'); +FileInfo.FunctionList.FunInfoDatDir = fullfile(FileInfo.FunctionList.MainDir,'FunInfoDatFiles'); + +// -------------------- +// --- Other Files. --- +// -------------------- +FileInfo.GeneralReport = fullfile(FileInfo.WorkingDir,'SCI2CGeneralReport.txt'); + +// ----------------------------------- +// --- C-Style paths and Makefile. --- +// ----------------------------------- +//-- FileInfo.CStyleSCI2CMainDir = ConvertPathMat2C(FileInfo.SCI2CMainDir,SharedInfo.CCompilerPathStyle); +//-- FileInfo.CStyleOutCCCodeDir = ConvertPathMat2C(OutCCCodeDir,SharedInfo.CCompilerPathStyle); +FileInfo.CStyleSCI2CMainDir = pathconvert(FileInfo.SCI2CMainDir, %f, %f, 'u'); +FileInfo.CStyleOutCCCodeDir = pathconvert(OutCCCodeDir, %f, %f, 'u'); +FileInfo.MakefileFilename = fullfile(FileInfo.CStyleOutCCCodeDir,'Makefile'); +FileInfo.MakefileTemplate = fullfile(SCI+'/contrib/scilab2c/macros/CCodeGeneration','SCI2CMakefileTemplate.rc'); +endfunction diff --git a/macros/ToolInitialization/INIT_GenLibraries.sci b/macros/ToolInitialization/INIT_GenLibraries.sci new file mode 100644 index 00000000..eb2c01b7 --- /dev/null +++ b/macros/ToolInitialization/INIT_GenLibraries.sci @@ -0,0 +1,61 @@ +function INIT_GenLibraries(FileInfoDatFile) +// function INIT_GenLibraries(FileInfoDatFile) +// ----------------------------------------------------------------- +// #RNU_RES_B +// This function initializes the SCI2C and USER libraries. +// For each Scilab function a .ann file is created where the function +// annotations are listed into it. +// #RNU_RES_E +// +// Input data: +// FileInfoDatFile: name of the .dat file containing the FileInfo structure. +// +// Output data: +// --- +// +// Status: +// 12-Jun-2007 -- Nutricato Raffaele: Author. +// 03-Jan-2008 -- Nutricato Raffaele: Changed directory structure. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +// --- Load File Info Structure. --- +clear FileInfo +load(FileInfoDatFile,'FileInfo'); + +// --- Load Shared Info Structure. --- +clear SharedInfo +load(FileInfo.SharedInfoDatFile,'SharedInfo'); + +PrintStepInfo('Initialize SCI2C and USER2C Libraries.',... + FileInfo.GeneralReport,'both'); +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// ----------------------------------------------------------- +// --- Fills SCI2C and USER2C libs with appropriate files. --- +// ----------------------------------------------------------- +INIT_FillSCI2LibCDirs(FileInfo,SharedInfo.Extension); + +// #RNU_RES_B +//NUT the following functions will be useful in next release +//NUT for advanced use of SCI2C +//INIT_FillSCI2LibSCIDirs(FileInfo,SharedInfo.Extension); +//INIT_FillUSER2LibCDirs(FileInfo,SharedInfo.Extension); +//INIT_FillUSER2LibSCIDirs(FileInfo,SharedInfo.Extension); +// --------------------------------------------------------------- +// --- End Fills SCI2C and USER2C libs with appropriate files. --- +// --------------------------------------------------------------- +// #RNU_RES_E +endfunction diff --git a/macros/ToolInitialization/INIT_GenSharedInfo.sci b/macros/ToolInitialization/INIT_GenSharedInfo.sci new file mode 100644 index 00000000..61c17e19 --- /dev/null +++ b/macros/ToolInitialization/INIT_GenSharedInfo.sci @@ -0,0 +1,118 @@ +function SharedInfo = INIT_GenSharedInfo(RunMode,UserScilabMainFile,TotTempScalarVars,EnableTempVarsReuse,Sci2CLibMainHeaderFName,CopySciCodeIntoCCode) +// function SharedInfo = INIT_GenSharedInfo(WorkingDir,OutCCCodeDir,UserSciFilesPaths,... +// RunMode,UserScilabMainFile,TotTempScalarVars,EnableTempVarsReuse,Sci2CLibMainHeaderFName) +// ----------------------------------------------------------------- +// #RNU_RES_B +// This function creates and initializes SharedInfo structure. +// +// Input data: +// WorkingDir: see description in the SCI2CInputParameters.sce file. +// OutCCCodeDir: see description in the SCI2CInputParameters.sce file. +// UserSciFilesPaths: see description in the SCI2CInputParameters.sce file. +// RunMode: see description in the SCI2CInputParameters.sce file. +// UserScilabMainFile: see description in the SCI2CInputParameters.sce file. +// TotTempScalarVars: see description in the SCI2CInputParameters.sce file. +// EnableTempVarsReuse: see description in the SCI2CInputParameters.sce file. +// +// Output data: +// SharedInfo: structure containing all info about general parameters +// used by SCI2C. +// +// #RNU_RES_E +// Status: +// 03-Jan-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ + +//-- SCI2CNInArgCheck(argn(2),8,8); + + +// ------------------------------ +// --- Initialize SharedInfo. --- +// ------------------------------ +//-- SharedInfo.CCompilerPathStyle = CCompilerPathStyle; +SharedInfo.RunMode = RunMode; +SharedInfo.Sci2CLibMainHeaderFName = pathconvert(Sci2CLibMainHeaderFName, %f, %f, 'u'); + +// #RNU_RES_B +// File names of the next .sci files to be converted in AST and +// successively into C. +// #RNU_RES_E +SharedInfo.NextSCIFileName = UserScilabMainFile; +[scipath,funname,sciext] = fileparts(UserScilabMainFile); +SharedInfo.SCIMainFunName = funname; +SharedInfo.CMainFunName = 'main'; +SharedInfo.NextSCIFunName = SharedInfo.SCIMainFunName; //NUT: per ora no so cosa metter +SharedInfo.NextCFunName = SharedInfo.CMainFunName; //NUT: per ora no so cosa metter //NUT: questo viene aggiornato dalla C_Funcall +SharedInfo.NextSCIFunNumber = 1; +SharedInfo.NFilesToTranslate = 1; + + +// --- Annotations. --- +SharedInfo.Annotations.GBLVAR = 'global'; +SharedInfo.Annotations.DataPrec = {'SCI2Cint','float','double'}; +SharedInfo.Annotations.FUNNIN = 'NIN='; +SharedInfo.Annotations.FUNNOUT = 'NOUT='; +SharedInfo.Annotations.FUNTYPE = '''OUT(''+string(SCI2C_nout)+'').TP='''; // Type includes also precision. +SharedInfo.Annotations.FUNSIZE = '''OUT(''+string(SCI2C_nout)+'').SZ(''+string(SCI2C_nelem)+'')= '''; +SharedInfo.Annotations.FUNCLASS = 'CLASS: '; +SharedInfo.Annotations.USERFUN = '//SCI2C: '; +// #RNU_RES_B +// Note when you execute the following code: + // SCI2C_nout=1; + // SCI2C_nelem=0; + // eval(SharedInfo.Annotations.FUNSIZE) + // you get: + // O1SIZE[0] = + +// Info related to temp variables used in the C code. +// #RNU_RES_E +SharedInfo.TotTempScalarVars = TotTempScalarVars; +SharedInfo.UsedTempScalarVars = 0; +SharedInfo.TempScalarVarsName = '__Scalar'; +//NUT: verificare se le seguenti due variabili sono utili. Le sto usando in AST2Ccode +SharedInfo.WorkAreaUsedBytes = WorkAreaSizeBytes; +SharedInfo.UsedTempScalarVars = WorkAreaSizeBytes; +// Info related to temp variables used in the AST reading phase. +SharedInfo.ASTReader.fidAST = -1; +SharedInfo.ASTReader.UsedTempVars = 0; +SharedInfo.ASTReader.TempVarsName = '__temp'; +SharedInfo.ASTReader.TempForCntVarsName = '__tmpcnt'; +SharedInfo.ASTReader.TempForValVarsName = '__TmpVal'; +SharedInfo.ASTReader.TempWhileCntVarsName = '__tmpWhilecnt';//NUT: vedi se serve. +SharedInfo.ASTReader.TempWhileValVarsName = '__TmpWhileVal'; //NUT: vedi se serve +SharedInfo.ASTReader.EnableTempVarsReuse = EnableTempVarsReuse; //NUT: non so se la devo rimuovere. +SharedInfo.ASTReader.ReusableTempVars = [];//NUT: to be removed + +SharedInfo.NIndent = 0; // Indentation Level. +SharedInfo.SkipNextEqual = 0; // 1 = the next equal in the AST will not produce C code. +SharedInfo.SkipNextPrec = 0; // 1 = the next precision specifier in the AST will not produce C code. +SharedInfo.SkipNextFun = 0; +SharedInfo.CopySciCodeIntoCCode = CopySciCodeIntoCCode; +SharedInfo.CountNestedIf = 0; // Number of nested if. + +SharedInfo.CFunId.OpColon = 3; +SharedInfo.CFunId.EqScalar = 4; +SharedInfo.CFunId.EqMatrix = 5; +SharedInfo.CFunId.GenFunMtx = 6; // (scalar functions are fall in the scalar equal category.) + +SharedInfo = INIT_SharedInfoEqual(SharedInfo); +// ------------------------ +// --- File Extensions. --- +// ------------------------ +SharedInfo.Extension.AnnotationFunctions = '.ann'; // Stands for annotation +SharedInfo.Extension.AnnotationClasses = '.acls'; // Stands for annotation class. +SharedInfo.Extension.FuncListFunctions = '.lst'; // Stands for list +SharedInfo.Extension.FuncListClasses = '.lcls'; // Stands for list class + +// ------------------------ +// --- Resize Approach. --- +// ------------------------ +SharedInfo.ResizeApproach = 'NO_RESIZE'; // 'NO_RESIZE', 'RESIZE_ALL', 'RESIZE_TEMP', 'RESIZE_LOCAL', 'RESIZE_GLOBAL', 'REALLOC_ALL_RESIZE_ALL' +endfunction diff --git a/macros/ToolInitialization/INIT_LoadLibraries.sci b/macros/ToolInitialization/INIT_LoadLibraries.sci new file mode 100644 index 00000000..35ff18af --- /dev/null +++ b/macros/ToolInitialization/INIT_LoadLibraries.sci @@ -0,0 +1,64 @@ +function INIT_LoadLibraries(FileInfoDatFile) +// function INIT_LoadLibraries(FileInfoDatFile) +// ----------------------------------------------------------------- +// This function loads the SCI2C and USER libraries. +// +// Input data: +// FileInfoDatFile: name of the .dat file containing the FileInfo structure. +// +// Output data: +// --- +// +// Status: +// 12-Jun-2007 -- Raffaele Nutricato: Author. +// 03-Jan-2008 -- Raffaele Nutricato: Changed directory structure. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +// --- Load File Info Structure. --- +clear FileInfo +load(FileInfoDatFile,'FileInfo'); + +// --- Load Shared Info Structure. --- +clear SharedInfo +load(FileInfo.SharedInfoDatFile,'SharedInfo'); +PrintStepInfo('Load SCI2C and USER2C Libraries.',FileInfo.GeneralReport,'both'); +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// ---------------------------------- +// --- Initialize Function Lists. --- +// ---------------------------------- +SCI2CAvailableC = []; +USER2CAvailableC = []; +Converted = []; +ToBeConverted(1).SCIFunctionName = SharedInfo.NextSCIFunName; +ToBeConverted(1).CFunctionName = SharedInfo.NextCFunName; + +// --- Read the list of library functions available. --- +[SCI2CAvailableC,SCI2CNElem] = FL_ExtractFuncList(FileInfo.SCI2CLibCFLFun,FileInfo.SCI2CLibCFLCls,... + SharedInfo.Annotations.FUNCLASS,SharedInfo.Extension.FuncListClasses,FileInfo.GeneralReport); + +[USER2CAvailableC,USER2CNElem] = FL_ExtractFuncList(FileInfo.USER2CLibCFLFun,FileInfo.USER2CLibCFLCls,... + SharedInfo.Annotations.FUNCLASS,SharedInfo.Extension.FuncListClasses,FileInfo.GeneralReport); + +// --- Save .dat files. --- +Available = SCI2CAvailableC; +save(FileInfo.FunctionList.SCI2CAvailableCDat,Available); +Available = USER2CAvailableC; +save(FileInfo.FunctionList.USER2CAvailableCDat,Available); +save(FileInfo.FunctionList.ConvertedDat,Converted); +save(FileInfo.FunctionList.ToBeConvertedDat,ToBeConverted); + +endfunction diff --git a/macros/ToolInitialization/INIT_RemoveDirs.sci b/macros/ToolInitialization/INIT_RemoveDirs.sci new file mode 100644 index 00000000..536b909e --- /dev/null +++ b/macros/ToolInitialization/INIT_RemoveDirs.sci @@ -0,0 +1,71 @@ +function INIT_RemoveDirs(FileInfo,SharedInfoRunMode) +// function INIT_RemoveDirs(FileInfo,SharedInfoRunMode) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Removes existing directories according to the RunMode +// specified by the user. +// +// Input data: +// FileInfo: structure containing all info about SCI2C files. +// SharedInfoRunMode: execution mode specified by the user in +// the SCI2CInputParameters.sce file. +// +// Output data: +// --- +// +// #RNU_RES_E +// Status: +// 03-Jan-2008 -- Raffaele Nutricato: Author. +// +// Copyright 2008 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ---------------------------------------------------- +// --- Remove previous versions of SCI2C files/dir. --- +// ---------------------------------------------------- +if (SharedInfoRunMode == 'GenLibraryStructure' | SharedInfoRunMode == 'All') + disp('Removing directory: '+FileInfo.WorkingDir); + disp('Removing directory: '+FileInfo.OutCCCodeDir); + // Remove software<->user interaction. + // yesno=input('Are you sure [y/n]?','string'); + yesno = 'y'; + + if (yesno=='y') + rmdir(FileInfo.WorkingDir,'s'); // delete WorkingDir if it exists due to previous translations... + mdelete(FileInfo.OutCCCodeDir+'/*.h'); // delete .h files generated in previous translations (if any). + mdelete(FileInfo.OutCCCodeDir+'/*.c'); // delete .h files generated in previous translations (if any). + mdelete(FileInfo.OutCCCodeDir+'/Makefile'); // delete .h files generated in previous translations (if any). + // Note I don't delete includes, interfaces and and src directories to avoid recompiling them every time + // a new translation is launched. I only delete source files generated by user. + + else + SCI2Cerror('Cannot continue, because you don''t want to delete: '+FileInfo.WorkingDir); + SCI2Cerror('Cannot continue, because you don''t want to delete: '+FileInfo.OutCCCodeDir); + end +elseif (SharedInfoRunMode == 'Translate') + // #RNU_RES_B + //NUT: non cancella le cartelle dei file C creati nella iterazione precedente + //NUT: occorre specificarlo bene nel manuale. + // #RNU_RES_E + disp('Removing directory: '+FileInfo.OutCCCodeDir); + // Remove software<->user interaction. + // yesno=input('Are you sure [y/n]?','string'); + yesno = 'y'; + if (yesno=='y') + rmdir(FileInfo.OutCCCodeDir,'s'); + else + SCI2Cerror('Cannot continue, because you don''t want to delete: '+FileInfo.OutCCCodeDir); + end +else + disp('Unknown RunMode: ""'+SharedInfoRunMode+'"".'); + disp('Please check RunMode parameter in the SCI2CInputParameters.sce file'); + SCI2Cerror(' '); +end + +endfunction diff --git a/macros/ToolInitialization/INIT_SCI2C.sci b/macros/ToolInitialization/INIT_SCI2C.sci new file mode 100644 index 00000000..00f25d88 --- /dev/null +++ b/macros/ToolInitialization/INIT_SCI2C.sci @@ -0,0 +1,151 @@ +function [FileInfoDatFile,SharedInfoDatFile] = ... + INIT_SCI2C(UserScilabMainFile, UserSciFilesPaths, SCI2COutputDir, RunMode) +// function [FileInfoDatFile,SharedInfoDatFile] = INIT_SCI2C(SCI2CInputPrmFile) +// ----------------------------------------------------------------- +// #RNU_RES_B +// This function initializes the SCI2C tool according +// to the input parameters recorded in the SCI2CParameters. +// All info will be stored into FileInfoDatFile. +// +// Input data: +// SCI2CInputPrmFile: name of the .sce file containing input parameters. +// +// Output data: +// FileInfoDatFile: name of the .dat file containing the FileInfo structure. +// SharedInfoDatFile: it is a buffer containing parameters that are exchanged by the +// functions of the SCI2C tool. +// #RNU_RES_E +// Status: +// 13-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// #RNU_RES_B +//NUT: questo file e' da rivedere quando il tool funzionera al 50% +// #RNU_RES_E +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +//SCI2CNInArgCheck(argn(2),1,1); + +// ------------------------------ +// --- Read Input Parameters. --- +// ------------------------------ +//exec(SCI2CInputPrmFile); +// #RNU_RES_B +//NUT: queste variabili sono per usi futuri. +//NUT: e saranno introdotti nel parameter file. +// #RNU_RES_E +WorkAreaSizeBytes = 2000*8; // 2000 locations of double +// #RNU_RES_B +// Maximum number of temporary scalar variables that can be used. +// #RNU_RES_E +TotTempScalarVars = 20; +EnableTempVarsReuse = 0; // 0 = Disable; 1 = Enable. + + +// #RNU_RES_B +//NUT: I prefer to don't show this parameters to the user. +// --- Directory where all the products of the SCI2C tool will be stored. --- +// #RNU_RES_E +//-- [SCI2CResultDir,tmpfile,tmpext] = fileparts(SCI2CInputPrmFile); +SCI2CResultDir = SCI2COutputDir; + + +WorkingDir = fullfile(SCI2CResultDir,'SCI2CTmpResultsReports'); +// #RNU_RES_B +// --- Directory where the generated C code will be stored. --- +// #RNU_RES_E +OutCCCodeDir = SCI2CResultDir; + +// ------------------------------ +// --- Initialize SharedInfo. --- +// ------------------------------ +//SharedInfo = INIT_GenSharedInfo(WorkingDir,OutCCCodeDir,UserSciFilesPaths,... +// RunMode,UserScilabMainFile,TotTempScalarVars,EnableTempVarsReuse,Sci2CLibMainHeaderFName); + +//-- FIXME : MainLibHeader and Verbose mode are (?) configurable +SharedInfo = INIT_GenSharedInfo(RunMode,UserScilabMainFile, ... + TotTempScalarVars,EnableTempVarsReuse,"sci2clib.h", %t); + +// ---------------------------- +// --- Initialize FileInfo. --- +// ---------------------------- +FileInfo = INIT_GenFileInfo(WorkingDir,OutCCCodeDir,UserSciFilesPaths); +PrintStepInfo('SCI2C hArtes/POLIBA Tool!!!',FileInfo.GeneralReport,'stdout'); + +// ---------------------------------------------------- +// --- Remove previous versions of SCI2C files/dir. --- +// ---------------------------------------------------- +INIT_RemoveDirs(FileInfo,SharedInfo.RunMode); + +// --------------------------- +// --- Create Directories. --- +// --------------------------- +INIT_CreateDirs(FileInfo); +PrintStepInfo('SCI2C hArtes/POLIBA Tool!!!',FileInfo.GeneralReport,'file'); + +// ------------------------------ +// --- Initialize GlobalVars. --- +// ------------------------------ +GlobalVars = []; +save(FileInfo.GlobalVarFileName,GlobalVars); + +// ---------------------------------- +// --- Initialize Main .dat file. --- +// ---------------------------------- +//NUT: qui va sistemata. +clear FunInfo +//NUT: qua conviene fare una unica funzione. +FunInfo.SCIFunctionName = SharedInfo.NextSCIFunName; +FunInfo.CFunctionName = SharedInfo.NextCFunName; +FunInfo.FunPrecSpecifier = ''; //NUT: si riferiscono al main verifica se sono corrette +FunInfo.FunTypeAnnot = ''; //NUT: si riferiscono al main verifica se sono corrette +FunInfo.FunSizeAnnot = ''; //NUT: si riferiscono al main verifica se sono corrette +FunInfo.NInArg = 0;//NUT: si riferiscono al main verifica se sono corrette +FunInfo.InArg(1).Name = '';//NUT: si riferiscono al main verifica se sono corrette +FunInfo.InArg(1).Type = '';//NUT: si riferiscono al main verifica se sono corrette +FunInfo.InArg(1).Value = %nan;//NUT: si riferiscono al main verifica se sono corrette +FunInfo.InArg(1).Size(1) = '';//NUT: si riferiscono al main verifica se sono corrette +FunInfo.InArg(1).Dimension = '';//NUT: si riferiscono al main verifica se sono corrette +FunInfo.InArg(2).Size(2) = '';//NUT: si riferiscono al main verifica se sono corrette +FunInfo.NOutArg = 0;//NUT: si riferiscono al main verifica se sono corrette +FunInfo.OutArg(1).Name = ''; +FunInfo.OutArg(1).Type = ''; +FunInfo.OutArg(1).Size(1) = ''; +FunInfo.OutArg(1).Size(2) = ''; +FunInfo.OutArg(1).Dimension = ''; +FunInfo.PosFirstOutScalar = 0; +FunInfo.LibTypeInfo = 'USER2C'; +save(fullfile(FileInfo.FunctionList.FunInfoDatDir,FunInfo.CFunctionName+'.dat'),FunInfo); +clear FunInfo + +// ------------------------------------- +// --- Initialize ASTStack.dat file. --- +// ------------------------------------- +//NUT: questa struttura deve sostituire le variabili global usate per lo stack +clear ASTStack +ASTStack.SCI2CSTACK = 'EMPTYSTACK'; +ASTStack.StackPosition = 1; +ASTStack.STACKDEDUG = 0; +save(FileInfo.ASTStackDataFile,ASTStack); +clear ASTStack + +// --------------------------------------------- +// --- Generate new versions of SCI2C files. --- +// --------------------------------------------- +save(FileInfo.FileInfoDatFile,FileInfo); +save(FileInfo.SharedInfoDatFile,SharedInfo); +FileInfoDatFile = FileInfo.FileInfoDatFile; +SharedInfoDatFile = FileInfo.SharedInfoDatFile; + +global anscounter; //NUT: just to fix problem with ans variables. +anscounter = 0; + +endfunction +// #RNU_RES_B +//NUT: quando genero il c della funzione utente devo anche generare il corrispondente file delle includes. +//NUT: perche' la main non la devo annotare, secondo me occorre annotarla.? +// #RNU_RES_E diff --git a/macros/ToolInitialization/INIT_SCI2CLoader.sce b/macros/ToolInitialization/INIT_SCI2CLoader.sce new file mode 100644 index 00000000..bd07f892 --- /dev/null +++ b/macros/ToolInitialization/INIT_SCI2CLoader.sce @@ -0,0 +1,72 @@ +// ----------------------------------------------------------------- +// Load SCI2C directories and files. +// +// Input data: +// SCI2CLoaderMainDir: path of the directory where this script (main.sce) is stored. +// +// Output data: +// --- +// +// Status: +// 11-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CLoaderMainDir = '..'; + +// --------------------------- +// --- Define Directories. --- +// --------------------------- +// Directory containing functions related to the management of the Abstract Syntactic tree. +ASTManagement = 'ASTManagement'; + +// Directory containing functions that produce the C code. +CCodeGeneration = 'CCodeGeneration'; + +// Directory containing functions that perform general tasks. +GeneralFunctions = 'GeneralFunctions'; + +// Directory containing functions that perform the initialization of the SCI2C tool. +ToolInitialization = 'ToolInitialization'; + +// Directory containing functions that perform the function annotation. +FunctionAnnotation = 'FunctionAnnotation'; + +// Directory containing functions that handle symbol table. +SymbolTable = 'SymbolTable'; + +// Directory containing functions that handle function lists. +FunctionList = 'FunctionList'; + +// Directory containing functions that print SCI2C error messages. +ErrorMessages = 'ErrorMessages'; + + +// ------------------------------- +// --- End Define Directories. --- +// ------------------------------- + +// ------------- +// --- getd. --- +// ------------- +getd(fullfile(SCI2CLoaderMainDir,ASTManagement)); +getd(fullfile(SCI2CLoaderMainDir,CCodeGeneration)); +getd(fullfile(SCI2CLoaderMainDir,GeneralFunctions)); +getd(fullfile(SCI2CLoaderMainDir,ToolInitialization)); +getd(fullfile(SCI2CLoaderMainDir,FunctionAnnotation)); +getd(fullfile(SCI2CLoaderMainDir,SymbolTable)); +getd(fullfile(SCI2CLoaderMainDir,FunctionList)); +getd(fullfile(SCI2CLoaderMainDir,ErrorMessages)); +// ----------------- +// --- End getd. --- +// ----------------- + +// ------------- +// --- exec. --- +// ------------- +exec(fullfile(SCI2CLoaderMainDir,ASTManagement,'%program_p.sci')); +// ----------------- +// --- End exec. --- +// ----------------- diff --git a/macros/ToolInitialization/INIT_SharedInfoEqual.sci b/macros/ToolInitialization/INIT_SharedInfoEqual.sci new file mode 100644 index 00000000..690a43f6 --- /dev/null +++ b/macros/ToolInitialization/INIT_SharedInfoEqual.sci @@ -0,0 +1,43 @@ +function SharedInfo = INIT_SharedInfoEqual(SharedInfo) +// function SharedInfo = INIT_SharedInfoEqual(SharedInfo) +// ----------------------------------------------------------------- +// #RNU_RES_B +// This function initializes the SCI2C tool according +// to the input parameters recorded in the SCI2CParameters. +// All info will be stored into FileInfoDatFile. +// +// Input data: +// SCI2CInputPrmFile: name of the .sce file containing input parameters. +// +// Output data: +// FileInfoDatFile: name of the .dat file containing the FileInfo structure. +// SharedInfoDatFile: it is a buffer containing parameters that are exchanged by the +// functions of the SCI2C tool. +// #RNU_RES_E +// Status: +// 13-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// #RNU_RES_B +//NUT: verifica se le variabili sotto elencate ti servono davvero. +//NUT: Sarebbe interessante accorpare tutte le variabili usate per la equal sotto un'unica struttura +//NUT: per esempio SharedInfo.SkipNextEqual +// #RNU_RES_E + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +SharedInfo.Equal.Enabled = 0; // 1 means enabled -> we are inside an equal AST block. +SharedInfo.Equal.NInArg = 0; +SharedInfo.Equal.InArg(1).Name = ''; +SharedInfo.Equal.NOutArg = 0; +SharedInfo.Equal.OutArg(1).Name = ''; +SharedInfo.Equal.Lhs = 0; +SharedInfo.Equal.Nins = 0; // Counts the number of ins found in the lhs of the Equal. + +endfunction diff --git a/macros/ToolInitialization/ManageNextConversion.sci b/macros/ToolInitialization/ManageNextConversion.sci new file mode 100644 index 00000000..8b2546bf --- /dev/null +++ b/macros/ToolInitialization/ManageNextConversion.sci @@ -0,0 +1,87 @@ +function FlagContinueTranslation = ManageNextConversion(FileInfoDatFile) +// function FlagContinueTranslation = ManageNextConversion(FileInfoDatFile) +// ----------------------------------------------------------------- +// //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 +// ----------------------------------------------------------------- + +//NUT: verifica se update e managenexconversion possono essere integrate in un'unica funzione. + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// --------------------- +// --- Load section. --- +// --------------------- +// --- Load File Info Structure. --- +load(FileInfoDatFile,'FileInfo'); + +// --- Load Shared Info Structure. --- +load(FileInfo.SharedInfoDatFile,'SharedInfo'); + +// --- Load ToBeConverted .dat file. --- +load(FileInfo.FunctionList.ToBeConvertedDat,'ToBeConverted'); +// ------------------------- +// --- End load section. --- +// ------------------------- + +FlagContinueTranslation = 0; + +// ------------------------------------ +// --- Finalize the current C code. --- +// ------------------------------------ +C_FinalizeCode(FileInfo,SharedInfo); + +// ------------------------------------------------ +// --- Identify the next function to translate. --- +// ------------------------------------------------ +SharedInfo.NFilesToTranslate = SharedInfo.NFilesToTranslate - 1; +if (SharedInfo.NFilesToTranslate >= 1) + // Remove the translated C function from the ToBeConverted list + ToBeConverted(1) = []; + FlagContinueTranslation = 1; + SharedInfo.NextSCIFunName = ToBeConverted(1).SCIFunctionName; + SharedInfo.NextCFunName = ToBeConverted(1).CFunctionName; + SharedInfo.NextSCIFunNumber = SharedInfo.NextSCIFunNumber + 1; + [FlagFound,SharedInfo.NextSCIFileName] = ... + SCI2CFindFile(FileInfo.UserSciFilesPaths,SharedInfo.NextSCIFunName+'.sci'); + if (FlagFound == 0) + SCI2CerrorFile('Cannot find a scilab file to generate ""'+SharedInfo.NextCFunName+'"".',... + FileInfo.GeneralReport); + end +end +// ---------------------------------------------------- +// --- End Identify the next function to translate. --- +// ---------------------------------------------------- + + +// --------------------- +// --- Save section. --- +// --------------------- +// --- Save Shared Info Structure. --- +save(FileInfo.SharedInfoDatFile,SharedInfo); +clear SharedInfo + +// --- Save ToBeConverted .dat file. --- +save(FileInfo.FunctionList.ToBeConvertedDat,ToBeConverted); +clear ToBeConverted + +clear FileInfo +// ------------------------- +// --- End Save section. --- +// ------------------------- + +endfunction diff --git a/macros/ToolInitialization/SCI2CInputParameters.bkp b/macros/ToolInitialization/SCI2CInputParameters.bkp new file mode 100644 index 00000000..7af3343c --- /dev/null +++ b/macros/ToolInitialization/SCI2CInputParameters.bkp @@ -0,0 +1,87 @@ +// ----------------------------------------------------------------- +// === hArtes/PoliBa/GAP SCI2C tool === +// === Authors: === +// === Raffaele Nutricato === +// === raffaele.nutricato@tiscali.it === +// === Alberto Morea === +// === === +// === *************** === +// === USER PARAMETERS === +// === *************** === +// === === +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------------------ +// --- Specify Paths of User Scilab code. --- +// ------------------------------------------ +UserSciCodeMainDir = 'C:\SCI2CTests\RegressionTests\test999'; + +// --- Path + filename of the .sci main file of the code to be translated. --- +// It is the entry point. +UserScilabMainFile = fullfile(UserSciCodeMainDir,'scilabcode\mainfun.sci'); + +// --- List of the paths containing the .sci files written by the user. --- +UserSciFilesPaths = ... + [... + fullfile(UserSciCodeMainDir,'scilabcode');... + ]; + +// -------------------------- +// --- End Specify paths. --- +// -------------------------- + + +// ---------------------------- +// --- Select the run mode. --- +// ---------------------------- +//RunMode = 'GenLibraryStructure'; +//RunMode = 'Translate'; +RunMode = 'All'; + +// --- Select one of the following options. --- + +// 'GenLibraryStructure'; +// Generates the library structure and exits. It is very +// useful when the user wants to manually change the files stored in that structure +// before running the translation. 'GenLibraryStructure' option forces SCI2C to remove +// the already existing WorkingDir and OutCCCodeDir directories. + +// 'Translate'; +// Performs the translation without generating the library structure. It means that the library +// structure must be already existing. This is useful when the user doesn't want to spend time +// to generate again that structure or when he wants to force the SCI2C tool to access to +// a manually-changed library structure. 'Translate' option forces SCI2C to don't remove +// the already existing WorkingDir. Only OutCCCodeDir directory will be removed. + +// 'All'; +// Performs all the actions listed above. + +// -------------------------------- +// --- End Select the run mode. --- +// -------------------------------- + + +// ---------------------------- +// --- Translation Options. --- +// ---------------------------- +// --- Enable (1) / Disable (0) copy of Scilab code into C code. --- +// If 1 the Scilab code will be copied into the C code in order to show +// how each Scilab code line has been translated into C code. +CopySciCodeIntoCCode = 1; + +// --- Select the path style for the C code. --- +// It can be: +// windows +// unix +// cygwin +CCompilerPathStyle = 'cygwin'; + +// --- Path + File name of the main SCI2C library header file. +Sci2CLibMainHeaderFName = 'C:\Nutricato\OpenProjects\FP6_hArtes\WP2_SCI2C\Software\Scilab2C\CFiles\sci2cincludes\sci2clib.h'; +// -------------------------------- +// --- End Translation Options. --- +// -------------------------------- diff --git a/macros/ToolInitialization/SCI2CInputParameters.sce b/macros/ToolInitialization/SCI2CInputParameters.sce new file mode 100644 index 00000000..7af3343c --- /dev/null +++ b/macros/ToolInitialization/SCI2CInputParameters.sce @@ -0,0 +1,87 @@ +// ----------------------------------------------------------------- +// === hArtes/PoliBa/GAP SCI2C tool === +// === Authors: === +// === Raffaele Nutricato === +// === raffaele.nutricato@tiscali.it === +// === Alberto Morea === +// === === +// === *************** === +// === USER PARAMETERS === +// === *************** === +// === === +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + + +// ------------------------------------------ +// --- Specify Paths of User Scilab code. --- +// ------------------------------------------ +UserSciCodeMainDir = 'C:\SCI2CTests\RegressionTests\test999'; + +// --- Path + filename of the .sci main file of the code to be translated. --- +// It is the entry point. +UserScilabMainFile = fullfile(UserSciCodeMainDir,'scilabcode\mainfun.sci'); + +// --- List of the paths containing the .sci files written by the user. --- +UserSciFilesPaths = ... + [... + fullfile(UserSciCodeMainDir,'scilabcode');... + ]; + +// -------------------------- +// --- End Specify paths. --- +// -------------------------- + + +// ---------------------------- +// --- Select the run mode. --- +// ---------------------------- +//RunMode = 'GenLibraryStructure'; +//RunMode = 'Translate'; +RunMode = 'All'; + +// --- Select one of the following options. --- + +// 'GenLibraryStructure'; +// Generates the library structure and exits. It is very +// useful when the user wants to manually change the files stored in that structure +// before running the translation. 'GenLibraryStructure' option forces SCI2C to remove +// the already existing WorkingDir and OutCCCodeDir directories. + +// 'Translate'; +// Performs the translation without generating the library structure. It means that the library +// structure must be already existing. This is useful when the user doesn't want to spend time +// to generate again that structure or when he wants to force the SCI2C tool to access to +// a manually-changed library structure. 'Translate' option forces SCI2C to don't remove +// the already existing WorkingDir. Only OutCCCodeDir directory will be removed. + +// 'All'; +// Performs all the actions listed above. + +// -------------------------------- +// --- End Select the run mode. --- +// -------------------------------- + + +// ---------------------------- +// --- Translation Options. --- +// ---------------------------- +// --- Enable (1) / Disable (0) copy of Scilab code into C code. --- +// If 1 the Scilab code will be copied into the C code in order to show +// how each Scilab code line has been translated into C code. +CopySciCodeIntoCCode = 1; + +// --- Select the path style for the C code. --- +// It can be: +// windows +// unix +// cygwin +CCompilerPathStyle = 'cygwin'; + +// --- Path + File name of the main SCI2C library header file. +Sci2CLibMainHeaderFName = 'C:\Nutricato\OpenProjects\FP6_hArtes\WP2_SCI2C\Software\Scilab2C\CFiles\sci2cincludes\sci2clib.h'; +// -------------------------------- +// --- End Translation Options. --- +// -------------------------------- diff --git a/macros/ToolInitialization/UpdateSCI2CInfo.sci b/macros/ToolInitialization/UpdateSCI2CInfo.sci new file mode 100644 index 00000000..32085475 --- /dev/null +++ b/macros/ToolInitialization/UpdateSCI2CInfo.sci @@ -0,0 +1,203 @@ +function UpdateSCI2CInfo(FileInfoDatFile) +// function UpdateSCI2CInfo(FileInfoDatFile) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Updates the FileInfo struct according to the new scilab function +// to be converted in C. +// +// Input data: +// FileInfoDatFile: name of the .dat file containing the FileInfo structure. +// +// Output data: +// --- +// +// #RNU_RES_E +// Status: +// 13-Apr-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// --------------------------------- +// --- Load File Info Structure. --- +// --------------------------------- +clear FileInfo +load(FileInfoDatFile,'FileInfo'); + +// ----------------------------------- +// --- Load Shared Info Structure. --- +// ----------------------------------- +clear SharedInfo +load(FileInfo.SharedInfoDatFile,'SharedInfo'); + +// --------------------------------------------------- +// --- Extraction of the function name and number. --- +// --------------------------------------------------- +funname = SharedInfo.NextSCIFunName; +funnumber = SharedInfo.NextSCIFunNumber; +// #RNU_RES_B +//NUT: sicuro che mi serve questa struttura? SharedInfo.NextSCIFunNumber cioe' il numero della funzione a che serve? +// #RNU_RES_E +PrintStepInfo('Start translation of function ""'+funname+'""',... + FileInfo.GeneralReport,'both'); + +// ----------------------------------- +// --- Update File Info structure. --- +// ----------------------------------- +FileInfo.Funct(funnumber).Name = funname; +FileInfo.Funct(funnumber).SCIFileName = SharedInfo.NextSCIFileName; +FileInfo.Funct(funnumber).ASTFileName = fullfile(FileInfo.WorkingDir,funname,funname+'.ast'); +FileInfo.Funct(funnumber).CPass1FileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_pass1.c'); +FileInfo.Funct(funnumber).PfxP1ForProlFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_pass1ProlFor'); +FileInfo.Funct(funnumber).PfxP1ForEpilFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_pass1EpilFor'); +FileInfo.Funct(funnumber).PfxP1WhileProlFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_pass1ProlWhile'); +FileInfo.Funct(funnumber).PfxP1WhileEpilFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_pass1EpilWhile'); +FileInfo.Funct(funnumber).CPass1FreeFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_pass1free.c'); +FileInfo.Funct(funnumber).CPass2FileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_pass2.c'); +FileInfo.Funct(funnumber).Pass1HeaderFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'.h'); +FileInfo.Funct(funnumber).FinalCFileName = fullfile(FileInfo.OutCCCodeDir,SharedInfo.NextCFunName+'.c'); +FileInfo.Funct(funnumber).FinalHeaderFileName = fullfile(FileInfo.OutCCCodeDir,SharedInfo.NextCFunName+'.h'); +FileInfo.Funct(funnumber).CInitVarsFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_initvars.c'); +FileInfo.Funct(funnumber).CDeclarationFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_declarations.c'); +FileInfo.Funct(funnumber).CGblDeclarFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_globaldeclarations.c'); +FileInfo.Funct(funnumber).ReportFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'.rpt'); +FileInfo.Funct(funnumber).LocalVarFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_LOCVAR.dat'); +FileInfo.Funct(funnumber).TempVarFileName = fullfile(FileInfo.WorkingDir,funname,SharedInfo.NextCFunName+'_TMPVAR.dat'); +FileInfo.Funct(funnumber).SCICopyFileName = fullfile(FileInfo.WorkingDir,funname,funname+'_copy.sci'); + + +// ------------------------------------- +// --- Update Shared Info structure. --- +// ------------------------------------- +SharedInfo.NIndent = 0; // Indentation Level. Useful to produce indentated C code. +SharedInfo.SkipNextEqual = 0; // 1 = the next equal in the AST will not produce C code. +SharedInfo.SkipNextPrec = 0; // 1 = the next precision specifier in the AST will not produce C code. +SharedInfo.SkipNextFun = 0; // 1 = the next function in the AST will not produce C code. +SharedInfo.ASTReader.fidAST = -1; +SharedInfo.CountNestedIf = 0; +SharedInfo.CountForTempVars = 0; +SharedInfo.For.Level = 0; +SharedInfo.ForExpr.OnExec = 0; +SharedInfo.ForExpr.IntCntArg = []; +SharedInfo.ForExpr.MtxValCntArg = []; +SharedInfo.ForExpr.SclValCntArg = []; +SharedInfo.ForExpr.OpColonInfoIn1 = ''; +SharedInfo.ForExpr.OpColonInfoIn2 = ''; +SharedInfo.ForExpr.OpColonInfoIn3 = ''; +SharedInfo.ForExpr.AssignmentFun = 0; + +SharedInfo.WhileExpr.OnExec = 0; +SharedInfo.WhileExpr.CondVar = ''; +SharedInfo.WhileExpr.DimCondVar = -1; +SharedInfo.While.Level = 0; +//NUT: anche questa sarebbe da inizializzare con una bella funzione. + + +SharedInfo.CFunId.OpColon = 3; +SharedInfo.CFunId.EqScalar = 4; +SharedInfo.CFunId.EqMatrix = 5; +SharedInfo.CFunId.GenFunMtx = 6; // (scalar functions are fall in the scalar equal category.) + +SharedInfo = INIT_SharedInfoEqual(SharedInfo); + +// Contains the list of the C calls calls made in the current .sci file. +SharedInfo.CFunctsAlreadyCalled = '_____________'; // Initialization with a dummy name + +// --------------------------------------- +// --- Update Converted Function List. --- +// --------------------------------------- +Converted = FL_UpdateConverted(SharedInfo.NFilesToTranslate,FileInfo.FunctionList.ConvertedDat); + +// -------------------------------------- +// --- Create the function directory. --- +// -------------------------------------- +rmdir(fullfile(FileInfo.WorkingDir,funname),'s'); +mkdir(FileInfo.WorkingDir,funname); + +// ----------------------------------------- +// --- Initialize Other FileInfo fields. --- +// ----------------------------------------- +PrintStringInfo(' ',FileInfo.Funct(funnumber).SCICopyFileName,'file','y'); // Cannot use copyfile when the directory is empty!. +SCI2Ccopyfile(FileInfo.Funct(funnumber).SCIFileName,FileInfo.Funct(funnumber).SCICopyFileName,'overwrite'); + +FileInfo.Funct(funnumber).SCICopyFileFid = SCI2COpenFileRead(FileInfo.Funct(funnumber).SCICopyFileName); +// Perform a dummy reading up to the function. +//NUT: mettimi in una funzione. +scicopyfid = FileInfo.Funct(funnumber).SCICopyFileFid; +CPass1FileName = FileInfo.Funct(funnumber).CPass1FileName; +IndentLevel = SharedInfo.NIndent; +FoundFunctionKey = 0; +PrintStringInfo(C_IndentBlanks(IndentLevel)+'/*',CPass1FileName,'file','y'); +PrintStringInfo(C_IndentBlanks(IndentLevel)+' SCI2C: ------------------------------------------------------------------',CPass1FileName,'file','y'); +while (~meof(scicopyfid) & (FoundFunctionKey==0)) + // Read a line from the scilab file + sciline = mgetl(scicopyfid,1); + noblkssciline = stripblanks(sciline); + if (SCI2Cstrncmps1size('function',noblkssciline)) + FoundFunctionKey = 1; + end + PrintStringInfo(C_IndentBlanks(IndentLevel)+' SCI2C: '+sciline,CPass1FileName,'file','y'); +end +PrintStringInfo(C_IndentBlanks(IndentLevel)+' SCI2C: ------------------------------------------------------------------',CPass1FileName,'file','y'); +PrintStringInfo(C_IndentBlanks(IndentLevel)+'*/',CPass1FileName,'file','y'); + +// ------------------------- +// --- Initialize Files. --- +// ------------------------- +PrintStringInfo(' ',FileInfo.Funct(funnumber).CDeclarationFileName,'file','y'); +PrintStringInfo(' ',FileInfo.Funct(funnumber).CGblDeclarFileName,'file','y'); +PrintStringInfo(' ',FileInfo.Funct(funnumber).CInitVarsFileName,'file','y'); +CPass1FreeFileName = FileInfo.Funct(funnumber).CPass1FreeFileName; +PrintStringInfo(' ',CPass1FreeFileName,'file','y'); +PrintStringInfo(C_IndentBlanks(1)+'/*',CPass1FreeFileName,'file','y'); +PrintStringInfo(C_IndentBlanks(1)+'** --------------------- ',CPass1FreeFileName,'file','y'); +PrintStringInfo(C_IndentBlanks(1)+'** --- Free Section. --- ',CPass1FreeFileName,'file','y'); +PrintStringInfo(C_IndentBlanks(1)+'** --------------------- ',CPass1FreeFileName,'file','y'); +PrintStringInfo(C_IndentBlanks(1)+'*/',CPass1FreeFileName,'file','y'); + +// ----------------------------------- +// --- Initialize Local/Temp Vars. --- +// ----------------------------------- +LocalVars = []; +TempVars = []; + +// ------------------------------------ +// --- Determine Default Precision. --- +// ------------------------------------ +// For the current release only the following approaches are available: +// 'NO_RESIZE' +// 'REALLOC_ALL_RESIZE_ALL' +SharedInfo.DefaultPrecision = ... + FA_GetDefaultPrecision(FileInfo.Funct(funnumber).SCICopyFileName,FileInfo.Funct(funnumber).ReportFileName); + +// ---------------------------------- +// --- Determine Resize Approach. --- +// ---------------------------------- +SharedInfo.ResizeApproach = FA_GetResizeApproach(FileInfo.Funct(funnumber).SCICopyFileName,FileInfo.Funct(funnumber).ReportFileName); + +// --------------------- +// --- Save section. --- +// --------------------- +// --- Save File Info Structure. --- +save(FileInfoDatFile,FileInfo); + +// --- Save File Info Structure. --- +save(FileInfo.SharedInfoDatFile,SharedInfo); + +// --- Save Local/Temp Vars. --- +save(FileInfo.Funct(funnumber).LocalVarFileName,LocalVars); +save(FileInfo.Funct(funnumber).TempVarFileName,TempVars); + +// --- Save Converted .dat file. --- +save(FileInfo.FunctionList.ConvertedDat,Converted); +// ------------------------- +// --- End save section. --- +// ------------------------- + +endfunction diff --git a/macros/ToolInitialization/buildmacros.sce b/macros/ToolInitialization/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/macros/ToolInitialization/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/ToolInitialization/doublecomplex.sci b/macros/ToolInitialization/doublecomplex.sci new file mode 100644 index 00000000..8b36bf65 --- /dev/null +++ b/macros/ToolInitialization/doublecomplex.sci @@ -0,0 +1,26 @@ +function y = doublecomplex(x) +// function y = doublecomplex(x) +// ----------------------------------------------------------------- +// //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),1,1); + +y = x+0*%i; + +endfunction \ No newline at end of file diff --git a/macros/ToolInitialization/floatcomplex.sci b/macros/ToolInitialization/floatcomplex.sci new file mode 100644 index 00000000..eedae766 --- /dev/null +++ b/macros/ToolInitialization/floatcomplex.sci @@ -0,0 +1,26 @@ +function y = floatcomplex(x) +// function y = floatcomplex(x) +// ----------------------------------------------------------------- +// //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),1,1); + +y = x+0*%i; + +endfunction \ No newline at end of file diff --git a/macros/buildmacros.sce b/macros/buildmacros.sce new file mode 100644 index 00000000..dde02652 --- /dev/null +++ b/macros/buildmacros.sce @@ -0,0 +1,32 @@ +// ==================================================================== +// Allan CORNET +// Simon LIPP +// INRIA 2008 +// This file is released into the public domain +// ==================================================================== +Directories = [ "ASTManagement", ... + "CCodeGeneration", ... + "ErrorMessages", ... + "findDeps", ... + "FunctionAnnotation", ... + "FunctionList", ... + "GeneralFunctions", ... + "SymbolTable", ... + "ToolInitialization" ]; + + +current_path_buildmacros = get_absolute_file_path('buildmacros.sce'); + +for K=1:size(Directories,"*") + if isdir( current_path_buildmacros + filesep() + Directories(K) ) then + chdir( current_path_buildmacros + filesep() + Directories(K) ); + exec("buildmacros.sce"); + chdir(current_path_buildmacros); + end +end + +clear current_path_buildmacros; + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/cb_sci2c_gui.sci b/macros/cb_sci2c_gui.sci new file mode 100644 index 00000000..935c0e6f --- /dev/null +++ b/macros/cb_sci2c_gui.sci @@ -0,0 +1,135 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// + +// Callback function for SCI2C GUI (See sci2c_gui.sci) + +function cb_sci2c_gui + +// +// --- File to convert --- +// +if get(gcbo,"tag")=="filebtn" then + + filename = uigetfile("*.sci", pwd(), gettext("Select the file to translate")); + if ~isempty(filename) then + set(findobj("tag", "fileedit"), "string", filename); + end + +// +// --- Sub-functions directory --- +// +elseif get(gcbo,"tag")=="subfunsbtn" then + + directory = uigetdir(pwd(), gettext("Select your sub-functions directory")); + if ~isempty(directory) then + set(findobj("tag", "subfunsedit"), "string", directory); + end + +// +// --- Output directory --- +// +elseif get(gcbo,"tag")=="outbtn" then + + directory = uigetdir(pwd(), gettext("Select the directory for generated files")); + if ~isempty(directory) then + set(findobj("tag", "outedit"), "string", directory); + end + +// +// --- Run mode option --- +// +elseif or(get(gcbo, "tag")==["runradioall","runradiotranslate","runradiogenlib"]) then + + set(findobj("tag", "runradioall"), "value", 0); + set(findobj("tag", "runradiotranslate"), "value", 0); + set(findobj("tag", "runradiogenlib"), "value", 0); + + set(gcbo, "value", 1); + +// +// --- Copy Scilab code into C option --- +// +elseif or(get(gcbo, "tag")==["sciintocradioyes","sciintocradiono"]) then + + set(findobj("tag", "sciintocradioyes"), "value", 0); + set(findobj("tag", "sciintocradiono"), "value", 0); + + set(gcbo, "value", 1); + +// +// --- Build Tool option --- +// +elseif or(get(gcbo, "tag")==["buildtoolradiowin","buildtoolradiounix"]) then + + set(findobj("tag", "buildtoolradiowin"), "value", 0); + set(findobj("tag", "buildtoolradiounix"), "value", 0); + + set(gcbo, "value", 1); + +// +// --- Cancel conversion --- +// +elseif get(gcbo, "tag")=="cancelbtn" | get(gcbo, "tag")=="close_menu" then + delete(findobj("tag", "sci2cfig")); + +// +// --- Launch conversion --- +// +elseif get(gcbo, "tag")=="convertbtn" then + UserScilabMainFile = get(findobj("tag", "fileedit"), "string"); + + UserSciFilesPaths = get(findobj("tag", "subfunsedit"), "string"); + +// Sci2CLibMainHeaderFName = get(findobj("tag", "headeredit"), "string"); + + UserSciCodeMainDir = get(findobj("tag", "outedit"), "string"); + + if get(findobj("tag", "runradioall"), "value") == 1 then + RunMode = "All"; + elseif get(findobj("tag", "runradiotranslate"), "value") == 1 then + RunMode = "Translate"; + else + RunMode = "GenLibraryStructure"; + end + + CopySciCodeIntoCCode = get(findobj("tag", "sciintocradioyes"), "value") == 1; + + if get(findobj("tag", "buildtoolradiowin"), "value") == 1 then + NativeBuild = "nmake"; + elseif get(findobj("tag", "buildtoolradiounix"), "value") == 1 then + NativeBuild = "make"; +// else +// CCompilerPathStyle = "cygwin"; + end + + // -*- DEBUG ONLY -*- + +// mprintf("UserScilabMainFile = {%s}\n", UserScilabMainFile); +// mprintf("UserSciFilesPaths = {%s}\n", UserSciFilesPaths); +// mprintf("UserSciCodeMainDir = {%s}\n", UserSciCodeMainDir); +// mprintf("RunMode = {%s}\n", RunMode); +// mprintf("CopySciCodeIntoCCode = {%d}\n", bool2s(CopySciCodeIntoCCode)); +// mprintf("NativeBuild = {%s}\n", NativeBuild); + scilab2c(UserScilabMainFile, UserSciCodeMainDir, UserSciFilesPaths, RunMode, NativeBuild); +// +// --- sci2c help --- +// +elseif get(gcbo, "tag")=="sci2c_help_menu" then + help sci2c + +// +// --- About SCI2C --- +// +elseif get(gcbo, "tag")=="about_sci2c_menu" then + help(gettext("About_SCI2C_tools")) +end + +endfunction diff --git a/macros/findDeps/Scilab2CDeps.sci b/macros/findDeps/Scilab2CDeps.sci new file mode 100644 index 00000000..8044e276 --- /dev/null +++ b/macros/findDeps/Scilab2CDeps.sci @@ -0,0 +1,749 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - INRIA - Arnaud Torset +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + + +function scilab2ccode = initDependecies() + + +///////////////////////////////// +////// AUXILIARY FUNCTIONS ////// +///////////////////////////////// + + +//abs +scilab2ccode.deps.cabss=["ssqrts","sabss","creals","cimags"] +scilab2ccode.deps.cabsa=["cabss"] +scilab2ccode.deps.dabss=[] +scilab2ccode.deps.dabsa=["dabss"] +scilab2ccode.deps.sabss=[] +scilab2ccode.deps.sabsa=["sabss"] +scilab2ccode.deps.zabss=["dsqrts","dabss","zreals","zimags"] +scilab2ccode.deps.zabsa=["zabss"] + + +//conj +scilab2ccode.deps.cconjs=["FloatComplex","creals","cimags"] +scilab2ccode.deps.cconja=["cconjs"] +scilab2ccode.deps.zconjs=["DoubleComplex","zreals","zimags"] +scilab2ccode.deps.zconja=["zconjs"] + +//find +scilab2ccode.deps.cfinda=["creals","cimags"] +scilab2ccode.deps.dfinda=[] +scilab2ccode.deps.sfinda=[] +scilab2ccode.deps.zfinda=["zreals","zimags"] + + +//find2d +scilab2ccode.deps.cfind2da=["creals","cimags"] +scilab2ccode.deps.dfind2da=[] +scilab2ccode.deps.sfind2da=[] +scilab2ccode.deps.zfind2da=["zreals","zimags"] + + +//frexp +scilab2ccode.deps.dfrexps=[] +scilab2ccode.deps.sfrexps=[] + +//isempty +scilab2ccode.deps.cisemptys=[] +scilab2ccode.deps.cisemptya=["cfinda"] +scilab2ccode.deps.disemptys=[] +scilab2ccode.deps.disemptya=["dfinda"] +scilab2ccode.deps.sisemptys=[] +scilab2ccode.deps.sisemptya=["sfinda"] +scilab2ccode.deps.zisemptys=[] +scilab2ccode.deps.zisemptya=["zfinda"] + +//isnan +scilab2ccode.deps.cisnans=["creals","cimags"] +scilab2ccode.deps.cisnana=["cisnans"] +scilab2ccode.deps.disnans=[] +scilab2ccode.deps.disnana=["disnans"] +scilab2ccode.deps.sisnans=[] +scilab2ccode.deps.sisnana=["sisnans"] +scilab2ccode.deps.zisnans=["zreals","zimags"] +scilab2ccode.deps.zisnana=["zisnans"] + +//length + +//pythag +scilab2ccode.deps.cpythags=["csqrts","cadds","cmuls"] +scilab2ccode.deps.dpythags=["dsqrts"] +scilab2ccode.deps.spythags=["ssqrts"] +scilab2ccode.deps.cpythags=["zsqrts","zadds","zmuls"] + +//rand + +//sign +scilab2ccode.deps.csigns=["FloatComplex","cabss","creals","cimags"] +scilab2ccode.deps.csigna=["csigns"] +scilab2ccode.deps.dsigns=[] +scilab2ccode.deps.dsigna=["dsigns"] +scilab2ccode.deps.dsigns=[] +scilab2ccode.deps.dsigna=["ssigns"] +scilab2ccode.deps.zsigns=["DoubleComplex","zabss","zreals","zimags"] +scilab2ccode.deps.zsigna=["zsigns"] + +//size + +//type + + +////////////////////////////////// +////// ELEMENTARY FUNCTIONS ////// +////////////////////////////////// + +//acos +scilab2ccode.deps.cacoss=["FloatComplex","ssqrts","sabss","sacoss","satans","slogs","slog1ps","creals","cimags"] +scilab2ccode.deps.cacosa=["cacoss"] +scilab2ccode.deps.dacoss=[] +scilab2ccode.deps.dacosa=["dacoss"] +scilab2ccode.deps.sacoss=[] +scilab2ccode.deps.sacosa=["sacoss"] +scilab2ccode.deps.zacoss=["DoubleComplex","dsqrts","dabss","dacoss","datans","dlogs","dlog1ps","zreals","zimags"] +scilab2ccode.deps.zacosa=["zacoss"] + + +//acosh +scilab2ccode.deps.cacoshs=["FloatComplex","cacoss","creals","cimags"] +scilab2ccode.deps.cacosha=["cacoshs"] +scilab2ccode.deps.dacoshs=[] +scilab2ccode.deps.dacosha=["dacoshs"] +scilab2ccode.deps.sacoshs=[] +scilab2ccode.deps.sacosha=["sacoshs"] +scilab2ccode.deps.zacoshs=["DoubleComplex","zacoss","zreals","zimags"] +scilab2ccode.deps.zacosha=["zacoshs"] + +//asin +scilab2ccode.deps.casins=["FloatComplex","ssqrts","sabss","sasins","satans","slogs","slog1ps","dabss","creals","cimags"] +scilab2ccode.deps.casina=["casins"] +scilab2ccode.deps.dasins=[] +scilab2ccode.deps.dasina=["dasins"] +scilab2ccode.deps.sasins=[] +scilab2ccode.deps.sasina=["sasins"] +scilab2ccode.deps.zasins=["DoubleComplex","dsqrts","dabss","dasins","datans","dlog1ps","dlogs","zreals","zimags"] +scilab2ccode.deps.zasina=["zasins"] + +//asinh +scilab2ccode.deps.casinhs=["FloatComplex","casins","creals","cimags"] +scilab2ccode.deps.casinha=["casinhs"] +scilab2ccode.deps.dasinhs=["DoubleComplex","zasins"] +scilab2ccode.deps.dasinha=["dasinhs"] +scilab2ccode.deps.sasinhs=["FloatComplex","casins"] +scilab2ccode.deps.sasinha=["sasinhs"] +scilab2ccode.deps.zasinhs=["DoubleComplex","zasins","zreals","zimags"] +scilab2ccode.deps.zasinha=["zasinhs"] + + +//atan +scilab2ccode.deps.catans=["satans","creals","cimags","dabss","slnp1m1s","sabss","FloatComplex"] +scilab2ccode.deps.catana=["catans"] +scilab2ccode.deps.datans=[] +scilab2ccode.deps.datana=["datans"] +scilab2ccode.deps.satans=[] +scilab2ccode.deps.satana=["satans"] +scilab2ccode.deps.zatans=["datans","zreals","zimags","dabss","dlnp1m1s","DoubleComplex"] +scilab2ccode.deps.zatana=["zatans"] + + +//atan2 +scilab2ccode.deps.datan2s=[] +scilab2ccode.deps.datan2a=["datan2s"] +scilab2ccode.deps.satan2s=[] +scilab2ccode.deps.satan2a=["satan2s"] + + +//atanh +scilab2ccode.deps.catanhs=["FloatComplex","creals","cimags","catans"] +scilab2ccode.deps.catanha=["catanhs"] +scilab2ccode.deps.datanhs=["zimags","zatans","DoubleComplex"] +scilab2ccode.deps.datanha=["datanhs"] +scilab2ccode.deps.satanhs=["cimags","catans","FloatComplex"] +scilab2ccode.deps.satanha=["satanhs"] +scilab2ccode.deps.zatanhs=["DoubleComplex","zreals","zimags","zatans"] +scilab2ccode.deps.zatanha=["zatanhs"] + + +//cos +scilab2ccode.deps.ccoss=["creals","cimags","FloatComplex","scoss","scoshs","ssins","ssinhs"] +scilab2ccode.deps.ccosa=["ccoss"] +scilab2ccode.deps.dcoss=[] +scilab2ccode.deps.dcosa=["dcoss"] +scilab2ccode.deps.scoss=[] +scilab2ccode.deps.scosa=["scoss"] +scilab2ccode.deps.zcoss=["zreals","zimags","DoubleComplex","dcoss","dcoshs","dsins","dsinhs"] +scilab2ccode.deps.zcosa=["zcoss"] + + +//cosh +scilab2ccode.deps.ccoshs=["ccoss","FloatComplex","creals","cimags"] +scilab2ccode.deps.ccosha=["ccoshs"] +scilab2ccode.deps.dcoshs=["dexps","dabss"] +scilab2ccode.deps.dcosha=["dcoshs"] +scilab2ccode.deps.scoshs=["sexps","sabss"] +scilab2ccode.deps.scosha=["scoshs"] +scilab2ccode.deps.zcoshs=["zcoss","DoubleComplex","zreals","zimags"] +scilab2ccode.deps.zcosha=["zcoshs"] + + +//exp +scilab2ccode.deps.cexps=["creals","cimags","FloatComplex","sexps","scoss","ssins"] +scilab2ccode.deps.cexpa=["cexps"] +scilab2ccode.deps.dexps=[] +scilab2ccode.deps.dexpa=["dexps"] +scilab2ccode.deps.sexps=[] +scilab2ccode.deps.sexpa=["sexps"] +scilab2ccode.deps.zexps=["zreals","zimags","DoubleComplex","dexps","dcoss","dsins"] +scilab2ccode.deps.zexpa=["zexps"] + + +//exp10 +scilab2ccode.deps.cexp10s=["cpows","FloatComplex"] +scilab2ccode.deps.cexp10a=["cexp10s"] +scilab2ccode.deps.dexp10s=[] +scilab2ccode.deps.dexp10a=["dexp10s"] +scilab2ccode.deps.sexp10s=[] +scilab2ccode.deps.sexp10a=["sexp10s"] +scilab2ccode.deps.zexp10s=["zpows","DoubleComplex"] +scilab2ccode.deps.zexp10a=["zexp10s"] + + +//lnp1m1 +scilab2ccode.deps.dlnp1m1s=["dabss"] +scilab2ccode.deps.slnp1m1s=["sabss"] + + +//log +scilab2ccode.deps.clogs=["creals","cimags","slog1ps","slogs","spythags","FloatComplex"] +scilab2ccode.deps.cloga=["clogs"] +scilab2ccode.deps.dlogs=[] +scilab2ccode.deps.dloga=["dlogs"] +scilab2ccode.deps.slogs=[] +scilab2ccode.deps.sloga=["slogs"] +scilab2ccode.deps.zlogs=["zreals","zimags","zlog1ps","zlogs","zpythags","DoubleComplex"] +scilab2ccode.deps.zloga=["zlogs"] + + +//log1p +scilab2ccode.deps.clog1ps=["clogs","FloatComplex","creals","cimags"] +scilab2ccode.deps.clog1pa=["clog1ps"] +scilab2ccode.deps.dlog1ps=["dlnp1m1s","dlogs"] +scilab2ccode.deps.dlog1pa=["dlog1ps"] +scilab2ccode.deps.slog1ps=["slnp1m1s","slogs"] +scilab2ccode.deps.slog1pa=["slog1ps"] +scilab2ccode.deps.zlog1ps=["zlogs","DoubleComplex","zreals","zimags"] +scilab2ccode.deps.zlog1pa=["zlog1ps"] + + +//log10 +scilab2ccode.deps.clog10s=["clogs","FloatComplex","creals","cimags","slogs"] +scilab2ccode.deps.clog10a=["clog10s"] +scilab2ccode.deps.dlog10s=[] +scilab2ccode.deps.dlog10a=["dlog10s"] +scilab2ccode.deps.slog10s=[] +scilab2ccode.deps.slog10a=["slog10s"] +scilab2ccode.deps.zlog10s=["zlogs","DoubleComplex","zreals","zimags","dlogs"] +scilab2ccode.deps.zlog10a=["zlog10s"] + + +//pow +scilab2ccode.deps.cpows=["cexps","cmuls","clogs"] +scilab2ccode.deps.cpowa=["cpows"] +scilab2ccode.deps.dpows=[] +scilab2ccode.deps.dpowa=["dpows"] +scilab2ccode.deps.spows=[] +scilab2ccode.deps.spowa=["spows"] +scilab2ccode.deps.zpows=["zexps","zmuls","zlogs"] +scilab2ccode.deps.zpowa=["zpows"] + + +//sin +scilab2ccode.deps.csins=["creals","cimags","FloatComplex","ssins","scoshs","scoss","ssinhs"] +scilab2ccode.deps.csina=["csins"] +scilab2ccode.deps.dsins=[] +scilab2ccode.deps.dsina=["dsins"] +scilab2ccode.deps.ssins=[] +scilab2ccode.deps.ssina=["ssins"] +scilab2ccode.deps.zsins=["zreals","zimags","DoubleComplex","dsins","dcoshs","dcoss","dsinhs"] +scilab2ccode.deps.zsina=["zsins"] + + +//sinh +scilab2ccode.deps.csinhs=["creals","cimags","csins","FloatComplex"] +scilab2ccode.deps.csinha=["csinhs"] +scilab2ccode.deps.dsinhs=[] +scilab2ccode.deps.dsinha=["dsinhs"] +scilab2ccode.deps.ssinhs=[] +scilab2ccode.deps.ssinha=["ssinhs"] +scilab2ccode.deps.zsinhs=["zreals","zimags","zsins","DoubleComplex"] +scilab2ccode.deps.zsinha=["zsinhs"] + + +//sqrt +scilab2ccode.deps.csqrts=["creals","cimags","dabss","ssqrts","sabss","spythags","FloatComplex"] +scilab2ccode.deps.csqrta=["csqrts"] +scilab2ccode.deps.dsqrts=[] +scilab2ccode.deps.dsqrta=["dsqrts"] +scilab2ccode.deps.ssqrts=[] +scilab2ccode.deps.ssqrta=["ssqrts"] +scilab2ccode.deps.zsqrts=["zreals","zimags","dabss","dsqrts","dpythags","DoubleComplex"] +scilab2ccode.deps.zsqrta=["zsqrts"] + + +//tan +scilab2ccode.deps.ctans=["slogs","ssqrts","creals","cimags","scoss","ssinhs","ssins","sabss","FloatComplex"] +scilab2ccode.deps.ctana=["ctans"] +scilab2ccode.deps.dtans=[] +scilab2ccode.deps.dtana=["dtans"] +scilab2ccode.deps.stans=[] +scilab2ccode.deps.stana=["stans"] +scilab2ccode.deps.ztans=["dlogs","dsqrts","zreals","zimags","dcoss","dsinhs","dsins","dabss","DoubleComplex"] +scilab2ccode.deps.ztana=["ztans"] + + +//tanh +scilab2ccode.deps.ctanhs=["creals","cimags","ctans","FloatComplex"] +scilab2ccode.deps.ctanha=["ctanhs"] +scilab2ccode.deps.dtanhs=[] +scilab2ccode.deps.dtanha=["dtanhs"] +scilab2ccode.deps.stanhs=[] +scilab2ccode.deps.stanha=["stanhs"] +scilab2ccode.deps.ztanhs=["zreals","zimags","ztans","DoubleComplex"] +scilab2ccode.deps.ztanha=["ztanhs"] + + + +/////////////////////////////// +////// MATRIX OPERATIONS ////// +/////////////////////////////// + + +//OpRc +scilab2ccode.deps.crowcats=[] +scilab2ccode.deps.crowcata=[] +scilab2ccode.deps.drowcats=[] +scilab2ccode.deps.drowcata=[] +scilab2ccode.deps.srowcats=[] +scilab2ccode.deps.srowcata=[] +scilab2ccode.deps.zrowcats=[] +scilab2ccode.deps.zrowcata=[] + + +//OpCc +scilab2ccode.deps.ccolumncats=[] +scilab2ccode.deps.ccolumncata=[] +scilab2ccode.deps.dcolumncats=[] +scilab2ccode.deps.dcolumncata=[] +scilab2ccode.deps.scolumncats=[] +scilab2ccode.deps.scolumncata=[] +scilab2ccode.deps.zcolumncats=[] +scilab2ccode.deps.zcolumncata=[] + + +//chol +scilab2ccode.deps.cchola=["DoubleComplex","creals","cimags","FloatComplex","zreals","zimags","cdiffs","cmuls","crdivs","csqrts"] +scilab2ccode.deps.dchols=["dsqrts"] +scilab2ccode.deps.dchola=[] +scilab2ccode.deps.schols=["ssqrts"] +scilab2ccode.deps.schola=["ssqrts"] +scilab2ccode.deps.zchola=["DoubleComplex","zreals","zimags","zdiffs","zmuls","zrdivs","zsqrts"] + + +//determ +scilab2ccode.deps.cdeterma=["cdiffs","FloatComplex","cmuls","cadds","DoubleComplex","creals","cimags","zreals","zimags","zmuls","crdivs"] +scilab2ccode.deps.ddeterma=[] +scilab2ccode.deps.sdeterma=[] +scilab2ccode.deps.zdeterma=["zdiffs","zmuls","DoubleComplex","zadds","zreals","zimags","zrdivs"] + + +//dist +scilab2ccode.deps.cdists=["spows","creals","cimags","ssqrts"] +scilab2ccode.deps.cdista=["spows","creals","cimags","ssqrts"] +scilab2ccode.deps.ddists=["dpows","dsqrts"] +scilab2ccode.deps.ddista=["dpows","dsqrts"] +scilab2ccode.deps.sdists=["spows","ssqrts"] +scilab2ccode.deps.sdista=["spows","ssqrts"] +scilab2ccode.deps.zdists=["dpows","zreals","zimags","dsqrts"] +scilab2ccode.deps.zdista=["dpows","zreals","zimags","dsqrts"] + + +//OpSlash +scilab2ccode.deps.crdivma=["DoubleComplex","creals","cimags","zrdivma","FloatComplex","zreals","zimags"] +scilab2ccode.deps.drdivma=["dtransposea"] +scilab2ccode.deps.srdivma=["drdivma"] +scilab2ccode.deps.zrdivma=["ztransposea","zconja","DoubleComplex","zreals","zimags"] + + +//OpBackSlash +scilab2ccode.deps.cldivma=["DoubleComplex","creals","cimags","zldivma","FloatComplex","zreals","zimags"] +scilab2ccode.deps.dldivma=[] +scilab2ccode.deps.sldivma=["dldivma"] +scilab2ccode.deps.zldivma=[] + + +//expm +scilab2ccode.deps.cexpma=["sfrexps","cinfnorma","spows","crdivs","FloatComplex","ceyea","cmuls","cadda","cdiffa","cmulma","cldivma"] +scilab2ccode.deps.dexpma=["dfrexps","dinfnorma","dpows","deyea","dadda","ddiffa","dmulma","dldivma"] +scilab2ccode.deps.sexpma=["sfrexps","sinfnorma","spows","seyea","sadda","sdiffa","smulma","sldivma"] +scilab2ccode.deps.zexpma=["dfrexps","zinfnorma","zrdivs","DoubleComplex","zeyea","zmuls","zadda","zdiffa","zmulma","zldivma"] + + +//eye +scilab2ccode.deps.ceyea= ["FloatComplex"] +scilab2ccode.deps.deyea= [] +scilab2ccode.deps.seyea= [] +scilab2ccode.deps.zeyea= ["DoubleComplex"] + + +//fill +scilab2ccode.deps.cfilla=["conesa","cmuls"] +scilab2ccode.deps.dfilla=["donesa"] +scilab2ccode.deps.sfilla=["sonesa"] +scilab2ccode.deps.zfilla=["zonesa","zmuls"] + + +//hilbert +scilab2ccode.deps.dhilberta=[] +scilab2ccode.deps.shilberta=[] + +//infinite norm +scilab2ccode.deps.cinfnorma=["spythags","creals","cimags"] +scilab2ccode.deps.dinfnorma=[] +scilab2ccode.deps.sinfnorma=[] +scilab2ccode.deps.zinfnorma=["dpythags","zreals","zimags"] + + +//inversion +scilab2ccode.deps.cinverma=["DoubleComplex","creals","cimags","zinverma","FloatComplex","zreals","zimags"] +scilab2ccode.deps.dinverma=[] +scilab2ccode.deps.sinverma=["dinverma"] +scilab2ccode.deps.zinverma=[] + + +//jmat + + +//logm +scilab2ccode.deps.clogma=["DoubleComplex","creals","cimags","zlogma","FloatComplex","zreals","zimags"] +scilab2ccode.deps.dlogma=["DoubleComplex","zlogma"] +scilab2ccode.deps.slogma=["DoubleComplex","zlogma","FloatComplex","zreals","zimags"] +scilab2ccode.deps.zlogma=["ztransposea","zreals","zimags","zlogs","DoubleComplex","zmulma","zinverma"] + + +//magnitude +scilab2ccode.deps.cmagns=["creals","cimags","ssqrts"] +scilab2ccode.deps.cmagna=["cmagns"] +scilab2ccode.deps.dmagns=[] +scilab2ccode.deps.dmagna=["dmagns"] +scilab2ccode.deps.smagns=[] +scilab2ccode.deps.smagna=["smagns"] +scilab2ccode.deps.zmagns=["zreals","zimags","dsqrts"] +scilab2ccode.deps.zmagna=["zmagns"] + + +//OpStar +scilab2ccode.deps.cmulma=["FloatComplex","cadds","cmuls"] +scilab2ccode.deps.dmulma=[] +scilab2ccode.deps.smulma=[] +scilab2ccode.deps.zmulma=["zreala","zimaga","DoubleComplex","zadds","zmuls"] + + +//ones +scilab2ccode.deps.conesa=["FloatComplex"] +scilab2ccode.deps.donesa=[] +scilab2ccode.deps.sonesa=[] +scilab2ccode.deps.zonesa=["DoubleComplex"] + + +//Squared Magnitude +scilab2ccode.deps.csquMagns=["creals","cimags"] +scilab2ccode.deps.csquMagna=["cmagna"] +scilab2ccode.deps.dsquMagns=[] +scilab2ccode.deps.dsquMagna=["dmagna"] +scilab2ccode.deps.ssquMagns=[] +scilab2ccode.deps.ssquMagna=["smagna"] +scilab2ccode.deps.zsquMagns=["zreals","zimags"] +scilab2ccode.deps.zsquMagna=["zmagna"] + + +//trace +scilab2ccode.deps.ctracea=["creals","cimags","FloatComplex"] +scilab2ccode.deps.dtracea=[] +scilab2ccode.deps.stracea=[] +scilab2ccode.deps.ztracea=["zreals","zimags","DoubleComplex"] + + +//transpose +scilab2ccode.deps.ctransposea=["creals","cimags","FloatComplex"] +scilab2ccode.deps.dtransposea=[] +scilab2ccode.deps.stransposea=[] +scilab2ccode.deps.ztransposea=["zreals","zimags","DoubleComplex"] + + + + +//////////////////////// +////// OPERATIONS ////// +//////////////////////// + + +//OpPlus +scilab2ccode.deps.cadds=["creals","cimags","FloatComplex"] +scilab2ccode.deps.cadda=["cadds"] +scilab2ccode.deps.dadds=[] +scilab2ccode.deps.dadda=["dadds"] +scilab2ccode.deps.sadds=[] +scilab2ccode.deps.sadda=["sadds"] +scilab2ccode.deps.zadds=["zreals","zimags","DoubleComplex"] +scilab2ccode.deps.zadda=["zadds"] + + +//OpDotSlash/OpSlash +scilab2ccode.deps.crdivs=["FloatComplex"] +scilab2ccode.deps.crdiva=["crdivs"] +scilab2ccode.deps.drdivs=[] +scilab2ccode.deps.drdiva=["drdivs"] +scilab2ccode.deps.srdivs=[] +scilab2ccode.deps.srdiva=["srdivs"] +scilab2ccode.deps.zrdivs=["DoubleComplex"] +scilab2ccode.deps.zrdiva=["zrdivs"] + + +//OpBackSlash +scilab2ccode.deps.cldivs=["cmuls","cconjs","creals","cimags","FloatComplex","crdivs"] +scilab2ccode.deps.cldiva=["cldivs"] +scilab2ccode.deps.dldivs=[] +scilab2ccode.deps.dldiva=["dldivs"] +scilab2ccode.deps.sldivs=[] +scilab2ccode.deps.sldiva=["scldivs"] +scilab2ccode.deps.zldivs=["zmuls","zconjs","zreals","zimags","DoubleComplex","zrdivs"] +scilab2ccode.deps.zldiva=["zldivs"] + + +//OpStar/OpDotStar +scilab2ccode.deps.cmuls=["FloatComplex"] +scilab2ccode.deps.cmula=["cmuls"] +scilab2ccode.deps.dmuls=[] +scilab2ccode.deps.dmula=["dmuls"] +scilab2ccode.deps.smuls=[] +scilab2ccode.deps.smula=["smuls"] +scilab2ccode.deps.zmuls=["DoubleComplex"] +scilab2ccode.deps.zmula=["zmuls"] + + +//OpMinus +scilab2ccode.deps.cdiffs=["creals","cimags","FloatComplex"] +scilab2ccode.deps.cdiffa=["cdiffs"] +scilab2ccode.deps.ddiffs=[] +scilab2ccode.deps.ddiffa=["ddiffs"] +scilab2ccode.deps.sdiffs=[] +scilab2ccode.deps.sdiffa=["sdiffs"] +scilab2ccode.deps.zdiffs=["zreals","zimags","DoubleComplex"] +scilab2ccode.deps.zdiffa=["zdiffs"] + + +/////////////////////////////// +////// SIGNAL PROCESSING ////// +/////////////////////////////// + + +//conv +scilab2ccode.deps.cconva=["FloatComplex","cfftma","cmula","cifftma"] +scilab2ccode.deps.dconva=["DoubleComplex","zconva","zreala"] +scilab2ccode.deps.sconva=["FloatComplex","cconva","creala"] +scilab2ccode.deps.zconva=["DoubleComplex","zfftma","zmula","zifftma"] + + +//conv2d +scilab2ccode.deps.cconv2da=["FloatComplex","cadds","cmuls"] +scilab2ccode.deps.dconv2da=[] +scilab2ccode.deps.sconv2da=[] +scilab2ccode.deps.zconv2da=["DoubleComplex","zadds","zmuls"] + + +//cross correlation +scilab2ccode.deps.ccrossCorra=["cconjs","cconv2da"] +scilab2ccode.deps.dcrossCorra=["dconv2da"] +scilab2ccode.deps.scrossCorra=["sconv2da"] +scilab2ccode.deps.zcrossCorra=["zconjs","zconv2da"] + + +//fft +scilab2ccode.deps.cfftma=["DoubleComplex","creals","cimags","zfftma","FloatComplex","zreals","zimags"] +scilab2ccode.deps.dfft2=["dfftbi"] +scilab2ccode.deps.dfftbi=["dfftmx"] +scilab2ccode.deps.dfftmx=[] +scilab2ccode.deps.fft842=["r2tx","r4tx","r8tx","DoubleComplex","zreals","zimags"] +scilab2ccode.deps.r2tx=["zadds","zdiffs","DoubleComplex","zreals","zimags"] +scilab2ccode.deps.r4tx=["zadds","zdiffs","DoubleComplex","zreals","zimags"] +scilab2ccode.deps.r8tx=["zadds","zdiffs","DoubleComplex","zreals","zimags"] +scilab2ccode.deps.zfftma=["zreala","zimaga","fft842","dfft2","DoubleComplexMatrix"] + + +//hilbert +scilab2ccode.deps.dhilberts=[] +scilab2ccode.deps.dhilberta=["DoubleComplex","zfftma","zmuls","zifftma"] +scilab2ccode.deps.shilberts=[] +scilab2ccode.deps.shilberta=["FloatComplex","cfftma","cmuls","cifftma"] + + +//ifft +scilab2ccode.deps.cifftma=["DoubleComplex","creals","cimags","zifftma","FloatComplex","zreals","zimags"] +scilab2ccode.deps.difft2=["difftbi"] +scilab2ccode.deps.difftbi=["difftmx"] +scilab2ccode.deps.difftmx=[] +scilab2ccode.deps.ifft842=["ir2tx","ir4tx","ir8tx","DoubleComplex","zreals","zimags"] +scilab2ccode.deps.ir2tx=["zadds","zdiffs","DoubleComplex","zreals","zimags"] +scilab2ccode.deps.ir4tx=["zadds","zdiffs","DoubleComplex","zreals","zimags"] +scilab2ccode.deps.ir8tx=["zadds","zdiffs","DoubleComplex","zreals","zimags"] +scilab2ccode.deps.zifftma=["zreala","zimaga","ifft842","difft2","DoubleComplexMatrix"] + + +//levin +scilab2ccode.deps.dlevina=["dinitTab","dr1","dr2","dr3","dr4","dlevinmul","dinverma","dmulma","dlevinmul2","ddecalage","dlevinsub","dlevinsig"] +scilab2ccode.deps.slevina=["sinitTab","sr1","sr2","sr3","sr4","slevinmul","sinverma","smulma","slevinmul2","sdecalage","slevinsub","slevinsig"] +scilab2ccode.deps.dinitTab=[] +scilab2ccode.deps.dr1=[] +scilab2ccode.deps.dr2=[] +scilab2ccode.deps.dr3=[] +scilab2ccode.deps.dr4=[] +scilab2ccode.deps.dlevinmul=[] +scilab2ccode.deps.dlevinmul2=[] +scilab2ccode.deps.ddecalage=[] +scilab2ccode.deps.dlevinsub=[] +scilab2ccode.deps.dlevinsig=[] +scilab2ccode.deps.sinitTab=[] +scilab2ccode.deps.sr1=[] +scilab2ccode.deps.sr2=[] +scilab2ccode.deps.sr3=[] +scilab2ccode.deps.sr4=[] +scilab2ccode.deps.slevinmul=[] +scilab2ccode.deps.slevinmul2=[] +scilab2ccode.deps.sdecalage=[] +scilab2ccode.deps.slevinsub=[] +scilab2ccode.deps.slevinsig=[] + + +//lpc2cep +scilab2ccode.deps.clpc2cepa=["cfftma","clogma","cifftma"] +scilab2ccode.deps.dlpc2cepa=["DoubleComplex","zfftma","zlogma","zifftma","zreala"] +scilab2ccode.deps.slpc2cepa=["FloatComplex","cfftma","clogma","cifftma","creala"] +scilab2ccode.deps.zlpc2cepa=["zfftma","zlogma","zifftma"] + + +///////////////////////////////// +////// STATISTIC FUNCTIONS ////// +///////////////////////////////// + + +//mean +scilab2ccode.deps.cmeana=["FloatComplex","cadds","creals","cimags"] +scilab2ccode.deps.dmeana=[] +scilab2ccode.deps.smeana=[] +scilab2ccode.deps.zmeana=["DoubleComplex","zadds","zreals","zimags"] +scilab2ccode.deps.ccolumnmeana=["ccolumnsuma","crdivs","FloatComplex"] +scilab2ccode.deps.dcolumnmeana=["dcolumnsuma"] +scilab2ccode.deps.scolumnmeana=["scolumnsuma"] +scilab2ccode.deps.zcolumnmeana=["zcolumnsuma","zrdivs","DoubleComplex"] +scilab2ccode.deps.crowmeana=["crowsuma","crdivs","FloatComplex"] +scilab2ccode.deps.drowmeana=["drowsuma"] +scilab2ccode.deps.srowmeana=["srowsuma"] +scilab2ccode.deps.zrowmeana=["zrowsuma","zrdivs","DoubleComplex"] + + +//prod +scilab2ccode.deps.cproda=["cmuls"] +scilab2ccode.deps.dproda=[] +scilab2ccode.deps.sproda=[] +scilab2ccode.deps.zproda=["zmuls"] +scilab2ccode.deps.ccolumnproda=["cmuls"] +scilab2ccode.deps.dcolumnproda=[] +scilab2ccode.deps.scolumnproda=[] +scilab2ccode.deps.zcolumnproda=["zmuls"] +scilab2ccode.deps.crowproda=["cmuls"] +scilab2ccode.deps.drowproda=[] +scilab2ccode.deps.srowproda=[] +scilab2ccode.deps.zrowproda=["zmuls"] + + +//sum +scilab2ccode.deps.csuma=["cadds"] +scilab2ccode.deps.dsuma=[] +scilab2ccode.deps.ssuma=[] +scilab2ccode.deps.zsuma=["zadds"] +scilab2ccode.deps.ccolumnsuma=["cadds"] +scilab2ccode.deps.dcolumnsuma=[] +scilab2ccode.deps.scolumnsuma=[] +scilab2ccode.deps.zcolumnsuma=["zadds"] +scilab2ccode.deps.crowsuma=["cadds"] +scilab2ccode.deps.drowsuma=[] +scilab2ccode.deps.srowsuma=[] +scilab2ccode.deps.zrowsuma=["zadds"] + + +//variance +scilab2ccode.deps.cvariancea=["FloatComplex","cmeana","cdiffs","cadds","cpows","creals","cimags","crdivs"] +scilab2ccode.deps.dvariancea=["dmeana","dpows"] +scilab2ccode.deps.svariancea=["smeana","spows"] +scilab2ccode.deps.zvariancea=["DoubleComplex","zmeana","zdiffs","zadds","zpows","zreals","zimags","zrdivs"] +scilab2ccode.deps.ccolumnvariancea=["cvariancea"] +scilab2ccode.deps.dcolumnvariancea=["dvariancea"] +scilab2ccode.deps.scolumnvariancea=["svariancea"] +scilab2ccode.deps.zcolumnvariancea=["zvariancea"] +scilab2ccode.deps.crowvariancea=["ctransposea","FloatComplex","creals","cimags","cvariancea"] +scilab2ccode.deps.drowvariancea=["dtransposea","dvariancea"] +scilab2ccode.deps.srowvariancea=["stransposea","svariancea"] +scilab2ccode.deps.zrowvariancea=["ztransposea","DoubleComplex","zreals","zimags","zvariancea"] + + +//////////////////// +////// STRING ////// +//////////////////// + + +//disp +scilab2ccode.deps.cdisps=["creals","cimags"] +scilab2ccode.deps.cdispa=["creals","cimags"] +scilab2ccode.deps.ddisps=[] +scilab2ccode.deps.ddispa=[] +scilab2ccode.deps.sdisps=[] +scilab2ccode.deps.sdispa=[] +scilab2ccode.deps.zdisps=["zreals","zimags"] +scilab2ccode.deps.zdispa=["zreals","zimags"] + + +/////////////////// +////// TYPES ////// +/////////////////// + + +//floatComplex +scilab2ccode.deps.creals=[] +scilab2ccode.deps.cimags=[] +scilab2ccode.deps.creala=["creals"] +scilab2ccode.deps.cimaga=["cimags"] +scilab2ccode.deps.FloatComplex=[] +scilab2ccode.deps.FloatComplexMatrix=["FloatComplex"] +scilab2ccode.deps.cisreals=["cimags"] +scilab2ccode.deps.cisimags=["creals"] + + +//doubleComplex +scilab2ccode.deps.zreals=[] +scilab2ccode.deps.zimags=[] +scilab2ccode.deps.zreala=["zreals"] +scilab2ccode.deps.zimaga=["zimags"] +scilab2ccode.deps.DoubleComplex=[] +scilab2ccode.deps.DoubleComplexMatrix=["DoubleComplex"] +scilab2ccode.deps.zisreals=["zimags"] +scilab2ccode.deps.zisimags=["zreals"] + +endfunction diff --git a/macros/findDeps/buildmacros.sce b/macros/findDeps/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/macros/findDeps/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/findDeps/findDeps.sci b/macros/findDeps/findDeps.sci new file mode 100644 index 00000000..965ae8e0 --- /dev/null +++ b/macros/findDeps/findDeps.sci @@ -0,0 +1,44 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) INRIA - 2009 - Arnaud TORSET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + + +function y=findDeps(x, deps) +//give the dependances of x +// + +nbArgsIn = size(deps.x,'c'); +//stocke deps.x dans y +y=deps.x; +for i=1:nbArgsIn, + //on boucle sur le nombre d'entrées afin de pouvoir extraire chaque éléments + //l'element est stockédans deps(deps.a(i)) + for j=1:size(deps(deps.a(i)),'c'), + //on boucle sur les dependances de cet element afin de savoir s'il faut rajoutere des dependances + nouveau = 0; + for k=1:size(y,'c'), + //on boucle sur le nombre d'elements de y afin de faire une comparaison entre les elements + //presents et absents de la liste. + //S'il est absent de la liste(nouveau=0), on le rajoute à y, sinon(nouveau=1) on fait rien + if (deps(deps.a(i))(j)==deps.y(k)) then nouveau=nouveau+1;end; + end; + if (nouveau==0) then y(1,size(y,'c')+1)=deps(deps.a(i))(j);end; + end; +end; + +//si le nb de parametres du début est égal à celui de la fin alors on arrete, sinon on continue +nbArgsOut = size(deps.y,'c'); +if (nbArgsOut>nbArgsIn) then findDeps(y, deps); +else if (nbArgsOut"),... +// "units", "pixels",... +// "position",[3*margin+100 outframemaxy+2*margin-1 figw-6*margin-100-btnw widgeth],... +// "fontname", defaultfont,... +// "fontunits", "points",... +// "fontsize", 12, ... +// "tag", "headeredit"); +// headerbtn = uicontrol("parent", sci2cfig,... +// "backgroundcolor", [0.8 0.8 0.8],... +// "style", "pushbutton",... +// "string", gettext("Browse"),... +// "position",[figw-2*margin-btnw outframemaxy+2*margin btnw btnh],... +// "fontname", defaultfont,... +// "fontunits", "points",... +// "fontsize", 12,... +// "callback", "cb_sci2c_gui",... +// "tag", "headerbtn"); + +// ------------------------- +// --- File(s) selection --- +// ------------------------- +// Frame +headerframemaxy = outframemaxy //+ 2*margin + widgeth + margin; +selframe = uicontrol("parent", sci2cfig,... + "relief", "groove",... + "style", "frame",... + "units", "pixels",... + "position", [margin headerframemaxy+margin figw-2*margin 3*margin+2*widgeth],... + "fontname", "arial",... + "fontunits", "points",... + "fontsize", 12,... + "fontweight", "bold", ... + "horizontalalignment", "center"); +// Frame title +seltitle = uicontrol("parent", sci2cfig,... + "style", "text",... + "string", gettext("Input file"),... + "units", "pixels",... + "position", [2*margin headerframemaxy+margin+3*margin+2*widgeth-8 50 14],... + "fontname", defaultfont,... + "fontunits", "points",... + "fontsize", 11,... + "horizontalalignment", "center", ... + "tag", "seltitle"); + +// --- Sub-functions selection --- +subfunslabel = uicontrol("parent", sci2cfig,... + "style", "text",... + "string", gettext("Sub-functions: "),... + "position",[2*margin headerframemaxy+2*margin-1 100 widgeth],... + "horizontalalignment", "left",... + "fontname", defaultfont,... + "fontunits", "points",... + "fontsize", 12); +subfunsedit = uicontrol("parent", sci2cfig,... + "style", "edit",... + "string", "",... + "units", "pixels",... + "position",[3*margin+100 headerframemaxy+2*margin-1 figw-6*margin-100-btnw widgeth],... + "fontname", defaultfont,... + "fontunits", "points",... + "fontsize", 12, ... + "tag", "subfunsedit"); +subfunsbtn = uicontrol("parent", sci2cfig,... + "backgroundcolor", [0.8 0.8 0.8],... + "style", "pushbutton",... + "string", gettext("Browse"),... + "position",[figw-2*margin-btnw headerframemaxy+2*margin btnw btnh],... + "fontname", defaultfont,... + "fontunits", "points",... + "fontsize", 12,... + "callback", "cb_sci2c_gui",... + "tag", "subfunsbtn"); + +// --- File selection --- +filelabel = uicontrol("parent", sci2cfig,... + "style", "text",... + "string", gettext("Main file name: "),... + "position",[2*margin headerframemaxy+3*margin-1+widgeth 100 widgeth],... + "horizontalalignment", "left",... + "fontname", defaultfont,... + "fontunits", "points",... + "fontsize", 12,... + "tag", "filelabel"); + +fileedit = uicontrol("parent", sci2cfig,... + "style", "edit",... + "string", gettext(""),... + "position",[3*margin+100 headerframemaxy+3*margin-1+widgeth figw-6*margin-100-btnw widgeth],... + "fontname", defaultfont,... + "fontunits", "points",... + "fontsize", 12,... + "tag", "fileedit"); + +filebtn = uicontrol("parent", sci2cfig,... + "backgroundcolor", [0.8 0.8 0.8],... + "style", "pushbutton",... + "string", gettext("Browse"),... + "position",[figw-2*margin-btnw headerframemaxy+3*margin+widgeth btnw btnh],... + "fontname", defaultfont,... + "fontunits", "points",... + "fontsize", 12,... + "callback", "cb_sci2c_gui",... + "tag", "filebtn"); + +endfunction diff --git a/macros/scilab2c.sci b/macros/scilab2c.sci new file mode 100644 index 00000000..b0265931 --- /dev/null +++ b/macros/scilab2c.sci @@ -0,0 +1,130 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2010 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +function scilab2c(varargin) + [lhs, rhs] = argn(); + + select rhs +// +// scilab2c() +// + case 0 + sci2c_gui(); + return +// +// scilab2c(UserScilabMainFile, CCodeOutputDir) +// + case 2 + for i = 1:2 + if typeof(varargin(i)) <> "string" + error(msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"),"scilab2c",i)); + return + end + end + UserScilabMainFile = varargin(1); + CCodeOutputDir = varargin(2); + UserSciFilesPaths = []; + RunMode = 'All'; + BuildTool = getNativeBuildTool(); + // +// scilab2c(UserScilabMainFile, CCodeOutputDir, UserSciFilesPaths) +// + case 3 + for i = 1:3 + if typeof(varargin(i)) <> "string" + error(msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"),"scilab2c",i)); + return + end + end + UserScilabMainFile = varargin(1); + CCodeOutputDir = varargin(2); + if varargin(3) == "" + UserSciFilesPaths = []; + else + UserSciFilesPaths = varargin(3); + end + RunMode = "All"; + BuildTool = getNativeBuildTool(); + // +// scilab2c(UserScilabMainFile, CCodeOutputDir, UserSciFilesPaths, RunMode) +// + case 4 + for i = 1:4 + if typeof(varargin(i)) <> "string" + error(msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"),"scilab2c",i)); + return + end + end + if varargin(4) <> "All" & varargin(4) <> "Translate" & varargin(4) <> "GenLibraryStructure" + error(msprintf(gettext("%s: argument #%d must be: ""All"", ""Translate"" or ""GenLibraryStructure"".\n"),"scilab2c",4)); + return + end + UserScilabMainFile = varargin(1); + CCodeOutputDir = varargin(2); + if varargin(3) == "" + UserSciFilesPaths = []; + else + UserSciFilesPaths = varargin(3); + end + RunMode = varargin(4); + BuildTool = getNativeBuildTool(); + case 5 + for i = 1:4 + if typeof(varargin(i)) <> "string" + error(msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"),"scilab2c",i)); + return + end + end + if varargin(4) <> "All" & varargin(4) <> "Translate" & varargin(4) <> "GenLibraryStructure" + error(msprintf(gettext("%s: argument #%d must be: ""All"", ""Translate"" or ""GenLibraryStructure"".\n"),"scilab2c",4)); + return + end + if varargin(5) <> "make" & varargin(5) <> "nmake" + error(msprintf(gettext("%s: argument #%d must be: ""make"" or ""nmake"".\n"),"scilab2c",5)); + return + end + UserScilabMainFile = varargin(1); + CCodeOutputDir = varargin(2); + if varargin(3) == "" + UserSciFilesPaths = []; + else + UserSciFilesPaths = varargin(3); + end + RunMode = varargin(4); + BuildTool = varargin(5); + else +// +// Calling scilab2c with more than understood values +// +error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"),"scilab2c",2)); + end + + +// --- LAUNCH USER SCI CODE TO TEST IT BEFORE TRANSLATING IT!!! --- + runscicode(UserScilabMainFile, UserSciFilesPaths); +// --- ASK USER FOR CONTINUATION. --- + + userchoice = messagebox("Exection Succesfull. Start translation ?", "modal", "info", ["Yes" "No"]) + if (userchoice == 1) +// --- LAUNCH SCI2C --- + runsci2c(UserScilabMainFile, UserSciFilesPaths, CCodeOutputDir, RunMode, BuildTool); + end + +endfunction + +function BuildTool = getNativeBuildTool() + if MSDOS + BuildTool = "nmake" + else + BuildTool = "make" + end +endfunction \ No newline at end of file -- cgit