Exemplo n.º 1
0
int meta_match_file_mask(meta *m, io_file_mask *ifm, io_file_index file)
{
	int retval = 1;
	io_file *ifile;
	
	ifile = &m->files.files_val[file];
	if( ifm->id[0] ) {
		if( ifm->mask_flags & IO_FILE_MASK_FILE_PART ) {
			if( ((ifm->mask_flags & IO_FILE_MASK_HAS_ID) &&
			     strcmp(ifm->id, file_part(ifile->id))) ||
			    (!(ifm->mask_flags & IO_FILE_MASK_HAS_ID) &&
			     !strcmp(ifm->id, file_part(ifile->id))) )
				retval = 0;
		} else {
			if( ((ifm->mask_flags & IO_FILE_MASK_HAS_ID) &&
			     strcmp(ifm->id, ifile->id)) ||
			    (!(ifm->mask_flags & IO_FILE_MASK_HAS_ID) &&
			     !strcmp(ifm->id, ifile->id)) )
				retval = 0;
		}
	}
	if( (ifile->flags & ifm->set_flags) != ifm->set_flags )
		retval = 0;
	if( ifile->flags & ifm->unset_flags )
		retval = 0;
	return( retval );
}
Exemplo n.º 2
0
Arquivo: buffer.c Projeto: dmt4/ne
buffer *get_buffer_named(const char *p) {
	if (!p) return NULL;
	p = file_part(p);

	for(buffer *b = (buffer *)buffers.head; b->b_node.next; b = (buffer *)b->b_node.next)
		if (b->filename && !strcmp(file_part(b->filename), p)) return b;

	return NULL;
}
Exemplo n.º 3
0
Arquivo: request.c Projeto: dmt4/ne
char *complete_filename(const char *start_prefix) {

	/* This might be NULL if the current directory has been unlinked, or it is not readable.
		in that case, we end up moving to the completion directory. */
	char * const cur_dir_name = ne_getcwd(CUR_DIR_MAX_SIZE);

	char * const dir_name = str_dup(start_prefix);
	if (dir_name) {
		char * const p = (char *)file_part(dir_name);
		*p = 0;
		if (p != dir_name && chdir(tilde_expand(dir_name)) == -1) {
			free(dir_name);
			return NULL;
		}
	}

	start_prefix = file_part(start_prefix);
	bool is_dir, unique = true;
	char *cur_prefix = NULL;
	DIR * const d = opendir(CURDIR);

	if (d) {
		for(struct dirent * de; !stop && (de = readdir(d)); ) {
			if (is_prefix(start_prefix, de->d_name))
				if (cur_prefix) {
					cur_prefix[max_prefix(cur_prefix, de->d_name)] = 0;
					unique = false;
				}
				else {
					cur_prefix = str_dup(de->d_name);
					is_dir = is_directory(de->d_name);
				}
		}

		closedir(d);
	}

	char * result = NULL;

	if (cur_prefix) {
		result = malloc(strlen(dir_name) + strlen(cur_prefix) + 2);
		strcat(strcat(strcpy(result, dir_name), cur_prefix), unique && is_dir ? "/" : "");
	}

	if (cur_dir_name != NULL) {
		chdir(cur_dir_name);
		free(cur_dir_name);
	}
	free(dir_name);
	free(cur_prefix);

	return result;
}
Exemplo n.º 4
0
int
plugin_kill (char *name, int by_filename)
{
	GSList *list;
	hexchat_plugin *pl;

	list = plugin_list;
	while (list)
	{
		pl = list->data;
		/* static-plugins (plugin-timer.c) have a NULL filename */
		if ((by_filename && pl->filename && g_ascii_strcasecmp (name, pl->filename) == 0) ||
			 (by_filename && pl->filename && g_ascii_strcasecmp (name, file_part (pl->filename)) == 0) ||
			(!by_filename && g_ascii_strcasecmp (name, pl->name) == 0))
		{
			/* statically linked plugins have a NULL filename */
			if (pl->filename != NULL && !pl->fake)
			{
				if (plugin_free (pl, TRUE, TRUE))
					return 1;
				return 2;
			}
		}
		list = list->next;
	}

	return 0;
}
Exemplo n.º 5
0
int plugin_kill(char *name, int by_filename)
{
	GSList *list;
	xchat_plugin *pl;

	list = plugin_list;
	while (list)
	{
		pl = (xchat_plugin*)list->data;
		// static-plugins (plugin-timer.c) have a nullptr filename
		if ((by_filename && pl->filename && strcasecmp(name, pl->filename) == 0) ||
			(by_filename && pl->filename && strcasecmp(name, file_part(pl->filename)) == 0) ||
			(!by_filename && strcasecmp(name, pl->name) == 0))
		{
			// statically linked plugins have a nullptr filename
			if (pl->filename != nullptr && !pl->fake)
			{
				if (plugin_free(pl, TRUE, TRUE))
					return 1;
				return 2;
			}
		}
		list = list->next;
	}

	return 0;
}
Exemplo n.º 6
0
void
fe_pluginlist_update (void)
{
	hexchat_plugin *pl;
	GSList *list;
	GtkTreeView *view;
	GtkListStore *store;
	GtkTreeIter iter;

	if (!plugin_window)
		return;

	view = g_object_get_data (G_OBJECT (plugin_window), "view");
	store = GTK_LIST_STORE (gtk_tree_view_get_model (view));
	gtk_list_store_clear (store);

	list = plugin_list;
	while (list)
	{
		pl = list->data;
		if (pl->version[0] != 0)
		{
			gtk_list_store_append (store, &iter);
			gtk_list_store_set (store, &iter, NAME_COLUMN, pl->name,
			                    VERSION_COLUMN, pl->version,
			                    FILE_COLUMN, file_part (pl->filename),
			                    DESC_COLUMN, pl->desc, -1);
		}
		list = list->next;
	}
}
Exemplo n.º 7
0
GModule *
module_load (char *filename)
{
	void *handle;
	char *filepart;
	char *pluginpath;

	/* get the filename without path */
	filepart = file_part (filename);

	/* load the plugin */
	if (!g_ascii_strcasecmp (filepart, filename))
	{
		/* no path specified, it's just the filename, try to load from config dir */
		pluginpath = g_build_filename (get_xdir (), "addons", filename, NULL);
		handle = g_module_open (pluginpath, 0);
		g_free (pluginpath);
	}
	else
	{
		/* try to load with absolute path */
		handle = g_module_open (filename, 0);
	}

	return handle;
}
Exemplo n.º 8
0
static void
dcc_prepare_row_recv (struct DCC *dcc, GtkListStore *store, GtkTreeIter *iter,
							 gboolean update_only)
{
	static char size[16], pos[16], kbs[16], perc[14], eta[16];
	float per;
	int to_go;

	if (!pix_dn)
		pix_dn = gtk_widget_render_icon (dccfwin.window, "gtk-go-down",
													GTK_ICON_SIZE_MENU, NULL);

	proper_unit (dcc->size, size, sizeof (size));
	if (dcc->dccstat == STAT_QUEUED)
		proper_unit (dcc->resumable, pos, sizeof (pos));
	else
		proper_unit (dcc->pos, pos, sizeof (pos));
	snprintf (kbs, sizeof (kbs), "%.1f", ((float)dcc->cps) / 1024);
	/* percentage recv'ed */
	per = (float) ((dcc->pos * 100.00) / dcc->size);
	snprintf (perc, sizeof (perc), "%.0f%%", per);
	if (dcc->cps != 0)
	{
		to_go = (dcc->size - dcc->pos) / dcc->cps;
		snprintf (eta, sizeof (eta), "%.2d:%.2d:%.2d",
					 to_go / 3600, (to_go / 60) % 60, to_go % 60);
	} else
		strcpy (eta, "--:--:--");

	if (update_only)
		gtk_list_store_set (store, iter,
								  COL_STATUS, _(dccstat[dcc->dccstat].name),
								  COL_POS, pos,
								  COL_PERC, perc,
								  COL_SPEED, kbs,
								  COL_ETA, eta,
								  COL_COLOR,
								  dccstat[dcc->dccstat].color == 1 ?
									NULL :
									colors + dccstat[dcc->dccstat].color,
									-1);
	else
		gtk_list_store_set (store, iter,
								  COL_TYPE, pix_dn,
								  COL_STATUS, _(dccstat[dcc->dccstat].name),
								  COL_FILE, file_part (dcc->file),
								  COL_SIZE, size,
								  COL_POS, pos,
								  COL_PERC, perc,
								  COL_SPEED, kbs,
								  COL_ETA, eta,
								  COL_NICK, dcc->nick,
								  COL_DCC, dcc,
								  COL_COLOR,
								  dccstat[dcc->dccstat].color == 1 ?
									NULL :
									colors + dccstat[dcc->dccstat].color,
									-1);
}
Exemplo n.º 9
0
void
signal_printer_dcc_send_request(gpointer *params)
{
	struct session *sess = params[0];
	struct DCC *dcc = params[1];
	gchar *to = params[2];

	session_print_format(sess, "dcc send offer", file_part(dcc->file), to, dcc->file);
}
Exemplo n.º 10
0
void
signal_printer_dcc_file_resume(gpointer *params)
{
	struct session *sess = params[0];
	gchar *nick = params[1];
	struct DCC *dcc = params[2];
	gchar *tbuf = params[3];

	session_print_format(sess, "dcc resume request", nick, file_part (dcc->file), tbuf);
}
Exemplo n.º 11
0
void
signal_printer_dcc_stoned(gpointer *params)
{
	struct DCC *dcc = params[0];
	server *serv = dcc->serv;
	gchar *type = g_strdup(dcctypes[dcc->type]);

	session_print_format(serv->front_session, "dcc timeout", type, file_part(dcc->file), dcc->nick);
	dcc_close(dcc, STAT_ABORTED, FALSE);
}
Exemplo n.º 12
0
void
signal_printer_dcc_send_failed(gpointer *params)
{
	struct DCC *dcc = params[0];
	server *serv = dcc->serv;
	gchar *error = params[1];

	session_print_format(serv->front_session, "dcc send failed", file_part(dcc->file), dcc->nick, error);
	dcc_close (dcc, STAT_FAILED, FALSE);
}
Exemplo n.º 13
0
static void plugin_auto_load_cb(char *filename)
{
	char *pMsg;

#ifndef WIN32	/* black listed */
	if (!strcmp(file_part(filename), "dbus.so"))
		return;
#endif

	pMsg = plugin_load(ps, filename, nullptr);
	if (pMsg)
	{
		PrintTextf(ps, "AutoLoad failed for: %s\n", filename);
		PrintText(ps, pMsg);
	}
}
Exemplo n.º 14
0
void
signal_printer_dcc_send_complete(gpointer *params)
{
	struct DCC *dcc = params[0];
	server *serv = dcc->serv;
	gchar *buf;

	/* force 100% ack for >4 GB */
	dcc->ack = dcc->size;
	dcc_close (dcc, STAT_DONE, FALSE);
	dcc_calc_average_cps (dcc);

	buf = g_strdup_printf("%d", dcc->cps);
	session_print_format(serv->front_session, "dcc send complete", file_part(dcc->file), dcc->nick, buf);
	g_free(buf);
}
Exemplo n.º 15
0
char *
plugin_load (session *sess, char *filename, char *arg)
{
	void *handle;
	char *filepart;
	hexchat_init_func *init_func;
	hexchat_deinit_func *deinit_func;
	char *pluginpath;

	/* get the filename without path */
	filepart = file_part (filename);

	/* load the plugin */
	if (!g_ascii_strcasecmp (filepart, filename))
	{
		/* no path specified, it's just the filename, try to load from config dir */
		pluginpath = g_build_filename (get_xdir (), "addons", filename, NULL);
		handle = g_module_open (pluginpath, 0);
		g_free (pluginpath);
	}
	else
	{
		/* try to load with absolute path */
		handle = g_module_open (filename, 0);
	}

	if (handle == NULL)
		return (char *)g_module_error ();

	/* find the init routine hexchat_plugin_init */
	if (!g_module_symbol (handle, "hexchat_plugin_init", (gpointer *)&init_func))
	{
		g_module_close (handle);
		return _("No hexchat_plugin_init symbol; is this really a HexChat plugin?");
	}

	/* find the plugin's deinit routine, if any */
	if (!g_module_symbol (handle, "hexchat_plugin_deinit", (gpointer *)&deinit_func))
		deinit_func = NULL;

	/* add it to our linked list */
	plugin_add (sess, filename, handle, init_func, deinit_func, arg, FALSE);

	return NULL;
}
Exemplo n.º 16
0
io_file_index meta_find_file(meta *m, const char *id, int flags,
			     int absolute_path)
{
	unsigned int lpc;
	io_file_index retval = -1;
	io_file *iofile;
	
	for( lpc = 0; (lpc < m->files.files_len) && (retval == -1); lpc++ ) {
		iofile = &m->files.files_val[lpc];
		if( (!id || !strcmp((absolute_path ?
				     iofile->id :
				     file_part(iofile->id)), id)) &&
		    (!flags || (iofile->flags & flags)) ) {
			retval = lpc;
		}
	}
	return( retval );
}
Exemplo n.º 17
0
static void
dcc_abort (struct DCC *dcc)
{
	if (dcc)
	{
		switch (dcc->dccstat)
		{
		case STAT_QUEUED:
		case STAT_CONNECTING:
		case STAT_ACTIVE:
			dcc_close (dcc, STAT_ABORTED, FALSE);

			EMIT_SIGNAL (XP_TE_DCCABORT, dcc->serv->front_session,
							 dcctypes[(int) dcc->type], file_part (dcc->file),
							 dcc->nick, NULL, 0);
			break;
		default:
			dcc_close (dcc, 0, TRUE);
		}
	}
}
Exemplo n.º 18
0
int
plugin_reload (session *sess, char *name, int by_filename)
{
	GSList *list;
	char *filename;
	char *ret;
	hexchat_plugin *pl;

	list = plugin_list;
	while (list)
	{
		pl = list->data;
		/* static-plugins (plugin-timer.c) have a NULL filename */
		if ((by_filename && pl->filename && g_ascii_strcasecmp (name, pl->filename) == 0) ||
			 (by_filename && pl->filename && g_ascii_strcasecmp (name, file_part (pl->filename)) == 0) ||
			(!by_filename && g_ascii_strcasecmp (name, pl->name) == 0))
		{
			/* statically linked plugins have a NULL filename */
			if (pl->filename != NULL && !pl->fake)
			{
				filename = g_strdup (pl->filename);
				plugin_free (pl, TRUE, FALSE);
				ret = plugin_load (sess, filename, NULL);
				g_free (filename);
				if (ret == NULL)
					return 1;
				else
					return 0;
			}
			else
				return 2;
		}
		list = list->next;
	}

	return 0;
}
Exemplo n.º 19
0
char *request_files(const char * const filename, int use_prefix) {

	int i, num_entries, name_len, max_name_len, total_len, next_dir, is_dir,
		entries_alloc_size = DEF_ENTRIES_ALLOC_SIZE,
		names_alloc_size = DEF_NAMES_ALLOC_SIZE;

	char *dir_name, **entries = NULL, *names = NULL, *cur_dir_name, *result = NULL, *p;

	DIR *d;
	struct dirent *de;

	if (!(cur_dir_name = ne_getcwd(CUR_DIR_MAX_SIZE))) return NULL;

	if (dir_name = str_dup(filename)) {
		i = 0;
		if ((p = (char *)file_part(dir_name)) != dir_name) {
			*p = 0;
			i = chdir(tilde_expand(dir_name));
		}
		free(dir_name);
		if (i == -1) return NULL;
	}

	if (entries = malloc(sizeof(char *) * entries_alloc_size)) {
		if (names = malloc(sizeof(char) * names_alloc_size)) {
			do {
				next_dir = FALSE;

				if (d = opendir(CURDIR)) {

					num_entries = max_name_len = total_len = 0;

					stop = FALSE;

					while(!stop && (de = readdir(d))) {
						is_dir = is_directory(de->d_name);
						if (use_prefix && !is_prefix(file_part(filename), de->d_name)) continue;
						name_len = strlen(de->d_name) + is_dir + 1;

						if (name_len > max_name_len) max_name_len = name_len;

						if (total_len + name_len > names_alloc_size) {
							char *t;
							t = realloc(names, sizeof(char) * (names_alloc_size = names_alloc_size * 2 + name_len));
							if (!t) break;
							names = t;
							/* Now adjust the entries to point to the newly reallocated strings */
							entries[0] = names;
							for (i = 1; i < num_entries; i++)
							  entries[i] = entries[i - 1] + strlen(entries[i - 1]) + 1;
						}

						if (num_entries >= entries_alloc_size) {
							char **t;
							t = realloc(entries, sizeof(char *) * (entries_alloc_size *= 2));
							if (!t) break;
							entries = t;
						}

						strcpy(entries[num_entries] = names + total_len, de->d_name);
						if (is_dir) strcpy(names + total_len + name_len - 2, "/");
						total_len += name_len;
						num_entries++;
					}

					if (num_entries) {
						qsort(entries, num_entries, sizeof(char *), filenamecmpp);

						if ((i = request_strings((const char * const *)entries, num_entries, 0, max_name_len, '/')) != ERROR) {
							p = entries[i >= 0 ? i : -i - 2];
							if (p[strlen(p) - 1] == '/' && i >= 0) {
								p[strlen(p) - 1] = 0;
								if (chdir(p)) alert();
								else use_prefix = FALSE;
								next_dir = TRUE;
							}
							else {
								result = ne_getcwd(CUR_DIR_MAX_SIZE + strlen(p) + 2);
								if (strcmp(result, "/")) strcat(result, "/");
								strcat(result, p);
								if (i < 0) {
									memmove(result + 1, result, strlen(result) + 1);
									result[0] = 0;
								}
							}
						}
					}

					closedir(d);
				}
				else alert();

			} while(next_dir);

			free(names);
		}
		free(entries);
	}

	chdir(cur_dir_name);
	free(cur_dir_name);

	return result;
}
Exemplo n.º 20
0
char *
plugin_load (session *sess, char *filename, char *arg)
{
	void *handle;
	xchat_init_func *init_func;
	xchat_deinit_func *deinit_func;

#ifdef USE_GMODULE
	/* load the plugin */
	handle = g_module_open (filename, 0);
	if (handle == NULL)
		return (char *)g_module_error ();

	/* find the init routine xchat_plugin_init */
	if (!g_module_symbol (handle, "xchat_plugin_init", (gpointer *)&init_func))
	{
		g_module_close (handle);
		return _("No xchat_plugin_init symbol; is this really an xchat plugin?");
	}

	/* find the plugin's deinit routine, if any */
	if (!g_module_symbol (handle, "xchat_plugin_deinit", (gpointer *)&deinit_func))
		deinit_func = NULL;

#else
	char *error;
	char *filepart;

/* OpenBSD lacks this! */
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif

#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif

	/* get the filename without path */
	filepart = file_part (filename);

	/* load the plugin */
	if (filepart &&
		 /* xsys draws in libgtk-1.2, causing crashes, so force RTLD_LOCAL */
		 (strstr (filepart, "local") || strncmp (filepart, "libxsys-1", 9) == 0)
		)
		handle = dlopen (filename, RTLD_NOW);
	else
		handle = dlopen (filename, RTLD_GLOBAL | RTLD_NOW);
	if (handle == NULL)
		return (char *)dlerror ();
	dlerror ();		/* Clear any existing error */

	/* find the init routine xchat_plugin_init */
	init_func = dlsym (handle, "xchat_plugin_init");
	error = (char *)dlerror ();
	if (error != NULL)
	{
		dlclose (handle);
		return _("No xchat_plugin_init symbol; is this really an xchat plugin?");
	}

	/* find the plugin's deinit routine, if any */
	deinit_func = dlsym (handle, "xchat_plugin_deinit");
	error = (char *)dlerror ();
#endif

	/* add it to our linked list */
	plugin_add (sess, filename, handle, init_func, deinit_func, arg, FALSE);

	return NULL;
}
Exemplo n.º 21
0
char* plugin_load(session *sess, char *filename, char *arg)
{
	void *handle;
	xchat_init_func *init_func;
	xchat_deinit_func *deinit_func;

#ifdef USE_GMODULE
	// load the plugin
	handle = g_module_open(filename, (GModuleFlags)0);
	if (handle == nullptr)
		return (char*)g_module_error();

	// find the init routine xchat_plugin_init
	if (!g_module_symbol((GModule*)handle, "xchat_plugin_init", (gpointer*)&init_func))
	{
		g_module_close((GModule*)handle);
		return _("No xchat_plugin_init symbol; is this really an xchat plugin?");
	}

	// find the plugin's deinit routine, if any
	if (!g_module_symbol((GModule*)handle, "xchat_plugin_deinit", (gpointer*)&deinit_func))
		deinit_func = nullptr;

#else
	char *error;
	char *filepart;

// OpenBSD lacks this!
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif

#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif

	// get the filename without path
	filepart = file_part(filename);

	// load the plugin
	if (filepart &&
		// xsys draws in libgtk-1.2, causing crashes, so force RTLD_LOCAL
		(strstr(filepart, "local") || strncmp (filepart, "libxsys-1", 9) == 0))
		handle = dlopen(filename, RTLD_NOW);
	else
		handle = dlopen(filename, RTLD_GLOBAL | RTLD_NOW);
	if (handle == nullptr)
		return (char*)dlerror();
	dlerror();		// Clear any existing error

	// find the init routine xchat_plugin_init
	init_func = (xif)dlsym(handle, "xchat_plugin_init");
	error = (char*)dlerror();
	if (error != nullptr)
	{
		dlclose(handle);
		return _("No xchat_plugin_init symbol; is this really an xchat plugin?");
	}

	// find the plugin's deinit routine, if any
	deinit_func = (xdf)dlsym(handle, "xchat_plugin_deinit");
	error = (char*)dlerror();
#endif

	// add it to our linked list
	plugin_add(sess, filename, handle, (void*)init_func, (void*)deinit_func, arg, FALSE);

	return nullptr;
}
Exemplo n.º 22
0
Arquivo: request.c Projeto: dmt4/ne
char *request_files(const char * const filename, bool use_prefix) {

	char * const cur_dir_name = ne_getcwd(CUR_DIR_MAX_SIZE);
	if (!cur_dir_name) return NULL;

	char * const dir_name = str_dup(filename);
	if (dir_name) {
		int result = 0;
		char * const p = (char *)file_part(dir_name);
		if (p != dir_name) {
			*p = 0;
			result = chdir(tilde_expand(dir_name));
		}
		free(dir_name);
		if (result == -1) return NULL;
	}

	req_list rl;
	bool next_dir;
	char *result = NULL;
	do {
		next_dir = false;
		if (req_list_init(&rl, filenamecmp, true, false, '/') != OK) break;

		DIR * const d = opendir(CURDIR);
		if (d) {

			stop = false;
			for(struct dirent * de; !stop && (de = readdir(d)); ) {
				const bool is_dir = is_directory(de->d_name);
				if (use_prefix && !is_prefix(file_part(filename), de->d_name)) continue;
				if (!req_list_add(&rl, de->d_name, is_dir)) break;
			}

			req_list_finalize(&rl);

			if (rl.cur_entries) {
				/* qsort(rl.entries, rl.cur_entries, sizeof(char *), filenamecmpp); */

				const int t = request_strings(&rl, 0);
				if (t != ERROR) {
					char * const p = rl.entries[t >= 0 ? t : -t - 2];
					if (p[strlen(p) - 1] == '/' && t >= 0) {
						p[strlen(p) - 1] = 0;
						if (chdir(p)) alert();
						else use_prefix = false;
						next_dir = true;
					}
					else {
						result = ne_getcwd(CUR_DIR_MAX_SIZE + strlen(p) + 2);
						if (strcmp(result, "/")) strcat(result, "/");
						strcat(result, p);
						if (t < 0) {
							memmove(result + 1, result, strlen(result) + 1);
							result[0] = 0;
						}
					}
				}
			}

			closedir(d);
		}
		else alert();
		req_list_free(&rl);
	} while(next_dir);

	chdir(cur_dir_name);
	free(cur_dir_name);

	return result;
}
Exemplo n.º 23
0
void
gtkutil_file_req (const char *title, void *callback, void *userdata, char *filter, char *extensions,
						int flags)
{
	struct file_req *freq;
	GtkWidget *dialog;
	GtkFileFilter *filefilter;
	extern char *get_xdir_fs (void);
	char *token;
	char *tokenbuffer;

#if 0	/* native file dialogs */
#ifdef WIN32
	if (!(flags & FRF_WRITE))
	{
		freq = malloc (sizeof (struct file_req));
		freq->th = thread_new ();
		freq->flags = 0;
		freq->multiple = (flags & FRF_MULTIPLE);
		freq->callback = callback;
		freq->userdata = userdata;
		freq->title = g_locale_from_utf8 (title, -1, 0, 0, 0);
		if (!filter)
		{
			freq->filter =	"All files\0*.*\0"
							"Executables\0*.exe\0"
							"ZIP files\0*.zip\0\0";
		}
		else
		{
			freq->filter = filter;
		}

		thread_start (freq->th, win32_thread, freq);
		fe_input_add (freq->th->pipe_fd[0], FIA_FD|FIA_READ, win32_read_thread, freq);

		return;

	}
	
	else {
		freq = malloc (sizeof (struct file_req));
		freq->th = thread_new ();
		freq->flags = 0;
		freq->multiple = (flags & FRF_MULTIPLE);
		freq->callback = callback;
		freq->userdata = userdata;
		freq->title = g_locale_from_utf8 (title, -1, 0, 0, 0);
		if (!filter)
		{
			freq->filter = "All files\0*.*\0\0";
		}
		else
		{
			freq->filter = filter;
		}

		thread_start (freq->th, win32_thread2, freq);
		fe_input_add (freq->th->pipe_fd[0], FIA_FD|FIA_READ, win32_read_thread, freq);

	return;
	}
#endif
#endif

	if (flags & FRF_WRITE)
	{
		dialog = gtk_file_chooser_dialog_new (title, NULL,
												GTK_FILE_CHOOSER_ACTION_SAVE,
												GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
												GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
												NULL);
		if (filter && filter[0])	/* filter becomes initial name when saving */
		{
			char temp[1024];
			path_part (filter, temp, sizeof (temp));
			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), temp);
			gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file_part (filter));
		}

		if (!(flags & FRF_NOASKOVERWRITE))
			gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
	}
	else
		dialog = gtk_file_chooser_dialog_new (title, NULL,
												GTK_FILE_CHOOSER_ACTION_OPEN,
												GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
												GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
												NULL);
	if (flags & FRF_MULTIPLE)
		gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
	if (last_dir[0])
		gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), last_dir);
	if (flags & FRF_ADDFOLDER)
		gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog),
														  get_xdir_fs (), NULL);
	if (flags & FRF_CHOOSEFOLDER)
	{
		gtk_file_chooser_set_action (GTK_FILE_CHOOSER (dialog), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
		gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), filter);
	}
	else
	{
		if (filter && (flags & FRF_FILTERISINITIAL))
			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), filter);
	}

	if (flags & FRF_EXTENSIONS && extensions != NULL)
	{
		filefilter = gtk_file_filter_new ();
		tokenbuffer = g_strdup (extensions);
		token = strtok (tokenbuffer, ";");

		while (token != NULL)
		{
			gtk_file_filter_add_pattern (filefilter, token);
			token = strtok (NULL, ";");
		}

		g_free (tokenbuffer);
		gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filefilter);
	}

	freq = malloc (sizeof (struct file_req));
	freq->dialog = dialog;
	freq->flags = flags;
	freq->callback = callback;
	freq->userdata = userdata;

	g_signal_connect (G_OBJECT (dialog), "response",
							G_CALLBACK (gtkutil_file_req_response), freq);
	g_signal_connect (G_OBJECT (dialog), "destroy",
						   G_CALLBACK (gtkutil_file_req_destroy), (gpointer) freq);
	gtk_widget_show (dialog);
}
Exemplo n.º 24
0
void
gtkutil_file_req (const char *title, void *callback, void *userdata, char *filter, char *extensions,
						int flags)
{
	struct file_req *freq;
	GtkWidget *dialog;
	GtkFileFilter *filefilter;
	extern char *get_xdir_fs (void);
	char *token;
	char *tokenbuffer;

	if (flags & FRF_WRITE)
	{
		dialog = gtk_file_chooser_dialog_new (title, NULL,
												GTK_FILE_CHOOSER_ACTION_SAVE,
												GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
												GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
												NULL);

		if (!(flags & FRF_NOASKOVERWRITE))
			gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
	}
	else
		dialog = gtk_file_chooser_dialog_new (title, NULL,
												GTK_FILE_CHOOSER_ACTION_OPEN,
												GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
												GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
												NULL);

	if (filter && filter[0] && (flags & FRF_FILTERISINITIAL))
	{
		if (flags & FRF_WRITE)
		{
			char temp[1024];
			path_part (filter, temp, sizeof (temp));
			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), temp);
			gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file_part (filter));
		}
		else
			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), filter);
	}
	else if (!(flags & FRF_RECENTLYUSED))
		gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), get_xdir ());

	if (flags & FRF_MULTIPLE)
		gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
	if (flags & FRF_CHOOSEFOLDER)
		gtk_file_chooser_set_action (GTK_FILE_CHOOSER (dialog), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);

	if ((flags & FRF_EXTENSIONS || flags & FRF_MIMETYPES) && extensions != NULL)
	{
		filefilter = gtk_file_filter_new ();
		tokenbuffer = g_strdup (extensions);
		token = strtok (tokenbuffer, ";");

		while (token != NULL)
		{
			if (flags & FRF_EXTENSIONS)
				gtk_file_filter_add_pattern (filefilter, token);
			else
				gtk_file_filter_add_mime_type (filefilter, token);
			token = strtok (NULL, ";");
		}

		g_free (tokenbuffer);
		gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filefilter);
	}

	gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog), get_xdir (), NULL);

	freq = malloc (sizeof (struct file_req));
	freq->dialog = dialog;
	freq->flags = flags;
	freq->callback = callback;
	freq->userdata = userdata;

	g_signal_connect (G_OBJECT (dialog), "response",
							G_CALLBACK (gtkutil_file_req_response), freq);
	g_signal_connect (G_OBJECT (dialog), "destroy",
						   G_CALLBACK (gtkutil_file_req_destroy), (gpointer) freq);
	gtk_widget_show (dialog);
}
Exemplo n.º 25
0
char *
plugin_load (session *sess, char *filename, char *arg)
{
	void *handle;
	char *filepart;
	hexchat_init_func *init_func;
	hexchat_deinit_func *deinit_func;
#ifndef USE_GMODULE
	char *error;
#else
	char *pluginpath;
#endif

	/* get the filename without path */
	filepart = file_part (filename);

#ifdef USE_GMODULE
	/* load the plugin */
	if (!g_ascii_strcasecmp (filepart, filename))
	{
		/* no path specified, it's just the filename, try to load from config dir */
		pluginpath = g_build_filename (get_xdir (), filename, NULL);
		handle = g_module_open (pluginpath, 0);
		g_free (pluginpath);
	}
	else
	{
		/* try to load with absolute path */
		handle = g_module_open (filename, 0);
	}

	if (handle == NULL)
		return (char *)g_module_error ();

	/* find the init routine hexchat_plugin_init */
	if (!g_module_symbol (handle, "hexchat_plugin_init", (gpointer *)&init_func))
	{
		g_module_close (handle);
		return _("No hexchat_plugin_init symbol; is this really a HexChat plugin?");
	}

	/* find the plugin's deinit routine, if any */
	if (!g_module_symbol (handle, "hexchat_plugin_deinit", (gpointer *)&deinit_func))
		deinit_func = NULL;

#else

/* OpenBSD lacks this! */
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif

#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif

	/* load the plugin */
	if (filepart &&
		 /* xsys draws in libgtk-1.2, causing crashes, so force RTLD_LOCAL */
		 (strstr (filepart, "local") || strncmp (filepart, "libxsys-1", 9) == 0)
		)
		handle = dlopen (filename, RTLD_NOW);
	else
		handle = dlopen (filename, RTLD_GLOBAL | RTLD_NOW);
	if (handle == NULL)
		return (char *)dlerror ();
	dlerror ();		/* Clear any existing error */

	/* find the init routine hexchat_plugin_init */
	init_func = dlsym (handle, "hexchat_plugin_init");
	error = (char *)dlerror ();
	if (error != NULL)
	{
		dlclose (handle);
		return _("No hexchat_plugin_init symbol; is this really a HexChat plugin?");
	}

	/* find the plugin's deinit routine, if any */
	deinit_func = dlsym (handle, "hexchat_plugin_deinit");
	error = (char *)dlerror ();
#endif

	/* add it to our linked list */
	plugin_add (sess, filename, handle, init_func, deinit_func, arg, FALSE);

	return NULL;
}
Exemplo n.º 26
0
void
fe_dcc_update_send_win (void)
{
	struct DCC *dcc;
	GSList *list = dcc_list;
	gchar *nnew[9];
	char size[14];
	char pos[14];
	char cps[14];
	char ack[14];
	char perc[14];
	char eta[14];
	gint row;
	int selrow;
	int to_go;
	float per;

	if (!dccswin.window)
		return;

	selrow = gtkutil_clist_selection (dccswin.list);

	gtk_clist_clear ((GtkCList *) dccswin.list);
	nnew[2] = size;
	nnew[3] = pos;
	nnew[4] = ack;
	nnew[5] = perc;
	nnew[6] = cps;
	while (list)
	{
		nnew[7] = eta;
		dcc = (struct DCC *) list->data;
		if (dcc->type == TYPE_SEND)
		{
			nnew[0] = _(dccstat[(int) dcc->dccstat].name);
			nnew[1] = file_part (dcc->file);
			nnew[8] = dcc->nick;
			/* percentage ack'ed */
			per = (float) ((dcc->ack * 100.00) / dcc->size);
			snprintf (size, sizeof (size), "%d", dcc->size);
			snprintf (pos, sizeof (pos), "%d", dcc->pos);
			snprintf (cps, sizeof (cps), "%d", dcc->cps);
			snprintf (perc, sizeof (perc), "%.0f%%", per);
			snprintf (ack, sizeof (ack), "%d", dcc->ack);
			if (dcc->cps != 0)
			{
				to_go = (dcc->size - dcc->ack) / dcc->cps;
				snprintf (eta, sizeof (eta), "%.2d:%.2d:%.2d",
							 to_go / 3600, (to_go / 60) % 60, to_go % 60);
			} else
				strcpy (eta, "--:--:--");
			row = gtk_clist_append (GTK_CLIST (dccswin.list), nnew);
			gtk_clist_set_row_data (GTK_CLIST (dccswin.list), row,
											(gpointer) dcc);
			if (dccstat[(int) dcc->dccstat].color != 1)
				gtk_clist_set_foreground
					(GTK_CLIST (dccswin.list), row,
					 colors + dccstat[(int) dcc->dccstat].color);
		}
		list = list->next;
	}
	if (selrow != -1)
		gtk_clist_select_row ((GtkCList *) dccswin.list, selrow, 0);
}
Exemplo n.º 27
0
void
gtkutil_file_req (const char *title, void *callback, void *userdata, char *filter, char *extensions,
						int flags)
{
	struct file_req *freq;
	GtkWidget *dialog;
	GtkFileFilter *filefilter;
	extern char *get_xdir_fs (void);
	char *token;
	char *tokenbuffer;

#if 0	/* native file dialogs */
#ifdef WIN32
	if (!(flags & FRF_WRITE))
	{
		freq = malloc (sizeof (struct file_req));
		freq->th = thread_new ();
		freq->flags = 0;
		freq->multiple = (flags & FRF_MULTIPLE);
		freq->callback = callback;
		freq->userdata = userdata;
		freq->title = g_locale_from_utf8 (title, -1, 0, 0, 0);
		if (!filter)
		{
			freq->filter =	"All files\0*.*\0"
							"Executables\0*.exe\0"
							"ZIP files\0*.zip\0\0";
		}
		else
		{
			freq->filter = filter;
		}

		thread_start (freq->th, win32_thread, freq);
		fe_input_add (freq->th->pipe_fd[0], FIA_FD|FIA_READ, win32_read_thread, freq);

		return;

	}
	
	else {
		freq = malloc (sizeof (struct file_req));
		freq->th = thread_new ();
		freq->flags = 0;
		freq->multiple = (flags & FRF_MULTIPLE);
		freq->callback = callback;
		freq->userdata = userdata;
		freq->title = g_locale_from_utf8 (title, -1, 0, 0, 0);
		if (!filter)
		{
			freq->filter = "All files\0*.*\0\0";
		}
		else
		{
			freq->filter = filter;
		}

		thread_start (freq->th, win32_thread2, freq);
		fe_input_add (freq->th->pipe_fd[0], FIA_FD|FIA_READ, win32_read_thread, freq);

	return;
	}
#endif
#endif

	if (flags & FRF_WRITE)
	{
		dialog = gtk_file_chooser_dialog_new (title, NULL,
												GTK_FILE_CHOOSER_ACTION_SAVE,
												GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
												GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
												NULL);
		if (filter && filter[0])	/* filter becomes initial name when saving */
		{
			char temp[1024];
			path_part (filter, temp, sizeof (temp));
			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), temp);
			gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file_part (filter));
		}

		if (!(flags & FRF_NOASKOVERWRITE))
			gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
	}
	else
		dialog = gtk_file_chooser_dialog_new (title, NULL,
												GTK_FILE_CHOOSER_ACTION_OPEN,
												GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
												GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
												NULL);
	if (flags & FRF_MULTIPLE)
		gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
	if (last_dir[0])
		gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), last_dir);
	if (flags & FRF_ADDFOLDER)
		gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog),
														  get_xdir (), NULL);
	if (flags & FRF_CHOOSEFOLDER)
	{
		gtk_file_chooser_set_action (GTK_FILE_CHOOSER (dialog), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
		gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), filter);
	}
	else
	{
		if (filter && (flags & FRF_FILTERISINITIAL))
		{
			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), filter);
		}
		/* With DCC, we can't rely on filter as initial folder since filter already contains
		 * the filename upon DCC RECV. Thus we have no better option than to check for the message
		 * which will be the title of the window. For DCC it always contains the "offering" word.
		 * This method is really ugly but it works so we'll stick with it for now.
		 */
		else if (strstr (title, "offering") != NULL)
		{
			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), prefs.hex_dcc_dir);
		}
		/* by default, open the config folder */
		else
		{
			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), get_xdir ());
		}
	}

	if (flags & FRF_EXTENSIONS && extensions != NULL)
	{
		filefilter = gtk_file_filter_new ();
		tokenbuffer = g_strdup (extensions);
		token = strtok (tokenbuffer, ";");

		while (token != NULL)
		{
			gtk_file_filter_add_pattern (filefilter, token);
			token = strtok (NULL, ";");
		}

		g_free (tokenbuffer);
		gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filefilter);
	}

	freq = malloc (sizeof (struct file_req));
	freq->dialog = dialog;
	freq->flags = flags;
	freq->callback = callback;
	freq->userdata = userdata;

	g_signal_connect (G_OBJECT (dialog), "response",
							G_CALLBACK (gtkutil_file_req_response), freq);
	g_signal_connect (G_OBJECT (dialog), "destroy",
						   G_CALLBACK (gtkutil_file_req_destroy), (gpointer) freq);
	gtk_widget_show (dialog);
}
Exemplo n.º 28
0
    indx_t jigsaw_load_msh_t (              // load msh_t
        char *_fchr,
        jigsaw_msh_t *_jmsh
        )
    {
        class msht_reader: 
            public jmsh_reader_base
        {
        public  :
            jigsaw_msh_t        *_jmsh ;
            
            std::int32_t         _errv ;
            
            std::int32_t         _ftag ;
            jmsh_kind::
            enum_data            _kind ;
            std::int32_t         _ndim ;
            std::int32_t         _nval ;
            
        public  :
        __normal_call msht_reader (
            jigsaw_msh_t *_jsrc =  nullptr
            ) : _jmsh(_jsrc) , 
                _errv(  +0 ) {}            
    /*-------------------------------- read MSHID section */
        __normal_call void_type push_mshid (
            std::int32_t  _ftag ,
            jmsh_kind::enum_data _kind
            )
        {   
            this->_ftag = _ftag ;
            this->_kind = _kind ;
            
            this->_jmsh->_flags  = JIGSAW_NULL_FLAG;
            
            if (_kind == 
                 jmsh_kind::euclidean_mesh)
            this->_jmsh->_flags  = 
                JIGSAW_EUCLIDEAN_MESH ;
            else
            if (_kind == 
                 jmsh_kind::euclidean_grid)
            this->_jmsh->_flags  = 
                JIGSAW_EUCLIDEAN_GRID ;
            else
            if (_kind == 
                 jmsh_kind::ellipsoid_mesh)
            this->_jmsh->_flags  = 
                JIGSAW_ELLIPSOID_MESH ;
            else
            if (_kind == 
                 jmsh_kind::ellipsoid_grid)
            this->_jmsh->_flags  = 
                JIGSAW_ELLIPSOID_GRID ;
        }
    /*-------------------------------- read NDIMS section */
        __normal_call void_type push_ndims (
            std::int32_t  _ndim
            )
        {   
            this->_ndim = _ndim ;
        }
    /*-------------------------------- read RADII section */
        __normal_call void_type push_radii (
            double      *_erad
            ) 
        { 
            jigsaw_alloc_reals (
               &this->_jmsh->_radii, +3  ) ;
        
            this->_jmsh->
                _radii._data[0] = _erad[0] ;
            this->_jmsh->
                _radii._data[1] = _erad[1] ;
            this->_jmsh->
                _radii._data[2] = _erad[2] ;
        } 
    /*-------------------------------- open POINT section */
        __normal_call void_type open_point (
            std:: size_t  _nrow
            ) 
        { 
            if (this->_kind == 
                jmsh_kind:: euclidean_mesh)
            {
            
            if (this->_ndim == +2)
            jigsaw_alloc_vert2 (
               &this->_jmsh->_vert2, _nrow) ;
            else
            if (this->_ndim == +3)
            jigsaw_alloc_vert3 (
               &this->_jmsh->_vert3, _nrow) ;
               
            jigsaw_alloc_reals (
               &this->_jmsh->_power, _nrow) ;
            
            }
            else
            if (this->_kind == 
                jmsh_kind:: ellipsoid_mesh)
            {
            
            if (this->_ndim == +2)
            jigsaw_alloc_vert2 (
               &this->_jmsh->_vert2, _nrow) ;
            else
            if (this->_ndim == +3)
            jigsaw_alloc_vert3 (
               &this->_jmsh->_vert3, _nrow) ;
            
            jigsaw_alloc_reals (
               &this->_jmsh->_power, _nrow) ;
            
            }
        }
    /*-------------------------------- read POINT section */
        __normal_call void_type push_point (
            std:: size_t  _ipos ,
            double       *_pval ,
            std::int32_t  _itag
            )
        {
            if (this->_ndim == +2 )
            {
            
            if (_ipos < this->_jmsh->_vert2._size)
            {
            this->_jmsh->_vert2._data[_ipos].
                _ppos[0] = _pval[0] ;
            this->_jmsh->_vert2._data[_ipos].
                _ppos[1] = _pval[1] ;
                
            this->_jmsh->_vert2.
                _data[_ipos]._itag  = _itag ;
                 
            this->_jmsh->
                _power._data[_ipos] = +0.00 ;
            }
            else
            {
            this->_errv =__invalid_argument ;
            } 
                
            }           
            else
            if (this->_ndim == +3 )
            {
            
            if (_ipos < this->_jmsh->_vert2._size)
            {
            this->_jmsh->_vert3._data[_ipos].
                _ppos[0] = _pval[0] ;
            this->_jmsh->_vert3._data[_ipos].
                _ppos[1] = _pval[1] ;
            this->_jmsh->_vert3._data[_ipos].
                _ppos[2] = _pval[2] ;
                
            this->_jmsh->_vert3.
                _data[_ipos]._itag  = _itag ;
                 
            this->_jmsh->
                _power._data[_ipos] = +0.00 ;
            }
            else
            {
            this->_errv =__invalid_argument ;
            }
                 
            }
        }       
    /*-------------------------------- read POWER section */
        __normal_call void_type push_power (
            std:: size_t _ipos,
            double     * _xpwr
            ) 
        { 
            if (this->_ndim == +2 )
            {
            
            if (_ipos < this->_jmsh->_vert2._size)
            {
            this->_jmsh->_power.
                _data[_ipos] = _xpwr[ +0] ;
            }
            else
            {
            this->_errv =__invalid_argument ;
            } 
                
            }           
            else
            if (this->_ndim == +3 )
            {
            
            if (_ipos < this->_jmsh->_vert3._size)
            {
            this->_jmsh->_power.
                _data[_ipos] = _xpwr[ +0] ;
            }
            else
            {
            this->_errv =__invalid_argument ;
            }
                 
            }
        }    
    /*-------------------------------- open COORD section */
        __normal_call void_type open_coord (
            std:: size_t _idim,
            std:: size_t _nrow
            )
        {   
            if (_idim == +1)
            jigsaw_alloc_reals (
                &this->_jmsh->_xgrid, _nrow) ;
            else
            if (_idim == +2)
            jigsaw_alloc_reals (
                &this->_jmsh->_ygrid, _nrow) ;
            else
            if (_idim == +3)
            jigsaw_alloc_reals (
                &this->_jmsh->_zgrid, _nrow) ;       
        }
    /*-------------------------------- read COORD section */
        __normal_call void_type push_coord (
            std:: size_t _idim,
            std:: size_t _ipos,
            double       _ppos
            )
        {
            if (_idim == +1)
            {
            
            if (_ipos < this->_jmsh->_xgrid._size)
            {
                this->_jmsh->_xgrid.
                    _data[_ipos] = _ppos ;
            }
            else
            {
                this->_errv = __invalid_argument ;
            }
            
            }
            else
            if (_idim == +2)
            {
            
            if (_ipos < this->_jmsh->_ygrid._size)
            {
                this->_jmsh->_ygrid.
                    _data[_ipos] = _ppos ;
            }
            else
            {
                this->_errv = __invalid_argument ;
            }
            
            }
            else
            if (_idim == +3)
            {
            
            if (_ipos < this->_jmsh->_zgrid._size)
            {
                this->_jmsh->_zgrid.
                    _data[_ipos] = _ppos ;
            }
            else
            {
                this->_errv = __invalid_argument ;
            }
            
            }   
        }
    /*-------------------------------- open EDGE2 section */
        __normal_call void_type open_edge2 (
            std:: size_t  _nrow
            ) 
        {
            jigsaw_alloc_edge2 (
               &this->_jmsh->_edge2, _nrow) ;
        }
    /*-------------------------------- push EDGE2 section */
        __normal_call void_type push_edge2 (
            std:: size_t  _ipos,
            std::int32_t* _node,
            std::int32_t  _itag
            ) 
        { 
            if (_ipos < this->_jmsh->_edge2._size)
            {
            this->_jmsh->_edge2._data[_ipos].
                _node[0] = _node[0] ;
            this->_jmsh->_edge2._data[_ipos].
                _node[1] = _node[1] ;
                
            this->_jmsh->_edge2.
                _data[_ipos]._itag =  _itag ;
            }
            else
            {
            this->_errv =__invalid_argument ;
            }
        }
    /*-------------------------------- open TRIA3 section */
        __normal_call void_type open_tria3 (
            std:: size_t  _nrow
            ) 
        {
            jigsaw_alloc_tria3 (
               &this->_jmsh->_tria3, _nrow) ;
        }
    /*-------------------------------- push TRIA3 section */
        __normal_call void_type push_tria3 (
            std:: size_t  _ipos,
            std::int32_t* _node,
            std::int32_t  _itag
            ) 
        { 
            if (_ipos < this->_jmsh->_tria3._size)
            {
            this->_jmsh->_tria3._data[_ipos].
                _node[0] = _node[0] ;
            this->_jmsh->_tria3._data[_ipos].
                _node[1] = _node[1] ;
            this->_jmsh->_tria3._data[_ipos].
                _node[2] = _node[2] ;
                
            this->_jmsh->_tria3.
                _data[_ipos]._itag =  _itag ;
            }
            else
            {
            this->_errv =__invalid_argument ;
            }
        }
    /*-------------------------------- open TRIA4 section */
        __normal_call void_type open_tria4 (
            std:: size_t  _nrow
            ) 
        {
            jigsaw_alloc_tria4 (
               &this->_jmsh->_tria4, _nrow) ;
        }
    /*-------------------------------- push TRIA4 section */
        __normal_call void_type push_tria4 (
            std:: size_t  _ipos,
            std::int32_t* _node,
            std::int32_t  _itag
            ) 
        { 
            if (_ipos < this->_jmsh->_tria4._size)
            {
            this->_jmsh->_tria4._data[_ipos].
                _node[0] = _node[0] ;
            this->_jmsh->_tria4._data[_ipos].
                _node[1] = _node[1] ;
            this->_jmsh->_tria4._data[_ipos].
                _node[2] = _node[2] ;
            this->_jmsh->_tria4._data[_ipos].
                _node[3] = _node[3] ;
                
            this->_jmsh->_tria4.
                _data[_ipos]._itag =  _itag ;
            }
            else
            {
            this->_errv =__invalid_argument ;
            }
        }
        
    /*-------------------------------- open BOUND section */
        __normal_call void_type open_bound (
            std:: size_t  _nrow
            ) 
        {
            jigsaw_alloc_bound (
               &this->_jmsh->_bound, _nrow) ;
        }        
    /*-------------------------------- push BOUND section */
        __normal_call void_type push_bound (
            std:: size_t  _ipos,
            std::int32_t  _itag,
            std::int32_t  _inum,
            std::int32_t  _kind
            )
        {
            if (_ipos < this->_jmsh->_bound._size)
            {
            this->_jmsh->_bound.
                _data[_ipos]._itag =  _itag ;
            this->_jmsh->_bound.
                _data[_ipos]._indx =  _inum ;
            this->_jmsh->_bound.
                _data[_ipos]._kind =  _kind ;
                      
            }
            else
            {
            this->_errv =__invalid_argument ;
            }
        }
        
    /*-------------------------------- open VALUE section */
        __normal_call void_type open_value (
            std:: size_t  _nrow,
            std:: size_t  _nval
            ) 
        { 
            this->_nval = _nval;

            jigsaw_alloc_reals (
                &this->
            _jmsh->_value , _nrow * _nval ) ;
        }
    /*-------------------------------- push VALUE section */
        __normal_call void_type push_value (
            std:: size_t  _ipos,
            double      * _vdat
            ) 
        { 
            if (_ipos < this->_jmsh->_value._size)
            {
            
            for (auto _ival = +0; 
                _ival< this->_nval; ++_ival)
            {
                this->_jmsh->_value.
            _data[_ipos*(_ival+1)] = _vdat[_ival];
            }
            
            }
            else
            {
                this->_errv =  __invalid_argument;
            }
        }
        
        } ;
    
    /*---------------------------------- parse MSH_T file */
        iptr_type _errv  = __no_error ;
    
        try
        {
            jmsh_reader   _read ;
            std::ifstream _file ;
            
            std::string _fstr(_fchr) ;
            std::string _path ;
            std::string _name ;
            std::string _fext ;
            file_part(_fstr, 
                _path, _name, _fext) ;
             
            _file.open(
                _fstr, std::ifstream:: in) ;

            if (_file.is_open() )
            {
                _read.read_file (
                _file, msht_reader(_jmsh)) ;
            }
            else
            {           
                _errv = __file_not_located ;
            }
            
            _file.close ();

            if(!_read._errs.empty())
            {
                _errv = __invalid_argument ;
            }
        }
        catch (...)
        {
            _errv = __unknown_error ;
        }

    /*---------------------------------- return read flag */
        return  _errv ;
    }