Re: Plug-in problems
HmmmI actually never use gdb too much becuase I'm too lazy to learn :) (one of these days)...but I generally put in a lot of fprintf(stderr, ...)'s :) On Thu, 30 Nov 2000, David Neary wrote: > > Thanks Maneesh, > > Now I really feel like an idiot - that worked a treat :) > > As a matter of interest, what kind of techniques have people built up > for debugging plug-ins? > > Cheers, > Dave. > > Maneesh Yadav wrote: > > > > I think you need to allocate the return vals (the pointeryou get from the > > args is to let you tell the caller where the return vals are...like this: > > > > static GimpParam values[1]; > > > > *nreturn_vals = 0; > > *return_vals = values; > > values[0].type = GIMP_PDB_STATUS; > > values[0].data.d_status = GIMP_PDB_SUCCESS; > > > > -- > Dave Neary, > Software engineer, Informix Dublin. > Ireland. > Phone: +353-1-409-1357 >
Re: Plug-in problems
Thanks Maneesh, Now I really feel like an idiot - that worked a treat :) As a matter of interest, what kind of techniques have people built up for debugging plug-ins? Cheers, Dave. Maneesh Yadav wrote: > > I think you need to allocate the return vals (the pointeryou get from the > args is to let you tell the caller where the return vals are...like this: > > static GimpParam values[1]; > > *nreturn_vals = 0; > *return_vals = values; > values[0].type = GIMP_PDB_STATUS; > values[0].data.d_status = GIMP_PDB_SUCCESS; > -- Dave Neary, Software engineer, Informix Dublin. Ireland. Phone: +353-1-409-1357
Re: Plug-in problems
I think you need to allocate the return vals (the pointeryou get from the args is to let you tell the caller where the return vals are...like this: static GimpParam values[1]; *nreturn_vals = 0; *return_vals = values; values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = GIMP_PDB_SUCCESS; > > Hi all, > > I'm trying to write a plug-in for the gimp, but I'm having a few > problems. I think at this stage it's pretty bare-bones, pretty much a > hello world plug-in. > > Anyway, my plug-in is detected at start-up by the Gimp, and registers > with the PDB etc - so I suspect that my query function is OK. > > When it's forked again to run, I get in a bit of trouble. On 1.1.28, it > just barf about the internal failure of the plug-in, and how that could > cause transmogrification of good, unsaved data. On 1.1.24, the widget (a > dialog) displays, but it, and the gimp, disappear when I click on it... > I did a stack-trace on teh core, and it looks like I got into an > infinite loop with _dl_runtime_resolve and __restore calling each other > a few hundred times, when gimp_ui_init starts up, until the process ran > out of memory. > > Anyway, I was wondering if someone would have a quick perusal and point > me in the direction of my stupidity. Or point me to a "hello, world!" > gimp plug-in, or point me in the direction of references I might find > useful, other than "Writing a GIMP Plug-in" by Kevin Turner, which is > what I have been working out of so far. > > Just in case the problem is actually in the query function (in > gimp_install_procedure, maybe?) I have included that. In fact, the only > stuff I haven't included are header includes and global vars (of which > there is only one, PLUG_IN_INFO). I realise this is kind of long, > especially for a first post, but I hope you'll give me a bit of > lattitude. > > Thanks a lot, > Dave Neary. > > -- > Dave Neary, > Software engineer, Informix Dublin. > Ireland. > Phone: +353-1-409-1357 > > ** Code segment starts here *** > > /* query() function. Sets up type of plug-in in the PDB. > */ > static void query(void) > { > /* We want to define the arguments this will take, > * and what it will return - eventually this will include more > * complicated stuff, for now it accepts the defaults, and returns > * SUCCESS > */ > > static GimpParamDef args[]= > { > { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" }, > { GIMP_PDB_IMAGE, "image_id", "(unused)" }, > { GIMP_PDB_DRAWABLE, "drawable_id", "Input drawable" }, > }; > static gint nargs = sizeof (args) / sizeof (args[0]); > > /* We need to register the module - we do this with > * gimp_install_procedure. > */ > > gimp_install_procedure("plug_in_hello", > "Prints a message", > "For no good reason this plug-in only accepts greyscale >images", > "David Neary ([EMAIL PROTECTED])", > "David Neary ([EMAIL PROTECTED])", > "2000", > "/Filters/Render/Pattern/Hello", > "GRAY", > GIMP_PLUGIN, > nargs,0, > args,NULL); > > } > > static void run(gchar *name, > gint nparams, > GimpParam *param, > gint*nreturn_vals, > GimpParam **return_vals) > { > > /* We'll add a couple of widgets and show them (a dialog titled > * Hello, world! or something equally original should do) > */ > GtkWidget *dlg; > GtkWidget *frame; > GtkWidget *greeting; > GimpPDBStatusType status = GIMP_PDB_SUCCESS; > > *nreturn_vals=1; > (*return_vals)->type = GIMP_PDB_STATUS; > ((*return_vals)->data).d_status = status; > > gimp_ui_init ("hello", FALSE); > > dlg = gimp_dialog_new ("Hello, world!", "hello", > gimp_standard_help_func, > MY_ARBITRARY_HTML_FILE, > GTK_WIN_POS_MOUSE, > FALSE, TRUE, FALSE, > > "OK", check_ok_callback, > NULL, NULL, NULL, TRUE, FALSE, > "Cancel", gtk_widget_destroy, > NULL, 1, NULL, FALSE, TRUE, > > NULL); > > frame = gtk_frame_new ("Greeting"); > gtk_frame_set_shadow_type (GTK_FRAME (frame), > GTK_SHADOW_ETCHED_IN); > gtk_container_set_border_width (GTK_CONTAINER(frame), 6); > gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dlg)->vbox), frame, TRUE, > TRUE, 0); > gtk_widget_show(frame); > > greeting = gtk_entry_new (); > gtk_entry_set_text( GTK_ENTRY(greeting),"Hello, world!"); > gtk_entry_set_editable( GTK_ENTRY(greeting), FALSE); >
Plug-in problems
Hi all, I'm trying to write a plug-in for the gimp, but I'm having a few problems. I think at this stage it's pretty bare-bones, pretty much a hello world plug-in. Anyway, my plug-in is detected at start-up by the Gimp, and registers with the PDB etc - so I suspect that my query function is OK. When it's forked again to run, I get in a bit of trouble. On 1.1.28, it just barf about the internal failure of the plug-in, and how that could cause transmogrification of good, unsaved data. On 1.1.24, the widget (a dialog) displays, but it, and the gimp, disappear when I click on it... I did a stack-trace on teh core, and it looks like I got into an infinite loop with _dl_runtime_resolve and __restore calling each other a few hundred times, when gimp_ui_init starts up, until the process ran out of memory. Anyway, I was wondering if someone would have a quick perusal and point me in the direction of my stupidity. Or point me to a "hello, world!" gimp plug-in, or point me in the direction of references I might find useful, other than "Writing a GIMP Plug-in" by Kevin Turner, which is what I have been working out of so far. Just in case the problem is actually in the query function (in gimp_install_procedure, maybe?) I have included that. In fact, the only stuff I haven't included are header includes and global vars (of which there is only one, PLUG_IN_INFO). I realise this is kind of long, especially for a first post, but I hope you'll give me a bit of lattitude. Thanks a lot, Dave Neary. -- Dave Neary, Software engineer, Informix Dublin. Ireland. Phone: +353-1-409-1357 ** Code segment starts here *** /* query() function. Sets up type of plug-in in the PDB. */ static void query(void) { /* We want to define the arguments this will take, * and what it will return - eventually this will include more * complicated stuff, for now it accepts the defaults, and returns * SUCCESS */ static GimpParamDef args[]= { { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" }, { GIMP_PDB_IMAGE, "image_id", "(unused)" }, { GIMP_PDB_DRAWABLE, "drawable_id", "Input drawable" }, }; static gint nargs = sizeof (args) / sizeof (args[0]); /* We need to register the module - we do this with * gimp_install_procedure. */ gimp_install_procedure("plug_in_hello", "Prints a message", "For no good reason this plug-in only accepts greyscale images", "David Neary ([EMAIL PROTECTED])", "David Neary ([EMAIL PROTECTED])", "2000", "/Filters/Render/Pattern/Hello", "GRAY", GIMP_PLUGIN, nargs,0, args,NULL); } static void run(gchar *name, gint nparams, GimpParam *param, gint*nreturn_vals, GimpParam **return_vals) { /* We'll add a couple of widgets and show them (a dialog titled * Hello, world! or something equally original should do) */ GtkWidget *dlg; GtkWidget *frame; GtkWidget *greeting; GimpPDBStatusType status = GIMP_PDB_SUCCESS; *nreturn_vals=1; (*return_vals)->type = GIMP_PDB_STATUS; ((*return_vals)->data).d_status = status; gimp_ui_init ("hello", FALSE); dlg = gimp_dialog_new ("Hello, world!", "hello", gimp_standard_help_func, MY_ARBITRARY_HTML_FILE, GTK_WIN_POS_MOUSE, FALSE, TRUE, FALSE, "OK", check_ok_callback, NULL, NULL, NULL, TRUE, FALSE, "Cancel", gtk_widget_destroy, NULL, 1, NULL, FALSE, TRUE, NULL); frame = gtk_frame_new ("Greeting"); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); gtk_container_set_border_width (GTK_CONTAINER(frame), 6); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dlg)->vbox), frame, TRUE, TRUE, 0); gtk_widget_show(frame); greeting = gtk_entry_new (); gtk_entry_set_text( GTK_ENTRY(greeting),"Hello, world!"); gtk_entry_set_editable( GTK_ENTRY(greeting), FALSE); gtk_container_add(GTK_CONTAINER(frame), greeting); gtk_widget_show(greeting); gtk_widget_show(dlg); gtk_main (); gdk_flush (); return; } /* Callback function for when the OK button is clicked. */ void check_ok_callback(GtkWidget *button, GtkWidget *entry) { gchar *entry_text; entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); printf("Entry contents: %s\n", entry_text); return; }
Re: print plug-in problems
Date: Sun, 20 Feb 2000 15:04:42 -0500 From: Robert L Krawitz <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] From: "Michael J. Hammel" <[EMAIL PROTECTED]> Date: Sun, 20 Feb 2000 11:56:17 -0700 (MST) I loaded the 1.1.17 release the other day and today I did a print job. All I get is a solid black output. I'm using an Epson Stylus Color 500 and the printer worked fine in 1.1.15 (I didn't try 1.1.16). Rob: if you need more info, let me know. Actually, the fact that it worked in 1.1.15 may be enough information...that already had one of my versions of the plugin. I'll let you know if I need more. I would like the two print files...nothing really jumps out at me. -- Robert Krawitz <[EMAIL PROTECTED]> http://www.tiac.net/users/rlk/ Tall Clubs International -- http://www.tall.org/ or 1-888-IM-TALL-2 Member of the League for Programming Freedom -- mail [EMAIL PROTECTED] Project lead for The Gimp Print -- http://gimp-print.sourceforge.net "Linux doesn't dictate how I work, I dictate how Linux works." --Eric Crampton
Re: print plug-in problems
From: "Michael J. Hammel" <[EMAIL PROTECTED]> Date: Sun, 20 Feb 2000 11:56:17 -0700 (MST) I loaded the 1.1.17 release the other day and today I did a print job. All I get is a solid black output. I'm using an Epson Stylus Color 500 and the printer worked fine in 1.1.15 (I didn't try 1.1.16). Rob: if you need more info, let me know. Actually, the fact that it worked in 1.1.15 may be enough information...that already had one of my versions of the plugin. I'll let you know if I need more.
Re: print plug-in problems
From: "Michael J. Hammel" <[EMAIL PROTECTED]> Date: Sun, 20 Feb 2000 11:56:17 -0700 (MST) I loaded the 1.1.17 release the other day and today I did a print job. All I get is a solid black output. I'm using an Epson Stylus Color 500 and the printer worked fine in 1.1.15 (I didn't try 1.1.16). Rob: if you need more info, let me know. BTW, what print mode were you using (360, 720 microweave, 720 softweave...)? I assume 720 microweave since that's what the other person who reported all-black output was using. If you want to try 3.1, you can get the CVS tree from sourceforge.net. There are differences, and it's possible that you'll get different results (that would be helpful in terms of back porting whatever makes the difference). Don't feel obligated to, though -- generating print files from 1.1.15 and 1.1.17 would be helpful. -- Robert Krawitz <[EMAIL PROTECTED]> http://www.tiac.net/users/rlk/ Tall Clubs International -- http://www.tall.org/ or 1-888-IM-TALL-2 Member of the League for Programming Freedom -- mail [EMAIL PROTECTED] Project lead for The Gimp Print -- http://gimp-print.sourceforge.net "Linux doesn't dictate how I work, I dictate how Linux works." --Eric Crampton
Re: print plug-in problems
From: "Michael J. Hammel" <[EMAIL PROTECTED]> Date: Sun, 20 Feb 2000 11:56:17 -0700 (MST) I loaded the 1.1.17 release the other day and today I did a print job. All I get is a solid black output. I'm using an Epson Stylus Color 500 and the printer worked fine in 1.1.15 (I didn't try 1.1.16). Rob: if you need more info, let me know. I've heard of similar things with the 800 in microweave mode, so there does seem to be a problem. It would be very interesting to know if it worked in 1.1.16, since that had an intermediate version of the code. What you could do to help me is to print out something small to a file in both 1.1.15 and 1.1.17 and send me a URL (or, in a pinch, a mail message) with the contents of both output files. Then it should be easy to track down. -- Robert Krawitz <[EMAIL PROTECTED]> http://www.tiac.net/users/rlk/ Tall Clubs International -- http://www.tall.org/ or 1-888-IM-TALL-2 Member of the League for Programming Freedom -- mail [EMAIL PROTECTED] Project lead for The Gimp Print -- http://gimp-print.sourceforge.net "Linux doesn't dictate how I work, I dictate how Linux works." --Eric Crampton
print plug-in problems
I loaded the 1.1.17 release the other day and today I did a print job. All I get is a solid black output. I'm using an Epson Stylus Color 500 and the printer worked fine in 1.1.15 (I didn't try 1.1.16). Rob: if you need more info, let me know. -- Michael J. Hammel | The Graphics Muse | If you can't be kind, at least have the decency [EMAIL PROTECTED] | to be vague. http://www.graphics-muse.com