Esempio n. 1
0
def newdate_options_get(option):
    """
    Get option for newdate, incdatr, difdatr

    Args:
        option : option name (str)
                 possible values:
                    'year'
    Returns:
        option value (str)
    Raises:
        TypeError if option not a string

    Examples:
    >>> import rpnpy.librmn.all as rmn
    >>> value = rmn.newdate_options_get('year')

    See also:
        newdate_options_set
        ignore_leapyear
        accept_leapyear
        newdate
    """
    cmd = 'get '
    optionv = _C_MKSTR(option.strip()+' '*32)
    loptionv = len(optionv.value)
    _rp.f_newdate_options(optionv, _C_WCHAR2CHAR(cmd), loptionv, len(cmd))
    if isinstance(optionv.value, bytes):
        return _C_CHAR2WCHAR(optionv.value).strip()
    else:
        return optionv.value.strip()
Esempio n. 2
0
def newdate_options_set(option):
    """
    Set option for newdate, incdatr, difdatr

    Args:
        option : 'option=value' to set (str)
                 possible values:
                    'year=gregorian'
                    'year=365_day'
                    'year=360_day'
    Returns:
        None
    Raises:
        TypeError if option not a string

    Examples:
    >>> import rpnpy.librmn.all as rmn
    >>> rmn.newdate_options_set('year=gregorian')

    See also:
        newdate_options_get
        ignore_leapyear
        accept_leapyear
        newdate
    """
    cmd = 'set'
    _rp.f_newdate_options(_C_WCHAR2CHAR(option), _C_WCHAR2CHAR(cmd),
                          len(option), len(cmd))