~ubuntu-branches/ubuntu/hardy/asis/hardy-proposed

« back to all changes in this revision

Viewing changes to tutorial/using_templets/metrics/README

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Brenta
  • Date: 2006-08-08 23:02:17 UTC
  • mfrom: (3.1.6 edgy)
  • Revision ID: james.westby@ubuntu.com-20060808230217-8j3ts1m8i83e0apm
Tags: 2005-5

debian/control: add support for alpha and s390.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Task 1:
2
 
======
3
 
The initial version of the metrics tool should compute the
4
 
following metrics for each user-defined unit in the Context:
5
 
 
6
 
   - the total number of statements in the code of the unit;
7
 
   - the total number of declarations in the code of the unit;
8
 
 
9
 
Task 2:
10
 
======
11
 
Add to the initial version of the metrics tool computation for the
12
 
following metrics:
13
 
 
14
 
   - the total number of simple statements (that is, statements
15
 
     which do not contain some other statement as its subcomponent);
16
 
 
17
 
   - the total number of compound statements (that is,
18
 
     statements which do contain other some statement as its
19
 
     subcomponent);
20
 
 
21
 
   - the total number of all the names explicitly declared in the
22
 
     unit;
23
 
 
24
 
The subdirectory 'task_1' contains four files:
25
 
 
26
 
- actuals_for_traversing-pre_op.adb - actual Pre-Operation to
27
 
    instantiate Traverse_Element, this file should replace the file
28
 
    with the same name in ASIS Application Templates to get the
29
 
    solution for Task 1.
30
 
 
31
 
- unit_processing.adb - the modified version of the
32
 
    unit_processing.adb file from the ASIS Application templates; the
33
 
    modification consists of adding the calls to subprograms which
34
 
    reset and print out the data structures used to collect metrics
35
 
    values. This file is the same for the solutions of Task 1 and
36
 
    Task 2;
37
 
 
38
 
- metrics_utilities.ads and metrics_utilities.adb - the package
39
 
    Metrics_Utilities, contains the data structures to
40
 
    collect metrics information and the procedures for printing this
41
 
    information out and to reset these data structures before
42
 
    processing the next unit.
43
 
 
44
 
The subdirectory 'task_2' contains three files:
45
 
 
46
 
- actuals_for_traversing-pre_op.adb - actual Pre-Operation to
47
 
    instantiate Traverse_Element, this file should replace the file
48
 
    with the same name in ASIS Application Templates to get the
49
 
    solution for Task 2, it is the extended version of the same
50
 
    file from subdirectory 'task_1', and it contains the code for
51
 
    computing new metrics information, as required by Task 2.
52
 
 
53
 
- metrics_utilities.ads and metrics_utilities.adb - the package
54
 
    Metrics_Utilities, updated to collect and output the new
55
 
    metrics information as required by Task 2
56
 
 
57
 
 
58
 
Hints for Task 1
59
 
----------------
60
 
To solve Task 1, you have to provide the real code for actual
61
 
Pre-Operation for Traverse_Element (this code should collect the
62
 
metrics information) and to add the calls to some procedures which
63
 
reset and which output the metrics values to the procedure providing
64
 
the general processing of a Compilation Unit (in the ASIS Application
65
 
Templates this is the Unit_Processing.Process_Unit). You have to
66
 
modify the general unit processing routine because you can only
67
 
collect the metrics information when traversing the unit structure,
68
 
and you have to reset the metrics data structures to the initial
69
 
values before starting the traversal, and you can print out the
70
 
metrics values only when the traversal is over.
71
 
 
72
 
The metrics to collect are very simple. In Pre-Operation, you have to
73
 
detect the kind of the Element being visited, and if it is a
74
 
statement or a declaration, you have to add 1 to the corresponding
75
 
metric counter.
76
 
 
77
 
Hints for Task 2 are given as comments in the solution for Task 1
78
 
(file task_1/actuals_for_traversing-pre_op.adb).
 
 
b'\\ No newline at end of file'