From 0345245e860375a32c9a437c4a9d9cae807134e9 Mon Sep 17 00:00:00 2001 From: Shashank Date: Mon, 29 May 2017 12:40:26 +0530 Subject: CMSCOPE changed --- modules/m2sci/macros/buildmacros.bat | 6 + modules/m2sci/macros/buildmacros.sce | 29 + modules/m2sci/macros/cb_m2sci_gui.bin | Bin 0 -> 19412 bytes modules/m2sci/macros/cb_m2sci_gui.sci | 182 + modules/m2sci/macros/cleanmacros.bat | 8 + .../m2sci/macros/kernel/%contents_i_funcall.bin | Bin 0 -> 752 bytes .../m2sci/macros/kernel/%contents_i_funcall.sci | 17 + .../m2sci/macros/kernel/%contents_i_operatio.bin | Bin 0 -> 752 bytes .../m2sci/macros/kernel/%contents_i_operatio.sci | 17 + .../m2sci/macros/kernel/%contents_i_variable.bin | Bin 0 -> 712 bytes .../m2sci/macros/kernel/%contents_i_variable.sci | 17 + modules/m2sci/macros/kernel/%cste_e.bin | Bin 0 -> 2440 bytes modules/m2sci/macros/kernel/%cste_e.sci | 27 + modules/m2sci/macros/kernel/%funcall_6.bin | Bin 0 -> 2972 bytes modules/m2sci/macros/kernel/%funcall_6.sci | 29 + modules/m2sci/macros/kernel/%funcall_e.bin | Bin 0 -> 2748 bytes modules/m2sci/macros/kernel/%funcall_e.sci | 28 + modules/m2sci/macros/kernel/%infer_i_s.bin | Bin 0 -> 3264 bytes modules/m2sci/macros/kernel/%infer_i_s.sci | 36 + modules/m2sci/macros/kernel/%infer_i_st.bin | Bin 0 -> 360 bytes modules/m2sci/macros/kernel/%infer_i_st.sci | 12 + modules/m2sci/macros/kernel/%l_i_cste.bin | Bin 0 -> 944 bytes modules/m2sci/macros/kernel/%l_i_cste.sci | 19 + modules/m2sci/macros/kernel/%l_i_funcall.bin | Bin 0 -> 964 bytes modules/m2sci/macros/kernel/%l_i_funcall.sci | 18 + modules/m2sci/macros/kernel/%l_i_operatio.bin | Bin 0 -> 964 bytes modules/m2sci/macros/kernel/%l_i_operatio.sci | 18 + modules/m2sci/macros/kernel/%l_i_variable.bin | Bin 0 -> 1204 bytes modules/m2sci/macros/kernel/%l_i_variable.sci | 20 + modules/m2sci/macros/kernel/%m2scivar_e.bin | Bin 0 -> 2496 bytes modules/m2sci/macros/kernel/%m2scivar_e.sci | 28 + modules/m2sci/macros/kernel/%operatio_6.bin | Bin 0 -> 2972 bytes modules/m2sci/macros/kernel/%operatio_6.sci | 29 + modules/m2sci/macros/kernel/%operatio_e.bin | Bin 0 -> 2972 bytes modules/m2sci/macros/kernel/%operatio_e.sci | 29 + modules/m2sci/macros/kernel/%s_i_operatio.bin | Bin 0 -> 960 bytes modules/m2sci/macros/kernel/%s_i_operatio.sci | 18 + modules/m2sci/macros/kernel/%s_i_variable.bin | Bin 0 -> 1284 bytes modules/m2sci/macros/kernel/%s_i_variable.sci | 21 + modules/m2sci/macros/kernel/%type_i_cste.bin | Bin 0 -> 696 bytes modules/m2sci/macros/kernel/%type_i_cste.sci | 17 + modules/m2sci/macros/kernel/%type_i_funcall.bin | Bin 0 -> 708 bytes modules/m2sci/macros/kernel/%type_i_funcall.sci | 17 + modules/m2sci/macros/kernel/%type_i_operatio.bin | Bin 0 -> 708 bytes modules/m2sci/macros/kernel/%type_i_operatio.sci | 17 + modules/m2sci/macros/kernel/%type_i_variable.bin | Bin 0 -> 3248 bytes modules/m2sci/macros/kernel/%type_i_variable.sci | 40 + modules/m2sci/macros/kernel/%variable_6.bin | Bin 0 -> 2720 bytes modules/m2sci/macros/kernel/%variable_6.sci | 29 + modules/m2sci/macros/kernel/%variable_e.bin | Bin 0 -> 2724 bytes modules/m2sci/macros/kernel/%variable_e.sci | 30 + modules/m2sci/macros/kernel/Contents.bin | Bin 0 -> 3080 bytes modules/m2sci/macros/kernel/Contents.sci | 31 + modules/m2sci/macros/kernel/Cste.bin | Bin 0 -> 3664 bytes modules/m2sci/macros/kernel/Cste.sci | 51 + modules/m2sci/macros/kernel/Equal.bin | Bin 0 -> 3696 bytes modules/m2sci/macros/kernel/Equal.sci | 34 + modules/m2sci/macros/kernel/Funcall.bin | Bin 0 -> 4012 bytes modules/m2sci/macros/kernel/Funcall.sci | 30 + modules/m2sci/macros/kernel/Infer.bin | Bin 0 -> 6108 bytes modules/m2sci/macros/kernel/Infer.sci | 42 + modules/m2sci/macros/kernel/M2scivar.bin | Bin 0 -> 3456 bytes modules/m2sci/macros/kernel/M2scivar.sci | 32 + modules/m2sci/macros/kernel/Operation.bin | Bin 0 -> 3196 bytes modules/m2sci/macros/kernel/Operation.sci | 29 + modules/m2sci/macros/kernel/Rhs_tlist.bin | Bin 0 -> 2500 bytes modules/m2sci/macros/kernel/Rhs_tlist.sci | 31 + modules/m2sci/macros/kernel/Type.bin | Bin 0 -> 3364 bytes modules/m2sci/macros/kernel/Type.sci | 30 + modules/m2sci/macros/kernel/Variable.bin | Bin 0 -> 2388 bytes modules/m2sci/macros/kernel/Variable.sci | 27 + modules/m2sci/macros/kernel/allunknown.bin | Bin 0 -> 496 bytes modules/m2sci/macros/kernel/allunknown.sci | 17 + modules/m2sci/macros/kernel/buildmacros.sce | 16 + modules/m2sci/macros/kernel/changevarname.bin | Bin 0 -> 8792 bytes modules/m2sci/macros/kernel/changevarname.sci | 63 + modules/m2sci/macros/kernel/clause2sci.bin | Bin 0 -> 60052 bytes modules/m2sci/macros/kernel/clause2sci.sci | 385 +++ modules/m2sci/macros/kernel/convert2double.bin | Bin 0 -> 4804 bytes modules/m2sci/macros/kernel/convert2double.sci | 40 + modules/m2sci/macros/kernel/default_trad.bin | Bin 0 -> 12140 bytes modules/m2sci/macros/kernel/default_trad.sci | 102 + modules/m2sci/macros/kernel/equal2sci.bin | Bin 0 -> 23972 bytes modules/m2sci/macros/kernel/equal2sci.sci | 158 + modules/m2sci/macros/kernel/expression2sci.bin | Bin 0 -> 17320 bytes modules/m2sci/macros/kernel/expression2sci.sci | 132 + .../m2sci/macros/kernel/first_non_singleton.bin | Bin 0 -> 1476 bytes .../m2sci/macros/kernel/first_non_singleton.sci | 26 + modules/m2sci/macros/kernel/funcall2sci.bin | Bin 0 -> 11480 bytes modules/m2sci/macros/kernel/funcall2sci.sci | 98 + modules/m2sci/macros/kernel/funcallsearch.bin | Bin 0 -> 18152 bytes modules/m2sci/macros/kernel/funcallsearch.sci | 104 + modules/m2sci/macros/kernel/get_unknown.bin | Bin 0 -> 3708 bytes modules/m2sci/macros/kernel/get_unknown.sci | 31 + modules/m2sci/macros/kernel/getoperands.bin | Bin 0 -> 1292 bytes modules/m2sci/macros/kernel/getoperands.sci | 24 + modules/m2sci/macros/kernel/getrhs.bin | Bin 0 -> 1352 bytes modules/m2sci/macros/kernel/getrhs.sci | 24 + modules/m2sci/macros/kernel/gettempvar.bin | Bin 0 -> 3784 bytes modules/m2sci/macros/kernel/gettempvar.sci | 35 + modules/m2sci/macros/kernel/getvar2sci.bin | Bin 0 -> 7828 bytes modules/m2sci/macros/kernel/getvar2sci.sci | 63 + modules/m2sci/macros/kernel/i_notation.bin | Bin 0 -> 11776 bytes modules/m2sci/macros/kernel/i_notation.sci | 94 + modules/m2sci/macros/kernel/infer2txt.bin | Bin 0 -> 7084 bytes modules/m2sci/macros/kernel/infer2txt.sci | 60 + modules/m2sci/macros/kernel/insert.bin | Bin 0 -> 1480 bytes modules/m2sci/macros/kernel/insert.sci | 26 + modules/m2sci/macros/kernel/instruction2sci.bin | Bin 0 -> 2804 bytes modules/m2sci/macros/kernel/instruction2sci.sci | 32 + modules/m2sci/macros/kernel/is_a_scalar.bin | Bin 0 -> 1348 bytes modules/m2sci/macros/kernel/is_a_scalar.sci | 24 + modules/m2sci/macros/kernel/is_a_vector.bin | Bin 0 -> 1820 bytes modules/m2sci/macros/kernel/is_a_vector.sci | 27 + modules/m2sci/macros/kernel/is_complex.bin | Bin 0 -> 784 bytes modules/m2sci/macros/kernel/is_complex.sci | 18 + modules/m2sci/macros/kernel/is_empty.bin | Bin 0 -> 1492 bytes modules/m2sci/macros/kernel/is_empty.sci | 25 + modules/m2sci/macros/kernel/is_real.bin | Bin 0 -> 788 bytes modules/m2sci/macros/kernel/is_real.sci | 18 + modules/m2sci/macros/kernel/isacomment.bin | Bin 0 -> 4376 bytes modules/m2sci/macros/kernel/isacomment.sci | 45 + modules/m2sci/macros/kernel/isanmfile.bin | Bin 0 -> 3804 bytes modules/m2sci/macros/kernel/isanmfile.sci | 46 + modules/m2sci/macros/kernel/isdefinedvar.bin | Bin 0 -> 6692 bytes modules/m2sci/macros/kernel/isdefinedvar.sci | 65 + modules/m2sci/macros/kernel/isinstring.bin | Bin 0 -> 8360 bytes modules/m2sci/macros/kernel/isinstring.sci | 78 + modules/m2sci/macros/kernel/lib | Bin 0 -> 2372 bytes modules/m2sci/macros/kernel/lst_funcall.bin | Bin 0 -> 37000 bytes modules/m2sci/macros/kernel/lst_funcall.sci | 234 ++ modules/m2sci/macros/kernel/m2sci.bin | Bin 0 -> 47728 bytes modules/m2sci/macros/kernel/m2sci.sci | 299 ++ modules/m2sci/macros/kernel/m2sci_info.bin | Bin 0 -> 6328 bytes modules/m2sci/macros/kernel/m2sci_info.sci | 45 + modules/m2sci/macros/kernel/m2sci_syntax.bin | Bin 0 -> 71736 bytes modules/m2sci/macros/kernel/m2sci_syntax.sci | 455 +++ modules/m2sci/macros/kernel/mfile_path.bin | Bin 0 -> 1384 bytes modules/m2sci/macros/kernel/mfile_path.sci | 21 + modules/m2sci/macros/kernel/mtlbtoolfun.bin | Bin 0 -> 684048 bytes modules/m2sci/macros/kernel/mtlbtoolfun.sci | 3653 ++++++++++++++++++++ modules/m2sci/macros/kernel/mtlbtree2sci.bin | Bin 0 -> 16272 bytes modules/m2sci/macros/kernel/mtlbtree2sci.sci | 125 + modules/m2sci/macros/kernel/multi_fun_file.bin | Bin 0 -> 23064 bytes modules/m2sci/macros/kernel/multi_fun_file.sci | 174 + modules/m2sci/macros/kernel/names | 87 + modules/m2sci/macros/kernel/no_equiv.bin | Bin 0 -> 468 bytes modules/m2sci/macros/kernel/no_equiv.sci | 14 + modules/m2sci/macros/kernel/not_a_scalar.bin | Bin 0 -> 1700 bytes modules/m2sci/macros/kernel/not_a_scalar.sci | 24 + modules/m2sci/macros/kernel/not_a_vector.bin | Bin 0 -> 1788 bytes modules/m2sci/macros/kernel/not_a_vector.sci | 25 + modules/m2sci/macros/kernel/not_empty.bin | Bin 0 -> 1932 bytes modules/m2sci/macros/kernel/not_empty.sci | 25 + modules/m2sci/macros/kernel/not_yet_converted.bin | Bin 0 -> 78112 bytes modules/m2sci/macros/kernel/not_yet_converted.sci | 1337 +++++++ modules/m2sci/macros/kernel/old2newinstr.bin | Bin 0 -> 15780 bytes modules/m2sci/macros/kernel/old2newinstr.sci | 94 + modules/m2sci/macros/kernel/operation2sci.bin | Bin 0 -> 7508 bytes modules/m2sci/macros/kernel/operation2sci.sci | 72 + modules/m2sci/macros/kernel/repl_poss.bin | Bin 0 -> 3988 bytes modules/m2sci/macros/kernel/repl_poss.sci | 40 + modules/m2sci/macros/kernel/replace_brackets.bin | Bin 0 -> 6636 bytes modules/m2sci/macros/kernel/replace_brackets.sci | 52 + modules/m2sci/macros/kernel/sci_generic.bin | Bin 0 -> 2196 bytes modules/m2sci/macros/kernel/sci_generic.sci | 25 + modules/m2sci/macros/kernel/sci_m2scideclare.bin | Bin 0 -> 58424 bytes modules/m2sci/macros/kernel/sci_m2scideclare.sci | 342 ++ modules/m2sci/macros/kernel/sciparam.bin | Bin 0 -> 4176 bytes modules/m2sci/macros/kernel/sciparam.sci | 56 + modules/m2sci/macros/kernel/set_infos.bin | Bin 0 -> 1808 bytes modules/m2sci/macros/kernel/set_infos.sci | 27 + modules/m2sci/macros/kernel/transformtree.bin | Bin 0 -> 12008 bytes modules/m2sci/macros/kernel/transformtree.sci | 84 + modules/m2sci/macros/kernel/translateorder.bin | Bin 0 -> 6368 bytes modules/m2sci/macros/kernel/translateorder.sci | 49 + modules/m2sci/macros/kernel/update_instr_list.bin | Bin 0 -> 3996 bytes modules/m2sci/macros/kernel/update_instr_list.sci | 45 + modules/m2sci/macros/kernel/updatevarslist.bin | Bin 0 -> 32828 bytes modules/m2sci/macros/kernel/updatevarslist.sci | 233 ++ modules/m2sci/macros/kernel/variablesearch.bin | Bin 0 -> 9756 bytes modules/m2sci/macros/kernel/variablesearch.sci | 71 + modules/m2sci/macros/lib | Bin 0 -> 376 bytes modules/m2sci/macros/m2sci_gui.bin | Bin 0 -> 44072 bytes modules/m2sci/macros/m2sci_gui.sci | 372 ++ modules/m2sci/macros/matfile2sci.bin | Bin 0 -> 9808 bytes modules/m2sci/macros/matfile2sci.sci | 80 + modules/m2sci/macros/mfile2sci.bin | Bin 0 -> 50756 bytes modules/m2sci/macros/mfile2sci.sci | 353 ++ modules/m2sci/macros/names | 5 + modules/m2sci/macros/percent/%02sci.bin | Bin 0 -> 3712 bytes modules/m2sci/macros/percent/%02sci.sci | 33 + modules/m2sci/macros/percent/%52sci.bin | Bin 0 -> 1908 bytes modules/m2sci/macros/percent/%52sci.sci | 25 + modules/m2sci/macros/percent/%a2sci.bin | Bin 0 -> 10360 bytes modules/m2sci/macros/percent/%a2sci.sci | 79 + modules/m2sci/macros/percent/%cc2sci.bin | Bin 0 -> 6404 bytes modules/m2sci/macros/percent/%cc2sci.sci | 77 + modules/m2sci/macros/percent/%cc_cell2sci.bin | Bin 0 -> 10468 bytes modules/m2sci/macros/percent/%cc_cell2sci.sci | 66 + modules/m2sci/macros/percent/%d2sci.bin | Bin 0 -> 3784 bytes modules/m2sci/macros/percent/%d2sci.sci | 39 + modules/m2sci/macros/percent/%e2sci.bin | Bin 0 -> 23804 bytes modules/m2sci/macros/percent/%e2sci.sci | 177 + modules/m2sci/macros/percent/%e_ce2sci.bin | Bin 0 -> 24112 bytes modules/m2sci/macros/percent/%e_ce2sci.sci | 174 + modules/m2sci/macros/percent/%e_st2sci.bin | Bin 0 -> 21144 bytes modules/m2sci/macros/percent/%e_st2sci.sci | 155 + modules/m2sci/macros/percent/%g2sci.bin | Bin 0 -> 10168 bytes modules/m2sci/macros/percent/%g2sci.sci | 69 + modules/m2sci/macros/percent/%h2sci.bin | Bin 0 -> 9996 bytes modules/m2sci/macros/percent/%h2sci.sci | 69 + modules/m2sci/macros/percent/%i2sci.bin | Bin 0 -> 26396 bytes modules/m2sci/macros/percent/%i2sci.sci | 190 + modules/m2sci/macros/percent/%i2sci_c.bin | Bin 0 -> 5372 bytes modules/m2sci/macros/percent/%i2sci_c.sci | 46 + modules/m2sci/macros/percent/%i2sci_g.bin | Bin 0 -> 2092 bytes modules/m2sci/macros/percent/%i2sci_g.sci | 25 + modules/m2sci/macros/percent/%i2sci_r.bin | Bin 0 -> 5368 bytes modules/m2sci/macros/percent/%i2sci_r.sci | 46 + modules/m2sci/macros/percent/%i2sci_s.bin | Bin 0 -> 3528 bytes modules/m2sci/macros/percent/%i2sci_s.sci | 33 + modules/m2sci/macros/percent/%i_ce2sci.bin | Bin 0 -> 28644 bytes modules/m2sci/macros/percent/%i_ce2sci.sci | 172 + modules/m2sci/macros/percent/%i_st2sci.bin | Bin 0 -> 30228 bytes modules/m2sci/macros/percent/%i_st2sci.sci | 191 + modules/m2sci/macros/percent/%imp2sci.bin | Bin 0 -> 12312 bytes modules/m2sci/macros/percent/%imp2sci.sci | 83 + modules/m2sci/macros/percent/%j2sci.bin | Bin 0 -> 3616 bytes modules/m2sci/macros/percent/%j2sci.sci | 40 + modules/m2sci/macros/percent/%l2sci.bin | Bin 0 -> 6656 bytes modules/m2sci/macros/percent/%l2sci.sci | 52 + modules/m2sci/macros/percent/%log2sci.bin | Bin 0 -> 8780 bytes modules/m2sci/macros/percent/%log2sci.sci | 59 + modules/m2sci/macros/percent/%m2sci.bin | Bin 0 -> 9300 bytes modules/m2sci/macros/percent/%m2sci.sci | 75 + modules/m2sci/macros/percent/%p2sci.bin | Bin 0 -> 3792 bytes modules/m2sci/macros/percent/%p2sci.sci | 42 + modules/m2sci/macros/percent/%q2sci.bin | Bin 0 -> 3776 bytes modules/m2sci/macros/percent/%q2sci.sci | 39 + modules/m2sci/macros/percent/%r2sci.bin | Bin 0 -> 4412 bytes modules/m2sci/macros/percent/%r2sci.sci | 42 + modules/m2sci/macros/percent/%rc2sci.bin | Bin 0 -> 8048 bytes modules/m2sci/macros/percent/%rc2sci.sci | 97 + modules/m2sci/macros/percent/%rc_cell2sci.bin | Bin 0 -> 6548 bytes modules/m2sci/macros/percent/%rc_cell2sci.sci | 41 + modules/m2sci/macros/percent/%s2sci.bin | Bin 0 -> 10452 bytes modules/m2sci/macros/percent/%s2sci.sci | 78 + modules/m2sci/macros/percent/%t2sci.bin | Bin 0 -> 2504 bytes modules/m2sci/macros/percent/%t2sci.sci | 28 + modules/m2sci/macros/percent/%x2sci.bin | Bin 0 -> 6512 bytes modules/m2sci/macros/percent/%x2sci.sci | 62 + modules/m2sci/macros/percent/buildmacros.sce | 16 + .../m2sci/macros/percent/get_contents_infer.bin | Bin 0 -> 6060 bytes .../m2sci/macros/percent/get_contents_infer.sci | 43 + modules/m2sci/macros/percent/lib | Bin 0 -> 1056 bytes modules/m2sci/macros/percent/names | 32 + modules/m2sci/macros/sci_files/GEN | 10 + modules/m2sci/macros/sci_files/Makeproto | 200 ++ modules/m2sci/macros/sci_files/buildmacros.sce | 16 + modules/m2sci/macros/sci_files/lib | Bin 0 -> 6800 bytes modules/m2sci/macros/sci_files/names | 271 ++ modules/m2sci/macros/sci_files/sci_PROTO0.g | 23 + modules/m2sci/macros/sci_files/sci_PROTO1.g | 169 + modules/m2sci/macros/sci_files/sci_PROTO10.g | 37 + modules/m2sci/macros/sci_files/sci_PROTO11.g | 49 + modules/m2sci/macros/sci_files/sci_PROTO12.g | 37 + modules/m2sci/macros/sci_files/sci_PROTO13.g | 98 + modules/m2sci/macros/sci_files/sci_PROTO14.g | 23 + modules/m2sci/macros/sci_files/sci_PROTO15.g | 36 + modules/m2sci/macros/sci_files/sci_PROTO2.g | 73 + modules/m2sci/macros/sci_files/sci_PROTO3.g | 176 + modules/m2sci/macros/sci_files/sci_PROTO4.g | 25 + modules/m2sci/macros/sci_files/sci_PROTO5.g | 29 + modules/m2sci/macros/sci_files/sci_PROTO6.g | 27 + modules/m2sci/macros/sci_files/sci_PROTO7.g | 46 + modules/m2sci/macros/sci_files/sci_PROTO8.g | 82 + modules/m2sci/macros/sci_files/sci_PROTO9.g | 55 + modules/m2sci/macros/sci_files/sci_abs.bin | Bin 0 -> 1704 bytes modules/m2sci/macros/sci_files/sci_abs.sci | 23 + modules/m2sci/macros/sci_files/sci_acos.bin | Bin 0 -> 1820 bytes modules/m2sci/macros/sci_files/sci_acos.sci | 23 + modules/m2sci/macros/sci_files/sci_acosh.bin | Bin 0 -> 1884 bytes modules/m2sci/macros/sci_files/sci_acosh.sci | 25 + modules/m2sci/macros/sci_files/sci_acot.bin | Bin 0 -> 1972 bytes modules/m2sci/macros/sci_files/sci_acot.sci | 25 + modules/m2sci/macros/sci_files/sci_acoth.bin | Bin 0 -> 3120 bytes modules/m2sci/macros/sci_files/sci_acoth.sci | 28 + modules/m2sci/macros/sci_files/sci_acsc.bin | Bin 0 -> 2016 bytes modules/m2sci/macros/sci_files/sci_acsc.sci | 25 + modules/m2sci/macros/sci_files/sci_acsch.bin | Bin 0 -> 1980 bytes modules/m2sci/macros/sci_files/sci_acsch.sci | 25 + modules/m2sci/macros/sci_files/sci_all.bin | Bin 0 -> 12432 bytes modules/m2sci/macros/sci_files/sci_all.sci | 98 + modules/m2sci/macros/sci_files/sci_angle.bin | Bin 0 -> 3024 bytes modules/m2sci/macros/sci_files/sci_angle.sci | 33 + modules/m2sci/macros/sci_files/sci_any.bin | Bin 0 -> 12412 bytes modules/m2sci/macros/sci_files/sci_any.sci | 98 + modules/m2sci/macros/sci_files/sci_asec.bin | Bin 0 -> 2016 bytes modules/m2sci/macros/sci_files/sci_asec.sci | 25 + modules/m2sci/macros/sci_files/sci_asech.bin | Bin 0 -> 2024 bytes modules/m2sci/macros/sci_files/sci_asech.sci | 25 + modules/m2sci/macros/sci_files/sci_asin.bin | Bin 0 -> 3568 bytes modules/m2sci/macros/sci_files/sci_asin.sci | 29 + modules/m2sci/macros/sci_files/sci_asinh.bin | Bin 0 -> 1884 bytes modules/m2sci/macros/sci_files/sci_asinh.sci | 25 + modules/m2sci/macros/sci_files/sci_atan.bin | Bin 0 -> 3568 bytes modules/m2sci/macros/sci_files/sci_atan.sci | 29 + modules/m2sci/macros/sci_files/sci_atan2.bin | Bin 0 -> 4720 bytes modules/m2sci/macros/sci_files/sci_atan2.sci | 40 + modules/m2sci/macros/sci_files/sci_atanh.bin | Bin 0 -> 3572 bytes modules/m2sci/macros/sci_files/sci_atanh.sci | 29 + modules/m2sci/macros/sci_files/sci_axis.bin | Bin 0 -> 16448 bytes modules/m2sci/macros/sci_files/sci_axis.sci | 126 + modules/m2sci/macros/sci_files/sci_balance.bin | Bin 0 -> 5092 bytes modules/m2sci/macros/sci_files/sci_balance.sci | 48 + modules/m2sci/macros/sci_files/sci_bar.bin | Bin 0 -> 2716 bytes modules/m2sci/macros/sci_files/sci_bar.sci | 24 + modules/m2sci/macros/sci_files/sci_barh.bin | Bin 0 -> 2720 bytes modules/m2sci/macros/sci_files/sci_barh.sci | 24 + modules/m2sci/macros/sci_files/sci_beep.bin | Bin 0 -> 1152 bytes modules/m2sci/macros/sci_files/sci_beep.sci | 19 + modules/m2sci/macros/sci_files/sci_besseli.bin | Bin 0 -> 9628 bytes modules/m2sci/macros/sci_files/sci_besseli.sci | 73 + modules/m2sci/macros/sci_files/sci_besselj.bin | Bin 0 -> 9644 bytes modules/m2sci/macros/sci_files/sci_besselj.sci | 73 + modules/m2sci/macros/sci_files/sci_besselk.bin | Bin 0 -> 9644 bytes modules/m2sci/macros/sci_files/sci_besselk.sci | 73 + modules/m2sci/macros/sci_files/sci_bessely.bin | Bin 0 -> 9644 bytes modules/m2sci/macros/sci_files/sci_bessely.sci | 73 + modules/m2sci/macros/sci_files/sci_beta.bin | Bin 0 -> 5656 bytes modules/m2sci/macros/sci_files/sci_beta.sci | 40 + modules/m2sci/macros/sci_files/sci_bin2dec.bin | Bin 0 -> 1280 bytes modules/m2sci/macros/sci_files/sci_bin2dec.sci | 18 + modules/m2sci/macros/sci_files/sci_bitand.bin | Bin 0 -> 1196 bytes modules/m2sci/macros/sci_files/sci_bitand.sci | 18 + modules/m2sci/macros/sci_files/sci_bitor.bin | Bin 0 -> 1192 bytes modules/m2sci/macros/sci_files/sci_bitor.sci | 18 + modules/m2sci/macros/sci_files/sci_blanks.bin | Bin 0 -> 4904 bytes modules/m2sci/macros/sci_files/sci_blanks.sci | 43 + modules/m2sci/macros/sci_files/sci_box.bin | Bin 0 -> 4520 bytes modules/m2sci/macros/sci_files/sci_box.sci | 44 + modules/m2sci/macros/sci_files/sci_break.bin | Bin 0 -> 672 bytes modules/m2sci/macros/sci_files/sci_break.sci | 16 + modules/m2sci/macros/sci_files/sci_cd.bin | Bin 0 -> 1364 bytes modules/m2sci/macros/sci_files/sci_cd.sci | 23 + modules/m2sci/macros/sci_files/sci_ceil.bin | Bin 0 -> 2232 bytes modules/m2sci/macros/sci_files/sci_ceil.sci | 27 + modules/m2sci/macros/sci_files/sci_cell.bin | Bin 0 -> 10252 bytes modules/m2sci/macros/sci_files/sci_cell.sci | 79 + modules/m2sci/macros/sci_files/sci_cell2mat.bin | Bin 0 -> 4832 bytes modules/m2sci/macros/sci_files/sci_cell2mat.sci | 40 + modules/m2sci/macros/sci_files/sci_cellstr.bin | Bin 0 -> 3148 bytes modules/m2sci/macros/sci_files/sci_cellstr.sci | 34 + modules/m2sci/macros/sci_files/sci_char.bin | Bin 0 -> 6804 bytes modules/m2sci/macros/sci_files/sci_char.sci | 53 + modules/m2sci/macros/sci_files/sci_chol.bin | Bin 0 -> 2668 bytes modules/m2sci/macros/sci_files/sci_chol.sci | 37 + modules/m2sci/macros/sci_files/sci_cla.bin | Bin 0 -> 2436 bytes modules/m2sci/macros/sci_files/sci_cla.sci | 26 + modules/m2sci/macros/sci_files/sci_clc.bin | Bin 0 -> 788 bytes modules/m2sci/macros/sci_files/sci_clc.sci | 17 + modules/m2sci/macros/sci_files/sci_clear.bin | Bin 0 -> 4188 bytes modules/m2sci/macros/sci_files/sci_clear.sci | 47 + modules/m2sci/macros/sci_files/sci_clf.bin | Bin 0 -> 2916 bytes modules/m2sci/macros/sci_files/sci_clf.sci | 29 + modules/m2sci/macros/sci_files/sci_clock.bin | Bin 0 -> 6680 bytes modules/m2sci/macros/sci_files/sci_clock.sci | 43 + modules/m2sci/macros/sci_files/sci_close.bin | Bin 0 -> 6020 bytes modules/m2sci/macros/sci_files/sci_close.sci | 58 + modules/m2sci/macros/sci_files/sci_closereq.bin | Bin 0 -> 1092 bytes modules/m2sci/macros/sci_files/sci_closereq.sci | 20 + modules/m2sci/macros/sci_files/sci_colordef.bin | Bin 0 -> 13336 bytes modules/m2sci/macros/sci_files/sci_colordef.sci | 86 + modules/m2sci/macros/sci_files/sci_cond.bin | Bin 0 -> 2500 bytes modules/m2sci/macros/sci_files/sci_cond.sci | 29 + modules/m2sci/macros/sci_files/sci_conj.bin | Bin 0 -> 1876 bytes modules/m2sci/macros/sci_files/sci_conj.sci | 25 + modules/m2sci/macros/sci_files/sci_continue.bin | Bin 0 -> 676 bytes modules/m2sci/macros/sci_files/sci_continue.sci | 16 + modules/m2sci/macros/sci_files/sci_conv.bin | Bin 0 -> 5780 bytes modules/m2sci/macros/sci_files/sci_conv.sci | 36 + modules/m2sci/macros/sci_files/sci_conv2.bin | Bin 0 -> 9224 bytes modules/m2sci/macros/sci_files/sci_conv2.sci | 65 + modules/m2sci/macros/sci_files/sci_cos.bin | Bin 0 -> 1704 bytes modules/m2sci/macros/sci_files/sci_cos.sci | 23 + modules/m2sci/macros/sci_files/sci_cosh.bin | Bin 0 -> 1708 bytes modules/m2sci/macros/sci_files/sci_cosh.sci | 23 + modules/m2sci/macros/sci_files/sci_cot.bin | Bin 0 -> 1872 bytes modules/m2sci/macros/sci_files/sci_cot.sci | 25 + modules/m2sci/macros/sci_files/sci_coth.bin | Bin 0 -> 1876 bytes modules/m2sci/macros/sci_files/sci_coth.sci | 25 + modules/m2sci/macros/sci_files/sci_cov.bin | Bin 0 -> 33292 bytes modules/m2sci/macros/sci_files/sci_cov.sci | 168 + modules/m2sci/macros/sci_files/sci_cputime.bin | Bin 0 -> 1252 bytes modules/m2sci/macros/sci_files/sci_cputime.sci | 20 + modules/m2sci/macros/sci_files/sci_csc.bin | Bin 0 -> 2100 bytes modules/m2sci/macros/sci_files/sci_csc.sci | 24 + modules/m2sci/macros/sci_files/sci_csch.bin | Bin 0 -> 2108 bytes modules/m2sci/macros/sci_files/sci_csch.sci | 24 + modules/m2sci/macros/sci_files/sci_cumprod.bin | Bin 0 -> 8172 bytes modules/m2sci/macros/sci_files/sci_cumprod.sci | 73 + modules/m2sci/macros/sci_files/sci_cumsum.bin | Bin 0 -> 8132 bytes modules/m2sci/macros/sci_files/sci_cumsum.sci | 73 + modules/m2sci/macros/sci_files/sci_date.bin | Bin 0 -> 1132 bytes modules/m2sci/macros/sci_files/sci_date.sci | 18 + modules/m2sci/macros/sci_files/sci_dec2bin.bin | Bin 0 -> 1544 bytes modules/m2sci/macros/sci_files/sci_dec2bin.sci | 22 + modules/m2sci/macros/sci_files/sci_dec2hex.bin | Bin 0 -> 7652 bytes modules/m2sci/macros/sci_files/sci_dec2hex.sci | 64 + modules/m2sci/macros/sci_files/sci_delete.bin | Bin 0 -> 1412 bytes modules/m2sci/macros/sci_files/sci_delete.sci | 24 + modules/m2sci/macros/sci_files/sci_det.bin | Bin 0 -> 1680 bytes modules/m2sci/macros/sci_files/sci_det.sci | 24 + modules/m2sci/macros/sci_files/sci_diag.bin | Bin 0 -> 9632 bytes modules/m2sci/macros/sci_files/sci_diag.sci | 89 + modules/m2sci/macros/sci_files/sci_diary.bin | Bin 0 -> 2672 bytes modules/m2sci/macros/sci_files/sci_diary.sci | 34 + modules/m2sci/macros/sci_files/sci_diff.bin | Bin 0 -> 9368 bytes modules/m2sci/macros/sci_files/sci_diff.sci | 76 + modules/m2sci/macros/sci_files/sci_dir.bin | Bin 0 -> 5712 bytes modules/m2sci/macros/sci_files/sci_dir.sci | 38 + modules/m2sci/macros/sci_files/sci_disp.bin | Bin 0 -> 668 bytes modules/m2sci/macros/sci_files/sci_disp.sci | 16 + modules/m2sci/macros/sci_files/sci_display.bin | Bin 0 -> 1264 bytes modules/m2sci/macros/sci_files/sci_display.sci | 19 + modules/m2sci/macros/sci_files/sci_doc.bin | Bin 0 -> 2172 bytes modules/m2sci/macros/sci_files/sci_doc.sci | 30 + modules/m2sci/macros/sci_files/sci_docopt.bin | Bin 0 -> 1680 bytes modules/m2sci/macros/sci_files/sci_docopt.sci | 18 + modules/m2sci/macros/sci_files/sci_dos.bin | Bin 0 -> 5104 bytes modules/m2sci/macros/sci_files/sci_dos.sci | 49 + modules/m2sci/macros/sci_files/sci_double.bin | Bin 0 -> 1892 bytes modules/m2sci/macros/sci_files/sci_double.sci | 25 + modules/m2sci/macros/sci_files/sci_drawnow.bin | Bin 0 -> 1420 bytes modules/m2sci/macros/sci_files/sci_drawnow.sci | 18 + modules/m2sci/macros/sci_files/sci_echo.bin | Bin 0 -> 3932 bytes modules/m2sci/macros/sci_files/sci_echo.sci | 43 + modules/m2sci/macros/sci_files/sci_eig.bin | Bin 0 -> 16084 bytes modules/m2sci/macros/sci_files/sci_eig.sci | 102 + modules/m2sci/macros/sci_files/sci_eomday.bin | Bin 0 -> 1144 bytes modules/m2sci/macros/sci_files/sci_eomday.sci | 19 + modules/m2sci/macros/sci_files/sci_erf.bin | Bin 0 -> 1704 bytes modules/m2sci/macros/sci_files/sci_erf.sci | 23 + modules/m2sci/macros/sci_files/sci_erfc.bin | Bin 0 -> 1708 bytes modules/m2sci/macros/sci_files/sci_erfc.sci | 23 + modules/m2sci/macros/sci_files/sci_erfcx.bin | Bin 0 -> 1712 bytes modules/m2sci/macros/sci_files/sci_erfcx.sci | 23 + modules/m2sci/macros/sci_files/sci_error.bin | Bin 0 -> 1132 bytes modules/m2sci/macros/sci_files/sci_error.sci | 23 + modules/m2sci/macros/sci_files/sci_etime.bin | Bin 0 -> 1128 bytes modules/m2sci/macros/sci_files/sci_etime.sci | 18 + modules/m2sci/macros/sci_files/sci_eval.bin | Bin 0 -> 3592 bytes modules/m2sci/macros/sci_files/sci_eval.sci | 41 + modules/m2sci/macros/sci_files/sci_exist.bin | Bin 0 -> 2188 bytes modules/m2sci/macros/sci_files/sci_exist.sci | 26 + modules/m2sci/macros/sci_files/sci_exit.bin | Bin 0 -> 660 bytes modules/m2sci/macros/sci_files/sci_exit.sci | 16 + modules/m2sci/macros/sci_files/sci_exp.bin | Bin 0 -> 1868 bytes modules/m2sci/macros/sci_files/sci_exp.sci | 25 + modules/m2sci/macros/sci_files/sci_expm.bin | Bin 0 -> 1876 bytes modules/m2sci/macros/sci_files/sci_expm.sci | 25 + modules/m2sci/macros/sci_files/sci_eye.bin | Bin 0 -> 22340 bytes modules/m2sci/macros/sci_files/sci_eye.sci | 176 + modules/m2sci/macros/sci_files/sci_factor.bin | Bin 0 -> 1084 bytes modules/m2sci/macros/sci_files/sci_factor.sci | 18 + modules/m2sci/macros/sci_files/sci_factorial.bin | Bin 0 -> 1464 bytes modules/m2sci/macros/sci_files/sci_factorial.sci | 21 + modules/m2sci/macros/sci_files/sci_false.bin | Bin 0 -> 22428 bytes modules/m2sci/macros/sci_files/sci_false.sci | 176 + modules/m2sci/macros/sci_files/sci_fclose.bin | Bin 0 -> 1992 bytes modules/m2sci/macros/sci_files/sci_fclose.sci | 27 + modules/m2sci/macros/sci_files/sci_feof.bin | Bin 0 -> 1380 bytes modules/m2sci/macros/sci_files/sci_feof.sci | 23 + modules/m2sci/macros/sci_files/sci_ferror.bin | Bin 0 -> 3488 bytes modules/m2sci/macros/sci_files/sci_ferror.sci | 39 + modules/m2sci/macros/sci_files/sci_feval.bin | Bin 0 -> 5128 bytes modules/m2sci/macros/sci_files/sci_feval.sci | 51 + modules/m2sci/macros/sci_files/sci_fft.bin | Bin 0 -> 8244 bytes modules/m2sci/macros/sci_files/sci_fft.sci | 73 + modules/m2sci/macros/sci_files/sci_fft2.bin | Bin 0 -> 5664 bytes modules/m2sci/macros/sci_files/sci_fft2.sci | 54 + modules/m2sci/macros/sci_files/sci_fftshift.bin | Bin 0 -> 2968 bytes modules/m2sci/macros/sci_files/sci_fftshift.sci | 30 + modules/m2sci/macros/sci_files/sci_fgetl.bin | Bin 0 -> 5264 bytes modules/m2sci/macros/sci_files/sci_fgetl.sci | 45 + modules/m2sci/macros/sci_files/sci_fgets.bin | Bin 0 -> 7580 bytes modules/m2sci/macros/sci_files/sci_fgets.sci | 56 + modules/m2sci/macros/sci_files/sci_fileparts.bin | Bin 0 -> 3652 bytes modules/m2sci/macros/sci_files/sci_fileparts.sci | 34 + modules/m2sci/macros/sci_files/sci_filesep.bin | Bin 0 -> 1144 bytes modules/m2sci/macros/sci_files/sci_filesep.sci | 18 + modules/m2sci/macros/sci_files/sci_find.bin | Bin 0 -> 11748 bytes modules/m2sci/macros/sci_files/sci_find.sci | 84 + modules/m2sci/macros/sci_files/sci_findstr.bin | Bin 0 -> 1924 bytes modules/m2sci/macros/sci_files/sci_findstr.sci | 23 + modules/m2sci/macros/sci_files/sci_fix.bin | Bin 0 -> 2228 bytes modules/m2sci/macros/sci_files/sci_fix.sci | 27 + modules/m2sci/macros/sci_files/sci_fliplr.bin | Bin 0 -> 4172 bytes modules/m2sci/macros/sci_files/sci_fliplr.sci | 41 + modules/m2sci/macros/sci_files/sci_flipud.bin | Bin 0 -> 3204 bytes modules/m2sci/macros/sci_files/sci_flipud.sci | 34 + modules/m2sci/macros/sci_files/sci_floor.bin | Bin 0 -> 2236 bytes modules/m2sci/macros/sci_files/sci_floor.sci | 27 + modules/m2sci/macros/sci_files/sci_fopen.bin | Bin 0 -> 6468 bytes modules/m2sci/macros/sci_files/sci_fopen.sci | 61 + modules/m2sci/macros/sci_files/sci_format.bin | Bin 0 -> 5284 bytes modules/m2sci/macros/sci_files/sci_format.sci | 78 + modules/m2sci/macros/sci_files/sci_fprintf.bin | Bin 0 -> 1884 bytes modules/m2sci/macros/sci_files/sci_fprintf.sci | 23 + modules/m2sci/macros/sci_files/sci_fread.bin | Bin 0 -> 3516 bytes modules/m2sci/macros/sci_files/sci_fread.sci | 36 + modules/m2sci/macros/sci_files/sci_frewind.bin | Bin 0 -> 1040 bytes modules/m2sci/macros/sci_files/sci_frewind.sci | 19 + modules/m2sci/macros/sci_files/sci_fscanf.bin | Bin 0 -> 3028 bytes modules/m2sci/macros/sci_files/sci_fscanf.sci | 32 + modules/m2sci/macros/sci_files/sci_fseek.bin | Bin 0 -> 5276 bytes modules/m2sci/macros/sci_files/sci_fseek.sci | 55 + modules/m2sci/macros/sci_files/sci_ftell.bin | Bin 0 -> 1248 bytes modules/m2sci/macros/sci_files/sci_ftell.sci | 21 + modules/m2sci/macros/sci_files/sci_full.bin | Bin 0 -> 4424 bytes modules/m2sci/macros/sci_files/sci_full.sci | 40 + modules/m2sci/macros/sci_files/sci_fullfile.bin | Bin 0 -> 1176 bytes modules/m2sci/macros/sci_files/sci_fullfile.sci | 19 + modules/m2sci/macros/sci_files/sci_fwrite.bin | Bin 0 -> 2376 bytes modules/m2sci/macros/sci_files/sci_fwrite.sci | 27 + modules/m2sci/macros/sci_files/sci_gamma.bin | Bin 0 -> 1712 bytes modules/m2sci/macros/sci_files/sci_gamma.sci | 23 + modules/m2sci/macros/sci_files/sci_gammaln.bin | Bin 0 -> 1720 bytes modules/m2sci/macros/sci_files/sci_gammaln.sci | 23 + modules/m2sci/macros/sci_files/sci_getenv.bin | Bin 0 -> 1164 bytes modules/m2sci/macros/sci_files/sci_getenv.sci | 18 + modules/m2sci/macros/sci_files/sci_global.bin | Bin 0 -> 3180 bytes modules/m2sci/macros/sci_files/sci_global.sci | 36 + modules/m2sci/macros/sci_files/sci_graymon.bin | Bin 0 -> 3008 bytes modules/m2sci/macros/sci_files/sci_graymon.sci | 29 + modules/m2sci/macros/sci_files/sci_grid.bin | Bin 0 -> 6764 bytes modules/m2sci/macros/sci_files/sci_grid.sci | 58 + modules/m2sci/macros/sci_files/sci_hankel.bin | Bin 0 -> 13212 bytes modules/m2sci/macros/sci_files/sci_hankel.sci | 106 + modules/m2sci/macros/sci_files/sci_help.bin | Bin 0 -> 2612 bytes modules/m2sci/macros/sci_files/sci_help.sci | 36 + modules/m2sci/macros/sci_files/sci_helpbrowser.bin | Bin 0 -> 800 bytes modules/m2sci/macros/sci_files/sci_helpbrowser.sci | 18 + modules/m2sci/macros/sci_files/sci_helpdesk.bin | Bin 0 -> 788 bytes modules/m2sci/macros/sci_files/sci_helpdesk.sci | 18 + modules/m2sci/macros/sci_files/sci_helpwin.bin | Bin 0 -> 784 bytes modules/m2sci/macros/sci_files/sci_helpwin.sci | 18 + modules/m2sci/macros/sci_files/sci_hess.bin | Bin 0 -> 2812 bytes modules/m2sci/macros/sci_files/sci_hess.sci | 32 + modules/m2sci/macros/sci_files/sci_hold.bin | Bin 0 -> 3892 bytes modules/m2sci/macros/sci_files/sci_hold.sci | 40 + modules/m2sci/macros/sci_files/sci_home.bin | Bin 0 -> 772 bytes modules/m2sci/macros/sci_files/sci_home.sci | 18 + modules/m2sci/macros/sci_files/sci_horzcat.bin | Bin 0 -> 6284 bytes modules/m2sci/macros/sci_files/sci_horzcat.sci | 72 + modules/m2sci/macros/sci_files/sci_ifft.bin | Bin 0 -> 8308 bytes modules/m2sci/macros/sci_files/sci_ifft.sci | 77 + modules/m2sci/macros/sci_files/sci_imag.bin | Bin 0 -> 1708 bytes modules/m2sci/macros/sci_files/sci_imag.sci | 23 + modules/m2sci/macros/sci_files/sci_input.bin | Bin 0 -> 1932 bytes modules/m2sci/macros/sci_files/sci_input.sci | 25 + modules/m2sci/macros/sci_files/sci_int16.bin | Bin 0 -> 6168 bytes modules/m2sci/macros/sci_files/sci_int16.sci | 55 + modules/m2sci/macros/sci_files/sci_int32.bin | Bin 0 -> 6168 bytes modules/m2sci/macros/sci_files/sci_int32.sci | 55 + modules/m2sci/macros/sci_files/sci_int8.bin | Bin 0 -> 6128 bytes modules/m2sci/macros/sci_files/sci_int8.sci | 55 + modules/m2sci/macros/sci_files/sci_interp1.bin | Bin 0 -> 8944 bytes modules/m2sci/macros/sci_files/sci_interp1.sci | 67 + modules/m2sci/macros/sci_files/sci_inv.bin | Bin 0 -> 1868 bytes modules/m2sci/macros/sci_files/sci_inv.sci | 25 + modules/m2sci/macros/sci_files/sci_isa.bin | Bin 0 -> 11892 bytes modules/m2sci/macros/sci_files/sci_isa.sci | 75 + modules/m2sci/macros/sci_files/sci_iscell.bin | Bin 0 -> 1936 bytes modules/m2sci/macros/sci_files/sci_iscell.sci | 22 + modules/m2sci/macros/sci_files/sci_ischar.bin | Bin 0 -> 1924 bytes modules/m2sci/macros/sci_files/sci_ischar.sci | 22 + modules/m2sci/macros/sci_files/sci_isdir.bin | Bin 0 -> 1136 bytes modules/m2sci/macros/sci_files/sci_isdir.sci | 18 + modules/m2sci/macros/sci_files/sci_isempty.bin | Bin 0 -> 1144 bytes modules/m2sci/macros/sci_files/sci_isempty.sci | 18 + modules/m2sci/macros/sci_files/sci_isequal.bin | Bin 0 -> 1852 bytes modules/m2sci/macros/sci_files/sci_isequal.sci | 22 + modules/m2sci/macros/sci_files/sci_isfield.bin | Bin 0 -> 4704 bytes modules/m2sci/macros/sci_files/sci_isfield.sci | 37 + modules/m2sci/macros/sci_files/sci_isfinite.bin | Bin 0 -> 2516 bytes modules/m2sci/macros/sci_files/sci_isfinite.sci | 26 + modules/m2sci/macros/sci_files/sci_isglobal.bin | Bin 0 -> 1152 bytes modules/m2sci/macros/sci_files/sci_isglobal.sci | 19 + modules/m2sci/macros/sci_files/sci_ishandle.bin | Bin 0 -> 1936 bytes modules/m2sci/macros/sci_files/sci_ishandle.sci | 23 + modules/m2sci/macros/sci_files/sci_ishold.bin | Bin 0 -> 2088 bytes modules/m2sci/macros/sci_files/sci_ishold.sci | 23 + modules/m2sci/macros/sci_files/sci_isinf.bin | Bin 0 -> 1788 bytes modules/m2sci/macros/sci_files/sci_isinf.sci | 23 + modules/m2sci/macros/sci_files/sci_isinteger.bin | Bin 0 -> 1936 bytes modules/m2sci/macros/sci_files/sci_isinteger.sci | 22 + modules/m2sci/macros/sci_files/sci_isletter.bin | Bin 0 -> 1504 bytes modules/m2sci/macros/sci_files/sci_isletter.sci | 22 + modules/m2sci/macros/sci_files/sci_islogical.bin | Bin 0 -> 2572 bytes modules/m2sci/macros/sci_files/sci_islogical.sci | 24 + modules/m2sci/macros/sci_files/sci_isnan.bin | Bin 0 -> 1788 bytes modules/m2sci/macros/sci_files/sci_isnan.sci | 23 + modules/m2sci/macros/sci_files/sci_isnumeric.bin | Bin 0 -> 2932 bytes modules/m2sci/macros/sci_files/sci_isnumeric.sci | 26 + modules/m2sci/macros/sci_files/sci_ispc.bin | Bin 0 -> 1064 bytes modules/m2sci/macros/sci_files/sci_ispc.sci | 18 + modules/m2sci/macros/sci_files/sci_isreal.bin | Bin 0 -> 2044 bytes modules/m2sci/macros/sci_files/sci_isreal.sci | 26 + modules/m2sci/macros/sci_files/sci_isscalar.bin | Bin 0 -> 2080 bytes modules/m2sci/macros/sci_files/sci_isscalar.sci | 23 + modules/m2sci/macros/sci_files/sci_isspace.bin | Bin 0 -> 3892 bytes modules/m2sci/macros/sci_files/sci_isspace.sci | 34 + modules/m2sci/macros/sci_files/sci_issparse.bin | Bin 0 -> 2572 bytes modules/m2sci/macros/sci_files/sci_issparse.sci | 25 + modules/m2sci/macros/sci_files/sci_isstr.bin | Bin 0 -> 1920 bytes modules/m2sci/macros/sci_files/sci_isstr.sci | 22 + modules/m2sci/macros/sci_files/sci_isstruct.bin | Bin 0 -> 1944 bytes modules/m2sci/macros/sci_files/sci_isstruct.sci | 22 + modules/m2sci/macros/sci_files/sci_isunix.bin | Bin 0 -> 1748 bytes modules/m2sci/macros/sci_files/sci_isunix.sci | 21 + modules/m2sci/macros/sci_files/sci_isvector.bin | Bin 0 -> 3512 bytes modules/m2sci/macros/sci_files/sci_isvector.sci | 31 + modules/m2sci/macros/sci_files/sci_keyboard.bin | Bin 0 -> 792 bytes modules/m2sci/macros/sci_files/sci_keyboard.sci | 18 + modules/m2sci/macros/sci_files/sci_kron.bin | Bin 0 -> 3392 bytes modules/m2sci/macros/sci_files/sci_kron.sci | 33 + modules/m2sci/macros/sci_files/sci_legendre.bin | Bin 0 -> 3720 bytes modules/m2sci/macros/sci_files/sci_legendre.sci | 43 + modules/m2sci/macros/sci_files/sci_length.bin | Bin 0 -> 3060 bytes modules/m2sci/macros/sci_files/sci_length.sci | 32 + modules/m2sci/macros/sci_files/sci_linspace.bin | Bin 0 -> 7116 bytes modules/m2sci/macros/sci_files/sci_linspace.sci | 54 + modules/m2sci/macros/sci_files/sci_load.bin | Bin 0 -> 5860 bytes modules/m2sci/macros/sci_files/sci_load.sci | 46 + modules/m2sci/macros/sci_files/sci_log.bin | Bin 0 -> 1868 bytes modules/m2sci/macros/sci_files/sci_log.sci | 25 + modules/m2sci/macros/sci_files/sci_log10.bin | Bin 0 -> 1884 bytes modules/m2sci/macros/sci_files/sci_log10.sci | 25 + modules/m2sci/macros/sci_files/sci_log2.bin | Bin 0 -> 4132 bytes modules/m2sci/macros/sci_files/sci_log2.sci | 39 + modules/m2sci/macros/sci_files/sci_logical.bin | Bin 0 -> 5296 bytes modules/m2sci/macros/sci_files/sci_logical.sci | 47 + modules/m2sci/macros/sci_files/sci_logm.bin | Bin 0 -> 2284 bytes modules/m2sci/macros/sci_files/sci_logm.sci | 30 + modules/m2sci/macros/sci_files/sci_lookfor.bin | Bin 0 -> 1208 bytes modules/m2sci/macros/sci_files/sci_lookfor.sci | 21 + modules/m2sci/macros/sci_files/sci_lower.bin | Bin 0 -> 3524 bytes modules/m2sci/macros/sci_files/sci_lower.sci | 37 + modules/m2sci/macros/sci_files/sci_lu.bin | Bin 0 -> 6304 bytes modules/m2sci/macros/sci_files/sci_lu.sci | 50 + modules/m2sci/macros/sci_files/sci_makecell.bin | Bin 0 -> 8728 bytes modules/m2sci/macros/sci_files/sci_makecell.sci | 87 + modules/m2sci/macros/sci_files/sci_max.bin | Bin 0 -> 23264 bytes modules/m2sci/macros/sci_files/sci_max.sci | 169 + modules/m2sci/macros/sci_files/sci_mean.bin | Bin 0 -> 8376 bytes modules/m2sci/macros/sci_files/sci_mean.sci | 78 + modules/m2sci/macros/sci_files/sci_median.bin | Bin 0 -> 7612 bytes modules/m2sci/macros/sci_files/sci_median.sci | 73 + modules/m2sci/macros/sci_files/sci_meshgrid.bin | Bin 0 -> 9964 bytes modules/m2sci/macros/sci_files/sci_meshgrid.sci | 67 + modules/m2sci/macros/sci_files/sci_min.bin | Bin 0 -> 23264 bytes modules/m2sci/macros/sci_files/sci_min.sci | 169 + modules/m2sci/macros/sci_files/sci_mkdir.bin | Bin 0 -> 2324 bytes modules/m2sci/macros/sci_files/sci_mkdir.sci | 28 + modules/m2sci/macros/sci_files/sci_mod.bin | Bin 0 -> 3248 bytes modules/m2sci/macros/sci_files/sci_mod.sci | 34 + modules/m2sci/macros/sci_files/sci_more.bin | Bin 0 -> 2056 bytes modules/m2sci/macros/sci_files/sci_more.sci | 32 + modules/m2sci/macros/sci_files/sci_nargin.bin | Bin 0 -> 4856 bytes modules/m2sci/macros/sci_files/sci_nargin.sci | 36 + modules/m2sci/macros/sci_files/sci_nargout.bin | Bin 0 -> 4876 bytes modules/m2sci/macros/sci_files/sci_nargout.sci | 36 + modules/m2sci/macros/sci_files/sci_ndims.bin | Bin 0 -> 2588 bytes modules/m2sci/macros/sci_files/sci_ndims.sci | 28 + modules/m2sci/macros/sci_files/sci_norm.bin | Bin 0 -> 2484 bytes modules/m2sci/macros/sci_files/sci_norm.sci | 32 + modules/m2sci/macros/sci_files/sci_now.bin | Bin 0 -> 1360 bytes modules/m2sci/macros/sci_files/sci_now.sci | 21 + modules/m2sci/macros/sci_files/sci_num2str.bin | Bin 0 -> 2864 bytes modules/m2sci/macros/sci_files/sci_num2str.sci | 30 + modules/m2sci/macros/sci_files/sci_ones.bin | Bin 0 -> 22384 bytes modules/m2sci/macros/sci_files/sci_ones.sci | 176 + modules/m2sci/macros/sci_files/sci_orth.bin | Bin 0 -> 1428 bytes modules/m2sci/macros/sci_files/sci_orth.sci | 19 + modules/m2sci/macros/sci_files/sci_pause.bin | Bin 0 -> 2016 bytes modules/m2sci/macros/sci_files/sci_pause.sci | 28 + modules/m2sci/macros/sci_files/sci_perms.bin | Bin 0 -> 4828 bytes modules/m2sci/macros/sci_files/sci_perms.sci | 32 + modules/m2sci/macros/sci_files/sci_pie.bin | Bin 0 -> 2716 bytes modules/m2sci/macros/sci_files/sci_pie.sci | 24 + modules/m2sci/macros/sci_files/sci_plot.bin | Bin 0 -> 2972 bytes modules/m2sci/macros/sci_files/sci_plot.sci | 25 + modules/m2sci/macros/sci_files/sci_pow2.bin | Bin 0 -> 8548 bytes modules/m2sci/macros/sci_files/sci_pow2.sci | 63 + modules/m2sci/macros/sci_files/sci_primes.bin | Bin 0 -> 1084 bytes modules/m2sci/macros/sci_files/sci_primes.sci | 18 + modules/m2sci/macros/sci_files/sci_prod.bin | Bin 0 -> 9332 bytes modules/m2sci/macros/sci_files/sci_prod.sci | 82 + modules/m2sci/macros/sci_files/sci_qr.bin | Bin 0 -> 11524 bytes modules/m2sci/macros/sci_files/sci_qr.sci | 86 + modules/m2sci/macros/sci_files/sci_quit.bin | Bin 0 -> 668 bytes modules/m2sci/macros/sci_files/sci_quit.sci | 16 + modules/m2sci/macros/sci_files/sci_rand.bin | Bin 0 -> 22384 bytes modules/m2sci/macros/sci_files/sci_rand.sci | 176 + modules/m2sci/macros/sci_files/sci_randn.bin | Bin 0 -> 22416 bytes modules/m2sci/macros/sci_files/sci_randn.sci | 176 + modules/m2sci/macros/sci_files/sci_rcond.bin | Bin 0 -> 2156 bytes modules/m2sci/macros/sci_files/sci_rcond.sci | 28 + modules/m2sci/macros/sci_files/sci_real.bin | Bin 0 -> 1708 bytes modules/m2sci/macros/sci_files/sci_real.sci | 23 + modules/m2sci/macros/sci_files/sci_realmax.bin | Bin 0 -> 3152 bytes modules/m2sci/macros/sci_files/sci_realmax.sci | 36 + modules/m2sci/macros/sci_files/sci_realmin.bin | Bin 0 -> 3152 bytes modules/m2sci/macros/sci_files/sci_realmin.sci | 36 + modules/m2sci/macros/sci_files/sci_rem.bin | Bin 0 -> 4844 bytes modules/m2sci/macros/sci_files/sci_rem.sci | 45 + modules/m2sci/macros/sci_files/sci_repmat.bin | Bin 0 -> 16448 bytes modules/m2sci/macros/sci_files/sci_repmat.sci | 123 + modules/m2sci/macros/sci_files/sci_reshape.bin | Bin 0 -> 11812 bytes modules/m2sci/macros/sci_files/sci_reshape.sci | 84 + modules/m2sci/macros/sci_files/sci_return.bin | Bin 0 -> 668 bytes modules/m2sci/macros/sci_files/sci_return.sci | 16 + modules/m2sci/macros/sci_files/sci_round.bin | Bin 0 -> 2236 bytes modules/m2sci/macros/sci_files/sci_round.sci | 27 + modules/m2sci/macros/sci_files/sci_save.bin | Bin 0 -> 3140 bytes modules/m2sci/macros/sci_files/sci_save.sci | 32 + modules/m2sci/macros/sci_files/sci_schur.bin | Bin 0 -> 2256 bytes modules/m2sci/macros/sci_files/sci_schur.sci | 28 + modules/m2sci/macros/sci_files/sci_setstr.bin | Bin 0 -> 5208 bytes modules/m2sci/macros/sci_files/sci_setstr.sci | 43 + modules/m2sci/macros/sci_files/sci_sign.bin | Bin 0 -> 1876 bytes modules/m2sci/macros/sci_files/sci_sign.sci | 25 + modules/m2sci/macros/sci_files/sci_sin.bin | Bin 0 -> 1868 bytes modules/m2sci/macros/sci_files/sci_sin.sci | 25 + modules/m2sci/macros/sci_files/sci_sinh.bin | Bin 0 -> 1876 bytes modules/m2sci/macros/sci_files/sci_sinh.sci | 25 + modules/m2sci/macros/sci_files/sci_size.bin | Bin 0 -> 10116 bytes modules/m2sci/macros/sci_files/sci_size.sci | 73 + modules/m2sci/macros/sci_files/sci_sort.bin | Bin 0 -> 15636 bytes modules/m2sci/macros/sci_files/sci_sort.sci | 138 + modules/m2sci/macros/sci_files/sci_sortrows.bin | Bin 0 -> 5236 bytes modules/m2sci/macros/sci_files/sci_sortrows.sci | 35 + modules/m2sci/macros/sci_files/sci_sparse.bin | Bin 0 -> 19952 bytes modules/m2sci/macros/sci_files/sci_sparse.sci | 126 + modules/m2sci/macros/sci_files/sci_sqrt.bin | Bin 0 -> 1876 bytes modules/m2sci/macros/sci_files/sci_sqrt.sci | 25 + modules/m2sci/macros/sci_files/sci_str2num.bin | Bin 0 -> 1040 bytes modules/m2sci/macros/sci_files/sci_str2num.sci | 18 + modules/m2sci/macros/sci_files/sci_strcmp.bin | Bin 0 -> 3600 bytes modules/m2sci/macros/sci_files/sci_strcmp.sci | 31 + modules/m2sci/macros/sci_files/sci_strcmpi.bin | Bin 0 -> 4208 bytes modules/m2sci/macros/sci_files/sci_strcmpi.sci | 33 + modules/m2sci/macros/sci_files/sci_strfind.bin | Bin 0 -> 2640 bytes modules/m2sci/macros/sci_files/sci_strfind.sci | 28 + modules/m2sci/macros/sci_files/sci_strrep.bin | Bin 0 -> 2820 bytes modules/m2sci/macros/sci_files/sci_strrep.sci | 28 + modules/m2sci/macros/sci_files/sci_struct.bin | Bin 0 -> 11264 bytes modules/m2sci/macros/sci_files/sci_struct.sci | 81 + modules/m2sci/macros/sci_files/sci_subplot.bin | Bin 0 -> 656 bytes modules/m2sci/macros/sci_files/sci_subplot.sci | 15 + modules/m2sci/macros/sci_files/sci_sum.bin | Bin 0 -> 9284 bytes modules/m2sci/macros/sci_files/sci_sum.sci | 82 + modules/m2sci/macros/sci_files/sci_surf.bin | Bin 0 -> 2720 bytes modules/m2sci/macros/sci_files/sci_surf.sci | 24 + modules/m2sci/macros/sci_files/sci_svd.bin | Bin 0 -> 3500 bytes modules/m2sci/macros/sci_files/sci_svd.sci | 39 + modules/m2sci/macros/sci_files/sci_tan.bin | Bin 0 -> 1868 bytes modules/m2sci/macros/sci_files/sci_tan.sci | 25 + modules/m2sci/macros/sci_files/sci_tanh.bin | Bin 0 -> 1876 bytes modules/m2sci/macros/sci_files/sci_tanh.sci | 25 + modules/m2sci/macros/sci_files/sci_tic.bin | Bin 0 -> 656 bytes modules/m2sci/macros/sci_files/sci_tic.sci | 16 + modules/m2sci/macros/sci_files/sci_title.bin | Bin 0 -> 3212 bytes modules/m2sci/macros/sci_files/sci_title.sci | 25 + modules/m2sci/macros/sci_files/sci_toc.bin | Bin 0 -> 1120 bytes modules/m2sci/macros/sci_files/sci_toc.sci | 18 + modules/m2sci/macros/sci_files/sci_toeplitz.bin | Bin 0 -> 4264 bytes modules/m2sci/macros/sci_files/sci_toeplitz.sci | 40 + modules/m2sci/macros/sci_files/sci_tril.bin | Bin 0 -> 4328 bytes modules/m2sci/macros/sci_files/sci_tril.sci | 46 + modules/m2sci/macros/sci_files/sci_triu.bin | Bin 0 -> 4328 bytes modules/m2sci/macros/sci_files/sci_triu.sci | 46 + modules/m2sci/macros/sci_files/sci_true.bin | Bin 0 -> 22384 bytes modules/m2sci/macros/sci_files/sci_true.sci | 176 + modules/m2sci/macros/sci_files/sci_type.bin | Bin 0 -> 1368 bytes modules/m2sci/macros/sci_files/sci_type.sci | 20 + modules/m2sci/macros/sci_files/sci_uigetdir.bin | Bin 0 -> 1296 bytes modules/m2sci/macros/sci_files/sci_uigetdir.sci | 21 + modules/m2sci/macros/sci_files/sci_uint16.bin | Bin 0 -> 6208 bytes modules/m2sci/macros/sci_files/sci_uint16.sci | 55 + modules/m2sci/macros/sci_files/sci_uint32.bin | Bin 0 -> 6208 bytes modules/m2sci/macros/sci_files/sci_uint32.sci | 55 + modules/m2sci/macros/sci_files/sci_uint8.bin | Bin 0 -> 6168 bytes modules/m2sci/macros/sci_files/sci_uint8.sci | 55 + modules/m2sci/macros/sci_files/sci_unix.bin | Bin 0 -> 5108 bytes modules/m2sci/macros/sci_files/sci_unix.sci | 49 + modules/m2sci/macros/sci_files/sci_upper.bin | Bin 0 -> 3524 bytes modules/m2sci/macros/sci_files/sci_upper.sci | 37 + modules/m2sci/macros/sci_files/sci_vertcat.bin | Bin 0 -> 5700 bytes modules/m2sci/macros/sci_files/sci_vertcat.sci | 64 + .../macros/sci_files/sci_waitforbuttonpress.bin | Bin 0 -> 2960 bytes .../macros/sci_files/sci_waitforbuttonpress.sci | 31 + modules/m2sci/macros/sci_files/sci_warning.bin | Bin 0 -> 5376 bytes modules/m2sci/macros/sci_files/sci_warning.sci | 47 + modules/m2sci/macros/sci_files/sci_who.bin | Bin 0 -> 2560 bytes modules/m2sci/macros/sci_files/sci_who.sci | 37 + modules/m2sci/macros/sci_files/sci_whos.bin | Bin 0 -> 2564 bytes modules/m2sci/macros/sci_files/sci_whos.sci | 37 + modules/m2sci/macros/sci_files/sci_winqueryreg.bin | Bin 0 -> 1564 bytes modules/m2sci/macros/sci_files/sci_winqueryreg.sci | 21 + modules/m2sci/macros/sci_files/sci_xlabel.bin | Bin 0 -> 3224 bytes modules/m2sci/macros/sci_files/sci_xlabel.sci | 25 + modules/m2sci/macros/sci_files/sci_ylabel.bin | Bin 0 -> 3224 bytes modules/m2sci/macros/sci_files/sci_ylabel.sci | 25 + modules/m2sci/macros/sci_files/sci_zeros.bin | Bin 0 -> 22428 bytes modules/m2sci/macros/sci_files/sci_zeros.sci | 176 + modules/m2sci/macros/sci_files/sci_zlabel.bin | Bin 0 -> 3224 bytes modules/m2sci/macros/sci_files/sci_zlabel.sci | 25 + modules/m2sci/macros/translatepaths.bin | Bin 0 -> 32336 bytes modules/m2sci/macros/translatepaths.sci | 218 ++ 822 files changed, 27250 insertions(+) create mode 100755 modules/m2sci/macros/buildmacros.bat create mode 100755 modules/m2sci/macros/buildmacros.sce create mode 100755 modules/m2sci/macros/cb_m2sci_gui.bin create mode 100755 modules/m2sci/macros/cb_m2sci_gui.sci create mode 100755 modules/m2sci/macros/cleanmacros.bat create mode 100755 modules/m2sci/macros/kernel/%contents_i_funcall.bin create mode 100755 modules/m2sci/macros/kernel/%contents_i_funcall.sci create mode 100755 modules/m2sci/macros/kernel/%contents_i_operatio.bin create mode 100755 modules/m2sci/macros/kernel/%contents_i_operatio.sci create mode 100755 modules/m2sci/macros/kernel/%contents_i_variable.bin create mode 100755 modules/m2sci/macros/kernel/%contents_i_variable.sci create mode 100755 modules/m2sci/macros/kernel/%cste_e.bin create mode 100755 modules/m2sci/macros/kernel/%cste_e.sci create mode 100755 modules/m2sci/macros/kernel/%funcall_6.bin create mode 100755 modules/m2sci/macros/kernel/%funcall_6.sci create mode 100755 modules/m2sci/macros/kernel/%funcall_e.bin create mode 100755 modules/m2sci/macros/kernel/%funcall_e.sci create mode 100755 modules/m2sci/macros/kernel/%infer_i_s.bin create mode 100755 modules/m2sci/macros/kernel/%infer_i_s.sci create mode 100755 modules/m2sci/macros/kernel/%infer_i_st.bin create mode 100755 modules/m2sci/macros/kernel/%infer_i_st.sci create mode 100755 modules/m2sci/macros/kernel/%l_i_cste.bin create mode 100755 modules/m2sci/macros/kernel/%l_i_cste.sci create mode 100755 modules/m2sci/macros/kernel/%l_i_funcall.bin create mode 100755 modules/m2sci/macros/kernel/%l_i_funcall.sci create mode 100755 modules/m2sci/macros/kernel/%l_i_operatio.bin create mode 100755 modules/m2sci/macros/kernel/%l_i_operatio.sci create mode 100755 modules/m2sci/macros/kernel/%l_i_variable.bin create mode 100755 modules/m2sci/macros/kernel/%l_i_variable.sci create mode 100755 modules/m2sci/macros/kernel/%m2scivar_e.bin create mode 100755 modules/m2sci/macros/kernel/%m2scivar_e.sci create mode 100755 modules/m2sci/macros/kernel/%operatio_6.bin create mode 100755 modules/m2sci/macros/kernel/%operatio_6.sci create mode 100755 modules/m2sci/macros/kernel/%operatio_e.bin create mode 100755 modules/m2sci/macros/kernel/%operatio_e.sci create mode 100755 modules/m2sci/macros/kernel/%s_i_operatio.bin create mode 100755 modules/m2sci/macros/kernel/%s_i_operatio.sci create mode 100755 modules/m2sci/macros/kernel/%s_i_variable.bin create mode 100755 modules/m2sci/macros/kernel/%s_i_variable.sci create mode 100755 modules/m2sci/macros/kernel/%type_i_cste.bin create mode 100755 modules/m2sci/macros/kernel/%type_i_cste.sci create mode 100755 modules/m2sci/macros/kernel/%type_i_funcall.bin create mode 100755 modules/m2sci/macros/kernel/%type_i_funcall.sci create mode 100755 modules/m2sci/macros/kernel/%type_i_operatio.bin create mode 100755 modules/m2sci/macros/kernel/%type_i_operatio.sci create mode 100755 modules/m2sci/macros/kernel/%type_i_variable.bin create mode 100755 modules/m2sci/macros/kernel/%type_i_variable.sci create mode 100755 modules/m2sci/macros/kernel/%variable_6.bin create mode 100755 modules/m2sci/macros/kernel/%variable_6.sci create mode 100755 modules/m2sci/macros/kernel/%variable_e.bin create mode 100755 modules/m2sci/macros/kernel/%variable_e.sci create mode 100755 modules/m2sci/macros/kernel/Contents.bin create mode 100755 modules/m2sci/macros/kernel/Contents.sci create mode 100755 modules/m2sci/macros/kernel/Cste.bin create mode 100755 modules/m2sci/macros/kernel/Cste.sci create mode 100755 modules/m2sci/macros/kernel/Equal.bin create mode 100755 modules/m2sci/macros/kernel/Equal.sci create mode 100755 modules/m2sci/macros/kernel/Funcall.bin create mode 100755 modules/m2sci/macros/kernel/Funcall.sci create mode 100755 modules/m2sci/macros/kernel/Infer.bin create mode 100755 modules/m2sci/macros/kernel/Infer.sci create mode 100755 modules/m2sci/macros/kernel/M2scivar.bin create mode 100755 modules/m2sci/macros/kernel/M2scivar.sci create mode 100755 modules/m2sci/macros/kernel/Operation.bin create mode 100755 modules/m2sci/macros/kernel/Operation.sci create mode 100755 modules/m2sci/macros/kernel/Rhs_tlist.bin create mode 100755 modules/m2sci/macros/kernel/Rhs_tlist.sci create mode 100755 modules/m2sci/macros/kernel/Type.bin create mode 100755 modules/m2sci/macros/kernel/Type.sci create mode 100755 modules/m2sci/macros/kernel/Variable.bin create mode 100755 modules/m2sci/macros/kernel/Variable.sci create mode 100755 modules/m2sci/macros/kernel/allunknown.bin create mode 100755 modules/m2sci/macros/kernel/allunknown.sci create mode 100755 modules/m2sci/macros/kernel/buildmacros.sce create mode 100755 modules/m2sci/macros/kernel/changevarname.bin create mode 100755 modules/m2sci/macros/kernel/changevarname.sci create mode 100755 modules/m2sci/macros/kernel/clause2sci.bin create mode 100755 modules/m2sci/macros/kernel/clause2sci.sci create mode 100755 modules/m2sci/macros/kernel/convert2double.bin create mode 100755 modules/m2sci/macros/kernel/convert2double.sci create mode 100755 modules/m2sci/macros/kernel/default_trad.bin create mode 100755 modules/m2sci/macros/kernel/default_trad.sci create mode 100755 modules/m2sci/macros/kernel/equal2sci.bin create mode 100755 modules/m2sci/macros/kernel/equal2sci.sci create mode 100755 modules/m2sci/macros/kernel/expression2sci.bin create mode 100755 modules/m2sci/macros/kernel/expression2sci.sci create mode 100755 modules/m2sci/macros/kernel/first_non_singleton.bin create mode 100755 modules/m2sci/macros/kernel/first_non_singleton.sci create mode 100755 modules/m2sci/macros/kernel/funcall2sci.bin create mode 100755 modules/m2sci/macros/kernel/funcall2sci.sci create mode 100755 modules/m2sci/macros/kernel/funcallsearch.bin create mode 100755 modules/m2sci/macros/kernel/funcallsearch.sci create mode 100755 modules/m2sci/macros/kernel/get_unknown.bin create mode 100755 modules/m2sci/macros/kernel/get_unknown.sci create mode 100755 modules/m2sci/macros/kernel/getoperands.bin create mode 100755 modules/m2sci/macros/kernel/getoperands.sci create mode 100755 modules/m2sci/macros/kernel/getrhs.bin create mode 100755 modules/m2sci/macros/kernel/getrhs.sci create mode 100755 modules/m2sci/macros/kernel/gettempvar.bin create mode 100755 modules/m2sci/macros/kernel/gettempvar.sci create mode 100755 modules/m2sci/macros/kernel/getvar2sci.bin create mode 100755 modules/m2sci/macros/kernel/getvar2sci.sci create mode 100755 modules/m2sci/macros/kernel/i_notation.bin create mode 100755 modules/m2sci/macros/kernel/i_notation.sci create mode 100755 modules/m2sci/macros/kernel/infer2txt.bin create mode 100755 modules/m2sci/macros/kernel/infer2txt.sci create mode 100755 modules/m2sci/macros/kernel/insert.bin create mode 100755 modules/m2sci/macros/kernel/insert.sci create mode 100755 modules/m2sci/macros/kernel/instruction2sci.bin create mode 100755 modules/m2sci/macros/kernel/instruction2sci.sci create mode 100755 modules/m2sci/macros/kernel/is_a_scalar.bin create mode 100755 modules/m2sci/macros/kernel/is_a_scalar.sci create mode 100755 modules/m2sci/macros/kernel/is_a_vector.bin create mode 100755 modules/m2sci/macros/kernel/is_a_vector.sci create mode 100755 modules/m2sci/macros/kernel/is_complex.bin create mode 100755 modules/m2sci/macros/kernel/is_complex.sci create mode 100755 modules/m2sci/macros/kernel/is_empty.bin create mode 100755 modules/m2sci/macros/kernel/is_empty.sci create mode 100755 modules/m2sci/macros/kernel/is_real.bin create mode 100755 modules/m2sci/macros/kernel/is_real.sci create mode 100755 modules/m2sci/macros/kernel/isacomment.bin create mode 100755 modules/m2sci/macros/kernel/isacomment.sci create mode 100755 modules/m2sci/macros/kernel/isanmfile.bin create mode 100755 modules/m2sci/macros/kernel/isanmfile.sci create mode 100755 modules/m2sci/macros/kernel/isdefinedvar.bin create mode 100755 modules/m2sci/macros/kernel/isdefinedvar.sci create mode 100755 modules/m2sci/macros/kernel/isinstring.bin create mode 100755 modules/m2sci/macros/kernel/isinstring.sci create mode 100755 modules/m2sci/macros/kernel/lib create mode 100755 modules/m2sci/macros/kernel/lst_funcall.bin create mode 100755 modules/m2sci/macros/kernel/lst_funcall.sci create mode 100755 modules/m2sci/macros/kernel/m2sci.bin create mode 100755 modules/m2sci/macros/kernel/m2sci.sci create mode 100755 modules/m2sci/macros/kernel/m2sci_info.bin create mode 100755 modules/m2sci/macros/kernel/m2sci_info.sci create mode 100755 modules/m2sci/macros/kernel/m2sci_syntax.bin create mode 100755 modules/m2sci/macros/kernel/m2sci_syntax.sci create mode 100755 modules/m2sci/macros/kernel/mfile_path.bin create mode 100755 modules/m2sci/macros/kernel/mfile_path.sci create mode 100755 modules/m2sci/macros/kernel/mtlbtoolfun.bin create mode 100755 modules/m2sci/macros/kernel/mtlbtoolfun.sci create mode 100755 modules/m2sci/macros/kernel/mtlbtree2sci.bin create mode 100755 modules/m2sci/macros/kernel/mtlbtree2sci.sci create mode 100755 modules/m2sci/macros/kernel/multi_fun_file.bin create mode 100755 modules/m2sci/macros/kernel/multi_fun_file.sci create mode 100755 modules/m2sci/macros/kernel/names create mode 100755 modules/m2sci/macros/kernel/no_equiv.bin create mode 100755 modules/m2sci/macros/kernel/no_equiv.sci create mode 100755 modules/m2sci/macros/kernel/not_a_scalar.bin create mode 100755 modules/m2sci/macros/kernel/not_a_scalar.sci create mode 100755 modules/m2sci/macros/kernel/not_a_vector.bin create mode 100755 modules/m2sci/macros/kernel/not_a_vector.sci create mode 100755 modules/m2sci/macros/kernel/not_empty.bin create mode 100755 modules/m2sci/macros/kernel/not_empty.sci create mode 100755 modules/m2sci/macros/kernel/not_yet_converted.bin create mode 100755 modules/m2sci/macros/kernel/not_yet_converted.sci create mode 100755 modules/m2sci/macros/kernel/old2newinstr.bin create mode 100755 modules/m2sci/macros/kernel/old2newinstr.sci create mode 100755 modules/m2sci/macros/kernel/operation2sci.bin create mode 100755 modules/m2sci/macros/kernel/operation2sci.sci create mode 100755 modules/m2sci/macros/kernel/repl_poss.bin create mode 100755 modules/m2sci/macros/kernel/repl_poss.sci create mode 100755 modules/m2sci/macros/kernel/replace_brackets.bin create mode 100755 modules/m2sci/macros/kernel/replace_brackets.sci create mode 100755 modules/m2sci/macros/kernel/sci_generic.bin create mode 100755 modules/m2sci/macros/kernel/sci_generic.sci create mode 100755 modules/m2sci/macros/kernel/sci_m2scideclare.bin create mode 100755 modules/m2sci/macros/kernel/sci_m2scideclare.sci create mode 100755 modules/m2sci/macros/kernel/sciparam.bin create mode 100755 modules/m2sci/macros/kernel/sciparam.sci create mode 100755 modules/m2sci/macros/kernel/set_infos.bin create mode 100755 modules/m2sci/macros/kernel/set_infos.sci create mode 100755 modules/m2sci/macros/kernel/transformtree.bin create mode 100755 modules/m2sci/macros/kernel/transformtree.sci create mode 100755 modules/m2sci/macros/kernel/translateorder.bin create mode 100755 modules/m2sci/macros/kernel/translateorder.sci create mode 100755 modules/m2sci/macros/kernel/update_instr_list.bin create mode 100755 modules/m2sci/macros/kernel/update_instr_list.sci create mode 100755 modules/m2sci/macros/kernel/updatevarslist.bin create mode 100755 modules/m2sci/macros/kernel/updatevarslist.sci create mode 100755 modules/m2sci/macros/kernel/variablesearch.bin create mode 100755 modules/m2sci/macros/kernel/variablesearch.sci create mode 100755 modules/m2sci/macros/lib create mode 100755 modules/m2sci/macros/m2sci_gui.bin create mode 100755 modules/m2sci/macros/m2sci_gui.sci create mode 100755 modules/m2sci/macros/matfile2sci.bin create mode 100755 modules/m2sci/macros/matfile2sci.sci create mode 100755 modules/m2sci/macros/mfile2sci.bin create mode 100755 modules/m2sci/macros/mfile2sci.sci create mode 100755 modules/m2sci/macros/names create mode 100755 modules/m2sci/macros/percent/%02sci.bin create mode 100755 modules/m2sci/macros/percent/%02sci.sci create mode 100755 modules/m2sci/macros/percent/%52sci.bin create mode 100755 modules/m2sci/macros/percent/%52sci.sci create mode 100755 modules/m2sci/macros/percent/%a2sci.bin create mode 100755 modules/m2sci/macros/percent/%a2sci.sci create mode 100755 modules/m2sci/macros/percent/%cc2sci.bin create mode 100755 modules/m2sci/macros/percent/%cc2sci.sci create mode 100755 modules/m2sci/macros/percent/%cc_cell2sci.bin create mode 100755 modules/m2sci/macros/percent/%cc_cell2sci.sci create mode 100755 modules/m2sci/macros/percent/%d2sci.bin create mode 100755 modules/m2sci/macros/percent/%d2sci.sci create mode 100755 modules/m2sci/macros/percent/%e2sci.bin create mode 100755 modules/m2sci/macros/percent/%e2sci.sci create mode 100755 modules/m2sci/macros/percent/%e_ce2sci.bin create mode 100755 modules/m2sci/macros/percent/%e_ce2sci.sci create mode 100755 modules/m2sci/macros/percent/%e_st2sci.bin create mode 100755 modules/m2sci/macros/percent/%e_st2sci.sci create mode 100755 modules/m2sci/macros/percent/%g2sci.bin create mode 100755 modules/m2sci/macros/percent/%g2sci.sci create mode 100755 modules/m2sci/macros/percent/%h2sci.bin create mode 100755 modules/m2sci/macros/percent/%h2sci.sci create mode 100755 modules/m2sci/macros/percent/%i2sci.bin create mode 100755 modules/m2sci/macros/percent/%i2sci.sci create mode 100755 modules/m2sci/macros/percent/%i2sci_c.bin create mode 100755 modules/m2sci/macros/percent/%i2sci_c.sci create mode 100755 modules/m2sci/macros/percent/%i2sci_g.bin create mode 100755 modules/m2sci/macros/percent/%i2sci_g.sci create mode 100755 modules/m2sci/macros/percent/%i2sci_r.bin create mode 100755 modules/m2sci/macros/percent/%i2sci_r.sci create mode 100755 modules/m2sci/macros/percent/%i2sci_s.bin create mode 100755 modules/m2sci/macros/percent/%i2sci_s.sci create mode 100755 modules/m2sci/macros/percent/%i_ce2sci.bin create mode 100755 modules/m2sci/macros/percent/%i_ce2sci.sci create mode 100755 modules/m2sci/macros/percent/%i_st2sci.bin create mode 100755 modules/m2sci/macros/percent/%i_st2sci.sci create mode 100755 modules/m2sci/macros/percent/%imp2sci.bin create mode 100755 modules/m2sci/macros/percent/%imp2sci.sci create mode 100755 modules/m2sci/macros/percent/%j2sci.bin create mode 100755 modules/m2sci/macros/percent/%j2sci.sci create mode 100755 modules/m2sci/macros/percent/%l2sci.bin create mode 100755 modules/m2sci/macros/percent/%l2sci.sci create mode 100755 modules/m2sci/macros/percent/%log2sci.bin create mode 100755 modules/m2sci/macros/percent/%log2sci.sci create mode 100755 modules/m2sci/macros/percent/%m2sci.bin create mode 100755 modules/m2sci/macros/percent/%m2sci.sci create mode 100755 modules/m2sci/macros/percent/%p2sci.bin create mode 100755 modules/m2sci/macros/percent/%p2sci.sci create mode 100755 modules/m2sci/macros/percent/%q2sci.bin create mode 100755 modules/m2sci/macros/percent/%q2sci.sci create mode 100755 modules/m2sci/macros/percent/%r2sci.bin create mode 100755 modules/m2sci/macros/percent/%r2sci.sci create mode 100755 modules/m2sci/macros/percent/%rc2sci.bin create mode 100755 modules/m2sci/macros/percent/%rc2sci.sci create mode 100755 modules/m2sci/macros/percent/%rc_cell2sci.bin create mode 100755 modules/m2sci/macros/percent/%rc_cell2sci.sci create mode 100755 modules/m2sci/macros/percent/%s2sci.bin create mode 100755 modules/m2sci/macros/percent/%s2sci.sci create mode 100755 modules/m2sci/macros/percent/%t2sci.bin create mode 100755 modules/m2sci/macros/percent/%t2sci.sci create mode 100755 modules/m2sci/macros/percent/%x2sci.bin create mode 100755 modules/m2sci/macros/percent/%x2sci.sci create mode 100755 modules/m2sci/macros/percent/buildmacros.sce create mode 100755 modules/m2sci/macros/percent/get_contents_infer.bin create mode 100755 modules/m2sci/macros/percent/get_contents_infer.sci create mode 100755 modules/m2sci/macros/percent/lib create mode 100755 modules/m2sci/macros/percent/names create mode 100755 modules/m2sci/macros/sci_files/GEN create mode 100755 modules/m2sci/macros/sci_files/Makeproto create mode 100755 modules/m2sci/macros/sci_files/buildmacros.sce create mode 100755 modules/m2sci/macros/sci_files/lib create mode 100755 modules/m2sci/macros/sci_files/names create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO0.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO1.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO10.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO11.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO12.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO13.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO14.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO15.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO2.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO3.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO4.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO5.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO6.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO7.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO8.g create mode 100755 modules/m2sci/macros/sci_files/sci_PROTO9.g create mode 100755 modules/m2sci/macros/sci_files/sci_abs.bin create mode 100755 modules/m2sci/macros/sci_files/sci_abs.sci create mode 100755 modules/m2sci/macros/sci_files/sci_acos.bin create mode 100755 modules/m2sci/macros/sci_files/sci_acos.sci create mode 100755 modules/m2sci/macros/sci_files/sci_acosh.bin create mode 100755 modules/m2sci/macros/sci_files/sci_acosh.sci create mode 100755 modules/m2sci/macros/sci_files/sci_acot.bin create mode 100755 modules/m2sci/macros/sci_files/sci_acot.sci create mode 100755 modules/m2sci/macros/sci_files/sci_acoth.bin create mode 100755 modules/m2sci/macros/sci_files/sci_acoth.sci create mode 100755 modules/m2sci/macros/sci_files/sci_acsc.bin create mode 100755 modules/m2sci/macros/sci_files/sci_acsc.sci create mode 100755 modules/m2sci/macros/sci_files/sci_acsch.bin create mode 100755 modules/m2sci/macros/sci_files/sci_acsch.sci create mode 100755 modules/m2sci/macros/sci_files/sci_all.bin create mode 100755 modules/m2sci/macros/sci_files/sci_all.sci create mode 100755 modules/m2sci/macros/sci_files/sci_angle.bin create mode 100755 modules/m2sci/macros/sci_files/sci_angle.sci create mode 100755 modules/m2sci/macros/sci_files/sci_any.bin create mode 100755 modules/m2sci/macros/sci_files/sci_any.sci create mode 100755 modules/m2sci/macros/sci_files/sci_asec.bin create mode 100755 modules/m2sci/macros/sci_files/sci_asec.sci create mode 100755 modules/m2sci/macros/sci_files/sci_asech.bin create mode 100755 modules/m2sci/macros/sci_files/sci_asech.sci create mode 100755 modules/m2sci/macros/sci_files/sci_asin.bin create mode 100755 modules/m2sci/macros/sci_files/sci_asin.sci create mode 100755 modules/m2sci/macros/sci_files/sci_asinh.bin create mode 100755 modules/m2sci/macros/sci_files/sci_asinh.sci create mode 100755 modules/m2sci/macros/sci_files/sci_atan.bin create mode 100755 modules/m2sci/macros/sci_files/sci_atan.sci create mode 100755 modules/m2sci/macros/sci_files/sci_atan2.bin create mode 100755 modules/m2sci/macros/sci_files/sci_atan2.sci create mode 100755 modules/m2sci/macros/sci_files/sci_atanh.bin create mode 100755 modules/m2sci/macros/sci_files/sci_atanh.sci create mode 100755 modules/m2sci/macros/sci_files/sci_axis.bin create mode 100755 modules/m2sci/macros/sci_files/sci_axis.sci create mode 100755 modules/m2sci/macros/sci_files/sci_balance.bin create mode 100755 modules/m2sci/macros/sci_files/sci_balance.sci create mode 100755 modules/m2sci/macros/sci_files/sci_bar.bin create mode 100755 modules/m2sci/macros/sci_files/sci_bar.sci create mode 100755 modules/m2sci/macros/sci_files/sci_barh.bin create mode 100755 modules/m2sci/macros/sci_files/sci_barh.sci create mode 100755 modules/m2sci/macros/sci_files/sci_beep.bin create mode 100755 modules/m2sci/macros/sci_files/sci_beep.sci create mode 100755 modules/m2sci/macros/sci_files/sci_besseli.bin create mode 100755 modules/m2sci/macros/sci_files/sci_besseli.sci create mode 100755 modules/m2sci/macros/sci_files/sci_besselj.bin create mode 100755 modules/m2sci/macros/sci_files/sci_besselj.sci create mode 100755 modules/m2sci/macros/sci_files/sci_besselk.bin create mode 100755 modules/m2sci/macros/sci_files/sci_besselk.sci create mode 100755 modules/m2sci/macros/sci_files/sci_bessely.bin create mode 100755 modules/m2sci/macros/sci_files/sci_bessely.sci create mode 100755 modules/m2sci/macros/sci_files/sci_beta.bin create mode 100755 modules/m2sci/macros/sci_files/sci_beta.sci create mode 100755 modules/m2sci/macros/sci_files/sci_bin2dec.bin create mode 100755 modules/m2sci/macros/sci_files/sci_bin2dec.sci create mode 100755 modules/m2sci/macros/sci_files/sci_bitand.bin create mode 100755 modules/m2sci/macros/sci_files/sci_bitand.sci create mode 100755 modules/m2sci/macros/sci_files/sci_bitor.bin create mode 100755 modules/m2sci/macros/sci_files/sci_bitor.sci create mode 100755 modules/m2sci/macros/sci_files/sci_blanks.bin create mode 100755 modules/m2sci/macros/sci_files/sci_blanks.sci create mode 100755 modules/m2sci/macros/sci_files/sci_box.bin create mode 100755 modules/m2sci/macros/sci_files/sci_box.sci create mode 100755 modules/m2sci/macros/sci_files/sci_break.bin create mode 100755 modules/m2sci/macros/sci_files/sci_break.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cd.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cd.sci create mode 100755 modules/m2sci/macros/sci_files/sci_ceil.bin create mode 100755 modules/m2sci/macros/sci_files/sci_ceil.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cell.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cell.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cell2mat.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cell2mat.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cellstr.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cellstr.sci create mode 100755 modules/m2sci/macros/sci_files/sci_char.bin create mode 100755 modules/m2sci/macros/sci_files/sci_char.sci create mode 100755 modules/m2sci/macros/sci_files/sci_chol.bin create mode 100755 modules/m2sci/macros/sci_files/sci_chol.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cla.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cla.sci create mode 100755 modules/m2sci/macros/sci_files/sci_clc.bin create mode 100755 modules/m2sci/macros/sci_files/sci_clc.sci create mode 100755 modules/m2sci/macros/sci_files/sci_clear.bin create mode 100755 modules/m2sci/macros/sci_files/sci_clear.sci create mode 100755 modules/m2sci/macros/sci_files/sci_clf.bin create mode 100755 modules/m2sci/macros/sci_files/sci_clf.sci create mode 100755 modules/m2sci/macros/sci_files/sci_clock.bin create mode 100755 modules/m2sci/macros/sci_files/sci_clock.sci create mode 100755 modules/m2sci/macros/sci_files/sci_close.bin create mode 100755 modules/m2sci/macros/sci_files/sci_close.sci create mode 100755 modules/m2sci/macros/sci_files/sci_closereq.bin create mode 100755 modules/m2sci/macros/sci_files/sci_closereq.sci create mode 100755 modules/m2sci/macros/sci_files/sci_colordef.bin create mode 100755 modules/m2sci/macros/sci_files/sci_colordef.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cond.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cond.sci create mode 100755 modules/m2sci/macros/sci_files/sci_conj.bin create mode 100755 modules/m2sci/macros/sci_files/sci_conj.sci create mode 100755 modules/m2sci/macros/sci_files/sci_continue.bin create mode 100755 modules/m2sci/macros/sci_files/sci_continue.sci create mode 100755 modules/m2sci/macros/sci_files/sci_conv.bin create mode 100755 modules/m2sci/macros/sci_files/sci_conv.sci create mode 100755 modules/m2sci/macros/sci_files/sci_conv2.bin create mode 100755 modules/m2sci/macros/sci_files/sci_conv2.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cos.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cos.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cosh.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cosh.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cot.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cot.sci create mode 100755 modules/m2sci/macros/sci_files/sci_coth.bin create mode 100755 modules/m2sci/macros/sci_files/sci_coth.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cov.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cov.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cputime.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cputime.sci create mode 100755 modules/m2sci/macros/sci_files/sci_csc.bin create mode 100755 modules/m2sci/macros/sci_files/sci_csc.sci create mode 100755 modules/m2sci/macros/sci_files/sci_csch.bin create mode 100755 modules/m2sci/macros/sci_files/sci_csch.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cumprod.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cumprod.sci create mode 100755 modules/m2sci/macros/sci_files/sci_cumsum.bin create mode 100755 modules/m2sci/macros/sci_files/sci_cumsum.sci create mode 100755 modules/m2sci/macros/sci_files/sci_date.bin create mode 100755 modules/m2sci/macros/sci_files/sci_date.sci create mode 100755 modules/m2sci/macros/sci_files/sci_dec2bin.bin create mode 100755 modules/m2sci/macros/sci_files/sci_dec2bin.sci create mode 100755 modules/m2sci/macros/sci_files/sci_dec2hex.bin create mode 100755 modules/m2sci/macros/sci_files/sci_dec2hex.sci create mode 100755 modules/m2sci/macros/sci_files/sci_delete.bin create mode 100755 modules/m2sci/macros/sci_files/sci_delete.sci create mode 100755 modules/m2sci/macros/sci_files/sci_det.bin create mode 100755 modules/m2sci/macros/sci_files/sci_det.sci create mode 100755 modules/m2sci/macros/sci_files/sci_diag.bin create mode 100755 modules/m2sci/macros/sci_files/sci_diag.sci create mode 100755 modules/m2sci/macros/sci_files/sci_diary.bin create mode 100755 modules/m2sci/macros/sci_files/sci_diary.sci create mode 100755 modules/m2sci/macros/sci_files/sci_diff.bin create mode 100755 modules/m2sci/macros/sci_files/sci_diff.sci create mode 100755 modules/m2sci/macros/sci_files/sci_dir.bin create mode 100755 modules/m2sci/macros/sci_files/sci_dir.sci create mode 100755 modules/m2sci/macros/sci_files/sci_disp.bin create mode 100755 modules/m2sci/macros/sci_files/sci_disp.sci create mode 100755 modules/m2sci/macros/sci_files/sci_display.bin create mode 100755 modules/m2sci/macros/sci_files/sci_display.sci create mode 100755 modules/m2sci/macros/sci_files/sci_doc.bin create mode 100755 modules/m2sci/macros/sci_files/sci_doc.sci create mode 100755 modules/m2sci/macros/sci_files/sci_docopt.bin create mode 100755 modules/m2sci/macros/sci_files/sci_docopt.sci create mode 100755 modules/m2sci/macros/sci_files/sci_dos.bin create mode 100755 modules/m2sci/macros/sci_files/sci_dos.sci create mode 100755 modules/m2sci/macros/sci_files/sci_double.bin create mode 100755 modules/m2sci/macros/sci_files/sci_double.sci create mode 100755 modules/m2sci/macros/sci_files/sci_drawnow.bin create mode 100755 modules/m2sci/macros/sci_files/sci_drawnow.sci create mode 100755 modules/m2sci/macros/sci_files/sci_echo.bin create mode 100755 modules/m2sci/macros/sci_files/sci_echo.sci create mode 100755 modules/m2sci/macros/sci_files/sci_eig.bin create mode 100755 modules/m2sci/macros/sci_files/sci_eig.sci create mode 100755 modules/m2sci/macros/sci_files/sci_eomday.bin create mode 100755 modules/m2sci/macros/sci_files/sci_eomday.sci create mode 100755 modules/m2sci/macros/sci_files/sci_erf.bin create mode 100755 modules/m2sci/macros/sci_files/sci_erf.sci create mode 100755 modules/m2sci/macros/sci_files/sci_erfc.bin create mode 100755 modules/m2sci/macros/sci_files/sci_erfc.sci create mode 100755 modules/m2sci/macros/sci_files/sci_erfcx.bin create mode 100755 modules/m2sci/macros/sci_files/sci_erfcx.sci create mode 100755 modules/m2sci/macros/sci_files/sci_error.bin create mode 100755 modules/m2sci/macros/sci_files/sci_error.sci create mode 100755 modules/m2sci/macros/sci_files/sci_etime.bin create mode 100755 modules/m2sci/macros/sci_files/sci_etime.sci create mode 100755 modules/m2sci/macros/sci_files/sci_eval.bin create mode 100755 modules/m2sci/macros/sci_files/sci_eval.sci create mode 100755 modules/m2sci/macros/sci_files/sci_exist.bin create mode 100755 modules/m2sci/macros/sci_files/sci_exist.sci create mode 100755 modules/m2sci/macros/sci_files/sci_exit.bin create mode 100755 modules/m2sci/macros/sci_files/sci_exit.sci create mode 100755 modules/m2sci/macros/sci_files/sci_exp.bin create mode 100755 modules/m2sci/macros/sci_files/sci_exp.sci create mode 100755 modules/m2sci/macros/sci_files/sci_expm.bin create mode 100755 modules/m2sci/macros/sci_files/sci_expm.sci create mode 100755 modules/m2sci/macros/sci_files/sci_eye.bin create mode 100755 modules/m2sci/macros/sci_files/sci_eye.sci create mode 100755 modules/m2sci/macros/sci_files/sci_factor.bin create mode 100755 modules/m2sci/macros/sci_files/sci_factor.sci create mode 100755 modules/m2sci/macros/sci_files/sci_factorial.bin create mode 100755 modules/m2sci/macros/sci_files/sci_factorial.sci create mode 100755 modules/m2sci/macros/sci_files/sci_false.bin create mode 100755 modules/m2sci/macros/sci_files/sci_false.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fclose.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fclose.sci create mode 100755 modules/m2sci/macros/sci_files/sci_feof.bin create mode 100755 modules/m2sci/macros/sci_files/sci_feof.sci create mode 100755 modules/m2sci/macros/sci_files/sci_ferror.bin create mode 100755 modules/m2sci/macros/sci_files/sci_ferror.sci create mode 100755 modules/m2sci/macros/sci_files/sci_feval.bin create mode 100755 modules/m2sci/macros/sci_files/sci_feval.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fft.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fft.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fft2.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fft2.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fftshift.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fftshift.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fgetl.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fgetl.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fgets.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fgets.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fileparts.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fileparts.sci create mode 100755 modules/m2sci/macros/sci_files/sci_filesep.bin create mode 100755 modules/m2sci/macros/sci_files/sci_filesep.sci create mode 100755 modules/m2sci/macros/sci_files/sci_find.bin create mode 100755 modules/m2sci/macros/sci_files/sci_find.sci create mode 100755 modules/m2sci/macros/sci_files/sci_findstr.bin create mode 100755 modules/m2sci/macros/sci_files/sci_findstr.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fix.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fix.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fliplr.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fliplr.sci create mode 100755 modules/m2sci/macros/sci_files/sci_flipud.bin create mode 100755 modules/m2sci/macros/sci_files/sci_flipud.sci create mode 100755 modules/m2sci/macros/sci_files/sci_floor.bin create mode 100755 modules/m2sci/macros/sci_files/sci_floor.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fopen.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fopen.sci create mode 100755 modules/m2sci/macros/sci_files/sci_format.bin create mode 100755 modules/m2sci/macros/sci_files/sci_format.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fprintf.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fprintf.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fread.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fread.sci create mode 100755 modules/m2sci/macros/sci_files/sci_frewind.bin create mode 100755 modules/m2sci/macros/sci_files/sci_frewind.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fscanf.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fscanf.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fseek.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fseek.sci create mode 100755 modules/m2sci/macros/sci_files/sci_ftell.bin create mode 100755 modules/m2sci/macros/sci_files/sci_ftell.sci create mode 100755 modules/m2sci/macros/sci_files/sci_full.bin create mode 100755 modules/m2sci/macros/sci_files/sci_full.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fullfile.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fullfile.sci create mode 100755 modules/m2sci/macros/sci_files/sci_fwrite.bin create mode 100755 modules/m2sci/macros/sci_files/sci_fwrite.sci create mode 100755 modules/m2sci/macros/sci_files/sci_gamma.bin create mode 100755 modules/m2sci/macros/sci_files/sci_gamma.sci create mode 100755 modules/m2sci/macros/sci_files/sci_gammaln.bin create mode 100755 modules/m2sci/macros/sci_files/sci_gammaln.sci create mode 100755 modules/m2sci/macros/sci_files/sci_getenv.bin create mode 100755 modules/m2sci/macros/sci_files/sci_getenv.sci create mode 100755 modules/m2sci/macros/sci_files/sci_global.bin create mode 100755 modules/m2sci/macros/sci_files/sci_global.sci create mode 100755 modules/m2sci/macros/sci_files/sci_graymon.bin create mode 100755 modules/m2sci/macros/sci_files/sci_graymon.sci create mode 100755 modules/m2sci/macros/sci_files/sci_grid.bin create mode 100755 modules/m2sci/macros/sci_files/sci_grid.sci create mode 100755 modules/m2sci/macros/sci_files/sci_hankel.bin create mode 100755 modules/m2sci/macros/sci_files/sci_hankel.sci create mode 100755 modules/m2sci/macros/sci_files/sci_help.bin create mode 100755 modules/m2sci/macros/sci_files/sci_help.sci create mode 100755 modules/m2sci/macros/sci_files/sci_helpbrowser.bin create mode 100755 modules/m2sci/macros/sci_files/sci_helpbrowser.sci create mode 100755 modules/m2sci/macros/sci_files/sci_helpdesk.bin create mode 100755 modules/m2sci/macros/sci_files/sci_helpdesk.sci create mode 100755 modules/m2sci/macros/sci_files/sci_helpwin.bin create mode 100755 modules/m2sci/macros/sci_files/sci_helpwin.sci create mode 100755 modules/m2sci/macros/sci_files/sci_hess.bin create mode 100755 modules/m2sci/macros/sci_files/sci_hess.sci create mode 100755 modules/m2sci/macros/sci_files/sci_hold.bin create mode 100755 modules/m2sci/macros/sci_files/sci_hold.sci create mode 100755 modules/m2sci/macros/sci_files/sci_home.bin create mode 100755 modules/m2sci/macros/sci_files/sci_home.sci create mode 100755 modules/m2sci/macros/sci_files/sci_horzcat.bin create mode 100755 modules/m2sci/macros/sci_files/sci_horzcat.sci create mode 100755 modules/m2sci/macros/sci_files/sci_ifft.bin create mode 100755 modules/m2sci/macros/sci_files/sci_ifft.sci create mode 100755 modules/m2sci/macros/sci_files/sci_imag.bin create mode 100755 modules/m2sci/macros/sci_files/sci_imag.sci create mode 100755 modules/m2sci/macros/sci_files/sci_input.bin create mode 100755 modules/m2sci/macros/sci_files/sci_input.sci create mode 100755 modules/m2sci/macros/sci_files/sci_int16.bin create mode 100755 modules/m2sci/macros/sci_files/sci_int16.sci create mode 100755 modules/m2sci/macros/sci_files/sci_int32.bin create mode 100755 modules/m2sci/macros/sci_files/sci_int32.sci create mode 100755 modules/m2sci/macros/sci_files/sci_int8.bin create mode 100755 modules/m2sci/macros/sci_files/sci_int8.sci create mode 100755 modules/m2sci/macros/sci_files/sci_interp1.bin create mode 100755 modules/m2sci/macros/sci_files/sci_interp1.sci create mode 100755 modules/m2sci/macros/sci_files/sci_inv.bin create mode 100755 modules/m2sci/macros/sci_files/sci_inv.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isa.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isa.sci create mode 100755 modules/m2sci/macros/sci_files/sci_iscell.bin create mode 100755 modules/m2sci/macros/sci_files/sci_iscell.sci create mode 100755 modules/m2sci/macros/sci_files/sci_ischar.bin create mode 100755 modules/m2sci/macros/sci_files/sci_ischar.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isdir.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isdir.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isempty.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isempty.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isequal.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isequal.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isfield.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isfield.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isfinite.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isfinite.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isglobal.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isglobal.sci create mode 100755 modules/m2sci/macros/sci_files/sci_ishandle.bin create mode 100755 modules/m2sci/macros/sci_files/sci_ishandle.sci create mode 100755 modules/m2sci/macros/sci_files/sci_ishold.bin create mode 100755 modules/m2sci/macros/sci_files/sci_ishold.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isinf.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isinf.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isinteger.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isinteger.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isletter.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isletter.sci create mode 100755 modules/m2sci/macros/sci_files/sci_islogical.bin create mode 100755 modules/m2sci/macros/sci_files/sci_islogical.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isnan.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isnan.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isnumeric.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isnumeric.sci create mode 100755 modules/m2sci/macros/sci_files/sci_ispc.bin create mode 100755 modules/m2sci/macros/sci_files/sci_ispc.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isreal.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isreal.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isscalar.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isscalar.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isspace.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isspace.sci create mode 100755 modules/m2sci/macros/sci_files/sci_issparse.bin create mode 100755 modules/m2sci/macros/sci_files/sci_issparse.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isstr.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isstr.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isstruct.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isstruct.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isunix.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isunix.sci create mode 100755 modules/m2sci/macros/sci_files/sci_isvector.bin create mode 100755 modules/m2sci/macros/sci_files/sci_isvector.sci create mode 100755 modules/m2sci/macros/sci_files/sci_keyboard.bin create mode 100755 modules/m2sci/macros/sci_files/sci_keyboard.sci create mode 100755 modules/m2sci/macros/sci_files/sci_kron.bin create mode 100755 modules/m2sci/macros/sci_files/sci_kron.sci create mode 100755 modules/m2sci/macros/sci_files/sci_legendre.bin create mode 100755 modules/m2sci/macros/sci_files/sci_legendre.sci create mode 100755 modules/m2sci/macros/sci_files/sci_length.bin create mode 100755 modules/m2sci/macros/sci_files/sci_length.sci create mode 100755 modules/m2sci/macros/sci_files/sci_linspace.bin create mode 100755 modules/m2sci/macros/sci_files/sci_linspace.sci create mode 100755 modules/m2sci/macros/sci_files/sci_load.bin create mode 100755 modules/m2sci/macros/sci_files/sci_load.sci create mode 100755 modules/m2sci/macros/sci_files/sci_log.bin create mode 100755 modules/m2sci/macros/sci_files/sci_log.sci create mode 100755 modules/m2sci/macros/sci_files/sci_log10.bin create mode 100755 modules/m2sci/macros/sci_files/sci_log10.sci create mode 100755 modules/m2sci/macros/sci_files/sci_log2.bin create mode 100755 modules/m2sci/macros/sci_files/sci_log2.sci create mode 100755 modules/m2sci/macros/sci_files/sci_logical.bin create mode 100755 modules/m2sci/macros/sci_files/sci_logical.sci create mode 100755 modules/m2sci/macros/sci_files/sci_logm.bin create mode 100755 modules/m2sci/macros/sci_files/sci_logm.sci create mode 100755 modules/m2sci/macros/sci_files/sci_lookfor.bin create mode 100755 modules/m2sci/macros/sci_files/sci_lookfor.sci create mode 100755 modules/m2sci/macros/sci_files/sci_lower.bin create mode 100755 modules/m2sci/macros/sci_files/sci_lower.sci create mode 100755 modules/m2sci/macros/sci_files/sci_lu.bin create mode 100755 modules/m2sci/macros/sci_files/sci_lu.sci create mode 100755 modules/m2sci/macros/sci_files/sci_makecell.bin create mode 100755 modules/m2sci/macros/sci_files/sci_makecell.sci create mode 100755 modules/m2sci/macros/sci_files/sci_max.bin create mode 100755 modules/m2sci/macros/sci_files/sci_max.sci create mode 100755 modules/m2sci/macros/sci_files/sci_mean.bin create mode 100755 modules/m2sci/macros/sci_files/sci_mean.sci create mode 100755 modules/m2sci/macros/sci_files/sci_median.bin create mode 100755 modules/m2sci/macros/sci_files/sci_median.sci create mode 100755 modules/m2sci/macros/sci_files/sci_meshgrid.bin create mode 100755 modules/m2sci/macros/sci_files/sci_meshgrid.sci create mode 100755 modules/m2sci/macros/sci_files/sci_min.bin create mode 100755 modules/m2sci/macros/sci_files/sci_min.sci create mode 100755 modules/m2sci/macros/sci_files/sci_mkdir.bin create mode 100755 modules/m2sci/macros/sci_files/sci_mkdir.sci create mode 100755 modules/m2sci/macros/sci_files/sci_mod.bin create mode 100755 modules/m2sci/macros/sci_files/sci_mod.sci create mode 100755 modules/m2sci/macros/sci_files/sci_more.bin create mode 100755 modules/m2sci/macros/sci_files/sci_more.sci create mode 100755 modules/m2sci/macros/sci_files/sci_nargin.bin create mode 100755 modules/m2sci/macros/sci_files/sci_nargin.sci create mode 100755 modules/m2sci/macros/sci_files/sci_nargout.bin create mode 100755 modules/m2sci/macros/sci_files/sci_nargout.sci create mode 100755 modules/m2sci/macros/sci_files/sci_ndims.bin create mode 100755 modules/m2sci/macros/sci_files/sci_ndims.sci create mode 100755 modules/m2sci/macros/sci_files/sci_norm.bin create mode 100755 modules/m2sci/macros/sci_files/sci_norm.sci create mode 100755 modules/m2sci/macros/sci_files/sci_now.bin create mode 100755 modules/m2sci/macros/sci_files/sci_now.sci create mode 100755 modules/m2sci/macros/sci_files/sci_num2str.bin create mode 100755 modules/m2sci/macros/sci_files/sci_num2str.sci create mode 100755 modules/m2sci/macros/sci_files/sci_ones.bin create mode 100755 modules/m2sci/macros/sci_files/sci_ones.sci create mode 100755 modules/m2sci/macros/sci_files/sci_orth.bin create mode 100755 modules/m2sci/macros/sci_files/sci_orth.sci create mode 100755 modules/m2sci/macros/sci_files/sci_pause.bin create mode 100755 modules/m2sci/macros/sci_files/sci_pause.sci create mode 100755 modules/m2sci/macros/sci_files/sci_perms.bin create mode 100755 modules/m2sci/macros/sci_files/sci_perms.sci create mode 100755 modules/m2sci/macros/sci_files/sci_pie.bin create mode 100755 modules/m2sci/macros/sci_files/sci_pie.sci create mode 100755 modules/m2sci/macros/sci_files/sci_plot.bin create mode 100755 modules/m2sci/macros/sci_files/sci_plot.sci create mode 100755 modules/m2sci/macros/sci_files/sci_pow2.bin create mode 100755 modules/m2sci/macros/sci_files/sci_pow2.sci create mode 100755 modules/m2sci/macros/sci_files/sci_primes.bin create mode 100755 modules/m2sci/macros/sci_files/sci_primes.sci create mode 100755 modules/m2sci/macros/sci_files/sci_prod.bin create mode 100755 modules/m2sci/macros/sci_files/sci_prod.sci create mode 100755 modules/m2sci/macros/sci_files/sci_qr.bin create mode 100755 modules/m2sci/macros/sci_files/sci_qr.sci create mode 100755 modules/m2sci/macros/sci_files/sci_quit.bin create mode 100755 modules/m2sci/macros/sci_files/sci_quit.sci create mode 100755 modules/m2sci/macros/sci_files/sci_rand.bin create mode 100755 modules/m2sci/macros/sci_files/sci_rand.sci create mode 100755 modules/m2sci/macros/sci_files/sci_randn.bin create mode 100755 modules/m2sci/macros/sci_files/sci_randn.sci create mode 100755 modules/m2sci/macros/sci_files/sci_rcond.bin create mode 100755 modules/m2sci/macros/sci_files/sci_rcond.sci create mode 100755 modules/m2sci/macros/sci_files/sci_real.bin create mode 100755 modules/m2sci/macros/sci_files/sci_real.sci create mode 100755 modules/m2sci/macros/sci_files/sci_realmax.bin create mode 100755 modules/m2sci/macros/sci_files/sci_realmax.sci create mode 100755 modules/m2sci/macros/sci_files/sci_realmin.bin create mode 100755 modules/m2sci/macros/sci_files/sci_realmin.sci create mode 100755 modules/m2sci/macros/sci_files/sci_rem.bin create mode 100755 modules/m2sci/macros/sci_files/sci_rem.sci create mode 100755 modules/m2sci/macros/sci_files/sci_repmat.bin create mode 100755 modules/m2sci/macros/sci_files/sci_repmat.sci create mode 100755 modules/m2sci/macros/sci_files/sci_reshape.bin create mode 100755 modules/m2sci/macros/sci_files/sci_reshape.sci create mode 100755 modules/m2sci/macros/sci_files/sci_return.bin create mode 100755 modules/m2sci/macros/sci_files/sci_return.sci create mode 100755 modules/m2sci/macros/sci_files/sci_round.bin create mode 100755 modules/m2sci/macros/sci_files/sci_round.sci create mode 100755 modules/m2sci/macros/sci_files/sci_save.bin create mode 100755 modules/m2sci/macros/sci_files/sci_save.sci create mode 100755 modules/m2sci/macros/sci_files/sci_schur.bin create mode 100755 modules/m2sci/macros/sci_files/sci_schur.sci create mode 100755 modules/m2sci/macros/sci_files/sci_setstr.bin create mode 100755 modules/m2sci/macros/sci_files/sci_setstr.sci create mode 100755 modules/m2sci/macros/sci_files/sci_sign.bin create mode 100755 modules/m2sci/macros/sci_files/sci_sign.sci create mode 100755 modules/m2sci/macros/sci_files/sci_sin.bin create mode 100755 modules/m2sci/macros/sci_files/sci_sin.sci create mode 100755 modules/m2sci/macros/sci_files/sci_sinh.bin create mode 100755 modules/m2sci/macros/sci_files/sci_sinh.sci create mode 100755 modules/m2sci/macros/sci_files/sci_size.bin create mode 100755 modules/m2sci/macros/sci_files/sci_size.sci create mode 100755 modules/m2sci/macros/sci_files/sci_sort.bin create mode 100755 modules/m2sci/macros/sci_files/sci_sort.sci create mode 100755 modules/m2sci/macros/sci_files/sci_sortrows.bin create mode 100755 modules/m2sci/macros/sci_files/sci_sortrows.sci create mode 100755 modules/m2sci/macros/sci_files/sci_sparse.bin create mode 100755 modules/m2sci/macros/sci_files/sci_sparse.sci create mode 100755 modules/m2sci/macros/sci_files/sci_sqrt.bin create mode 100755 modules/m2sci/macros/sci_files/sci_sqrt.sci create mode 100755 modules/m2sci/macros/sci_files/sci_str2num.bin create mode 100755 modules/m2sci/macros/sci_files/sci_str2num.sci create mode 100755 modules/m2sci/macros/sci_files/sci_strcmp.bin create mode 100755 modules/m2sci/macros/sci_files/sci_strcmp.sci create mode 100755 modules/m2sci/macros/sci_files/sci_strcmpi.bin create mode 100755 modules/m2sci/macros/sci_files/sci_strcmpi.sci create mode 100755 modules/m2sci/macros/sci_files/sci_strfind.bin create mode 100755 modules/m2sci/macros/sci_files/sci_strfind.sci create mode 100755 modules/m2sci/macros/sci_files/sci_strrep.bin create mode 100755 modules/m2sci/macros/sci_files/sci_strrep.sci create mode 100755 modules/m2sci/macros/sci_files/sci_struct.bin create mode 100755 modules/m2sci/macros/sci_files/sci_struct.sci create mode 100755 modules/m2sci/macros/sci_files/sci_subplot.bin create mode 100755 modules/m2sci/macros/sci_files/sci_subplot.sci create mode 100755 modules/m2sci/macros/sci_files/sci_sum.bin create mode 100755 modules/m2sci/macros/sci_files/sci_sum.sci create mode 100755 modules/m2sci/macros/sci_files/sci_surf.bin create mode 100755 modules/m2sci/macros/sci_files/sci_surf.sci create mode 100755 modules/m2sci/macros/sci_files/sci_svd.bin create mode 100755 modules/m2sci/macros/sci_files/sci_svd.sci create mode 100755 modules/m2sci/macros/sci_files/sci_tan.bin create mode 100755 modules/m2sci/macros/sci_files/sci_tan.sci create mode 100755 modules/m2sci/macros/sci_files/sci_tanh.bin create mode 100755 modules/m2sci/macros/sci_files/sci_tanh.sci create mode 100755 modules/m2sci/macros/sci_files/sci_tic.bin create mode 100755 modules/m2sci/macros/sci_files/sci_tic.sci create mode 100755 modules/m2sci/macros/sci_files/sci_title.bin create mode 100755 modules/m2sci/macros/sci_files/sci_title.sci create mode 100755 modules/m2sci/macros/sci_files/sci_toc.bin create mode 100755 modules/m2sci/macros/sci_files/sci_toc.sci create mode 100755 modules/m2sci/macros/sci_files/sci_toeplitz.bin create mode 100755 modules/m2sci/macros/sci_files/sci_toeplitz.sci create mode 100755 modules/m2sci/macros/sci_files/sci_tril.bin create mode 100755 modules/m2sci/macros/sci_files/sci_tril.sci create mode 100755 modules/m2sci/macros/sci_files/sci_triu.bin create mode 100755 modules/m2sci/macros/sci_files/sci_triu.sci create mode 100755 modules/m2sci/macros/sci_files/sci_true.bin create mode 100755 modules/m2sci/macros/sci_files/sci_true.sci create mode 100755 modules/m2sci/macros/sci_files/sci_type.bin create mode 100755 modules/m2sci/macros/sci_files/sci_type.sci create mode 100755 modules/m2sci/macros/sci_files/sci_uigetdir.bin create mode 100755 modules/m2sci/macros/sci_files/sci_uigetdir.sci create mode 100755 modules/m2sci/macros/sci_files/sci_uint16.bin create mode 100755 modules/m2sci/macros/sci_files/sci_uint16.sci create mode 100755 modules/m2sci/macros/sci_files/sci_uint32.bin create mode 100755 modules/m2sci/macros/sci_files/sci_uint32.sci create mode 100755 modules/m2sci/macros/sci_files/sci_uint8.bin create mode 100755 modules/m2sci/macros/sci_files/sci_uint8.sci create mode 100755 modules/m2sci/macros/sci_files/sci_unix.bin create mode 100755 modules/m2sci/macros/sci_files/sci_unix.sci create mode 100755 modules/m2sci/macros/sci_files/sci_upper.bin create mode 100755 modules/m2sci/macros/sci_files/sci_upper.sci create mode 100755 modules/m2sci/macros/sci_files/sci_vertcat.bin create mode 100755 modules/m2sci/macros/sci_files/sci_vertcat.sci create mode 100755 modules/m2sci/macros/sci_files/sci_waitforbuttonpress.bin create mode 100755 modules/m2sci/macros/sci_files/sci_waitforbuttonpress.sci create mode 100755 modules/m2sci/macros/sci_files/sci_warning.bin create mode 100755 modules/m2sci/macros/sci_files/sci_warning.sci create mode 100755 modules/m2sci/macros/sci_files/sci_who.bin create mode 100755 modules/m2sci/macros/sci_files/sci_who.sci create mode 100755 modules/m2sci/macros/sci_files/sci_whos.bin create mode 100755 modules/m2sci/macros/sci_files/sci_whos.sci create mode 100755 modules/m2sci/macros/sci_files/sci_winqueryreg.bin create mode 100755 modules/m2sci/macros/sci_files/sci_winqueryreg.sci create mode 100755 modules/m2sci/macros/sci_files/sci_xlabel.bin create mode 100755 modules/m2sci/macros/sci_files/sci_xlabel.sci create mode 100755 modules/m2sci/macros/sci_files/sci_ylabel.bin create mode 100755 modules/m2sci/macros/sci_files/sci_ylabel.sci create mode 100755 modules/m2sci/macros/sci_files/sci_zeros.bin create mode 100755 modules/m2sci/macros/sci_files/sci_zeros.sci create mode 100755 modules/m2sci/macros/sci_files/sci_zlabel.bin create mode 100755 modules/m2sci/macros/sci_files/sci_zlabel.sci create mode 100755 modules/m2sci/macros/translatepaths.bin create mode 100755 modules/m2sci/macros/translatepaths.sci (limited to 'modules/m2sci/macros') diff --git a/modules/m2sci/macros/buildmacros.bat b/modules/m2sci/macros/buildmacros.bat new file mode 100755 index 000000000..f464ac666 --- /dev/null +++ b/modules/m2sci/macros/buildmacros.bat @@ -0,0 +1,6 @@ +rem Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +rem Copyright (C) 2007 - INRIA - Allan CORNET +rem +rem This file is distributed under the same license as the Scilab package. + +@..\..\..\bin\scilex -nwni -ns -e exec('buildmacros.sce');quit; \ No newline at end of file diff --git a/modules/m2sci/macros/buildmacros.sce b/modules/m2sci/macros/buildmacros.sce new file mode 100755 index 000000000..a20ca7fc2 --- /dev/null +++ b/modules/m2sci/macros/buildmacros.sce @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2005 - INRIA - Allan CORNET +// Copyright (C) 2008 - INRIA - Pierre MARECHAL +// +// 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.1-en.txt + +//------------------------------------ +if (isdef("genlib") == %f) then + exec(SCI+"/modules/functions/scripts/buildmacros/loadgenlib.sce"); +end +//------------------------------------ +genlib("m2scilib","SCI/modules/m2sci/macros"); +//------------------------------------ +mprintf(gettext("-- Creation of [%s] (Macros) --\n"),"m2sci"); +//------------------------------------ + +lines(0); +CurrentDirectorym2sci = get_absolute_file_path("buildmacros.sce"); +macrosdirs = ["kernel","percent","sci_files"]; + +for i=1:size(macrosdirs,"*") do + exec(CurrentDirectorym2sci+"/"+macrosdirs(i)+"/buildmacros.sce"); +end + +clear my_script_path CurrentDirectorym2sci macrosdirs diff --git a/modules/m2sci/macros/cb_m2sci_gui.bin b/modules/m2sci/macros/cb_m2sci_gui.bin new file mode 100755 index 000000000..66d9b3c30 Binary files /dev/null and b/modules/m2sci/macros/cb_m2sci_gui.bin differ diff --git a/modules/m2sci/macros/cb_m2sci_gui.sci b/modules/m2sci/macros/cb_m2sci_gui.sci new file mode 100755 index 000000000..d44d6d425 --- /dev/null +++ b/modules/m2sci/macros/cb_m2sci_gui.sci @@ -0,0 +1,182 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - 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.1-en.txt +// + +// Callback function for M2SCI GUI (See m2sci_gui.sci) + +function cb_m2sci_gui + + // + // --- Switch to file conversion mode --- + // + if get(gcbo,"tag")=="fileradio" then + + set(gcbo, "value", 1); + set("dirradio", "value", 0); + + // Make dir objects not-visible + set("dirlabel", "visible","off"); + set("diredit", "visible","off"); + set("dirbtn", "visible","off"); + + // Make file objects visible + set("filedirselect", "border",createBorder("titled", createBorder("line", "lightGray", 1),... + _("Input file"),"left","top",createBorderFont("", 11, "normal"), "black")); + set("filelabel", "visible","on"); + set("fileedit", "visible","on"); + set("filebtn", "visible","on"); + + // + // --- Switch to directory conversion mode --- + // + elseif get(gcbo,"tag")=="dirradio" then + + set(gcbo, "value", 1); + set("fileradio", "value", 0); + + // Make dir objects visible + set("filedirselect", "border",createBorder("titled", createBorder("line", "lightGray", 1),... + _("Input directory"),"left","top",createBorderFont("", 11, "normal"), "black")); + set("dirlabel", "visible", "on"); + set("diredit", "visible", "on"); + set("dirbtn", "visible", "on"); + + // Make file objects not-visible + set("filelabel", "visible", "off"); + set("fileedit", "visible", "off"); + set("filebtn", "visible", "off"); + + // + // --- Directory to convert --- + // + elseif get(gcbo,"tag")=="dirbtn" then + + directoryname = uigetdir(pwd(), gettext("Select the directory to convert")); + set("diredit", "string", directoryname); + + // + // --- File to convert --- + // + elseif get(gcbo,"tag")=="filebtn" then + + filename = uigetfile("*.m", pwd(), gettext("Select the file to convert")); + set("fileedit", "string", filename); + + // + // --- Output directory --- + // + elseif get(gcbo,"tag")=="outbtn" then + + directoryname = uigetdir(pwd(), gettext("Select the directory for generated files")); + set("outedit", "string", directoryname); + + // + // --- Recmode option --- + // + elseif or(get(gcbo, "tag")==["recradioyes","recradiono"]) then + + set("recradioyes", "value", 0); + set("recradiono", "value", 0); + + set(gcbo, "value", 1); + + // + // --- Double option --- + // + elseif or(get(gcbo, "tag")==["doubradioyes","doubradiono"]) then + + set("doubradioyes", "value", 0); + set("doubradiono", "value", 0); + + set(gcbo, "value", 1); + + // + // --- Verbose option --- + // + elseif or(get(gcbo, "tag")==["verbradio0","verbradio1","verbradio2","verbradio3"]) then + + set("verbradio0", "value", 0); + set("verbradio1", "value", 0); + set("verbradio2", "value", 0); + set("verbradio3", "value", 0); + + set(gcbo, "value", 1); + + // + // --- Pretty print option --- + // + elseif or(get(gcbo, "tag")==["ppradioyes","ppradiono"]) then + + set("ppradioyes", "value", 0); + set("ppradiono", "value", 0); + + set(gcbo, "value", 1); + + // + // --- Cancel conversion --- + // + elseif get(gcbo, "tag")=="cancelbtn" | get(gcbo, "tag")=="close_menu" then + //delete(findobj("tag", "m2scifig")); + delete(gcf()) + + // + // --- Launch conversion --- + // + elseif get(gcbo, "tag")=="convertbtn" then + outputdir = get("outedit", "string"); + + rec = get("recradioyes", "value") == 1; + + doub = get("doubradioyes", "value") == 1; + + if get("verbradio0", "value") == 1 then + verb = 0; + elseif get("verbradio1", "value") == 1 then + verb = 1; + elseif get("verbradio2", "value") == 1 then + verb = 2; + else + verb = 3; + end + + pp = get("ppradioyes", "value") == 1; + + if get("fileradio", "value") == 1 then // Single file conversion + inputfile = get("fileedit", "string"); + //delete(findobj("tag", "m2scifig")); + delete(gcf()); + mfile2sci(inputfile, outputdir, rec, doub, verb, pp); + else // Directory conversion + inputdir = get("diredit", "string"); + //delete(findobj("tag", "m2scifig")); + delete(gcf()); + translatepaths(inputdir, outputdir); + end + + // + // --- mfile2sci help --- + // + elseif get(gcbo, "tag")=="mfile2sci_help_menu" then + help mfile2sci + + // + // --- translatepaths help --- + // + elseif get(gcbo, "tag")=="translatepaths_help_menu" then + help translatepaths + + // + // --- About M2SCI --- + // + elseif get(gcbo, "tag")=="about_m2sci_menu" then + help(gettext("About_M2SCI_tools")) + end + +endfunction diff --git a/modules/m2sci/macros/cleanmacros.bat b/modules/m2sci/macros/cleanmacros.bat new file mode 100755 index 000000000..9356615c4 --- /dev/null +++ b/modules/m2sci/macros/cleanmacros.bat @@ -0,0 +1,8 @@ +rem Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +rem Copyright (C) 2007 - INRIA - Allan CORNET +rem +rem This file is distributed under the same license as the Scilab package. + +@del *.bin 2>NUL +@del lib 2>NUL +@del names 2>NUL \ No newline at end of file diff --git a/modules/m2sci/macros/kernel/%contents_i_funcall.bin b/modules/m2sci/macros/kernel/%contents_i_funcall.bin new file mode 100755 index 000000000..ea3f8cd8c Binary files /dev/null and b/modules/m2sci/macros/kernel/%contents_i_funcall.bin differ diff --git a/modules/m2sci/macros/kernel/%contents_i_funcall.sci b/modules/m2sci/macros/kernel/%contents_i_funcall.sci new file mode 100755 index 000000000..63f3c1ef4 --- /dev/null +++ b/modules/m2sci/macros/kernel/%contents_i_funcall.sci @@ -0,0 +1,17 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function funcall=%contents_i_funcall(field,contlist,funcall) + + if field=="contents" then + funcall.lhs(1).infer.contents=contlist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%contents_i_operatio.bin b/modules/m2sci/macros/kernel/%contents_i_operatio.bin new file mode 100755 index 000000000..6984de3c2 Binary files /dev/null and b/modules/m2sci/macros/kernel/%contents_i_operatio.bin differ diff --git a/modules/m2sci/macros/kernel/%contents_i_operatio.sci b/modules/m2sci/macros/kernel/%contents_i_operatio.sci new file mode 100755 index 000000000..d209095b1 --- /dev/null +++ b/modules/m2sci/macros/kernel/%contents_i_operatio.sci @@ -0,0 +1,17 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function operation=%contents_i_operatio(field,contlist,operation) + + if field=="contents" then + operation.out(1).infer.contents=contlist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%contents_i_variable.bin b/modules/m2sci/macros/kernel/%contents_i_variable.bin new file mode 100755 index 000000000..cdbcc3b38 Binary files /dev/null and b/modules/m2sci/macros/kernel/%contents_i_variable.bin differ diff --git a/modules/m2sci/macros/kernel/%contents_i_variable.sci b/modules/m2sci/macros/kernel/%contents_i_variable.sci new file mode 100755 index 000000000..e10362c97 --- /dev/null +++ b/modules/m2sci/macros/kernel/%contents_i_variable.sci @@ -0,0 +1,17 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function variable=%contents_i_variable(field,contlist,variable) + + if field=="contents" then + variable.infer.contents=contlist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%cste_e.bin b/modules/m2sci/macros/kernel/%cste_e.bin new file mode 100755 index 000000000..64ca00ff9 Binary files /dev/null and b/modules/m2sci/macros/kernel/%cste_e.bin differ diff --git a/modules/m2sci/macros/kernel/%cste_e.sci b/modules/m2sci/macros/kernel/%cste_e.sci new file mode 100755 index 000000000..3c4dd8182 --- /dev/null +++ b/modules/m2sci/macros/kernel/%cste_e.sci @@ -0,0 +1,27 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function val=%cste_e(field,m2scitlist) + // File generated from %PROTO_e.g: PLEASE DO NOT EDIT ! + + val=[] + if field=="infer" then + val=m2scitlist.infer + elseif field=="dims" then + val=m2scitlist.infer.dims + elseif field=="type" then + val=m2scitlist.infer.type + elseif field=="vtype" then + val=m2scitlist.infer.type.vtype + elseif field=="property" then + val=m2scitlist.infer.type.property + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%funcall_6.bin b/modules/m2sci/macros/kernel/%funcall_6.bin new file mode 100755 index 000000000..65db8eed5 Binary files /dev/null and b/modules/m2sci/macros/kernel/%funcall_6.bin differ diff --git a/modules/m2sci/macros/kernel/%funcall_6.sci b/modules/m2sci/macros/kernel/%funcall_6.sci new file mode 100755 index 000000000..274f88ec4 --- /dev/null +++ b/modules/m2sci/macros/kernel/%funcall_6.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function val=%funcall_6(field,m2scitlist) + // File generated from %PROTO_6.g: PLEASE DO NOT EDIT ! + + val=[] + if field=="infer" then + val=m2scitlist.lhs(1).infer + elseif field=="dims" then + val=m2scitlist.lhs(1).infer.dims + elseif field=="type" then + val=m2scitlist.lhs(1).infer.type + elseif field=="vtype" then + val=m2scitlist.lhs(1).infer.type.vtype + elseif field=="property" then + val=m2scitlist.lhs(1).infer.type.property + elseif field=="contents" then + val=m2scitlist.lhs(1).infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%funcall_e.bin b/modules/m2sci/macros/kernel/%funcall_e.bin new file mode 100755 index 000000000..56f98f63a Binary files /dev/null and b/modules/m2sci/macros/kernel/%funcall_e.bin differ diff --git a/modules/m2sci/macros/kernel/%funcall_e.sci b/modules/m2sci/macros/kernel/%funcall_e.sci new file mode 100755 index 000000000..aa227e52f --- /dev/null +++ b/modules/m2sci/macros/kernel/%funcall_e.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function val=%funcall_e(field,m2scitlist) + + val=[] + if field=="infer" then + val=m2scitlist.lhs(1).infer + elseif field=="dims" then + val=m2scitlist.lhs(1).infer.dims + elseif field=="type" then + val=m2scitlist.lhs(1).infer.type + elseif field=="vtype" then + val=m2scitlist.lhs(1).infer.type.vtype + elseif field=="property" then + val=m2scitlist.lhs(1).infer.type.property + elseif field=="contents" then + val=m2scitlist.lhs(1).infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%infer_i_s.bin b/modules/m2sci/macros/kernel/%infer_i_s.bin new file mode 100755 index 000000000..ac533086b Binary files /dev/null and b/modules/m2sci/macros/kernel/%infer_i_s.bin differ diff --git a/modules/m2sci/macros/kernel/%infer_i_s.sci b/modules/m2sci/macros/kernel/%infer_i_s.sci new file mode 100755 index 000000000..528cc0f90 --- /dev/null +++ b/modules/m2sci/macros/kernel/%infer_i_s.sci @@ -0,0 +1,36 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function M=%infer_i_s(varargin) + + [lhs,rhs]=argn(0) + M=varargin(rhs) + N=varargin(rhs-1)//inserted matrix + index=varargin(1) // + + if rhs==3&(type(index)==10|type(index)==15) then + if type(index)<>15 then + M=struct() + M(index)=N + if index=="entries" then + // change struct to cell + f=getfield(1,M);f(1)="ce" + setfield(1,f,M) + end + else + M=createstruct(index,N) + if type(index(1))<>10 & index(2)=="entries" then + // change struct to cell + f=getfield(1,M);f(1)="ce" + setfield(1,f,M) + end + end + return + end +endfunction diff --git a/modules/m2sci/macros/kernel/%infer_i_st.bin b/modules/m2sci/macros/kernel/%infer_i_st.bin new file mode 100755 index 000000000..e452c1545 Binary files /dev/null and b/modules/m2sci/macros/kernel/%infer_i_st.bin differ diff --git a/modules/m2sci/macros/kernel/%infer_i_st.sci b/modules/m2sci/macros/kernel/%infer_i_st.sci new file mode 100755 index 000000000..a87ce6c00 --- /dev/null +++ b/modules/m2sci/macros/kernel/%infer_i_st.sci @@ -0,0 +1,12 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function st=%infer_i_st(field,infer,st) + st=generic_i_st(field,infer,st) +endfunction diff --git a/modules/m2sci/macros/kernel/%l_i_cste.bin b/modules/m2sci/macros/kernel/%l_i_cste.bin new file mode 100755 index 000000000..88c18f3b9 Binary files /dev/null and b/modules/m2sci/macros/kernel/%l_i_cste.bin differ diff --git a/modules/m2sci/macros/kernel/%l_i_cste.sci b/modules/m2sci/macros/kernel/%l_i_cste.sci new file mode 100755 index 000000000..2f3503f28 --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_cste.sci @@ -0,0 +1,19 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function cste=%l_i_cste(field,inslist,cste) + + if field=="dims" then + cste.infer.dims=inslist + elseif field=="type" then + cste.infer.type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%l_i_funcall.bin b/modules/m2sci/macros/kernel/%l_i_funcall.bin new file mode 100755 index 000000000..bf28cf848 Binary files /dev/null and b/modules/m2sci/macros/kernel/%l_i_funcall.bin differ diff --git a/modules/m2sci/macros/kernel/%l_i_funcall.sci b/modules/m2sci/macros/kernel/%l_i_funcall.sci new file mode 100755 index 000000000..8d6c66e5f --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_funcall.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function funcall=%l_i_funcall(field,inslist,funcall) + if field=="dims" then + funcall.lhs(1).dims=inslist + elseif field=="type" then + funcall.lhs(1).type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%l_i_operatio.bin b/modules/m2sci/macros/kernel/%l_i_operatio.bin new file mode 100755 index 000000000..655a4a679 Binary files /dev/null and b/modules/m2sci/macros/kernel/%l_i_operatio.bin differ diff --git a/modules/m2sci/macros/kernel/%l_i_operatio.sci b/modules/m2sci/macros/kernel/%l_i_operatio.sci new file mode 100755 index 000000000..ad4fe2162 --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_operatio.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function operation=%l_i_operatio(field,inslist,operation) + if field=="dims" then + operation.out(1).dims=inslist + elseif field=="type" then + operation.out(1).type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%l_i_variable.bin b/modules/m2sci/macros/kernel/%l_i_variable.bin new file mode 100755 index 000000000..892071fe0 Binary files /dev/null and b/modules/m2sci/macros/kernel/%l_i_variable.bin differ diff --git a/modules/m2sci/macros/kernel/%l_i_variable.sci b/modules/m2sci/macros/kernel/%l_i_variable.sci new file mode 100755 index 000000000..68c109e99 --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_variable.sci @@ -0,0 +1,20 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function var=%l_i_variable(field,inslist,var) + if field=="dims" then + var.infer.dims=inslist + elseif field=="type" then + var.infer.type=inslist + elseif field=="contents" then + var.infer.contents=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%m2scivar_e.bin b/modules/m2sci/macros/kernel/%m2scivar_e.bin new file mode 100755 index 000000000..af7c773c4 Binary files /dev/null and b/modules/m2sci/macros/kernel/%m2scivar_e.bin differ diff --git a/modules/m2sci/macros/kernel/%m2scivar_e.sci b/modules/m2sci/macros/kernel/%m2scivar_e.sci new file mode 100755 index 000000000..47da81db4 --- /dev/null +++ b/modules/m2sci/macros/kernel/%m2scivar_e.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function val=%m2scivar_e(field,m2scitlist) + + val=[] + if field=="infer" then + val=m2scitlist.infer + elseif field=="dims" then + val=m2scitlist.infer.dims + elseif field=="type" then + val=m2scitlist.infer.type + elseif field=="vtype" then + val=m2scitlist.infer.type.vtype + elseif field=="property" then + val=m2scitlist.infer.type.property + elseif field=="contents" then + val=m2scitlist.infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%operatio_6.bin b/modules/m2sci/macros/kernel/%operatio_6.bin new file mode 100755 index 000000000..241c7e464 Binary files /dev/null and b/modules/m2sci/macros/kernel/%operatio_6.bin differ diff --git a/modules/m2sci/macros/kernel/%operatio_6.sci b/modules/m2sci/macros/kernel/%operatio_6.sci new file mode 100755 index 000000000..d5cc4661e --- /dev/null +++ b/modules/m2sci/macros/kernel/%operatio_6.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function val=%operatio_6(field,m2scitlist) + // File generated from %PROTO_6.g: PLEASE DO NOT EDIT ! + + val=[] + if field=="infer" then + val=m2scitlist.out(1).infer + elseif field=="dims" then + val=m2scitlist.out(1).infer.dims + elseif field=="type" then + val=m2scitlist.out(1).infer.type + elseif field=="vtype" then + val=m2scitlist.out(1).infer.type.vtype + elseif field=="property" then + val=m2scitlist.out(1).infer.type.property + elseif field=="contents" then + val=m2scitlist.out(1).infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%operatio_e.bin b/modules/m2sci/macros/kernel/%operatio_e.bin new file mode 100755 index 000000000..08fdf78db Binary files /dev/null and b/modules/m2sci/macros/kernel/%operatio_e.bin differ diff --git a/modules/m2sci/macros/kernel/%operatio_e.sci b/modules/m2sci/macros/kernel/%operatio_e.sci new file mode 100755 index 000000000..66907542c --- /dev/null +++ b/modules/m2sci/macros/kernel/%operatio_e.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function val=%operatio_e(field,m2scitlist) + // File generated from %PROTO_e.g: PLEASE DO NOT EDIT ! + + val=[] + if field=="infer" then + val=m2scitlist.out(1).infer + elseif field=="dims" then + val=m2scitlist.out(1).infer.dims + elseif field=="type" then + val=m2scitlist.out(1).infer.type + elseif field=="vtype" then + val=m2scitlist.out(1).infer.type.vtype + elseif field=="property" then + val=m2scitlist.out(1).infer.type.property + elseif field=="contents" then + val=m2scitlist.out(1).infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%s_i_operatio.bin b/modules/m2sci/macros/kernel/%s_i_operatio.bin new file mode 100755 index 000000000..357dc8c5e Binary files /dev/null and b/modules/m2sci/macros/kernel/%s_i_operatio.bin differ diff --git a/modules/m2sci/macros/kernel/%s_i_operatio.sci b/modules/m2sci/macros/kernel/%s_i_operatio.sci new file mode 100755 index 000000000..4ac65ba1b --- /dev/null +++ b/modules/m2sci/macros/kernel/%s_i_operatio.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function op=%s_i_operatio(field,cste,op) + if field=="vtype" then + op.type.vtype=cste + elseif field=="property" then + op.type.property=cste + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%s_i_variable.bin b/modules/m2sci/macros/kernel/%s_i_variable.bin new file mode 100755 index 000000000..19778f4f7 Binary files /dev/null and b/modules/m2sci/macros/kernel/%s_i_variable.bin differ diff --git a/modules/m2sci/macros/kernel/%s_i_variable.sci b/modules/m2sci/macros/kernel/%s_i_variable.sci new file mode 100755 index 000000000..1998542a6 --- /dev/null +++ b/modules/m2sci/macros/kernel/%s_i_variable.sci @@ -0,0 +1,21 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function var=%s_i_variable(field,cste,var) + + if field=="vtype" then + var.infer.type.vtype=cste + elseif field=="property" then + var.infer.type.property=cste + elseif field=="contents" then + var.infer.contents=cste + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%type_i_cste.bin b/modules/m2sci/macros/kernel/%type_i_cste.bin new file mode 100755 index 000000000..1f082b41f Binary files /dev/null and b/modules/m2sci/macros/kernel/%type_i_cste.bin differ diff --git a/modules/m2sci/macros/kernel/%type_i_cste.sci b/modules/m2sci/macros/kernel/%type_i_cste.sci new file mode 100755 index 000000000..a85e4c240 --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_cste.sci @@ -0,0 +1,17 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function cste=%type_i_cste(field,inslist,cste) + + if field=="type" then + cste.infer.type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%type_i_funcall.bin b/modules/m2sci/macros/kernel/%type_i_funcall.bin new file mode 100755 index 000000000..fe57ef823 Binary files /dev/null and b/modules/m2sci/macros/kernel/%type_i_funcall.bin differ diff --git a/modules/m2sci/macros/kernel/%type_i_funcall.sci b/modules/m2sci/macros/kernel/%type_i_funcall.sci new file mode 100755 index 000000000..996a354bd --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_funcall.sci @@ -0,0 +1,17 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function funcall=%type_i_funcall(field,inslist,funcall) + + if field=="type" then + funcall.lhs(1).type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%type_i_operatio.bin b/modules/m2sci/macros/kernel/%type_i_operatio.bin new file mode 100755 index 000000000..a70ae1a1b Binary files /dev/null and b/modules/m2sci/macros/kernel/%type_i_operatio.bin differ diff --git a/modules/m2sci/macros/kernel/%type_i_operatio.sci b/modules/m2sci/macros/kernel/%type_i_operatio.sci new file mode 100755 index 000000000..137be6fc9 --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_operatio.sci @@ -0,0 +1,17 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function operation=%type_i_operatio(field,inslist,operation) + + if field=="type" then + operation.out(1).type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%type_i_variable.bin b/modules/m2sci/macros/kernel/%type_i_variable.bin new file mode 100755 index 000000000..e781b7364 Binary files /dev/null and b/modules/m2sci/macros/kernel/%type_i_variable.bin differ diff --git a/modules/m2sci/macros/kernel/%type_i_variable.sci b/modules/m2sci/macros/kernel/%type_i_variable.sci new file mode 100755 index 000000000..d0ab15387 --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_variable.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function var=%type_i_variable(field,inslist,var) + + if typeof(inslist)=="ce" then + if field=="type" then + var.infer=inslist + else + error(gettext("Not yet implemented.")) + end + elseif typeof(inslist)=="st" then + pause + else + if or(typeof(var.infer)==["ce","st"]) then + if field=="type" then + dims=list() + for kd=1:size(var.infer.dims,"*") + dims(kd)=var.infer.dims(kd) + end + var.infer=Infer(dims,Type()) + var.infer.type=inslist + else + error(gettext("Not yet implemented.")) + end + else + if field=="type" then + var.infer.type=inslist + else + error(gettext("Not yet implemented.")) + end + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/%variable_6.bin b/modules/m2sci/macros/kernel/%variable_6.bin new file mode 100755 index 000000000..512ab3a8d Binary files /dev/null and b/modules/m2sci/macros/kernel/%variable_6.bin differ diff --git a/modules/m2sci/macros/kernel/%variable_6.sci b/modules/m2sci/macros/kernel/%variable_6.sci new file mode 100755 index 000000000..6a735f665 --- /dev/null +++ b/modules/m2sci/macros/kernel/%variable_6.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function val=%variable_6(field,m2scitlist) + // File generated from %PROTO_6.g: PLEASE DO NOT EDIT ! + + val=[] + if field=="infer" then + val=m2scitlist.infer + elseif field=="dims" then + val=m2scitlist.infer.dims + elseif field=="type" then + val=m2scitlist.infer.type + elseif field=="vtype" then + val=m2scitlist.infer.type.vtype + elseif field=="property" then + val=m2scitlist.infer.type.property + elseif field=="contents" then + val=m2scitlist.infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%variable_e.bin b/modules/m2sci/macros/kernel/%variable_e.bin new file mode 100755 index 000000000..6fe7b191a Binary files /dev/null and b/modules/m2sci/macros/kernel/%variable_e.bin differ diff --git a/modules/m2sci/macros/kernel/%variable_e.sci b/modules/m2sci/macros/kernel/%variable_e.sci new file mode 100755 index 000000000..6a7fab8e8 --- /dev/null +++ b/modules/m2sci/macros/kernel/%variable_e.sci @@ -0,0 +1,30 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function val=%variable_e(field,m2scitlist) + // File generated from %PROTO_e.g: PLEASE DO NOT EDIT ! + + val=[] + + if field=="infer" then + val=m2scitlist.infer + elseif field=="dims" then + val=m2scitlist.infer.dims + elseif field=="type" then + val=m2scitlist.infer.type + elseif field=="vtype" then + val=m2scitlist.infer.type.vtype + elseif field=="property" then + val=m2scitlist.infer.type.property + elseif field=="contents" then + val=m2scitlist.infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/Contents.bin b/modules/m2sci/macros/kernel/Contents.bin new file mode 100755 index 000000000..b87f044a2 Binary files /dev/null and b/modules/m2sci/macros/kernel/Contents.bin differ diff --git a/modules/m2sci/macros/kernel/Contents.sci b/modules/m2sci/macros/kernel/Contents.sci new file mode 100755 index 000000000..f4f91811a --- /dev/null +++ b/modules/m2sci/macros/kernel/Contents.sci @@ -0,0 +1,31 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function cont=Contents(varargin) + // Create a new inference tlist + + fields=["contents","index","data"] + + nargs=size(varargin) + + // Contents: all unknown + if nargs==0 then + cont=tlist(fields,list(),list()) + elseif nargs==2 then + if typeof(varargin(1))<>"list" then + error(msprintf(gettext("index must be a list instead of a: %s."),typeof(varargin(1)))) + end + if typeof(varargin(2))<>"list" then + error(msprintf(gettext("index must be a list instead of a: %s."),typeof(varargin(2)))) + end + cont=tlist(fields,varargin(1),varargin(2)) + else + error(gettext("Wrong number of inputs.")); + end +endfunction diff --git a/modules/m2sci/macros/kernel/Cste.bin b/modules/m2sci/macros/kernel/Cste.bin new file mode 100755 index 000000000..7936c7337 Binary files /dev/null and b/modules/m2sci/macros/kernel/Cste.bin differ diff --git a/modules/m2sci/macros/kernel/Cste.sci b/modules/m2sci/macros/kernel/Cste.sci new file mode 100755 index 000000000..8dd54986a --- /dev/null +++ b/modules/m2sci/macros/kernel/Cste.sci @@ -0,0 +1,51 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function const=Cste(value) + // Create a new constant tlist + + rhs=argn(2) + + if rhs~=1 then + error(gettext("Wrong number of inputs.")); + end + + dims=list() + + if value=="" then + dims=list(0,0) + else + sz=size(value) + for k=1:size(sz,"*") + dims($+1)=sz(k) + if type(value)==String then + if k==2 then + dims($)=sum(length(value)) + end + end + end + end + + if type(value)==String then + prop=Real + value=value + else + if type(value)==1 then + if isreal(value) then + prop=Real + else + prop=Complex + end + else + prop=Real + end + end + + const=tlist(["cste","value","infer"],value,Infer(dims,Type(type(value),prop))) +endfunction diff --git a/modules/m2sci/macros/kernel/Equal.bin b/modules/m2sci/macros/kernel/Equal.bin new file mode 100755 index 000000000..504a4c80d Binary files /dev/null and b/modules/m2sci/macros/kernel/Equal.bin differ diff --git a/modules/m2sci/macros/kernel/Equal.sci b/modules/m2sci/macros/kernel/Equal.sci new file mode 100755 index 000000000..d742b690a --- /dev/null +++ b/modules/m2sci/macros/kernel/Equal.sci @@ -0,0 +1,34 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function eq=Equal(lhslist,expression,endsymbol) + // Create a new 'equal' tlist + + rhs=argn(2) + + if rhs<2 then + error(gettext("Wrong number of inputs.")) + end + if rhs<3 then + endsymbol=";" + end + if typeof(lhslist)<>"list" then + error(msprintf(gettext("lhslist should be a list and not a: %s."),typeof(lhslist))); + end + if and(typeof(expression)<>["funcall","cste","operation","variable"]) then + disp(expression) + error(msprintf(gettext("expression can not be a: %s."),typeof(expression))) + end + if type(endsymbol)<>10 then + error(msprintf(gettext("endsymbol should be a character string and not a: %s."),typeof(lhslist))); + end + + eq=tlist(["equal","lhs","expression","endsymbol"],lhslist,expression,endsymbol) + +endfunction diff --git a/modules/m2sci/macros/kernel/Funcall.bin b/modules/m2sci/macros/kernel/Funcall.bin new file mode 100755 index 000000000..9d1fa324f Binary files /dev/null and b/modules/m2sci/macros/kernel/Funcall.bin differ diff --git a/modules/m2sci/macros/kernel/Funcall.sci b/modules/m2sci/macros/kernel/Funcall.sci new file mode 100755 index 000000000..feca5cf5a --- /dev/null +++ b/modules/m2sci/macros/kernel/Funcall.sci @@ -0,0 +1,30 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function funcall_tlist=Funcall(name,lhsnb,rhslist,lhslist) + // Copyright INRIA + // Create a new function tlist + + rhs=argn(2) + + // Verify input value + if rhs~=4 then + error(gettext("Wrong number of inputs.")); + elseif typeof(name)~="string" then + error(msprintf(gettext("name must be a string instead of a: %s."),typeof(name))); + elseif typeof(lhsnb)~="constant" then + error(msprintf(gettext("lhsnb must be a constant instead of a: %s."),typeof(lhsnb))); + elseif typeof(rhslist)~="list" & rhslist<>[] then + error(msprintf(gettext("rhslist must be a list instead of a: %s."),typeof(rhslist))); + elseif typeof(lhslist)~="list" then + error(msprintf(gettext("lhslist must be a list instead of a: %s."),typeof(lhslist))); + end + + funcall_tlist=tlist(["funcall","name","lhsnb","rhs","lhs"],name,lhsnb,rhslist,lhslist) +endfunction diff --git a/modules/m2sci/macros/kernel/Infer.bin b/modules/m2sci/macros/kernel/Infer.bin new file mode 100755 index 000000000..661284cb1 Binary files /dev/null and b/modules/m2sci/macros/kernel/Infer.bin differ diff --git a/modules/m2sci/macros/kernel/Infer.sci b/modules/m2sci/macros/kernel/Infer.sci new file mode 100755 index 000000000..26e3100cc --- /dev/null +++ b/modules/m2sci/macros/kernel/Infer.sci @@ -0,0 +1,42 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function infer=Infer(varargin) + // Create a new inference tlist + + fields=["infer","dims","type","contents"] + + rhs=argn(2) + + nargs=size(varargin) + + // Infer(): all unknown + if nargs==0 then + infer=tlist(fields,list(Unknown,Unknown),Type(Unknown,Unknown),Contents()) + elseif nargs==2 then + if typeof(varargin(1))<>"list" then + error(msprintf(gettext("dims must be a list instead of a: %s."),typeof(varargin(1)))); + end + if typeof(varargin(2))<>"type" then + error(msprintf(gettext("type must be a ''type'' tlist instead of a: %s."),typeof(varargin(2)))); + end + infer=tlist(fields,varargin(1),varargin(2),Contents()) + elseif nargs==3 then // Should only be used for cells and structs + if typeof(varargin(1))<>"list" then + error(msprintf(gettext("dims must be a list instead of a: %s."),typeof(varargin(1)))); + end + if typeof(varargin(2))<>"type" then + error(msprintf(gettext("type must be a ''type'' tlist instead of a: %s."),typeof(varargin(2)))); + end + if typeof(varargin(3))<>"contents" then + error(msprintf(gettext("contents must be a ''contents'' tlist instead of a: %s."),typeof(varargin(3)))); + end + infer=tlist(fields,varargin(1),varargin(2),varargin(3)) + end +endfunction diff --git a/modules/m2sci/macros/kernel/M2scivar.bin b/modules/m2sci/macros/kernel/M2scivar.bin new file mode 100755 index 000000000..6521eeddd Binary files /dev/null and b/modules/m2sci/macros/kernel/M2scivar.bin differ diff --git a/modules/m2sci/macros/kernel/M2scivar.sci b/modules/m2sci/macros/kernel/M2scivar.sci new file mode 100755 index 000000000..c755548c3 --- /dev/null +++ b/modules/m2sci/macros/kernel/M2scivar.sci @@ -0,0 +1,32 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function var=M2scivar(sciname,matname,infer,call_level) + // Create a new 'm2scivar' tlist + + rhs=argn(2) + + if rhs<3 then + error(gettext("Wrong number of inputs.")) + end + if rhs==3 then + call_level=0 + end + + if typeof(sciname)~="string" then + error(msprintf(gettext("sciname must be a string instead of a: %s."),typeof(sciname))); + elseif typeof(matname)~="string" then + error(msprintf(gettext("matname must be a string instead of a: %s."),typeof(matname))); + elseif typeof(infer)~="infer" then + error(msprintf(gettext("infer must be an ''infer'' tlist instead of a: %s."),typeof(infer))); + end + + var=tlist(["m2scivar","sciname","matname","infer","level"],sciname,matname,infer,call_level) + +endfunction diff --git a/modules/m2sci/macros/kernel/Operation.bin b/modules/m2sci/macros/kernel/Operation.bin new file mode 100755 index 000000000..eec4f0bb0 Binary files /dev/null and b/modules/m2sci/macros/kernel/Operation.bin differ diff --git a/modules/m2sci/macros/kernel/Operation.sci b/modules/m2sci/macros/kernel/Operation.sci new file mode 100755 index 000000000..0c2ed5eac --- /dev/null +++ b/modules/m2sci/macros/kernel/Operation.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function operation_tlist=Operation(operator,operands,out) + // Create a new operation tlist + + rhs=argn(2) + + // Verify input value + if rhs~=3 then + error(gettext("Wrong number of inputs.")) + end + + if typeof(operator)~="string" then + error(msprintf(gettext("operator must be a string instead of a: %s."),typeof(operator)));; + elseif typeof(operands)~="list" then + error(msprintf(gettext("operands must be a list instead of a: %s."),typeof(operands))); + elseif typeof(out)~="list" then + error(msprintf(gettext("out must be a list instead of a: %s."),typeof(out))); + end + + operation_tlist=tlist(["operation","operator","operands","out"],operator,operands,out) +endfunction diff --git a/modules/m2sci/macros/kernel/Rhs_tlist.bin b/modules/m2sci/macros/kernel/Rhs_tlist.bin new file mode 100755 index 000000000..6df3132ed Binary files /dev/null and b/modules/m2sci/macros/kernel/Rhs_tlist.bin differ diff --git a/modules/m2sci/macros/kernel/Rhs_tlist.sci b/modules/m2sci/macros/kernel/Rhs_tlist.sci new file mode 100755 index 000000000..437971d81 --- /dev/null +++ b/modules/m2sci/macros/kernel/Rhs_tlist.sci @@ -0,0 +1,31 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function rhs_tlist=Rhs_tlist(varargin) + // Create a new rhs tlist + + expressions=list() + if size(varargin)==1 then + if or(typeof(varargin(1))==["string","constant"]) then + expressions(1)=Cste(varargin(1)) + else + expressions(1)=varargin(1) + end + else + for k=1:size(varargin) + if or(typeof(varargin(k))==["string","constant"]) then + expressions(k)=Cste(varargin(k)) + elseif varargin(k)<>list() then //list() is used for rand()... + expressions(k)=varargin(k) + end + end + end + rhs_tlist=expressions + +endfunction diff --git a/modules/m2sci/macros/kernel/Type.bin b/modules/m2sci/macros/kernel/Type.bin new file mode 100755 index 000000000..35edeaf53 Binary files /dev/null and b/modules/m2sci/macros/kernel/Type.bin differ diff --git a/modules/m2sci/macros/kernel/Type.sci b/modules/m2sci/macros/kernel/Type.sci new file mode 100755 index 000000000..ec587b11a --- /dev/null +++ b/modules/m2sci/macros/kernel/Type.sci @@ -0,0 +1,30 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function Type_tlist=Type(vtype,property) + // Create a new 'type' tlist for inference + + rhs=argn(2) + if rhs<2 then + Type_tlist=tlist(["type","vtype","property"],Unknown,Unknown) + return + end + + if and(vtype~=[Double,Boolean,String,Unknown,Sparse,Cell,Struct,Int,Handle]) then + error(msprintf(gettext("%s is not yet implemented."),string(vtype))) + end + + if typeof(property)=="list" then + error(gettext("list of properties is not yet implemented.")) + elseif and(property~=[Real,Complex,Unknown]) then + error(msprintf(gettext("wrong property %s."),string(property))) + end + + Type_tlist=tlist(["type","vtype","property"],vtype,property) +endfunction diff --git a/modules/m2sci/macros/kernel/Variable.bin b/modules/m2sci/macros/kernel/Variable.bin new file mode 100755 index 000000000..7132c5a53 Binary files /dev/null and b/modules/m2sci/macros/kernel/Variable.bin differ diff --git a/modules/m2sci/macros/kernel/Variable.sci b/modules/m2sci/macros/kernel/Variable.sci new file mode 100755 index 000000000..7b55ff9e1 --- /dev/null +++ b/modules/m2sci/macros/kernel/Variable.sci @@ -0,0 +1,27 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function var=Variable(name,infer) + // Create a new variable tlist + + rhs=argn(2) + + if rhs<>2 then + error(gettext("Wrong number of inputs.")) + end + + if typeof(name)~="string" then + error(msprintf(gettext("name must be a string instead of a: %s."),typeof(name))) + elseif typeof(infer)~="infer" then + error(msprintf(gettext("infer must be an ''infer'' tlist instead of a: %s."),typeof(infer))) + end + + var=tlist(["variable","name","infer"],name,infer) + +endfunction diff --git a/modules/m2sci/macros/kernel/allunknown.bin b/modules/m2sci/macros/kernel/allunknown.bin new file mode 100755 index 000000000..f58cc3854 Binary files /dev/null and b/modules/m2sci/macros/kernel/allunknown.bin differ diff --git a/modules/m2sci/macros/kernel/allunknown.sci b/modules/m2sci/macros/kernel/allunknown.sci new file mode 100755 index 000000000..8e469a182 --- /dev/null +++ b/modules/m2sci/macros/kernel/allunknown.sci @@ -0,0 +1,17 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function dims=allunknown(in) + + dims=list() + for k=1:size(in) + dims(k)=-1 + end + +endfunction diff --git a/modules/m2sci/macros/kernel/buildmacros.sce b/modules/m2sci/macros/kernel/buildmacros.sce new file mode 100755 index 000000000..1adb52e12 --- /dev/null +++ b/modules/m2sci/macros/kernel/buildmacros.sce @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2005 - INRIA - 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.1-en.txt + +//------------------------------------ +if (isdef("genlib") == %f) then + exec(SCI+"/modules/functions/scripts/buildmacros/loadgenlib.sce"); +end +//------------------------------------ +genlib("m2scikernellib","SCI/modules/m2sci/macros/kernel",%f,%t); +//------------------------------------ diff --git a/modules/m2sci/macros/kernel/changevarname.bin b/modules/m2sci/macros/kernel/changevarname.bin new file mode 100755 index 000000000..44c51a08a Binary files /dev/null and b/modules/m2sci/macros/kernel/changevarname.bin differ diff --git a/modules/m2sci/macros/kernel/changevarname.sci b/modules/m2sci/macros/kernel/changevarname.sci new file mode 100755 index 000000000..00e3837ff --- /dev/null +++ b/modules/m2sci/macros/kernel/changevarname.sci @@ -0,0 +1,63 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function changevarname(fun,oldname,newname) + // This function replaces the variable (named oldname) of a file by a new name (which is newname). It uses the old2newinstr function + // INPUTS: + // -fun: a string, the name (with the whole path) of the modifed file + // -oldname: a string, the old name of the variable + // -newname: a string, the new name of the variable after modification + + sep=filesep(); + + sep_ind=strindex(fun,sep); + dot_ind=strindex(fun,"."); + + // funname is the function name (without the path and the extension) + funname=part(fun,sep_ind($)+1:dot_ind($)-1); + + if sep_ind<>[] + funsave=part(fun,1:sep_ind($))+"save_"+part(fun,sep_ind($)+1:dot_ind($)-1)+".sci"; + else + funsave="save_"+part(fun,sep_ind($)+1:dot_ind($)-1)+".sci"; + end + + // Compilation + exec(fun); + var=who("get"); + indvar=find(var==funname); + funvect=var(indvar(1):-1:1); + txt=mgetl(fun); + mputl(txt,funsave); + + txt=[] + for j=1:size(funvect,1) + //Get the tree of the function + execstr("tree=macr2tree("+funvect(j)+")"); + // Change oldname into newname in the tree + if tree.name==oldname then + tree.name=newname; + end + for i=1:size(tree.inputs) + tree.inputs(i)=old2newinstr(tree.inputs(i),oldname,newname); + end + for i=1:size(tree.outputs) + tree.outputs(i)=old2newinstr(tree.outputs(i),oldname,newname); + end + for i=1:size(tree.statements) + tree.statements(i)=old2newinstr(tree.statements(i),oldname,newname); + end + + // Get the matching code of the tree after modification + txt=[txt; tree2code(tree,%T)]; + end + + // Replace the old code by the new code (which is txt) in the file fun + mputl(txt,fun); +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/kernel/clause2sci.bin b/modules/m2sci/macros/kernel/clause2sci.bin new file mode 100755 index 000000000..2690bd04d Binary files /dev/null and b/modules/m2sci/macros/kernel/clause2sci.bin differ diff --git a/modules/m2sci/macros/kernel/clause2sci.sci b/modules/m2sci/macros/kernel/clause2sci.sci new file mode 100755 index 000000000..a50a74bef --- /dev/null +++ b/modules/m2sci/macros/kernel/clause2sci.sci @@ -0,0 +1,385 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [sci_clause,nblines]=clause2sci(mtlb_clause,nblines,leveltemp) + // M2SCI function + + // Global variables for M2SCI + global("m2sci_to_insert_b") + global("varslist") + + // Increment level of clause indentation + level + + // Temp variable used to store instructions to insert before clause + to_insert=list() + select typeof(mtlb_clause) + // --- TRYCATCH --- + case "trycatch" + level=[level;0] + + // Get instructions to insert if there are + if m2sci_to_insert_b<>list() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert try + sci_try=list() + level($)=level($)+1 + for k=1:size(mtlb_clause.trystat) + if typeof(mtlb_clause.trystat(k))=="sup_equal" then + sci_try_temp=list() + for i=1:size(mtlb_clause.trystat(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.trystat(k).sup_instr(i),nblines) + sci_try_temp=update_instr_list(sci_try_temp,instr) + end + sci_try($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_try_temp,mtlb_clause.trystat(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.trystat(k),nblines) + sci_try=update_instr_list(sci_try,instr) + end + end + + // Convert catch + sci_catch=list() + level($)=level($)+1 + for k=1:size(mtlb_clause.catchstat) + if typeof(mtlb_clause.catchstat(k))=="sup_equal" then + sci_catch_temp=list() + for i=1:size(mtlb_clause.catchstat(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.catchstat(k).sup_instr(i),nblines) + sci_catch_temp=update_instr_list(sci_catch_temp,instr) + end + sci_catch($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_catch_temp,mtlb_clause.catchstat(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.catchstat(k),nblines) + sci_catch=update_instr_list(sci_catch,instr) + end + end + + // Create Scilab trycatch + sci_clause=tlist(["trycatch","trystat","catchstat"],sci_try,sci_catch) + level($)=level($)+1 + updatevarslist("END OF CLAUSE") + + // --- IF --- + case "ifthenelse" + level=[level;0] + + // Convert expression + [sci_expr]=expression2sci(mtlb_clause.expression) + + // Get instructions to insert if there are + if m2sci_to_insert_b<>list() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert then statements + sci_then=list() + level($)=level($)+1 + for k=1:size(mtlb_clause.then) + if typeof(mtlb_clause.then(k))=="sup_equal" then + sci_then_temp=list() + for i=1:size(mtlb_clause.then(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.then(k).sup_instr(i),nblines) + sci_then_temp=update_instr_list(sci_then_temp,instr) + end + sci_then($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_then_temp,mtlb_clause.then(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.then(k),nblines) + sci_then=update_instr_list(sci_then,instr) + end + end + + // Convert elseifs + sci_elseifs=list() + for k=1:size(mtlb_clause.elseifs) + level($)=level($)+1 + + // Convert expression + [sci_exprn]=expression2sci(mtlb_clause.elseifs(k).expression) + + // Get instructions to insert if there are + if m2sci_to_insert_b<>list() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert statements + sci_stat=list() + for l=1:size(mtlb_clause.elseifs(k).then) + if typeof(mtlb_clause.elseifs(k).then(l))=="sup_equal" then + sci_stat_temp=list() + for i=1:size(mtlb_clause.elseifs(k).then(l).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.elseifs(k).then(l).sup_instr(i),nblines) + sci_stat_temp=update_instr_list(sci_stat_temp,instr) + end + sci_stat($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_stat_temp,mtlb_clause.elseifs(k).then(l).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.elseifs(k).then(l),nblines) + sci_stat=update_instr_list(sci_stat,instr) + end + end + sci_elseifs($+1)=tlist(["elseif","expression","then"],sci_exprn,sci_stat) + end + + // Convert else + sci_else=list() + if size(mtlb_clause.else)<>0 then + level($)=level($)+1 + end + for k=1:size(mtlb_clause.else) + if typeof(mtlb_clause.else(k))=="sup_equal" then + sci_else_temp=list() + for i=1:size(mtlb_clause.else(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.else(k).sup_instr(i),nblines) + sci_else_temp=update_instr_list(sci_else_temp,instr) + end + sci_else($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_else_temp,mtlb_clause.else(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.else(k),nblines) + sci_else=update_instr_list(sci_else,instr) + end + end + + // Create Scilab ifthenelse + sci_clause=tlist(["ifthenelse","expression","then","elseifs","else"],sci_expr,sci_then,sci_elseifs,sci_else) + level($)=level($)+1 + updatevarslist("END OF CLAUSE") + + // --- SELECT --- + case "selectcase" + level=[level;0] + // Convert expression + sci_expr=list() + [sci_expr(1)]=expression2sci(mtlb_clause.expression(1)) + for i=2:size(mtlb_clause.expression) + sci_expr(i)=mtlb_clause.expression(i) // EOL or comment + end + + // Get instructions to insert if there are + if m2sci_to_insert_b<>list() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert cases + sci_cases=list() + k=0 + while klist() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert statements + sci_stat=list() + for l=1:size(mtlb_clause.cases(k).then) + if typeof(mtlb_clause.cases(k).then(l))=="sup_equal" then + sci_stat_temp=list() + for i=1:size(mtlb_clause.cases(k).then(l).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.cases(k).then(l).sup_instr(i),nblines) + sci_stat_temp=update_instr_list(sci_stat_temp,instr) + end + sci_stat($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_stat_temp,mtlb_clause.cases(k).then(l).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.cases(k).then(l),nblines) + sci_stat=update_instr_list(sci_stat,instr) + end + end + sci_cases($+1)=tlist(["case","expression","then"],sci_exprn,sci_stat) + end + + // Convert else + sci_else=list() + if size(mtlb_clause.else)<>0 then + level($)=level($)+1 + end + for k=1:size(mtlb_clause.else) + if typeof(mtlb_clause.else(k))=="sup_equal" then + sci_else_temp=list(); + for i=1:size(mtlb_clause.else(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.else(k).sup_instr(i),nblines) + sci_else_temp=update_instr_list(sci_else_temp,instr) + end + sci_else($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_else_temp,mtlb_clause.else(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.else(k),nblines) + sci_else=update_instr_list(sci_else,instr) + end + end + // Create Scilab selectcase + sci_clause=tlist(["selectcase","expression","cases","else"],sci_expr,sci_cases,sci_else) + level($)=level($)+1 + updatevarslist("END OF CLAUSE") + + // --- WHILE --- + case "while" + level=[level;0] + sci_do=list() + // Convert expression + [sci_expr]=expression2sci(mtlb_clause.expression) + // If there are instructions to insert, while is modified so that inserted instruction is evaluated in each loop + if m2sci_to_insert_b<>list() then + newif=tlist(["ifthenelse","expression","then","elseifs","else"],sci_expr,list(Funcall("break",1,list(),list())),list(),list()) + m2sci_to_insert_b($+1)=newif + sci_expr=Cste(%T) + sci_do=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert all do instructions + level($)=level($)+1 + for k=1:size(mtlb_clause.statements) + if typeof(mtlb_clause.statements(k))=="sup_equal" then + sci_do_temp=list() + for i=1:size(mtlb_clause.statements(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.statements(k).sup_instr(i),nblines) + // If inserted instruction is an initialisation, it has to be done just one time and before loop + l=1; + while l<=lstsize(m2sci_to_insert_b) + if typeof(m2sci_to_insert_b(l))=="equal" & .. + (and(m2sci_to_insert_b(l).expression==Cste([])) | .. + and(m2sci_to_insert_b(l).expression==Funcall("struct",1,list(),list())) | .. + and(m2sci_to_insert_b(l).expression==Funcall("cell",1,list(),list())) ) then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + if lstsize(m2sci_to_insert_b)>=l & m2sci_to_insert_b(l)==list("EOL") then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + end + else + l=l+1; + end + end + sci_do_temp=update_instr_list(sci_do_temp,instr) + end + sci_do($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_do_temp,mtlb_clause.statements(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.statements(k),nblines) + // If inserted instruction is an initialisation, it has to be done just one time and before loop + l=1; + while l<=lstsize(m2sci_to_insert_b) + if typeof(m2sci_to_insert_b(l))=="equal" & .. + (and(m2sci_to_insert_b(l).expression==Cste([])) | .. + and(m2sci_to_insert_b(l).expression==Funcall("struct",1,list(),list())) | .. + and(m2sci_to_insert_b(l).expression==Funcall("cell",1,list(),list())) ) then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + if lstsize(m2sci_to_insert_b)>=l & m2sci_to_insert_b(l)==list("EOL") then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + end + else + l=l+1; + end + end + sci_do=update_instr_list(sci_do,instr) + end + end + + // Create Scilab while + sci_clause=tlist(["while","expression","statements"],sci_expr,sci_do) + level($)=level($)+1 + updatevarslist("END OF CLAUSE") + + // --- FOR --- + case "for" + //level=[level;1] + // Convert expression + [sci_expr,nblines]=instruction2sci(mtlb_clause.expression,nblines) + if typeof(sci_expr)=="equal" then + [bval,pos]=isdefinedvar(sci_expr.lhs(1)) + if bval then + varslist(pos).infer.dims=list(varslist(pos).infer.dims(1),1) + end + end + // Get instructions to insert if there are + if m2sci_to_insert_b<>list() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + sci_instr=list() + // Convert all do instructions + for k=1:size(mtlb_clause.statements) + if typeof(mtlb_clause.statements(k))=="sup_equal" then + sci_instr_temp=list() + for i=1:size(mtlb_clause.statements(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.statements(k).sup_instr(i),nblines) + // If inserted instruction is an initialisation, it has to be done just one time and before loop + l=1; + while l<=lstsize(m2sci_to_insert_b) + if typeof(m2sci_to_insert_b(l))=="equal" & .. + (and(m2sci_to_insert_b(l).expression==Cste([])) | .. + and(m2sci_to_insert_b(l).expression==Funcall("struct",1,list(),list())) | .. + and(m2sci_to_insert_b(l).expression==Funcall("cell",1,list(),list())) ) then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + if lstsize(m2sci_to_insert_b)>=l & m2sci_to_insert_b(l)==list("EOL") then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + end + else + l=l+1; + end + end + sci_instr_temp=update_instr_list(sci_instr_temp,instr) + end + sci_instr($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_instr_temp,mtlb_clause.statements(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.statements(k),nblines) + // If inserted instruction is an initialisation, it has to be done just one time and before loop + l=1; + while l<=lstsize(m2sci_to_insert_b) + if typeof(m2sci_to_insert_b(l))=="equal" & .. + (and(m2sci_to_insert_b(l).expression==Cste([])) | .. + and(m2sci_to_insert_b(l).expression==Funcall("struct",1,list(),list())) | .. + and(m2sci_to_insert_b(l).expression==Funcall("cell",1,list(),list())) ) then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + if lstsize(m2sci_to_insert_b)>=l & m2sci_to_insert_b(l)==list("EOL") then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + end + else + l=l+1; + end + end + sci_instr=update_instr_list(sci_instr,instr) + end + end + // Create Scilab while + sci_clause=tlist(["for","expression","statements"],sci_expr,sci_instr) + else + error(msprintf(gettext("unknown clause type: %s."),typeof(mtlb_clause))) + end + m2sci_to_insert_b=to_insert + if m2sci_to_insert_b<>list() then + m2sci_to_insert_b($+1)=list("EOL"); + end +endfunction diff --git a/modules/m2sci/macros/kernel/convert2double.bin b/modules/m2sci/macros/kernel/convert2double.bin new file mode 100755 index 000000000..2161e1b88 Binary files /dev/null and b/modules/m2sci/macros/kernel/convert2double.bin differ diff --git a/modules/m2sci/macros/kernel/convert2double.sci b/modules/m2sci/macros/kernel/convert2double.sci new file mode 100755 index 000000000..1933dac57 --- /dev/null +++ b/modules/m2sci/macros/kernel/convert2double.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [dble]=convert2double(A) + // This function converts input parameters to double to avoid to write overloading functions in Scilab + + lhs=argn(1) + + if A.vtype==Double then + dble=A + return + end + + if only_double then + dble=A + dble.type=Type(Double,Unknown) + else + if A.vtype==String then + lhslist=list(); + lhslist($+1)=Variable("ans",Infer(A.dims,Type(Double,Real))) + dble=Funcall("asciimat",1,Rhs_tlist(A),lhslist) + elseif A.vtype==Boolean then + lhslist=list(); + lhslist($+1)=Variable("ans",Infer(A.dims,Type(Double,Real))) + dble=Funcall("bool2s",1,Rhs_tlist(A),lhslist) + elseif A.vtype==Unknown then + lhslist=list(); + lhslist($+1)=Variable("ans",Infer(A.dims,Type(Double,Unknown))) + dble=Funcall("mtlb_double",1,Rhs_tlist(A),lhslist) + else + error(msprintf(gettext("%s is not yet implemented."),string(A.vtype))) + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/default_trad.bin b/modules/m2sci/macros/kernel/default_trad.bin new file mode 100755 index 000000000..a0312b06d Binary files /dev/null and b/modules/m2sci/macros/kernel/default_trad.bin differ diff --git a/modules/m2sci/macros/kernel/default_trad.sci b/modules/m2sci/macros/kernel/default_trad.sci new file mode 100755 index 000000000..4d9868308 --- /dev/null +++ b/modules/m2sci/macros/kernel/default_trad.sci @@ -0,0 +1,102 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=default_trad(tree) + // M2SCI function + // Create a default translation function + + global("mtlbref_fun") //contains the matlab reference functions which not yet converted + global("mtlbtool_fun")//contains the matlab toolboxes functions + global("not_mtlb_fun") // contains the not matlab functions + + if ~exists("mtlbref_fun") then + mtlb_fun=[] + end + if ~exists("mtlbtool_fun") then + mtlbtool_fun=[] + end + if ~exists("not_mtlb_fun") then + not_mtlb_fun=[] + end + + name=tree.name + + ispriminame=%f; + //true if the name function is the name of scilab function primitive + if funptr(tree.name)<>0 then + name1="%"+tree.name + tree.name=name1 + ispriminame=%t; + end + //ismtlbfun is true if the function is in a matlab toolbox, mtlbpath is the path where is the function + [mtlbpath,ismtlbtoolfun]=mtlbtoolfun(name) + //Matlab reference functions + if or(name==not_yet_converted()) then + set_infos(msprintf(gettext("Matlab function %s not yet converted, original calling sequence used."),name),2) + if ~or(name==mtlbref_fun(:,1)) then + mtlbref_fun($+1,1)=name + if ispriminame then + mtlbref_fun($,2)=msprintf(gettext("(Warning name conflict: function name changed from %s to %s)."),name,name1); + else + mtlbref_fun($,2)="" + end + end + //Matlab toolboxes functions + elseif ismtlbtoolfun then + set_infos(msprintf(gettext("Matlab toolbox(es) function %s not converted, original calling sequence used"),name),2) + if ~or(name==mtlbtool_fun(:,1)) then + mtlbtool_fun($+1,1)=name + if ispriminame then + mtlbtool_fun($,2)=msprintf(gettext("Matlab toolbox(es) function %s not converted, original calling sequence used."),name,name1,mtlbpath) + else + mtlbtool_fun($,2)=msprintf(gettext("(Find this function in matlab/%s)."),mtlbpath) + end + end + elseif isdefinedvar(Variable(tree.name,Infer())) then + operands=list() + operands(1)=Variable(tree.name,Infer()) + for krhs=1:lstsize(tree.rhs) + operands($+1)=tree.rhs(krhs) + end + tree=Operation("ext",operands,tree.lhs) + tree=operation2sci(tree) + + //Not matlbb function + else + set_infos(msprintf(gettext("Unknown function %s not converted, original calling sequence used."),name),2) + if ~or(name==not_mtlb_fun(:,1)) then + not_mtlb_fun($+1,1)=name + if ispriminame then + not_mtlb_fun($,2)=msprintf(gettext("(Warning name conflict: function name changed from %s to %s)."),name,name1); + else + not_mtlb_fun($,2)="" + end + end + end + if ispriminame then + set_infos(msprintf(gettext("(Warning name conflict: function name changed from %s to %s)."),name,name1),0) + end + [tree]=sci_generic(tree) +endfunction + + + + + + + + + + + + + + + + diff --git a/modules/m2sci/macros/kernel/equal2sci.bin b/modules/m2sci/macros/kernel/equal2sci.bin new file mode 100755 index 000000000..6cbf3980c Binary files /dev/null and b/modules/m2sci/macros/kernel/equal2sci.bin differ diff --git a/modules/m2sci/macros/kernel/equal2sci.sci b/modules/m2sci/macros/kernel/equal2sci.sci new file mode 100755 index 000000000..9b2bebc0e --- /dev/null +++ b/modules/m2sci/macros/kernel/equal2sci.sci @@ -0,0 +1,158 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [sci_instr]=equal2sci(mtlb_instr) + // Convertion of a Matlab instruction or expression to Scilab + // Input: + // - mtlb_instr: Matlab instr or expression to convert + // Output: + // - sci_instr: Scilab equivalent for mtlb_instr + + // Trees to insert in converted function tree + global("m2sci_to_insert_b") + m2sci_to_insert_b=list() + global("m2sci_to_insert_a") + m2sci_to_insert_a=list() + global("varslist") + + sci_instr=mtlb_instr + + // Add inference data to lhs + lhslist=list() + + // Inference field added to each lhs argument + // Get infos in varslist to init + for k=1:size(mtlb_instr.lhs) + if typeof(mtlb_instr.lhs(k))=="variable" then + [bval,index]=isdefinedvar(mtlb_instr.lhs(k)) + if bval then + INFER=varslist(index).infer + else + INFER=Infer() + end + lhslist($+1)=Variable(mtlb_instr.lhs(k).name,INFER) + elseif typeof(mtlb_instr.lhs(k))=="operation" then + if mtlb_instr.lhs(k).operator<>"ins" then + error(msprintf(gettext("lhs cannot be a %s operation."),mtlb_instr.lhs(k).operator)) + end + + [bval,index]=isdefinedvar(mtlb_instr.lhs(k).operands(1)) + if bval then + INFER=varslist(index).infer + else + INFER=Infer() + end + + lhslist($+1)=Operation(mtlb_instr.lhs(k).operator,.. + mtlb_instr.lhs(k).operands,.. + list(Variable(mtlb_instr.lhs(k).operands(1).name,INFER))) + else + error(msprintf(gettext("lhs cannot be a %s."),typeof(mtlb_instr.lhs(k)))) + end + end + + // Convert expression + + [sci_expr]=expression2sci(mtlb_instr.expression,lhslist); + + if sci_expr==list() then // Conversion made by inserted instructions or 'm2scideclare' + sci_instr=list() + else + + sci_instr.expression=sci_expr; + + // Update lhs of instruction + select typeof(sci_instr.expression) + case "operation" then + sci_instr.lhs=sci_expr.out; + case "funcall" then + sci_instr.lhs=sci_instr.expression.lhs + if typeof(mtlb_instr.expression)=="funcall" then + sci_instr.lhs=sci_expr.lhs; + end + case "cste" then + sci_instr.lhs=lhslist; + sci_instr.lhs(1).dims=sci_expr.dims; + sci_instr.lhs(1).type=sci_expr.type; + case "variable" then + sci_instr.lhs=lhslist; + sci_instr.lhs(1).dims=sci_expr.dims; + sci_instr.lhs(1).type=sci_expr.type; + else + error(msprintf(gettext("%s is not yet implemented."),typeof(sci_instr.expression))); + end + + // If lhs are insertion operation, they also have to be converted + for k=1:size(sci_instr.lhs) + if typeof(sci_instr.lhs(k))=="operation" then + sci_instr.lhs(k).operands($+1)=sci_instr.expression + // Keep just one inference field in sci_instr.expression (if is a funcall) so that inference can be made in operation2sci() + if typeof(sci_instr.lhs(k).operands($))=="funcall" then + for l=1:size(sci_instr.lhs(k).operands($).lhs) + if l<>k then + sci_instr.lhs(k).operands($).lhs(l)=list() + end + end + l=1 + while l<=size(sci_instr.lhs(k).operands($).lhs) + if sci_instr.lhs(k).operands($).lhs(l)==list() then + sci_instr.lhs(k).operands($).lhs(l)=null() + else + l=l+1 + end + end + // Verify that there is just one lhs kept + if size(sci_instr.lhs(k).operands($).lhs)<>1 then pause;end + end + // If insertion made in an unknown variable, I add it to varslist + inservar=sci_instr.lhs(k).operands(1) + [bval,index]=isdefinedvar(inservar) + if ~bval then + // Variable added to varslist before insertion + if funptr(inservar.name)<>0 then + matname="%"+inservar.name + else + matname=inservar.name + end + if sci_instr.expression.vtype==Struct then + // Variable is initialized to struct() in converted script is does not already exist + varslist($+1)=M2scivar(matname,inservar.name,Infer(list(0,0),Type(Struct,Unknown))) + //m2sci_to_insert_b($+1)=Equal(list(inservar),Funcall("struct",1,list(),list())) + elseif sci_instr.expression.vtype==Cell then + // Variable is initialized to cell() in converted script is does not already exist + varslist($+1)=M2scivar(matname,inservar.name,Infer(list(0,0),Type(Cell,Unknown))) + //m2sci_to_insert_b($+1)=Equal(list(inservar),Funcall("cell",1,list(),list())) + else + // Variable is initialized to [] in converted script is does not already exist + varslist($+1)=M2scivar(matname,inservar.name,Infer(list(0,0),Type(Double,Real))) + //m2sci_to_insert_b($+1)=Equal(list(inservar),Cste([])) + end + sci_instr.lhs(k).out(1).infer=varslist($).infer + else + sci_instr.lhs(k).out(1).infer=varslist(index).infer + end + [sci_instr.lhs(k)]=operation2sci(sci_instr.lhs(k)) + if typeof(sci_instr.lhs(k))=="operation" then + if or(sci_instr.lhs(k).operands($)<>sci_instr.expression) then // Update expression if has been modified while converting lhs + sci_instr.expression=sci_instr.lhs(k).operands($) + end + + sci_instr.lhs(k).operands($)=null() + updatevarslist(sci_instr.lhs(k).out) + else + // Insertion done by inserted instruction + sci_instr=list() + return + end + end + end + // Update varslist + updatevarslist(sci_instr.lhs); + end +endfunction diff --git a/modules/m2sci/macros/kernel/expression2sci.bin b/modules/m2sci/macros/kernel/expression2sci.bin new file mode 100755 index 000000000..aa20981dd Binary files /dev/null and b/modules/m2sci/macros/kernel/expression2sci.bin differ diff --git a/modules/m2sci/macros/kernel/expression2sci.sci b/modules/m2sci/macros/kernel/expression2sci.sci new file mode 100755 index 000000000..ded4e6b1f --- /dev/null +++ b/modules/m2sci/macros/kernel/expression2sci.sci @@ -0,0 +1,132 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [sci_expr]=expression2sci(mtlb_expr,lhslist) + // M2SCI function + + // Global variable for M2SCI + global("varslist") + + // When lhslist is given, then expression2sci is called from equal2sci + // else it is called from an other function (clause2sci for example) + rhs=argn(2); + // If not given, lhslist is initialized with no name lhs + if rhs==1 then + if typeof(mtlb_expr)=="funcall" then + lhsnb=mtlb_expr.lhsnb; + else + lhsnb=1; + end + lhslist=list(); + for k=1:lhsnb + lhslist($+1)=Variable("ans",Infer()); + end + end + + select typeof(mtlb_expr) + // --- Expression is an 'operation' tlist --- + case "operation" + // Add inference fields to operation + mtlb_expr=Operation(mtlb_expr.operator,mtlb_expr.operands,lhslist) + + // Translation + [sci_expr]=operation2sci(mtlb_expr) + + // --- Expression is a 'funcall' tlist --- + case "funcall" + + // Particular case if expression is a call to 'm2scideclare' + if mtlb_expr.name=="m2scideclare" then + sci_expr=list() + // varslist is updated with user defined data + sci_m2scideclare(mtlb_expr) + + // Particular case if expression is a call to 'comment' + elseif mtlb_expr.name=="%comment" then + // Add inference fields to funcall + sci_expr=Funcall(mtlb_expr.name,mtlb_expr.lhsnb,mtlb_expr.rhs,lhslist) + // All other 'funcall' expressions + else + // Add inference fields to funcall + mtlb_expr=Funcall(mtlb_expr.name,mtlb_expr.lhsnb,mtlb_expr.rhs,lhslist) + + // Translation + [sci_expr]=funcall2sci(mtlb_expr) + end + + // --- Expression is a 'cste' tlist --- + case "cste" + // Convert expression + sci_expr=Cste(mtlb_expr.value) + + // --- Expression is a 'variable' tlist --- + case "variable" + [bval,index]=isdefinedvar(mtlb_expr) + + // Variable already exists + if bval then + sci_expr=Variable(varslist(index).sciname,varslist(index).infer) + // Variable is unknown + else + // Try to find what is this variable + [sci_expr]=getvar2sci(mtlb_expr,lhslist) + if typeof(sci_expr)=="funcall" then + if typeof(lhslist(1))=="variable" & sci_expr.name==lhslist(1).name then // Used for commands such as keyboard, cputime... + // keyboard in an M-file is represented in tree by an equal with lhs=keyboard and expression=keyboard + sci_expr.lhs(1).name="ans" + elseif typeof(lhslist(1))=="variable" & mtlb_expr.name==lhslist(1).name then // When command converted by mtlb(cmd_name) + sci_expr.lhs(1).name="ans" + end + if sci_expr.name<>"mtlb" then + [sci_expr]=funcall2sci(sci_expr) + end + end + end + // --- operand is a list (only for operations) --- + case "list" + if lstsize(mtlb_expr)==1 & mtlb_expr==list("EOL") then + sci_expr=mtlb_expr + return + end + for k=1:size(mtlb_expr) + if typeof(mtlb_expr(k))=="cste" then + mtlb_expr(k)=Cste(mtlb_expr(k).value) + elseif typeof(mtlb_expr(k))=="variable" then + [isvar,index]=isdefinedvar(mtlb_expr(k)) + if isvar then + mtlb_expr(k)=Variable(mtlb_expr(k).name,varslist(index).infer) + else + mtlb_expr(k)=Variable(mtlb_expr(k).name,Infer()) + end + elseif typeof(mtlb_expr(k))=="list" then + [mtlb_expr(k)]=expression2sci(mtlb_expr(k),lhslist) + elseif typeof(mtlb_expr(k))=="operation" then + [mtlb_expr(k)]=expression2sci(mtlb_expr(k),lhslist) + elseif typeof(mtlb_expr(k))=="funcall" then + [mtlb_expr(k)]=expression2sci(mtlb_expr(k),lhslist) + else + error(msprintf(gettext("recursive extraction with one index of type %s is not yet implemented."),typeof(mtlb_expr(k)))) + end + end + sci_expr=mtlb_expr + // --- operand is a comment --- + case "comment" + sci_expr=mtlb_expr + // --- Expression is a not tolerated tlist --- + else + error(msprintf(gettext("%s is not yet implemented."),typeof(mtlb_expr))) + end + + // Verify if flag for translation improvements has to be set + if typeof(sci_expr)=="funcall" then + if part(sci_expr.name,1:4)=="mtlb" then + m2sci_infos(1)=%t // level 1 = improvements + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/first_non_singleton.bin b/modules/m2sci/macros/kernel/first_non_singleton.bin new file mode 100755 index 000000000..168324531 Binary files /dev/null and b/modules/m2sci/macros/kernel/first_non_singleton.bin differ diff --git a/modules/m2sci/macros/kernel/first_non_singleton.sci b/modules/m2sci/macros/kernel/first_non_singleton.sci new file mode 100755 index 000000000..4d5d80747 --- /dev/null +++ b/modules/m2sci/macros/kernel/first_non_singleton.sci @@ -0,0 +1,26 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function dim=first_non_singleton(m2scitlist) + dim=-1 + if is_a_scalar(m2scitlist) | is_a_vector(m2scitlist) then + dim=0; + return + end + for k=1:size(m2scitlist.dims) + if m2scitlist.dims(k)==0 then + dim=0 + break + elseif m2scitlist.dims(k)>0 & m2scitlist.dims(k)<>1 then + dim=k + break + end + end + +endfunction diff --git a/modules/m2sci/macros/kernel/funcall2sci.bin b/modules/m2sci/macros/kernel/funcall2sci.bin new file mode 100755 index 000000000..1b06ecd50 Binary files /dev/null and b/modules/m2sci/macros/kernel/funcall2sci.bin differ diff --git a/modules/m2sci/macros/kernel/funcall2sci.sci b/modules/m2sci/macros/kernel/funcall2sci.sci new file mode 100755 index 000000000..56a2af907 --- /dev/null +++ b/modules/m2sci/macros/kernel/funcall2sci.sci @@ -0,0 +1,98 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [sci_equiv]=funcall2sci(mtlb_expr) + // M2SCI function + // Convert a function call in an instruction or in an expression from Matlab to Scilab + // Input: + // - mtlb_instr: Matlab instr or expression to convert + // Output: + // - sci_instr: Scilab equivalent for mtlb_instr + + rhslist=mtlb_expr.rhs + if rhslist==[] then // Function called as a command + rhsnb=-1 + rhslist=list() + mtlb_expr.rhs=list() + else + rhsnb=size(rhslist) + end + // Init returned value + sci_expr=mtlb_expr + + rhsind=1 + while rhsind<=rhsnb + [sci_equiv]=expression2sci(rhslist(rhsind)); + mtlb_expr.rhs(rhsind)=sci_equiv; + rhsind=rhsind+1; + end + + // Performs the conversion of function call + lhs=mtlb_expr.lhsnb + if rhsnb==-1 then + rhs=-1 + else + rhs=size(mtlb_expr.rhs) + end + funname=mtlb_expr.name + + // If a translation function exists + if exists("sci_"+funname)==1 then + execstr("[sci_equiv]=sci_"+funname+"(mtlb_expr)"); + // If I don't know where I can search other M-files + elseif res_path==[] then + sci_equiv=default_trad(mtlb_expr) + else + sci_tmpfile =pathconvert(TMPDIR)+pathconvert(fnam)+"sci_"+funname+".sci" + tmpierr=execstr("exec(sci_tmpfile,-1)","errcatch");errclear(); + sci_file=res_path+"sci_"+funname+".sci" + ierr=execstr("exec(sci_file,-1)","errcatch");errclear(); + if tmpierr==0 then + execstr("[sci_equiv]=sci_"+mtlb_expr.name+"(mtlb_expr)"); + // If a translation function exists + elseif ierr==0 then + execstr("[sci_equiv]=sci_"+mtlb_expr.name+"(mtlb_expr)"); + // If no translation indication given + elseif Recmode then + // Check if the M-file exists in the given paths + path=mfile_path(funname) + if path==[] then + sci_equiv=default_trad(mtlb_expr) + elseif or(funname==nametbl) + sci_equiv=sci_generic(mtlb_expr) + else + fnam=funname + scipath=res_path+fnam+".sci" + scepath=res_path+fnam+".sce" + catpath=res_path+fnam+".cat" + res=0 + if newest(path,scipath,scepath)==1 then + res=mfile2sci(path,res_path,%F,%T) + end + if res==1 then + exec(sci_file, -1) + ierr=execstr("[sci_equiv]=sci_"+mtlb_expr.name+"(mtlb_expr)","errcatch"); + if ierr<>0 then + error(msprintf(gettext("Error while executing : [sci_equiv]=sci_%s(mtlb_expr)."),mtlb_expr.name)); + end + else + sci_equiv=default_trad(mtlb_expr) + end + end + else // Default translation + sci_equiv=default_trad(mtlb_expr) + end + end + + // If equivalent is a funcall, number of lhs can have changed + if typeof(sci_equiv)=="funcall" then + sci_equiv.lhsnb=size(sci_equiv.lhs) + end + +endfunction diff --git a/modules/m2sci/macros/kernel/funcallsearch.bin b/modules/m2sci/macros/kernel/funcallsearch.bin new file mode 100755 index 000000000..857a7dd71 Binary files /dev/null and b/modules/m2sci/macros/kernel/funcallsearch.bin differ diff --git a/modules/m2sci/macros/kernel/funcallsearch.sci b/modules/m2sci/macros/kernel/funcallsearch.sci new file mode 100755 index 000000000..3b96282e2 --- /dev/null +++ b/modules/m2sci/macros/kernel/funcallsearch.sci @@ -0,0 +1,104 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function [funcallname,variablename]=funcallsearch(instr,funcallname,fnamvect,variablename) + // + // FUNCALLSEARCH recursive function (used by "translatepaths" function) + // Searches the functions names in each instruction of mtlbtree + // Input-Output + // -funcallname : a vector which contains the names of called functions if it exists a M-file having the same name in the Paths + // -variablename : a vector which contains the names of declared variables + // Input + // -instr : mtlbtree instruction + // -fnamvect : vector which contains all M-files names found in the Paths + + // case : ifthenelse instruction + if typeof(instr) == "ifthenelse" then + [funcallname,variablename]=funcallsearch(instr.expression,funcallname,fnamvect,variablename) + for i=1:size(instr.then) + [funcallname,variablename]=funcallsearch((instr.then(i)),funcallname,fnamvect,variablename) + end + for i=1:size(instr.elseifs) + for k=1:size(instr.elseifs(i).then) + [funcallname,variablename]=funcallsearch((instr.elseifs(i).then(k)),funcallname,fnamvect,variablename) + end + end + for i=1:size(instr.else) + [funcallname,variablename]=funcallsearch((instr.else(i)),funcallname,fnamvect,variablename) + end + // case : selectcase instruction + elseif typeof(instr) == "selectcase" then + [funcallname,variablename]=funcallsearch(instr.expression,funcallname,fnamvect,variablename) + + for i=1:size(instr.cases) + [funcallname,variablename]=funcallsearch((instr.cases(i).expression),funcallname,fnamvect,variablename) + for j=1:size(instr.cases(i).then) + [funcallname,variablename]=funcallsearch((instr.cases(i).then(j)),funcallname,fnamvect,variablename) + end + end + for i=1:size(instr.else) + [funcallname,variablename]=funcallsearch(instr.else(i),funcallname,fnamvect,variablename) + end + // case : while instruction + elseif typeof(instr) == "while" then + [funcallname,variablename]=funcallsearch(instr.expression,funcallname,fnamvect,variablename) + for i=1:size(instr.statements) + [funcallname,variablename]=funcallsearch(instr.statements(i),funcallname,fnamvect,variablename) + end + // case : for instruction + elseif typeof(instr) == "for" then + [funcallname,variablename]=funcallsearch(instr.expression,funcallname,fnamvect,variablename) + for i=1:size(instr.statements) + [funcallname,variablename]=funcallsearch(instr.statements(i),funcallname,fnamvect,variablename) + end + // case : cste instruction + elseif typeof(instr)== "cste" then + return + // case : variable instruction + elseif typeof(instr)=="variable" + if find(instr.name==variablename)==[] & find(instr.name==stripblanks(part(fnamvect,1:24)))<>[] & find(instr.name==funcallname)==[] then + funcallname=[funcallname;fnamvect(find(instr.name==stripblanks(part(fnamvect,1:24))))] + else + return + end + // case : equal instruction + elseif typeof(instr) == "equal" then + [funcallname,variablename]=funcallsearch(instr.expression,funcallname,fnamvect,variablename) + // case : expression is a funcall + elseif typeof(instr) == "funcall" then + if find(funcallname==instr.name) == [] & find(instr.name==stripblanks(part(fnamvect,1:24)))<>[] then + if size(find(instr.name==stripblanks(part(fnamvect,1:24))),2)==1 then + funcallname=[funcallname;fnamvect(find(instr.name==stripblanks(part(fnamvect,1:24))))] + else + findvect=find(instr.name==stripblanks(part(fnamvect,1:24))) + funcallname=[funcallname;fnamvect(findvect(2))] + st = " " + mtlbtree.name + ": " + fnamvect(findvect(1)) + for i=2:size(findvect,2) + st = st+ " <-> " + fnamvect(findvect(i)) + end + st = st + gettext(": The 24 first characters of the files names are equal: "); + warning(st) + end + end + // case : expression is cste + if typeof(instr.rhs)== "constant" then + return + else + for ind=1:size(instr.rhs) + [funcallname,variablename]=funcallsearch(instr.rhs(ind),funcallname,fnamvect,variablename) + end + end + // case : operation instruction + elseif typeof(instr) == "operation" then + for ind=1:size(instr.operands) + [funcallname,variablename]=funcallsearch(instr.operands(ind),funcallname,fnamvect,variablename) + end + end + +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/kernel/get_unknown.bin b/modules/m2sci/macros/kernel/get_unknown.bin new file mode 100755 index 000000000..aff5c164c Binary files /dev/null and b/modules/m2sci/macros/kernel/get_unknown.bin differ diff --git a/modules/m2sci/macros/kernel/get_unknown.sci b/modules/m2sci/macros/kernel/get_unknown.sci new file mode 100755 index 000000000..02f1181ee --- /dev/null +++ b/modules/m2sci/macros/kernel/get_unknown.sci @@ -0,0 +1,31 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function [sci_equiv]=get_unknown(varname,lhslist) + // Handle cases where varname appear in an expression while it is not known. + + // nam may be: + // - a variable created in an other clause part + // - a M-file called without args + // - a variable created by an eval + + // Check clause !!! + + // Check if it is a Matlab function not converted yet + if or(varname==not_yet_converted()) then + set_infos(msprintf(gettext("Matlab function %s not yet converted."),varname),2) + tmpvar=Variable(varname,Infer()) + sci_equiv=Funcall("mtlb",1,Rhs_tlist(tmpvar),lhslist) + else + // Other cases: I am not able to determine what is nam + set_infos(msprintf(gettext("mtlb(%s) can be replaced by %s() or %s whether %s is an M-file or not."),varname,varname,varname,varname),1) + tmpvar=Variable(varname,Infer()) + sci_equiv=Funcall("mtlb",1,Rhs_tlist(tmpvar),lhslist) + end +endfunction diff --git a/modules/m2sci/macros/kernel/getoperands.bin b/modules/m2sci/macros/kernel/getoperands.bin new file mode 100755 index 000000000..ed31252d0 Binary files /dev/null and b/modules/m2sci/macros/kernel/getoperands.bin differ diff --git a/modules/m2sci/macros/kernel/getoperands.sci b/modules/m2sci/macros/kernel/getoperands.sci new file mode 100755 index 000000000..b9f77eabf --- /dev/null +++ b/modules/m2sci/macros/kernel/getoperands.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function [varargout] = getoperands(op_tree) + + varargout=list() + + if typeof(op_tree)<>"operation" then + error(gettext("input argument must be an ''operation'' tlist.")) + end + + opnb=size(op_tree.operands) + + for k=1:opnb + varargout(k)=op_tree.operands(k) + end + +endfunction diff --git a/modules/m2sci/macros/kernel/getrhs.bin b/modules/m2sci/macros/kernel/getrhs.bin new file mode 100755 index 000000000..9d2d21eec Binary files /dev/null and b/modules/m2sci/macros/kernel/getrhs.bin differ diff --git a/modules/m2sci/macros/kernel/getrhs.sci b/modules/m2sci/macros/kernel/getrhs.sci new file mode 100755 index 000000000..3401a22ce --- /dev/null +++ b/modules/m2sci/macros/kernel/getrhs.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function [varargout] = getrhs(instr_tree) + + varargout=list() + + if typeof(instr_tree)<>"funcall" then + error(gettext("Wrong input argument in getrhs() (Must be a ''funcall'' tlist).")) + end + + rhsnb=size(instr_tree.rhs) + + for k=1:rhsnb + varargout(k)=instr_tree.rhs(k) + end + +endfunction diff --git a/modules/m2sci/macros/kernel/gettempvar.bin b/modules/m2sci/macros/kernel/gettempvar.bin new file mode 100755 index 000000000..43479e444 Binary files /dev/null and b/modules/m2sci/macros/kernel/gettempvar.bin differ diff --git a/modules/m2sci/macros/kernel/gettempvar.sci b/modules/m2sci/macros/kernel/gettempvar.sci new file mode 100755 index 000000000..699739779 --- /dev/null +++ b/modules/m2sci/macros/kernel/gettempvar.sci @@ -0,0 +1,35 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function var=gettempvar(n) + // M2SCI function + // Create a temporary variable with name depending on clause level... + + global("tmpvarnb") + [lhs,rhs]=argn(0) + + varname="%v"+string(tmpvarnb) + tmpvarnb=tmpvarnb+1 + + // If in the expression of a clause then variable name is modified by adding level + if size(level,1)>1 then + if level(size(level,1))==0 then + varname=varname+string(size(level,1)) + elseif level(size(level,1))>0 then // If in statements of a clause then variable name is modified by adding _level + varname=varname+"_"+string(level(size(level,1))) + end + end + + // User is allowed to precise a variable number + if rhs==1 then + varname=varname+"$"+string(n) + end + + var=Variable(varname,Infer(list(0,0),Type())) +endfunction diff --git a/modules/m2sci/macros/kernel/getvar2sci.bin b/modules/m2sci/macros/kernel/getvar2sci.bin new file mode 100755 index 000000000..6796fa65e Binary files /dev/null and b/modules/m2sci/macros/kernel/getvar2sci.bin differ diff --git a/modules/m2sci/macros/kernel/getvar2sci.sci b/modules/m2sci/macros/kernel/getvar2sci.sci new file mode 100755 index 000000000..caf989093 --- /dev/null +++ b/modules/m2sci/macros/kernel/getvar2sci.sci @@ -0,0 +1,63 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function [sci_equiv]=getvar2sci(var,lhslist) + // Translate the named variable acquisition + + // Global variable for M2SCI + global("varslist") + + rhs=argn(2) + if rhs<>2 then + error(gettext("Wrong number of inputs.")) + end + + // Search variable name in variable name table + [boolval,index]=isdefinedvar(var) + varname=var.name + + // Variable is not defined yet + if ~boolval then + scinam=varname + + // If Matlab variable name is a function name in Scilab + if funptr(varname)<>0 then + scinam="%"+varname + end + + // Undefined variable may be a M-file or a global variable + // Check if a corresponding M-file exists here + if isanmfile(varname) then + // A M-file without parameter + if verbose_mode<0 then + m2sci_info(msprintf(gettext("L.%d: Unknown variable %s is a M-file."),nblines,varname),-1); + end + sci_equiv=Funcall(varname,size(lhslist),list(),lhslist) + elseif exists("sci_"+varname)==1 then + // A translated function without parameter + if verbose_mode<0 then + m2sci_info(msprintf(gettext("L.%d: Unknown variable %s is a M-file (sci_%s exists)."),nblines,varname,varname),-1); + end + sci_equiv=Funcall(varname,size(lhslist),list(),lhslist) + elseif or(varname==["i","j"]) then + if verbose_mode<0 then + m2sci_info(msprintf(gettext("Variable %s supposed to be the Imaginary unit."),varname),-1); + end + sci_equiv=Variable("%i",Infer(list(1,1),Type(Double,Complex))) + else + // Try to find what is 'varname' + sci_equiv=get_unknown(varname,lhslist) + if verbose_mode<0 then + m2sci_info(msprintf(gettext("L.%d: Unknown variable %s."),nblines,varname),-1); + end + end + else + sci_equiv=Variable(varname,Infer(varslist(index).dims,varslist(index).type)) + end +endfunction diff --git a/modules/m2sci/macros/kernel/i_notation.bin b/modules/m2sci/macros/kernel/i_notation.bin new file mode 100755 index 000000000..0bbd59db5 Binary files /dev/null and b/modules/m2sci/macros/kernel/i_notation.bin differ diff --git a/modules/m2sci/macros/kernel/i_notation.sci b/modules/m2sci/macros/kernel/i_notation.sci new file mode 100755 index 000000000..c7ae4c9b0 --- /dev/null +++ b/modules/m2sci/macros/kernel/i_notation.sci @@ -0,0 +1,94 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function txt=i_notation(txt) + // This function changes 1i ,... by 1*i,... + + // M2SCI kernel functions called : + // - isinstring + + + // To succeed in this work, we successively suppress occurences which can be proved not to be complex notation + // Until we are 'sure' to have a complex notation + + n=size(txt,"r") + + I="i";J="j" + matches=[string(0:9)+I(ones(1,10)),".i",string(0:9)+J(ones(1,10)),".j"] + symbs=["+","-","*","/","\","(","["," ","^"," ",",",";","=","{"] + s1=["+","-","*","/","\",",",";"," ","^",".","&","|","''","]",")","}"] + s2=[string(0:9),"d","e","D","E","."] + + for k=1:n + st=strindex(txt(k),[";//","//"]) + if st<> [] then + for stk=1:size(st,"*") + if ~isinstring(txt(k),stk) then + break + end + end + continue + end + tk=txt(k)+" " + + // Find possible occurence of complex notation + kc=strindex(tk,matches) + + // Kill indexes which point to non complex values (e.g. : a1item...) + for kk=size(kc,"*"):-1:1 + km=kc(kk)+2 + if find(part(tk,km)==s1)==[] then kc(kk)=[],end + end + + kc=[0 kc] + + for kk=size(kc,"*"):-1:2 + km=kc(kk) + num=%T + // Reads numeric value leading complex variable + while or(part(tk,km)==s2) + km=km-1 + if km<=kc(kk-1)+1 then + km=kc(kk-1); + num=%F; + break + end + end + + tokill=%F + num=part(tk,km+1:kc(kk)-1) + ke=strindex(convstr(num),["e","d"]) + kd=strindex(convstr(num),".") + + // Searching for invalid numeric values (more than one dot...) + if size(ke,2)>1|size(kd,2)>1 then + tokill=%T + elseif size(ke,2)==1&size(kd,2)==1 then + if kekc(kk-1) then + if and(part(tk,km)<>symbs) then tokill=%T,end + end + end + + if ~tokill then + km=kc(kk) + // If supposed complex notation is not in a string + if ~isinstring(tk,km) then + tk=part(tk,1:km)+"*%"+part(tk,km+1:length(tk)) + end + end + end + txt(k)=tk + end +endfunction diff --git a/modules/m2sci/macros/kernel/infer2txt.bin b/modules/m2sci/macros/kernel/infer2txt.bin new file mode 100755 index 000000000..2b05e16fa Binary files /dev/null and b/modules/m2sci/macros/kernel/infer2txt.bin differ diff --git a/modules/m2sci/macros/kernel/infer2txt.sci b/modules/m2sci/macros/kernel/infer2txt.sci new file mode 100755 index 000000000..bef0b616f --- /dev/null +++ b/modules/m2sci/macros/kernel/infer2txt.sci @@ -0,0 +1,60 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function txt=infer2txt(infer) + txt=[] + dims=[] + if typeof(infer)=="infer" then + for l=1:size(infer.dims) + dims=[dims,string(infer.dims(l))] + end + else + error(gettext("Not yet implemented.")) + end + dims=strcat(dims," ") + + tp=infer.type.vtype + if tp==1 then + tp="Double" + elseif tp==10 then + tp="String" + elseif or(tp==[4,6]) then + tp="Boolean" + elseif tp==16 then + tp="Struct" + for k=1:lstsize(infer.contents.index) + if typeof(infer.contents.index(k))<>"list" then + txt=[txt;expression2code(list(infer.contents.index(k)))+infer2txt(infer.contents.data(k))] + else + txt=[txt;expression2code(infer.contents.index(k))+infer2txt(infer.contents.data(k))] + end + end + elseif tp==17 then + tp="Cell" + for k=1:lstsize(infer.contents.index) + if typeof(infer.contents.index(k))<>"list" then + txt=[txt;expression2code(list(infer.contents.index(k)))+infer2txt(infer.contents.data(k))] + else + txt=[txt;expression2code(infer.contents.index(k))+infer2txt(infer.contents.data(k))] + end + end + elseif tp==9 then + tp="Handle" + else + tp="Unknown" + end + if infer.type.property==Real then + prop="Real" + elseif infer.type.property==Complex then + prop="Complex" + else + prop="Unknown" + end + txt=["|"+dims+"|"+tp+"|"+prop;txt] +endfunction diff --git a/modules/m2sci/macros/kernel/insert.bin b/modules/m2sci/macros/kernel/insert.bin new file mode 100755 index 000000000..bc4e95a9e Binary files /dev/null and b/modules/m2sci/macros/kernel/insert.bin differ diff --git a/modules/m2sci/macros/kernel/insert.sci b/modules/m2sci/macros/kernel/insert.sci new file mode 100755 index 000000000..d72cfcdf4 --- /dev/null +++ b/modules/m2sci/macros/kernel/insert.sci @@ -0,0 +1,26 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function []=insert(instr,opt) + + // Global variables for M2SCI + global("m2sci_to_insert_b") + global("m2sci_to_insert_a") + + [lhs,rhs]=argn() + + if rhs==1 then + opt=0 // Insertion before current instruction + end + if opt<>1 then + m2sci_to_insert_b($+1)=instr + else + m2sci_to_insert_a($+1)=instr + end +endfunction diff --git a/modules/m2sci/macros/kernel/instruction2sci.bin b/modules/m2sci/macros/kernel/instruction2sci.bin new file mode 100755 index 000000000..af311919f Binary files /dev/null and b/modules/m2sci/macros/kernel/instruction2sci.bin differ diff --git a/modules/m2sci/macros/kernel/instruction2sci.sci b/modules/m2sci/macros/kernel/instruction2sci.sci new file mode 100755 index 000000000..903f993fc --- /dev/null +++ b/modules/m2sci/macros/kernel/instruction2sci.sci @@ -0,0 +1,32 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [converted_instr,nblines]=instruction2sci(mtlb_instr,nblines) + + // Convertion of empty lines + if mtlb_instr==list("EOL") then + converted_instr=list("EOL") + nblines = nblines + 1; + return + end + + if typeof(mtlb_instr)=="equal" then + [converted_instr]=equal2sci(mtlb_instr) + elseif or(typeof(mtlb_instr)==["ifthenelse","selectcase","for","while","trycatch"]) then + [converted_instr,nblines]=clause2sci(mtlb_instr,nblines) + elseif or(typeof(mtlb_instr)==["funcall","cste","operation","variable"]) then + [converted_instr]=expression2sci(mtlb_instr) + elseif typeof(mtlb_instr)=="comment" then + [converted_instr]=mtlb_instr + + else + error(gettext("unknown instruction type %s."),typeof(mtlb_instr)) + end + +endfunction diff --git a/modules/m2sci/macros/kernel/is_a_scalar.bin b/modules/m2sci/macros/kernel/is_a_scalar.bin new file mode 100755 index 000000000..d18b829bd Binary files /dev/null and b/modules/m2sci/macros/kernel/is_a_scalar.bin differ diff --git a/modules/m2sci/macros/kernel/is_a_scalar.sci b/modules/m2sci/macros/kernel/is_a_scalar.sci new file mode 100755 index 000000000..5ad16a005 --- /dev/null +++ b/modules/m2sci/macros/kernel/is_a_scalar.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function r=is_a_scalar(A) + // M2SCI function + // Checks if all dimensions of A are 1 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A is a scalar) + + n=size(A.dims) + r=%T + for k=1:n + if A.dims(k)<>1 then + r=%F + return + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/is_a_vector.bin b/modules/m2sci/macros/kernel/is_a_vector.bin new file mode 100755 index 000000000..dcae3cbce Binary files /dev/null and b/modules/m2sci/macros/kernel/is_a_vector.bin differ diff --git a/modules/m2sci/macros/kernel/is_a_vector.sci b/modules/m2sci/macros/kernel/is_a_vector.sci new file mode 100755 index 000000000..3c4b01af6 --- /dev/null +++ b/modules/m2sci/macros/kernel/is_a_vector.sci @@ -0,0 +1,27 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function r=is_a_vector(A) + // M2SCI function + // Checks if all dimensions of A but one are 1 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A is a vector) + + nbones=0 + n=size(A.dims) + r=%F + for k=1:n + if A.dims(k)==1 then + nbones=nbones+1 + elseif A.dims(k)==-1 then + return + end + end + r=nbones==n-1 +endfunction diff --git a/modules/m2sci/macros/kernel/is_complex.bin b/modules/m2sci/macros/kernel/is_complex.bin new file mode 100755 index 000000000..81263e6cb Binary files /dev/null and b/modules/m2sci/macros/kernel/is_complex.bin differ diff --git a/modules/m2sci/macros/kernel/is_complex.sci b/modules/m2sci/macros/kernel/is_complex.sci new file mode 100755 index 000000000..5c804ed89 --- /dev/null +++ b/modules/m2sci/macros/kernel/is_complex.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function r=is_complex(A) + // M2SCI function + // Checks if A is complex + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A is complex) + + r=A.property==Complex +endfunction + diff --git a/modules/m2sci/macros/kernel/is_empty.bin b/modules/m2sci/macros/kernel/is_empty.bin new file mode 100755 index 000000000..d19743406 Binary files /dev/null and b/modules/m2sci/macros/kernel/is_empty.bin differ diff --git a/modules/m2sci/macros/kernel/is_empty.sci b/modules/m2sci/macros/kernel/is_empty.sci new file mode 100755 index 000000000..5f605e37f --- /dev/null +++ b/modules/m2sci/macros/kernel/is_empty.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function r=is_empty(A) + // M2SCI function + // Checks if all A dimension are 0 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A is an empty matrix) + + n=size(A.dims) + nb=0 + for k=1:n + if A.dims(k)==0 then + nb=nb+1 + end + end + + r=nb==n +endfunction diff --git a/modules/m2sci/macros/kernel/is_real.bin b/modules/m2sci/macros/kernel/is_real.bin new file mode 100755 index 000000000..809de4d86 Binary files /dev/null and b/modules/m2sci/macros/kernel/is_real.bin differ diff --git a/modules/m2sci/macros/kernel/is_real.sci b/modules/m2sci/macros/kernel/is_real.sci new file mode 100755 index 000000000..8edb3c84f --- /dev/null +++ b/modules/m2sci/macros/kernel/is_real.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function r=is_real(A) + // M2SCI function + // Checks if A real + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A is real) + + r=A.type.property==Real +endfunction + diff --git a/modules/m2sci/macros/kernel/isacomment.bin b/modules/m2sci/macros/kernel/isacomment.bin new file mode 100755 index 000000000..d44b0aeb4 Binary files /dev/null and b/modules/m2sci/macros/kernel/isacomment.bin differ diff --git a/modules/m2sci/macros/kernel/isacomment.sci b/modules/m2sci/macros/kernel/isacomment.sci new file mode 100755 index 000000000..f70d1ea81 --- /dev/null +++ b/modules/m2sci/macros/kernel/isacomment.sci @@ -0,0 +1,45 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function k=isacomment(txt) + // Find if txt contains a Matlab comment + // If no return 0 + // If yes return the position of the beginning of the comment + + kc=strindex(txt,"%") + k=0 + if kc<>[] then + kq=strindex(txt,quote) + while %t then + qc=size(find(kq2 then + if (kq(qc-1)==kq(qc)-1) then // Found a '' sequence + qc=qc-2 + else + break + end + end + kk=kq(qc) + if execstr("prev = part(txt,kk-1)","errcatch")<>0 then pause,end;errclear(); + if or(prev==[" ",",",";","=","[","("]) then // qc points on a string beginning + kc(1)=[] + if kc==[] then break,end + else + k=kc(1) + break + end + end + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/isanmfile.bin b/modules/m2sci/macros/kernel/isanmfile.bin new file mode 100755 index 000000000..4aa97fe3c Binary files /dev/null and b/modules/m2sci/macros/kernel/isanmfile.bin differ diff --git a/modules/m2sci/macros/kernel/isanmfile.sci b/modules/m2sci/macros/kernel/isanmfile.sci new file mode 100755 index 000000000..baa6b5bcf --- /dev/null +++ b/modules/m2sci/macros/kernel/isanmfile.sci @@ -0,0 +1,46 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function r=isanmfile(nam) + + // Try to find if nam is the name of a M-file + r=%F + + // If a translation function exists + if exists("sci_"+nam)==1 then + r=%T + return + end + + // If this function is part of known untranslated functions + // Special case of untranslated function without arguments + if find(nam==["grid","hold","gca"])<>[] then + r=%T + return + end + + // If recursive mode, try to find M-file in user defined paths + if Recmode then + for k=1:size(Paths,"*") + [u,ierr]=file("open",Paths(k)+nam+".m","old") + if ierr==0 then + file("close",u) + r=%T + break + end + end + else + // Try to find file in working directory + [u,ierr]=file("open",file_path+nam+".m","old") + if ierr==0 then + file("close",u) + end + r=(ierr==0) + end +endfunction diff --git a/modules/m2sci/macros/kernel/isdefinedvar.bin b/modules/m2sci/macros/kernel/isdefinedvar.bin new file mode 100755 index 000000000..010ac9b22 Binary files /dev/null and b/modules/m2sci/macros/kernel/isdefinedvar.bin differ diff --git a/modules/m2sci/macros/kernel/isdefinedvar.sci b/modules/m2sci/macros/kernel/isdefinedvar.sci new file mode 100755 index 000000000..e0bdca09c --- /dev/null +++ b/modules/m2sci/macros/kernel/isdefinedvar.sci @@ -0,0 +1,65 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [boolval,index]=isdefinedvar(var) + // Verify if variable is defined in varslist + // Input: + // - var: a M2SCI tlist (funcall, operation...) or a character string (name) for special variables + // Special variables i, j, pi, eps, nargin, nargout + // Output: + // - boolval: + // %T if input tlist is a defined 'variable' (already found while converting M-file) + // %F if input is not a 'variable' or an uknown 'variable' + + // Global variable for M2SCI + global("varslist") + + // level is declared in m2sci.sci and modified in clause2sci.sci + level; + + boolval=%F + index=[] + + // If input is a string + if type(var)==10 then + if and(var<>["i","j","pi","eps","%nargin","%nargout"]) then + warning(msprintf(gettext("Bad use of isdefinedvar() with input: %s."),var)) + return + end + varname=var + else + // If input is not a 'variable', it can be a defined variable... + if typeof(var)=="variable" then + varname=var.name + elseif typeof(var)=="m2scivar" then + varname=var.matname + else + return + end + end + + // Compare with all existing variables varslist + levelsize=size(level,1) + i=0 + while i=pos then + r=strcnt<>0; + return + end + ksym=ksym+1; + psym=sym; // psym = previous symbol + sym=part(str,ksym); + if sym<>" " then break,end + end + + if strcnt<>0 then // If in a string + if sym==quote then + qcount=1 + while part(str,ksym+1)<>quote&ksym+1qcount then + strcnt=0 + sym=part(str,ksym) + end + end + elseif sym==quote then + // Check if transpose or beginning of a string + if abs(_str2code(psym))>=36&psym<>")"&psym<>"]"&psym<>"."&psym<>quote then // Not a transpose + strcnt=1 + elseif bcount<>0 then // Inside a matrix definition + if part(str,ksym-1)==" " then strcnt=1,end + end + elseif sym=="[" then + bcount=bcount+1 + elseif sym=="]" then + bcount=bcount-1 + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/lib b/modules/m2sci/macros/kernel/lib new file mode 100755 index 000000000..625e3229d Binary files /dev/null and b/modules/m2sci/macros/kernel/lib differ diff --git a/modules/m2sci/macros/kernel/lst_funcall.bin b/modules/m2sci/macros/kernel/lst_funcall.bin new file mode 100755 index 000000000..4e515f19e Binary files /dev/null and b/modules/m2sci/macros/kernel/lst_funcall.bin differ diff --git a/modules/m2sci/macros/kernel/lst_funcall.sci b/modules/m2sci/macros/kernel/lst_funcall.sci new file mode 100755 index 000000000..c02374d3a --- /dev/null +++ b/modules/m2sci/macros/kernel/lst_funcall.sci @@ -0,0 +1,234 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function funcallname=lst_funcall(fil,fnamvect) + // LST_FUNCALL function (used by "translatepaths" function) Creates a list of vectors. The first component of each vector is the name of a M-file (found in the Paths to translate), followed by the called functions by this file + // Output + // -funcallname : a list of vectors + // Input + // -fil : vector which contains all M-files names (path+name) found in the Paths + // -fnamvect : vector which contains all M-files names (just the name) found in the Paths + + quote="''"; + dquote=""""; + + k=strindex(fil,".") + ke=k($)-1 + // Function name + ksep=strindex(fil,sep) + fnam=part(fil,ksep($)+1:ke) // File name without extension + txt=mgetl(fil); + + kf=grep(txt,["function[","function "]) + + if isempty(kf) then + // Batch file + bval=%f + elseif size(kf,"*")==1 then + // Only one function defined + bval=%f + else + funcdecl=[] + for kk=kf + ind=strindex(txt(kk),["function[";"function "]) + if (ind + // - txt: Scilab equivalent function code (function declaration and varaibles initialisation) + // - crp: Scilab equivalent function code (function body) + + [lhs,rhs]=argn(0) + if rhs==1 then + error(gettext("Wrong number of inputs.")) + end + if rhs==2 then Recmode=%f,end + + lcount=1; + + // Level of clause indentation (used for getting temporary variables and for updating varslist) + // if there is not a clause then size of level = 1 and the value is 0 (level=0) + // add one size at level each time a new clause is found + // if just one clause then size of level = 2, the value of level(2) : the index of clause part for the first clause (1 for 'if' statements, 2 for first 'elseif' statements, 3 for first 'elseif' statements,...) + // if there are 2 clauses, then size of level = 3, the value of level(3) : the index of clause part for the second clause (1 for if statements, 2 for first elseif statements, 3 for second elseif statements,...) + // for example : level = [0,4,1] : in this case there are 2 clauses the index for the first clause (i.e level(2)) is 4 (4 for second 'elseif' statements), the index for the second clause (i.e level(3)) is 1 (1 for 'if' statements) + // the first components of level (i.e level(1)) is always 0 (because in the zero level there is no clause, so there is no 'if' no 'elseif' no 'else') + level=0 + + // Parameters declaration + sciparam() + + // Scilab variable types + Double=1; + Boolean=4; // Boolean type can also be 6 + Sparse=5; + Int=8; + Handle=9; + String=10; + Cell=17; + Struct=16; + Void=0; + Unknown=-1; // Unknown type or dimension + SupToOne=-2; // Dimension >1 + NotNull=-3; // Dimension >0 + Complex=1 //"Complex" + Real=0 //"Real" + Units=["pixels","centimeters","points","inches","normalized"] + + global %graphics + %graphics=struct() + %graphics.type=Double + %graphics.units="pixels" + + // Translated function input arguments + macrhs=size(mtlbtree.inputs) + global("varslist") + varslist=list() + for k=1:macrhs + if funptr(mtlbtree.inputs(k).name)<>0 then // Matlab variable name corresponding to a Scilab function name + varslist($+1)=M2scivar("%"+mtlbtree.inputs(k).name,mtlbtree.inputs(k).name,Infer()) + mtlbtree.inputs(k).name="%"+mtlbtree.inputs(k).name, + elseif mtlbtree.inputs(k).name=="varargin" then + varslist($+1)=M2scivar("varargin","varargin",Infer(list(Unknown,Unknown),Type(Cell,Unknown))) + else + varslist($+1)=M2scivar(mtlbtree.inputs(k).name,mtlbtree.inputs(k).name,Infer()) + end + end + // Add predefined variables in the defined variables + varslist($+1)=M2scivar("%i","%i",Infer(list(1,1),Type(Double,Complex))) + varslist($+1)=M2scivar("%i","%j",Infer(list(1,1),Type(Double,Complex))) + varslist($+1)=M2scivar("%nan","NaN",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("%nan","nan",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("%inf","Inf",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("%inf","inf",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("$","end",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("%pi","pi",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("%eps","eps",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("varargout","%varargout",Infer(list(Unknown,Unknown),Type(Cell,Unknown))) + varslist($+1)=M2scivar("%shortcircuit","%shortcircuit",Infer(list(1,1),Type(Double,Real))) // Used for short circuiting operators + + // Translated function output arguments + maclhs=size(mtlbtree.outputs) + for k=1:maclhs + if funptr(mtlbtree.outputs(k).name)<>0 then + varslist($+1)=M2scivar("%"+mtlbtree.outputs(k).name,mtlbtree.outputs(k).name,Infer(list(0,0),Type(Double,Real))) + mtlbtree.outputs(k).name="%"+mtlbtree.outputs(k).name + else + varslist($+1)=M2scivar(mtlbtree.outputs(k).name,mtlbtree.outputs(k).name,Infer(list(0,0),Type(Double,Real))) + end + end + + // Translation + [scitree,crp]=mtlbtree2sci(mtlbtree,prettyprintoutput) + + dcl=[] + // Add special code + // If nargin or nargout function is used + if isdefinedvar("%nargin") | isdefinedvar("%nargout") then + dcl=["";gettext("// Number of arguments in function call");"[%nargout,%nargin] = argn(0)"] + end + + // Set display mode equivalent to Matlab echo off + dcl=[dcl;"";gettext("// Display mode");"mode(0);"] + // Set flotting point exception mode + dcl=[dcl;"";gettext("// Display warning for floating point exception");"ieee(1);"] + + // Initial value of lhs arguments + // If they are not initialized by input value, they are initialized with [] + ini=[] + for k=1:size(mtlbtree.outputs) + found=%F + for l=1:size(mtlbtree.inputs) + if mtlbtree.inputs(l).name==mtlbtree.outputs(k).name then + found=%T + end + end + if ~found then + if mtlbtree.outputs(k).name<>"varargout" then + ini=[ini;mtlbtree.outputs(k).name+"=[];"] + else + ini=[ini;mtlbtree.outputs(k).name+"=list();"] + end + end + end + + // Graphics init + //graph_ini=[gettext("// Graphics initialisation");"global %graphics";"%graphics.type=1";"%graphics.units=""pixels"""]; + graph_ini=[] + if ini<>[] then + ini=["";gettext("// Output variables initialisation (not found in input variables)");ini] + end + //ini=[ini;" ";graph_ini] + + // Info on macros variables + if verbose_mode<0 then + write(%io(2),gettext("TESTING M2SCI: creating varslist file...")) + n=size(varslist) + info=[] + + for k=1:n + info=[info;"//"+varslist(k).sciname+infer2txt(varslist(k).infer)]; + end + infofilename=res_path+nam+"_varslist.dia.ref"; + if verbose_mode==-2 then + write(%io(2),info) + end + infofile=mopen(infofilename,"w"); + mputl(info,infofile); + mclose(infofile); + end + + // Add function header + if ~batch then + rhsexpr="(" + for k=1:macrhs + rhsexpr=rhsexpr+varslist(k).sciname + if ksize(mtlbtree.outputs) then + hdr=hdr+"," + end + end + hdr=hdr+"] = "+nam+rhsexpr; + txt=[hdr;ini;dcl] + else + txt=[ini;dcl] + end + + // Generate associated translation function + if batch then + trad=[ + "function [tree] = sci_"+fnam+"(tree)" + msprintf(gettext("// Generated by M2SCI\n// Conversion function for Matlab %s\n// Input: tree = Matlab funcall tree\n// Output: tree = Scilab equivalent for tree"),fnam) + "" + "tree=Funcall(""exec"",1,Rhs_tlist(tree.name),tree.lhs)" + ] + else + trad=[ + "function [tree] = sci_"+nam+"(tree)" + msprintf(gettext("// Copyright INRIA (Generated by M2SCI)\n// Conversion function for Matlab %s()\n// Input: tree = Matlab funcall tree\n// Output: tree = Scilab equivalent for tree"),nam) + ] + + if maclhs==0 then // Function with no outputs + // Do nothing + elseif maclhs==1 then // Function with one output + [boolval,index]=isdefinedvar(M2scivar(mtlbtree.outputs(1).name,strsubst(mtlbtree.outputs(1).name,"%",""),Infer())) + if boolval then + dims=sci2exp(varslist(index).dims) + vtype=varslist(index).vtype + prop=varslist(index).property + else + dims="list(Unknown,Unknown)" + vtype=Unknown + prop=Unknown + end + + select vtype + case Double then vtype="Double" + case Boolean then vtype="Boolean" + case String then vtype="String" + case Struct then vtype="Struct" + case Cell then vtype="Cell" + case Unknown then vtype="Unknown" + case Sparse then vtype="Sparse" + end + + select prop + case -1 then prop="Unknown" + case 0 then prop="Real" + case 1 then prop="Complex" + end + + typ="Type("+vtype+","+prop+")" + + if mtlbtree.outputs($).name<>"varargout" then + trad=[trad;"tree.lhs(1).dims="+dims;"tree.lhs(1).type="+typ] + else + trad=[trad; + "for k=1:lhs" + " tree.lhs(k).dims=list(Unknown,Unknown)" + " tree.lhs(k).vtype=Unknown" + " tree.lhs(k).property=Unknown" + "end" + ] + end + else // Function with more than 1 output + dims=list(); + vtype=[]; + prop=[] + for k=1:maclhs + [boolval,index]=isdefinedvar(M2scivar(mtlbtree.outputs(k).name,strsubst(mtlbtree.outputs(k).name,"%",""),Infer())) + if boolval then + dims(k)=varslist(index).dims + vtype=[vtype;varslist(index).vtype] + prop=[prop;varslist(index).property] + else + dims(k)=list(Unknown,Unknown) + vtype=[vtype;Unknown] + prop=[prop;Unknown] + end + end + + dimstemp=sci2exp(dims) + dims=["dims="+dimstemp(1);dimstemp(2:$)] + vtype="vtype="+sci2exp(vtype) + prop="prop="+sci2exp(prop) + trad=[trad; + gettext("// dims(i,:) is the ith output argument dimensions vector") + dims + gettext("// dims(i,:) is the ith output argument dimensions vector") + vtype + gettext("// prop(i) is the ith output argument property") + prop] + if mtlbtree.outputs($).name<>"varargout" then + trad=[trad; + "for k=1:lhs" + " tree.lhs(k).dims=dims(k)" + " tree.lhs(k).vtype=vtype(k)" + " tree.lhs(k).property=prop(k)" + "end" + ] + else + trad=[trad; + "for k=1:min(lstsize(dims),lhs)" + " tree.lhs(k).dims=dims(k)" + " tree.lhs(k).vtype=vtype(k)" + " tree.lhs(k).property=prop(k)" + "end" + gettext("// Inference for varargout") + "for k=min(lstsize(dims),lhs)+1:lhs" + " tree.lhs(k).dims=list(Unknown,Unknown)" + " tree.lhs(k).vtype=Unknown" + " tree.lhs(k).property=Unknown" + "end" + ] + end + end + end + trad=[trad;"endfunction"] + clearglobal varslist + clearglobal %graphics +endfunction diff --git a/modules/m2sci/macros/kernel/m2sci_info.bin b/modules/m2sci/macros/kernel/m2sci_info.bin new file mode 100755 index 000000000..3c8c33632 Binary files /dev/null and b/modules/m2sci/macros/kernel/m2sci_info.bin differ diff --git a/modules/m2sci/macros/kernel/m2sci_info.sci b/modules/m2sci/macros/kernel/m2sci_info.sci new file mode 100755 index 000000000..e27fadc56 --- /dev/null +++ b/modules/m2sci/macros/kernel/m2sci_info.sci @@ -0,0 +1,45 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function m2sci_info(txt,verb_mode) + // verb_mode=0: no information displayed + // verb_mode=1: information written as comment is resulting SCI-file + // verb_mode=2: information written as comment is resulting SCI-file and in logfile + // verb_mode=3: information written as comment is resulting SCI-file, in logfile and displayed in Scilab window + // verb_mode=-1: information written in logfile and displayed in Scilab window (should not be used by user) (TEST MODE) + // verb_mode=-2: information written in logfile and displayed in Scilab window (should not be used by user) and varslist displayed in Scilab command window (DEBUG MODE) + + + + if verb_mode==0 then + return + end + + if verb_mode>0 then + if exists("m2sci_to_insert_b")==0 then + write(%io(2),gettext("loginfos: verb_mode 0 should not be used in this context, information ignored.")); + return + end + global("m2sci_to_insert_b") + for k=1:size(txt,"*") + m2sci_to_insert_b($+1)=Equal(.. + list(Variable("ans",Infer())),.. + Funcall("%comment",1,list(Cste(" "+txt(k))),list(Variable("",Infer())))) + m2sci_to_insert_b($+1)=list("EOL"); + end + end + + if verb_mode>1 | verb_mode==-1 then + write(logfile,margin+txt); // margin is defined in mfile2sci() + end + + if verb_mode>2 | verb_mode==-1 then + mprintf("%s\n",strsubst(strsubst(margin+txt, "%i", "%%i"),"%n","%%n")); // margin is defined in mfile2sci() + end +endfunction diff --git a/modules/m2sci/macros/kernel/m2sci_syntax.bin b/modules/m2sci/macros/kernel/m2sci_syntax.bin new file mode 100755 index 000000000..e517dd610 Binary files /dev/null and b/modules/m2sci/macros/kernel/m2sci_syntax.bin differ diff --git a/modules/m2sci/macros/kernel/m2sci_syntax.sci b/modules/m2sci/macros/kernel/m2sci_syntax.sci new file mode 100755 index 000000000..d9f5aca6f --- /dev/null +++ b/modules/m2sci/macros/kernel/m2sci_syntax.sci @@ -0,0 +1,455 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [helppart,txt,batch]=m2sci_syntax(txt) + // Make minor changes on M-file data syntax to have it readable by Scilab + // Input arguments: + // - txt: the contents of an M-file + // Output: + // - helppart: Matlab help contained in M-file + // - txt: input txt modified (If M-file contains only comments returned txt is[]) + // - batch: boolean flag indicates if it is a batch file + + // m2sci kernel functions called : + // - isacomment + // - isinstring + // - replace_brackets + + sciparam(); + quote="''" + dquote="""" + ctm="."+"."+"." // Continuation mark + batch=%t + + k=0 + first_ncl=[] + while k[] then + kc=isacomment(tk) + if kc<>0 then // Current line has or is a comment + // If function prototype immediately followed by a comment on same line + if stripblanks(part(tk,eolind(1):kc))<>"" then + txt=[txt(1:k-1);part(tk,1:eolind(1)-1);part(tk,eolind(1)+1:length(tk));txt(k+1:size(txt,"*"))] + tk=part(tk,1:eolind(1)-1) + end + elseif stripblanks(part(tk,eolind(1)+1:length(tk)))<>"" then + txt=[txt(1:k-1);part(tk,1:eolind(1)-1);part(tk,eolind(1)+1:length(tk));txt(k+1:size(txt,"*"))] + tk=part(tk,1:eolind(1)-1) + end + end + end + end + + // Number of lines in txt (i.e. in M-file) + n=size(txt,"r") + eoltoinsert=0 + firstctm=[] + k=0 + while k0 then // Line has a comment + if kc10 then + if part(stripblanks(txt(k)),1)=="}" then + txt(k-1)=txt(k-1)+txt(k); + txt(k)=""; + end + end + end + + // Change comments and get help part in input txt + n=size(txt,"r") + first=%t + helppart=[],endofhelp=%f + + for k=1:n + tk=txt(k) + + // ifthenelse expression like if (x==1)t=2 becomes if (x==1) t=2 + // Add a blank between parenthesize expression and the first instruction + kif=strindex(tk,"if") + if kif<>[] then + kcom=isacomment(tk) + for i=1:size(kif,"*") + if kif(i)>kcom & kcom<>0 then + break + else + if (kif(i)>1 & or(stripblanks(part(tk,kif(i)-1:kif(i)+2))==["if(","if"])) | (kif(i)==1 & or(stripblanks(part(tk,kif(i):kif(i)+2))==["if(","if"])) + m=min(strindex(tk,"(")) + if m<>[] then + for l=1:size(m,"*") + if m(l)>=kif(i)+2 + if stripblanks(part(tk,kif(i)+2:m(l)))=="(" then + openpar=1 + mtemp=m(l)+1 + while openpar<>0 + if or(part(tk,mtemp)=="(") then + openpar=openpar+1 + elseif or(part(tk,mtemp)==")") then + openpar=openpar-1 + end + mtemp=mtemp+1 + end + tk=part(tk,1:mtemp-1)+" "+part(tk,mtemp:length(tk)) + break + end + end + end + end + end + end + end + end + + // Insert a blank when a digit is followed by a dotted operator + // So that point is associated to operator and not to digit + // Because if it is associated to digit, dot is suppressed by comp() + kdot=strindex(tk,[".*","./",".\",".^",".''"]) + if kdot<>[] then + kdgt=kdot(find(abs(_str2code(part(tk,kdot-1)))<9)) + for kk=size(kdgt,"*"):-1:1 + tk=part(tk,1:kdgt(kk)-1)+" "+part(tk,kdgt(kk):length(tk)); + end + end + + // Modify struct like x.(fieldname) which become x(fieldname) + tk=strsubst(tk,".(","(") + + // Parenthesize calls to pause when pause on or pause off + kpause=strindex(tk,"pause") + kpsav=length(tk) // kpsave is kp value for l-1 index + for l=size(kpause,"*"):-1:1 + kp=kpause(l) + kon=strindex(tk,"on") + kon=kon(find((kon>kp)&(kon[] then + for l=kp+5:kon-1 + if part(tk,l)<>" " then + break + end + end + tk=part(tk,1:kp+4)+"(''on'')"+part(tk,kon+2:length(tk)) + end + koff=strindex(tk,"off") + koff=koff(find((koff>kp)&(koff[] then + for l=kp+5:koff-1 + if part(tk,l)<>" " then + break + end + end + tk=part(tk,1:kp+4)+"(''off'')"+part(tk,koff+3:length(tk)) + end + kpsav=kp + end + + // Convert @fhandle to 'fhandle' (cf feval) + symbs=[" ",",",";","=",")","]"] + kpunct=strindex(tk,"@") + kcom=isacomment(tk) + if kcom<>0 then + kpunct=kpunct(kpunct[] then + for l=size(kpunct,"*"):-1:1 + if ~isinstring(tk,kpunct(l)) then + kk=gsort(strindex(tk,symbs),"r","i") + kk=kk(find(kk>kpunct(l))) + if kk==[] then + kk=length(tk) + tk=part(tk,1:kpunct(l)-1)+quote+part(tk,kpunct(l)+1:kk)+quote + else + kk=kk(1) + tk=part(tk,1:kpunct(l)-1)+quote+part(tk,kpunct(l)+1:kk-1)+quote+part(tk,kk:length(tk)) + end + end + end + end + + // Looking for comments + kc=isacomment(tk) + if kc<>0 then // Current line has or is a comment + // If function prototype immediately followed by a comment on same line + if part(stripblanks(tk),1:9) == "function " | part(stripblanks(tk),1:9) == "function[" then + first_ncl=k + end + com=part(tk,kc+1:length(tk)) + if stripblanks(part(tk,1:kc-1))<>"" & ~(stripblanks(part(tk,1:9))=="function " | stripblanks(part(tk,1:9))=="function[") then endofhelp=%t;end + if ~endofhelp & part(tk,1:9) ~= "function " then helppart=[helppart;com];end // Get help part placed at the beginning of the file + if length(com)==0 then com=" ",end + com=strsubst(com,quote,quote+quote) + com=strsubst(com,dquote,dquote+dquote) + if part(com,1:12)=="m2sciassume " | part(com,1:13)=="m2scideclare " then // User has given a clue to help translation + if part(com,1:12)=="m2sciassume " then + warning(gettext("m2sciassume is obsolete, used m2scideclare instead.")); + end + com=";m2scideclare("+quote+part(com,13:length(com))+quote+")" + else + com=";//"+com + end + tkbeg=part(tk,1:kc-1) + + // Short circuiting operators + if ~isempty(strindex(tkbeg,"||")) then + orexpr=tokens(tkbeg,"|") + boolendsymbol=%f + orexprtemp=orexpr($) + indendsymbol=strindex(orexpr($),[";",","]) + if indendsymbol<>[] then + if stripblanks(part(orexpr($),indendsymbol($)+1:length(orexpr($))))=="" then + boolendsymbol=%t + endsymbol=part(orexprtemp,indendsymbol($)) + indendsymbol=indendsymbol($) + orexpr($)=part(orexpr($),1:indendsymbol($)-1) + end + end + for i=2:size(orexpr,"*") + notsymbol=strindex(stripblanks(orexpr(i)),"~") + if notsymbol<>[] + if notsymbol(1)==1 then + orexpr(i)="("+ stripblanks(orexpr(i)) + ")" + end + end + end + for kk=2:2:size(orexpr,"*") + orexpr=[orexpr(1:kk);"%shortcircuit";orexpr(kk+1:size(orexpr,"*"))] + end + tkbeg=strcat(orexpr,"|") + if boolendsymbol then + tkbeg=tkbeg+endsymbol + end + end + if ~isempty(strindex(tkbeg,"&&")) then + andexpr=tokens(tkbeg,"&") + boolendsymbol=%f + andexprtemp=andexpr($) + indendsymbol=strindex(andexpr($),[";",","]) + if indendsymbol<>[] then + if stripblanks(part(andexpr($),indendsymbol($)+1:length(andexpr($))))=="" then + boolendsymbol=%t + endsymbol=part(andexprtemp,indendsymbol($)) + indendsymbol=indendsymbol($) + andexpr($)=part(andexpr($),1:indendsymbol($)-1) + end + end + for i=2:size(andexpr,"*") + notsymbol=strindex(stripblanks(andexpr(i)),"~") + if notsymbol<>[] + if notsymbol(1)==1 then + andexpr(i)="("+ stripblanks(andexpr(i)) + ")" + end + end + end + for kk=2:2:size(andexpr,"*") + andexpr=[andexpr(1:kk);"%shortcircuit";andexpr(kk+1:size(andexpr,"*"))] + end + tkbeg=strcat(andexpr,"&") + if boolendsymbol then + tkbeg=tkbeg+endsymbol + end + end + + // varargout replaced by %varargout so that code can be compiled with varargout considered as a Cell + if isempty(strindex(tkbeg,"function")) then + tkbeg=strsubst(tkbeg,"varargout","%varargout") + end + + txt(k)=tkbeg+com + else // Current line has not and is not a comment line + if first then // Function keyword not yet found + tk=stripblanks(tk) + if tk<>"" then // Current line is not a blank line + if ~(part(tk,1:9) == "function "| part(tk,1:9) == "function[") then + endofhelp=%t; + txt(k)=tk; // VC 01/04/2003 + else + first_ncl=k + first=%f + end + else + if ~endofhelp then helppart=[helppart;" "],end + txt(k)="// " + end + else // Current line is a line after function keyword + endofhelp=%t + txt(k)=tk + end + + // Short circuiting operators + if ~isempty(strindex(tk,"||")) then + orexpr=tokens(tk,"|") + indendsymbol=strindex(orexpr($),[";",","]) + boolendsymbol=%f + if indendsymbol<>[] then + if stripblanks(part(orexpr($),indendsymbol($)+1:length(orexpr($))))=="" then + boolendsymbol=%t + indendsymbol=indendsymbol($) + endsymbol=part(orexpr($),indendsymbol($)) + orexpr($)=part(orexpr($),1:indendsymbol($)-1) + end + end + for i=2:size(orexpr,"*") + notsymbol=strindex(stripblanks(orexpr(i)),"~") + if notsymbol<>[] + if notsymbol(1)==1 then + orexpr(i)="("+ stripblanks(orexpr(i)) + ")" + end + end + end + for kk=2:2:size(orexpr,"*") + orexpr=[orexpr(1:kk);"%shortcircuit";orexpr(kk+1:size(orexpr,"*"))] + end + tk=strcat(orexpr,"|") + if boolendsymbol then + tk=tk+endsymbol + end + end + if ~isempty(strindex(tk,"&&")) then + andexpr=tokens(tk,"&") + boolendsymbol=%f + andexprtemp=andexpr($) + indendsymbol=strindex(andexpr($),[";",","]) + if indendsymbol<>[] then + if stripblanks(part(andexpr($),indendsymbol($)+1:length(andexpr($))))=="" then + boolendsymbol=%t + endsymbol=part(andexprtemp,indendsymbol($)) + indendsymbol=indendsymbol($) + andexpr($)=part(andexpr($),1:indendsymbol($)-1) + end + end + for i=2:size(andexpr,"*") + notsymbol=strindex(stripblanks(andexpr(i)),"~") + if notsymbol<>[] + if notsymbol(1)==1 then + andexpr(i)="("+ stripblanks(andexpr(i)) + ")" + end + end + end + for kk=2:2:size(andexpr,"*") + andexpr=[andexpr(1:kk);"%shortcircuit";andexpr(kk+1:size(andexpr,"*"))] + end + tk=strcat(andexpr,"&") + if boolendsymbol then + tk=tk+endsymbol + end + end + + // varargout replaced by %varargout so that code can be compiled with varargout considered as a Cell + if isempty(strindex(tk,"function")) then + tk=strsubst(tk,"varargout","%varargout") + end + + txt(k)=tk + end + end + + // When there is just help line in txt + if ~endofhelp then + txt=[] + return + end + + // Syntax modification + + // Complex variable + txt=i_notation(txt) + + // Replace double quotes + txt=strsubst(txt,dquote,dquote+dquote) + + // Replace switch by select + txt=strsubst(txt,"switch ","select ") + txt=strsubst(txt,"switch(","select (") + + // Replace otherwise by else + txt=strsubst(txt,"otherwise","else") + + // Replace {..} by (..) or [..] : useful for cells translation + txt=replace_brackets(txt) + + // Place function definition line at first line + kc=strindex(txt(first_ncl),"function") + if kc==[] then + // Batch file + txt=["function []="+fnam+"()";txt] // fnam is defined in mfile2sci() + batch=%t + else + kc=kc(1) + batch=%f + if first_ncl<>1 then + while strindex(txt(first_ncl($)+1),ctm)<>[] then + first_ncl=[first_ncl,first_ncl($)+1] + end + txt=[txt(first_ncl);txt(1:first_ncl(1)-1);txt(first_ncl($)+1:$)] + end + // Beginning of BUG 2341 fix: function prototype with no comma between output parameters names + begb=strindex(txt(1),"["); + endb=strindex(txt(1),"]"); + if ~isempty(begb) & ~isempty(endb) + outputparams = stripblanks(part(txt(1),(begb+1):(endb-1)))+" "; + k=0; + while k[","," "])) & (k",") & (k[] then + mtlbpath=tb(k,2) + ismtlb=%t + end +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/kernel/mtlbtree2sci.bin b/modules/m2sci/macros/kernel/mtlbtree2sci.bin new file mode 100755 index 000000000..02fd232a1 Binary files /dev/null and b/modules/m2sci/macros/kernel/mtlbtree2sci.bin differ diff --git a/modules/m2sci/macros/kernel/mtlbtree2sci.sci b/modules/m2sci/macros/kernel/mtlbtree2sci.sci new file mode 100755 index 000000000..4748eecc9 --- /dev/null +++ b/modules/m2sci/macros/kernel/mtlbtree2sci.sci @@ -0,0 +1,125 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [scitree,crp]=mtlbtree2sci(mtlbtree,prettyprintoutput) + // Conversion of a Matlab function tree to Scilab (and code generation) + // Input arguments: + // - mtlbtree: tree (returned by macr2tree) representing Matlab function compiled code + // - prettyprintoutput: boolean flag for pretty printed output file if TRUE + // Output arguments: + // - scitree: Scilab equivalent for mtlbtree + // - crp: Scilab equivalent function code (function body) + + // Global variables for M2SCI + global("m2sci_to_insert_b") // To insert before current instruction + global("m2sci_to_insert_a") // To insert after current instruction + global("tmpvarnb") // Index for temporary variables + m2sci_to_insert_b=list() + m2sci_to_insert_a=list() + tmpvarnb=0 + + if typeof(mtlbtree)<>"program" then + error(gettext("wrong type of input.")) + end + + // Init Scilab tree + scitree=tlist(["program","name","outputs","inputs","statements"],mtlbtree.name,mtlbtree.outputs,mtlbtree.inputs,list()) + + ninstr=1 // Index of Matlab tree + if batch then // defined in m2sci.sci + nblines=0 + else + nblines=1 // Number of converted lines + end + + m2sci_info(gettext("Conversion of M-tree..."),-1); + + // Default value + rhs = argn(2); + if rhs<2 then + prettyprintoutput=%F + end + + crp="" + + // Function prototype + lhsstr=[] + rhsstr=[] + if scitree.name<>"" then // Not a batch file + for k=1:size(scitree.outputs) + lhsstr=[lhsstr,expression2code(scitree.outputs(k))] + end + lhsstr="["+strcat(lhsstr,",")+"]" + + for k=1:size(scitree.inputs) + rhsstr=[rhsstr,expression2code(scitree.inputs(k))] + end + rhsstr="("+strcat(rhsstr,",")+")" + + crp=lhsstr+" = "+scitree.name+rhsstr; + end + + // Convert Matlab instruction tree to Scilab + while ninstr<=size(mtlbtree.statements)-3 + //Case : sup_equal instruction + // Add converted tree to scitree and also inserted instructions + if typeof(mtlbtree.statements(ninstr))=="sup_equal" + + sci_stat=list() + for i=1:size(mtlbtree.statements(ninstr).sup_instr) + [converted_tree,nblines]=instruction2sci(mtlbtree.statements(ninstr).sup_instr(i),nblines) + + sci_stat=update_instr_list(sci_stat,converted_tree) + end + + scitree.statements($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_stat,mtlbtree.statements(ninstr).nb_opr) + else + + [converted_tree,nblines]=instruction2sci(mtlbtree.statements(ninstr),nblines) + + // Add converted tree to scitree and also inserted instructions + + scitree.statements=update_instr_list(scitree.statements,converted_tree) + + // Generate code corresponding to scitree.statements + end + for k=1:size(scitree.statements) + if klist("EOL") then + crp = cat_code(crp,instruction2code(scitree.statements(1),prettyprintoutput)); + crp = format_txt(crp,scitree.statements(1),prettyprintoutput,list("EOL")); + end + + if scitree.name<>"" then // Not a batch file + crp=cat_code(crp,""); + crp=cat_code(crp,"endfunction"); // Replace last return + crp=cat_code(crp,""); + end + + m2sci_info(gettext("Conversion of M-tree: Done"),-1); + + + clearglobal("m2sci_to_insert_b") + clearglobal("m2sci_to_insert_a") + clearglobal("tmpvarnb") + +endfunction diff --git a/modules/m2sci/macros/kernel/multi_fun_file.bin b/modules/m2sci/macros/kernel/multi_fun_file.bin new file mode 100755 index 000000000..a2e3c915d Binary files /dev/null and b/modules/m2sci/macros/kernel/multi_fun_file.bin differ diff --git a/modules/m2sci/macros/kernel/multi_fun_file.sci b/modules/m2sci/macros/kernel/multi_fun_file.sci new file mode 100755 index 000000000..7e427e098 --- /dev/null +++ b/modules/m2sci/macros/kernel/multi_fun_file.sci @@ -0,0 +1,174 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function bval=multi_fun_file(fil,res_path,Recmode,only_double,verbose_mode,prettyprintoutput) + // This function converts M-Files containing more than one functio + // Inputs are the same as mfile2sci() + // Outputs : + // - bval: boolean value, %t if file contains more than on function, %f else + + sciparam(); + + // File name + k=strindex(fil,".") + if k<>[] + ke=k($)-1 + base_name=part(fil,1:ke) + else + ke=length(fil) + base_name=fil + end + // File path + k=strindex(fil,"/") + if k==[] then + file_path="./" + else + file_path=part(fil,1:k($)) + end + base_name=part(base_name,k($)+1:ke) + + txt=mgetl(fil); + + kf=grep(txt,["function[","function "]) + + if isempty(kf) then + // Batch file + bval=%f + elseif size(kf,"*")==1 then + // Only one function defined + bval=%f + else + funcdecl=[] + for kk=kf + ind=strindex(txt(kk),["function[";"function "]) + if isacomment(txt(kk))==0 & ~isinstring(txt(kk),ind) & part(stripblanks(txt(kk),%T),1:8)=="function" then // function prototype + funcdecl=[funcdecl kk] + end + end + + if isempty(funcdecl) then + // "function" only exists in comments and strings + bval=%f + return + elseif size(funcdecl,"*")==1 then + bval=%f + return + end + + // Verify if the directory exists + dirnam = ls(pathconvert(TMPDIR)+base_name); + + sep = filesep(); + + if or(dirnam<>"") then + rmdir(pathconvert(TMPDIR)+base_name,"s") + end + mkdir(pathconvert(TMPDIR),base_name) + write(%io(2),msprintf(gettext(" -- File %s contains more than one function -- "),fil)); + + bval= %t + + // First split file into as many files as function declared + funcdecl=[funcdecl size(txt,"*")+1] + + tmpfiles=[] + for k=1:size(funcdecl,"*")-1 + functxt=txt(funcdecl(k):funcdecl(k+1)-1) + str= strindex(txt(funcdecl(k)),"(")-1 + if str==-1 then + funcname=stripblanks(part(txt(funcdecl(k)),strindex(txt(funcdecl(k)),["function[","function "])+8:length(txt(funcdecl(k))))) + else + funcname=stripblanks(part(txt(funcdecl(k)),strindex(txt(funcdecl(k)),["function[","function "])+8:str(1))) + end + + keq=strindex(funcname,"=") + if ~isempty(keq) then + funcname=stripblanks(part(funcname,keq+1:length(funcname))) + end + tmpfiles=[tmpfiles;funcname] + mputl(functxt,pathconvert(TMPDIR)+base_name+sep+tmpfiles($)+".m"); + end + + write(%io(2),msprintf(gettext(" -- Each function converted separately: %s -- "),strcat(tmpfiles," "))); + write(%io(2),msprintf(gettext(" -- Temporary files put in: %s -- "),pathconvert(TMPDIR))); + + // Conversion of each file + + for k=1:size(tmpfiles,"*") + txt=mgetl(pathconvert(TMPDIR)+base_name+sep+tmpfiles(k)+".m") + //mfile2sci(pathconvert(TMPDIR)+tmpfiles(k)+".m",res_path,Recmode,only_double,verbose_mode,prettyprintoutput) + end + + translatepaths(pathconvert(TMPDIR)+base_name,pathconvert(TMPDIR)+base_name) + + txt=[] + if isfile(pathconvert(TMPDIR)+base_name+sep+"log") then + txt=mgetl(pathconvert(TMPDIR)+base_name+sep+"log") + end + mputl(txt,res_path+"log"); + if isfile(pathconvert(TMPDIR)+base_name+sep+"resumelog") then + txt=mgetl(pathconvert(TMPDIR)+base_name+sep+"resumelog") + end + mputl(txt,res_path+"resumelog"); + + // Catenation of all .sci files to have only one output file + txt=[] + for k=1:size(tmpfiles,"*") + txt=[txt ;"";mgetl(pathconvert(TMPDIR)+base_name+sep+tmpfiles(k)+".sci")] + end + + // Delete useless .sci files + //for k=1:size(tmpfiles,"*") + //mdelete(res_path+tmpfiles(k)+".sci") + //end + + mputl(txt,res_path+base_name+".sci"); + + // Catenation of all .log files to have only one output file + //if exists("logfile")==0 then + //txt=[] + //for k=1:size(tmpfiles,"*") + //txt=[txt ; mgetl(pathconvert(TMPDIR)+base_name+sep+"m2sci_"+tmpfiles(k)+".log")] + //end + + // Delete useless .log files + //for k=1:size(tmpfiles,"*") + //mdelete(pathconvert(TMPDIR)+base_name+sep+"m2sci_"+tmpfiles(k)+".log") + //end + + //mputl(txt,res_path+"m2sci_"+base_name+".log"); + //end + + // Catenation of all resume.log files to have only one output file + //if exists("resume_logfile")==0 then + //txt=[] + //for k=1:size(tmpfiles,"*") + //txt=[txt ; mgetl(res_path+"m2sci_"+tmpfiles(k)+"_resume.log")] + //end + + // Delete useless _resume.log files + //for k=1:size(tmpfiles,"*") + //mdelete(res_path+"m2sci_"+tmpfiles(k)+"_resume.log") + //end + + //mputl(txt,res_path+"m2sci_"+base_name+"_resume.log"); + //end + + // Delete useless .m files + //for k=1:size(tmpfiles,"*") + //mdelete(pathconvert(TMPDIR)+tmpfiles(k)+".m") + //end + + rmdir(pathconvert(TMPDIR)+base_name,"s") + for k=1:size(tmpfiles,"*") + mdelete(pathconvert(TMPDIR)+tmpfiles(k)+".tree") + end + end + +endfunction diff --git a/modules/m2sci/macros/kernel/names b/modules/m2sci/macros/kernel/names new file mode 100755 index 000000000..42ef173b6 --- /dev/null +++ b/modules/m2sci/macros/kernel/names @@ -0,0 +1,87 @@ +%contents_i_funcall +%contents_i_operatio +%contents_i_variable +%cste_e +%funcall_6 +%funcall_e +%infer_i_s +%infer_i_st +%l_i_cste +%l_i_funcall +%l_i_operatio +%l_i_variable +%m2scivar_e +%operatio_6 +%operatio_e +%s_i_operatio +%s_i_variable +%type_i_cste +%type_i_funcall +%type_i_operatio +%type_i_variable +%variable_6 +%variable_e +Contents +Cste +Equal +Funcall +Infer +M2scivar +Operation +Rhs_tlist +Type +Variable +allunknown +changevarname +clause2sci +convert2double +default_trad +equal2sci +expression2sci +first_non_singleton +funcall2sci +funcallsearch +get_unknown +getoperands +getrhs +gettempvar +getvar2sci +i_notation +infer2txt +insert +instruction2sci +is_a_scalar +is_a_vector +is_complex +is_empty +is_real +isacomment +isanmfile +isdefinedvar +isinstring +lst_funcall +m2sci +m2sci_info +m2sci_syntax +mfile_path +mtlbtoolfun +mtlbtree2sci +multi_fun_file +no_equiv +not_a_scalar +not_a_vector +not_empty +not_yet_converted +old2newinstr +operation2sci +repl_poss +replace_brackets +sci_generic +sci_m2scideclare +sciparam +set_infos +transformtree +translateorder +update_instr_list +updatevarslist +variablesearch diff --git a/modules/m2sci/macros/kernel/no_equiv.bin b/modules/m2sci/macros/kernel/no_equiv.bin new file mode 100755 index 000000000..099620776 Binary files /dev/null and b/modules/m2sci/macros/kernel/no_equiv.bin differ diff --git a/modules/m2sci/macros/kernel/no_equiv.sci b/modules/m2sci/macros/kernel/no_equiv.sci new file mode 100755 index 000000000..92995848c --- /dev/null +++ b/modules/m2sci/macros/kernel/no_equiv.sci @@ -0,0 +1,14 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function []=no_equiv(expr) + + set_infos(msprintf(gettext("No Scilab equivalent for: %s"),expr),2) + +endfunction diff --git a/modules/m2sci/macros/kernel/not_a_scalar.bin b/modules/m2sci/macros/kernel/not_a_scalar.bin new file mode 100755 index 000000000..8fd43d990 Binary files /dev/null and b/modules/m2sci/macros/kernel/not_a_scalar.bin differ diff --git a/modules/m2sci/macros/kernel/not_a_scalar.sci b/modules/m2sci/macros/kernel/not_a_scalar.sci new file mode 100755 index 000000000..e8411dff6 --- /dev/null +++ b/modules/m2sci/macros/kernel/not_a_scalar.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function r=not_a_scalar(A) + // M2SCI function + // Checks if at least one dimension of A is greater than 1 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A can not be a scalar) + + nb=0 + for k=1:size(A.dims) + if A.dims(k)>1 | A.dims(k)==SupToOne then + nb=nb+1 + end + end + + r=nb<>0 +endfunction diff --git a/modules/m2sci/macros/kernel/not_a_vector.bin b/modules/m2sci/macros/kernel/not_a_vector.bin new file mode 100755 index 000000000..d9d230146 Binary files /dev/null and b/modules/m2sci/macros/kernel/not_a_vector.bin differ diff --git a/modules/m2sci/macros/kernel/not_a_vector.sci b/modules/m2sci/macros/kernel/not_a_vector.sci new file mode 100755 index 000000000..c21b85a77 --- /dev/null +++ b/modules/m2sci/macros/kernel/not_a_vector.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function r=not_a_vector(A) + // M2SCI function + // Checks if at least two dimensions of A are greater than 1 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A can not be a vector) + + n=size(A.dims) + nb=0 + for k=1:n + if A.dims(k)>1 | A.dims(k)==SupToOne then + nb=nb+1 + end + end + + r=nb>=2 +endfunction diff --git a/modules/m2sci/macros/kernel/not_empty.bin b/modules/m2sci/macros/kernel/not_empty.bin new file mode 100755 index 000000000..1ac782240 Binary files /dev/null and b/modules/m2sci/macros/kernel/not_empty.bin differ diff --git a/modules/m2sci/macros/kernel/not_empty.sci b/modules/m2sci/macros/kernel/not_empty.sci new file mode 100755 index 000000000..bdb03e8e3 --- /dev/null +++ b/modules/m2sci/macros/kernel/not_empty.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function r=not_empty(A) + // M2SCI function + // Checks if no A dimension can be 0 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A can not be an empty matrix) + + n=size(A.dims) + nb=0 + for k=1:n + if A.dims(k)>0 | A.dims(k)==SupToOne | A.dims(k)==NotNull then + nb=nb+1 + end + end + + r=nb>0 +endfunction diff --git a/modules/m2sci/macros/kernel/not_yet_converted.bin b/modules/m2sci/macros/kernel/not_yet_converted.bin new file mode 100755 index 000000000..0701bd1fb Binary files /dev/null and b/modules/m2sci/macros/kernel/not_yet_converted.bin differ diff --git a/modules/m2sci/macros/kernel/not_yet_converted.sci b/modules/m2sci/macros/kernel/not_yet_converted.sci new file mode 100755 index 000000000..98ef7052f --- /dev/null +++ b/modules/m2sci/macros/kernel/not_yet_converted.sci @@ -0,0 +1,1337 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function allnames=not_yet_converted() + allnames=["abcdchk"; + "accumarray"; + "acosd"; + "acotd"; + "acscd"; + "actxproxy"; + "adddatadlg"; + "addpath"; + "addpref"; + "addsubplot"; + "addtodate"; + "airfoil"; + "airy"; + "align"; + "alim"; + "allchild"; + "alpha"; + "alphamap"; + "amp1dae"; + "ancestor"; + "and"; + "annotation"; + "anondemo"; + "ardemo"; + "area"; + "arith"; + "arpackc"; + "arrayviewfunc"; + "asecd"; + "asind"; + "assignin"; + "atand"; + "audiodevinfo"; + "audioplayerreg"; + "audiorecorderreg"; + "audiouniquename"; + "auditcontents"; + "aufinfo"; + "auread"; + "automesh"; + "autumn"; + "auwrite"; + "avifinfo"; + "aviinfo"; + "aviread"; + "awtinvoke"; + "axes"; + "axescheck"; + "axlimdlg"; + "ballode"; + "bar"; + "bar3"; + "bar3h"; + "barh"; + "base2dec"; + "basicfitdatastat"; + "batonode"; + "bench"; + "besschk"; + "bessel"; + "bessela"; + "besselh"; + "betacore"; + "betainc"; + "betaln"; + "bicg"; + "bicgstab"; + "bin2dec"; + "binpatch"; + "bitand"; + "bitcmp"; + "bitget"; + "bitmax"; + "bitor"; + "bitset"; + "bitshift"; + "bitxor"; + "blkdiag"; + "bone"; + "brighten"; + "brussode"; + "btndown"; + "btngroup"; + "btnicon"; + "btnpress"; + "btnresize"; + "btnstate"; + "btnup"; + "bucky"; + "buckydem"; + "builtin"; + "burgersode"; + "bvp4c"; + "bvpget"; + "bvpinit"; + "bvpset"; + "bvpval"; + "bwcontr"; + "calendar"; + "callSoapService"; + "calllib"; + "camdolly"; + "cameramenu"; + "cameratoolbar"; + "camlight"; + "camlookat"; + "camorbit"; + "campan"; + "campos"; + "camproj"; + "camroll"; + "camrotate"; + "camtarget"; + "camup"; + "camva"; + "camzoom"; + "cart2pol"; + "cart2sph"; + "cast"; + "cat"; + "catch"; + "caxis"; + "cbedit"; + "cdf2rdf"; + "cdfinfo"; + "cdfread"; + "cdfwrite"; + "cell2struct"; + "celldisp"; + "cellfun"; + "cellplot"; + "census"; + "cgs"; + "changeseriestype"; + "checkSyntacticWarnings"; + "checkin"; + "checkinwin"; + "checkout"; + "checkoutwin"; + "cholinc"; + "cholupdate"; + "circshift"; + "ckdepfun"; + "clabel"; + "class"; + "cleanupcomment"; + "clearcase"; + "clg"; + "clipboard"; + "clruprop"; + "cmapeditor"; + "cmdispatch"; + "cmdlnbgn"; + "cmdlnend"; + "cmdlnwin"; + "cmoptsdialog"; + "code2html"; + "codec"; + "colamd"; + "colmmd"; + "colon"; + "colorbar"; + "colorcube"; + "colormap"; + "colormapeditor"; + "colornone"; + "colperm"; + "colstyle"; + "comet"; + "comet3"; + "commandhistory"; + "commandwindow"; + "compan"; + "compass"; + "complex"; + "computer"; + "cond"; + "condeig"; + "condest"; + "coneplot"; + "contentsrpt"; + "contour"; + "contour3"; + "contourc"; + "contourf"; + "contours"; + "contourslice"; + "contrast"; + "conv2"; + "convertdemostodom"; + "convhull"; + "convhulln"; + "convn"; + "cool"; + "copper"; + "copyfile"; + "copyobj"; + "copyoptionsfcn"; + "corrcoef"; + "cosd"; + "cotd"; + "cov"; + "coveragerpt"; + "cplxdemo"; + "cplxgrid"; + "cplxmap"; + "cplxpair"; + "cplxroot"; + "createClassFromWsdl"; + "createSoapMessage"; + "cross"; + "cruller"; + "cscd"; + "cshelp"; + "csvread"; + "csvwrite"; + "ctlpanel"; + "ctranspose"; + "cumtrapz"; + "curl"; + "customverctrl"; + "cvs"; + "cylinder"; + "daqread"; + "daspect"; + "datachildren"; + "datacursormode"; + "dataread"; + "datatipinfo"; + "datenum"; + "datestr"; + "datetick"; + "datevec"; + "dbclear"; + "dbcont"; + "dbdown"; + "dblquad"; + "dbmex"; + "dbquit"; + "dbstack"; + "dbstatus"; + "dbstep"; + "dbstop"; + "dbtype"; + "dbup"; + "dde23"; + "ddeget"; + "ddeset"; + "ddex1"; + "ddex1de"; + "ddex1hist"; + "ddex2"; + "deal"; + "deblank"; + "debug"; + "dec2base"; + "dec2bin"; + "decic"; + "deconv"; + "del2"; + "delaunay"; + "delaunay3"; + "delaunayn"; + "deleteconfirm"; + "delsq"; + "delsqdemo"; + "demo"; + "demos"; + "demowin"; + "depdir"; + "depfun"; + "deprpt"; + "deselectall"; + "desktop"; + "desktopmenufcn"; + "detrend"; + "deval"; + "dialog"; + "diff2asv"; + "diffcode"; + "diffrpt"; + "diffuse"; + "divergence"; + "dlmread"; + "dlmwrite"; + "dmperm"; + "doclick"; + "docroot"; + "docsearch"; + "dofixrpt"; + "dokeypress"; + "domymenu"; + "doresize"; + "dot"; + "dragrect"; + "dsearch"; + "dsearchn"; + "e2pi"; + "e_handler"; + "earthmap"; + "edit"; + "editmenufcn"; + "editpath"; + "edtext"; + "eigmovie"; + "eigs"; + "eigs2"; + "eigshow"; + "ellipj"; + "ellipke"; + "ellipsoid"; + "emdenbvp"; + "enddrag"; + "eomday"; + "eq"; + "erfcinv"; + "erfcore"; + "erfinv"; + "errorbar"; + "errordlg"; + "etree"; + "etreeplot"; + "evalc"; + "evalin"; + "evalmcw"; + "expint"; + "expm1"; + "expmdemo"; + "expmdemo1"; + "expmdemo2"; + "expmdemo3"; + "export2wsdlg"; + "exportsetupdlg"; + "extent"; + "ezcontour"; + "ezcontourf"; + "ezgraph3"; + "ezmesh"; + "ezmeshc"; + "ezplot"; + "ezplot3"; + "ezpolar"; + "ezsurf"; + "ezsurfc"; + "factor"; + "factorial"; + "fcnchk"; + "feather"; + "fem1ode"; + "fem2ode"; + "fft2"; + "fftdemo"; + "fftn"; + "fftw"; + "fibodemo"; + "fieldnames"; + "fifteen"; + "figcopytemplatelistener"; + "figflag"; + "fignamer"; + "figtoolset"; + "figure"; + "figuredeletedlistener"; + "figureheaderdlg"; + "figurepalette"; + "fileattrib"; + "filebrowser"; + "fileformats"; + "filemarker"; + "filemenufcn"; + "fileread"; + "fill"; + "fill3"; + "filter"; + "filter2"; + "findall"; + "finddemo"; + "findfigs"; + "findobj"; + "finfo"; + "fitdemo"; + "fitfun"; + "fitsinfo"; + "fitsread"; + "fixcontents"; + "fixhelp"; + "fixquote"; + "flag"; + "flipdim"; + "flops"; + "flow"; + "fminbnd"; + "fminsearch"; + "fplot"; + "frame2im"; + "freeserial"; + "freqspace"; + "fsbvp"; + "func2str"; + "function_handle"; + "functions"; + "funfuns"; + "funm"; + "fzero"; + "gallery"; + "gammainc"; + "gca"; + "gcbf"; + "gcbo"; + "gcd"; + "gcf"; + "gco"; + "ge"; + "genpath"; + "genvarname"; + "get"; + "getFigureToolManager"; + "getappdata"; + "getcallinfo"; + "getcolumn"; + "getfield"; + "getframe"; + "getobj"; + "getorcreateobj"; + "getpixelposition"; + "getplottool"; + "getpref"; + "getprinttemplate"; + "getptr"; + "getscribecontextmenu"; + "getscribeobjectdata"; + "getselectobjects"; + "getstatus"; + "getuprop"; + "ginput"; + "gmres"; + "gplot"; + "grabcode"; + "gradient"; + "graf2d"; + "graf2d2"; + "graf3d"; + "graph2dhelper"; + "gray"; + "griddata"; + "griddata3"; + "griddatan"; + "gsvd"; + "gt"; + "gtext"; + "gui_mainfcn"; + "guidata"; + "guide"; + "guidefunc"; + "guidemfile"; + "guideopts"; + "guidetemplate"; + "guidetemplate0"; + "guidetemplate1"; + "guidetemplate2"; + "guidetemplate3"; + "guihandles"; + "hadamard"; + "handle2struct"; + "hardcopy"; + "hasbehavior"; + "hb1dae"; + "hb1ode"; + "hdf"; + "hdf5info"; + "hdf5read"; + "hdf5write"; + "hdfan"; + "hdfdf24"; + "hdfdfr8"; + "hdfgd"; + "hdfh"; + "hdfhd"; + "hdfhe"; + "hdfhx"; + "hdfinfo"; + "hdfml"; + "hdfpt"; + "hdfread"; + "hdfsd"; + "hdfsw"; + "hdftool"; + "hdftoolswitchyard"; + "hdfv"; + "hdfvf"; + "hdfvh"; + "hdfvs"; + "helpdlg"; + "helpinfo"; + "helpmenufcn"; + "helprpt"; + "helpview"; + "hex2dec"; + "hex2num"; + "hgaddbehavior"; + "hgbehaviorfactory"; + "hgconvertunits"; + "hgexport"; + "hgfeval"; + "hggetbehavior"; + "hgline2lineseries"; + "hgload"; + "hgsave"; + "hgtransform"; + "hidden"; + "hidegui"; + "hilb"; + "hist"; + "histc"; + "hndlaxis"; + "hndlgraf"; + "hot"; + "hsv"; + "hsv2rgb"; + "hthelp"; + "htpp"; + "humps"; + "iburgersode"; + "icondisp"; + "ifft2"; + "ifftn"; + "ihb1dae"; + "im2frame"; + "im2java"; + "image"; + "imagedemo"; + "imageext"; + "imagesc"; + "imageview"; + "imfinfo"; + "imformats"; + "import"; + "importdata"; + "imread"; + "imtext"; + "imwrite"; + "ind2rgb"; + "ind2sub"; + "indexhelper"; + "inferiorto"; + "info"; + "initdesktoputils"; + "inlineeval"; + "inmem"; + "inpolygon"; + "inputdlg"; + "inputname"; + "insertmenufcn"; + "inside"; + "inspect"; + "instrcb"; + "instrfind"; + "instrfindall"; + "int2str"; + "int64"; + "integerMath"; + "interp1q"; + "interp2"; + "interp3"; + "interpft"; + "interpn"; + "interpstreamspeed"; + "intersect"; + "intmax"; + "intmin"; + "intro"; + "intwarning"; + "invalidateaxis"; + "inverter"; + "invhilb"; + "ipermute"; + "is2D"; + "isappdata"; + "iscellstr"; + "isdeployed"; + "isequalwithequalnans"; + "isfloat"; + "ishghandle"; + "isjava"; + "iskeyword"; + "ismethod"; + "isobject"; + "isocaps"; + "isocolors"; + "isonormals"; + "isosurface"; + "ispref"; + "isprime"; + "isprop"; + "ispuma"; + "issorted"; + "issourcecontrolconfigured"; + "isstrprop"; + "isstudent"; + "isvarname"; + "java"; + "javaAddLsnrsToFigure"; + "javaArray"; + "javaGetHandles"; + "javaMethod"; + "javaObject"; + "javaaddpath"; + "javachk"; + "javaclasspath"; + "javacomponent"; + "javafigurequeue"; + "javarmpath"; + "jet"; + "jpropeditutils"; + "klein1"; + "knot"; + "lasterr"; + "lasterror"; + "lastwarn"; + "layout"; + "lcm"; + "ldivide"; + "le"; + "legend"; + "legendcolorbarlayout"; + "legendinfo"; + "legendre"; + "libfunctions"; + "libfunctionsview"; + "libisloaded"; + "libpointer"; + "libstruct"; + "life"; + "light"; + "lightangle"; + "lighting"; + "lin2mu"; + "line"; + "lines"; + "lineseries"; + "linkaxes"; + "linkprop"; + "linsolve"; + "listdlg"; + "listfonts"; + "lists"; + "loadhtml"; + "loadlibrary"; + "loadobj"; + "log1p"; + "loglog"; + "logm"; + "logo"; + "logspace"; + "lorenz"; + "lotka"; + "lotkademo"; + "ls"; + "lscan"; + "lscov"; + "lsqnonneg"; + "lsqr"; + "lt"; + "ltitr"; + "luinc"; + "m2struct"; + "magic"; + "makebars"; + "makecontentsfile"; + "makecounter"; + "makedisplaynames"; + "makefcn"; + "makehgtform"; + "makemcode"; + "makemenu"; + "makeshow"; + "makevase"; + "mat2cell"; + "mat2str"; + "mat4bvp"; + "material"; + "matfinfo"; + "matlabpath"; + "matlabroot"; + "matmanip"; + "matq2ws"; + "matqdlg"; + "matqparse"; + "matqueue"; + "mdbfileonpath"; + "mdbpublish"; + "mdbstatus"; + "mean"; + "median"; + "membrane"; + "memory"; + "menu"; + "menubar"; + "menuedit"; + "menueditfunc"; + "menulabel"; + "mesh"; + "meshc"; + "meshgrid"; + "meshz"; + "methods"; + "methodsview"; + "mex"; + "mexdebug"; + "mexext"; + "mfilename"; + "mfiletemplate"; + "middrag"; + "mimofr"; + "minres"; + "minus"; + "mislocked"; + "mkpp"; + "mlcomiface"; + "mldivide"; + "mlint"; + "mlintrpt"; + "mlock"; + "mmcompinfo"; + "mmfileinfo"; + "modes"; + "moveaxis"; + "movefile"; + "movegui"; + "movie"; + "movie2avi"; + "moviein"; + "movieview"; + "mpoles"; + "mpower"; + "mrdivide"; + "msgbox"; + "mtimes"; + "mu2lin"; + "multibandread"; + "multibandwrite"; + "munlock"; + "namelengthmax"; + "namelengthmax"; + "nargchk"; + "nargoutchk"; + "native2unicode"; + "nchoosek"; + "nddemo"; + "ndgrid"; + "ne"; + "nestdiss"; + "nested"; + "nesteddemo"; + "newfun"; + "newplot"; + "nextpow2"; + "nnload"; + "nnz"; + "noanimate"; + "nodither"; + "nonzeros"; + "normest"; + "normest1"; + "not"; + "notebook"; + "notebookCaptureFigures"; + "notebookCompareFigures"; + "now"; + "nthroot"; + "null"; + "num2cell"; + "num2hex"; + "numel"; + "numgrid"; + "numjac"; + "nzmax"; + "objbounds"; + "ode113"; + "ode15i"; + "ode15s"; + "ode23"; + "ode23s"; + "ode23t"; + "ode23tb"; + "ode45"; + "odedemo"; + "odeexamples"; + "odefile"; + "odeget"; + "odephas2"; + "odephas3"; + "odeplot"; + "odeprint"; + "odeset"; + "odextend"; + "open"; + "openfig"; + "opengl"; + "opentoline"; + "openvar"; + "optimget"; + "optimset"; + "or"; + "orbitode"; + "orderfields"; + "ordqz"; + "ordschur"; + "orient"; + "orth"; + "overobj"; + "pack"; + "padecoef"; + "pagedlg"; + "pagesetupdlg"; + "pan"; + "paren"; + "pareto"; + "parseSoapResponse"; + "parseparams"; + "partialpath"; + "pascal"; + "patch"; + "path"; + "path2rc"; + "pathsep"; + "pathtool"; + "pbaspect"; + "pcg"; + "pchip"; + "pcode"; + "pcolor"; + "pde"; + "pdepe"; + "pdeval"; + "pdex1"; + "pdex1bc"; + "pdex1ic"; + "pdex1pde"; + "pdex2"; + "pdex3"; + "pdex4"; + "pdex5"; + "peaks"; + "penny"; + "perl"; + "perms"; + "permute"; + "persistent"; + "pie"; + "pie3"; + "pink"; + "pinv"; + "planerot"; + "playbackdemo"; + "playshow"; + "plot3"; + "plotbrowser"; + "plotchild"; + "plotdoneevent"; + "plotedit"; + "plotmatrix"; + "plottoolfunc"; + "plottools"; + "plotutils"; + "plotyy"; + "plus"; + "pol2cart"; + "polar"; + "poly"; + "polyarea"; + "polyder"; + "polyeig"; + "polyfit"; + "polyint"; + "polyval"; + "polyvalm"; + "popupstr"; + "power"; + "ppval"; + "precedence"; + "prefdir"; + "preferences"; + "prefspanel"; + "prepdrag"; + "prepender"; + "primes"; + "print"; + "printdlg"; + "printdmfile"; + "printjob"; + "printprepare"; + "printpreview"; + "printrestore"; + "printtables"; + "printtemplate"; + "prism"; + "profile"; + "profreport"; + "profsave"; + "profview"; + "profviewgateway"; + "propedit"; + "propertyeditor"; + "psi"; + "publish"; + "punct"; + "putdowntext"; + "pvcs"; + "pwch"; + "pwd"; + "qhull"; + "qhulldemo"; + "qmr"; + "qrdelete"; + "qrinsert"; + "qrupdate"; + "quad"; + "quad8"; + "quadl"; + "quadv"; + "quake"; + "quatdemo"; + "questdlg"; + "quivdemo"; + "quiver"; + "quiver3"; + "qz"; + "randperm"; + "rank"; + "rat"; + "rats"; + "rbbox"; + "rcs"; + "rdivide"; + "reallog"; + "realpow"; + "realsqrt"; + "rectangle"; + "rectint"; + "recycle"; + "reducepatch"; + "reducevolume"; + "refresh"; + "refreshdata"; + "regexp"; + "regexpi"; + "regexprep"; + "rehash"; + "reloadsys"; + "relop"; + "remapfig"; + "render_basicaudiotoolbar"; + "render_fullaudiotoolbar"; + "reset"; + "resetplotview"; + "resi2"; + "residue"; + "rethrow"; + "rgb2hsv"; + "rgbplot"; + "ribbon"; + "rigidode"; + "rjr"; + "rmappdata"; + "rmdir"; + "rmfield"; + "rmpath"; + "rmpref"; + "roots"; + "rose"; + "rosser"; + "rot90"; + "rotate"; + "rotate3d"; + "rref"; + "rrefmovie"; + "rsf2csf"; + "run"; + "runreport"; + "saveas"; + "saveobj"; + "savepath"; + "savtoner"; + "scatter"; + "scatter3"; + "scribealign"; + "scribeaxesdlg"; + "scribeclearmode"; + "scribecursors"; + "scribeeventhandler"; + "scribefiglisten"; + "scribelinedlg"; + "scriberestoresavefcns"; + "scribetextdlg"; + "script"; + "sec"; + "secd"; + "sech"; + "selectmoveresize"; + "selectobject"; + "semilogx"; + "semilogy"; + "sendmail"; + "sepplot"; + "set"; + "setappdata"; + "setdiff"; + "setfield"; + "setpixelposition"; + "setpref"; + "setptr"; + "setscribecontextmenu"; + "setscribeobjectdata"; + "setstatus"; + "setuprop"; + "setxor"; + "shading"; + "shg"; + "shiftdim"; + "shockbvp"; + "showplottool"; + "shrinkfaces"; + "sind"; + "single"; + "singleMath"; + "slash"; + "slice"; + "slide2script"; + "smooth3"; + "snapshot"; + "snaptogrid"; + "soma"; + "somasols"; + "sortrows"; + "sound"; + "soundsc"; + "soundview"; + "sourcesafe"; + "spalloc"; + "sparsfun"; + "sparsity"; + "spaugment"; + "spconvert"; + "spdiags"; + "specular"; + "speye"; + "spfun"; + "sph2cart"; + "spharm2"; + "sphere"; + "spinmap"; + "spiral"; + "spline"; + "spline2d"; + "splncore"; + "spones"; + "spparms"; + "sprand"; + "sprandn"; + "sprandsym"; + "sprank"; + "spring"; + "sprintf"; + "spy"; + "spypart"; + "sqrtm"; + "squeeze"; + "ss2tf"; + "ss2zp"; + "sscanf"; + "ssdisp"; + "sshow"; + "ssinit"; + "sspause"; + "stairs"; + "standardrpt"; + "startscribeobject"; + "startscribepinning"; + "std"; + "stem"; + "stem3"; + "str2double"; + "str2func"; + "str2mat"; + "str2num"; + "str2rng"; + "strcat"; + "stream2"; + "stream3"; + "streamline"; + "streamparticles"; + "streamribbon"; + "streamslice"; + "streamtube"; + "strings"; + "stripanchors"; + "strjust"; + "strmatch"; + "strncmp"; + "strncmpi"; + "strread"; + "strtok"; + "strtrim"; + "strucdem"; + "strucdem_helper"; + "struct2cell"; + "struct2handle"; + "strvcat"; + "sub2ind"; + "subplot"; + "subsasgn"; + "subsindex"; + "subspace"; + "subsref"; + "substruct"; + "subvolume"; + "summer"; + "sunspots"; + "superiorfloat"; + "superiorto"; + "superquad"; + "support"; + "surf"; + "surf2patch"; + "surface"; + "surfc"; + "surfl"; + "surfnorm"; + "svds"; + "symamd"; + "symbfact"; + "symmlq"; + "symmmd"; + "symrcm"; + "symvar"; + "syntax"; + "system"; + "tabdlg"; + "table1"; + "table2"; + "tand"; + "taxDemo"; + "teapotdemo"; + "tempdir"; + "tempname"; + "tetramesh"; + "tex"; + "texlabel"; + "text"; + "textread"; + "textscan"; + "textscanDemo"; + "textwrap"; + "tf2ss"; + "tf2zp"; + "tfchk"; + "threebvp"; + "timerfind"; + "timerfindall"; + "times"; + "title"; + "toolsmenufcn"; + "tori4"; + "trace"; + "transpdemo"; + "transpose"; + "trapz"; + "travel"; + "treelayout"; + "treeplot"; + "trimesh"; + "triplequad"; + "triplot"; + "trisurf"; + "truss"; + "try"; + "tsearch"; + "tsearchn"; + "tube"; + "twobc"; + "twobvp"; + "twoode"; + "tzero"; + "uibuttongroup"; + "uiclearmode"; + "uicontainer"; + "uicontextmenu"; + "uicontrol"; + "uigetfile"; + "uigetpref"; + "uigettool"; + "uigettoolbar"; + "uiimport"; + "uiload"; + "uimenu"; + "uint64"; + "uiopen"; + "uipanel"; + "uipushtool"; + "uiputfile"; + "uirestore"; + "uiresume"; + "uisave"; + "uisetcolor"; + "uisetfont"; + "uisetpref"; + "uistack"; + "uisuspend"; + "uitable"; + "uitoggletool"; + "uitoolbar"; + "uitoolfactory"; + "uitree"; + "uitreefigure"; + "uitreenode"; + "uiundo"; + "uiwait"; + "umfpack"; + "uminus"; + "umtoggle"; + "undocheckout"; + "unicode2native"; + "union"; + "unique"; + "unloadlibrary"; + "unmesh"; + "unmkpp"; + "unwrap"; + "unzip"; + "uplus"; + "urlread"; + "urlwrite"; + "usejava"; + "usev6plotapi"; + "vander"; + "vanderpoldemo"; + "var"; + "vdp1"; + "vdp1000"; + "vdpode"; + "vectorize"; + "ver"; + "vertexpicker"; + "vga"; + "vibes"; + "view"; + "viewmenufcn"; + "viewmtx"; + "visdiff"; + "visdir"; + "visdirformhandler"; + "visdirrefresh"; + "vissuite"; + "volumebounds"; + "volvec"; + "voronoi"; + "voronoin"; + "vrml"; + "waitbar"; + "waitfor"; + "warndlg"; + "watchoff"; + "watchon"; + "waterfall"; + "wavfinfo"; + "wavplay"; + "wavread"; + "wavrecord"; + "wavwrite"; + "web"; + "webmenufcn"; + "weekday"; + "weissinger"; + "wernerboy"; + "what"; + "whatsnew"; + "which"; + "white"; + "whitebg"; + "why"; + "wilkinson"; + "winmenu"; + "winter"; + "wizard"; + "wk1const"; + "wk1finfo"; + "wk1read"; + "wk1wrec"; + "wk1write"; + "workspace"; + "workspacefunc"; + "wrldtrv"; + "ws2matq"; + "xfourier"; + "xgetselection"; + "xlabel"; + "xlim"; + "xlsfinfo"; + "xlsread"; + "xlswrite"; + "xmlread"; + "xmlwrite"; + "xor"; + "xpbombs"; + "xpklein"; + "xppage"; + "xpquad"; + "xpsound"; + "xpsubplt"; + "xptext"; + "xsetselection"; + "xslt"; + "xychk"; + "xycrull"; + "xyklein"; + "xyzchk"; + "xyzvchk"; + "ylabel"; + "ylim"; + "zip"; + "zlabel"; + "zlim"; + "zoom"; + "zp2ss"; + "zp2tf"] +endfunction diff --git a/modules/m2sci/macros/kernel/old2newinstr.bin b/modules/m2sci/macros/kernel/old2newinstr.bin new file mode 100755 index 000000000..0190897f1 Binary files /dev/null and b/modules/m2sci/macros/kernel/old2newinstr.bin differ diff --git a/modules/m2sci/macros/kernel/old2newinstr.sci b/modules/m2sci/macros/kernel/old2newinstr.sci new file mode 100755 index 000000000..a425bc5db --- /dev/null +++ b/modules/m2sci/macros/kernel/old2newinstr.sci @@ -0,0 +1,94 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function instr=old2newinstr(instr,oldname,newname) + // This function replaces by a new name (given in a input argument:newname) in a Scilab instruction all the variables names and functions names matching to a given name in a input argument:oldname + // INPUTS: + // -instr: Scilab instruction + // -oldname: a string, matching to the name variable which must be replaced + // -newname: a string, matching to the new variable name + // OUTPUT: + // -instr: Scilab instruction after modification + + // VARIABLE tlist // + // If the variable name matches to the oldname argument then replace the variable name by the newname argument + if typeof(instr)=="variable" then + if instr.name==oldname then + instr.name=newname + end + // FUNCALL tlist // + // If the function name matches to oldname argument then replace the function name by newname argument + elseif typeof(instr)=="funcall" + if instr.name==oldname then + instr.name=newname + end + // ex: function return has not rhs: return.rhs is not a list + if typeof(instr.rhs)=="list" then + for i=1:size(instr.rhs) + instr.rhs(i)=old2newinstr(instr.rhs(i),oldname,newname) + end + end + // OPERATION tlist// + elseif typeof(instr)=="operation" then + for i=1:size(instr.operands) + instr.operands(i)=old2newinstr(instr.operands(i),oldname,newname) + end + // IF-THEN-ELSE instruction // + elseif typeof(instr)=="ifthenelse" then + instr.expression=old2newinstr(instr.expression,oldname,newname) + for i=1:size(instr.then) + instr.then(i)=old2newinstr(instr.then(i),oldname,newname) + end + for i=1:size(instr.elseifs) + for k=1:size(instr.elseifs(i).then) + instr.elseifs(i).then(k)=old2newinstr((instr.elseifs(i).then(k)),oldname,newname) + end + end + for i=1:size(instr.else) + instr.else(i)=old2newinstr((instr.else(i)),oldname,newname) + end + // SELECT-CASE instruction // + elseif typeof(instr)=="selectcase" then + instr.expression=old2newinstr(instr.expression,oldname,newname) + for i=1:size(instr.cases) + for j=1:size(instr.cases(i).then) + instr.cases(i).then(j)=old2newinstr((instr.cases(i).then(j)),oldname,newname) + end + end + for i=1:size(instr.else) + instr.else(i)=old2newinstr(instr.else(i),oldname,newname) + end + // WHILE instruction // + elseif typeof(instr)=="while" then + instr.expression=old2newinstr(instr.expression,oldname,newname) + for i=1:size(instr.statements) + instr.statements(i)=old2newinstr(instr.statements(i),oldname,newname) + end + // TRY-CATCH instruction // + elseif typeof(instr)=="trycatch" + for i=1:size(instr.trystat) + instr.trystat(i)=old2newinstr(instr.trystat(i),oldname,newname) + end + for i=1:size(instr.catchstat) + instr.catchstat(i)=old2newinstr(instr.catchstat(i),oldname,newname) + end + // FOR instruction // + elseif typeof(instr)=="for" then + instr.expression=old2newinstr(instr.expression,oldname,newname) + for i=1:size(instr.statements) + instr.statements(i)=old2newinstr(instr.statements(i),oldname,newname) + end + // EQUAL instruction // + elseif typeof(instr)=="equal" then + instr.expression=old2newinstr(instr.expression,oldname,newname) + for i=1:size(instr.lhs) + instr.lhs(i)=old2newinstr(instr.lhs(i),oldname,newname) + end + end +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/kernel/operation2sci.bin b/modules/m2sci/macros/kernel/operation2sci.bin new file mode 100755 index 000000000..9d6972a29 Binary files /dev/null and b/modules/m2sci/macros/kernel/operation2sci.bin differ diff --git a/modules/m2sci/macros/kernel/operation2sci.sci b/modules/m2sci/macros/kernel/operation2sci.sci new file mode 100755 index 000000000..7705c4300 --- /dev/null +++ b/modules/m2sci/macros/kernel/operation2sci.sci @@ -0,0 +1,72 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [sci_equiv]=operation2sci(mtlb_expr) + // M2SCI function + // Convert a function call in an instruction or in an expression from Matlab to Scilab + // Input: + // - mtlb_instr: Matlab instr or expression to convert + // Output: + // - sci_instr: Scilab equivalent for mtlb_instr + + sci_equiv=mtlb_expr + + nboperands=size(mtlb_expr.operands) + + // Special case for extraction + if mtlb_expr.operator=="ext" then + [bval,index]=isdefinedvar(mtlb_expr.operands(1)) + + // Variable is unknown + if ~bval then + // Try to find what is this variable + [tmp]=getvar2sci(mtlb_expr.operands(1),lhslist) + if typeof(tmp)=="funcall" then + newname=mtlb_expr.operands(1).name + mtlb_expr.operands(1)=null() + mtlb_expr=Funcall(newname,size(lhslist),mtlb_expr.operands,lhslist) + [sci_equiv]=expression2sci(mtlb_expr,lhslist) + return + else + end + end + end + + opind=1 + while opind<=nboperands + [sci_operand]=expression2sci(mtlb_expr.operands(opind)) + mtlb_expr.operands(opind)=sci_operand + opind=opind+1 + // Special case for insertion, is this case, last operand (right expression) is not converted + if mtlb_expr.operator=="ins" & opind==nboperands then + break + end + + end + + // Function find is not used because does not work with strings + ind=-1 + for kop=1:size(ops,1) + if ops(kop,1)==mtlb_expr.operator then + ind=kop + break + end + end + if ind==-1 then + error(msprintf(gettext("operator %s not found."),mtlb_expr.operator)) + end + rhs=size(mtlb_expr.operands) + execstr("[sci_equiv]=%"+ops(ind,2)+"2sci(mtlb_expr)"); + + // Update lhsnb if Scilab equivalent is a function call + if typeof(sci_equiv)=="funcall" then + sci_equiv.lhsnb=size(sci_equiv.lhs) + end + +endfunction diff --git a/modules/m2sci/macros/kernel/repl_poss.bin b/modules/m2sci/macros/kernel/repl_poss.bin new file mode 100755 index 000000000..9c67a3373 Binary files /dev/null and b/modules/m2sci/macros/kernel/repl_poss.bin differ diff --git a/modules/m2sci/macros/kernel/repl_poss.sci b/modules/m2sci/macros/kernel/repl_poss.sci new file mode 100755 index 000000000..d7d8e2807 --- /dev/null +++ b/modules/m2sci/macros/kernel/repl_poss.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function []=repl_poss(expr,varargin) + // Display information for replacement for a statement in converted file + + txt=[] + nposs=size(varargin) + + if nposs==0 | fix(nposs/3)*3~=nposs then + error(gettext("Wrong number of inputs.")) + end + + txt=[expression2code(expr)+gettext(" may be replaced by:")] + for k=1:3:nposs + vars="" + if typeof(varargin(k+1))<>"list" then + vars=expression2code(varargin(k+1)) + else + for l=1:size(varargin(k+1)) + vars=vars+expression2code(varargin(k+1)(l)) + if l "+expression2code(varargin(k))+" "+gettext("if")+" "+vars+" "+varargin(k+2)] + end + + set_infos(txt,1) + +endfunction diff --git a/modules/m2sci/macros/kernel/replace_brackets.bin b/modules/m2sci/macros/kernel/replace_brackets.bin new file mode 100755 index 000000000..b83f831f0 Binary files /dev/null and b/modules/m2sci/macros/kernel/replace_brackets.bin differ diff --git a/modules/m2sci/macros/kernel/replace_brackets.sci b/modules/m2sci/macros/kernel/replace_brackets.sci new file mode 100755 index 000000000..084923e06 --- /dev/null +++ b/modules/m2sci/macros/kernel/replace_brackets.sci @@ -0,0 +1,52 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function txt=replace_brackets(txt) + + symbs=[",",";","=",")","]","("] + // This file will be use to deal with cells... + for k=1:size(txt,"r") + + // select-case + if strindex(txt(k),"case")<>[] then + txt(k)=strsubst(strsubst(txt(k),"{","makecell("),"}",")") + else + tk=strsubst(txt(k)," ","") + + ko=strindex(tk,"{") + if ko<>[] then + teq=strindex(tk,"=") + + /// + if ko(1)==1 then + txt(k)=strsubst(txt(k),"{}","makecell()") + txt(k)=strsubst(strsubst(txt(k),"{","(makecell([cell(),"),"}","]))") + elseif or(part(tk,ko(1)-1)==symbs) then + txt(k)=strsubst(txt(k),"{}","makecell()") + txt(k)=strsubst(strsubst(txt(k),"{","(makecell([cell(),"),"}","]))") + else // Cell index + txt(k)=strsubst(strsubst(txt(k),"{","("),"}",").entries") + end + + //// + + for kk=2:size(ko,"*") + if or(part(tk,ko(kk)-1)==symbs) then // Cell creation + txt(k)=strsubst(txt(k),"{}","makecell()") + txt(k)=strsubst(strsubst(txt(k),"{","(makecell([cell(),"),"}","]))") + else // Cell index + txt(k)=strsubst(strsubst(txt(k),"{","("),"}",").entries") + end + end + elseif ~isempty(strindex(txt(k),"}")) then + txt(k)=strsubst(txt(k),"}","]))") + end + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/sci_generic.bin b/modules/m2sci/macros/kernel/sci_generic.bin new file mode 100755 index 000000000..cca08126d Binary files /dev/null and b/modules/m2sci/macros/kernel/sci_generic.bin differ diff --git a/modules/m2sci/macros/kernel/sci_generic.sci b/modules/m2sci/macros/kernel/sci_generic.sci new file mode 100755 index 000000000..ffe4d8307 --- /dev/null +++ b/modules/m2sci/macros/kernel/sci_generic.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_generic(tree) + // M2SCI function + // Generic conversion function for unknown Matlab functions + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + if typeof(tree)=="operation" + tree.out(1).dims=list(-1,-1) + tree.out(1).type=Type(-1,-1) + else + for i=1:size(tree.lhs) + tree.lhs(i).dims=list(-1,-1) + tree.lhs(i).type=Type(-1,-1) + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/sci_m2scideclare.bin b/modules/m2sci/macros/kernel/sci_m2scideclare.bin new file mode 100755 index 000000000..a6849403e Binary files /dev/null and b/modules/m2sci/macros/kernel/sci_m2scideclare.bin differ diff --git a/modules/m2sci/macros/kernel/sci_m2scideclare.sci b/modules/m2sci/macros/kernel/sci_m2scideclare.sci new file mode 100755 index 000000000..c1c41bcc0 --- /dev/null +++ b/modules/m2sci/macros/kernel/sci_m2scideclare.sci @@ -0,0 +1,342 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function []=sci_m2scideclare(def) + // This function translate calls to m2scideclare + // which can be used by the user to influence translation + // by adding a comment which begins by m2scideclare + + // Global variable for M2SCI + global("varslist") + + //variable_name|dimensions|datatype|property + + //dimensions: variable dimensions separated by blanks (Unknown dimension is ?) + + //datatype: + // - double: scalar/vector/matrix/hypermatrix containing double values + // - string: scalar/vector/matrix/hypermatrix containing character strings + // - boolean: scalar/vector/matrix/hypermatrix containing boolean values + // - int: scalar/vector/matrix/hypermatrix containing integer values + // - handle: matrix of graphics handles or graphics handle + // - sparse: sparse scalar/vector/matrix/hypermatrix + // - cell: cell array + // - struct: struct array + // - ? if unknown + + //property: + // - real/complex/? for double and int datatype + // - real for string and boolean datatype (ignored if not) + // - NOT USED for struct/cell/handle datatype + + // def is the comment added by the user + userdata=def.rhs(1).value + // Remove all multiple blanks + while strindex(userdata," ")<>[] + userdata=strsubst(userdat," "," ") + end + + seppos=strindex(userdata,"|") + + seppos=[seppos,length(userdata)+1] + + nbsep=size(seppos,"*") + + if nbsep<3 then + error(gettext("not enough data, you should give at least variable_name|dimensions|datatype.")); + elseif nbsep>4 then + error(gettext("too much data.")); + end + + name=stripblanks(part(userdata,1:seppos(1)-1)) + + dimstxt=part(userdata,seppos(1)+1:seppos(2)-1) + + datatypetxt=part(userdata,seppos(2)+1:seppos(3)-1) + + if nbsep==4 then + proptxt=part(userdata,seppos(3)+1:seppos(4)-1) + else + proptxt="?" + end + + // Dimensions + dimstxt=strsubst(dimstxt,"?","-1") + dimstxt=strsubst(dimstxt,"*","-2") + dimstxt=strsubst(dimstxt,"#","-3") + blpos=strindex(dimstxt," ") + nbblanks=size(blpos) + blpos=[1,blpos,length(dimstxt)+1] + fmt="%d" + dims=list() + for kbl=1:size(blpos,"*")-1 + dims($+1)=evstr(part(dimstxt,blpos(kbl):blpos(kbl+1))) + end + + // Datatype + datatypetxt=strsubst(datatypetxt,"?","Unknown") + datatype=convstr(datatypetxt,"l") + if or(datatype==["double","boolean","string","int","handle","sparse","cell","struct","unknown"]) then + datatype=convstr(part(datatype,1),"u")+convstr(part(datatype,2:length(datatype)),"l") + vtype=evstr(datatype) + else + error(msprintf(gettext("Unknown datatype %s."),datatypetxt)); + end + + // Property + proptxt=strsubst(proptxt,"?","Unknown") + prop=convstr(proptxt,"l") + if or(prop==["real","complex","homogen","unknown"]) then + prop=convstr(part(prop,1),"u")+part(prop,2:length(prop)) + property=evstr(prop) + else + error(msprintf(gettext("Unknown property %s."),proptxt)); + end + // Property correction + if or(vtype==[Boolean,String]) then + property=Real + end + + if strindex(name,".")<>[] then // Cell or Struct m2scideclare + // Get varname + endofname=min([strindex(name,[".","("])])-1 + varname=part(name,1:endofname) + + // First field name (if is 'entries' then a cell else a struct) + firstpoint=min(strindex(name,".")) + secpoint=min(strindex(part(name,firstpoint+1:length(name)),".")) + par=min(strindex(part(name,firstpoint+1:length(name)),"(")) + if isempty(secpoint) & isempty(par) then //x.fieldname + firstfield=part(name,firstpoint:length(name)) + elseif isempty(secpoint) then //x.fieldname(p...) + firstfield=part(name,firstpoint:par-1) + elseif isempty(par) then //x.fieldname.fieldname2 + firstfield=part(name,firstpoint:secpoint-1) + else //x.fieldname(p...).fieldname2 + firstfield=part(name,firstpoint:min([secpoint par])-1) + end + if firstfield==".entries" then // Cell + vartype=Cell + else // Struct + vartype=Struct + end + + // Indexes for varname ? myvar(1,2).field.... + if or(strindex(name,"(")Unknown then + err=%T + break + end + end + + // Update dimensions + if err then + set_infos(msprintf(gettext("Dimensions current value and m2scideclare statements conflict for: %s\n m2scideclare given dimension: %s\n Current dimension: %s\n m2scideclare IGNORED"),varname,dims2str(vardims),dims2str(infereddims)),2) + else + varslist(index)=M2scivar(varslist(index).matname,varslist(index).matname,Infer(vardims,Type(varslist(index).type.vtype,property))) + end + + // Update vtype + if varslist(index).type.vtype==Unknown then + varslist(index)=M2scivar(varslist(index).matname,varslist(index).matname,Infer(vardims,Type(vartype,varslist(index).property))) + elseif varslist(index).type.vtype~=vartype then + set_infos(msprintf(gettext("Type current value and m2scideclare statements conflict for: %s\n m2scideclare given type: %s\n current type: %s\n m2scideclare IGNORED"),varname,tp2str(vartype),tp2str(varslist(index).type.vtype)),2) + end + + // Update property + if varslist(index).property==Unknown then + varslist(index).infer.type.property=property + elseif property==Unknown then + varslist(index).type.property=Unknown + elseif varslist(index).type.property~=property then + set_infos(msprintf(gettext("Property current value and m2scideclare statements conflict for: %s\n m2scideclare given type: %s\n current type: %s\n m2scideclare IGNORED"),name,prop2str(Unknown),prop2str(varslist(index).type.property)),2) + end + + // Update contents (no verification made...too complex) + contents=varslist(index).contents + name=strsubst(name,"*","%genericm2sciindex") + deff("m2scitmp",name) + t=macr2tree(m2scitmp); + if isempty(firstpoint) then + contents.index($+1)=t.statements(2).expression.rhs; + else + contents.index($+1)=t.statements(2).expression.rhs(1); + end + clear m2scitmp + for k=1:lstsize(contents.index($)) + if typeof(contents.index($)(k))=="variable" & contents.index($)(k).name=="%genericm2sciindex" then + contents.index($)(k)=Cste("*") + elseif typeof(contents.index($)(k))=="cste" then + contents.index($)(k)=Cste(contents.index($)(k).value) + elseif typeof(contents.index($)(k))=="list" then + for kk=1:lstsize(contents.index($)(k)) + if typeof(contents.index($)(k)(kk))=="variable" & contents.index($)(k)(kk).name=="%genericm2sciindex" then + contents.index($)(k)(kk)=Cste("*") + elseif typeof(contents.index($)(k)(kk))=="cste" then + contents.index($)(k)(kk)=Cste(contents.index($)(k)(kk).value) + end + end + end + end + contents.data($+1)=Infer(dims,Type(vtype,property)) + varslist(index)=M2scivar(varname,varname,Infer(vardims,Type(vartype,Unknown),contents)) + + end + else // Variable m2scideclare + + // Special part for %graphicswindow + if name=="%graphicswindow" then + global %graphicswindow + if and(vtype<>[Handle,Double]) then + set_infos(gettext("%graphicswindow set to default value Handle."),2); + else + %graphicswindow=vtype + end + return + end + + [isvar,index]=isdefinedvar(Variable(name,Infer())) + + if ~isvar then // If variable does not exist it is added to varslist + varslist($+1)=M2scivar(name,name,Infer(dims,Type(vtype,property))) + else // Try to compare with already infered data + // Update dims + infereddims=varslist(index).dims + + err=%F + for kd=1:min([lstsize(dims) lstsize(infereddims)]) + if infereddims(kd)~=dims(kd) & infereddims(kd)<>Unknown then + err=%T + break + end + end + + if err then + set_infos(msprintf(gettext("Dimensions current value and m2scideclare statements conflict for: %s\n m2scideclare given dimension: %s\n Current dimension: %s\n m2scideclare IGNORED"),name,dims2str(dims),dims2str(infereddims)),2) + else + varslist(index)=M2scivar(varslist(index).matname,varslist(index).sciname,Infer(dims,varslist(index).type)) + end + + // Update vtype + if varslist(index).type.vtype==Unknown then + varslist(index)=M2scivar(varslist(index).matname,varslist(index).sciname,Infer(varslist(index).dims,Type(vtype,varslist(index).type.property))) + elseif varslist(index).type.vtype~=vtype then + set_infos(msprintf(gettext("Type current value and m2scideclare statements conflict for: %s\n m2scideclare given type: %s\n current type: %s\n m2scideclare IGNORED"),name,tp2str(vtype),tp2str(varslist(index).type.vtype)),2) + end + + // Update property + if varslist(index).type.property==Unknown then + varslist(index)=M2scivar(varslist(index).matname,varslist(index).sciname,Infer(varslist(index).dims,Type(varslist(index).type.vtype,property))) + elseif varslist(index).type.property~=property then + set_infos(msprintf(gettext("Property current value and m2scideclare statements conflict for: %s\n m2scideclare given type: %s\n current type: %s\n m2scideclare IGNORED"),name,prop2str(property),prop2str(varslist(index).type.property)),2) + end + end + end +endfunction + + +function str=tp2str(tp) + // Returns equivalent of typeof() from data coming from type() + + if tp==1 then + str="Double" + elseif tp==4 then + str="Boolean" + elseif tp==6 then + str="Sparse" + elseif tp==8 then + str="Int" + elseif tp==9 then + str="Handle" + elseif tp==10 then + str="String" + elseif tp==16 then + str="Struct" + elseif tp==17 then + str="Cell" + elseif tp==-1 then + str="Unknown" + else + error(msprintf(gettext("type %d is not implemented."),tp)) + end +endfunction + +function str=prop2str(prop) + if type(prop)==10 then + str=prop + elseif prop==-1 then + str="Unknown" + else + error(msprintf(gettext("type %d is not implemented."),prop)) + end +endfunction + +function str=dims2str(dims) + str="" + for kd=1:lstsize(dims) + str=str+string(dims(kd))+" " + end +endfunction diff --git a/modules/m2sci/macros/kernel/sciparam.bin b/modules/m2sci/macros/kernel/sciparam.bin new file mode 100755 index 000000000..e028f558c Binary files /dev/null and b/modules/m2sci/macros/kernel/sciparam.bin differ diff --git a/modules/m2sci/macros/kernel/sciparam.sci b/modules/m2sci/macros/kernel/sciparam.sci new file mode 100755 index 000000000..4c420376a --- /dev/null +++ b/modules/m2sci/macros/kernel/sciparam.sci @@ -0,0 +1,56 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function sciparam() + // M2SCI variable declaration + // All variables listed below can be accessed for reading from all macros called from m2sci() macro + + quote="''" + logics=["==","<",">","<=",">=","<>"] + + // Operations code + // [ operation symbol, operation translation function code ; ...] + // e.g. : translation function for addition (+) is named %a2sci()... + ops = [ "+" , "a" ; + "-" , "s" ; + "*" , "m" ; + ".*" , "x" ; + "*." , "u" ; + ".*." , "k" ; + "/" , "r" ; + "./" , "d" ; + "/." , "v" ; + "./." , "y" ; + "\" , "l" ; + ".\" , "q" ; + "\." , "w" ; + ".\." , "z" ; + "^" , "p" ; + "==" , "log" ; + "<" , "log" ; + ">" , "log" ; + "<=" , "log" ; + ">=" , "log" ; + "~=" , "log" ; + ":" , "imp" ; + "rc" , "rc" ; + "ins" , "i" ; + "ext" , "e" ; + quote , "t" ; + "cc" , "cc" ; + "|" , "g" ; + "&" , "h" ; + "~" , "5" ; + ".^" , "j" ; + "."+quote , "0" ; + "cceol" , "cc" ] // Column Concatenation with EOL between Rows + + [logics,ops,quote]=resume(logics,ops,quote) + +endfunction diff --git a/modules/m2sci/macros/kernel/set_infos.bin b/modules/m2sci/macros/kernel/set_infos.bin new file mode 100755 index 000000000..ff1c90da4 Binary files /dev/null and b/modules/m2sci/macros/kernel/set_infos.bin differ diff --git a/modules/m2sci/macros/kernel/set_infos.sci b/modules/m2sci/macros/kernel/set_infos.sci new file mode 100755 index 000000000..927e49414 --- /dev/null +++ b/modules/m2sci/macros/kernel/set_infos.sci @@ -0,0 +1,27 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function []=set_infos(t,level) + + // Add warning and error messages obtained while translating to display it in the end of file translation + global("m2sci_infos") + + t(1)="L."+string(nblines)+": "+t(1) + + select level + case 0 then + case 1 then + m2sci_infos(level)=%t + t="! "+t + case 2 then + m2sci_infos(level)=%t + t="!! "+t + end + m2sci_info(t,verbose_mode); +endfunction diff --git a/modules/m2sci/macros/kernel/transformtree.bin b/modules/m2sci/macros/kernel/transformtree.bin new file mode 100755 index 000000000..51744bad8 Binary files /dev/null and b/modules/m2sci/macros/kernel/transformtree.bin differ diff --git a/modules/m2sci/macros/kernel/transformtree.sci b/modules/m2sci/macros/kernel/transformtree.sci new file mode 100755 index 000000000..5478ebb31 --- /dev/null +++ b/modules/m2sci/macros/kernel/transformtree.sci @@ -0,0 +1,84 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function instr=transformtree(instr) + //TRANSFORMTREE function + //This function research and transform the equal instructions(if the lhs are a multi_operation and expression is a funcall) + //of the matlab tree to a sup_equal instructions + //sup_equal is a tlist : tlist([sup_equal,sup_instr,nb_op],sup_instr,nb_op) + //i.e : the equal instruction [a(1),b(2:3)]=f() is replaced by + //sup_equal, whith sup_intr list is composed to : + //[%v1,%v2]=f() + //a(1)=%v1 + //b(2:3)=%v2 + //and nb_op is: the number of insert operation (in this case 2) + //Input + //instr : instruction of matlab tree before tranformation + //Output + //instr : instruction of matlab tree after transformation + + Unknown=-1; + // Browse all the instrucions of the matlab tree: + if typeof(instr)=="ifthenelse" then + for i=1:size(instr.then) + instr.then(i)=transformtree((instr.then(i))) + end + for i=1:size(instr.elseifs) + for k=1:size(instr.elseifs(i).then) + instr.elseifs(i).then(k)=transformtree((instr.elseifs(i).then(k))) + end + end + for i=1:size(instr.else) + instr.else(i)=transformtree((instr.else(i))) + end + elseif typeof(instr)=="selectcase" then + for i=1:size(instr.cases) + for j=1:size(instr.cases(i).then) + instr.cases(i).then(j)=transformtree((instr.cases(i).then(j))) + end + end + for i=1:size(instr.else) + instr.else(i)=transformtree(instr.else(i)) + end + elseif typeof(instr)=="while" then + for i=1:size(instr.statements) + instr.statements(i)=transformtree(instr.statements(i)) + end + elseif typeof(instr)=="for" then + for i=1:size(instr.statements) + instr.statements(i)=transformtree(instr.statements(i)) + end + //instruction is an equal instruction + elseif typeof(instr)=="equal" then + if typeof(instr.expression)=="funcall" then //expression is a funcall + nb_opr=0; + for ind=1:size(instr.lhs) + if typeof(instr.lhs(ind))=="operation" then + nb_opr=nb_opr+1 + end + end + if nb_opr>1 then //more than one lhs insert operation + sup_instr=list(""); + lhstemp=list(); + for j=1:size(instr.lhs) + if typeof(instr.lhs(j))=="operation" then + x=gettempvar(); + sup_instr($+1)=Equal(list(instr.lhs(j)),x); + lhstemp(j)=x; + else + lhstemp(j)=instr.lhs(j) + end + end + sup_instr(1)=Equal(lhstemp,instr.expression) + //creation of the sup_equal + instr=tlist(["sup_equal","sup_instr","nb_opr"],sup_instr,nb_opr) + end + end + end +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/kernel/translateorder.bin b/modules/m2sci/macros/kernel/translateorder.bin new file mode 100755 index 000000000..3b1d7665f Binary files /dev/null and b/modules/m2sci/macros/kernel/translateorder.bin differ diff --git a/modules/m2sci/macros/kernel/translateorder.sci b/modules/m2sci/macros/kernel/translateorder.sci new file mode 100755 index 000000000..89acd5d8b --- /dev/null +++ b/modules/m2sci/macros/kernel/translateorder.sci @@ -0,0 +1,49 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function [transorder]=translateorder(transorder,funtxt,overfunname) + // TRANSLATEORDER Recursive function + // Determinates a translate order of the M-files found in Paths (used by "translatepaths" function) + // Output-Input + // -transorder : a vector containing the M-files names which are arranged in order to respect an priority order of translation + // Input + // -funtxt : a vector which contains the name of a M-file found in the Paths (its first component: funtxt(1)), and the called functions by this file (the others components : funtxt(2:$)) + // -overfunname : a vector which contains the files names being passed like argument of "translateorder" function + + // the file is already in the list + if or(transorder==funtxt(1)) then + return + end + + if size(funtxt,"*")>1 then + for i=2:size(funtxt,1) + // the called function is already in the list + if find(funtxt(i)==transorder)<>[] then + continue + // the called function is already passed in argument of "translateorder" function (a loop) + elseif find(funtxt(i)==overfunname)<>[] then + disp([overfunname;funtxt(i)],"loop: ") + //return + continue + // order the under level, also we call translateorder (recursive) + else + overfunname($+1)=funtxt(1) + execstr("[transorder]=translateorder(transorder,"+funtxt(i)+"vect,overfunname)") + end + end + transorder($+1)=funtxt(1) + else + // no called function by the M-file, also we put the M-file name in the transorder vector + transorder($+1)=funtxt(1) + end + +endfunction + + + diff --git a/modules/m2sci/macros/kernel/update_instr_list.bin b/modules/m2sci/macros/kernel/update_instr_list.bin new file mode 100755 index 000000000..4f950bce2 Binary files /dev/null and b/modules/m2sci/macros/kernel/update_instr_list.bin differ diff --git a/modules/m2sci/macros/kernel/update_instr_list.sci b/modules/m2sci/macros/kernel/update_instr_list.sci new file mode 100755 index 000000000..87526ae45 --- /dev/null +++ b/modules/m2sci/macros/kernel/update_instr_list.sci @@ -0,0 +1,45 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [instr_list]=update_instr_list(instr_list,instr) + // M2SCI function + + // Global variables for M2SCI + global("m2sci_to_insert_b") + if isempty(m2sci_to_insert_b) + m2sci_to_insert_b = list(); + end + global("m2sci_to_insert_a") + if isempty(m2sci_to_insert_a) + m2sci_to_insert_a = list(); + end + + // Get instructions that must be inserted before converted instruction + for k=1:lstsize(m2sci_to_insert_b) + if m2sci_to_insert_b(k)<>list() then + instr_list($+1)=m2sci_to_insert_b(k) + end + end + m2sci_to_insert_b=list() + + // Insert converted instruction + // instr can be an empty list if a call to 'm2scideclare' or convertion made in m2sci_to_insert_b + if instr<>list() then + instr_list($+1)=instr + end + + // Get instructions that must be inserted after converted instruction + for k=1:lstsize(m2sci_to_insert_a) + if m2sci_to_insert_a(k)<>list() then + instr_list($+1)=m2sci_to_insert_a(k) + end + end + m2sci_to_insert_a=list() + +endfunction diff --git a/modules/m2sci/macros/kernel/updatevarslist.bin b/modules/m2sci/macros/kernel/updatevarslist.bin new file mode 100755 index 000000000..949389aa7 Binary files /dev/null and b/modules/m2sci/macros/kernel/updatevarslist.bin differ diff --git a/modules/m2sci/macros/kernel/updatevarslist.sci b/modules/m2sci/macros/kernel/updatevarslist.sci new file mode 100755 index 000000000..a19d331b3 --- /dev/null +++ b/modules/m2sci/macros/kernel/updatevarslist.sci @@ -0,0 +1,233 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function []=updatevarslist(instr_lhs) + // (2 functions in this file: merge_vars() at the end) + // Update list of M2SCI variables with converted instruction lhs + // Input: + // - instr_lhs: list of lhs of current instruction + // - in_a_clause: boolean value + // Set to 1 if instruction is in a clause + // In this case, type and dimensions are set to unknown if differ from those already stored in varslist + // (Default value is %F) + + // Global variable for M2SCI + global("varslist") + if isempty(varslist) + varslist = list() + end + // level is declared in m2sci.sci and modified in clause2sci.sci + level; + + rhs=argn(2) + if rhs==2 then + in_a_clause=%F + end + + // Merge infered data from the last two parts of clause which are above the current part + // if we are in the third part of clause (current), then : merge the first and second part of clause + // when end of conversion of a clause : merge infered data from the last two parts of clause + levelsize=size(level,1) + changepartclause=%F + + for i=size(varslist):-1:1 + if size(varslist(i).level,1)==levelsize then + varlevel=varslist(i).level + if varlevel($)<>level($) + changepartclause=%T + else + changepartclause=%F + break + end + end + end + if changepartclause | instr_lhs=="END OF CLAUSE" then + index=[] // Search variables from two part above current part clause + for k=size(varslist):-1:1 + if size(varslist(k).level,1)==levelsize then + varlevel=varslist(k).level + if and(varlevel(1:$-1)==level(1:$-1)) & varlevel($)==level($)-2 then + index=[index;k] + end + end + end + if index<>[] then // Found variables from the second part above current part of a clause + for k=1:size(index,1) + boolmerge =%F + for i=size(varslist):-1:1 // Search variables from the first part above current part of a clause, and which have the same name than variables from the second part above current part of a clause + varlevel=varslist(i).level + if varslist(i).matname==varslist(index(k)).matname & and(varlevel(1:$-1)==level(1:$-1)) & varlevel($)==level($)-1 then + boolmerge =%T // Found the same variable name from the last two parts above the current part : Merge + merge_vars(index(k),varslist(i)) + varslist(i)=null() + break + end + end + if ~boolmerge then + varslist(index(k)).level=[level(1:$-1);level($)-1] + end + end + end + end + + // Special case when end of conversion of a clause + // Merge infered data from clause and those from level-1 + if instr_lhs=="END OF CLAUSE" then // Search variables in the last part of a clause (above end of conversion of a clause) + index=[] // + for k=size(varslist):-1:1 // Search variables from level-1 which have the same name than variables from the last part of current level + varlevel=varslist(k).level + if varlevel==[level(1:$-1);level($)-1] then + index=[index;k] + end + end + if index<>[] then + for j=1:size(index,1) + boolmerge=%F + for k=size(varslist):-1:1 // + varlevel=varslist(k).level + if varslist(k).matname==varslist(index(j)).matname & and(varlevel==level(1:$-1)) then + boolmerge=%T // Found variables from level-1 which have the same name than variables from the last part of current level : Merge + index_lower_level=k + merge_vars(index_lower_level,varslist(index(j))) + varslist(k).level=level(1:$-1) + varslist(index(j))=null() + break + end + end + if boolmerge==%F then + varslist(index(j)).level=level(1:$-1) + end + end + end + return + end + + // Expression: lhs name is empty => nothing to do + if instr_lhs==list() then + return + end + + // Remove lhs which are not variables + k=1 + while k<=size(instr_lhs) + // Insertion operation + if typeof(instr_lhs(k))=="operation" then + instr_lhs(k)=null() + else + k=k+1 + end + end + + if size(instr_lhs)==0 then + return + end + + // Update varslist + for k=1:size(instr_lhs) + [bval,index]=isdefinedvar(instr_lhs(k)) + ierr=execstr("zz=instr_lhs(k).contents.index","errcatch") + if ierr<>0 then pause;end + // Remove multiple entries from contents + for kcont=lstsize(instr_lhs(k).contents.index):-1:1 + [infertlist,pos]=get_contents_infer(instr_lhs(k),instr_lhs(k).contents.index(kcont)) + if pos<>0 & pos<>kcont then + instr_lhs(k).contents.index(pos)=null() + instr_lhs(k).contents.data(pos)=null() + end + end + // If variable exists for the current level in the same part of clause then update exixting variable + if bval + boolupdate=%F + for l=1:size(varslist) + if varslist(l).matname==instr_lhs(k).name & varslist(l).level==level then + varslist(l)=M2scivar(varslist(l).sciname,.. + varslist(l).matname,.. + Infer(instr_lhs(k).infer.dims,instr_lhs(k).infer.type,instr_lhs(k).infer.contents),.. + varslist(l).level) + boolupdate=%T + break + end + end + // If variable exists, but not for the current level or not in the same part of clause then Update variable then create new variable + if ~boolupdate then + varslist($+1)=M2scivar(varslist(index).sciname,.. + varslist(index).matname,.. + instr_lhs(k).infer,.. + level) + end + else + // Variable added to varslist if as a name (not done for expressions + if execstr("f=instr_lhs(k).name","errcatch")<>0 then pause;end;errclear(); + if instr_lhs(k).name<>"ans" then + varslist($+1)=M2scivar(instr_lhs(k).name,.. + instr_lhs(k).name,.. + instr_lhs(k).infer,.. + level) + end + end + end +endfunction + +function []=merge_vars(oldvarindex,newvar) + // M2SCI function + // Merge two variables inference properties, if different then set to Unknown + // Input: + // - oldvarindex: index of old variable in varslist + // - newvar: new variable to take in account to update oldvar properties + + // Global variable for M2SCI + global("varslist") + oldvar=varslist(oldvarindex) + + olddims=oldvar.dims + oldvtype=oldvar.vtype + oldprop=oldvar.property + + newdims=newvar.dims + newvtype=newvar.vtype + newprop=newvar.property + + // Verify dims + for l=1:min(size(newdims),size(olddims)) + if newdims(l)<>olddims(l) then + newdims(l)=Unknown + end + end + if size(newdims)>size(olddims) then + for l=size(olddims):size(newdims) + newdims(l)=null() + end + end + + // Verify vtype + if newvtype<>oldvtype then + newvtype=Unknown + end + + // Verify property + if newprop<>oldprop then + newprop=Unknown + end + + // Verify contents + for k=1:lstsize(newvar.contents.index) + olddata=get_contents_infer(oldvar,newvar.contents.index(k)) + newdata=newvar.contents.data(k) + + if or(olddata<>newdata) then + newvar.infer.contents.data(k)=Infer() + end + end + + // Write result in varslist + varslist(oldvarindex)=M2scivar(oldvar.sciname,.. + oldvar.matname,.. + Infer(newdims,Type(newvtype,newprop),newvar.contents),.. + newvar.level) +endfunction diff --git a/modules/m2sci/macros/kernel/variablesearch.bin b/modules/m2sci/macros/kernel/variablesearch.bin new file mode 100755 index 000000000..55207abd5 Binary files /dev/null and b/modules/m2sci/macros/kernel/variablesearch.bin differ diff --git a/modules/m2sci/macros/kernel/variablesearch.sci b/modules/m2sci/macros/kernel/variablesearch.sci new file mode 100755 index 000000000..87eeba661 --- /dev/null +++ b/modules/m2sci/macros/kernel/variablesearch.sci @@ -0,0 +1,71 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function variablename=variablesearch(instr,variablename) + // VARIABLESEARCH recursive function (used by "translatepaths" function) + // Searches names of declared variables for each instruction of mtlbtree + // Output + // -variablename : a vector which contains the names of declared variables + // -instr : mtlbtree instruction + + // case : ifthenelse instruction + if typeof(instr) == "ifthenelse" then + for i=1:size(instr.then) + [variablename]=variablesearch((instr.then(i)),variablename) + end + for i=1:size(instr.elseifs) + for k=1:size(instr.elseifs(i).then) + [variablename]=variablesearch((instr.elseifs(i).then(k)),variablename) + end + end + for i=1:size(instr.else) + [variablename]=variablesearch((instr.else(i)),variablename) + end + // case : selectcase instruction + elseif typeof(instr) == "selectcase" then + for i=1:size(instr.cases) + [variablename]=variablesearch(instr.cases(i).expression,variablename) + for j=1:size(instr.cases(i).then) + [variablename]=variablesearch((instr.cases(i).then(j)),variablename) + end + end + for i=1:size(instr.else) + [variablename]=variablesearch(instr.else(i),variablename) + end + // case : while instruction + elseif typeof(instr) == "while" then + for i=1:size(instr.statements) + [variablename]=variablesearch(instr.statements(i),variablename) + end + // case : for instruction + elseif typeof(instr) == "for" then + [variablename]=variablesearch(instr.expression,variablename) + for i=1:size(instr.statements) + [variablename]=variablesearch(instr.statements(i),variablename) + end + // case : equal instruction + elseif typeof(instr) == "equal" then + for i=1:size(instr.lhs) + [variablename]=variablesearch(instr.lhs(i),variablename) + end + // case : operation instruction + elseif typeof(instr) == "operation" then + if instr.operator=="ins" then + if find(instr.operands(1).name==variablename)==[] then + variablename($+1)=instr.operands(1).name + end + end + // case : variable instruction + elseif typeof(instr) == "variable" then + if find(instr.name==variablename)==[] & instr.name<>"ans" then + variablename($+1)=instr.name + end + end + +endfunction diff --git a/modules/m2sci/macros/lib b/modules/m2sci/macros/lib new file mode 100755 index 000000000..816f48826 Binary files /dev/null and b/modules/m2sci/macros/lib differ diff --git a/modules/m2sci/macros/m2sci_gui.bin b/modules/m2sci/macros/m2sci_gui.bin new file mode 100755 index 000000000..c19a8b9f1 Binary files /dev/null and b/modules/m2sci/macros/m2sci_gui.bin differ diff --git a/modules/m2sci/macros/m2sci_gui.sci b/modules/m2sci/macros/m2sci_gui.sci new file mode 100755 index 000000000..4257b9d72 --- /dev/null +++ b/modules/m2sci/macros/m2sci_gui.sci @@ -0,0 +1,372 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2008 - 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.1-en.txt +// + +function m2sci_gui() + + // Sizes + widgeth = 20; + btnh = 22; + btnw = 90; + // defaultfont = "arial"; + margin = 18; + + // Figure creation + m2scifig = figure("figure_name", gettext("Matlab to Scilab conversion tool"),... + "infobar_visible", "off",... + "toolbar_visible", "off",... + "dockable", "off",... + "menubar", "none",... + "default_axes", "off",... + "resize", "off"); + + h = uimenu("parent", m2scifig, "label", gettext("File")); + uimenu("parent", h, "label", gettext("Close"), "callback", "cb_m2sci_gui", "tag", "close_menu"); + + h = uimenu("parent", m2scifig, "label", gettext("?")); + uimenu("parent", h, "label", gettext("Mfile2sci help page"), "callback", "cb_m2sci_gui();", "tag", "mfile2sci_help_menu"); + uimenu("parent", h, "label", gettext("Translatepaths help page"), "callback", "cb_m2sci_gui();", "tag", "translatepaths_help_menu"); + uimenu("parent", h, "label", gettext("About M2SCI tools..."), "callback", "cb_m2sci_gui();", "tag", "about_m2sci_menu"); + + figw = 650; + figh = 17*margin + btnh + 7*widgeth; + m2scifig.axes_size = [figw figh]; + + //------------------- + // --- Validation --- + //------------------- + + // Convert button + convertbtn = uicontrol("parent", m2scifig,... + "style", "pushbutton",... + "string", gettext("Convert"),... + "position", [figw-margin-btnw margin btnw btnh],... + "fontsize", 12,... + "tag","convertbtn",... + "callback","cb_m2sci_gui"); + + // Cancel button + cancelbtn = uicontrol("parent", m2scifig,... + "style", "pushbutton",... + "string", gettext("Cancel"),... + "position",[figw-2*margin-2*btnw margin btnw btnh],... + "fontsize", 12,... + "tag", "cancelbtn",... + "callback","cb_m2sci_gui"); + + //---------------- + // --- Options --- + //---------------- + // Frame + optframe = uicontrol("parent", m2scifig,... + "style", "frame",... + "units", "pixels",... + "border", createBorder("titled", createBorder("line", "lightGray", 1),... + _("Options"), "left", "top", createBorderFont("", 11, "normal"), "black"),... + "position", [margin 2*margin+btnh figw-2*margin 5*margin+4*widgeth]); + + // --- Pretty print option --- + pplabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Generate pretty printed code: "),... + "position",[2*margin 2*margin+btnh+margin 280 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12); + ppradioyes = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("Yes"),... + "position",[2*margin+300 2*margin+btnh+margin 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "ppradioyes"); + ppradiono = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("No"),... + "position",[2*margin+360 2*margin+btnh+margin 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 1,... + "callback", "cb_m2sci_gui",... + "tag", "ppradiono"); + + // --- Verbose option --- + verby = 2*margin+btnh+margin+widgeth+margin; + verblabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Verbose mode: "),... + "position",[2*margin verby 280 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12); + verbradio0 = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("0"),... + "position",[2*margin+300 verby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "verbradio0"); + verbradio1 = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("1"),... + "position",[2*margin+300+60 verby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "verbradio1"); + verbradio2 = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("2"),... + "position",[2*margin+300+60+60 verby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "verbradio2"); + verbradio3 = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("3"),... + "position",[2*margin+300+60+60+60 verby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 1,... + "callback", "cb_m2sci_gui",... + "tag", "verbradio3"); + + // --- Only doubles option --- + douby = verby + margin + widgeth; + doublabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Only double values used: "),... + "position",[2*margin douby 280 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12); + doubradioyes = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("Yes"),... + "position",[2*margin+300 douby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "doubradioyes"); + doubradiono = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("No"),... + "position",[2*margin+360 douby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 1,... + "callback", "cb_m2sci_gui",... + "tag", "doubradiono"); + + // --- Recursive mode option --- + recy = douby + margin + widgeth; + reclabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Recursive conversion: "),... + "position",[2*margin recy 280 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12); + recradioyes = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("Yes"),... + "position",[2*margin+300 recy 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "recradioyes"); + recradiono = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("No"),... + "position",[2*margin+360 recy 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 1,... + "callback", "cb_m2sci_gui",... + "tag", "recradiono"); + + // ------------------------ + // --- Output directory --- + // ------------------------ + // Frame + optframemaxy = 2*margin+btnh + 5*margin+4*widgeth; + outframe = uicontrol("parent", m2scifig,... + "style", "frame",... + "position", [margin optframemaxy+margin figw-2*margin widgeth+2*margin],... + "border", createBorder("titled", createBorder("line", "lightGray", 1),... + _("Output directory"),"left","top",createBorderFont("", 11, "normal"), "black")); + + outlabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Directory name: "),... + "position",[2*margin optframemaxy+2*margin-1 120 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12); + outedit = uicontrol("parent", m2scifig,... + "style", "edit",... + "string", pwd(),... + "units", "pixels",... + "position",[3*margin+100 optframemaxy+2*margin-1 figw-6*margin-100-btnw widgeth],... + "fontunits", "points",... + "fontsize", 12, ... + "tag", "outedit"); + + outbtn = uicontrol("parent", m2scifig,... + "style", "pushbutton",... + "string", gettext("Browse"),... + "position",[figw-2*margin-btnw optframemaxy+1.9*margin btnw btnh],... + "fontsize", 12,... + "callback", "cb_m2sci_gui",... + "tag", "outbtn"); + + // -------------------------------- + // --- File/Directory selection --- + // -------------------------------- + // Frame + outframemaxy = optframemaxy + 2*margin + widgeth + margin; + selframe = uicontrol("parent", m2scifig,... + "relief", "groove",... + "style", "frame",... + "units", "pixels",... + "position", [margin outframemaxy+margin figw-2*margin 2*margin+widgeth],... + "border", createBorder("titled", createBorder("line", "lightGray", 1),... + _("Input file"),"left","top",createBorderFont("", 11, "normal"), "black"),... + "tag", "filedirselect"); + + // --- Directory selection --- + dirlabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Directory name: "),... + "position",[2*margin outframemaxy+2*margin-1 120 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "visible", "off",... + "tag", "dirlabel"); + diredit = uicontrol("parent", m2scifig,... + "style", "edit",... + "string", pwd(),... + "position",[3*margin+100 outframemaxy+2*margin-1 figw-6*margin-100-btnw widgeth],... + "fontunits", "points",... + "fontsize", 12,... + "tag", "diredit",... + "visible", "off",... + "tag", "diredit"); + dirbtn = uicontrol("parent", m2scifig,... + "style", "pushbutton",... + "string", gettext("Browse"),... + "position",[figw-2*margin-btnw outframemaxy+1.9*margin btnw btnh],... + "fontsize", 12,... + "visible", "off",... + "callback", "cb_m2sci_gui",... + "tag", "dirbtn"); + + // --- File selection --- + filelabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("File name: "),... + "position",[2*margin outframemaxy+2*margin-1 120 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "tag", "filelabel"); + + fileedit = uicontrol("parent", m2scifig,... + "style", "edit",... + "string", gettext(""),... + "position",[3*margin+100 outframemaxy+2*margin-1 figw-6*margin-100-btnw widgeth],... + "fontunits", "points",... + "fontsize", 12,... + "tag", "fileedit"); + + filebtn = uicontrol("parent", m2scifig,... + "style", "pushbutton",... + "string", gettext("Browse"),... + "position",[figw-2*margin-btnw outframemaxy+1.9*margin btnw btnh],... + "fontsize", 12,... + "callback", "cb_m2sci_gui",... + "tag", "filebtn"); + + // ------------ + // --- Mode --- + // ------------ + // Frame + selframemaxy = outframemaxy + 2*margin + widgeth + margin; + modeframe = uicontrol("parent", m2scifig,... + "style", "frame",... + "position", [margin selframemaxy+margin figw-2*margin 2*margin+widgeth],... + "border", createBorder("titled", createBorder("line", "lightGray", 1),... + _("Conversion mode"), "left", "top", createBorderFont("", 11, "normal"), "black")); + + fileradio = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("Convert a single file"),... + "position",[2*margin selframemaxy+2*margin (figw-5*margin)/2 widgeth],... + "fontunits", "points",... + "fontsize", 12, ... + "min", 0, ... + "max", 1, ... + "value", 1,... + "tag", "fileradio", ... + "callback", "cb_m2sci_gui"); + + dirradio = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("Convert a whole directory"),... + "position",[3*margin+(figw-5*margin)/2 selframemaxy+2*margin (figw-5*margin)/2 widgeth],... + "fontunits", "points",... + "fontsize", 12, ... + "min", 0, ... + "max", 1, ... + "value", 0,... + "tag", "dirradio", ... + "callback", "cb_m2sci_gui"); + +endfunction diff --git a/modules/m2sci/macros/matfile2sci.bin b/modules/m2sci/macros/matfile2sci.bin new file mode 100755 index 000000000..939b9246f Binary files /dev/null and b/modules/m2sci/macros/matfile2sci.bin differ diff --git a/modules/m2sci/macros/matfile2sci.sci b/modules/m2sci/macros/matfile2sci.sci new file mode 100755 index 000000000..10e5a85d8 --- /dev/null +++ b/modules/m2sci/macros/matfile2sci.sci @@ -0,0 +1,80 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Serge STEER +// Copyright (C) 2009 - DIGITEO - 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.1-en.txt + +function matfile2sci(mat_file_path, result_file_path, overwrite) + // Translate a Matlab MAT file into a Scilab file + // + // mat_file_path : path of the Matlab MAT file + // result_file_path : path of the generated Scilab file + // + //This function has been developed following the "MAT-File Format" description: + //www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf + + if ~with_module("matio") then + error(msprintf(gettext("%s: %s module is not installed.\n"), "matfile2sci", "matio")); + end + + [lhs,rhs]=argn(0) + if rhs<2 | rhs>3 then + error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"), "matfile2sci", 2, 3)); + end + + //overwrite is false by default + if rhs==2 + overwrite = %F; + end + + //overwrite must be a boolean + if type(overwrite)<>4 + error(msprintf(_("%s: Wrong type for argument #%d: Boolean matrix expected.\n"), "matfile2sci", 3)); + end + + if size(overwrite, "*")<>1 + error(msprintf(_("%s: Wrong size for input argument #%d: %d-by-%d matrix expected.\n"), "matfile2sci", 3, 1, 1)); + end + + //--file opening + input_file_path = pathconvert(mat_file_path, %F, %T) + fdi=matfile_open(input_file_path, "r"); + fdo_path=pathconvert(result_file_path, %F, %T); + + //Wipe file if overwrite is true and the output file previously existed + if isfile(fdo_path) & overwrite + fdo = mopen(fdo_path, "wb"); + end + + //-- Read first variable + ierr = execstr("[Name, Matrix, Class] = matfile_varreadnext(fdi);", "errcatch"); + ierrsave = 0; + + if (ierr~=0) | ~exists("Name") + error(msprintf(_("%s: Could not read variables in %s"), "matfile2sci", input_file_path)) + end + + if Name=="" + error(msprintf(_("%s: Could not read variables in %s"), "matfile2sci", input_file_path)) + end + + //--loop on the stored variables + while Name<>"" & ierr==0 & ierrsave==0 + ierrsave = execstr(Name + " = Matrix; save(fdo_path, ""-append"", """+Name+""")", "errcatch") + if ierrsave==0 then + //-- Read next variable + ierr = execstr("[Name, Matrix, Class] = matfile_varreadnext(fdi);", "errcatch"); + end + end + + if exists("fdo")==1 + mclose(fdo); + end + + //--file closing + matfile_close(fdi); +endfunction diff --git a/modules/m2sci/macros/mfile2sci.bin b/modules/m2sci/macros/mfile2sci.bin new file mode 100755 index 000000000..dc26aa6af Binary files /dev/null and b/modules/m2sci/macros/mfile2sci.bin differ diff --git a/modules/m2sci/macros/mfile2sci.sci b/modules/m2sci/macros/mfile2sci.sci new file mode 100755 index 000000000..cade50470 --- /dev/null +++ b/modules/m2sci/macros/mfile2sci.sci @@ -0,0 +1,353 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// Copyright (C) ???? - INRIA - Serge STEER +// +// 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.1-en.txt + +function res=mfile2sci(fil,res_path,Recmode,only_double,verbose_mode,prettyprintoutput) + // This function performs translation of a single M-file + // - fil: file name + // - res_path: path to write translated file in (default value is fil path) + // - Recmode: recursive mode (default value is false) + + // Get default arguments + [lhs,rhs]=argn(0) + if rhs<6 then prettyprintoutput=%F,end + if rhs<5 then verbose_mode=3,end + if rhs<4 then only_double=%T,end + if rhs<3 then Recmode=%F,end + if rhs<2 then res_path="./",end + if rhs<1 then m2sci_gui();res=[];return;end + if getos() == "Windows" then + fil=strsubst(fil,filesep(),"/") + res_path=strsubst(res_path,"\","/") + end + if part(res_path,length(res_path))<>"/" then + res_path=res_path+"/" + end + // Loads libraries related to m2sci + if exists("m2scikernellib")==0 then load("SCI/modules/m2sci/macros/kernel/lib"),end + if exists("m2scipercentlib")==0 then load("SCI/modules/m2sci/macros/percent/lib"),end + if exists("m2scisci_fileslib")==0 then load("SCI/modules/m2sci/macros/sci_files/lib"),end + + if multi_fun_file(fil,res_path,Recmode,only_double,verbose_mode,prettyprintoutput) then + res=1 + return + end + + // Get context + global("m2sci_infos") + global("mtlbref_fun") + global("mtlbtool_fun") + global("not_mtlb_fun") + [l,mac]=where() + Reclevel=size(find(mac=="mfile2sci"),"*") + tpcallpos=min(find(mac=="translatepaths")); + guicallpos=min(find(mac=="m2sci_gui")); + if size(find(mac=="m2sci_gui"),"*")==1 & tpcallpos[] + ke=k($)-1 + base_name=part(fil,1:ke) + else + ke=length(fil) + base_name=fil + end + // File path + k=strindex(fil,"/") + if k==[] then + file_path="./" + else + file_path=part(fil,1:k($)) + end + // Others M-files in directory + if exists("Paths")==0 then + Paths=file_path, + if getos() == "Windows" then + Paths=strsubst(Paths,"/","\") + mfiles=listfiles(Paths+"*.m") + sep=filesep() + else + mfiles=listfiles(Paths+"*.m") + sep=filesep() + end + end + + // Function name + fnam=part(base_name,k($)+1:ke) // File name without extension + + // logfile initialisation + if exists("logfile")==0 then + [tempfd1,ierr1]=file("open",pathconvert(TMPDIR)+"logfile.dat","old") + if ierr1==0 then + load(pathconvert(TMPDIR)+"logfile.dat") + file("close",tempfd1) + file("close",logfile) + mdelete(pathconvert(TMPDIR)+"logfile.dat") + end + logfile=file("open",res_path+"m2sci_"+fnam+".log","unknown") + save(pathconvert(TMPDIR)+"logfile.dat", "logfile") + end + + // Output beginning message + mss=[gettext("****** Beginning of mfile2sci() session ******"); + gettext("File to convert:")+" "+fil; + gettext("Result file path:")+" "+res_path; + gettext("Recursive mode:")+" "+rec; + gettext("Only double values used in M-file:")+" "+dble; + gettext("Verbose mode:")+" "+string(verbose_mode); + gettext("Generate formated code:")+" "+pretty] + m2sci_info(mss,-1); + + // Read in the file as text + m2sci_info(gettext("M-file reading..."),-1); + txt=mgetl(fil); + m2sci_info(gettext("M-file reading: Done"),-1); + + //Replace TAB by SPACE + txt=strsubst(txt, ascii(9), ""); + + if txt==[] then + m2sci_infos(msprintf(gettext("File %s is an empty file.\n"),fil),-1); + return + end + tmptxt=txt + + // Make minor changes on syntax + m2sci_info(gettext("Syntax modification..."),-1); + ierr=execstr("load(''"+pathconvert(TMPDIR)+fnam+ ".tree'',''txt'',''helppart'',''batch'')","errcatch","n") + if ierr<>0 | exists("txt")==0 | exists("batch")==0 & strindex(res_path,TMPDIR)==[] then + [helppart,txt,batch]=m2sci_syntax(txt) + elseif ierr==0 & newest(fil,pathconvert(TMPDIR)+fnam+ ".tree")==1 then + [helppart,txt,batch]=m2sci_syntax(tmptxt) + end + + m2sci_info(gettext("Syntax modification: Done"),-1); + + // Write .cat file and update whatis + if helppart<>[] then + catfil=res_path+fnam+".cat" + whsfil=res_path+"whatis" + mputl(helppart,catfil); + if exists("whsfil_unit")==1 then + write(whsfil_unit,stripblanks(helppart(1))+" |"+fnam,"(a)") + end + end + + if txt~=[] then + quote="''"; + dquote=""""; + kc=strindex(txt(1),"function"); + kc=kc(1); + + // Define Scilab function + fprot=funcprot(); + funcprot(0); + + // Blanks in file name are replaced by _ for batch + // kc+9 because 'function ' + ksc=min(strindex(txt(1),";")) // searching for a comment on first line after function prototype + if isempty(ksc) then + ksc=length(txt(1))+1; + firstline=[] + else + firstline=part(txt(1),ksc+1:length(txt(1))); + end + + func_proto=part(txt(1),kc+9:ksc-1) + keq=min(strindex(func_proto,"=")) + kpar=min(strindex(func_proto,"(")) + if isempty(keq) then + keq=1 + end + if isempty(kpar) then + kpar=length(func_proto)+1 + end + func_proto=part(func_proto,1:keq)+.. + strsubst(stripblanks(part(func_proto,keq+1:kpar-1))," ","_")+.. + part(func_proto,kpar:length(func_proto)) + + deff(func_proto,[firstline;txt(2:$)],"n") + w=who("get"); + mname=w(1); + nametbl=[nametbl;mname] + if fnam<>mname & ~batch then // warning is not displayed for a batch file + mss=msprintf(gettext("Warning: file %s defines function %s instead of %s\n %s.sci, %s.cat and sci_%s.sci will be generated !"),fil,mname,fnam,mname,mname,mname); + m2sci_info(mss,-1); + end + + txt($+1) = "endfunction" + // Compilation + txt = [part(txt(1),kc:ksc-1);firstline;txt(2:$)] + mputl(txt, TMPDIR+"/"+mname+".sci"); + exec(TMPDIR+"/"+mname+".sci", -1); + funcprot(fprot); + mdelete(TMPDIR+"/"+mname+".sci"); + + // Get Scilab pseudo code of the function + m2sci_info(gettext("Macro to tree conversion..."),-1); + macr=evstr(mname) + mtlbtree=macr2tree(macr); + if ~batch then + mtlbtree.name=mname; + else + mtlbtree.name=""; + end + + //Transfom a equal instructions(if lhs are multi_operation insert and expression is a funcall) in the matlab tree to sup_equal instructions + global("tmpvarnb") + tmpvarnb=0; + level=[0,0]; + ninstr=1; + while ninstr<=size(mtlbtree.statements)-3 + mtlbtree.statements(ninstr)=transformtree(mtlbtree.statements(ninstr)) + ninstr=ninstr+1 + end + + // Perform the translation + [scitree,trad,hdr,crp]=m2sci(mtlbtree,w(1),Recmode,prettyprintoutput) + + //Creation of fname_resume.log file + // if mtlbref_fun<>[]|not_mtlb_fun<>[]|mtlbtool_fun<>[] then + //resume_logfile initialisation + if exists("resume_logfile")==0 then + [tempfd2,ierr2]=file("open",pathconvert(TMPDIR)+gettext("resumelogfile.dat"),"old") + if ierr2==0 then + load(pathconvert(TMPDIR)+gettext("resumelogfile.dat")) + file("close",tempfd2) + file("close",resume_logfile) + mdelete(pathconvert(TMPDIR)+gettext("resumelogfile.dat")) + end + resume_logfile=file("open",res_path+gettext("resume")+"_m2sci_"+fnam+".log","unknown") + save(pathconvert(TMPDIR)+gettext("resumelogfile.dat"), "resume_logfile") + end + + //number of matlab reference functions, matlab toolboxes functions, not matlab functions + size1=size(mtlbref_fun,1) + size2=size(mtlbtool_fun,1) + size3=size(not_mtlb_fun,1) + + if size(mtlbref_fun,"*")<>0 then + mtlbref_fun(:,1)=""""+mtlbref_fun(:,1)+"""" + end + if size(mtlbtool_fun,"*")<>0 then + mtlbtool_fun(:,1)=""""+mtlbtool_fun(:,1)+"""" + end + if size(not_mtlb_fun,"*")<>0 then + not_mtlb_fun(:,1)=""""+not_mtlb_fun(:,1)+"""" + end + + info_resume=[msprintf(gettext("****** %s: Functions of mfile2sci() session ******"),fnam); + "*"; + msprintf(gettext("%d Matlab Function(s) not yet converted, original calling sequence used:"),size1); + mtlbref_fun(:,1)+mtlbref_fun(:,2); + "*"; + msprintf(gettext("%d Matlab Toolbox(es) Functions, original calling sequence used :"),size2); + mtlbtool_fun(:,1)+mtlbtool_fun(:,2); + "*"; + msprintf(gettext("%d Unknown Function(s), original calling sequence used :"),size3); + not_mtlb_fun(:,1)+not_mtlb_fun(:,2); + "*"] + + write(resume_logfile,margin+info_resume) + file("close",resume_logfile) + mdelete(pathconvert(TMPDIR)+gettext("resumelogfile.dat")) + //end + + m2sci_info(gettext("Macro to tree conversion: Done"),-1); + + crp(1)=""; // Delete function prototype + if isempty(firstline) then + res=[hdr;crp] + else + hdr(1)=hdr(1)+" "+crp(2); + crp(2)=[]; + res=[hdr;crp]; + end + + // Strip last return and blank lines + n=size(res,1) + while res(n)==part(" ",1:length(res(n))) then + n=n-1 + end + res=res(1:n) + + // Write sci-file + ext=".sci" + scifil=res_path+fnam+ext + mputl(res,scifil); + + // Write sci_.sci translation file + if trad<>[] then + sci_fil=res_path+"sci_"+mname+".sci" + mputl(trad,sci_fil); + res=1 + else + res=0 + end + + // Output summary information + infos=[] + if m2sci_infos(1) then + infos=gettext("Translation may be improved: see the //! comments and for all mtlb_ function call\n Type help mtlb_ in Scilab command window to get information about improvements."); + end + if m2sci_infos(2) then + infos=[infos;gettext("Translation may be wrong (see the //!! comments).")] + end + + nametbl($)=[] + + else + infos=gettext("File contains no instruction, no translation made..."); + end + + // End of translation messages + mss=gettext("****** End of mfile2sci() session ******"); + + m2sci_info([infos;mss],-1); + + if Reclevel>1 then + m2sci_infos=m2sci_infos_save + end + + file("close",logfile) + clearglobal m2sci_infos + clearglobal mtlbref_fun + clearglobal mtlbtool_fun + clearglobal not_mtlb_fun + // For execution called by translatepaths() + //nametbl=resume(nametbl) + mdelete(pathconvert(TMPDIR)+fnam+ ".tree") + mdelete(pathconvert(TMPDIR)+"logfile.dat") + +endfunction diff --git a/modules/m2sci/macros/names b/modules/m2sci/macros/names new file mode 100755 index 000000000..d673a3406 --- /dev/null +++ b/modules/m2sci/macros/names @@ -0,0 +1,5 @@ +cb_m2sci_gui +m2sci_gui +matfile2sci +mfile2sci +translatepaths diff --git a/modules/m2sci/macros/percent/%02sci.bin b/modules/m2sci/macros/percent/%02sci.bin new file mode 100755 index 000000000..f6c128221 Binary files /dev/null and b/modules/m2sci/macros/percent/%02sci.bin differ diff --git a/modules/m2sci/macros/percent/%02sci.sci b/modules/m2sci/macros/percent/%02sci.sci new file mode 100755 index 000000000..40987f72b --- /dev/null +++ b/modules/m2sci/macros/percent/%02sci.sci @@ -0,0 +1,33 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%02sci(tree) + // M2SCI function + // Conversion function for Matlab dot transpose + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_0() + + A = getoperands(tree) + + // Scilab and Matlab transposition do not work in the same way for strings + if or(A.vtype==[String,Unknown]) then + tree=Funcall("mtlb_0",1,Rhs_tlist(A),tree.out) + tree.lhs(1).dims=list(A.dims(2),A.dims(1)) + tree.lhs(1).type=A.type + else + if A.vtype==Boolean then + tree.operands=list(Funcall("bool2s",1,list(A),list())) + end + tree.out(1).dims=list(A.dims(2),A.dims(1)) + tree.out(1).type=A.type + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%52sci.bin b/modules/m2sci/macros/percent/%52sci.bin new file mode 100755 index 000000000..970038cee Binary files /dev/null and b/modules/m2sci/macros/percent/%52sci.bin differ diff --git a/modules/m2sci/macros/percent/%52sci.sci b/modules/m2sci/macros/percent/%52sci.sci new file mode 100755 index 000000000..a61d766d0 --- /dev/null +++ b/modules/m2sci/macros/percent/%52sci.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%52sci(tree) + // M2SCI function + // Conversion function for Matlab negation + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + A = getoperands(tree) + if and(A.vtype<>[Double,Boolean]) then + A = convert2double(A) + tree.operands=list(A) + end + + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/percent/%a2sci.bin b/modules/m2sci/macros/percent/%a2sci.bin new file mode 100755 index 000000000..fa8ced46c Binary files /dev/null and b/modules/m2sci/macros/percent/%a2sci.bin differ diff --git a/modules/m2sci/macros/percent/%a2sci.sci b/modules/m2sci/macros/percent/%a2sci.sci new file mode 100755 index 000000000..8c503ddd0 --- /dev/null +++ b/modules/m2sci/macros/percent/%a2sci.sci @@ -0,0 +1,79 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%a2sci(tree) + // M2SCI function + // Conversion function for Matlab addition + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_a() + + // In Matlab only two matrices with the same size can be added unless one is a scalar + // So empty matrix can only be added to a scalar or an onther empty matrix + // For example : [1,2,3]+[] is not possible + // An other important difference with Scilab is that : + // - Matlab gives : [1]+[]=[] + // - Scilab gives : [1]+[]=[1] + + // WARNING : translation does not work for codes like var=+'a' + // In this case, user have to modify M-file and replace +'a' by 0+'a' for example + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_a_s.sci + // - %s_a_b.sci + + // Binary operator: A+B + if size(tree.operands)==2 then + [A,B]=getoperands(tree) + + // Matlab and Scilab addition do not match for Strings + if or(A.vtype==[String,Unknown]) then + A=convert2double(A) + end + if or(B.vtype==[String,Unknown]) then + B=convert2double(B) + end + + // %b_a_b is not defined in Scilab + if A.vtype==Boolean & B.vtype==Boolean + A=convert2double(A) + end + + tree.operands=list(A,B) + + // Type inference + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + else + tree.out(1).type=Type(Double,Unknown) + end + + // When both operands are not [] Scilab and Matlab give the same results + if not_empty(A) & not_empty(B) then + if is_a_scalar(A) then + tree.out(1).dims=B.dims + else + tree.out(1).dims=A.dims + end + // If at least one operand is [] then Matlab result is [] but not Scilab one + elseif is_empty(A) | is_empty(B) then + set_infos(msprintf(gettext("At least one operand of %s is an empty matrix, Scilab equivalent is []."),expression2code(tree)),0) + tree=Cste([]) + else + tree.out(1).dims=allunknown(A.dims) + tree=Funcall("mtlb_a",1,list(A,B),tree.out) + end + else + // This case can not exist because Scilab interpreter ignores unary + + A=getoperands(tree) + //A=convert2double(A) + tree.operands=list(A) + tree.out(1).infer=A.infer + end +endfunction diff --git a/modules/m2sci/macros/percent/%cc2sci.bin b/modules/m2sci/macros/percent/%cc2sci.bin new file mode 100755 index 000000000..70c10ed30 Binary files /dev/null and b/modules/m2sci/macros/percent/%cc2sci.bin differ diff --git a/modules/m2sci/macros/percent/%cc2sci.sci b/modules/m2sci/macros/percent/%cc2sci.sci new file mode 100755 index 000000000..9260b3ccf --- /dev/null +++ b/modules/m2sci/macros/percent/%cc2sci.sci @@ -0,0 +1,77 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function [tree]=%cc2sci(tree) + + // Make a 'column' with many rows + if tree.operands(1).vtype==Cell then + tree=%cc_cell2sci(tree) + return + end + + rownb=size(tree.operands) + col=list() + rowsize=[] + colsize=[] + + realrows=0 + complexrows=0 + + for k=1:rownb + ck=tree.operands(k) + if ck==list("EOL") | typeof(ck)=="comment" then + rowsize=[rowsize 0] + colsize=[colsize 0] + else + rowsize=[rowsize tree.operands(k).dims(1)] + colsize=[colsize tree.operands(k).dims(2)] + if ck.property==Complex then + complexrows=complexrows+1 + end + if ck.property==Real then + realrows=realrows+1 + end + end + end + + if realrows==rownb then + prop=Real + elseif complexrows<>0 then + prop=Complex + else + prop=Unknown + end + + + undef=find(colsize==-1) + void=find(colsize==0) + colsize([undef void])=[] + if colsize==[] then + if undef<>[] then + sc=-1 + else + sc=0 + end + else + [w,k]=min(length(colsize)) + sc=colsize(k) + end + if find(rowsize==-1)==[] then + w=rowsize(1) + for k=2:rownb + w=w+rowsize(k) + end + sr=w + else + sr=-1 + end + tree.out(1).dims=list(sr,sc) + tree.out(1).type=Type(ck.vtype,prop) + tree.out(1).contents=Contents() +endfunction diff --git a/modules/m2sci/macros/percent/%cc_cell2sci.bin b/modules/m2sci/macros/percent/%cc_cell2sci.bin new file mode 100755 index 000000000..7fc1c3d64 Binary files /dev/null and b/modules/m2sci/macros/percent/%cc_cell2sci.bin differ diff --git a/modules/m2sci/macros/percent/%cc_cell2sci.sci b/modules/m2sci/macros/percent/%cc_cell2sci.sci new file mode 100755 index 000000000..fe10e2ac2 --- /dev/null +++ b/modules/m2sci/macros/percent/%cc_cell2sci.sci @@ -0,0 +1,66 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function tree=%cc_cell2sci(tree) + + // Make a CELL 'column' with many rows + + if typeof(tree.operands(1))=="funcall" then + if tree.operands(1).name=="cell" then + tree.out(1).infer=Infer(list(1,1),Type(Cell,Unknown),Contents()) + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data($+1)=tree.operands(2).infer + return + end + end + + if tree.operands(1).vtype==Cell then + tree.out(1).infer=tree.operands(1).infer + else + tree.out(1).infer=Infer(list(1,1),Type(Cell,Unknown),Contents()) + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data($+1)=tree.operands(1).infer + end + dim1=tree.operands(1).dims(1) + dim2=tree.operands(1).dims(2) + + INFER=list() + if dim2==1 then + INFER(1)=tree.operands(2).infer + else + // Second operand is a rc or a + + op=tree.operands(2) + for kd2=1:dim2-1 + for ki=lstsize(INFER):-1:1 + INFER(ki+1)=INFER(ki) + end + INFER(1)=op.operands(2).infer + op=op.operands(1) + end + for ki=lstsize(INFER):-1:1 + INFER(ki+1)=INFER(ki) + end + INFER(1)=op.infer + end + for kd2=1:dim2 + tree.out(1).contents.index($+1)=list(list(Cste(dim1+1),Cste(kd2)),Cste("entries")) + tree.out(1).contents.data($+1)=INFER(kd2) + tree.out(1).contents.index($+1)=list(Cste(dim1+1),Cste(kd2)) + tree.out(1).contents.data($+1)=Infer(list(1,1),Type(Cell,Unknown),.. + Contents(list(list(list(Cste(1),Cste(1)),Cste("entries"))),list(tree.out(1).contents.data($)))) + end + + + if tree.out(1).dims(1)<>Unknown then + tree.out(1).dims(1)=tree.out(1).dims(1)+1 + end + if tree.out(1).dims(2)==0 then + tree.out(1).dims(2)=tree.out(1).dims(2)+1 + end +endfunction diff --git a/modules/m2sci/macros/percent/%d2sci.bin b/modules/m2sci/macros/percent/%d2sci.bin new file mode 100755 index 000000000..8b7ac6d5d Binary files /dev/null and b/modules/m2sci/macros/percent/%d2sci.bin differ diff --git a/modules/m2sci/macros/percent/%d2sci.sci b/modules/m2sci/macros/percent/%d2sci.sci new file mode 100755 index 000000000..4c3bee3ab --- /dev/null +++ b/modules/m2sci/macros/percent/%d2sci.sci @@ -0,0 +1,39 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%d2sci(tree) + // M2SCI function + // Conversion function for Matlab elementwise right division + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + [A,B] = getoperands(tree) + + // Scilab right division does not work with Strings, Booleans... + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + elseif (is_real(A) & is_complex(B)) | (is_real(B) & is_complex(A)) then + tree.out(1).type=Type(Double,Complex) + else + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + else + tree.out(1).dims=A.dims + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%e2sci.bin b/modules/m2sci/macros/percent/%e2sci.bin new file mode 100755 index 000000000..d1b617ab0 Binary files /dev/null and b/modules/m2sci/macros/percent/%e2sci.bin differ diff --git a/modules/m2sci/macros/percent/%e2sci.sci b/modules/m2sci/macros/percent/%e2sci.sci new file mode 100755 index 000000000..53233963c --- /dev/null +++ b/modules/m2sci/macros/percent/%e2sci.sci @@ -0,0 +1,177 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%e2sci(tree) + // M2SCI function + // Conversion function for Matlab extraction + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_e() + + // Global variable for M2SCI + global("varslist") + + var=tree.operands(1) + + // Special case for varargin/varargout + if or(var.name==["varargin","varargout"]) then + ind=tree.operands(2) + if type(ind)<>15 then + tree=Variable(var.name,Infer()) + else + if type(ind(1))==15 | ind(1).vtype<>String then + tree.operands(2)(2)=null() // Del 'entries' + elseif typeof(ind(1))=="cste" then + tree.operands(2)(2)=null() // Del 'entries' + else + tree.operands(2)(1)=null() // Del 'entries' + end + end + return + end + + // Extraction from cells + if var.vtype==Cell then + tree=%e_ce2sci(tree) + return + end + + // Extraction from structs + if var.vtype==Struct then + tree=%e_st2sci(tree) + return + end + + // Do not consider variable as a rhs... + rhs=rhs-1 + + // One index value + if rhs==1 then + ind=tree.operands(2) + // --- Recursive extraction --- + if type(ind)==15 then + for kind=1:lstsize(ind) + if type(ind(kind))<>15 then + if ind(kind).vtype==String then + if ind(kind).value=="entries" then + tree.operands(1).vtype=Cell + rhs=rhs+1 + tree=%e_ce2sci(tree) + return + else + tree.operands(1).vtype=Struct + rhs=rhs+1 + tree=%e_st2sci(tree) + return + end + end + end + end + error(msprintf(gettext("recursive extraction from a variable %s of type %s."),var.name,string(var.vtype))) + elseif var.vtype==String then // Character string extraction + tree=Funcall("part",1,Rhs_tlist(var,ind),tree.out) + if is_a_scalar(ind) then + tree.lhs(1).dims=list(1,1) + else + tree.lhs(1).dims=list(1,ind.dims(2)) + end + tree.lhs(1).type=var.type + else // Extraction x(i) + if var.vtype==Unknown then // Unknown type -> can be String + tree=Funcall("mtlb_e",1,Rhs_tlist(var,ind),tree.out) + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=var.type + else + if typeof(ind)=="cste" then + if ind.value==":" then + if var.dims(1)<>Unknown & var.dims(2)<>Unknown then + tree.out(1).dims=list(var.dims(1)*var.dims(2),1) + tree.out(1).type=var.type + else + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=var.type + end + return + end + end + + if ind.dims(1)==1 & ind.dims(2)==1 then + tree.out(1).dims=list(1,1) + tree.out(1).type=var.type + elseif var.dims(1)==1 then + tree.out(1).dims=list(1,Unknown) + tree.out(1).type=var.type + elseif var.dims(2)==1 then + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=var.type + elseif ind.dims(2)==1 then + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=var.type + elseif ind.dims(1)==1 then + tree.out(1).dims=list(1,Unknown) + tree.out(1).type=var.type + elseif var.dims(1)<>Unknown & var.dims(2)<>Unknown then + tree=Operation(".''",list(tree),tree.out) + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=var.type + else // at leat one dimension unknown + tree=Funcall("mtlb_e",1,Rhs_tlist(var,ind),tree.out) + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=var.type + end + end + end + // No rhs: for example variable display + elseif rhs==0 then + + // More than one index value + else + dims=list() + for k=2:rhs+1 + dimprod=1 + for l=1:size(tree.operands(k).dims) + dimprod=dimprod*tree.operands(k).dims(l) + if dimprod<0 then // Last dimension not known exactly + break + end + end + if is_a_scalar(tree.operands(k)) // All dims are 1 + dims(k-1)=1 + if typeof(tree.operands(k))=="cste" then + if tree.operands(k).value==":" then + if k<=lstsize(var.dims)+1 then + dims(k-1)=var.dims(k-1); + else + dims(k-1)=Unknown; + end + end + end + elseif dimprod>=0 then + dims(k-1)=dimprod + else + dims(k-1)=Unknown + end + end + + if var.vtype==String then // extraction in strings + if rhs==2 then + rhsarg=Operation("ext",list(var,tree.operands(2)),list()) + tree=Funcall("part",1,Rhs_tlist(rhsarg,tree.operands(3)),tree.out) + tree.lhs(1).dims=list(dims(1:2)) + tree.lhs(1).type=var.type + else + error(gettext("Extraction from strings with more than two indexes not implemented.")) + end + else + tree.out(1).dims=dims + tree.out(1).type=var.type + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%e_ce2sci.bin b/modules/m2sci/macros/percent/%e_ce2sci.bin new file mode 100755 index 000000000..76ef80158 Binary files /dev/null and b/modules/m2sci/macros/percent/%e_ce2sci.bin differ diff --git a/modules/m2sci/macros/percent/%e_ce2sci.sci b/modules/m2sci/macros/percent/%e_ce2sci.sci new file mode 100755 index 000000000..28b00873e --- /dev/null +++ b/modules/m2sci/macros/percent/%e_ce2sci.sci @@ -0,0 +1,174 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%e_ce2sci(tree) + // M2SCI function + // Conversion function for Matlab extraction from cells + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_e() + + // Global variable for M2SCI + global("varslist") + + var=tree.operands(1) + + // Do not consider variable as a rhs... + rhs=rhs-1 + + // One index value + if rhs==1 then + ind=tree.operands(2) + + // --- Recursive extraction --- + if type(ind)==15 then + // If last index value is not a fieldname, it is ignored + // it will be considered after all other indexes + // Avoid some extraction problems from character strings + lastisnotfield=typeof(ind($))=="list" + if ~lastisnotfield then + lastisnotfield=ind($).vtype<>String + end + + // Inference + infertree=tree.operands(2) + if lastisnotfield then + infertree($)=null() // Last index is not a fieldname, ignored here + end + + // Change index value if just one double + for k=1:lstsize(infertree) + if typeof(infertree(k))=="cste" | (typeof(infertree(k))<>"list" & is_a_scalar(infertree(k))) then + if infertree(k).vtype<>String then + infertree(k)=list(Cste(1),infertree(k)) + end + end + end + + [bval,index]=isdefinedvar(var) + if ~bval then + error(msprintf(gettext("M2SCI bug: extraction from unknown variable %s in varslist."),var.name)) + else + tmp=get_contents_infer(var,infertree); + tree.out(1).dims=tmp.dims + tree.out(1).type=tmp.type + tree.out(1).contents=tmp.contents + end + + // Convert last extraction operation is not already done + if lastisnotfield then + [inftlist,pos]=get_contents_infer(var,infertree) + tmp=gettempvar() + tmp.infer=inftlist + tmp.name=var.name+expression2code(infertree) + + oplist=list() + oplist(1)=tmp + infertree=tree.operands($)($) + if typeof(infertree)<>"list" then + infertree=list(infertree); + end + for k=1:lstsize(infertree) + oplist($+1)=infertree(k) + end + newop=Operation("ext",oplist,tree.out) + rhs=size(newop.operands) + newop=%e2sci(newop) + if typeof(newop)=="operation" then + tree.out(1).dims=newop.out(1).dims + tree.out(1).type=newop.out(1).type + tree.out(1).contents=newop.out(1).contents + else + tree.out(1).dims=newop.lhs(1).dims + tree.out(1).type=newop.lhs(1).type + tree.out(1).contents=newop.lhs(1).contents + end + end + else // Just one index value + tree.out(1).vtype=Cell + + iscste=typeof(ind)=="cste" + iscolon=%F + if iscste then + iscolon=ind.value==":" + end + if ~iscolon & iscste then + tree.out(1).dims=list(1,1) + tree.out(1).contents=Contents() + if tree.operands(1).dims(1)==1 then // row vector + tree.out(1).contents.index(1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data(1)=get_contents_infer(tree.operands(1),list(list(Cste(1),ind),Cste("entries"))) + elseif tree.operands(1).dims(2)==1 then // column vector + tree.out(1).contents.index(1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data(1)=get_contents_infer(tree.operands(1),list(list(ind,Cste(1)),Cste("entries"))) + end + else + tree.out(1).contents=Contents() + if ~iscolon then + tree=Operation("''",list(tree),tree.out) + tree.out(1).dims=ind.dims + else + dprod=1 + for kd=1:lstsize(var.dims) + dprod=dprod*var.dims(kd) + if dprod<0 then + break + end + end + if dprod>0 then + tree.out(1).dims=list(dprod,1) + else + tree.out(1).dims=list(Unknown,1) + end + end + end + + end + // More than one index value + else + dims=list() + for k=2:rhs+1 + dimsum=0 + for l=1:size(tree.operands(k).dims) + dimsum=dimsum+tree.operands(k).dims(l) + end + if dimsum==size(tree.operands(k).dims) // All dims are 1 + dims(k-1)=1 + if typeof(tree.operands(k))=="cste" then + if tree.operands(k).value==":" then + dims(k-1)=var.dims(k-1) + end + end + else + dims(k-1)=Unknown + end + end + + infertree=tree.operands + infertree(1)=null() + + tree.out(1).type=var.type + tree.out(1).dims=dims + + [bval,index]=isdefinedvar(var) + if ~bval then + error(msprintf(gettext("M2SCI bug: extraction from unknown variable %s in varslist."),var.name)) + else + tmp=get_contents_infer(var,list(infertree,Cste("entries"))); + if is_a_scalar(tree.out(1)) then + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data($+1)=tmp + elseif not_a_scalar(tree.out(1)) then + tree.out(1).contents.index($+1)=list(infertree,Cste("entries")) + tree.out(1).contents.data($+1)=tmp + end + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%e_st2sci.bin b/modules/m2sci/macros/percent/%e_st2sci.bin new file mode 100755 index 000000000..2d1a89977 Binary files /dev/null and b/modules/m2sci/macros/percent/%e_st2sci.bin differ diff --git a/modules/m2sci/macros/percent/%e_st2sci.sci b/modules/m2sci/macros/percent/%e_st2sci.sci new file mode 100755 index 000000000..92e55ecc4 --- /dev/null +++ b/modules/m2sci/macros/percent/%e_st2sci.sci @@ -0,0 +1,155 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%e_st2sci(tree) + // M2SCI function + // Conversion function for Matlab extraction from structs + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_e() + + // Global variable for M2SCI + global("varslist") + + var=tree.operands(1) + + // Do not consider variable as a rhs... + rhs=rhs-1 + + // One index value + if rhs==1 then + ind=tree.operands(2) + + // --- Recursive extraction --- + if type(ind)==15 then + // If last index value is not a fieldname, it is ignored + // it will be considered after all other indexes + // Avoid some extraction problems from character strings + lastisnotfield=typeof(ind($))=="list" + if ~lastisnotfield then + lastisnotfield=ind($).vtype<>String + end + + // Inference + infertree=tree.operands(2) + if lastisnotfield then // Last index is not a fieldname, ignored here + infertree($)=null() + end + // Change index value if just one double + for k=1:lstsize(infertree) + if typeof(infertree(k))=="cste" | (typeof(infertree(k))<>"list" & is_a_scalar(infertree(k))) then + if infertree(k).vtype<>String then + infertree(k)=list(Cste(1),infertree(k)) + end + end + end + + [bval,index]=isdefinedvar(var) + if ~bval then + error(msprintf(gettext("M2SCI bug: extraction from unknown variable %s in varslist."),var.name)) + else + tmp=get_contents_infer(var,infertree); + tree.out(1).dims=tmp.dims + tree.out(1).type=tmp.type + tree.out(1).contents=tmp.contents + end + + // Convert last extraction operation is not already done + if lastisnotfield then + [inftlist,pos]=get_contents_infer(var,infertree) + tmp=gettempvar() + tmp.infer=inftlist + varslist($+1)=M2scivar(tmp.name,tmp.name,tmp.infer) + + oplist=list() + oplist(1)=tmp + infertree=tree.operands($)($) + if typeof(infertree)<>"list" & infertree.vtype<>String then + infertree=list(infertree); + end + for k=1:size(infertree) + oplist($+1)=infertree(k) + end + newop=Operation("ext",oplist,tree.out) + rhs=size(newop.operands) + newop=%e2sci(newop) + if typeof(newop)=="operation" then + tree.out(1).dims=newop.out(1).dims + tree.out(1).type=newop.out(1).type + tree.out(1).contents=newop.out(1).contents + else + tree.out(1).dims=newop.lhs(1).dims + tree.out(1).type=newop.lhs(1).type + tree.out(1).contents=newop.lhs(1).contents + end + end + else + // extraction from struct + // this case should happen only if var(ind.value) contains only one value + [bval,index]=isdefinedvar(var) + if ~bval then + error(msprintf(gettext("M2SCI bug: extraction from unknown variable %s in varslist."),var.name)) + else + if varslist(index).vtype<>Struct then + // variable not defined as a struct, modify inference + varslist(index).infer.vtype=Struct + end + end + outdims=list(Unknown,Unknown) + if ind.dims(1)==1 then // a scalar or a vector + outdims=list(1,ind.dims(2)) + end + if typeof(ind)=="cste" | (typeof(ind)<>"list" & is_a_scalar(ind)) then + if ind.vtype<>String then + if var.dims(1)==1 then // row vector + ind=list(Cste(1),ind) + elseif var.dims(2)==1 then // column vector + ind=list(ind,Cste(1)) + end + end + end + if typeof(ind)<>"list" then + ind=list(ind); + end + tree.out(1).infer=get_contents_infer(var,ind) + if tree.out(1).dims==list(Unknown,Unknown) then + tree.out(1).dims=outdims + end + end + // More than one index value + else + dims=list() + for k=2:rhs+1 + dimsum=0 + for l=1:size(tree.operands(k).dims) + dimsum=dimsum+tree.operands(k).dims(l) + end + if dimsum==size(tree.operands(k).dims) // All dims are 1 + dims(k-1)=1 + if typeof(tree.operands(k))=="cste" then + if tree.operands(k).value==":" then + dims(k-1)=var.dims(k-1) + end + end + else + dims(k-1)=Unknown + end + end + + tree.out(1).dims=dims + tree.out(1).type=var.type + + IND=tree.operands + IND(1)=null() // Variable is not an index + + tree.out(1).contents.index($+1)=IND + tree.out(1).contents.data($+1)=get_contents_infer(tree.operands(1),IND) + end +endfunction + diff --git a/modules/m2sci/macros/percent/%g2sci.bin b/modules/m2sci/macros/percent/%g2sci.bin new file mode 100755 index 000000000..df60f7492 Binary files /dev/null and b/modules/m2sci/macros/percent/%g2sci.bin differ diff --git a/modules/m2sci/macros/percent/%g2sci.sci b/modules/m2sci/macros/percent/%g2sci.sci new file mode 100755 index 000000000..89cf5ad56 --- /dev/null +++ b/modules/m2sci/macros/percent/%g2sci.sci @@ -0,0 +1,69 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%g2sci(tree) + // M2SCI function + // Conversion function for Matlab logical OR + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_g_s.sci + // - %s_g_b.sci + // These functions are not used to get the same output value as Matlab one with empty matrices + + // %s_g_s is also defined but no more used (hard coded) + + [A,B] = getoperands(tree) + + // Short circuiting OR + if (typeof(B)=="variable" & B.name=="%shortcircuit") then + if typeof(tree.out(1))=="variable" & tree.out(1).name=="ans" then + tmp=gettempvar() + tmp.type=Type(Boolean,Real) + tree=tmp + else + tmp=tree.out(1) + global("varslist") + varslist($+1)=M2scivar(tree.out(1).name,tree.out(1).name,Infer(list(1,1),Type(Boolean,Real))) + tree=list() + end + insert(Equal(list(tmp),Cste(%T))) + insert(tlist(["ifthenelse","expression","then","elseifs","else"],Operation("~",list(A.operands(1)),list()),list(Equal(list(tmp),A.operands(2))),list(),list())) + return + end + + // To have good size for result with String as input + // And overloading functions are not written for Strings + if A.vtype==Unknown | A.vtype==String then + A = convert2double(A) + end + if B.vtype==Unknown | B.vtype==String then + B = convert2double(B) + end + tree.operands=list(A,B) + + tree.out(1).type=Type(Boolean,Real) + // If A is a scalar + if is_a_scalar(A) then + tree.out(1).dims=B.dims + // If B is a scalar + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + // If A or B is an empty matrix + elseif is_empty(A) | is_empty(B) then + tree.out(1).dims=A.dims + // A and B are not scalars and not empty matrices -> they have the same size + elseif not_empty(A) & not_empty(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=allunknown(A.dims) + end + +endfunction diff --git a/modules/m2sci/macros/percent/%h2sci.bin b/modules/m2sci/macros/percent/%h2sci.bin new file mode 100755 index 000000000..a24697373 Binary files /dev/null and b/modules/m2sci/macros/percent/%h2sci.bin differ diff --git a/modules/m2sci/macros/percent/%h2sci.sci b/modules/m2sci/macros/percent/%h2sci.sci new file mode 100755 index 000000000..4a43049aa --- /dev/null +++ b/modules/m2sci/macros/percent/%h2sci.sci @@ -0,0 +1,69 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%h2sci(tree) + // M2SCI function + // Conversion function for Matlab logical AND + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_h_s.sci + // - %s_h_b.sci + // These functions are not used to get the same output value as Matlab one with empty matrices + + // %s_h_s is also defined but no more used (hard coded) + + [A,B]=getoperands(tree) + + // Short circuiting AND + if (typeof(B)=="variable" & B.name=="%shortcircuit") then + if typeof(tree.out(1))=="variable" & tree.out(1).name=="ans" then + tmp=gettempvar() + tmp.type=Type(Boolean,Real) + tree=tmp + else + tmp=tree.out(1) + global("varslist") + varslist($+1)=M2scivar(tree.out(1).name,tree.out(1).name,Infer(list(1,1),Type(Boolean,Real))) + tree=list() + end + insert(Equal(list(tmp),Cste(%F))) + insert(tlist(["ifthenelse","expression","then","elseifs","else"],A.operands(1),list(Equal(list(tmp),A.operands(2))),list(),list())) + return + end + + // To have good size for result with String as input + // And overloading functions are not written for Strings + if A.vtype==Unknown | A.vtype==String then + A = convert2double(A) + end + if B.vtype==Unknown | B.vtype==String then + B = convert2double(B) + end + tree.operands=list(A,B) + + tree.out(1).type=Type(Boolean,Real) + // If A is a scalar + if is_a_scalar(A) then + tree.out(1).dims=B.dims + // If B is a scalar + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + // If A or B is an empty matrix + elseif is_empty(A) | is_empty(B) then + tree.out(1).dims=A.dims + // A and B are not scalars and not empty matrices -> they have the same size + elseif not_empty(A) & not_empty(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=allunknown(A.dims) + end + +endfunction diff --git a/modules/m2sci/macros/percent/%i2sci.bin b/modules/m2sci/macros/percent/%i2sci.bin new file mode 100755 index 000000000..d37d833ec Binary files /dev/null and b/modules/m2sci/macros/percent/%i2sci.bin differ diff --git a/modules/m2sci/macros/percent/%i2sci.sci b/modules/m2sci/macros/percent/%i2sci.sci new file mode 100755 index 000000000..27a69605a --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci.sci @@ -0,0 +1,190 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%i2sci(tree) + // M2SCI function + // Conversion function for Matlab insertion + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation functions: mtlb_i() and mtlb_is() + + // Global variable for M2SCI + global("varslist") + + from=tree.operands($) + to=tree.operands(1) + + // Special case for varargin/varargout + if or(to.name==["varargin","varargout"]) then + ind=tree.operands(2) + if type(ind)<>15 then + tree=Variable(to.name,Infer()) + else + if type(ind(1))==15 | ind(1).vtype<>String then + tree.operands(2)(2)=null() // Del 'entries' + elseif typeof(ind(1))=="cste" then + tree.operands(2)(2)=null() // Del 'entries' + else + tree.operands(2)(1)=null() // Del 'entries' + end + end + return + end + + + // Ajust rhs value (variable and value to insert are part of rhs) + rhs=rhs-2 + + // Insertion with cells + if to.vtype==Cell | from.vtype==Cell then + tree=%i_ce2sci(tree) + return + end + + // Insertion with structs + if to.vtype==Struct | from.vtype==Struct then + tree=%i_st2sci(tree) + return + end + + // Just one index value + if rhs==1 then + ind=tree.operands(2) + // --- Insertion of strings --- + if to.vtype==String & from.vtype==String then + tree=list() + to.dims=allunknown(to.dims) + [bval,index]=isdefinedvar(to) + if bval then + varslist(index).infer.dims=allunknown(to.dims) + end + insert(Equal(list(to),Funcall("mtlb_is",1,Rhs_tlist(to,from,ind),list(to))),1) + // --- Insertion with just one index --- + elseif type(ind)<>15 then + if ind.vtype==String then + if typeof(ind)=="cste" then + if ind.value<>":" then + tree=%i_st2sci(tree) + return + end + end + end + + iscste=typeof(ind)=="cste" + iscolon=%F + if iscste then + iscolon=ind.value==":" + end + + // --- Insertion with just one index which is not : --- + if ~iscolon then + if is_empty(to) then // Insertion in an empty matrix + if typeof(ind)=="cste" then + tree.out(1).dims=list(1,ind.value) + else + tree.out(1).dims=list(1,Unknown) + end + tree.out(1).type=to.type + tree=%i2sci_s(tree) + else + if is_a_scalar(to) then + tree=%i2sci_s(tree) + elseif is_a_vector(to) & to.dims(2)<>1 then + tree=%i2sci_r(tree) + elseif is_a_vector(to) & to.dims(1)<>1 then + tree=%i2sci_c(tree) + else + tree=%i2sci_g(tree) + return + end + end + // --- Insertion with just one index which is : --- + else + if is_empty(to) then // Insertion in an empty matrix + if from.dims(2)<>1 then + if typeof(from)=="variable" then + if isdefinedvar(from) then + break + end + end + insert(Equal(list(to),list(from))) + end + end + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=to.type + end + // --- Insertion with more than one index value (index is a list) --- + else + indexisstr=%F + iscell=%F + for k=1:lstsize(ind) + if type(ind(k))<>15 then + if ind(k).vtype==String then + if typeof(ind(k))=="cste" & ind(k).value=="entries" then + iscell=%T + else + indexisstr=%T + end + end + end + end + if iscell then + tree=%i_ce2sci(tree) + return + end + if indexisstr then + tree=%i_st2sci(tree) + return + end + error(msprintf(gettext("recursive insertion in a variable which is not a Cell nor a Struct: %s."),to.name)) + end + // Two indexes: to(ind1,ind2,...)=from or more + else + if to.vtype==String & from.vtype==String then + tree=list() + to.dims=allunknown(to.dims) + [bval,index]=isdefinedvar(to) + if bval then + varslist(index).infer.dims=allunknown(to.dims) + end + insert(Equal(list(to),Funcall("mtlb_is",1,Rhs_tlist(to,from,tree.operands(2),tree.operands(3)),list(to))),1) + else + tree.out(1).dims=list() + for k=1:lstsize(tree.operands)-2 + tree.out(1).dims(k)=Unknown + end + // dim can be infered when index is a constant and when index value is greater than older dim and this dim is not unknown + for kdim=1:size(tree.operands)-2 + if typeof(tree.operands(kdim+1))=="cste" & tree.operands(kdim+1).vtype<>String then + if to.dims(kdim)<>Unknown then + if to.dims(kdim)<=tree.operands(kdim+1).value then + tree.out(1).dims(kdim)=tree.operands(kdim+1).value; + else + tree.out(1).dims(kdim)=to.dims(kdim) + end + end + end + end + if is_empty(to) then + // a(k,:)=b with a==[] is converted by a(1,1:length(b))=b + if lstsize(tree.operands)-2 == 2 & typeof(tree.operands($-1))=="cste" & tree.operands($-1).value==":" then + length_funcall=Funcall("length",1,Rhs_tlist(tree.operands($)),list()) + tree.operands($-1)=Operation(":",list(Cste(1),length_funcall),list()) + end + // a(:,k)=b with a==[] is converted by a(1:length(b),1)=b + if lstsize(tree.operands)-2 == 2 & typeof(tree.operands($-2))=="cste" & tree.operands($-2).value==":" then + length_funcall=Funcall("length",1,Rhs_tlist(tree.operands($)),list()) + tree.operands($-2)=Operation(":",list(Cste(1),length_funcall),list()) + end + end + tree.out(1).type=from.type + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%i2sci_c.bin b/modules/m2sci/macros/percent/%i2sci_c.bin new file mode 100755 index 000000000..e64c6b345 Binary files /dev/null and b/modules/m2sci/macros/percent/%i2sci_c.bin differ diff --git a/modules/m2sci/macros/percent/%i2sci_c.sci b/modules/m2sci/macros/percent/%i2sci_c.sci new file mode 100755 index 000000000..344bf6db1 --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_c.sci @@ -0,0 +1,46 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%i2sci_c(tree) + // M2SCI function + // Conversion function for Matlab insertion in column vectors (called by %i2sci()) + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + from=tree.operands($) + to=tree.operands(1) + ind=tree.operands(2) + + if from.dims(1)==1 & from.dims(2)==1 then // Insert a scalar + elseif from.dims(2)==1 then // Insert a row vector + elseif from.dims(1)<>Unknown & from.dims(2)<>Unknown then // Insert a matrix with known sizes + tree.operands($)=Funcall("matrix",1,Rhs_tlist(from,1,Operation("-",list(Cste(1)),list()))) + else + if ~isdefinedvar(from) then + w=gettempvar() + insert(Equal(list(w),from)) + else + w=from + end + + // from=from(:)' + tmp=Operation("ext",list(w,Cste(":")),list()) + tmp=Operation("''",list(tmp),list()) + + tree.operands(4)=tmp + tree.operands(3)=Cste(1) + tree.operands(2)=ind + end + + // Data inference + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=to.type +endfunction + + diff --git a/modules/m2sci/macros/percent/%i2sci_g.bin b/modules/m2sci/macros/percent/%i2sci_g.bin new file mode 100755 index 000000000..60452b3ff Binary files /dev/null and b/modules/m2sci/macros/percent/%i2sci_g.bin differ diff --git a/modules/m2sci/macros/percent/%i2sci_g.sci b/modules/m2sci/macros/percent/%i2sci_g.sci new file mode 100755 index 000000000..380e6200e --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_g.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%i2sci_g(tree) + // M2SCI function + // Conversion function for Matlab insertion in matrices (called by %i2sci()) + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + from=tree.operands($) + to=tree.operands(1) + ind=tree.operands(2) + + newtree=Funcall("mtlb_i",1,Rhs_tlist(to,ind,from),list(to)) + insert(Equal(list(to),newtree)) + tree=list() +endfunction + + diff --git a/modules/m2sci/macros/percent/%i2sci_r.bin b/modules/m2sci/macros/percent/%i2sci_r.bin new file mode 100755 index 000000000..e0afc88fe Binary files /dev/null and b/modules/m2sci/macros/percent/%i2sci_r.bin differ diff --git a/modules/m2sci/macros/percent/%i2sci_r.sci b/modules/m2sci/macros/percent/%i2sci_r.sci new file mode 100755 index 000000000..37f132275 --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_r.sci @@ -0,0 +1,46 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%i2sci_r(tree) + // M2SCI function + // Conversion function for Matlab insertion in row vectors (called by %i2sci()) + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + from=tree.operands($) + to=tree.operands(1) + ind=tree.operands(2) + + if from.dims(1)==1 & from.dims(2)==1 then // Insert a scalar + elseif from.dims(1)==1 then // Insert a row vector + elseif from.dims(1)<>Unknown & from.dims(2)<>Unknown then // Insert a matrix with known sizes + tree.operands($)=Funcall("matrix",1,Rhs_tlist(from,1,Operation("-",list(Cste(1)),list()))) + else + if ~isdefinedvar(from) then + w=gettempvar() + insert(Equal(list(w),from)) + else + w=from + end + + // from=from(:).' + tmp=Operation("ext",list(w,Cste(":")),list()) + tmp=Operation(".''",list(tmp),list()) + + tree.operands(4)=tmp + tree.operands(3)=ind + tree.operands(2)=Cste(1) + end + + // Data inference + tree.out(1).dims=list(1,Unknown) + tree.out(1).type=to.type +endfunction + + diff --git a/modules/m2sci/macros/percent/%i2sci_s.bin b/modules/m2sci/macros/percent/%i2sci_s.bin new file mode 100755 index 000000000..af23a49dc Binary files /dev/null and b/modules/m2sci/macros/percent/%i2sci_s.bin differ diff --git a/modules/m2sci/macros/percent/%i2sci_s.sci b/modules/m2sci/macros/percent/%i2sci_s.sci new file mode 100755 index 000000000..e73361fc1 --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_s.sci @@ -0,0 +1,33 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%i2sci_s(tree) + // M2SCI function + // Conversion function for Matlab insertion in scalars (called by %i2sci()) + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + from=tree.operands($) + to=tree.operands(1) + ind=tree.operands(2) + + tree.operands(2)=list(Cste(1),ind) + if ~is_a_scalar(from) & from.dims(1)<>1 then + tree.operands($)=Funcall("matrix",1,Rhs_tlist(from,1,Operation("-",list(Cste(1)),list())),list()) + end + + // Data inference + if typeof(ind)=="cste" then + tree.out(1).dims=list(1,ind.value) + else + tree.out(1).dims=list(1,Unknown) + end + tree.out(1).type=to.type +endfunction + diff --git a/modules/m2sci/macros/percent/%i_ce2sci.bin b/modules/m2sci/macros/percent/%i_ce2sci.bin new file mode 100755 index 000000000..b224be906 Binary files /dev/null and b/modules/m2sci/macros/percent/%i_ce2sci.bin differ diff --git a/modules/m2sci/macros/percent/%i_ce2sci.sci b/modules/m2sci/macros/percent/%i_ce2sci.sci new file mode 100755 index 000000000..2c3fbcd89 --- /dev/null +++ b/modules/m2sci/macros/percent/%i_ce2sci.sci @@ -0,0 +1,172 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%i_ce2sci(tree) + // M2SCI function + // Conversion function for Matlab insertion in cells + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + from=tree.operands($) + to=tree.operands(1) + // Verify that to is not a struct (cell of struct) + inds=tree.operands;inds(1)=null();inds($)=null() + if type(inds)<>15 then + inds=list(inds) + end + for kinds=1:lstsize(inds) + if typeof(inds(kinds))<>"list" & inds(kinds).vtype==String & typeof(inds(kinds))=="cste" & inds(kinds).value<>":" then + tree=%i_st2sci(tree) + return + end + end + + if to.vtype<>Struct then + if and(to.vtype<>[Cell,Unknown]) then + if to.vtype==Double & and(to.dims==list(0,0)) then + insert(Equal(list(to),Funcall("cell",1,list(),list(to)))) + // To be sure that variable will now be of type Cell + [bval,index]=isdefinedvar(to) + varslist(index).infer.type.vtype=Cell + else + error(msprintf(gettext("destination variable is not a cell: %s is of type %s."),to.name,string(to.vtype))) + end + elseif to.vtype==Unknown then + insert(Equal(list(to),Funcall("cell",1,list(),list(to)))) + // To be sure that variable will now be of type Cell + [bval,index]=isdefinedvar(to) + varslist(index).infer.type.vtype=Cell + end + end + // Just one index value + if rhs==1 then + ind=tree.operands(2) + if type(ind)<>15 then // One value index A(xx)={...} + tree.operands(2)=list(Cste(1),ind) + tree.out(1).vtype=Cell + if typeof(ind)=="cste" then + if ind.vtype<>String then // Not : + tree.out(1).dims=list(1,ind.value) + + // Data added so that extraction of a cell element can also be infered + tree.out(1).contents.index($+1)=tree.operands(2) + tree.out(1).contents.data($+1)=Infer(list(1,1),Type(Cell,Unknown),from.contents) + + if lstsize(from.contents.data)==1 then + tree.out(1).contents.index($+1)=list(tree.operands(2),Cste("entries")) + tree.out(1).contents.data($+1)=from.contents.data(1) + else + error(gettext("Not yet implemented.")) + end + else + tree.out(1).infer=from.infer + end + else + tree.out(1).dims=list(1,Unknown) + end + else // --- Insertion with more than one index value (index is a list) --- + // Cell array of struct A{p,q,...}.name... or recursive index A{p,q,...}(1,2)... + for kind=1:lstsize(tree.operands(2)) + if typeof(tree.operands(2)(kind))=="cste" then + if tree.operands(2)(kind).vtype<>String then + tree.operands(2)(kind)=list(Cste(1),tree.operands(2)(kind)) + end + end + end + IND=tree.operands(2)(1) + // Update cell dims for inference + if typeof(IND)=="list" then + if lstsize(IND)>lstsize(tree.out(1).dims) then + for kd=lstsize(tree.out(1).dims):lstsize(IND) + tree.out(1).dims(kd)=Unknown + end + end + for kd=1:lstsize(tree.out(1).dims) + if typeof(IND(kd))=="cste" & tree.out(1).dims(kd)<>Unknown & tree.out(1).dims(kd)Infer()) then + tmp.infer=get_contents_infer(tree.operands(1),tmpind) + end + oplist(1)=tmp + + for kind=1:size(ind($)) + oplist($+1)=ind($)(kind) + end + + oplist($+1)=tree.operands($) + + newop=Operation("ins",oplist,list(tmp)) + newop=%i2sci(newop) + tree.out(1).infer.contents.index($+1)=tmpind + tree.out(1).infer.contents.data($+1)=newop.out(1).infer + elseif ind($).vtype==String then + tree.out(1).type=Type(Struct,Unknown) + end + + // Update cell contents + infertree=tree.operands(2) + tree.out(1).contents.index($+1)=infertree + tree.out(1).contents.data($+1)=from.infer + end + // Two indexes: to(ind1,ind2,...)=from or more + else + tree.out(1).dims=list() + for k=1:lstsize(tree.operands)-2 + tree.out(1).dims(k)=Unknown + end + + // dim can be infered when index is a constant and when index value is greater than older dim and this dim is not unknown + for kdim=1:size(tree.operands)-2 + if typeof(tree.operands(kdim+1))=="cste" then + if to.dims(kdim)<>Unknown then + if to.dims(kdim)<=tree.operands(kdim+1).value then + tree.out(1).dims(kdim)=tree.operands(kdim+1).value; + else + tree.out(1).dims(kdim)=to.dims(kdim) + end + end + end + end + tree.out(1).type=from.type + + // Update contents... + infertree=tree.operands + infertree(1)=null() + infertree($)=null() + + // Data added so that extraction of a cell element can also be infered + tree.out(1).contents.index($+1)=infertree + tree.out(1).contents.data($+1)=Infer(list(1,1),Type(Cell,Unknown),Contents()) + + infertree=list(infertree,Cste("entries")) + if lstsize(from.contents.index)==1 then + tree.out(1).contents.index($+1)=infertree + tree.out(1).contents.data($+1)=from.contents.data(1); + elseif lstsize(from.contents.index)==0 then + tree.out(1).contents=Contents() + else + error(gettext("Not yet implemented.")) + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%i_st2sci.bin b/modules/m2sci/macros/percent/%i_st2sci.bin new file mode 100755 index 000000000..c2d15c7c8 Binary files /dev/null and b/modules/m2sci/macros/percent/%i_st2sci.bin differ diff --git a/modules/m2sci/macros/percent/%i_st2sci.sci b/modules/m2sci/macros/percent/%i_st2sci.sci new file mode 100755 index 000000000..9ce57cac7 --- /dev/null +++ b/modules/m2sci/macros/percent/%i_st2sci.sci @@ -0,0 +1,191 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%i_st2sci(tree) + // M2SCI function + // Conversion function for Matlab insertion in structs + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation functions: mtlb_i() and mtlb_is() + + // Global variable for M2SCI + global("varslist") + + from=tree.operands($) + to=tree.operands(1) + + // Insertion of a struct in a not-struct array + if typeof(to)=="variable" & to.vtype<>Struct then + // To be sure that variable will now be of type Struct + [bval,index]=isdefinedvar(to) + varslist(index).infer.type.vtype=Struct + varslist(index).infer.contents=Contents() + tree.out(1).infer=Infer(list(0,0),Type(Struct,Unknown),Contents()) + elseif typeof(to)=="operation" & to.vtype<>Struct then + // To be sure that variable will now be of type Struct + [bval,index]=isdefinedvar(to.operands(1)) + varslist(index).infer.type.vtype=Struct + varslist(index).infer.contents=Contents() + tree.out(1).infer=Infer(list(0,0),Type(Struct,Unknown),Contents()) + end + + // Just one index value + if rhs==1 then + ind=tree.operands(2) + // --- Insertion with just one index --- + if type(ind)<>15 then + // --- Insertion in a struct with just one index --- + if ind.vtype==String then // A.f + tree.out(1).dims=list(1,1); + tree.out(1).vtype=Struct + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),ind) + tree.out(1).contents.data($+1)=from.infer + else + if from.vtype<>Double then // X(p)=struct(...) + tree.operands(2)=list(Cste(1),tree.operands(2)) + tree.out(1).vtype=Struct + if typeof(ind)=="cste" then + if ind.vtype<>String then // Not : + tree.out(1).dims=list(1,ind.value) + + tree.out(1).contents.index($+1)=list(Cste(1),ind) + + // Update contents for an extraction of type: z = X(p) + CONT=Contents() + for k=1:lstsize(from.infer.contents.index) + if type(from.contents.index(k)(1))==15 then + CONT.index($+1)=list(from.contents.index(k)(2)) + else + CONT.index($+1)=list(from.contents.index(k)) + end + CONT.data($+1)=from.contents.data(k) + end + tree.out(1).contents.data($+1)=Infer(list(1,1),Type(Struct,Unknown),CONT) + + // Update contents for extraction of type: z = X(p).f + for k=1:lstsize(from.infer.contents.index) + if type(from.contents.index(k)(1))==15 then + tree.out(1).contents.index($+1)=list(list(Cste(1),ind),from.contents.index(k)(2)) + else + tree.out(1).contents.index($+1)=list(list(Cste(1),ind),from.contents.index(k)) + end + tree.out(1).contents.data($+1)=from.contents.data(k) + end + else + tree.out(1).dims=from.dims + tree.out(1).contents=from.contents + end + end + else + if is_empty(from) then // Clear element: A(p)=[] + // Nothing done + else // Change type of variable + error(gettext("Not yet implemented.")) + end + end + end + // --- Insertion with more than one index value (index is a recursive index list) --- + else + + // Change index value if just one double + for k=1:lstsize(ind) + //ind(k+1) <-> tree.operands(2)(k+1) + if typeof(ind(k))=="cste" | (typeof(ind(k))<>"list" & is_a_scalar(ind(k))) then + if ind(k).vtype<>String then + tree.operands(2)(k)=list(Cste(1),tree.operands(2)(k)) + end + end + end + ind=tree.operands(2); + + if typeof(ind($))=="list" | ind($).vtype~=String then // X.p(m,n)=y + tmp=gettempvar() + oplist=list() + + tmpind=ind + tmpind($)=null() + if or(get_contents_infer(tree.operands(1),tmpind)<>Infer()) then + tmp.infer=get_contents_infer(tree.operands(1),tmpind) + end + oplist(1)=tmp + + for kind=1:size(ind($)) + oplist($+1)=ind($)(kind) + end + + oplist($+1)=tree.operands($) + + newop=Operation("ins",oplist,list(tmp)) + newop=%i2sci(newop) + tree.out(1).infer.contents.index($+1)=tmpind + tree.out(1).infer.contents.data($+1)=newop.out(1).infer + end + + infertree=tree.operands(2) + + // A(x,y,...).f + if typeof(infertree(1))=="list" then + possible_dims=infertree(1) + infdims=tree.out(1).dims + if lstsize(infdims)"cste" then + infdims(k)=Unknown + elseif infdims(k)<>Unknown & infdims(k)Unknown then + if to.dims(kdim)<=tree.operands(kdim+1).value then + tree.out(1).dims(kdim)=tree.operands(kdim+1).value; + else + tree.out(1).dims(kdim)=to.dims(kdim) + end + end + end + end + tree.out(1).type=from.type + + // Update contents + ind=tree.operands + ind(1)=null() + ind($)=null() + tree.out(1).infer.contents.index($+1)=ind + tree.out(1).infer.contents.data($+1)=from.infer + + end +endfunction + diff --git a/modules/m2sci/macros/percent/%imp2sci.bin b/modules/m2sci/macros/percent/%imp2sci.bin new file mode 100755 index 000000000..f9e630c8c Binary files /dev/null and b/modules/m2sci/macros/percent/%imp2sci.bin differ diff --git a/modules/m2sci/macros/percent/%imp2sci.sci b/modules/m2sci/macros/percent/%imp2sci.sci new file mode 100755 index 000000000..cfe706810 --- /dev/null +++ b/modules/m2sci/macros/percent/%imp2sci.sci @@ -0,0 +1,83 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%imp2sci(tree) + // M2SCI function + // Conversion function for Matlab colon + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_imp() + + // A:B + if size(tree.operands)==2 then + + // Convert all inputs to double because Matlab also accept Strings... + [A,B] = getoperands(tree) + + if A.vtype<>String then + A = convert2double(A) + end + if B.vtype<>String then + B = convert2double(B) + end + tree.operands=list(A,B) + + if is_empty(A) | is_empty(B) then + set_infos(msprintf(gettext("One operand is an empty matrix in : %s, result set to []."),expression2code(tree)),1); + tree=Cste([]) + tree.dims=list(1,0) + elseif not_empty(A) & not_empty(B) then + tree.out(1).type=Type(Double,Real) + if and([A.vtype,B.vtype]==String) then + tree.out(1).dims=list(1,size(asciimat(A.value):asciimat(B.value),"*")) + tree.out(1).type=Type(String,Real) + elseif and([typeof(A),typeof(B)]=="cste") then + tree.out(1).dims=list(1,size(A.value:B.value,"*")) + else + tree.out(1).dims=list(1,Unknown) + end + else + tree=Funcall("mtlb_imp",1,list(A,B),tree.out) + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + // A:inc:B + else + + // Convert all inputs to double because Matlab also accept Strings... + [A,inc,B]=getoperands(tree) + if A.vtype<>String then + A = convert2double(A) + end + if B.vtype<>String then + B = convert2double(B) + end + if inc.vtype<>String then + inc = convert2double(inc) + end + tree.operands=list(A,inc,B) + + if is_empty(A) | is_empty(B) | is_empty(inc) then + set_infos(msprintf(gettext("One operand is an empty matrix in : %s, result set to []."),expression2code(tree)),1); + tree=Cste([]) + tree.dims=list(1,0) + elseif not_empty(A) & not_empty(B) & not_empty(inc) then + tree.out(1).dims=list(1,Unknown) + tree.out(1).type=Type(Double,Real) + else + tree=Funcall("mtlb_imp",1,list(A,inc,B),tree.out) + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + if and([A.vtype,B.vtype]==String) then + tree.out(1).type=Type(String,Real) + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%j2sci.bin b/modules/m2sci/macros/percent/%j2sci.bin new file mode 100755 index 000000000..6615840fa Binary files /dev/null and b/modules/m2sci/macros/percent/%j2sci.bin differ diff --git a/modules/m2sci/macros/percent/%j2sci.sci b/modules/m2sci/macros/percent/%j2sci.sci new file mode 100755 index 000000000..a8d11d79e --- /dev/null +++ b/modules/m2sci/macros/percent/%j2sci.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%j2sci(tree) + // M2SCI function + // Conversion function for Matlab elementwise exponent + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + [A,B] = getoperands(tree) + + // Scilab exponent does not work with Strings, Booleans... + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + else + // Output can be Complex or Real whatever are the inputs + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=allunknown(A.dims) + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%l2sci.bin b/modules/m2sci/macros/percent/%l2sci.bin new file mode 100755 index 000000000..9adf49a8f Binary files /dev/null and b/modules/m2sci/macros/percent/%l2sci.bin differ diff --git a/modules/m2sci/macros/percent/%l2sci.sci b/modules/m2sci/macros/percent/%l2sci.sci new file mode 100755 index 000000000..bf2966709 --- /dev/null +++ b/modules/m2sci/macros/percent/%l2sci.sci @@ -0,0 +1,52 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%l2sci(tree) + // M2SCI function + // Conversion function for Matlab left division + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_l() + + [A,B] = getoperands(tree) + + // We have to call mtlb_l() for strings because result is computed with transposed strings... + if or(A.vtype==[String,Unknown]) & or(A.vtype==[String,Unknown]) then + tree=Funcall("mtlb_l",1,list(A,B),tree.out) + tree.lhs(1).dims=allunknown(A.dims) + if A.vtype==String & B.vtype==String then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + else + // Boolean -> Double + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + elseif (is_real(A) & is_complex(B)) | (is_real(B) & is_complex(A)) then + tree.out(1).type=Type(Double,Complex) + else + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=list(A.dims(2),B.dims(2)) + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%log2sci.bin b/modules/m2sci/macros/percent/%log2sci.bin new file mode 100755 index 000000000..6b8ca6753 Binary files /dev/null and b/modules/m2sci/macros/percent/%log2sci.bin differ diff --git a/modules/m2sci/macros/percent/%log2sci.sci b/modules/m2sci/macros/percent/%log2sci.sci new file mode 100755 index 000000000..3bf545d3c --- /dev/null +++ b/modules/m2sci/macros/percent/%log2sci.sci @@ -0,0 +1,59 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%log2sci(tree) + // M2SCI function + // Conversion function for Matlab logical operators + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_logic() + + [A,B]=getoperands(tree) + A=convert2double(A) + B=convert2double(B) + + // Special case for nargout + if typeof(A)=="variable" & typeof(B)=="cste" then + if A.name=="nargout" & B.value==0 then + B=Cste(1) + end + end + if typeof(B)=="variable" & typeof(A)=="cste" then + if B.name=="nargout" & A.value==0 then + A=Cste(1) + end + end + + tree.operands=list(A,B) + + tree.out(1).type=Type(Boolean,Real) + + // Scilab operators >, <, >= and <= do not work with complex values + if or(tree.operator==["<", ">", "<=", ">="]) & (~is_real(A) | ~is_real(B)) then + tree=Funcall("mtlb_logic",1,list(A,Cste(tree.operator),B),tree.out) + tree.lhs(1).dims=A.dims + else + // Cases with empty matrix + if is_empty(A) | is_empty(B) then + // For >, <, >= and <= : Scilab gives an error message if both operands are [] + // For == and ~= : Scilab returns %T or %F + set_infos(msprintf(gettext("At least one operand is an empty matrix for operator: %s, result set to []."),expression2code(tree)),1); + tree=Cste([]) + elseif is_a_scalar(A) & not_empty(B) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) & not_empty(A) then + tree.out(1).dims=A.dims + elseif not_empty(A) & not_empty(B) then + tree.out(1).dims=A.dims + else + tree=Funcall("mtlb_logic",1,list(A,Cste(tree.operator),B),tree.out) + tree.lhs(1).dims=A.dims + end + end +endfunction diff --git a/modules/m2sci/macros/percent/%m2sci.bin b/modules/m2sci/macros/percent/%m2sci.bin new file mode 100755 index 000000000..e23a280f2 Binary files /dev/null and b/modules/m2sci/macros/percent/%m2sci.bin differ diff --git a/modules/m2sci/macros/percent/%m2sci.sci b/modules/m2sci/macros/percent/%m2sci.sci new file mode 100755 index 000000000..12a2b3aeb --- /dev/null +++ b/modules/m2sci/macros/percent/%m2sci.sci @@ -0,0 +1,75 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%m2sci(tree) + // M2SCI function + // Conversion function for Matlab multiplication + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_m_s.sci + // - %s_m_b.sci + + [A,B]=getoperands(tree) + + // Multiplication does not work with Strings in Scilab + if or(A.vtype==[String,Unknown]) then + A=convert2double(A) + end + if or(B.vtype==[String,Unknown]) then + B=convert2double(B) + end + + // %b_m_b is not defined in Scilab + if A.vtype==Boolean & B.vtype==Boolean then + B=convert2double(B) + end + tree.operands=list(A,B) + + if is_complex(A) & is_complex(B) then + prop=Unknown + elseif A.property==Complex | B.property==Complex then + if not_empty(A) & not_empty(B) then + prop=Complex + elseif is_empty(A) | is_empty(B) then + prop=Real + else + prop=Unknown + end + elseif is_real(A) & is_real(B) then + prop=Real + else + prop=Unknown + end + + tree.out(1).type=Type(Double,prop) + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + elseif not_a_scalar(A) & not_a_scalar(B) then + // A and B have the same dimensions + tree.out(1).dims=A.dims; + for kk=1:size(B.dims) + if B.dims<>Unknown then + tree.out(1).dims(kk) = B.dims(kk); + end + end + elseif not_empty(A) & not_empty(B) then + tree.out(1).dims=list(A.dims(1),B.dims(2)) + elseif is_empty(A) | is_empty(B) then + tree.out(1).dims=list(0,0) + elseif not_empty(A) | not_empty(B) then + tree.out(1).dims=list(A.dims(1),B.dims(2)) + else + tree.out(1).dims=list(Unknown,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/percent/%p2sci.bin b/modules/m2sci/macros/percent/%p2sci.bin new file mode 100755 index 000000000..821c5a0d5 Binary files /dev/null and b/modules/m2sci/macros/percent/%p2sci.bin differ diff --git a/modules/m2sci/macros/percent/%p2sci.sci b/modules/m2sci/macros/percent/%p2sci.sci new file mode 100755 index 000000000..315ec4ae5 --- /dev/null +++ b/modules/m2sci/macros/percent/%p2sci.sci @@ -0,0 +1,42 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%p2sci(tree) + // M2SCI function + // Conversion function for Matlab exponent + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + // Warning: Matlab bug for p^X when p is a character ! + + [A,B] = getoperands(tree) + + // Scilab exponent does not work with Strings, Booleans... + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + else + // Output can be Complex or Real whatever are the inputs + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=allunknown(A.dims) + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%q2sci.bin b/modules/m2sci/macros/percent/%q2sci.bin new file mode 100755 index 000000000..1b47eb7ca Binary files /dev/null and b/modules/m2sci/macros/percent/%q2sci.bin differ diff --git a/modules/m2sci/macros/percent/%q2sci.sci b/modules/m2sci/macros/percent/%q2sci.sci new file mode 100755 index 000000000..74173fe3e --- /dev/null +++ b/modules/m2sci/macros/percent/%q2sci.sci @@ -0,0 +1,39 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%q2sci(tree) + // M2SCI function + // Conversion function for Matlab elementwise left division + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + [A,B] = getoperands(tree) + + // Scilab left division does not work with Strings, Booleans... + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + elseif (is_real(A) & is_complex(B)) | (is_real(B) & is_complex(A)) then + tree.out(1).type=Type(Double,Complex) + else + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + else + tree.out(1).dims=A.dims + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%r2sci.bin b/modules/m2sci/macros/percent/%r2sci.bin new file mode 100755 index 000000000..2f016d7b0 Binary files /dev/null and b/modules/m2sci/macros/percent/%r2sci.bin differ diff --git a/modules/m2sci/macros/percent/%r2sci.sci b/modules/m2sci/macros/percent/%r2sci.sci new file mode 100755 index 000000000..45a1b66e0 --- /dev/null +++ b/modules/m2sci/macros/percent/%r2sci.sci @@ -0,0 +1,42 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%r2sci(tree) + // M2SCI function + // Conversion function for Matlab right division + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + [A,B] = getoperands(tree) + + // Scilab right division does not work with Strings, Booleans... + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + elseif (is_real(A) & is_complex(B)) | (is_real(B) & is_complex(A)) then + tree.out(1).type=Type(Double,Complex) + else + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + else + // Dimensions are Unknown because can be (1,1) if both operands are equal... + tree.out(1).dims=list(Unknown,Unknown) + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%rc2sci.bin b/modules/m2sci/macros/percent/%rc2sci.bin new file mode 100755 index 000000000..ab090f738 Binary files /dev/null and b/modules/m2sci/macros/percent/%rc2sci.bin differ diff --git a/modules/m2sci/macros/percent/%rc2sci.sci b/modules/m2sci/macros/percent/%rc2sci.sci new file mode 100755 index 000000000..451ab030f --- /dev/null +++ b/modules/m2sci/macros/percent/%rc2sci.sci @@ -0,0 +1,97 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function [tree]=%rc2sci(tree) + + // Make a 'row' with many columns + + if tree.operands(1).vtype==Cell then + tree=%rc_cell2sci(tree) + return + end + + colnb=size(tree.operands) + row=list() + rowsize=[] + colsize=[] + typ=Double + + realcols=0 + complexcols=0 + + for k=1:colnb + rk=tree.operands(k) + row(k)=rk + if rk.vtype==String then + typ=String + end + rowsize=[rowsize tree.operands(k).dims(1)] + colsize=[colsize tree.operands(k).dims(2)] + if rk.property==Complex then + complexcols=complexcols+1 + end + if rk.property==Real then + realcols=realcols+1 + end + end + + if realcols==colnb then + prop=Real + elseif complexcols<>0 then + prop=Complex + else + prop=Unknown + end + + undef=find(rowsize==-1) + void=find(rowsize==0) + rowsize([undef void])=[] + if rowsize==[] then + if undef<>[] then + sr=-1 + else + sr=0 + end + else + [w,k]=min(length(rowsize)) + sr=rowsize(k) + end + + if typ<>String then + if find(colsize==-1)==[] then + w=colsize(1) + for k=2:colnb + w=w+colsize(k) + end + sc=w + else + sc=-1 + end + + tree.out(1).dims=list(sr,sc) + tree.out(1).type=Type(rk.vtype,prop) + else + if find(colsize==-1)==[] then + w=colsize(1) + for k=2:colnb + w=w+colsize(k) + end + sc=w + else + sc=-1 + end + + tree.out(1).dims=list(sr,sc) + tree.out(1).type=Type(String,Real) + tree=Operation("+",tree.operands,tree.out) + end + tree.out(1).contents=Contents() +endfunction + + diff --git a/modules/m2sci/macros/percent/%rc_cell2sci.bin b/modules/m2sci/macros/percent/%rc_cell2sci.bin new file mode 100755 index 000000000..4fded4cf2 Binary files /dev/null and b/modules/m2sci/macros/percent/%rc_cell2sci.bin differ diff --git a/modules/m2sci/macros/percent/%rc_cell2sci.sci b/modules/m2sci/macros/percent/%rc_cell2sci.sci new file mode 100755 index 000000000..1f3639372 --- /dev/null +++ b/modules/m2sci/macros/percent/%rc_cell2sci.sci @@ -0,0 +1,41 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// 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.1-en.txt + +function tree=%rc_cell2sci(tree) + + // Make a CELL 'row' with many columns + + if typeof(tree.operands(1))=="funcall" then + if tree.operands(1).name=="cell" then + tree.out(1).infer=Infer(list(1,1),Type(Cell,Unknown),Contents()) + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data($+1)=tree.operands(2).infer + return + end + end + + if tree.operands(1).vtype==Cell then + tree.out(1).infer=tree.operands(1).infer + else + tree.out(1).infer=Infer(list(1,1),Type(Cell,Unknown),Contents()) + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data($+1)=tree.operands(1).infer + end + dim1=tree.operands(1).dims(1) + dim2=tree.operands(1).dims(2) + tree.out(1).contents.index($+1)=list(list(Cste(dim1),Cste(dim2+1)),Cste("entries")) + tree.out(1).contents.data($+1)=tree.operands(2).infer + + if tree.out(1).dims(2)<>Unknown then + tree.out(1).dims(2)=tree.out(1).dims(2)+1 + end + if tree.out(1).dims(1)==0 then + tree.out(1).dims(1)=tree.out(1).dims(1)+1 + end +endfunction diff --git a/modules/m2sci/macros/percent/%s2sci.bin b/modules/m2sci/macros/percent/%s2sci.bin new file mode 100755 index 000000000..595f0095a Binary files /dev/null and b/modules/m2sci/macros/percent/%s2sci.bin differ diff --git a/modules/m2sci/macros/percent/%s2sci.sci b/modules/m2sci/macros/percent/%s2sci.sci new file mode 100755 index 000000000..ec3c52bed --- /dev/null +++ b/modules/m2sci/macros/percent/%s2sci.sci @@ -0,0 +1,78 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%s2sci(tree) + // M2SCI function + // Conversion function for Matlab subtraction + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_s() + + // In Matlab only two matrices with the same size can be added unless one is a scalar + // So empty matrix can only be added to a scalar or an onther empty matrix + // For example: [1,2,3]-[] is not possible + // An other important difference with Scilab is that: + // - Matlab gives : [1]-[]=[] + // - Scilab gives : [1]-[]=[1] + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_s_s.sci + // - %s_s_b.sci + + // Binary operator: A-B + if size(tree.operands)==2 then + [A,B]=getoperands(tree) + + // Matlab and Scilab subtraction do not match for Strings + if or(A.vtype==[String,Unknown]) then + A=convert2double(A) + end + if or(B.vtype==[String,Unknown]) then + B=convert2double(B) + end + + // %b_s_b is not defined in Scilab + if A.vtype==Boolean & B.vtype==Boolean + A=convert2double(A) + end + + tree.operands=list(A,B) + + // Type inference + if (is_complex(A) & is_real(B)) | (is_complex(B) & is_real(A)) then + tree.out(1).type=Type(Double,Complex) + elseif is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + else + tree.out(1).type=Type(Double,Unknown) + end + + // When both operands are not [] Scilab and Matlab give the same results + if not_empty(A) & not_empty(B) then + if is_a_scalar(A) then + tree.out(1).dims=B.dims + else + tree.out(1).dims=A.dims + end + // If at least one operand is [] then Matlab result is [] but not Scilab one + elseif is_empty(A) | is_empty(B) then + set_infos(msprintf(gettext("At least one operand of %s is an empty matrix, Scilab equivalent is []."),expression2code(tree)),0) + tree=Cste([]) + else + tree.out(1).dims=allunknown(A.dims); + tree=Funcall("mtlb_s",1,list(A,B),tree.out); + end + else + A=getoperands(tree) + //A=convert2double(A) + tree.operands=list(A) + tree.out(1).dims=A.dims + tree.out(1).type=A.type + end +endfunction diff --git a/modules/m2sci/macros/percent/%t2sci.bin b/modules/m2sci/macros/percent/%t2sci.bin new file mode 100755 index 000000000..00d53892b Binary files /dev/null and b/modules/m2sci/macros/percent/%t2sci.bin differ diff --git a/modules/m2sci/macros/percent/%t2sci.sci b/modules/m2sci/macros/percent/%t2sci.sci new file mode 100755 index 000000000..af6c53f55 --- /dev/null +++ b/modules/m2sci/macros/percent/%t2sci.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%t2sci(tree) + // M2SCI function + // Conversion function for Matlab transpose + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_t() + + A = getoperands(tree) + + tree.out(1).dims=list(A.dims(2),A.dims(1)) + tree.out(1).type=A.type + + // Scilab and Matlab transposition do not work in the same way for strings + if or(A.vtype==[String,Unknown]) then + tree=Funcall("mtlb_t",1,Rhs_tlist(A),tree.out) + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%x2sci.bin b/modules/m2sci/macros/percent/%x2sci.bin new file mode 100755 index 000000000..8b21ea45b Binary files /dev/null and b/modules/m2sci/macros/percent/%x2sci.bin differ diff --git a/modules/m2sci/macros/percent/%x2sci.sci b/modules/m2sci/macros/percent/%x2sci.sci new file mode 100755 index 000000000..6ab4cc590 --- /dev/null +++ b/modules/m2sci/macros/percent/%x2sci.sci @@ -0,0 +1,62 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=%x2sci(tree) + // M2SCI function + // Conversion function for Matlab elementwise multiplication + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_x_s.sci + // - %s_x_b.sci + + [A,B]=getoperands(tree) + + // Dot multiplication does not work with Strings in Scilab + if or(A.vtype==[String,Unknown]) then + A=convert2double(A) + end + if or(B.vtype==[String,Unknown]) then + B=convert2double(B) + end + + // %b_x_b is not defined in Scilab$ + if A.vtype==Boolean & B.vtype==Boolean then + A = convert2double(A) + end + + tree.operands=list(A,B) + + if is_complex(A) & is_complex(B) then + prop=Unknown + elseif A.property==Complex | B.property==Complex then + if not_empty(A) & not_empty(B) then + prop=Complex + elseif is_empty(A) | is_empty(B) then + prop=Real + else + prop=Unknown + end + elseif is_real(A) & is_real(B) then + prop=Real + else + prop=Unknown + end + + tree.out(1).type=Type(Double,prop) + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=list(A.dims(1),B.dims(2)) + end +endfunction diff --git a/modules/m2sci/macros/percent/buildmacros.sce b/modules/m2sci/macros/percent/buildmacros.sce new file mode 100755 index 000000000..44591ce9a --- /dev/null +++ b/modules/m2sci/macros/percent/buildmacros.sce @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2005 - INRIA - 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.1-en.txt + +//------------------------------------ +if (isdef("genlib") == %f) then + exec(SCI+"/modules/functions/scripts/buildmacros/loadgenlib.sce"); +end +//------------------------------------ +genlib("m2scipercentlib","SCI/modules/m2sci/macros/percent",%f,%t); +//------------------------------------ diff --git a/modules/m2sci/macros/percent/get_contents_infer.bin b/modules/m2sci/macros/percent/get_contents_infer.bin new file mode 100755 index 000000000..f6e522e4a Binary files /dev/null and b/modules/m2sci/macros/percent/get_contents_infer.bin differ diff --git a/modules/m2sci/macros/percent/get_contents_infer.sci b/modules/m2sci/macros/percent/get_contents_infer.sci new file mode 100755 index 000000000..20680b191 --- /dev/null +++ b/modules/m2sci/macros/percent/get_contents_infer.sci @@ -0,0 +1,43 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [infertlist,pos]=get_contents_infer(from,index) + // Search inference data in the contents of a cell or a struct corresponding to a particular index + // Input: + // - from: the cell or struct where we have to search + // - index: index to search + // Output: + // - infertlist: inference data found + // - pos: position where index has been found + + pos=0; + infertlist=Infer(); + + for k=1:lstsize(from.contents.index) + allequal=[] + if lstsize(index)==lstsize(from.contents.index(k)) then // Indexes must have the same size + for ki=1:lstsize(index) + if typeof(index(ki))==typeof(from.contents.index(k)(ki)) then // Index elements must have the same type + if typeof(index(ki))<>"list" then + allequal=allequal & ( and(index(ki)==from.contents.index(k)(ki)) | and(from.contents.index(k)(ki)==Cste("*")) ) + elseif typeof(index(ki))=="list" then + for kii=1:lstsize(index(ki)) + allequal=allequal & ( and(index(ki)(kii)==from.contents.index(k)(ki)(kii)) | and(from.contents.index(k)(ki)(kii)==Cste("*")) ) + end + end + end + end + end + if ~isempty(allequal) & allequal then + pos=k + infertlist=from.contents.data(k) + return + end + end +endfunction diff --git a/modules/m2sci/macros/percent/lib b/modules/m2sci/macros/percent/lib new file mode 100755 index 000000000..c9d0a5a8a Binary files /dev/null and b/modules/m2sci/macros/percent/lib differ diff --git a/modules/m2sci/macros/percent/names b/modules/m2sci/macros/percent/names new file mode 100755 index 000000000..83d1ef104 --- /dev/null +++ b/modules/m2sci/macros/percent/names @@ -0,0 +1,32 @@ +%02sci +%52sci +%a2sci +%cc2sci +%cc_cell2sci +%d2sci +%e2sci +%e_ce2sci +%e_st2sci +%g2sci +%h2sci +%i2sci +%i2sci_c +%i2sci_g +%i2sci_r +%i2sci_s +%i_ce2sci +%i_st2sci +%imp2sci +%j2sci +%l2sci +%log2sci +%m2sci +%p2sci +%q2sci +%r2sci +%rc2sci +%rc_cell2sci +%s2sci +%t2sci +%x2sci +get_contents_infer diff --git a/modules/m2sci/macros/sci_files/GEN b/modules/m2sci/macros/sci_files/GEN new file mode 100755 index 000000000..30ce3b01e --- /dev/null +++ b/modules/m2sci/macros/sci_files/GEN @@ -0,0 +1,10 @@ +#!/bin/sh +# +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) ???? - INRIA - Scilab +# +# This file is distributed under the same license as the Scilab package. +# +# GEN prototype Matlab_fun_name Scilab_fun_name +sed -e "s/Prototype.*$/File generated from $1: PLEASE DO NOT EDIT !/" -e "s/MFUN/$2/g" -e "s/SFUN/$3/g" $1 + diff --git a/modules/m2sci/macros/sci_files/Makeproto b/modules/m2sci/macros/sci_files/Makeproto new file mode 100755 index 000000000..9bc2d1e87 --- /dev/null +++ b/modules/m2sci/macros/sci_files/Makeproto @@ -0,0 +1,200 @@ +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) ???? - INRIA - Scilab +# +# This file is distributed under the same license as the Scilab package. + +# This Makefile is used to build sci_funname.sci files from PROTOx.g + +PROTO0 = sci_abs.sci sci_cos.sci sci_cosh.sci sci_erf.sci sci_erfc.sci\ + sci_erfcx.sci sci_gamma.sci sci_gammaln.sci sci_imag.sci sci_real.sci +PROTO1 = sci_max.sci sci_min.sci +PROTO2 = sci_cumprod.sci sci_cumsum.sci +PROTO3 = sci_eye.sci sci_false.sci sci_ones.sci sci_rand.sci sci_randn.sci sci_true.sci sci_zeros.sci +PROTO4 = sci_acosh.sci sci_asinh.sci sci_conj.sci sci_cot.sci sci_coth.sci sci_double.sci sci_exp.sci sci_expm.sci sci_inv.sci sci_log.sci sci_log10.sci sci_sign.sci sci_sin.sci sci_sinh.sci sci_sqrt.sci sci_tan.sci sci_tanh.sci +PROTO5 = sci_asin.sci sci_atanh.sci sci_atan.sci +PROTO6 = sci_ceil.sci sci_fix.sci sci_floor.sci sci_round.sci +PROTO7 = sci_tril.sci sci_triu.sci +PROTO8 = sci_prod.sci sci_sum.sci +PROTO9 = sci_int8.sci sci_int16.sci sci_int32.sci sci_uint8.sci sci_uint16.sci sci_uint32.sci +PROTO10 = sci_lower.sci sci_upper.sci +PROTO11 = sci_dos.sci sci_unix.sci +PROTO12 = sci_who.sci sci_whos.sci +PROTO13 = sci_all.sci sci_any.sci +PROTO14 = sci_acos.sci +PROTO15 = sci_nargin.sci sci_nargout.sci + +# Files generated from file : sci_PROTO0.g +sci_abs.sci: sci_PROTO0.g + @./GEN $? abs abs > $@ +sci_cos.sci: sci_PROTO0.g + @./GEN $? cos cos > $@ +sci_cosh.sci: sci_PROTO0.g + @./GEN $? cosh cosh > $@ +sci_erf.sci: sci_PROTO0.g + @./GEN $? erf erf > $@ +sci_erfc.sci: sci_PROTO0.g + @./GEN $? erfc erfc > $@ +sci_erfcx.sci: sci_PROTO0.g + @./GEN $? erfcx erfcx > $@ +sci_gamma.sci: sci_PROTO0.g + @./GEN $? gamma gamma > $@ +sci_gammaln.sci: sci_PROTO0.g + @./GEN $? gammaln gammaln > $@ +sci_imag.sci: sci_PROTO0.g + @./GEN $? imag imag > $@ +sci_real.sci: sci_PROTO0.g + @./GEN $? real real > $@ + +# Files generated from file : sci_PROTO1.g +sci_max.sci: sci_PROTO1.g + @./GEN $? max max > $@ +sci_min.sci: sci_PROTO1.g + @./GEN $? min min > $@ + +# Files generated from file : sci_PROTO2.g +sci_cumprod.sci: sci_PROTO2.g + @./GEN $? cumprod cumprod > $@ +sci_cumsum.sci: sci_PROTO2.g + @./GEN $? cumsum cumsum > $@ + +# Files generated from file : sci_PROTO3.g +sci_eye.sci: sci_PROTO3.g + @./GEN $? eye eye > $@ +sci_false.sci: sci_PROTO3.g + @./GEN $? false zeros > $@ +sci_ones.sci: sci_PROTO3.g + @./GEN $? ones ones > $@ +sci_rand.sci: sci_PROTO3.g + @./GEN $? rand rand > $@ +sci_randn.sci: sci_PROTO3.g + @./GEN $? randn rand > $@ +sci_true.sci: sci_PROTO3.g + @./GEN $? true ones > $@ +sci_zeros.sci: sci_PROTO3.g + @./GEN $? zeros zeros > $@ + +# Files generated from file : sci_PROTO4.g (Output property same as input) +sci_acosh.sci: sci_PROTO4.g + @./GEN $? acosh acosh > $@ +sci_asinh.sci: sci_PROTO4.g + @./GEN $? asinh asinh > $@ +sci_conj.sci: sci_PROTO4.g + @./GEN $? conj conj > $@ +sci_cot.sci: sci_PROTO4.g + @./GEN $? cot cotg > $@ +sci_coth.sci: sci_PROTO4.g + @./GEN $? coth coth > $@ +sci_double.sci: sci_PROTO4.g + @./GEN $? double double > $@ +sci_exp.sci: sci_PROTO4.g + @./GEN $? exp exp > $@ +sci_expm.sci: sci_PROTO4.g + @./GEN $? expm expm > $@ +sci_inv.sci: sci_PROTO4.g + @./GEN $? inv inv > $@ +sci_log.sci: sci_PROTO4.g + @./GEN $? log log > $@ +sci_log10.sci: sci_PROTO4.g + @./GEN $? log10 log10 > $@ +sci_sign.sci: sci_PROTO4.g + @./GEN $? sign sign > $@ +sci_sin.sci: sci_PROTO4.g + @./GEN $? sin sin > $@ +sci_sinh.sci: sci_PROTO4.g + @./GEN $? sinh sinh > $@ +sci_sqrt.sci: sci_PROTO4.g + @./GEN $? sqrt sqrt > $@ +sci_tan.sci: sci_PROTO4.g + @./GEN $? tan tan > $@ +sci_tanh.sci: sci_PROTO4.g + @./GEN $? tanh tanh > $@ + +# Files generated from file : sci_PROTO5.g +sci_asin.sci: sci_PROTO5.g + @./GEN $? asin asin > $@ +sci_atan.sci: sci_PROTO5.g + @./GEN $? atan atan > $@ +sci_atanh.sci: sci_PROTO5.g + @./GEN $? atanh atanh > $@ + +# Files generated from file : sci_PROTO6.g +sci_ceil.sci: sci_PROTO6.g + @./GEN $? ceil ceil > $@ +sci_fix.sci: sci_PROTO6.g + @./GEN $? fix fix > $@ +sci_floor.sci: sci_PROTO6.g + @./GEN $? floor floor > $@ +sci_round.sci: sci_PROTO6.g + @./GEN $? round round > $@ + +# Files generated from file : sci_PROTO7.g +sci_tril.sci: sci_PROTO7.g + @./GEN $? tril tril > $@ +sci_triu.sci: sci_PROTO7.g + @./GEN $? triu triu > $@ + +# Files generated from file : sci_PROTO8.g +sci_prod.sci: sci_PROTO8.g + @./GEN $? prod prod > $@ +sci_sum.sci: sci_PROTO8.g + @./GEN $? sum sum > $@ + +# Files generated from file : sci_PROTO9.g +sci_int8.sci: sci_PROTO9.g + @./GEN $? int8 int8 > $@ +sci_int16.sci: sci_PROTO9.g + @./GEN $? int16 int16 > $@ +sci_int32.sci: sci_PROTO9.g + @./GEN $? int32 int32 > $@ +sci_uint8.sci: sci_PROTO9.g + @./GEN $? uint8 uint8 > $@ +sci_uint16.sci: sci_PROTO9.g + @./GEN $? uint16 uint16 > $@ +sci_uint32.sci: sci_PROTO9.g + @./GEN $? uint32 uint32 > $@ + +# Files generated from file : sci_PROTO10.g +sci_lower.sci: sci_PROTO10.g + @./GEN $? lower convstr > $@ +sci_upper.sci: sci_PROTO10.g + @./GEN $? upper convstr > $@ + +# Files generated from file : sci_PROTO11.g +sci_dos.sci: sci_PROTO11.g + @./GEN $? dos unix_g > $@ +sci_unix.sci: sci_PROTO11.g + @./GEN $? unix unix_g > $@ + +# Files generated from file : sci_PROTO12.g +sci_who.sci: sci_PROTO12.g + @./GEN $? who who > $@ +sci_whos.sci: sci_PROTO12.g + @./GEN $? whos whos > $@ + +# Files generated from file : sci_PROTO13.g +sci_any.sci: sci_PROTO13.g + @./GEN $? any or > $@ +sci_all.sci: sci_PROTO13.g + @./GEN $? all and > $@ + +# Files generated from file : sci_PROTO14.g +sci_acos.sci: sci_PROTO14.g + @./GEN $? acos acos > $@ + +# Files generated from file : sci_PROTO15.g +sci_nargin.sci: sci_PROTO15.g + @./GEN $? nargin nargin > $@ +sci_nargout.sci: sci_PROTO15.g + @./GEN $? nargout nargout > $@ + +all: $(PROTO0) $(PROTO1) $(PROTO2) $(PROTO3) $(PROTO4) \ + $(PROTO5) $(PROTO6) $(PROTO7) $(PROTO8) $(PROTO9) \ + $(PROTO10) $(PROTO11) $(PROTO12) $(PROTO13) $(PROTO14) \ + $(PROTO15) + +distclean :: + -rm -f $(PROTO0) $(PROTO1) $(PROTO2) $(PROTO3) $(PROTO4) $(PROTO5) $(PROTO6) $(PROTO7) $(PROTO8) $(PROTO9) $(PROTO10) $(PROTO11) $(PROTO12) $(PROTO13) $(PROTO14) $(PROTO15) + + + + diff --git a/modules/m2sci/macros/sci_files/buildmacros.sce b/modules/m2sci/macros/sci_files/buildmacros.sce new file mode 100755 index 000000000..83cc5ddaf --- /dev/null +++ b/modules/m2sci/macros/sci_files/buildmacros.sce @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2005 - INRIA - 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.1-en.txt + +//------------------------------------ +if (isdef("genlib") == %f) then + exec(SCI+"/modules/functions/scripts/buildmacros/loadgenlib.sce"); +end +//------------------------------------ +genlib("m2scisci_fileslib","SCI/modules/m2sci/macros/sci_files",%f,%t); +//------------------------------------ diff --git a/modules/m2sci/macros/sci_files/lib b/modules/m2sci/macros/sci_files/lib new file mode 100755 index 000000000..97d382027 Binary files /dev/null and b/modules/m2sci/macros/sci_files/lib differ diff --git a/modules/m2sci/macros/sci_files/names b/modules/m2sci/macros/sci_files/names new file mode 100755 index 000000000..27872732f --- /dev/null +++ b/modules/m2sci/macros/sci_files/names @@ -0,0 +1,271 @@ +sci_abs +sci_acos +sci_acosh +sci_acot +sci_acoth +sci_acsc +sci_acsch +sci_all +sci_angle +sci_any +sci_asec +sci_asech +sci_asin +sci_asinh +sci_atan +sci_atan2 +sci_atanh +sci_axis +sci_balance +sci_bar +sci_barh +sci_beep +sci_besseli +sci_besselj +sci_besselk +sci_bessely +sci_beta +sci_bin2dec +sci_bitand +sci_bitor +sci_blanks +sci_box +sci_break +sci_cd +sci_ceil +sci_cell +sci_cell2mat +sci_cellstr +sci_char +sci_chol +sci_cla +sci_clc +sci_clear +sci_clf +sci_clock +sci_close +sci_closereq +sci_colordef +sci_cond +sci_conj +sci_continue +sci_conv +sci_conv2 +sci_cos +sci_cosh +sci_cot +sci_coth +sci_cov +sci_cputime +sci_csc +sci_csch +sci_cumprod +sci_cumsum +sci_date +sci_dec2bin +sci_dec2hex +sci_delete +sci_det +sci_diag +sci_diary +sci_diff +sci_dir +sci_disp +sci_display +sci_doc +sci_docopt +sci_dos +sci_double +sci_drawnow +sci_echo +sci_eig +sci_eomday +sci_erf +sci_erfc +sci_erfcx +sci_error +sci_etime +sci_eval +sci_exist +sci_exit +sci_exp +sci_expm +sci_eye +sci_factor +sci_factorial +sci_false +sci_fclose +sci_feof +sci_ferror +sci_feval +sci_fft +sci_fft2 +sci_fftshift +sci_fgetl +sci_fgets +sci_fileparts +sci_filesep +sci_find +sci_findstr +sci_fix +sci_fliplr +sci_flipud +sci_floor +sci_fopen +sci_format +sci_fprintf +sci_fread +sci_frewind +sci_fscanf +sci_fseek +sci_ftell +sci_full +sci_fullfile +sci_fwrite +sci_gamma +sci_gammaln +sci_getenv +sci_global +sci_graymon +sci_grid +sci_hankel +sci_help +sci_helpbrowser +sci_helpdesk +sci_helpwin +sci_hess +sci_hold +sci_home +sci_horzcat +sci_ifft +sci_imag +sci_input +sci_int16 +sci_int32 +sci_int8 +sci_interp1 +sci_inv +sci_isa +sci_iscell +sci_ischar +sci_isdir +sci_isempty +sci_isequal +sci_isfield +sci_isfinite +sci_isglobal +sci_ishandle +sci_ishold +sci_isinf +sci_isinteger +sci_isletter +sci_islogical +sci_isnan +sci_isnumeric +sci_ispc +sci_isreal +sci_isscalar +sci_isspace +sci_issparse +sci_isstr +sci_isstruct +sci_isunix +sci_isvector +sci_keyboard +sci_kron +sci_legendre +sci_length +sci_linspace +sci_load +sci_log +sci_log10 +sci_log2 +sci_logical +sci_logm +sci_lookfor +sci_lower +sci_lu +sci_makecell +sci_max +sci_mean +sci_median +sci_meshgrid +sci_min +sci_mkdir +sci_mod +sci_more +sci_nargin +sci_nargout +sci_ndims +sci_norm +sci_now +sci_num2str +sci_ones +sci_orth +sci_pause +sci_perms +sci_pie +sci_plot +sci_pow2 +sci_primes +sci_prod +sci_qr +sci_quit +sci_rand +sci_randn +sci_rcond +sci_real +sci_realmax +sci_realmin +sci_rem +sci_repmat +sci_reshape +sci_return +sci_round +sci_save +sci_schur +sci_setstr +sci_sign +sci_sin +sci_sinh +sci_size +sci_sort +sci_sortrows +sci_sparse +sci_sqrt +sci_str2num +sci_strcmp +sci_strcmpi +sci_strfind +sci_strrep +sci_struct +sci_subplot +sci_sum +sci_surf +sci_svd +sci_tan +sci_tanh +sci_tic +sci_title +sci_toc +sci_toeplitz +sci_tril +sci_triu +sci_true +sci_type +sci_uigetdir +sci_uint16 +sci_uint32 +sci_uint8 +sci_unix +sci_upper +sci_vertcat +sci_waitforbuttonpress +sci_warning +sci_who +sci_whos +sci_winqueryreg +sci_xlabel +sci_ylabel +sci_zeros +sci_zlabel diff --git a/modules/m2sci/macros/sci_files/sci_PROTO0.g b/modules/m2sci/macros/sci_files/sci_PROTO0.g new file mode 100755 index 000000000..f025f567e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO0.g @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Generic conversion function +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +A=getrhs(tree) +A=convert2double(A) +tree.rhs=Rhs_tlist(A) + +tree.lhs(1).dims=A.dims +tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO1.g b/modules/m2sci/macros/sci_files/sci_PROTO1.g new file mode 100755 index 000000000..f25e8a7d4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO1.g @@ -0,0 +1,169 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for max and min +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// C = MFUN(A) or [C,I] = MFUN(A) +if rhs==1 then + A = getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown // If A is a scalar then Matlab return Double type value else a Boolean type value + end + A = convert2double(A) + tree.rhs = Rhs_tlist(A) + dim = first_non_singleton(A) + + if dim==-1 then + // All output dims are unknown + tree.lhs(1).dims=allunknown(A.dims) + tmp=gettempvar() + insert(Equal(list(tmp),A)) + // First non singleton dimension will be computed at execution + tree.rhs=Rhs_tlist(tmp,Funcall("firstnonsingleton",1,list(tmp),list())) + else + tree.lhs(1).dims=A.dims + if dim==0 then + tree.rhs=Rhs_tlist(A) + if is_empty(A) then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims=list(1,1) + end + elseif dim==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims(dim)=1 + elseif dim==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims(dim)=1 + end + end + + // C = MFUN(A) or [C,I] = MFUN(A) + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + elseif is_complex(A) then + // Scilab MFUN() does not work with complexes so mtlb_MFUN() is called + tree.name="mtlb_MFUN" + tree.lhs(1).type=Type(Double,Unknown) + else + // Scilab MFUN() does not work with complexes so mtlb_MFUN() is called but can be replaced + tree.name="mtlb_MFUN" + tree.lhs(1).type=Type(vtype,Unknown) + end + + // [C,I] = MFUN(A) + if lhs==2 then + // All dims Unknown because if A is [] then I is also [] else I is a row vector + tree.lhs(2).dims=allunknown(A.dims) + tree.lhs(2).type=Type(Double,Real) + end +// C = MFUN(A,B) +elseif rhs==2 then + [A,B]=getrhs(tree) + vtype=Double + if A.vtype==Boolean & B.vtype==Boolean | A.vtype==Unknown & B.vtype==Unknown then + vtype=Unknown + end + A=convert2double(A) + B=convert2double(B) + tree.rhs=Rhs_tlist(A,B) + + if is_real(A) & is_real(B) then + if not_empty(A) & not_empty(B) then + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + else + // Perhaps an input is an empty matrix + tree.name="mtlb_MFUN" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + end + else + // Inputs can be complexes and/or empty matrices + tree.name="mtlb_MFUN" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Unknown) + end +// C = MFUN(A,[],dim) or [C,I] = MFUN(A,[],dim) +else + [A,tmp,dim]=getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown + end + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + // C = MFUN(A,[],dim) or [C,I] = MFUN(A,[],dim) + if or(lhs==[1,2]) then + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + if typeof(dim)=="cste" then + if dim.value==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(1)=Unknown // 0 or 1 + elseif dim.value==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(2)=Unknown // 0 or 1 + elseif dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + else + // Scilab MFUN() does not work when dim is greater than number of dims of A + tree.name="mtlb_MFUN" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=A.dims + end + else + // If dim is 1 it can be replaced by 'r' + // If dim is 2 it can be replaced by 'c' + tree.name="mtlb_MFUN" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + end + else + // A can be complex.... + tree.name="mtlb_MFUN" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + tree.lhs(1).type=Type(vtype,Unknown) + end + end + + // [C,I] = MFUN(A,[],dim) + if lhs==2 then + tree.lhs(2).type=Type(Double,Real) + if is_real(A) then + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(2).dims=allunknown(A.dims) + else + tree.lhs(2).dims=A.dims + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + end +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO10.g b/modules/m2sci/macros/sci_files/sci_PROTO10.g new file mode 100755 index 000000000..e3df4efa1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO10.g @@ -0,0 +1,37 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +opt=part("MFUN",1) + +A = getrhs(tree) +if A.vtype==String then + tree.name="SFUN" + tree.rhs=Rhs_tlist(A,opt) + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +elseif A.vtype==Unknown then + tree.name="mtlb_MFUN" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +else + if typeof(A)=="funcall" then + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + A.out=tree.lhs + end + tree=A +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO11.g b/modules/m2sci/macros/sci_files/sci_PROTO11.g new file mode 100755 index 000000000..8142821f9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO11.g @@ -0,0 +1,49 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +if rhs==2 then + tree.rhs(2)=null() +end + +if lhs==1 then + V=gettempvar(2) + S=tree.lhs(1) + if S.name=="ans" then + S=gettempvar(1) + tree.lhs=list(V,S) + else + tree.lhs=list(V,S) + end + insert(Equal(tree.lhs,tree)) + tree=list() + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(S),list())),1) + end +else + tree.lhs=list(tree.lhs($:-1:1)) + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(tree.lhs(1),tree.lhs(2)),list())),1) + end + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(String,Real) + + tree.lhs(2).dims=list(1,1) + tree.lhs(2).type=Type(Double,Real) + +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO12.g b/modules/m2sci/macros/sci_files/sci_PROTO12.g new file mode 100755 index 000000000..3d5ad4f76 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO12.g @@ -0,0 +1,37 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +k=1 +while k<=size(tree.rhs) + if tree.rhs(k).value=="" then + tree.rhs(k)=null() + end + k=k+1 +end + +if size(tree.rhs)==0 then + // Nothing to do +else + select tree.rhs(1).value + case "global" then + // Nothing to do + case "-file" then + no_equiv(expression2code(tree)) + else + no_equiv(expression2code(tree)) + end +end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO13.g b/modules/m2sci/macros/sci_files/sci_PROTO13.g new file mode 100755 index 000000000..215e01755 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO13.g @@ -0,0 +1,98 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for all and any +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +tree.name="SFUN" + +// B = MFUN(A) +if rhs==1 then + A = getrhs(tree) + + // %c_SFUN and %b_SFUN are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A) + + // if A is not a multidimensional array + if size(A.dims)==2 then + if is_a_vector(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.rhs=Rhs_tlist(A,1) + tree.lhs(1).dims=list(1,A.dims(2)) + else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=list(Unknown,Unknown) + end + // if A is a multidimensional array + else + dim = first_non_singleton(A) + if dim<>Unknown then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + newrhs=Funcall("firstnonsingleton",1,list(A),list()) + tree.rhs=Rhs_tlist(A,newrhs) + tree.lhs(1).dims=allunknown(A.dims) + end + end + tree.lhs(1).type=Type(Boolean,Real) + +// B = MFUN(A,dim) +else + [A,dim] = getrhs(tree) + + // %c_SFUN and %b_SFUN are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + tree.lhs(1).type=Type(Boolean,Real) + else + if not_empty(A) then + tree=Operation("<>",list(A,Cste(0)),tree.lhs) + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) + else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=A.dims + end + end + else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=allunknown(A.dims) + end +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO14.g b/modules/m2sci/macros/sci_files/sci_PROTO14.g new file mode 100755 index 000000000..36f8a1e92 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO14.g @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for functions with same syntax and output property unknown +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +A=getrhs(tree) +A=convert2double(A) +tree.rhs=Rhs_tlist(A) + +tree.lhs(1).dims=A.dims +tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO15.g b/modules/m2sci/macros/sci_files/sci_PROTO15.g new file mode 100755 index 000000000..7417d7c49 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO15.g @@ -0,0 +1,36 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for functions nargin and nargout +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +global("varslist") + +if rhs==0 then // Number of arguments of local function + tree=Variable("%MFUN",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("MFUN","%MFUN",Infer(list(1,1),Type(Double,Real))) +else // Number of arguments of M-file + if "MFUN"=="nargin" then + fieldnb=1 + else + fieldnb=2 + end + set_infos(msprintf(gettext("%s considered to be a Scilab macro."),rhs2code(tree.rhs)),2); + evstrtree=Funcall("evstr",1,tree.rhs,list()) + macrovartree=Funcall("macrovar",1,Rhs_tlist(evstrtree),list()) + getfieldtree=Funcall("getfield",1,Rhs_tlist(fieldnb,macrovartree),list()) + tree=Funcall("size",1,Rhs_tlist(getfieldtree,"*"),tree.lhs) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO2.g b/modules/m2sci/macros/sci_files/sci_PROTO2.g new file mode 100755 index 000000000..93570dbd5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO2.g @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for cumsum and cumprod +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// B = MFUN(A) +if rhs==1 then + A = getrhs(tree) + + // Because %b_SFUN and %C_SFUN are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + dim=first_non_singleton(A) + + tree.lhs(1).dims=A.dims + + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + elseif dim==-1 then + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + end + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +// B = MFUN(A,dim) +else + [A,dim] = getrhs(tree) + + // Because %b_SFUN and %C_SFUN are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + if typeof(A)=="funcall" then + tree.lhs(1).infer=A.infer + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + tree.lhs(1).infer=A.infer + A.out=tree.lhs + end + tree=A; + set_infos(msprintf(gettext("Scilab %s() does not work when dim input argument is greater than number of dims of first rhs..."),"SFUN"),1) + return + end + end + + tree.name="mtlb_MFUN" + tree.lhs(1).dims=A.dims + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO3.g b/modules/m2sci/macros/sci_files/sci_PROTO3.g new file mode 100755 index 000000000..8281759d3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO3.g @@ -0,0 +1,176 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for eye false ones rand randn true zeros +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// Used for false and true +name_sav=tree.name + +if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return +end + +if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return +end + +// Special cases for rand and randn +if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end +end + +opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + +// MFUN(n) +if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("SFUN",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // MFUN([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("SFUN",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // MFUN(n) or MFUN([n1,n2,...]) ? + else + tree.name="mtlb_MFUN" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + +// MFUN(n1,n2,..) +else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="SFUN" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) +end + +if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) +end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_PROTO4.g b/modules/m2sci/macros/sci_files/sci_PROTO4.g new file mode 100755 index 000000000..c66645ab0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO4.g @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for functions with same syntax and output property same as input +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +tree.name="SFUN" + +A=getrhs(tree) +A=convert2double(A) +tree.rhs=Rhs_tlist(A) + +tree.lhs(1).dims=A.dims +tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO5.g b/modules/m2sci/macros/sci_files/sci_PROTO5.g new file mode 100755 index 000000000..6e67b2c55 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO5.g @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for: atanh asin atan +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +A=getrhs(tree) +A=convert2double(A) +tree.rhs=Rhs_tlist(A) + +if tree.name=="atan" then + set_infos(msprintf(gettext("If %s is outside [-1,1]\n real part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) +else + set_infos(msprintf(gettext("If %s is outside [-1,1]\n complex part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) +end + +tree.lhs(1).dims=A.dims +tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO6.g b/modules/m2sci/macros/sci_files/sci_PROTO6.g new file mode 100755 index 000000000..755fd57bd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO6.g @@ -0,0 +1,27 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for functions with same syntax and output property unknown when input is complex +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +A=getrhs(tree) +A=convert2double(A) +tree.rhs=Rhs_tlist(A) + +tree.lhs(1).dims=A.dims +if is_real(A) then + tree.lhs(1).type=Type(Double,Real) +else + tree.lhs(1).type=Type(Double,Unknown) +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO7.g b/modules/m2sci/macros/sci_files/sci_PROTO7.g new file mode 100755 index 000000000..bfe28e774 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO7.g @@ -0,0 +1,46 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for: triu tril +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// L = MFUN(X,k) +if rhs==2 then + [X,k] = getrhs(tree) + // Convert k to double + k=convert2double(k) + tree.rhs=Rhs_tlist(X,k) +// L = MFUN(X) +else + X = getrhs(tree) +end + +// Common part +if or(X.vtype==[String,Unknown]) then + tree.name="mtlb_MFUN" +else + if X.vtype==Boolean then + X=Funcall("bool2s",1,Rhs_tlist(X),list(Variable("",X.infer))) + tree.rhs(1)=X + end +end + +if isempty(strindex(tree.name,"triu")) then + tree.lhs(1).type=X.type +else + tree.lhs(1).type=Type(X.vtype,Unknown) +end +tree.lhs(1).dims=X.dims + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO8.g b/modules/m2sci/macros/sci_files/sci_PROTO8.g new file mode 100755 index 000000000..bd4c8e613 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO8.g @@ -0,0 +1,82 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for sum prod and mean +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// B = MFUN(A) +if rhs==1 then + A = getrhs(tree) + + // Because %b_SFUN and %C_SFUN are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_a_vector(A) | is_empty(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.lhs(1).dims=list(1,A.dims(2)) + tree.rhs=Rhs_tlist(A,1) + elseif not_empty(A) then + dim = first_non_singleton(A) + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + tree.lhs(1).dims=allunknown(A.dims) + end + else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=allunknown(A.dims) + end + +// B = MFUN(A,dim) +else + [A,dim] = getrhs(tree) + + // Because %b_SFUN and %C_SFUN are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + // Scilab SFUN() does not work when dim is greater than number of dims A + tree.name="mtlb_MFUN" + tree.lhs(1).dims=allunknown(A.dims) + else + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + end + else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=allunknown(A.dims) + end + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO9.g b/modules/m2sci/macros/sci_files/sci_PROTO9.g new file mode 100755 index 000000000..2c0d13a02 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO9.g @@ -0,0 +1,55 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_MFUN(tree) +// Prototype for *int**() +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// %c_MFUN and %b_MFUN are not defined in Scilab +x = getrhs(tree) + +// Matlab MFUN() can return Boolean type value +if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown +else + vtype=Int +end + +x = convert2double(x) + +tree.rhs=Rhs_tlist(x) + +if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"MFUN","MFUN"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x +elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"MFUN","MFUN"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x +else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type +end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_abs.bin b/modules/m2sci/macros/sci_files/sci_abs.bin new file mode 100755 index 000000000..69121b911 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_abs.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_abs.sci b/modules/m2sci/macros/sci_files/sci_abs.sci new file mode 100755 index 000000000..96f913540 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_abs.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_abs(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab abs() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acos.bin b/modules/m2sci/macros/sci_files/sci_acos.bin new file mode 100755 index 000000000..db5fd788c Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_acos.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_acos.sci b/modules/m2sci/macros/sci_files/sci_acos.sci new file mode 100755 index 000000000..95a469526 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acos.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_acos(tree) + // File generated from sci_PROTO14.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab acos() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acosh.bin b/modules/m2sci/macros/sci_files/sci_acosh.bin new file mode 100755 index 000000000..88cc4c272 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_acosh.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_acosh.sci b/modules/m2sci/macros/sci_files/sci_acosh.sci new file mode 100755 index 000000000..a0c84c915 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acosh.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_acosh(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab acosh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="acosh" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acot.bin b/modules/m2sci/macros/sci_files/sci_acot.bin new file mode 100755 index 000000000..3c829d8f1 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_acot.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_acot.sci b/modules/m2sci/macros/sci_files/sci_acot.sci new file mode 100755 index 000000000..9990714c3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acot.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_acot(tree) + // M2SCI function + // Conversion function for Matlab acot() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + tree.name="atan" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=X.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acoth.bin b/modules/m2sci/macros/sci_files/sci_acoth.bin new file mode 100755 index 000000000..aacafe602 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_acoth.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_acoth.sci b/modules/m2sci/macros/sci_files/sci_acoth.sci new file mode 100755 index 000000000..9b27c22d6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acoth.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_acoth(tree) + // M2SCI function + // Conversion function for Matlab acoth() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + set_infos(msprintf(gettext("If %s is outside [-1,1]\n complex part of output of %s will be the opposite of Matlab one."),expression2code(X),expression2code(tree)),2) + + tree.name="atanh" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + // Property unknown because result can be complex for real input + tree.lhs(1).type=Type(X.vtype,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acsc.bin b/modules/m2sci/macros/sci_files/sci_acsc.bin new file mode 100755 index 000000000..69f578b81 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_acsc.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_acsc.sci b/modules/m2sci/macros/sci_files/sci_acsc.sci new file mode 100755 index 000000000..b85f018ea --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acsc.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_acsc(tree) + // M2SCI function + // Conversion function for Matlab acsc() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + tree.name="asin" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acsch.bin b/modules/m2sci/macros/sci_files/sci_acsch.bin new file mode 100755 index 000000000..56a64a386 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_acsch.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_acsch.sci b/modules/m2sci/macros/sci_files/sci_acsch.sci new file mode 100755 index 000000000..44abe317e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acsch.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_acsch(tree) + // M2SCI function + // Conversion function for Matlab acsch() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + tree.name="asinh" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=X.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_all.bin b/modules/m2sci/macros/sci_files/sci_all.bin new file mode 100755 index 000000000..c45c4059f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_all.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_all.sci b/modules/m2sci/macros/sci_files/sci_all.sci new file mode 100755 index 000000000..1571eaf61 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_all.sci @@ -0,0 +1,98 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_all(tree) + // File generated from sci_PROTO13.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab all() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_all() + + tree.name="and" + + // B = all(A) + if rhs==1 then + A = getrhs(tree) + + // %c_and and %b_and are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A) + + // if A is not a multidimensional array + if size(A.dims)==2 then + if is_a_vector(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.rhs=Rhs_tlist(A,1) + tree.lhs(1).dims=list(1,A.dims(2)) + else + tree.name="mtlb_all" + tree.lhs(1).dims=list(Unknown,Unknown) + end + // if A is a multidimensional array + else + dim = first_non_singleton(A) + if dim<>Unknown then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + newrhs=Funcall("firstnonsingleton",1,list(A),list()) + tree.rhs=Rhs_tlist(A,newrhs) + tree.lhs(1).dims=allunknown(A.dims) + end + end + tree.lhs(1).type=Type(Boolean,Real) + + // B = all(A,dim) + else + [A,dim] = getrhs(tree) + + // %c_and and %b_and are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + tree.lhs(1).type=Type(Boolean,Real) + else + if not_empty(A) then + tree=Operation("<>",list(A,Cste(0)),tree.lhs) + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) + else + tree.name="mtlb_all" + tree.lhs(1).dims=A.dims + end + end + else + tree.name="mtlb_all" + tree.lhs(1).dims=allunknown(A.dims) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_angle.bin b/modules/m2sci/macros/sci_files/sci_angle.bin new file mode 100755 index 000000000..510727e7a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_angle.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_angle.sci b/modules/m2sci/macros/sci_files/sci_angle.sci new file mode 100755 index 000000000..1528b6457 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_angle.sci @@ -0,0 +1,33 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_angle(tree) + // M2SCI function + // Conversion function for Matlab angle() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + + if typeof(A)=="variable" then + n=A + else + n=gettempvar() + insert(Equal(list(n),A)) + end + + realpart=Funcall("real",1,list(n),list()) + imagpart=Funcall("imag",1,list(n),list()) + + tree=Funcall("atan",1,list(imagpart,realpart),tree.lhs) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_any.bin b/modules/m2sci/macros/sci_files/sci_any.bin new file mode 100755 index 000000000..c7e798d9e Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_any.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_any.sci b/modules/m2sci/macros/sci_files/sci_any.sci new file mode 100755 index 000000000..c23b4f09e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_any.sci @@ -0,0 +1,98 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_any(tree) + // File generated from sci_PROTO13.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab any() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_any() + + tree.name="or" + + // B = any(A) + if rhs==1 then + A = getrhs(tree) + + // %c_or and %b_or are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A) + + // if A is not a multidimensional array + if size(A.dims)==2 then + if is_a_vector(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.rhs=Rhs_tlist(A,1) + tree.lhs(1).dims=list(1,A.dims(2)) + else + tree.name="mtlb_any" + tree.lhs(1).dims=list(Unknown,Unknown) + end + // if A is a multidimensional array + else + dim = first_non_singleton(A) + if dim<>Unknown then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + newrhs=Funcall("firstnonsingleton",1,list(A),list()) + tree.rhs=Rhs_tlist(A,newrhs) + tree.lhs(1).dims=allunknown(A.dims) + end + end + tree.lhs(1).type=Type(Boolean,Real) + + // B = any(A,dim) + else + [A,dim] = getrhs(tree) + + // %c_or and %b_or are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + tree.lhs(1).type=Type(Boolean,Real) + else + if not_empty(A) then + tree=Operation("<>",list(A,Cste(0)),tree.lhs) + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) + else + tree.name="mtlb_any" + tree.lhs(1).dims=A.dims + end + end + else + tree.name="mtlb_any" + tree.lhs(1).dims=allunknown(A.dims) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_asec.bin b/modules/m2sci/macros/sci_files/sci_asec.bin new file mode 100755 index 000000000..1f878bd0c Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_asec.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_asec.sci b/modules/m2sci/macros/sci_files/sci_asec.sci new file mode 100755 index 000000000..b9cc29875 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asec.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_asec(tree) + // M2SCI function + // Conversion function for Matlab asec() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + tree.name="acos" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_asech.bin b/modules/m2sci/macros/sci_files/sci_asech.bin new file mode 100755 index 000000000..ad9e62c57 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_asech.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_asech.sci b/modules/m2sci/macros/sci_files/sci_asech.sci new file mode 100755 index 000000000..74220878e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asech.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_asech(tree) + // M2SCI function + // Conversion function for Matlab asech() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + tree.name="acosh" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_asin.bin b/modules/m2sci/macros/sci_files/sci_asin.bin new file mode 100755 index 000000000..a234eddbc Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_asin.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_asin.sci b/modules/m2sci/macros/sci_files/sci_asin.sci new file mode 100755 index 000000000..052da34e4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asin.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_asin(tree) + // File generated from sci_PROTO5.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab asin() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + if tree.name=="atan" then + set_infos(msprintf(gettext("If %s is outside [-1,1]\n real part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + else + set_infos(msprintf(gettext("If %s is outside [-1,1]\n complex part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + end + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_asinh.bin b/modules/m2sci/macros/sci_files/sci_asinh.bin new file mode 100755 index 000000000..3d3a252c3 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_asinh.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_asinh.sci b/modules/m2sci/macros/sci_files/sci_asinh.sci new file mode 100755 index 000000000..da1a1ed3a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asinh.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_asinh(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab asinh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="asinh" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_atan.bin b/modules/m2sci/macros/sci_files/sci_atan.bin new file mode 100755 index 000000000..bd1db2120 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_atan.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_atan.sci b/modules/m2sci/macros/sci_files/sci_atan.sci new file mode 100755 index 000000000..687f2009a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_atan.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_atan(tree) + // File generated from sci_PROTO5.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab atan() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + if tree.name=="atan" then + set_infos(msprintf(gettext("If %s is outside [-1,1]\n real part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + else + set_infos(msprintf(gettext("If %s is outside [-1,1]\n complex part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + end + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_atan2.bin b/modules/m2sci/macros/sci_files/sci_atan2.bin new file mode 100755 index 000000000..3a7b2be2a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_atan2.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_atan2.sci b/modules/m2sci/macros/sci_files/sci_atan2.sci new file mode 100755 index 000000000..94d2687d6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_atan2.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_atan2(tree) + // M2SCI function + // Conversion function for Matlab atan2() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_atan and %b_atan are not defined in Scilab + [Y,X]=getrhs(tree) + //Y=convert2double(Y) + //X=convert2double(X) + tree.rhs=Rhs_tlist(Y,X) + + // Scilab atan() does not work with complex + if is_complex(Y) then + tree.rhs(1)=Funcall("real",1,list(Y),list()) + elseif ~is_real(Y) then + tree.rhs(1)=Funcall("real",1,list(Y),list()) + repl_poss(tree.rhs(1),Y,Y,"is real") + end + if is_complex(X) then + tree.rhs(2)=Funcall("real",1,list(X),list()) + elseif ~is_real(X) then + tree.rhs(2)=Funcall("real",1,list(X),list()) + repl_poss(tree.rhs(2),X,X,"is real") + end + + tree.name="atan" + + tree.lhs(1).dims=Y.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_atanh.bin b/modules/m2sci/macros/sci_files/sci_atanh.bin new file mode 100755 index 000000000..e267e5649 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_atanh.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_atanh.sci b/modules/m2sci/macros/sci_files/sci_atanh.sci new file mode 100755 index 000000000..5470460c7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_atanh.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_atanh(tree) + // File generated from sci_PROTO5.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab atanh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + if tree.name=="atan" then + set_infos(msprintf(gettext("If %s is outside [-1,1]\n real part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + else + set_infos(msprintf(gettext("If %s is outside [-1,1]\n complex part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + end + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_axis.bin b/modules/m2sci/macros/sci_files/sci_axis.bin new file mode 100755 index 000000000..81290dc7f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_axis.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_axis.sci b/modules/m2sci/macros/sci_files/sci_axis.sci new file mode 100755 index 000000000..aafb31bda --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_axis.sci @@ -0,0 +1,126 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_axis(tree) + // M2SCI function + // Conversion function for Matlab axis() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // Insert %v0=gca() + a=Funcall("gca",1,list(),list()) + + if rhs>0 then + for krhs=1:rhs + if tree.rhs(krhs).vtype==Double then + + // axis([xmin xmax ymin ymax]) + // axis([xmin xmax ymin ymax zmin zmax]) + if or(tree.rhs(krhs).dims(2)==[4,6]) then + mat=Funcall("matrix",1,list(tree.rhs(krhs),Cste(2),Cste(-1)),list()) + tree=Funcall("set",1,Rhs_tlist(a,"data_bounds",mat),tree.lhs) + + // axis([xmin xmax ymin ymax zmin zmax cmin cmax]) + elseif tree.rhs(krhs).dims(2)==8 then + no_equiv(expression2code(tree)) + + // Unknown column number for tree.rhs(krhs) + else + tree.name="mtlb_axis" + end + elseif tree.rhs(krhs).vtype==String then + + // Option is a character string + if typeof(tree.rhs(krhs))=="cste" then + + // axis auto + if tree.rhs(krhs).value=="auto" then + tree=Funcall("set",1,Rhs_tlist(a,"auto_scale","on"),tree.lhs) + + // axis manual + elseif tree.rhs(krhs).value=="manual" then + tree=Funcall("set",1,Rhs_tlist(a,"auto_scale","off"),tree.lhs) + + // axis tight + elseif tree.rhs(krhs).value=="tight" then + tree=Funcall("set",1,Rhs_tlist(a,"tight_limits","on"),tree.lhs) + + // axis fill + elseif tree.rhs(krhs).value=="fill" then + no_equiv(expression2code(tree)) + + // axis ij + elseif tree.rhs(krhs).value=="ij" then + mat=Operation("cc",list(Cste(180),Cste(270)),list()) + tree=Funcall("set",1,Rhs_tlist(a,"rotation_angles",mat),tree.lhs) + + // axis xy + elseif tree.rhs(krhs).value=="xy" then + mat=Operation("cc",list(Cste(0),Cste(270)),list()) + tree=Funcall("set",1,Rhs_tlist(a,"rotation_angles",mat),tree.lhs) + + // axis equal + elseif tree.rhs(krhs).value=="equal" then + tree=Funcall("set",1,Rhs_tlist(a,"isoview","on"),tree.lhs) + + // axis image + elseif tree.rhs(krhs).value=="image" then + no_equiv(expression2code(tree)) + + // axis square + elseif tree.rhs(krhs).value=="square" then + set_infos(gettext("cube_scaling only used in 3d mode."),2); + tree=Funcall("set",1,Rhs_tlist(a,"cube_scaling","on"),tree.lhs) + + // axis vis3d + elseif tree.rhs(krhs).value=="vis3d" then + tree=Funcall("set",1,Rhs_tlist(a,"view","3d"),tree.lhs) + + // axis normal + elseif tree.rhs(krhs).value=="normal" then + no_equiv(expression2code(tree)) + + // axis on + elseif tree.rhs(krhs).value=="on" then + tree=Funcall("set",1,Rhs_tlist(a,"axes_visible","on"),tree.lhs) + + // axis off + elseif tree.rhs(krhs).value=="off" then + tree=Funcall("set",1,Rhs_tlist(a,"axes_visible","off"),tree.lhs) + + // [mode,visibility,direction] = axis('state') + elseif tree.rhs(krhs).value=="state" then + tree.name="mtlb_axis" + + // Unknown character string + else + tree.name="mtlb_axis" + end + + // Option is a variable + else + tree.name="mtlb_axis" + end + + // axis(axes_handles,...) + elseif tree.rhs(krhs).vtype==Handle then + no_equiv(expression2code(tree)) + + // Unknown type for tree.rhs(krhs) + else + tree.name="mtlb_axis" + end + end + // v = axis + else + tree=Funcall("set",1,Rhs_tlist(a,"data_bounds"),tree.lhs) + tree.lhs(1).dims=list(2,Unknown) + tree.lhs(1).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_balance.bin b/modules/m2sci/macros/sci_files/sci_balance.bin new file mode 100755 index 000000000..00a6527b2 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_balance.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_balance.sci b/modules/m2sci/macros/sci_files/sci_balance.sci new file mode 100755 index 000000000..8fa05e4cf --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_balance.sci @@ -0,0 +1,48 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_balance(tree) + // M2SCI function + // Conversion function for Matlab balance() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + + // %c_balance and %b_balance are not defined + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.name="balanc" + + // B=balance(A) + if lhs==1 then + if tree.lhs(1).name=="ans" then + B=gettempvar(1) + T=gettempvar(2) + insert(Equal(list(B,T),tree)) + tree=B + else + T=gettempvar(2) + tree.lhs=list(tree.lhs(1),T) + end + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(Double,Real) + // [T,B] = balance(A) + else + tree.lhs=list(tree.lhs(2),tree.lhs(1)) + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).dims=A.dims + tree.lhs(2).type=A.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_bar.bin b/modules/m2sci/macros/sci_files/sci_bar.bin new file mode 100755 index 000000000..67ea0f2a9 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_bar.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_bar.sci b/modules/m2sci/macros/sci_files/sci_bar.sci new file mode 100755 index 000000000..ee25ced11 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bar.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_bar(tree) + // M2SCI function + // Conversion function for Matlab bar() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if tree.lhs(1).name <> "ans" then + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("gce",1,list(),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + else + tree.lhs(1).type=Type(Handle,Unknown) + end +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_barh.bin b/modules/m2sci/macros/sci_files/sci_barh.bin new file mode 100755 index 000000000..5007e08c3 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_barh.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_barh.sci b/modules/m2sci/macros/sci_files/sci_barh.sci new file mode 100755 index 000000000..c3b9d4231 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_barh.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_barh(tree) + // M2SCI function + // Conversion function for Matlab barh() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if tree.lhs(1).name <> "ans" then + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("gce",1,list(),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + else + tree.lhs(1).type=Type(Handle,Unknown) + end +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_beep.bin b/modules/m2sci/macros/sci_files/sci_beep.bin new file mode 100755 index 000000000..4f38106cc Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_beep.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_beep.sci b/modules/m2sci/macros/sci_files/sci_beep.sci new file mode 100755 index 000000000..0bd3356b8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_beep.sci @@ -0,0 +1,19 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_beep(tree) + // M2SCI function + // Conversion function for Matlab beep + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,Unknown); + tree.lhs(1).type=Type(String,Real); + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_besseli.bin b/modules/m2sci/macros/sci_files/sci_besseli.bin new file mode 100755 index 000000000..40243ea4e Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_besseli.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_besseli.sci b/modules/m2sci/macros/sci_files/sci_besseli.sci new file mode 100755 index 000000000..e98f1bcef --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_besseli.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_besseli(tree) + // M2SCI function + // Conversion function for Matlab besseli() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.lhs)==2 then // [y,ierr]=besseli(alpha,x) + error(gettext("Bessel function is not implemented for 2 outputs arguments.")) + end + + if rhs==2 then + [A,B]=getrhs(tree) // y=besseli(alpha,x) + elseif rhs==3 then //besseli(alpha,x,) + [A,B,C]=getrhs(tree) + end + + A=convert2double(A) + B=convert2double(B) + + if is_real(B) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_empty(A) | is_empty(B) then // A or B is an empty + tree.lhs(1).dims=list(0,0) + elseif is_a_scalar(A) then // A is a scalar + tree.lhs(1).dims=B.dims + elseif is_a_scalar(B) then// B is a scalar + tree.lhs(1).dims=A.dims + else + Aknowndim=%t // boolean false if A dimension is unknown + Bknowndim=%t // boolean false if B dimension is unknown + for i=1:size(A.dims) + if A.dims(i)==-1 then + Aknowndim=%f + break + end + end + for i=1:size(B.dims) + if B.dims(i)==-1 then + Bknowndim=%f + break + end + end + if is_a_vector(A) then // A is a vector + if is_a_vector(B) then // B is a vector + if A.dims==B.dims then // both A and B are column vectors or both A and B are line vectors + tree.lhs(1).dims=B.dims + else // A is a line vector and B is a column vector, or A is a column vector and B is a line vector + tree.lhs(1).dims(1)=B.dims(1)*B.dims(2) + tree.lhs(1).dims(2)=A.dims(1)*A.dims(2) + end + end + elseif ~(Aknowndim & Bknowndim) then // A or B dimension(s) is unknown + tree.lhs(1).dims==list(-1,-1) + elseif A.dims==B.dims then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims==list(-1,-1) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_besselj.bin b/modules/m2sci/macros/sci_files/sci_besselj.bin new file mode 100755 index 000000000..a831abae1 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_besselj.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_besselj.sci b/modules/m2sci/macros/sci_files/sci_besselj.sci new file mode 100755 index 000000000..52571bddf --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_besselj.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_besselj(tree) + // M2SCI function + // Conversion function for Matlab besselj() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.lhs)==2 then // [y,ierr]=besselj(alpha,x) + error(gettext("Bessel function is not implemented for 2 outputs arguments.")) + end + + if rhs==2 then + [A,B]=getrhs(tree) // y=besselj(alpha,x) + elseif rhs==3 then // y=besselj(alpha,x,1) + [A,B,C]=getrhs(tree) + end + + A=convert2double(A) + B=convert2double(B) + + if is_real(B) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_empty(A) | is_empty(B) then // A or B is an empty + tree.lhs(1).dims=list(0,0) + elseif is_a_scalar(A) then // A is a scalar + tree.lhs(1).dims=B.dims + elseif is_a_scalar(B) then// B is a scalar + tree.lhs(1).dims=A.dims + else + Aknowndim=%t // boolean false if A dimension is unknown + Bknowndim=%t // boolean false if B dimension is unknown + for i=1:size(A.dims) + if A.dims(i)==-1 then + Aknowndim=%f + break + end + end + for i=1:size(B.dims) + if B.dims(i)==-1 then + Bknowndim=%f + break + end + end + if is_a_vector(A) then // A is a vector + if is_a_vector(B) then // B is a vector + if A.dims==B.dims then // both A and B are column vectors or both A and B are line vectors + tree.lhs(1).dims=B.dims + else // A is a line vector and B is a column vector, or A is a column vector and B is a line vector + tree.lhs(1).dims(1)=B.dims(1)*B.dims(2) + tree.lhs(1).dims(2)=A.dims(1)*A.dims(2) + end + end + elseif ~(Aknowndim & Bknowndim) then // A or B dimension(s) is unknown + tree.lhs(1).dims==list(-1,-1) + elseif A.dims==B.dims then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims==list(-1,-1) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_besselk.bin b/modules/m2sci/macros/sci_files/sci_besselk.bin new file mode 100755 index 000000000..715d461a1 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_besselk.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_besselk.sci b/modules/m2sci/macros/sci_files/sci_besselk.sci new file mode 100755 index 000000000..f7788aefc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_besselk.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_besselk(tree) + // M2SCI function + // Conversion function for Matlab besselk() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.lhs)==2 then // [y,ierr]=besselk(alpha,x) + error(gettext("Bessel function is not implemented for 2 outputs arguments.")) + end + + if rhs==2 then + [A,B]=getrhs(tree) // y=besselk(alpha,x) + elseif rhs==3 then // y=besselk(alpha,x,1) + [A,B,C]=getrhs(tree) + end + + A=convert2double(A) + B=convert2double(B) + + if is_real(B) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_empty(A) | is_empty(B) then // A or B is an empty + tree.lhs(1).dims=list(0,0) + elseif is_a_scalar(A) then // A is a scalar + tree.lhs(1).dims=B.dims + elseif is_a_scalar(B) then// B is a scalar + tree.lhs(1).dims=A.dims + else + Aknowndim=%t // boolean false if A dimension is unknown + Bknowndim=%t // boolean false if B dimension is unknown + for i=1:size(A.dims) + if A.dims(i)==-1 then + Aknowndim=%f + break + end + end + for i=1:size(B.dims) + if B.dims(i)==-1 then + Bknowndim=%f + break + end + end + if is_a_vector(A) then // A is a vector + if is_a_vector(B) then // B is a vector + if A.dims==B.dims then // both A and B are column vectors or both A and B are line vectors + tree.lhs(1).dims=B.dims + else // A is a line vector and B is a column vector, or A is a column vector and B is a line vector + tree.lhs(1).dims(1)=B.dims(1)*B.dims(2) + tree.lhs(1).dims(2)=A.dims(1)*A.dims(2) + end + end + elseif ~(Aknowndim & Bknowndim) then // A or B dimension(s) is unknown + tree.lhs(1).dims==list(-1,-1) + elseif A.dims==B.dims then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims==list(-1,-1) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_bessely.bin b/modules/m2sci/macros/sci_files/sci_bessely.bin new file mode 100755 index 000000000..3d13bfccf Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_bessely.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_bessely.sci b/modules/m2sci/macros/sci_files/sci_bessely.sci new file mode 100755 index 000000000..72896ea90 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bessely.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_bessely(tree) + // M2SCI function + // Conversion function for Matlab bessely() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.lhs)==2 then // [y,ierr]=bessely(alpha,x) + error(gettext("Bessel function is not implemented for 2 outputs arguments.")) + end + + if rhs==2 then + [A,B]=getrhs(tree) // y=bessely(alpha,x) + elseif rhs==3 then // y=bessely(alpha,x,1) + [A,B,C]=getrhs(tree) + end + + A=convert2double(A) + B=convert2double(B) + + if is_real(B) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_empty(A) | is_empty(B) then // A or B is an empty + tree.lhs(1).dims=list(0,0) + elseif is_a_scalar(A) then // A is a scalar + tree.lhs(1).dims=B.dims + elseif is_a_scalar(B) then// B is a scalar + tree.lhs(1).dims=A.dims + else + Aknowndim=%t // boolean false if A dimension is unknown + Bknowndim=%t // boolean false if B dimension is unknown + for i=1:size(A.dims) + if A.dims(i)==-1 then + Aknowndim=%f + break + end + end + for i=1:size(B.dims) + if B.dims(i)==-1 then + Bknowndim=%f + break + end + end + if is_a_vector(A) then // A is a vector + if is_a_vector(B) then // B is a vector + if A.dims==B.dims then // both A and B are column vectors or both A and B are line vectors + tree.lhs(1).dims=B.dims + else // A is a line vector and B is a column vector, or A is a column vector and B is a line vector + tree.lhs(1).dims(1)=B.dims(1)*B.dims(2) + tree.lhs(1).dims(2)=A.dims(1)*A.dims(2) + end + end + elseif ~(Aknowndim & Bknowndim) then // A or B dimension(s) is unknown + tree.lhs(1).dims==list(-1,-1) + elseif A.dims==B.dims then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims==list(-1,-1) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_beta.bin b/modules/m2sci/macros/sci_files/sci_beta.bin new file mode 100755 index 000000000..852deb8ec Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_beta.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_beta.sci b/modules/m2sci/macros/sci_files/sci_beta.sci new file mode 100755 index 000000000..f1a900eb0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_beta.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_beta(tree) + // M2SCI function + // Conversion function for Matlab beta() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + [A,B]=getrhs(tree) + A=convert2double(A) + B=convert2double(B) + tree.rhs=list(A,B) + + if is_a_scalar(A) & not_a_scalar(B) then // A is a scalar but not B + n=gettempvar() + insert(Equal(list(n),B)) + insert(Equal(list(Operation("ins",list(n,Cste(":")),list())),A)) + tree.rhs(1)=n + tree.lhs(1).dims=B.dims + elseif is_a_scalar(B) & not_a_scalar(A) then // B is be a scalar but not A + n=gettempvar() + insert(Equal(list(n),A)) + insert(Equal(list(Operation("ins",list(n,Cste(":")),list())),B)) + tree.rhs(2)=n + tree.lhs(1).dims=A.dims + elseif is_a_scalar(A) & is_a_scalar(B) then // Both A and B are scalars + elseif not_a_scalar(A) & not_a_scalar(B) then // A and B have the same size + else + tree.name="mtlb_beta" + end + + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_bin2dec.bin b/modules/m2sci/macros/sci_files/sci_bin2dec.bin new file mode 100755 index 000000000..7df7f529a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_bin2dec.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_bin2dec.sci b/modules/m2sci/macros/sci_files/sci_bin2dec.sci new file mode 100755 index 000000000..822f8e44d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bin2dec.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_bin2dec(tree) + // M2SCI function + // Conversion function for Matlab bin2dec() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(tree.rhs(1).dims(1),1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_bitand.bin b/modules/m2sci/macros/sci_files/sci_bitand.bin new file mode 100755 index 000000000..aeafa4eec Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_bitand.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_bitand.sci b/modules/m2sci/macros/sci_files/sci_bitand.sci new file mode 100755 index 000000000..da336d3c0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bitand.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_bitand(tree) + // M2SCI function + // Conversion function for Matlab bitand() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=tree.rhs(1).dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_bitor.bin b/modules/m2sci/macros/sci_files/sci_bitor.bin new file mode 100755 index 000000000..13ec762b1 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_bitor.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_bitor.sci b/modules/m2sci/macros/sci_files/sci_bitor.sci new file mode 100755 index 000000000..4d66c93a3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bitor.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_bitor(tree) + // M2SCI function + // Conversion function for Matlab bitor() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=tree.rhs(1).dims + tree.lhs(1).type=Type(Double,Real) +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_blanks.bin b/modules/m2sci/macros/sci_files/sci_blanks.bin new file mode 100755 index 000000000..af5292d90 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_blanks.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_blanks.sci b/modules/m2sci/macros/sci_files/sci_blanks.sci new file mode 100755 index 000000000..b8b7387ea --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_blanks.sci @@ -0,0 +1,43 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_blanks(tree) + // M2SCI function + // Conversion function for Matlab blanks() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + + if ~is_a_scalar(A) & typeof(A)<>"variable" then + n=gettempvar() + insert(Equal(list(n),A)) + B=Operation("ext",list(n,Cste(1)),list()) + repl_poss(B,.. + A,A,gettext("is a scalar.")) + elseif ~is_a_scalar(A) then + B=Operation("ext",list(A,Cste(1)),list()) + repl_poss(B,.. + A,A,gettext("is a scalar.")) + else + B=A + end + + tree.name="part" + ones_funcall=Funcall("ones",1,list(Cste(1),B),list()) + tree.rhs=list(Cste(" "),ones_funcall) + + if typeof(A)=="cste" then + tree.lhs(1).dims=list(1,A.value(1)) + else + tree.lhs(1).dims=list(1,Unknown) + end + tree.lhs(1).type=Type(String,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_box.bin b/modules/m2sci/macros/sci_files/sci_box.bin new file mode 100755 index 000000000..ded876f2e Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_box.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_box.sci b/modules/m2sci/macros/sci_files/sci_box.sci new file mode 100755 index 000000000..bdf9533b3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_box.sci @@ -0,0 +1,44 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_box(tree) + // M2SCI function + // Conversion function for Matlab box() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // box toggle + if rhs<=0 then + tree.name="mtlb_box" + // box on/off + elseif rhs==1 then + if typeof(tree.rhs(1))=="cste" then + a=gettempvar() + insert(Equal(list(a),Funcall("gca",1,list(),list()))) + + LHS=Operation("ins",list(a,Cste("box")),list()) + insert(Equal(list(LHS),Cste(convstr(tree.rhs(1).value,"l")))) + + tree=list() + else + tree.name="mtlb_box" + end + + // box(axes_handle,...) + else + if typeof(tree.rhs(2))=="cste" then + LHS=Operation("ins",list(tree.rhs(1),Cste("box")),list()) + insert(Equal(list(LHS),Cste(convstr(tree.rhs(2).value,"l")))) + + tree=list() + else + tree.name="mtlb_box" + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_break.bin b/modules/m2sci/macros/sci_files/sci_break.bin new file mode 100755 index 000000000..af1e05df7 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_break.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_break.sci b/modules/m2sci/macros/sci_files/sci_break.sci new file mode 100755 index 000000000..84848563a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_break.sci @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_break(tree) + // M2SCI function + // Conversion function for Matlab break() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cd.bin b/modules/m2sci/macros/sci_files/sci_cd.bin new file mode 100755 index 000000000..520f1a8ca Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cd.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cd.sci b/modules/m2sci/macros/sci_files/sci_cd.sci new file mode 100755 index 000000000..ac47fdb4b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cd.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_cd(tree) + // M2SCI function + // Conversion function for Matlab cd() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // cd + if rhs<=0 then + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) + // cd(dirname) + else + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ceil.bin b/modules/m2sci/macros/sci_files/sci_ceil.bin new file mode 100755 index 000000000..5538b2cff Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_ceil.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_ceil.sci b/modules/m2sci/macros/sci_files/sci_ceil.sci new file mode 100755 index 000000000..fa1102934 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ceil.sci @@ -0,0 +1,27 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_ceil(tree) + // File generated from sci_PROTO6.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab ceil() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cell.bin b/modules/m2sci/macros/sci_files/sci_cell.bin new file mode 100755 index 000000000..23995ac9d Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cell.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cell.sci b/modules/m2sci/macros/sci_files/sci_cell.sci new file mode 100755 index 000000000..eefd4e458 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cell.sci @@ -0,0 +1,79 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_cell(tree) + // M2SCI function + // Conversion function for Matlab cell() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==0 then + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Cell,Unknown) + return + end + + // cell(n) + if rhs==1 then + n = getrhs(tree) + if is_complex(n) then + n=Funcall("real",1,list(n),list(Variable("",n.infer))) + elseif ~is_real(n) then + newn=Funcall("real",1,list(n),list(Variable("",n.infer))) + repl_poss(newn,n,n,gettext("is Real.")); + n=newn + end + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Cell,Unknown) + // cell([n1,n2,...]) + elseif not_a_scalar(n) + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + tree.lhs(1).type=Type(Cell,Unknown) + // cell(n) or cell([n1,n2,...]) ? + else + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Cell,Unknown) + end + + // cell(n1,n2,..) + else + for k=1:size(tree.rhs) + if is_complex(tree.rhs(k)) then + tree.rhs(k)=Funcall("real",1,list(tree.rhs(k)),list()) + elseif ~is_real(tree.rhs(k)) then + newn=Funcall("real",1,list(tree.rhs(k)),list()) + repl_poss(newn,tree.rhs(k),tree.rhs(k),gettext("is Real.")); + tree.rhs(k)=newn + end + end + + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Cell,Unknown) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cell2mat.bin b/modules/m2sci/macros/sci_files/sci_cell2mat.bin new file mode 100755 index 000000000..83daaf1f4 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cell2mat.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cell2mat.sci b/modules/m2sci/macros/sci_files/sci_cell2mat.sci new file mode 100755 index 000000000..c5560aaa7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cell2mat.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_cell2mat(tree) + // M2SCI function + // Conversion function for Matlab cell2mat() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + if is_empty(A) then + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Double,Real) + elseif size(A.dims)==2 + if A.dims(1)<> -1 & A.dims(2)<> -1 then + lhs_dims2=0; + for i=1:A.dims(2) + lhs_dims2=A.contents.data(i).dims(2) + lhs_dims2 + end + lhs_dims1=0; + for i=1:A.dims(1) + lhs_dims1=A.contents.data(1+(i-1)*A.dims(2)).dims(1) + lhs_dims1 + end + tree.lhs(1).dims=list(lhs_dims1,lhs_dims2) + tree.lhs(1).type = A.contents.data(1).type + else + tree.lhs(1).dims=list(-1,-1) + tree.lhs(1).type=Type(Unknown,Unknown) + end + else + tree.lhs(1).dims=list(-1,-1) + tree.lhs(1).type=Type(Unknown,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cellstr.bin b/modules/m2sci/macros/sci_files/sci_cellstr.bin new file mode 100755 index 000000000..c71ea6e8f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cellstr.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cellstr.sci b/modules/m2sci/macros/sci_files/sci_cellstr.sci new file mode 100755 index 000000000..d2c1a9647 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cellstr.sci @@ -0,0 +1,34 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_cellstr(tree) + // M2SCI function + // Conversion function for Matlab cellstr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + tree.rhs=Rhs_tlist(A) + Aknowndim=%t // Aknowndim is a boolean, true if all dimennsions of A are known + tree.lhs(1).dims=list() + for i=1:size(A.dims) + if A.dims(i)==-1 then + Aknowndim=%f + break + end + end + if ~Aknowndim then + tree.lhs(1).dims(1)=-1 + tree.lhs(1).dims(2)=1 + else + tree.lhs(1).dims(1)=A.dims(1) + tree.lhs(1).dims(2)=1 + end + tree.lhs(1).type=Type(Cell,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_char.bin b/modules/m2sci/macros/sci_files/sci_char.bin new file mode 100755 index 000000000..67d9c583c Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_char.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_char.sci b/modules/m2sci/macros/sci_files/sci_char.sci new file mode 100755 index 000000000..ea9d3b805 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_char.sci @@ -0,0 +1,53 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_char(tree) + // M2SCI function + // Conversion function for Matlab char() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 then // char(A) + A = getrhs(tree) + if A.vtype==1 | A.vtype==8 | A.vtype==10 then + tree.lhs(1).dims=tree.rhs(1).dims + // input is cell + elseif A.vtype==16 | A.vtype==17 then + if size(A.contents.data)>0 then + lhs_dims1=0; + lhs_dims2=0; + for i=1:size(A.contents.data) + if A.contents.data(i).dims(1)<>-1 & A.contents.data(i).dims(2)<>-1 then + lhs_dims1=lhs_dims1+A.contents.data(i).dims(1) + lhs_dims2=max(A.contents.data(i).dims(2),lhs_dims2) + else + lhs_dims1=-1; + lhs_dims2=-1; + end + end + tree.lhs(1).dims(1)=lhs_dims1; + tree.lhs(1).dims(2)=lhs_dims2; + end + elseif A.vtype==Unknown then + tree.lhs(1).dims=list(-1,-1); + else + error(msprintf(gettext("%s is not implemented."),string(A.vtype))) + end + elseif rhs>1 //char(t1,t2,t3,...) + lhs_dims1=0; + lhs_dims2=0; + for i=1:rhs + lhs_dims1=lhs_dims1+tree.rhs(i).dims(1) + lhs_dims2=max(tree.rhs(i).dims(2),lhs_dims2) + end + tree.lhs(1).dims(1)=lhs_dims1; + tree.lhs(1).dims(2)=lhs_dims2; + end + tree.lhs(1).type=Type(String,Real); +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_chol.bin b/modules/m2sci/macros/sci_files/sci_chol.bin new file mode 100755 index 000000000..4dd772b31 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_chol.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_chol.sci b/modules/m2sci/macros/sci_files/sci_chol.sci new file mode 100755 index 000000000..aafba0f81 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_chol.sci @@ -0,0 +1,37 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_chol(tree) + // M2SCI function + // Conversion function for Matlab chol() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X = getrhs(tree) + + if X.vtype==Sparse then + tree.name="spchol" + else + tree.name="chol" + end + + // %c_chol and %b_chol are not defined + X=convert2double(X) + tree.rhs=Rhs_tlist(X) + + // R = chol(X) + if lhs==1 then + tree.lhs(1).dims=X.dims + tree.lhs(1).type=X.type + // [R,p] = chol(X) + else + no_equiv(gettext("Call to chol() with 2 outputs.")) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cla.bin b/modules/m2sci/macros/sci_files/sci_cla.bin new file mode 100755 index 000000000..3a48a09d7 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cla.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cla.sci b/modules/m2sci/macros/sci_files/sci_cla.sci new file mode 100755 index 000000000..40ddc4a9c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cla.sci @@ -0,0 +1,26 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_cla(tree) + // M2SCI function + // Conversion function for Matlab cla() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs<1 then + set_infos(gettext("All children will be deleted, no HandleVisibility property in Scilab graphics."),2); + end + + // a=gca() + a=gettempvar() + insert(Equal(list(a),Funcall("gca",1,list(),list()))) + + tree.name="delete" + tree.rhs=list(Operation("ext",list(a,Cste("children")),list())) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_clc.bin b/modules/m2sci/macros/sci_files/sci_clc.bin new file mode 100755 index 000000000..339fdea80 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_clc.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_clc.sci b/modules/m2sci/macros/sci_files/sci_clc.sci new file mode 100755 index 000000000..05c60be28 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clc.sci @@ -0,0 +1,17 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_clc(tree) + // M2SCI function + // Conversion function for Matlab clc + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.rhs=list() +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_clear.bin b/modules/m2sci/macros/sci_files/sci_clear.bin new file mode 100755 index 000000000..292dd3373 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_clear.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_clear.sci b/modules/m2sci/macros/sci_files/sci_clear.sci new file mode 100755 index 000000000..199e70a01 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clear.sci @@ -0,0 +1,47 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_clear(tree) + // M2SCI function + // Conversion function for Matlab clear() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + for k=1:rhs + if tree.rhs(k).value=="" then + tree.rhs(k)=null() + end + end + + if size(tree.rhs)==0 then + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Unknown,Unknown) + else + select tree.rhs(1).value + case "global" then + tree.rhs(1)=null() + tree.name="clearglobal" + case "all" then + tree.rhs=list() + case "classes" then + no_equiv(expression2code(tree)) + case "functions" then + no_equiv(expression2code(tree)) + case "import" then + no_equiv(expression2code(tree)) + case "variables" then + tree.rhs=list() + else + // Nothing to do + end + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Unknown,Unknown) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_clf.bin b/modules/m2sci/macros/sci_files/sci_clf.bin new file mode 100755 index 000000000..febbb8181 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_clf.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_clf.sci b/modules/m2sci/macros/sci_files/sci_clf.sci new file mode 100755 index 000000000..223749a13 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clf.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_clf(tree) + // M2SCI function + // Conversion function for Matlab clf() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs<1 then + set_infos(gettext("All children will be deleted, no HandleVisibility property in Scilab graphics."),2); + end + if rhs==1 then + set_infos(gettext("All properties will be reset."),2); + end + + // f=gcf() inserted if output value stored in a variable + if tree.lhs(1).name<>"ans" then + f=tree.lhs(1) + insert(Equal(list(f),Funcall("gcf",1,list(),list())),1) + end + tree.lhs(1).name="ans" +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_clock.bin b/modules/m2sci/macros/sci_files/sci_clock.bin new file mode 100755 index 000000000..af1af9730 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_clock.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_clock.sci b/modules/m2sci/macros/sci_files/sci_clock.sci new file mode 100755 index 000000000..a20d8f3b2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clock.sci @@ -0,0 +1,43 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_clock(tree) + // M2SCI function + // Conversion function for Matlab clock() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + w = gettempvar() + elt1=Operation(":",list(Cste(1),Cste(2)),list()) + elt2=Operation(":",list(Cste(6),Cste(9)),list()) + row=Operation("rc",list(elt1,elt2),list()) + + // w = getdate(); + insert(Equal(list(w),Funcall("getdate",1,list(),list()))) + + // w(3:5)=[] (then w with 7 values) + imp=Operation(":",list(Cste(3),Cste(5)),list()) + w35=Operation("ins",list(w,imp),list()) + insert(Equal(list(w35),Cste([]))) + + // w(6)=w(6)+w(7)/1000 + w7=Operation("ext",list(w,Cste(7)),list()) + w6ext=Operation("ext",list(w,Cste(6)),list()) + w6ins=Operation("ext",list(w,Cste(6)),list()) + div=Operation("/",list(w7,Cste(1000)),list()) + add=Operation("+",list(w6ext,div),list()) + insert(Equal(list(w6ins),add)) + + // c= w(1:6) + imp=Operation(":",list(Cste(1),Cste(6)),list()) + tree=Operation("ext",list(w,imp),tree.lhs) + + tree.out(1).dims=list(1,6) + tree.out(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_close.bin b/modules/m2sci/macros/sci_files/sci_close.bin new file mode 100755 index 000000000..ee1a355da Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_close.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_close.sci b/modules/m2sci/macros/sci_files/sci_close.sci new file mode 100755 index 000000000..d5806d62c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_close.sci @@ -0,0 +1,58 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_close(tree) + // M2SCI function + // Conversion function for Matlab close() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_close() + + global %graphicswindow + + if tree.lhs(1).name<>"ans" then + no_equiv(msprintf(gettext("%s will be ignored at run time."),tree.lhs(1).name)) + end + + // close + if rhs==0 then + if %graphicswindow==Handle then + tree.name="delete" + tree.rhs(1)=Funcall("gcf",1,list(),list()) + else + // Nothing changed + end + // close(h) - close('all') - close(name) + elseif rhs==1 then + h=tree.rhs(1) + if h.vtype==Handle then // close(h) + tree.name="delete" + elseif h.vtype==Double then // close(h) + // Nothing changed + elseif h.vtype==String then + if typeof(h)=="cste" then + if h.value=="all" then // close('all') + tree.name="xdel" + tree.rhs(1)=Funcall("winsid",1,list(),list()) + else // close(name) + tree.name="mtlb_close" + end + else + tree.name="mtlb_close" + end + else // Unknown type for h + tree.name="mtlb_close" + end + else // close('all','hidden') + set_infos(gettext("All windows will be deleted."),2); + tree.name="xdel" + tree.rhs(1)=Funcall("winsid",1,list(),list()) + tree.rhs(2)=null() + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_closereq.bin b/modules/m2sci/macros/sci_files/sci_closereq.bin new file mode 100755 index 000000000..ff89693fe Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_closereq.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_closereq.sci b/modules/m2sci/macros/sci_files/sci_closereq.sci new file mode 100755 index 000000000..0ed564687 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_closereq.sci @@ -0,0 +1,20 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_closereq(tree) + // M2SCI function + // Conversion function for Matlab closereq + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="delete" + + tree.rhs(1)=Funcall("gcf",1,list(),list()) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_colordef.bin b/modules/m2sci/macros/sci_files/sci_colordef.bin new file mode 100755 index 000000000..0e4c80721 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_colordef.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_colordef.sci b/modules/m2sci/macros/sci_files/sci_colordef.sci new file mode 100755 index 000000000..441eb7031 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_colordef.sci @@ -0,0 +1,86 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_colordef(tree) + // M2SCI function + // Conversion function for Matlab colordef() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if tree.lhs(1).name=="ans" then + f=gettempvar() + else + f=tree.lhs(1) + end + + // colordef color_option + if rhs==1 then + if typeof(tree.rhs(1))=="cste" then + if or(tree.rhs(1).value==["black","none"]) then + insert(Equal(list(f),Funcall("gcf",1,list(),list()))) + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-1))) + tree=list() + elseif tree.rhs(1).value=="white" then + insert(Equal(list(f),Funcall("gcf",1,list(),list()))) + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-2))) + tree=list() + else + no_equiv(expression2code(tree)) + end + else + tree.name="mtlb_colordef" + end + else + // colordef('new',color_opt) + if tree.rhs(1).vtype==String then + winsid_funcall=Funcall("winsid",1,list(),list()) + max_funcall=Funcall("max",1,list(winsid_funcall),list()) + addition=Operation("+",list(max_funcall,Cste(1)),list()) + scf_funcall=Funcall("scf",1,list(addition),list()) + insert(Equal(list(f),scf_funcall)) + if or(tree.rhs(2).value==["black","none"]) then + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-1))) + tree=list() + elseif tree.rhs(2).value=="white" then + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-2))) + tree=list() + else + no_equiv(expression2code(tree)) + end + + // colordef(fig,color_opt) + elseif tree.rhs(1).vtype==Handle then + f=tree.rhs(1) + if or(tree.rhs(2).value==["black","none"]) then + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-1))) + if tree.lhs(1).name<>"ans" then + insert(Equal(list(tree.lhs(1)),f)) + end + tree=list() + elseif tree.rhs(2).value=="white" then + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-2))) + if tree.lhs(1).name<>"ans" then + insert(Equal(list(tree.lhs(1)),f)) + end + tree=list() + else + no_equiv(expression2code(tree)) + end + else + tree.name="mtlb_colordef" + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cond.bin b/modules/m2sci/macros/sci_files/sci_cond.bin new file mode 100755 index 000000000..b309b0e19 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cond.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cond.sci b/modules/m2sci/macros/sci_files/sci_cond.sci new file mode 100755 index 000000000..065cacc3f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cond.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_cond(tree) + // M2SCI function + // Conversion function for Matlab cond() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_cond() + + if rhs == 1 then + A = getrhs(tree); + for i=1:size(A.dims) + if A.dims(i) == -1 | A.dims(i) == 0 then + tree.name = "mtlb_cond"; + end + end + elseif rhs == 2 + tree.name = "mtlb_cond"; + end + tree.lhs(1).type = Type(Double,Real); + tree.lhs(1).dims =list(1,1); +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_conj.bin b/modules/m2sci/macros/sci_files/sci_conj.bin new file mode 100755 index 000000000..8ea67326b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_conj.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_conj.sci b/modules/m2sci/macros/sci_files/sci_conj.sci new file mode 100755 index 000000000..b30ca6524 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_conj.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_conj(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab conj() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="conj" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_continue.bin b/modules/m2sci/macros/sci_files/sci_continue.bin new file mode 100755 index 000000000..52385b085 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_continue.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_continue.sci b/modules/m2sci/macros/sci_files/sci_continue.sci new file mode 100755 index 000000000..651d2e249 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_continue.sci @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_continue(tree) + // M2SCI function + // Conversion function for Matlab continue + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_conv.bin b/modules/m2sci/macros/sci_files/sci_conv.bin new file mode 100755 index 000000000..0c363c56e Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_conv.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_conv.sci b/modules/m2sci/macros/sci_files/sci_conv.sci new file mode 100755 index 000000000..5810a6edd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_conv.sci @@ -0,0 +1,36 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_conv(tree) + // M2SCI function + // Conversion function for Matlab conv() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_conv() + + if rhs==2 then // conv(u,v) + [A,B]=getrhs(tree) // conv(u,v) + elseif rhs==3 then + [A,B,shape]=getrhs(tree) + end + if is_real(A)&is_real(B) then + tree.lhs(1).type=Type(Double,Real) + elseif is_complex(A)|is_complex(B) then + tree.lhs(1).type=Type(Double,Complex) + else + tree.lhs(1).type=Type(Double,Unknown) + end + if and([A.dims(1),B.dims(1)]==1)|(A.dims(2)==SupToOne&B.dims(2)==SupToOne)|(A.dims(2)>1&B.dims(2)>1) then //A and B row vectors + tree.lhs(1).dims=list(1,Unknown) + elseif and([A.dims(2),B.dims(2)]==1)|(A.dims(1)==SupToOne&B.dims(1)==SupToOne)|(A.dims(1)>1&B.dims(1)>1) then // A and B column vectors + tree.lhs(1).dims=list(Unknown,1) + else + tree.lhs(1).dims=list(Unknown,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_conv2.bin b/modules/m2sci/macros/sci_files/sci_conv2.bin new file mode 100755 index 000000000..99ed2b8e8 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_conv2.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_conv2.sci b/modules/m2sci/macros/sci_files/sci_conv2.sci new file mode 100755 index 000000000..7fea4be73 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_conv2.sci @@ -0,0 +1,65 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_conv2(tree) + // M2SCI function + // Conversion function for Matlab conv2() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==2 then // conv2(A,B) + [A,B]=getrhs(tree) + A=convert2double(A) + B=convert2double(B) + if is_real(A)&is_real(B) then + tree.lhs(1).type=Type(Double,Real) + elseif is_complex(A)|is_complex(B) then + tree.lhs(1).type=Type(Double,Complex) + else + tree.lhs(1).type=Type(Double,Unknown) + end + elseif rhs==3 then + [A,B,C]=getrhs(tree) + if C.type==String then // conv(A,B,frame) + A=convert2double(A) + B=convert2double(B) + if is_real(A)&is_real(B) then + tree.lhs(1).type=Type(Double,Real) + elseif is_complex(A)|is_complex(B) then + tree.lhs(1).type=Type(Double,Complex) + else + tree.lhs(1).type=Type(Double,Unknown) + end + else // conv(u,v,B) + A=convert2double(A) + B=convert2double(B) + C=convert2double(C) + if is_real(A)&is_real(B)&is_real(C) then + tree.lhs(1).type=Type(Double,Real) + elseif is_complex(A)|is_complex(B)|is_complex(C) then + tree.lhs(1).type=Type(Double,Complex) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end + elseif rhs==4 then // conv(u,v,B, frame) + [A,B,C,D]=getrhs(tree) + A=convert2double(A) + B=convert2double(B) + C=convert2double(C) + if is_real(A)&is_real(B)&is_real(C) then + tree.lhs(1).type=Type(Double,Real) + elseif is_complex(A)|is_complex(B)|is_complex(C) then + tree.lhs(1).type=Type(Double,Complex) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end + tree.lhs(1).dims=list(Unknown,Unknown); +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cos.bin b/modules/m2sci/macros/sci_files/sci_cos.bin new file mode 100755 index 000000000..f0964b35a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cos.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cos.sci b/modules/m2sci/macros/sci_files/sci_cos.sci new file mode 100755 index 000000000..36cb95930 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cos.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_cos(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab cos() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cosh.bin b/modules/m2sci/macros/sci_files/sci_cosh.bin new file mode 100755 index 000000000..ecf20105b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cosh.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cosh.sci b/modules/m2sci/macros/sci_files/sci_cosh.sci new file mode 100755 index 000000000..fb4e90ad0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cosh.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_cosh(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab cosh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cot.bin b/modules/m2sci/macros/sci_files/sci_cot.bin new file mode 100755 index 000000000..541ef8032 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cot.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cot.sci b/modules/m2sci/macros/sci_files/sci_cot.sci new file mode 100755 index 000000000..8156291b2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cot.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_cot(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab cot() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="cotg" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_coth.bin b/modules/m2sci/macros/sci_files/sci_coth.bin new file mode 100755 index 000000000..a55e5ce77 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_coth.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_coth.sci b/modules/m2sci/macros/sci_files/sci_coth.sci new file mode 100755 index 000000000..7773441f1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_coth.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_coth(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab coth() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="coth" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cov.bin b/modules/m2sci/macros/sci_files/sci_cov.bin new file mode 100755 index 000000000..1d43ad5ef Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cov.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cov.sci b/modules/m2sci/macros/sci_files/sci_cov.sci new file mode 100755 index 000000000..e6b7789d1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cov.sci @@ -0,0 +1,168 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_cov(tree) + // M2SCI function + // Conversion function for Matlab cov() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 then + A=getrhs(tree) + if A.dims(1) == 1 then + if A.dims(2) == 1 then + tree.name="mvvacov" + tree.lhs(1).dims=list(1,1) + elseif A.dims(2) > 1 then + tree.name="mvvacov" + tree.rhs(1) = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + n = A.dims(2) + n_minus = n-1 + tree.lhs(1).dims=list(n,n) + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + elseif A.dims(2) == Unknown then + tree.name = "mtlb_cov" + end + elseif A.dims(1) > 1 then + tree.name = "mvvacov" + n = A.dims(1) + n_minus = n-1 + tree.lhs(1).dims=list(n,n) + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + elseif A.dims(1) == Unknown & A.dims(2) == Unknown + tree.name = "mtlb_cov" + end + elseif rhs == 2 then + [A,B] = getrhs(tree) + if B.dims(1) == 1 & B.dims(2) == 1 + if typeof(B) == "cste" & B.value == 1 then + if A.dims(1) == 1 then + if A.dims(2) == 1 then + tree.name = "mvvacov" + tree.rhs(2)=null() + tree.lhs(1).dims=list(1,1) + elseif A.dims(2) > 1 then + tree.name = "mvvacov" + tree.rhs(1) = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + tree.rhs(2)=null() + tree.lhs(1).dims=list(A.dims(2),A.dims(2)) + elseif A.dims(2) == Unknown then + tree.name = "mtlb_cov" + end + elseif A.dims(1) > 1 then + tree.name = "mvvacov" + tree.rhs(2)=null() + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + elseif A.dims(1) == Unknown & A.dims(2) == Unknown + tree.name = "mtlb_cov" + end + elseif typeof(B) == "cste" & B.value == 0 then + if A.dims(1) == 1 then + if A.dims(2) == 1 then + tree.name="mvvacov" + tree.rhs(2)=null() + tree.lhs(1).dims=list(1,1) + elseif A.dims(2) > 1 then + tree.name="mvvacov" + tree.rhs(2)=null() + tree.rhs(1) = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + n = A.dims(2) + n_minus = n-1 + tree.lhs(1).dims=list(n,n) + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + elseif A.dims(2) == Unknown then + tree.name = "mtlb_cov" + end + elseif A.dims(1) > 1 then + tree.name = "mvvacov" + tree.rhs(2)=null() + n = A.dims(1) + n_minus = n-1 + tree.lhs(1).dims=list(n,n) + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + elseif A.dims(1) == Unknown & A.dims(2) == Unknown + tree.name = "mtlb_cov" + end + else + tree.name = "mtlb_cov" + end + elseif B.dims(1)>1 | B.dims(2)>1 then + tree.name = "mvvacov" + n = B.dims(1)*B.dims(2) + n_minus = n-1 + tree.lhs(1).dims=list(n,n) + rhs1 = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + rhs2 = Funcall("matrix",1,list(B,Cste(-1),Cste(1)),list()) + tree.rhs(1) = Operation("rc",list(rhs1,rhs2),list()) + tree.rhs(2) = null() + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + else + tree.name = "mtlb_cov" + end + elseif rhs==3 + [A,B,C]=getrhs(tree) + if typeof(C) == "cste" & C.value == 1 then + if B.dims(1)>1 | B.dims(2)>1 | A.dims(1)>1 | A.dims(2)>1 + tree.name = "mvvacov" + rhs1 = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + rhs2 = Funcall("matrix",1,list(B,Cste(-1),Cste(1)),list()) + tree.rhs(1) = Operation("rc",list(rhs1,rhs2),list()) + tree.rhs(3) = null() + tree.rhs(2) = null() + if A.dims(1)<> Unknown & A.dims(2)<>Unknown + tree.lhs(1).dims = list(A.dims(1)*A.dims(2),A.dims(1)*A.dims(2)) + elseif B.dims(1)<>Unknown & B.dims(2)<>Unknown + tree.lhs(1).dims = list(B.dims(1)*B.dims(2),B.dims(1)*B.dims(2)) + end + else + tree.name = "mtlb_cov" + end + elseif typeof(C) == "cste" & C.value == 0 then + if B.dims(1)>1 | B.dims(2)>1 | A.dims(1)>1 | A.dims(2)>1 + if A.dims(1)<>Unknown & A.dims(2)<>Unknown + tree.name = "mvvacov" + n = A.dims(1)*A.dims(2) + n_minus = n-1 + tree.lhs(1).dims = list(n,n) + rhs1 = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + rhs2 = Funcall("matrix",1,list(B,Cste(-1),Cste(1)),list()) + tree.rhs(1) = Operation("rc",list(rhs1,rhs2),list()) + tree.rhs(3)=null() + tree.rhs(2)=null() + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + elseif B.dims(1)<>Unknown & B.dims(2)<>Unknown + tree.name = "mvvacov" + n = B.dims(1)*B.dims(2) + n_minus = n-1 + tree.lhs(1).dims = list(n,n) + rhs1 = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + rhs2 = Funcall("matrix",1,list(B,Cste(-1),Cste(1)),list()) + tree.rhs(1) = Operation("rc",list(rhs1,rhs2),list()) + tree.rhs(3)=null() + tree.rhs(2)=null() + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + else + tree.name = "mtlb_cov" + end + else + tree.name = "mtlb_cov" + end + else + tree.name = "mtlb_cov" + end + end + +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_cputime.bin b/modules/m2sci/macros/sci_files/sci_cputime.bin new file mode 100755 index 000000000..c3ad74c1e Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cputime.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cputime.sci b/modules/m2sci/macros/sci_files/sci_cputime.sci new file mode 100755 index 000000000..b942e921c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cputime.sci @@ -0,0 +1,20 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_cputime(tree) + // M2SCI function + // Conversion function for Matlab cputime() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="timer" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_csc.bin b/modules/m2sci/macros/sci_files/sci_csc.bin new file mode 100755 index 000000000..f7da639b7 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_csc.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_csc.sci b/modules/m2sci/macros/sci_files/sci_csc.sci new file mode 100755 index 000000000..39ed08bda --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_csc.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_csc(tree) + // M2SCI function + // Conversion function for Matlab csc() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + sin_funcall=Funcall("sin",1,list(X),list()) + tree=Operation("./",list(Cste(1),sin_funcall),tree.lhs) + + tree.out(1).dims=X.dims + tree.out(1).type=Type(Double,X.property) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_csch.bin b/modules/m2sci/macros/sci_files/sci_csch.bin new file mode 100755 index 000000000..46a318aa3 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_csch.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_csch.sci b/modules/m2sci/macros/sci_files/sci_csch.sci new file mode 100755 index 000000000..625257ac1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_csch.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_csch(tree) + // M2SCI function + // Conversion function for Matlab csch() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + sinh_funcall=Funcall("sinh",1,list(X),list()) + tree=Operation("./",list(Cste(1),sinh_funcall),tree.lhs) + + tree.out(1).dims=X.dims + tree.out(1).type=Type(Double,X.property) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cumprod.bin b/modules/m2sci/macros/sci_files/sci_cumprod.bin new file mode 100755 index 000000000..24b912a4a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cumprod.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cumprod.sci b/modules/m2sci/macros/sci_files/sci_cumprod.sci new file mode 100755 index 000000000..3e94b9c4c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cumprod.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_cumprod(tree) + // File generated from sci_PROTO2.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab cumprod() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_cumprod() + + // B = cumprod(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_cumprod and %C_cumprod are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + dim=first_non_singleton(A) + + tree.lhs(1).dims=A.dims + + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + elseif dim==-1 then + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + end + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + // B = cumprod(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_cumprod and %C_cumprod are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + if typeof(A)=="funcall" then + tree.lhs(1).infer=A.infer + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + tree.lhs(1).infer=A.infer + A.out=tree.lhs + end + tree=A; + set_infos(msprintf(gettext("Scilab %s() does not work when dim input argument is greater than number of dims of first rhs..."),"cumprod"),1) + return + end + end + + tree.name="mtlb_cumprod" + tree.lhs(1).dims=A.dims + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cumsum.bin b/modules/m2sci/macros/sci_files/sci_cumsum.bin new file mode 100755 index 000000000..17367a13c Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_cumsum.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_cumsum.sci b/modules/m2sci/macros/sci_files/sci_cumsum.sci new file mode 100755 index 000000000..58cd29af9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cumsum.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_cumsum(tree) + // File generated from sci_PROTO2.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab cumsum() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_cumsum() + + // B = cumsum(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_cumsum and %C_cumsum are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + dim=first_non_singleton(A) + + tree.lhs(1).dims=A.dims + + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + elseif dim==-1 then + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + end + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + // B = cumsum(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_cumsum and %C_cumsum are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + if typeof(A)=="funcall" then + tree.lhs(1).infer=A.infer + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + tree.lhs(1).infer=A.infer + A.out=tree.lhs + end + tree=A; + set_infos(msprintf(gettext("Scilab %s() does not work when dim input argument is greater than number of dims of first rhs..."),"cumsum"),1) + return + end + end + + tree.name="mtlb_cumsum" + tree.lhs(1).dims=A.dims + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_date.bin b/modules/m2sci/macros/sci_files/sci_date.bin new file mode 100755 index 000000000..e95193f2d Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_date.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_date.sci b/modules/m2sci/macros/sci_files/sci_date.sci new file mode 100755 index 000000000..4c9c560c4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_date.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_date(tree) + // M2SCI function + // Conversion function for Matlab date() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,11) + tree.lhs(1).type=Type(String,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_dec2bin.bin b/modules/m2sci/macros/sci_files/sci_dec2bin.bin new file mode 100755 index 000000000..7b945a5c2 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_dec2bin.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_dec2bin.sci b/modules/m2sci/macros/sci_files/sci_dec2bin.sci new file mode 100755 index 000000000..0ee30cfe9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dec2bin.sci @@ -0,0 +1,22 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_dec2bin(tree) + // M2SCI function + // Conversion function for Matlab dec2bin() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + proddims=1 + for k=tree.rhs(1).dims + proddims=k*proddims + end + tree.lhs(1).dims=list(proddims,1) + tree.lhs(1).type=Type(String,Real) +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_dec2hex.bin b/modules/m2sci/macros/sci_files/sci_dec2hex.bin new file mode 100755 index 000000000..7d4ce676a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_dec2hex.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_dec2hex.sci b/modules/m2sci/macros/sci_files/sci_dec2hex.sci new file mode 100755 index 000000000..d765d58c0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dec2hex.sci @@ -0,0 +1,64 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_dec2hex(tree) + // M2SCI function + // Conversion function for Matlab dec2hex() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // str=dec2hex(D) + if rhs==1 then + D=getrhs(tree) + D=convert2double(D) + + if ~is_real(D) then + newD=Funcall("real",1,list(D),list(D)) + repl_poss(newD,D,D,gettext("is Real.")); + D=newD + end + tree.rhs=list(D) + + if is_empty(D) then + tree=Cste("") + return + elseif not_empty(D) then + tree=Funcall("matrix",1,list(tree,Cste(-1),Cste(1)),tree.lhs) + if is_a_scalar(D) then + tree.lhs(1).dims=list(1,Unknown) + elseif is_a_vector(D) & ( D.dims(1)==1 | D.dims(2)>1 ) then // Row vector + tree.lhs(1).dims=list(D.dims(2),Unknown) + elseif is_a_vector(D) & ( D.dims(1)>1 | D.dims(2)==1 ) then + tree.lhs(1).dims=list(D.dims(1),Unknown) + else + tree.lhs(1).dims=list(Unknown,Unknown) + end + else + tree.name="mtlb_dec2hex" + tree.lhs(1).dims=list(Unknown,Unknown) + end + + // str=dec2hex(D,N) + else + [D,N]=getrhs(tree) + D=convert2double(D) + N=convert2double(N) + tree.rhs=list(D,N) + + tree.name="mtlb_dec2hex" + + if is_empty(D) then + tree=Cste("") + return + elseif not_empty(D) & typeof(N)=="cste" then + tree.lhs(1).dims=list(Unknown,N.value) + end + end + tree.lhs(1).type=Type(String,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_delete.bin b/modules/m2sci/macros/sci_files/sci_delete.bin new file mode 100755 index 000000000..0de216df2 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_delete.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_delete.sci b/modules/m2sci/macros/sci_files/sci_delete.sci new file mode 100755 index 000000000..87c679d56 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_delete.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_delete(tree) + // M2SCI function + // Conversion function for Matlab delete() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X = getrhs(tree) + + if X.vtype==String then + tree.name="mdelete" + elseif X.vtype<>Handle then + tree.name="mtlb_delete" + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_det.bin b/modules/m2sci/macros/sci_files/sci_det.bin new file mode 100755 index 000000000..1cf713654 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_det.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_det.sci b/modules/m2sci/macros/sci_files/sci_det.sci new file mode 100755 index 000000000..fc1fa8a2a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_det.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_det(tree) + // M2SCI function + // Conversion function for Matlab det() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X = getrhs(tree) + + // %c_det and %b_det are not defined + X = convert2double(X) + tree.rhs=Rhs_tlist(X) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=X.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_diag.bin b/modules/m2sci/macros/sci_files/sci_diag.bin new file mode 100755 index 000000000..a8be8b14b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_diag.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_diag.sci b/modules/m2sci/macros/sci_files/sci_diag.sci new file mode 100755 index 000000000..76ee4bb88 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_diag.sci @@ -0,0 +1,89 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_diag(tree) + // M2SCI function + // Conversion function for Matlab diag() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_diag() + + // B = diag(A,k) + if rhs==2 then + [A,k] = getrhs(tree) + // In Scilab k must be a real or complex matrix + k = convert2double(k) + tree.rhs=Rhs_tlist(A,k) + + // Compute dims to for inference + if typeof(k)=="cste" then + if A.dims(1)==1 then // diag of a row vector + n=A.dims(2)+k.value + m=n + elseif A.dims(2)==1 then // diag of a column vector + n=A.dims(1)+k.value + m=n + else + m=Unknown; + n=Unknown; + end + else + m=Unknown; + n=Unknown; + end + tree.lhs(1).dims=list(m,n) + + if or(A.vtype==[String,Unknown]) then + tree.name="mtlb_diag" + tree.lhs(1).type=A.type + else + if A.vtype==Boolean then + tree.rhs=Rhs_tlist(Funcall("bool2s",1,list(A),list()),k) + tree.lhs(1).type=Type(Boolean,Real) + else + tree.lhs(1).type=A.type + end + end + // B = diag(A) + else + A = getrhs(tree) + + // Compute dims to for inference + if A.dims(1)==1 then // diag of a row vector + n=A.dims(2) + m=n + elseif A.dims(2)==1 then // diag of a column vector + n=A.dims(1) + m=n + elseif not_a_vector(A) then + m=min(A.dims); + if not_empty(A) then + n=1 + else + n=Unknown; + end + else + m=Unknown; + n=Unknown; + end + tree.lhs(1).dims=list(m,n) + + if or(A.vtype==[String,Unknown]) then + tree.name="mtlb_diag" + tree.lhs(1).type=A.type + else + if A.vtype==Boolean then + tree.rhs=Rhs_tlist(Funcall("bool2s",1,list(A),list())) + tree.lhs(1).type=Type(Boolean,Real) + else + tree.lhs(1).type=A.type + end + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_diary.bin b/modules/m2sci/macros/sci_files/sci_diary.bin new file mode 100755 index 000000000..7b42b8a2f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_diary.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_diary.sci b/modules/m2sci/macros/sci_files/sci_diary.sci new file mode 100755 index 000000000..e3e9dc09a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_diary.sci @@ -0,0 +1,34 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_diary(tree) + // M2SCI function + // Conversion function for Matlab diary() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // diary toggle + if rhs<=0 then + no_equiv("diary toggle") + else + str=getrhs(tree) + if typeof(str)=="variable" then + str=str.name + elseif typeof(str)=="cste" then + str=str.value + end + if convstr(str,"l")=="""off""" then // diary off + tree.rhs=Cste(0) + elseif convstr(str,"l")=="""on""" then // diary on + no_equiv("diary on") + else // diary(filename) + // Nothing to do + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_diff.bin b/modules/m2sci/macros/sci_files/sci_diff.bin new file mode 100755 index 000000000..8d89b4096 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_diff.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_diff.sci b/modules/m2sci/macros/sci_files/sci_diff.sci new file mode 100755 index 000000000..4c32c81f9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_diff.sci @@ -0,0 +1,76 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_diff(tree) + // M2SCI function + // Conversion function for Matlab diff() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_diff() + + // Y = diff(X) + if rhs==1 then + X=getrhs(tree) + // %c_diff and %b_diff are not defined in Scilab + X=convert2double(X) + tree.rhs=Rhs_tlist(X) + + dim = first_non_singleton(X) + + if dim==-1 then + // All output dims are unknown + tree.lhs(1).dims=allunknown(X.dims) + // First non singleton dimension will be computed at execution + tree.rhs=Rhs_tlist(X,1,Funcall("firstnonsingleton",1,list(X),list())) + else + tree.lhs(1).dims=X.dims + if dim==0 then + tree.rhs=Rhs_tlist(X) + if is_a_scalar(X) then // Special case for scalar input, output is [] + tree.lhs(1).dims = list(0,0); + end + if is_a_vector(X) then // Special case for vector input (all dimensions known and one is greater than 1) + for n=1:size(X.dims) + if tree.lhs(1).dims(n)<>1 then + tree.lhs(1).dims(n)=tree.lhs(1).dims(n)-1; + end + end + end + else + tree.rhs=Rhs_tlist(X,1,dim) + tree.lhs(1).dims(dim)=max(X.dims(dim)-1,-1) + end + end + tree.lhs(1).type=Type(Double,Unknown) + // Y = diff(X,n) + elseif rhs==2 then + [X,n] = getrhs(tree); + X = convert2double(X) + n = convert2double(n) + tree.rhs=Rhs_tlist(X,n) + + if ~is_a_vector(X) then + tree.name="mtlb_diff" + end + tree.lhs(1).dims=allunknown(X.dims) + tree.lhs(1).type=Type(Double,Unknown) + + // Y = diff(X,n,dim) + else + [X,n,dim] = getrhs(tree); + X = convert2double(X) + n = convert2double(n) + dim = convert2double(dim) + tree.rhs=Rhs_tlist(X,n,dim) + + tree.lhs(1).dims=allunknown(X.dims) + tree.lhs(1).type=Type(Double,Unknown) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_dir.bin b/modules/m2sci/macros/sci_files/sci_dir.bin new file mode 100755 index 000000000..9864cc93c Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_dir.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_dir.sci b/modules/m2sci/macros/sci_files/sci_dir.sci new file mode 100755 index 000000000..96005537d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dir.sci @@ -0,0 +1,38 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_dir(tree) + // M2SCI function + // Conversion function for Matlab dir() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_dir() + + if tree.lhs(1).name=="ans" then + tree.name="dir" + else + tree.name="mtlb_dir" + tree.lhs(1).type=Type(Struct,Real) + tree.lhs(1).dims=list(Unknown,1) + tree.lhs(1).contents=Contents() + + tree.lhs(1).contents.index(1)=list(list(Cste("*"),Cste("*")),Cste("name")) + tree.lhs(1).contents.data(1)=Infer(list(1,Unknown),Type(String,Real)) + + tree.lhs(1).contents.index(2)=list(list(Cste("*"),Cste("*")),Cste("date")) + tree.lhs(1).contents.data(2)=Infer(list(1,Unknown),Type(String,Real)) + + tree.lhs(1).contents.index(3)=list(list(Cste("*"),Cste("*")),Cste("bytes")) + tree.lhs(1).contents.data(3)=Infer(list(1,1),Type(Double,Real)) + + tree.lhs(1).contents.index(4)=list(list(Cste("*"),Cste("*")),Cste("isdir")) + tree.lhs(1).contents.data(4)=Infer(list(1,1),Type(Boolean,Real)) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_disp.bin b/modules/m2sci/macros/sci_files/sci_disp.bin new file mode 100755 index 000000000..5e7b836d8 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_disp.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_disp.sci b/modules/m2sci/macros/sci_files/sci_disp.sci new file mode 100755 index 000000000..87d1b153b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_disp.sci @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_disp(tree) + // M2SCI function + // Conversion function for Matlab disp() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_display.bin b/modules/m2sci/macros/sci_files/sci_display.bin new file mode 100755 index 000000000..642565858 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_display.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_display.sci b/modules/m2sci/macros/sci_files/sci_display.sci new file mode 100755 index 000000000..2acae53ff --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_display.sci @@ -0,0 +1,19 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_display(tree) + // M2SCI function + // Conversion function for Matlab display() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + set_infos(gettext("Verify that overloading functions have been written for inputs in display()."),2); + tree.name="disp" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_doc.bin b/modules/m2sci/macros/sci_files/sci_doc.bin new file mode 100755 index 000000000..90556fac2 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_doc.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_doc.sci b/modules/m2sci/macros/sci_files/sci_doc.sci new file mode 100755 index 000000000..6d797f8fd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_doc.sci @@ -0,0 +1,30 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_doc(tree) + // M2SCI function + // Conversion function for Matlab doc() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==0 then + tree.rhs=list() + else + topic=getrhs(tree) + k=strindex(topic.value,"/") + if k<>[] & min(k)<>2 then // help toolbox/ + no_equiv(expression2code(tree)); + elseif topic.value=="syntax" then + tree.rhs=Rhs_tlist("names") + else + // Nothing to do + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_docopt.bin b/modules/m2sci/macros/sci_files/sci_docopt.bin new file mode 100755 index 000000000..a473edb76 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_docopt.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_docopt.sci b/modules/m2sci/macros/sci_files/sci_docopt.sci new file mode 100755 index 000000000..95c9eccd6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_docopt.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_docopt(tree) + // M2SCI function + // Conversion function for Matlab docopt() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree=Variable("%browsehelp",Infer(list(1,Unknown),Type(String,Real))) + insert(Equal(list(),Funcall("global",1,list(Cste(tree.name)),list()))) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_dos.bin b/modules/m2sci/macros/sci_files/sci_dos.bin new file mode 100755 index 000000000..4a07d547f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_dos.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_dos.sci b/modules/m2sci/macros/sci_files/sci_dos.sci new file mode 100755 index 000000000..28cf889cb --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dos.sci @@ -0,0 +1,49 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_dos(tree) + // M2SCI function + // Conversion function for Matlab dos() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + if rhs==2 then + tree.rhs(2)=null() + end + + if lhs==1 then + V=gettempvar(2) + S=tree.lhs(1) + if S.name=="ans" then + S=gettempvar(1) + tree.lhs=list(V,S) + else + tree.lhs=list(V,S) + end + insert(Equal(tree.lhs,tree)) + tree=list() + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(S),list())),1) + end + else + tree.lhs=list(tree.lhs($:-1:1)) + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(tree.lhs(1),tree.lhs(2)),list())),1) + end + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(String,Real) + + tree.lhs(2).dims=list(1,1) + tree.lhs(2).type=Type(Double,Real) + + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_double.bin b/modules/m2sci/macros/sci_files/sci_double.bin new file mode 100755 index 000000000..c14252717 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_double.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_double.sci b/modules/m2sci/macros/sci_files/sci_double.sci new file mode 100755 index 000000000..6ac89b0fd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_double.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_double(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab double() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="double" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_drawnow.bin b/modules/m2sci/macros/sci_files/sci_drawnow.bin new file mode 100755 index 000000000..03cddbc7f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_drawnow.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_drawnow.sci b/modules/m2sci/macros/sci_files/sci_drawnow.sci new file mode 100755 index 000000000..bd6fbb31e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_drawnow.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_drawnow(tree) + // M2SCI function + // Conversion function for Matlab drawnow() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + set_infos(gettext("Drawing events are not queued in Scilab."),0); + tree=Funcall("%comment",1,list(Cste(tree.name)),list()) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_echo.bin b/modules/m2sci/macros/sci_files/sci_echo.bin new file mode 100755 index 000000000..e2cdadb02 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_echo.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_echo.sci b/modules/m2sci/macros/sci_files/sci_echo.sci new file mode 100755 index 000000000..6a77a1a93 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_echo.sci @@ -0,0 +1,43 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_echo(tree) + // M2SCI function + // Conversion function for Matlab echo() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_echo() + + // echo toggle + if rhs<=0 then + // mode(abs(mode()-1)) + tree.name="mode" + sub=Operation("-",list(tree,Cste(1)),list()) + abs_funcall=Funcall("abs",1,Rhs_tlist(sub),list()) + tree.rhs=Rhs_tlist(abs_funcall) + // echo on or echo off + elseif rhs==1 then + if typeof(tree.rhs(1))=="cste" then + if tree.rhs(1).value=="on" then + tree.name="mode" + tree.rhs=Rhs_tlist(1); + elseif tree.rhs(1).value=="off" then + tree.name="mode" + tree.rhs=Rhs_tlist(0); + else + no_equiv(expression2code(tree)) + end + else + tree.name="mtlb_echo" + end + // echo function on/off + else + no_equiv(expression2code(tree)) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_eig.bin b/modules/m2sci/macros/sci_files/sci_eig.bin new file mode 100755 index 000000000..838037fa4 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_eig.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_eig.sci b/modules/m2sci/macros/sci_files/sci_eig.sci new file mode 100755 index 000000000..9313e70a6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eig.sci @@ -0,0 +1,102 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_eig(tree) + // M2SCI function + // Conversion function for Matlab eig() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // eig(A) + if rhs==1 then + // Because %c_spec and %b_spec are not defined + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.name="spec" + + // d = eig(A) + if lhs==1 then + tree.lhs(1).dims=list(A.dims(1),1) + tree.lhs(1).type=Type(Double,Unknown) + // [V,D] = eig(A) + else + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=Type(Double,Unknown) + tree.lhs(2).dims=list(A.dims(1),A.dims(1)) + tree.lhs(2).type=Type(Double,Unknown) + end + // eig(A,B) or eig(A,'nobalance') + elseif rhs==2 then + [A,B] = getrhs(tree) + + // 'nobalance' + if B.vtype==String then + no_equiv(gettext("''nobalance'' option, IGNORED.")) + tree.rhs=Rhs_tlist(tree.rhs(1)) + if lhs==1 then + tree.name="spec" + tree.lhs(1).dims=list(A.dims(1),1) + tree.lhs(1).type=Type(Double,Unknown) + else + tree.rhs(1)=Operation("+",list(tree.rhs(1),Variable("%i",Infer()),list())) + rhs2=Operation("+",list(Cste(1),Variable("%eps",Infer()),list())) + tree.rhs=Rhs_tlist(tree.rhs(1),rhs2) + tree.name="bdiag" + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=Type(Double,Unknown) + tree.lhs(2).dims=list(A.dims(1),A.dims(1)) + tree.lhs(2).type=Type(Double,Unknown) + end + return + end + + if B.vtype<>Double then + set_infos(gettext("eig() with 2 inputs: consider generalized eigen. Check."),2) + end + m=A.dims(1) + n=A.dims(2) + if lhs==1 then + al=gettempvar(1) + be=gettempvar(2) + insert(Equal(list(al,be),Funcall("spec",1,tree.rhs,list(al,be)))) + tree=Operation("./",list(al,be),tree.lhs) + + tree.out(1).dims=list(m,1) + tree.out(1).type=Type(Double,Unknown) + else + al=gettempvar(1) + be=gettempvar(2) + + insert(Equal(list(al,be,tree.lhs(1)),Funcall("eig",1,tree.rhs,list(al,be,tree.lhs(1))))) + + tree=Operation("./",list(al,be),list(tree.lhs(1))) + tree=Funcall("diag",1,list(tree),tree.out) + + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=Type(Double,Unknown) + tree.lhs(2).dims=list(A.dims(1),A.dims(1)) + tree.lhs(2).type=Type(Double,Unknown) + end + // eig(A,B,flag) + else + no_equiv(msprintf(gettext("%s, flag IGNORED."),expression2code(tree))) + + tree.rhs(3)=null() + + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=Type(Double,Unknown) + if lhs==2 then + tree.lhs(2).dims=list(A.dims(1),A.dims(1)) + tree.lhs(2).type=Type(Double,Unknown) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_eomday.bin b/modules/m2sci/macros/sci_files/sci_eomday.bin new file mode 100755 index 000000000..38a417e34 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_eomday.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_eomday.sci b/modules/m2sci/macros/sci_files/sci_eomday.sci new file mode 100755 index 000000000..5339ee0b8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eomday.sci @@ -0,0 +1,19 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_eomday(tree) + // M2SCI function + // Conversion function for Matlab eomday() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).type=Type(Double,Real) + tree.lhs(1).dims=list(1,1) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_erf.bin b/modules/m2sci/macros/sci_files/sci_erf.bin new file mode 100755 index 000000000..b4ba986d7 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_erf.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_erf.sci b/modules/m2sci/macros/sci_files/sci_erf.sci new file mode 100755 index 000000000..b68b00b8b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_erf.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_erf(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab erf() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_erfc.bin b/modules/m2sci/macros/sci_files/sci_erfc.bin new file mode 100755 index 000000000..5d57d7be1 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_erfc.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_erfc.sci b/modules/m2sci/macros/sci_files/sci_erfc.sci new file mode 100755 index 000000000..4723f563c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_erfc.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_erfc(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab erfc() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_erfcx.bin b/modules/m2sci/macros/sci_files/sci_erfcx.bin new file mode 100755 index 000000000..458edcee8 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_erfcx.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_erfcx.sci b/modules/m2sci/macros/sci_files/sci_erfcx.sci new file mode 100755 index 000000000..c3c1a184a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_erfcx.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_erfcx(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab erfcx() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_error.bin b/modules/m2sci/macros/sci_files/sci_error.bin new file mode 100755 index 000000000..65f27b37a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_error.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_error.sci b/modules/m2sci/macros/sci_files/sci_error.sci new file mode 100755 index 000000000..5961ccc31 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_error.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_error(tree) + // M2SCI function + // Conversion function for Matlab error() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 then + //Scilab error is equivalent to the Matlab one + return + else + tree.name="mtlb_error" + return + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_etime.bin b/modules/m2sci/macros/sci_files/sci_etime.bin new file mode 100755 index 000000000..d5eeaf6b7 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_etime.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_etime.sci b/modules/m2sci/macros/sci_files/sci_etime.sci new file mode 100755 index 000000000..8007d1b13 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_etime.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_etime(tree) + // M2SCI function + // Conversion function for Matlab etime + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_eval.bin b/modules/m2sci/macros/sci_files/sci_eval.bin new file mode 100755 index 000000000..162c6ec5e Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_eval.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_eval.sci b/modules/m2sci/macros/sci_files/sci_eval.sci new file mode 100755 index 000000000..48be1b5ec --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eval.sci @@ -0,0 +1,41 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_eval(tree) + // M2SCI function + // Conversion function for Matlab eval() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_eval() + + if lhs==1 then + // eval(expression) + if rhs==1 then + tree.name="mtlb_eval" + // eval(expression,catch_expr) + else + tree.name="mtlb_eval" + end + else + tree.name="mtlb_eval" + + // lhs names + LHS=[] + for k=1:lhs + LHS=[LHS,tree.lhs(k).name] + end + LHS="["+strcat(LHS,",")+"]" + if typeof(tree.rhs(1))=="cste" then + tree.rhs=Rhs_tlist(LHS+" = "+tree.rhs(1).value) + else + tree.rhs=Rhs_tlist(LHS+" = "+expression2code(tree.rhs(1))) + end + tree.lhs=list(Variable("ans",Infer())) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_exist.bin b/modules/m2sci/macros/sci_files/sci_exist.bin new file mode 100755 index 000000000..5e29f7c40 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_exist.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_exist.sci b/modules/m2sci/macros/sci_files/sci_exist.sci new file mode 100755 index 000000000..6e529b28b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_exist.sci @@ -0,0 +1,26 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_exist(tree) + // M2SCI function + // Conversion function for Matlab exist() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_exist() + + no_equiv(gettext("Matlab exist(), mtlb_exist() is called.")) + + set_infos(gettext("mtlb_exist() is just a partial emulation of Matlab exist() function."),2) + + scitree.name="mtlb_exist" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_exit.bin b/modules/m2sci/macros/sci_files/sci_exit.bin new file mode 100755 index 000000000..68ff64667 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_exit.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_exit.sci b/modules/m2sci/macros/sci_files/sci_exit.sci new file mode 100755 index 000000000..907241853 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_exit.sci @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_exit(tree) + // M2SCI function + // Conversion function for Matlab exit + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_exp.bin b/modules/m2sci/macros/sci_files/sci_exp.bin new file mode 100755 index 000000000..5722fa2e6 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_exp.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_exp.sci b/modules/m2sci/macros/sci_files/sci_exp.sci new file mode 100755 index 000000000..d3f42dc17 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_exp.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_exp(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab exp() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="exp" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_expm.bin b/modules/m2sci/macros/sci_files/sci_expm.bin new file mode 100755 index 000000000..6be2d7831 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_expm.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_expm.sci b/modules/m2sci/macros/sci_files/sci_expm.sci new file mode 100755 index 000000000..ca247f433 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_expm.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_expm(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab expm() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="expm" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_eye.bin b/modules/m2sci/macros/sci_files/sci_eye.bin new file mode 100755 index 000000000..2e8ecbf41 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_eye.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_eye.sci b/modules/m2sci/macros/sci_files/sci_eye.sci new file mode 100755 index 000000000..8820a67f2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eye.sci @@ -0,0 +1,176 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_eye(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab eye() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_eye() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // eye(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("eye",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // eye([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("eye",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // eye(n) or eye([n1,n2,...]) ? + else + tree.name="mtlb_eye" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // eye(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="eye" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_factor.bin b/modules/m2sci/macros/sci_files/sci_factor.bin new file mode 100755 index 000000000..dd844f299 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_factor.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_factor.sci b/modules/m2sci/macros/sci_files/sci_factor.sci new file mode 100755 index 000000000..3658c2116 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_factor.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_factor(tree) + // M2SCI function + // Conversion function for Matlab factor() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims(1)=1 + tree.lhs(1).type=Type(Double,Real) +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_factorial.bin b/modules/m2sci/macros/sci_files/sci_factorial.bin new file mode 100755 index 000000000..8b7bce292 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_factorial.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_factorial.sci b/modules/m2sci/macros/sci_files/sci_factorial.sci new file mode 100755 index 000000000..1e6b3ca63 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_factorial.sci @@ -0,0 +1,21 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_factorial(tree) + // M2SCI function + // Conversion function for Matlab factorial() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_false.bin b/modules/m2sci/macros/sci_files/sci_false.bin new file mode 100755 index 000000000..a8f3c7416 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_false.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_false.sci b/modules/m2sci/macros/sci_files/sci_false.sci new file mode 100755 index 000000000..4e4f8ca3e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_false.sci @@ -0,0 +1,176 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_false(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab false() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_false() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // false(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("zeros",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // false([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("zeros",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // false(n) or false([n1,n2,...]) ? + else + tree.name="mtlb_false" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // false(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="zeros" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_fclose.bin b/modules/m2sci/macros/sci_files/sci_fclose.bin new file mode 100755 index 000000000..d79b267c5 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fclose.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fclose.sci b/modules/m2sci/macros/sci_files/sci_fclose.sci new file mode 100755 index 000000000..015f46b24 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fclose.sci @@ -0,0 +1,27 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fclose(tree) + // M2SCI function + // Conversion function for Matlab fclose() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + fid=getrhs(tree) + + tree.name="mclose" + + if fid.vtype==Unknown then + set_infos(gettext("Unknown type for input parameter: consider fclose(fid)."),2) + end + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_feof.bin b/modules/m2sci/macros/sci_files/sci_feof.bin new file mode 100755 index 000000000..b2c4a43a1 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_feof.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_feof.sci b/modules/m2sci/macros/sci_files/sci_feof.sci new file mode 100755 index 000000000..36ea9a985 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_feof.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_feof(tree) + // M2SCI function + // Conversion function for Matlab feof() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + fid=getrhs(tree) + + tree.name="meof" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ferror.bin b/modules/m2sci/macros/sci_files/sci_ferror.bin new file mode 100755 index 000000000..cdbc03cf3 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_ferror.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_ferror.sci b/modules/m2sci/macros/sci_files/sci_ferror.sci new file mode 100755 index 000000000..9f1b4d612 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ferror.sci @@ -0,0 +1,39 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_ferror(tree) + // M2SCI function + // Conversion function for Matlab ferror() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + fid=getrhs(tree) + + // ferror(fid,'clear') + if rhs==2 then + tree.rhs(2)=null() + if lhs==2 then + no_equiv(msprintf(gettext("%s with two outputs."),expression2code(tree))); + else + tree.name="mclearerr" + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) + end + // ferror(fid) + else + if lhs==2 then + no_equiv(msprintf(gettext("%s with two outputs."),expression2code(tree))); + else + tree.name="merror" + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_feval.bin b/modules/m2sci/macros/sci_files/sci_feval.bin new file mode 100755 index 000000000..188ab826b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_feval.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_feval.sci b/modules/m2sci/macros/sci_files/sci_feval.sci new file mode 100755 index 000000000..93879664c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_feval.sci @@ -0,0 +1,51 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_feval(tree) + // M2SCI function + // Conversion function for Matlab feval() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_feval() + + set_infos(gettext("Verify that expression evaluated by execstr() is Scilab compatible."),2) + + RHS="(" + for k=2:rhs + if k<>2 then + RHS=RHS+"," + end + if typeof(tree.rhs(k))=="cste" then + RHS=RHS+string(tree.rhs(k).value) + else + RHS=RHS+rhs2code(tree.rhs(k)) + end + end + RHS=RHS+")" + RHS=Operation("+",list(tree.rhs(1),Cste(RHS)),list()) + + if lhs==1 then + tree.name="evstr" + tree.rhs=list(RHS) + else + tree.name="execstr" + LHS="[" + for k=1:lhs + if k>1 then + LHS=LHS+"," + end + LHS=LHS+tree.lhs(k).name + end + LHS=LHS+"]" + + tree.rhs=Rhs_tlist(Operation("+",list(Cste(LHS+" = "),RHS),list())) + + tree.lhs=list(Variable("ans",Infer())) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fft.bin b/modules/m2sci/macros/sci_files/sci_fft.bin new file mode 100755 index 000000000..45ad5d905 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fft.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fft.sci b/modules/m2sci/macros/sci_files/sci_fft.sci new file mode 100755 index 000000000..e255c61b3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fft.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fft(tree) + // M2SCI function + // Conversion function for Matlab fft() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fft() + + // Y = fft(X) + if rhs==1 then + X = getrhs(tree) + // %c_fft and %b_fft are not defined + X = convert2double(X) + tree.rhs=Rhs_tlist(X,-1) + + if size(X.dims)==2 then + if is_a_scalar(X) | is_a_vector(X) then + tree.rhs=Rhs_tlist(X,-1) + elseif not_a_vector(X) then + if X.dims(2)<>Unknown then + tree.rhs=Rhs_tlist(X,-1,X.dims(1),1) + else + tmp=Funcall("size",1,list(X,1),list()) + tree.rhs=Rhs_tlist(X,-1,tmp,1) + end + else + tree.name="mtlb_fft" + tree.rhs=Rhs_tlist(X) + end + else + tree.rhs=Rhs_tlist(X,-1,Funcall("firstnonsingleton",1,list(X,"num"),list()),1) + end + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) + + // Y = fft(X,n) + elseif rhs==2 then + [X,n] = getrhs(tree) + X = convert2double(X) + n = convert2double(n) + tree.rhs=Rhs_tlist(X,n) + + tree.name="mtlb_fft" + if is_empty(X) + tree.lhs(1).dims=list(0,0) + else + tree.lhs(1).dims=allunknown(X.dims) + end + tree.lhs(1).type=Type(Double,Unknown) + // Three input args + elseif rhs==3 then + [X,n,dim] = getrhs(tree) + X = convert2double(X) + n = convert2double(n) + dim = convert2double(dim) + tree.rhs=Rhs_tlist(X,n,dim) + + tree.name="mtlb_fft" + + tree.lhs(1).dims=allunknown(X.dims) + tree.lhs(1).type=Type(Double,Unknown) + + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fft2.bin b/modules/m2sci/macros/sci_files/sci_fft2.bin new file mode 100755 index 000000000..20929f9ef Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fft2.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fft2.sci b/modules/m2sci/macros/sci_files/sci_fft2.sci new file mode 100755 index 000000000..ef9cdd991 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fft2.sci @@ -0,0 +1,54 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_fft2(tree) + // M2SCI function + // Conversion function for Matlab fft2() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // Y = fft2(X) + if rhs == 1 then + X = getrhs(tree) + // %c_fft2 and %b_fft2 are not defined + X = convert2double(X) + tree.rhs=Rhs_tlist(X) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) + + // Y = fft2(X,m,n) + elseif rhs == 3 then + [X,m,n] = getrhs(tree) + X = convert2double(X) + m = convert2double(m) + n = convert2double(n) + tree.rhs=Rhs_tlist(X,m,n) + + tree.lhs(1).type=Type(Double,Unknown) + + for i=1:size(X.dims) + if X.dims(i)==-1 then + tree.lhs(1).dims=allunknown(X.dims) + return + end + end + if tree.rhs(2).dims(1) <> -1 & tree.rhs(3).dims(1) <> -1 + tree.lhs(1).dims=list(m.value,n.value) + else + tree.lhs(1).dims=allunknown(X.dims) + return + end + // case x hypermatrix + for i=3:size(X.dims) + tree.lhs(1).dims($+1)=X.dims(i) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fftshift.bin b/modules/m2sci/macros/sci_files/sci_fftshift.bin new file mode 100755 index 000000000..76784007d Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fftshift.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fftshift.sci b/modules/m2sci/macros/sci_files/sci_fftshift.sci new file mode 100755 index 000000000..1ee77f64b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fftshift.sci @@ -0,0 +1,30 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fftshift(tree) + // M2SCI function + // Conversion function for Matlab fftshift() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if or(tree.rhs(1).vtype==[String,Unknown]) then + tree.name="mtlb_fftshift" + end + if rhs==2 then + if typeof(tree.rhs(2))=="cste" then + if tree.rhs(2).value>size(tree.rhs(1).dims) then + tree.name="mtlb_fftshift" + end + else + tree.name="mtlb_fftshift" + end + end + tree.lhs(1).dims=tree.rhs(1).dims + tree.lhs(1).type=Type(tree.rhs(1).vtype,tree.rhs(1).property) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fgetl.bin b/modules/m2sci/macros/sci_files/sci_fgetl.bin new file mode 100755 index 000000000..c4e7decc5 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fgetl.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fgetl.sci b/modules/m2sci/macros/sci_files/sci_fgetl.sci new file mode 100755 index 000000000..96e8e40e4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fgetl.sci @@ -0,0 +1,45 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fgetl(tree) + // M2SCI function + // Conversion function for Matlab fgetl() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="mgetl" + tree.rhs(2)=Cste(1) + + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name=="ans" then + out=gettempvar() + insert(Equal(list(out),tree)) + tree=out + else + out=tree.lhs(1) + end + + // meof + meof_funcall=Funcall("meof",1,list(),list()) + // meof()~=0 + neq=Operation("~=",list(meof_funcall,Cste(0)),list()) + + // output=-1 + EQ=Equal(list(out),Cste(-1)) + + if typeof(tree)=="variable" then + insert(tlist(["ifthenelse","expression","then","elseifs","else"],neq,list(EQ),list(),list())); + else + insert(tlist(["ifthenelse","expression","then","elseifs","else"],neq,list(EQ),list(),list()),1); + end + + if typeof(tree)<>"variable" then + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(Unknown,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fgets.bin b/modules/m2sci/macros/sci_files/sci_fgets.bin new file mode 100755 index 000000000..26f2253ba Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fgets.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fgets.sci b/modules/m2sci/macros/sci_files/sci_fgets.sci new file mode 100755 index 000000000..1fe42dd30 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fgets.sci @@ -0,0 +1,56 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fgets(tree) + // M2SCI function + // Conversion function for Matlab fgets() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + + if rhs==2 then + tree.name="mgetstr" + tree.rhs=Rhs_tlist(tree.rhs(2),tree.rhs(1)) + if typeof(tree.rhs(1))=="cste" then + tree.lhs(1).dims=list(1,tree.rhs(1).value) + else + tree.lhs(1).dims=list(1,Unknown) + end + tree.lhs(1).type=Type(String,Real) + else + tree.name="mgetl" + tree.lhs(1).dims=list(1,Unknown) + tree.rhs(2)=Cste(1) + // Add a case for the end of file + // fgets returns -1 + // mgetl returns [] + outputvar = tree.lhs(1); + tempvar = %F; + if typeof(outputvar)=="variable" & outputvar.name=="ans" then + outputvar = gettempvar(); + tempvar = %T; + end + // if isempty(outputvar) then outputvar=-1; end + isemptyfuncall = Funcall("isempty", 1, list(outputvar), list()); + newvalue = Equal(list(outputvar), Cste(-1)); + + // If the result is not assigned to a variable then a temporary variable is returned + if tempvar then + // Assign result to tmp + insert(Equal(list(outputvar), tree)); + // Just add the test for EOF + insert(tlist(["ifthenelse","expression","then","elseifs","else"],isemptyfuncall, list(newvalue),list(),list())); + tree = outputvar; + tree.type = Type(Unknown,Real); + else // Just add the test for EOF + insert(tlist(["ifthenelse","expression","then","elseifs","else"],isemptyfuncall, list(newvalue),list(),list()), 1); + tree.lhs(1).type=Type(Unknown,Real) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fileparts.bin b/modules/m2sci/macros/sci_files/sci_fileparts.bin new file mode 100755 index 000000000..4faba3027 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fileparts.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fileparts.sci b/modules/m2sci/macros/sci_files/sci_fileparts.sci new file mode 100755 index 000000000..d7742b01b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fileparts.sci @@ -0,0 +1,34 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fileparts(tree) + // M2SCI function + // Conversion function for Matlab fileparts() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + for klhs=1:lhs + tree.lhs(k).dims=list(Unknown,Unknown) + tree.lhs(k).type=Type(String,Real) + end + + // Add trailing / or \ to path + pathconvert_funcall=Funcall("pathconvert",1,Rhs_tlist("/"),list()) + if lhs==1 then + tree=Operation("+",list(tree,pathconvert_funcall),tree.lhs) + else + add=Operation("+",list(tree.lhs(1),pathconvert_funcall),list()) + insert(Equal(list(tree.lhs(1)),add),1) + end + + if lhs==4 then + insert(Equal(list(tree.lhs(4)),Cste("")),1) + tree.lhs(4)=null() + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_filesep.bin b/modules/m2sci/macros/sci_files/sci_filesep.bin new file mode 100755 index 000000000..ecc298ffd Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_filesep.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_filesep.sci b/modules/m2sci/macros/sci_files/sci_filesep.sci new file mode 100755 index 000000000..5169f810e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_filesep.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_filesep(tree) + // M2SCI function + // Conversion function for Matlab filesep() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(String,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_find.bin b/modules/m2sci/macros/sci_files/sci_find.bin new file mode 100755 index 000000000..7dee792aa Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_find.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_find.sci b/modules/m2sci/macros/sci_files/sci_find.sci new file mode 100755 index 000000000..b71ec1521 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_find.sci @@ -0,0 +1,84 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_find(tree) + // M2SCI function + // Conversion function for Matlab find() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_find() + + x = getrhs(tree) + + // Because %c_find is not defined + x = convert2double(x) + tree.rhs=Rhs_tlist(x) + + // k = find(x) + if lhs==1 then + if is_complex(x) then + x = Funcall("abs",1,list(x),list(Variable("",x.infer))) + elseif ~is_real(x) then + newx = Funcall("abs",1,list(x),list(Variable("",x.infer))) + repl_poss(newx,x,x,gettext("is Real.")); + x=newx + end + tree.rhs=Rhs_tlist(x) + + tree1=Operation("''",list(tree),tree.lhs) + tree2=Funcall("matrix",1,Rhs_tlist(tree,-1,1),tree.lhs) + + tree.lhs(1).type=Type(Double,Real) + + if x.dims(1)==1 then // Row vector + tree.lhs(1).dims=list(1,Unknown) + elseif x.dims(2)==1 then // Column vector + tree=tree1 + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=Type(Double,Real) + elseif not_a_vector(x) then + tree=tree2 + tree.lhs(1).dims=list(Unknown,Unknown) + else + tree.name="mtlb_find" + tree.lhs(1).dims=list(Unknown,Unknown) + end + // [i,j] = find(x) + elseif lhs==2 then + if is_complex(x) then + x = Funcall("abs",1,list(x),list(Variable("",x.infer))) + elseif ~is_real(x) then + newx = Funcall("abs",1,list(x),list(Variable("",x.infer))) + repl_poss(newx,x,x,gettext("is Real.")); + x=newx + end + tree.rhs=Rhs_tlist(x) + + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).type=Type(Double,Real) + if x.dims(1)==1 then // Row Vector + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(2).dims=list(1,Unknown) + else + tree.name="mtlb_find" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(2).dims=list(Unknown,Unknown) + end + // [i,j,v] = find(x) + else + tree.name="mtlb_find" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(3).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).type=Type(Double,Real) + tree.lhs(3).type=Type(Unknown,Unknown) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_findstr.bin b/modules/m2sci/macros/sci_files/sci_findstr.bin new file mode 100755 index 000000000..ec9a6e2c5 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_findstr.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_findstr.sci b/modules/m2sci/macros/sci_files/sci_findstr.sci new file mode 100755 index 000000000..5d7024333 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_findstr.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_findstr(tree) + // M2SCI function + // Conversion function for Matlab findstr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_findstr() + + set_infos(gettext("No equivalent for findstr() in Scilab so mtlb_findstr() is called."),0); + + tree.name="mtlb_findstr" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fix.bin b/modules/m2sci/macros/sci_files/sci_fix.bin new file mode 100755 index 000000000..b10a15169 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fix.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fix.sci b/modules/m2sci/macros/sci_files/sci_fix.sci new file mode 100755 index 000000000..3528577d4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fix.sci @@ -0,0 +1,27 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fix(tree) + // File generated from sci_PROTO6.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab fix() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fliplr.bin b/modules/m2sci/macros/sci_files/sci_fliplr.bin new file mode 100755 index 000000000..402dc5318 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fliplr.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fliplr.sci b/modules/m2sci/macros/sci_files/sci_fliplr.sci new file mode 100755 index 000000000..224153202 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fliplr.sci @@ -0,0 +1,41 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fliplr(tree) + // M2SCI function + // Conversion function for Matlab fliplr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fliplr() + + treedims=tree.rhs(1).dims + treetype=tree.rhs(1).type + + + if or(tree.rhs(1).vtype==[String,Unknown]) then + tree.name="mtlb_fliplr" + tree.lhs(1).dims=treedims + tree.lhs(1).type=treetype + else + if typeof(tree.rhs(1))<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),tree.rhs(1))) + else + tmp=tree.rhs(1) + end + + ind1=Cste(":") + ind2=Operation(":",list(Cste("$"),Cste(-1),Cste(1)),list()) + + tree=Operation("ext",list(tmp,ind1,ind2),tree.lhs) + + tree.out(1).dims=treedims + tree.out(1).type=treetype + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_flipud.bin b/modules/m2sci/macros/sci_files/sci_flipud.bin new file mode 100755 index 000000000..72d1a667a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_flipud.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_flipud.sci b/modules/m2sci/macros/sci_files/sci_flipud.sci new file mode 100755 index 000000000..ecb0e00b9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_flipud.sci @@ -0,0 +1,34 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_flipud(tree) + // M2SCI function + // Conversion function for Matlab flipud() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + treedims=tree.rhs(1).dims + treetype=tree.rhs(1).type + + + if typeof(tree.rhs(1))<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),tree.rhs(1))) + else + tmp=tree.rhs(1) + end + + ind1=Operation(":",list(Cste("$"),Cste(-1),Cste(1)),list()) + ind2=Cste(":") + + tree=Operation("ext",list(tmp,ind1,ind2),tree.lhs) + + tree.out(1).dims=treedims + tree.out(1).type=treetype +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_floor.bin b/modules/m2sci/macros/sci_files/sci_floor.bin new file mode 100755 index 000000000..efe931b7f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_floor.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_floor.sci b/modules/m2sci/macros/sci_files/sci_floor.sci new file mode 100755 index 000000000..6a5a9fc24 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_floor.sci @@ -0,0 +1,27 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_floor(tree) + // File generated from sci_PROTO6.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab floor() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fopen.bin b/modules/m2sci/macros/sci_files/sci_fopen.bin new file mode 100755 index 000000000..2b7d88649 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fopen.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fopen.sci b/modules/m2sci/macros/sci_files/sci_fopen.sci new file mode 100755 index 000000000..acdfc6a41 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fopen.sci @@ -0,0 +1,61 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fopen(tree) + // M2SCI function + // Conversion function for Matlab fopen() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 then + filename=getrhs(tree) + permission="rb" + elseif rhs==2 then + [filename,permission]=getrhs(tree) + elseif rhs==3 then + [filename,permission,machineformat]=getrhs(tree) + no_equiv(expression2code(tree)) + return + end + + if typeof(filename)=="cste" then + if filename.value=="all" then + no_equiv(gettext("fopen(''all'') has no translation.")) + return + end + elseif filename.vtype==Double then + no_equiv(msprintf(gettext("%s (See fileinfo() function)."),expression2code(tree))) + return + end + + // Options 'W' and 'A' are unknown for Scilab + if typeof(permission)=="cste" then + if or(permission.value==["W","A"]) then + no_equiv(gettext("W and A permission parameters.")); + return + end + end + + tree.name="mtlb_fopen" + + // fid=fopen(filename) and so on + if lhs==1 then + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + // [fid,mess]=fopen(filename) and so on + elseif lhs==2 then + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).dims=list(1,Unknown) + tree.lhs(2).type=Type(String,Real) + // [fid,mess,machineformat]=fopen(filename) and so on + else + no_equiv(gettext("fopen used with three outputs.")) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_format.bin b/modules/m2sci/macros/sci_files/sci_format.bin new file mode 100755 index 000000000..2c2c8488f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_format.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_format.sci b/modules/m2sci/macros/sci_files/sci_format.sci new file mode 100755 index 000000000..6c46d2956 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_format.sci @@ -0,0 +1,78 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_format(tree) + // M2SCI function + // Conversion function for Matlab format + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_format() + + rhs1=rhs + if rhs==2 then + fp="e" + rhs=rhs-1 + else + fp="v" + end + + d=5; + hex=%f; + bank=%f; + compact=%f; + loose=%f, + ratf=%f; + symb=%f; + unk=%f + + if rhs==1 then + f=tree.rhs(1) + select f.value + case """short""" then + d=5 + case """long""" then + d=15 + case """hex""" then + hex=%t + case """+""" then + symb=%t + case """bank""" then + bank=%t + case """compact""" then + compact=%t + case """loose""" then + loose=%t + case """rat""" then + ratf=%t + else + unk=%t + end + else + d=5 + end + + + if unk then + if rhs1==1 then + tree.name="mtlb_format" + else + tree.name="mtlb_format" + end + elseif ratf|loose|compact|bank|hex then + no_equiv("format "+f.value) + else + if rhs1==1 then + tree.rhs=Rhs_tlist(d+1) + elseif rhs1==2 then + tree.rhs=Rhs_tlist(fp,d+1) + else + tree.rhs=Rhs_tlist("v",6) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fprintf.bin b/modules/m2sci/macros/sci_files/sci_fprintf.bin new file mode 100755 index 000000000..ddd7bf28c Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fprintf.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fprintf.sci b/modules/m2sci/macros/sci_files/sci_fprintf.sci new file mode 100755 index 000000000..b21023d89 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fprintf.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fprintf(tree) + // M2SCI function + // Conversion function for Matlab fprintf() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fprintf() + + set_infos(msprintf(gettext("No simple equivalent, so %s() is called."),"mtlb_fprintf"),0); + + tree.name="mtlb_fprintf" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fread.bin b/modules/m2sci/macros/sci_files/sci_fread.bin new file mode 100755 index 000000000..dd7e3d6ee Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fread.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fread.sci b/modules/m2sci/macros/sci_files/sci_fread.sci new file mode 100755 index 000000000..c19f11ab7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fread.sci @@ -0,0 +1,36 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fread(tree) + // M2SCI function + // Conversion function for Matlab fread() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fread() + + RHS=[] + + set_infos(msprintf(gettext("No simple equivalent, so %s() is called."),"mtlb_fread"),0); + + if rhs==4 then + no_equiv(msprintf(gettext("%s() called with skip parameter."),"fread")); + end + + tree.name="mtlb_fread" + + if lhs==1 then + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).dims=list(1,1) + tree.lhs(2).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_frewind.bin b/modules/m2sci/macros/sci_files/sci_frewind.bin new file mode 100755 index 000000000..44491b04f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_frewind.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_frewind.sci b/modules/m2sci/macros/sci_files/sci_frewind.sci new file mode 100755 index 000000000..474ed8a16 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_frewind.sci @@ -0,0 +1,19 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_frewind(tree) + // M2SCI function + // Conversion function for Matlab frewind() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="mseek" + tree.rhs=Rhs_tlist(0,tree.rhs(1)) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fscanf.bin b/modules/m2sci/macros/sci_files/sci_fscanf.bin new file mode 100755 index 000000000..2faf65f01 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fscanf.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fscanf.sci b/modules/m2sci/macros/sci_files/sci_fscanf.sci new file mode 100755 index 000000000..afa8bb0a7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fscanf.sci @@ -0,0 +1,32 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fscanf(tree) + // M2SCI function + // Conversion function for Matlab fscanf() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fscanf() + + RHS=[] + + set_infos(msprintf(gettext("No simple equivalent, so %s() is called."),"mtlb_fscanf"),0); + + tree.name="mtlb_fscanf" + + if lhs==1 then + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).dims=list(1,1) + tree.lhs(2).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fseek.bin b/modules/m2sci/macros/sci_files/sci_fseek.bin new file mode 100755 index 000000000..ee1b849ab Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fseek.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fseek.sci b/modules/m2sci/macros/sci_files/sci_fseek.sci new file mode 100755 index 000000000..477713184 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fseek.sci @@ -0,0 +1,55 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fseek(tree) + // M2SCI function + // Conversion function for Matlab fseek() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + [fid,offset,origin]=getrhs(tree) + + if typeof(origin)=="cste" then + select origin.value + case "bof" then + flag="set" + case "cof" then + flag="cur" + case "eof" then + flag="end" + case -1 then + flag="set" // Should not happen because -1 is an operation... + case 0 then + flag="cur" + case 1 then + flag="end" + else + set_infos(msprintf(gettext("Not enough information on %s to set the proper flag."),expression2code(origin)),1) + flag=Funcall("fseek_origin",1,list(origin),list()) + end + else + if typeof(origin)=="operation" then + if origin.operator=="-" then + if origin.operands==list(Cste(1)) then + flag="set" + end + end + else + set_infos(msprintf(gettext("Not enough information on %s to set the proper flag."),expression2code(origin)),1) + flag=Funcall("fseek_origin",1,list(origin),list()) + end + end + + tree.name="mseek" + tree.rhs=Rhs_tlist(offset,fid,flag) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ftell.bin b/modules/m2sci/macros/sci_files/sci_ftell.bin new file mode 100755 index 000000000..e0e9f7639 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_ftell.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_ftell.sci b/modules/m2sci/macros/sci_files/sci_ftell.sci new file mode 100755 index 000000000..33b5cfd6a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ftell.sci @@ -0,0 +1,21 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_ftell(tree) + // M2SCI function + // Conversion function for Matlab ftell() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="mtell" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_full.bin b/modules/m2sci/macros/sci_files/sci_full.bin new file mode 100755 index 000000000..f8de6a7ca Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_full.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_full.sci b/modules/m2sci/macros/sci_files/sci_full.sci new file mode 100755 index 000000000..51257ca54 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_full.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_full(tree) + // M2SCI function + // Conversion function for Matlab full() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_full() + + S = getrhs(tree) + + if S.vtype==String then + tree.name="mtlb_full" + tree.lhs(1).dims=S.dims + tree.lhs(1).type=S.type + elseif S.vtype==Boolean then + S = convert2double(S) + tree.rhs=Rhs_tlist(S) + tree.lhs(1).dims=S.dims + tree.lhs(1).type=Type(Boolean,Real) + elseif S.vtype==Double then + tree.lhs(1).dims=S.dims + tree.lhs(1).type=S.type + elseif S.vtype==Sparse then + tree.lhs(1).dims=S.dims + tree.lhs(1).type=Type(Double,S.property) + else + tree.name="mtlb_full" + tree.lhs(1).dims=S.dims + tree.lhs(1).type=S.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fullfile.bin b/modules/m2sci/macros/sci_files/sci_fullfile.bin new file mode 100755 index 000000000..787dd7aba Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fullfile.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fullfile.sci b/modules/m2sci/macros/sci_files/sci_fullfile.sci new file mode 100755 index 000000000..9293bd35b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fullfile.sci @@ -0,0 +1,19 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fullfile(tree) + // M2SCI function + // Conversion function for Matlab fullfile() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fwrite.bin b/modules/m2sci/macros/sci_files/sci_fwrite.bin new file mode 100755 index 000000000..d20e868f2 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_fwrite.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_fwrite.sci b/modules/m2sci/macros/sci_files/sci_fwrite.sci new file mode 100755 index 000000000..7e2632cde --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fwrite.sci @@ -0,0 +1,27 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_fwrite(tree) + // M2SCI function + // Conversion function for Matlab fwrite() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fwrite() + + set_infos(msprintf(gettext("No simple equivalent, so %s() is called."),"mtlb_fwrite"),0); + + if rhs==4 then + no_equiv(msprintf(gettext("%s() called with skip parameter."),"fwrite")); + end + + tree.name="mtlb_fwrite" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_gamma.bin b/modules/m2sci/macros/sci_files/sci_gamma.bin new file mode 100755 index 000000000..5d3c270b1 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_gamma.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_gamma.sci b/modules/m2sci/macros/sci_files/sci_gamma.sci new file mode 100755 index 000000000..ef7bdb036 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_gamma.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_gamma(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab gamma() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_gammaln.bin b/modules/m2sci/macros/sci_files/sci_gammaln.bin new file mode 100755 index 000000000..40406e58b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_gammaln.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_gammaln.sci b/modules/m2sci/macros/sci_files/sci_gammaln.sci new file mode 100755 index 000000000..cbe27a5b3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_gammaln.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_gammaln(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab gammaln() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_getenv.bin b/modules/m2sci/macros/sci_files/sci_getenv.bin new file mode 100755 index 000000000..554777afb Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_getenv.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_getenv.sci b/modules/m2sci/macros/sci_files/sci_getenv.sci new file mode 100755 index 000000000..770c979d1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_getenv.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_getenv(tree) + // M2SCI function + // Conversion function for Matlab getenv() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_global.bin b/modules/m2sci/macros/sci_files/sci_global.bin new file mode 100755 index 000000000..3a408fb2b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_global.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_global.sci b/modules/m2sci/macros/sci_files/sci_global.sci new file mode 100755 index 000000000..07e737394 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_global.sci @@ -0,0 +1,36 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_global(tree) + // M2SCI function + // Conversion function for Matlab global() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // Global variable for M2SCI + global("varslist"); + + for k=1:rhs + nam=tree.rhs(k).value + if nam<>"" then + exist=%F + for l=1:size(varslist) + if varslist(l).matname==nam then + exist=%T + break + end + end + if exist==%F then + varslist($+1)=M2scivar(nam,nam,Infer(list(Unknown,Unknown),Type(Unknown,Unknown))) + write(%io(2),msprintf(gettext("Global variable %s added to M2SCI variable list."),nam)) + end + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_graymon.bin b/modules/m2sci/macros/sci_files/sci_graymon.bin new file mode 100755 index 000000000..9e71372b9 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_graymon.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_graymon.sci b/modules/m2sci/macros/sci_files/sci_graymon.sci new file mode 100755 index 000000000..9fc51f47c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_graymon.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_graymon(tree) + // M2SCI function + // Conversion function for Matlab graymon() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // set(gdf(),"color_map",[.75 .5 .25]'*ones(1,3)) + + tree.name="set" + + rc=Operation("rc",list(Cste(0.75),Cste(0.5)),list()); + rc=Operation("rc",list(rc,Cste(0.25)),list()); + transp=Operation("''",list(rc),list()) + ones_funcall=Funcall("ones",1,Rhs_tlist(1,3),list()) + mult=Operation("*",list(transp,ones_funcall),list()) + + gdf_funcall=Funcall("gdf",1,list(),list()) + + tree.rhs=Rhs_tlist(gdf_funcall,"color_map",mult); +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_grid.bin b/modules/m2sci/macros/sci_files/sci_grid.bin new file mode 100755 index 000000000..63f772fcc Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_grid.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_grid.sci b/modules/m2sci/macros/sci_files/sci_grid.sci new file mode 100755 index 000000000..3bae2bf9f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_grid.sci @@ -0,0 +1,58 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_grid(tree) + // M2SCI function + // Conversion function for Matlab grid() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_grid() + + // [1 1] + on=Operation("rc",list(Cste(1),Cste(1)),list()) + // [-1 -1] + off=Operation("rc",list(Cste(-1),Cste(-1)),list()) + if rhs==0 then // grid toggle + tree.name="mtlb_grid"; + elseif rhs==1 then + ax=Funcall("gca",1,list(),list()) + opt=tree.rhs(1) + if typeof(opt)=="cste" then + if opt.value=="on" then + tree.name="set"; + tree.rhs=Rhs_tlist(ax,"grid",on); + elseif opt.value=="off" then + tree.name="set"; + tree.rhs=Rhs_tlist(ax,"grid",off); + else + set_infos(gettext("No minor grid in Scilab."),2); + tree.name="mtlb_grid"; + end + else + tree.name="mtlb_grid"; + end + else + ax=tree.rhs(1) + opt=tree.rhs(2) + if typeof(opt)=="cste" then + if opt.value=="on" then + insert(Equal(list(Operation("ins",list(ax,Cste("grid")),list())),on)) + tree=list() + elseif opt.value=="off" then + insert(Equal(list(Operation("ins",list(ax,Cste("grid")),list())),off)) + tree=list() + else + set_infos(gettext("No minor grid in Scilab."),2); + tree.name="mtlb_grid"; + end + else + tree.name="mtlb_grid"; + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_hankel.bin b/modules/m2sci/macros/sci_files/sci_hankel.bin new file mode 100755 index 000000000..3e578c689 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_hankel.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_hankel.sci b/modules/m2sci/macros/sci_files/sci_hankel.sci new file mode 100755 index 000000000..11b6c204d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_hankel.sci @@ -0,0 +1,106 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_hankel(tree) + // M2SCI function + // Conversion function for Matlab hankel() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="hank" + + // H = hankel(c) + if rhs==1 then + if typeof(tree.rhs(1))<>"variable" then + c=gettempvar(); + insert(Equal(list(c),tree.rhs(1))) + else + c=tree.rhs(1); + end + + n=gettempvar() + insert(Equal(list(n),Funcall("size",1,Rhs_tlist(c,"*"),list()))); + + if is_a_scalar(tree.rhs(1)) then + v=c + else + // v=[matrix(c,1,-1),zeros(1,n)] + matrix_funcall=Funcall("matrix",1,Rhs_tlist(c,1,-1),list()) + zeros_funcall=Funcall("zeros",1,Rhs_tlist(1,n),list()) + v=Operation("rc",list(matrix_funcall,zeros_funcall),list()) + end + + dim=1 + for kd=1:lstsize(tree.rhs(1).dims) + if tree.rhs(1).dims(kd)<>Unknown then + dim=dim*tree.rhs(1).dims(kd) + else + dim=Unknown + break + end + end + + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=tree.rhs(1).type + + tree.rhs=Rhs_tlist(n,n,v); + // H = hankel(c,r) + else + if typeof(tree.rhs(1))<>"variable" then + c=gettempvar(); + insert(Equal(list(c),tree.rhs(1))) + else + c=tree.rhs(1); + end + + if typeof(tree.rhs(2))<>"variable" then + r=gettempvar(); + insert(Equal(list(r),tree.rhs(2))) + else + r=tree.rhs(2); + end + + m=gettempvar(); + n=gettempvar(); + insert(Equal(list(m),Funcall("size",1,Rhs_tlist(c,"*"),list()))); + insert(Equal(list(n),Funcall("size",1,Rhs_tlist(r,"*"),list()))); + + + // v=[matrix(c,1,-1),matrix(r(2:$),1,-1)] + cmatrix_funcall=Funcall("matrix",1,Rhs_tlist(c,1,-1),list()) + imp=Operation(":",list(Cste(2),Cste("$")),list()) + ext=Operation("ext",list(r,imp),list()) + rmatrix_funcall=Funcall("matrix",1,Rhs_tlist(ext,1,-1),list()) + v=Operation("rc",list(cmatrix_funcall,rmatrix_funcall),list()) + + dim1=1 + for kd=1:lstsize(tree.rhs(1).dims) + if tree.rhs(1).dims(kd)<>Unknown then + dim1=dim1*tree.rhs(1).dims(kd) + else + dim1=Unknown + break + end + end + dim2=1 + for kd=1:lstsize(tree.rhs(2).dims) + if tree.rhs(2).dims(kd)<>Unknown then + dim2=dim2*tree.rhs(2).dims(kd) + else + dim2=Unknown + break + end + end + + tree.lhs(1).dims=list(dim1,dim2) + tree.lhs(1).type=tree.rhs(1).type + + tree.rhs=Rhs_tlist(m,n,v); + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_help.bin b/modules/m2sci/macros/sci_files/sci_help.bin new file mode 100755 index 000000000..17eca8016 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_help.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_help.sci b/modules/m2sci/macros/sci_files/sci_help.sci new file mode 100755 index 000000000..07cfb1188 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_help.sci @@ -0,0 +1,36 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_help(tree) +// M2SCI function +// Conversion function for Matlab help() +// Input: tree = Matlab funcall tree +// Ouput: tree = Scilab equivalent for tree + + if rhs==0 then + tree.rhs=list() + else + topic=getrhs(tree) + + if typeof(topic) == "funcall" then + tree.rhs=Rhs_tlist(topic.name) + else + k=strindex(topic.value,"/") + + if k<>[] & min(k)<>2 then // help toolbox/ + no_equiv(expression2code(tree)); + elseif topic.value=="syntax" then + tree.rhs=Rhs_tlist("names") + else +// Nothing to do + end + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_helpbrowser.bin b/modules/m2sci/macros/sci_files/sci_helpbrowser.bin new file mode 100755 index 000000000..c82691733 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_helpbrowser.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_helpbrowser.sci b/modules/m2sci/macros/sci_files/sci_helpbrowser.sci new file mode 100755 index 000000000..34fe96570 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_helpbrowser.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_helpbrowser(tree) + // M2SCI function + // Conversion function for Matlab helpbrowser() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="help" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_helpdesk.bin b/modules/m2sci/macros/sci_files/sci_helpdesk.bin new file mode 100755 index 000000000..d751ccce2 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_helpdesk.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_helpdesk.sci b/modules/m2sci/macros/sci_files/sci_helpdesk.sci new file mode 100755 index 000000000..4ab6356bc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_helpdesk.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_helpdesk(tree) + // M2SCI function + // Conversion function for Matlab helpdesk() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="help" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_helpwin.bin b/modules/m2sci/macros/sci_files/sci_helpwin.bin new file mode 100755 index 000000000..36414fa67 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_helpwin.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_helpwin.sci b/modules/m2sci/macros/sci_files/sci_helpwin.sci new file mode 100755 index 000000000..9b9b5cba8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_helpwin.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_helpwin(tree) + // M2SCI function + // Conversion function for Matlab helpwin() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="help" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_hess.bin b/modules/m2sci/macros/sci_files/sci_hess.bin new file mode 100755 index 000000000..3e105e505 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_hess.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_hess.sci b/modules/m2sci/macros/sci_files/sci_hess.sci new file mode 100755 index 000000000..5abcc66a6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_hess.sci @@ -0,0 +1,32 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_hess(tree) + // M2SCI function + // Conversion function for Matlab hess() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + // H = hess(A) + if lhs==1 then + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + // [P,H] = hess(A) + else + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(A.vtype,Unknown) // Real if A<>%i + tree.lhs(2).dims=A.dims + tree.lhs(2).type=A.type + + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_hold.bin b/modules/m2sci/macros/sci_files/sci_hold.bin new file mode 100755 index 000000000..479b4e9d0 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_hold.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_hold.sci b/modules/m2sci/macros/sci_files/sci_hold.sci new file mode 100755 index 000000000..1f6620aef --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_hold.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_hold(tree) + // M2SCI function + // Conversion function for Matlab hold() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_hold() + + if rhs==0 then // hold toggle + tree.name="mtlb_hold" + else + opt=tree.rhs(1) + if typeof(opt)=="cste" then + if opt.value=="on" then + // set(gca(),'auto_clear','off') + gca_funcall=Funcall("gca",1,list(),list()) + tree.name="set" + tree.rhs=Rhs_tlist(gca_funcall,Cste("auto_clear"),Cste("off")) + elseif opt.value=="off" then + // set(gca(),'auto_clear','on') + gca_funcall=Funcall("gca",1,list(),list()) + tree.name="set" + tree.rhs=Rhs_tlist(gca_funcall,Cste("auto_clear"),Cste("on")) + else + no_equiv(msprintf(gettext("%s option."),opt.value)) + end + else + tree.name="mtlb_hold" + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_home.bin b/modules/m2sci/macros/sci_files/sci_home.bin new file mode 100755 index 000000000..43e0775ba Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_home.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_home.sci b/modules/m2sci/macros/sci_files/sci_home.sci new file mode 100755 index 000000000..0de6a331b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_home.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_home(tree) + // M2SCI function + // Conversion function for Matlab home + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="tohome" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_horzcat.bin b/modules/m2sci/macros/sci_files/sci_horzcat.bin new file mode 100755 index 000000000..ba84ed905 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_horzcat.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_horzcat.sci b/modules/m2sci/macros/sci_files/sci_horzcat.sci new file mode 100755 index 000000000..7d526de39 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_horzcat.sci @@ -0,0 +1,72 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_horzcat(tree) + // M2SCI function + // Conversion function for Matlab horzcat() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + allargs=tree.rhs + out=tree.lhs + + op="rc" + for k=1:lstsize(allargs) + if allargs(k).vtype==String then + op="+" + break + end + end + + tree=Operation(op,list(allargs(1),allargs(2)),list()) + + // Create output + for k=3:rhs + tree=Operation(op,list(tree,allargs(k)),list()) + end + tree.out=out + + // Dimensions + outdims=allargs(1).dims + for k=1:lstsize(outdims) + outdims(k)=Unknown + end + for k=1:rhs + for l=1:lstsize(allargs(k).dims) + if l<>2 & allargs(k).dims(l)<>Unknown then + outdims(l)=allargs(k).dims(l) + end + end + end + nbcols=0 + for k=1:rhs + if allargs(k).dims(2)<>Unknown then + nbcols=nbcols+allargs(k).dims(2) + else + nbcols=Unknown + break + end + end + outdims(2)=nbcols + + // Property + prop=Real + for k=1:rhs + if allargs(k).property==Complex then + prop=Complex + break + elseif allargs(k).property==Unknown then + prop=Unknown + break + end + end + + tree.out(1).dims=outdims + tree.out(1).type=Type(allargs(1).vtype,prop) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ifft.bin b/modules/m2sci/macros/sci_files/sci_ifft.bin new file mode 100755 index 000000000..967396d86 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_ifft.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_ifft.sci b/modules/m2sci/macros/sci_files/sci_ifft.sci new file mode 100755 index 000000000..6ff5d1713 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ifft.sci @@ -0,0 +1,77 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_ifft(tree) + // M2SCI function + // Conversion function for Matlab ifft() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_ifft() + + tree.name="fft" + + // Y = ifft(X) + if rhs==1 then + X = getrhs(tree) + // %c_ifft and %b_ifft are not defined + X = convert2double(X) + tree.rhs=Rhs_tlist(X,1) + + if size(X.dims)==2 then + if is_a_scalar(X) | is_a_vector(X) then + tree.rhs=Rhs_tlist(X,1) + elseif not_a_vector(X) then + if X.dims(2)<>Unknown then + tree.rhs=Rhs_tlist(X,1,X.dims(1),1) + else + tmp=Funcall("size",1,list(X,1),list()) + tree.rhs=Rhs_tlist(X,1,tmp,1) + end + else + tree.name="mtlb_ifft" + tree.rhs=Rhs_tlist(X) + end + else + tree.rhs=Rhs_tlist(X,1,Funcall("firstnonsingleton",1,list(X,"num"),list()),1) + end + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) + + // Y = ifft(X,n) + elseif rhs==2 then + [X,n] = getrhs(tree) + X = convert2double(X) + n = convert2double(n) + tree.rhs=Rhs_tlist(X,n) + + tree.name="mtlb_ifft" + + if is_empty(X) + tree.lhs(1).dims=list(0,0) + else + tree.lhs(1).dims=allunknown(X.dims) + end + tree.lhs(1).type=Type(Double,Unknown) + + // Three input args + elseif rhs==3 then + [X,n,dim] = getrhs(tree) + X = convert2double(X) + n = convert2double(n) + dim = convert2double(dim) + tree.rhs=Rhs_tlist(X,n,dim) + + tree.name="mtlb_ifft" + + tree.lhs(1).dims=allunknown(X.dims) + tree.lhs(1).type=Type(Double,Unknown) + + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_imag.bin b/modules/m2sci/macros/sci_files/sci_imag.bin new file mode 100755 index 000000000..a4283c073 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_imag.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_imag.sci b/modules/m2sci/macros/sci_files/sci_imag.sci new file mode 100755 index 000000000..62b895a2d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_imag.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_imag(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab imag() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_input.bin b/modules/m2sci/macros/sci_files/sci_input.bin new file mode 100755 index 000000000..fee8ca217 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_input.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_input.sci b/modules/m2sci/macros/sci_files/sci_input.sci new file mode 100755 index 000000000..fdd74fd7a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_input.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_input(tree) + // M2SCI function + // Conversion function for Matlab input() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // input(msg) + if rhs==1 then + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Unknown,Unknown) + else + // input(msg,'s') + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_int16.bin b/modules/m2sci/macros/sci_files/sci_int16.bin new file mode 100755 index 000000000..f04ad7e26 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_int16.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_int16.sci b/modules/m2sci/macros/sci_files/sci_int16.sci new file mode 100755 index 000000000..0008bb3a3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_int16.sci @@ -0,0 +1,55 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_int16(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab int16() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_int16() + + // %c_int16 and %b_int16 are not defined in Scilab + x = getrhs(tree) + + // Matlab int16() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int16","int16"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int16","int16"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_int16" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_int32.bin b/modules/m2sci/macros/sci_files/sci_int32.bin new file mode 100755 index 000000000..be4a91226 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_int32.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_int32.sci b/modules/m2sci/macros/sci_files/sci_int32.sci new file mode 100755 index 000000000..97f860fa1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_int32.sci @@ -0,0 +1,55 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_int32(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab int32() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_int32() + + // %c_int32 and %b_int32 are not defined in Scilab + x = getrhs(tree) + + // Matlab int32() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int32","int32"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int32","int32"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_int32" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_int8.bin b/modules/m2sci/macros/sci_files/sci_int8.bin new file mode 100755 index 000000000..f86d59cde Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_int8.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_int8.sci b/modules/m2sci/macros/sci_files/sci_int8.sci new file mode 100755 index 000000000..9cb641e50 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_int8.sci @@ -0,0 +1,55 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_int8(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab int8() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_int8() + + // %c_int8 and %b_int8 are not defined in Scilab + x = getrhs(tree) + + // Matlab int8() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int8","int8"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int8","int8"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_int8" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_interp1.bin b/modules/m2sci/macros/sci_files/sci_interp1.bin new file mode 100755 index 000000000..e7717db52 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_interp1.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_interp1.sci b/modules/m2sci/macros/sci_files/sci_interp1.sci new file mode 100755 index 000000000..1a9b7c269 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_interp1.sci @@ -0,0 +1,67 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_interp1(tree) + // M2SCI function + // Conversion function for Matlab interp1() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==2 then // y=interp1(y,xi) + y=tree.rhs(1) + xi=tree.rhs(2) + elseif rhs>=3 then + A=tree.rhs(3) + if A.vtype==-1 then + tree.lhs(1).dims==list(-1,-1) + elseif A.vtype==1 then // y=interp1(x,y,xi,..) + y=tree.rhs(2) + xi=tree.rhs(3) + elseif A.vtype==10 then // y=interp1(x,y,'method',..) + y=tree.rhs(1) + xi=tree.rhs(2) + end + end + + if (rhs>=3 & (A.vtype==1 | A.vtype==10)) | rhs==2 then + ydimknown=%t // ydimknown : a boolean, true if all dimensions of y are known + xidimknown=%t // xidimknown : a boolean, true if all dimensions of xi are known + for i=1:size(xi.dims) + if xi.dims(i)==-1 then + xidimknown=%f + break + end + end + for i=1:size(y.dims) + if y.dims(i)==-1 then + ydimknown=%f + break + end + end + if is_a_vector(y) then // y a vector + if xidimknown then // xi a scalar or a vector or a matrix or a hypermatrix + tree.lhs(1).dims=xi.dims + else // dimension(s) of xi is unknown + tree.lhs(1).dims=list(-1,-1) + end + elseif ydimknown then // y is a matrix or a hypermatrix + if xidimknown then // xi a scalar or a vector or a matrix or a hypermatrix + tree.lhs(1).dims==xi.dims + for i=1:size(xi.dims)-1 + tree.lhs(1).dims(i+size(xi.dims))=y.dims(i+1) + end + else // dimension(s) of xi is unknown + tree.lhs(1).dims==list(-1,-1) + end + else // dimension(s) of y is unknown + tree.lhs(1).dims=list(-1,-1) + end + end + tree.lhs(1).type=Type(Double,Real) +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_inv.bin b/modules/m2sci/macros/sci_files/sci_inv.bin new file mode 100755 index 000000000..968b6c32c Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_inv.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_inv.sci b/modules/m2sci/macros/sci_files/sci_inv.sci new file mode 100755 index 000000000..cd06be900 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_inv.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_inv(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab inv() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="inv" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isa.bin b/modules/m2sci/macros/sci_files/sci_isa.bin new file mode 100755 index 000000000..1259c6749 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isa.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isa.sci b/modules/m2sci/macros/sci_files/sci_isa.sci new file mode 100755 index 000000000..f079ba0c3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isa.sci @@ -0,0 +1,75 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isa(tree) + // M2SCI function + // Conversion function for Matlab isa() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + [OBJ,class] = getrhs(tree) + + if typeof(class)=="cste" then + + typetree=Funcall("type",1,Rhs_tlist(OBJ),list()) + typeoftree=Funcall("typeof",1,Rhs_tlist(OBJ),list()) + + select class.value + case "logical" + tree=Operation("==",list(typetree,Cste(4)),tree.lhs) + case "char" + tree=Operation("==",list(typetree,Cste(10)),tree.lhs) + case "numeric" + catop=Operation("rc",list(Cste(1),Cste(5)),list()) + catop=Operation("rc",list(catop,Cste(8)),list()) + eqtree=Operation("==",list(typetree,catop),list()) + tree=Funcall("or",1,list(eqtree),list(tree.lhs(1))) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + return + case "int8" + tree=Operation("==",list(typeoftree,Cste("int8")),tree.lhs) + case "uint8" + tree=Operation("==",list(typeoftree,Cste("uint8")),tree.lhs) + case "int16" + tree=Operation("==",list(typeoftree,Cste("int16")),tree.lhs) + case "uint16" + tree=Operation("==",list(typeoftree,Cste("uint16")),tree.lhs) + case "int32" + tree=Operation("==",list(typeoftree,Cste("int32")),tree.lhs) + case "uint32" + tree=Operation("==",list(typeoftree,Cste("uint32")),tree.lhs) + case "single" + tree=Operation("==",list(typetree,Cste(1)),tree.lhs) + case "double" + tree=Operation("==",list(typetree,Cste(1)),tree.lhs) + case "cell" + tree=Operation("==",list(typeoftree,Cste("ce")),tree.lhs) + case "struct" + tree=Operation("==",list(typeoftree,Cste("st")),tree.lhs) + case "function_handle" + tree=Operation("==",list(typetree,Cste(13)),tree.lhs) + case "sparse" + tree=Operation("==",list(typetree,Cste(5)),tree.lhs) + case "lti" + tree=Operation("==",list(typeoftree,Cste("state-space")),tree.lhs) + else + set_infos(msprintf(gettext("Unhandled class: %s."),class.value),2) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + return + end + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + else + tree.name="mtlb_isa" + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_iscell.bin b/modules/m2sci/macros/sci_files/sci_iscell.bin new file mode 100755 index 000000000..a7d62a00a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_iscell.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_iscell.sci b/modules/m2sci/macros/sci_files/sci_iscell.sci new file mode 100755 index 000000000..7c5f95903 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_iscell.sci @@ -0,0 +1,22 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_iscell(tree) + // M2SCI function + // Conversion function for Matlab iscell() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("typeof",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste("ce")),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ischar.bin b/modules/m2sci/macros/sci_files/sci_ischar.bin new file mode 100755 index 000000000..3253d3455 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_ischar.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_ischar.sci b/modules/m2sci/macros/sci_files/sci_ischar.sci new file mode 100755 index 000000000..063accae1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ischar.sci @@ -0,0 +1,22 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_ischar(tree) + // M2SCI function + // Conversion function for Matlab ischar() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste(10)),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isdir.bin b/modules/m2sci/macros/sci_files/sci_isdir.bin new file mode 100755 index 000000000..92aecaf0f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isdir.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isdir.sci b/modules/m2sci/macros/sci_files/sci_isdir.sci new file mode 100755 index 000000000..7173ade9e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isdir.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isdir(tree) + // M2SCI function + // Conversion function for Matlab isdir() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isempty.bin b/modules/m2sci/macros/sci_files/sci_isempty.bin new file mode 100755 index 000000000..8a00d6596 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isempty.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isempty.sci b/modules/m2sci/macros/sci_files/sci_isempty.sci new file mode 100755 index 000000000..1ec1ce98b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isempty.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isempty(tree) + // M2SCI function + // Conversion function for Matlab isempty() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isequal.bin b/modules/m2sci/macros/sci_files/sci_isequal.bin new file mode 100755 index 000000000..dccf91966 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isequal.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isequal.sci b/modules/m2sci/macros/sci_files/sci_isequal.sci new file mode 100755 index 000000000..63b46e771 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isequal.sci @@ -0,0 +1,22 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isequal(tree) + // M2SCI function + // Conversion function for Matlab isequal() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if tree.rhs(1).vtype==Struct then + set_infos(gettext("isequal requires fields are in the same order for structs to be equal."),2); + end + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isfield.bin b/modules/m2sci/macros/sci_files/sci_isfield.bin new file mode 100755 index 000000000..8b40843c7 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isfield.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isfield.sci b/modules/m2sci/macros/sci_files/sci_isfield.sci new file mode 100755 index 000000000..30bb0177c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isfield.sci @@ -0,0 +1,37 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isfield(tree) + // M2SCI function + // Conversion function for Matlab isfield() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + st=tree.rhs(1) + f=tree.rhs(2) + if and(st.vtype<>[Struct,Unknown]) then + tree=Cste(%F) + elseif st.vtype==Unknown then + tree.name="mtlb_tree" + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + else + // allf=getfield(1,st);tf=or(allf(3:$)==f); + allf=gettempvar() + insert(Equal(list(allf),Funcall("getfield",1,Rhs_tlist(1,st),list()))) + + imp=Operation(":",list(Cste(3),Cste("$")),list()) + ext=Operation("ext",list(allf,imp),list()) + eq=Operation("==",list(ext,f),list()) + + tree=Funcall("or",1,Rhs_tlist(eq),tree.lhs) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isfinite.bin b/modules/m2sci/macros/sci_files/sci_isfinite.bin new file mode 100755 index 000000000..db45e68f1 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isfinite.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isfinite.sci b/modules/m2sci/macros/sci_files/sci_isfinite.sci new file mode 100755 index 000000000..feeee9ce5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isfinite.sci @@ -0,0 +1,26 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isfinite(tree) + // M2SCI function + // Conversion function for Matlab isfinite() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_isfinite and %b_isfinite are not defined in Scilab + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree=Funcall("abs",1,list(A),tree.lhs) + tree=Operation("<",list(tree,Cste(%inf)),tree.lhs) + + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isglobal.bin b/modules/m2sci/macros/sci_files/sci_isglobal.bin new file mode 100755 index 000000000..7f477df6b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isglobal.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isglobal.sci b/modules/m2sci/macros/sci_files/sci_isglobal.sci new file mode 100755 index 000000000..2157be8a5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isglobal.sci @@ -0,0 +1,19 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isglobal(tree) + // M2SCI function + // Conversion function for Matlab isglobal() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ishandle.bin b/modules/m2sci/macros/sci_files/sci_ishandle.bin new file mode 100755 index 000000000..45d3a48c3 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_ishandle.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_ishandle.sci b/modules/m2sci/macros/sci_files/sci_ishandle.sci new file mode 100755 index 000000000..06ccee948 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ishandle.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_ishandle(tree) + // M2SCI function + // Conversion function for Matlab ishandle() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste(9)),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ishold.bin b/modules/m2sci/macros/sci_files/sci_ishold.bin new file mode 100755 index 000000000..242eaf8f9 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_ishold.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_ishold.sci b/modules/m2sci/macros/sci_files/sci_ishold.sci new file mode 100755 index 000000000..e4a04b658 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ishold.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_ishold(tree) + // M2SCI function + // Conversion function for Matlab ishold() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + gca_funcall=Funcall("gca",1,list(),list()) + get_funcall=Funcall("get",1,Rhs_tlist(gca_funcall,"auto_clear"),list()) + tree=Operation("==",list(get_funcall,Cste("off")),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isinf.bin b/modules/m2sci/macros/sci_files/sci_isinf.bin new file mode 100755 index 000000000..ffd561ef2 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isinf.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isinf.sci b/modules/m2sci/macros/sci_files/sci_isinf.sci new file mode 100755 index 000000000..7046c21d8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isinf.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isinf(tree) + // M2SCI function + // Conversion function for Matlab isinf() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_isinf and %b_isinf are not defined in Scilab + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isinteger.bin b/modules/m2sci/macros/sci_files/sci_isinteger.bin new file mode 100755 index 000000000..ef35869b8 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isinteger.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isinteger.sci b/modules/m2sci/macros/sci_files/sci_isinteger.sci new file mode 100755 index 000000000..0a795d68d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isinteger.sci @@ -0,0 +1,22 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isinteger(tree) + // M2SCI function + // Conversion function for Matlab isinteger() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste(8)),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isletter.bin b/modules/m2sci/macros/sci_files/sci_isletter.bin new file mode 100755 index 000000000..305549251 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isletter.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isletter.sci b/modules/m2sci/macros/sci_files/sci_isletter.sci new file mode 100755 index 000000000..495cd5d5c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isletter.sci @@ -0,0 +1,22 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isletter(tree) + // M2SCI function + // Conversion function for Matlab isletter() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_isletter() + + tree.name="mtlb_isletter" + + tree.lhs(1).dims=tree.rhs(1).dims + tree.lhs(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_islogical.bin b/modules/m2sci/macros/sci_files/sci_islogical.bin new file mode 100755 index 000000000..99fa9ac12 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_islogical.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_islogical.sci b/modules/m2sci/macros/sci_files/sci_islogical.sci new file mode 100755 index 000000000..51577505a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_islogical.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_islogical(tree) + // M2SCI function + // Conversion function for Matlab islogical() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + mat=Operation("rc",list(Cste(4),Cste(6)),list()) + tree=Operation("==",list(A,mat),tree.lhs) + tree=Funcall("or",1,list(tree),tree.out) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isnan.bin b/modules/m2sci/macros/sci_files/sci_isnan.bin new file mode 100755 index 000000000..488cd00aa Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isnan.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isnan.sci b/modules/m2sci/macros/sci_files/sci_isnan.sci new file mode 100755 index 000000000..3fc592256 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isnan.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isnan(tree) + // M2SCI function + // Conversion function for Matlab isnan() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_isnan and %b_isnan are not defined in Scilab + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isnumeric.bin b/modules/m2sci/macros/sci_files/sci_isnumeric.bin new file mode 100755 index 000000000..b6ac51fe6 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isnumeric.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isnumeric.sci b/modules/m2sci/macros/sci_files/sci_isnumeric.sci new file mode 100755 index 000000000..827e0bbc8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isnumeric.sci @@ -0,0 +1,26 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isnumeric(tree) + // M2SCI function + // Conversion function for Matlab isnumeric() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // tf = or(type(A)==[1 5 8]) + rc15=Operation("rc",list(Cste(1),Cste(5)),list()) + rc158=Operation("rc",list(rc15,Cste(8)),list()) + type_funcall=Funcall("type",1,list(tree.rhs(1)),list()) + eq=Operation("==",list(type_funcall,rc158),list()) + tree=Funcall("or",1,Rhs_tlist(eq),tree.lhs) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ispc.bin b/modules/m2sci/macros/sci_files/sci_ispc.bin new file mode 100755 index 000000000..a61cf6e4e Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_ispc.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_ispc.sci b/modules/m2sci/macros/sci_files/sci_ispc.sci new file mode 100755 index 000000000..b0b101a9e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ispc.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_ispc(tree) + // M2SCI function + // Conversion function for Matlab ispc() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree=Variable("MSDOS",Infer(list(1,1),Type(Boolean,Real))) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isreal.bin b/modules/m2sci/macros/sci_files/sci_isreal.bin new file mode 100755 index 000000000..6e82eb7f7 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isreal.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isreal.sci b/modules/m2sci/macros/sci_files/sci_isreal.sci new file mode 100755 index 000000000..2e1084035 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isreal.sci @@ -0,0 +1,26 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isreal(tree) + // M2SCI function + // Conversion function for Matlab isreal() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_isreal and %b_isreal are not defined in Scilab + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + // eps set to 0 + tree.rhs=Rhs_tlist(A,0) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isscalar.bin b/modules/m2sci/macros/sci_files/sci_isscalar.bin new file mode 100755 index 000000000..d5134773f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isscalar.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isscalar.sci b/modules/m2sci/macros/sci_files/sci_isscalar.sci new file mode 100755 index 000000000..c771faf0b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isscalar.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isscalar(tree) + // M2SCI function + // Conversion function for Matlab isscalar() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + lgth_funcall=Funcall("length",1,tree.rhs,list()) + sum_funcall=Funcall("sum",1,Rhs_tlist(lgth_funcall),list()) + tree=Operation("==",list(sum_funcall,Cste(1)),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isspace.bin b/modules/m2sci/macros/sci_files/sci_isspace.bin new file mode 100755 index 000000000..b47ddf8c0 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isspace.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isspace.sci b/modules/m2sci/macros/sci_files/sci_isspace.sci new file mode 100755 index 000000000..4d0f469ec --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isspace.sci @@ -0,0 +1,34 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isspace(tree) + // M2SCI function + // Conversion function for Matlab isspace() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_isspace() + + A = getrhs(tree) + + if A.vtype==String then + A = Funcall("asciimat",1,Rhs_tlist(A),list(Variable("",A.infer))) + tree = Operation("==",list(A,Cste(32)),tree.lhs) + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) + elseif or(A.vtype==[Double,Boolean]) then + tree.name="zeros" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Boolean,Real) + else + tree.name="mtlb_isspace" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Boolean,Real) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_issparse.bin b/modules/m2sci/macros/sci_files/sci_issparse.bin new file mode 100755 index 000000000..41113fa61 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_issparse.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_issparse.sci b/modules/m2sci/macros/sci_files/sci_issparse.sci new file mode 100755 index 000000000..4bb1afb25 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_issparse.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_issparse(tree) + // M2SCI function + // Conversion function for Matlab issparse() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + mat=Operation("rc",list(Cste(5),Cste(6)),list()) + tree=Operation("==",list(A,mat),tree.lhs) + tree=Funcall("or",1,list(tree),tree.out) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isstr.bin b/modules/m2sci/macros/sci_files/sci_isstr.bin new file mode 100755 index 000000000..36d82e013 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isstr.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isstr.sci b/modules/m2sci/macros/sci_files/sci_isstr.sci new file mode 100755 index 000000000..8b2202ca5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isstr.sci @@ -0,0 +1,22 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isstr(tree) + // M2SCI function + // Conversion function for Matlab isstr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste(10)),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isstruct.bin b/modules/m2sci/macros/sci_files/sci_isstruct.bin new file mode 100755 index 000000000..9a8818923 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isstruct.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isstruct.sci b/modules/m2sci/macros/sci_files/sci_isstruct.sci new file mode 100755 index 000000000..f92fc17c2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isstruct.sci @@ -0,0 +1,22 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isstruct(tree) + // M2SCI function + // Conversion function for Matlab isstruct() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("typeof",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste("st")),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isunix.bin b/modules/m2sci/macros/sci_files/sci_isunix.bin new file mode 100755 index 000000000..eb3b6daed Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isunix.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isunix.sci b/modules/m2sci/macros/sci_files/sci_isunix.sci new file mode 100755 index 000000000..41de62042 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isunix.sci @@ -0,0 +1,21 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isunix(tree) + // M2SCI function + // Conversion function for Matlab isunix() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree=Operation("~",list(Variable("MSDOS",Infer(list(1,1),Type(Boolean,Real)))),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isvector.bin b/modules/m2sci/macros/sci_files/sci_isvector.bin new file mode 100755 index 000000000..f2ea07b97 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_isvector.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_isvector.sci b/modules/m2sci/macros/sci_files/sci_isvector.sci new file mode 100755 index 000000000..096a72e14 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isvector.sci @@ -0,0 +1,31 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_isvector(tree) + // M2SCI function + // Conversion function for Matlab isvector() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if or(tree.rhs(1).vtype==[String,Unknown]) then + tree.rhs(1)=convert2double(tree.rhs(1)) + end + + rowsize=Funcall("size",1,Rhs_tlist(tree.rhs(1),1),list()) + colsize=Funcall("size",1,Rhs_tlist(tree.rhs(1),2),list()) + + rowsizeeq=Operation("==",list(rowsize,Cste(1)),list()) + colsizeeq=Operation("==",list(colsize,Cste(1)),list()) + + tree=Operation("|",list(rowsizeeq,colsizeeq),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_keyboard.bin b/modules/m2sci/macros/sci_files/sci_keyboard.bin new file mode 100755 index 000000000..dc9c5b2b0 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_keyboard.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_keyboard.sci b/modules/m2sci/macros/sci_files/sci_keyboard.sci new file mode 100755 index 000000000..75e6dea42 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_keyboard.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_keyboard(tree) + // M2SCI function + // Conversion function for Matlab keyboard() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="pause" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_kron.bin b/modules/m2sci/macros/sci_files/sci_kron.bin new file mode 100755 index 000000000..ba643592b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_kron.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_kron.sci b/modules/m2sci/macros/sci_files/sci_kron.sci new file mode 100755 index 000000000..3e61021c9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_kron.sci @@ -0,0 +1,33 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_kron(tree) + // M2SCI function + // Conversion function for Matlab kron() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // Scilab .*. operator does no work with Strings... + if tree.rhs(1).vtype<>Double then + tree.rhs(1)=convert2double(tree.rhs(1)) + end + if tree.rhs(2).vtype<>Double then + tree.rhs(2)=convert2double(tree.rhs(2)) + end + + tree=Operation(".*.",tree.rhs,tree.lhs) + + tree.out(1).type=Type(Double,Unknown) + + if is_a_scalar(tree.operands(1)) then + tree.out(1).dims=tree.operands(2).dims + elseif is_a_scalar(tree.operands(2)) then + tree.out(1).dims=tree.operands(1).dims + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_legendre.bin b/modules/m2sci/macros/sci_files/sci_legendre.bin new file mode 100755 index 000000000..9aefd6802 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_legendre.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_legendre.sci b/modules/m2sci/macros/sci_files/sci_legendre.sci new file mode 100755 index 000000000..c02f28cb0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_legendre.sci @@ -0,0 +1,43 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_legendre(tree) + // M2SCI function + // Conversion function for Matlab legendre() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_legendre() + + tree.name = "mtlb_legendre"; + boolknowndims = %t; + dims = list(); + for i=1:size(tree.rhs(2).dims) + if tree.rhs(2).dims(i) == -1 then + boolknowndims = %f; + break + end + dims($+1) = tree.rhs(2).dims(i); + end + + if boolknowndims then + if typeof(tree.rhs(1)) == "cste" + if tree.rhs(1).value > 0 then + dims = list(tree.rhs(1).value+1,dims) + end + else + dims = list(-1,-1) + end + else + dims = list(-1,-1) + end + + tree.lhs(1).dims = dims; + tree.lhs(1).type = Type(Double,Real); + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_length.bin b/modules/m2sci/macros/sci_files/sci_length.bin new file mode 100755 index 000000000..b17e19d5f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_length.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_length.sci b/modules/m2sci/macros/sci_files/sci_length.sci new file mode 100755 index 000000000..01b7474fa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_length.sci @@ -0,0 +1,32 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_length(tree) + // M2SCI function + // Conversion function for Matlab length() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X = getrhs(tree) + // Conversion to double is made to have the same results for strings + if or(X.vtype==[String,Unknown]) then + X = convert2double(X) + tree.rhs=list(X) + end + + if is_a_vector(X) then + tree=Funcall("size",1,Rhs_tlist(X,"*"),tree.lhs) + else + tree.name="size" + tree=Funcall("max",1,Rhs_tlist(tree),tree.lhs) + end + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_linspace.bin b/modules/m2sci/macros/sci_files/sci_linspace.bin new file mode 100755 index 000000000..baab27c93 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_linspace.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_linspace.sci b/modules/m2sci/macros/sci_files/sci_linspace.sci new file mode 100755 index 000000000..40521e84a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_linspace.sci @@ -0,0 +1,54 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_linspace(tree) + // M2SCI function + // Conversion function for Matlab linspace() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_linspace() + + A=tree.rhs(1) + B=tree.rhs(2) + + // %c_linspace and %b_linspace are not defined + if is_complex(A) | is_complex(B) then + tree.lhs(1).property=Complex + elseif or(A.vtype==[String,Boolean,Unknown]) | or(B.vtype==[String,Boolean,Unknown]) then + tree.lhs(1).vtype=Unknown + else + tree.lhs(1).vtype=Double + end + + // y = linspace(A,B) + if rhs==2 then + tree.rhs=Rhs_tlist(A,B) + tree.lhs(1).dims=list(1,100); + if or(A.vtype==[String,Boolean,Unknown]) | or(B.vtype==[String,Boolean,Unknown]) then + tree.name = "mtlb_linspace"; + end + else + // y = linspace(A,B,n) + n=tree.rhs(3) + tree.rhs=Rhs_tlist(A,B,n) + if typeof(n)=="cste" & n.vtype==Double then + if isempty(n.value) then + tree.lhs(1).dims=list(1,1) + else + tree.lhs(1).dims=list(1,n.value) + end + else + tree.lhs(1).dims=list(1,Unknown) + end + if or(A.vtype==[String,Boolean,Unknown]) | or(B.vtype==[String,Boolean,Unknown]) | or(n.vtype==[String,Boolean,Unknown]) then + tree.name = "mtlb_linspace"; + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_load.bin b/modules/m2sci/macros/sci_files/sci_load.bin new file mode 100755 index 000000000..2210f5b47 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_load.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_load.sci b/modules/m2sci/macros/sci_files/sci_load.sci new file mode 100755 index 000000000..19c2a49ba --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_load.sci @@ -0,0 +1,46 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_load(tree) + // M2SCI function + // Conversion function for Matlab load() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("varslist") + tree.name="loadmatfile" + + // If no rhs, then load all environment + if rhs<=0 then + tree.name="loadmatfile" + tree.rhs=Rhs_tlist("scilab.mat") + return + end + + for k=1:rhs + if typeof(tree.rhs(k))=="cste" & tree.rhs(k).value=="-regexp" then + set_infos(gettext("Option -regexp not yet handled: will be ignored."),2); + end + if typeof(tree.rhs(k))=="cste" //& exists("sci_"+tree.rhs(k).value)==1 + INFER=Infer() + varslist($+1)=M2scivar(tree.rhs(k).value,tree.rhs(k).value,INFER) + end + if typeof(tree.rhs(k))=="operation" + for j=1:size(tree.rhs(k).operands) + if typeof(tree.rhs(k).operands(j))=="cste" //& exists("sci_"+tree.rhs(k).operands(j).value)==1 + INFER=Infer() + varslist($+1)=M2scivar(tree.rhs(k).operands(j).value,tree.rhs(k).operands(j).value,INFER) + end + end + end + end + rhstemp=list() + rhstemp($+1)=tree.rhs(1) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_log.bin b/modules/m2sci/macros/sci_files/sci_log.bin new file mode 100755 index 000000000..610b1c093 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_log.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_log.sci b/modules/m2sci/macros/sci_files/sci_log.sci new file mode 100755 index 000000000..494867f47 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_log.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_log(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab log() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="log" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_log10.bin b/modules/m2sci/macros/sci_files/sci_log10.bin new file mode 100755 index 000000000..159cd2faa Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_log10.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_log10.sci b/modules/m2sci/macros/sci_files/sci_log10.sci new file mode 100755 index 000000000..bd8954ce4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_log10.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_log10(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab log10() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="log10" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_log2.bin b/modules/m2sci/macros/sci_files/sci_log2.bin new file mode 100755 index 000000000..36500f308 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_log2.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_log2.sci b/modules/m2sci/macros/sci_files/sci_log2.sci new file mode 100755 index 000000000..2f0b36b35 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_log2.sci @@ -0,0 +1,39 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_log2(tree) + // M2SCI function + // Conversion function for Matlab log2() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_log2/%c_frexp and %b_log2/%b_frexp are not defined in Scilab + X = getrhs(tree) + X = convert2double(X) + tree.rhs=Rhs_tlist(X) + + // Y = log2(X) + if lhs==1 then + tree.lhs(1).infer=X.infer + // [F,E] = log2(X) + else + if is_complex(X) then + X = Funcall("real",1,list(X),list(Variable("",X.infer))) + elseif ~is_real(X) then + newX = Funcall("real",1,list(X),list(Variable("",X.infer))) + repl_poss(newX,X,X,gettext("is Real.")); + X=newX + end + tree.rhs=Rhs_tlist(X) + tree.name="frexp" + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Real) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_logical.bin b/modules/m2sci/macros/sci_files/sci_logical.bin new file mode 100755 index 000000000..01c445907 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_logical.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_logical.sci b/modules/m2sci/macros/sci_files/sci_logical.sci new file mode 100755 index 000000000..168866163 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_logical.sci @@ -0,0 +1,47 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_logical(tree) + // M2SCI function + // Conversion function for Matlab logical() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_logical() + + X = getrhs(tree) + // Conversion to double is made to have the same results for strings + if or(X.vtype==[String,Unknown]) then + X = convert2double(X) + tree.rhs=list(X) + end + + if is_empty(X) then + set_infos(msprintf(gettext("%s is an empty matrix, so result is set to []."),expression2code(X)),0); + tree=Cste([]) + elseif not_empty(X) then + if X.vtype==Boolean then + if typeof(X)=="operation" then + X.out(1)=tree.lhs(1) + elseif typeof(X)=="funcall" then + X.lhs(1)=tree.lhs(1) + end + + tree=X + else + tree=Operation("<>",list(X,Cste(0)),tree.lhs) + + tree.out(1).dims=X.dims + tree.out(1).type=Type(Boolean,Real) + end + else + tree.name="mtlb_logical" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Boolean,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_logm.bin b/modules/m2sci/macros/sci_files/sci_logm.bin new file mode 100755 index 000000000..2a62a800b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_logm.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_logm.sci b/modules/m2sci/macros/sci_files/sci_logm.sci new file mode 100755 index 000000000..c6814603a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_logm.sci @@ -0,0 +1,30 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_logm(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab logm() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Unknown) + if size(tree.lhs)==2 + tree.lhs(2)=null() + set_infos(gettext("second output argument will be ignored."),2); + end +endfunction + + + + diff --git a/modules/m2sci/macros/sci_files/sci_lookfor.bin b/modules/m2sci/macros/sci_files/sci_lookfor.bin new file mode 100755 index 000000000..c96a64970 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_lookfor.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_lookfor.sci b/modules/m2sci/macros/sci_files/sci_lookfor.sci new file mode 100755 index 000000000..3d8f67116 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_lookfor.sci @@ -0,0 +1,21 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_lookfor(tree) + // M2SCI function + // Conversion function for Matlab lookfor() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==2 then + no_equiv(gettext("-all option ignored.")) + tree.rhs(2)=null() + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_lower.bin b/modules/m2sci/macros/sci_files/sci_lower.bin new file mode 100755 index 000000000..5da18aab0 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_lower.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_lower.sci b/modules/m2sci/macros/sci_files/sci_lower.sci new file mode 100755 index 000000000..7b0ed14af --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_lower.sci @@ -0,0 +1,37 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_lower(tree) + // M2SCI function + // Conversion function for Matlab lower() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_lower() + + opt=part("lower",1) + + A = getrhs(tree) + if A.vtype==String then + tree.name="convstr" + tree.rhs=Rhs_tlist(A,opt) + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + elseif A.vtype==Unknown then + tree.name="mtlb_lower" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + else + if typeof(A)=="funcall" then + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + A.out=tree.lhs + end + tree=A + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_lu.bin b/modules/m2sci/macros/sci_files/sci_lu.bin new file mode 100755 index 000000000..3f3967a55 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_lu.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_lu.sci b/modules/m2sci/macros/sci_files/sci_lu.sci new file mode 100755 index 000000000..477bdebaa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_lu.sci @@ -0,0 +1,50 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_lu(tree) + // M2SCI function + // Conversion function for Matlab lu() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // lu(X) + if rhs==1 then + X = getrhs(tree) + X = convert2double(X) + tree.rhs=Rhs_tlist(X) + // Y = lu(X) + if lhs==1 then + if tree.lhs(1).name=="ans" then + no_equiv(expression2code(tree)) + else + no_equiv(tree.lhs(1).name+" = "+expression2code(tree)) + end + // [L,U] = lu(X) + elseif lhs==2 then + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(X.vtype,Real) + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(2).type=X.type + // [L,U,P] = lu(X) + elseif lhs==3 then + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(X.vtype,Real) + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(2).type=X.type + tree.lhs(3).dims=list(Unknown,Unknown) + tree.lhs(3).type=Type(X.vtype,Real) + // [L,U,P,Q] = lu(X) + else + no_equiv("["+tree.lhs(1).name+","+tree.lhs(2).name+","+tree.lhs(3).name+"] = "+expression2code(tree)) + end + // lu(X,thresh) + else + no_equiv(expression2code(tree)) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_makecell.bin b/modules/m2sci/macros/sci_files/sci_makecell.bin new file mode 100755 index 000000000..156abc995 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_makecell.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_makecell.sci b/modules/m2sci/macros/sci_files/sci_makecell.sci new file mode 100755 index 000000000..ebfb05eae --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_makecell.sci @@ -0,0 +1,87 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_makecell(tree) + // M2SCI function + // Conversion function for Matlab {} + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==0 then + tree.rhs(1)=Operation("rc",list(Cste(0),Cste(0)),list()) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Cell,Unknown) + tree.lhs(1).contents=Contents() + return + end + + dimsrhs=Operation("rc",list(Cste(double(tree.rhs(1).dims(1))),Cste(double(tree.rhs(1).dims(2)))),list()) + + inrhs=tree.rhs(1) + + tmprhslist=list() + tmprhslist(1)=dimsrhs + if double(tree.rhs(1).dims(1))<>1 then + + for kr=1:double(tree.rhs(1).dims(1))-1 + + for krhs=lstsize(tmprhslist):-1:2 + tmprhslist(krhs+1)=tmprhslist(krhs) + end + + tmprhslist(2)=inrhs.operands(2) + inrhs=inrhs.operands(1) + end + + for krhs=lstsize(tmprhslist):-1:2 + tmprhslist(krhs+1)=tmprhslist(krhs) + end + tmprhslist(2)=inrhs + + else + tmprhslist(2)=inrhs + end + + rhslist=list() + rhslist(1)=dimsrhs + if double(tree.rhs(1).dims(2))<>1 then + + tmprhslist(1)=null() + + for ksz=lstsize(tmprhslist):-1:1 + inrhs=tmprhslist(ksz) + for kr=1:double(tree.rhs(1).dims(2))-1 + + for krhs=lstsize(rhslist):-1:2 + rhslist(krhs+1)=rhslist(krhs) + end + + rhslist(2)=inrhs.operands(2) + inrhs=inrhs.operands(1) + end + + for krhs=lstsize(rhslist):-1:2 + rhslist(krhs+1)=rhslist(krhs) + end + rhslist(2)=inrhs + + end + else + rhslist=tmprhslist + end + + // Del cell in first rhslist(2) + rhslist(2)=rhslist(2).operands(2) + tree.lhs(1).dims=tree.rhs(1).dims + tree.lhs(1).type=tree.rhs(1).type + tree.lhs(1).contents=tree.rhs(1).contents + + tree.rhs=rhslist + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_max.bin b/modules/m2sci/macros/sci_files/sci_max.bin new file mode 100755 index 000000000..93b850754 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_max.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_max.sci b/modules/m2sci/macros/sci_files/sci_max.sci new file mode 100755 index 000000000..66bfdbe28 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_max.sci @@ -0,0 +1,169 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_max(tree) + // File generated from sci_PROTO1.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab max() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_max() + + // C = max(A) or [C,I] = max(A) + if rhs==1 then + A = getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown // If A is a scalar then Matlab return Double type value else a Boolean type value + end + A = convert2double(A) + tree.rhs = Rhs_tlist(A) + dim = first_non_singleton(A) + + if dim==-1 then + // All output dims are unknown + tree.lhs(1).dims=allunknown(A.dims) + tmp=gettempvar() + insert(Equal(list(tmp),A)) + // First non singleton dimension will be computed at execution + tree.rhs=Rhs_tlist(tmp,Funcall("firstnonsingleton",1,list(tmp),list())) + else + tree.lhs(1).dims=A.dims + if dim==0 then + tree.rhs=Rhs_tlist(A) + if is_empty(A) then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims=list(1,1) + end + elseif dim==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims(dim)=1 + elseif dim==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims(dim)=1 + end + end + + // C = max(A) or [C,I] = max(A) + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + elseif is_complex(A) then + // Scilab max() does not work with complexes so mtlb_max() is called + tree.name="mtlb_max" + tree.lhs(1).type=Type(Double,Unknown) + else + // Scilab max() does not work with complexes so mtlb_max() is called but can be replaced + tree.name="mtlb_max" + tree.lhs(1).type=Type(vtype,Unknown) + end + + // [C,I] = max(A) + if lhs==2 then + // All dims Unknown because if A is [] then I is also [] else I is a row vector + tree.lhs(2).dims=allunknown(A.dims) + tree.lhs(2).type=Type(Double,Real) + end + // C = max(A,B) + elseif rhs==2 then + [A,B]=getrhs(tree) + vtype=Double + if A.vtype==Boolean & B.vtype==Boolean | A.vtype==Unknown & B.vtype==Unknown then + vtype=Unknown + end + A=convert2double(A) + B=convert2double(B) + tree.rhs=Rhs_tlist(A,B) + + if is_real(A) & is_real(B) then + if not_empty(A) & not_empty(B) then + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + else + // Perhaps an input is an empty matrix + tree.name="mtlb_max" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + end + else + // Inputs can be complexes and/or empty matrices + tree.name="mtlb_max" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Unknown) + end + // C = max(A,[],dim) or [C,I] = max(A,[],dim) + else + [A,tmp,dim]=getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown + end + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + // C = max(A,[],dim) or [C,I] = max(A,[],dim) + if or(lhs==[1,2]) then + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + if typeof(dim)=="cste" then + if dim.value==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(1)=Unknown // 0 or 1 + elseif dim.value==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(2)=Unknown // 0 or 1 + elseif dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + else + // Scilab max() does not work when dim is greater than number of dims of A + tree.name="mtlb_max" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=A.dims + end + else + // If dim is 1 it can be replaced by 'r' + // If dim is 2 it can be replaced by 'c' + tree.name="mtlb_max" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + end + else + // A can be complex.... + tree.name="mtlb_max" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + tree.lhs(1).type=Type(vtype,Unknown) + end + end + + // [C,I] = max(A,[],dim) + if lhs==2 then + tree.lhs(2).type=Type(Double,Real) + if is_real(A) then + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(2).dims=allunknown(A.dims) + else + tree.lhs(2).dims=A.dims + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_mean.bin b/modules/m2sci/macros/sci_files/sci_mean.bin new file mode 100755 index 000000000..2e51ac312 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_mean.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_mean.sci b/modules/m2sci/macros/sci_files/sci_mean.sci new file mode 100755 index 000000000..825278026 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_mean.sci @@ -0,0 +1,78 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_mean(tree) + // File generated from sci_PROTO8.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab mean() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_mean() + + // B = mean(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_mean and %C_mean are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A,"m") + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_a_vector(A) | is_empty(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.lhs(1).dims=list(1,A.dims(2)) + elseif not_empty(A) then + dim = first_non_singleton(A) + if dim>0 then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + tree.lhs(1).dims=allunknown(A.dims) + end + else + tree.lhs(1).dims=allunknown(A.dims) + end + + // B = mean(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_mean and %C_mean are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + // Scilab mean() does not work when dim is greater than number of dims A + tree.name="mtlb_mean" + tree.lhs(1).dims=allunknown(A.dims) + else + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + end + else + tree.name="mtlb_mean" + tree.lhs(1).dims=allunknown(A.dims) + end + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_median.bin b/modules/m2sci/macros/sci_files/sci_median.bin new file mode 100755 index 000000000..c3c259f20 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_median.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_median.sci b/modules/m2sci/macros/sci_files/sci_median.sci new file mode 100755 index 000000000..7caaa090b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_median.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_median(tree) + // M2SCI function + // Conversion function for Matlab median() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_median() + + // B = median(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_median and %C_median are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A,"m") + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_a_vector(A) | is_empty(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.lhs(1).dims=list(1,A.dims(2)) + elseif not_empty(A) then + dim = first_non_singleton(A) + if dim>0 then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + tree.lhs(1).dims=allunknown(A.dims) + end + else + tree.lhs(1).dims=allunknown(A.dims) + end + + // B = median(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_median and %C_median are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + end + else + tree.lhs(1).dims=allunknown(A.dims) + end + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_meshgrid.bin b/modules/m2sci/macros/sci_files/sci_meshgrid.bin new file mode 100755 index 000000000..8fc6ca86b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_meshgrid.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_meshgrid.sci b/modules/m2sci/macros/sci_files/sci_meshgrid.sci new file mode 100755 index 000000000..db62b84c6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_meshgrid.sci @@ -0,0 +1,67 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_meshgrid(tree) + // M2SCI function + // Conversion function for Matlab meshgrid() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 + A=getrhs(tree); + A=convert2double(A); + tree.rhs=Rhs_tlist(A); + elseif rhs==2 + [A,B]=getrhs(tree); + A=convert2double(A); + B=convert2double(B); + tree.rhs=Rhs_tlist(A,B); + end + + if lhs==1 + if tree.rhs(1).dims(1)<>Unknown + tree.lhs(1).dims=list(tree.rhs(1).dims(1),tree.rhs(1).dims(1)); + else + tree.lhs(1).dims=list(tree.rhs(1).dims(2),tree.rhs(1).dims(2)); + end + elseif lhs==2 + if tree.rhs(1).dims(1)<>Unknown + tree.lhs(1).dims=list(tree.rhs(1).dims(1),tree.rhs(1).dims(1)); + else + tree.lhs(1).dims=list(tree.rhs(1).dims(2),tree.rhs(1).dims(2)); + end + if rhs==1 + tree.lhs(2).dims=tree.lhs(1).dims; + else + if tree.rhs(2).dims(1)<>Unknown + tree.lhs(2).dims=list(tree.rhs(2).dims(1),tree.rhs(2).dims(1)); + else + tree.lhs(2).dims=list(tree.rhs(2).dims(2),tree.rhs(2).dims(2)); + end + end + else + if tree.rhs(1).dims(1)<>Unknown + tree.lhs(1).dims=list(tree.rhs(1).dims(1),tree.rhs(1).dims(1)); + else + tree.lhs(1).dims=list(tree.rhs(1).dims(2),tree.rhs(1).dims(2)); + end + + if tree.rhs(2).dims(1)<>Unknown + tree.lhs(2).dims=list(tree.rhs(2).dims(1),tree.rhs(2).dims(1)); + else + tree.lhs(2).dims=list(tree.rhs(2).dims(2),tree.rhs(2).dims(2)); + end + + if tree.rhs(3).dims(1)<>Unknown + tree.lhs(3).dims=list(tree.rhs(3).dims(1),tree.rhs(3).dims(1)); + else + tree.lhs(3).dims=list(tree.rhs(3).dims(2),tree.rhs(3).dims(2)); + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_min.bin b/modules/m2sci/macros/sci_files/sci_min.bin new file mode 100755 index 000000000..16b381ef0 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_min.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_min.sci b/modules/m2sci/macros/sci_files/sci_min.sci new file mode 100755 index 000000000..550bb60e4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_min.sci @@ -0,0 +1,169 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_min(tree) + // File generated from sci_PROTO1.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab min() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_min() + + // C = min(A) or [C,I] = min(A) + if rhs==1 then + A = getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown // If A is a scalar then Matlab return Double type value else a Boolean type value + end + A = convert2double(A) + tree.rhs = Rhs_tlist(A) + dim = first_non_singleton(A) + + if dim==-1 then + // All output dims are unknown + tree.lhs(1).dims=allunknown(A.dims) + tmp=gettempvar() + insert(Equal(list(tmp),A)) + // First non singleton dimension will be computed at execution + tree.rhs=Rhs_tlist(tmp,Funcall("firstnonsingleton",1,list(tmp),list())) + else + tree.lhs(1).dims=A.dims + if dim==0 then + tree.rhs=Rhs_tlist(A) + if is_empty(A) then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims=list(1,1) + end + elseif dim==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims(dim)=1 + elseif dim==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims(dim)=1 + end + end + + // C = min(A) or [C,I] = min(A) + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + elseif is_complex(A) then + // Scilab min() does not work with complexes so mtlb_min() is called + tree.name="mtlb_min" + tree.lhs(1).type=Type(Double,Unknown) + else + // Scilab min() does not work with complexes so mtlb_min() is called but can be replaced + tree.name="mtlb_min" + tree.lhs(1).type=Type(vtype,Unknown) + end + + // [C,I] = min(A) + if lhs==2 then + // All dims Unknown because if A is [] then I is also [] else I is a row vector + tree.lhs(2).dims=allunknown(A.dims) + tree.lhs(2).type=Type(Double,Real) + end + // C = min(A,B) + elseif rhs==2 then + [A,B]=getrhs(tree) + vtype=Double + if A.vtype==Boolean & B.vtype==Boolean | A.vtype==Unknown & B.vtype==Unknown then + vtype=Unknown + end + A=convert2double(A) + B=convert2double(B) + tree.rhs=Rhs_tlist(A,B) + + if is_real(A) & is_real(B) then + if not_empty(A) & not_empty(B) then + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + else + // Perhaps an input is an empty matrix + tree.name="mtlb_min" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + end + else + // Inputs can be complexes and/or empty matrices + tree.name="mtlb_min" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Unknown) + end + // C = min(A,[],dim) or [C,I] = min(A,[],dim) + else + [A,tmp,dim]=getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown + end + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + // C = min(A,[],dim) or [C,I] = min(A,[],dim) + if or(lhs==[1,2]) then + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + if typeof(dim)=="cste" then + if dim.value==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(1)=Unknown // 0 or 1 + elseif dim.value==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(2)=Unknown // 0 or 1 + elseif dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + else + // Scilab min() does not work when dim is greater than number of dims of A + tree.name="mtlb_min" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=A.dims + end + else + // If dim is 1 it can be replaced by 'r' + // If dim is 2 it can be replaced by 'c' + tree.name="mtlb_min" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + end + else + // A can be complex.... + tree.name="mtlb_min" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + tree.lhs(1).type=Type(vtype,Unknown) + end + end + + // [C,I] = min(A,[],dim) + if lhs==2 then + tree.lhs(2).type=Type(Double,Real) + if is_real(A) then + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(2).dims=allunknown(A.dims) + else + tree.lhs(2).dims=A.dims + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_mkdir.bin b/modules/m2sci/macros/sci_files/sci_mkdir.bin new file mode 100755 index 000000000..3e9e5adba Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_mkdir.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_mkdir.sci b/modules/m2sci/macros/sci_files/sci_mkdir.sci new file mode 100755 index 000000000..358b6ccf6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_mkdir.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_mkdir(tree) + // M2SCI function + // Conversion function for Matlab mkdir + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1); + tree.lhs(1).type=Type(Double,Real); + + if lhs>=2 then + tree.lhs(2).dims=list(1,Unknown); + tree.lhs(2).type=Type(String,Real); + end + + if lhs==3 then + no_equiv(msprintf(gettext("%s when called with three outputs."),expression2code(tree))); + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_mod.bin b/modules/m2sci/macros/sci_files/sci_mod.bin new file mode 100755 index 000000000..4d4ba2793 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_mod.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_mod.sci b/modules/m2sci/macros/sci_files/sci_mod.sci new file mode 100755 index 000000000..069ecffee --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_mod.sci @@ -0,0 +1,34 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_mod(tree) + // M2SCI function + // Conversion function for Matlab mod() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_r_c and %b_r_b are not defined in Scilab + [X,Y] = getrhs(tree) + X = convert2double(X) + Y = convert2double(Y) + tree.rhs=Rhs_tlist(X,Y) + + tree.name="pmodulo" + + if is_a_scalar(X) then + tree.lhs(1).dims=Y.dims + elseif is_a_scalar(Y) then + tree.lhs(1).dims=X.dims + elseif X.dims==Y.dims then + tree.lhs(1).dims=X.dims + else + tree.lhs(1).dims=allunknown(X.dims) + end + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_more.bin b/modules/m2sci/macros/sci_files/sci_more.bin new file mode 100755 index 000000000..b4cb39bec Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_more.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_more.sci b/modules/m2sci/macros/sci_files/sci_more.sci new file mode 100755 index 000000000..aef42a54e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_more.sci @@ -0,0 +1,32 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_more(tree) + // M2SCI function + // Conversion function for Matlab more() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_more() + + opt=getrhs(tree) + + tree.name="lines" + if typeof(opt)=="cste" then + if opt.value=="off" then + tree.rhs=Rhs_tlist(0) + elseif opt.value=="on" then + tree.rhs=Rhs_tlist(60) + else + // Nothing to do + end + else + tree.name="mtlb_more" + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_nargin.bin b/modules/m2sci/macros/sci_files/sci_nargin.bin new file mode 100755 index 000000000..afd61e112 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_nargin.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_nargin.sci b/modules/m2sci/macros/sci_files/sci_nargin.sci new file mode 100755 index 000000000..fef9e3da2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_nargin.sci @@ -0,0 +1,36 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_nargin(tree) + // File generated from sci_PROTO15.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab nargin() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + global("varslist") + + if rhs==0 then // Number of arguments of local function + tree=Variable("%nargin",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("nargin","%nargin",Infer(list(1,1),Type(Double,Real))) + else // Number of arguments of M-file + if "nargin"=="nargin" then + fieldnb=1 + else + fieldnb=2 + end + set_infos(msprintf(gettext("%s considered to be a Scilab macro."),rhs2code(tree.rhs)),2); + evstrtree=Funcall("evstr",1,tree.rhs,list()) + macrovartree=Funcall("macrovar",1,Rhs_tlist(evstrtree),list()) + getfieldtree=Funcall("getfield",1,Rhs_tlist(fieldnb,macrovartree),list()) + tree=Funcall("size",1,Rhs_tlist(getfieldtree,"*"),tree.lhs) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_nargout.bin b/modules/m2sci/macros/sci_files/sci_nargout.bin new file mode 100755 index 000000000..a2032902f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_nargout.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_nargout.sci b/modules/m2sci/macros/sci_files/sci_nargout.sci new file mode 100755 index 000000000..813fb9d21 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_nargout.sci @@ -0,0 +1,36 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_nargout(tree) + // File generated from sci_PROTO15.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab nargout() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + global("varslist") + + if rhs==0 then // Number of arguments of local function + tree=Variable("%nargout",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("nargout","%nargout",Infer(list(1,1),Type(Double,Real))) + else // Number of arguments of M-file + if "nargout"=="nargin" then + fieldnb=1 + else + fieldnb=2 + end + set_infos(msprintf(gettext("%s considered to be a Scilab macro."),rhs2code(tree.rhs)),2); + evstrtree=Funcall("evstr",1,tree.rhs,list()) + macrovartree=Funcall("macrovar",1,Rhs_tlist(evstrtree),list()) + getfieldtree=Funcall("getfield",1,Rhs_tlist(fieldnb,macrovartree),list()) + tree=Funcall("size",1,Rhs_tlist(getfieldtree,"*"),tree.lhs) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ndims.bin b/modules/m2sci/macros/sci_files/sci_ndims.bin new file mode 100755 index 000000000..26e53f379 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_ndims.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_ndims.sci b/modules/m2sci/macros/sci_files/sci_ndims.sci new file mode 100755 index 000000000..4f4f27785 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ndims.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_ndims(tree) + // M2SCI function + // Conversion function for Matlab ndims() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + // Conversion to double is made to have the same results for strings + if or(A.vtype==[String,Unknown]) then + A = convert2double(A) + tree.rhs=list(A) + end + + tree.name="size" + tree=Funcall("size",1,Rhs_tlist(tree,"*"),tree.lhs) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_norm.bin b/modules/m2sci/macros/sci_files/sci_norm.bin new file mode 100755 index 000000000..b0ff01915 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_norm.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_norm.sci b/modules/m2sci/macros/sci_files/sci_norm.sci new file mode 100755 index 000000000..48a4d39bc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_norm.sci @@ -0,0 +1,32 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_norm(tree) + // M2SCI function + // Conversion function for Matlab norm() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_norm() + + // n = norm(A) + if rhs==1 then + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + // n = norm(A,p) + else + [A,p] = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A,p) + end + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_now.bin b/modules/m2sci/macros/sci_files/sci_now.bin new file mode 100755 index 000000000..cad04e03c Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_now.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_now.sci b/modules/m2sci/macros/sci_files/sci_now.sci new file mode 100755 index 000000000..3df9152e5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_now.sci @@ -0,0 +1,21 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_now(tree) + // M2SCI function + // Conversion function for Matlab now() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.lhs)==1 then + tree.lhs(1).type=Type(Double,Real) + tree.lhs(1).dims=list(1,1) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_num2str.bin b/modules/m2sci/macros/sci_files/sci_num2str.bin new file mode 100755 index 000000000..24aea1e87 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_num2str.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_num2str.sci b/modules/m2sci/macros/sci_files/sci_num2str.sci new file mode 100755 index 000000000..09f63e43a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_num2str.sci @@ -0,0 +1,30 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_num2str(tree) + // M2SCI function + // Conversion function for Matlab num2str() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 then + set_infos(gettext("string output can be different from Matlab num2str output."),2) + tree.name="string" + else + if tree.rhs(2).vtype==String then + tree.name="msprintf" + tree.rhs=Rhs_tlist(tree.rhs(2),tree.rhs(1)) + elseif tree.rhs(2).vtype<>Unknown then + no_equiv(expression2code(tree)) + set_infos(gettext("See msprintf for solutions."),1); + else + tree.name="mtlb_num2str" + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ones.bin b/modules/m2sci/macros/sci_files/sci_ones.bin new file mode 100755 index 000000000..1c1f907f7 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_ones.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_ones.sci b/modules/m2sci/macros/sci_files/sci_ones.sci new file mode 100755 index 000000000..df0921ea0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ones.sci @@ -0,0 +1,176 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_ones(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab ones() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_ones() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // ones(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("ones",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // ones([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("ones",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // ones(n) or ones([n1,n2,...]) ? + else + tree.name="mtlb_ones" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // ones(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="ones" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_orth.bin b/modules/m2sci/macros/sci_files/sci_orth.bin new file mode 100755 index 000000000..7e1f665e8 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_orth.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_orth.sci b/modules/m2sci/macros/sci_files/sci_orth.sci new file mode 100755 index 000000000..432a70fc4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_orth.sci @@ -0,0 +1,19 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_orth(tree) + // M2SCI function + // Conversion function for Matlab orth() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + tree.lhs(1).dims=list(A.dims(1),-1) + tree.lhs(1).type=Type(Double,A.property) +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_pause.bin b/modules/m2sci/macros/sci_files/sci_pause.bin new file mode 100755 index 000000000..0b3a6a140 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_pause.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_pause.sci b/modules/m2sci/macros/sci_files/sci_pause.sci new file mode 100755 index 000000000..5425afeb6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_pause.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_pause(tree) + // M2SCI function + // Conversion function for Matlab pause + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs<1 then + tree.name="halt" + else + n = getrhs(tree) + if n.vtype==String then // pause on/off + no_equiv(expression2code(tree)); + else + tree.rhs=Rhs_tlist(Operation("*",list(Cste(1000),n),list())) + tree.name="xpause" + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_perms.bin b/modules/m2sci/macros/sci_files/sci_perms.bin new file mode 100755 index 000000000..dddea9dcf Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_perms.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_perms.sci b/modules/m2sci/macros/sci_files/sci_perms.sci new file mode 100755 index 000000000..11814c442 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_perms.sci @@ -0,0 +1,32 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_perms(tree) + // M2SCI function + // Conversion function for Matlab perms() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + tree.rhs=Rhs_tlist(A) + + if (type(tree.rhs(1).dims(1))==1 & tree.rhs(1).dims(1)==1) & (type(tree.rhs(1).dims(2))==1 & tree.rhs(1).dims(2)<>-1) then + tree.lhs(1).dims(1)=prod(1:tree.rhs(1).dims(2)) + tree.lhs(1).dims(2)=tree.rhs(1).dims(2) + elseif (type(tree.rhs(1).dims(2))==1 & tree.rhs(1).dims(2)==1) & (type(tree.rhs(1).dims(1))==1 & tree.rhs(1).dims(1)<>-1) then + tree.lhs(1).dims(1)=prod(1:tree.rhs(1).dims(1)) + tree.lhs(1).dims(2)=tree.rhs(1).dims(1) + else + tree.lhs(1).dims(1)=-1 + tree.lhs(1).dims(2)=-1 + end + + tree.lhs(1).type=tree.rhs(1).type + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_pie.bin b/modules/m2sci/macros/sci_files/sci_pie.bin new file mode 100755 index 000000000..6918af470 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_pie.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_pie.sci b/modules/m2sci/macros/sci_files/sci_pie.sci new file mode 100755 index 000000000..e414dff7d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_pie.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_pie(tree) + // M2SCI function + // Conversion function for Matlab pie() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if tree.lhs(1).name <> "ans" then + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("gce",1,list(),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + else + tree.lhs(1).type=Type(Handle,Unknown) + end +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_plot.bin b/modules/m2sci/macros/sci_files/sci_plot.bin new file mode 100755 index 000000000..3058befcb Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_plot.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_plot.sci b/modules/m2sci/macros/sci_files/sci_plot.sci new file mode 100755 index 000000000..f55c7028b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_plot.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_plot(tree) + // M2SCI function + // Conversion function for Matlab plot() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name == "ans" then + tree.lhs(1).type=Type(Handle,Unknown) + else + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("gce",1,list(),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_pow2.bin b/modules/m2sci/macros/sci_files/sci_pow2.bin new file mode 100755 index 000000000..16fe5d4a5 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_pow2.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_pow2.sci b/modules/m2sci/macros/sci_files/sci_pow2.sci new file mode 100755 index 000000000..0df9e52a1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_pow2.sci @@ -0,0 +1,63 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_pow2(tree) + // M2SCI function + // Conversion function for Matlab pow2() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // X = pow2(Y) + if rhs==1 then + // %c_pow2 and %b_pow2 are not defined in Scilab + Y = getrhs(tree) + Y = convert2double(Y) + + tree=Operation(".^",list(Cste(2),Y),list(Variable(tree.lhs(1).name,Y.infer))) + // X = pow2(E,F) + else + // %c_pow2 and %b_pow2 are not defined in Scilab + [E,F] = getrhs(tree) + E = convert2double(E) + F = convert2double(F) + + // Imaginary parts are ignored by Matlab + if is_complex(E) then + E = Funcall("real",1,list(E),list(Variable("",E.infer))) + elseif ~is_real(E) then + newE = Funcall("real",1,list(E),list(Variable("",E.infer))) + repl_poss(newE,E,E,gettext("is Real.")); + E=newE + end + if is_complex(F) then + F = Funcall("real",1,list(F),list(Variable("",F.infer))) + elseif ~is_real(F) then + newF = Funcall("real",1,list(F),list(Variable("",F.infer))) + repl_poss(newF,F,F,gettext("is Real.")); + F=newF + end + + tmp=Operation(".^",list(Cste(2),F),list(Variable("",F.infer))) + + tree=Operation(".*",list(E,tmp),list(Variable(tree.lhs(1).name,Infer()))) + + if is_a_scalar(E) then + tree.out(1).dims=F.dims + elseif is_a_scalar(F) then + tree.out(1).dims=E.dims + elseif E.dims==F.dims then + tree.out(1).dims=E.dims + else + tree.out(1).dims=allunknown(E.dims) + end + tree.out(1).type=Type(Double,Real) + end + + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_primes.bin b/modules/m2sci/macros/sci_files/sci_primes.bin new file mode 100755 index 000000000..0a3a3582d Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_primes.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_primes.sci b/modules/m2sci/macros/sci_files/sci_primes.sci new file mode 100755 index 000000000..9b035cab5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_primes.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_primes(tree) + // M2SCI function + // Conversion function for Matlab primes() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims(1)=1 + tree.lhs(1).type=Type(Double,Real) +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_prod.bin b/modules/m2sci/macros/sci_files/sci_prod.bin new file mode 100755 index 000000000..ce2721ac3 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_prod.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_prod.sci b/modules/m2sci/macros/sci_files/sci_prod.sci new file mode 100755 index 000000000..fb903fc77 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_prod.sci @@ -0,0 +1,82 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_prod(tree) + // File generated from sci_PROTO8.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab prod() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_prod() + + // B = prod(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_prod and %C_prod are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_a_vector(A) | is_empty(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.lhs(1).dims=list(1,A.dims(2)) + tree.rhs=Rhs_tlist(A,1) + elseif not_empty(A) then + dim = first_non_singleton(A) + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + tree.lhs(1).dims=allunknown(A.dims) + end + else + tree.name="mtlb_prod" + tree.lhs(1).dims=allunknown(A.dims) + end + + // B = prod(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_prod and %C_prod are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + // Scilab prod() does not work when dim is greater than number of dims A + tree.name="mtlb_prod" + tree.lhs(1).dims=allunknown(A.dims) + else + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + end + else + tree.name="mtlb_prod" + tree.lhs(1).dims=allunknown(A.dims) + end + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_qr.bin b/modules/m2sci/macros/sci_files/sci_qr.bin new file mode 100755 index 000000000..789a512cb Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_qr.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_qr.sci b/modules/m2sci/macros/sci_files/sci_qr.sci new file mode 100755 index 000000000..10a431271 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_qr.sci @@ -0,0 +1,86 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_qr(tree) + // M2SCI function + // Conversion function for Matlab qr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_qr() + + // qr(A) + if rhs==1 then + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + if is_real(A) then + prop=Real + else + prop=Unknown + end + // X = qr(A) + if lhs==1 then + if tree.lhs(1).name=="ans" then + no_equiv(expression2code(tree)) + else + no_equiv(tree.lhs(1).name+" = "+expression2code(tree)) + end + // [Q,R] = qr(A) + elseif lhs==2 then + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=A.type + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(A.vtype,prop) + // [Q,R,E] = qr(A) + else + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=A.type + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(A.vtype,prop) + tree.lhs(3).dims=list(A.dims(2),A.dims(2)) + tree.lhs(3).type=Type(A.vtype,prop) + end + // qr(A,0) + else + [A,B] = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A,B) + if is_real(A) then + prop=Real + else + prop=Unknown + end + // R = qr(A,0) + if lhs==1 then + if tree.lhs(1).name=="ans" then + no_equiv(expression2code(tree)) + else + no_equiv(tree.lhs(1).name+" = "+expression2code(tree)) + end + // [Q,R] = qr(A,0) + elseif lhs==2 then + tree.rhs=Rhs_tlist(A,"e") + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=A.type + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(2).type=Type(A.vtype,prop) + // [Q,R,E] = qr(A,0) + else + set_infos(gettext("Scilab and Matlab qr() do not give same results for this case: mtlb_qr() is used."),0) + tree.name="mtlb_qr" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(A.vtype,prop) + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(2).type=Type(A.vtype,prop) + tree.lhs(3).dims=list(Unknown,Unknown) + tree.lhs(3).type=Type(A.vtype,prop) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_quit.bin b/modules/m2sci/macros/sci_files/sci_quit.bin new file mode 100755 index 000000000..816ec4b89 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_quit.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_quit.sci b/modules/m2sci/macros/sci_files/sci_quit.sci new file mode 100755 index 000000000..05f6bdcd1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_quit.sci @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_quit(tree) + // M2SCI function + // Conversion function for Matlab quit() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_rand.bin b/modules/m2sci/macros/sci_files/sci_rand.bin new file mode 100755 index 000000000..5ff5702c4 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_rand.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_rand.sci b/modules/m2sci/macros/sci_files/sci_rand.sci new file mode 100755 index 000000000..f2962e66d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_rand.sci @@ -0,0 +1,176 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_rand(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab rand() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_rand() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // rand(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("rand",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // rand([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("rand",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // rand(n) or rand([n1,n2,...]) ? + else + tree.name="mtlb_rand" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // rand(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="rand" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_randn.bin b/modules/m2sci/macros/sci_files/sci_randn.bin new file mode 100755 index 000000000..ad6a2d6c5 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_randn.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_randn.sci b/modules/m2sci/macros/sci_files/sci_randn.sci new file mode 100755 index 000000000..4bc1f7c46 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_randn.sci @@ -0,0 +1,176 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_randn(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab randn() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_randn() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // randn(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("rand",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // randn([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("rand",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // randn(n) or randn([n1,n2,...]) ? + else + tree.name="mtlb_randn" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // randn(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="rand" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_rcond.bin b/modules/m2sci/macros/sci_files/sci_rcond.bin new file mode 100755 index 000000000..0762070a2 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_rcond.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_rcond.sci b/modules/m2sci/macros/sci_files/sci_rcond.sci new file mode 100755 index 000000000..9d964bd92 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_rcond.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_rcond(tree) + // M2SCI function + // Conversion function for Matlab rcond() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_rcond() + + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + // If A can be an empty matrix... + if ~not_empty(A) then + tree.name="mtlb_rcond" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_real.bin b/modules/m2sci/macros/sci_files/sci_real.bin new file mode 100755 index 000000000..a54b50f5a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_real.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_real.sci b/modules/m2sci/macros/sci_files/sci_real.sci new file mode 100755 index 000000000..3f19bea4b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_real.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_real(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab real() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_realmax.bin b/modules/m2sci/macros/sci_files/sci_realmax.bin new file mode 100755 index 000000000..747837e5c Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_realmax.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_realmax.sci b/modules/m2sci/macros/sci_files/sci_realmax.sci new file mode 100755 index 000000000..26219a244 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_realmax.sci @@ -0,0 +1,36 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_realmax(tree) + // M2SCI function + // Conversion function for Matlab realmax() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_realmax() + + // realmax + if rhs<=0 then + tree.name="number_properties" + tree.rhs(1)=Cste("huge"); + // realmax('double') or realmax('single') + else + if typeof(tree.rhs(1))=="cste" then + if tree.rhs(1).value=="double" then + tree.name="number_properties" + tree.rhs(1)=Cste("huge"); + else + no_equiv(expression2code(tree)); + end + else + tree.name="mtlb_realmax"; + end + end + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_realmin.bin b/modules/m2sci/macros/sci_files/sci_realmin.bin new file mode 100755 index 000000000..99fcd7117 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_realmin.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_realmin.sci b/modules/m2sci/macros/sci_files/sci_realmin.sci new file mode 100755 index 000000000..edb4f8cb7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_realmin.sci @@ -0,0 +1,36 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function tree=sci_realmin(tree) + // M2SCI function + // Conversion function for Matlab realmin() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_realmin() + + // realmin + if rhs<=0 then + tree.name="number_properties" + tree.rhs(1)=Cste("tiny"); + // realmin('double') or realmin('single') + else + if typeof(tree.rhs(1))=="cste" then + if tree.rhs(1).value=="double" then + tree.name="number_properties" + tree.rhs(1)=Cste("tiny"); + else + no_equiv(expression2code(tree)); + end + else + tree.name="mtlb_realmin"; + end + end + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_rem.bin b/modules/m2sci/macros/sci_files/sci_rem.bin new file mode 100755 index 000000000..56c1ad737 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_rem.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_rem.sci b/modules/m2sci/macros/sci_files/sci_rem.sci new file mode 100755 index 000000000..040e8c5ce --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_rem.sci @@ -0,0 +1,45 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_rem(tree) + // M2SCI function + // Conversion function for Matlab rem() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_d_c and %b_d_b are not defined in Scilab + [X,Y] = getrhs(tree) + X = convert2double(X) + Y = convert2double(Y) + tree.rhs=Rhs_tlist(X,Y) + + // X./Y + drd=Operation("./",tree.rhs,list()) + // fix(X./Y) + fix_funcall=Funcall("fix",1,list(drd),list()) + // fix(X./Y).*Y + drm=Operation(".*",list(fix_funcall,tree.rhs(2)),list()) + // X-fix(X./Y).*Y + tree=Operation("-",list(tree.rhs(1),drm),tree.lhs) + + if is_a_scalar(X) then + tree.out(1).dims=Y.dims + elseif is_a_scalar(Y) then + tree.out(1).dims=X.dims + elseif is_a_vector(X) then + tree.out(1).dims=X.dims + elseif is_a_vector(Y) then + tree.out(1).dims=Y.dims + else + tree.out(1).dims=X.dims + end + + tree.out(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_repmat.bin b/modules/m2sci/macros/sci_files/sci_repmat.bin new file mode 100755 index 000000000..165fad937 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_repmat.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_repmat.sci b/modules/m2sci/macros/sci_files/sci_repmat.sci new file mode 100755 index 000000000..fac5b275a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_repmat.sci @@ -0,0 +1,123 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_repmat(tree) + // M2SCI function + // Conversion function for Matlab repmat() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_repmat() + + // repmat(A,m) + if rhs==2 then + [A,m] = getrhs(tree) + vtype=A.vtype + if A.vtype==Unknown then + tree.name="mtlb_repmat" + if typeof(m)=="cste" then + for kd=1:lstsize(A.dims) + tree.lhs(1).dims(kd)=A.dims(kd)*m.value + if tree.lhs(1).dims(kd)<0 then + tree.lhs(1).dims(kd)=Unknown + end + end + end + tree.lhs(1).vtype=A.vtype + return + elseif A.vtype==Boolean then + A=convert2double(A) + elseif A.vtype==String then + A=convert2double(A) + end + + // repmat(A,m) equivalent to repmat(A,m,m) + if is_a_scalar(m) then + tree.rhs=list(m,m); + tree.name="ones"; + tree=Operation(".*.",list(tree,A),tree.lhs) + + if typeof(m)=="cste" then + tree.out(1).dims=A.dims + for kd=1:2 + tree.out(1).dims(kd)=A.dims(kd)*m.value + if tree.out(1).dims(kd)<0 then + tree.out(1).dims(kd)=Unknown + end + end + end + tree.out(1).type=Type(A.vtype,A.property) + // repmat(A,[m,n,...]) + elseif not_a_scalar(m) + tmp=m + if typeof(m)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),m)) + end + newrhs=list() + for k=1:size(m.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + tree.rhs=newrhs; + tree.name="ones"; + tree=Operation(".*.",list(tree,A),tree.lhs) + + tree.out(1).type=Type(Double,A.property) + // repmat(A,m) or repmat(A,[m,n,...]) + else + tree.name="mtlb_repmat" + tree.lhs(1).type=Type(A.vtype,A.property) + if or(vtype==[String,Boolean]) then + tree.lhs(1).type=Type(vtype,A.property) + end + return + end + // repmat(A,m,n) + else + [A,m,n] = getrhs(tree) + vtype=A.vtype + if A.vtype==Unknown then + tree.name="mtlb_repmat" + if is_a_scalar(A) & typeof(m)=="cste" then + tree.lhs(1).dims(1)=m.value + end + if is_a_scalar(A) & typeof(n)=="cste" then + tree.lhs(1).dims(2)=n.value + end + tree.lhs(1).vtype=A.vtype + return + elseif A.vtype==Boolean then + A=convert2double(A) + elseif A.vtype==String then + A=convert2double(A) + end + tree.rhs=Rhs_tlist(m,n) + tree.name="ones"; + tree=Operation(".*.",list(tree,A),tree.lhs) + + if typeof(m)=="cste" & typeof(n)=="cste" then + tree.out(1).dims=A.dims + tree.out(1).dims(1)=A.dims(1)*m.value + if tree.out(1).dims(1)<0 then + tree.out(1).dims(1)=Unknown + end + tree.out(1).dims(2)=A.dims(2)*n.value + if tree.out(1).dims(2)<0 then + tree.out(1).dims(2)=Unknown + end + end + end + + if vtype==String then + tree=Funcall("asciimat",1,list(tree),tree.out); + tree.lhs(1).type=Type(String,Real) + elseif vtype==Boolean then + tree.out(1).type=Type(Boolean,Real) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_reshape.bin b/modules/m2sci/macros/sci_files/sci_reshape.bin new file mode 100755 index 000000000..d45b91d91 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_reshape.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_reshape.sci b/modules/m2sci/macros/sci_files/sci_reshape.sci new file mode 100755 index 000000000..dd06819dd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_reshape.sci @@ -0,0 +1,84 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_reshape(tree) + // M2SCI function + // Conversion function for Matlab reshape() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // knowndims is a boolean, it's true if all the dimensions of the lhs are known else it's false + // isemptyrhs is a boolean, it's true if one (or more than one) of the lhs dimensions it's equal to 0 else it's false + knowndims=%t + isemptyrhs=%f + for k=1:rhs + if k==1 then + if tree.rhs(k).vtype==String then + tree.rhs(k)=Funcall("mstr2sci",1,list(tree.rhs(k)),list(Variable("",tree.rhs(k).infer))) + elseif tree.rhs(k).vtype==Unknown then + scitree=tree + scitree.rhs(k)=Funcall("mtlb_double",1,list(tree.rhs(k)),list(Variable("",tree.rhs(k).infer))) + repl_poss(scitree,tree,tree.rhs(k),gettext("is not a character string matrix.")) + tree=scitree + end + end + if k>=2 then + for i=1:size(tree.rhs(k).dims) + if tree.rhs(k).dims(i)==-1 + knowndims=%f + end + end + end + if typeof(tree.rhs(k))=="cste" then + if isempty(tree.rhs(k).value) then + isemptyrhs=%t + tree.rhs(k)=Cste(-1) + end + end + end + + set_infos(gettext("WARNING: Matlab reshape() suppresses singleton higher dimension, it is not the case for matrix."),2) + tree.name="matrix" + tree.lhs(1).type=tree.rhs(1).type + if knowndims==%t + dims=list() + if size(tree.rhs)==2 + dims=lhsdimsearch(tree.rhs(2)) + tree.lhs(1).dims=dims + elseif size(tree.rhs)>=2 + if ~isemptyrhs then + for k=2:size(tree.rhs) + if typeof(tree.rhs(k)) == "cste" then + dims($+1)=tree.rhs(k).value + else + dims($+1) = Unknown; + end + end + tree.lhs(1).dims=dims + end + else + tree.lhs(1).dims=allunknown(tree.rhs(1).dims) + end + else + tree.lhs(1).dims=allunknown(tree.rhs(1).dims) + end +endfunction + +function dims=lhsdimsearch(rhs) + // LHSDIMSEARCH function searches dimensions size of the lhs + // dims : a list which contains the size of the lhs + if typeof(rhs)=="operation" then + dims=lstcat(rhs.operands(2).value,dims) + if typeof(rhs.operands(1))=="operation" then + dims=lhsdimsearch(rhs.operands(1)) + else + dims=lstcat(rhs.operands(1).value,dims) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_return.bin b/modules/m2sci/macros/sci_files/sci_return.bin new file mode 100755 index 000000000..c5ee632b3 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_return.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_return.sci b/modules/m2sci/macros/sci_files/sci_return.sci new file mode 100755 index 000000000..2331d5cee --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_return.sci @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_return(tree) + // M2SCI function + // Conversion function for Matlab return + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_round.bin b/modules/m2sci/macros/sci_files/sci_round.bin new file mode 100755 index 000000000..b34f7146d Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_round.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_round.sci b/modules/m2sci/macros/sci_files/sci_round.sci new file mode 100755 index 000000000..22a9a66fa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_round.sci @@ -0,0 +1,27 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_round(tree) + // File generated from sci_PROTO6.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab round() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_save.bin b/modules/m2sci/macros/sci_files/sci_save.bin new file mode 100755 index 000000000..adcbf6653 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_save.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_save.sci b/modules/m2sci/macros/sci_files/sci_save.sci new file mode 100755 index 000000000..82ad49113 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_save.sci @@ -0,0 +1,32 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_save(tree) + // M2SCI function + // Conversion function for Matlab save() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="savematfile" + + // If no rhs, save Scilab environment + if rhs<=0 then + tree.rhs=Rhs_tlist("scilab.mat") + return + end + + for k=1:rhs + if typeof(tree.rhs(k))=="cste" & tree.rhs(k).value=="-regexp" then + set_infos(gettext("Option -regexp not yet handled: will be ignored."),2); + elseif typeof(tree.rhs(k))=="cste" & tree.rhs(k).value=="-append" then + set_infos(gettext("Option -append not yet handled: will be ignored."),2); + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_schur.bin b/modules/m2sci/macros/sci_files/sci_schur.bin new file mode 100755 index 000000000..ea70d8045 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_schur.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_schur.sci b/modules/m2sci/macros/sci_files/sci_schur.sci new file mode 100755 index 000000000..4e1b377cb --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_schur.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_schur(tree) + // M2SCI function + // Conversion function for Matlab schur() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + // %c_schur and %b_schur are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + + if lhs==2 then + tree.lhs(2).dims=A.dims + tree.lhs(2).type=A.type + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_setstr.bin b/modules/m2sci/macros/sci_files/sci_setstr.bin new file mode 100755 index 000000000..f821c7428 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_setstr.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_setstr.sci b/modules/m2sci/macros/sci_files/sci_setstr.sci new file mode 100755 index 000000000..766571bca --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_setstr.sci @@ -0,0 +1,43 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_setstr(tree) + // M2SCI function + // Conversion function for Matlab setstr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_setstr() + + X = getrhs(tree) + + if X.vtype==String then + set_infos(msprintf(gettext("In %s %s is a String,\nSo result is set to %s."),expression2code(tree),expression2code(X),expression2code(X)),0) + // Because of String concatenation + if typeof(X)=="operation" then + X.out(1)=tree.lhs(1) + elseif typeof(X)=="funcall" then + X.lhs(1)=tree.lhs(1) + end + tree=X + elseif X.vtype==Unknown then + tree.name="mtlb_setstr" + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(String,Real) + else + tree.name="ascii" + if X.dims(1)==1 | is_a_scalar(X) then // Row vector or scalar + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(String,Real) + else + tree.name="mtlb_setstr" + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(String,Real) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sign.bin b/modules/m2sci/macros/sci_files/sci_sign.bin new file mode 100755 index 000000000..d3e95a026 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_sign.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_sign.sci b/modules/m2sci/macros/sci_files/sci_sign.sci new file mode 100755 index 000000000..dae4becff --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sign.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_sign(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab sign() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="sign" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sin.bin b/modules/m2sci/macros/sci_files/sci_sin.bin new file mode 100755 index 000000000..d050b387c Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_sin.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_sin.sci b/modules/m2sci/macros/sci_files/sci_sin.sci new file mode 100755 index 000000000..0e1fb2bf6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sin.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_sin(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab sin() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="sin" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sinh.bin b/modules/m2sci/macros/sci_files/sci_sinh.bin new file mode 100755 index 000000000..11942d99b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_sinh.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_sinh.sci b/modules/m2sci/macros/sci_files/sci_sinh.sci new file mode 100755 index 000000000..fd79df1cc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sinh.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_sinh(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab sinh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="sinh" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_size.bin b/modules/m2sci/macros/sci_files/sci_size.bin new file mode 100755 index 000000000..8997ce5dc Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_size.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_size.sci b/modules/m2sci/macros/sci_files/sci_size.sci new file mode 100755 index 000000000..620be408d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_size.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_size(tree) + // M2SCI function + // Conversion function for Matlab size() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_size() + + // In Matlab : size('str1') = [1 4] but in Scilab : size('str1') = [1 1] + // so we convert expr to ascii code matrix which have good size + + + // m = size(X,dim) (If two inputs, then only one output) + if rhs==2 then + [X,dim]=getrhs(tree) + if or(X.vtype==[String,Unknown]) then + X = convert2double(X) + end + tree.rhs=Rhs_tlist(X,dim) + + // Matlab can work with dim > size(size(X),2) but not Scilab + if typeof(dim)=="cste" then + if dim.value>size(X.dims) then + set_infos(msprintf(gettext("M2SCI found: %s > size(size(%s),2),\nSo result is set to 1."),expression2code(dim),expression2code(X)),0) + tree=Cste(1) + else + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end + else + tree=Funcall("mtlb_size",1,list(X,dim),tree.lhs) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end + + // [d1,d2,d3,...,dn] = size(X) + else + X = getrhs(tree) + if or(X.vtype==[String,Unknown]) then + X = convert2double(X) + end + tree.rhs=Rhs_tlist(X) + + // d1 = size(X) + if lhs==1 then + tree.lhs(1).dims=list(1,size(X.dims)) + tree.lhs(1).type=Type(Double,Real) + + // [d1,d2,d3,...,dn] = size(X) + else + if size(tree.lhs)size(X.dims) then + // Number of outputs is greater than size(size(X),2) so mtlb_size() is called + tree=Funcall("mtlb_size",size(tree.lhs),list(X),tree.lhs) + end + for klhs=1:size(tree.lhs) + tree.lhs(klhs).dims=list(1,1) + tree.lhs(klhs).type=Type(Double,Real) + end + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sort.bin b/modules/m2sci/macros/sci_files/sci_sort.bin new file mode 100755 index 000000000..a844166eb Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_sort.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_sort.sci b/modules/m2sci/macros/sci_files/sci_sort.sci new file mode 100755 index 000000000..adb7e2ab1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sort.sci @@ -0,0 +1,138 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_sort(tree) + // M2SCI function + // Conversion function for Matlab sort() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_sort() + + // B = sort(A) or [B,IND] = sort(A) + if rhs==1 then + A = getrhs(tree) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + + if or(A.vtype==[String,Unknown]) then + tree.name="mtlb_sort" + elseif A.vtype==Boolean then + tree.name="gsort" + if is_a_vector(A) then + A = Funcall("bool2s",1,Rhs_tlist(A),list()) + tree.rhs=Rhs_tlist(A,"g","i") + elseif not_a_vector(A) then + A = Funcall("bool2s",1,Rhs_tlist(A),list()) + tree.rhs=Rhs_tlist(A,"r","i") + else + tree.name="mtlb_sort" + end + else + tree.name="gsort" + if is_a_vector(A) then + tree.rhs=Rhs_tlist(A,"g","i") + elseif not_a_vector(A) then + tree.rhs=Rhs_tlist(A,"r","i") + else + tree.name="mtlb_sort" + end + end + + if lhs==2 then + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(Double,Real) + end + // B = sort(A,dim) or [B,IND] = sort(A,dim) + elseif rhs==2 + [A,dim] = getrhs(tree) + dim = convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + + if size(A.dims)>2 then + set_infos(gettext("Scilab sort() and gsort() do not work with multidimensional arrays")) + else + name="gsort" + if typeof(dim)=="cste" then + if dim.value==1 then + dim=Cste("r") + elseif dim.value==2 then + dim=Cste("c") + else + name="mtlb_sort" + end + else + name="mtlb_sort" + end + + if or(A.vtype==[String,Unknown]) then + name="mtlb_sort" + elseif A.vtype==Boolean then + A = Funcall("bool2s",1,Rhs_tlist(A),list()) + tree.rhs=Rhs_tlist(A,dim,"i") + else + tree.rhs=Rhs_tlist(A,dim,"i") + end + tree.name=name + + if lhs==2 then + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(Double,Real) + end + end + elseif rhs==3 + [A,dim,txt] = getrhs(tree) + dim = convert2double(dim) + tree.rhs=Rhs_tlist(A,dim,txt) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + + if size(A.dims)>2 then + set_infos(gettext("Scilab sort() and gsort() do not work with multidimensional arrays")) + else + name="gsort" + if typeof(dim)=="cste" then + if dim.value==1 then + dim=Cste("r") + elseif dim.value==2 then + dim=Cste("c") + else + name="mtlb_sort" + end + else + name="mtlb_sort" + end + if or(A.vtype==[String,Unknown]) then + name="mtlb_sort" + elseif A.vtype==Boolean then + A = Funcall("bool2s",1,Rhs_tlist(A),list()) + tree.rhs(1)=A + end + + if txt.vtype==String & txt.value=="ascend" + tree.rhs=Rhs_tlist(A,dim,"i") + elseif txt.vtype==String & txt.value=="descend" + tree.rhs=Rhs_tlist(A,dim,"d") + else + name="mtlb_sort" + end + tree.name=name + + if lhs==2 then + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(Double,Real) + end + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sortrows.bin b/modules/m2sci/macros/sci_files/sci_sortrows.bin new file mode 100755 index 000000000..1e1b00b25 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_sortrows.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_sortrows.sci b/modules/m2sci/macros/sci_files/sci_sortrows.sci new file mode 100755 index 000000000..c9384f856 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sortrows.sci @@ -0,0 +1,35 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_sortrows(tree) + // M2SCI function + // Conversion function for Matlab sortrows() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.rhs)==1 then + if tree.rhs(1).vtype==4 + tree.rhs(1)=convert2double(tree.rhs(1)) + tree=Funcall("gsort",1,list(tree.rhs(1),Cste("lr"),Cste("i")),list(tree.lhs(:))) + elseif tree.rhs(1).vtype==Unknown + tree=Funcall("mtlb_sortrows",1,list(tree.rhs(1)),list(tree.lhs(:))) + else + tree=Funcall("gsort",1,list(tree.rhs(1),Cste("lr"),Cste("i")),list(tree.lhs(:))) + end + tree.lhs(1).infer=tree.rhs(1).infer + elseif size(tree.rhs)==2 then + tree=Funcall("mtlb_sortrows",1,list(tree.rhs(1),tree.rhs(2)),list(tree.lhs(:))) + end + + if size(tree.lhs)==2 then + tree.lhs(2).dims=list(tree.rhs(1).dims(1),1) + tree.lhs(2).type=Type(1,Real) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sparse.bin b/modules/m2sci/macros/sci_files/sci_sparse.bin new file mode 100755 index 000000000..0734b0c06 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_sparse.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_sparse.sci b/modules/m2sci/macros/sci_files/sci_sparse.sci new file mode 100755 index 000000000..8ed4d22bf --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sparse.sci @@ -0,0 +1,126 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_sparse(tree) + // M2SCI function + // Conversion function for Matlab sparse() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // nzmax does not exist in Scilab + if rhs==6 then + rhs=5 + set_infos(gettext("Call to sparse(): nzmax option ignored."),0) + end + + // S = sparse(A) + if rhs==1 then + A = getrhs(tree) + // %c_sparse and %b_sparse are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Sparse,A.property) + + // S = sparse(m,n) + elseif rhs==2 then + [m,n] = getrhs(tree) + // %c_sparse and %b_sparse are not defined + m = convert2double(m) + n = convert2double(n) + tree.rhs=Rhs_tlist([],[],Operation("rc",list(m,n),list())) + + dims=list(Unknown,Unknown) + if typeof(m)=="cste" then + dims(1)=m.value + end + if typeof(n)=="cste" then + dims(2)=n.value + end + tree.lhs(1).dims=dims + tree.lhs(1).type=Type(Sparse,Real) + + // S = sparse(i,j,s) + elseif rhs==3 then + [i,j,s] = getrhs(tree) + // %c_sparse and %b_sparse are not defined + i = convert2double(i) + j = convert2double(j) + s = convert2double(s) + tree.rhs=Rhs_tlist(i,j,s) + + // Matlab tolerates length(i)<>length(j)... + if size(i.dims)<>size(j.dims) | size(i.dims)<>size(s.dims) then + set_infos(gettext("For Scilab sparse(), input values must have the same size, not sure they have."),2) + end + + if i.dims(2)==1 & j.dims(2)==1 then + tree.rhs=Rhs_tlist(Operation("rc",list(i,j),list()),s) + elseif typeof(i)=="variable" & typeof(j)=="variable" then + tree.rhs=Rhs_tlist(Operation("rc",list(Operation("ext",list(i,Cste(":")),list()),Operation("ext",list(j,Cste(":")),list())),list()),s) + else + if typeof(i)<>"variable" then + V1=gettempvar(1) + insert(Equal(list(V1),i)) + else + V1=i + end + if typeof(j)<>"variable" then + V2=gettempvar(2) + insert(Equal(list(V2),j)) + else + V2=j + end + tree.rhs=Rhs_tlist(Operation("rc",list(Operation("ext",list(V1,Cste(":")),list()),Operation("ext",list(V2,Cste(":")),list())),list()),s) + end + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Sparse,s.property) + elseif rhs==4 then + // Can not happen + //S = sparse(i,j,s,m,n) + elseif rhs==5 then + + [i,j,s,m,n] = getrhs(tree) + i = convert2double(i) + j = convert2double(j) + s = convert2double(s) + m = convert2double(m) + n = convert2double(n) + + tree.rhs=Rhs_tlist(i,j,s,m,n) + + if i.dims(2)==1 & j.dims(2)=="1" then + tree.rhs=Rhs_tlist(Operation("rc",list(i,j),list()),s) + elseif typeof(i)=="variable" & typeof(j)=="variable" then + rhs1=Operation("rc",list(Operation("ext",list(i,Cste(":")),list()),Operation("ext",list(j,Cste(":")),list())),list()) + rhs3=Operation("rc",list(m,n),list()) + tree.rhs=Rhs_tlist(rhs1,s,rhs3) + else + if typeof(i)<>"variable" then + V1=gettempvar(1) + insert(Equal(list(V1),i)) + else + V1=i + end + if typeof(j)<>"variable" then + V2=gettempvar(2) + insert(Equal(list(V2),j)) + else + V2=j + end + rhs1=Operation("rc",list(Operation("ext",list(V1,Cste(":")),list()),Operation("ext",list(V2,Cste(":")),list())),list()) + rhs3=Operation("rc",list(m,n),list()) + tree.rhs=Rhs_tlist(rhs1,s,rhs3) + end + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Sparse,s.property) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sqrt.bin b/modules/m2sci/macros/sci_files/sci_sqrt.bin new file mode 100755 index 000000000..94a33d2fe Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_sqrt.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_sqrt.sci b/modules/m2sci/macros/sci_files/sci_sqrt.sci new file mode 100755 index 000000000..93eacf4d3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sqrt.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_sqrt(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab sqrt() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="sqrt" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_str2num.bin b/modules/m2sci/macros/sci_files/sci_str2num.bin new file mode 100755 index 000000000..8368aed55 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_str2num.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_str2num.sci b/modules/m2sci/macros/sci_files/sci_str2num.sci new file mode 100755 index 000000000..c50c27295 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_str2num.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function [tree]=sci_str2num(tree) + // M2SCI function + // Conversion function for Matlab str2num() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="evstr" + tree.lhs(1).type=Type(Double,Real) +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_strcmp.bin b/modules/m2sci/macros/sci_files/sci_strcmp.bin new file mode 100755 index 000000000..86ba2e7af Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_strcmp.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_strcmp.sci b/modules/m2sci/macros/sci_files/sci_strcmp.sci new file mode 100755 index 000000000..c7ba87778 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strcmp.sci @@ -0,0 +1,31 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_strcmp(tree) + // M2SCI function + // Conversion function for Matlab strcmp() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_strcmp() + + [A,B] = getrhs(tree) + + if A.vtype==String & B.vtype==String then + tree = Operation("==",list(A,B),tree.lhs) + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + elseif A.vtype<>Unknown & B.vtype<>Unknown then + // At least one argument is not a character string matrix in call of strcmp() so result is set to 0 + tree = Cste(%F) + else + tree.name="mtlb_strcmp" + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_strcmpi.bin b/modules/m2sci/macros/sci_files/sci_strcmpi.bin new file mode 100755 index 000000000..f9d94709f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_strcmpi.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_strcmpi.sci b/modules/m2sci/macros/sci_files/sci_strcmpi.sci new file mode 100755 index 000000000..3f76894b1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strcmpi.sci @@ -0,0 +1,33 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_strcmpi(tree) + // M2SCI function + // Conversion function for Matlab strcmpi() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_strcmpi() + + [A,B] = getrhs(tree) + + if A.vtype==String & B.vtype==String then + A = Funcall("convstr",1,Rhs_tlist(A),list()) + B = Funcall("convstr",1,Rhs_tlist(B),list()) + tree = Operation("==",list(A,B),tree.lhs) + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + elseif A.vtype<>Unknown & B.vtype<>Unknown then + // At least one argument is not a character string matrix in call of strcmpi() so result is set to 0 + tree = Cste(%F) + else + tree.name="mtlb_strcmpi" + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_strfind.bin b/modules/m2sci/macros/sci_files/sci_strfind.bin new file mode 100755 index 000000000..37538f0e1 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_strfind.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_strfind.sci b/modules/m2sci/macros/sci_files/sci_strfind.sci new file mode 100755 index 000000000..6b1e6c0d2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strfind.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_strfind(tree) + // M2SCI function + // Conversion function for Matlab strfind() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_strfind() + + [A,B] = getrhs(tree) + + if A.vtype==String & B.vtype==String then + tree.name="strindex" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + else + tree.name="mtlb_strfind" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_strrep.bin b/modules/m2sci/macros/sci_files/sci_strrep.bin new file mode 100755 index 000000000..67a04683e Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_strrep.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_strrep.sci b/modules/m2sci/macros/sci_files/sci_strrep.sci new file mode 100755 index 000000000..818e7a08b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strrep.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_strrep(tree) + // M2SCI function + // Conversion function for Matlab strrep() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_strrep() + + [s1,s2,s3] = getrhs(tree) + + if s1.vtype==String & s2.vtype==String & s3.vtype==String then + tree.name="strsubst" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(String,Real) + else + tree.name="mtlb_strrep" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Unknown,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_struct.bin b/modules/m2sci/macros/sci_files/sci_struct.bin new file mode 100755 index 000000000..a5943b4b8 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_struct.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_struct.sci b/modules/m2sci/macros/sci_files/sci_struct.sci new file mode 100755 index 000000000..e10d38414 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_struct.sci @@ -0,0 +1,81 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_struct(tree) + // M2SCI function + // Conversion function for Matlab struct() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).type=Type(Struct,Unknown) + + // Dims... + dims=tree.rhs(2).dims + for k=4:2:rhs + for l=1:lstsize(dims) + if tree.rhs(k).dims(l)==Unknown then + dims(l)=Unknown + else + if dims(l)<>Unknown then + if dims(l)Cell + end + if allnotcells then + dims=[1 1] + tree.lhs(1).dims=list(1,1) + else + for k=1:2:rhs + if tree.rhs(k+1).vtype==Cell then + if double(tree.rhs(k+1).dims(1))>dims(1) then + dims(1)=double(tree.rhs(k+1).dims(1)) + end + if double(tree.rhs(k+1).dims(2))>dims(2) then + dims(2)=double(tree.rhs(k+1).dims(2)) + end + end + end + end + + for k=1:2:rhs + dim1=dims(1) + dim2=dims(2) + for kd1=1:dims(1) + for kd2=1:dims(2) + if tree.rhs(k+1).vtype==Cell then + + if tree.rhs(k+1).dims(1)*tree.rhs(k+1).dims(2)<>1 then + tree.lhs(1).contents.index($+1)=list(list(Cste(kd1),Cste(kd2)),tree.rhs(k)) + tree.lhs(1).contents.data($+1)=get_contents_infer(tree.rhs(k+1),list(list(Cste(kd1),Cste(kd2)),Cste("entries"))) + else + tree.lhs(1).contents.index($+1)=list(list(Cste(kd1),Cste(kd2)),tree.rhs(k)) + tree.lhs(1).contents.data($+1)=get_contents_infer(tree.rhs(k+1),list(list(Cste(1),Cste(1)),Cste("entries"))) + end + + else + tree.lhs(1).contents.index($+1)=list(list(Cste(1),Cste(1)),tree.rhs(k)) + tree.lhs(1).contents.data($+1)=tree.rhs(k+1).infer + end + end + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_subplot.bin b/modules/m2sci/macros/sci_files/sci_subplot.bin new file mode 100755 index 000000000..3f43db1e4 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_subplot.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_subplot.sci b/modules/m2sci/macros/sci_files/sci_subplot.sci new file mode 100755 index 000000000..49a8c27ed --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_subplot.sci @@ -0,0 +1,15 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - INRIA - Serge STEER +// +// 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.1-en.txt +function [tree]=sci_subplot(tree) + // M2SCI function + // Conversion function for Matlab tic + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sum.bin b/modules/m2sci/macros/sci_files/sci_sum.bin new file mode 100755 index 000000000..a54652213 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_sum.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_sum.sci b/modules/m2sci/macros/sci_files/sci_sum.sci new file mode 100755 index 000000000..7221fb027 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sum.sci @@ -0,0 +1,82 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_sum(tree) + // File generated from sci_PROTO8.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab sum() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_sum() + + // B = sum(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_sum and %C_sum are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_a_vector(A) | is_empty(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.lhs(1).dims=list(1,A.dims(2)) + tree.rhs=Rhs_tlist(A,1) + elseif not_empty(A) then + dim = first_non_singleton(A) + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + tree.lhs(1).dims=allunknown(A.dims) + end + else + tree.name="mtlb_sum" + tree.lhs(1).dims=allunknown(A.dims) + end + + // B = sum(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_sum and %C_sum are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + // Scilab sum() does not work when dim is greater than number of dims A + tree.name="mtlb_sum" + tree.lhs(1).dims=allunknown(A.dims) + else + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + end + else + tree.name="mtlb_sum" + tree.lhs(1).dims=allunknown(A.dims) + end + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_surf.bin b/modules/m2sci/macros/sci_files/sci_surf.bin new file mode 100755 index 000000000..a7e4343ef Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_surf.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_surf.sci b/modules/m2sci/macros/sci_files/sci_surf.sci new file mode 100755 index 000000000..c3502f1e7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_surf.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_surf(tree) + // M2SCI function + // Conversion function for Matlab surf() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if tree.lhs(1).name <> "ans" then + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("gce",1,list(),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + else + tree.lhs(1).type=Type(Handle,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_svd.bin b/modules/m2sci/macros/sci_files/sci_svd.bin new file mode 100755 index 000000000..1bd726756 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_svd.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_svd.sci b/modules/m2sci/macros/sci_files/sci_svd.sci new file mode 100755 index 000000000..628ec27e5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_svd.sci @@ -0,0 +1,39 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_svd(tree) + // M2SCI function + // Conversion function for Matlab svd() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // svd(X) + if rhs==1 then + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + // svd(A,0) + else + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A,"e") + end + + tree.lhs(1).dims=list(Unknown,1) + tree.lhs(1).type=Type(Double,Real) + if lhs>1 then + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(2).type=A.type + end + if lhs>2 then + tree.lhs(3).dims=list(Unknown,Unknown) + tree.lhs(3).type=Type(Double,Unknown) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_tan.bin b/modules/m2sci/macros/sci_files/sci_tan.bin new file mode 100755 index 000000000..8e39a6485 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_tan.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_tan.sci b/modules/m2sci/macros/sci_files/sci_tan.sci new file mode 100755 index 000000000..3dc49705d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tan.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_tan(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab tan() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="tan" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_tanh.bin b/modules/m2sci/macros/sci_files/sci_tanh.bin new file mode 100755 index 000000000..89b42e38b Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_tanh.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_tanh.sci b/modules/m2sci/macros/sci_files/sci_tanh.sci new file mode 100755 index 000000000..9f6748a04 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tanh.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_tanh(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab tanh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="tanh" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_tic.bin b/modules/m2sci/macros/sci_files/sci_tic.bin new file mode 100755 index 000000000..def989292 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_tic.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_tic.sci b/modules/m2sci/macros/sci_files/sci_tic.sci new file mode 100755 index 000000000..c7cc9b4c8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tic.sci @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_tic(tree) + // M2SCI function + // Conversion function for Matlab tic + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_title.bin b/modules/m2sci/macros/sci_files/sci_title.bin new file mode 100755 index 000000000..e1118ab3f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_title.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_title.sci b/modules/m2sci/macros/sci_files/sci_title.sci new file mode 100755 index 000000000..0dee821ef --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_title.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_title(tree) + // M2SCI function + // Conversion function for Matlab title() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name == "ans" then + tree.lhs(1).type=Type(Handle,Unknown) + else + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("get",1,list(Funcall("gca",1,list(),list()),"""title"""),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_toc.bin b/modules/m2sci/macros/sci_files/sci_toc.bin new file mode 100755 index 000000000..ac0c3118d Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_toc.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_toc.sci b/modules/m2sci/macros/sci_files/sci_toc.sci new file mode 100755 index 000000000..d9e433cfa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_toc.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_toc(tree) + // M2SCI function + // Conversion function for Matlab toc + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_toeplitz.bin b/modules/m2sci/macros/sci_files/sci_toeplitz.bin new file mode 100755 index 000000000..45976425a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_toeplitz.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_toeplitz.sci b/modules/m2sci/macros/sci_files/sci_toeplitz.sci new file mode 100755 index 000000000..b4e5b20e6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_toeplitz.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_toeplitz(tree) + // M2SCI function + // Conversion function for Matlab toeplitz() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // T = toeplitz(c) + if rhs==1 then + c=tree.rhs(1) + if c.property<>Real then + tree.name="mtlb_toeplitz" + elseif ~is_a_vector(c) & ~is_a_scalar(c) then + tree.name="mtlb_toeplitz" + end + tree.rhs(1)=c + tree.lhs(1).type=Type(Double,c.property) + // T = toeplitz(c,r) + else + [c,r]=getrhs(tree) + tree.rhs=Rhs_tlist(c, r) + tree.name="mtlb_toeplitz" + if c.property==Complex | r.property==Complex then + tree.lhs(1).type=Type(Double,Complex) + elseif c.property==Real | r.property==Real then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_tril.bin b/modules/m2sci/macros/sci_files/sci_tril.bin new file mode 100755 index 000000000..ee7b88cc5 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_tril.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_tril.sci b/modules/m2sci/macros/sci_files/sci_tril.sci new file mode 100755 index 000000000..4dcae6faf --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tril.sci @@ -0,0 +1,46 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_tril(tree) + // File generated from sci_PROTO7.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab tril() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_tril() + + // L = tril(X,k) + if rhs==2 then + [X,k] = getrhs(tree) + // Convert k to double + k=convert2double(k) + tree.rhs=Rhs_tlist(X,k) + // L = tril(X) + else + X = getrhs(tree) + end + + // Common part + if or(X.vtype==[String,Unknown]) then + tree.name="mtlb_tril" + else + if X.vtype==Boolean then + X=Funcall("bool2s",1,Rhs_tlist(X),list(Variable("",X.infer))) + tree.rhs(1)=X + end + end + + if isempty(strindex(tree.name,"triu")) then + tree.lhs(1).type=X.type + else + tree.lhs(1).type=Type(X.vtype,Unknown) + end + tree.lhs(1).dims=X.dims + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_triu.bin b/modules/m2sci/macros/sci_files/sci_triu.bin new file mode 100755 index 000000000..0acb7208f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_triu.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_triu.sci b/modules/m2sci/macros/sci_files/sci_triu.sci new file mode 100755 index 000000000..7fa409d19 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_triu.sci @@ -0,0 +1,46 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_triu(tree) + // File generated from sci_PROTO7.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab triu() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_triu() + + // L = triu(X,k) + if rhs==2 then + [X,k] = getrhs(tree) + // Convert k to double + k=convert2double(k) + tree.rhs=Rhs_tlist(X,k) + // L = triu(X) + else + X = getrhs(tree) + end + + // Common part + if or(X.vtype==[String,Unknown]) then + tree.name="mtlb_triu" + else + if X.vtype==Boolean then + X=Funcall("bool2s",1,Rhs_tlist(X),list(Variable("",X.infer))) + tree.rhs(1)=X + end + end + + if isempty(strindex(tree.name,"triu")) then + tree.lhs(1).type=X.type + else + tree.lhs(1).type=Type(X.vtype,Unknown) + end + tree.lhs(1).dims=X.dims + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_true.bin b/modules/m2sci/macros/sci_files/sci_true.bin new file mode 100755 index 000000000..c0f0ddc86 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_true.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_true.sci b/modules/m2sci/macros/sci_files/sci_true.sci new file mode 100755 index 000000000..138a1aa4c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_true.sci @@ -0,0 +1,176 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_true(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab true() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_true() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // true(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("ones",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // true([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("ones",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // true(n) or true([n1,n2,...]) ? + else + tree.name="mtlb_true" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // true(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="ones" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_type.bin b/modules/m2sci/macros/sci_files/sci_type.bin new file mode 100755 index 000000000..76653c648 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_type.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_type.sci b/modules/m2sci/macros/sci_files/sci_type.sci new file mode 100755 index 000000000..aa3bb326e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_type.sci @@ -0,0 +1,20 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_type(tree) + // M2SCI function + // Conversion function for Matlab type() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_type() + + set_infos(msprintf(gettext("No simple equivalent, so %s() is called."),"mtlb_type"),0); + tree.name="mtlb_type" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_uigetdir.bin b/modules/m2sci/macros/sci_files/sci_uigetdir.bin new file mode 100755 index 000000000..145041410 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_uigetdir.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_uigetdir.sci b/modules/m2sci/macros/sci_files/sci_uigetdir.sci new file mode 100755 index 000000000..f83befeb0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uigetdir.sci @@ -0,0 +1,21 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_uigetdir(tree) + // M2SCI function + // Conversion function for Matlab uigetdir() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="uigetdir" + + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_uint16.bin b/modules/m2sci/macros/sci_files/sci_uint16.bin new file mode 100755 index 000000000..51f5c1b42 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_uint16.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_uint16.sci b/modules/m2sci/macros/sci_files/sci_uint16.sci new file mode 100755 index 000000000..fc0d473d9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uint16.sci @@ -0,0 +1,55 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_uint16(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab uint16() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_uint16() + + // %c_uint16 and %b_uint16 are not defined in Scilab + x = getrhs(tree) + + // Matlab uint16() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint16","uint16"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint16","uint16"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_uint16" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_uint32.bin b/modules/m2sci/macros/sci_files/sci_uint32.bin new file mode 100755 index 000000000..b5f5ad71f Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_uint32.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_uint32.sci b/modules/m2sci/macros/sci_files/sci_uint32.sci new file mode 100755 index 000000000..dc056d9e3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uint32.sci @@ -0,0 +1,55 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_uint32(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab uint32() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_uint32() + + // %c_uint32 and %b_uint32 are not defined in Scilab + x = getrhs(tree) + + // Matlab uint32() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint32","uint32"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint32","uint32"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_uint32" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_uint8.bin b/modules/m2sci/macros/sci_files/sci_uint8.bin new file mode 100755 index 000000000..fc022cb22 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_uint8.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_uint8.sci b/modules/m2sci/macros/sci_files/sci_uint8.sci new file mode 100755 index 000000000..6c2ca635d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uint8.sci @@ -0,0 +1,55 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_uint8(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab uint8() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_uint8() + + // %c_uint8 and %b_uint8 are not defined in Scilab + x = getrhs(tree) + + // Matlab uint8() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint8","uint8"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint8","uint8"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_uint8" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_unix.bin b/modules/m2sci/macros/sci_files/sci_unix.bin new file mode 100755 index 000000000..44c5426f9 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_unix.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_unix.sci b/modules/m2sci/macros/sci_files/sci_unix.sci new file mode 100755 index 000000000..dc9ae4309 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_unix.sci @@ -0,0 +1,49 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_unix(tree) + // M2SCI function + // Conversion function for Matlab unix() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + if rhs==2 then + tree.rhs(2)=null() + end + + if lhs==1 then + V=gettempvar(2) + S=tree.lhs(1) + if S.name=="ans" then + S=gettempvar(1) + tree.lhs=list(V,S) + else + tree.lhs=list(V,S) + end + insert(Equal(tree.lhs,tree)) + tree=list() + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(S),list())),1) + end + else + tree.lhs=list(tree.lhs($:-1:1)) + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(tree.lhs(1),tree.lhs(2)),list())),1) + end + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(String,Real) + + tree.lhs(2).dims=list(1,1) + tree.lhs(2).type=Type(Double,Real) + + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_upper.bin b/modules/m2sci/macros/sci_files/sci_upper.bin new file mode 100755 index 000000000..3e57680bd Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_upper.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_upper.sci b/modules/m2sci/macros/sci_files/sci_upper.sci new file mode 100755 index 000000000..75f7a3e5c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_upper.sci @@ -0,0 +1,37 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_upper(tree) + // M2SCI function + // Conversion function for Matlab upper() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_upper() + + opt=part("upper",1) + + A = getrhs(tree) + if A.vtype==String then + tree.name="convstr" + tree.rhs=Rhs_tlist(A,opt) + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + elseif A.vtype==Unknown then + tree.name="mtlb_upper" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + else + if typeof(A)=="funcall" then + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + A.out=tree.lhs + end + tree=A + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_vertcat.bin b/modules/m2sci/macros/sci_files/sci_vertcat.bin new file mode 100755 index 000000000..bdf613133 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_vertcat.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_vertcat.sci b/modules/m2sci/macros/sci_files/sci_vertcat.sci new file mode 100755 index 000000000..1aa3d1915 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_vertcat.sci @@ -0,0 +1,64 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_vertcat(tree) + // M2SCI function + // Conversion function for Matlab vertcat() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + allargs=tree.rhs + out=tree.lhs + + tree=Operation("cc",list(allargs(1),allargs(2)),list()) + + // Create output + for k=3:rhs + tree=Operation("cc",list(tree,allargs(k)),list()) + end + tree.out=out + + // Dimensions + outdims=allargs(1).dims + for k=1:lstsize(outdims) + outdims(k)=Unknown + end + for k=1:rhs + for l=1:lstsize(allargs(k).dims) + if l<>1 & allargs(k).dims(l)<>Unknown then + outdims(l)=allargs(k).dims(l) + end + end + end + nbrows=0 + for k=1:rhs + if allargs(k).dims(1)<>Unknown then + nbrows=nbrows+allargs(k).dims(1) + else + nbrows=Unknown + break + end + end + outdims(1)=nbrows + + // Property + prop=Real + for k=1:rhs + if allargs(k).property==Complex then + prop=Complex + break + elseif allargs(k).property==Unknown then + prop=Unknown + break + end + end + + tree.out(1).dims=outdims + tree.out(1).type=Type(allargs(1).vtype,prop) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.bin b/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.bin new file mode 100755 index 000000000..002f5090a Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.sci b/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.sci new file mode 100755 index 000000000..28c108a8a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.sci @@ -0,0 +1,31 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_waitforbuttonpress(tree) + // M2SCI function + // Conversion function for Matlab waitforbuttonpress() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + btn=gettempvar() + xc=gettempvar() + yc=gettempvar() + win=gettempvar() + str=gettempvar() + + insert(Equal(list(btn,xc,yc,win,str),Funcall("xclick",1,list(),list()))) + + comp=Operation(">",list(btn,Cste(64)),list()) + + tree=Funcall("bool2s",1,list(comp),tree.lhs) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_warning.bin b/modules/m2sci/macros/sci_files/sci_warning.bin new file mode 100755 index 000000000..e7bc30cbf Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_warning.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_warning.sci b/modules/m2sci/macros/sci_files/sci_warning.sci new file mode 100755 index 000000000..aa2a6430d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_warning.sci @@ -0,0 +1,47 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_warning(tree) + // M2SCI function + // Conversion function for Matlab warning() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // warning + if rhs==0 then + // s = warning + if lhs==1 then + tree.rhs(1)=Cste("query") + // [s,f] = warning + else + insert(Equal(list(tree.lhs(2)),Cste("once"))) + tree.rhs(1)=Cste("query"); + tree.lhs(2)=null(); + end + elseif rhs<=2 then + if rhs==2 then + // First arg is a msg_id + set_infos(gettext("message_id ignored in following line."),2) + tree.rhs(1)=Cste(tree.rhs(1).value+" "+tree.rhs(2).value) + tree.rhs(2)=null() + end + + if typeof(tree.rhs(1))=="cste" & or(convstr(tree.rhs(1).value)==["""on""","""off""","""backtrace""","""debug""","""once""","""always"""]) then + if tree.lhs(1).name<>"ans" then + no_equiv(msprintf(gettext("%s: Output value set to ''on''."),expression2code(tree))) + tree=Cste("on") + else + no_equiv(expression2code(tree)) + end + end + // rhs >= 3 + else + no_equiv(expression2code(tree)) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_who.bin b/modules/m2sci/macros/sci_files/sci_who.bin new file mode 100755 index 000000000..b95bf0a6c Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_who.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_who.sci b/modules/m2sci/macros/sci_files/sci_who.sci new file mode 100755 index 000000000..603d9f361 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_who.sci @@ -0,0 +1,37 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_who(tree) + // M2SCI function + // Conversion function for Matlab who() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + k=1 + while k<=size(tree.rhs) + if tree.rhs(k).value=="" then + tree.rhs(k)=null() + end + k=k+1 + end + + if size(tree.rhs)==0 then + // Nothing to do + else + select tree.rhs(1).value + case "global" then + // Nothing to do + case "-file" then + no_equiv(expression2code(tree)) + else + no_equiv(expression2code(tree)) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_whos.bin b/modules/m2sci/macros/sci_files/sci_whos.bin new file mode 100755 index 000000000..0fcb48415 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_whos.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_whos.sci b/modules/m2sci/macros/sci_files/sci_whos.sci new file mode 100755 index 000000000..4a2feab00 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_whos.sci @@ -0,0 +1,37 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_whos(tree) + // M2SCI function + // Conversion function for Matlab whos() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + k=1 + while k<=size(tree.rhs) + if tree.rhs(k).value=="" then + tree.rhs(k)=null() + end + k=k+1 + end + + if size(tree.rhs)==0 then + // Nothing to do + else + select tree.rhs(1).value + case "global" then + // Nothing to do + case "-file" then + no_equiv(expression2code(tree)) + else + no_equiv(expression2code(tree)) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_winqueryreg.bin b/modules/m2sci/macros/sci_files/sci_winqueryreg.bin new file mode 100755 index 000000000..6acaff4dc Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_winqueryreg.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_winqueryreg.sci b/modules/m2sci/macros/sci_files/sci_winqueryreg.sci new file mode 100755 index 000000000..9e14ca667 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_winqueryreg.sci @@ -0,0 +1,21 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_winqueryreg(tree) + // M2SCI function + // Conversion function for Matlab winqueryreg + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // Matlab returns a Cell of strings or a int32 + // Scilab returns a matrix of strings or a int32 + tree.lhs(1).dims=list(Unknown,1); + tree.lhs(1).type=Type(Unknown,Real); + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_xlabel.bin b/modules/m2sci/macros/sci_files/sci_xlabel.bin new file mode 100755 index 000000000..b76452638 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_xlabel.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_xlabel.sci b/modules/m2sci/macros/sci_files/sci_xlabel.sci new file mode 100755 index 000000000..28f47c90f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_xlabel.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_xlabel(tree) + // M2SCI function + // Conversion function for Matlab xlabel() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name == "ans" then + tree.lhs(1).type=Type(Handle,Unknown) + else + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("get",1,list(Funcall("gca",1,list(),list()),"""x_label"""),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + end + +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_ylabel.bin b/modules/m2sci/macros/sci_files/sci_ylabel.bin new file mode 100755 index 000000000..5dd1ab5aa Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_ylabel.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_ylabel.sci b/modules/m2sci/macros/sci_files/sci_ylabel.sci new file mode 100755 index 000000000..021aa862d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ylabel.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_ylabel(tree) + // M2SCI function + // Conversion function for Matlab ylabel() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name == "ans" then + tree.lhs(1).type=Type(Handle,Unknown) + else + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("get",1,list(Funcall("gca",1,list(),list()),"""y_label"""),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + end + +endfunction \ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_zeros.bin b/modules/m2sci/macros/sci_files/sci_zeros.bin new file mode 100755 index 000000000..b8f5ae2f7 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_zeros.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_zeros.sci b/modules/m2sci/macros/sci_files/sci_zeros.sci new file mode 100755 index 000000000..0ea7eac20 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_zeros.sci @@ -0,0 +1,176 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - 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.1-en.txt + +function [tree]=sci_zeros(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab zeros() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_zeros() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // zeros(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("zeros",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // zeros([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("zeros",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // zeros(n) or zeros([n1,n2,...]) ? + else + tree.name="mtlb_zeros" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // zeros(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="zeros" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_zlabel.bin b/modules/m2sci/macros/sci_files/sci_zlabel.bin new file mode 100755 index 000000000..98ed26ca1 Binary files /dev/null and b/modules/m2sci/macros/sci_files/sci_zlabel.bin differ diff --git a/modules/m2sci/macros/sci_files/sci_zlabel.sci b/modules/m2sci/macros/sci_files/sci_zlabel.sci new file mode 100755 index 000000000..b5d5bb563 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_zlabel.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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.1-en.txt + +function tree=sci_zlabel(tree) + // M2SCI function + // Conversion function for Matlab zlabel() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name == "ans" then + tree.lhs(1).type=Type(Handle,Unknown) + else + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("get",1,list(Funcall("gca",1,list(),list()),"""z_label"""),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + end + +endfunction diff --git a/modules/m2sci/macros/translatepaths.bin b/modules/m2sci/macros/translatepaths.bin new file mode 100755 index 000000000..4ab22c6de Binary files /dev/null and b/modules/m2sci/macros/translatepaths.bin differ diff --git a/modules/m2sci/macros/translatepaths.sci b/modules/m2sci/macros/translatepaths.sci new file mode 100755 index 000000000..80c74512b --- /dev/null +++ b/modules/m2sci/macros/translatepaths.sci @@ -0,0 +1,218 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// Copyright (C) ???? - INRIA - Serge STEER +// +// 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.1-en.txt + +function transorder=translatepaths(Paths,res_path) + // Perform translation of Matlab M-files to Scilab for all M-files found in Paths + + // Output : + // -transorder : a vector which contains the files names with a determinated order + // Input : + // -Paths : a vector of strings (paths of Matlab M-files to translate) + // -res_paths : a string (resolution path of translated files) + + // M2SCI kernel functions called: + // -lst_funcall + // -translateorder + // - mfile2sci + + // Get default arguments + + [lhs,rhs]=argn(0) + if rhs<2 then res_path="./",end + if rhs<1 then m2sci_gui();transorder=[];return;end + + // Loads libraries related to m2sci + if exists("m2skernellib")==0 then load("SCI/modules/m2sci/macros/kernel/lib"),end + if exists("m2spercentlib")==0 then load("SCI/modules/m2sci/macros/percent/lib"),end + if exists("m2ssci_fileslib")==0 then load("SCI/modules/m2sci/macros/sci_files/lib"),end + + // Convert paths so that they can be used according to the platform + + sep = filesep(); + if getos() == "Windows" then + Paths=strsubst(Paths,"/",sep) + res_path=strsubst(res_path,"/",sep) + else + Paths=strsubst(Paths,"\",sep) + res_path=strsubst(res_path,"\",sep) + end + + // Close resolution path with a / or a \ + res_path=stripblanks(res_path) + if part(res_path,length(res_path))<>sep then + res_path=res_path+sep + end + + // Create a logfile and a whatis file + Paths=stripblanks(Paths) + [tempfd,ierr]=file("open",pathconvert(TMPDIR)+gettext("unitfile.dat"),"old"); + + if ierr==0 then + load(pathconvert(TMPDIR)+gettext("unitfile.dat")) + file("close",whsfil_unit); + file("close",tempfd); + mdelete(pathconvert(TMPDIR)+gettext("unitfile.dat")) + end + + whsfil_unit=file("open",res_path+"whatis","unknown") + save(pathconvert(TMPDIR)+gettext("unitfile.dat"),whsfil_unit) + // Close paths with a / or a \ + for k=1:size(Paths,"*") + if part(Paths(k),length(Paths(k)))<>sep then + Paths(k)=Paths(k)+sep, + end + end + + // Find names of files to translate + // mfiles is a vector which contains the names (and the paths) of files to translate + mfiles=[] + for k=1:size(Paths,"*") + path = Paths(k); + mfiles = [mfiles; ls(path+"*.m")]; + end + + // fnamvect is a vector which contains all M-files names (just the names) found in Paths + // filefuncallname is a list of vectors. The first component of each vector is the name of a M-file (found in the Path(s)) to translate, followed by the called functions by this M-file) + fnamvect=[] + filefuncallname=list() + for k1=1:size(mfiles,1) + kk=strindex(mfiles(k1),sep) + fnamvect=[fnamvect;part(mfiles(k1),kk($)+1:length(mfiles(k1))-2)] + end + + for k1=1:size(mfiles,1) + mpath=mfiles(k1) + // disp(gettext("********************lst_funcall**********************")) + // disp(mpath) + filefuncallname($+1)=lst_funcall(mpath,fnamvect) + end + + // Determination of a translation order for the M-files found in the Paths + // transorder is a vector containing the M-files names which are arranged to order to respect an priority order of translation + transorder=[] + for i=1:size(filefuncallname) + execstr(filefuncallname(i)(1)+"vect=filefuncallname(i)") + end + + overfunname=[] + for i=1:size(filefuncallname) + execstr("transorder=translateorder(transorder,"+filefuncallname(i)(1)+"vect,overfunname)") + end + + // funpath is a vector which contains the M-files names (ands their paths) to translate + funpath=[] + for i=1:size(transorder,1) + ind=find(transorder(i)==fnamvect) + if ind<>[] then + funpath=[funpath;mfiles(ind)] + end + end + + // Translation is done only if M-file has changed + logtxt=[] + resumelogtxt=""; + + for i=1:size(funpath,1) + kk=strindex(funpath(i),sep) + mpath=funpath(i) + fnam=part(funpath(i),kk($)+1:length(funpath(i))-2) + scipath=res_path+fnam+".sci" + scepath=res_path+fnam+".sce" + + if newest(mpath,scipath,scepath)==1 then + [fd,ierr]=file("open",pathconvert(TMPDIR)+fnam+".m","old"); + if ierr==0 & strindex(mpath,TMPDIR)==[] then + mfile2sci(pathconvert(TMPDIR)+fnam+".m",res_path, %t, %t) + file("close",fd) + mdelete(pathconvert(TMPDIR)+fnam+".m") + rmdir(pathconvert(TMPDIR)+pathconvert(fnam),"s") + else + mfile2sci(funpath(i),res_path, %t, %t) + end + + tmp_sci_file=pathconvert(TMPDIR)+"tmp_"+fnam+".sci" + ierr=execstr("exec(tmp_sci_file)","errcatch");errclear(); + if ierr==0 & strindex(mpath,TMPDIR)==[] then + txt=[] + txt=mgetl(scipath) + txt=[txt;" ";mgetl(tmp_sci_file)] + mputl(txt,scipath); + mdelete(tmp_sci_file) + end + + // LOG + tmp_m2sci_file=pathconvert(TMPDIR)+"tmp_m2sci_"+fnam+".log" + m2scipath=res_path+"m2sci_"+fnam+".log" + logtxt=[logtxt;" ";" ";mgetl(m2scipath)] + mdelete(m2scipath) + + [fd,ierr]=file("open",tmp_m2sci_file,"old"); + if ierr==0 & strindex(mpath,TMPDIR)==[] then + logtxt=[logtxt;" ";mgetl(tmp_m2sci_file)] + file("close",fd) + mdelete(tmp_m2sci_file) + end + + // RESUMELOG + tmp_resume_m2sci_file=pathconvert(TMPDIR)+"tmp_resume_m2sci_"+fnam+".log" + resumem2scipath=res_path+"resume_m2sci_"+fnam+".log" + if fileinfo(resumem2scipath)<>[] then + resumelogtxt=[resumelogtxt;" ";" ";mgetl(resumem2scipath)] + mdelete(resumem2scipath) + end + + [fd,ierr]=file("open",tmp_resume_m2sci_file,"old"); + if ierr==0 & strindex(mpath,TMPDIR)==[] then + resumelogtxt=[resumelogtxt;" ";mgetl(tmp_resume_m2sci_file)] + file("close",fd) + mdelete(tmp_resume_m2sci_file) + end + end + if isempty(logtxt) then + logtxt = "" + end + mputl(logtxt,res_path+"log"); + if isempty(resumelogtxt) then + resumelogtxt = "" + end + mputl(resumelogtxt,res_path+"resumelog"); + end + + // File closing + file("close",whsfil_unit); + mdelete(pathconvert(TMPDIR)+gettext("unitfile.dat")) + + // create builder.sce and loader.sce files + // get the directory name where the Scilab functions are written + if res_path=="./" then + current_path=pathconvert(unix_g("pwd")) + index_slash=strindex(current_path,"/") + if size(index_slash,"*")==1 then index_slash=[0 index_slash],end + namelib=part(current_path,index_slash($-1)+1:index_slash($)-1) + else + index_slash=strindex(res_path,"/") + if size(index_slash,"*")==1 then index_slash=[0 index_slash],end + namelib=part(res_path,index_slash($-1)+1:index_slash($)-1) + end + + //builder.sce + buildertxt=[] + buildertxt($+1)="path=get_absolute_file_path(""builder.sce"")" + buildertxt($+1)="genlib("""+namelib+"lib"",path)" + builderfile=res_path+"builder.sce" + mputl(buildertxt,builderfile); + //loader.sce + loadertxt=[] + loadertxt($+1)="path=get_absolute_file_path(""loader.sce"")" + loadertxt($+1)="load(path+"+"""lib"")" + loaderfile=res_path+"loader.sce" + mputl(loadertxt,loaderfile); + +endfunction -- cgit