Author Topic: is the plugin mechanism useable in 25.0.2  (Read 3406 times)

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: is the plugin mechanism useable in 25.0.2
« Reply #15 on: June 28, 2021, 11:40:44 PM »
I tried making the bitmap path a normal pathname but it didn't help.


// xretrace_plugin.sh is copied to xretrace.sh when packaging the xretrace plugin
#define XRETRACE_IS_PLUGIN yes

//#define XRETRACE_PATH "plugin://user_graeme_nz.xretrace/"

#define XRETRACE_PATH _ConfigPath() :+ "/plugins/user_graeme_nz.xretrace/"

#define XRETRACE_BITMAPS_PATH  XRETRACE_PATH :+ "bitmaps" :+ FILESEP


patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: is the plugin mechanism useable in 25.0.2
« Reply #16 on: June 29, 2021, 07:29:24 PM »
Ok, I do see this with the plugin you posted, with a clean config.  I'll quit SlickEdit, restart, and I don't see the bitmaps in the gutter.  Showing the xretrace options shows everything I selected is still selected.  Loading the module makes the bitmaps appear for that session, till I quit again.  And I get the say() output, so I know the init function is being called.

I'll see if I can trace why this is happening. 

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: is the plugin mechanism useable in 25.0.2
« Reply #17 on: June 30, 2021, 03:56:18 AM »
I've tried fiddling with the definit and on-load-module code to see if I can see what is the difference between a manual load and a restart - but I got nowhere.  If I comment out some of the code, a manual load still makes the bitmaps work.  I did notice that after a manual load, on the next restart, the bitmaps work but not on the restart after that.

I've found another way to get the bitmaps working is to disable xretrace (using the config dialog), then restart xretrace by running the xretrace-cursor-steps command.  - it calls init-xretrace.  So it seems that init-xretrace works sometimes and sometimes not.  I  don't normally have bitmaps showing so I can't really tell whether this problem is because it's a plugin or because it sometimes happens anyway.  In my "normal" 25.0.2 config the bitmaps always appear so far.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: is the plugin mechanism useable in 25.0.2
« Reply #18 on: July 01, 2021, 02:52:46 PM »
I don't think you can do anything that isn't extremely hacky to work around this.  I've gotten far enough to see that it is specific to the plugin loading process, and that your image indexes are getting removed after your init.  So we're closing in on what the problem is. 

And I do see the behavior you mention of it working once after a reload - it looks like in this case xretrace.e is getting loaded outside of the plugin loads.  I haven't looked closely as to why this is yet,  but I suspect it's something outside of the plugin system deciding it needs a reload.   Something to look at after the main load problem is fixed.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: is the plugin mechanism useable in 25.0.2
« Reply #19 on: July 01, 2021, 07:35:44 PM »
Found the problem.  I'll put the fix in for the next hotfix.  In the meantime,  you can load the attached copy of cfg.e to get the fix.


patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: is the plugin mechanism useable in 25.0.2
« Reply #20 on: July 01, 2021, 07:39:03 PM »
Ack, attached the wrong version.  Load the cfg.e in this post to get the fix.

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: is the plugin mechanism useable in 25.0.2
« Reply #21 on: July 22, 2021, 11:52:22 AM »
My xretrace macro needs the source files to be loaded in a certain order.  Currently I get a slick stack when trying to install the plugin because definit in xretrace.e tries to call a function that doesn't exist.  I had to use task manager to kill slickedit.  Is there any way to handle this?

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: is the plugin mechanism useable in 25.0.2
« Reply #22 on: July 23, 2021, 11:50:03 AM »
I'm trying to work around this problem by loading the missing macro file from xretrace def_init if find_index doesn't find a particular function - dlist_construct   - but find_index says the function is in the names table but when I call the function, I get a slick stack.  Is it possible that a #import adds names to the names table and makes find_index return non zero even though the module containing dlist_construct hasn't been loaded yet?

Code: [Select]
   int vv1 = find_index('dlist_construct', PROC_TYPE);
   say("ggg " :+ vv1);

- the code above gives me 33104 but calling dlist_construct crashes.
 
For the plugin version of xretrace, I will probably have to load DLinkList.e from xretrace.e def_init every time xretrace.e is loaded.  It seems to work.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: is the plugin mechanism useable in 25.0.2
« Reply #23 on: July 23, 2021, 02:10:30 PM »
How did you create your plug-in? If you just zip up your files, you can’t rely on order of macro loading. You have to use the plug-in creation commands. If I remember correctly the manifest (written by plug-in creation commands) specifies the macro load order and is generated automatically.

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: is the plugin mechanism useable in 25.0.2
« Reply #24 on: July 23, 2021, 10:17:31 PM »
Yes, I just zipped it.  I didn't know there was a plugin creator.  I'll give it a try.  Thanks.