Example #1
0
static void click_handler(ClickRecognizerRef recognizer, Window *window) {
	int screen_count = s_active_item_count + 1;
	
	int next_item = current_item;
	switch (click_recognizer_get_button_id(recognizer)) {
		case BUTTON_ID_UP:
			if (screen_count <= 1)
				break;
			next_item = current_item - 1;
			show_event(next_item);
		break;

		case BUTTON_ID_DOWN:
			if (screen_count <= 1)
				break;
			next_item = current_item + 1;
			show_event(next_item);
		break;

		default:
		case BUTTON_ID_SELECT:
			select_current_item();
		break;
	}
}
Example #2
0
static int
cmd_event(char *arg)
{
	int num;

	if (arg == NULL) {
		if (selected_event == NULL) {
			g_message("No event currently selected.");
		} else {
			g_message("Currently selected is event %d, track %d.", selected_event->event_number, selected_track->track_number);
			show_event(selected_event);
		}
	} else {
		num = parse_event_number(arg);
		if (num < 0)
			return (-1);

		selected_event = smf_track_get_event_by_number(selected_track, num);
		if (selected_event == NULL) {
			g_critical("smf_get_event_by_number() failed, event not selected.");
			return (-2);
		}

		g_message("Event number %d selected.", selected_event->event_number);
		show_event(selected_event);
	}

	return (0);
}
Example #3
0
static int
cmd_events(char *notused)
{
	smf_event_t *event;

	if (selected_track == NULL) {
		g_critical("No track selected - please use 'track <number>' command first.");
		return (-1);
	}

	if (selected_track->number_of_events == 0) {
		g_message("Selected track is empty.");
		return (0);
	}

	g_message("List of events in track %d follows:", selected_track->track_number);

	smf_rewind(smf);

	while ((event = smf_track_get_next_event(selected_track)) != NULL)
		show_event(event);

	smf_rewind(smf);

	return (0);
}
Example #4
0
/*
 * Decide which event to show. Works in a cycle. Clears the display if there is a calendar event outstanding. The phone could
 * have been offline for some while and hence what is being displayed could be inaccurate.
 */
void show_next_event() {
  // Else get processing
  if (g_max_entries == 0) {
	clear_event();
  } else {
	g_entry_no++;
	if (g_entry_no > g_max_entries || g_entry_no > ROT_MAX)
	  g_entry_no = 1;
	  show_event(g_entry_no);
  } 
}
Example #5
0
void scroll_down() {
  slot* new_event = selected_event;
  while(new_event->next) {
    new_event = new_event->next;
    if(new_event->location == get_location(selected_location_id)) {
      selected_event=new_event;
      show_event();
      return;
    }
  }
}
Example #6
0
static int
msg_cb (void *dummy_arg, rfc822parse_event_t event, rfc822parse_t msg)
{
  show_event (event);
  if (event == RFC822PARSE_T2BODY)
    {
      rfc822parse_field_t ctx;
      void *ectx;
      const char *line;

      for (ectx=NULL; (line = rfc822parse_enum_header_lines (msg, &ectx)); )
        {
          printf ("*** HDR: %s\n", line);
	}
      rfc822parse_enum_header_lines (NULL, &ectx); /* Close enumerator. */

      ctx = rfc822parse_parse_field (msg, "Content-Type", -1);
      if (ctx)
        {
          const char *s1, *s2;
          s1 = rfc822parse_query_media_type (ctx, &s2);
          if (s1)
            printf ("***   media: `%s/%s'\n", s1, s2);
          else
            printf ("***   media: [not found]\n");
          show_param (ctx, "boundary");
          show_param (ctx, "protocol");
          rfc822parse_release_field (ctx);
        }
      else
        printf ("***   media: text/plain [assumed]\n");

      ctx = rfc822parse_parse_field (msg, "Content-Disposition", -1);
      if (ctx)
        {
          const char *s1;
          TOKEN t;

          s1 = rfc822parse_query_parameter (ctx, NULL, 1);
          if (s1)
            printf ("***   disp: type=`%s'\n", s1);
          s1 = rfc822parse_query_parameter (ctx, "filename", 0);
          if (s1)
            printf ("***   disp: fname=`%s'\n", s1);

          rfc822parse_release_field (ctx);
        }
    }


  return 0;
}
Example #7
0
void scroll_up() {
  slot* new_event = selected_event;
  while(new_event->previous) {
    //APP_LOG(APP_LOG_LEVEL_INFO, "searching up for event at location %d..",selected_location_id);
    new_event = new_event->previous;
    if(new_event->location == get_location(selected_location_id)) {
      selected_event=new_event;
      //APP_LOG(APP_LOG_LEVEL_INFO, "found event %s..",selected_event->description);
      show_event();
      return;
    }
  }
}
Example #8
0
/*
 * Decide which event to show. Works in a cycle. Clears the display if there is a calendar event outstanding. The phone could
 * have been offline for some while and hence what is being displayed could be inaccurate.
 */
void show_next_event() {
  // Don't mess up an alert that is underway
  if (g_showing_alert)
	  return;
  // Else get processing
  if (g_max_entries == 0) {
	clear_event();
  } else {
	g_entry_no++;
	if (g_entry_no > g_max_entries || g_entry_no > ROT_MAX)
	  g_entry_no = 1;
	  show_event(g_entry_no);
  } 
}
Example #9
0
int
main( int argc, char *argv[] )
{
     DFBResult              err;
     DFBSurfaceDescription  sdsc;
     DFBFontDescription     fdsc;
     const char            *fontfile = FONTDIR"/decker.ttf";
     int                    n;
     DeviceInfo            *devices = NULL;

     DFBCHECK(DirectFBInit( &argc, &argv ));

     DirectFBSetOption ("bg-none", NULL);

     /* create the super interface */
     DFBCHECK(DirectFBCreate( &dfb ));

     /* create a list of input devices */
     dfb->EnumInputDevices( dfb, enum_input_device, &devices );

     /* create an event buffer for all devices */
     DFBCHECK(dfb->CreateInputEventBuffer( dfb, DICAPS_ALL,
                                           DFB_FALSE, &events ));

     /* set our cooperative level to DFSCL_FULLSCREEN
        for exclusive access to the primary layer */
     dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );

     /* get the primary surface, i.e. the surface of the
        primary layer we have exclusive access to */
     sdsc.flags = DSDESC_CAPS;
     sdsc.caps  = DSCAPS_PRIMARY | DSCAPS_DOUBLE;

     DFBCHECK(dfb->CreateSurface( dfb, &sdsc, &primary ));

     primary->GetSize( primary, &screen_width, &screen_height );

     mouse_x = screen_width  / 2;
     mouse_y = screen_height / 2;

     fdsc.flags = DFDESC_HEIGHT;

     fdsc.height = screen_width / 30;
     DFBCHECK(dfb->CreateFont( dfb, fontfile, &fdsc, &font_small ));

     fdsc.height = screen_width / 20;
     DFBCHECK(dfb->CreateFont( dfb, fontfile, &fdsc, &font_normal ));

     fdsc.height = screen_width / 10;
     DFBCHECK(dfb->CreateFont( dfb, fontfile, &fdsc, &font_large ));

     primary->Clear( primary, 0, 0, 0, 0 );
     primary->SetFont( primary, font_normal );
     primary->SetColor( primary, 0x60, 0x60, 0x60, 0xFF );
     primary->DrawString( primary, "Press any key to continue.", -1,
                          screen_width/2, screen_height/2, DSTF_CENTER );
     primary->Flip( primary, NULL, 0 );

     keys_image  = load_image( IMGDIR "/gnu-keys.png" );
     mouse_image = load_image( IMGDIR "/gnome-mouse.png" );

     if (events->WaitForEventWithTimeout( events, 10, 0 ) == DFB_TIMEOUT) {
          primary->Clear( primary, 0, 0, 0, 0 );
          primary->DrawString( primary, "Timed out.", -1,
                               screen_width/2, screen_height/2, DSTF_CENTER );
          primary->Flip( primary, NULL, 0 );
          primary->Clear( primary, 0, 0, 0, 0 );
          sleep( 1 );
     }
     else {
          DFBInputDeviceKeySymbol  last_symbol = DIKS_NULL;

          while (1) {
               DFBInputEvent evt;

               while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) {
                    const char *device_name;
                    DFBInputDeviceTypeFlags device_type;

                    primary->Clear( primary, 0, 0, 0, 0 );

                    device_name  = get_device_name( devices, evt.device_id );
                    device_type  = get_device_type( devices, evt.device_id );

                    show_event( device_name, device_type, &evt );

                    primary->Flip( primary, NULL, 0 );
               }

               if (evt.type == DIET_KEYRELEASE) {
                    if ((last_symbol == DIKS_ESCAPE || last_symbol == DIKS_EXIT) &&
                        (evt.key_symbol == DIKS_ESCAPE || evt.key_symbol == DIKS_EXIT))
                         break;
                    last_symbol = evt.key_symbol;
               }

               events->WaitForEvent( events );
          }
     }

     while (devices) {
          DeviceInfo *next = devices->next;

          free( devices );
          devices = next;
     }

     /* release our interfaces to shutdown DirectFB */
     if (keys_image)
          keys_image->Release( keys_image );
     if (mouse_image)
          mouse_image->Release( mouse_image );

     font_small->Release( font_small );
     font_normal->Release( font_normal );
     font_large->Release( font_large );

     primary->Release( primary );
     events->Release( events );
     dfb->Release( dfb );

     return 0;
}
Example #10
0
int find_events( int sat_no, double t1, double t2, int viewpoint, EVENT *e)
{
   double t, lon_j, lat_j, rad_j, lon_e, lat_e, rad_e;
   double loc[9], tloc[18], *tptr, step, delta_lat, prev_delta_lat;
   double tc, lon_s, lat_s, rad_s, prev_delta = 0., delta;
   int i, rval = 0;

   t = t1;
   step = 10. / speeds[sat_no - 1];
   while( t < t2)
      {
      tc = (t - 2451545.) / 36525.;     /* re-cvt to julian centuries */

      lon_j = calc_vsop_loc( vsop_data, 5, 0, tc, 0.);
      lat_j = calc_vsop_loc( vsop_data, 5, 1, tc, 0.);
      rad_j = calc_vsop_loc( vsop_data, 5, 2, tc, 0.);

      lon_e = calc_vsop_loc( vsop_data, 3, 0, tc, 0.);
      lat_e = calc_vsop_loc( vsop_data, 3, 1, tc, 0.);
      rad_e = calc_vsop_loc( vsop_data, 3, 2, tc, 0.);

      loc[0] = rad_j * cos( lat_j) * cos( lon_j);
      loc[1] = rad_j * cos( lat_j) * sin( lon_j);
      loc[2] = rad_j * sin( lat_j);

      loc[6] = rad_e * cos( lat_e) * cos( lon_e);
      loc[7] = rad_e * cos( lat_e) * sin( lon_e);
      loc[8] = rad_e * sin( lat_e);

      calc_jsat_loc( t, tloc, 1 << (sat_no - 1), 0L);
      tptr = tloc + (sat_no - 1) * 3;
      loc[3] = loc[0] + tptr[0] * AU_PER_JRAD;
      loc[4] = loc[1] + tptr[1] * AU_PER_JRAD;
      loc[5] = loc[2] + tptr[2] * AU_PER_JRAD;

      if( viewpoint)
         {
         for( i = 0; i < 9; i++)
            loc[i] -= loc[6 + i % 3];
         lon_j = atan2( loc[1], loc[0]);
         lat_j = atan( loc[2] / sqrt( loc[0] * loc[0] + loc[1] * loc[1]));
         }
      rad_s = sqrt( loc[3] * loc[3] + loc[4] * loc[4] + loc[5] * loc[5]);
      lon_s = atan2( loc[4], loc[3]);
      while( lon_s - lon_j > PI)
         lon_s -= PI + PI;
      while( lon_s - lon_j <-PI)
         lon_s += PI + PI;
      lat_s = asin( loc[5] / rad_s);
      delta = (lon_s - lon_j) * rad_s / AU_PER_JRAD;
      delta_lat = (lat_s - lat_j) * rad_s / AU_PER_JRAD;
      delta_lat *= 1.071374;     /* stretch for jup's oblateness */
      if( delta * prev_delta < 0.)     /* zero crossed */
         {
         double t_crossing, diff, a, b, c, dx, dy, dist = 0.;

         dx = prev_delta - delta;
         dy = prev_delta_lat - delta_lat;
         a = dx * dx + dy * dy;              /* quadratic for intercept */
         b = 2. * (dx * delta + dy * delta_lat);
         c = delta_lat * delta_lat + delta * delta - 1.;
         diff = b * b - 4. * a * c;
         t_crossing = t + b * step / (2. * a);
         t = t_crossing + (180. / speeds[sat_no - 1]) * .9;
         if( diff > 0.)       /* if real solution, ie, sat doesn't miss */
            {
            diff = sqrt( diff) * step / (2. * a);
            diff = fabs( diff);
            for( i = 0; i < 3; i++)
               dist += (loc[i + 6] - loc[i]) * (loc[i + 6] - loc[i]);
            t_crossing += sqrt( dist) / AU_PER_DAY;
            e[0].t = t_crossing - diff;
            e[0].sat = sat_no;
            e[0].event_type = (prev_delta > 0.);
            if( !viewpoint)
               e[0].event_type |= FROM_SUN;
            e[1].t = t_crossing + diff;
            e[1].sat = sat_no;
            e[1].event_type = e[0].event_type;
            e[0].event_type |= EVENT_START;
            if( !quiet)
               {
               show_event( stdout, e);
               show_event( stdout, e + 1);
               }
            e += 2;
            rval += 2;
            }
         delta = 0.;
         }
      prev_delta = delta;
      prev_delta_lat = delta_lat;
      t += step;
      }
   return( rval);
}
Example #11
0
int main( int argc, char **argv)
{
   int i, j, k, julian = 0, sat_no = 15, n_days = 30, gap;
   int n_events = 0, n_sun, n_earth;
   double t1, t2;
   long jd;
   EVENT *e;
   FILE *ofile = NULL, *data_file = NULL;
   FILE *vsop_file;
   char *vsop_tbuff;

   vsop_file = fopen( "vsop.bin", "rb");
   if( !vsop_file)
      {
      printf( "Couldn't open vsop.bin");
      return( -3);
      }
   vsop_tbuff = (char *)malloc( VSOP_CHUNK);
   vsop_data = (char FAR *)FMALLOC( VSOP_CHUNK * 22U);
   for( i = 0; i < 22; i++)
      {
      fread( vsop_tbuff, VSOP_CHUNK, 1, vsop_file);
      memcpy( vsop_data + (unsigned)i * VSOP_CHUNK, vsop_tbuff, VSOP_CHUNK);
      }
   fclose( vsop_file);
   free( vsop_tbuff);

   if( argc < 4)
      {
      printf( "JEVENT calculates Jovian satellite events (transits, eclipses,\n");
      printf( "shadows,  occultations) as seen from Earth.  It requires, as a\n");
      printf( "minimum,  a day,  month,  and year.  Given,  say,  the command\n");
      printf( "\nJEVENT 18 4 1993\n\n");
      printf( "JEVENT will calculate all events from 18 Apr 1993 for the next\n");
      printf( "thirty days.  You can add on the following parameters:\n\n");
      printf( "   -j        Use Julian calendar\n");
      printf( "   -d(#)     Calculate for (#) days instead of 30\n");
      printf( "   -f(name)  Put results in ASCII file (name) as well as on screen\n");
      return( -2);
      }
   for( i = 0; i < argc; i++)
      if( argv[i][0] == '-')
         switch( argv[i][1])
            {
            case 'j': case 'J':
               julian = 1;
               break;
            case 'q': case 'Q':
               quiet = 1;
               break;
            case 's': case 'S':
               sat_no = atoi( argv[i] + 2);
               break;
            case 'd': case 'D':
               n_days = atoi( argv[i] + 2);
               break;
            case 'f': case 'F':
               ofile = fopen( argv[i] + 2, "wb");
               break;
            case 'r': case 'R':
               data_file = fopen( argv[i] + 2, "ab");
               printf( "Appending data to %s\n", argv[i] + 2);
               break;
            default:
               break;
            }
   e = (EVENT *)calloc( MAX_EVENTS, sizeof( EVENT));
   if( !e)
      return( -1);
   jd = dmy_to_day( 0, atoi( argv[2]), atol( argv[3]), julian);
   t1 = (double)jd - .5 + atof( argv[1]);
   t2 = t1 + (double)n_days;
   printf( "JD %lf to %lf\n", t1, t2);
   for( i = 0; i < 4; i++)
      if( sat_no & (1 << i))
         {
         printf( "Sat %d from sun\n", i + 1);
         n_sun = find_events( i + 1, t1 - 1., t2 + 1., 0, e + n_events);
         printf( "Sat %d from earth\n", i + 1);
         n_earth = find_events( i + 1, t1 - 1., t2 + 1., 1, e + n_events + n_sun);
         printf( "Finding hidden events\n");
         k = n_events + n_sun;
         for( j = n_events; j < n_events + n_sun; j++)
            while( k < n_events + n_sun + n_earth && e[k].t < e[j].t)
               {
               if( e[k + 1].t > e[j].t)
                  if( !(e[j].event_type & IN_FRONT))
                     e[j].event_type |= EVENT_UNSEEN;
               k += 2;
               }
         k = n_events;
         for( j = n_events + n_sun; j < n_events + n_sun + n_earth; j++)
            while( k < n_events + n_sun && e[k].t < e[j].t)
               {
               if( e[k + 1].t > e[j].t)
                  if( !(e[j].event_type & IN_FRONT))
                     e[j].event_type |= EVENT_UNSEEN;
               k += 2;
               }
         n_events += n_earth + n_sun;
         }
   printf( "Sorting %d events\n", n_events);
   for( gap = 1; gap < n_events / 3; gap = gap * 3 + 1)
      ;
   while( gap)
      {
      for( i = 0; i < gap; i++)
         for( j = i; j + gap < n_events; j += gap)
            if( e[j].t > e[j + gap].t)
               {
               EVENT temp;

               memcpy( &temp, e + j + gap, sizeof( EVENT));
               memcpy( e + j + gap, e + j, sizeof( EVENT));
               memcpy( e + j, &temp, sizeof( EVENT));
               if( j >= gap)
                  j -= gap + gap;
               }
      gap /= 3;
      }

   if( !quiet)
      {
      printf( "Final results:\n");
      for( i = 0; i < n_events; i++)
         if( e[i].t > t1 && e[i].t < t2)
            show_event( stdout, e + i);
      }

   if( ofile)
      {
      for( i = 0; i < n_events; i++)
         if( e[i].t > t1 && e[i].t < t2)
            show_event( ofile, e + i);
      fclose( ofile);
      }

   if( data_file)
      {
      for( i = 0; i < n_events; i++)
         if( e[i].t > t1 && e[i].t < t2)
            if( !( e[i].event_type & EVENT_UNSEEN))
               {
               char buff[5];

                        /* store minutes from 2000.0 */
               *(long *)buff = (long)( (e[i].t - 2451545.0) * 1440.);
               buff[4] = (char)( (e[i].event_type & 7) | (e[i].sat << 3));
               fwrite( buff, 1, 5, data_file);
               }
      fclose( data_file);
      }
   return( 0);
}
Example #12
0
int main(int argc, char* argv[])
{
	int i = 0;
	int fd;
	struct pollfd* mfds = (struct pollfd*)calloc(1, sizeof(struct pollfd));
	int mfd_count = 0;
	int nr;
	struct input_event event;
	int store_fd;
	char** dev_name;

	if(argc < 2)
	{
		fprintf(stderr, "error input\n");
		usage(argv[0]);
		exit(-1);
	}

	if(strcmp(argv[1], "a1") == 0)
	{
		dev_name = dev_name_a1;
	}
	else if (strcmp(argv[1], "a310") == 0)
	{
		dev_name = dev_name_a310;
	} 
	else if (strcmp(argv[1], "a810") == 0)
	{
		dev_name = dev_name_a810;
	}
	else 
	{
		fprintf(stderr, "error input argv[1]: %s\n", argv[1]);
		usage(argv[0]);
		exit(-1);
	}
	 
	i = 0;
	while(dev_name[i] != NULL)
	{

		printf("open %s\n", dev_name[i]);
		fd = open_dev(dev_name[i]);
		if(fd > 0)
		{
			struct pollfd* new_mfds = (struct pollfd*)realloc(mfds, sizeof(struct pollfd)*(mfd_count + 1));

			if(new_mfds == NULL)
			{
				fprintf(stderr, "realloc out of memeory\n");
				return -1;
			}

			mfds = new_mfds;

			mfds[i].fd = fd;
			mfds[i].events = POLLIN;
			mfd_count++;
		}

		i++;
	}

	//open store file
	store_fd = open(gen_filename(), O_RDWR|O_CREAT);
	if(store_fd < 0)
	{
		fprintf(stderr, "fail to open record file\n");
		exit(-1);
	}
	
	while(1)
	{

		nr = poll(mfds, mfd_count, 0);
		if(nr <= 0)
			continue;

		for(i = 0; i < mfd_count; i++)
		{
			if(mfds[i].revents == POLLIN)
			{
				int ret = read(mfds[i].fd, &event, sizeof(event));
				if(ret == sizeof(event))
				{
					show_event(&event);
					store_event(store_fd, &event);
				}

			}

		}

	}
	return 0;
}
Example #13
0
/* This function is called by the parser to communicate events.  This
   callback communicates with the main program using a structure
   passed in OPAQUE. Should retrun 0 or set errno and return -1. */
static int
message_cb (void *opaque, rfc822parse_event_t event, rfc822parse_t msg)
{
  struct parse_info_s *info = opaque;

  if (debug)
    show_event (event);
  if (event == RFC822PARSE_T2BODY)
    {
      rfc822parse_field_t ctx;
      size_t off;
      char *p;

      info->mime_type = MT_NONE;
      info->transfer_encoding = TE_NONE;
      info->test_base64 = 0;
      info->got_probe = 0;
      info->no_mime = 0;
      ctx = rfc822parse_parse_field (msg, "Content-Type", -1);
      if (ctx)
        {
          const char *s1, *s2;
          s1 = rfc822parse_query_media_type (ctx, &s2);
          if (!s1)
            ;
          else if (!strcmp (s1, "application") 
                   && !strcmp (s2, "octet-stream"))
            info->mime_type = MT_OCTET_STREAM;
          else if (!strcmp (s1, "text") 
                   && !strcmp (s2, "html"))
            info->mime_type = MT_TEXT_HTML;
          else if (!strcmp (s1, "audio"))
            info->mime_type = MT_AUDIO;
          else if (!strcmp (s1, "image"))
            info->mime_type = MT_IMAGE;

          if (verbose)
            {
              printf ("# Content-Type: %s/%s", s1?s1:"", s2?s2:"");
              s1 = rfc822parse_query_parameter (ctx, "charset", 0);
              if (s1)
                printf ("; charset=%s", s1);
              putchar ('\n');
            }

          rfc822parse_release_field (ctx);
        }
      else
        {
          p = rfc822parse_get_field (msg, "MIME-Version", -1, NULL);
          if (p)
            free (p);
          else
            info->no_mime = 1;
        }

      if (verbose)
        {
          const char *s1;

          p = rfc822parse_get_field (msg, "Content-Disposition", -1, NULL);
          if (p)
            {
              printf ("# %s\n", p);
              free (p);
            }

          ctx = rfc822parse_parse_field (msg, "Content-Disposition", -1);
          if (ctx)
            {
              s1 = rfc822parse_query_parameter (ctx, "filename", 0);
              if (s1)
                printf ("# Content-Disposition has filename=`%s'\n", s1);
              rfc822parse_release_field (ctx);
            }
        }

      p = rfc822parse_get_field (msg, "Content-Transfer-Encoding", -1, &off);
      if (p)
        {
          lowercase_string (p+off);
          if (!strcmp (p+off, "base64"))
            info->transfer_encoding = TE_BASE64;
          free (p);
        }

      if (!info->top_seen)
        {
          info->top_seen = 1;
          p = rfc822parse_get_field (msg, "To", -1, NULL);
          if (p)
            {
              if ( strstr (p, "Werner Koch") )
                {
                  if (verbose)
                    fputs ("# Found known name in To\n", stdout);
                  info->wk_seen = 1;
                }
              free (p);
            }
          if (!info->wk_seen)
            {
              p = rfc822parse_get_field (msg, "Cc", -1, NULL);
              if (p)
                {
                  if ( strstr (p, "Werner Koch") )
                    {
                      if (verbose)
                        fputs ("# Found known name in Cc\n", stdout);
                      info->wk_seen = 1;
                    }
                  free (p);
                }
            }
        }

      if ((info->mime_type == MT_OCTET_STREAM
           || info->mime_type == MT_AUDIO
           || info->mime_type == MT_IMAGE)
          && info->transfer_encoding == TE_BASE64)
        info->test_base64 = 1;
      else if (info->mime_type == MT_TEXT_HTML)
        {
          if (!quiet)
            fputs ("HTML\n", stdout);
          if (opt_match_html && !info->wk_seen)
            exit (0);
        }

    }
  else if (event == RFC822PARSE_PREAMBLE)
    ;
  else if (event == RFC822PARSE_BOUNDARY || event == RFC822PARSE_LAST_BOUNDARY)
    {
      if (info->test_base64)
        info->got_probe = 1;
      info->test_base64 = 0;
    }
  else if (event == RFC822PARSE_BEGIN_HEADER)
    {
    }

  return 0;
}
Example #14
0
static int show_scope(ivl_scope_t net, void*x)
{
      unsigned idx;
      const char *is_auto;

      fprintf(out, "scope: %s (%u parameters, %u signals, %u logic)",
	      ivl_scope_name(net), ivl_scope_params(net),
	      ivl_scope_sigs(net), ivl_scope_logs(net));

      is_auto = ivl_scope_is_auto(net) ? "automatic " : "";
      switch (ivl_scope_type(net)) {
	  case IVL_SCT_MODULE:
	    fprintf(out, " module %s%s", ivl_scope_tname(net),
                    ivl_scope_is_cell(net) ? " (cell)" : "");
	    break;
	  case IVL_SCT_FUNCTION:
	    fprintf(out, " function %s%s", is_auto, ivl_scope_tname(net));
	    break;
	  case IVL_SCT_BEGIN:
	    fprintf(out, " begin : %s", ivl_scope_tname(net));
	    break;
	  case IVL_SCT_FORK:
	    fprintf(out, " fork : %s", ivl_scope_tname(net));
	    break;
	  case IVL_SCT_TASK:
	    fprintf(out, " task %s%s", is_auto, ivl_scope_tname(net));
	    break;
	  default:
	    fprintf(out, " type(%u) %s", ivl_scope_type(net),
		    ivl_scope_tname(net));
	    break;
      }

      fprintf(out, " time units = 1e%d\n", ivl_scope_time_units(net));
      fprintf(out, " time precision = 1e%d\n", ivl_scope_time_precision(net));

      for (idx = 0 ;  idx < ivl_scope_attr_cnt(net) ;  idx += 1) {
	    ivl_attribute_t attr = ivl_scope_attr_val(net, idx);
	    switch (attr->type) {
		case IVL_ATT_VOID:
		  fprintf(out, "  (* %s *)\n", attr->key);
		  break;
		case IVL_ATT_STR:
		  fprintf(out, "  (* %s = \"%s\" *)\n", attr->key,
			  attr->val.str);
		  break;
		case IVL_ATT_NUM:
		  fprintf(out, "  (* %s = %ld *)\n", attr->key,
			  attr->val.num);
		  break;
	    }
      }

      for (idx = 0 ;  idx < ivl_scope_params(net) ;  idx += 1)
	    show_parameter(ivl_scope_param(net, idx));

      for (idx = 0 ; idx < ivl_scope_enumerates(net) ; idx += 1)
	    show_enumerate(ivl_scope_enumerate(net, idx));

      for (idx = 0 ;  idx < ivl_scope_sigs(net) ;  idx += 1)
	    show_signal(ivl_scope_sig(net, idx));

      for (idx = 0 ;  idx < ivl_scope_events(net) ;  idx += 1)
	    show_event(ivl_scope_event(net, idx));

      for (idx = 0 ;  idx < ivl_scope_logs(net) ;  idx += 1)
	    show_logic(ivl_scope_log(net, idx));

      for (idx = 0 ;  idx < ivl_scope_lpms(net) ;  idx += 1)
	    show_lpm(ivl_scope_lpm(net, idx));

      for (idx = 0 ; idx < ivl_scope_switches(net) ; idx += 1)
	    show_switch(ivl_scope_switch(net, idx));

      switch (ivl_scope_type(net)) {
	  case IVL_SCT_FUNCTION:
	  case IVL_SCT_TASK:
	    fprintf(out, "  scope function/task definition\n");
	    if (ivl_scope_def(net) == 0) {
		  fprintf(out, "  ERROR: scope missing required task definition\n");
		  stub_errors += 1;
	    } else {
		  show_statement(ivl_scope_def(net), 6);
	    }
	    break;

	  default:
	    if (ivl_scope_def(net)) {
		  fprintf(out, "  ERROR: scope has an attached task definition:\n");
		  show_statement(ivl_scope_def(net), 6);
		  stub_errors += 1;
	    }
	    break;
      }

      fprintf(out, "end scope %s\n", ivl_scope_name(net));
      return ivl_scope_children(net, show_scope, 0);
}