esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

SPEC_UTILS.MAC
See other macros in category: TOOLS
Description:
Documentation:
    DESCRIPTION
    * Collection of usefull macros to program with SPEC.
    * Please add your favorite macros.
    * Majority of macros have a test function.
    * Please add pertinent tests.


Macros:
    spec_utils_test
    Usage: spec_utils_test
    Launch a set of tests of spec_utils macros.

    wwwhat
    Usage: wwwhat <symbol>
    Prints infos about <symbol>.

    spec_utils_which
    Usage: spec_utils_which (<macro_name>)
    Return the file from where the macro is taken ???????? (without the "#" of prdef)

    wwwhat_test
    Usage: wwwhat_test
    Performs tests on wwwhat

    symbol_exists
    Usage: symbol_exists (<symbol_name>)
    Return 1 if symbol <symbol_name> exists in the current SPEC session. Return 0 otherwise.

    taco_str_to_state_number
    Usage: taco_str_to_state_number (<taco_state_string>)
    Return a number corresponding to the Taco state string <taco_state_string>.

    taco_state_to_str
    Usage: taco_state_to_str (<taco_state_number>)
    Return a string of the Taco state corresponding to <taco_state_number>.

    taco_state_to_number_to_state_test
    Usage: taco_state_to_number_to_state_test ()
    Tests taco_state_to_str and taco_str_to_state_number on 0..48 taco states.

    ds_is_tango
    Usage: ds_is_tango (<ds_name>)
    Test if a DS is a Tango one. Return 1 if yes Return 0 if NO or it is unresposive. !!! depend on SPEC version... 5.08.06-6 -> does not work.

    ds_is_taco
    Usage: ds_is_taco (<ds_name>)
    Test if a DS is a Taco one. Return 1 if yes Return 0 if NO or it is unresposive.

    ds_is_responsive
    Usage: ds_is_responsive (<ds_name>)
    Test if a DS (taco or tango) is responsive. Return 1 if YES Return 0 if NO

    ds_is_what
    Usage: ds_is_what (<ds_name>)
    Test if a responsive DS is taco or tango. Return "TANGO" or "TACO" or "UNRESPONSIVE".

    is_tango_ds_test
    Usage: is_tango_ds_test


    tango_state_to_str
    Usage: tango_state_to_str <tango_state>
    Return the string corresponding to the tango state <tango_state>

    tango_str_to_state
    Usage: tango_str_to_state <tango_state_string>
    Return the Tango state number corresponding to the string <tango_state_string>.

    tango_state_to_number_to_state_test
    Usage: tango_state_to_number_to_state_test ()
    Tests tnago_state_to_str and tango_str_to_state_number on -1..12 tango states.

    tango_cprint_state
    Usage: tango_cprint_state <tango_state>
    <tango_state> must be a number

    math_test
    Usage: math_test
    Performs a set of tests on math functions.

    min2
    Usage: min2 (<x>, <y>)
    Return the minimum of the 2 values <x> and <y>.

    min3
    Usage: min3 (<x>, <y>, <z>)
    Return the minimum of the 3 values <x>, <y> and <z>.

    max2
    Usage: max2 (<x>, <y>)
    Return the maximum of the 2 values <x> and <y>.

    max3
    Usage: max3 (<x>, <y>, <z>)
    Return the maximum of the 3 values <x>, <y> and <z>.

    supermin
    Usage: supermin (<a>,<b>,<c>)
    min of 2 or 3 values. (from ZAP _zap_min())

    round_nearest_tests
    Usage: round_nearest_tests
    Performs a set of tests on "round_nearest()" function.

    ceil_tests
    Usage: ceil_tests()
    Performs a set of tests on "ceil()" function.

    round_down_tests
    Usage: round_down_tests (<step>)
    Performs a set of tests on "round_down" function.

    round_up_tests
    Usage: round_up_tests (step)
    Performs a set of tests on "round_up" function.

    round_next_tests
    Usage: round_next_tests (step)
    Performs a set of tests on "round_next" function.

    floor_tests
    Usage: floor_tests (step)
    Performs a set of tests on "floor" function.

    int_tests
    Usage: int_tests (step)
    Performs a set of tests on "int" function.

    round_int_tests
    Usage: round_int_tests ()
    Performs a set of tests on "round_int" function.

    rounding_test
    Usage: rounding_test (<step>)
    Launchs all rounding tests.

    rounding_test_tab
    Usage: rounding_test_tab (<step>)
    Launchs all rounding tests.

    matrix_test
    Usage: matrix_test


    matrix_load
    Usage: matrix_load (<file_name>, <out_arr>)


    matrix_print
    Usage: matrix_print <parma>


    matrix_print_vector
    Usage: matrix_print_vector <parma>


    matrix_mul
    Usage: matrix_mul (<m1>, <m2>, <m3>)


    matrix_add
    Usage: matrix_add (<m1>, <m2>, <m3>)


    matrix_sub
    Usage: matrix_sub (<m1>, <m2>, <m3>)


    removeEndingChar
    Usage: removeEndingChar (<str>, <char_to_remove>)
    Removes to <str> an eventual ending <char_to_remove>. NOTE : Removes only 1 character. OULALA pourquoi c si complique ???

    removeEndingCharTests
    Usage: removeEndingCharTests ()
    Perform a set of tests on "removeEndingChar()" function.

    removeStartingSpaces
    Usage: removeStartingSpaces (<string>)


    removeChars_test
    Usage: removeChars_test
    Tests removeChars.

    removeChars
    Usage: removeChars (<str>, <char_to_remove>)
    Removes to <str> all occurences of <char_to_remove>.

    string_get_last_char
    Usage: string_get_last_char (<str>)
    Return the last char of string <str>.

    string_get_last_N_char
    Usage: string_get_last_N_char (<str>, <nb_char>)
    Return last N char(s) of string <str>.

    string_remove_last_N_chars
    Usage: string_remove_last_N_chars (<str>, <nb_char>)
    Return string <str> without <nb_char> last characters.

    str_is_std
    Usage: str_is_std <input_string>
    Return 1 if <input_string> contains only "standard" characters. from RH

    str_is_std_path_win
    Usage: str_is_std_path_win <input_string>
    Return 1 if <input_string> contains only "standard" characters and \ and / for paths and windows paths. from RH

    is_element_in_string
    Usage: is_element_in_string (<element>, <the_string>, [<separator>])
    Return 1 if <element> is present in string <the_string>. Return 0 otherwise. Default separator is space character.

    rindex
    Usage: rindex (<>, <>)
    ???

    file_extention
    Usage: file_extention (<filename>)
    Return the extention of a file file_extention("toto.titi.42.txt") : return "txt"

    file_without_extention
    Usage: file_without_extention (<filename>)
    Return the filename whitout extention. file_without_extention("toto.titi.42.txt") : return "toto.titi.42"

    list_dir
    Usage: list_dir (<dir>)
    Return an associative array of files AND DIRECTORIES found in directory <dir>

    list_dir_files
    Usage: list_dir_files (<dir>)
    Return an associative array of files AND NOT DIRECTORIES found in directory <dir>. If specified, return only fiels with <extention> extention.

    get_tool_path
    Usage: get_tool_path (<tname> <verbose>)
    Return the path of the file <tname>

    is_int
    Usage: is_int (<value_to_test>)
    Return 1 if <value_to_test> is an integer (-2 -1 0 1 2). Return 0 otherwise.

    is_int_pos
    Usage: is_int_pos (<value_to_test>)
    Return 1 if <value_to_test> is a positive integer (0 1 2). Return 0 otherwise.

    is_int_pos_not_zero
    Usage: is_int_pos_not_zero (<value_to_test>)
    Return 1 if <value_to_test> is a natural number (1 2 3). Return 0 otherwise.

    is_number
    Usage: is_number (<value_to_test>)
    Return 1 if <value_to_test> is a number (-0.12 0 1 3.14 3.2232e3) 0 otherwise.

    is_number_in_range
    Usage: is_number_in_range (<value_to_test>, <low_lim>, <high_lim>)
    Return 1 if <value_to_test> is a number (-0.12 0 1 3.14 3.2232e3) and in range [<low_lim>, <high_lim>] (limits included). Return 0 otherwise.

    is_int_test
    Usage: is_int_test (<value>)
    Prints a int test for <value>.

    is_int_pos_test
    Usage: is_int_pos_test (<value>)
    Prints a int pos test for <value>.

    is_int_pos_not_zero_test
    Usage: is_int_pos_not_zero_test (<value>)
    Prints a integer positive and not zero test for <value>.

    is_int_test_suite
    Usage: is_int_test_suite ()
    Performs a set of tests for is_int() function.

    is_number_test
    Usage: is_number_test (<value>)
    Prints a number test for <value>.

    is_number_test_suite
    Usage: is_number_test_suite ()
    Launches a set of tests on is_number() function.

    getval_int
    Usage: getval_int (<message>, <default>, <unit>)
    Prompts for an integer until a valid one is entered. example: getval_int("Enter number of samples", 4, " pieces")

    getval_int_interval
    Usage: getval_int_interval (<message>, <default>, <val_min>, <val_max>, <unit>)
    Prompts for an integer in a range until a valid one is entered. example: getval_int("Enter number of samples", 4, 1, 10, " pieces")

    getval_int_pos
    Usage: getval_int_pos (<message>, <default>, <unit>)
    Prompts for a positive integer until a valid one is entered.

    getval_int_pos_not_zero
    Usage: getval_int_pos_not_zero (<message>, <default>, <unit>)
    Prompts for a positive non zero integer until a valid one is entered.

    getval_number
    Usage: getval_number (<message>, <default>, <unit>)
    Prompts for a number until a valid one is entered.

    getval_number_interval
    Usage: getval_number_interval (<message>, <default>, <val_min>, <val_max>, <unit>)
    Prompts for a number between <val_min> and <val_max> (values included). Repeat until a valid one is entered. ex : getval_number_interval("Enter a temperature (-273..500)", 20.5, -273, 500)

    getval_string_len
    Usage: getval_string_len (<message>, <default>, <len_min>, <len_max>)
    Prompts for a string of lenght between <len_min> and <len_max> until a valid one is entered. example: getval_string_len("Beamline type ? (ID/BM)", "ID", 2, 2)

    getval_counter
    Usage: getval_counter (<message>, <default_counter_mne>)
    Prompts for a COUNTER *mnemonic*. example: getval_counter("Detector counter ?", "apd")

    getval_motor
    Usage: getval_motor (<message>, <default_motor_mne>)
    Prompts for a MOTOR mnemonic. example: getval_motor("Motor mne ?", "etron")

    getval_check
    Usage: getval_check (<message>, <value>)
    To replace "getval()" by a more secure (forbid strange characters) version.

    getval_check_path
    Usage: getval_check_path (<message>, <value>)
    To replace "getval()" by a more secure (forbid strange characters) version.

    getval_list
    Usage: getval_list (<message>, <list>, <default>)
    Prompts for a STRING from a given associative array until a valid one is entered by user then RETURN THE STRING.

    getkey_list_by_key
    Usage: getkey_list_by_key (<message>, <list>, <default>)
    Prompts for a valid KEY of a list and return the KEY.

    ass_arr_nb_key
    Usage: ass_arr_nb_key (<ass_arr>)
    Return the number of elements in associative array <ass_arr>.

    ass_arr2string
    Usage: ass_arr2string (<param>)
    Flatterns an associative array (tilps) ie: the reverse of split function.

    is_element_in_ass_arr
    Usage: is_element_in_ass_arr (<element>, <ass_arr>)
    Return 1 if <element> is present in associative array <ass_arr>. Return 0 otherwise.

    ass_arr_get_key
    Usage: ass_arr_get_key (<ass_arr>, <element>)
    Return the first found key of associative array <ass_arr> corresponding to element <element>. if nothing found, return -1 ... bof ..

    ass_arr_print_elements
    Usage: ass_arr_print_elements (<ass_array>, <bullet>)


    ass_arr_print_numbered_elements
    Usage: ass_arr_print_numbered_elements (<ass_array>)
    Prints elements of an associative array <ass_array> of size NB_ELEM. Elements are prefixed by numbers [1..NB_ELEM] NB : prints in good order !

    ass_arr_reverse
    Usage: ass_arr_reverse (<ass_arr>)
    Return an assosiative array in reverse order...

    ass_arr_is_ordered
    Usage: ass_arr_is_ordered (<ass_arr>)
    Return 1 if <ass_arr> assosiative array values are ordered.

    beamline_name
    Usage: beamline_name ()
    Return the name of the beamline where SPEC session is running. info is taken from SPECBL which is set in /users/blissadm/local/spec/spec.d/site.name

    beamline_info
    Usage: beamline_info ()
    Return an associative array containing infos on beamline: example : on piano : tmp["number"] = 26 tmp["type"] = "ID" on chandra : tmp["number"] = 05 tmp["type"] = "D"

    beamline_number
    Usage: beamline_number ()
    Return beamline number.

    beamline_type
    Usage: beamline_type ()
    Return beamline type (ID or D)

    beamline_info_test
    Usage: beamline_info_test


    notice_test
    Usage: notice_test
    Performs a test on notice.

    countdown
    Usage: countdown (<duration>)
    Displays a <duration> seconds countdown. example : countdown(5)

    print_line
    Usage: print_line (<char>, <color>)
    Prints a full line of character <char> with the color <color>.

    print_right
    Usage: print_right (<message>, <len>)
    Prints <message> right aligned in a space of <len> characters.

    print_left
    Usage: print_left (<message>, <len>, <char>)
    Prints <message> left-aligned and fills the rest of the line until <len> character with <char>.

    message_warning
    Usage: message_warning <message>
    Opens a QT window displaying <message>.

    message_question
    Usage: message_question <message>
    Opens a QT window displaying <message> and asking for a YES/NO answer.

    print_start_info
    Usage: print_start_info (<msg>, <status>)
    Prints a 2-parts ligne : 1st part is a message, 2nd part is a ON/OFF green/red "a la" linux starting console. Text is adjusted to fit ligne width minus 15 chars."

    print_start_info_test
    Usage: print_start_info_test
    Performs a test on "print_start_info()".

    bprint
    Usage: bprint (<str>)
    Prints <str> in bold.

    buprint
    Usage: buprint (<str>)
    Prints <str> in underlined bold.

    uprint
    Usage: uprint (<str>)
    Prints <str> underlined.

    cprint_examples
    Usage: cprint_examples
    Prints "Ab1" string in many colored and modified typo.

    cprint_enable_colors
    Usage: cprint_enable_colors
    Enables usge of colors with cprint* functions.

    cprint_colors_enabled
    Usage: cprint_colors_enabled ()
    Check if usage of colors with cprint* functions is enabled. Return 1 if yes, 0 otherwise.

    cprint_disable_colors
    Usage: cprint_disable_colors
    Disables usge of colors with cprint* functions.

    cprint_set_dark_background
    Usage: cprint_set_dark_background
    If using a dark background, this might help to have more readable colored texts.

    cprint_set_light_background
    Usage: cprint_set_light_background
    If using a light background, this might help to have more readable colored texts.

    cprint_get_coloration
    Usage: cprint_get_coloration (<str>, <fgcolor>, <bgcolor>, <bold>, <underlined>, <st>)
    Prints <str> with color and attributes. <fgcolor> : foreground color : 0..8 (0=black 8=current fg color) <bgcolor> : background color : 0..8 (0=black 8=current bg color) <bold> : +bold <underlined> : +underlined <st> : +Strikethrough

    cprint_on_off
    Usage: cprint_on_off (<etat>)
    Prints "on" in green "off" in red depending on <etat>

    cprint_msg_on_off
    Usage: cprint_msg_on_off (<msg>, <etat>)
    Prints <msg> depending on <etat> in green(1/ON) or in red (0/OFF)

    cprint_yes_no
    Usage: cprint_yes_no (<etat>)
    Prints "yes" in green "no" in red depending on <etat>

    cprint_ok_bad
    Usage: cprint_ok_bad (<etat>, <str_ok>, <str_bad>)
    Prints <str_ok> string in green <str_bad> in red depending on <etat>

    cprint_red
    Usage: cprint_red (<msg>)
    Prints <msg> in red.

    kbf_fformat
    Usage: kbf_fformat (<val>)
    Return a decimal-point-centered string of the <val> number.

    print_centered
    Usage: print_centered (<msg>,<surrounding_char>,<surrounding_spaces>)
    Prints <msg> message centered over the terminal window.

    print_centered_test
    Usage: print_centered_test
    "print_centered" function.

    print_aligned
    Usage: print_aligned (<msg1>, <msg2>, <left_size>)
    Prints <msg1> message within <left_size> characters then <msg2>.

    print_aligned_test
    Usage: print_aligned_test
    test for "print_aligned" function.

    print_boxed
    Usage: print_boxed (<msg>, <offset>)
    Prints <msg> as a boxed text. <offset> adds spaces before the box. if <offset> == -1 box is centered.

    print_boxed_test
    Usage: print_boxed_test
    Performs a set of tests for "print_boxed" function.

    get_day_number
    Usage: get_day_number ()
    Return the current day number in the month. (1..31)

    get_day_name
    Usage: get_day_name ()
    Return the shortened name of the current day (Mon Tue ...)

    get_month_number
    Usage: get_month_number ()
    Return the number of the curretn month (1..12)

    get_month_name
    Usage: get_month_name ()
    Return the shortened name of the current month (Jan..Dec)

    get_year
    Usage: get_year ()
    Return the current year number.

    date_stamping_second
    Usage: date_stamping_second ()
    Return a string of the current date (usable to timestamp a file for example) with second accuracy.

    date_stamping_milisecond
    Usage: date_stamping_milisecond ()
    Return a string of the current time (usable to timestamp a debug log for example) with milisecond accuracy. substract <offset> from current time.

    date_stamping_minute
    Usage: date_stamping_minute ()
    Return a string of the current date (usable to timestamp a file for example) with minute accuracy.

    date_test
    Usage: date_test ()
    Performs test on date&time functions.

    binary_to_decimal
    Usage: binary_to_decimal (bin)
    Return the decimal value corresponding to string <b> binary representation. Max 32 bits Return -1 in case of error.

    motors_disableall
    Usage: motors_disableall ()


    motors_enableall
    Usage: motors_enableall ()


    motors_enable
    Usage: motors_enable (<motors_list>)


    motors_disable
    Usage: motors_disable (<motors_list>)


    motors_set
    Usage: motors_set (<motors_list>, <state>)
    Sets motors of the list <motors_list> in state <state> (0 to enable 1 to disable)

    motor_print_position
    Usage: motor_print_position (<mot_num>)


    cnt_exists
    Usage: cnt_exists (<cnt_id> : counter_num | counter_mne)
    Return 1 if the counter exists.

    cnt_check
    Usage: cnt_check (<cnt_id> : counter_num | counter_mne)


    cnt_enable
    Usage: cnt_enable (<cnt_id> : counter_num | counter_mne)


    cnt_disable
    Usage: cnt_disable (<cnt_id> : counter_num | counter_mne)


    cnt_disable_silent
    Usage: cnt_disable_silent (<cnt_id> : counter_num | counter_mne)
    Disables counter <cnt_id> whitout error message if it does not exists. Useful to disable devices in SPEC setups.

    ux2dos_directory2dos
    Usage: ux2dos_directory2dos (path)
    courtesy of zapxmap.mac: original macro name _zap_xmap_convert_path(path). convert a unix path to windows path, using a unix path and a translation table.

    ux2dos_directory2ux
    Usage: ux2dos_directory2ux (path)
    convert a dos path to unix path, using a dos path and a translation table. NOTE: if arg is given as string, each backslash needs to be doubled!

    ux2dos_add_paths
    Usage: ux2dos_add_paths


    ux2dos_del_paths
    Usage: ux2dos_del_paths


    ux2dos_dirshow
    Usage: ux2dos_dirshow
    Shows directory mapping between UNIX and WINDOWS

    test_ux2dos_pathname_conversion
    Usage: test_ux2dos_pathname_conversion
    test the ux2dos pathname conversion

Internal Macros:
    symbol_in_file
    Usage: symbol_in_file (<symbol_name>, <file>)
    Return 1 if symbol <symbol_name> is defined in file <file>.

    symbol_to_define
    Usage: symbol_to_define (<symbol_name>, <file_name>)
    Checks if <symbol_name> macro has to be defined.

    in_spec_session
    Usage: in_spec_session (<sname>, <print_error>)
    Return 1 (0) depending if function is called (not) from session <sname>. if <print_error> then print an error message.

    help_css
    Usage: help_css


    spec_version_newer_than
    Usage: spec_version_newer_than(major, minor, patch, release)


    spec_version_test
    Usage: spec_version_test


    _spec_version_test_func
    Usage: _spec_version_test_func(major, minor, patch, release)


    get_SCAN_D_counter_number
    Usage: get_SCAN_D_counter_number(counter_number)


    is_aprox
    Usage: is_aprox(x, y, tol)
    checks if two numbers are "almost" equal

    signed_modulus
    Usage: signed_modulus (x,d)
    This calculates the difference between x and and the closest integer multiple of d.

    mod
    Usage: mod (x,d)
    Modulus, calculate reminder of modular division of x by d, Similar to SPEC`s % operator, but works also for non-integer and negative numbers, the returned value is always positive

    round_down
    Usage: round_down (x,step)
    Rounds "x" to a smaller or equal value that is a multiple of "step".

    round_up
    Usage: round_up (x,step)
    Rounds "x" to a bigger or equal value that is a multiple of "step". round_up(X,1) == ceil(X)

    round_next
    Usage: round_next (x[,step])
    Rounds x up or down to the next multiple of step. If you omit step it rounds to integer.

    floor
    Usage: floor (<x>)
    Return the largest integer number smaller or equal than x.

    ceil
    Usage: ceil (<x>)
    Return the smallesr integer number bigger or equal than x.

    round_int
    Usage: round_int(x)
    Rounds up or down to next integer value.

    round_nearest
    Usage: round_nearest (x)
    Return a well rounded integer as opposed to int() which always round down

    removeStrangeChars
    Usage: removeStrangeChars(user_string)


    str_isstd
    Usage: str_isstd(input_string)


    name_increase
    Usage: name_increase(scan_name)


    name_increase_test
    Usage: name_increase_test


    is_string
    Usage: is_string(the_string)


    is_element_in_string_test
    Usage: is_element_in_string_test(element, the_string, result)


    is_element_in_string_test_suite
    Usage: is_element_in_string_test_suite()


    string_toupper
    Usage: string_toupper(str)


    string_tolower
    Usage: string_tolower(str)


    char_is_lower_case
    Usage: char_is_lower_case(letter)


    char_is_upper_case
    Usage: char_is_upper_case(letter)


    tolower_test
    Usage: tolower_test()


    toupper_test
    Usage: toupper_test()


    case_test
    Usage: case_test


    split_fname
    Usage: split_fname(f)


    string_reverse
    Usage: string_reverse(s)
    return the inverted string

    dirname
    Usage: dirname(s)


    basename
    Usage: basename(f, suffix)
    return the basename (i.e. basename("this_is_a_long_path/with/multiple/dirs")=dirs) if second argument is given, the suffix will be cut off. Unlike the bash version, it`ll cut off any suffix, regardless of the content of the variable suffix. The macro should work as before, when there is no suffix.

    dirname
    Usage: dirname (fname)
    Gets the directory path of a file name. Still incomplete ...

    create_directory_tree
    Usage: create_directory_tree(tree)


    swap
    Usage: swap <a> <b>
    interchange the value of the variables "a" and "b"

    is_ass_arr
    Usage: is_ass_arr(aaasssaaarrr)


    is_ass_arr_test_suite
    Usage: is_ass_arr_test_suite()


    is_ass_arr_test
    Usage: is_ass_arr_test(ass_arr, array_name, result)


    is_type_test_suite
    Usage: is_type_test_suite()


    getval_list_test
    Usage: getval_list_test ()
    Performs a test for "getval_list()".

    getkey_list_by_key_test
    Usage: getkey_list_by_key_test


    getval_list_by_key
    Usage: getval_list_by_key(message, list, default_key)


    getval_list_by_specific_key
    Usage: getval_list_by_specific_key(message, list, default_key)


    getval_list_by_specific_key_test
    Usage: getval_list_by_specific_key_test


    getval_list_by_key_test
    Usage: getval_list_by_key_test ()
    Performs a test for "getval_list_by_key()".

    getval_file_in_dir
    Usage: getval_file_in_dir ()
    Ask for a file (not the directories) from directory <dir_path>. If specified, proposes only fiels with <extention> extention.

    assarr2string
    Usage: assarr2string(ARR)


    is_element_in_assarr
    Usage: is_element_in_assarr(element, ass_arr)


    is_element_in_ass_arr_test
    Usage: is_element_in_ass_arr_test(element, ass_arr, ass_arr_name, result)


    is_key_in_ass_arr
    Usage: is_key_in_ass_arr(ass_arr, key)


    is_key_in_ass_arr_test
    Usage: is_key_in_ass_arr_test


    is_element_in_ass_arr_test_suite
    Usage: is_element_in_ass_arr_test_suite()


    ass_arr_print_keys_and_values
    Usage: ass_arr_print_keys_and_values(list, separator)


    ass_arr_is_ordered_test
    Usage: ass_arr_is_ordered_test


    save_array
    Usage: save_array <array>
    Useful for saving global variables across a "spec -f". Writes the contents of all members of an array to an ASCII file, so they can be reloaded later by the "restore_array" macro. The file is in the directory ~specadm/local/userconf/SPEC and has the name of the array with the user name appended.

    restore_array
    Usage: restore_array <array>
    Loads back saved values from an ASCII file from a previous "save_array" call.

    notice
    Usage: notice(message)


    cprint_bold
    Usage: cprint_bold(str)


    cprint_bold_underlined
    Usage: cprint_bold_underlined(str)


    cprint_underlined
    Usage: cprint_underlined(str)


    _cprint_bad_contrast
    Usage: _cprint_bad_contrast (<fgcolor>, <bgcolor>, <bold>, <underlined>)
    Return 1 if one of the conditions of poor contrast is matched.

    _cprint_bad_contrast2
    Usage: _cprint_bad_contrast2 (<fgcolor>, <bgcolor>, <bold>, <underlined>)
    Return 1 if one of the conditions of poor contrast is matched.

    _cprint_bad_contrast3
    Usage: _cprint_bad_contrast3 (<fgcolor>, <bgcolor>, <bold>, <underlined>)
    Return 1 if one of the conditions of poor contrast is matched.

    cprint
    Usage: cprint(str, fgcolor, bgcolor, bold, underlined, st)


    ceprint
    Usage: ceprint(str, fgcolor, bgcolor, bold, underlined, st)


    cprint_green
    Usage: cprint_green(msg)


    cprint_yellow
    Usage: cprint_yellow(msg)


    cprint_blue
    Usage: cprint_blue(msg)


    cprint_pink
    Usage: cprint_pink(msg)


    cprint_cyan
    Usage: cprint_cyan(msg)


    cprint_test_colors
    Usage: cprint_test_colors


    time_string
    Usage: time_string (value)
    convert time given in seconds in more readable format such as ps, ns, ms, s, min, hours and days. Rounds at 3 dignificant digits ?

    seconds
    Usage: seconds (<text>)
    Converts sub seconds units into seconds ex : p seconds("3ps") -> 3e-12

    date_init
    Usage: date_init [parma]
    From fasttomo.mac

    binary
    Usage: binary (<x> [<n>])
    Return <x> as binary number string consisting of 0 and 1. If <n> is given, the return value is filled with leading zeros up to <n> digits. Works for 32 bits numbers.

    __n354_return_bits
    Usage: __n354_return_bits (value, firstbit, lastbit)
    Return the value of a bit sequence (high positions starts left) % lowest bit is number 0

    __n354_yes_no
    Usage: __n354_yes_no (bit)
    Return yes for 1 and no for 0

    __n354_print_binary
    Usage: __n354_print_binary (decimal_number)
    Prints decimal, hexadecimal and binary of a given decimal number.

    __dec2bin
    Usage: __dec2bin (decimal_number)
    Decimal to binary conversion

    __bin2dec
    Usage: __bin2dec (binary_number)
    Binary to decimal conversion

    decimal_to_binary
    Usage: decimal_to_binary (decimal_number)
    Return the binary representation of a decimal number <x>. Return -1 is number is too big.

    motor_valid
    Usage: motor_valid (<motor_mnemonique>)
    Return 1 if.. Return 0 otherwise.

    counters_disableall
    Usage: counters_disableall()


    counters_enableall
    Usage: counters_enableall()


    counters_enable
    Usage: counters_enable( counters_list )


    counters_disable
    Usage: counters_disable( counters_list )


    counters_set
    Usage: counters_set(counters_list, state)


    sim_warn
    Usage: sim_warn()


    sim_warn_on
    Usage: sim_warn_on


    sim_warn_off
    Usage: sim_warn_off


Filename: spec_utils.mac
Author: BLISS (Compilation).
Last mod.: 20/03/2023 15:13 by guilloud