示例#1
0
文件: kernel.c 项目: phillid/toast
void kernel_main(multiboot_info_t *mbd, uint32_t magic)
{
	//*********************************************************
	// First things first. Parse the command line. Quick guide:
	//
	//  o quiet  - Don't print so much stuff to the screen during boot
	//  o silent - Don't print anything at all during boot (implies quiet)
	//  o eshell - (RESERVED) Will be used to enter emergency shell
	//
	if (string_contains( (char*)(mbd->cmdline) , "quiet"))
		KERNEL_OPTION_QUIET = TRUE;

	if (string_contains( (char*)(mbd->cmdline) , "silent"))
	{
		KERNEL_OPTION_QUIET = TRUE;
		KERNEL_OPTION_SILENT = TRUE;
	}
	if (string_contains( (char*)(mbd->cmdline) , "eshell"))
		KERNEL_OPTION_ESHELL = TRUE;
	//*********************************************************

	//*********************************************************
	// Do some important things before we forget
	k_tally_available_memory(mbd);

	// Init the text console and colours
	console_init();
	console_set_colors(COLOR_BRIGHT_GRAY, COLOR_BLACK);
	console_swap_colors();
	console_set_colors(COLOR_BRIGHT_GRAY, COLOR_BLACK);
	console_clear();
	//*********************************************************

	if (!KERNEL_OPTION_QUIET)
	{
		// Print some stuff about the environment
		console_print("Here is kernel_main()\n");
		console_print("Bootloader: %s\n",mbd->boot_loader_name);
		console_print("Kernel: %s\n",mbd->cmdline);
		console_print("Flags: %b\n",mbd->flags);
		console_print("Boot Device: %x\n",mbd->boot_device);

		// Dump some info about the memory blocks/regions available/reserved
		k_dump_memory_blocks(mbd);
	}
	if (!KERNEL_OPTION_SILENT)
	{
		console_print("Welcome to Toast v%d.%d (nickname '%s')\nMemory: %dMiB",
						KERNEL_VERSION_MAJ,
						KERNEL_VERSION_MIN,
						KERNEL_NICKNAME,
						TOTAL_MEMORY/1048576);
	}
	//panic(0x4655434B); // (TEST) testing panic
}
static gboolean playlists_menuitem_is_video_related (PlaylistsMenuitem* self, PlaylistDetails* new_detail) {
	gboolean result = FALSE;
	PlaylistDetails _tmp0_;
	const char* _tmp1_;
	gchar* _tmp2_;
	gchar* location;
	const gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (new_detail != NULL, FALSE);
	_tmp0_ = *new_detail;
	_tmp1_ = _tmp0_.path;
	_tmp2_ = g_strdup ((const gchar*) _tmp1_);
	location = _tmp2_;
	_tmp3_ = location;
	_tmp4_ = string_contains (_tmp3_, "/VideoLibrarySource/");
	if (_tmp4_) {
		result = TRUE;
		_g_free0 (location);
		return result;
	}
	result = FALSE;
	_g_free0 (location);
	return result;
}
示例#3
0
void build_array(struct Value_array * array, struct Tokens * tokens){
    while(tokens->tokens[tokens->counter].type != 'e'){
        tokens->counter++;
        if(tokens->tokens[tokens->counter].type == 's'){
            struct Value * val = malloc(sizeof(struct Value));
            val->type = 's';
            val->data.str.length = tokens->tokens[tokens->counter].data.length;
            strcpy(val->data.str.body, tokens->tokens[tokens->counter].data.body);
            array->values[array->size] = val;
            array->size++;
        }
        else if(tokens->tokens[tokens->counter].type == 'n'){
            struct Value * val = malloc(sizeof(struct Value));
            if(string_contains(dot_const, &tokens->tokens[tokens->counter].data)){
                float content = atof(tokens->tokens[tokens->counter].data.body);
                val->type='f';
                val->data.fl=content;
            } else {
                long content = atol(tokens->tokens[tokens->counter].data.body);
                val->type='l';
                val->data.ln=content;
            }
            array->values[array->size] = val;
            array->size++;
        }
        else if(tokens->tokens[tokens->counter].type == 'k'){
            struct Value * val = malloc(sizeof(struct Value));
            val->type = 'k';
            val->data.str.length = tokens->tokens[tokens->counter].data.length;
            strcpy(val->data.str.body, tokens->tokens[tokens->counter].data.body);
            array->values[array->size] = val;
            array->size++;
        }
        else if(tokens->tokens[tokens->counter].type == 'b'){
            struct Value * val = malloc(sizeof(struct Value));
            val->type = 'a';
            val->data.array = malloc(sizeof(struct Value_array));
            val->data.array->size = 0;
            build_array(val->data.array, tokens);
            array->values[array->size] = val;
            array->size++;
            // to advance beyond the inner closing bracket, otherwise it
            // will cause the outer array to stop building
            tokens->counter++;
        }
    }
}
示例#4
0
void options_parse(int argc, char** argv)
{
  if (argv_singleton != NULL)
    argv_singleton = NULL;
  options_t* o = options_new();

  // Parse the basic options.
  o->num_args = argc;
  o->args = polymec_malloc(sizeof(char*) * o->num_args);
  int first_named_value = -1;
  for (int i = 0; i < argc; ++i)
  {
    if (string_contains(argv[i], "=") && (first_named_value == -1))
      first_named_value = i;
    o->args[i] = string_dup(argv[i]);
  }

  // Now parse parameters.
  int i = (first_named_value == -1) ? 0 : first_named_value;
  while (i < argc)
  {
    // Parse a key=value pair.
    int pos = 0, length;
    char* token;
    if (string_next_token(argv[i], "=", &pos, &token, &length))
    {
      // We found a key with an '=' after it. What's the value?
      char key[length+1];
      strncpy(key, token, length);
      key[length] = '\0';
      if (string_next_token(argv[i], "=", &pos, &token, &length))
      {
        char value[length+1];
        strncpy(value, token, length);
        value[length] = '\0';
        options_set(o, key, value);
      }
    }

    // Next!
    ++i;
  }

  argv_singleton = o;
}
示例#5
0
int main(void)			/* GCC doesn't like void main() */
{
    char buf[128];
    char *pattern = getarg(0);

    if (pattern == 0 || getarg(1) != 0) {
        print("usage: q2prog <pattern>\n");
        return 0;
    }
    
    for (;;) {
        readline(buf, sizeof(buf));
        if (buf[0] == '\n' || buf[0] == 0)
            break;
        if (string_contains(pattern, buf)) {
            print("-- ");
            print(buf);
        }
    }
    return 0;
}
示例#6
0
static gboolean rygel_gst_utils_rtp_depay_filter (GstPluginFeature* feature) {
#line 312 "rygel-gst-utils.c"
	gboolean result = FALSE;
	GstElementFactory* factory;
#line 93 "rygel-gst-utils.vala"
	g_return_val_if_fail (feature != NULL, FALSE);
#line 94 "rygel-gst-utils.vala"
	if (!g_type_is_a (G_TYPE_FROM_INSTANCE ((GObject*) feature), GST_TYPE_ELEMENT_FACTORY)) {
#line 319 "rygel-gst-utils.c"
		result = FALSE;
#line 95 "rygel-gst-utils.vala"
		return result;
#line 323 "rygel-gst-utils.c"
	}
#line 98 "rygel-gst-utils.vala"
	factory = _gst_object_ref0 (GST_ELEMENT_FACTORY (feature));
#line 327 "rygel-gst-utils.c"
	result = string_contains (gst_element_factory_get_klass (factory), "Depayloader");
	_gst_object_unref0 (factory);
#line 100 "rygel-gst-utils.vala"
	return result;
#line 332 "rygel-gst-utils.c"
}
示例#7
0
static void smtp_conn_readcb(struct bufferevent *bev, void* args)
{
  struct evbuffer* buffer = bufferevent_get_input(bev);
  struct email* email = (struct email*) args;
  size_t len;
  char* line = evbuffer_readln(buffer, &len, EVBUFFER_EOL_CRLF);
  while (line) {
    if (email->mode != DATA) {
      if (string_equals(line, "QUIT"))
        bufferevent_write(bev, _221_BYE, strlen(_221_BYE));
      else if (string_equals(line, "RSET"))
        bufferevent_write(bev, _502_NOT_SUPPORTED, strlen(_502_NOT_SUPPORTED));
    }
    switch (email->mode) {
    case HEADERS:
      if (len >= 4 && !email->ehlo) { /* Could be an EHLO or HELO */
        if (string_startsWith(line, "EHLO") || string_startsWith(line, "HELO")) {
          email->ehlo = 1;
          bufferevent_write(bev, _250_OK, strlen(_250_OK));
        }
      } else if (email->ehlo) {
        if (!forEachCharacter(line, isEmailCharacters)) {
          if (string_startsWith(line, "MAIL FROM:<")) {
            char* addr = stripOutEmailAddress(line);
            if (addr) {
              char* query = create_check_email_from_query(addr);
              if (query)
                databaseQuery(query, check_email_from_callback, email);
              else
                bufferevent_write(bev, _550_NOT_ALLOWED, strlen(_550_NOT_ALLOWED));
              SAFEFREE(addr);
            } else
              bufferevent_write(bev, _550_NOT_ALLOWED, strlen(_550_NOT_ALLOWED));
          } else if (string_startsWith(line, "RCPT TO:<")) {
            char* addr = stripOutEmailAddress(line);
            if (addr) {
              char* query = create_check_email_to_query(addr);
              if (query)
                databaseQuery(query, check_email_to_callback, email);
              else
                bufferevent_write(bev, _550_NOT_ALLOWED, strlen(_550_NOT_ALLOWED));
              SAFEFREE(addr);
            } else
              bufferevent_write(bev, _550_NOT_ALLOWED, strlen(_550_NOT_ALLOWED));
          } else if (string_equals(line, "DATA")) {
            if (email_has_recipients(email)) {
              bufferevent_write(bev, _354_GO_AHEAD, strlen(_354_GO_AHEAD));
              email->mode = DATA_HEADERS;
            } else
              bufferevent_write(bev, _503_BAD_SEQUENCE, strlen(_503_BAD_SEQUENCE));
          } else
            bufferevent_write(bev, _550_NOT_ALLOWED, strlen(_550_NOT_ALLOWED));
        } else
          bufferevent_write(bev, _502_NOT_SUPPORTED, strlen(_502_NOT_SUPPORTED));
      }
      break;
    case DATA_HEADERS:
      if (strlen(line) == 0)
        email->mode = DATA;
      else if (!string_contains(line, ':')) {
        email->mode = DATA;
        email_append_data(email, line);
      } else if (string_startsWith(line, "Subject: "))
        email_set_subject(email, line);
      break;
    case DATA:
      if (strlen(line) > 0) {
        if (string_equals(line, ".")) {
          bufferevent_write(bev, _250_OK, strlen(_250_OK));
          email->mode = DATA_DONE;
          email_for_each_recipient(email, bufferevent_get_base(bev), launch_push_queries);
        } else
          email_append_data(email, line);
      }
      break;
    default:
      break;
    }
#ifdef DEV
    printf("I got the following line: %s\n", line);
#endif
    SAFEFREE(line);
    line = evbuffer_readln(buffer, &len, EVBUFFER_EOL_CRLF);
  }
}
示例#8
0
void mathg_math_cog_put (mathgMathCog *self) {
	gchar* s = NULL;
	mathgElmnt* _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	gint _tmp1_ = 0;
	mathgElmnt _tmp2_ = {0};
	const gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	gdouble d = 0.0;
	const gchar* _tmp25_ = NULL;
	gdouble _tmp26_ = 0.0;
	mathgElmnt* _tmp27_ = NULL;
	gint _tmp27__length1 = 0;
	gint _tmp28_ = 0;
	const gchar* _tmp29_ = NULL;
	gchar* _tmp30_ = NULL;
	gdouble ans = 0.0;
	mathgElmnt* _tmp31_ = NULL;
	gint _tmp31__length1 = 0;
	gint _tmp32_ = 0;
	mathgElmnt _tmp33_ = {0};
	gdouble _tmp34_ = 0.0;
	gboolean _tmp35_ = FALSE;
	gdouble _tmp36_ = 0.0;
	gdouble _tmp37_ = 0.0;
	gdouble _tmp38_ = 0.0;
	gdouble _tmp39_ = 0.0;
	_tmp0_ = (*self).stra;
	_tmp0__length1 = (*self).stra_length1;
	_tmp1_ = (*self).straind;
	_tmp2_ = _tmp0_[_tmp1_];
	_tmp3_ = _tmp2_.guess;
	_tmp4_ = g_strdup (_tmp3_);
	s = _tmp4_;
	_tmp5_ = (*self).ch;
	if (g_strcmp0 (_tmp5_, "-") == 0) {
		gchar* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
		gboolean _tmp8_ = FALSE;
		gchar* _tmp14_ = NULL;
		_tmp7_ = s;
		_tmp8_ = string_contains (_tmp7_, "-");
		if (_tmp8_) {
			const gchar* _tmp9_ = NULL;
			gchar* _tmp10_ = NULL;
			_tmp9_ = s;
			_tmp10_ = string_substring (_tmp9_, (glong) 1, (glong) -1);
			_g_free0 (_tmp6_);
			_tmp6_ = _tmp10_;
		} else {
			const gchar* _tmp11_ = NULL;
			const gchar* _tmp12_ = NULL;
			gchar* _tmp13_ = NULL;
			_tmp11_ = (*self).ch;
			_tmp12_ = s;
			_tmp13_ = g_strconcat (_tmp11_, _tmp12_, NULL);
			_g_free0 (_tmp6_);
			_tmp6_ = _tmp13_;
		}
		_tmp14_ = g_strdup (_tmp6_);
		_g_free0 (s);
		s = _tmp14_;
		_g_free0 (_tmp6_);
	} else {
		mathgNumberUtils _tmp15_ = {0};
		gint _tmp16_ = 0;
		gchar* _tmp17_ = NULL;
		gchar* _tmp18_ = NULL;
		const gchar* _tmp19_ = NULL;
		gboolean _tmp20_ = FALSE;
		gboolean _tmp21_ = FALSE;
		_tmp15_ = (*self).nu;
		_tmp16_ = _tmp15_.bas;
		_tmp17_ = string_substring (MATHG_digits, (glong) 0, (glong) _tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = (*self).ch;
		_tmp20_ = string_contains (_tmp18_, _tmp19_);
		_tmp21_ = _tmp20_;
		_g_free0 (_tmp18_);
		if (_tmp21_) {
			const gchar* _tmp22_ = NULL;
			const gchar* _tmp23_ = NULL;
			gchar* _tmp24_ = NULL;
			_tmp22_ = s;
			_tmp23_ = (*self).ch;
			_tmp24_ = g_strconcat (_tmp22_, _tmp23_, NULL);
			_g_free0 (s);
			s = _tmp24_;
		}
	}
	_tmp25_ = s;
	_tmp26_ = mathg_number_utils_td (&(*self).nu, _tmp25_);
	d = _tmp26_;
	_tmp27_ = (*self).stra;
	_tmp27__length1 = (*self).stra_length1;
	_tmp28_ = (*self).straind;
	_tmp29_ = s;
	_tmp30_ = g_strdup (_tmp29_);
	_g_free0 (_tmp27_[_tmp28_].guess);
	_tmp27_[_tmp28_].guess = _tmp30_;
	_tmp31_ = (*self).stra;
	_tmp31__length1 = (*self).stra_length1;
	_tmp32_ = (*self).straind;
	_tmp33_ = _tmp31_[_tmp32_];
	_tmp34_ = _tmp33_.answer;
	ans = _tmp34_;
	_tmp36_ = d;
	_tmp37_ = ans;
	_tmp38_ = fabs ((_tmp36_ / _tmp37_) - 1);
	_tmp39_ = (*self).deviation;
	if (_tmp38_ <= _tmp39_) {
		_tmp35_ = TRUE;
	} else {
		gboolean _tmp40_ = FALSE;
		_tmp40_ = (*self).isenter;
		_tmp35_ = _tmp40_;
	}
	if (_tmp35_) {
		gdouble _tmp41_ = 0.0;
		_tmp41_ = ans;
		mathg_math_cog_close (&(*self), _tmp41_);
	}
	(*self).isenter = FALSE;
	_g_free0 (s);
}
示例#9
0
static GdkPixbuf* plank_drawing_drawing_service_load_pixbuf (const gchar* icon, gint size) {
	GdkPixbuf* result = NULL;
	GdkPixbuf* pbuf = NULL;
	GtkIconTheme* icon_theme = NULL;
	GtkIconTheme* _tmp0_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (icon != NULL, NULL);
	pbuf = NULL;
	_tmp0_ = gtk_icon_theme_get_default ();
	icon_theme = _tmp0_;
	{
		GtkIconTheme* _tmp1_ = NULL;
		const gchar* _tmp2_ = NULL;
		gboolean _tmp3_ = FALSE;
		_tmp1_ = icon_theme;
		_tmp2_ = icon;
		_tmp3_ = gtk_icon_theme_has_icon (_tmp1_, _tmp2_);
		if (_tmp3_) {
			GdkPixbuf* _tmp4_ = NULL;
			GtkIconTheme* _tmp5_ = NULL;
			const gchar* _tmp6_ = NULL;
			gint _tmp7_ = 0;
			GdkPixbuf* _tmp8_ = NULL;
			GdkPixbuf* _tmp9_ = NULL;
			_tmp5_ = icon_theme;
			_tmp6_ = icon;
			_tmp7_ = size;
			_tmp8_ = gtk_icon_theme_load_icon (_tmp5_, _tmp6_, _tmp7_, 0, &_inner_error_);
			_tmp4_ = _tmp8_;
			if (_inner_error_ != NULL) {
				goto __catch4_g_error;
			}
			_tmp9_ = _tmp4_;
			_tmp4_ = NULL;
			_g_object_unref0 (pbuf);
			pbuf = _tmp9_;
			_g_object_unref0 (_tmp4_);
		} else {
			const gchar* _tmp10_ = NULL;
			gboolean _tmp11_ = FALSE;
			_tmp10_ = icon;
			_tmp11_ = string_contains (_tmp10_, ".");
			if (_tmp11_) {
				gchar** parts = NULL;
				const gchar* _tmp12_ = NULL;
				gchar** _tmp13_ = NULL;
				gchar** _tmp14_ = NULL;
				gint parts_length1 = 0;
				gint _parts_size_ = 0;
				GtkIconTheme* _tmp15_ = NULL;
				gchar** _tmp16_ = NULL;
				gint _tmp16__length1 = 0;
				const gchar* _tmp17_ = NULL;
				gboolean _tmp18_ = FALSE;
				_tmp12_ = icon;
				_tmp14_ = _tmp13_ = g_strsplit (_tmp12_, ".", 0);
				parts = _tmp14_;
				parts_length1 = _vala_array_length (_tmp13_);
				_parts_size_ = parts_length1;
				_tmp15_ = icon_theme;
				_tmp16_ = parts;
				_tmp16__length1 = parts_length1;
				_tmp17_ = _tmp16_[0];
				_tmp18_ = gtk_icon_theme_has_icon (_tmp15_, _tmp17_);
				if (_tmp18_) {
					GdkPixbuf* _tmp19_ = NULL;
					GtkIconTheme* _tmp20_ = NULL;
					gchar** _tmp21_ = NULL;
					gint _tmp21__length1 = 0;
					const gchar* _tmp22_ = NULL;
					gint _tmp23_ = 0;
					GdkPixbuf* _tmp24_ = NULL;
					GdkPixbuf* _tmp25_ = NULL;
					_tmp20_ = icon_theme;
					_tmp21_ = parts;
					_tmp21__length1 = parts_length1;
					_tmp22_ = _tmp21_[0];
					_tmp23_ = size;
					_tmp24_ = gtk_icon_theme_load_icon (_tmp20_, _tmp22_, _tmp23_, 0, &_inner_error_);
					_tmp19_ = _tmp24_;
					if (_inner_error_ != NULL) {
						parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
						goto __catch4_g_error;
					}
					_tmp25_ = _tmp19_;
					_tmp19_ = NULL;
					_g_object_unref0 (pbuf);
					pbuf = _tmp25_;
					_g_object_unref0 (_tmp19_);
				}
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			}
		}
	}
	goto __finally4;
	__catch4_g_error:
	{
		g_clear_error (&_inner_error_);
		_inner_error_ = NULL;
	}
	__finally4:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (pbuf);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	result = pbuf;
	return result;
}
示例#10
0
void image_exporter_export_svg (ImageExporterRenderer renderer, void* renderer_target) {
	gchar* filename = NULL;
	gchar* _tmp0_ = NULL;
	ImageExporterImageFormat imageFormat = 0;
	PropertySet* propertySet = NULL;
	PropertySet* _tmp1_ = NULL;
	PropertyItemSelection* formatProperty = NULL;
	PropertyItemSelection* _tmp2_ = NULL;
	PropertyItemSelection* _tmp3_ = NULL;
	PropertyItemSelection* _tmp4_ = NULL;
	PropertyItemSelection* _tmp5_ = NULL;
	PropertySet* _tmp6_ = NULL;
	PropertyItemSelection* _tmp7_ = NULL;
	PropertiesQuery* propertiesQuery = NULL;
	PropertySet* _tmp8_ = NULL;
	PropertiesQuery* _tmp9_ = NULL;
	PropertiesQuery* _tmp10_ = NULL;
	gint _tmp11_ = 0;
	const gchar* _tmp47_ = NULL;
	_tmp0_ = g_strdup ("");
	filename = _tmp0_;
	imageFormat = IMAGE_EXPORTER_IMAGE_FORMAT_SVG;
	_tmp1_ = property_set_new ("SVG Export", "SVG image export options.");
	propertySet = _tmp1_;
	_tmp2_ = property_item_selection_new ("Background", "The background for the SVG to use.");
	formatProperty = _tmp2_;
	_tmp3_ = formatProperty;
	property_item_selection_add_option (_tmp3_, "White Background", NULL);
	_tmp4_ = formatProperty;
	property_item_selection_add_option (_tmp4_, "Transparent Background", NULL);
	_tmp5_ = formatProperty;
	property_item_selection_set_option (_tmp5_, "White Background");
	_tmp6_ = propertySet;
	_tmp7_ = formatProperty;
	property_set_add_item (_tmp6_, (PropertyItem*) _tmp7_);
	_tmp8_ = propertySet;
	_tmp9_ = properties_query_new ("Export SVG Options", NULL, _tmp8_);
	propertiesQuery = _tmp9_;
	_tmp10_ = propertiesQuery;
	_tmp11_ = properties_query_run (_tmp10_);
	if (_tmp11_ == ((gint) GTK_RESPONSE_APPLY)) {
		GtkFileFilter* svgFileFilter = NULL;
		GtkFileFilter* _tmp12_ = NULL;
		GtkFileFilter* _tmp13_ = NULL;
		GtkFileFilter* _tmp14_ = NULL;
		GtkFileFilter* anyFileFilter = NULL;
		GtkFileFilter* _tmp15_ = NULL;
		GtkFileFilter* _tmp16_ = NULL;
		GtkFileFilter* _tmp17_ = NULL;
		GtkFileChooserDialog* fileChooser = NULL;
		GtkFileChooserDialog* _tmp18_ = NULL;
		GtkFileChooserDialog* _tmp19_ = NULL;
		GtkFileFilter* _tmp20_ = NULL;
		GtkFileFilter* _tmp21_ = NULL;
		GtkFileChooserDialog* _tmp22_ = NULL;
		GtkFileFilter* _tmp23_ = NULL;
		GtkFileFilter* _tmp24_ = NULL;
		GtkFileChooserDialog* _tmp25_ = NULL;
		gboolean stillChoosing = FALSE;
		GtkFileChooserDialog* _tmp46_ = NULL;
		_tmp12_ = gtk_file_filter_new ();
		g_object_ref_sink (_tmp12_);
		svgFileFilter = _tmp12_;
		_tmp13_ = svgFileFilter;
		gtk_file_filter_set_name (_tmp13_, "Scalable Vector Graphic (.svg)");
		_tmp14_ = svgFileFilter;
		gtk_file_filter_add_pattern (_tmp14_, "*.svg");
		_tmp15_ = gtk_file_filter_new ();
		g_object_ref_sink (_tmp15_);
		anyFileFilter = _tmp15_;
		_tmp16_ = anyFileFilter;
		gtk_file_filter_set_name (_tmp16_, "Any File");
		_tmp17_ = anyFileFilter;
		gtk_file_filter_add_pattern (_tmp17_, "*");
		_tmp18_ = (GtkFileChooserDialog*) gtk_file_chooser_dialog_new ("Export to SVG", NULL, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
		g_object_ref_sink (_tmp18_);
		fileChooser = _tmp18_;
		_tmp19_ = fileChooser;
		_tmp20_ = svgFileFilter;
		_tmp21_ = _g_object_ref0 (_tmp20_);
		gtk_file_chooser_add_filter ((GtkFileChooser*) _tmp19_, _tmp21_);
		_tmp22_ = fileChooser;
		_tmp23_ = anyFileFilter;
		_tmp24_ = _g_object_ref0 (_tmp23_);
		gtk_file_chooser_add_filter ((GtkFileChooser*) _tmp22_, _tmp24_);
		_tmp25_ = fileChooser;
		gtk_file_chooser_set_do_overwrite_confirmation ((GtkFileChooser*) _tmp25_, TRUE);
		stillChoosing = TRUE;
		while (TRUE) {
			gboolean _tmp26_ = FALSE;
			GtkFileChooserDialog* _tmp27_ = NULL;
			gint _tmp28_ = 0;
			_tmp26_ = stillChoosing;
			if (!_tmp26_) {
				break;
			}
			_tmp27_ = fileChooser;
			_tmp28_ = gtk_dialog_run ((GtkDialog*) _tmp27_);
			if (_tmp28_ == ((gint) GTK_RESPONSE_ACCEPT)) {
				GtkFileChooserDialog* _tmp29_ = NULL;
				gchar* _tmp30_ = NULL;
				const gchar* _tmp31_ = NULL;
				gboolean _tmp32_ = FALSE;
				const gchar* _tmp40_ = NULL;
				gboolean _tmp41_ = FALSE;
				_tmp29_ = fileChooser;
				_tmp30_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp29_);
				_g_free0 (filename);
				filename = _tmp30_;
				_tmp31_ = filename;
				_tmp32_ = string_contains (_tmp31_, ".");
				if (_tmp32_) {
					FILE* _tmp33_ = NULL;
					_tmp33_ = stdout;
					fprintf (_tmp33_, "File extension already given\n");
				} else {
					GtkFileChooserDialog* _tmp34_ = NULL;
					GtkFileFilter* _tmp35_ = NULL;
					GtkFileFilter* _tmp36_ = NULL;
					GtkFileFilter* _tmp37_ = NULL;
					_tmp34_ = fileChooser;
					_tmp35_ = gtk_file_chooser_get_filter ((GtkFileChooser*) _tmp34_);
					_tmp36_ = _tmp35_;
					_tmp37_ = svgFileFilter;
					if (_tmp36_ == _tmp37_) {
						const gchar* _tmp38_ = NULL;
						gchar* _tmp39_ = NULL;
						_tmp38_ = filename;
						_tmp39_ = g_strconcat (_tmp38_, ".svg", NULL);
						_g_free0 (filename);
						filename = _tmp39_;
					}
				}
				_tmp40_ = filename;
				_tmp41_ = g_file_test (_tmp40_, G_FILE_TEST_EXISTS);
				if (_tmp41_) {
					GtkFileChooserDialog* _tmp42_ = NULL;
					const gchar* _tmp43_ = NULL;
					gint _tmp44_ = 0;
					_tmp42_ = fileChooser;
					_tmp43_ = filename;
					_tmp44_ = basic_dialog_ask_overwrite ((GtkWindow*) _tmp42_, _tmp43_);
					if (_tmp44_ == ((gint) GTK_RESPONSE_YES)) {
						stillChoosing = FALSE;
					}
				} else {
					stillChoosing = FALSE;
				}
			} else {
				GtkFileChooserDialog* _tmp45_ = NULL;
				_tmp45_ = fileChooser;
				gtk_widget_destroy ((GtkWidget*) _tmp45_);
				_g_object_unref0 (fileChooser);
				_g_object_unref0 (anyFileFilter);
				_g_object_unref0 (svgFileFilter);
				_properties_query_unref0 (propertiesQuery);
				_property_item_unref0 (formatProperty);
				_property_item_unref0 (propertySet);
				_g_free0 (filename);
				return;
			}
		}
		_tmp46_ = fileChooser;
		gtk_widget_destroy ((GtkWidget*) _tmp46_);
		_g_object_unref0 (fileChooser);
		_g_object_unref0 (anyFileFilter);
		_g_object_unref0 (svgFileFilter);
	}
	_tmp47_ = filename;
	if (g_strcmp0 (_tmp47_, "") != 0) {
		PropertySet* _tmp48_ = NULL;
		gchar* _tmp49_ = NULL;
		gchar* _tmp50_ = NULL;
		GQuark _tmp52_ = 0U;
		static GQuark _tmp51_label0 = 0;
		static GQuark _tmp51_label1 = 0;
		ImageExporterRenderer _tmp53_ = NULL;
		void* _tmp53__target = NULL;
		const gchar* _tmp54_ = NULL;
		ImageExporterImageFormat _tmp55_ = 0;
		_tmp48_ = propertySet;
		_tmp49_ = property_item_selection_get_data (_tmp48_, "Background");
		_tmp50_ = _tmp49_;
		_tmp52_ = (NULL == _tmp50_) ? 0 : g_quark_from_string (_tmp50_);
		g_free (_tmp50_);
		if (_tmp52_ == ((0 != _tmp51_label0) ? _tmp51_label0 : (_tmp51_label0 = g_quark_from_static_string ("White Background")))) {
			switch (0) {
				default:
				{
					imageFormat = IMAGE_EXPORTER_IMAGE_FORMAT_SVG;
					break;
				}
			}
		} else if (_tmp52_ == ((0 != _tmp51_label1) ? _tmp51_label1 : (_tmp51_label1 = g_quark_from_static_string ("Transparent Background")))) {
			switch (0) {
				default:
				{
					imageFormat = IMAGE_EXPORTER_IMAGE_FORMAT_SVG_CLEAR;
					break;
				}
			}
		}
		_tmp53_ = renderer;
		_tmp53__target = renderer_target;
		_tmp54_ = filename;
		_tmp55_ = imageFormat;
		_tmp53_ (_tmp54_, _tmp55_, (gdouble) 1, _tmp53__target);
	}
	_properties_query_unref0 (propertiesQuery);
	_property_item_unref0 (formatProperty);
	_property_item_unref0 (propertySet);
	_g_free0 (filename);
}
示例#11
0
void image_exporter_export_pdf (ImageExporterRenderer renderer, void* renderer_target) {
	gchar* filename = NULL;
	gchar* _tmp0_ = NULL;
	GtkFileFilter* pdfFileFilter = NULL;
	GtkFileFilter* _tmp1_ = NULL;
	GtkFileFilter* _tmp2_ = NULL;
	GtkFileFilter* _tmp3_ = NULL;
	GtkFileFilter* anyFileFilter = NULL;
	GtkFileFilter* _tmp4_ = NULL;
	GtkFileFilter* _tmp5_ = NULL;
	GtkFileFilter* _tmp6_ = NULL;
	GtkFileChooserDialog* fileChooser = NULL;
	GtkFileChooserDialog* _tmp7_ = NULL;
	GtkFileChooserDialog* _tmp8_ = NULL;
	GtkFileFilter* _tmp9_ = NULL;
	GtkFileFilter* _tmp10_ = NULL;
	GtkFileChooserDialog* _tmp11_ = NULL;
	GtkFileFilter* _tmp12_ = NULL;
	GtkFileFilter* _tmp13_ = NULL;
	GtkFileChooserDialog* _tmp14_ = NULL;
	gboolean stillChoosing = FALSE;
	GtkFileChooserDialog* _tmp35_ = NULL;
	const gchar* _tmp36_ = NULL;
	_tmp0_ = g_strdup ("");
	filename = _tmp0_;
	_tmp1_ = gtk_file_filter_new ();
	g_object_ref_sink (_tmp1_);
	pdfFileFilter = _tmp1_;
	_tmp2_ = pdfFileFilter;
	gtk_file_filter_set_name (_tmp2_, "Portable Document Format (.pdf)");
	_tmp3_ = pdfFileFilter;
	gtk_file_filter_add_pattern (_tmp3_, "*.pdf");
	_tmp4_ = gtk_file_filter_new ();
	g_object_ref_sink (_tmp4_);
	anyFileFilter = _tmp4_;
	_tmp5_ = anyFileFilter;
	gtk_file_filter_set_name (_tmp5_, "Any File");
	_tmp6_ = anyFileFilter;
	gtk_file_filter_add_pattern (_tmp6_, "*");
	_tmp7_ = (GtkFileChooserDialog*) gtk_file_chooser_dialog_new ("Export to PDF", NULL, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
	g_object_ref_sink (_tmp7_);
	fileChooser = _tmp7_;
	_tmp8_ = fileChooser;
	_tmp9_ = pdfFileFilter;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	gtk_file_chooser_add_filter ((GtkFileChooser*) _tmp8_, _tmp10_);
	_tmp11_ = fileChooser;
	_tmp12_ = anyFileFilter;
	_tmp13_ = _g_object_ref0 (_tmp12_);
	gtk_file_chooser_add_filter ((GtkFileChooser*) _tmp11_, _tmp13_);
	_tmp14_ = fileChooser;
	gtk_file_chooser_set_do_overwrite_confirmation ((GtkFileChooser*) _tmp14_, TRUE);
	stillChoosing = TRUE;
	while (TRUE) {
		gboolean _tmp15_ = FALSE;
		GtkFileChooserDialog* _tmp16_ = NULL;
		gint _tmp17_ = 0;
		_tmp15_ = stillChoosing;
		if (!_tmp15_) {
			break;
		}
		_tmp16_ = fileChooser;
		_tmp17_ = gtk_dialog_run ((GtkDialog*) _tmp16_);
		if (_tmp17_ == ((gint) GTK_RESPONSE_ACCEPT)) {
			GtkFileChooserDialog* _tmp18_ = NULL;
			gchar* _tmp19_ = NULL;
			const gchar* _tmp20_ = NULL;
			gboolean _tmp21_ = FALSE;
			const gchar* _tmp29_ = NULL;
			gboolean _tmp30_ = FALSE;
			_tmp18_ = fileChooser;
			_tmp19_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp18_);
			_g_free0 (filename);
			filename = _tmp19_;
			_tmp20_ = filename;
			_tmp21_ = string_contains (_tmp20_, ".");
			if (_tmp21_) {
				FILE* _tmp22_ = NULL;
				_tmp22_ = stdout;
				fprintf (_tmp22_, "File extension already given\n");
			} else {
				GtkFileChooserDialog* _tmp23_ = NULL;
				GtkFileFilter* _tmp24_ = NULL;
				GtkFileFilter* _tmp25_ = NULL;
				GtkFileFilter* _tmp26_ = NULL;
				_tmp23_ = fileChooser;
				_tmp24_ = gtk_file_chooser_get_filter ((GtkFileChooser*) _tmp23_);
				_tmp25_ = _tmp24_;
				_tmp26_ = pdfFileFilter;
				if (_tmp25_ == _tmp26_) {
					const gchar* _tmp27_ = NULL;
					gchar* _tmp28_ = NULL;
					_tmp27_ = filename;
					_tmp28_ = g_strconcat (_tmp27_, ".pdf", NULL);
					_g_free0 (filename);
					filename = _tmp28_;
				}
			}
			_tmp29_ = filename;
			_tmp30_ = g_file_test (_tmp29_, G_FILE_TEST_EXISTS);
			if (_tmp30_) {
				GtkFileChooserDialog* _tmp31_ = NULL;
				const gchar* _tmp32_ = NULL;
				gint _tmp33_ = 0;
				_tmp31_ = fileChooser;
				_tmp32_ = filename;
				_tmp33_ = basic_dialog_ask_overwrite ((GtkWindow*) _tmp31_, _tmp32_);
				if (_tmp33_ == ((gint) GTK_RESPONSE_YES)) {
					stillChoosing = FALSE;
				}
			} else {
				stillChoosing = FALSE;
			}
		} else {
			GtkFileChooserDialog* _tmp34_ = NULL;
			_tmp34_ = fileChooser;
			gtk_widget_destroy ((GtkWidget*) _tmp34_);
			_g_object_unref0 (fileChooser);
			_g_object_unref0 (anyFileFilter);
			_g_object_unref0 (pdfFileFilter);
			_g_free0 (filename);
			return;
		}
	}
	_tmp35_ = fileChooser;
	gtk_widget_destroy ((GtkWidget*) _tmp35_);
	_tmp36_ = filename;
	if (g_strcmp0 (_tmp36_, "") != 0) {
		ImageExporterRenderer _tmp37_ = NULL;
		void* _tmp37__target = NULL;
		const gchar* _tmp38_ = NULL;
		_tmp37_ = renderer;
		_tmp37__target = renderer_target;
		_tmp38_ = filename;
		_tmp37_ (_tmp38_, IMAGE_EXPORTER_IMAGE_FORMAT_PDF, (gdouble) 1, _tmp37__target);
	}
	_g_object_unref0 (fileChooser);
	_g_object_unref0 (anyFileFilter);
	_g_object_unref0 (pdfFileFilter);
	_g_free0 (filename);
}
示例#12
0
int is_a_number(char ch){
    return string_contains(ch, &numbers);
}
示例#13
0
static bool compare_want_substring(Constraint *constraint, intptr_t actual) {
    return string_contains((const char *)actual, (const char *)constraint->expected_value);
}
示例#14
0
文件: strings.c 项目: raglandba/WebC
int string_contains_string(String* source, String* contents) {
	return string_contains(source, contents->string);
}
示例#15
0
int is_a_function(char ch){
  return string_contains(ch, &functions);
}
static void steadyflow_file_list_controller_update_model (SteadyflowFileListController* self) {
	GtkListStore* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->model;
	gtk_list_store_clear (_tmp0_);
	{
		SteadyflowCoreIDownloadService* _tmp1_;
		SteadyflowCoreIDownloadService* _tmp2_;
		GeeList* _tmp3_;
		GeeList* _tmp4_;
		GeeList* _file_list;
		GeeList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _file_size;
		gint _file_index;
		_tmp1_ = steadyflow_services_get_download ();
		_tmp2_ = _tmp1_;
		_tmp3_ = steadyflow_core_idownload_service_get_files (_tmp2_);
		_tmp4_ = _tmp3_;
		_file_list = _tmp4_;
		_tmp5_ = _file_list;
		_tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_file_size = _tmp7_;
		_file_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			gint _tmp10_;
			GeeList* _tmp11_;
			gint _tmp12_;
			gpointer _tmp13_ = NULL;
			SteadyflowCoreIDownloadFile* file;
			SteadyflowCoreIDownloadFile* _tmp14_;
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			gchar* _tmp17_ = NULL;
			gchar* _tmp18_;
			const gchar* _tmp19_;
			gboolean _tmp20_ = FALSE;
			gboolean _tmp21_;
			GtkTreeIter iter = {0};
			GtkListStore* _tmp22_;
			GtkTreeIter _tmp23_ = {0};
			GtkListStore* _tmp24_;
			GtkTreeIter _tmp25_;
			SteadyflowCoreIDownloadFile* _tmp26_;
			_tmp8_ = _file_index;
			_file_index = _tmp8_ + 1;
			_tmp9_ = _file_index;
			_tmp10_ = _file_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _file_list;
			_tmp12_ = _file_index;
			_tmp13_ = gee_list_get (_tmp11_, _tmp12_);
			file = (SteadyflowCoreIDownloadFile*) _tmp13_;
			_tmp14_ = file;
			_tmp15_ = steadyflow_core_idownload_file_get_local_basename (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = g_utf8_casefold (_tmp16_, (gssize) (-1));
			_tmp18_ = _tmp17_;
			_tmp19_ = self->priv->filter;
			_tmp20_ = string_contains (_tmp18_, _tmp19_);
			_tmp21_ = !_tmp20_;
			_g_free0 (_tmp18_);
			if (_tmp21_) {
				_g_object_unref0 (file);
				continue;
			}
			_tmp22_ = self->priv->model;
			gtk_list_store_prepend (_tmp22_, &_tmp23_);
			iter = _tmp23_;
			_tmp24_ = self->priv->model;
			_tmp25_ = iter;
			_tmp26_ = file;
			gtk_list_store_set (_tmp24_, &_tmp25_, 0, _tmp26_, -1, -1);
			_g_object_unref0 (file);
		}
		_g_object_unref0 (_file_list);
	}
	g_signal_emit_by_name (self, "filelist-changed");
}
示例#17
0
gchar* fso_factory_function (FsoFrameworkSubsystem* subsystem, GError** error) {
	gchar* result = NULL;
	FsoFrameworkSmartKeyFile* _tmp0_;
	FsoFrameworkSmartKeyFile* _tmp1_;
	FsoFrameworkSmartKeyFile* config;
	gchar* _tmp2_ = NULL;
	const gchar* _tmp3_;
	gchar* _tmp4_ = NULL;
	const gchar* _tmp5_;
	gchar* _tmp6_ = NULL;
	const gchar* _tmp7_;
	GDir* _tmp8_ = NULL;
	GDir* dir;
	const gchar* _tmp9_ = NULL;
	gchar* _tmp10_;
	gchar* entry;
	gchar* _tmp22_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (subsystem != NULL, NULL);
	_tmp0_ = fso_framework_theConfig;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	config = _tmp1_;
	_tmp2_ = fso_framework_smart_key_file_stringValue (config, "cornucopia", "sysfs_root", "/sys");
	_g_free0 (sysfs_root);
	sysfs_root = _tmp2_;
	_tmp3_ = sysfs_root;
	_tmp4_ = g_strdup_printf ("%s/class/timed_output", _tmp3_);
	_g_free0 (sys_class_timedoutputs);
	sys_class_timedoutputs = _tmp4_;
	_tmp5_ = sysfs_root;
	_tmp6_ = g_strdup_printf ("%s/class/net", _tmp5_);
	_g_free0 (sys_class_net);
	sys_class_net = _tmp6_;
	_tmp7_ = sys_class_timedoutputs;
	_tmp8_ = g_dir_open (_tmp7_, (guint) 0, &_inner_error_);
	dir = _tmp8_;
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (config);
		return NULL;
	}
	_tmp9_ = g_dir_read_name (dir);
	_tmp10_ = g_strdup (_tmp9_);
	entry = _tmp10_;
	while (TRUE) {
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gboolean _tmp13_ = FALSE;
		const gchar* _tmp20_ = NULL;
		gchar* _tmp21_;
		_tmp11_ = entry;
		if (!(_tmp11_ != NULL)) {
			break;
		}
		_tmp12_ = entry;
		_tmp13_ = string_contains (_tmp12_, "vib");
		if (_tmp13_) {
			const gchar* _tmp14_;
			const gchar* _tmp15_;
			gchar* _tmp16_ = NULL;
			gchar* filename;
			FsoFrameworkSubsystem* _tmp17_;
			const gchar* _tmp18_;
			VibratorTimedOutputClass* _tmp19_;
			_tmp14_ = sys_class_timedoutputs;
			_tmp15_ = entry;
			_tmp16_ = g_build_filename (_tmp14_, _tmp15_, NULL);
			filename = _tmp16_;
			_tmp17_ = subsystem;
			_tmp18_ = filename;
			_tmp19_ = vibrator_timed_outputclass_new (_tmp17_, _tmp18_);
			instances = g_list_append (instances, _tmp19_);
			_g_free0 (filename);
		}
		_tmp20_ = g_dir_read_name (dir);
		_tmp21_ = g_strdup (_tmp20_);
		_g_free0 (entry);
		entry = _tmp21_;
	}
	_tmp22_ = g_strdup ("fsodevice.vibrator_timedoutputclasss");
	result = _tmp22_;
	_g_free0 (entry);
	_g_dir_close0 (dir);
	_g_object_unref0 (config);
	return result;
}
示例#18
0
int is_a_letter(char ch){
    return string_contains(ch, &letters);
}