ftp.nice.ch/pub/next/science/chemistry/WaterC.s.tar.gz#/WaterC/wmenu.c

This is wmenu.c in view mode; [Download] [Up]

#define TRUE  1
#define FALSE 0

#define NOPROPS 25

extern char *properties[NOPROPS];

menu1_select()           
{         
	char s[80], *sp;
	sp = s;
	do {
	  if ((nxOutput) && (! attributes[0]))
	   { printf("\n** Output will be in columns, but no attributes **\n");
	     printf("** have been set. Please do so through (O) then (F)**\n");}
	  if (inFile)
  	    printf("\n Data is being drawn from a file. \n");
	  printf("\n(C)ompute properties \n");
	  printf("(D)ata from file \n");    
	  printf("(I)nitial TP or TD conditions \n");
	  printf("(O)utput preferences \n");
	  printf("(S)aturation surface \n");
	  printf("(T)riple point preference \n");
	  printf("(U)nits change \n");
  	  printf("(Q)uit \n");    
	  printf("choose one: \n");    
	  gets(s);         
	} while(tolower(*sp) == ' ');
	return tolower(*sp);
}                    

output_select()
{
	char s[80], *sp;
	sp = s;
	do {
	  printf("(D)estination \n");
	  printf("(F)ormat \n");
	  printf("(O)utput length \n");
	  printf("choose one: \n");    
	  gets(s);         
	} while(tolower(*sp) == ' ');
	return tolower(*sp);
}

triple_select()
{
	char s[80], *sp;
	sp = s;
	do {
	  printf("(G)eochemical triple point \n");
	  printf("(E)ngineering triple point \n");
	  printf("choose one (");
	  if (_params_.specs[4])
	    printf("G");
	  else
	    printf("E");
	  printf(") \n");
	  gets(s);         
	} while(tolower(*sp) == ' ');
	return tolower(*sp);
}

initials_menu()
{
	char s[80], *sp;
	sp = s;
	do {
	  printf("(D)ouble parameter increment \n");
	  printf("(O)ne data point \n");
	  printf("(S)ingle parameter increment \n");
	  printf("choose one: \n");    
	  gets(s);         
	} while(tolower(*sp) == ' ');
	return tolower(*sp);
}

units_select()
{
	char s[80], *sp;
	sp = s;
	do {
	  printf("(T)emperature Units \n");
	  printf("(P)ressure Units \n");
	  printf("(D)ensity Units \n");
	  printf("(E)nergy Units \n");
	  printf("choose one: \n");    
	  gets(s);         
	} while(tolower(*sp) == ' ');
	return tolower(*sp);
}

get_t_units ()
{
	  switch (sel_t_units(myunits.temp)) {
	    case 'k':
	      _params_.specs[0]=1;
	      break;
	    case 'c':
	      _params_.specs[0]=2;
	      break;
	    case 'r':
	      _params_.specs[0]=3;
	      break;
	    case 'f':
	      _params_.specs[0]=4;
	      break;
	    default:
	      break;
	  }
}

sel_t_units (tunits)
char tunits[10];
{
	char s[80], *sp;
	sp = s;
	do {     
	  printf(" \n");
	  printf("Current temperature units are (%s) \n", tunits);
	  printf("(K)elvin \n");
	  printf("(C)elcius \n");
	  printf("(R)ankine \n");
	  printf("(F)ahrenheit \n");
	  printf("(N)o change in temperature units \n");
	  printf("choose one:");    
	  gets(s);         
	} while(tolower(*sp) == ' ');
	return tolower(*sp);
}

get_p_units ()
{
  	  switch (sel_p_units(myunits.pres)) {
	    case 'm':
	      _params_.specs[1] = 1;
	      break;
	    case 'b':
	      _params_.specs[1] = 2;
	      break;
	    case 'a':
	      _params_.specs[1] = 3;
	      break;
	    case 'l':
	      _params_.specs[1] = 4;
	      break;
	    case 'k':
	      _params_.specs[1] = 5;
	      break;
	    default:
	      break;
	  }
}

sel_p_units (punits)
char punits[10];
{
	char s[80], *sp;
	sp = s;
	do {     
	  printf(" \n");
	  printf("Current pressure units are (%s) \n", punits);
	  printf("(M)Pa \n");
	  printf("(b)ar \n");
	  printf("(a)tm \n");
	  printf("(l)b/in**2 \n");
	  printf("(k)g/cm**2 \n");
	  printf("(N)o change in pressure units \n");
	  printf("choose one:");    
	  gets(s);         
	} while(tolower(*sp) == ' ');
	return tolower(*sp);
}

get_d_units ()
{
  	  switch (sel_d_units(myunits.dens)) {
	    case 'k':
	      _params_.specs[2] = _params_.specs[3] = 1;
	      break;
	    case 'g':
	      _params_.specs[2] = _params_.specs[3] = 2;
	      break;
	    case 'm':
	      _params_.specs[2] = _params_.specs[3] = 3;
   	      break;
	    case 'l':
	      _params_.specs[2] = _params_.specs[3] = 4;
	      break;
	    default:
	      break;
	  }	  
}

sel_d_units (dunits)
char dunits[10];
{
	char s[80], *sp;
	sp = s;
	do {     
	  printf(" \n");
	  printf("Current density units are (%s) \n", dunits);
	  printf("(k)g/m**3 \n");
	  printf("(g)/cm**3 \n");
	  printf("(m)ole/liter \n");
	  printf("(l)b/ft**3 \n");
	  printf("(N)o change in density units \n");
	  printf("choose one:");    
	  gets(s);         
	} while(tolower(*sp) == ' ');
	return tolower(*sp);
}

get_e_units ()
{
  	  switch (sel_e_units(myunits.ener)) {
 	    case 'k':
	         _params_.specs[3]=1;
	      break;
	    case 'j':
	      switch (mol_g_menu()) {
		case 'm':
	          _params_.specs[3]=3;
		  break;
		case 'g':
	          _params_.specs[3]=2;
		  break;
	      }
	      break;
	    case 'c':
	      switch (mol_g_menu()) {
		case 'm':
	          _params_.specs[3]=5;
		  break;
		case 'g':
	          _params_.specs[3]=4;
		  break;
	      }
	      break;
  	    case 'b':
	       _params_.specs[3]=6;
	      break;
	    default:
	      break;
	  }
}

sel_e_units (eunits)
char eunits[10];
{
	char s[80], *sp;
	sp = s;
	do {     
	  printf(" \n");
	  printf("Current energy units are (%s) \n", eunits);
	  printf("(k)J/kg \n");
	  printf("(J)/g or J/mol \n");
	  printf("(c)al/g or cal/mol \n");
	  printf("(b)tu/lb \n");
	  printf("(N)o change in energy units \n");
	  printf("choose one:");    
	  gets(s);         
	} while(tolower(*sp) == ' ');
	return tolower(*sp);
}

attributeList()
{
	printf("(1) Volume  (2) Helmholtz  (3) Gibbs Free Energy  (4) Entropy \n");
	printf("(5) Internal Energy  (6) Enthalpy  (7) Cv  (8) Cp  (9) Velocity \n");
	printf("(10) alpha  (11) beta  (12) Dielectric  (13) Kinematic Viscosity \n");
	printf("(14) Dynamic Viscosity  (15) Conductivity  (16) Diffusity  \n");
	printf("(17) Surface Tension  (18) Prandtl  (19) alpha/beta  (20) ZBorn \n");
	printf("(21) YBorn  (22) QBorn  (23) d(alpha)/dT  (24) XBorn \n");
	printf("(25) Temperature  (26) Pressure  (27) Density \n");
	printf("\n Choose an attribute 1-27 : ");
}

mol_g_menu()
{
	char s[80], *sp;
	sp = s;
	do {
	  printf("  \n");
	  printf("per (m)ole \n");
	  printf("per (g)ram \n");
	  gets(s);
	} while (tolower(*sp) == ' ');
	return tolower(*sp);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.