sb120: #i111190# disabled failing tests for now

-o sw.CharacterStyle
-o sw.ConditionalParagraphStyle
-o sw.PageStyle
-o sw.ParagraphStyle
-o sw.SwAccessibleDocumentPageView
#i86751 -o sw.SwAccessibleDocumentView
#i111185 -o sw.SwAccessibleEndnoteView
-o sw.SwAccessibleFooterView
#i111185 -o sw.SwAccessibleFootnoteView
-o sw.SwAccessibleHeaderView
#i89022 -o sw.SwAccessiblePageView
-o sw.SwAccessibleParagraphView
-o sw.SwAccessibleTableCellView
#i85634 -o sw.SwAccessibleTableView
#i111178 -o sw.SwAccessibleTextEmbeddedObject
#i111178 -o sw.SwAccessibleTextFrameView
-o sw.SwAccessibleTextGraphicObject
-o sw.SwXAutoTextContainer
-o sw.SwXAutoTextEntry
-o sw.SwXAutoTextGroup
#i111185 -o sw.SwXBodyText
-o sw.SwXBookmark
-o sw.SwXBookmarks
-o sw.SwXCell
-o sw.SwXCellRange
-o sw.SwXChapterNumbering
#i111185 -o sw.SwXDocumentIndex
#i111185 -o sw.SwXDocumentIndexMark
-o sw.SwXDocumentIndexes
-o sw.SwXDrawPage
#i111185 -o sw.SwXEndnoteProperties
-o sw.SwXFieldEnumeration
-o sw.SwXFieldMaster
#i111185 -o sw.SwXFootnote
#i111185 -o sw.SwXFootnoteProperties
#i111185 -o sw.SwXFootnoteText
#i111185 -o sw.SwXFootnotes
-o sw.SwXFrames
#i111185 -o sw.SwXHeadFootText
-o sw.SwXLineNumberingProperties
#i85640 -o sw.SwXMailMerge
-o sw.SwXModule
-o sw.SwXNumberingRules
#i103696 -o sw.SwXParagraph
-o sw.SwXParagraphEnumeration
-o sw.SwXPrintSettings
-o sw.SwXPropertySet
-o sw.SwXPropertySetInfo
-o sw.SwXReferenceMark
-o sw.SwXReferenceMarks
#i111190 -o sw.SwXShape
-o sw.SwXStyleFamilies
-o sw.SwXStyleFamily
#i111185 -o sw.SwXTableCellText
-o sw.SwXTableColumns
-o sw.SwXTableRows
-o sw.SwXTextColumns
-o sw.SwXTextCursor
#i89021 -o sw.SwXTextDefaults
#i111185 -o sw.SwXTextDocument
-o sw.SwXTextEmbeddedObject
-o sw.SwXTextEmbeddedObjects
-o sw.SwXTextField
-o sw.SwXTextFieldMasters
-o sw.SwXTextFieldTypes
-o sw.SwXTextFrame
#i111185 -o sw.SwXTextFrameText
-o sw.SwXTextGraphicObject
-o sw.SwXTextGraphicObjects
#i103696 -o sw.SwXTextPortion
-o sw.SwXTextPortionEnumeration
-o sw.SwXTextRange
-o sw.SwXTextRanges
-o sw.SwXTextSearch
-o sw.SwXTextSection
-o sw.SwXTextSections
-o sw.SwXTextTable
-o sw.SwXTextTableCursor
-o sw.SwXTextTableRow
-o sw.SwXTextTables
#i85580 -o sw.SwXTextView
-o sw.SwXTextViewCursor
-o sw.SwXViewSettings
-o sw.XMLContentExporter
#i23394 -o sw.XMLContentImporter
-o sw.XMLExporter
-o sw.XMLImporter
#i23394 -o sw.XMLMetaExporter
-o sw.XMLMetaImporter
-o sw.XMLSettingsExporter
-o sw.XMLSettingsImporter
-o sw.XMLStylesExporter
#i23394 -o sw.XMLStylesImporter
-o sw.DocumentSettings

-o sw.CharacterStyle
-o sw.ConditionalParagraphStyle
-o sw.PageStyle
-o sw.ParagraphStyle
-o sw.SwAccessibleDocumentPageView
#i86751 -o sw.SwAccessibleDocumentView
#i111185 -o sw.SwAccessibleEndnoteView
-o sw.SwAccessibleFooterView
#i111185 -o sw.SwAccessibleFootnoteView
-o sw.SwAccessibleHeaderView
#i89022 -o sw.SwAccessiblePageView
-o sw.SwAccessibleParagraphView
-o sw.SwAccessibleTableCellView
#i85634 -o sw.SwAccessibleTableView
#i111178 -o sw.SwAccessibleTextEmbeddedObject
#i111178 -o sw.SwAccessibleTextFrameView
-o sw.SwAccessibleTextGraphicObject
-o sw.SwXAutoTextContainer
-o sw.SwXAutoTextEntry
-o sw.SwXAutoTextGroup
#i111185 -o sw.SwXBodyText
-o sw.SwXBookmark
-o sw.SwXBookmarks
-o sw.SwXCell
-o sw.SwXCellRange
-o sw.SwXChapterNumbering
#i111185 -o sw.SwXDocumentIndex
#i111185 -o sw.SwXDocumentIndexMark
-o sw.SwXDocumentIndexes
-o sw.SwXDrawPage
#i111185 -o sw.SwXEndnoteProperties
-o sw.SwXFieldEnumeration
-o sw.SwXFieldMaster
#i111185 -o sw.SwXFootnote
#i111185 -o sw.SwXFootnoteProperties
#i111185 -o sw.SwXFootnoteText
#i111185 -o sw.SwXFootnotes
-o sw.SwXFrames
#i111185 -o sw.SwXHeadFootText
-o sw.SwXLineNumberingProperties
#i85640 -o sw.SwXMailMerge
-o sw.SwXModule
-o sw.SwXNumberingRules
#i103696 -o sw.SwXParagraph
-o sw.SwXParagraphEnumeration
-o sw.SwXPrintSettings
-o sw.SwXPropertySet
-o sw.SwXPropertySetInfo
-o sw.SwXReferenceMark
-o sw.SwXReferenceMarks
-o sw.SwXShape
-o sw.SwXStyleFamilies
-o sw.SwXStyleFamily
#i111185 -o sw.SwXTableCellText
-o sw.SwXTableColumns
-o sw.SwXTableRows
-o sw.SwXTextColumns
-o sw.SwXTextCursor
#i89021 -o sw.SwXTextDefaults
#i111185 -o sw.SwXTextDocument
-o sw.SwXTextEmbeddedObject
-o sw.SwXTextEmbeddedObjects
-o sw.SwXTextField
-o sw.SwXTextFieldMasters
-o sw.SwXTextFieldTypes
-o sw.SwXTextFrame
#i111185 -o sw.SwXTextFrameText
-o sw.SwXTextGraphicObject
-o sw.SwXTextGraphicObjects
#i103696 -o sw.SwXTextPortion
-o sw.SwXTextPortionEnumeration
-o sw.SwXTextRange
-o sw.SwXTextRanges
-o sw.SwXTextSearch
-o sw.SwXTextSection
-o sw.SwXTextSections
-o sw.SwXTextTable
-o sw.SwXTextTableCursor
-o sw.SwXTextTableRow
-o sw.SwXTextTables
#i85580 -o sw.SwXTextView
-o sw.SwXTextViewCursor
-o sw.SwXViewSettings
-o sw.XMLContentExporter
#i23394 -o sw.XMLContentImporter
-o sw.XMLExporter
-o sw.XMLImporter
#i23394 -o sw.XMLMetaExporter
-o sw.XMLMetaImporter
-o sw.XMLSettingsExporter
-o sw.XMLSettingsImporter
-o sw.XMLStylesExporter
#i23394 -o sw.XMLStylesImporter
-o sw.DocumentSettings


User block name too long fix

User block name too long fix

function mdaq_block_add(block_def)

    if type(block_def) <> 17 then
        disp("ERROR: Wrong type of input argument!");
        if type(block_def) == 13 then
            disp("Input argument type is function - use ''block = mdaq_block()'' instead of ''block = mdaq_block''")
        else
            disp("Use mdaq_block() function to create initialized block sctructure!")
        end
        return;
    end

    if size(block_def.in, 'r' ) > 1 then
        if size(block_def.in, 'c' ) > 1 then
            disp("ERROR: Wrong block ''in'' parameter - one dimentional array expected!");
            return;
        end
        block_def.in = block_def.in';
    end

    if size(block_def.out, 'r' ) > 1 then
        if size(block_def.out, 'c' ) > 1 then
            disp("ERROR: Wrong block ''out'' parameter - one dimentional array expected!")
            return;
        end
        block_def.out = block_def.out';
    end

    if length(block_def.name) > 20 then
        disp("ERROR: Block name too long!");
        return;
    end

    path = dirname(get_function_path('mdaq_block_add')) + filesep();
    module_path = part(path,1:length(path)-length("macros") - 1 );
    SCRIPT_FILE_ROOT = path + 'user_blocks' + filesep();
    C_FILE_ROOT = module_path+'src'+filesep()+'c'+ filesep()+'userlib'+filesep();
    IMAGE_FILE_ROOT = module_path + filesep() + 'images' + filesep();

    // =============================PREPARE INPUT=====================================
    params_size = max(size(block_def.param_name));
    params_size_size = max(size(block_def.param_size));
    params_def_val_size = max(size(block_def.param_def_val));
    in_size = max(size(block_def.in));
    out_size = max(size(block_def.out));

    if block_def.in(1) < 1 then
        in_size = 0;
    end

    if block_def.out(1) < 1 then
        out_size = 0;
    end

    //If user did not enter enough information about size of parameters then
    //we set it to default 1.
    if params_size > params_size_size then
        sizes = ones(1:params_size)';
        sizes(1:params_size_size) = block_def.param_size;
        block_def.param_size = sizes;
    end

    //If user did not enter enough information about default parameters value then
    //we set it to default 0.
    def_val = list();
    for i=1:params_size
        def_val(i) = zeros(1:block_def.param_size(i))';

        if i <= params_def_val_size then
            i_params_def_val_size = max(size(block_def.param_def_val(i)));
            def_val(i)(1:i_params_def_val_size) = block_def.param_def_val(i);
        end
    end

    block_def.param_def_val = def_val;

    // if block name changed without desc - change block name in desc
    if block_def.desc == "Set new_block parameters" then
        block_def.desc = strsubst(block_def.desc, "new_block", block_def.name);
    end

    // =============================GENERATE STRINGS=====================================
    // converted params
    params_converted = [];

    // script file
    params_string1 = [];
    params_string2 = [];
    params_string3 = [];
    params_string4 = [];
    params_string5 = [];

    //default values string
    params_string6 = [];

    // C file
    in_ports_string = [];
    out_ports_string = [];
    params_c_string = [];

    name_converted = convstr(block_def.name,'l');
    name_converted = strsubst(name_converted, ' ', '_');
    name_converted = 'mdaq_' + name_converted;

    for i = 1:params_size
        // Remove spaces and convert to lower case
        params_converted(i) = convstr(block_def.param_name(i),'l')
        params_converted(i) = strsubst(params_converted(i), ' ', '_')
        params_converted(i) = strsubst(params_converted(i), ';', '_')
        params_converted(i) = strsubst(params_converted(i), ':', '_')
        params_converted(i) = strsubst(params_converted(i), ',', '_')
        params_converted(i) = strsubst(params_converted(i), '.', '_')

        params_string1 = params_string1 + params_converted(i)+',';
        params_string2 = params_string2 + ''''+block_def.param_name(i)+':'';';
        params_string3 = params_string3 + '''vec'','+ string(block_def.param_size(i)) + ',';
        params_string4 = params_string4 + 'sci2exp(' + params_converted(i) + ');';
        params_string5 = params_string5 + params_converted(i)+';';

        i_def_param_size = max(size(block_def.param_def_val(i)));
        i_param_def_string = [];

        for j = 1:block_def.param_size(i)
            i_param_def_string = i_param_def_string + string(block_def.param_def_val(i)(j))+';';
        end

        //default values string
        params_string6(i) = '       '+params_converted(i)+' = ['+i_param_def_string+'];';

    end

    //delete last character ','
    params_string3 = part(params_string3, 1:(length(params_string3)-1) );

    in_string = '';
    out_string = '';

    if  in_size > 0 then
        for i = 1:(in_size-1)
            in_string = in_string + string(block_def.in(i)) + ';';
        end
        in_string = in_string + string(block_def.in(in_size));
    end

    if  out_size > 0 then
        for i = 1:(out_size-1)
            out_string = out_string + string(block_def.out(i)) + ';';
        end
        out_string = out_string + string(block_def.out(out_size));
    end

    block_v_size = 3;
    if max([out_size in_size]) > 2 then
        block_v_size = block_v_size + (max([out_size in_size]) - 2);
    end

    block_h_size = 4;
    if length(block_def.name) > 8 then
        block_h_size = block_h_size + ((length(block_def.name) - 8) * 0.2);
    end

    // =============================GENERATE SCRIPT=====================================
    // TODO define default params value
    //  (block_def.name).sci script generator
    block_script = [
    '// Generated with MicroDAQ toolbox ver: ' + mdaq_get_version() + '';
    'function [x,y,typ] = '+ name_converted + '(job,arg1,arg2)';
    '   block_desc = [''' + block_def.desc + ''';';
    '   '''';]';
    '';
    '   x=[];y=[];typ=[];';
    '   select job';
    '   case ''set'' then';
    '       x=arg1;';];
    if params_size > 0 then
        block_script = [block_script;
        '       model=arg1.model;';
        '       graphics=arg1.graphics;';
        '       exprs=graphics.exprs;';
        '';
        '       while %t do';
        '           try';
        '               getversion(''scilab'');';
        '               [ok,'+params_string1+'exprs]=..'
        '               scicos_getvalue( block_desc,..';
        '               ['+params_string2+'],..';
        '               list('+params_string3+'), exprs)';
        '           catch';
        '               [ok,'+params_string1+'exprs]=..'
        '               getvalue(block_desc,..';
        '               ['+params_string2+'],..';
        '               list('+params_string3+'), exprs);';
        '           end;';
        '';
        '       if ~ok then';
        '              break';
        '       end';
        '';
        '       if ok then';
        '           [model,graphics,ok] = check_io(model,graphics, ['+in_string+'], ['+out_string+'], 1, []);';
        '           graphics.exprs = exprs;';
        '           model.rpar = ['+params_string5+'];';
        '           model.ipar = [];';
        '           model.dstate = [];';
        '           x.graphics = graphics;';
        '           x.model = model;';
        '           break';
        '       end';
        '';
        '   end'];
    end
    block_script = [block_script; '   case ''define'' then';
    params_string6;
    '       model=scicos_model();'
    '       model.sim=list('''+name_converted+'_sim'',5);';
    '       model.in=['+in_string+'];';
    '       model.in2=1;';
    '       model.out=['+out_string+'];';
    '       model.out2=1;';
    '       model.outtyp=1;';
    '       model.intyp=1;';
    '       model.evtin=1;';
    '       model.rpar=['+params_string5+'];';
    '       model.ipar=[];';
    '       model.dstate=[];';
    '       model.blocktype=''d'';';
    '       model.dep_ut=[%t %f];';
    '       exprs=['+params_string4+'];';
    '       gr_i=[''xstringb(orig(1),orig(2),['''''''' ; ],sz(1),sz(2),''''fill'''');''];';
    '       x=standard_define([' + string(block_h_size) + ' '+string(block_v_size)+'],model,exprs,gr_i);';
    '       x.graphics.in_implicit=[];';
    '       x.graphics.exprs=exprs;';
    '       x.graphics.style=[""blockWithLabel;verticalLabelPosition=center;displayedLabel=' + block_def.name + '""]';
    '   end';
    'endfunction';
    ];

    // =============================GENERATE SIM SCRIPT=====================================
    //  (block_def.name)_sim.sci script generator
    block_script_sim = [
    '// Generated with MicroDAQ toolbox ver: ' + mdaq_get_version() + '';
    'function block='+name_converted+'_sim(block,flag)';
    'select flag';

    '   case -5 // Error';
    '   case 0 // Derivative State Update';
    '   case 1 // Output Update';
    '   case 2 // State Update';
    '   case 3 // OutputEventTiming';
    '   case 4 // Initialization';
    '   case 5 // Ending';
    '   case 6 // Re-Initialisation';
    '   case 9 // ZeroCrossing';
    '   else // Unknown flag';
    'end';
    'endfunction';
    ];

    // save scripts
    file_name = SCRIPT_FILE_ROOT+name_converted+'.sci';
    save_string(file_name, block_script);

    file_name = SCRIPT_FILE_ROOT+name_converted+'_sim.sci';
    save_string(file_name, block_script_sim);

    // =============================GENERATE C FILE =====================================
    l = 1;
    n_lines = 3;

    if in_size > 0 then
        in_ports_string(1) = '    /* Block input ports */';
        for i = 2:n_lines:(in_size*n_lines+1)
            in_ports_string(i) = '    double *u'+string(l)+' = GetRealInPortPtrs(block,'+string(l)+');';
            in_ports_string(i+1) = '    int u' +string(l)+ '_size = GetInPortRows(block,'+ string(l)+');'+...
            '    /* u' + string(l)+ '_size = '+string(block_def.in(l))+' */';
            in_ports_string(i+2) = '';
            l = l + 1;
        end
    end

    l = 1;

    if out_size > 0 then
        out_ports_string(1) = '    /* Block output ports */';
        for i = 2:n_lines:(out_size*n_lines+1)
            out_ports_string(i) = '    double *y'+string(l)+' = GetRealOutPortPtrs(block,'+string(l)+');';
            out_ports_string(i+1) = '    int y'+string(l)+'_size = GetOutPortRows(block,'+string(l)+');'+....
            '    /* y' + string(l)+ '_size = '+string(block_def.out(l))+' */';
            out_ports_string(i+2) = '';
            l = l + 1;
        end
    end

    index = 0;
    n_lines = 2;
    l = 1;
    for i = 1:n_lines:(params_size*n_lines)
        if  block_def.param_size(l) == 1 then
            params_c_string(i) = '    /* param size = 1 */';
            params_c_string(i+1) =  '    double '+params_converted(l)+' = params['+string(index)+'];';
        else
            params_c_string(i) = '    int '+params_converted(l)+'_size = '+string(block_def.param_size(l))+';';
            params_c_string(i+1) =  '    double *'+params_converted(l)+' = &params['+string(index)+'];';
        end

        index = index + block_def.param_size(l);
        l = l + 1;
    end

    block_c_file = [
    '/* Generated with MicroDAQ toolbox ver: ' + mdaq_get_version() + ' */';
    '#include '"scicos_block4.h'"';
    '';
    '';
    'extern double get_scicos_time( void );';
    '';
    '/* This function will executed once at the beginning of model execution */'
    'static void init(scicos_block *block)';
    '{';
    '    /* Block parameters */';
    '    double *params = GetRparPtrs(block);';
    '';
    params_c_string;
    '';
    '    /* Add block init code here */';
    '}';
    '';
    '/* This function will be executed on every model step */';
    'static void inout(scicos_block *block)';
    '{';
    '    /* Block parameters */';
    '    double *params = GetRparPtrs(block);';
    params_c_string;
    '';
    in_ports_string;
    out_ports_string;
    '';
    '    /* Add block code here (executed every model step) */';
    '';
    '}';
    '';
    '/* This function will be executed once at the end of model execution (only in Ext mode) */'
    'static void end(scicos_block *block)';
    '{';
    '    /* Prameters */';
    '    double *params = GetRparPtrs(block);';
    '';
    params_c_string;
    '';
    '    /* Add block end code here */';
    '}';
    '';
    'void '+name_converted+'(scicos_block *block,int flag)';
    '{';
    '    if (flag == 1){            /* set output */';
    '        inout(block);';
    '    }';
    '    else if (flag == 5){       /* termination */';
    '        end(block);';
    '    }';
    '    else if (flag == 4){       /* initialisation */';
    '        init(block);';
    '    }';
    '}';
    ]

    file_name = C_FILE_ROOT+name_converted+'.c';
    save_string(file_name, block_c_file);

    svg_path = IMAGE_FILE_ROOT + 'svg' + filesep();
    gen_svg(svg_path, name_converted, block_def.name);

    tbx_build_macros("microdaq", SCRIPT_FILE_ROOT);
    blocks = name_converted;

    p_dir = pwd();
    cd(module_path);
    tbx_build_blocks(module_path, blocks, "macros" + filesep() + "user_blocks");

    // userlib compilation
    mdaq_block_build();

    cd(p_dir);
endfunction

function res = save_string(filename, content)
    [f,res] = mopen(filename,'w');
    if res == 0 then
        mprintf(" ### Generating %s\n", filename);
        mputl(content,f)
        mclose(f)
    end
endfunction

function gen_svg(path,filename,label);
    doc = xmlRead(path+'mdaq_template.svg');

    // Label handle
    node = doc.root.children(13).children(1);
    node.content = "";
    xmlDump(node);
    xmlWrite(doc,path+filename+'.svg');
    xmlDelete(doc);
endfunction

function mdaq_block_add(block_def)

    if type(block_def) <> 17 then
        disp("ERROR: Wrong type of input argument!");
        if type(block_def) == 13 then
            disp("Input argument type is function - use ''block = mdaq_block()'' instead of ''block = mdaq_block''")
        else
            disp("Use mdaq_block() function to create initialized block sctructure!")
        end
        return;
    end

    if size(block_def.in, 'r' ) > 1 then
        if size(block_def.in, 'c' ) > 1 then
            disp("ERROR: Wrong block ''in'' parameter - one dimentional array expected!");
            return;
        end
        block_def.in = block_def.in';
    end

    if size(block_def.out, 'r' ) > 1 then
        if size(block_def.out, 'c' ) > 1 then
            disp("ERROR: Wrong block ''out'' parameter - one dimentional array expected!")
            return;
        end
        block_def.out = block_def.out';
    end

    path = dirname(get_function_path('mdaq_block_add')) + filesep();
    module_path = part(path,1:length(path)-length("macros") - 1 );
    SCRIPT_FILE_ROOT = path + 'user_blocks' + filesep();
    C_FILE_ROOT = module_path+'src'+filesep()+'c'+ filesep()+'userlib'+filesep();
    IMAGE_FILE_ROOT = module_path + filesep() + 'images' + filesep();

    // =============================PREPARE INPUT=====================================
    params_size = max(size(block_def.param_name));
    params_size_size = max(size(block_def.param_size));
    params_def_val_size = max(size(block_def.param_def_val));
    in_size = max(size(block_def.in));
    out_size = max(size(block_def.out));

    if block_def.in(1) < 1 then
        in_size = 0;
    end

    if block_def.out(1) < 1 then
        out_size = 0;
    end

    //If user did not enter enough information about size of parameters then
    //we set it to default 1.
    if params_size > params_size_size then
        sizes = ones(1:params_size)';
        sizes(1:params_size_size) = block_def.param_size;
        block_def.param_size = sizes;
    end

    //If user did not enter enough information about default parameters value then
    //we set it to default 0.
    def_val = list();
    for i=1:params_size
        def_val(i) = zeros(1:block_def.param_size(i))';

        if i <= params_def_val_size then
            i_params_def_val_size = max(size(block_def.param_def_val(i)));
            def_val(i)(1:i_params_def_val_size) = block_def.param_def_val(i);
        end
    end

    block_def.param_def_val = def_val;

    // if block name changed without desc - change block name in desc
    if block_def.desc == "Set new_block parameters" then
        block_def.desc = strsubst(block_def.desc, "new_block", block_def.name);
    end

    // =============================GENERATE STRINGS=====================================
    // converted params
    params_converted = [];

    // script file
    params_string1 = [];
    params_string2 = [];
    params_string3 = [];
    params_string4 = [];
    params_string5 = [];

    //default values string
    params_string6 = [];

    // C file
    in_ports_string = [];
    out_ports_string = [];
    params_c_string = [];

    name_converted = convstr(block_def.name,'l');
    name_converted = strsubst(name_converted, ' ', '_');
    name_converted = 'mdaq_' + name_converted;

    for i = 1:params_size
        // Remove spaces and convert to lower case
        params_converted(i) = convstr(block_def.param_name(i),'l')
        params_converted(i) = strsubst(params_converted(i), ' ', '_')
        params_converted(i) = strsubst(params_converted(i), ';', '_')
        params_converted(i) = strsubst(params_converted(i), ':', '_')
        params_converted(i) = strsubst(params_converted(i), ',', '_')
        params_converted(i) = strsubst(params_converted(i), '.', '_')

        params_string1 = params_string1 + params_converted(i)+',';
        params_string2 = params_string2 + ''''+block_def.param_name(i)+':'';';
        params_string3 = params_string3 + '''vec'','+ string(block_def.param_size(i)) + ',';
        params_string4 = params_string4 + 'sci2exp(' + params_converted(i) + ');';
        params_string5 = params_string5 + params_converted(i)+';';

        i_def_param_size = max(size(block_def.param_def_val(i)));
        i_param_def_string = [];

        for j = 1:block_def.param_size(i)
            i_param_def_string = i_param_def_string + string(block_def.param_def_val(i)(j))+';';
        end

        //default values string
        params_string6(i) = '       '+params_converted(i)+' = ['+i_param_def_string+'];';

    end

    //delete last character ','
    params_string3 = part(params_string3, 1:(length(params_string3)-1) );

    in_string = '';
    out_string = '';

    if  in_size > 0 then
        for i = 1:(in_size-1)
            in_string = in_string + string(block_def.in(i)) + ';';
        end
        in_string = in_string + string(block_def.in(in_size));
    end

    if  out_size > 0 then
        for i = 1:(out_size-1)
            out_string = out_string + string(block_def.out(i)) + ';';
        end
        out_string = out_string + string(block_def.out(out_size));
    end

    block_v_size = 3;
    if max([out_size in_size]) > 2 then
        block_v_size = block_v_size + (max([out_size in_size]) - 2);
    end

    block_h_size = 4;
    if length(block_def.name) > 8 then
        block_h_size = block_h_size + ((length(block_def.name) - 8) * 0.2);
    end

    // =============================GENERATE SCRIPT=====================================
    // TODO define default params value
    //  (block_def.name).sci script generator
    block_script = [
    '// Generated with MicroDAQ toolbox ver: ' + mdaq_get_version() + '';
    'function [x,y,typ] = '+ name_converted + '(job,arg1,arg2)';
    '   block_desc = [''' + block_def.desc + ''';';
    '   '''';]';
    '';
    '   x=[];y=[];typ=[];';
    '   select job';
    '   case ''set'' then';
    '       x=arg1;';];
   if params_size > 0 then
         block_script = [block_script;
    '       model=arg1.model;';
    '       graphics=arg1.graphics;';
    '       exprs=graphics.exprs;';
    '';
    '       while %t do';
    '           try';
    '               getversion(''scilab'');';
    '               [ok,'+params_string1+'exprs]=..'
    '               scicos_getvalue( block_desc,..';
    '               ['+params_string2+'],..';
    '               list('+params_string3+'), exprs)';
    '           catch';
    '               [ok,'+params_string1+'exprs]=..'
    '               getvalue(block_desc,..';
    '               ['+params_string2+'],..';
    '               list('+params_string3+'), exprs);';
    '           end;';
    '';
    '       if ~ok then';
    '              break';
    '       end';
    '';
    '       if ok then';
    '           [model,graphics,ok] = check_io(model,graphics, ['+in_string+'], ['+out_string+'], 1, []);';
    '           graphics.exprs = exprs;';
    '           model.rpar = ['+params_string5+'];';
    '           model.ipar = [];';
    '           model.dstate = [];';
    '           x.graphics = graphics;';
    '           x.model = model;';
    '           break';
    '       end';
    '';
    '   end'];
    end
    block_script = [block_script; '   case ''define'' then';
    params_string6;
    '       model=scicos_model();'
    '       model.sim=list('''+name_converted+'_sim'',5);';
    '       model.in=['+in_string+'];';
    '       model.in2=1;';
    '       model.out=['+out_string+'];';
    '       model.out2=1;';
    '       model.outtyp=1;';
    '       model.intyp=1;';
    '       model.evtin=1;';
    '       model.rpar=['+params_string5+'];';
    '       model.ipar=[];';
    '       model.dstate=[];';
    '       model.blocktype=''d'';';
    '       model.dep_ut=[%t %f];';
    '       exprs=['+params_string4+'];';
    '       gr_i=[''xstringb(orig(1),orig(2),['''''''' ; ],sz(1),sz(2),''''fill'''');''];';
    '       x=standard_define([' + string(block_h_size) + ' '+string(block_v_size)+'],model,exprs,gr_i);';
    '       x.graphics.in_implicit=[];';
    '       x.graphics.exprs=exprs;';
    '       x.graphics.style=[""blockWithLabel;verticalLabelPosition=center;displayedLabel=' + block_def.name + '""]';
    '   end';
    'endfunction';
    ];

    // =============================GENERATE SIM SCRIPT=====================================
    //  (block_def.name)_sim.sci script generator
    block_script_sim = [
    '// Generated with MicroDAQ toolbox ver: ' + mdaq_get_version() + '';
    'function block='+name_converted+'_sim(block,flag)';
    'select flag';

    '   case -5 // Error';
    '   case 0 // Derivative State Update';
    '   case 1 // Output Update';
    '   case 2 // State Update';
    '   case 3 // OutputEventTiming';
    '   case 4 // Initialization';
    '   case 5 // Ending';
    '   case 6 // Re-Initialisation';
    '   case 9 // ZeroCrossing';
    '   else // Unknown flag';
    'end';
    'endfunction';
    ];

    // save scripts
    file_name = SCRIPT_FILE_ROOT+name_converted+'.sci';
    save_string(file_name, block_script);

    file_name = SCRIPT_FILE_ROOT+name_converted+'_sim.sci';
    save_string(file_name, block_script_sim);

    // =============================GENERATE C FILE =====================================
    l = 1;
    n_lines = 3;

    if in_size > 0 then
     in_ports_string(1) = '    /* Block input ports */';
     for i = 2:n_lines:(in_size*n_lines+1)
            in_ports_string(i) = '    double *u'+string(l)+' = GetRealInPortPtrs(block,'+string(l)+');';
            in_ports_string(i+1) = '    int u' +string(l)+ '_size = GetInPortRows(block,'+ string(l)+');'+...
                                   '    /* u' + string(l)+ '_size = '+string(block_def.in(l))+' */';
            in_ports_string(i+2) = '';
            l = l + 1;
        end
    end

    l = 1;

    if out_size > 0 then
        out_ports_string(1) = '    /* Block output ports */';
        for i = 2:n_lines:(out_size*n_lines+1)
            out_ports_string(i) = '    double *y'+string(l)+' = GetRealOutPortPtrs(block,'+string(l)+');';
            out_ports_string(i+1) = '    int y'+string(l)+'_size = GetOutPortRows(block,'+string(l)+');'+....
                                    '    /* y' + string(l)+ '_size = '+string(block_def.out(l))+' */';
            out_ports_string(i+2) = '';
            l = l + 1;
        end
    end

    index = 0;
    n_lines = 2;
    l = 1;
    for i = 1:n_lines:(params_size*n_lines)
        if  block_def.param_size(l) == 1 then
            params_c_string(i) = '    /* param size = 1 */';
            params_c_string(i+1) =  '    double '+params_converted(l)+' = params['+string(index)+'];';
        else
            params_c_string(i) = '    int '+params_converted(l)+'_size = '+string(block_def.param_size(l))+';';
            params_c_string(i+1) =  '    double *'+params_converted(l)+' = &params['+string(index)+'];';
        end

        index = index + block_def.param_size(l);
        l = l + 1;
    end

    block_c_file = [
    '/* Generated with MicroDAQ toolbox ver: ' + mdaq_get_version() + ' */';
    '#include '"scicos_block4.h'"';
    '';
    '';
    'extern double get_scicos_time( void );';
    '';
    '/* This function will executed once at the beginning of model execution */'
    'static void init(scicos_block *block)';
    '{';
    '    /* Block parameters */';
    '    double *params = GetRparPtrs(block);';
    '';
    params_c_string;
    '';
    '    /* Add block init code here */';
    '}';
    '';
    '/* This function will be executed on every model step */';
    'static void inout(scicos_block *block)';
    '{';
    '    /* Block parameters */';
    '    double *params = GetRparPtrs(block);';
    params_c_string;
    '';
    in_ports_string;
    out_ports_string;
    '';
    '    /* Add block code here (executed every model step) */';
    '';
    '}';
    '';
    '/* This function will be executed once at the end of model execution (only in Ext mode) */'
    'static void end(scicos_block *block)';
    '{';
    '    /* Prameters */';
    '    double *params = GetRparPtrs(block);';
    '';
    params_c_string;
    '';
    '    /* Add block end code here */';
    '}';
    '';
    'void '+name_converted+'(scicos_block *block,int flag)';
    '{';
    '    if (flag == 1){            /* set output */';
    '        inout(block);';
    '    }';
    '    else if (flag == 5){       /* termination */';
    '        end(block);';
    '    }';
    '    else if (flag == 4){       /* initialisation */';
    '        init(block);';
    '    }';
    '}';
    ]

    file_name = C_FILE_ROOT+name_converted+'.c';
    save_string(file_name, block_c_file);

    svg_path = IMAGE_FILE_ROOT + 'svg' + filesep();
    gen_svg(svg_path, name_converted, block_def.name);

    tbx_build_macros("microdaq", SCRIPT_FILE_ROOT);
    blocks = name_converted;

    p_dir = pwd();
    cd(module_path);
    tbx_build_blocks(module_path, blocks, "macros" + filesep() + "user_blocks");

    // userlib compilation
    mdaq_block_build();

    cd(p_dir);
endfunction

function res = save_string(filename, content)
    [f,res] = mopen(filename,'w');
    if res == 0 then
        mprintf(" ### Generating %s\n", filename);
        mputl(content,f)
        mclose(f)
    end
endfunction

function gen_svg(path,filename,label);
    doc = xmlRead(path+'mdaq_template.svg');

    // Label handle
    node = doc.root.children(13).children(1);
    node.content = "";
    xmlDump(node);
    xmlWrite(doc,path+filename+'.svg');
    xmlDelete(doc);
endfunction


INTEGRATION: CWS components1 (1.6.200); FILE MERGED 2006/10/13 08:15:40 af 1.6.200.1: #i68075# Adaption to recent controller restructuring.

-o sd.SdXImpressDocument
-o sd.SdXCustomPresentationAccess
###i35935### -o sd.AccessibleDrawDocumentView
-o sd.AccessibleOutlineView
###i35935### -o sd.AccessibleSlideView
-o sd.SdDocLinkTargets
-o sd.SdDrawPage
-o sd.SdGenericDrawPage
-o sd.SdLayer
-o sd.SdLayerManager
-o sd.SdMasterPage
-o sd.SdMasterPagesAccess
-o sd.SdPageLinkTargets
-o sd.SdXCustomPresentation
-o sd.SdXPresentation
-o sd.SdXShape
-o sd.SdDrawPagesAccess
-o sd.DrawController_DrawView
-o sd.DrawController_HandoutView
-o sd.DrawController_NotesView
-o sd.DrawController_OutlineView
-o sd.DrawController_PresentationView

###i46734###-o sd.SdUnoSlideView
-o sd.SdXImpressDocument
-o sd.SdXCustomPresentationAccess
-o sd.SdUnoOutlineView
-o sd.SdUnoPresView
###i35935### -o sd.AccessibleDrawDocumentView
-o sd.AccessibleOutlineView
###i35935### -o sd.AccessibleSlideView
-o sd.SdDocLinkTargets
-o sd.SdDrawPage
-o sd.SdGenericDrawPage
-o sd.SdLayer
-o sd.SdLayerManager
-o sd.SdMasterPage
-o sd.SdMasterPagesAccess
-o sd.SdPageLinkTargets
-o sd.SdXCustomPresentation
-o sd.SdXPresentation
-o sd.SdXShape
-o sd.SdUnoDrawView
-o sd.SdDrawPagesAccess


Omitting bank dir params on E2000

Omitting bank dir params on E2000

It closes issue 34 from MLink repo

// Generated with MicroDAQ toolbox ver: 1.0.
function [x,y,typ] = mdaq_dio_config(job,arg1,arg2)
    global %microdaq;
    block_desc = ['This block sets DIO alternative functions';
    'and DIO bank direction.';
    '';
    'DIO alternative functions setting:';
    '0 - disable DIO alternative function (set DIO function)';
    '1 - enable DIO alternative function';
    '';
    'DIO bank direction setting:';
    '0 - configure DIO bank as an OUTPUT';
    '1 - configure DIO bank as an INPUT';
    '';
    'Warning: This block has limitations due to hardware.';
    'In case of MicroDaq E2000 bank direction is fixed. These'
    'parameters will be omitted.'
    '';
    "Set block parameters:"];

    x=[];y=[];typ=[];
    select job
    case 'set' then
        x=arg1;
        model=arg1.model;
        graphics=arg1.graphics;
        exprs=graphics.exprs;

        while %t do
            try
                getversion('scilab');
                [ok,enc1,enc2,pwm1,pwm2,pwm3,uart,bank_1_direction,bank_2_direction,bank_3_direction,bank_4_direction,exprs]=..
                scicos_getvalue( block_desc,..
                ['ENC1 function:';'ENC2 function:';'PWM1 function:';..
                'PWM2 function:';'PWM3 function:';'UART function:';..
                'DIO1...8 direction:';'DIO9...16 direction:';..
                'DIO17...24 direction:';'DIO25...32 direction:';],..
                list('vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1), exprs)
            catch
                [ok,enc1,enc2,pwm1,pwm2,pwm3,uart,bank_1_direction,bank_2_direction,bank_3_direction,bank_4_direction,exprs]=..
                getvalue(block_desc,..
                ['ENC1 function:';'ENC2 function:';'PWM1 function:';..
                'PWM2 function:';'PWM3 function:';'UART function:';..
                'DIO1...8 direction:';'DIO9...16 direction:';..
                'DIO17...24 direction:';'DIO25...32 direction:';],..
                list('vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1), exprs);
            end;

            if ~ok then
                break
            end

            if bank_1_direction == 0 then
                if uart | enc1 | enc2 then
                    ok = %f;
                    message("Bank 1 configured as an OUTPUT - unable set selected DIO alternative functions!")
                end
            end

            if bank_2_direction <> 0 then
                if uart | pwm1 | pwm2 | pwm3 then
                    ok = %f;
                    message("Bank 2 configured as an INPUT - unable set selected DIO alternative functions!")
                end
            end

            if %microdaq.private.mdaq_hwid(1) == 2000 then
                bank_1_direction = 1;
                bank_2_direction = 0;
            end

            if ok then
                [model,graphics,ok] = check_io(model,graphics, [], [], [], []);
                graphics.exprs = exprs;
                model.ipar = [enc1;enc2;pwm1;pwm2;pwm3;uart;bank_1_direction;bank_2_direction;bank_3_direction;bank_4_direction;];
                model.rpar = [];
                model.dstate = [];
                x.graphics = graphics;
                x.model = model;
                break
            end

        end
    case 'define' then
        enc1 = [1];
        enc2 = [1];
        pwm1 = [1];
        pwm2 = [1];
        pwm3 = [1];
        uart = [1];
        bank_1_direction = [1];
        bank_2_direction = [0];
        bank_3_direction = [0];
        bank_4_direction = [1];
        model=scicos_model();
        model.sim=list('mdaq_dio_config_sim',5);
        model.in=[];
        model.in2=[];
        model.out=[];
        model.out2=[];
        model.outtyp=[];
        model.intyp=[];
        model.evtin=[];
        model.ipar=[enc1;enc2;pwm1;pwm2;pwm3;uart;bank_1_direction;bank_2_direction;bank_3_direction;bank_4_direction;];
        model.rpar=[];
        model.dstate=[];
        model.blocktype='d';
        model.dep_ut=[%t %f];
        exprs=[sci2exp(enc1);sci2exp(enc2);sci2exp(pwm1);sci2exp(pwm2);sci2exp(pwm3);sci2exp(uart);sci2exp(bank_1_direction);sci2exp(bank_2_direction);sci2exp(bank_3_direction);sci2exp(bank_4_direction);];
        gr_i=['xstringb(orig(1),orig(2),['''' ; ],sz(1),sz(2),''fill'');'];
        x=standard_define([4 3],model,exprs,gr_i);
        x.graphics.in_implicit=[];
        x.graphics.exprs=exprs;
    end
endfunction

// Generated with MicroDAQ toolbox ver: 1.0.
function [x,y,typ] = mdaq_dio_config(job,arg1,arg2)
    block_desc = ['This block sets DIO alternative functions';
    'and DIO bank direction.';
    '';
    'DIO alternative functions setting:';
    '0 - disable DIO alternative function (set DIO function)';
    '1 - enable DIO alternative function';
    '';
    'DIO bank direction setting:';
    '0 - configure DIO bank as an OUTPUT';
    '1 - configure DIO bank as an INPUT';
    '';
    'Warning: This block has limitations due to hardware.';
    'In case of MicroDaq E2000 bank direction is fixed. These'
    'parameters will be omitted.'
    '';
    "Set block parameters:"];

    x=[];y=[];typ=[];
    select job
    case 'set' then
        x=arg1;
        model=arg1.model;
        graphics=arg1.graphics;
        exprs=graphics.exprs;

        while %t do
            try
                getversion('scilab');
                [ok,enc1,enc2,pwm1,pwm2,pwm3,uart,bank_1_direction,bank_2_direction,bank_3_direction,bank_4_direction,exprs]=..
                scicos_getvalue( block_desc,..
                ['ENC1 function:';'ENC2 function:';'PWM1 function:';..
                'PWM2 function:';'PWM3 function:';'UART function:';..
                'DIO1...8 direction:';'DIO9...16 direction:';..
                'DIO17...24 direction:';'DIO25...32 direction:';],..
                list('vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1), exprs)
            catch
                [ok,enc1,enc2,pwm1,pwm2,pwm3,uart,bank_1_direction,bank_2_direction,bank_3_direction,bank_4_direction,exprs]=..
                getvalue(block_desc,..
                ['ENC1 function:';'ENC2 function:';'PWM1 function:';..
                'PWM2 function:';'PWM3 function:';'UART function:';..
                'DIO1...8 direction:';'DIO9...16 direction:';..
                'DIO17...24 direction:';'DIO25...32 direction:';],..
                list('vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1), exprs);
            end;

            if ~ok then
                break
            end

            if bank_1_direction == 0 then
                if uart | enc1 | enc2 then
                    ok = %f;
                    message("Bank 1 configured as an OUTPUT - unable set selected DIO alternative functions!")
                end
            end

            if bank_2_direction <> 0 then
                if uart | pwm1 | pwm2 | pwm3 then
                    ok = %f;
                    message("Bank 2 configured as an INPUT - unable set selected DIO alternative functions!")
                end
            end

            if ok then
                [model,graphics,ok] = check_io(model,graphics, [], [], [], []);
                graphics.exprs = exprs;
                model.ipar = [enc1;enc2;pwm1;pwm2;pwm3;uart;bank_1_direction;bank_2_direction;bank_3_direction;bank_4_direction;];
                model.rpar = [];
                model.dstate = [];
                x.graphics = graphics;
                x.model = model;
                break
            end

        end
    case 'define' then
        enc1 = [1];
        enc2 = [1];
        pwm1 = [1];
        pwm2 = [1];
        pwm3 = [1];
        uart = [1];
        bank_1_direction = [1];
        bank_2_direction = [0];
        bank_3_direction = [0];
        bank_4_direction = [1];
        model=scicos_model();
        model.sim=list('mdaq_dio_config_sim',5);
        model.in=[];
        model.in2=[];
        model.out=[];
        model.out2=[];
        model.outtyp=[];
        model.intyp=[];
        model.evtin=[];
        model.ipar=[enc1;enc2;pwm1;pwm2;pwm3;uart;bank_1_direction;bank_2_direction;bank_3_direction;bank_4_direction;];
        model.rpar=[];
        model.dstate=[];
        model.blocktype='d';
        model.dep_ut=[%t %f];
        exprs=[sci2exp(enc1);sci2exp(enc2);sci2exp(pwm1);sci2exp(pwm2);sci2exp(pwm3);sci2exp(uart);sci2exp(bank_1_direction);sci2exp(bank_2_direction);sci2exp(bank_3_direction);sci2exp(bank_4_direction);];
        gr_i=['xstringb(orig(1),orig(2),['''' ; ],sz(1),sz(2),''fill'');'];
        x=standard_define([4 3],model,exprs,gr_i);
        x.graphics.in_implicit=[];
        x.graphics.exprs=exprs;
    end
endfunction


Execution profiling  - support for 300MHz and 456MHz CPUs

function []=post_xcos_simulate(%cpr, scs_m, needcompile)
    global %microdaq;

    for i = 1:size(scs_m.objs)
        curObj= scs_m.objs(i);
        if (typeof(curObj) == "Block" & curObj.gui == "mdaq_setup")
            if  %microdaq.dsp_loaded == %T then

                // make scope nicer
                list_fig=winsid();
                for i=1:length(list_fig)
                    h=get_figure_handle(list_fig(i));
                    if h.children.type == "Axes" then
                        axes = h.children;
                        axes.grid = [1,1];
                        axes.grid_style = [9,10];
                        poliline = axes.children;
                        if isempty(poliline.children) then
                            poliline.polyline_style = 2;
                        end
                    end
                end

                client_disconnect(1);
                %microdaq.dsp_loaded = %F;

                connection_id = mdaq_open();
                if connection_id < 0 then
                    return;
                end

                if connection_id > -1 then
                    mlink_set_obj(connection_id, 'model_stop_flag', 1 );
                    mlink_set_obj(connection_id, 'terminate_signal_task', 1 );

                    // save dsp profiling data
                    if curObj.model.ipar(3) == 1 then
                        //get number of records
                        [nr_records, result] = mlink_profile_data_get(connection_id, 1);
                        if nr_records > 0 & nr_records < 250000 & result > -1 then
                            [profile_data, result] = mlink_profile_data_get(connection_id, nr_records + 1);
                            if result > -1 then
                                if %microdaq.private.mdaq_hwid(4) == 0 then
                                    cpu_clock = 300000000;
                                else
                                    cpu_clock = 456000000;
                                end
                                profile_data = profile_data / (cpu_clock / 1000000);
                                dsp_exec_profile = tlist(["listtype","init","step","end"], [], []);
                                dsp_exec_profile.init = profile_data(3);
                                dsp_exec_profile.step = profile_data(4:nr_records);
                            dsp_exec_profile.end = profile_data(2);
                            save(TMPDIR + filesep() + "profiling_data", "dsp_exec_profile");
                            clear dsp_exec_profile;
                        end
                    end
                end
                mdaq_close(connection_id);
            end
        end
    end
end

if %microdaq.private.connection_id > -1 & %microdaq.private.has_mdaq_block then
    mdaq_close(%microdaq.private.connection_id);
    %microdaq.private.connection_id = -1;
    %microdaq.private.has_mdaq_block = %f
end

endfunction

function []=post_xcos_simulate(%cpr, scs_m, needcompile)
    global %microdaq;

    for i = 1:size(scs_m.objs)
        curObj= scs_m.objs(i);
        if (typeof(curObj) == "Block" & curObj.gui == "mdaq_setup")
            if  %microdaq.dsp_loaded == %T then

                // make scope nicer
                list_fig=winsid();
                for i=1:length(list_fig)
                    h=get_figure_handle(list_fig(i));
                    if h.children.type == "Axes" then
                        axes = h.children;
                        axes.grid = [1,1];
                        axes.grid_style = [9,10];
                        poliline = axes.children;
                        if isempty(poliline.children) then
                            poliline.polyline_style = 2;
                        end
                    end
                end

                client_disconnect(1);
                %microdaq.dsp_loaded = %F;

                connection_id = mdaq_open();
                if connection_id < 0 then
                    return;
                end

                if connection_id > -1 then
                    mdaq_set_obj(connection_id, 'model_stop_flag', 1 );
                    mdaq_set_obj(connection_id, 'terminate_signal_task', 1 );

                    // save dsp profiling data
                    if curObj.model.ipar(3) == 1 then
                        //get number of records
                        [nr_records, result] = mlink_profile_data_get(connection_id, 1);
                        if nr_records > 0 & nr_records < 250000 & result > -1 then
                            [profile_data, result] = mlink_profile_data_get(connection_id, nr_records + 1);
                            if result > -1 then
                                [cpu_clock, hw_id] = mdaq_hw_id();
                                profile_data = profile_data / (cpu_clock / 1000000);
                                dsp_exec_profile = tlist(["listtype","init","step","end"], [], []);
                                dsp_exec_profile.init = profile_data(3);
                                dsp_exec_profile.step = profile_data(4:nr_records);
                                dsp_exec_profile.end = profile_data(2);
                                save(TMPDIR + filesep() + "profiling_data", "dsp_exec_profile");
                                clear dsp_exec_profile;
                            end
                        end
                    end
                    mdaq_close(connection_id);
                end
            end
        end
    end

    if %microdaq.private.connection_id > -1 & %microdaq.private.has_mdaq_block then
        mdaq_close(%microdaq.private.connection_id);
        %microdaq.private.connection_id = -1;
        %microdaq.private.has_mdaq_block = %f
    end

endfunction


INTEGRATION: CWS qadev32 (1.7.98); FILE MERGED 2008/06/04 12:20:58 cn 1.7.98.3: #i87216# add issue 2008/05/13 19:44:36 cn 1.7.98.2: #i87389# update lists 2008/04/16 18:11:27 cn 1.7.98.1: #i87216# update lists

# i84653 -o sc.ScPageObj
# i84554 -o sc.AccessibleEditableTextPara_PreviewNote
# i88241 -o sc.AccessibleEditableTextPara_HeaderFooter
-o sc.AccessibleEditableTextPara_PreviewCell
-o sc.ScAccessibleCell
-o sc.ScAccessibleCsvCell
# i84726 -o sc.ScAccessibleCsvGrid
# i84641 -o sc.ScAccessibleCsvRuler
# i88330 -o sc.ScAccessibleDocument
-o sc.ScAccessiblePageHeader
-o sc.ScAccessiblePageHeaderArea
-o sc.ScAccessiblePreviewCell
-o sc.ScAccessiblePreviewHeaderCell
-o sc.ScAccessiblePreviewTable
-o sc.ScAccessibleSpreadsheet
-o sc.ScAnnotationObj
-o sc.ScAnnotationShapeObj
-o sc.ScAnnotationsObj
-o sc.ScAreaLinkObj
-o sc.ScAreaLinksObj
-o sc.ScAutoFormatFieldObj
-o sc.ScAutoFormatObj
-o sc.ScAutoFormatsObj
-o sc.ScCellCursorObj
-o sc.ScCellFieldObj
-o sc.ScCellFieldsObj
-o sc.ScCellFormatsEnumeration
-o sc.ScCellFormatsObj
-o sc.ScCellObj
-o sc.ScCellRangeObj
-o sc.ScCellRangesObj
-o sc.ScCellSearchObj
-o sc.ScCellTextCursor
-o sc.ScCellsEnumeration
-o sc.ScCellsObj
-o sc.ScChartObj
-o sc.ScChartsObj
-o sc.ScConsolidationDescriptor
-o sc.ScDDELinkObj
-o sc.ScDDELinksObj
-o sc.ScDataPilotFieldGroupItemObj
-o sc.ScDataPilotFieldGroupObj
-o sc.ScDataPilotFieldGroupsObj
-o sc.ScDataPilotFieldObj
-o sc.ScDataPilotFieldsObj
-o sc.ScDataPilotItemObj
-o sc.ScDataPilotItemsObj
-o sc.ScDataPilotTableObj
-o sc.ScDataPilotTablesObj
-o sc.ScDatabaseRangeObj
-o sc.ScDatabaseRangesObj
-o sc.ScDocumentConfiguration
-o sc.ScDrawPageObj
-o sc.ScDrawPagesObj
-o sc.ScFilterDescriptorBase
-o sc.ScFunctionListObj
-o sc.ScHeaderFieldObj
-o sc.ScHeaderFieldsObj
-o sc.ScHeaderFooterContentObj
-o sc.ScHeaderFooterTextCursor
-o sc.ScHeaderFooterTextObj
-o sc.ScIndexEnumeration_CellAnnotationsEnumeration
-o sc.ScIndexEnumeration_CellAreaLinksEnumeration
-o sc.ScIndexEnumeration_DDELinksEnumeration
-o sc.ScIndexEnumeration_DataPilotFieldsEnumeration
-o sc.ScIndexEnumeration_DataPilotItemsEnumeration
-o sc.ScIndexEnumeration_DataPilotTablesEnumeration
-o sc.ScIndexEnumeration_DatabaseRangesEnumeration
-o sc.ScIndexEnumeration_FunctionDescriptionEnumeration
-o sc.ScIndexEnumeration_LabelRangesEnumeration
-o sc.ScIndexEnumeration_NamedRangesEnumeration
-o sc.ScIndexEnumeration_ScenariosEnumeration
-o sc.ScIndexEnumeration_SheetCellRangesEnumeration
-o sc.ScIndexEnumeration_SheetLinksEnumeration
-o sc.ScIndexEnumeration_SpreadsheetViewPanesEnumeration
-o sc.ScIndexEnumeration_SpreadsheetsEnumeration
-o sc.ScIndexEnumeration_SubTotalFieldsEnumeration
-o sc.ScIndexEnumeration_TableAutoFormatEnumeration
-o sc.ScIndexEnumeration_TableChartsEnumeration
-o sc.ScIndexEnumeration_TableColumnsEnumeration
-o sc.ScIndexEnumeration_TableConditionalEntryEnumeration
-o sc.ScIndexEnumeration_TableRowsEnumeration
-o sc.ScIndexEnumeration_TextFieldEnumeration
-o sc.ScLabelRangeObj
-o sc.ScLabelRangesObj
-o sc.ScModelObj
-o sc.ScNamedRangeObj
-o sc.ScNamedRangesObj
-o sc.ScRecentFunctionsObj
-o sc.ScScenariosObj
-o sc.ScShapeObj
-o sc.ScSheetLinkObj
-o sc.ScSheetLinksObj
-o sc.ScSpreadsheetSettings
-o sc.ScSpreadsheetSettingsObj
-o sc.ScStyleFamiliesObj
-o sc.ScStyleFamilyObj
-o sc.ScStyleObj
-o sc.ScSubTotalDescriptorBase
-o sc.ScSubTotalFieldObj
# i84656 -o sc.ScTabViewObj
-o sc.ScTableColumnObj
-o sc.ScTableColumnsObj
-o sc.ScTableConditionalEntry
-o sc.ScTableConditionalFormat
-o sc.ScTableRowObj
-o sc.ScTableRowsObj
-o sc.ScTableSheetObj
-o sc.ScUniqueCellFormatsEnumeration
-o sc.ScUniqueCellFormatsObj
-o sc.ScTableSheetsObj
-o sc.ScTableValidationObj
-o sc.ScViewPaneObj
#i89411 -o sc.XMLContentExporter
#i89411 -o sc.XMLContentImporter
#i89411 -o sc.XMLExporter
#i89411 -o sc.XMLImporter
#i89411 -o sc.XMLMetaExporter
#i89411 -o sc.XMLMetaImporter
-o sc.XMLSettingsExporter
-o sc.XMLSettingsImporter
-o sc.XMLStylesExporter
-o sc.XMLStylesImporter
-o sc.ScAccessibleDocumentPagePreview
-o sc.XMLExporter

### i84653 -o sc.ScPageObj
### i84554 -o sc.AccessibleEditableTextPara_PreviewNote
-o sc.AccessibleEditableTextPara_HeaderFooter
-o sc.AccessibleEditableTextPara_PreviewCell
-o sc.ScAccessibleCell
-o sc.ScAccessibleCsvCell
### i84726 -o sc.ScAccessibleCsvGrid
### i84641 -o sc.ScAccessibleCsvRuler
-o sc.ScAccessibleDocument
-o sc.ScAccessiblePageHeader
-o sc.ScAccessiblePageHeaderArea
-o sc.ScAccessiblePreviewCell
-o sc.ScAccessiblePreviewHeaderCell
-o sc.ScAccessiblePreviewTable
-o sc.ScAccessibleSpreadsheet
-o sc.ScAnnotationObj
-o sc.ScAnnotationShapeObj
-o sc.ScAnnotationsObj
-o sc.ScAreaLinkObj
-o sc.ScAreaLinksObj
-o sc.ScAutoFormatFieldObj
-o sc.ScAutoFormatObj
-o sc.ScAutoFormatsObj
-o sc.ScCellCursorObj
-o sc.ScCellFieldObj
-o sc.ScCellFieldsObj
-o sc.ScCellFormatsEnumeration
-o sc.ScCellFormatsObj
-o sc.ScCellObj
-o sc.ScCellRangeObj
-o sc.ScCellRangesObj
-o sc.ScCellSearchObj
-o sc.ScCellTextCursor
-o sc.ScCellsEnumeration
-o sc.ScCellsObj
-o sc.ScChartObj
-o sc.ScChartsObj
-o sc.ScConsolidationDescriptor
-o sc.ScDDELinkObj
-o sc.ScDDELinksObj
-o sc.ScDataPilotFieldGroupItemObj
-o sc.ScDataPilotFieldGroupObj
-o sc.ScDataPilotFieldGroupsObj
-o sc.ScDataPilotFieldObj
-o sc.ScDataPilotFieldsObj
-o sc.ScDataPilotItemObj
-o sc.ScDataPilotItemsObj
-o sc.ScDataPilotTableObj
-o sc.ScDataPilotTablesObj
-o sc.ScDatabaseRangeObj
-o sc.ScDatabaseRangesObj
-o sc.ScDocumentConfiguration
-o sc.ScDrawPageObj
-o sc.ScDrawPagesObj
-o sc.ScFilterDescriptorBase
-o sc.ScFunctionListObj
-o sc.ScHeaderFieldObj
-o sc.ScHeaderFieldsObj
-o sc.ScHeaderFooterContentObj
-o sc.ScHeaderFooterTextCursor
-o sc.ScHeaderFooterTextObj
-o sc.ScIndexEnumeration_CellAnnotationsEnumeration
-o sc.ScIndexEnumeration_CellAreaLinksEnumeration
-o sc.ScIndexEnumeration_DDELinksEnumeration
-o sc.ScIndexEnumeration_DataPilotFieldsEnumeration
-o sc.ScIndexEnumeration_DataPilotItemsEnumeration
-o sc.ScIndexEnumeration_DataPilotTablesEnumeration
-o sc.ScIndexEnumeration_DatabaseRangesEnumeration
-o sc.ScIndexEnumeration_FunctionDescriptionEnumeration
-o sc.ScIndexEnumeration_LabelRangesEnumeration
-o sc.ScIndexEnumeration_NamedRangesEnumeration
-o sc.ScIndexEnumeration_ScenariosEnumeration
-o sc.ScIndexEnumeration_SheetCellRangesEnumeration
-o sc.ScIndexEnumeration_SheetLinksEnumeration
-o sc.ScIndexEnumeration_SpreadsheetViewPanesEnumeration
-o sc.ScIndexEnumeration_SpreadsheetsEnumeration
-o sc.ScIndexEnumeration_SubTotalFieldsEnumeration
-o sc.ScIndexEnumeration_TableAutoFormatEnumeration
-o sc.ScIndexEnumeration_TableChartsEnumeration
-o sc.ScIndexEnumeration_TableColumnsEnumeration
-o sc.ScIndexEnumeration_TableConditionalEntryEnumeration
-o sc.ScIndexEnumeration_TableRowsEnumeration
-o sc.ScIndexEnumeration_TextFieldEnumeration
-o sc.ScLabelRangeObj
-o sc.ScLabelRangesObj
-o sc.ScModelObj
-o sc.ScNamedRangeObj
-o sc.ScNamedRangesObj
-o sc.ScRecentFunctionsObj
-o sc.ScScenariosObj
-o sc.ScShapeObj
-o sc.ScSheetLinkObj
-o sc.ScSheetLinksObj
-o sc.ScSpreadsheetSettings
-o sc.ScSpreadsheetSettingsObj
-o sc.ScStyleFamiliesObj
-o sc.ScStyleFamilyObj
-o sc.ScStyleObj
-o sc.ScSubTotalDescriptorBase
-o sc.ScSubTotalFieldObj
### i84656 -o sc.ScTabViewObj
-o sc.ScTableColumnObj
-o sc.ScTableColumnsObj
-o sc.ScTableConditionalEntry
-o sc.ScTableConditionalFormat
-o sc.ScTableRowObj
-o sc.ScTableRowsObj
-o sc.ScTableSheetObj
-o sc.ScUniqueCellFormatsEnumeration
-o sc.ScUniqueCellFormatsObj
-o sc.ScTableSheetsObj
-o sc.ScTableValidationObj
-o sc.ScViewPaneObj
-o sc.XMLContentExporter
-o sc.XMLContentImporter
-o sc.XMLExporter
-o sc.XMLImporter
-o sc.XMLMetaExporter
-o sc.XMLMetaImporter
-o sc.XMLSettingsExporter
-o sc.XMLSettingsImporter
-o sc.XMLStylesExporter
-o sc.XMLStylesImporter
-o sc.ScAccessibleDocumentPagePreview
-o sc.XMLExporter


Fix mdaq_log to work with Scilab 6.

Fix mdaq_log to work with Scilab 6.

function mdaqLog(filepath)
    mdaq_ip = mdaq_get_ip();
    if mdaq_system_ping() then
        try
            [filename, mlog] = getURL(mdaq_ip + "/log/mlink-server.log", TMPDIR + filesep());
        catch

        end
    else
        mprintf("ERROR: Unable to connect to MicroDAQ device!\n");
        return;
    end

    sci = ver();
    [version, opts] = getversion();

    if argn(2) == 0 then
        // print
        mprintf('Log generated on: %s\n',date());
        mprintf('Toolbox ver: %s\n\n',mdaq_version());
        mprintf('---- MLink log:\n%s\n\n', mlog);
        mprintf('---- Scilab environment info:\n');
        mprintf('Scilab architecture: %s\n', opts(2));
        for i=1:6
            mprintf('%s %s\n', sci(i, 1), sci(i, 2));
        end
    else
        // save to file
        fd = mopen(filepath,'wt');
        mfprintf(fd,'Log generated on: %s\n',date());
        mfprintf(fd,'Toolbox ver: %s\n\n',mdaq_version());
        mfprintf(fd,'---- MLink log:\n%s\n\n', mlog);
        mfprintf(fd,'---- Scilab environment info:\n');
        mfprintf(fd,'Scilab architecture: %s\n', opts(2));
        for i=1:6
            mfprintf(fd,'%s %s\n', sci(i, 1), sci(i, 2));
        end

        mclose(fd);
    end
endfunction

function mdaqLog(filepath)
    mdaq_ip = mdaq_get_ip();
    if mdaq_system_ping() then
        try
            [filename, mlog] = getURL(mdaq_ip + "/log/mlink-server.log", TMPDIR + filesep());
        catch

        end
    else
        mprintf("ERROR: Unable to connect to MicroDAQ device!\n");
        return;
    end

    sci = ver();
    [version, opts] = getversion();

    if argn(2) == 0 then
        // print
        mprintf('Log generated on: %s\n',date());
        mprintf('Toolbox ver: %s\n\n',mdaq_version());
        mprintf('---- MLink log:\n%s\n\n', mlog);
        mprintf('---- Scilab environment info:\n');
        mprintf('Scilab architecture: %s\n', opts(2));
        for i=1:size(sci, 'r')
            mprintf('%s %s\n', sci(i, 1), sci(i, 2));
        end
    else
        // save to file
        fd = mopen(filepath,'wt');
        mfprintf(fd,'Log generated on: %s\n',date());
        mfprintf(fd,'Toolbox ver: %s\n\n',mdaq_version());
        mfprintf(fd,'---- MLink log:\n%s\n\n', mlog);
        mfprintf(fd,'---- Scilab environment info:\n');
        mfprintf(fd,'Scilab architecture: %s\n', opts(2));
        for i=1:size(sci, 'r')
            mfprintf(fd,'%s %s\n', sci(i, 1), sci(i, 2));
        end

        mclose(fd);
    end
endfunction


Create meeting_scilab.sci

Create meeting_scilab.sci

// >>> 1

// i
A = [1 2 3 4; 4 3 2 1; -1 2 3 4; 0 1 0 1]
b = [1; 0; 1; 1]

// ii
zeros(4, 10)
zeros(10, 10)
eye(10, 10)
rand(4, 10)
Z = zeros(4, 4)
I4 = eye(4, 4)
B = rand(4, 4)*10
C = rand(4, 4)*10

// iii
B*C
C*B
B*C == C*B

// iv
B = rand(4, 4)*10
C = rand(4, 4)*10
B*C == C*B

// v
(B-C)*(B+C) == B*B - C*C

// vi
A23 = A(2, 3)
A1 = A(1, :)
X1 = A(:, 1)
X23 = A(2:3, 2:3)

// vii
LIX = A
LIX(2,3) = 0
LIX(3,2) = 0

// viii
LIX = A
LIX(2:3, 2:3) = eye(2,2)

// ix
AA = A
AA(1,:) = AA(3,:) + AA(4,:)

// x
A*inv(A) // não deu identidadade, pois (A*inv(B))(3,1) é igual a 4.441D-16, por quê?
inv(A)*A // resultou em identidade 4x4
inv(A*B)
inv(B)*inv(A)
inv(A)*inv(B)
inv(A*B) == inv(B)*inv(A) // apesar de visualmente iguais, o teste deu F, por quê?

// xi
x = inv(A)*b
A*x-b // por que não deu nulo?

// xii
invAA = inv(AA) // matriz muito próxima, mas não exata
AA*invAA // resultado muito esquisito
invAA*AA // esquisitisse de novo, e diferente do anterior, o que é mais esquisito ainda!

// xiii
x = invAA*b
AA*x-b // o valor de invAA não é exatamente o que deveria ser, por isso deu coisas esquisitas aqui

// xiv
b
b' // o vetor coluna 4x1 virou um vetor linha 1x4
b' * C // um vetor linha
C' * b // deu o mesmo que b'*C, porém em vetor coluna (a transposta do resultado anterior)
b * C' // erro de consistência, a multiplicação não pôde ser feita
C * b' // a transposta de tal inconsistência acima também é inconsistente

// xv
F = B + B'
G = C + C'
F * G
F' * G'
G' * F'
(F*G)' // foi igua à G' * F'

// >>> 1

A = rand(4, 4)
b = [ 1 0 0 0 ]
b=A\x
rank(A)
invA = inv(A)
invA*b
rref(A)
[L, U, P] = lu(A)

// v
det(eye(10,10)) == 1
kernel(A)
trace(A)

// >>> 5

B = rand(4,4)
I = (eye(4,4))
x = inv(B) * I(:, 1)
invB = inv(B)
invB(:,1) == x // deu certo!
B*x(:,1) - I(:,1)
rref(B)
[L, U, P] = lu(B)

// >>> 6

rank(B)
invB // já havia feito antes
invB*B == B*invB // F, os resultados são muito esquisitos devido à falta de precisão, e bem diferentes de eye(4,4)

// >>> 7

A = rand(100,100); B = rand(100, 100); tic; A*B; toc // no máximo 5ms
A = rand(200,200); B = rand(200, 200); tic; A*B; toc // no máximo 13 ou 16ms
A = rand(1000,1000); B = rand(1000, 1000); tic; A*B; toc // 1s
A = rand(10000,10000); B = rand(10000, 10000); tic; A*B; toc // erro de memória stack

// >>> 8

function x=triaginf(L,b)
    n = size(L,1);
    x = zeros(n,1);
    x(1)=b(1)/L(1,1);
    for i=1:n
        x(i)=(b(i) - L(i,1:i-1)*x(1:i-1))/L(i,i);
    end
endfunction

M = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16]
b = [1; 0; 0; 0]
x = triaginf(M,b)

// >>> 9

function [L,U] = lu0006(A)
    n=size(A,1);
    U = A;
    L = eye(n,n);
    for j=1:n-1
        if abs(U(j,j)) < 10^(-12), 'Pivô nulo atrapalhou', break, end
        b = 1/U(j,j);
        for i=j+1:n
            L(i,j) = b*U(i,j);
            U(i,j:n) = U(i,j:n) - L(i,j)*U(j,j:n);
        end
    end
endfunction

A = rand(5,5)
[L,U] = lu0006(A)

B = [1 1 3 2 0; 2 1 3 1 2; 1 2 6 5 0; 0 1 4 0 1; 0 0 0 0 2]
[L,U] = lu0006(B)


sb120: #i111185# disabled failing tests for now

-o sw.CharacterStyle
-o sw.ConditionalParagraphStyle
-o sw.PageStyle
-o sw.ParagraphStyle
-o sw.SwAccessibleDocumentPageView
#i86751 -o sw.SwAccessibleDocumentView
#i111185 -o sw.SwAccessibleEndnoteView
-o sw.SwAccessibleFooterView
#i111185 -o sw.SwAccessibleFootnoteView
-o sw.SwAccessibleHeaderView
#i89022 -o sw.SwAccessiblePageView
-o sw.SwAccessibleParagraphView
-o sw.SwAccessibleTableCellView
#i85634 -o sw.SwAccessibleTableView
#i111178 -o sw.SwAccessibleTextEmbeddedObject
#i111178 -o sw.SwAccessibleTextFrameView
-o sw.SwAccessibleTextGraphicObject
-o sw.SwXAutoTextContainer
-o sw.SwXAutoTextEntry
-o sw.SwXAutoTextGroup
#i111185 -o sw.SwXBodyText
-o sw.SwXBookmark
-o sw.SwXBookmarks
-o sw.SwXCell
-o sw.SwXCellRange
-o sw.SwXChapterNumbering
#i111185 -o sw.SwXDocumentIndex
#i111185 -o sw.SwXDocumentIndexMark
-o sw.SwXDocumentIndexes
-o sw.SwXDrawPage
#i111185 -o sw.SwXEndnoteProperties
-o sw.SwXFieldEnumeration
-o sw.SwXFieldMaster
#i111185 -o sw.SwXFootnote
#i111185 -o sw.SwXFootnoteProperties
#i111185 -o sw.SwXFootnoteText
#i111185 -o sw.SwXFootnotes
-o sw.SwXFrames
#i111185 -o sw.SwXHeadFootText
-o sw.SwXLineNumberingProperties
#i85640 -o sw.SwXMailMerge
-o sw.SwXModule
-o sw.SwXNumberingRules
#i103696 -o sw.SwXParagraph
-o sw.SwXParagraphEnumeration
-o sw.SwXPrintSettings
-o sw.SwXPropertySet
-o sw.SwXPropertySetInfo
-o sw.SwXReferenceMark
-o sw.SwXReferenceMarks
-o sw.SwXShape
-o sw.SwXStyleFamilies
-o sw.SwXStyleFamily
#i111185 -o sw.SwXTableCellText
-o sw.SwXTableColumns
-o sw.SwXTableRows
-o sw.SwXTextColumns
-o sw.SwXTextCursor
#i89021 -o sw.SwXTextDefaults
#i111185 -o sw.SwXTextDocument
-o sw.SwXTextEmbeddedObject
-o sw.SwXTextEmbeddedObjects
-o sw.SwXTextField
-o sw.SwXTextFieldMasters
-o sw.SwXTextFieldTypes
-o sw.SwXTextFrame
#i111185 -o sw.SwXTextFrameText
-o sw.SwXTextGraphicObject
-o sw.SwXTextGraphicObjects
#i103696 -o sw.SwXTextPortion
-o sw.SwXTextPortionEnumeration
-o sw.SwXTextRange
-o sw.SwXTextRanges
-o sw.SwXTextSearch
-o sw.SwXTextSection
-o sw.SwXTextSections
-o sw.SwXTextTable
-o sw.SwXTextTableCursor
-o sw.SwXTextTableRow
-o sw.SwXTextTables
#i85580 -o sw.SwXTextView
-o sw.SwXTextViewCursor
-o sw.SwXViewSettings
-o sw.XMLContentExporter
#i23394 -o sw.XMLContentImporter
-o sw.XMLExporter
-o sw.XMLImporter
#i23394 -o sw.XMLMetaExporter
-o sw.XMLMetaImporter
-o sw.XMLSettingsExporter
-o sw.XMLSettingsImporter
-o sw.XMLStylesExporter
#i23394 -o sw.XMLStylesImporter
-o sw.DocumentSettings

-o sw.CharacterStyle
-o sw.ConditionalParagraphStyle
-o sw.PageStyle
-o sw.ParagraphStyle
-o sw.SwAccessibleDocumentPageView
#i86751 -o sw.SwAccessibleDocumentView
-o sw.SwAccessibleEndnoteView
-o sw.SwAccessibleFooterView
-o sw.SwAccessibleFootnoteView
-o sw.SwAccessibleHeaderView
#i89022 -o sw.SwAccessiblePageView
-o sw.SwAccessibleParagraphView
-o sw.SwAccessibleTableCellView
#i85634 -o sw.SwAccessibleTableView
#i111178 -o sw.SwAccessibleTextEmbeddedObject
#i111178 -o sw.SwAccessibleTextFrameView
-o sw.SwAccessibleTextGraphicObject
-o sw.SwXAutoTextContainer
-o sw.SwXAutoTextEntry
-o sw.SwXAutoTextGroup
-o sw.SwXBodyText
-o sw.SwXBookmark
-o sw.SwXBookmarks
-o sw.SwXCell
-o sw.SwXCellRange
-o sw.SwXChapterNumbering
-o sw.SwXDocumentIndex
-o sw.SwXDocumentIndexMark
-o sw.SwXDocumentIndexes
-o sw.SwXDrawPage
-o sw.SwXEndnoteProperties
-o sw.SwXFieldEnumeration
-o sw.SwXFieldMaster
-o sw.SwXFootnote
-o sw.SwXFootnoteProperties
-o sw.SwXFootnoteText
-o sw.SwXFootnotes
-o sw.SwXFrames
-o sw.SwXHeadFootText
-o sw.SwXLineNumberingProperties
#i85640 -o sw.SwXMailMerge
-o sw.SwXModule
-o sw.SwXNumberingRules
#i103696 -o sw.SwXParagraph
-o sw.SwXParagraphEnumeration
-o sw.SwXPrintSettings
-o sw.SwXPropertySet
-o sw.SwXPropertySetInfo
-o sw.SwXReferenceMark
-o sw.SwXReferenceMarks
-o sw.SwXShape
-o sw.SwXStyleFamilies
-o sw.SwXStyleFamily
-o sw.SwXTableCellText
-o sw.SwXTableColumns
-o sw.SwXTableRows
-o sw.SwXTextColumns
-o sw.SwXTextCursor
#i89021 -o sw.SwXTextDefaults
-o sw.SwXTextDocument
-o sw.SwXTextEmbeddedObject
-o sw.SwXTextEmbeddedObjects
-o sw.SwXTextField
-o sw.SwXTextFieldMasters
-o sw.SwXTextFieldTypes
-o sw.SwXTextFrame
-o sw.SwXTextFrameText
-o sw.SwXTextGraphicObject
-o sw.SwXTextGraphicObjects
#i103696 -o sw.SwXTextPortion
-o sw.SwXTextPortionEnumeration
-o sw.SwXTextRange
-o sw.SwXTextRanges
-o sw.SwXTextSearch
-o sw.SwXTextSection
-o sw.SwXTextSections
-o sw.SwXTextTable
-o sw.SwXTextTableCursor
-o sw.SwXTextTableRow
-o sw.SwXTextTables
#i85580 -o sw.SwXTextView
-o sw.SwXTextViewCursor
-o sw.SwXViewSettings
-o sw.XMLContentExporter
#i23394 -o sw.XMLContentImporter
-o sw.XMLExporter
-o sw.XMLImporter
#i23394 -o sw.XMLMetaExporter
-o sw.XMLMetaImporter
-o sw.XMLSettingsExporter
-o sw.XMLSettingsImporter
-o sw.XMLStylesExporter
#i23394 -o sw.XMLStylesImporter
-o sw.DocumentSettings


Fix: read version from VERSION file

Fix: read version from VERSION file

function mdaq_ver = mdaq_version()
    mdaq_ver = mgetl(mdaq_toolbox_path() + filesep() + "VERSION", 1);
endfunction

function mdaq_ver = mdaq_version()
    mdaq_ver = "1.1.";
endfunction


Update AO scanning example

Update AO scanning example

sin_waveform_point_count = 26
scan_freq = 8000 * sin_waveform_point_count;
ch_count = 4;

duration = 10;
sin_amp = 5;
bias = 0;

ao_data = sin(linspace(0,2*%pi,sin_waveform_point_count + 1)') * sin_amp;
ao_data = ao_data + bias;

mdaq_ao_scan_init(1:ch_count, 3, 0, scan_freq, duration)

for ch=1:ch_count
    mdaq_ao_scan_data(ch, ch*100, ao_data(1:sin_waveform_point_count));
end

mdaq_ao_scan()

scan_freq = 800000;
duration = 10;
sin_waveform_point_count = 15
sin_amp = 5;
bias = 0;

ao_data = sin(linspace(0,2*%pi,sin_waveform_point_count + 1)') * sin_amp;
ao_data = ao_data + bias;

mdaq_ao_scan_init()
mdaq_ao_scan_init(1:8, 3, scan_freq, duration)

for ch=1:8
    mdaq_ao_scan_data(ch, ch*100, ao_data(1:sin_waveform_point_count));
end

mdaq_ao_scan()


Fix microdaq_setup

Fix microdaq_setup

function [] = microdaq_setup(arg1, arg2)
    sciVer = getversion('scilab');
    if sciVer(1) == 5 & argn(2) <> 2 then
        mprintf("Description:\n");
        mprintf("\tConfigures MicroDAQ toolbox\n");
        mprintf("Usage:\n");
        mprintf("\tmicrodaq_setup(compilerPath, ipAddress)\n")
        mprintf("\tcompilerPath - the C6000 compiler installation path e.g ""c:\\ti\\c6000_7.4.21\\""\n");
        mprintf("\tipAddress - MicroDAQ IP address e.g ""10.10.1.1""\n");
        return
    elseif sciVer(1) == 6 & argn(2) <> 1 then
        mprintf("Description:\n");
        mprintf("\tConfigures MicroDAQ toolbox\n");
        mprintf("Usage:\n");
        mprintf("\tmicrodaq_setup(ipAddress)\n")
        mprintf("\tipAddress - MicroDAQ IP address e.g ""10.10.1.1""\n");
        return
    end

    if sciVer(1) == 5 then
        if isfile(pathconvert(arg1 + "\bin\") + "cl6x.exe") | isfile(pathconvert(arg1 + "/bin/") + "cl6x") then
            CompilerRoot = getshortpathname(pathconvert(arg1, %F));
            ipAddress = arg2;
        else
            error("Unable to locate compiler in " + arg1);
        end
    elseif sciVer(1) == 6 then
        ipAddress = arg1;
        try
            mdaqSetIP(ipAddress)
        catch
            error("Unable to set MicroDAQ IP address");
        end
        disp('Setup complete - toolbox is ready to use!');
        return
    else
        error("Unsupported Scilab version");
    end

    // set MicroDAQ IP address
    try
        mdaqSetIP(ipAddress)
    catch
        error("Unable to set MicroDAQ IP address");
    end

    // checking firmware
    [firmVer rawFrimVer res] = mdaq_fw_version_url();
    if res == %F then
        disp('Unable to verify MicroDAQ firmware - make sure you have latest MicroDAQ firmware installed!');
    elseif firmVer(1) < 2 then
        disp('Firmware version '+rawFrimVer+' is not supported.Please upgrade MicroDAQ firmware!');
    else
        result = mdaqOpen();
        if result < 0  then
            disp('Unable to connect to MicroDAQ device!');
        else
            global %microdaq;
            disp(%microdaq.model + ' connected, firmware version: '+rawFrimVer);
            mdaqClose(result);
        end
    end

    dir_temp = pwd();

    targetRoot = pathconvert(dirname(get_function_path('microdaq_setup'))+"\..\etc", %F);
    targetPathsFile = pathconvert(dirname(get_function_path('microdaq_setup'))+"\..\rt_templates\target_paths.mk", %F);
    cpu0LinkerFile = pathconvert(targetRoot + '\sysbios\cpu0\configPkg\linker.cmd', %F);
    mkdir(pathconvert(targetRoot + '\sysbios\cpu0\configPkg', %F));
    cpu1LinkerFile = pathconvert(targetRoot + '\sysbios\cpu1\configPkg\linker.cmd', %F);
    mkdir(pathconvert(targetRoot + '\sysbios\cpu1\configPkg', %F));
    linkerTemplateFile = pathconvert(targetRoot + '\sysbios\linker.template', %F);

    [cpu0Linker, res1] = mopen(cpu0LinkerFile, 'w')
    [cpu1Linker, res2] = mopen(cpu1LinkerFile, 'w')
    if res1 < 0 | res2 < 0 then
        error("Unable to create linker file")
    end

    [linkerTemplate, res1] = mopen(linkerTemplateFile, 'r')
    if res1 < 0 then
        error("Unable to open linker template file")
    end
    linker = mgetl(linkerTemplate);
    mclose(linkerTemplate);

    [targetPaths, res1] = mopen(targetPathsFile, 'w');
    if res1 < 0 then
        error('Building failed. Cannot create file ''target_path.mk''');
    end

    mputl('-l""' + pathconvert(targetRoot + '\sysbios\boot.ae674', %F) + '""', cpu0Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\ti.targets.rts6000.ae674', %F) + '""', cpu0Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\cpu0\libs\sysbios_pe674.oe674', %F) + '""', cpu0Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\cpu0\libs\sysbios.ae674', %F) + '""', cpu0Linker);
    mputl(linker, cpu0Linker);
    mclose(cpu0Linker)

    mputl('-l""' + pathconvert(targetRoot + '\sysbios\boot.ae674', %F) + '""', cpu1Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\ti.targets.rts6000.ae674', %F) + '""', cpu1Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\cpu1\libs\sysbios_pe674.oe674', %F) + '""', cpu1Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\cpu1\libs\sysbios.ae674', %F) + '""', cpu1Linker);
    mputl(linker, cpu1Linker);
    mclose(cpu1Linker)

    mputl('# MicroDAQ paths', targetPaths)
    mputl('',targetPaths)
    mputl('CompilerRoot  = ' + CompilerRoot, targetPaths)
    mputl('TargetRoot    = '+ targetRoot, targetPaths)
    mclose(targetPaths)

    disp('Setup complete - toolbox is ready to use!');
endfunction

function [] = microdaq_setup(arg1, arg2)
    sciVer = getversion('scilab');
    if sciVer(1) == 5 & argn(2) <> 2 then
        mprintf("Description:\n");
        mprintf("\tConfigures MicroDAQ toolbox\n");
        mprintf("Usage:\n");
        mprintf("\tmicrodaq_setup(compilerPath, ipAddress)\n")
        mprintf("\tcompilerPath - the C6000 compiler installation path e.g ""c:\\ti\\c6000_7.4.21\\""\n");
        mprintf("\tipAddress - MicroDAQ IP address e.g ""10.10.1.1""\n");
        return
    elseif sciVer(1) == 6 & argn(2) <> 1 then
        mprintf("Description:\n");
        mprintf("\tConfigures MicroDAQ toolbox\n");
        mprintf("Usage:\n");
        mprintf("\tmicrodaq_setup(ipAddress)\n")
        mprintf("\tipAddress - MicroDAQ IP address e.g ""10.10.1.1""\n");
        return
    end

    if sciVer(1) == 5 then
        if isfile(pathconvert(arg1 + "\bin\") + "cl6x.exe") | isfile(pathconvert(arg1 + "/bin/") + "cl6x") then
            CompilerRoot = getshortpathname(pathconvert(arg1, %F));
            ipAddress = arg2;
        else
            error("Unable to locate compiler in " + arg1);
        end
    elseif sciVer(1) == 6 then
        ipAddress = arg1;
        try
            mdaqSetIP(ipAddress)
        catch
            error("Unable to set MicroDAQ IP address");
        end
        disp('Setup complete - toolbox is ready to use!');
        return
    else
        error("Unsupported Scilab version");
    end

    // set MicroDAQ IP address
    try
        mdaqSetIP(ipAddress)
    catch
        error("Unable to set MicroDAQ IP address");
    end

    // checking firmware
    [firmVer rawFrimVer res] = mdaq_fw_version_url();
    if res == %F then
        disp('Unable to verify MicroDAQ firmware - make sure you have latest MicroDAQ firmware installed!');
    elseif firmVer(1) < 2 then
        disp('Firmware version '+rawFrimVer+' is not supported.Please upgrade MicroDAQ firmware!');
    else
        result = mdaqOpen();
        if result < 0  then
            disp('Unable to connect to MicroDAQ device!');
        else
            global %microdaq;
            disp(%microdaq.model + ' connected, firmware version: '+rawFrimVer);
            mdaqClose(result);
        end
    end

    dir_temp = pwd();

    targetRoot = pathconvert(dirname(get_function_path('microdaq_setup'))+"\..\etc", %F);
    targetPathsFile = pathconvert(dirname(get_function_path('microdaq_setup'))+"\..\rt_templates\target_paths.mk", %F);
    cpu0LinkerFile = pathconvert(targetRoot + '\sysbios\cpu0\configPkg\linker.cmd', %F);
    cpu1LinkerFile = pathconvert(targetRoot + '\sysbios\cpu1\configPkg\linker.cmd', %F);
    linkerTemplateFile = pathconvert(targetRoot + '\sysbios\linker.template', %F);

    [cpu0Linker, res1] = mopen(cpu0LinkerFile, 'w')
    [cpu1Linker, res2] = mopen(cpu1LinkerFile, 'w')
    if res1 < 0 | res2 < 0 then
        error("Unable to create linker file")
    end

    [linkerTemplate, res1] = mopen(linkerTemplateFile, 'r')
    if res1 < 0 then
        error("Unable to open linker template file")
    end
    linker = mgetl(linkerTemplate);
    mclose(linkerTemplate);

    [targetPaths, res1] = mopen(targetPathsFile, 'w');
    if res1 < 0 then
        error('Building failed. Cannot create file ''target_path.mk''');
    end

    mputl('-l""' + pathconvert(targetRoot + '\sysbios\boot.ae674', %F) + '""', cpu0Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\ti.targets.rts6000.ae674', %F) + '""', cpu0Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\cpu0\libs\sysbios_pe674.oe674', %F) + '""', cpu0Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\cpu0\libs\sysbios.ae674', %F) + '""', cpu0Linker);
    mputl(linker, cpu0Linker);
    mclose(cpu0Linker)

    mputl('-l""' + pathconvert(targetRoot + '\sysbios\boot.ae674', %F) + '""', cpu1Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\ti.targets.rts6000.ae674', %F) + '""', cpu1Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\cpu1\libs\sysbios_pe674.oe674', %F) + '""', cpu1Linker);
    mputl('-l""' + pathconvert(targetRoot + '\sysbios\cpu1\libs\sysbios.ae674', %F) + '""', cpu1Linker);
    mputl(linker, cpu1Linker);
    mclose(cpu1Linker)

    mputl('# MicroDAQ paths', targetPaths)
    mputl('',targetPaths)
    mputl('CompilerRoot  = ' + CompilerRoot, targetPaths)
    mputl('TargetRoot    = '+ targetRoot, targetPaths)
    mclose(targetPaths)

    disp('Setup complete - toolbox is ready to use!');
endfunction


Terminate signal task in mdaq_dsp_stop()

function mdaq_dsp_stop(arg1)
    // Check version compatibility
    [is_supp vers] = mdaq_is_working('mdaq_dsp_stop');
    if is_supp == %F then
        error('ERROR: ' + vers)
        return;
    end

    global %microdaq;

    if %microdaq.dsp_loaded == %T then
        if argn(2) == 1 then
            link_id = arg1;
            if link_id < 0 then
                disp("ERROR: Invalid link ID!")
                return;
            end
        end

        if %microdaq.dsp_ext_mode then
            client_disconnect(1);
        end

        %microdaq.dsp_loaded = %F;
        if argn(2) == 0 then
            link_id = mdaq_open();
            if link_id < 0 then
                disp("ERROR: Unable to connect to MicroDAQ device!");
                return;
            end
        end

        res = mlink_set_obj(link_id, 'model_stop_flag', 1.0 );
        res = mlink_set_obj(link_id, 'terminate_signal_task', 1 );
        if argn(2) == 0 then
            mdaq_close(link_id);
        end

    else
        disp("DSP is not running, use mdaq_dsp_start to run DSP!");
        %microdaq.dsp_loaded = %F
    end
endfunction

function mdaq_dsp_stop(arg1)
    // Check version compatibility
    [is_supp vers] = mdaq_is_working('mdaq_dsp_stop');
    if is_supp == %F then
        error('ERROR: ' + vers)
        return;
    end

    global %microdaq;

    if %microdaq.dsp_loaded == %T then
        if argn(2) == 1 then
            link_id = arg1;
            if link_id < 0 then
                disp("ERROR: Invalid link ID!")
                return;
            end
        end

        if %microdaq.dsp_ext_mode then
            client_disconnect(1);
        end

        %microdaq.dsp_loaded = %F;
        if argn(2) == 0 then
            link_id = mdaq_open();
            if link_id < 0 then
                disp("ERROR: Unable to connect to MicroDAQ device!");
                return;
            end
        end

        res = mlink_set_obj(link_id, 'model_stop_flag', 1.0 );
        if argn(2) == 0 then
            mdaq_close(link_id);
        end

    else
        disp("DSP is not running, use mdaq_dsp_start to run DSP!");
        %microdaq.dsp_loaded = %F
    end
endfunction


chart47: #i112047# #i112048# disable crashing API tests

-o xmloff.Chart.XMLContentExporter
-o xmloff.Chart.XMLContentImporter
-o xmloff.Chart.XMLExporter
-o xmloff.Chart.XMLImporter
-o xmloff.Chart.XMLStylesExporter
#i112047 -o xmloff.Chart.XMLStylesImporter
-o xmloff.Draw.XMLContentExporter
-o xmloff.Draw.XMLContentImporter
-o xmloff.Draw.XMLExporter
-o xmloff.Draw.XMLImporter
-o xmloff.Draw.XMLMetaExporter
#i111200 -o xmloff.Draw.XMLMetaImporter
#i111287 -o xmloff.Draw.XMLSettingsExporter
#i111287 -o xmloff.Draw.XMLSettingsImporter
#i87695 -o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
#i111224 -o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
#i112048 -o xmloff.Impress.XMLExporter
#i111111# -o xmloff.Impress.XMLImporter
-o xmloff.Impress.XMLMetaExporter
-o xmloff.Impress.XMLMetaImporter
#i111287 -o xmloff.Impress.XMLSettingsExporter
#i111287 -o xmloff.Impress.XMLSettingsImporter
#i87695 -o xmloff.Impress.XMLStylesExporter
-o xmloff.Impress.XMLStylesImporter

-o xmloff.Chart.XMLContentExporter
-o xmloff.Chart.XMLContentImporter
-o xmloff.Chart.XMLExporter
-o xmloff.Chart.XMLImporter
-o xmloff.Chart.XMLStylesExporter
-o xmloff.Chart.XMLStylesImporter
-o xmloff.Draw.XMLContentExporter
-o xmloff.Draw.XMLContentImporter
-o xmloff.Draw.XMLExporter
-o xmloff.Draw.XMLImporter
-o xmloff.Draw.XMLMetaExporter
#i111200 -o xmloff.Draw.XMLMetaImporter
#i111287 -o xmloff.Draw.XMLSettingsExporter
#i111287 -o xmloff.Draw.XMLSettingsImporter
#i87695 -o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
#i111224 -o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
-o xmloff.Impress.XMLExporter
#i111111# -o xmloff.Impress.XMLImporter
-o xmloff.Impress.XMLMetaExporter
-o xmloff.Impress.XMLMetaImporter
#i111287 -o xmloff.Impress.XMLSettingsExporter
#i111287 -o xmloff.Impress.XMLSettingsImporter
#i87695 -o xmloff.Impress.XMLStylesExporter
-o xmloff.Impress.XMLStylesImporter


sw33bf06: #i111185#: sw: re-enable tests  the unxsols4 compiler bug workarounds have been deployed: i112513, i111177

-o sw.CharacterStyle
-o sw.ConditionalParagraphStyle
-o sw.PageStyle
-o sw.ParagraphStyle
#i111197 -o sw.SwAccessibleDocumentPageView
#i86751 -o sw.SwAccessibleDocumentView
-o sw.SwAccessibleEndnoteView
-o sw.SwAccessibleFooterView
-o sw.SwAccessibleFootnoteView
-o sw.SwAccessibleHeaderView
#i89022 -o sw.SwAccessiblePageView
-o sw.SwAccessibleParagraphView
-o sw.SwAccessibleTableCellView
#i85634 -o sw.SwAccessibleTableView
#i111178 -o sw.SwAccessibleTextEmbeddedObject
#i111178 -o sw.SwAccessibleTextFrameView
-o sw.SwAccessibleTextGraphicObject
-o sw.SwXAutoTextContainer
-o sw.SwXAutoTextEntry
-o sw.SwXAutoTextGroup
-o sw.SwXBodyText
-o sw.SwXBookmark
-o sw.SwXBookmarks
-o sw.SwXCell
-o sw.SwXCellRange
-o sw.SwXChapterNumbering
-o sw.SwXDocumentIndex
-o sw.SwXDocumentIndexMark
-o sw.SwXDocumentIndexes
-o sw.SwXDrawPage
-o sw.SwXEndnoteProperties
-o sw.SwXFieldEnumeration
-o sw.SwXFieldMaster
-o sw.SwXFootnote
-o sw.SwXFootnoteProperties
-o sw.SwXFootnoteText
-o sw.SwXFootnotes
-o sw.SwXFrames
-o sw.SwXHeadFootText
-o sw.SwXLineNumberingProperties
#i85640 -o sw.SwXMailMerge
-o sw.SwXModule
-o sw.SwXNumberingRules
#i103696 -o sw.SwXParagraph
-o sw.SwXParagraphEnumeration
-o sw.SwXPrintSettings
-o sw.SwXPropertySet
-o sw.SwXPropertySetInfo
-o sw.SwXReferenceMark
-o sw.SwXReferenceMarks
#i111190 -o sw.SwXShape
-o sw.SwXStyleFamilies
-o sw.SwXStyleFamily
-o sw.SwXTableCellText
-o sw.SwXTableColumns
-o sw.SwXTableRows
-o sw.SwXTextColumns
-o sw.SwXTextCursor
#i89021 -o sw.SwXTextDefaults
-o sw.SwXTextDocument
-o sw.SwXTextEmbeddedObject
-o sw.SwXTextEmbeddedObjects
-o sw.SwXTextField
-o sw.SwXTextFieldMasters
-o sw.SwXTextFieldTypes
-o sw.SwXTextFrame
-o sw.SwXTextFrameText
-o sw.SwXTextGraphicObject
-o sw.SwXTextGraphicObjects
#i103696 -o sw.SwXTextPortion
-o sw.SwXTextPortionEnumeration
-o sw.SwXTextRange
-o sw.SwXTextRanges
-o sw.SwXTextSearch
-o sw.SwXTextSection
-o sw.SwXTextSections
-o sw.SwXTextTable
-o sw.SwXTextTableCursor
-o sw.SwXTextTableRow
-o sw.SwXTextTables
#i85580 -o sw.SwXTextView
-o sw.SwXTextViewCursor
-o sw.SwXViewSettings
-o sw.XMLContentExporter
#i23394 -o sw.XMLContentImporter
#i111194-o sw.XMLExporter
-o sw.XMLImporter
#i23394 -o sw.XMLMetaExporter
-o sw.XMLMetaImporter
-o sw.XMLSettingsExporter
-o sw.XMLSettingsImporter
-o sw.XMLStylesExporter
#i23394 -o sw.XMLStylesImporter
-o sw.DocumentSettings

-o sw.CharacterStyle
-o sw.ConditionalParagraphStyle
-o sw.PageStyle
-o sw.ParagraphStyle
#i111197 -o sw.SwAccessibleDocumentPageView
#i86751 -o sw.SwAccessibleDocumentView
#i111185 -o sw.SwAccessibleEndnoteView
-o sw.SwAccessibleFooterView
#i111185 -o sw.SwAccessibleFootnoteView
-o sw.SwAccessibleHeaderView
#i89022 -o sw.SwAccessiblePageView
-o sw.SwAccessibleParagraphView
-o sw.SwAccessibleTableCellView
#i85634 -o sw.SwAccessibleTableView
#i111178 -o sw.SwAccessibleTextEmbeddedObject
#i111178 -o sw.SwAccessibleTextFrameView
-o sw.SwAccessibleTextGraphicObject
-o sw.SwXAutoTextContainer
-o sw.SwXAutoTextEntry
-o sw.SwXAutoTextGroup
#i111185 -o sw.SwXBodyText
-o sw.SwXBookmark
-o sw.SwXBookmarks
-o sw.SwXCell
-o sw.SwXCellRange
-o sw.SwXChapterNumbering
#i111185 -o sw.SwXDocumentIndex
#i111185 -o sw.SwXDocumentIndexMark
-o sw.SwXDocumentIndexes
-o sw.SwXDrawPage
#i111185 -o sw.SwXEndnoteProperties
-o sw.SwXFieldEnumeration
-o sw.SwXFieldMaster
#i111185 -o sw.SwXFootnote
#i111185 -o sw.SwXFootnoteProperties
#i111185 -o sw.SwXFootnoteText
#i111185 -o sw.SwXFootnotes
-o sw.SwXFrames
#i111185 -o sw.SwXHeadFootText
-o sw.SwXLineNumberingProperties
#i85640 -o sw.SwXMailMerge
-o sw.SwXModule
-o sw.SwXNumberingRules
#i103696 -o sw.SwXParagraph
-o sw.SwXParagraphEnumeration
-o sw.SwXPrintSettings
-o sw.SwXPropertySet
-o sw.SwXPropertySetInfo
-o sw.SwXReferenceMark
-o sw.SwXReferenceMarks
#i111190 -o sw.SwXShape
-o sw.SwXStyleFamilies
-o sw.SwXStyleFamily
#i111185 -o sw.SwXTableCellText
-o sw.SwXTableColumns
-o sw.SwXTableRows
-o sw.SwXTextColumns
-o sw.SwXTextCursor
#i89021 -o sw.SwXTextDefaults
#i111185 -o sw.SwXTextDocument
-o sw.SwXTextEmbeddedObject
-o sw.SwXTextEmbeddedObjects
-o sw.SwXTextField
-o sw.SwXTextFieldMasters
-o sw.SwXTextFieldTypes
-o sw.SwXTextFrame
#i111185 -o sw.SwXTextFrameText
-o sw.SwXTextGraphicObject
-o sw.SwXTextGraphicObjects
#i103696 -o sw.SwXTextPortion
-o sw.SwXTextPortionEnumeration
-o sw.SwXTextRange
-o sw.SwXTextRanges
-o sw.SwXTextSearch
-o sw.SwXTextSection
-o sw.SwXTextSections
-o sw.SwXTextTable
-o sw.SwXTextTableCursor
-o sw.SwXTextTableRow
-o sw.SwXTextTables
#i85580 -o sw.SwXTextView
-o sw.SwXTextViewCursor
-o sw.SwXViewSettings
-o sw.XMLContentExporter
#i23394 -o sw.XMLContentImporter
#i111194-o sw.XMLExporter
-o sw.XMLImporter
#i23394 -o sw.XMLMetaExporter
-o sw.XMLMetaImporter
-o sw.XMLSettingsExporter
-o sw.XMLSettingsImporter
-o sw.XMLStylesExporter
#i23394 -o sw.XMLStylesImporter
-o sw.DocumentSettings


sb123: #i113245# disabled fwl.TypeDetection for now


mdaq_ao_write fix

mdaq_ao_write fix

translate range to DAC specific value in case when 1 channel selected

function mdaq_ao_write(arg1, arg2, arg3, arg4)
    link_id = -1;

    if argn(2) == 3 then
        channels = arg1;
        ao_range = arg2;
        data = arg3;
    end

    if argn(2) == 4 then
        link_id = arg1;
        channels = arg2;
        ao_range = arg3;
        data = arg4;

        if link_id < 0 then
            disp("ERROR: Invalid link ID!")
            return;
        end
    end

    global %microdaq;
    if %microdaq.private.mdaq_hwid <> [] then
        dac = %microdaq.private.mdaq_hwid(3);
        if  dac == 0 then
            disp("ERROR: Unable to detect DAC configuration!");
            return;
        end
        dac_info = %microdaq.private.dac_info;
        if argn(2) > 4 | argn(2) < 3 then
            mprintf("Description:\n");
            mprintf("\tWrites data to MicroDAQ analog outputs\n");
            mprintf("Usage:\n");
            mprintf("\tmdaq_ao_write(link_id, channels, range, data);\n")
            mprintf("\tlink_id - connection id returned by mdaq_open() (OPTIONAL)\n");
            mprintf("\tchannels - analog output channels \n");
            mprintf("\trange - analog output range:\n");
            for i = 1:size(dac_info.c_params.c_range_desc, "r")
                mprintf("\t    %s\n", string(i) + ": " + dac_info.c_params.c_range_desc(i));
            end
            mprintf("\tdata - data to be written\n");
            return;
        end
    else
        error('ERROR: Unable to detect MicroDAQ configuration - run mdaq_hwinfo and try again!');
        return;
    end

    data_size = size(data, '*');
    ch_count = size(channels, '*');
    dac_ch_count = strtod(dac_info.channel);

    if ch_count > dac_ch_count then
        disp("ERROR: Too many channels selected!")
        return;
    end

    if max(channels) > dac_ch_count | min(channels) < 1 then
        disp("ERROR: Wrong channel number selected!")
        return;
    end

    if data_size <> ch_count then
        disp("ERROR: Wrong data for selected AO channels!");
        return;
    end

    if ao_range > size(dac_info.c_params.c_range_desc, "r") | ao_range < 1 then
        mprintf("ERROR: Wrong AO range selected.\nSupported ranges:\n");
        for i = 1:size(dac_info.c_params.c_range_desc, "r")
            mprintf("\t    %s\n", string(i) + ": " + dac_info.c_params.c_range_desc(i));
        end
        return;
    end

    if argn(2) == 3 then
        link_id = mdaq_open();
        if link_id < 0 then
            disp("ERROR: Unable to connect to MicroDAQ device!");
            return;
        end
    end

    range_size = size(ao_range, 'c');
    if range_size == 1 then
        ao_range = ones(ch_count, 1) * dac_info.c_params.c_range(ao_range);
    else
        for i = 1:ch_count
            ao_range(i) = dac_info.c_params.c_range(ao_range(i));
        end
    end

    result = call("sci_mlink_ao_write",..
                    link_id, 1, "i",..
                    dac, 2, "i",..
                    channels, 3, "i",..
                    ch_count, 4, "i",..
                    ao_range, 5, "i",..
                    data, 6, "d",..
                "out",..
                    [1, 1], 7, "i");

    if result < 0 then
        mdaq_error(result)
    end

    if argn(2) == 3 then
        mdaq_close(link_id);
    end

    clear data_size;
    clear ch_count;
    clear dac_ch_count;
endfunction

function mdaq_ao_write(arg1, arg2, arg3, arg4)
    link_id = -1;

    if argn(2) == 3 then
        channels = arg1;
        ao_range = arg2;
        data = arg3;
    end

    if argn(2) == 4 then
        link_id = arg1;
        channels = arg2;
        ao_range = arg3;
        data = arg4;

        if link_id < 0 then
            disp("ERROR: Invalid link ID!")
            return;
        end
    end

    global %microdaq;
    if %microdaq.private.mdaq_hwid <> [] then
        dac = %microdaq.private.mdaq_hwid(3);
        if  dac == 0 then
            disp("ERROR: Unable to detect DAC configuration!");
            return;
        end
        dac_info = %microdaq.private.dac_info;
        if argn(2) > 4 | argn(2) < 3 then
            mprintf("Description:\n");
            mprintf("\tWrites data to MicroDAQ analog outputs\n");
            mprintf("Usage:\n");
            mprintf("\tmdaq_ao_write(link_id, channels, range, data);\n")
            mprintf("\tlink_id - connection id returned by mdaq_open() (OPTIONAL)\n");
            mprintf("\tchannels - analog output channels \n");
            mprintf("\trange - analog output range:\n");
            for i = 1:size(dac_info.c_params.c_range_desc, "r")
                mprintf("\t    %s\n", string(i) + ": " + dac_info.c_params.c_range_desc(i));
            end
            mprintf("\tdata - data to be written\n");
            return;
        end
    else
        error('ERROR: Unable to detect MicroDAQ configuration - run mdaq_hwinfo and try again!');
        return;
    end

    data_size = size(data, '*');
    ch_count = size(channels, '*');
    dac_ch_count = strtod(dac_info.channel);

    if ch_count > dac_ch_count then
        disp("ERROR: Too many channels selected!")
        return;
    end

    if max(channels) > dac_ch_count | min(channels) < 1 then
        disp("ERROR: Wrong channel number selected!")
        return;
    end

    if data_size <> ch_count then
        disp("ERROR: Wrong data for selected AO channels!");
        return;
    end

    if ao_range > size(dac_info.c_params.c_range_desc, "r") | ao_range < 1 then
        mprintf("ERROR: Wrong AO range selected.\nSupported ranges:\n");
        for i = 1:size(dac_info.c_params.c_range_desc, "r")
            mprintf("\t    %s\n", string(i) + ": " + dac_info.c_params.c_range_desc(i));
        end
        return;
    end

    if argn(2) == 3 then
        link_id = mdaq_open();
        if link_id < 0 then
            disp("ERROR: Unable to connect to MicroDAQ device!");
            return;
        end
    end

    range_size = size(ao_range, 'c');
    if range_size == 1 then
        ao_range = ones(ch_count, 1) * ao_range;
    else
        for i = 1:ch_count
            ao_range(i) = dac_info.c_params.c_range(ao_range(i));
        end
    end

    result = call("sci_mlink_ao_write",..
                    link_id, 1, "i",..
                    dac, 2, "i",..
                    channels, 3, "i",..
                    ch_count, 4, "i",..
                    ao_range, 5, "i",..
                    data, 6, "d",..
                "out",..
                    [1, 1], 7, "i");

    if result < 0 then
        mdaq_error(result)
    end

    if argn(2) == 3 then
        mdaq_close(link_id);
    end

    clear data_size;
    clear ch_count;
    clear dac_ch_count;
endfunction


Minor help update in mdaqFileData function

function result = mdaqFileData(filename, filetype, rows, cols)
    result = [];

    if (argn(2) > 4 | argn(2) < 2) | (filetype == 2 & argn(2) <> 4) then
        mprintf("Description:\n");
        mprintf("\tReads data from file created with MicroDAQ ''To File'' block\n");
        mprintf("Usage:\n");
        mprintf("\tmdaqFileData(name, type, rows, cols);\n")
        mprintf("\tname - file name \n");
        mprintf("\ttype - file type to read data from (1 - text (csv) | 2 - binary)\n");
        mprintf("\trows - number of rows (optinal for text filetype)\n");
        mprintf("\tcols - number of columns (optinal for text filetype)\n");
        return;
    end

    [mdaq_ip_address, res] = mdaq_get_ip();
    if res < 0 then
        disp("ERROR: Unable to get IP address!")
        return;
    end
    [tmp_file res] = getURL('http://' + mdaq_ip_address + '/user-disk/dsp/data/' + filename, TMPDIR);

    if isfile(tmp_file) & (strindex(res,'404 - Not Found') == []) then
        if filetype == 1 then
            result = fscanfMat(tmp_file);
            if argn(2) == 4 then
                nrows = rows;
                if nrows > size(result, 1) then
                    nrows = size(result, 1);
                end
                ncols = cols;
                if ncols > size(result, 2) then
                    ncols = size(result, 2)
                end
                result = resize_matrix(result, nrows, ncols);
            end

        elseif filetype == 2 then
            fd1 = mopen(tmp_file,'rb');
            data_count = rows*cols;
            data = mget(rows*cols,'d',fd1);

            if size(data, 2) < data_count then
                //disp("ERROR: !");
                data_count = size(data, 2);
            end

            for i=1:cols
                result = [result; data(i:cols:data_count)];
            end
            result = result';
            mclose(fd1)
        else
            error("Unsupported file type, use: 1 - text (csv), 2 - binary");
        end
        mdelete(tmp_file);
    else
        error("File not found!");
    end

endfunction

function result = mdaqFileData(filename, filetype, rows, cols)
    result = [];

    if (argn(2) > 4 | argn(2) < 2) | (filetype == 2 & argn(2) <> 4) then
        mprintf("Description:\n");
        mprintf("\tReads data from file created with MicroDAQ ''To File'' block\n");
        mprintf("Usage:\n");
        mprintf("\tmdaqFileData(name, type, rows, cols);\n")
        mprintf("\tname - name of file from user-disk/dsp/data\n");
        mprintf("\ttype - (1 - text | 2 - binary)\n");
        mprintf("\trows - number of rows (optinal for text filetype)\n");
        mprintf("\tcols - number of rows (optinal for text filetype)\n");
        return;
    end

    [mdaq_ip_address, res] = mdaq_get_ip();
    if res < 0 then
        disp("ERROR: Unable to get IP address!")
        return;
    end
    [tmp_file res] = getURL('http://' + mdaq_ip_address + '/user-disk/dsp/data/' + filename, TMPDIR);

    if isfile(tmp_file) & (strindex(res,'404 - Not Found') == []) then
        if filetype == 1 then
            result = fscanfMat(tmp_file);
            if argn(2) == 4 then
                nrows = rows;
                if nrows > size(result, 1) then
                    nrows = size(result, 1);
                end
                ncols = cols;
                if ncols > size(result, 2) then
                    ncols = size(result, 2)
                end
                result = resize_matrix(result, nrows, ncols);
            end

        elseif filetype == 2 then
            fd1 = mopen(tmp_file,'rb');
            data_count = rows*cols;
            data = mget(rows*cols,'d',fd1);

            if size(data, 2) < data_count then
                //disp("ERROR: !");
                data_count = size(data, 2);
            end

            for i=1:cols
                result = [result; data(i:cols:data_count)];
            end
            result = result';
            mclose(fd1)
        else
            disp("ERROR: Invalid filetype! (1 - text, 2 - binary)");
        end
        mdelete(tmp_file);
    else
        disp("ERROR: File not found!");
    end

endfunction


Remove double error printing

Remove double error printing

Use mdaq_error() instead of disp(mdaq_error())

function fw_ver = mdaq_fw_version()
    connection_id = mdaq_open();
    if connection_id > -1  then
        result = [];
        [fw_ver, result] = call("sci_mlink_version",..
                                connection_id, 1, "i",..
                            "out",..
                                [4,1], 2, "i",..
                                [1,1], 3, "i");

        mdaq_close(connection_id);
        if result < 0 then
            mdaq_error(result);
        end
    else
        disp("Unable to connect to MicroDAQ device!");
        fw_ver = [];
    end
    fw_ver = fw_ver';
    clear result;
endfunction

function fw_ver = mdaq_fw_version()
    connection_id = mdaq_open();
    if connection_id > -1  then
        result = [];
        [fw_ver, result] = call("sci_mlink_version",..
                                connection_id, 1, "i",..
                            "out",..
                                [4,1], 2, "i",..
                                [1,1], 3, "i");

            mdaq_close(connection_id);

            if result < 0 then
                disp(mdaq_error(result));
            end
    else
        disp("Unable to connect to MicroDAQ device!");
        fw_ver = [];
    end
    fw_ver = fw_ver';
    clear result;
endfunction