fix for SCHEDULING-1392

fix for SCHEDULING-1392

git-svn-id: 27916816d6cfa57849e9a885196bf7392b80e1ac@20854 28e8926c-6b08-0410-baaa-805c5e19b8d6

function res=PAResult(future,taskinfo)
    global ('PAResult_DB');
    if typeof(PAResult_DB) ~= 'list'
        PAResult_DB = list();
    end
    PAResult_DB($+1) = %f;
    rid = length(PAResult_DB);
    jimport java.util.concurrent.atomic.AtomicBoolean;
    jautoUnwrap(%t);
    jimport java.lang.StringBuilder;
    res = tlist(['PAResult','future','cleanFileSet','cleanDirSet', 'outFile','jobid','taskid', 'cleaned', 'logsPrinted','logs','waited','iserror','resultSet','rid'],future, taskinfo.cleanFileSet, taskinfo.cleanDirSet, taskinfo.outFile, taskinfo.jobid, taskinfo.taskid, jnewInstance(AtomicBoolean,%f), jnewInstance(AtomicBoolean,%f), jnewInstance(StringBuilder), jnewInstance(AtomicBoolean,%f), jnewInstance(AtomicBoolean,%f),jnewInstance(AtomicBoolean,%f), rid);

endfunction

function res=PAResult(future,taskinfo)
    global ('PAResult_DB');
    if ~exists('PAResult_DB')
        PAResult_DB = list();
    end
    PAResult_DB($+1) = %f;
    rid = length(PAResult_DB);
    jimport java.util.concurrent.atomic.AtomicBoolean;
    jautoUnwrap(%t);
    jimport java.lang.StringBuilder;
    res = tlist(['PAResult','future','cleanFileSet','cleanDirSet', 'outFile','jobid','taskid', 'cleaned', 'logsPrinted','logs','waited','iserror','resultSet','rid'],future, taskinfo.cleanFileSet, taskinfo.cleanDirSet, taskinfo.outFile, taskinfo.jobid, taskinfo.taskid, jnewInstance(AtomicBoolean,%f), jnewInstance(AtomicBoolean,%f), jnewInstance(StringBuilder), jnewInstance(AtomicBoolean,%f), jnewInstance(AtomicBoolean,%f),jnewInstance(AtomicBoolean,%f), rid);

endfunction


minor fixes

minor fixes

clear(); // Löschen aller Variablen
clearglobal(); // Löschen aller globalen Variablen

//********************************************
//              CONSTANTS
//********************************************

PI = 3.14;

//********************************************
//      READ IN THE FUNCTIONS.SCI FIlE
//  containing numiercal and plotting routines
//********************************************

// not sure what's the cleaner way, but i'll go with getd()
getd("./")
//exec('./functions.sci');

//********************************************
//              DATA-IMPORT
//********************************************

// Öffnendialog starten
data_path = uigetfile("*.*","","Select CSV data",%t);

// Einlesen der Daten
delimiter = " ";                                // Ist klar
regex_ignore = '/(Track).*$/';                  // Löschen aller mit "Track" beginnenden Zeilen
header = 5;                                     // Anzahl an Zeilen im Kopf
data = csvRead(data_path, delimiter, [], [], [], regex_ignore, [], header);

// Meta-Daten der Bilder
numberOfTracks = size(data,1) / max(data(:, 2))           // Number of Tracks
numberOfImages = max(data(:, 2))                          // Number of Images per Track
DELTA_T = 0.02;                                 // 50 FPS
CALIBRATION = 300;                              // Pix per m is correct, get the cal ratio from user via dialog box
Y_RESOLUTION = 576 / 300;                             // Höhe in Pixeln

// Kalibrieren
data = data / CALIBRATION;

// Eingelesenen Datensatz gemäß der Logik beim Tracken in 8 Datensätze unterteilen
// Jeder Datensatz wird logisch in x und y Werte unterteilt
// Gelenk.x und Gelenk.y enthalten jeweils eine 1 spaltige Matrix mit Koordinatenwerten
// Multiplikation mit -1 der y-Werte um "natürliches Koordinatensystem" zu erhalten
for i = 1 : numberOfTracks
    if i == 1 then
        toes.x = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 3);
        toes.y = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 4) * (-1) + Y_RESOLUTION;
    elseif i == 2 then
        ankle.x = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 3);
        ankle.y = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 4) * (-1) + Y_RESOLUTION;
    elseif i == 3 then
        knee.x = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 3);
        knee.y = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 4) * (-1) + Y_RESOLUTION;
    elseif i == 4 then
        hip.x = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 3);
        hip.y = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 4) * (-1) + Y_RESOLUTION;
    elseif i == 5 then
        shoulder.x = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 3);
        shoulder.y = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 4) * (-1) + Y_RESOLUTION;
    elseif i == 6 then
        elbow.x = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 3);
        elbow.y = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 4) * (-1) + Y_RESOLUTION;
    elseif i == 7 then
        hand.x = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 3);
        hand.y = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 4) * (-1) + Y_RESOLUTION;
    elseif i == 8 then
        neck.x = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 3);
        neck.y = data(numberOfImages*(i - 1) + 1:i*numberOfImages , 4) * (-1) + Y_RESOLUTION;
    end
end

plot (toes.x, toes.y, 'or');
// plot(knee.x,knee.y,'or'); // Plot x, y, ?

//savetarget = uiputfile("*.txt*");

//fprintfMat(savetarget, UsS); // Speichern fprintfMat(Zielpfad, Daten)

clear(); // Löschen aller Variablen
clearglobal(); // Löschen aller globalen Variablen

//********************************************
//              CONSTANTS
//********************************************

PI = 3.14;

//********************************************
//      READ IN THE FUNCTIONS.SCI FIlE
//  containing numiercal and plotting routines
//********************************************

// not sure what's the cleaner way, but i'll go with getd()
getd("./")
//exec('./functions.sci');

//********************************************
//              DATA-IMPORT
//********************************************

// Öffnendialog starten
data_path = uigetfile("*.*","","Select CSV data",%t);

// Einlesen der Daten
delimiter = " ";                                // Ist klar
regex_ignore = '/(Track).*$/';                  // Löschen aller mit "Track" beginnenden Zeilen
header = 5;                                     // Anzahl an Zeilen im Kopf
data = csvRead(data_path, delimiter, [], [], [], regex_ignore, [], header);

// Meta-Daten der Bilder
nOfT = size(data,1) / max(data(:, 2))           // Number of Tracks
nOfI = max(data(:, 2))                          // Number of Images per Track
DELTA_T = 0.02;                                 // 50 FPS
CALIBRATION = 300;                              // Pix per m is correct, get the cal ratio from user via dialog box
Y_RESOLUTION = 576;                             // Höhe in Pixeln

// Kalibrieren
data = data / CALIBRATION;

// Eingelesenen Datensatz gemäß der Logik beim Tracken in 8 Datensätze unterteilen
// Jeder Datensatz wird logisch in x und y Werte unterteilt
// Gelenk.x und Gelenk.y enthalten jeweils eine 1 spaltige Matrix mit Koordinatenwerten
// Multiplikation mit -1 der y-Werte um "natürliches Koordinatensystem" zu erhalten
for i = 1 : nOfT
    if i == 1 then
        toes.x = data(nOfI*(i - 1) + 1:i*nOfI , 3);
        toes.y = data(nOfI*(i - 1) + 1:i*nOfI , 4) * (-1) + Y_RESOLUTION;
    elseif i == 2 then
        ankle.x = data(nOfI*(i - 1) + 1:i*nOfI , 3);
        ankle.y = data(nOfI*(i - 1) + 1:i*nOfI , 4) * (-1) + Y_RESOLUTION;
    elseif i == 3 then
        knee.x = data(nOfI*(i - 1) + 1:i*nOfI , 3);
        knee.y = data(nOfI*(i - 1) + 1:i*nOfI , 4) * (-1) + Y_RESOLUTION;
    elseif i == 4 then
        hip.x = data(nOfI*(i - 1) + 1:i*nOfI , 3);
        hip.y = data(nOfI*(i - 1) + 1:i*nOfI , 4) * (-1) + Y_RESOLUTION;
    elseif i == 5 then
        shoulder.x = data(nOfI*(i - 1) + 1:i*nOfI , 3);
        shoulder.y = data(nOfI*(i - 1) + 1:i*nOfI , 4) * (-1) + Y_RESOLUTION;
    elseif i == 6 then
        elbow.x = data(nOfI*(i - 1) + 1:i*nOfI , 3);
        elbow.y = data(nOfI*(i - 1) + 1:i*nOfI , 4) * (-1) + Y_RESOLUTION;
    elseif i == 7 then
        hand.x = data(nOfI*(i - 1) + 1:i*nOfI , 3);
        hand.y = data(nOfI*(i - 1) + 1:i*nOfI , 4) * (-1) + Y_RESOLUTION;
    elseif i == 8 then
        neck.x = data(nOfI*(i - 1) + 1:i*nOfI , 3);
        neck.y = data(nOfI*(i - 1) + 1:i*nOfI , 4) * (-1) + Y_RESOLUTION;
    end
end

plot (toes.x, toes.y, 'or');
// plot(knee.x,knee.y,'or'); // Plot x, y, ?

//savetarget = uiputfile("*.txt*");

//fprintfMat(savetarget, UsS); // Speichern fprintfMat(Zielpfad, Daten)


INTEGRATION: CWS unoapi3 (1.3.16); FILE MERGED 2008/01/14 11:13:51 cn 1.3.16.1: #i84995# update issues

-o lng.DicList
-o lng.LinguProps
#i84435 -o lng.LngSvcMgr

-o lng.LinguProps
-o lng.LngSvcMgr
-o lng.DicList


git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/proactive/trunk@3628 28e8926c-6b08-0410-baaa-805c5e19b8d6

//need to initialize variable n
for i=1:n,
  for j=1:n,
    if i==j then
      x(i,j)=2;
    else x(i,j)=4;
    end;
  end;
end;

y=tril(x);


Remove mprintf error in function description

function mdaq_ao_data_queue(arg1, arg2, arg3)
    global %microdaq;
    link_id = -1;

    if argn(2) == 2 then
        data = arg1;
        blocking = arg2;
    end

    if argn(2) == 3 then
        link_id = arg1;
        data = arg2;
        blocking = arg3;

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

    if argn(2) > 3 | argn(2) < 2 then
        mprintf("Description:\n");
        mprintf("\tQueues AO channel data in scanning continuous mode.\n");
        mprintf("Usage:\n");
        mprintf("\tmdaq_ao_data_queue(link_id, data, blocking);\n")
        mprintf("\tlink_id - connection id returned by mdaq_open() (OPTIONAL)\n");
        mprintf("\tdata - AO scan data");
        disp("       blocking - blocking mode (%T-enable, %F-disable)");
        return;
    end

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

//    if size(data, "c") > 1 & size(data, "r") > 1 then
//        error("ERROR: Wrong AO scan data size");
//        return
//    end
    if blocking == %T then
            blocking = 1;
    elseif blocking == %F then
            blocking = 0;
    elseif blocking > 0 then
            blocking = 1;
    else
            blocking = 0;
    end

    data_size = size(data, "*");
    ch_count = %microdaq.private.ao_scan_ch_count;
    if ch_count <> size(data, "c") then
        if link_id > -1 then
            mdaq_close(link_id);
        end
        error("ERROR: Wrong AO scan data size or function is called before mdaq_ao_scan_init");
        return
    end

//MDAQ_API void sci_mlink_ao_data_queue(
//		IO		int 		*link_fd,
//		IN		double      *data,
//		IN		int			*data_size,
//		IN		int			*blocking,
//		OUT		int			*result)
//    mprintf("link_fd: %d\n", link_id)
//    disp(data);

    result = [];
    result = call("sci_mlink_ao_data_queue",..
                link_id, 1, "i",..
                data, 2, "d",..
                data_size, 3, "i",..
                blocking, 4, "i",..
                "out",..
                [1, 1], 5, "i");

    if result < 0  then
        if argn(2) == 2 then
            mdaq_close(link_id);
        end
        mdaq_error(result);
    end

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

function mdaq_ao_data_queue(arg1, arg2, arg3)
    global %microdaq;
    link_id = -1;

    if argn(2) == 2 then
        data = arg1;
        blocking = arg2;
    end

    if argn(2) == 3 then
        link_id = arg1;
        data = arg2;
        blocking = arg3;

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

    if argn(2) > 3 | argn(2) < 2 then
        mprintf("Description:\n");
        mprintf("\tQueues AO channel data in scanning continuous mode.\n");
        mprintf("Usage:\n");
        mprintf("\tmdaq_ao_data_queue(link_id, data, blocking);\n")
        mprintf("\tlink_id - connection id returned by mdaq_open() (OPTIONAL)\n");
        mprintf("\tdata - AO scan data\n");
        mprintf("\tblocking - blocking mode (%T-enable, %F-disable)\n");
        return;
    end

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

//    if size(data, "c") > 1 & size(data, "r") > 1 then
//        error("ERROR: Wrong AO scan data size");
//        return
//    end
    if blocking == %T then
            blocking = 1;
    elseif blocking == %F then
            blocking = 0;
    elseif blocking > 0 then
            blocking = 1;
    else
            blocking = 0;
    end

    data_size = size(data, "*");
    ch_count = %microdaq.private.ao_scan_ch_count;
    if ch_count <> size(data, "c") then
        if link_id > -1 then
            mdaq_close(link_id);
        end
        error("ERROR: Wrong AO scan data size or function is called before mdaq_ao_scan_init");
        return
    end

//MDAQ_API void sci_mlink_ao_data_queue(
//		IO		int 		*link_fd,
//		IN		double      *data,
//		IN		int			*data_size,
//		IN		int			*blocking,
//		OUT		int			*result)
//    mprintf("link_fd: %d\n", link_id)
//    disp(data);

    result = [];
    result = call("sci_mlink_ao_data_queue",..
                link_id, 1, "i",..
                data, 2, "d",..
                data_size, 3, "i",..
                blocking, 4, "i",..
                "out",..
                [1, 1], 5, "i");

    if result < 0  then
        if argn(2) == 2 then
            mdaq_close(link_id);
        end
        mdaq_error(result);
    end

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


fix for SCHEDULING-1331

fix for SCHEDULING-1331

git-svn-id: 27916816d6cfa57849e9a885196bf7392b80e1ac@20413 28e8926c-6b08-0410-baaa-805c5e19b8d6

function val=PAResult_PAwaitFor(R,timeout)
    global ('PAResult_DB');
    //disp('PAResult_PAwaitFor : init')
    jimport org.objectweb.proactive.api.PAFuture;
    errormessage=[];
    ff = R.future;
    if argn(2) == 2

        RaL = PAFuture.getFutureValue(ff,timeout);
    else
        RaL = PAFuture.getFutureValue(ff);
    end
    if jinvoke(RaL,'isOK')
        //disp('PAResult_PAwaitFor : isOK')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            jinvoke(R.logs,'append',logs);
            jinvoke(R.logsPrinted,'set',%t);
            if ~isempty(logs) then
                printf('%s',logs);
            end
        end

        if jinvoke(R.resultSet,'get')
            //disp('PAResult_PAwaitFor : Result get')
            val=PAResult_DB(R.rid);
            //disp(val)
        else
            //disp('PAResult_PAwaitFor : Result set')
            load(R.outFile);
            val = out;
            PAResult_DB(R.rid) = out;
            //disp(val)
            jinvoke(R.resultSet,'set',%t);
        end

    elseif jinvoke(RaL,'isMatSciError');
        //disp('PAResult_PAwaitFor : isMatSciError')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            jinvoke(R.logs,'append',logs);
            jinvoke(R.logsPrinted,'set',%t);
            if ~isempty(logs) then
                printf('%s',logs);
            end
            //System.err.println(logs);
        end
        jinvoke(R.iserror,'set',%t);
        errormessage = 'PAResult:PAwaitFor Error during remote script execution';
    else
        //disp('PAResult_PAwaitFor : internalError')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            if ~isempty(logs) then
                jinvoke(R.logs,'append',logs);
                jinvoke(R.logsPrinted,'set',%t);
                printf('%s',logs);
            end

        end
        e = jinvoke(RaL,'getException');
        jimport org.ow2.proactive.scheduler.ext.scilab.client.ScilabSolver;
        exstr = ScilabSolver.getStackTrace(e);
        printf('%s',exstr);
        //err = java.lang.System.err;
        //jinvoke(e.printStackTrace(err);
        jinvoke(R.iserror,'set',%t);
        errormessage = 'PAResult:PAwaitFor Internal Error';
    end
    PAResult_clean(R);
    if errormessage ~= [] then
        val = [];
        error(errormessage)
    end
endfunction

function val=PAResult_PAwaitFor(R,timeout)
    global ('PAResult_DB');
    //disp('PAResult_PAwaitFor : init')
    jimport org.objectweb.proactive.api.PAFuture;
    errormessage=[];
    ff = R.future;
    if argn(2) == 2

        RaL = PAFuture.getFutureValue(ff,timeout);
    else
        RaL = PAFuture.getFutureValue(ff);
    end
    if jinvoke(RaL,'isOK')
        //disp('PAResult_PAwaitFor : isOK')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            jinvoke(R.logs,'append',logs);
            jinvoke(R.logsPrinted,'set',%t);
            if ~isempty(logs) then
                printf('%s',logs);
            end
        end

        if jinvoke(R.resultSet,'get')
            //disp('PAResult_PAwaitFor : Result get')
            val=PAResult_DB(R.rid);
            //disp(val)
        else
            //disp('PAResult_PAwaitFor : Result set')
            load(R.outFile);
            val = out;
            PAResult_DB(R.rid) = out;
            //disp(val)
            jinvoke(R.resultSet,'set',%t);
        end

    elseif jinvoke(RaL,'isMatSciError');
        //disp('PAResult_PAwaitFor : isMatSciError')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            jinvoke(R.logs,'append',logs);
            jinvoke(R.logsPrinted,'set',%t);
            if ~isempty(logs) then
                printf('%s',logs);
            end
            //System.err.println(logs);
        end
        jinvoke(R.iserror,'set',%t);
        errormessage = 'PAResult:PAwaitFor Error during remote script execution';
    else
        //disp('PAResult_PAwaitFor : internalError')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            if ~isempty(logs) then
                jinvoke(R.logs,'append',logs);
                jinvoke(R.logsPrinted,'set',%t);
                printf('%s',logs);
            end

        end
        e = jinvoke(RaL,'getException');
        jimport org.ow2.proactive.scheduler.ext.scilab.client.ScilabSolver;
        exstr = ScilabSolver.getStackTrace(ex);
        printf('%s',exstr);
        //err = java.lang.System.err;
        //jinvoke(e.printStackTrace(err);
        jinvoke(R.iserror,'set',%t);
        errormessage = 'PAResult:PAwaitFor Internal Error';
    end
    PAResult_clean(R);
    if errormessage ~= [] then
        val = [];
        error(errormessage)
    end
endfunction


INTEGRATION: CWS unoapi1 (1.4.572); FILE MERGED 2007/07/19 08:33:12 cn 1.4.572.1: #i79479# update of files

-o svtools.AccessibleIconChoiceCtrlEntry
#-o svtools.AccessibleTabBarPage
-o svtools.AccessibleBrowseBox
-o svtools.AccessibleBrowseBoxHeaderBar
-o svtools.AccessibleBrowseBoxHeaderCell
-o svtools.AccessibleBrowseBoxTable
#-o svtools.AccessibleBrowseBoxTableCell
-o svtools.AccessibleIconChoiceCtrl
-o svtools.AccessibleTabBar
#-o svtools.AccessibleTabBarPageList
-o svtools.AccessibleTreeListBox
-o svtools.AccessibleTreeListBoxEntry

-o svtools.AccessibleIconChoiceCtrlEntry
-o svtools.AccessibleTabBarPage
-o svtools.AccessibleBrowseBox
-o svtools.AccessibleBrowseBoxHeaderBar
-o svtools.AccessibleBrowseBoxHeaderCell
-o svtools.AccessibleBrowseBoxTable
-o svtools.AccessibleBrowseBoxTableCell
-o svtools.AccessibleIconChoiceCtrl
-o svtools.AccessibleTabBar
-o svtools.AccessibleTabBarPageList
-o svtools.AccessibleTreeListBox
-o svtools.AccessibleTreeListBoxEntry


Fix condition for worning when duration < 0 but not = -1

function  mdaq_ao_scan_init(arg1, arg2, arg3, arg4, arg5, arg6, arg7)
    global %microdaq;

    link_id = -1;
    if argn(2) == 6 then
        channels = arg1;
        ao_range = arg2;
        continuous = arg3;
        ao_trigger = arg4;
        scan_freq = arg5;
        scan_time = arg6;
    end

    if argn(2) == 7 then
        link_id = arg1;
        channels = arg2;
        ao_range = arg3;
        continuous = arg4;
        ao_trigger = arg5;
        scan_freq = arg6;
        scan_time = arg7;

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

    global %microdaq;
    if %microdaq.private.mdaq_hwid <> [] then
        if  %microdaq.private.mdaq_hwid(3) == 0 then
            disp("ERROR: Unable to detect DAC configuration!");
            return;
        end
        dac_info = %microdaq.private.dac_info;
        if argn(2) > 6 | argn(2) < 5 then
        mprintf("Description:\n");
        mprintf("\Initiates AO scan\n");
        mprintf("Usage:\n");
        mprintf("\tmdaq_ao_scan_init(link_id, channels, range, continuous, trigger, frequency, duration);\n")
        mprintf("\tlink_id - connection id returned by mdaq_open() (OPTIONAL)\n");
        mprintf("\tchannels - analog output channels to write\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("\tcontinuous - scanning mode (%%T/%%F)\n");
        mprintf("\ttrigger - DIO number (DIO1-8), high state triggers scanning\n");
        mprintf("\tfrequency - analog output scan frequency\n");
        mprintf("\tduration - analog output scan duration in seconds\n");
            return;
        end
    else
        error('Unable to detect MicroDAQ confituration - run mdaq_hwinfo and try again!');
        return;
    end

    if continuous == %T then
        continuous = 1;
    else
        continuous = 0;
    end

    if scan_time < 0 & scan_time <> -1 then
        mprintf("Warning: For infinite scan session as a duration parameter use -1 value instead!\n");
        scan_time = -1;
    end

    dac_ch_count = strtod(dac_info.channel);

    ch_count = max(size(channels));
    if ch_count < 1 | ch_count > dac_ch_count then
        disp("Error: Wrong AO channel selected!")
        return;
    end

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

    ao_range_desc_index = ao_range;
    try
        ao_range = dac_info.c_params.c_range(ao_range);
    catch
        error("Error: wrong AO range selected!");
    end

    if size(ao_range, "*") == 1 then
        tmp = ones(1, ch_count);
        ao_range = tmp * ao_range;
    else
        //if size(ao_range, "*") <> ch_count then
            disp("ERROR: Wrong AO range selected!");
            return;
       // end
    end

    if ao_range > 4 | ao_range < 0 then
        disp("ERROR: Wrong AO output range!")
        return;
    end
    if ao_trigger == [] | ao_trigger > 8 then
        ao_trigger = 0;
    end

    if continuous == %T | continuous == 1 then
        continuous = 1;
    else
        continuous = 0;
    end

    %microdaq.private.ao_scan_ch_count = ch_count;

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

    result = [];
    result = call("sci_mlink_ao_scan_init",..
            link_id, 1, "i",..
            channels, 2, "i",..
            ch_count, 3, "i",..
            ao_range, 4, "i",..
            continuous, 5, "i", ..
            ao_trigger,6, "i",..
            scan_freq, 7, "d",..
            scan_time, 8, "d",..
        "out",..
            [1, 1], 9, "i");

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

    if result < 0 then
        error(mdaq_error2(result), 10000 + abs(result));
    else
        if result == 1 then
            mprintf("\nWARNING: Your MicroDAQ device does not allow running AI and AO scanning session simultaneously.\n")
        end

        mprintf("\nData acquisition session settings:\n");

        range_table = [ "0-5V" "0-10V" "±5V" "±10V" "±2.5V" ];
        str = "";
        s = size(channels);
        for j=1:s(2)
            if j > 1
              str = str + ", ";
            end
            str = str + string(channels(1,j)) + "(" + dac_info.c_params.c_range_desc(ao_range_desc_index) +")";
        end
        mprintf("\tChannles:\t%s\n", str);

        if ao_trigger == 0 then
            mprintf("\tTrigger:\tNONE\n");
        else
            mprintf("\tTrigger:\tDIO%d\n", ao_trigger);
        end

        if scan_freq >= 1000
            mprintf("\tFrequency:\t%.3fkHz\n", scan_freq/1000);
        else
            mprintf("\tFrequency:\t%dHz\n", scan_freq);
        end

        if scan_time < 0
            mprintf("\tDuration:\tInf\n");
            mprintf("\tScan count:\tInf");
        else
            mprintf("\tDuration:\t%.2fsec\n", scan_time);
            mprintf("\tScan count:\t%d", scan_time * scan_freq);
        end
    end
endfunction

function  mdaq_ao_scan_init(arg1, arg2, arg3, arg4, arg5, arg6, arg7)
    global %microdaq;

    link_id = -1;
    if argn(2) == 6 then
        channels = arg1;
        ao_range = arg2;
        continuous = arg3;
        ao_trigger = arg4;
        scan_freq = arg5;
        scan_time = arg6;
    end

    if argn(2) == 7 then
        link_id = arg1;
        channels = arg2;
        ao_range = arg3;
        continuous = arg4;
        ao_trigger = arg5;
        scan_freq = arg6;
        scan_time = arg7;

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

    global %microdaq;
    if %microdaq.private.mdaq_hwid <> [] then
        if  %microdaq.private.mdaq_hwid(3) == 0 then
            disp("ERROR: Unable to detect DAC configuration!");
            return;
        end
        dac_info = %microdaq.private.dac_info;
        if argn(2) > 6 | argn(2) < 5 then
        mprintf("Description:\n");
        mprintf("\Initiates AO scan\n");
        mprintf("Usage:\n");
        mprintf("\tmdaq_ao_scan_init(link_id, channels, range, continuous, trigger, frequency, duration);\n")
        mprintf("\tlink_id - connection id returned by mdaq_open() (OPTIONAL)\n");
        mprintf("\tchannels - analog output channels to write\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("\tcontinuous - scanning mode (%%T/%%F)\n");
        mprintf("\ttrigger - DIO number (DIO1-8), high state triggers scanning\n");
        mprintf("\tfrequency - analog output scan frequency\n");
        mprintf("\tduration - analog output scan duration in seconds\n");
            return;
        end
    else
        error('Unable to detect MicroDAQ confituration - run mdaq_hwinfo and try again!');
        return;
    end

    if continuous == %T then
        continuous = 1;
    else
        continuous = 0;
    end

    if scan_time < 0 then
        mprintf("Warning: wrong duration value, -1 will be used\n");
        scan_time = -1;
    end

    dac_ch_count = strtod(dac_info.channel);

    ch_count = max(size(channels));
    if ch_count < 1 | ch_count > dac_ch_count then
        disp("Error: Wrong AO channel selected!")
        return;
    end

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

    ao_range_desc_index = ao_range;
    try
        ao_range = dac_info.c_params.c_range(ao_range);
    catch
        error("Error: wrong AO range selected!");
    end

    if size(ao_range, "*") == 1 then
        tmp = ones(1, ch_count);
        ao_range = tmp * ao_range;
    else
        //if size(ao_range, "*") <> ch_count then
            disp("ERROR: Wrong AO range selected!");
            return;
       // end
    end

    if ao_range > 4 | ao_range < 0 then
        disp("ERROR: Wrong AO output range!")
        return;
    end
    if ao_trigger == [] | ao_trigger > 8 then
        ao_trigger = 0;
    end

    if continuous == %T | continuous == 1 then
        continuous = 1;
    else
        continuous = 0;
    end

    %microdaq.private.ao_scan_ch_count = ch_count;

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

    result = [];
    result = call("sci_mlink_ao_scan_init",..
            link_id, 1, "i",..
            channels, 2, "i",..
            ch_count, 3, "i",..
            ao_range, 4, "i",..
            continuous, 5, "i", ..
            ao_trigger,6, "i",..
            scan_freq, 7, "d",..
            scan_time, 8, "d",..
        "out",..
            [1, 1], 9, "i");

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

    if result < 0 then
        error(mdaq_error2(result), 10000 + abs(result));
    else
        if result == 1 then
            mprintf("\nWARNING: Your MicroDAQ device does not allow running AI and AO scanning session simultaneously.\n")
        end

        mprintf("\nData acquisition session settings:\n");

        range_table = [ "0-5V" "0-10V" "±5V" "±10V" "±2.5V" ];
        str = "";
        s = size(channels);
        for j=1:s(2)
            if j > 1
              str = str + ", ";
            end
            str = str + string(channels(1,j)) + "(" + dac_info.c_params.c_range_desc(ao_range_desc_index) +")";
        end
        mprintf("\tChannles:\t%s\n", str);

        if ao_trigger == 0 then
            mprintf("\tTrigger:\tNONE\n");
        else
            mprintf("\tTrigger:\tDIO%d\n", ao_trigger);
        end

        if scan_freq >= 1000
            mprintf("\tFrequency:\t%.3fkHz\n", scan_freq/1000);
        else
            mprintf("\tFrequency:\t%dHz\n", scan_freq);
        end

        if scan_time < 0
            mprintf("\tDuration:\tInf\n");
            mprintf("\tScan count:\tInf");
        else
            mprintf("\tDuration:\t%.2fsec\n", scan_time);
            mprintf("\tScan count:\t%d", scan_time * scan_freq);
        end
    end
endfunction


sb120: #i111178# disabled failing tests for now

-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

-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
-o sw.SwAccessibleTextEmbeddedObject
-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


sb123: #i113142# disabled sw.SwAccessibleFooterView and sw.SwAccessibleHeaderView for now

-o sw.CharacterStyle
-o sw.ConditionalParagraphStyle
-o sw.PageStyle
-o sw.ParagraphStyle
#i111197 -o sw.SwAccessibleDocumentPageView
#i86751 -o sw.SwAccessibleDocumentView
-o sw.SwAccessibleEndnoteView
#i113142 -o sw.SwAccessibleFooterView
-o sw.SwAccessibleFootnoteView
#i113142 -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
-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


Fix inconsistent quotation... 2

Fix inconsistent quotation... 2

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

    if  check_mdaq_compiler() == %F then
        disp("ERROR: Compiler not found - run microdaq_setup! ");
        return;
    end

    if argn(2) < 1 then
        host_build = %T;
    end

    root_path = mdaq_toolbox_path();
    userlib_src_path = root_path + filesep() + "src" + filesep() + "c"+ filesep() + "userlib" + filesep();
    userlib_path = root_path + filesep() + "etc" + filesep() + "userlib" + filesep() + "lib" + filesep();
    userhostlib_path = root_path + filesep() + "etc" + filesep() + "userlib" + filesep() + "hostlib" + filesep();
    macros_path = mdaq_toolbox_path() + "macros" + filesep() + "user_blocks" + filesep();

    p_dir = pwd();
    chdir(userlib_src_path);
    GMAKE = root_path + "\etc\bin\gmake.exe";
    mprintf(" ### Building DSP library...\n")
    if getenv('WIN32','NO')=='OK' then
        if argn(2) > 1 & argn(2) < 3 then
            if debug_build then
                unix_w(GMAKE + ' -f Makefile' + ' OPT_FLAG=-g');
            else
                unix_w(GMAKE + ' -f Makefile' );
            end

        else
            unix_w(GMAKE + ' -f Makefile' );
        end

    else
        if argn(2) > 0 & argn(2) < 2 then
            if debug_build then
                unix_w('make' + ' OPT_FLAG=-g')
            else
                unix_w('make')
            end
        else
            unix_w('make')
        end

    end

    //delete old one
    mdelete(userlib_path+'userlib');

    if isfile("userlib.lib") then
        copyfile("userlib.lib", userlib_path);
    end

    //Building userdll for host
    if haveacompiler() & (host_build == %T) then
        if %microdaq.private.userhostlib_link_id <> -1000 then
                ulink(%microdaq.private.userhostlib_link_id);
        end
        //delete files related to user blocks
        mdelete(userhostlib_path+'loader.sce');
        mdelete(userhostlib_path+'libuserhost'+getdynlibext());
        mdelete(macros_path+'lib');
        mdelete(macros_path+'names');
        mdelete(macros_path+'*.bin');
        try
            xcosPalDelete("MicroDAQ User");
        catch

        end

        c_files = ls("*.c");
        if c_files == [] then
            chdir(p_dir);
            return;
        end

        mprintf(" ### Building host library...\n")
        //get list of existing blocks
        blocks = [];
        cd(macros_path);
        macros = ls("*_sim.sci")
        for i=1:size(macros,'*')
            blocks(i) = part(macros(i), 1:length(macros(i)) - 8);
        end
        chdir(userlib_src_path);

        c_flags = "";
        scicos_libpath = "";
        os = getos();
        if os == 'Windows' then
            cflags = "-I scilab";
            scicos_libpath = SCI + filesep() + "bin" + filesep() + "scicos"
        elseif os == 'Linux' then
            cflags    = '-I '+pwd()+filesep()+'scilab';
            scicos_libpath = SCI+"/../../lib/scilab/libsciscicos";
        else
            error("This platform is not supported!");
        end

        ldflags=['-lpthread -lstdc++ -lm '];
        libs=[scicos_libpath];

        tbx_build_src(blocks, c_files', 'c', userlib_src_path ,libs , "", cflags, "", "", "userhost", "loader.sce");

        //generate custom loader
        blocks_link = "";
        for i=1:max(size(blocks))
            blocks_link =blocks_link+'''' +blocks(i)+''''
            if i <> max(size(blocks)) then
                blocks_link = blocks_link + ',';
            end
        end

        disp(blocks_link);

        loader_template = [
        '//Generated by mdaq_block_build function, do not change content.'
        'global %microdaq;'
        ''
        '//ulink previous library'
        'if %microdaq.private.userhostlib_link_id <> -1000 then'
        '   ulink(%microdaq.private.userhostlib_link_id);'
        'end'
        ''
        'userhost_path = get_absolute_file_path(''loader.sce'');'
        '%microdaq.private.userhostlib_link_id = link(userhost_path+''libuserhost''+getdynlibext(), ['+blocks_link'+'], ''c'');'
        'clear userhost_path;'
        ];

        fd = mopen('loader.sce','wt');
        mputl(loader_template,fd);
        mclose(fd);

        if isfile("libuserhost"+getdynlibext()) then
            if isdir(userhostlib_path) == %F then
                mkdir(userhostlib_path);
            end

            copyfile("libuserhost"+getdynlibext(), userhostlib_path);
            copyfile("loader.sce", userhostlib_path);
            exec("cleaner.sce");
            exec(userhostlib_path+"loader.sce");
        end
    elseif haveacompiler() == %F then
        mprintf("WARNING: No compiler detected, cannot build user host library. Make sure that the valid\n")
        mprintf("\t compiler is installed. More information about supported compilers is available at:\n");
        mprintf("\t https://help.scilab.org/doc/5.5.2/en_US/supported_compilers.html");
    end

    userhostlib_loader = mdaq_toolbox_path() + pathconvert("/etc/userlib/hostlib/loader.sce", %f);
    if isfile(userhostlib_loader) then
        mprintf("\tLoad user host library\n");
        exec(userhostlib_loader);
    end

    mprintf(" ### Building user block macros...\n")

    tbx_build_macros("microdaq", macros_path);
    cd(mdaq_toolbox_path());
    tbx_build_blocks(mdaq_toolbox_path(), blocks, "macros" + filesep() + "user_blocks");
    chdir(p_dir);

    root_tlbx = mdaq_toolbox_path();
    //Reload user block palette
    if isfile(macros_path+'lib') == %T
        //microdaqUserBlocks = lib(macros_path);
        getd(macros_path);
        mprintf("\tReload MicroDAQ User blocks\n");
        blocks = [];

        tmp_path = pwd();
        cd(macros_path);
        macros = ls("mdaq_*.bin");
        cd(tmp_path);

        for b=1:size(macros, "r")
            macros(b) = part(macros(b), 1:length(macros(b)) - 4);
            if strstr(macros(b), "_sim") == ""
                if isfile(macros_path + macros(b) + '.sci')  == %T then
                    blocks = [blocks, macros(b)];
                end
            end
        end
        pal = xcosPal("MicroDAQ User");

        for i=1:size(blocks, "*")
            h5  = ls(root_tlbx + "/images/h5/"  + blocks(i) + "." + ["sod" "h5"]);
            gif = ls(root_tlbx + "/images/gif/" + blocks(i) + "." + ["png" "jpg" "gif"]);
            svg = ls(root_tlbx + "/images/svg/" + blocks(i) + "." + ["png" "jpg" "gif" "svg"]);
            pal = xcosPalAddBlock(pal, h5(1), gif(1), svg(1));
        end

        if ~xcosPalAdd(pal,"MicroDAQ User") then
            error(msprintf(gettext("%s: Unable to export %s.\n"), "microdaq.start", "pal"));
        end
    end
endfunction

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

    if  check_mdaq_compiler() == %F then
        disp("ERROR: Compiler not found - run microdaq_setup! ");
        return;
    end

    if argn(2) < 1 then
        host_build = %T;
    end

    root_path = mdaq_toolbox_path();
    userlib_src_path = root_path + filesep() + "src" + filesep() + "c"+ filesep() + "userlib" + filesep();
    userlib_path = root_path + filesep() + "etc" + filesep() + "userlib" + filesep() + "lib" + filesep();
    userhostlib_path = root_path + filesep() + "etc" + filesep() + "userlib" + filesep() + "hostlib" + filesep();
    macros_path = mdaq_toolbox_path() + "macros" + filesep() + "user_blocks" + filesep();

    p_dir = pwd();
    chdir(userlib_src_path);
    GMAKE = root_path + "\etc\bin\gmake.exe";
    mprintf(" ### Building DSP library...\n")
    if getenv('WIN32','NO')=='OK' then
        if argn(2) > 1 & argn(2) < 3 then
            if debug_build then
                unix_w(GMAKE + ' -f Makefile' + ' OPT_FLAG=-g');
            else
                unix_w(GMAKE + ' -f Makefile' );
            end

        else
            unix_w(GMAKE + ' -f Makefile' );
        end

    else
        if argn(2) > 0 & argn(2) < 2 then
            if debug_build then
                unix_w('make' + ' OPT_FLAG=-g')
            else
                unix_w('make')
            end
        else
            unix_w('make')
        end

    end

    //delete old one
    mdelete(userlib_path+'userlib');

    if isfile("userlib.lib") then
        copyfile("userlib.lib", userlib_path);
    end

    //Building userdll for host
    if haveacompiler() & (host_build == %T) then
        if %microdaq.private.userhostlib_link_id <> -1000 then
                ulink(%microdaq.private.userhostlib_link_id);
        end
        //delete files related to user blocks
        mdelete(userhostlib_path+'loader.sce');
        mdelete(userhostlib_path+'libuserhost'+getdynlibext());
        mdelete(macros_path+'lib');
        mdelete(macros_path+'names');
        mdelete(macros_path+'*.bin');
        try
            xcosPalDelete("MicroDAQ User");
        catch

        end

        c_files = ls("*.c");
        if c_files == [] then
            chdir(p_dir);
            return;
        end

        mprintf(" ### Building host library...\n")
        //get list of existing blocks
        blocks = [];
        cd(macros_path);
        macros = ls("*_sim.sci")
        for i=1:size(macros,'*')
            blocks(i) = part(macros(i), 1:length(macros(i)) - 8);
        end
        chdir(userlib_src_path);

        c_flags = "";
        scicos_libpath = "";
        os = getos();
        if os == 'Windows' then
            cflags = "-I scilab";
            scicos_libpath = SCI + filesep() + "bin" + filesep() + "scicos"
        elseif os == 'Linux' then
            cflags    = '-I '+pwd()+filesep()+'scilab';
            scicos_libpath = SCI+"/../../lib/scilab/libsciscicos";
        else
            error("This platform is not supported!");
        end

        ldflags=['-lpthread -lstdc++ -lm '];
        libs=[scicos_libpath];

        tbx_build_src(blocks, c_files', 'c', userlib_src_path ,libs , "", cflags, "", "", "userhost", "loader.sce");

        //generate custom loader
        blocks_link = "";
        for i=1:max(size(blocks))
            blocks_link =blocks_link+'''' +blocks(i)+''''
            if i <> max(size(blocks)) then
                blocks_link = blocks_link + ',';
            end
        end

        disp(blocks_link);

        loader_template = [
        '//Generated by mdaq_block_build function, do not change content.'
        'global %microdaq;'
        ''
        '//ulink previous library'
        'if %microdaq.private.userhostlib_link_id <> -1000 then'
        '   ulink(%microdaq.private.userhostlib_link_id);'
        'end'
        ''
        'userhost_path = get_absolute_file_path(''loader.sce'');'
        '%microdaq.private.userhostlib_link_id = link(userhost_path+''libuserhost''+getdynlibext(), ['+blocks_link'+'], ''c'');'
        'clear userhost_path;'
        ];

        fd = mopen('loader.sce','wt');
        mputl(loader_template,fd);
        mclose(fd);

        if isfile("libuserhost"+getdynlibext()) then
            if isdir(userhostlib_path) == %F then
                mkdir(userhostlib_path);
            end

            copyfile("libuserhost"+getdynlibext(), userhostlib_path);
            copyfile("loader.sce", userhostlib_path);
            exec("cleaner.sce");
            exec(userhostlib_path+"loader.sce");
        end
    elseif haveacompiler() == %F then
        mprintf("WARNING: No compiler detected, cannot build user host library. Make sure that the valid\n")
        mprintf("\t compiler is installed. More information about supported compilers is available at:\n');
        mprintf("\t https://help.scilab.org/doc/5.5.2/en_US/supported_compilers.html');
    end

    userhostlib_loader = mdaq_toolbox_path() + pathconvert("/etc/userlib/hostlib/loader.sce", %f);
    if isfile(userhostlib_loader) then
        mprintf("\tLoad user host library\n");
        exec(userhostlib_loader);
    end

    mprintf(" ### Building user block macros...\n")

    tbx_build_macros("microdaq", macros_path);
    cd(mdaq_toolbox_path());
    tbx_build_blocks(mdaq_toolbox_path(), blocks, "macros" + filesep() + "user_blocks");
    chdir(p_dir);

    root_tlbx = mdaq_toolbox_path();
    //Reload user block palette
    if isfile(macros_path+'lib') == %T
        //microdaqUserBlocks = lib(macros_path);
        getd(macros_path);
        mprintf("\tReload MicroDAQ User blocks\n");
        blocks = [];

        tmp_path = pwd();
        cd(macros_path);
        macros = ls("mdaq_*.bin");
        cd(tmp_path);

        for b=1:size(macros, "r")
            macros(b) = part(macros(b), 1:length(macros(b)) - 4);
            if strstr(macros(b), "_sim") == ""
                if isfile(macros_path + macros(b) + '.sci')  == %T then
                    blocks = [blocks, macros(b)];
                end
            end
        end
        pal = xcosPal("MicroDAQ User");

        for i=1:size(blocks, "*")
            h5  = ls(root_tlbx + "/images/h5/"  + blocks(i) + "." + ["sod" "h5"]);
            gif = ls(root_tlbx + "/images/gif/" + blocks(i) + "." + ["png" "jpg" "gif"]);
            svg = ls(root_tlbx + "/images/svg/" + blocks(i) + "." + ["png" "jpg" "gif" "svg"]);
            pal = xcosPalAddBlock(pal, h5(1), gif(1), svg(1));
        end

        if ~xcosPalAdd(pal,"MicroDAQ User") then
            error(msprintf(gettext("%s: Unable to export %s.\n"), "microdaq.start", "pal"));
        end
    end
endfunction


Remove hwid during cleaning

Remove hwid during cleaning

// Copyright (c) 2015, Embedded Solutions
// All rights reserved.

// This file is released under the 3-clause BSD license. See COPYING-BSD.

function cleanmacros()
  libpath = get_absolute_file_path('cleanmacros.sce');

  binfiles = ls(libpath+'/*.bin');
  for i = 1:size(binfiles,'*')
    mdelete(binfiles(i));
  end

  mdelete(libpath+'/names');
  mdelete(libpath+'/lib');

  blockfiles = ls(libpath+'../images/h5/*.h5');
  for i = 1:size(blockfiles,'*')
    mdelete(blockfiles(i));
  end

  mdelete(libpath+'../etc/mlink/hwid');
endfunction

cleanmacros();
clear cleanmacros; // remove cleanmacros on stack

// Copyright (c) 2015, Embedded Solutions
// All rights reserved.

// This file is released under the 3-clause BSD license. See COPYING-BSD.

function cleanmacros()
  libpath = get_absolute_file_path('cleanmacros.sce');

  binfiles = ls(libpath+'/*.bin');
  for i = 1:size(binfiles,'*')
    mdelete(binfiles(i));
  end

  mdelete(libpath+'/names');
  mdelete(libpath+'/lib');

  blockfiles = ls(libpath+'../images/h5/*.h5');
  for i = 1:size(blockfiles,'*')
    mdelete(blockfiles(i));
  end
endfunction

cleanmacros();
clear cleanmacros; // remove cleanmacros on stack


Do not use mdaq_is_woring script

Do not use mdaq_is_woring script

function mdaqDSPBuild(diagram_file)
    if isfile(diagram_file) == %F then
        disp("ERROR: Xcos model file not found!");
        return;
    end

    // load Xcos libs if needed
    if isdef("c_pass1") == %F then
        loadXcosLibs();
    end

    importXcosDiagram(diagram_file);

    mdaq_code_gen(%F);
endfunction

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

    if isfile(diagram_file) == %F then
        disp("ERROR: Xcos model file not found!");
        return;
    end

    // load Xcos libs if needed
    if isdef("c_pass1") == %F then
        loadXcosLibs();
    end

    importXcosDiagram(diagram_file);

    mdaq_code_gen(%F);
endfunction


AO scan init - fix table summary info

AO scan init - fix table summary info

function  mdaqAOScanInit(arg1, arg2, arg3, arg4, arg5, arg6, arg7)
    global %microdaq;

    link_id = -1;
    if argn(2) == 6 then
        channels = arg1;
        data = arg2;
        ao_range = arg3;
        continuous = arg4;
        scan_freq = arg5;
        scan_time = arg6;
    end

    if argn(2) == 7 then
        link_id = arg1;
        channels = arg2;
        data = arg3;
        ao_range = arg4;
        continuous = arg5;
        scan_freq = arg6;
        scan_time = arg7;

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

    global %microdaq;
    if %microdaq.private.mdaq_hwid <> [] then
        if  %microdaq.private.mdaq_hwid(3) == 0 then
            disp("ERROR: Unable to detect DAC configuration!");
            return;
        end
        dac_info = %microdaq.private.dac_info;
        if argn(2) > 7 | argn(2) < 6 then
        mprintf("Description:\n");
        mprintf("\Initiates AO scanning session\n");
        mprintf("Usage:\n");
        mprintf("\tmdaqAOScanInit(linkId, channels, data, range, isContinuous, scanFrequency, duration);\n")
        mprintf("\tlinkId - connection id (optional)\n");
        mprintf("\tchannels - analog output channels to write\n");
        mprintf("\tdata - output data\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("\tisContinuous - mode of operation (%%T - continuous, %%F - periodic)\n");
        mprintf("\tscanFrequency - analog output scan frequency\n");
        mprintf("\tduration - analog output scan duration in seconds\n");
            return;
        end
    else
        error('Unable to detect MicroDAQ confituration - run mdaqHWInfo and try again!');
        return;
    end

    if continuous == %T then
        continuous = 1;
    else
        continuous = 0;
    end

    if scan_time < 0 & scan_time <> -1 then
        mprintf("WARNING: For infinite scan session as a duration parameter use -1 value instead!\n");
        scan_time = -1;
    end

    if size(channels, 'r') > 1 then
        error("Wrong channel - single row vector expected!")
    end

    if size(ao_range, 'c') <> 2 then
        error("Vector range [low,high;low,high;...] expected!")
        return;
    end

    ch_count = size(channels, "c");

    if size(ao_range, 'r') == 1 then
        range_tmp = ao_range;
        ao_range = ones(ch_count,2);
        ao_range(:,1) = range_tmp(1);
        ao_range(:,2) = range_tmp(2);
    end
    ao_range = matrix(ao_range', 1, ch_count*2);
    dac_ch_count = strtod(dac_info.channel);

    if size(data, "c") <> ch_count then
        error("Wrong output data - colums should match selected channels!")
    end

    data_size = size(data, "*");

    if ch_count < 1 | ch_count > dac_ch_count then
        error("Wrong AO channel selected!")
    end

    if max(channels) > dac_ch_count | min(channels) < 1 then
        error("Wrong AO channel selected!")
    end

    if continuous == %T | continuous == 1 then
        continuous = 1;
    else
        continuous = 0;
    end

    %microdaq.private.ao_scan_ch_count = ch_count;

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

    result = [];

    result = call("sci_mlink_ao_scan_init",..
                link_id, 1, "i",..
                channels, 2, "i",..
                ch_count, 3, "i",..
                data, 4, "d",..
                data_size, 5, "i",..
                ao_range, 6, "d",..
                continuous, 7, "i", ..
                scan_freq, 8, "d",..
                scan_time, 9, "d",..
            "out",..
                [1, 1], 10, "i");

    if argn(2) == 6 then
        mdaqClose(link_id);
    end

    if result < 0 then
        error(mdaq_error2(result), 10000 + abs(result));
    else
        if result == 1 then
            mprintf("\nWARNING: Your MicroDAQ device does not allow running AI and AO scanning session simultaneously.\n")
        end

        rows = [];
        row = '';
        adc_res = strtod(part(adc_info.resolution, 1:2))
        for j=1:ch_count
            dac_range = range_tmp(j, 2) - range_tmp(j, 1);
            resolution = string((int(dac_range/2^adc_res * 1000000)) / 1000);
            rangeStr="";
            if range_tmp(j, 1) < 0 then
                rangeStr = "±" + string(range_tmp(j, 2))+"V";
            else
                rangeStr = "0-" + string(range_tmp(j, 2))+"V";
            end
            rows = [rows; "AO"+string(channels(j)), rangeStr, resolution+"mV"]
        end

        mprintf("\nAnalog output scanning session settings:\n");
        mprintf("\t--------------------------------------------------\n")
        str2table(rows, ["Channel",  "Range", "Resolution"], 12)
        mprintf("\t--------------------------------------------------\n")

        if scan_freq >= 1000
            mprintf("\tScan frequency:\t\t%.5f kHz\n", scan_freq/1000);
        else
            mprintf("\tScan frequency:\t\t%d Hz\n", scan_freq);
        end
        if 1 /scan_freq > 0.001 then
            mprintf("\tScan period: \t\t%.5f seconds\n", 1 / scan_freq);
        end

        if 1 /scan_freq <= 0.001 then
            mprintf("\tScan period: \t\t%.5f ms\n", 1 / scan_freq * 1000);
        end
        if continuous == 1 then
            mprintf("\tMode:\t\t\tStream\n");
        else
            mprintf("\tMode:\t\t\tPeriodic\n");
        end

        mprintf("\tQueue data size: \t%sx%s\n", string(size(data,"c")), string(size(data,"r")))
        if scan_time < 0
            mprintf("\tNumber of channels:\t%d\n", ch_count)
            mprintf("\tNumber of scans:\tInf\n");
            mprintf("\tDuration:\t\tInf\n");
        else
            mprintf("\tNumber of channels:\t%d\n", ch_count)
            mprintf("\tNumber of scans:\t%d\n", scan_time * scan_freq);
            if scan_time == 1
                mprintf("\tDuration:\t\t%.2f second\n", scan_time);
            else
                mprintf("\tDuration:\t\t%.2f seconds\n", scan_time);
            end
        end
        mprintf("\t--------------------------------------------------\n")
    end
endfunction

function  mdaqAOScanInit(arg1, arg2, arg3, arg4, arg5, arg6, arg7)
    global %microdaq;

    link_id = -1;
    if argn(2) == 6 then
        channels = arg1;
        data = arg2;
        ao_range = arg3;
        continuous = arg4;
        scan_freq = arg5;
        scan_time = arg6;
    end

    if argn(2) == 7 then
        link_id = arg1;
        channels = arg2;
        data = arg3;
        ao_range = arg4;
        continuous = arg5;
        scan_freq = arg6;
        scan_time = arg7;

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

    global %microdaq;
    if %microdaq.private.mdaq_hwid <> [] then
        if  %microdaq.private.mdaq_hwid(3) == 0 then
            disp("ERROR: Unable to detect DAC configuration!");
            return;
        end
        dac_info = %microdaq.private.dac_info;
        if argn(2) > 7 | argn(2) < 6 then
        mprintf("Description:\n");
        mprintf("\Initiates AO scanning session\n");
        mprintf("Usage:\n");
        mprintf("\tmdaqAOScanInit(linkId, channels, data, range, isContinuous, scanFrequency, duration);\n")
        mprintf("\tlinkId - connection id (optional)\n");
        mprintf("\tchannels - analog output channels to write\n");
        mprintf("\tdata - output data\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("\tisContinuous - mode of operation (%%T - continuous, %%F - periodic)\n");
        mprintf("\tscanFrequency - analog output scan frequency\n");
        mprintf("\tduration - analog output scan duration in seconds\n");
            return;
        end
    else
        error('Unable to detect MicroDAQ confituration - run mdaqHWInfo and try again!');
        return;
    end

    if continuous == %T then
        continuous = 1;
    else
        continuous = 0;
    end

    if scan_time < 0 & scan_time <> -1 then
        mprintf("WARNING: For infinite scan session as a duration parameter use -1 value instead!\n");
        scan_time = -1;
    end

    if size(channels, 'r') > 1 then
        error("Wrong channel - single row vector expected!")
    end

    if size(ao_range, 'c') <> 2 then
        error("Vector range [low,high;low,high;...] expected!")
        return;
    end

    ch_count = size(channels, "c");

    if size(ao_range, 'r') == 1 then
        range_tmp = ao_range;
        ao_range = ones(ch_count,2);
        ao_range(:,1) = range_tmp(1);
        ao_range(:,2) = range_tmp(2);
    end
    ao_range = matrix(ao_range', 1, ch_count*2);
    dac_ch_count = strtod(dac_info.channel);

    if size(data, "c") <> ch_count then
        error("Wrong output data - colums should match selected channels!")
    end

    data_size = size(data, "*");

    if ch_count < 1 | ch_count > dac_ch_count then
        error("Wrong AO channel selected!")
    end

    if max(channels) > dac_ch_count | min(channels) < 1 then
        error("Wrong AO channel selected!")
    end

    if continuous == %T | continuous == 1 then
        continuous = 1;
    else
        continuous = 0;
    end

    %microdaq.private.ao_scan_ch_count = ch_count;

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

    result = [];

    result = call("sci_mlink_ao_scan_init",..
                link_id, 1, "i",..
                channels, 2, "i",..
                ch_count, 3, "i",..
                data, 4, "d",..
                data_size, 5, "i",..
                ao_range, 6, "d",..
                continuous, 7, "i", ..
                scan_freq, 8, "d",..
                scan_time, 9, "d",..
            "out",..
                [1, 1], 10, "i");

    if argn(2) == 6 then
        mdaqClose(link_id);
    end

    if result < 0 then
        error(mdaq_error2(result), 10000 + abs(result));
    else
        if result == 1 then
            mprintf("\nWARNING: Your MicroDAQ device does not allow running AI and AO scanning session simultaneously.\n")
        end

        rows = [];
        row = '';
// TODO: print info table with RANGES
//        dac_res = strtod(part(dac_info.resolution, 1:2))
//        for j=1:ch_count
//            //dac_range = diff(dac_info.c_params.c_range_value(ao_range_t(j),:))
//            resolution = string((int(0/2^dac_res * 1000000)) / 1000);
//            rows = [rows; string(channels(j)), 0, resolution+"mV"]
//        end

        mprintf("\nAnalog output scanning session settings:\n");
        mprintf("\t---------------------------------\n")
        //str2table(rows, ["Channel",  "Range", "Resolution"], 5)
        mprintf("\t---------------------------------\n")

        if scan_freq >= 1000
            mprintf("\tScan frequency:\t\t%.3fkHz\n", scan_freq/1000);
        else
            mprintf("\tScan frequency:\t\t%dHz\n", scan_freq);
        end

        if continuous == 1 then
            mprintf("\tMode:\t\t\tStream\n");
        else
            mprintf("\tMode:\t\t\tPeriodic\n");
        end

        mprintf("\tOudput data size: \t%sx%s\n", string(size(data,"c")), string(size(data,"r")))
        if scan_time < 0
            mprintf("\tDuration:\t\tInf\n");
            mprintf("\tNumber of scans:\tInf\n");
            mprintf("\tNumber of channels:\t%d\n", ch_count)
        else
            mprintf("\tDuration:\t\t%.2fs\n", scan_time);
            mprintf("\tNumber of scans:\t%d\n", scan_time * scan_freq);
            mprintf("\tNumber of channels:\t%d\n", ch_count)
        end
        mprintf("\t---------------------------------\n")

    end
endfunction


Fix for E1100 ADC02 configuration

Fix for E1100 ADC02 configuration

ADC block range selection was missing for E1100 ADC02 configuration


microdaq setup rework fix

microdaq setup rework fix


INTEGRATION: CWS qadev32 (1.10.12); FILE MERGED 2008/05/05 10:53:14 cn 1.10.12.1: #i87216# update lists

-o fwl.ContentHandlerFactory
-o fwl.FilterFactory
-o fwl.FrameLoaderFactory
-o fwl.SubstituteVariables
-o fwl.TypeDetection
#i84346 -o fwl.PathSettings
-o fwk.DispatchRecorder
-o fwk.DispatchRecorderSupplier
-o fwk.FooterMenuController
-o fwk.ObjectMenuController
-o fwk.StatusBarControllerFactory
-o fwk.ToolBarsMenuController
-o fwk.UICategoryDescription
#i84423 -o fwk.JobExecutor
#i84423 -o fwk.JobHandler
-o fwk.MailToDispatcher
-o fwk.ServiceHandler
-o fwk.URLTransformer
-o fwk.MacrosMenuController
-o fwk.ModuleManager
-o fwk.UIElementFactoryManager
-o fwk.UICommandDescription
-o fwk.LayoutManager
-o fwk.UIConfigurationManager
-o fwk.MenuBarFactory
-o fwk.FontSizeMenuController
-o fwk.HeaderMenuController
-o fwk.ControlMenuController
-o fwk.FontMenuController
-o fwk.ModuleUIConfigurationManagerSupplier
-o fwk.ModuleUIConfigurationManager
#i84321 -o fwk.PopupMenuControllerFactory
#i88644 -o fwk.Frame
-o fwk.Desktop

-o fwl.ContentHandlerFactory
-o fwl.FilterFactory
-o fwl.FrameLoaderFactory
-o fwl.SubstituteVariables
-o fwl.TypeDetection
#i84346 -o fwl.PathSettings
-o fwk.DispatchRecorder
-o fwk.DispatchRecorderSupplier
-o fwk.FooterMenuController
-o fwk.ObjectMenuController
-o fwk.StatusBarControllerFactory
-o fwk.ToolBarsMenuController
-o fwk.UICategoryDescription
#i84423 -o fwk.JobExecutor
#i84423 -o fwk.JobHandler
-o fwk.MailToDispatcher
-o fwk.ServiceHandler
-o fwk.URLTransformer
-o fwk.MacrosMenuController
-o fwk.ModuleManager
-o fwk.UIElementFactoryManager
-o fwk.UICommandDescription
-o fwk.LayoutManager
-o fwk.UIConfigurationManager
-o fwk.MenuBarFactory
-o fwk.FontSizeMenuController
-o fwk.HeaderMenuController
-o fwk.ControlMenuController
-o fwk.FontMenuController
-o fwk.ModuleUIConfigurationManagerSupplier
-o fwk.ModuleUIConfigurationManager
# i84321 -o fwk.PopupMenuControllerFactory
-o fwk.Frame
-o fwk.Desktop


INTEGRATION: CWS unoapi2 (1.8.24); FILE MERGED 2007/12/10 11:31:36 cn 1.8.24.1: #i83871# update lists

-o fwl.ContentHandlerFactory
-o fwl.FilterFactory
-o fwl.FrameLoaderFactory
-o fwl.SubstituteVariables
-o fwl.TypeDetection
#i84346 -o fwl.PathSettings
-o fwk.DispatchRecorder
-o fwk.DispatchRecorderSupplier
-o fwk.FooterMenuController
-o fwk.ObjectMenuController
-o fwk.StatusBarControllerFactory
-o fwk.ToolBarsMenuController
-o fwk.UICategoryDescription
#i84423 -o fwk.JobExecutor
#i84423 -o fwk.JobHandler
-o fwk.MailToDispatcher
-o fwk.ServiceHandler
-o fwk.SoundHandler
-o fwk.URLTransformer
-o fwk.MacrosMenuController
-o fwk.ModuleManager
-o fwk.UIElementFactoryManager
-o fwk.UICommandDescription
-o fwk.LayoutManager
-o fwk.UIConfigurationManager
-o fwk.MenuBarFactory
-o fwk.FontSizeMenuController
-o fwk.HeaderMenuController
-o fwk.ControlMenuController
-o fwk.FontMenuController
-o fwk.ModuleUIConfigurationManagerSupplier
-o fwk.ModuleUIConfigurationManager
# i84321 -o fwk.PopupMenuControllerFactory
-o fwk.Frame
-o fwk.Desktop

-o fwl.ContentHandlerFactory
-o fwl.FilterFactory
-o fwl.FrameLoaderFactory
-o fwl.SubstituteVariables
-o fwl.TypeDetection
# -o fwl.PathSettings
-o fwk.DispatchRecorder
-o fwk.DispatchRecorderSupplier
-o fwk.FooterMenuController
-o fwk.ObjectMenuController
-o fwk.StatusBarControllerFactory
-o fwk.ToolBarsMenuController
-o fwk.UICategoryDescription
#-o fwk.JobExecutor
#-o fwk.JobHandler
-o fwk.MailToDispatcher
-o fwk.ServiceHandler
-o fwk.SoundHandler
-o fwk.URLTransformer
-o fwk.MacrosMenuController
-o fwk.ModuleManager
-o fwk.UIElementFactoryManager
-o fwk.UICommandDescription
-o fwk.LayoutManager
-o fwk.UIConfigurationManager
-o fwk.MenuBarFactory
-o fwk.FontSizeMenuController
-o fwk.HeaderMenuController
-o fwk.ControlMenuController
-o fwk.FontMenuController
-o fwk.ModuleUIConfigurationManagerSupplier
-o fwk.ModuleUIConfigurationManager
-o fwk.PopupMenuControllerFactory
-o fwk.Frame
-o fwk.Desktop


Loading mdaq blocks fix

Loading mdaq blocks fix

function [res] = load_mdaq_palette()
    is_generated = %F;
    config_path = mdaq_toolbox_path() + "etc"+filesep()+"mblockstmpdir";

    //check if sod files were generated
    try
        load(config_path);
        if fileinfo(tmp_dir+filesep()+"01.sod") <> [] then
            is_generated = %T;
        else
            is_generated = %F;
        end
    catch
        is_generated = %F;
    end

    if is_generated == %F then
        //Generete palette sod files
        tmp_dir = TMPDIR+filesep()+"palette";
        mkdir(tmp_dir);

        //generate & load
        build_mdaq_palette(tmp_dir);
        save(config_path, 'tmp_dir');

        //Bugfix
        //replace mdaq .svg files in TMPDIR
        svg_path = mdaq_toolbox_path() + filesep() + "images" +..
        filesep() + "svg" + filesep();
        copyfile(svg_path, TMPDIR+filesep());

    else
        //Load generated sod files
        load_saved_palette(tmp_dir);
    end

    res = 0;
endfunction

function [res] = load_saved_palette(mdaq_tmp_dir)
    palette_files = ls(mdaq_tmp_dir);
    palette_files_index = grep(palette_files, ".sod");

    if palette_files_index <> [] then
        pal_size = size(palette_files_index, '*');
        for i = 1:pal_size
            xcosPalAdd(mdaq_tmp_dir + filesep() + palette_files(palette_files_index(pal_size-i+1)),'MicroDAQ')
        end
    end
    res = 0;
endfunction

function [res] = load_mdaq_palette()
    is_generated = %F;
    config_path = mdaq_toolbox_path() + "etc"+filesep()+"mblockstmpdir";

    //check if sod files were generated
    try
        load(config_path);
        if fileinfo(tmp_dir+filesep()+"01.sod") <> [] then
            is_generated = %T;
        else
            is_generated = %F;
        end
    catch
        is_generated = %F;
    end

    if is_generated == %F then
        //Generete palette sod files
        tmp_dir = TMPDIR+filesep()+"palette";
        mkdir(tmp_dir);

        //generate & load
        build_mdaq_palette(tmp_dir);
        save(config_path, 'tmp_dir');

    else
        //Load generated sod files
        load_saved_palette(tmp_dir);
    end

    res = 0;
endfunction

function [res] = load_saved_palette(mdaq_tmp_dir)
palette_files = ls(mdaq_tmp_dir);
palette_files_index = grep(palette_files, ".sod");

if palette_files_index <> [] then
    pal_size = size(palette_files_index, '*');
    for i = 1:pal_size
        xcosPalAdd(mdaq_tmp_dir + filesep() + palette_files(palette_files_index(pal_size-i+1)),'MicroDAQ')
    end
end
res = 0;
endfunction


sb120: #i111194# 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
#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
-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


Changing bitshift to an equivalent decimal operation

function [buffer] = pblib_write_varint(value)
//pblib_write_varint
//   buffer = pblib_write_varint(value)
//
//   Encodes a uint value as a varint.
//
//   The value passed in can be any uint up to uint64.  We do a hand coded
//   binary search tree like Google's C++ code generation to quickly decide how
//   many bytes we'll need for the encoding, or at least estimate.

//   protobuf-matlab - FarSounder's Protocol Buffer support for Matlab
//   Copyright (c) 2008, FarSounder Inc.  All rights reserved.
//   http://code.google.com/p/protobuf-matlab/
//
//   Redistribution and use in source and binary forms, with or without
//   modification, are permitted provided that the following conditions are met:
//
//       * Redistributions of source code must retain the above copyright
//   notice, this list of conditions and the following disclaimer.
//
//       * Redistributions in binary form must reproduce the above copyright
//   notice, this list of conditions and the following disclaimer in the
//   documentation and/or other materials provided with the distribution.
//
//       * Neither the name of the FarSounder Inc. nor the names of its
//   contributors may be used to endorse or promote products derived from this
//   software without specific prior written permission.
//
//   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
//   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
//   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
//   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
//   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
//   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
//   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
//   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
//   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
//   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
//   POSSIBILITY OF SUCH DAMAGE.

//   Author: fedor.labounko@gmail.com (Fedor Labounko)
//   Support function used by Protobuf compiler generated .m files.

  if (value < uint64(268435456)) // 2^28
    if (value < uint64(16384)) // 2^14
      if (value < uint64(128)) // 2^7
        buffer = zeros([1 1], 'uint8');
      else
        buffer = zeros([1 2], 'uint8');
      end
    else
      if (value < uint64(2097152)) // 2^21
        buffer = zeros([1 3], 'uint8');
      else
        buffer = zeros([1 4], 'uint8');
      end
    end
  else
    if (value < uint64(4398046511104)) // 2^42
      if (value < uint64(34359738368)) // 2^35
        buffer = zeros([1 5], 'uint8');
      else
        buffer = zeros([1 6], 'uint8');
      end
    else
      if (value < uint64(72057594037927936)) // 2^56
        buffer = zeros([1 8], 'uint8');
      else
        buffer = zeros([1 10], 'uint8');
      end
    end
  end
  num_bytes = 0;
  while (value > 127)
    num_bytes = num_bytes + 1;
    buffer(num_bytes) = bitset(bitand(value, 127), 8);
    value = value * (2 ** -7);
  end
  num_bytes = num_bytes + 1;
  buffer(num_bytes) = value;
  buffer = buffer(1 : num_bytes);

endfunction

function [buffer] = pblib_write_varint(value)
//pblib_write_varint
//   buffer = pblib_write_varint(value)
//
//   Encodes a uint value as a varint.
//
//   The value passed in can be any uint up to uint64.  We do a hand coded
//   binary search tree like Google's C++ code generation to quickly decide how
//   many bytes we'll need for the encoding, or at least estimate.

//   protobuf-matlab - FarSounder's Protocol Buffer support for Matlab
//   Copyright (c) 2008, FarSounder Inc.  All rights reserved.
//   http://code.google.com/p/protobuf-matlab/
//
//   Redistribution and use in source and binary forms, with or without
//   modification, are permitted provided that the following conditions are met:
//
//       * Redistributions of source code must retain the above copyright
//   notice, this list of conditions and the following disclaimer.
//
//       * Redistributions in binary form must reproduce the above copyright
//   notice, this list of conditions and the following disclaimer in the
//   documentation and/or other materials provided with the distribution.
//
//       * Neither the name of the FarSounder Inc. nor the names of its
//   contributors may be used to endorse or promote products derived from this
//   software without specific prior written permission.
//
//   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
//   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
//   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
//   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
//   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
//   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
//   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
//   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
//   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
//   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
//   POSSIBILITY OF SUCH DAMAGE.

//   Author: fedor.labounko@gmail.com (Fedor Labounko)
//   Support function used by Protobuf compiler generated .m files.

  if (value < uint64(268435456)) // 2^28
    if (value < uint64(16384)) // 2^14
      if (value < uint64(128)) // 2^7
        buffer = zeros([1 1], 'uint8');
      else
        buffer = zeros([1 2], 'uint8');
      end
    else
      if (value < uint64(2097152)) // 2^21
        buffer = zeros([1 3], 'uint8');
      else
        buffer = zeros([1 4], 'uint8');
      end
    end
  else
    if (value < uint64(4398046511104)) // 2^42
      if (value < uint64(34359738368)) // 2^35
        buffer = zeros([1 5], 'uint8');
      else
        buffer = zeros([1 6], 'uint8');
      end
    else
      if (value < uint64(72057594037927936)) // 2^56
        buffer = zeros([1 8], 'uint8');
      else
        buffer = zeros([1 10], 'uint8');
      end
    end
  end
  num_bytes = 0;
  while (value > 127)
    num_bytes = num_bytes + 1;
    buffer(num_bytes) = bitset(bitand(value, 127), 8);
    value = bitshift(value, -7);
  end
  num_bytes = num_bytes + 1;
  buffer(num_bytes) = value;
  buffer = buffer(1 : num_bytes);

endfunction


INTEGRATION: CWS unoapi1 (1.2.158); FILE MERGED 2007/08/15 10:25:09 cn 1.2.158.1: #i79479# update list

-o lng.DicList
-o lng.LinguProps
#-o lng.LngSvcMgr

-o lng.DicList
-o lng.LinguProps
-o lng.LngSvcMgr