Products Downloads


French version


 

A source fragment is a piece of Adelia source code that can be generated automatically in the source via the automatic completion module. The fragment can contain parameters that are calculated automatically when the fragment is inserted.

You can use source fragments to semi-automate repetitive code input procedures, insert standard headers, etc.

 

To insert a source fragment into the code at the current cursor position, simply enter the start of the fragment's name and then call the automatic completion module by pressing CTRL+SPACE.

The fragments are then shown at the top of the completion list, with a different background color to distinguish them from the language's keywords:

 

Completion for TE...
The TEST source fragment is selected.

 

Source fragments can contain logical server assignments. These are only generated in Visual Adelia client programs, and ignored in other source types.

  • During the completion operation, the fragment's case is adapted to match the current input. Depending on the context, the fragment will adopt either the Adelia syntax (all upper-case) or the Visual Adelia syntax (non case-sensitive).
    This yields the following result:

    For the code in the following DO_WHILE fragment:

* standard loop

i = 0

do_while i < 10

* code here

$(caret)

redo

 

   The completion for DO_... gives:

* STANDARD LOOP

I = 0

DO_WHILE I < 10

* CODE HERE

 

REDO

 

   And the completion for do_... :

* standard loop

i = 0

do_while i < 10

* code here

 

redo

 

  • During the completion operation, any parameters in the fragment that appear in the form $(parameter) are calculated and substituted.

For example, if the fragment's code is:

* changed on $(date) at $(time) by $(engineer)

The inserted text might be:

* changed on 01/04/2005 at 17:00:00 by ADELIA

In this example, the date and time and the software engineer's name are replaced by the appropriate values upon execution.

 

The following parameter variables are available:

 

Name

Utilization

environ

Adelia development environment name.

app_area

Name of the current application area.

engineer

Name of the current software engineer.

program

Name of the current program/document.

owner

Name of the software engineer that owns the program.

user

Windows user name.

computer

Computer name.

date

Date (DMY / MDY / YMD format)

time

Time (HH:MI:SS)

timestamp

Date and time (YYYY-MM-DD-HH.MI.SS)

caret

Special keyword: the cursor is positioned here after the completion operation.

...

 

Others

If the parameter is not included in this list, the system substitutes an environment variable value, or deletes the parameter if no value is found.
For example, $(ADELIWS) generally becomes C:\ADELIWS.

 

 

 

Source Fragment

* ------------------------------------------------------------

*   keyword substitution test template

* ------------------------------------------------------------

*

*   environment                         : $(environ)

*   application area                    : $(app_area)

*   current software engineer      : $(engineer)

*   owner                                  : $(owner)

*   program                               : $(program)

*

*   computer                              : $(computer)

*   windows user                        : $(user)

*

*   date                                     : $(date)

*   time                                     : $(time)

*   timestamp                            : $(timestamp)

*

*   ADELIWS variable                 : $(ADELIWS)

*   USERDNSDOMAIN variable   : $(USERDNSDOMAIN)

*

*   the cursor should be here      : $(caret) <= right here...

*

* ------------------------------------------------------------

 

Code following completion

* ------------------------------------------------------------

*   keyword substitution test template

* ------------------------------------------------------------

*

*   environment                            : KBADEL

*   application area                       : ADELIA_EXAMPLE

*   current software engineer         : ADELIA

*   owner                                     : ADELIA

*   program                                  : A_TST2

*

*   computer                                 : PS00JCV1

*   windows user                           : jcv

*

*   date                                        : 01/04/2007

*   time                                        : 16:51:40

*   timestamp                               : 2007-04-01-16.51.40

*

*   ADELIWS variable                    : D:\ADELIWS

*   USERDNSAPPAREA variable      : hardis.fr

*

*   the cursor should be here         :  <= right here...

*

* ------------------------------------------------------------

 

The cursor is positioned at the penultimate line, in the location shown.

 

 

 

↑ Top of page

  • Aucune étiquette