Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


On 29/05/13 15:47, Noel Power wrote:
But... lets talk about this maybe tomorrow, we should meet up in anycase to just even say hello. I will try to write some very rough ideas of where to start with this, we can then discuss that in some more detail
Ok so...

first think I would try to do is modify the compiler to accept a statement like

Dim aVariable as SomeType

Actually this is not so hard to do, the vba support already allows this ( to a certain extent )

e.g. if you open a calc document, create a module in the document basic and insert

Option VBASupport 1

Sub Test
Dim aRange as Range
End

basic will happily accept that ( and compile without errors )

Best way to find out where that is handled is to do try the same code without the 'Option VBASupport 1' and trace back compile error ( slap a breakpoint in StarBASIC::CError and work back )

From there you should be able to work out ( hopefully ) some place in the compiler where there will be some

if ( bVBA )
{
   // don't complain about Dim as SomeType
}

for the above ( if you have trouble tracking it down let me know )

You will need to conditionalize the same thing for experimental mode ( remember on IRC we discussed we need to limit the new functionality to only run when the experimental features are enabled ) see SvtMiscOptions ( it has some method for telling if experimental mode is enabled or not )


One you have that sorted then hopefully I think the next step is to tweak the IDE so that you know what 'variables' have been declared via

'Dim aVariable as SomeType'
'Dim anotherVariable as SomeOtherType'

in the current procedure. You need to search around basctl for a suitable place to do that, I am pretty sure that the IDE already does a cheap and nasty parse of the source code each time that you type in the module window ( iirc it does this to update the list of procedures ( SbMethods ) that it is using ) I am hoping that in there you can do something similar to build a cache of the variable names -> variable types.

The next step would be again to hook into where the source is been updated ( when you type ) there must be some eventhandler doing that ( again you will need to search in the IDE code in basctl for that ) What I would like to see there is some code that detects a '.' being typed following one of the already identified variables. For the moment if you can just detect this scenario and when the '.' is typed and just dump ( all ) the methods ( to stdout/screen e.g. printf or whatever trace macros people use ) , then detect the following keystrokes and try and again dump to the terminal the best matches for the method. If you can get to this point then I think it is time to start looking at introducing a comboxbox to popup etc.

anyway the initial steps above I think are enough to start with and get you going

I think you already have a good idea of where we want to get to, anyway I gave a talk last year about this stuff, there is some highlevel detail and mockup etc. to be found in slides 18-22 in http://conference.libreoffice.org/talks/content/sessions/049/files/basicidewhatsnewandmightbenewlater.pdf ( and also there are some other ideas in there if this task proves to be too easy ( which it might do ) so don't worry, you won't run out of things to implement


thanks

Noel

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.