コード例 #1
0
ファイル: mainloop.cpp プロジェクト: OS2World/APP-MATH-Euler
void give_out (header *hd)
/***** give_out
	print a value.
*****/
{	switch(hd->type)
	{	case s_real : double_out(*realof(hd)); output("\n"); break;
		case s_complex : complex_out(*realof(hd),*imagof(hd));
			output("\n"); break;
		case s_matrix : out_matrix(hd); break;
		case s_cmatrix : out_cmatrix(hd); break;
		case s_imatrix : out_imatrix(hd); break;
		case s_string : output(stringof(hd)); output("\n"); break;
		case s_interval : interval_out(*aof(hd),*bof(hd));
			output("\n"); break;
		default : output("?\n");
	}
}
コード例 #2
0
ファイル: mainloop.cpp プロジェクト: OS2World/APP-MATH-Euler
void out_imatrix (header *hd)
/***** out_matrix
   print a complex matrix.
*****/
{	int c,r,i,j,c0,cend;
	double *m,*x;
	getmatrix(hd,&r,&c,&m);
	for (c0=0; c0<c; c0+=ilinew)
	{	cend=c0+ilinew-1;
		if (cend>=c) cend=c-1;
		if (c>ilinew) output2("Column %d to %d:\n",c0+1,cend+1);
		for (i=0; i<r; i++)
		{	x=imat(m,c,i,c0);
			for (j=c0; j<=cend; j++) { interval_out(*x,*(x+1));
				x+=2; }
			output("\n");
			if (test_key()==escape) return;
		}
	}
}
コード例 #3
0
ファイル: main.c プロジェクト: sbertrang/datizo
int
main(int argc, char *argv [])
{
	TimeZoneAbbrevTable	*tzabbr;
	TimestampTz		 tsz, eol;
	Timestamp		 ts;
	TimeTzADT		*timetz;
	Interval		*i;
	DateADT			 d;
	TimeADT			 time;
	char			*s;

	pg_timezone_initialize();

	if (!(tzabbr = load_tzoffsets("Default")))
		warnx("failed to load Default");
	else
		InstallTimeZoneAbbrevs(tzabbr);

	warnx("test...");

	session_timezone = pg_tzset("Europe/Amsterdam");

	tsz = timestamptz_in("2012/1/1 00:20:01+05");
	s = timestamptz_out(tsz);

	warnx("timestamptz: %s", s);

	ts = timestamp_in("2012/12/12 12:12:12");
	s = timestamp_out(ts);

	warnx("timestamp: %s", s);

	i = interval_in("10h5m");
	s = interval_out(i);

	warnx("interval: %s", s);



	i = interval_in("1000000 hours");
	s = interval_out(interval_justify_interval(i));

	warnx("lifetime: %s", s);


	d = date_in("1999/9/9");
	s = date_out(d);

	warnx("date: %s", s);


	time = time_in("10:20");
	s = time_out(time);

	warnx("time: %s", s);

	timetz = timetz_in("10:20");
	s = timetz_out(timetz);

	warnx("timetz: %s", s);

	tsz = GetCurrentTimestamp();
	s = timestamptz_out(tsz);

	warnx("timestamptz: %s (now)", s);


	eol = timestamptz_pl_interval(tsz, interval_justify_interval(i));
	s = timestamptz_out(eol);

	warnx("eol: %s", s);


	session_timezone = pg_tzset("Canada/Mountain");

	s = timestamptz_out(tsz);

	warnx("timestamptz in canada: %s", s);

	return EX_OK;
}