本文整理汇总了C++中printv函数的典型用法代码示例。如果您正苦于以下问题:C++ printv函数的具体用法?C++ printv怎么用?C++ printv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: v4l_suspend
static int
v4l_suspend(vbi_capture_v4l *v)
{
int fd;
v4l_read_stop(v);
if (v->read_active) {
printv("Suspending read: re-open device...\n");
/* hack: cannot suspend read to allow SVBIFMT,
need to close device */
fd = device_open (v->capture.sys_log_fp,
v->p_dev_name, O_RDWR, 0);
if (-1 == fd) {
printv ("v4l2-suspend: failed to re-open "
"VBI device: %d: %s\n",
errno, strerror(errno));
return -1;
}
/* use dup2() to keep the same fd,
which may be used by our client */
device_close (v->capture.sys_log_fp, v->fd);
dup2 (fd, v->fd);
device_close (v->capture.sys_log_fp, fd);
v->read_active = FALSE;
}
return 0;
}
示例2: main
int main()
try{
//input
std::cout << "Input a string: ";
std::string s;
std::getline(std::cin, s);
if (!std::cin){
throw std::runtime_error("input fail");
}
std::string w;
std::cout << "Input whitespace: ";
std::getline(std::cin, w);
if (!std::cin){
throw std::runtime_error("input fail");
}
//output
std::cout << "split:" << std::endl;
printv(split(s));
std::cout << "split (with w):" << std::endl;
printv(split(s, w));
return 0;
}
catch (std::runtime_error& e){
std::cerr << "Error: " << e.what() << std::endl;
return 1;
}
catch (...){
std::cerr << "Unknown error!" << std::endl;
return 2;
}
示例3: check_copied_tags
void check_copied_tags(struct radix_tree_root *tree, unsigned long start, unsigned long end, unsigned long *idx, int count, int fromtag, int totag)
{
int i;
for (i = 0; i < count; i++) {
/* if (i % 1000 == 0)
putchar('.'); */
if (idx[i] < start || idx[i] > end) {
if (item_tag_get(tree, idx[i], totag)) {
printv(2, "%lu-%lu: %lu, tags %d-%d\n", start,
end, idx[i], item_tag_get(tree, idx[i],
fromtag),
item_tag_get(tree, idx[i], totag));
}
assert(!item_tag_get(tree, idx[i], totag));
continue;
}
if (item_tag_get(tree, idx[i], fromtag) ^
item_tag_get(tree, idx[i], totag)) {
printv(2, "%lu-%lu: %lu, tags %d-%d\n", start, end,
idx[i], item_tag_get(tree, idx[i], fromtag),
item_tag_get(tree, idx[i], totag));
}
assert(!(item_tag_get(tree, idx[i], fromtag) ^
item_tag_get(tree, idx[i], totag)));
}
}
示例4: print
void print(int num[],int total,int s){
int c,r;
int i,j,k;
c = 2*s; r = 2*s+3;
for(i=0;i<r;i++){
for(j=total-1;j>=0;j--){
if(i==0||i==s+1||i==2*s+2){
if(i==0)
print_horizon(num[j],0,s);
else if(i==s+1)
print_horizon(num[j],3,s);
else
print_horizon(num[j],6,s);
} else {
if(i-s<=0.0){
printv(num[j],1,2,s);
}else {
printv(num[j],4,5,s);
}
}
if(j!=0)printf(" ");
}
printf("\n");
}
}
示例5: pair_print
inline void pair_print( container *C, value v )
{
printf("(");
printv(((pair_container_priv*)C->priv)->A, pair(v).first);
printf(":");
printv(((pair_container_priv*)C->priv)->B, pair(v).second);
printf(")");
}
示例6: main
int
main(int argc, char *argv[]) {
int arr[9] = {5,17,3,10,84,19,6,22,9};
int heap[5];
printv(arr, 9);
k_smallest(arr, 9, heap, 5);
printv(heap, 5);
getchar();
return 0;
}
示例7: cos_init
void cos_init(void)
{
cbuf_t cbs[MAX_CBUFS];
int szs[MAX_CBUFS];
char *bufs[MAX_CBUFS];
int i;
printc("UNIT TEST Unit tests for cbufs...\n");
for (i = 0 ; i < MAX_CBUFS ; i++) {
int sz = (rand() % MAX_CBUF_SZ) + 1;
bufs[i] = cbuf_alloc(sz, &cbs[i]);
printv("UNIT TEST alloc %d -> %p\n", sz, bufs[i]);
assert(bufs[i]);
cbuf_free(bufs[i]);
printv("UNIT TEST free %p\n", bufs[i]);
}
printc("UNIT TEST PASSED: alloc->dealloc\n");
for (i = 0 ; i < MAX_CBUFS ; i++) {
int sz = (rand() % MAX_CBUF_SZ) + 1;
bufs[i] = cbuf_alloc(sz, &cbs[i]);
printv("UNIT TEST alloc %d -> %p\n", sz, bufs[i]);
assert(bufs[i]);
}
for (i = 0 ; i < MAX_CBUFS ; i++) {
cbuf_free(bufs[i]);
printv("UNIT TEST free %p\n", bufs[i]);
}
printc("UNIT TEST PASSED: N alloc -> N dealloc\n");
for (i = 0 ; i < MAX_CBUFS ; i++) {
int sz = (rand() % MAX_CBUF_SZ) + 1;
bufs[i] = cbuf_alloc(sz, &cbs[i]);
printv("UNIT TEST alloc %d -> %p\n", sz, bufs[i]);
szs[i] = sz;
assert(bufs[i]);
bufs[i][0] = '_';
unit_cbuf(cbs[i], sz);
assert(bufs[i][0] == '*');
printv("UNIT TEST cbuf2buf %d\n", sz);
}
printc("UNIT TEST PASSED: N alloc + cbuf2buf\n");
for (i = 0 ; i < MAX_CBUFS ; i++) {
bufs[i][0] = '_';
unit_cbuf(cbs[i], szs[i]);
printv("UNIT TEST cbuf2buf %d\n", szs[i]);
}
printc("UNIT TEST PASSED: N cached cbuf2buf\n");
for (i = 0 ; i < MAX_CBUFS ; i++) {
cbuf_free(bufs[i]);
printv("UNIT TEST free %p\n", bufs[i]);
}
printc("UNIT TEST PASSED: N deallocs\n");
printc("UNIT TEST ALL PASSED\n");
return;
}
示例8: learn_expand_or_one
static int learn_expand_or_one(struct solver_state *s, int w, int h) {
const int sz = w * h;
int i;
int learn = FALSE;
assert(s);
for (i = 0; i < sz; ++i) {
int j;
int one = TRUE;
if (s->board[i] != EMPTY) continue;
for (j = 0; j < 4; ++j) {
const int x = (i % w) + dx[j];
const int y = (i / w) + dy[j];
const int idx = w*y + x;
if (x < 0 || x >= w || y < 0 || y >= h) continue;
if (s->board[idx] == EMPTY) {
one = FALSE;
continue;
}
if (one &&
(s->board[idx] == 1 ||
(s->board[idx] >= expandsize(s->board, s->dsf, w, h,
i, s->board[idx]))))
one = FALSE;
assert(s->board[i] == EMPTY);
s->board[i] = -SENTINEL;
if (check_capacity(s->board, w, h, idx)) continue;
assert(s->board[i] == EMPTY);
printv("learn: expanding in one\n");
expand(s, w, h, i, idx);
learn = TRUE;
break;
}
if (j == 4 && one) {
printv("learn: one at (%d, %d)\n", i % w, i / w);
assert(s->board[i] == EMPTY);
s->board[i] = 1;
assert(s->nempty);
--s->nempty;
learn = TRUE;
}
}
return learn;
}
示例9: printv_func
void THIS::init(parent_t * const & p)
{
printv_func(DEBUG);
setParent(p);
auto app = get_fnd_app();
if(app->G::has_object())
if(!G::has_object())
G::make_object<THIS, int>(
app->get_graphics_plugin(),
neb::fnd::plug::gfx::core::shape::type::CUBOID);
if(app->P::has_object()) {
if(P::has_object()) {
printv(DEBUG, "phx plugin not null\n");
} else {
P::make_object<THIS, int>(
app->get_physics_plugin(),
neb::fnd::plug::phx::core::shape::type::CUBOID);
}
}
neb::fnd::core::shape::base::init(p);
//neb::gfx::core::shape::base::init(p);
//neb::gfx::core::shape::box::init(p);
//neb::phx::core::shape::base::init(p);
//neb::phx::core::shape::box::init(p);
//neb::fin::core::shape::base::init(p);
}
示例10: printv_func
void neb::gfx::Viewport::load()
{
printv_func(DEBUG);
printv(DEBUG, "x %i y %i w %i h %i\n", x_, y_, w_, h_);
glViewport(x_, y_, w_, h_);
}
示例11: learn_critical_square
static int learn_critical_square(struct solver_state *s, int w, int h) {
const int sz = w * h;
int i;
int learn = FALSE;
assert(s);
/* for each connected component */
for (i = 0; i < sz; ++i) {
int j;
if (s->board[i] == EMPTY) continue;
if (i != dsf_canonify(s->dsf, i)) continue;
if (dsf_size(s->dsf, i) == s->board[i]) continue;
assert(s->board[i] != 1);
/* for each empty square */
for (j = 0; j < sz; ++j) {
if (s->board[j] != EMPTY) continue;
s->board[j] = -SENTINEL;
if (check_capacity(s->board, w, h, i)) continue;
/* if not expanding s->board[i] to s->board[j] implies
* that s->board[i] can't reach its full size, ... */
assert(s->nempty);
printv(
"learn: ds %d at (%d, %d) blocking (%d, %d)\n",
s->board[i], j % w, j / w, i % w, i / w);
--s->nempty;
s->board[j] = s->board[i];
filled_square(s, w, h, j);
learn = TRUE;
}
}
return learn;
}
示例12: print_board
static void print_board(int *board, int w, int h) {
if (verbose) {
char *repr = board_to_string(board, w, h);
printv("%s\n", repr);
free(repr);
}
}
示例13: provaCalcS
/*
* Test 1
* */
void provaCalcS(){
printf("halloo, probando probando!!\n");
vector pc = zerov(2);
vector pcPrimes = zerov(2);
matrix S = zerom(2, 3);
pc.v[0] = 50; pc.v[1] = 200;
//Test in matlab
//S = [ 0 0.0003495 0.002; 0.0018 0.0338 0.0207];
S.m[0][0] = 0; S.m[0][1] = 0.0003495; S.m[0][2] = 0.002;
S.m[1][0] = 0.0018; S.m[1][1] = 0.0338; S.m[1][2] = 0.0207;
int numPrimes = (int)(pc.v[pc.x - 1] / pc.v[0]);
intvector numsPrimesReason = primes(numPrimes);
int i, j;
for(i = 0; i < numsPrimesReason.x; ++i){
printf("i: %d\n", numsPrimesReason.v[i]);
int primeNum = numsPrimesReason.v[i];
for(j = 0; j < pcPrimes.x; ++j){
pcPrimes.v[j] = pc.v[j] * primeNum;
}
printf("\nArray pcPrimes:\n");
printv(pcPrimes);
matrix SnInterp = interp1Mat(pc, pcPrimes, S, 0);
printf("\nResult S\n");
printm(SnInterp);
}
}
示例14: printv
void THIS::step(
gal::etc::timestep const & ts)
{
printv(DEBUG, "%s\n", __PRETTY_FUNCTION__);
neb::fnd::core::shape::util::parent::step(ts);
neb::fnd::core::light::util::parent::step(ts);
}
示例15: main
int main(void)
{
int x, y;
int cs, st;
srand((unsigned)(time(NULL)));
setlocale(LC_ALL, "zh_TW.UTF-8");
while(1)
{
x=1, y=1+(int)(20.*rand()/(1.+RAND_MAX));
printf("\x1b[2J");
while(x<=70)
{
cs=(int)(2.*rand()/(1.+RAND_MAX));
if(cs)
{
st=(int)(2.*rand()/(1.+RAND_MAX));
if(y==20){ st=0; }
else if(y==1){ st=1; }
printv(&x, &y, st);
}
else
{
printf("\x1b[%d;%dH%lc", y, x, linec[0]);
pwhite(x, y+1);
x+=1;
}
}
}
return 0;
}