#1 2016-06-08 22:21

bdpq
Member
Registered: 2015-11-05
Posts: 7

Pascalscript - include external procedure or function library?

Hi,

I have been using the wonderful renamer for about 4 years, and over the years I have written quite a few pascalscrips that share functions and procedures.  Most of these "library" functions and procedures do not change overtime but when a change is necessary, it is quite a bit of work to update every instance of them in all the scripts that use these shared scripts.

Would it be possible in a future version of renamer to have a library inclusion feature that would call external functions or procedures in a form of a *.inc file so that the shared library functions and procedures can be managed efficiently?

This would be a great feature for us script-addicts. smile 

Thank you!

Last edited by bdpq (2016-06-08 23:31)

Offline

#2 2016-06-09 18:05

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Pascalscript - include external procedure or function library?

I had the same issue. You can save the functions/procedures as code snippets instead of complete scripts, then insert them inline wherever required using Shift as mentioned in my suggestion thread.

Of course it's not quite the same as loading from external files, so even if you edit the snippet it'll not affect scripts where the snippet has been included already.

Last edited by Andrew (2016-06-09 18:08)

Offline

#3 2016-06-09 23:37

bdpq
Member
Registered: 2015-11-05
Posts: 7

Re: Pascalscript - include external procedure or function library?

Thank you for your reply and indeed I also use code snippets as well.

My current solution is actually using dreamweaver to edit the .pas file, as it has a pretty good code snippet management capability.  Whenever I update the code snippets, I use dreamweaver to change all the instances of the shared code in the \script directory as well.  It works, but still rather cumbersome.  A solution that include the code libraries in or before runtime would be optimal.

Offline

#4 2016-06-10 08:56

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Pascalscript - include external procedure or function library?

There is a possibility of using the include directive, i.e. "{$I filename.inc}".

I'll investigate this after the upcoming release.

Offline

#5 2016-06-12 21:28

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Pascalscript - include external procedure or function library?

Handling of the include directive was implemented in v6.5.0.1 Beta.

You can use {$I filename.pas} or {$INCLUDE 'my script.pas'} syntax.

The specified filename can contain directory names and will be resolved relative to the Scripts directory.

Offline

#6 2016-06-13 14:34

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Pascalscript - include external procedure or function library?

den4b wrote:

The specified filename can contain directory names and will be resolved relative to the Scripts directory.

So we can't include scripts stored on a different partition? Would it be possible to treat the path as an absolute one if it begins with "Letter:", and only otherwise treat it as relative to the Scripts directory?

Edit: Did a little bit of testing and here are my observations so far:

1) Did you mean to include Scripts\Include\TEST.inc in the download package? No included script uses it so maybe it was left over from your testing? On the other hand, perhaps one of the scripts in the package such as "User defined functions.pas" can be modified to use an include file instead.

2) The error message displayed if an include file isn't found is: Unable to find file 'include\test.inc' used from ''

First, it would read better if the message was Unable to find file 'include\test.inc' in ''

Second, the path at the end where the include file is expected to be found is always empty. Either the path should be mentioned (in which case if it is extremely long then it might get truncated which would be bad), or the error message can simply be Unable to find file 'include\test.inc'

3) A significant bug has been introduced in the PascalScript editor. After compiling a script, after the compile success or failure dialog is displayed, pressing OK causes text in the editor to be deleted to the right of the cursor.

Last edited by Andrew (2016-06-13 16:44)

Offline

#7 2016-06-13 21:36

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Pascalscript - include external procedure or function library?

So we can't include scripts stored on a different partition? Would it be possible to treat the path as an absolute one if it begins with "Letter:", and only otherwise treat it as relative to the Scripts directory?

I am glad to hear this question, because this is exactly what is planned. The idea was to release the most basic version of the script inclusion concept as soon as possible, and later build on it.

Did you mean to include Scripts\Include\TEST.inc in the download package?

No, that sneaked in from the testing.

perhaps one of the scripts in the package such as "User defined functions.pas" can be modified to use an include file instead.

Good thinking.

Unable to find file 'include\test.inc' used from ''

It's a 3rd party message. It was designed to fit a concept of files, where "used from" is meant to be the filename of the script where the inclusion was used. This can be changed however, to better fit ReNamer's framework.

A significant bug has been introduced in the PascalScript editor. After compiling a script, after the compile success or failure dialog is displayed, pressing OK causes text in the editor to be deleted to the right of the cursor.

I'm guessing that you have used the Ctrl+T shortcut? It conflicts with the shortcut used by the editor component, it deletes the current word at the cursor position. This will be fixed.

Offline

#8 2016-06-14 00:05

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Pascalscript - include external procedure or function library?

Yep, I did use Ctrl+T. smile Is there a full list of shortcuts used by the editor component? Having one for deleting the current word seems like it might be useful, although I'd probably use one that deletes the current line a lot more.

Looking forward to future releases with a more powerful version of the include feature.

Offline

#9 2016-06-20 09:36

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Pascalscript - include external procedure or function library?

Andrew wrote:

Is there a full list of shortcuts used by the editor component?

The list of default shortcuts is not available officially.

I'd probably use one that deletes the current line a lot more.

Ctrl+Y deletes the current line.

Here is a snapshot of currently available keystrokes:

renamer-synedit-keystrokes.png

P.S. Added as a feature request with a low priority.

Offline

#10 2016-06-22 17:11

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Pascalscript - include external procedure or function library?

All points raised above were addressed in v6.5.0.2 Beta.

Offline

Board footer

Powered by FluxBB