Example #1
0
VALUE intersys_query_fetch(VALUE self) {
	struct rbQuery* query;
	VALUE data = Qnil;
	Data_Get_Struct(self, struct rbQuery, query);
	int num_cols = 0;
	int i = 0;
	int sql_code;

	RUN(cbind_query_fetch(query->query, &sql_code));
	
	data = rb_ary_new();

	if(sql_code == 100) {
		query->query = 1;
		rb_funcall(self, rb_intern("close"), 0);
		return data;
	}
	if(sql_code) {
		return data;
	//	rb_raise(rb_eStandardError, "Error in SQL: %d", sql_code);
	}
	
	RUN(cbind_query_get_num_cols(query->query, &num_cols));
	for(i = 0; i < num_cols; i++) {
		rb_ary_push(data, rb_funcall(self, rb_intern("get_data"), 1, INT2FIX(i+1)));
	}
	return data;
}
Example #2
0
int main() {
    RUN(example1);
    RUN(example2);
#if WITH_THREADS
    RUN(example3);
#endif
}
Example #3
0
char *test_State_http() 
{
    State state;

    // Simulates doing a basic HTTP request then closing the connection.
    RUN(http_dir,
            OPEN, 
            REQ_RECV, HTTP_REQ, DIRECTORY, RESP_SENT, CLOSE);

    // Simulates two keep-alive handler requests then a close.
    RUN(http_handler,
            OPEN, 
            REQ_RECV, HTTP_REQ, HANDLER, REQ_SENT,
            REQ_RECV, HTTP_REQ, HANDLER, REQ_SENT, CLOSE);

    // Simulates two requests over a proxy connection followed by
    // the remote closing the connection so we have to shutdown.
    RUN(http_proxy,
            OPEN, 
            REQ_RECV, HTTP_REQ, PROXY, CONNECT, 
            REQ_SENT, REQ_RECV, HTTP_REQ, REQ_SENT, REQ_RECV, REMOTE_CLOSE,
            CLOSE);

    // Simulates a proxy connect that needs to exit after a 
    // handler request was issued and there's a bit of data left.
    RUN(http_proxy_handler,
            OPEN, 
            REQ_RECV, HTTP_REQ, PROXY, CONNECT, 
            REQ_SENT, REQ_RECV,
            HANDLER, REQ_SENT, CLOSE);

    return NULL;
}
Example #4
0
static int
do_test (void)
{
  int result = 0;
  int e;

#define RUN(test) \
  errno = 0;								      \
  e = test;								      \
  if (e != -1)								      \
    {									      \
      printf ("%s returned %d\n", #test, e);				      \
      result = 1;							      \
    }									      \
  else if (errno != EINVAL)						      \
    {									      \
      printf ("%s didn't set errno to EINVAL (%s instead)\n",		      \
	      #test, strerror (errno));					      \
      result = 1;							      \
    }

  RUN (sighold (-1));
  RUN (sighold (_NSIG + 100));

  RUN (sigrelse (-1));
  RUN (sigrelse (_NSIG + 100));

  return result;
}
Example #5
0
void git::Create(LPCTSTR szOutputFile, LPCTSTR szWorkingDir, LPCTSTR szTime, LPCTSTR szUser, LPCTSTR szEmail, LPCTSTR szComment)
{
	CString sOriginalDir;
	GetCurrentDirectory(2000, sOriginalDir.GetBufferSetLength(2000));
	SetCurrentDirectory(szWorkingDir);
	
	if (!file::DoesFileExist(".git"))
	{
		CString sOutputFile = szOutputFile;
		sOutputFile.Replace("../", "../../"); //workaround

		CString sCommand;
		sCommand.Format("git init >> %s", sOutputFile);
		RUN(sCommand);

		sCommand.Format("ECHO. >> %s", sOutputFile);
		RUN(sCommand);

		sCommand.Format("ECHO. >> %s", sOutputFile);
		RUN(sCommand);

		git::Commit(szOutputFile, szWorkingDir, szTime, szUser, szEmail, szComment);
	}

	SetCurrentDirectory(sOriginalDir);
}
Example #6
0
void git::Commit(LPCTSTR szOutputFile, LPCTSTR szWorkingDir, LPCTSTR szTime, LPCTSTR szUser, LPCTSTR szEmail, LPCTSTR szComment)
{
	CString sOriginalDir;
	GetCurrentDirectory(2000, sOriginalDir.GetBufferSetLength(2000));
	SetCurrentDirectory(szWorkingDir);
	
	CString sOutputFile = szOutputFile;
	sOutputFile.Replace("../", "../../"); //workaround

	CString sCommand;
	sCommand.Format("git add -A >> %s", sOutputFile);
	RUN(sCommand);

	sCommand.Format("git config user.name %s >> %s", szUser, sOutputFile);
	RUN(sCommand);

	sCommand.Format("git config user.email %s >> %s", szEmail, sOutputFile);
	RUN(sCommand);


	sCommand.Format("env GIT_AUTHOR_DATE=\"%s 0 %s\" git commit -m '%s' >> %s",
						szTime,
						config::szTimeZone,
						szComment,
						sOutputFile);

	RUN(sCommand);

	SetCurrentDirectory(sOriginalDir);
}
void ActivationFunctionsTestCase::run()
{
  RUN(ActivationFunctionsTestCase, softmax);
  RUN(ActivationFunctionsTestCase, logistic);
  RUN(ActivationFunctionsTestCase, normaltanh);
  RUN(ActivationFunctionsTestCase, linear);
  RUN(ActivationFunctionsTestCase, rectifier);
}
Example #8
0
int main(int argc, char** argv) {
    tl_init();
    RUN(num_new);
    RUN(build_and_print);
    RUN(basic);
    RUN(mul);
    RUN(pow);
}
Example #9
0
int main (int argc, char * argv[]){
	printf ("Basics Testcase\n");
	RUN (StructureParser::test_matchTypeName());
	RUN (StructureParser::test_matchCppType());
	RUN (StructureParser::test_matchVariableDefinition());
	RUN (StructureParser::test_matchFunctionDeclaration());
	return 0;
}
Example #10
0
VALUE intersys_query_column_name(VALUE self, VALUE i) {
	struct rbQuery* query;
	Data_Get_Struct(self, struct rbQuery, query);
	int len;
	const wchar_t *res;
	RUN(cbind_query_get_col_name_len(query->query, FIX2INT(i), &len));
	RUN(cbind_query_get_col_name(query->query, FIX2INT(i), &res));
	return FROMWCSTR(res);
}
Example #11
0
int main(int argc, char ** argv) {

	RUN(test_basic_diffusion);
	RUN(test_near_borders);
	RUN(test_border_temperatures);
	RUN(test_on_border_edge_case);

	return TEST_REPORT();
}
Example #12
0
int run_perftest(maincontext_t* maincontext)
{
   (void) maincontext;

   RUN(perftest_task_syncrunner);
   RUN(perftest_task_syncrunner_raw);

   return 0;
}
Example #13
0
VALUE intersys_query_execute(VALUE self) {
	struct rbQuery* query;
	int sql_code;
	int res;
	Data_Get_Struct(self, struct rbQuery, query);
	RUN(cbind_query_execute(query->query, &sql_code));
    RUN(cbind_query_get_num_pars(query->query, &res));
	query->executed = 1;
	return self;
}
Example #14
0
File: main.c Project: A-Paul/RIOT
int main(void)
{
    RUN(fix16_exp_unittests);
    RUN(fix16_macros_unittests);
    RUN(fix16_str_unittests);
    RUN(fix16_unittests);

    puts("SUCCESS");
    return 0;
}
Example #15
0
int main(void)
{
    RUN(fix16_exp_unittests);
    RUN(fix16_macros_unittests);
    RUN(fix16_str_unittests);
    RUN(fix16_unittests);

    puts("All tests executed.");
    return 0;
}
Example #16
0
int
main (void) {

  RUN(value);
  RUN(var);

  RUN(lexer);

  ok_done();
  return 0;
}
Example #17
0
VALUE intersys_query_initialize(VALUE self, VALUE database, VALUE sql_query) {
	struct rbQuery* query;
	struct rbDatabase* base;
	int sql_code;
	Data_Get_Struct(self, struct rbQuery, query);
	Data_Get_Struct(database, struct rbDatabase, base);
	rb_iv_set(self, "@database", database);
	query->limit = -1;
	RUN(cbind_alloc_query(base->database, &query->query));
	RUN(cbind_prepare_gen_query(query->query, WCHARSTR(TOWCHAR(sql_query)), &sql_code));
	return self;
}
Example #18
0
void interrupt 20 RxInterrupt(void)
{
    DisableInterrupts;
    if( SCI0SR1 & 0x20 )
    {
        CaptureCommand = SCI0DRL;
    }
    switch(CaptureCommand)
    {
        case '0':
            BREAK();isbreak = 1;constant_speed = 0;
            break;
        case '9':
            RUN();debug = 0;isbreak = 0;constant_speed = 450;
            break;
        case 'b':
            STOP();constant_speed = 0;
            break;
        case 'c':
            STOP();constant_speed = 0;
            break;
        case 'd':
            debug = 1;STOP();constant_speed = 0;
            break;
        default:
            break;
    }
    EnableInterrupts;
}
Example #19
0
int test_singlefile()
{
  SETUP;

  CHECK_SET_INTERFACE(singlefile);

  CHECK("get option (rib-file)",
        (option =
         bgpstream_get_data_interface_option_by_name(bs, datasource_id,
                                                     "rib-file")) != NULL);
  bgpstream_set_data_interface_option(bs, option,
                           "routeviews.route-views.jinx.ribs.1427846400.bz2");

  CHECK("get option (upd-file)",
        (option =
         bgpstream_get_data_interface_option_by_name(bs, datasource_id,
                                                     "upd-file")) != NULL);
  bgpstream_set_data_interface_option(bs, option,
                                      "ris.rrc06.updates.1427846400.gz");

  RUN(singlefile);

  TEARDOWN;
  return 0;
}
Example #20
0
int main(int argc, char* argv[])
{
  libkeccak_generalised_spec_t spec;
  libkeccak_generalised_spec_initialise(&spec);
  libkeccak_spec_shake((libkeccak_spec_t*)&spec, 256, 256);
  return RUN("SHAKE", "shake256sum", LIBKECCAK_SHAKE_SUFFIX);
}
Example #21
0
int main(int argc, char* argv[])
{
  libkeccak_generalised_spec_t spec;
  libkeccak_generalised_spec_initialise(&spec);
  libkeccak_spec_sha3((libkeccak_spec_t*)&spec, 384);
  return RUN("SHA-3", "sha3-384sum", LIBKECCAK_SHA3_SUFFIX);
}
Example #22
0
void git::GetLastComment(LPCTSTR szWorkingDir, CString &sComment)
{
	CString sOriginalDir;
	GetCurrentDirectory(2000, sOriginalDir.GetBufferSetLength(2000));
	SetCurrentDirectory(szWorkingDir);
	
	CString sOutputFile = config::szDump;
	sOutputFile.Replace("../", "../../"); //workaround

	CString sCommand;
	sCommand.Format("git log -1 >> %s", sOutputFile);
	RUN(sCommand);

	CStdioFile file;
	if (file.Open(sOutputFile, CFile::modeRead | CFile::shareDenyNone, NULL))
	{
		file.ReadString(sComment);
		file.ReadString(sComment);
		file.ReadString(sComment);
		file.ReadString(sComment);
		file.ReadString(sComment);
		sComment.TrimLeft();
		file.Close();
	}

//	sComment = "vss2git: 12345";

	::DeleteFile(sOutputFile);

	SetCurrentDirectory(sOriginalDir);
}
Example #23
0
void lcd_init_device(void)
{
    semaphore_init(&g_wait_sema, 1, 0);
    /* I'm not really sure this pin is related to power, it does not seem to do anything */
    imx233_pinctrl_acquire(1, 8, "lcd_power");
    imx233_pinctrl_acquire(1, 9, "lcd_spi_sdo");
    imx233_pinctrl_acquire(1, 10, "lcd_spi_scl");
    imx233_pinctrl_acquire(1, 11, "lcd_spi_cs");
    imx233_pinctrl_set_function(1, 9, PINCTRL_FUNCTION_GPIO);
    imx233_pinctrl_set_function(1, 10, PINCTRL_FUNCTION_GPIO);
    imx233_pinctrl_set_function(1, 11, PINCTRL_FUNCTION_GPIO);
    imx233_pinctrl_set_function(1, 8, PINCTRL_FUNCTION_GPIO);
    imx233_pinctrl_enable_gpio(1, 8, true);
    /** lcd is 320x240, data bus is 8-bit, depth is 24-bit so we need 3clk/pix
     * by running PIX clock at 24MHz we can sustain ~100 fps */
    imx233_clkctrl_enable(CLK_PIX, false);
    imx233_clkctrl_set_div(CLK_PIX, 2);
    imx233_clkctrl_set_bypass(CLK_PIX, true); /* use XTAL */
    imx233_clkctrl_enable(CLK_PIX, true);
    imx233_lcdif_init();
    imx233_lcdif_setup_dotclk_pins(8, false);
    imx233_lcdif_set_word_length(8);
    imx233_lcdif_set_underflow_cb(&lcd_underflow);
    imx233_lcdif_enable_underflow_irq(true);
    imx233_dma_clkgate_channel(APB_LCDIF, true);
    imx233_dma_reset_channel(APB_LCDIF);
    /** Datasheet states:
     * 257H >= VBP >= 3H, VBP > VLW, VFP >= 1H
     * 1533clk >= HBP >= 24clk, HBP > HLW, HFP >= 4clk
     * 
     * Take VLW=1H, VBP=3H, VFP=1H, HLW=8, HBP=24, HFP=4
     * Take 3clk/pix because we send 24-bit/pix with 8-bit data bus
     * Keep consistent with register setting in lcd_init_seq
     */
    imx233_lcdif_setup_dotclk_ex(/*v_pulse_width*/1, /*v_back_porch*/3,
        /*v_front_porch*/1, /*h_pulse_width*/8, /*h_back_porch*/24,
        /*h_front_porch*/4, LCD_WIDTH, LCD_HEIGHT, /*clk_per_pix*/3,
        /*enable_present*/false);
    imx233_lcdif_set_byte_packing_format(0xf);
    imx233_lcdif_enable_sync_signals(true); // we need frame signals during init
    // setup dma
    unsigned size = IMX233_FRAMEBUFFER_SIZE;
    uint8_t *frame_p = FRAME;
    for(int i = 0; i < NR_CMDS; i++)
    {
        unsigned xfer = MIN(IMX233_MAX_SINGLE_DMA_XFER_SIZE, size);
        lcdif_dma[i].dma.next = &lcdif_dma[(i + 1) % NR_CMDS].dma;
        lcdif_dma[i].dma.cmd = BF_OR3(APB_CHx_CMD, CHAIN(1),
            COMMAND(BV_APB_CHx_CMD_COMMAND__READ), XFER_COUNT(xfer));
        lcdif_dma[i].dma.buffer =  frame_p;
        size -= xfer;
        frame_p += xfer;
    }
    // first transfer: enable run, dotclk and so on
    lcdif_dma[0].dma.cmd |= BF_OR1(APB_CHx_CMD, CMDWORDS(1));
    lcdif_dma[0].ctrl = BF_OR4(LCDIF_CTRL, BYPASS_COUNT(1), DOTCLK_MODE(1),
        RUN(1), WORD_LENGTH(1));
    // enable
    lcd_enable(true);
}
Example #24
0
int main(int argc, char* argv[])
{
  libkeccak_generalised_spec_t spec;
  libkeccak_generalised_spec_initialise(&spec);
  libkeccak_spec_keccak((libkeccak_spec_t*)&spec, 224);
  return RUN("Keccak", "keccak-224sum", LIBKECCAK_KECCAK_SUFFIX);
}
Example #25
0
void intersys_query_free(struct rbQuery* query) {
	if(!query->closed && query->executed) {
		query_close(query);
		RUN(cbind_free_query(query->query));
		xfree(query);
	}
}
Example #26
0
VALUE intersys_base_level(VALUE self) {
	struct rbDatabase* base;
	int level;
	Data_Get_Struct(self, struct rbDatabase, base);
	RUN(cbind_tlevel(base->database, &level));
	return INT2FIX(level);
}
Example #27
0
int main(int argc, char** argv)
{
	seed = static_cast<unsigned int>(std::time(0));
	std::cout << "Seed = " << seed << std::endl;

	RUN(q0::algorithms::monte_carlo_1);
	RUN(q0::algorithms::monte_carlo);
	RUN(q0::algorithms::local_unimodal_search_1);
	RUN(q0::algorithms::local_unimodal_search);
	RUN(q0::algorithms::pattern_search_1);
	RUN(q0::algorithms::pattern_search);
	RUN(q0::algorithms::simulated_annealing_1);
	RUN(q0::algorithms::simulated_annealing);
	RUN(q0::algorithms::apso);
	RUN(q0::algorithms::differential_evolution);
	return 1;
}
Example #28
0
int
main()
{
	TEST_BEGIN

	RUN(test_Queue);

	TEST_END
}
Example #29
0
VALUE intersys_object_create(VALUE self) {
	wchar_t *init_val = NULL;
	struct rbObject *object;
	VALUE r_object = rb_funcall(self, rb_intern("new"), 0);
	
	Data_Get_Struct(r_object, struct rbObject, object);
	
	RUN(cbind_create_new(object->database, CLASS_NAME(object), init_val,&object->oref));
	return r_object;
}
Example #30
0
/*
	memory[0] = 0x0E; MOV AX
	memory[1] = 0x32;	mem
	memory[2] = 0x0B; ADD AX
	memory[3] = 0x33;	mem
	memory[4] = 0x0F; MOV AX
	memory[5] = 0x34;	mem
	

	memory[50] = 19;
	memory[51] = 15;
	memory[52] = 0;
	
	mov ax,19
	add ax,15
	mov 52,ax
*/
int main(void)
{
	
    while(1)
    {
		RUN();
        asm("nop");
		PORTC = GetWord(0x34);
    }
}