示例#1
0
void print_floor(Floor f) {

	printf("Floor : %d", f.number);
	printf("Requests (up : down) : %d : %d\n", f.request_button[0], f.request_button[0]);
	printf("Queue : ");
	llist_print(f.queue);
	printf("\nIn the floor : ");
	llist_print(f.in_floor);

}	
示例#2
0
void print_lift(Lift* l) {

	printf("Lift Floor : %d, Direction : %d\n", l->current_floor, l->direction);
	printf("Max limit : %d\n In lift : ", l->max_limit);
	llist_print(l->people);
	printf("\n");

}
示例#3
0
int main(void) {
 /* linked list */
 PERSON *newnode = NULL;
 int i = 0; /* a general counter */

 /* load some random values into the linked list */
 for(i = 0; i < MAX; i++) {
  llist_add(&newnode, (rand() % 100));
 }

 head = newnode;
 printf("Before bubble sort:\n");
 llist_print();
 printf("After  bubble sort:\n");
 llist_bubble_sort();
 llist_print();

 return 0;
}
// Print contents of the table.
void wtable_print(WordTable * wtable, FILE * fd)
{
	fprintf(fd, "------- WORD TABLE -------\n");

	// Print words
	for (int i = 0; i < wtable->nWords; i++) {
		fprintf(fd, "%d: %s: ", i, wtable->wordArray[i].word);
		llist_print( &wtable->wordArray[i].positions);
	}
}
示例#5
0
void stack_print(Stack* st)
{
    LList* new3=(LList*)malloc(sizeof(LList));
    new3->head=(Node*)malloc(sizeof(Node));
    LList* new2=(LList*)malloc(sizeof(LList));
    new2->head=(Node*)malloc(sizeof(Node));
    new3=llist_new();
    new2->head=st->list->head;
    while (new2->head!=NULL)
    {
        new3=llist_prepend(new3,new2->head->data);
        new2->head=new2->head->next;
    }
    llist_print(new3);
}
示例#6
0
int main(int argc, char **argv)
{
    llist_t *paths,*src,*todo;
    set_t *incl;
    map_t *deps;

    if (argc < 2) {
        fprintf(stderr,"FastDep v%s for LAMMPS\n"
                "Usage: %s [-I <path> ...] -- <src1> [<src2> ...]\n",
                version,argv[0]);
        fprintf(stderr,"Supported extensions: %s, %s, %s\n",
                extensions[0], extensions[1], extensions[2]);
        return 1;
    }

    /* hash tables for all known included files and dependencies
     * we guesstimate a little over 2x as many entries as sources. */
    incl = set_init(2*argc);
    deps = map_init(2*argc);

    /* list of include search paths. prefixed by "." and "..". */
    paths = llist_init();
    llist_append(paths,".");
    llist_append(paths,"..");

    while (++argv, --argc > 0) {
        if (strncmp(*argv, "-I", 2) == 0) {
            if ((*argv)[2] != '\0') {
                llist_append(paths,trim_path(*argv+2));
            } else {
                ++argv;
                --argc;
                if (argc > 0) {
                    if (strcmp(*argv,"--") == 0) {
                        break;
                    } else {
                        llist_append(paths,trim_path(*argv));
                    }
                }
            }
        } else if (strcmp(*argv,"--") == 0) {
            break;
        } /* ignore all unrecognized arguments before '--'. */
    }

    src = llist_init();
    while (++argv, --argc > 0) {
        llist_append(src,*argv);
    }

    /* process files to look for includes */
    todo = llist_init();
    find_includes(src->head,todo,paths,incl,deps);
    find_includes(todo->head,todo,paths,incl,deps);
    llist_free(todo);

    fprintf(stdout,"# FastDep v%s for LAMMPS\n",version);
    fputs("# Search path: ",stdout);
    llist_print(paths);
    fprintf(stdout,"# % 5d sources\n# % 5d includes\n# % 5d depfiles\n",
            llist_size(src),set_size(incl),map_size(deps));

    set_free(incl);
    do_depend(src->head,deps);

    llist_free(src);
    llist_free(paths);
    map_free(deps);
    return 0;
}