Ejemplo n.º 1
0
void    check_my_type(t_mar *mar)
{
  int   c;

  c = 0;
  if (mar->str[c] == 'i' || mar->str[c] == 'c' && mar->str[c + 1] == 'h'
      || mar->str[c] == 's' && mar->str[c + 1] == 'h')
    print_basic(mar, c);
  else if (mar->str[c] == 'l')
    check_long(mar, c);
  else if (mar->str[c] == 's' && mar->str[c + 1] == 't'
	   && mar->str[c + 2] == 'a' && mar->str[c + 3] == 't'
	   && mar->str[c + 4] == 'i' && mar->str[c + 5] == 'c'
	   && mar->str[c + 6] == ' ')
    check_static(mar, c);
  else if (mar->str[c] == 'c' && mar->str[c + 1] == 'o'
	   && mar->str[c + 2] == 'n' && mar->str[c + 3] == 's'
	   && mar->str[c + 4] == 't' && mar->str[c + 5] == ' ')
    check_const(mar, c);
  else if (mar->str[c] == 'u' || mar->str[c] == 'v' || mar->str[c] == 'f'
           || mar->str[c] == 'd')
    check_my_type_two(mar, c);
  printf("Déclaration de la variable de type %s%s nommé %s.\n",
         mar->ptr, mar->type, mar->var);
}
Ejemplo n.º 2
0
int soltrack_init(double deg_lat, double deg_long)
{
	// Check domain
	if (!(check_lat(deg_lat) && check_long(deg_long))) {
		return SOL_DOMAIN_ERROR;
	}
	// Calculate latitude and longitude in radians
	double rad_lat = deg_to_rad(deg_lat);
	double rad_long = deg_to_rad(deg_long);
	// Create a 3-dimensional vector
	uv_orth_w_spin = gsl_vector_alloc(V_DIM);
	gsl_vector_set(uv_orth_w_spin, X_AXIS, \
		gsl_sf_cos(rad_long) * gsl_sf_cos(rad_lat));
	gsl_vector_set(uv_orth_w_spin, Y_AXIS, \
		gsl_sf_sin(rad_long) * gsl_sf_cos(rad_lat));
	gsl_vector_set(uv_orth_w_spin, Z_AXIS, gsl_sf_sin(rad_lat));
	// Create the rotation matrix for axial tilt of the earth
	rm_ax_tilt = gsl_matrix_calloc(V_DIM, V_DIM); // Initialize 0
	// X-Axis
	gsl_matrix_set(rm_ax_tilt, X_AXIS, X_AXIS, gsl_sf_cos(rad_ax_tilt));
	gsl_matrix_set(rm_ax_tilt, X_AXIS, Z_AXIS, -gsl_sf_sin(rad_ax_tilt));
	// Y-Axis (no rotation)
	gsl_matrix_set(rm_ax_tilt, Y_AXIS, Y_AXIS, 1.0);
	// Z-Axis
	gsl_matrix_set(rm_ax_tilt, Z_AXIS, X_AXIS, gsl_sf_sin(rad_ax_tilt));
	gsl_matrix_set(rm_ax_tilt, Z_AXIS, Z_AXIS, gsl_sf_cos(rad_ax_tilt));
	
	// Initialisation complete
	initialized = 1;	
	return 0;
}
Ejemplo n.º 3
0
static int
check_all (model_t model, int *src, TransitionCB cb, void *context)
{
    check_ctx_t    *ctx = GBgetContext (model);
    int res = 0;
    for (int i = 0; i < ctx->K; i++) {
        res += check_long (model, i, src, cb, context);
    }
    return res;
}
Ejemplo n.º 4
0
void os2_checkinstallation(void)
{
	char *emxopt, *tmp, *home, *logname, *termcap;
	char hostname[256], *display, *hostvar, *s, *h;
	struct hostent *hent;
	struct in_addr *in;
	int i;

	if (diag_checks) return;
	diag_checks = TRUE;

	/* test whether the EMX version is okay */
	check_emx();

	/* Check a number of environment variables */
	emxopt = getenv("EMXOPT");
	if (emxopt) {
		for (i=0; i<strlen(emxopt); i++) {
			if (emxopt[i]=='-') {
				switch (emxopt[++i]) {
				case 't':
					ErrorF("xf86-OS/2: Remove -t option from EMXOPT variable!\n");
					break;
				case 'r':
					ErrorF("xf86-OS/2: Remove -r option from EMXOPT variable!\n");
				}
			}
		}
	}

	tmp = check_env_present("TMP");
	if (tmp) {
	        check_bsl(tmp);
	        check_long(tmp);
	}

	home = check_env_present("HOME");
	if (home) {
	        check_bsl(home);
	        check_long(home);
	}

	logname = check_env_present("LOGNAME");
	termcap = check_env_present("TERMCAP");
	if (termcap)
	        check_fsl(termcap);

	if (gethostname(hostname,sizeof(hostname)) != 0) {
		ErrorF("xf86-OS/2: gethostname() failed: Check TCP/IP setup!\n");
	} else {
		ErrorF("xf86-OS/2: gethostname() returns: \"%s\"\n",hostname);
	}

	display = check_env_present("DISPLAY");
	if (display)
		ErrorF("xf86-OS/2: DISPLAY to listen is set to: \"%s\"\n",
			display);

	hostvar = check_env_present("HOSTNAME");
	
	strcpy(hostname,display);
	h = strchr(hostname,':');
	if (!h)
		ErrorF("xf86-OS/2: Invalid DISPLAY name: expected something like XXX:0.0\n");
	else
		*h = 0;
	h = strchr(hostname,'/');
	if (h) 
		h++;
	else
		h = hostname;

	if (stricmp(h,hostvar)) {
		ErrorF("xf86-OS/2: HOSTNAME does not match DISPLAY: Do you really mean this?\n");
		ErrorF("xf86-OS/2:   This means that xinit/startx and client access may not work\n");
		ErrorF("xf86-OS/2:   which is intentional usually only when connection to a XDM server\n");
	}

	hent = gethostbyname(h);
	if (!hent) 
		ErrorF("xf86-OS/2: gethostbyname() failed: Check TCP/IP setup\n");
	else {
		ErrorF("xf86-OS/2: gethostbyname() returns the following data:\n");
		ErrorF("xf86-OS/2:    official host name: \"%s\"\n",hent->h_name);
		while ((s= *(hent->h_aliases)) != NULL) {
			ErrorF("xf86-OS/2:                 alias: \"%s\"\n",s);
			hent->h_aliases++;
		}
		ErrorF("xf86-OS/2:    addr type = %d,  addr length = %d\n",
			hent->h_addrtype, hent->h_length);
		if (hent->h_addrtype == AF_INET) {
			while ((in= (struct in_addr*)*(hent->h_addr_list++)) != NULL) {
				ErrorF("xf86-OS/2:      Internet address: \"%s\"\n",
					inet_ntoa(*in));
			}
		} else {
			ErrorF("xf86-OS/2: addr type should be %d: Check network setup and install TCP/IP support correctly\n",
				AF_INET);
		}
	}
}