BBC BASIC for Windows
« Utilities »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:35pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1 2 3  Notify Send Topic Print
 veryhotthread  Author  Topic: Utilities  (Read 3910 times)
Malcolm
Guest
xx Utilities
« Thread started on: Mar 4th, 2009, 3:13pm »

The reading of the lines from the IDE looked quite simple in the skeleton utility. To write back a modified line would you use the selection (from message 1041) and do a EM_REPLACESEL or is it more complicated?

I was thinking about writing simple Concatenation : Expand formatting and perhaps REM removal kind of operations.

I did not understand the significance of PROC0 but I know you don't do things arbitrarily so it must be important. What is it doing?

Regards, Malcolm.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Utilities
« Reply #1 on: Mar 4th, 2009, 4:02pm »

Quote:
The reading of the lines from the IDE looked quite simple in the skeleton utility.

Er, what "skeleton utility"? Nobody has asked me for the source code yet; I'm expecting a request for it from Michael Hutton at any moment, but nothing received so far. You're welcome to a copy if you have an application in mind.

Quote:
To write back a modified line would you use the selection (from message 1041) and do a EM_REPLACESEL or is it more complicated?

Bear in mind that the BB4W program editor isn't a Windows edit control; it doesn't (in general) respond to EM_ messages, and those few it does respond to often don't work the way you might expect (since BB4W both sends and receives the messages, they are treated as 'private' messages, with custom content, even if they 'borrow' official Windows message numbers).

The 'check quotes' demo utility doesn't need to modify the contents of the edit buffer, but I could in principle generate one that illustrates how to do that. However, actually changing the user's program obviously has ramifications that a 'read only' utility doesn't (should it save the original program, should it change the file name, that sort of thing) so it would require a lot of careful thought.

Quote:
I was thinking about writing simple Concatenation : Expand formatting and perhaps REM removal kind of operations.

Surely 'concatenation' and 'REM removal' are operations that you would want to do as part of the compilation process, rather than to the 'source code'? The last thing I would want is for people to make their programs less readable! If somebody really has a reason to do something like that (and I can't think of one) the way to do it is to extract the output from BB4W's built-in cruncher.

Incidentally I am hoping that Mohsen may want to implement his advanced cruncher (StrongBS) as an 'add on' utility for BB4W. There's not much it can't do, judging by the description of the RISC OS version!

Richard.
User IP Logged

Malcolm
Guest
xx Re: Utilities
« Reply #2 on: Mar 4th, 2009, 5:02pm »

We most likely have different ways of going about things, but I write programs first as a series of REMs that describe the logic. Then I fill in the function of that logic with actual code. And within that code I add REM's that describe the things, sub routines, that I have still to code.

What I typically do is put something like a couple of ** into those todo's. I also use the *| REM's to have reminder notes in the code so that I don't get lost quite so often. Then later I go and take them out. It would be nice to do that automatically. Similarly I have had many occasion to take someone elses listing and spread out the multi statement lines so that I can see the indenting. Again that would be a nice automatic function.

Sure it can be done with scanning files and rewriting to a new one. The IDE utilities route seems to be neater.

So I am formally asking whether you would provide the information to allow me to do that.

Malcolm.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Utilities
« Reply #3 on: Mar 4th, 2009, 9:37pm »

Quote:
Then later I go and take them out. It would be nice to do that automatically.

If you use 'regular' REMs, can't you simply use the 'Add REMs' and 'Remove REMs' options already available in the context menu?

Quote:
So I am formally asking whether you would provide the information to allow me to do that.

I'll send you the source of the 'check quotes' utility. As for modifying the contents of the edit buffer from an 'addon' utility, having thought about it I'm not sure there's a satisfactory way of achieving that. Internal to BB4W everything relies on the memory being shared, so I don't have to bother with the 'marshalling' needed to copy strings from one process to another. You possibly could do it by simulating user input (WM_CHAR message), but it would be messy.

Richard.
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: Utilities
« Reply #4 on: Mar 5th, 2009, 01:29am »

Quote:
I'm expecting a request for it from Michael Hutton


Hello. Sorry, up in Queensland at the moment only intermittanly getting to a computer. I have just downloaded the checkquote.exe. I need to go back and see what it does although I can imagine that it checks quotes!

I am working on the principle (after reading this thread) that I can get a program from the IDE line by line using windows messages. This should be easy to add to a utility once it is up an going.

In the meantime I need to fully get to grips with the Varlist207.. which I am doing at present.

My main idea is to get it into a 'decent' GUI such as a listview etc but I would *really* welcome any suggestions on what people would like to see and how people would like to see it. On this note I will start a new thread... Varlist Utitlity here in the IDE section.

On requesting the skeleton code I will email.

Michael
« Last Edit: Mar 5th, 2009, 01:31am by Michael Hutton » User IP Logged

Malcolm
Guest
xx Re: Utilities
« Reply #5 on: Mar 5th, 2009, 03:29am »


Quote:
As for modifying the contents of the edit buffer from an 'addon' utility, having thought about it I'm not sure there's a satisfactory way of achieving that.


So we may as well extract from the IDE, process to a .bbc or .bas and read that back in.

Can the save and read back be remotely triggered? Actually it might be easier just to fire up another copy of the IDE using the file associations.

Malcolm.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Utilities
« Reply #6 on: Mar 5th, 2009, 08:38am »

Quote:
Can the save and read back be remotely triggered?

Goes away to check the BB4W source code....

You could trigger a Save As... operation, but that unavoidably prompts the user for the location and filename, which I guess isn't what you would want. It also changes the 'current' filename to what it has been saved as, which isn't useful.

There's no way of activating the actual 'file write' code in BB4W because that's a straightforward C function call within the IDE; it isn't triggered by a Windows message.

Your best bet may be to read the entire program using the technique in checkquotes.exe and save it yourself. However that might be a little slow for very long programs.

Richard.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Utilities
« Reply #7 on: Mar 5th, 2009, 09:10am »

Quote:
To write back a modified line would you... do a EM_REPLACESEL

Actually that might work, because Windows should do the marshalling for you (since EM_REPLACESEL is a standard message). However you would need to take account of the ways in which the BB4W editor's implementation of EM_REPLACESEL is non-standard:
    * The message is ignored if there isn't a current selection. This differs from the standard behaviour, which is to insert the string at the caret, and unfortunately makes it difficult to insert new text.

    * The wParam value is ignored.
An alternative approach would be to put the replacement text on the clipboard, and send a WM_PASTE message. That allows both replacement and insertion (although not deletion) but of course has the disadvantage of destroying the existing clipboard contents.

Richard.
User IP Logged

Malcolm
Guest
xx Re: Utilities
« Reply #8 on: Mar 5th, 2009, 5:21pm »

Quote:
Actually that might work, because Windows should do the marshalling for you (since EM_REPLACESEL is a standard message).


I can confirm that it does! That's quite useful.

Malcolm.
User IP Logged

Malcolm
Guest
xx Re: Utilities
« Reply #9 on: Mar 7th, 2009, 2:26pm »

Utility Programs that are supplied as an executable cause a warning when used about being unsigned. That stops it from being used 'seamlessly' from the menu. It shows that an .exe is being called and requires authorization in some form.

Is there a way around this other than the authors getting a digital signature , local compilation, or switching the PC security to a low level which may not be within the user's control.

Malcolm.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Utilities
« Reply #10 on: Mar 7th, 2009, 5:28pm »

Quote:
Utility Programs that are supplied as an executable cause a warning when used about being unsigned.

Under normal circumstances you only get a warning about an executable being 'unsigned' if you run it from a web site. I've never seen that warning when executing a file locally on my PC, nor would I expect to.

The 'addon utility' feature in BB4W uses the regular ShellExecute API, so if that is resulting in the warning it's going to affect a great deal more than just BBC BASIC!

Are you sure this isn't a side-effect of a virus scanner or something similar?
User IP Logged

Malcolm
Guest
xx Re: Utilities
« Reply #11 on: Mar 7th, 2009, 6:18pm »

You are possible right that it is the virus checker or one of the other security programs that causes this. It certainly looks like a windows warning though. It links to IE and the following text.

Quote:
Should you open files from the Internet or e-mail that you have saved to your computer?
It depends. You should take a few precautions before opening a file that you saved from the Internet or received as an e-mail attachment. If the file is a program or computer code, such as an .exe file, Windows will display a message to alert you that the file could be harmful to your computer. If this happens, ask these questions before you open the file:

Have you scanned the file for viruses?

You should scan all files you download with an up-to-date antivirus program before you open them.

If you do not have antivirus software installed, you should purchase and install an up-to-date antivirus program to help protect your computer. For a list of antivirus programs, see the Microsoft Antivirus Partners (http://www.microsoft.com/security/partners/antivirus.asp) website. If you have already installed antivirus software, make sure that it is up to date and actively scanning the files on your computer. Viruses are released on an almost daily basis, so keeping your antivirus program current is important.

Do you know who created the file?

If you choose to save or open the file, Windows will check the file for a digital signature. A valid digital signature helps to tell you the identity of the publisher (the company, website, or individual distributing the file) and whether the file has been tampered with since it was signed.

If the file has no valid digital signature, you cannot be certain that the file is actually from the source it claims to be from, or that it has not been tampered with. Avoid opening the file unless you have scanned it for viruses and know that the contents are safe.

Do you know what the file will do to your computer?

The publisher of the file should have provided information explaining what this file is for and any special details you need to know about the file to open it. Be sure to read any terms of use or license agreements, and look for anything you don't agree with, such as having to accept unsolicited advertising, or that the program sends information back to the publisher. If this information is not available, you should be cautious about running the file.


Running an executable direct from a web page isn't even an option. I have to download any .exe file to the local machine first. Then I have to 'accept' at this warning. And yes, it affects not only BB4W. Programs that are installed are obviously checked somehow and don't generate the warning, only downloads do.
.exe Attachments to mail are rejected outright.

I guess security here is tight.

Malcolm.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Utilities
« Reply #12 on: Mar 7th, 2009, 10:25pm »

Quote:
You are possible right that it is the virus checker or one of the other security programs that causes this.

I have often found that virus scanners, despite their obvious value, cause unwanted and annoying side-effects (sometimes genuinely in the interests of 'security', sometimes by mistake). Here I use AVG, which not only gets high ratings in comparisons of security products but also seems to be exceptionally free from such side-effects:

http://www.avg.com/

There's a free version (for private use only):

http://www.avg.com/product-avg-anti-virus-free-edition

Richard.
User IP Logged

Malcolm
Guest
xx Re: Utilities
« Reply #13 on: Mar 22nd, 2009, 2:53pm »

Thanks, Richard,

Sorry I only just noticed your last post. I actually use AVG so it must be the Windows security level that is at issue.
AVG scanner does mask many of the Icons in the system tray on start up, although this is seen as a Windows 'feature'.

User IP Logged

Malcolm
Guest
xx Re: Utilities
« Reply #14 on: Apr 1st, 2009, 2:04pm »

Quote:
Actually that might work, because Windows should do the marshalling for you (since EM_REPLACESEL is a standard message).


One issue that arises is that the screen updates after the replacement as you would expect. I found that doing a large number of replacemnts on a long program causes the program to scroll after each insert as well. This overwhelmed my system. I think the WM_PAINT messages backed up to the point that Windows failed to cope. It caused a black screen and a slow recovery and very slow graphics afterwards or even a Blue screen of death.
Using WM_SETREDRAW message to suppress the redraw to a sensible rate or switching it off temporarily solves the problem. Is there a way to set the IDE's mouse pointer to a busy Icon while it is being manipulated from outside. Setting a messagebox on top of the IDE seemed a bit clumsy.

Malcolm.
User IP Logged

Pages: 1 2 3  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls