Exemple #1
0
int   LG::Terminate (int rc)
{
      double dsec;
		int    min, sec, thou, i;
		char   num[14] = "             ";

		if (n_states > org_states) org_states = n_states;
		if (n_prods > max_n_prods) max_n_prods = n_prods; // brute force fix.
		else max_n_prods++;										  // brute force fix again.
		if (n_prods < 0) n_prods = 0; // In case of early syntax error.

	  	if (optn[LG_VERBOSE] > 1)
		{
         optncount[MAX_SYM]   = n_symbs;
         optncount[MAX_PRO]   = n_prods;
         optncount[MAX_TAIL]  = n_tails;
         optncount[MAX_EBNF]  = amt_space;
         optncount[MAX_STA]   = org_states;
         optncount[MAX_FIN]   = n_finals;
         optncount[MAX_KER]   = n_kernels;
         optncount[MAX_NTT]   = n_nonttran;
         optncount[MAX_TT]    = n_termtran;
         optncount[MAX_TTA]   = n_ttas;
         optncount[MAX_LB]    = n_lookbacks;
         optncount[MAX_LA]    = n_lookah;
         optncount[MAX_INC]   = n_includes;
         optncount[MAX_CH]    = max_child_usage;
         optncount[MAX_ND]    = 0;
			for (i = 0; *MAOption[i].name != 0; i++)
			{
				prt_num (MAOption[i].desc, optncount[MAOption[i].numb], MAOption[i].name, optn[MAOption[i].numb]);
			}
	  	   prt_logonly ("\n");
		}

		char* es  = "s";
		char* ws  = "s";

		if (n_errors    == 1) es  = "";
		if (n_warnings  == 1) ws  = "";										   

      time2 = clock ();
      dsec  = (double)(time2-time1) / CLOCKS_PER_SEC;
      min   =  dsec/60;
      sec   =  dsec-min*60;
      thou  = (dsec-min*60-sec)*1000;
      int x = memory_max/1024/1024;
      int y = memory_max/1024 - 1024*x;

		prt_log ("%1d min %1d.%03d sec, %d.%03d MB, %d warning%s, %d error%s.\n\n", 
		min, sec, thou, x, y, n_warnings, ws, n_errors, es);

		close_con ();
		close_grm ();
		close_sta ();
		close_lst ();

      if (n_errors > 0) quit (n_errors);
		return 0;
}
Exemple #2
0
int   PG::Terminate (int rc)
{
      double dsec;
		int i, min, sec, thou;

      inputt ();

      if (optn[PG_VERBOSE] > 1)
      {
         optncount[MAX_SYM]   = Symtab::n_symbols;
         optncount[MAX_PRO]   = N_prods;
         optncount[MAX_TAIL]  = N_tails;
         optncount[MAX_EBNF]  = 0;
         optncount[MAX_STA]   = org_states;
         optncount[MAX_FIN]   = n_finals;
         optncount[MAX_KER]   = n_kernels;
         optncount[MAX_NTT]   = n_nttran;
         optncount[MAX_TT]    = n_ttran;
         optncount[MAX_TTA]   = n_ttas;
         optncount[MAX_LB]    = n_lookbacks;
         optncount[MAX_LA]    = n_lookah;
         optncount[MAX_INC]   = n_includes;
         optncount[MAX_CH]    = max_child_usage;
         optncount[MAX_ND]    = n_nditems;
			for (i = 0; *MAOption[i].name != 0; i++)
			{
				prt_num (MAOption[i].desc, optncount[MAOption[i].numb], MAOption[i].name, optn[MAOption[i].numb]);
			}
	  	   prt_logonly ("\n");
      }
		PGParser::terminate ();

		char* es = "s";
		char* ws = "s";
		char* cs = "s";
		if (n_errors    == 1) es = "";
		if (n_warnings  == 1) ws = "";
		if (c_states    == 1) cs = "";

      time2 = clock ();
      dsec  = (double)(time2-time1) / CLOCKS_PER_SEC;
      min   = dsec/60;
      sec   = dsec-min*60;
      thou  = (dsec-min*60-sec)*1000;
      int x = memory_max/1024/1024;
      int y = memory_max/1024 - 1024*x;

		prt_log ("%1d min %1d.%03d sec, %d.%03d MB, %d warning%s, %d error%s.\n\n", 
		min, sec, thou, x, y, n_warnings, ws, n_errors, es);

      close_con ();
		close_grm ();
	//	close_log ();
		close_sta ();
		close_lst ();

      if (n_errors > 0) quit (n_errors);
		return 0;
}