コード例 #1
0
static void
test_groups (gimple *stmt)
{
  gcall *call = check_for_named_call (stmt, "__emit_warning", 1);
  if (!call)
    return;

  /* We expect an ADDR_EXPR with a STRING_CST inside it for the
     initial arg.  */
  tree t_addr_string = gimple_call_arg (call, 0);
  if (TREE_CODE (t_addr_string) != ADDR_EXPR)
    {
      error_at (call->location, "string literal required for arg 1");
      return;
    }

  tree t_string = TREE_OPERAND (t_addr_string, 0);
  if (TREE_CODE (t_string) != STRING_CST)
    {
      error_at (call->location, "string literal required for arg 1");
      return;
    }

  {
    auto_diagnostic_group d;
    if (warning_at (call->location, 0, "%s", call,
		    TREE_STRING_POINTER (t_string)))
      {
	inform (call->location, "message for note");
	inform (call->location, " some more detail");
	inform (call->location, "  yet more detail");
      }
  }
  inform (call->location, "an unrelated message");
}
コード例 #2
0
ファイル: fn_disk.c プロジェクト: mihaicarabas/dragonfly
void
fn_format_msdos_floppy(struct i_fn_args *a)
{
	struct commands *cmds;

	switch (dfui_be_present_dialog(a->c, _("Format MSDOS Floppy"),
	    _("Format Floppy|Return to Utilities Menu"),
	    _("Please insert the floppy to be formatted "
	    "in unit 0 (``drive A:'')."))) {
	case 1:
		cmds = commands_new();
		command_add(cmds, "%s%s -y -f 1440 /dev/fd0",
		    a->os_root, cmd_name(a, "FDFORMAT"));
		command_add(cmds, "%s%s -f 1440 fd0",
		    a->os_root, cmd_name(a, "NEWFS_MSDOS"));
		if (commands_execute(a, cmds))
			inform(a->c, _("Floppy successfully formatted!"));
		else
			inform(a->c, _("Floppy was not successfully formatted."));
		break;
	case 2:
		return;
	default:
		abort_backend();
	}
}
コード例 #3
0
ファイル: mschunk.c プロジェクト: mlconnolly1951/biohedron
int write_area (struct surface *this_srf, FILE *fp_area, char *argument)
{
	if (! this_srf -> surface_completed || ! this_srf -> volume_computed) {
		inform ("premature area command");
		return(0);
	}
	if (argument == NULL || strlen(argument) < (unsigned) 1) {
		if (!write_atom_area (this_srf, fp_area)) return (0);
	}
	else {
		if (strcmp (argument, "by_atom_and_component") == 0 ||
			strcmp (argument, "bac") == 0) {
			if (!write_atom_component (this_srf, fp_area)) return (0);
		}
		else if (strcmp (argument, "by_component_and_atom") == 0
			|| strcmp (argument, "bca") == 0) {
			if (!write_component_atom (this_srf, fp_area)) return (0);
		}
		else {
			inform ("write_area: invalid breakdown type for area output");
			return(0);
		}
	}
	if (error()) return (0);
	return (1);
}
コード例 #4
0
ファイル: objdump.c プロジェクト: axelmuhr/Helios-NG
int
readobjnum( void )
{
  int 	ch     = getc( f );
  int 	nflag  = (ch & NFLAG) != 0;
  int 	r      = ch & 0x3f;

  
  if (ch == EOF)
    {
      inform( "Error - Unexpected EOF" );

      tidyup( 1 );
    }
  
   while ((ch & MORE) != 0)
     {
       if ((ch = getc( f )) == EOF)
	 {
	   inform( "Error - Unexpected EOF" );
	   
	   tidyup( 1 );
	 }

       r  = (r << 7) + (ch & 0x7f);
     }

  return nflag ? -r : r;

} /* readobjnum */
コード例 #5
0
ファイル: mscube.c プロジェクト: mlconnolly1951/biohedron
int storePoly (struct Plex *plex)
{
	char message[MAXLINE];

	if (!storePolyBefore(plex)) return (0);
	if (plex -> dimension == 2) {
		if (!cutPoly2(plex)) return (0);
	}
	else if (plex -> dimension == 3) {
		if (!cutPoly3(plex)) return (0);
	}
	if (!storePolyAfter(plex)) return (0);
	free_objects (PLEXEDGE, (short *) (plex -> plexedges));
	plex -> plexedges = NULL;
	if (plex -> plextriangles != NULL) {
		free_objects (PLEXTRIANGLE, (short *) (plex -> plextriangles));
		plex -> plextriangles = NULL;
	}
	if (plex -> dimension == 3) {
		sprintf (message, "%8ld edges after dicing", plex -> n_edge);
		inform (message);
		sprintf (message, "%8ld triangles after dicing", plex -> n_triangle);
		inform (message);
	}
	return (1);
}
コード例 #6
0
ファイル: data_writers.c プロジェクト: KristianLyng/spew
/*
 * Pre-creates the entire HTTP request. Petty dirty.
 *
 * It sticks Connection: close on the last request to trick the server into
 * doing out job for us. It's simpler.
 *
 * FIXME: UUUGH.
 */
static void rand_init(struct data_engine_t *de, char *url, char *host)
{
	struct rand_data_set_t *b_data;
	char *buf = malloc(1024);
	char *batch;
	b_data =  malloc(sizeof (struct rand_data_set_t));
	de->priv = (void *)b_data;
	assert(de->priv);
	assert(b_data);
	assert(buf);
	assert(url);
	assert(host);
	assert(strlen(url) < 256);
	assert(strlen(host) < 256);
	b_data->url = url;
	b_data->host = host;
	if (P_rand() < P_reqs()) {
		inform(V(HTTP_INFO),"You're generating fewer requests"
				    "(reqs=) than your randomness setting"
				    "(rand=).");
		inform(V(HTTP_INFO),"rand= is effectively capped by reqs=");
	}
	snprintf(buf, 1024, "GET %s%d HTTP/1.1\r\nHost: %s\r\n\r\n", url, P_rand()-1, host);
	snprintf(b_data->last_req, 1024,
		 "GET %s%d HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n",
		 url, P_rand()-1, host);
	b_data->data = buf;
	b_data->dsize = strlen(buf);
	batch =
	    malloc(((P_reqs() - 1) * b_data->dsize) + P_reqs() + strlen(b_data->last_req));
	assert(batch);
	b_data->batch = batch;
	inform(V(HTTP_DEBUG), "Randomness: %d", P_rand());
}
コード例 #7
0
ファイル: msform.c プロジェクト: mlconnolly1951/biohedron
int mspol2 (struct msscene *ms, FILE *fpd, FILE *fpy, FILE *fpe, FILE *fpo, char *format, double ctrlev, double sphere_radius, int smooth)
{
	int result;
	char message[MAXLINE];
	struct surface *den, *den1, *den2;
	struct surface *phn;

	if (format == NULL) informd ("msform: no output format specified");
	sprintf (message, "%8.3f sphere radius", sphere_radius);
	inform (message);
	sprintf (message, "%8.3f contour level", ctrlev);
	inform (message);
	if (smooth) inform ("         smoothed density contoured");
	den1 = read_density (fpd);
	if (den1 == NULL) {
		set_error1 ("mspol2: problem reading density");
		return (0);
	}
	den2 = read_density (fpy);
	if (den2 == NULL) {
		set_error1 ("mspol2: problem reading density");
		return (0);
	}
	den = subtract_densities (den1, den2);
	if (den == NULL) return (0);
	phn = density_to_polyhedron (den, ctrlev, sphere_radius, smooth);
	if (phn == NULL) return (0);
	result = write_vet (phn, fpo);
	if (result == 0) return (0);
	fclose(fpo);
	return(1);
}
コード例 #8
0
ファイル: data_writers.c プロジェクト: KristianLyng/spew
/*
 * Pre-creates the entire HTTP request. Petty dirty.
 *
 * It sticks Connection: close on the last request to trick the server into
 * doing out job for us. It's simpler.
 *
 * FIXME: UUUGH.
 */
static void batch_init(struct data_engine_t *de, char *url, char *host)
{
	struct batch_data_set_t *b_data; 
	char *buf = malloc(1024);
	char tmp[1024];
	char *batch;
	int i;
	int dec;
	b_data = malloc(sizeof (struct batch_data_set_t));
	de->priv = b_data;
	assert(b_data);
	assert(de->priv);
	assert(buf);
	assert(url);
	assert(host);
	assert(strlen(url) < 256);
	assert(strlen(host) < 256);
	if (P_rand() < P_reqs()) {
		inform(V(HTTP_INFO),"You're generating fewer requests"
				    "(reqs=) than your randomness setting"
				    "(rand=).");
		inform(V(HTTP_INFO),"rand= is effectively capped by reqs=");
	}
	if (P_rand() > 0) {
		snprintf(buf, 1024, "GET %s?%d HTTP/1.1\r\nHost: %s\r\n\r\n", url, P_rand()-1, host);
		snprintf(tmp, 1024,
			 "GET %s?%d HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n",
			 url, P_rand()-1, host);
	} else {
		snprintf(buf, 1024, "GET %s HTTP/1.1\r\nHost: %s\r\n\r\n", url, host);
		snprintf(tmp, 1024,
			 "GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n",
			 url, host);
	}
	b_data->data = buf;
	b_data->dsize = strlen(buf);
	batch =
	    malloc(((P_reqs() - 1) * b_data->dsize) + P_reqs() + strlen(tmp));
	assert(batch);
	b_data->batch = batch;
	inform(V(HTTP_DEBUG), "Randomness: %d", P_rand());
	for (i = 0; i < (P_reqs() - 1); i++) {
		if (P_rand() > 0) {
			dec = snprintf(batch, 1024, "GET %s?%d HTTP/1.1\r\nHost: %s\r\n\r\n", url, i % P_rand(), host);
		} else {
			dec = snprintf(batch, 1024, "GET %s HTTP/1.1\r\nHost: %s\r\n\r\n", url, host);
		}
		batch = batch + dec;
	}
	memcpy(batch, tmp, strlen(tmp));
	batch = batch + strlen(tmp);
	b_data->bsize = batch - b_data->batch;
}
コード例 #9
0
int main(int argc, char *argv[]) {

    FILE *fichero;
    char sopa[NMAX][NMAX];
    int opcion;
    char nombre_de_fichero[0x20];
    srand(time(NULL));
    int sopa_cargada = 0; // 0 equivale a falso, cualquier cosa != 0 es verdadero

    do {
        switch(opcion = leer_menu()) {
        case crear:
            cabecera("Nueva Sopa");
            rellenar(sopa);
            sopa_cargada = 1;
            pintar(sopa);
            break;
        case abrir:
            imprimir_directorio("./");
            printf("Elige un fichero sopa: ");
            scanf(" %s", nombre_de_fichero);
            fichero = fopen(nombre_de_fichero, "r");
            leer(fichero, sopa);
            sopa_cargada = 1;
            fclose(fichero);
            break;
        case ver:
            if (sopa_cargada) {
                cabecera("Sopa Activa");
                pintar(sopa);
            } else
                inform("De momento no hay ninguna sopa cargada.");
            break;
        case guardar:
            if (sopa_cargada) {
                imprimir_directorio("./");
                printf("Elige un nombre para guardar la sopa: ");
                scanf(" %s", nombre_de_fichero);
                fichero = fopen(nombre_de_fichero, "w");
                escribir(fichero, sopa);
                fclose(fichero);
                inform("Fichero Guardado.");
            } else
                inform("De momento no hay ninguna sopa cargada.");
            break;
        }
    } while(opcion != salir);

    return EXIT_SUCCESS;
}
コード例 #10
0
ファイル: xcurses.c プロジェクト: drkvogel/jameslind
					/* PUT CONTENTS OF WINDOW ONTO SCREEN */
void wrefresh( WINDOW *w )
{	int	i, j, blank;
	if ( 0 == debug_pcurses )
		{
#ifdef __BORLANDC__
		textcolor( pcurses_select_text_color( w->attribute ) );
#endif
		for ( i = 0; i < w->y.size; i++ )
			{gotoxy( w->x.origin + 1, w->y.origin + i + 1 );
			cprintf( w->c[i] );
			}
#ifdef __BORLANDC__
		if ( 0 != w->attribute )	/* RESTORE TO DEFAULTS */
			{textcolor( normal_text_colour );
			}
#endif
		}
	else
		{blank = YES;
		for ( i = 0; i < w->y.size; i++ )
			{j = 0;
			while ( EOS != w->c[i][j] )
				{if ( SPACE != w->c[i][j] )
					{blank = NO;
					}
				j++;
				}
			}
		if ( YES == blank )
			{inform( "wrefresh %d is BLANK", w->index );
			return;
			}
		inform( "wrefresh %d", w->index );
		if ( YES == border )
			{printf( "\n" );
			for ( i = 0; i < w->x.size; i++ )
				{printf( "#" );
				}
			}
		for ( i = 0; i < w->y.size; i++ )
			{printf( "\n%s", w->c[i] );
			}
		if ( YES == border )
			{printf( "\n" );
			for ( i = 0; i < w->x.size; i++ )
				{printf( "#" );
				}
			}
		}
}
コード例 #11
0
ファイル: mschunk.c プロジェクト: mlconnolly1951/biohedron
int write_volume2 (struct surface *srf)
{
	int component_number;
	double taa, tav;
	char message[MAXLINE];
	struct component *cmp_ptr;

	if (srf == (struct surface *) NULL) {
		inform ("premature volume command");
		return(0);
	}
	sprintf (message,"%8.1f convex area  (polyhedral)", srf -> shape_area[0]);
	inform(message);
	sprintf (message,"%8.1f saddle area  (polyhedral)", srf -> shape_area[1]);
	inform(message);
	sprintf (message,"%8.1f concave area (polyhedral)", srf -> shape_area[2]);
	inform(message);
	taa = 0.0; tav = 0.0;
	inform ("                     area                         volume");
	inform ("              analytic  polyhedral          analytic  polyhedral");
	for (component_number = 1; component_number <= srf -> n_component;
		component_number++) {
		cmp_ptr = *(srf -> component_handles + component_number - 1);
		taa += cmp_ptr -> area;
		tav += cmp_ptr -> volume;
		sprintf (message,"%8d    %10.3f  %10.3f        %10.3f  %10.3f",
			component_number, cmp_ptr -> area, cmp_ptr -> parea,
			cmp_ptr -> volume, cmp_ptr -> pvolume);
		inform(message);
	}
	sprintf (message,"            %10.3f  %10.3f        %10.3f  %10.3f",
		taa, srf -> total_area, tav, srf -> total_volume);
	inform(message);
	return(1);
}
コード例 #12
0
ファイル: frame.c プロジェクト: commshare/squeezeterisk
/* -----------------------------------------------------------------------
   After all is read and done, inform the inclined user of the elapsed time
   -----------------------------------------------------------------------*/
static void statistics( void)
{
   int temp;

   temp = time(NULL) - stopwatch;
   if (temp != 1)
   {
      inform ("\nTime: %d seconds\n", temp);
   }
   else
   {
      inform ("\nTime: 1 second\n");
   }
   return;
}
コード例 #13
0
ファイル: xcurses.c プロジェクト: drkvogel/jameslind
						/* WRITE TEXT TO WINDOW */
void wprintw( WINDOW *w, char *fmt, ... )
{	int	i = 0;
	char	*tmp;
	va_list	args;				/* VARIABLE ARGUMENT LIST */
	if ( 0 != debug_pcurses )
		{inform( "wprintw %d \"%s\"...", w->index, fmt );
		}
	tmp = (char *) xmalloc( 100 + strlen( fmt ) + ( w->x.size*w->y.size ) );
	va_start( args, fmt );
	vsprintf( tmp, fmt, args );
	va_end( args );				/* TIDY ARGUMENT LIST */
	while ( tmp[i] != EOS && w->y.cursor < w->y.size )
		{while ( w->x.cursor < w->x.size && tmp[i] != EOS
				&& tmp[i] != EOL )
			{w->c[ w->y.cursor ][ w->x.cursor++ ] = tmp[ i++ ];
			}
		if ( tmp[i] != EOS )
			{if ( EOL == tmp[i] )
				{i++;
				}
			w->x.cursor = 0;
			w->y.cursor++;
			}
		}
	xfree( tmp );
}
コード例 #14
0
ファイル: msform.c プロジェクト: mlconnolly1951/biohedron
int msden (struct msscene *ms, FILE *fpt, FILE *fpe, FILE *fpo, double cube_width, char *format)
{
	int result;
	char message[MAXLINE];
	struct surface *den;
	struct surface *phn;

	sprintf (message, "%8.3f cube width", cube_width);
	inform (message);
	if (format == NULL) informd ("msform: no output format specified");
	phn = read_polyhedron (fpt);
	if (error ()) return (0);
	if (phn == NULL) {
		set_error2 ("msform: problem reading polyhedron");
		return (0);
	}
	ms -> this_srf = phn;
	den = polyhedron_to_density (phn, cube_width);
	if (error ()) return (0);
	if (den == NULL) return (0);
	phn -> next = den;
	result = write_density (den, fpo);
	if (error ()) return (0);
	if (result == 0) return (0);
	fclose(fpo);
	return(1);
}
コード例 #15
0
ファイル: SGDStep.cpp プロジェクト: s1hofmann/PipeR
std::tuple<cv::Mat1d, double, vl_size, double, double> SGDStep::loadWithPlatt(const std::string &fileName) const
{
    cv::FileStorage fs(fileName, cv::FileStorage::READ);

    if ((fs["model"].isNone() || fs["model"].empty()) ||
        (fs["bias"].isNone() || fs["bias"].empty()) ||
        (fs["plattA"].isNone() || fs["plattA"].empty()) ||
        (fs["plattB"].isNone() || fs["plattB"].empty())) {
        std::stringstream s;
        s << "Error. Unable to load classifier data from file: " << fileName << ". Aborting." << std::endl;
        throw MLError(s.str(), currentMethod, currentLine);
    }
    cv::Mat1d model;
    double bias;
    double iterations;
    double plattA;
    double plattB;

    fs["model"] >> model;
    fs["bias"] >> bias;
    fs["plattA"] >> plattA;
    fs["plattB"] >> plattB;

    if(fs["iterations"].isNone() || fs["iterations"].empty()) {
        inform("No iteration info found, skipping. Maybe an old classifier format?");
        iterations = 0;
    } else {
        fs["iterations"] >> iterations;
    }

    fs.release();

    return std::make_tuple(model, bias, static_cast<vl_size>(iterations), plattA, plattB);
}
コード例 #16
0
ファイル: msrollio.c プロジェクト: mlconnolly1951/biohedron
/* write header record */
void write_header (struct surface *srf, char *molecule_name, FILE *fp_surface)
{
	long idx;
	struct header headerout;

	for (idx = 0; idx < 8; idx++)
		headerout.filetype[idx] = (char) 0;
	strcpy (headerout.filetype, "PQMS");
	headerout.version = VERSION;
	headerout.subversion = SUBVERSION;
	headerout.probe_radius = srf -> probe_radius;
	headerout.counters[0] = srf -> n_variety;
	headerout.counters[1] = srf -> n_vertex;
	headerout.counters[2] = srf -> n_circle;
	headerout.counters[3] = srf -> n_arc;
	headerout.counters[4] = srf -> n_face;
	headerout.counters[5] = srf -> n_cycle;
	headerout.counters[6] = srf -> n_edge;
	headerout.counters[7] = srf -> n_component;
	headerout.counters[8] = srf -> n_atom;
	headerout.counters[9] = 0;			/* unused */
	for (idx = 0; idx < 64; idx++)
		headerout.name[idx] = (char) 0;
	if (strlen (molecule_name) >= (unsigned) 64) {
		inform ("molecule name too long, omitted");
		strcpy (headerout.name, " ");
	}
	else strcpy (headerout.name, molecule_name);
	for (idx = 0; idx < 384; idx++)
		headerout.filler[idx] = (char) 0;
	fwrite ((char *) &headerout, sizeof (struct header), 1, fp_surface);
}
コード例 #17
0
ファイル: audio.c プロジェクト: patrikohlsson/faudio
session_t fa_audio_begin_session()
{
    if (!pa_mutex) {
        assert(false && "Module not initalized");
    }

    inform(string("Initializing real-time audio session"));

    fa_thread_lock(pa_mutex);
    {
        if (pa_status) {
            fa_thread_unlock(pa_mutex);
            return (session_t) audio_device_error(string("Overlapping real-time audio sessions"));
        } else {
            Pa_Initialize();
            pa_status = true;
            fa_thread_unlock(pa_mutex);

            session_t session = new_session();
            session_init_devices(session);

            current_session = session;
            return session;
        }
    }
}
コード例 #18
0
ファイル: xcurses.c プロジェクト: drkvogel/jameslind
WINDOW *newwin( int ys, int xs, int yo, int xo )
{	int	i, j;
	static	int	count = 0;
	WINDOW	*w;
	w = (WINDOW *) xmalloc( sizeof(WINDOW) );
	w->index = count++;
	if ( 0 != debug_pcurses )
		{inform( "newwin %d, %d %d %d %d", w->index, ys, xs, yo, xo );
		}
	if ( ( w->x.origin = xo ) < 0 || ( w->y.origin = yo ) < 0
			|| ( w->x.size = xs ) < 1 || ( w->y.size = ys ) < 1
			|| ( w->x.max = w->x.origin + w->x.size ) > 80
			|| ( w->y.max = w->y.origin + w->y.size ) > 24 )
		{failure( "newwin : invalid dimensions %d %d %d %d [ %d %d ]",
			w->y.size, w->x.size, w->y.origin, w->x.origin,
			w->y.max, w->x.max );
		}
	w->x.cursor = w->y.cursor = 0;
	w->attribute = 0;
	w->c = (char **) xmalloc( w->y.size * sizeof(char *) );
	for ( i = 0; i < w->y.size; i++ )
		{w->c[i] = (char *) xmalloc( w->x.size + 2 );
		for ( j = 0; j < w->x.size; j++ )
			{w->c[i][j] = SPACE;
			}
		w->c[i][j] = EOS;
		}
	return( w );
}
コード例 #19
0
ファイル: avr-devices.c プロジェクト: KangDroid/gcc
void
avr_inform_core_architectures (void)
{
  char *archs = avr_archs_str ();
  inform (input_location, "supported core architectures:%s", archs);
  free (archs);
}
コード例 #20
0
ファイル: auto-profile.c プロジェクト: chainalgit/gcc
bool
autofdo_source_profile::read ()
{
  if (gcov_read_unsigned () != GCOV_TAG_AFDO_FUNCTION)
    {
      inform (0, "Not expected TAG.");
      return false;
    }

  /* Skip the length of the section.  */
  gcov_read_unsigned ();

  /* Read in the function/callsite profile, and store it in local
     data structure.  */
  unsigned function_num = gcov_read_unsigned ();
  for (unsigned i = 0; i < function_num; i++)
    {
      function_instance::function_instance_stack stack;
      function_instance *s = function_instance::read_function_instance (
          &stack, gcov_read_counter ());
      afdo_profile_info->sum_all += s->total_count ();
      map_[s->name ()] = s;
    }
  return true;
}
コード例 #21
0
ファイル: lto-lang.c プロジェクト: KangDroid/gcc
static tree
handle_const_attribute (tree *node, tree ARG_UNUSED (name),
			tree ARG_UNUSED (args), int ARG_UNUSED (flags),
			bool * ARG_UNUSED (no_add_attrs))
{
  if (TREE_CODE (*node) != FUNCTION_DECL
      || !DECL_BUILT_IN (*node))
    inform (UNKNOWN_LOCATION, "%s:%s: %E: %E", __FILE__, __func__, *node, name);

  tree type = TREE_TYPE (*node);

  /* See FIXME comment on noreturn in c_common_attribute_table.  */
  if (TREE_CODE (*node) == FUNCTION_DECL)
    TREE_READONLY (*node) = 1;
  else if (TREE_CODE (type) == POINTER_TYPE
	   && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
    TREE_TYPE (*node)
      = build_pointer_type
	(build_type_variant (TREE_TYPE (type), 1,
			     TREE_THIS_VOLATILE (TREE_TYPE (type))));
  else
    gcc_unreachable ();

  return NULL_TREE;
}
コード例 #22
0
ファイル: mscube.c プロジェクト: mlconnolly1951/biohedron
int numberCubes(struct Plex *plex)
{
	long idx, comp, n_cube;
	struct PlexCube *plexcubes, *cube, *rcube;
	long ncomps[512];
	char message[MAXLINE];
	
	n_cube = plex -> n_cube;
	plexcubes = plex -> plexcubes;
	for (comp = 0; comp < 512; comp++)
		ncomps[comp] = 0;
	for (idx = 0; idx < n_cube; idx++) {
		cube = plexcubes + idx;
		if (cube -> type == PartialCube) continue;	/* surface cubes out of it */
		if (cube -> next == NULL) {
			comp = cube -> comp;
			ncomps[comp]++;
			continue;			/* root cubes already handled */
		}
		rcube = cubeRoot (cube);					/* find representative */
		if (rcube == NULL) continue;
		cube -> comp = rcube -> comp;
		comp = cube -> comp;
		ncomps[comp]++;
	}
	if (plex -> dimension == 3)
	for (comp = 0; comp < 512; comp++)
		if (ncomps[comp] > 0) {
			sprintf (message, "%8ld cubes in component %4ld",
				ncomps[comp], comp);
			inform (message);
		}
	return (1);
}
コード例 #23
0
void leer(FILE *entrada, char matriz[NMAX][NMAX]) {
    for (int fila=0; fila<NMAX; fila++)
        for(int col=0; col<NMAX; col++)
            fscanf(entrada, " %c", &matriz[fila][col]);

    inform("Sopa Cargada.");
}
コード例 #24
0
void customDevice::handle() {

  unsigned long now = millis();
  if (now - lastPoll >= 3000) {
    lastPoll = now;
    inform();
  }
}
コード例 #25
0
ファイル: fn_disk.c プロジェクト: mihaicarabas/dragonfly
static void
ask_to_wipe_boot_sector(struct i_fn_args *a, struct commands *fcmds)
{
	struct commands *cmds;
	struct command *cmd;
	char *disk;

	for (cmd = command_get_first(fcmds); cmd != NULL;
	     cmd = command_get_next(cmd)) {
		disk = command_get_tag(cmd);
		if (disk != NULL &&
		    command_get_result(cmd) > 0 &&
		    command_get_result(cmd) < 256) {
			switch (dfui_be_present_dialog(a->c,
			    _("Bootblock Install Failed"),
			    _("Re-Initialize Bootblock|Cancel"),
			    _("Warning: bootblocks were not successfully "
			    "installed on the disk `%s'. This may be "
			    "because the disk is new and not yet "
			    "formatted. If this is the case, it might "
			    "help to re-initialize the boot sector, "
			    "then try installing the bootblock again. "
			    "Note that this should not affect the "
			    "partition table of the disk."),
			    disk)) {
			case 1:
				cmds = commands_new();
				command_add(cmds,
				    "%s%s | %s%s -B /dev/%s",
				    a->os_root, cmd_name(a, "YES"),
				    a->os_root, cmd_name(a, "FDISK"),
				    disk);
				if (commands_execute(a, cmds)) {
					inform(a->c, _("Boot sector successfully initialized."));
				} else {
					inform(a->c, _("Some errors occurred. "
					    "Boot sector was not successfully initialized."));
				}
				commands_free(cmds);
				break;
			default:
				break;
			}
		}
	}
}
コード例 #26
0
ファイル: main.cpp プロジェクト: enghqii/Snake
void main(){
	char data;
	snake s1;
	feed f1;
	int SnakeSpeed=45;

	int SnakeSpeedArray[]={100,100,95,80,75,60,50,40,30,20,10,5,1};
	int LimitTimeArray[] ={60000 ,60000 ,55000,50000,45000,40000,35000,30000,25000,20000,15000,10000,5000};
	int NTailArray[]     ={5  ,7  ,10,15,30,35,40,45,50,57,63,67,70};
	
	display();

	do{
        inform(s1,f1,startTime,LimitTimeArray[step],SnakeSpeedArray[step],NTailArray[step],step);
		//¹öÀü1 inform(s1,f1,startTime,10000000000000,SnakeSpeed,99,0);
		
		if(f1.eatten){
			f1.pos=f1.makeFeed(s1);
			f1.eatten=false;
		}

		f1.drawFeed();

		if(f1.isiteatten(s1)&&s1.ntail<99){
			s1.ntail++;
		}
		
		
		if(!s1.Crash()){
			PrintResult(LimitTimeArray[step],s1.ntail,SnakeSpeedArray[step],0);	//¹öÀü1
			break;
		}
		
		if(s1.ntail>=NTailArray[step]){
			PrintResult(LimitTimeArray[step],s1.ntail,SnakeSpeedArray[step],1);
			s1.head.X=38;
			s1.head.Y=11;
			s1.ntail=1;
			startTime = GetTickCount();
			s1.GoAheadCOORD(s1.ntail);
			if(step<12) step++;
			display();
		}
		
		

		data = getch();
		
		if(kbhit())
			continue;
		
		ungetch(data);
		s1.move(data);
		
		Sleep(SnakeSpeedArray[step]);
		
	}while(1);
}
コード例 #27
0
ファイル: moveships.c プロジェクト: fjarlq/midway
void sendcap(struct squadron *enemy, int from)
{
   int killed = 0;
   char buf[128];

   if (shiplist[from].hits && shiplist[from].torps && capplanes[from]) {
      sprintf(buf, "%s CAP intercepting", shiplist[from].name);
      inform(buf, 0);
      switch (enemy -> type) {
         
         case F4F:
            if (capplanes[from] > 2 * enemy -> planes) {
               capplanes[from] -= (killed = enemy -> planes);
               enemy -> planes = 0;
            } else if (enemy -> planes > 2 * capplanes[from]) {
               enemy -> planes -= (killed = capplanes[from]);
               capplanes[from] = 0;
            } else {
               killed = min(capplanes[from], enemy -> planes);
               capplanes[from] -= killed;
               enemy -> planes -= killed;
            }
            break;

         case SBD:
            enemy -> planes -= (killed = capplanes[from] * 3 / 10);
            break;

         case TBF:
            killed = capplanes[from] * 35 / 100;
            capplanes[from] -= enemy -> planes * 15 / 100;
            enemy -> planes -= killed;
      }
      if (killed > 0) {
         sprintf(buf, "*** %d %s shot down", killed, describe[enemy -> type]);
         inform(buf, 0);
      }
      if (enemy -> planes <= 0) {
         if (Japanese(from))
            ditch(enemy, &american);
         else
            ditch(enemy, &japanese);
      }
   }
}
コード例 #28
0
void DescConnection::sendMessage(Message* message)
{
    char taskID = 0;
    lockTaskQueue(taskID);
    taskInfo[(unsigned char)taskID].messageQueue.push(message);
    unlockTaskQueue(taskID);
    inform(taskID);
    return;
}
コード例 #29
0
ファイル: airstrike.c プロジェクト: fjarlq/midway
void newbogey(int boat)
{
	register int n;
	char buf[128];

	if (!sighted[boat]) {
		for (n = boat; n < MAXSHIPS && shiplist[n].flagship == boat; n++)
			sighted[n] = 1;
		if (Japanese(boat) == Japanese(player)) {
			if (boat == shiplist[player].flagship)
				inform("Enemy scout plane overhead!", 0);
		} else {
			sprintf(buf, "%s %s sighted", describe[shiplist[boat].type], shiplist[boat].name);
			inform(buf, 0);
			inform("@ %d, %d", boat + 1);
		}
	}
}
コード例 #30
0
ファイル: fn_disk.c プロジェクト: mihaicarabas/dragonfly
void
fn_create_cdboot_floppy(struct i_fn_args *a)
{
	struct commands *cmds;
	char msg_buf[1][1024];

	snprintf(msg_buf[0], sizeof(msg_buf[0]),
	    "%s cannot be installed from a floppy; "
	    "it must be installed from a booted CD-ROM. "
	    "However, many older systems do not support booting "
	    "from a CD-ROM. For these systems, a boot disk can be "
	    "created. This boot disk contains the Smart Boot "
	    "Manager program, which can boot a CD-ROM even "
	    "on systems with BIOSes which do not support booting "
	    "from the CD-ROM.\n\n"
	    "Smart Boot Manager is not a part of %s; "
	    "the Smart Boot Manager project can be found here:\n\n"
	    "http://btmgr.sourceforge.net/\n\n"
	    "To create a CDBoot floppy, insert a blank floppy "
	    "in unit 0 (``drive A:'') before proceeding."
	    "",
	    OPERATING_SYSTEM_NAME, OPERATING_SYSTEM_NAME);

	switch (dfui_be_present_dialog(a->c, _("Create CDBoot Floppy"),
	    _("Create CDBoot Floppy|Return to Utilities Menu"),
	    "%s", msg_buf[0])) {
	case 1:
		cmds = commands_new();
		command_add(cmds, "%s%s -c %sboot/cdboot.flp.bz2 | "
		    "%s%s of=/dev/fd0 bs=32k",
		    a->os_root, cmd_name(a, "BUNZIP2"),
		    a->os_root,
		    a->os_root, cmd_name(a, "DD"));
		if (commands_execute(a, cmds))
			inform(a->c, _("CDBoot floppy successfully created!"));
		else
			inform(a->c, _("CDBoot floppy was not successfully created."));
		break;
	case 2:
		return;
	default:
		abort_backend();
	}
}