Esempio n. 1
0
 void ObChunkServerMain::print_version()
 {
   fprintf(stderr, "chunkserver (%s %s)\n", PACKAGE_STRING, RELEASEID);
   fprintf(stderr, "SVN_VERSION: %s\n", svn_version());
   fprintf(stderr, "BUILD_TIME: %s %s\n\n", build_date(), build_time());
   fprintf(stderr, "Copyright (c) 2007-2011 Taobao Inc.\n");
 }
Esempio n. 2
0
File: date.c Progetto: BigEd/wp34s
/*
 *  Convert Z = year, y = month, x = day to a valid date in X
 */
decNumber *dateFromYMD(decNumber *res, const decNumber *z, const decNumber *y, const decNumber *x) {
	if (decNumberIsSpecial(x) || decNumberIsSpecial(y) || decNumberIsSpecial(z))
		return set_NaN(res);
	else {
		return build_date(res, dn_to_int(z), dn_to_int(y), dn_to_int(x));
	}
}
Esempio n. 3
0
int so_main()
{
  printf(INTRODUCTION);
  printf("SVN Revision: %s\n", svn_version());
  printf("SO Build Time: %s %s\n", build_date(), build_time());
  printf("GCC Version: %s\n", __VERSION__);
  printf("\n");
  exit(0);
}
Esempio n. 4
0
File: date.c Progetto: BigEd/wp34s
void date_date(enum nilop op) {
	if (Xtal) {
		unsigned int d, m, y;
		decNumber z;

		query_date(&d, &m, &y);
		build_date(&z, y, m, d);
		setX(&z);
	} else
		err(ERR_NO_CRYSTAL);
}
Esempio n. 5
0
File: date.c Progetto: BigEd/wp34s
decNumber *dateFromJ(decNumber *res, const decNumber *x) {
	if (decNumberIsSpecial(x) || dn_lt0(x))
		set_NaN(res);
	else {
		const int j = dn_to_int(x);
		int y, m, d;

		JDN2(j, &y, &m, &d);
		return build_date(res, y, m, d);
	}
	return res;
}
    void ObUpdateServerMain::print_version()
    {
      fprintf(stderr, "updateserver (%s %s)\n", PACKAGE_STRING, RELEASEID);
      fprintf(stderr, "SVN_VERSION: %s\n", svn_version());
      fprintf(stderr, "BUILD_TIME: %s %s\n", build_date(), build_time());
      fprintf(stderr, "BUILD_FLAGS: %s\n\n", build_flags());
#ifdef _BTREE_ENGINE_
      fprintf(stderr, "Using Btree Key-Value Engine.\n");
#else
      fprintf(stderr, "Using Hash Key-Value Engine.\n");
#endif
      fprintf(stderr, "Copyright (c) 2007-2011 Taobao Inc.\n");
    }
Esempio n. 7
0
File: date.c Progetto: BigEd/wp34s
/* Date of Easter.  Input is the year and output is a date.
 * The input can either be specified as an integer year or as a
 * valid date in the current format.
 */
decNumber *dateEaster(decNumber *res, const decNumber *x) {
	int y;

	if (find_year(x, &y)) {
		set_NaN(res);
		return res;
	} else {
		int m, d;

		easter(y, &m, &d);
		build_date(res, y, m, d);
	}
	return res;
}
Esempio n. 8
0
flim::build_info_t flim::build_info() {
  flim::build_info_t info;

  info.date = build_date();
  info.host = build_host();
  info.user = build_user();
  info.rev[0] = m_rfflim->get_reg(RORC_REG_FLIM_BUILD_REV_0);
  info.rev[1] = m_rfflim->get_reg(RORC_REG_FLIM_BUILD_REV_1);
  info.rev[2] = m_rfflim->get_reg(RORC_REG_FLIM_BUILD_REV_2);
  info.rev[3] = m_rfflim->get_reg(RORC_REG_FLIM_BUILD_REV_3);
  info.rev[4] = m_rfflim->get_reg(RORC_REG_FLIM_BUILD_REV_4);
  info.hw_ver = hardware_ver();
  info.clean = (m_rfflim->get_reg(RORC_REG_FLIM_BUILD_FLAGS) & 0x1);
  info.repo = (m_rfflim->get_reg(RORC_REG_FLIM_BUILD_FLAGS) & 0x6) >> 1;
  return info;
}
Esempio n. 9
0
void get_package_and_svn(char* server_version, int64_t buf_len)
{
  const char* server_version_template = "%s_%s(%s %s)";
  snprintf(server_version, buf_len, server_version_template, PACKAGE_VERSION,
      svn_version(), build_date(), build_time());
}
Esempio n. 10
0
File: eva_cgi.c Progetto: AmziLS/eva
int main(int argc, char *argv[])
{
	char buffer[5000];
	char *val;
	char *buf, *buf2;
	long buflen;
	int i, j, n;
	char *p, *q, *tp;
	char valbuf[5000];
	char ibuf[10];
	int date_error = 0;
	
	// used for Prolog
	RC rc;
	TERM term;
	TF tf;
	char errmsg[1000];
	TERM table;
	TERM row;
	TERM item;
	
	val = getenv("CONTENT_LENGTH");
	if (val == NULL)
	{
		val = getenv("QUERY_STRING");
		if (val == NULL) return;
		buf = (char *)malloc(strlen(val)+2);
		strcpy(buf, val);
	}
	else
	{
		// Add two for two nuls and malloc space
		buflen = atol(val)+2;
		buf = (char *)malloc(buflen);
		if (buf == NULL) return;
		fgets(buf, buflen-1, stdin);
		buf[buflen-1] = '\0';			// Add an extra nul
	}
	
	//strcpy(buffer, head);
	//strcat(buffer, buf);
	//strcat(buffer, foot);
	//fputs(buffer, outfile);
	
	
	p = buf;
	i = 0;
	while (*p != '\0')
	{
		// Grab the attribute (up to the equal = sign)
		q = strchr(p, '=');
		if (q == NULL) // Not the right format
		{
			free(buf);
			return;
		}
		*q = '\0';
		tp = q + 1;
		decode_url(p);

		// get the attribute name
		strcpy(facts[i].name, p);
 		
		// Grab the value (up to the & or nul)
		p = tp;
		q = strchr(p, '&');
		if (q == NULL)		// End of string
		{
			q = &buf[buflen-1];
			tp = q;
		}
		else				// More values left to process
		{
			*q = '\0';
			tp = q + 1;
		}
		decode_url(p);
		
		if (strstr( facts[i].name, "Date" ) != 0 && strlen(p) > 0) {
			strcpy(facts[i].value, build_date(p));
			if (strcmp(facts[i].value, "bad date") == 0) date_error = 1;
		}
		else {
			strcpy(facts[i].value, p);
		}
		i++;

		p = tp;
	}
	
	n = i;
	
	
	printf("Content-type: text/html\n\n<html>\n\n<body><h1>EVA India</h1>");

#ifdef TEST
	strcpy(buffer, "<table border='3' cellpadding='5'>");
	for (i=0; i<n; i++) {
		strcat(buffer, "<tr>");
		strcat(buffer, "<td>");
		strcat(buffer, facts[i].name);
		strcat(buffer, "</td>");
		strcat(buffer, "<td>");
		strcat(buffer, facts[i].value);
		strcat(buffer, "</td>");
		strcat(buffer, "</tr>");
	}
	strcat(buffer, "</table>");
	fputs(buffer, stdout);  // was outfile
#endif
	free(buf);
	
	if (date_error == 1) {
		printf("<p><font color=red>Please enter dates in YYYY-MM-DD format</font></p>");
		goto main_error;
		}

	
	
	// Initialize the Prolog environment

#ifdef TEST
	printf("<P><font color='green'>lsInit cureng= %p</font></p>", CurEng);
#endif

	rc = lsInit(&CurEng, "arules");
	if (rc != 0)
	{
		lsGetExceptMsg(CurEng, errmsg, 1024);

		printf("<p><font color='red'>Fatal Error #%d initializing Amzi! Logic Server:\n%s</font></p>", rc, errmsg);
		goto main_error;
	}


#ifdef TEST
	printf("<P><font color='green'>lsInitLSX cureng= %p</font></p>", CurEng);
#endif
	rc = lsInitLSX(CurEng, NULL);
	if (rc != 0)
	{
		printf("<p><font color='red'>Fatal Error #%d initializing LSXs</font></p>", rc);
		goto main_error;
	}


	// Load the .xpl file 
#ifdef TEST
	printf("<P><font color='green'>lsLoad cureng= %p</font></p>", CurEng);
#endif
	rc = lsLoad(CurEng, "arules");
	if (rc != 0)
	{
		lsGetExceptMsg(CurEng, errmsg, 1024);

		printf("<p><font color='red'>Fatal Error #%d loading Amzi! Logic Server XPL file:\n%s</font></p>", rc, errmsg);
		goto main_error;
	}
	
#ifdef TEST
	printf("<P><font color='green'>lsExecStr version(X) cureng= %p</font></p>", CurEng);

	tf = lsExecStr(CurEng, &term, "version( ?x )");
	if (tf != TRUE)
	{
		printf("<p><font color='red'>version failed");
		goto main_error;
	}
	rc = lsGetArg(CurEng, term, 1, cSTR, buffer);
	printf("<P><font color='green'>version = %s, cureng= %p</font></p>", buffer, CurEng);
#endif
	
	
#ifdef TEST
	printf("<P><font color='green'>lsExecStr load('eva_india.axl') cureng= %p</font></p>", CurEng);
#endif
	tf = lsExecStr(CurEng, &term, "load('eva_india.axl')");
	if (tf != TRUE)
	{
		lsGetExceptMsg(CurEng, errmsg, 1024);

		printf("<p><font color='red'>Fatal Error #%d loading eva_india.axl file: %s</font></p>", rc, errmsg);
		goto main_error;
	}
	
#ifdef TEST
	printf("<P><font color='green'>lsExecStr arxl...  cureng= %p</font></p>", CurEng);
#endif
	// Assert the basic data for the case
	tf = lsExecStr(CurEng, &term, "arxl_initialize_table(`CommonRules`, `data`)");
	tf = lsExecStr(CurEng, &term, "arxl_initialize_table(`CommonRules`, `raw_vaccination`)");

	j = 1;
	for (i=0; i<n; i++) {
		if (strstr(facts[i].name, "Vaccination") != 0 && strlen(facts[i].value) > 0 ) {
			strcpy(buffer, "arxl_add_to_table(`CommonRules`, `raw_vaccination`, ");
			sprintf(ibuf, "%d", j);
			strcat(buffer, ibuf);
			strcat(buffer, ", `Vaccination`, `");
			strcat(buffer, facts[i].value);
			strcat(buffer, "`)");
			//printf(buffer);
			tf = lsExecStr(CurEng, &term, buffer);
			i++;
			strcpy(buffer,  "arxl_add_to_table(`CommonRules`, `raw_vaccination`, ");
			strcat(buffer, ibuf);
			strcat(buffer, ", `VaccinationDate`, `");
			strcat(buffer, facts[i].value);
			strcat(buffer, "`)");
			//printf(buffer);
			tf = lsExecStr(CurEng, &term, buffer);
			j++;
		}
		else {
			strcpy(buffer, "arxl_add_to_vector(`CommonRules`, `data`, `");
			strcat(buffer, facts[i].name);
			strcat(buffer, "`, `");
			strcat(buffer, facts[i].value);
			strcat(buffer, "`)");
			//printf(buffer);
			tf = lsExecStr(CurEng, &term, buffer);
		}
	}
	
	// Start the Output
	printf("<h2><font color=red>Demonstration Only, Not for Medical use</font></h2>");
	printf("<p><a href='/vaccinationanalysis/index.html'>EVA</a> is a tool for the encoding, verification, testing, and deployment of vaccination knowledge.</p>");
	printf("<p><a href='/vaccinationanalysis/eva_user_documentation.html'>Explanation of Results</a></p>");

	// Get the age
	tf = lsExecStr(CurEng, &term, "arxl_query('EVA', false, `FIND age`, ?x)");
	rc = lsGetArg(CurEng, term, 4, cSTR, buffer);
	printf("<h3>age = %s</h3>", buffer);
	// Get the history
	tf = lsExecStr(CurEng, &term, "arxl_query('EVA', false, `FIND history`, ?x)");
	rc = lsGetArg(CurEng, term, 4, cTERM, &table);
#ifdef TEST
	rc = lsTermToStr(CurEng, table, buffer, 500);
   if (strcmp(buffer, "[]") == 0) table = NULL;
	printf("<P><font color='green'>history = %s</font></p>", buffer);
#endif
	
	printf("<h2>Retrospective Analysis</h2>");
	printf("<p><font color=green>The comment indicates whether a previously given vaccination was:</p>");
	printf("<ul><li>too early,</li><li>early but OK,</li><li>during the optimal interval,</li><li>past the optimal interval,</li>");
	printf("<li>a violation of minimum intervals between doses, or</li><li>an invalid spacing between live virus vaccinations.</li></ul>");
	printf("<p>A dose with an X was not given at the correct time and does not count as a valid dose. </font></p>");
	printf("<table border='3' cellspacing='2' cellpadding='5'>");
	printf("<tr>");
	printf("<th>Vaccination</th>");
	printf("<th>Dose</th>");
	printf("<th>Date Given</th>");
	printf("<th>Status</th>");
	printf("<th>Comment</th>");
	printf("<th>Age Given</th>");
	printf("</tr>");

	i = 0;
	while (table != 0 && i < 50) {
		lsGetHead(CurEng, table, cTERM, &row);
		j = 0;
		printf("<tr>");
		while (row != 0 && j < 10) {
			lsGetHead(CurEng, row, cTERM, &item);
			lsTermToStr(CurEng, item, buffer, 80);
			printf("<td>%s</td>", buffer);
			row = lsGetTail(CurEng, row);
			j++;
			}
		table = lsGetTail(CurEng, table);
		printf("</tr>");
		i++;
		}
	
	printf("</table>");

	// Get the plan
	tf = lsExecStr(CurEng, &term, "arxl_query('EVA', false, `FIND plans`, ?x)");
	rc = lsGetArg(CurEng, term, 4, cTERM, &table);
#ifdef TEST
	rc = lsTermToStr(CurEng, table, buffer, 500);
	printf("<P><font color='green'>plans = %s</font></p>", buffer);
#endif
	
	printf("<h2>Future Plan</h2>");
	printf("<p><font color=green>The status indicates what should happen next for a given vaccine as of the date the report is given.  The results are sorted with most critical future vaccinations first.  Possible values are:</p>");
	printf("<ul>");
	printf("<li>not applicable - for example doctor deferred or HPV for males.</li>");
	printf("<li>complete - the full series has been given.</li>");
	printf("<li>current - the vaccinations are up-to-date, nothing to do today.</li>");
	printf("<li>eligible - it's after the minimum date, so it could be given today, but it's before the optimal range.</li>");
	printf("<li>due - it's in the optimal range.</li>");
	printf("<li>past due - it's past the optimal range.</li>");
	printf("</ul>");
	printf("<p>The three dates indicate the earliest date for the next dose, and the beginning and end of the optimal range. ");
	printf("Note that the <a href='http://www.iapindia.org/immunisation/immunisation-schedule'>IAP ITT</a> documents do not specify a minimum age or interval, so for this demonstration the earliest age and the optimal start are the same.");
	printf(" The document does not specify the acceptable range either, so either one week or one month was assumed.");
	printf("</font></p>");
	
	printf("<table border='3' cellspacing='2' cellpadding='5'>");
	printf("<tr>");
	printf("<th>Vaccination</th>");
	printf("<th>Status</th>");
	printf("<th>Dose</th>");
	printf("<th>Earliest</th>");
	printf("<th>Optimal Start</th>");
	printf("<th>Optimal End</th>");
	printf("<th>Citation</th>");
	printf("<th>Comment</th>");
	printf("</tr>");

	i = 0;
	while (table != 0 && i < 50) {
		lsGetHead(CurEng, table, cTERM, &row);
		j = 0;
		printf("<tr>");
		while (row != 0 && j < 10) {
			lsGetHead(CurEng, row, cTERM, &item);
			lsTermToStr(CurEng, item, buffer, 80);
			printf("<td>%s</td>", buffer);
			row = lsGetTail(CurEng, row);
			j++;
			}
		table = lsGetTail(CurEng, table);
		printf("</tr>");
		i++;
		}
	
	printf("</table>");


		
main_error:

	rc = lsClose(CurEng);
	
	printf("<p>Use the browser back button to enter another.</p></body></html>");
	
	return(TRUE);
}
Esempio n. 11
0
void print_build_time() {
  printf(BUILD_TIME_FMT "%s %s\n", build_date(), build_time());
}
    int ObChunkServerMain::do_work()
    {
      int ret = OB_SUCCESS;
      char dump_config_path[OB_MAX_FILE_NAME_LENGTH];
      TBSYS_LOG(INFO, "oceanbase-chunk start svn_version=[%s] "
                "build_data=[%s] build_time=[%s]", svn_version(), build_date(),
                build_time());

      cs_reload_config_.set_chunk_server(server_);

      snprintf(dump_config_path,
               sizeof (dump_config_path), "etc/%s.config.bin", server_name_);
      config_mgr_.set_dump_path(dump_config_path);
      if (OB_SUCCESS != (ret = config_mgr_.base_init()))
      {
        TBSYS_LOG(ERROR, "init config manager error, ret: [%d]", ret);
      }
      else if (OB_SUCCESS != (ret = config_mgr_.load_config(config_)))
      {
        TBSYS_LOG(ERROR, "load config error, path: [%s], ret: [%d]",
                  config_, ret);
      }

      /* set rs address if command line has past in */
      if (strlen(cmd_rs_ip_) > 0 && cmd_rs_port_ != 0)
      {
        cs_config_.root_server_ip.set_value(cmd_rs_ip_);
        cs_config_.root_server_port = cmd_rs_port_;
      }
      if (cmd_port_ != 0)
      {
        cs_config_.port = cmd_port_;
      }
      if (strlen(cmd_data_dir_) > 0)
      {
        cs_config_.datadir.set_value(cmd_data_dir_);
      }
      if (strlen(cmd_appname_) > 0)
      {
        cs_config_.appname.set_value(cmd_appname_);
      }
      if (strlen(cmd_devname_) > 0)
      {
        cs_config_.devname.set_value(cmd_devname_);
      }
      if (strlen(config_))
      {
        TBSYS_LOG(INFO, "using config file path: [%s]", config_);
      }
      if (strlen(cmd_extra_config_) > 0
          && OB_SUCCESS != (ret = cs_config_.add_extra_config(cmd_extra_config_)))
      {
        TBSYS_LOG(ERROR, "Parse extra config error! string: [%s], ret: [%d]",
                  cmd_extra_config_, ret);
      }
      cs_config_.print();

      if (OB_SUCCESS == ret && OB_SUCCESS != (ret = cs_config_.check_all()))
      {
        TBSYS_LOG(ERROR, "check config failed, ret: [%d]", ret);
      }

      if (OB_SUCCESS != ret)
      {
        TBSYS_LOG(ERROR, "Start chunk server failed, ret: [%d]", ret);
      }
      else
      {
        server_.set_io_thread_count((int)cs_config_.io_thread_count);
        server_.start();
      }

      return ret;
    }