示例#1
0
int main(int argc, char **argv)
{
    
    FILE *in = NULL, *out = NULL;
    struct vm_state *myvm = NULL ;
    int runcycles = 0;
    if (argc != 4)
    {
        fprintf(stderr, "usage: %s input output cycles \n", argv[0]);
        exit(1);
    }

    in = fopen(argv[1], "rb");
    out = fopen(argv[2], "wb");    

    if (in == NULL)
    {
        perror("opening input file");
        exit(1);
    }
    if (out == NULL)
    {
        perror("opening output file");
        exit(1);
    }
    runcycles = atoi(argv[3]);

    myvm = initialize_vm();
    load_vm(myvm, in);
    run_vm(myvm, runcycles);
    dump_vm(myvm, out);
    return 0;

    
}
示例#2
0
文件: main.c 项目: vlad9486/emperor
int main(int argc, char* argv[]) {

    if (argc < 2) {
        printf("[ERROR]: too few parameters\n");
        return EXIT_FAILURE;
    }
    initialize_vm(argv[1]);
    loop();
    finalize_vm();

    return EXIT_SUCCESS;
}