yast2-core
Macros | Functions | Variables
YCPBuiltinInteger.cc File Reference
#include <sstream>
#include "ycp/YCPBuiltinInteger.h"
#include "ycp/YCPInteger.h"
#include "ycp/YCPString.h"
#include "ycp/YCPFloat.h"
#include "ycp/StaticDeclaration.h"
#include "y2log.h"

Macros

#define ETC   0, NULL, constTypePtr(), NULL
 
#define ETCf   NULL, constTypePtr(), NULL
 

Functions

static YCPValue i_plus (const YCPInteger &i1, const YCPInteger &i2)
 
static YCPValue i_minus (const YCPInteger &i1, const YCPInteger &i2)
 
static YCPValue i_mult (const YCPInteger &i1, const YCPInteger &i2)
 
static YCPValue i_div (const YCPInteger &i1, const YCPInteger &i2)
 
static YCPValue i_mod (const YCPInteger &i1, const YCPInteger &i2)
 
static YCPValue i_and (const YCPInteger &i1, const YCPInteger &i2)
 
static YCPValue i_xor (const YCPInteger &i1, const YCPInteger &i2)
 
static YCPValue i_or (const YCPInteger &i1, const YCPInteger &i2)
 
static YCPValue i_left (const YCPInteger &i1, const YCPInteger &i2)
 
static YCPValue i_right (const YCPInteger &i1, const YCPInteger &i2)
 
static YCPValue i_neg (const YCPInteger &i1)
 
static YCPValue i_bnot (const YCPInteger &i1)
 
static YCPValue i_tointeger1 (const YCPValue &v)
 
static YCPValue i_tointeger2 (const YCPString &v, const YCPInteger &b)
 

Variables

StaticDeclaration static_declarations
 

Macro Definition Documentation

#define ETC   0, NULL, constTypePtr(), NULL
#define ETCf   NULL, constTypePtr(), NULL

Function Documentation

static YCPValue i_and ( const YCPInteger i1,
const YCPInteger i2 
)
static

integer i1 & integer i2 -> integer Bitwise and of integers.

Examples:

13 & 8 -> 8
13 & 7 -> 5

References YCPElement::isNull().

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_bnot ( const YCPInteger i1)
static

~ integer i -> integer Bitwise not of integer.

Example:

~42 = -43

References YCPElement::isNull().

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_div ( const YCPInteger i1,
const YCPInteger i2 
)
static

integer i1 / integer i2 -> integer Division of integers.

Examples:

6 / 2 -> 3
42 / 0 -> nil

References YCPElement::isNull(), and ycp2error.

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_left ( const YCPInteger i1,
const YCPInteger i2 
)
static

integer i1 << integer i2 -> integer Bitwise shift left for integers.

Example:

8 << 2 -> 32

References YCPElement::isNull().

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_minus ( const YCPInteger i1,
const YCPInteger i2 
)
static

integer i1 - integer i2 -> integer Subtraction of integers.

Example:

1 - 2 -> -1

References YCPElement::isNull().

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_mod ( const YCPInteger i1,
const YCPInteger i2 
)
static

integer i1 % integer i2 -> integer Modulus of integers.

Examples:

7 % 4 -> 3

References YCPElement::isNull().

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_mult ( const YCPInteger i1,
const YCPInteger i2 
)
static

integer i1 * integer i2 -> integer Multiplication of integers.

Example:

2 * 3 -> 6

References YCPElement::isNull().

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_neg ( const YCPInteger i1)
static

- integer i -> integer Negative of integer.

References YCPElement::isNull().

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_or ( const YCPInteger i1,
const YCPInteger i2 
)
static

integer i1 | integer i2 -> integer Bitwise or of integers.

Examples:

2 | 2 -> 2
1 | 4 -> 5

References YCPElement::isNull().

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_plus ( const YCPInteger i1,
const YCPInteger i2 
)
static

integer i1 + integer i2 -> integer Addition of integers.

Example:

1 + 2 -> 3

References YCPElement::isNull().

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_right ( const YCPInteger i1,
const YCPInteger i2 
)
static

integer i1 >> integer i2 -> integer Bitwise shift right for integers.

Example:

8 >> 2 -> 2

References YCPElement::isNull().

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_tointeger1 ( const YCPValue v)
static

tointeger tointeger-1 Converts a value to an integer. If the value can't be converted to an integer, nil is returned.

Parameters
anyVALUE
Returns
integer

tointeger (4.03) -> 4 tointeger ("42") -> 42 tointeger ("0x42") -> 66 tointeger ("042") -> 34

References YCPElement::isNull(), YT_FLOAT, YT_INTEGER, and YT_STRING.

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_tointeger2 ( const YCPString v,
const YCPInteger b 
)
static

tointeger tointeger-2 Converts a string to an integer. If the value can't be converted to an integer, nil is returned.

Parameters
stringvalue
integerbase
Returns
integer

tointeger("20", 8) -> 16 tointeger("20", 10) -> 20 tointeger("20", 16) -> 32 tointeger("0x20", 16) -> 32

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

static YCPValue i_xor ( const YCPInteger i1,
const YCPInteger i2 
)
static

integer i1 ^ integer i2 -> integer Bitwise exclusive or of integers.

Examples:

2 ^ 7 -> 5
5 ^ 4 -> 1

References YCPElement::isNull().

Referenced by YCPBuiltinInteger::YCPBuiltinInteger().

Variable Documentation

StaticDeclaration static_declarations

Generated on a sunny day for yast2-core by doxygen 1.8.6