예제 #1
0
파일: robtkapp.c 프로젝트: x42/robtk
static void main_loop(void) {
	struct timespec timeout;
	pthread_mutex_lock (&gui_thread_lock);
	while (client_state != Exit) {
		run_one();

		if (client_state == Exit) break;

#ifdef _WIN32
		//Sleep(1000/UI_UPDATE_FPS);
#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
		struct __timeb64 timebuffer;
		_ftime64(&timebuffer);
#else
		struct __timeb32 timebuffer;
		_ftime(&timebuffer);
#endif
		timeout.tv_nsec = timebuffer.millitm * 1000000;
		timeout.tv_sec = timebuffer.time;
#else // POSIX
		clock_gettime(CLOCK_REALTIME, &timeout);
#endif
		timeout.tv_nsec += 1000000000 / (UI_UPDATE_FPS);
		if (timeout.tv_nsec >= 1000000000) {timeout.tv_nsec -= 1000000000; timeout.tv_sec+=1;}
		pthread_cond_timedwait (&data_ready, &gui_thread_lock, &timeout);

	} /* while running */
	pthread_mutex_unlock (&gui_thread_lock);
}
예제 #2
0
파일: main.cpp 프로젝트: GYGit/reactos
// -i R:\src\apphelp\reactos\media\sdb\sysmain.xml -oR:\build\apphelp\devenv_msvc\media\sdb\ros2.sdb
int main(int argc, char * argv[])
{
    std::string input, output;
    srand(time(0));

    for (int i = 1; i < argc; ++i)
    {
        if (argv[i][0] == '/' || argv[i][0] == '-')
        {
            switch(argv[i][1])
            {
            case 'i':
                input = get_strarg(argc, argv, i);
                break;
            case 'o':
                output = get_strarg(argc, argv, i);
                break;
            }
            if (!input.empty() && !output.empty())
            {
                if (!run_one(input, output))
                {
                    printf("Failed converting '%s' to '%s'\n", input.c_str(), output.c_str());
                    return 1;
                }
            }
        }
    }
    return 0;
}
예제 #3
0
파일: main.cpp 프로젝트: Moteesh/reactos
int main(int argc, char * argv[])
{
    std::string input, output;
    srand(time(0));

    for (int i = 1; i < argc; ++i)
    {
        if (argv[i][0] != '/' && argv[i][0] != '-')
            continue;

        switch(argv[i][1])
        {
        case 'i':
            input = get_strarg(argc, argv, i);
            break;
        case 'o':
            output = get_strarg(argc, argv, i);
            break;
        case 'l':
            update_loglevel(argc, argv, i);
            break;
        }
        if (input.empty() || output.empty())
            continue;

        if (!run_one(input, output))
        {
            printf("Failed converting '%s' to '%s'\n", input.c_str(), output.c_str());
            return 1;
        }
    }
    return 0;
}
예제 #4
0
파일: robtkapp.c 프로젝트: x42/robtk
static void osx_loop (CFRunLoopTimerRef timer, void *info) {
	if (client_state == Run) {
		run_one();
	}
	if (client_state == Exit) {
		rtk_osx_api_terminate();
	}
}
예제 #5
0
void
run_all (FILE *fp)
{
  mp_size_t  prev_size;
  int        i;
  TMP_DECL;

  TMP_MARK;
  SPEED_TMP_ALLOC_LIMBS (sp.xp_block, SPEED_BLOCK_SIZE, sp.align_xp);
  SPEED_TMP_ALLOC_LIMBS (sp.yp_block, SPEED_BLOCK_SIZE, sp.align_yp);

  data_fill (sp.xp_block, SPEED_BLOCK_SIZE);
  data_fill (sp.yp_block, SPEED_BLOCK_SIZE);

  for (i = 0; i < size_num; i++)
    {
      sp.size = size_array[i].start;
      prev_size = -1;
      for (;;)
        {
          mp_size_t  step;

          if (option_data == DATA_2FD && sp.size >= 2)
            sp.xp[sp.size-1] = 2;

          run_one (fp, &sp, prev_size);
          prev_size = sp.size;

          if (option_data == DATA_2FD && sp.size >= 2)
            sp.xp[sp.size-1] = MP_LIMB_T_MAX;

          if (option_factor != 0.0)
            {
              step = (mp_size_t) (sp.size * option_factor - sp.size);
              if (step < 1)
                step = 1;
            }
          else if(size_array[i].inc > 0)
              step = size_array[i].inc;
          else
            step = 1;

          if (step < option_step)
            step = option_step;

          sp.size += step;
          if (sp.size > size_array[i].end)
            break;
        }
    }

  TMP_FREE;
}
예제 #6
0
파일: work.c 프로젝트: dleslie/c-work-queue
int main(int argc, char **argv) {
  queue_t queue = {0};
  
  enqueue(&queue, f, "A");
  enqueue(&queue, f, "B");
  enqueue(&queue, f, "C");

  // Imagine this is your inner event loop
  while (run_one(&queue))
    sleep(1);

  return 0;
};
예제 #7
0
파일: zpios_main.c 프로젝트: Alyseo/zfs
static int
run_offsets(cmd_args_t *args)
{
	int rc = 0;

	while (rc == 0 && get_next(&args->current_O, &args->O)) {
		rc = run_one(args, args->current_id,
		    args->current_T, args->current_N, args->current_C,
		    args->current_S, args->current_O, args->current_B);
		args->current_id++;
	}

	args->O.next_val = 0;
	return (rc);
}
예제 #8
0
파일: main.cpp 프로젝트: chrns/heclub
int main() {
	run_one();
	run_two();
	return 0;
}
예제 #9
0
rc_t run ()
{
    KCipher * cipher;
    rc_t rc = 0, orc = 0;

#if 1
    subtype_iterator = 0;

    STSMSG (1, ("======================================================================"));
    STSMSG (1, ("%d: %s\n", subtype_iterator, types[subtype_iterator]));
    rc = KCipherTestByteMake (&cipher, kcipher_AES);
    if (rc == 0)
    {
        run_one (cipher);
        KCipherRelease (cipher);
    }
    else if (GetRCState(rc) == rcUnsupported)
        STSMSG (1, ("Not supported on this machine"));
    else
        orc = rc;
#endif
#if 1
    subtype_iterator = 1;
    STSMSG (1, ("======================================================================"));
    STSMSG (1, ("%d: %s\n", subtype_iterator, types[subtype_iterator]));
    rc = KCipherTestVecMake (&cipher, kcipher_AES);
    if (rc == 0)
    {
        run_one (cipher);
        KCipherRelease (cipher);
    }
    else if (GetRCState(rc) == rcUnsupported)
        STSMSG (1, ("Not supported on this machine"));
    else
        orc = rc;
#endif
#if 1
    subtype_iterator = 2;
    STSMSG (1, ("======================================================================"));
    STSMSG (1, ("%d: %s\n", subtype_iterator, types[subtype_iterator]));
    rc = KCipherTestVecRegMake (&cipher, kcipher_AES);
    if (rc == 0)
    {
        run_one (cipher);
        KCipherRelease (cipher);
    }
    else if (GetRCState(rc) == rcUnsupported)
        STSMSG (1, ("Not supported on this machine"));
    else
        orc = rc;
#endif
#if 1
    subtype_iterator = 3;
    STSMSG (1, ("======================================================================"));
    STSMSG (1, ("%d: %s\n", subtype_iterator, types[subtype_iterator]));
    rc = KCipherTestVecAesNiMake (&cipher, kcipher_AES);
    if (rc == 0)
    {
        run_one (cipher);
        KCipherRelease (cipher);
    }
    else if (GetRCState(rc) == rcUnsupported)
        STSMSG (1, ("Not supported on this machine"));
    else
        orc = rc;
#endif
    return orc;
}
예제 #10
0
파일: midlc.c 프로젝트: OpenSharp/NDceRpc
static int
run(int argc, char **argv,
		const char *filename,
		const char *outname,
		const char *type,
		const char *symtabpath,
		struct hashmap *macros,
		int verbose)
{
	struct idl idl;
	struct sym iface;
	unsigned char _outname[PATH_MAX];

	memset(&idl, 0, sizeof(idl));
	idl.argc = argc;
	idl.argv = argv;
	idl.type = type;
	idl.macros = macros;
	idl.verbose = verbose;
	idl.al = NULL;
	if ((idl.syms = hashmap_new(hash_str, cmp_str, NULL, idl.al)) == NULL ||
				(idl.consts = hashmap_new(hash_str, cmp_str, NULL, idl.al)) == NULL ||
				(idl.tmp = hashmap_new(hash_str, cmp_str, NULL, idl.al)) == NULL) {
		AMSG("");
		return -1;
	}
	if (symload(&idl, symtabpath) == -1) {
		if (errno != ENOENT || symload(&idl, path_filename(symtabpath)) == -1) {
			AMSG("");
			return -1;
		}
	}
                                            /* generate parse tree in iface */
	syminit(&iface, idl.al);
	if (idl_process_file(&idl, filename, &iface) == -1) {
		AMSG("");
		return -1;
	}

	if (idl.verbose > 1) {
		print_tree(&idl, &iface, 0);                     /* print everything */
	} else if (idl.verbose) {
		iter_t iter;
		struct sym *mem;
	
		linkedlist_iterate(&iface.mems, &iter);
		while ((mem = linkedlist_next(&iface.mems, &iter))) {
			if (IS_OPERATION(mem) == 0) {
				continue;
			}
			print_tree(&idl, mem, 0); /* only print operations and their params */
		}
	}
	if (idl.verbose)
		fprintf(stderr, " No Flg   Type            Ptr   Name      OutType       NdrType Siz Aln Off Attributes\n");

	mkoutname(_outname, outname ? outname : filename, "");
	idl.outname = dupstr(path_filename(_outname), NULL);

	if (strcmp(type, "jcifs") == 0) {
		mkoutname(_outname, outname ? outname : filename, ".java");
		if (run_one(&idl, &iface, _outname, emit_stub_jcifs) == -1) {
			AMSG("");
			return -1;
		}
	} else if (strcmp(type, "java") == 0) {
		mkoutname(_outname, outname ? outname : filename, ".java");
		if (run_one(&idl, &iface, _outname, emit_stub_java) == -1) {
			AMSG("");
			return -1;
		}
	} else if (*type == 's') {
		mkoutname(_outname, outname ? outname : filename, ".c");
		if (run_one(&idl, &iface, _outname, emit_stub_samba) == -1) {
			AMSG("");
			return -1;
		}
	} else if (*type == 'c') {
		mkoutname(_outname, outname ? outname : filename, ".h");
		if (run_one(&idl, &iface, _outname, emit_hdr_c) == -1) {
			AMSG("");
			return -1;
		}
		mkoutname(_outname, outname ? outname : filename, "_s.c");
		if (run_one(&idl, &iface, _outname, emit_svr_stub_c) == -1) {
			AMSG("");
			return -1;
		}
		mkoutname(_outname, outname ? outname : filename, "_c.c");
	}

	return 0;
}