Archive for the ‘CodeGear’ Category

Castalia 2010.3

Posted on September 2nd, 2010 in Castalia, CodeGear, Delphi, TwoDesk | No Comments »

http://www.twodesk.com/castalia
I’m pleased to announce the release of Castalia 2010.3, the newest version of the popular Delphi IDE tools package.
Castalia 2010.3 adds support for Delphi/RAD Studio XE, as well as some other minor bug fixes and enhancements. If you haven’t tried Castalia yet, now is a great time to try!
With Castalia, you can:
* Navigate through code faster
* Understand code better
* Quickly and easily refactor your code to improve its design
* Streamline your coding so you get more done
* Find errors in your code before the compiler does
* Analyze your code to find sections that will be hardest to maintain
* …And more!
Current subscribers can download the latest release at http://subscribe.twodesk.com. Everyone else should try a free trial at http://www.twodesk.com/castalia/download.html
–Jacob

http://www.twodesk.com/castalia

I’m pleased to announce the release of Castalia 2010.3, the newest version of the popular Delphi IDE tools package.

Castalia 2010.3 adds support for Delphi/RAD Studio XE, as well as some other minor bug fixes and enhancements. If you haven’t tried Castalia yet, now is a great time to try!

With Castalia, you can:

  • Navigate through code faster
  • Understand code better
  • Quickly and easily refactor your code to improve its design
  • Streamline your coding so you get more done
  • Find errors in your code before the compiler does
  • Analyze your code to find sections that will be hardest to maintain
  • …And more!

Current subscribers can download the latest release at http://subscribe.twodesk.com. Everyone else should try a free trial at http://www.twodesk.com/castalia/download.html.

–Jacob

Castalia 2010.2.1 released

Posted on July 7th, 2010 in Castalia, CodeGear, Delphi, TwoDesk | No Comments »

Castalia 2010.2.1 is now available. This release includes three important fixes:

* Error message appears when double-clicking a line in the code analysis report
* Certain rare situations can cause the parser thread to lock up, causing 100% CPU usage and preventing the navigation toolbar from updating
* Incorrect syntax evaluation for class helpers

Current subscribers can get it at http://subscribe.twodesk.com. Everyone else can download a free trial at http://www.twodesk.com/castalia

Castalia 2009.3 is available.

Posted on August 31st, 2009 in Business, Castalia, CodeGear, Delphi, TwoDesk | No Comments »

Castalia 2009.3 is now available. The big deal here is Delphi 2010
support, but I’ve also added a few more “smart keys” that are available
in every edition:

* Smart Parenthesis: Highlight some text and press the ‘(’ key, and the
text will be surrounded with parenthesis.

* Smart Brackets: Highlight some text and press the ‘[’ key, and the
text will be surrounded with brackets.

* Smart Braces: Highlight some text and press the ‘{’ key, and the text
will be surrounded with braces.

As always, customers with current subscriptions can get it from the
customer service site at http://subscribe.twodesk.com.  Everyone else
can try a free trial at http://www.twodesk.com/castalia/download.html.

More information about Castalia is available at http://www.twodesk.com/castalia

–Jacob

Released: Castalia 2009.2.1

Posted on August 12th, 2009 in Business, Castalia, CodeGear, Delphi, TwoDesk | No Comments »

Castalia 2009.2.1 is now available. This update fixes a critical defect where switching desktop presets or running a project could cause the IDE to crash.

Users with a current subscription can get it at http://subscribe.twodesk.com, everyone else can try it free for 30 days at http://www.twodesk.com/castalia/download.html.

This one has taken a long time to figure out, and special thanks to a couple of dedicated customers who did some extra testing and helped me narrow it down.

Just released: Castalia 2009.2

Posted on June 24th, 2009 in Business, Castalia, CodeGear, Delphi, TwoDesk | 2 Comments »

I’m very excited to announce the latest version of Castalia, the ultimate tool for Delphi developers.

The major focus of Castalia 2009.2 has been improving the parser and adding support for many language features that have been added to Delphi in recent years. I’m very happy to say that the Castalia Delphi parser is now fully up-to-date.

In addition, Castalia 2009.2 includes the following improvements over the previous version:

* Fixed: “Index Out of Bounds” error during some context switches
* Fixed: Some Castalia features not available after line 30768 in the code editor
* Fixed: Access violation when firing a code template with an empty scope

Castalia users with a current maintenance subscription can download version 2009.2 today at http://subscribe.twodesk.com.

Everyone else can grab the free trial at http://www.twodesk.com/castalia.

Castalia 2009.1 is now available.

Posted on April 23rd, 2009 in Castalia, CodeGear, Delphi, TwoDesk | No Comments »

If you have a current subscription, you can get Castalia 2009.1 at http://subscribe.twodesk.com.  Everyone else should give the free trial a run (http://www.twodesk.com/castalia).

Here’s what’s new:

* New: “Modeless” “Add Parameter” refactoring
* Improved code formatting for “Remove Unused Variables” refactoring
* New: “CurrentLine” function in code template scripting
* Fixed: Unicode characters in identifiers can cause memory leaks in Delphi 2009.
* Fixed: Improper cursor movement after some text searches
* Fixed: <Esc> key closes Code Insight *AND* pops a bookmark off the stack if Code Insight is invoked when there are bookmarks on the stack.

Enjoy!

–Jacob

Released: Castalia 2008.4.1

Posted on December 30th, 2008 in Castalia, CodeGear, Delphi, TwoDesk | 2 Comments »

Castalia 2008.4.1 is now available.

Current customers can download from http://subscribe.twodesk.com

Everyone else can get the free trial at http://www.twodesk.com/castalia/

This release is entirely a bugfix release.  The following issues have been addressed:

  •  Fixed: Access violations when pressing F3 after using modeless text search
  •  Fixed: ‘Clipboard’ function not recognized in code templates
  •  Fixed: Clipboard insertions incorrectly translated to new code template format
  •  Fixed: Some hotkey pickers don’t display properly in D2005, D2006, D2007, or D2009
  •  Fixed: Code template indenting stuck at 2 spaces
  •  Fixed: Library precompiler activates at the wrong time under some circumstances
  •  Fixed: Delphi 2009 hangs at the splash screen under some circumstances
  •  Fixed: Incorrectly identified syntax error when using parameterized types with multiple parameters

Released: Castalia 2008.4

Posted on December 10th, 2008 in Castalia, CodeGear, Delphi, TwoDesk | 7 Comments »

I just uploaded release and trial binaries for Castalia 2008.4.  This is the biggest Castalia release in quite a while, with the huge changes to the code templates and other things.  Here’s what’s new:

  • New code template engine
  • Improved template activation strings
  • New code template scripting
  • New code template context-sensitivity with “scope expressions”
  • New “sidebar
  • And other little tweaks and fixes….

I’ve talked about the templates a little in this blog, but haven’t mentioned the “sidebar” at all.  Here you go: http://www.twodesk.com/castalia/sidebar.html.

Castalia 2008.4 is available immediatedly for current subscribers at http://subscribe.twodesk.com, or you can download the free trial athttp://www.twodesk.com/castalia/download.html.

More on the new code templates

Posted on November 25th, 2008 in Castalia, CodeGear, Delphi, TwoDesk | 2 Comments »

Here’s another interesting tidbit about the upcoming new code templates.  Again, this is all pre-release, and is subject to change or withdrawal until it actually ships.  Comments and suggestions are, as always welcome.

Castalia’s code templates have always been context-sensitive, to a degree.  In the template editor, there have always been checkboxes that allow you to specify whether a template should fire in strings or in comments.  This is important because when you type “if” in a comment, you probably don’t mean to create an if..then statement.

This sensitivity is good, but it could be better.  Take, for example, the “r=” template, which expands to “Result :=”.  This is only really useful in a function, and wouldn’t be good to do in a procedure (in fact, if you typed this in a procedure, having it NOT fire would serve as a good reminder that you don’t have a return value for your procedure – catching the error before it gets out of control).  With Castalia’s current templates, there’s no way to specify that a template fire only in a function, not in a procedure.

With the new templates, this is easy.  In the template editor, the checkboxes are gone, and have been replaced with a simple “scope” edit control.  Each template has a scope string, which is sort of like a demented CSS selector.  Here’s what the scope string looks like for the “r=” template:

 function – string & function – comment

This is reasonably self explanatory, but let’s explore a bit.  This string is made of two individual scope selectors, joined with an &, meaning AND.  Each individual selector is in the form “positive – negative” and will match any location in code where the positive part is true, and the negative part is false.  So “function – string” means “in a function, but not in a string.”  “function – comment” means “in a function, but not in a comment.”  The & means that both of those selectors must be true in order for the template to fire.

The individual parts of a selector can contain nested words, for greater precision.  For example, if you wanted a template to fire only in a function that is a member of a class, you could do it:

class > function

The positive or negative part of a selector can be blank.  In the example above, the negative selector is blank (so there is no “-” sign).  If the positive selector is blank, the selector begins with the “-” operator.  This selector will fire everywhere except in a comment or a string:

 - comment & – string

Note that the “-” operator is always binary – it is part of the selector, not a modifier of a selector.  That is, this is invalid:

method – (comment & string)

What is being intended here should be written like this:

method – comment & method – string

Or like this:

method & – comment & – string

If you want to use an OR operator, you would use a comma.  For example, the following scope would match any class except in a comment, or any string:

class – comment, string

Operator precedence between & and , is simply left to right.  You can change that with parenthesis:

class – comment, (string & method)

This would fire in any class except in a comment, or in any string that’s in a method.  There are better ways to write that, but it demonstrates the concept.  One more example wouldn’t hurt, so here’s how I would write it better:

class – comment, method > string

Scope selectors in the new Castalia templates allow for powerful and completely flexible control over where templates fire, and are one of the major improvements over the old template system.  The more I work on this, more excited I am to get it finished and get it into your hands.

Preparing for Delphi 2009: Part 4

Posted on September 9th, 2008 in Castalia, CodeGear, Delphi | 4 Comments »

Over the last few days, I’ve written about things to look for in your code to be prepared for Delphi 2009.  In today’s installment, I’m going to discuss a few Windows API calls that gave me a little trouble when porting Castalia to Delphi 2009.

GetProcAddress

The GetProcAddress API call is used to find the address of an exported function in a DLL.  If you’re using it, it probably looks something like this:

procAddr := GetProcAddress(Handle, PChar(’SomeFunctionName’));

We run into trouble with that last parameter.  GetProcAddress expects an ASCII string.  That is, an array of bytes, not words.  In Delphi 2009, the above code will fail, because you’ll get a pointer to a UTF-16 string.  Here’s the way it should look now:

procAddr := GetProcAddress(Handle, PAnsiChar(AnsiString(’SomeFunctionName’)));

The typecast to AnsiString ensures that the string is a string of bytes, not words.  Then the PChar cast is changed to PAnsiChar for completeness.

ToAscii

ToAscii is used to convert a keyboard state into an ASCII character.  It’s usually called from a KeyDown or KeyUp event handler.  Here’s a typical use:

GetKeyboardState(KS);

I := ToAscii(KeyCode, KS, @TempChar, 0);

Most of the parameters of ToAscii are beyond the scope of this post, but the point is that it takes the current keyboard state (represented by KS and KeyCode) and turns it into the ASCII character which should be displayed.

Of course, now that a Char is no longer limited to Ascii (and the size of the Char data type has changed), ToAscii isn’t really going to work any more.  I have to admit I was a bit surprised to discover the solution – the ToUnicode API call:

 I := ToUnicode(KeyCode, 0, KS, TempChar, 1, 0);

There are a few more parameters involved here (and note that TempChar is no longer referenced by pointer).  Again, most of them don’t matter, but the usage above will work for most cases.  If you’re using ToAscii in your code, you’re going to want to replace it with ToUnicode.

 MultiByteToWideChar

The MultiByteToWideChar function maps a string (often an ASCII or UTF-8 string) to a WideString.  Now that the default string type is unicode, and all string types are compatible by assignment, calls to MultiByteToWideChar can be replaced by simple assignment:

//Old code

MultiByteToWideChar(0, 0, pchar(sourceString), Length(S), PWideChar(targetString), Length(targetString));

//New code

targetString := sourceString;

Any API call that works with strings is probably worth examining for correctness, since most API calls that require a string also require the length of that string.  You should check whether it expects the length of the string in bytes or in WCHARs, and even if it might expect one form of string or another.

One note though: Delphi’s included Windows API units include overloaded versions of most of the API routines that involve strings, so you can call them with either a string or an AnsiString, and they’ll still work.  As I said before, 99.9% of your code is likely to simply compile and work without any changes.  That’s still true.