1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) Scilab Enterprises - 201é - Clément DAVID
//
// This file is distributed under the same license as the Scilab package.
// <-- ENGLISH IMPOSED -->
// <-- XCOS TEST -->
//
// <-- Short Description -->
// Check the API of multiple Xcos hooks, see SEP_066_Xcos_hooks.odt
global status;
status = [];
function continueSimulation = pre1(scs_m, needcompile)
global status;
[linenum,mac]=where();
status = [status mac(1)];
continueSimulation=%t;
endfunction
function continueSimulation = pre2(scs_m, needcompile)
global status;
[linenum,mac]=where();
status = [status mac(1)];
continueSimulation=%t;
endfunction
function continueSimulation = pre3(scs_m, needcompile)
global status;
[linenum,mac]=where();
status = [status mac(1)];
continueSimulation=%t;
endfunction
function post1(%cpr, scs_m, needcompile)
global status;
[linenum,mac]=where();
status = [status mac(1)];
endfunction
function post2(%cpr, scs_m, needcompile)
global status;
[linenum,mac]=where();
status = [status mac(1)];
endfunction
// register the hooks
pre_xcos_simulate=list('pre1', 'pre2', 'pre3');
post_xcos_simulate=list('post1', 'post2');
assert_checktrue(importXcosDiagram(SCI + "/modules/xcos/demos/Simple_Demo.zcos"));
xcos_simulate(scs_m, 4);
assert_checkequal(status, ['pre1', 'pre2', 'pre3', 'post1', 'post2'])
ans =
T
|