1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2// Copyright (C) INRIA - Vincent COUVERT 3// Copyright (C) 2012 - 2016 - Scilab Enterprises 4// Copyright (C) 2020 - Samuel GOUGEON 5// 6// This file is hereby licensed under the terms of the GNU GPL v2.0, 7// pursuant to article 5.3.4 of the CeCILL v.2.1. 8// This file was originally licensed under the terms of the CeCILL v2.1, 9// and continues to be available under such terms. 10// For more information, see the COPYING file which you should have received 11// along with this program. 12 13function t = cat_code(a,b) 14 15 // Catenate two parts of code (called by tree2code) 16 // Input: 17 // - a: original code 18 // - b: code to add to a 19 // Output: 20 // - t: catenation of a and b 21 22 if a==[] then 23 t = b 24 elseif b==[] then 25 t = a 26 elseif stripblanks(b)=="" then // b=="" then add a new line 27 t = [a ; ""]; 28 else 29 if a($) <> "" & part(a($),$-1:$)<>"; " & grep(b(1), "|^\s*//|","r")==[] 30 a($) = a($) + ", " // Separating instructions on the same line 31 end // without endsymbol 32 t = [a(1:$-1) ; a($)+b(1) ; b(2:$)] 33 end 34endfunction 35