int main() { int s; char num[10]; char a[11]="- -- -----"; char b[2][11]; char c[11]=" ----- --"; char d[2][11]; char e[11]="- -- -- --"; strcpy(b[0],"| ||| ||"); strcpy(b[1],"||||| |||"); strcpy(d[0],"| | | | "); strcpy(d[1],"|| |||||||"); while(scanf("%d %s",&s,num),s){ printrow(a,s,num); printf("\n"); printcol(b,s,num); printrow(c,s,num); printf("\n"); printcol(d,s,num); printrow(e,s,num); printf("\n\n"); } return 0; }
/* the arguments for this routine are the same as those for the routine "splitpath". this routine was used to debug daddinv. */ void printrows(short length,short drift,signed char *br, signed char *tr,signed char *twod,signed char *twodp1) {printf("dedrifting %ld and %ld to %ld\n",2*drift, 2*drift + 1,drift); printrow(length,twodp1); printrow(length,twod); printrow(length,tr); printrow(length,br); }
int main() { list *head=readfromfile(); rebuild(head);//排序重建 int num; printf("演示————\n\n输入查找的列:"); fflush(stdin); scanf("%d",&num); printcol(head,num); printf("\n\n输入查找的行:"); fflush(stdin); scanf("%d",&num); printrow(head,num); int x,y; printf("\n\n输入查找的坐标(x y):"); fflush(stdin); scanf("%d%d",&x,&y); printone(head,x,y); char name[20]=""; printf("\n\n输入查找的人名:"); fflush(stdin); scanf("%s",name); printaperson(head,name); //查找就那么遍历链表就行了,没写。 printsitchart(head); return 0; }
void setbottomrow(void) /* Figures out the value of bottomrow based on the value of toprow */ { if (toprow + SCREENROWS > MAXROWS) toprow = MAXROWS - 20; bottomrow = toprow + 19; printrow(); } /* setbottomrow */
void settoprow(void) /* Figures out the value of toprow based on the value of bottomrow */ { if (bottomrow - SCREENROWS < -1) bottomrow = 19; toprow = bottomrow - 19; printrow(); } /* settoprow */
int usnic_vnic_dump(struct usnic_vnic *vnic, char *buf, int buf_sz, void *hdr_obj, int (*printtitle)(void *, char*, int), int (*printcols)(char *, int), int (*printrow)(void *, char *, int)) { struct usnic_vnic_res_chunk *chunk; struct usnic_vnic_res *res; struct vnic_dev_bar *bar0; int i, j, offset; offset = 0; bar0 = usnic_vnic_get_bar(vnic, 0); offset += scnprintf(buf + offset, buf_sz - offset, "VF:%hu BAR0 bus_addr=%pa vaddr=0x%p size=%ld ", usnic_vnic_get_index(vnic), &bar0->bus_addr, bar0->vaddr, bar0->len); if (printtitle) offset += printtitle(hdr_obj, buf + offset, buf_sz - offset); offset += scnprintf(buf + offset, buf_sz - offset, "\n"); offset += scnprintf(buf + offset, buf_sz - offset, "|RES\t|CTRL_PIN\t\t|IN_USE\t"); if (printcols) offset += printcols(buf + offset, buf_sz - offset); offset += scnprintf(buf + offset, buf_sz - offset, "\n"); spin_lock(&vnic->res_lock); for (i = 0; i < ARRAY_SIZE(vnic->chunks); i++) { chunk = &vnic->chunks[i]; for (j = 0; j < chunk->cnt; j++) { res = chunk->res[j]; offset += scnprintf(buf + offset, buf_sz - offset, "|%s[%u]\t|0x%p\t|%u\t", usnic_vnic_res_type_to_str(res->type), res->vnic_idx, res->ctrl, !!res->owner); if (printrow) { offset += printrow(res->owner, buf + offset, buf_sz - offset); } offset += scnprintf(buf + offset, buf_sz - offset, "\n"); } } spin_unlock(&vnic->res_lock); return offset; }