YCPBuiltinMisc.cc File Reference

#include <unistd.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include "ycp/YCPBuiltinMisc.h"
#include "ycp/YCPBoolean.h"
#include "ycp/YCPInteger.h"
#include "ycp/YCPVoid.h"
#include "ycp/YCPString.h"
#include "ycp/YCPCode.h"
#include "ycp/StaticDeclaration.h"
#include "ycp/y2log.h"
#include "ycp/ExecutionEnvironment.h"

Functions

static YCPInteger Time ()
 Return the number of seconds since 1.1.1970.
static YCPValue Sleep (const YCPInteger &ms)
 Sleeps a number of milliseconds.
static YCPInteger Random (const YCPInteger &max)
 Random number generator. Returns random integer in the interval (0,MAX). srandom must be activated to get really random numbers.
static YCPInteger Srandom1 ()
 Initialize random number generator Initialize random number generator with current date and time and returns the seed.
static YCPValue Srandom2 (const YCPInteger &seed)
 Initialize random number generator.
static YCPValue Eval (const YCPValue &v)
 Evaluate a YCP value. See also the builtin ``, which is kind of the counterpart to eval.
static YCPString s_sformat (const YCPValue &format, const YCPValue &_argv)
 Format a String FORM is a string that may contains placeholders 1, 2, ... Each placeholder is substituted with the argument converted to string whose number is after the %. Only 1-9 are allowed by now. The percentage sign is donated with %%.
static YCPValue Y2Log (loglevel_t level, const YCPString &format, const YCPList &args)
static YCPValue Y2Debug (const YCPString &format, const YCPList &args)
 Log a message to the y2log.
static YCPValue Y2Milestone (const YCPString &format, const YCPList &args)
 Log a milestone to the y2log.
static YCPValue Y2Warning (const YCPString &format, const YCPList &args)
 Log a warning to the y2log.
static YCPValue Y2Error (const YCPString &format, const YCPList &args)
 Log an error to the y2log.
static YCPValue Y2Security (const YCPString &format, const YCPList &args)
 Log a security message to the y2log.
static YCPValue Y2Internal (const YCPString &format, const YCPList &args)
 Log an internal message to the y2log.
static YCPValue Y2FDebug (const YCPInteger &f, const YCPString &format, const YCPList &args)
static YCPValue Y2FMilestone (const YCPInteger &f, const YCPString &format, const YCPList &args)
static YCPValue Y2FWarning (const YCPInteger &f, const YCPString &format, const YCPList &args)
static YCPValue Y2FError (const YCPInteger &f, const YCPString &format, const YCPList &args)
static YCPValue Y2FSecurity (const YCPInteger &f, const YCPString &format, const YCPList &args)
static YCPValue Y2FInternal (const YCPInteger &f, const YCPString &format, const YCPList &args)

Variables

StaticDeclaration static_declarations

Function Documentation

static YCPValue Eval const YCPValue v  )  [static]
 

Evaluate a YCP value. See also the builtin ``, which is kind of the counterpart to eval.

eval

eval (``(1+2)) -> 3

static YCPInteger Random const YCPInteger max  )  [static]
 

Random number generator. Returns random integer in the interval (0,MAX). srandom must be activated to get really random numbers.

random

Parameters:
integer MAX
Returns:
integer Returns integer in the interval (0,MAX). random(100) -> 82 random(100) -> 36

static YCPString s_sformat const YCPValue format,
const YCPValue _argv
[static]
 

Format a String FORM is a string that may contains placeholders 1, 2, ... Each placeholder is substituted with the argument converted to string whose number is after the %. Only 1-9 are allowed by now. The percentage sign is donated with %%.

sformat

Parameters:
string FORM
any PAR1
any PAR2
any ...
Returns:
string sformat ("%2 is greater %% than %1", 3, "five") -> "five is greater % than 3"

static YCPValue Sleep const YCPInteger ms  )  [static]
 

Sleeps a number of milliseconds.

sleep

Parameters:
integer MILLISECONDS Time in milliseconds
Returns:
void sleep(3000) -> sleeps 3 sec.

static YCPInteger Srandom1  )  [static]
 

Initialize random number generator Initialize random number generator with current date and time and returns the seed.

srandom

Returns:
integer srandom_1 srandom()

static YCPValue Srandom2 const YCPInteger seed  )  [static]
 

Initialize random number generator.

srandom

Parameters:
integer SEED
Returns:
void srandom_2 srandom(3355)

static YCPInteger Time  )  [static]
 

Return the number of seconds since 1.1.1970.

time

Returns:
integer time() -> 1111207439

static YCPValue Y2Debug const YCPString format,
const YCPList args
[static]
 

Log a message to the y2log.

y2debug

Arguments are same as for sformat() builtin. The y2log component is "YCP", so you can control these messages the same way as other y2log messages.

Parameters:
string FORMAT
any PAR1
any PAR2
any ...
Returns:
void
See also:
sformat
y2debug ("%1 is smaller than %2", 7, "13");

static YCPValue Y2Error const YCPString format,
const YCPList args
[static]
 

Log an error to the y2log.

y2error

Parameters:
string FORMAT
any PAR1
any PAR2
any ...
Returns:
void
See also:
sformat
y2error ("Invalid format of IPv4 '%1'.", "333.10.20.1") -> "Invalid format of IPv4 '333.10.20.1'"

static YCPValue Y2FDebug const YCPInteger f,
const YCPString format,
const YCPList args
[static]
 

static YCPValue Y2FError const YCPInteger f,
const YCPString format,
const YCPList args
[static]
 

static YCPValue Y2FInternal const YCPInteger f,
const YCPString format,
const YCPList args
[static]
 

static YCPValue Y2FMilestone const YCPInteger f,
const YCPString format,
const YCPList args
[static]
 

static YCPValue Y2FSecurity const YCPInteger f,
const YCPString format,
const YCPList args
[static]
 

static YCPValue Y2FWarning const YCPInteger f,
const YCPString format,
const YCPList args
[static]
 

static YCPValue Y2Internal const YCPString format,
const YCPList args
[static]
 

Log an internal message to the y2log.

y2internal

Parameters:
string FORMAT
any PAR1
any PAR2
any ...
Returns:
void
See also:
sformat
y2internal("This is a robbery!") -> "This is a robbery!"

static YCPValue Y2Log loglevel_t  level,
const YCPString format,
const YCPList args
[static]
 

static YCPValue Y2Milestone const YCPString format,
const YCPList args
[static]
 

Log a milestone to the y2log.

y2milestone

Parameters:
string FORMAT
any PAR1
any PAR2
any ...
Returns:
void
See also:
sformat
y2milestone("%1 - Humans detected!", "2038-02-12") -> "2038-02-12 - Humans detected!"

static YCPValue Y2Security const YCPString format,
const YCPList args
[static]
 

Log a security message to the y2log.

y2security

Parameters:
string FORMAT
any PAR1
any PAR2
any ...
Returns:
void
See also:
sformat
y2security ("Users on vacations: %1", ["josh", "joe", "pete"]) -> "Users on vacations: ["josh", "joe", "pete"]"

static YCPValue Y2Warning const YCPString format,
const YCPList args
[static]
 

Log a warning to the y2log.

y2warning

Parameters:
string FORMAT
any PAR1
any PAR2
any ...
Returns:
void
See also:
sformat
y2warning ("Breakers don't work!") -> "Breakers don't work!" y2warning ("%1 %2 packets have been lost", 12, "UDP") -> "12 UDP packets have been lost"


Variable Documentation

StaticDeclaration static_declarations
 


Generated on Fri Jun 16 18:07:45 2006 for yast2-core by  doxygen 1.4.6