Check-in [ac285fc8ed]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Rework to pycca and tack to bring in latest changes in STSA mechanisms and latest versions of ral package.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ac285fc8ed4b1a48a6214fddb40208bbeae5a059
User & Date: andrewm 2016-09-15 23:33:26
Context
2016-11-06
17:50
Changes in pycca and tack to improve build under macosx. check-in: 1b62fec06c user: andrewm tags: trunk
2016-09-15
23:33
Rework to pycca and tack to bring in latest changes in STSA mechanisms and latest versions of ral package. check-in: ac285fc8ed user: andrewm tags: trunk
2014-05-22
14:34
Archive package files for linux x86_64. check-in: 63d4cf2042 user: andrewm tags: trunk, mpssespi-1.0
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pycca/build/linux/pycca.

cannot compute difference between binary files

Changes to pycca/build/linux/pycca.tpj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

30
31
32
33
34
35
36
37
..
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
format  {TclDevKit Project File}
fmtver  2.0
fmttool {TclDevKit TclApp} 5.3

##  Saved at : Thu Aug 22 07:17:18 PDT 2013
##  By       : andrewm@zabox

########
#####
###
##
#

App/Code               {}
App/Package            {}
App/PostCode           {}
Metadata               {subject {tclkit basekit starkit starpack deployment} description {A single file tcl interpreter for the execution of starkits, also a prefix file usable by Tcl Dev Kit's TclApp for the creation of starpacks.} as::origin http://www.activestate.com/activetcl platform linux-glibc2.3-ix86 copyright {(c) 2007 - 2013 G. Andrew Mangogna} name pycca summary {Single File Tcl Executable} version 4.3 license {{ActiveTcl Community License v2.1} http://www.activestate.com/activetcl/license/} author {G. Andrew Mangogna} tdk-licensed-to {George Mangogna}}
OSX/Info.plist         {}
Path                   {Relativeto /home/andrewm/working/tcl-cm3/pycca/src}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca.tcl}
Path                   Startup
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_gen.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_mm.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_parse.tab.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_parse.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_scan.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/cdcl.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_portal.h}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_portal.c}

Pkg/Architecture       linux-glibc2.3-ix86
Pkg/Archive            /opt/ActiveTcl-8.6/lib/teapot
Pkg/Reference          Mk4tcl
Pkg/Reference          {Tcl 8.6}
Pkg/Reference          cmdline
Pkg/Reference          crc16
Pkg/Reference          csv
Pkg/Reference          ral
................................................................................
Pkg/Reference          textutil::adjust
Pkg/Reference          textutil::expander
Pkg/Reference          textutil::repeat
Pkg/Reference          textutil::split
Pkg/Reference          textutil::string
Pkg/Reference          textutil::tabify
Pkg/Reference          textutil::trim
Pkg/Reference          try
StringInfo             {}
System/Nocompress      0
System/TempDir         {}
System/Verbose         0
Wrap/Compile/NoTbcload 0
Wrap/Compile/Tcl       0
Wrap/Compile/Version   {}
Wrap/FSMode            {}
Wrap/Icon              {}
Wrap/InputPrefix       /opt/ActiveTcl-8.6/bin/base-tcl8.6-thread-linux-ix86
Wrap/Interpreter       {}
Wrap/Merge             0
Wrap/NoProvided        0
Wrap/NoSpecials        0
Wrap/Output            /home/andrewm/working/tcl-cm3/pycca/build/linux/pycca
Wrap/Output/OSXApp     0

#
##
###
#####
########




|
|










|












>
|







 







<









|












1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
format  {TclDevKit Project File}
fmtver  2.0
fmttool {TclDevKit TclApp} 5.3

##  Saved at : Fri Aug 12 16:23:19 PDT 2016
##  By       : andrewm@Office-NUC

########
#####
###
##
#

App/Code               {}
App/Package            {}
App/PostCode           {}
Metadata               {as::origin http://www.activestate.com/activetcl description {A single file tcl interpreter for the execution of starkits, also a prefix file usable by Tcl Dev Kit's TclApp for the creation of starpacks.} subject {tclkit basekit starkit starpack deployment} name pycca copyright {(c) 2007 - 2015 G. Andrew Mangogna} platform linux-glibc2.3-ix86 version 4.4 summary {Single File Tcl Executable} tdk-licensed-to {George Mangogna} author {G. Andrew Mangogna} license {{ActiveTcl Community License v2.1} http://www.activestate.com/activetcl/license/}}
OSX/Info.plist         {}
Path                   {Relativeto /home/andrewm/working/tcl-cm3/pycca/src}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca.tcl}
Path                   Startup
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_gen.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_mm.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_parse.tab.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_parse.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_scan.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/cdcl.tcl}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_portal.h}
Path                   {File /home/andrewm/working/tcl-cm3/pycca/src/pycca_portal.c}
Pkg/Architecture       linux-glibc2.19-x86_64
Pkg/Architecture       linux-glibc2.3-x86_64
Pkg/Archive            /opt/ActiveTcl-8.6/lib/teapot
Pkg/Reference          Mk4tcl
Pkg/Reference          {Tcl 8.6}
Pkg/Reference          cmdline
Pkg/Reference          crc16
Pkg/Reference          csv
Pkg/Reference          ral
................................................................................
Pkg/Reference          textutil::adjust
Pkg/Reference          textutil::expander
Pkg/Reference          textutil::repeat
Pkg/Reference          textutil::split
Pkg/Reference          textutil::string
Pkg/Reference          textutil::tabify
Pkg/Reference          textutil::trim

StringInfo             {}
System/Nocompress      0
System/TempDir         {}
System/Verbose         0
Wrap/Compile/NoTbcload 0
Wrap/Compile/Tcl       0
Wrap/Compile/Version   {}
Wrap/FSMode            {}
Wrap/Icon              {}
Wrap/InputPrefix       /home/andrewm/opt/ActiveTcl-8.6/bin/base-tcl8.6-thread-linux-x86_64
Wrap/Interpreter       {}
Wrap/Merge             0
Wrap/NoProvided        0
Wrap/NoSpecials        0
Wrap/Output            /home/andrewm/working/tcl-cm3/pycca/build/linux/pycca
Wrap/Output/OSXApp     0

#
##
###
#####
########

Changes to pycca/doc/pycca-translate/xuml-translation.pdf.

cannot compute difference between binary files

Changes to pycca/doc/pycca.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
83
84
85
86
87
88
89
90



91
92
93



94
95
96
97
98
99
100
...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
...
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
...
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
...
535
536
537
538
539
540
541


542
543
544
545
546
547
548
...
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
...
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
...
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
....
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
....
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
....
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
....
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
....
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
....
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
....
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
....
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
....
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
....
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
....
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
....
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
....
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
....
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
....
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
....
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
....
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
....
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
....
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
....
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
....
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
....
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
....
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
....
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
....
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
....
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
....
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
....
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
....
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
....
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
....
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
....
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
....
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
....
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
....
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
....
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
....
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
....
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
....
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
....
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
....
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
....
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
....
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
....
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
....
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
....
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
....
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
....
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
....
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
....
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
....
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
....
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
....
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
....
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
....
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
....
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
....
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
....
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
....
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
....
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
....
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
....
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
....
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
....
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
....
4332
4333
4334
4335
4336
4337
4338
4339
4340

4341
4342
4343
4344
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.7" />
<title>PYCCA(1)</title>
<style type="text/css">
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */

/* Default font. */
body {
  font-family: Georgia,serif;
................................................................................

ul, ol, li > p {
  margin-top: 0;
}
ul > li     { color: #aaa; }
ul > li > * { color: black; }

pre {



  padding: 0;
  margin: 0;
}




#author {
  color: #527bbd;
  font-weight: bold;
  font-size: 1.1em;
}
#email {
................................................................................

div.exampleblock > div.content {
  border-left: 3px solid #dddddd;
  padding-left: 0.5em;
}

div.imageblock div.content { padding-left: 0; }
span.image img { border-style: none; }
a.image:visited { color: white; }

dl {
  margin-top: 0.8em;
  margin-bottom: 0.8em;
}
dt {
................................................................................


/*
 * xhtml11 specific
 *
 * */

tt {
  font-family: "Courier New", Courier, monospace;
  font-size: inherit;
  color: navy;
}

div.tableblock {
  margin-top: 1.0em;
  margin-bottom: 1.5em;
}
div.tableblock > table {
  border: 3px solid #527bbd;
}
................................................................................


/*
 * html5 specific
 *
 * */

.monospaced {
  font-family: "Courier New", Courier, monospace;
  font-size: inherit;
  color: navy;
}

table.tableblock {
  margin-top: 1.0em;
  margin-bottom: 1.5em;
}
thead, p.tableblock.header {
  font-weight: bold;
  color: #527bbd;
................................................................................
body.manpage div.sectionbody {
  margin-left: 3em;
}

@media print {
  body.manpage div#toc { display: none; }
}


</style>
<script type="text/javascript">
/*<![CDATA[*/
var asciidoc = {  // Namespace.

/////////////////////////////////////////////////////////////////////
// Table Of Contents generator
................................................................................
The language that <strong>pycca</strong> translates is a simple configuration language
that allows the specification of domains, classes and state machines.
Any associated processing is specified in ordinary "C" code.
The language is translated into the necessary data structures required by
STSA with the included "C" code passed through into the definitions.</p></div>
<div class="paragraph"><p><strong>Pycca</strong> generates two files from its input.
One file is the generated "C" code,
named by appending a <tt>.c</tt> suffix to the basename of the first input file.
The other file is a generated header file which has a <tt>.h</tt> suffix.
More than one input file may be given in the invocation.
Subsequent files are processes as if all the files had been concatenated
together.
Typically, second and subsequent files hold domain population
information so that a domain may be populated differently without
modifying the file containing its logic.
However, additional domains may also be processed with the resulting
................................................................................
</p>
</dd>
<dt class="hdlist1">
-noline
</dt>
<dd>
<p>
    Do not output <tt>#line</tt> directives in the generated file that reference
    the <strong>pycca</strong> file.
    Normally, the generated "C" code contains line
    directives to so that compiler error messages reference the <strong>pycca</strong>
    source rather than the generated code.
    However, some compilers and debuggers are confused by these directives.
</p>
</dd>
................................................................................
<dt class="hdlist1">
-header file
</dt>
<dd>
<p>
    Use <em>file</em> as the name of the header file that contains the interface
    declarations for the software architectural mechanisms.
    By default, the file <tt>mechs.h</tt> is assumed to be the mechanisms interface
    file.
</p>
</dd>
</dl></div>
</div>
</div>
<div class="sect1">
................................................................................
</dt>
<dd>
<p>
any text appearing between matching parentheses, (&#8230;),
is taken to be a list of comma separated "C" variable or parameter declarations.
As of pycca version 3.0,
parameter lists and attribute declarations are parsed.
Because of the inherent ambiguity of <tt>typedef</tt> type aliases
and the complexity of certain "C" declarations that involve constant
expressions,
it is possible for <strong>pycca</strong> to incorrectly parse the declaration.
These issues can usually be solved with an appropriate typedef included
in the implementation prolog section.
</p>
</dd>
................................................................................
The token name is given to match as it appears in the syntax definition below.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
MPOINTS
</dt>
<dd>
<p>
<tt>-&gt;&gt;</tt> or <tt>-&gt;&gt;c</tt> or <tt>-&gt;&gt;n</tt>
</p>
</dd>
<dt class="hdlist1">
MLPOINTS
</dt>
<dd>
<p>
<tt>-&gt;&gt;l</tt>
</p>
</dd>
<dt class="hdlist1">
MCPOINTS
</dt>
<dd>
<p>
<tt>-ddd&gt;&gt;</tt>, where <em>ddd</em> is a sequence of decimal digits
</p>
</dd>
<dt class="hdlist1">
POINTS
</dt>
<dd>
<p>
<tt>-&gt;</tt>
</p>
</dd>
<dt class="hdlist1">
NAME
</dt>
<dd>
<p>
................................................................................
</div>
<div class="sect1">
<h2 id="_syntax">SYNTAX</h2>
<div class="sectionbody">
<div class="paragraph"><p>The following is a <em>yacc</em> style syntax of the language accepted by <strong>pycca</strong>.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>translation
    :
    |   domainDefs
    ;

domainDefs
    :   domain
    |   domainDefs domain
................................................................................

attrValue
    :   CODE
    |   POINTS NAME
    |   POINTS NAME '.' NAME
    |   MPOINTS nameList END
    |   '-'
    ;</tt></pre>
</div></div>
</div>
</div>
<div class="sect1">
<h2 id="_semantics">SEMANTICS</h2>
<div class="sectionbody">
<div class="paragraph"><p>The <strong>pycca</strong> language allows the definition of <em>domains</em>.
................................................................................
constructs of the <strong>pycca</strong> language.</p></div>
<div class="sect2">
<h3 id="_domain">DOMAIN</h3>
<div class="paragraph"><p>Domain definitions start with the <strong>domain</strong> keyword followed by the
name of the domain and stops at the matching <strong>end</strong> keyword.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>domain myDomain
    # Put your domain definition here
end</tt></pre>
</div></div>
<div class="paragraph"><p>The procedural interface to a domain consists of a set of <em>domain operations</em>.
Domain operations are converted into ordinary "C" functions.
They are made external in scope and their prototype is inserted into the
generated header file.
To help manage the global namespace, the name of the domain and an underscore
are prepended to the "C" function that is generated for a domain operation.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>domain myDomain
    domain operation
    init(void)
    {
        // the domain initialization is done here
    }
end</tt></pre>
</div></div>
<div class="paragraph"><p>So this would generate:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>void myDomain_init(void)
{
    // the domain initialization is done here
}</tt></pre>
</div></div>
<div class="paragraph"><p>If a domain operation returns a value, then the type is
specified by following the interface with a colon (:) and a variable type.
If no return type is specified,
then the function is typed as <strong>void</strong>.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>domain myDomain
    domain operation
    getStatus(void) : (int)
    {
        return 3 ;
    }
end</tt></pre>
</div></div>
<div class="paragraph"><p>This would generate:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>int myDomain_getStatus(void)
{
    return 3 ;
}</tt></pre>
</div></div>
<div class="paragraph"><p>Since domain operations form the external interface of the domain,
it is convenient to be able to associate comments and declarations
in the pycca source and have that information placed in the
generated header file.
An optional "C" segment may precede the domain operation definition
and this will be placed in the generated header.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>domain myDomain
    domain operation {
    /*
     * This operation is used to modify parameters.
     */}
    modParam(int a)
    {
        // modify parameters here!
    }
}</tt></pre>
</div></div>
<div class="paragraph"><p>This construct would result in the comment being passed to the generated
header file (and only the generated header) as:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>/*
 * This operation is used to modify parameters.
 */
extern void myDomain_modParam(int a) ;</tt></pre>
</div></div>
<div class="paragraph"><p>Although this construct is intended primarily to pass comments associated with
domain operations through to the generated header file that serves as the
interface specification to the domain,
the "C" code lines (like all other pycca constructs enclosed in <strong>{}</strong>)
is passed through unmodified (except for whitespace trimming) and may be used
to pass through pre-processor include directives or for any other useful
purposes.</p></div>
<div class="paragraph"><p>Complementary to domain operations are external operations.
They are defined similarly to domain operations.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>domain myDomain
    external operation
    getReactorTemp(int reactor)
    {
        // any code here is not passed through
    }
}</tt></pre>
</div></div>
<div class="paragraph"><p>External operations define the external function dependencies of the
domain.
The domain expects these functions to be supplied from elsewhere.
The above example generates external declarations such as:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>extern void eop_myDomain_getReactorTemp(int reactor) ;</tt></pre>
</div></div>
<div class="paragraph"><p>in both the generated header file and in the code file.
The intent of the external operation declarations is to aid in generating
bridge functions for the domain.
For each external operation, a function must be provided that
satisfies the semantics of the operation by bridging to domain
functions of another domain.
................................................................................
done via a macro.
Other bridges may be more complex, mapping encoded identifiers in one
domain to encoded identifiers in another domain.
Any code associated with the external operation does <strong>not</strong> get placed
in the generated code.
However, this code may be used in other pycca-based tools.
To invoke an external operation from with in the code of a domain,
use the <tt>ExternalOp()</tt> macro described below.</p></div>
</div>
<div class="sect2">
<h3 id="_classes">CLASSES</h3>
<div class="paragraph"><p>A <em>Domain</em> contains <em>classes</em>.
A <em>class</em> is <strong>template</strong> for data and behavior.
A particular <strong>instance</strong> of a class (often called an <strong>object</strong>)
performs the computational actions.
All instances of a given class have the same attribute data and
same general behavior.
A class has a name and optionally attributes and a state machine.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c1
    # class definition appears here.
end</tt></pre>
</div></div>
<div class="sect3">
<h4 id="_class_attributes">CLASS ATTRIBUTES</h4>
<div class="paragraph"><p>Attributes are declared in the same way as structure members in "C",
but without any punctuation.
Attributes are optional, but useful classes usually have attributes.
Following the lexical conventions,
the "C" declarations appear in parentheses.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c1
    attribute (int a1)
end</tt></pre>
</div></div>
<div class="paragraph"><p>The default value of an instance can also be specified.
The default value is used only if no value is specified when
an initial instance of the class is defined.
Default values are used only when specifying the set of initial instances.
For dynamically created instances,
all attribute values are set by running code.
The default value must evaluate to a valid "C" compile-time constant expression
(since it will be used as an initializer)
and since it is passed through must be enclosed in braces.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c1
    attribute (int a2) default {sizeof(int) + 32}
end</tt></pre>
</div></div>
</div>
<div class="sect3">
<h4 id="_class_references">CLASS REFERENCES</h4>
<div class="paragraph"><p>Sometimes classes need to refer to other classes or themselves in
order to implement relationships.
A reference is a special kind of attribute
................................................................................
as a pointer to a structure that matches the class name.</p></div>
<div class="sect4">
<h5 id="_singular_references">SINGULAR REFERENCES</h5>
<div class="paragraph"><p>Usually a single valued reference is used to implement
traversal of a relationship on the side that is <em>one</em> or <em>one-conditional</em>.
In the case of a singular reference,
a simple pointer member holds the address of the referenced instance
and <tt>NULL</tt> may be used to indicate conditionality.
So</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c1
    reference R1 -&gt; c1
end</tt></pre>
</div></div>
<div class="paragraph"><p>is translated to</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>struct c1 {
    ...
    struct c1 *R1 ;
    ...
} ;</tt></pre>
</div></div>
</div>
<div class="sect4">
<h5 id="_multiple_references">MULTIPLE REFERENCES</h5>
<div class="paragraph"><p>A reference may also implement a relationship traversal for the side
that is "many" or "many-conditional".
This type of reference storage is more complicated since we must
................................................................................
relationships.
Static relationships don&#8217;t change in time over the course of program
execution.
They are occur relatively frequently in some applications and which
instance are related to each other is known at compile time.
Two different storage strategies are available for static multiple
references.</p></div>
<div class="paragraph"><p>Using the <tt>-&gt;&gt;</tt> symbol will cause <strong>pycca</strong> to insert an
array of pointers.
The <tt>-&gt;&gt;</tt> notation comes in several alternate forms that are used
to control the details of how the array of pointers is allocated.
If <tt>-&gt;&gt;</tt> or <tt>-&gt;&gt;n</tt> is used to define the multiple reference,
then the class structure has a pointer member defined for it
that will point to a <tt>NULL</tt> terminated array of class references.
For example, the class fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c2
    reference R2 -&gt;&gt; c1
end</tt></pre>
</div></div>
<div class="paragraph"><p>translates into the "C" structure fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>    struct c1 *const*const R2 ;</tt></pre>
</div></div>
<div class="paragraph"><p>If <tt>-&gt;&gt;c</tt> is used to define the reference, then the array
of class references is <strong>counted</strong> and the class structure will have
two members defined for it, a pointer to the array and a count value.
In this case the class fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c3
    reference R3 -&gt;&gt;c c5
end</tt></pre>
</div></div>
<div class="paragraph"><p>translates into the "C" structure fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>    struct c5 *const*const R3 ;
    unsigned R3__count ;</tt></pre>
</div></div>
<div class="paragraph"><p>The <em>&lt;name&gt;__count</em> member should be accessed using the <tt>RefCountMember()</tt>
macro described below to insulate any code from the member naming convention.</p></div>
<div class="paragraph"><p>In both cases,
<strong>pycca</strong> will examine the initial instance population and build an array of
pointers in constant memory that point to the related instances and will
initialize the class instance with the pointer to the reference array.
If a <tt>NULL</tt> terminated array was requested then the array of references
will have a <tt>NULL</tt> value as its last element.
If a counted array was requested, the array contains just as many
pointers as indicated by the initial instance population and a count
of the number of pointers in the array is set in the initializer
of the referrring instance.</p></div>
<div class="paragraph"><p>For dynamic relationships,
two alternatives are provided.
If the reference specification is of the form "-ddd&gt;&gt;",
................................................................................
of class references is allocated in non-constant memory.
When the count form is used,
then the class instances will have an array of pointers of the specified size
defined as part of their class structure.
For example, the class fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c6
    reference R4 -20&gt;&gt; c7
end</tt></pre>
</div></div>
<div class="paragraph"><p>translates into the "C" structure fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>    struct c7 *R4[20] ;</tt></pre>
</div></div>
<div class="paragraph"><p>Where the <em>R4</em> member is an array of of class references
(<em>i.e.</em> pointers of type <em>struct c7 *</em> in this case).
The array will be initialized for each instance with the references specified
in the instance definition for the instance and any unused slots will be set to
<tt>NULL</tt>.
Action code can then manage that storage to implement dynamic one-to-many
type relationships where a <tt>NULL</tt> value is used to indicate that a reference
storage slot is not being used.</p></div>
<div class="paragraph"><p>Finally, if the reference specification is of the form <tt>-&gt;&gt;l</tt>,
a doubly linked list is set up to manage the multiple relationship.
This entails two things.
First, a set of links is added as a member of the class that defines
the reference.
Second, a corresponding set of links is added as a member of the class to which
the reference is made.
This allows a list be built starting at the referring class and threading
................................................................................
Thus the memory for the links is relatively easily managed and
referenced instances may be easily added and removed from the list.
A set of macros, defined below, is provided to hide the details of the
linking, unlinking and traversal mechanism.</p></div>
<div class="paragraph"><p>For example, the class fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c8
    reference R10 -&gt;&gt;l c9
end</tt></pre>
</div></div>
<div class="paragraph"><p>adds the following member to <em>struct c8</em>:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>    rlink_t R10 ;</tt></pre>
</div></div>
<div class="paragraph"><p>and adds the following member to <em>struct c9</em>:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>    rlink_t R10__links ;</tt></pre>
</div></div>
<div class="paragraph"><p>Any initial instances of <em>c9</em> that are referenced by <em>c8</em> are linked
together as part of the initializers defined by the initial instance
population.</p></div>
</div>
</div>
<div class="sect3">
<h4 id="_class_constructors_and_destructors">CLASS CONSTRUCTORS AND DESTRUCTORS</h4>
<div class="paragraph"><p>A class may define a constructor or a destructor.
Neither constructors nor destructors can take parameters.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c3
    attribute (int count)
    constructor {
        self-&gt;count = 0 ;
    }
    destructor {
        reportCount(self-&gt;count) ;
    }
end</tt></pre>
</div></div>
<div class="paragraph"><p>If any class that contains a constructor also has an initial instance
population specified,
then <strong>pycca</strong> will generate a function of the form, <tt>&lt;domain name&gt;_Ctor</tt>
where &lt;domain name&gt; is replaced by the name of the domain.
This function will invoke the constructor for all initial instances of
all classes that have defined a set of initial instances and also
have defined a constructor.
It is up to the user to invoke this function during the application
initialization phase (<em>e.g.</em> in some domain operation that is invoked
at initialization time).</p></div>
................................................................................
<div class="sect3">
<h4 id="_class_operations">CLASS OPERATIONS</h4>
<div class="paragraph"><p>A class may define class based operations.
Class operations do reference any particular instance and provide a means of
factoring common class operations into a single function.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c4
    class operation
    common(
        int a,
        char *b) : (int)
    {
        // Common class operation code.
        // No defined instance variable.
        return -1 ;
    }
end</tt></pre>
</div></div>
</div>
<div class="sect3">
<h4 id="_instance_operations">INSTANCE OPERATIONS</h4>
<div class="paragraph"><p>A class may define instance based operations.
Instance operations have an implicit first parameter which is a pointer
to the instance on which the operation is to be performed.
It is not necessary to declare the <tt>self</tt> variable as <strong>pycca</strong> will
insert it.
However, since this is "C", it is necessary to supply a value for the
implied <tt>self</tt> parameter when invoking an instance operation.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c5
    attribute (int count)
    instance operation
    addFive()
    {
        // Can reference "self"
        self-&gt;count += 5 ;
    }
end</tt></pre>
</div></div>
</div>
<div class="sect3">
<h4 id="_instance_storage">INSTANCE STORAGE</h4>
<div class="paragraph"><p>A separate pool of storage of instances is generated for each class.
Instances may be declared as initial instances, as slots in the
storage pool for dynamically created instances or the pool may contain both
initially defined instances and slots for dynamic instance creation.
If a class definition contains a <em>slots</em> statement, then the storage
pool for the class will contain at least the given number of instance
storage locations.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c6
    attribute (int count)
    population dynamic
    slots 5
end</tt></pre>
</div></div>
<div class="paragraph"><p>The above example insures that there are five dynamically allocatable
instances of class <em>c6</em>.</p></div>
<div class="sect4">
<h5 id="_initial_instances">INITIAL INSTANCES</h5>
<div class="paragraph"><p>The <strong>instance</strong> and <strong>table</strong> statements are used to define
initial class instances.
................................................................................
for that class may be defined.
Instances may be named or anonymous.
Named instances are useful when creating initial instances that
have instance references in them.
Anonymous instances cannot be referred to directly by other
initial instances.
Named instances also have the advantage of being able to be
located at run time using the <tt>Instance()</tt> macro.</p></div>
<div class="paragraph"><p>The values of all attributes that do not have a defined default
value must be specified.
For attributes that have a defined default value,
they are given that default value if not mentioned in the
instance definition.
Otherwise the default value is overrided when mention in the instance
definition.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c6
    attribute (int count) default {0}
    attribute (int age)
    reference R13 -&gt; c7
end

instance c6@i1
    (int age) {22}
    (int count) {17}
    R13 -&gt; i14
end</tt></pre>
</div></div>
<div class="paragraph"><p>The above example defines a named initial instance, <strong>i1</strong>, of class, <strong>c6</strong>.
The default value of <tt>(int count)</tt> is overridden to be 17 rather than
the default of 0.
The singular reference, <strong>R13</strong>, is set to point to the <strong>i14</strong> instance of
class, <strong>c7</strong>.</p></div>
<div class="paragraph"><p>When there are a number of instances of a particular class,
the <strong>instance</strong> statement can be tedious to use and obscures the
nature of the instances as a group.
In this case, the <strong>table</strong> command allows many instances to be defined
in a tabular arrangement.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>table
    c6      (int age)       (int count)     R13
    @i2     {19}            {26}            -&gt; i8
    @       -               {27}            -&gt; i9
    @i3     {42}            {28}            -&gt; i10
end</tt></pre>
</div></div>
<div class="paragraph"><p>The above example shows three more initial instances for class <strong>c6</strong>.
The attributes are listed as a heading, followed by lines that
give the name of the instance and the values of the attributes it is to have.
The heading need only contain those attributes that you wish to define
to be different from the default.
If the instance name is not given (<em>i.e.</em> a plain <em>@</em> is present)
................................................................................
Neither <strong>constant</strong> nor <strong>static</strong> class storage types
may have a <strong>slots</strong> statement to declare dynamic instances.
Pycca will issue a warning for <strong>constant</strong> or <strong>static</strong> classes whose
initial instance population is empty and no storage pool will be
defined for such classes.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c7
    attribute (int count)
    attribute (int year)
    population constant
end

instance c7
    (int count) 3
    (int year) 1977
end

instance c7
    (int count) 7
    (int year) 1978
end</tt></pre>
</div></div>
<div class="paragraph"><p>The above example declares two anonymous instances of the constant class, <strong>c7</strong>.
The storage pool for <strong>c7</strong> will be declared as <em>const</em> and its size is
fixed at two.</p></div>
</div>
</div>
</div>
................................................................................
type state machines.
For Moore machines,
action code is associated with the state and that code is executed
upon the transition into the state.
There are quite a number of rules for state machines as we shall see below.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class Dog
    machine
        initial state born
        final state die

        state born()
        {
            // "C" code for the "born" state goes here
................................................................................
        transition grow - Age -&gt; die

        state die()
        {
            // "C" code for the "die" state goes here
        }
    end
end</tt></pre>
</div></div>
<div class="paragraph"><p>Each machine may specify a default initial state using the
<strong>initial state</strong> statement.
If none is given, then the first state defined is taken to be
the default initial state.
A state may be marked as a final state using the <strong>final state</strong>
statement.
................................................................................
Thus it is not allowed for the same event to cause a transition
into states that have a different parameter signatures.
<strong>Pycca</strong> detects this error, issuing an appropriate error message.</p></div>
<div class="paragraph"><p>The state action is supplied by the "C" code in the enclosing
braces.
When an event causes a transition into a state,
the given "C" code executes.
The code may refer to <tt>self</tt> which is declared as a pointer
to a class instance and contains the reference to the instance
to which the event was directed.</p></div>
<div class="paragraph"><p>Transitions are specified by the <strong>transition</strong> statement.
This statement lists the current state, event and new state.
<strong>Pycca</strong> allows the state machine to be specified in any order.
You may list all the state definitions followed by the transitions
or any combination you find clearest.
................................................................................
<div class="paragraph"><p>The STSA supports dynamic instance creation.
Each class has its own storage pool.
This is in keeping with the minimal system assumptions that STSA
makes.
Class instances may be created in a synchronous manner or in an
asynchronous manner.
Synchronous creation involves invoking a create function from STSA.
Pycca provides a convenience macro, <tt>PYCCA_createInstance</tt>, to
help in the interface to STSA.
Synchronously created instances may be placed in any state when
they are created.
Usually the default initial state is chosen using the
<tt>InitialStateNumber()</tt> macro (or just 0 for creating instances that
have no associated state machine).
It is important to remember that synchronously created instances
<em>do not execute the action of their initial state</em>.
They are simply allocated from the class storage pool, run the
constructor if any and are placed in the state.
So for example:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>ClassRefVar(Dog, d) ;
d = PYCCA_createInstance(Dog, InitialStateNumber(Dog)) ;</tt></pre>
</div></div>
<div class="paragraph"><p>will create an instance of <em>Dog</em> held in the <tt>d</tt> variable in its
default initial state, but state action of the default initial state
has not been run.</p></div>
<div class="paragraph"><p>The other form of instance creation is asynchronous instance creation.
Any <strong>transition</strong> statement where the current state is named by the
period character (.) is a creation transition.
The period state name represents an initial pseudo state where
the instance has been created and will be delivered a event causing
a transition into the new state given in the <strong>transition</strong> statement.
For asynchronous creation, the state action into which the
instance transition upon receiving the creation event is executed.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class Dog
    machine
        transition . - Born -&gt; born
        transition born - GrowUp -&gt; grown
        state born()
        {
            puts("Dog is born") ;
        }

        state grown()
        {
            puts("Dog is grown") ;
        }
    end
end</tt></pre>
</div></div>
<div class="paragraph"><p>defines a class with a creation event, <tt>Born</tt>.
Executing the statement:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>PYCCA_generateCreation(Born, Dog, self) ;</tt></pre>
</div></div>
<div class="paragraph"><p>will cause the creation event <tt>Born</tt> to be queued.
When that event is dispatched, an instance of Dog will
be created in the initial pseudo state (with the constructor
executed if any) and the
<tt>Born</tt> event will be delivered to the new instance.
The event will cause a transition from the initial pseudo state
into the <tt>born</tt> state
and the action associated with that state will be executed.</p></div>
<div class="paragraph"><p>The creation rules may seem complex, but they cover all the
required circumstances.
It is worth noting that any state that is an initial state and
which does not have any <em>incoming</em> transitions should have
an empty state action.
Since there is never any transition into the state,
................................................................................
<h4 id="_generalizations_implemented_by_reference">GENERALIZATIONS IMPLEMENTED BY REFERENCE</h4>
<div class="paragraph"><p>A class defines a storage for generalization relationship implmented
by reference using the <strong>subtype &#8230; reference</strong> statement.
This statement gives a list of classes that are to be considered
as the subtype classes.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c8
    subtype R9 reference
        cs1
        cs2
        cs3
    end
end</tt></pre>
</div></div>
<div class="paragraph"><p><strong>Pycca</strong> will translate a <strong>subtype &#8230; reference</strong> statement into
two structure members:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>struct c8 {
    SubtypeCode R9__code ;
    MechInstance R9 ;
} ;</tt></pre>
</div></div>
<div class="paragraph"><p>The <strong>R9</strong> member holds a pointer to one of the subtypes of the <strong>R9</strong>
reference.
The <strong>R9__code</strong> member holds an integer encoding of the type of the
<strong>R9</strong> pointer.
In this scheme of subtyping,
the subtype instances are quite distinct from the supertype and
................................................................................
<div class="paragraph"><p>In simple cases,
typically a generalization hierarchy that is only a single level deep,
it is sometimes more convenient to hold the subtype classes of the supertype
directly in the storage of the supertype instances as a union data type.
Considering the above example, it would appear in union form as below:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class c8
    subtype R9 union
        cs1
        cs2
        cs3
    end
end</tt></pre>
</div></div>
<div class="paragraph"><p>In this case,
<strong>pycca</strong> would translate this subtype statement into:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>struct c8 {
    SubtypeCode R9__code ;
    union {
        struct cs1 R9_cs1 ;
        struct cs2 R9_cs2 ;
        struct cs3 R9_cs3 ;
    } R9 ;
} ;</tt></pre>
</div></div>
<div class="paragraph"><p>Keeping subtypes in a union data structure contained within a member
of the supertype can make managing dynamic instances easier,
especially in the case of dynamic migration of one subtype into another.
As long as the size of the subtype classes is similar,
there is no waste of memory and there may be some savings.
However, complex hierarchies, such as those where one supertype class
................................................................................
In practice the full power of polymorphic events is rarely needed.
<strong>Pycca</strong> includes checks to insure that the polymorphism is properly
defined.
The following example shows a situation with a two level generalization
hierachy.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>class super1
    subtype R1 reference
        sub_1_A
        sub_1_B
    end
    polymorphic event
        e1
        e2
................................................................................
    machine
        transition s1 - e2 -&gt; s1
        state s1()
        {
            puts("Consume e2 at this level") ;
        }
    end
end</tt></pre>
</div></div>
<div class="paragraph"><p>In this example, the supertype class, <strong>super1</strong>, has a
generalization relationship, <strong>R1</strong>, with two subtypes,
<strong>sub_1_A</strong> and <strong>sub_1_B</strong>.
The <strong>super1</strong> class defines two polymorphic events, <strong>e1</strong> and <strong>e2</strong>.
This means that the subtypes of <strong>super1</strong> must either consume the
polymorphic events directly or they must be consumed by
................................................................................
For example, header files needed by the "C" code in actions
needs to be put into the generated file at a location dictated by the
compiler.
<strong>Pycca</strong> allows both <strong>prolog</strong> and <strong>epilog</strong> code to be inserted in
both the <strong>interface</strong> and <strong>implementation</strong> files.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>implementation prolog {
#include &lt;stddef.h&gt;
#include "myHeader.h"
}</tt></pre>
</div></div>
<div class="paragraph"><p>Prolog code is placed in the generated "C" file before any of the
passed through code.
Similarly for the <strong>interface</strong> prolog.
It is placed before the domain function prototypes.
Epilog code is placed at the end.
Note also that prolog and epilog code is cumulative in that there
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <tt>NULL</tt>
if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_generateSelf(e, c)</div><p>Generate an event to self.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</p>
</dd>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class of <tt>self</tt>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_generateToSelf(e)</div><p>Generate an event to self.
This macro will use the current class context.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <tt>NULL</tt>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_generateCreation(e, c, s)</div><p>Generate a creation event.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <tt>NULL</tt>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
<dt class="hdlist1">
d
</dt>
<dd>
<p>
The delay time, in milliseconds.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_generateDelayedSelf(e, c, d)</div><p>Generate a delayed event to <tt>self</tt>.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
The name of the event to generate.
................................................................................
</p>
</dd>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class of <tt>self</tt>.
</p>
</dd>
<dt class="hdlist1">
d
</dt>
<dd>
<p>
The delay time, in milliseconds.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_generateDelayedToSelf(e, d)</div><p>Generate a delayed event to <tt>self</tt>.
This macro will use the current class context.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <tt>NULL</tt>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_cancelDelayedSelf(e, c)</div><p>Cancel a delayed event that was sent to <tt>self</tt>.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
The name of the event to generate.
</p>
</dd>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class of <tt>self</tt>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_cancelDelayedToSelf(e)</div><p>Cancel a delayed event that was sent to <tt>self</tt>.
This macro will use the current class context.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <tt>NULL</tt>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_remainDelayedSelf(e, c)</div><p>Retrive the time remaining on a self-directed delayed event.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</p>
</dd>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class of <tt>self</tt>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_remainDelayedToSelf(e)</div><p>Retrive the time remaining on a self-directed delayed event.
This macro will use the current class context.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</li>
</ol></div>
<div class="paragraph"><div class="title">Sending a <em>Bark</em> Event</div><p>Assuming that <em>dog</em> is an instance of class <em>Dog</em> and that the <em>Bark</em>
event takes a single parameter, <em>howLoud</em>, then the following will send
the <em>Bark</em> event to the <em>dog</em> instance of <em>Dog</em>.</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>MechEcb bark = PYCCA_newEvent(Bark, Dog, dog, self) ;
PYCCA_eventParam(bark, Dog, Bark, howLoud) = 20 ;
PYCCA_postEvent(bark) ;</tt></pre>
</div></div>
<div class="paragraph"><div class="title">PYCCA_newEvent(e, c, i, s)</div><p>Returns a <em>MechEcb</em> for an ordinary event.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <tt>NULL</tt>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_newSelfEvent(e, c)</div><p>Returns a <em>MechEcb</em> for an ordinary event where the target instance
and the sending instance are <tt>self</tt>.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
The name of the event to generate.
................................................................................
<dd>
<p>
The name of the class of the instance receiving the event.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_newEventToSelf(e)</div><p>Returns a <em>MechEcb</em> for an ordinary event where the target instance
and the sending instance are <tt>self</tt>.
This macro will use the current class context.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <tt>NULL</tt>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_newCreationEvent(e, c, s)</div><p>Returns a <em>MechEcb</em> for a creation event.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <tt>NULL</tt>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_newCreationEventForThisClass(e, s)</div><p>Returns a <em>MechEcb</em> for a creation event for creating an instance of
the current class context.</p></div>
<div class="dlist"><dl>
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <tt>NULL</tt>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_eventParam(ecb, c, e, p)</div><p>Retrieve the value of an event parameter.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
The initial state that the class is to be placed in.
    This argument is the actual numeric code for the state and should
    be specified by a macro.
    This is usually specified as <em>InitialStateNumber(c)</em>,
    to create the instance in its default initial state
    but a class may be created in any of its states as
    specified by the <em>StateNumber(c, s)</em> macro.
    For classes that do not have an associated state machine use <tt>0</tt>.
    <em>N.B.</em> that the action of the initial state is <strong>not</strong> executed when
    an instance is synchronously created in this manner.
    To both create an instance and execute an action, you must create
    the instance asynchronously using a creation event.
</p>
</dd>
</dl></div>
................................................................................
</dt>
<dd>
<p>
A pointer to the instance that is to have its state changed.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_selectOneInstWhere(i, c, expr)</div><p>This macro expands to a linear search of class named, <tt>c</tt>, for the first
instance where <tt>expr</tt> is true.
The <tt>i</tt> argument is the name of a
variable which is of type pointer to <tt>c</tt> structure.
The expanded code searches the storage pool for <tt>c</tt>
stopping at the first instance that is in use and that satisfies
<tt>expr</tt>.
<tt>Expr</tt> is presumed to contain accesses to the attributes of <tt>c</tt>
in the form of <tt>i&#8594;a</tt>.
The value of <tt>i</tt> variable is modified and at the end of the loop will either
point to the first instance of <tt>c</tt> where <tt>expr</tt> evaluates to non-zero
or will point past the end of
the storage pool for the class (as given by the <tt>EndStorage(c)</tt> macro,
<strong>i.e.</strong> if <tt>i</tt> &gt;= EndStorage(c) then the search failed).
Note that this macro tests for whether or not the instance is
currently allocated and therefore is only useful for classes that are
either dynamically allocated or have a state machine.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
i
</dt>
................................................................................
</dt>
<dd>
<p>
A "C" expression that will be intepreted as a boolean.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_selectOneInstOfThisClassWhere(i, expr)</div><p>This macro operates the same as <tt>PYCCA_selectOneInstWhere</tt> except that
the current class context is used to supply the class name.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
i
</dt>
<dd>
<p>
................................................................................
</dt>
<dd>
<p>
A "C" expression that will be intepreted as a boolean.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_selectOneStaticInstWhere(i, c, expr)</div><p>This macro is like <tt>PYCCA_selectOneInstWhere</tt> except that it does not
assume that <tt>c</tt> is has a dynamic pool associated with it.
For static and constant populations, there may not be an
instance allocation block created and this macro does not include
the test that the instance in the storage pool is actually in use.</p></div>
<div class="paragraph"><div class="title">PYCCA_selectOneStaticInstOfThisClassWhere(i, expr)</div><p>This macro is like <tt>PYCCA_selectOneInstWhere</tt> except that it uses the
current class context to supply the class name.</p></div>
<div class="paragraph"><div class="title">PYCCA_forAllInst(i, c)</div><p>This macro is a convenience macro that sets up a loop such that iterates
across all instances of a class.
The macro should be followed by a statement (possibly compound and
enclosed in braces (<strong>{}</strong>).
In the statement, <strong>i</strong> will iteratively take on the value of every
instance defined for the class, <strong>c</strong>.</p></div>
................................................................................
</dt>
<dd>
<p>
The name of the class of the instance corresponding to <em>i</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_forAllInstOfThisClass(i)</div><p>This macro is like <tt>PYCCA_forAllInst</tt> except that it uses the
current class context to supply the class name.</p></div>
<div class="paragraph"><div class="title">PYCCA_forAllRelated(v, i, r)</div><p>This macro is a convenience macro that sets up a loop such that iterates
across the instances that are related to the class.
This macro assumes that the related instances were declared using the
<tt>&#8594;&gt;c</tt>, syntax, <em>i.e.</em> the related instances are of the counted type.
The macro should be followed by a statement (possibly compound and
enclosed in braces (<strong>{}</strong>).
In the macro, <strong>v</strong> should be declared as <tt>ClassRefSetVar</tt> or a
<tt>ClassRefConstSetVar</tt>. Then <strong>v</strong> is iterated over the set of related instances.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
v
</dt>
<dd>
<p>
The name of a reference set variable.
................................................................................
</dt>
<dd>
<p>
The name of the relationship across which the iteration occurs.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_forAllRelatedTerm(v, i, r)</div><p>This macro is the same as <tt>PYCCA_forAllRelated()</tt> except that the relationship
must have been declared using the <tt>&#8594;&gt;n</tt> syntax, <em>i.e.</em> the relationship
storage consists of a <tt>NULL</tt> terminated array of instance pointers.</p></div>
</div>
<div class="sect2">
<h3 id="_generalization_navigation">GENERALIZATION NAVIGATION</h3>
<div class="paragraph"><p>When a generalization relationship is implemented as a union
data type, the instances of the subtypes do not use a pointer to
navigate to the supertype.
Rather it is only necessary to <em>up cast</em> the self pointer to
................................................................................
<div class="paragraph"><div class="title">PYCCA_unionSupertype(sub, supc, r)</div><p>Navigate to the supertype for instances contained in a union.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sub
</dt>
<dd>
<p>
A pointer to the subtype instance. This is frequently <tt>self</tt>.
</p>
</dd>
<dt class="hdlist1">
supc
</dt>
<dd>
<p>
................................................................................
<div class="paragraph"><div class="title">PYCCA_unionSubtype(sup, r, subc)</div><p>Navigate to the subtype instance contained in a union.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sup
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <tt>self</tt>.
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
................................................................................
<div class="paragraph"><div class="title">PYCCA_referenceSubtype(sup, r, subc)</div><p>Navigate to the subtype instance by pointer reference.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sup
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <tt>self</tt>.
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
................................................................................
the subtype class, <em>subc</em> across the relationship, <em>r</em>.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sup
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <tt>self</tt>.
</p>
</dd>
<dt class="hdlist1">
supc
</dt>
<dd>
<p>
................................................................................
For subtypes that have a constructor, an explicit call is required.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sup
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <tt>self</tt>.
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
................................................................................
<p>
The name of the subtype class.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_initUnionInstanceToState(sup, r, subc, st)</div><p>Initialize a subtype instance that is contained in a union based
supertype specifying a particular state.
This macro is like the <tt>PYCCA_initUnionInstance</tt> macro but also
allows you to specify the state into which the instance is placed.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sup
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <tt>self</tt>.
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
st
</dt>
<dd>
<p>
The state name of a <tt>subc</tt> class state.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_relateSubtypeByRef(s, supc, r, t, subc)</div><p>Relate a supertype instance to a subtype instance when the relationship
is being stored by reference.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <tt>self</tt>.
</p>
</dd>
<dt class="hdlist1">
supc
</dt>
<dd>
<p>
................................................................................
</dl></div>
</div>
<div class="sect2">
<h3 id="_dynamic_relationship_management">DYNAMIC RELATIONSHIP MANAGEMENT</h3>
<div class="paragraph"><p>These macro aid in managing the references associated with dynamic
relationships.
In particular, one-to-many relationships implemented by a counted pointer
array (<em>i.e.</em> those using the <tt>-ddd&gt;&gt;</tt> syntax)
require you to find a slot whose value is <tt>NULL</tt> and store the reference there.
Unrelating instances is similar.</p></div>
<div class="paragraph"><div class="title">PYCCA_relateToMany(n, o, r, m)</div><p>Relate two instances in an one-to-many relationship that is implemented
using a counted pointer array.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
n
</dt>
................................................................................
</dt>
<dd>
<p>
A pointer to an instance on the many side of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>The <tt>n</tt> variable is ranged over the counted pointer array where instances
of <tt>r</tt> are stored
until an empty slot is found (as indicated by a <tt>NULL</tt> value) and then many
side instance is then assigned to that slot.
If no slot is found, then the expression <tt>n &gt;= o&#8594;r + COUNTOF(o&#8594;r)</tt>
is true.</p></div>
<div class="paragraph"><div class="title">PYCCA_unrelateFromMany(n, o, r, m)</div><p>Unrelate two instances from a one-to-many relationship that is implemented
by a counted pointer array.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
n
</dt>
................................................................................
</dt>
<dd>
<p>
A pointer to an instance on the many side of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>The <tt>n</tt> variable is ranged over the counted pointer array where instances
of <tt>r</tt> are stored a slot containing the value of <tt>m</tt> is found
and then that slot is assigned <tt>NULL</tt>.
If no matching slot is found, then the expression <tt>n &gt;= o&#8594;r + COUNTOF(o&#8594;r)</tt>
is true.</p></div>
<div class="paragraph"><p>For one-to-many relationships implemented by linked lists (<em>i.e.</em> those
using the <tt>-&gt;&gt;l</tt> syntax), the following macros are useful.</p></div>
<div class="paragraph"><div class="title">PYCCA_linkToMany(o, r, m)</div><p>Relate two instances in an one-to-many relationship that is implemented
using linked lists.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
o
</dt>
<dd>
................................................................................
</dt>
<dd>
<p>
A pointer to an instance on the many side of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>The <tt>m</tt> instance is added to the linked list of instances that are related
to the <tt>o</tt> instance across relationship <tt>r</tt>.</p></div>
<div class="paragraph"><div class="title">PYCCA_unlinkFromMany(m, r)</div><p>Unrelate an instance in a one-to-many relationship that is implemented
using linked lists.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
m
</dt>
<dd>
................................................................................
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
The name of the relationship in which <tt>m</tt> participates.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>The <tt>m</tt> instance is unlinked from the list associated with relationship <tt>r</tt>.</p></div>
<div class="paragraph"><div class="title">PYCCA_isLinkEmpty(o, r)</div><p>Test if there are any instance in a one-to-many relationship implemented
using linked lists.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
o
</dt>
<dd>
................................................................................
<dd>
<p>
The name of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro evaluates to a boolean that is true if there are no instances
linked from <tt>o</tt> across the relationship, <tt>r</tt>, and false otherwise.</p></div>
<div class="paragraph"><div class="title">PYCCA_isLinkNotEmpty(o, r)</div><p>Test if there are no instances in a one-to-many relationship implemented
using linked lists.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
o
</dt>
<dd>
................................................................................
<dd>
<p>
The name of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro evaluates to a boolean that is true if there is at least one
instance linked from <tt>o</tt> across the relationship, <tt>r</tt>, and false otherwise.</p></div>
<div class="paragraph"><div class="title">PYCCA_forAllLinkedInst(o, r, l)</div><p>Iterate over the instances of a one-to-many relationship implemented using
linked lists.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
o
</dt>
<dd>
................................................................................
</p>
</dd>
<dt class="hdlist1">
l
</dt>
<dd>
<p>
The name of a variable of type <tt>rlink_t *</tt>
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro expands to a <tt>for</tt> loop construct where all the instances related
to <tt>o</tt> across <tt>r</tt> are visited.
The link variable, <tt>l</tt>, is successively assigned values of the links
related on the many side to <tt>o</tt>.
The value of the link variable, <tt>l</tt>, is <em>not</em> a pointer to an instance.
The instance pointer must be recovered by using the
<tt>PYCCA_linkToInstRef()</tt> or <tt>PYCCA_linkToInstRefOfThisClass()</tt>
macros described below.</p></div>
<div class="dlist"><div class="title">PYCCA_linkToInstRef(l, c, r)</div><dl>
<dt class="hdlist1">
l
</dt>
<dd>
<p>
The name of a variable of type <tt>rlink_t *</tt>
</p>
</dd>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class on the many side of the relationship
to which <tt>l</tt> refers.
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
The name of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro converts a link pointer of type <tt>rlink_t *</tt> that is a link
in relationship, <tt>r</tt>, to pointer to an instance of class, <tt>c</tt>.</p></div>
<div class="dlist"><div class="title">PYCCA_linkToInstRefOfThisClass()</div><dl>
<dt class="hdlist1">
l
</dt>
<dd>
<p>
The name of a variable of type <tt>rlink_t *</tt>
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
The name of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro is like <tt>PYCCA_linkToInstRef()</tt> except that it uses the
current class context to determine the class of the referenced instance.</p></div>
</div>
<div class="sect2">
<h3 id="_instance_identifiers">Instance Identifiers</h3>
<div class="paragraph"><p>It is sometimes useful to use have an means to identify an instance of
a particular class outside of a domain.
The pointer value of the instance is <strong>not</strong> suitable for this purpose,
but the array index of the instance in its storage pool is satisfactory.
The macros in this group provide a means of generating a small integer value
for a instance that can be used as an identifier external to the domain
or to translate an instance identifier into a pointer reference to the instance.</p></div>
<div class="paragraph"><div class="title">PYCCA_idOfSelf</div><p>This macro generates an integer identifier for the <tt>self</tt> reference.</p></div>
<div class="dlist"><div class="title">PYCCA_idOfRef(c, r)</div><dl>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class.
................................................................................
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
The reference value for a member of class, <tt>c</tt>.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro generates an integer identifier for a reference, <tt>r</tt> of class, <tt>c</tt>.</p></div>
<div class="dlist"><div class="title">PYCCA_idOfInst(c, n)</div><dl>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class.
................................................................................
</dt>
<dd>
<p>
The name of a named instance.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro generates an integer identifier for the named instance, <tt>n</tt> of
class, <tt>c</tt>.</p></div>
<div class="dlist"><div class="title">PYCCA_refOfId(c, i)</div><dl>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class.
................................................................................
</dt>
<dd>
<p>
An integer identifier for an instance of the class.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro returns an instance reference to an instance of class, <tt>c</tt>, that
is identifed by the integer identifier, <tt>i</tt>.</p></div>
<div class="dlist"><div class="title">PYCCA_refOfThisClassId(i)</div><dl>
<dt class="hdlist1">
i
</dt>
<dd>
<p>
An integer identifier for an instance of the class.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro is like <tt>PYCCA_refOfId()</tt> except that it uses the current
class context to determine the class of the instance identifier.</p></div>
<div class="dlist"><div class="title">PYCCA_checkId(c, i)</div><dl>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
................................................................................
</dt>
<dd>
<p>
An integer identifier for an instance of the class.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro generates an invocation of the <tt>assert()</tt> macro to test
that the identifier, <tt>i</tt> is valid for class, <tt>c</tt>.
This is useful if a domain operation accepts an integer identifier for
an instance and wants to assert its validity.</p></div>
<div class="dlist"><div class="title">PYCCA_checkThisClassId(i)</div><dl>
<dt class="hdlist1">
i
</dt>
<dd>
<p>
An integer identifier for an instance of the class.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro is like <tt>PYCCA_checkId()</tt> except that it uses the current
class context to determine the class of the instance identifier.</p></div>
</div>
<div class="sect2">
<h3 id="_encoding_macros">ENCODING MACROS</h3>
<div class="paragraph"><p>This set of macros gives access to the various encodings and
naming conventions used by <strong>pycca</strong> in the generated code.
These macros are used by the <em>PYCCA_</em> macros and are sometimes useful
in normal state action code.
As of version 2.6, new macros were added that can use the class context
that <strong>pycca</strong> generates.</p></div>
<div class="paragraph"><div class="title">ClassRefType(c)</div><p>Expands to the type of a reference to an instance of class named, <tt>c</tt>.</p></div>
<div class="paragraph"><div class="title">ThisClassRefType</div><p>Expands to the type of a reference to an instance of the current class
context.</p></div>
<div class="paragraph"><div class="title">ClassRefVar(c, v)</div><p>Declare a variable named <tt>v</tt> that refers to the class named, <tt>c</tt>.</p></div>
<div class="paragraph"><div class="title">ThisClassRefVar(v)</div><p>Declare a variable named <tt>v</tt> that refers to the current class.</p></div>
<div class="paragraph"><div class="title">ClassConstRefVar(c, v)</div><p>Declare a variable named <tt>v</tt> that refers to the class name <tt>c</tt>.
This macro is used for references to classes that have constant populations.</p></div>
<div class="paragraph"><div class="title">ThisClassConstRefVar(v)</div><p>Declare a variable named <tt>v</tt> that refers to a constant instance of the
current class.</p></div>
<div class="paragraph"><div class="title">ClassRefSetVar(c, v)</div><p>Declare a variable named <tt>v</tt> that refers to a set of instances of the
class named <tt>c</tt>.</p></div>
<div class="paragraph"><div class="title">ThisClassRefSetVar(v)</div><p>Declare a variable named <tt>v</tt> that refers to a set of instances of the
current class.</p></div>
<div class="paragraph"><div class="title">ClassConstRefSetVar(c, v)</div><p>Declare a variable named <tt>v</tt> that revers to a set of constant instances of the
class named <tt>c</tt>.</p></div>
<div class="paragraph"><div class="title">ThisClassConstRefSetVar(c, v)</div><p>Declare a variable named <tt>v</tt> that revers to a set of constant instances of the
current class.</p></div>
<div class="paragraph"><div class="title">SubCodeMember(r)</div><p>For generalization relationships, the super type holds an encoded values
that signifies the type of the sub type to which it is currently related.
This macro gives the structure member name in the super type instance
for relationship, <em>r</em>.</p></div>
<div class="paragraph"><div class="title">SubCodeValue(c, r, s)</div><p>For generalization relationships, the super type holds an encoded values
that signifies the type of the sub type to which it is currently related.
This macro gives the subtype code number for class, <em>c</em>, relationship, <em>r</em>
and subtype name, <em>s</em>.</p></div>
<div class="paragraph"><div class="title">SubTypesMember(r, s)</div><p>For subtypes held in a union, this macro gives the name of the union
member for subtype, <em>s</em>, in relationship, <em>r</em>.
Use the <em>PYCCA_unionSubtype()</em> macro to simply obtain the address
of the union subtype member.</p></div>
<div class="paragraph"><div class="title">RefCountMember(r)</div><p>For multiple references defined with the <tt>-&gt;&gt;c</tt> construct,
this macro gives the name of the class structure member that
holds the count of class references along the relationship given
by the <em>r</em> argument.</p></div>
<div class="paragraph"><div class="title">EventNumber(c, e)</div><p>The number of the ordinary event for the event named, <em>e</em>, in class, <em>c</em>.</p></div>
<div class="paragraph"><div class="title">ThisClassEventNumber(e)</div><p>The number of the ordinary event for the event named, <em>e</em>, in the current class.</p></div>
<div class="paragraph"><div class="title">PolyEventNumber(c, e)</div><p>The number of the polymorphic event for the event named, <em>e</em>, in class, <em>c</em>.</p></div>
<div class="paragraph"><div class="title">InitialStateNumber(c)</div><p>The number of the default initial state for instances of class, <em>c</em>.</p></div>
................................................................................
<div class="paragraph"><div class="title">ThisClassStateNumber(s)</div><p>The number encoding the state, <em>s</em>, for the current class.</p></div>
<div class="paragraph"><div class="title">SelfStateNumber</div><p>The number encoding the state for the current state of the <em>self</em> instance.</p></div>
<div class="paragraph"><div class="title">EventParamType(c, e)</div><p>The type name of the data structure for event, <em>e</em>, in class, <em>c</em>.
This macro is now <strong>deprecated</strong> as it interfers with a type name
used in the architecture mechanisms.
It is retained for backwards compatiblity but
will be removed in a future release.
Use the <tt>EventParamDecl()</tt> macro instead.</p></div>
<div class="paragraph"><div class="title">EventParamDecl(c, e)</div><p>The type name of the data structure for event, <em>e</em>, in class, <em>c</em>.</p></div>
<div class="paragraph"><div class="title">ThisClassEventParamDecl(e)</div><p>The type name of the data structure for event, <em>e</em>, in the current class.</p></div>
<div class="paragraph"><div class="title">ClassData(c)</div><p>A pointer to the class data structure for <em>c</em>.</p></div>
<div class="paragraph"><div class="title">ThisClassData</div><p>A pointer to the class data structure for the current class.</p></div>
<div class="paragraph"><div class="title">RefCountMember(r)</div><p>The name of the structure member that holds the reference count
for a muli-reference relationship.</p></div>
<div class="paragraph"><div class="title">BeginStorage(c)</div><p>The address of the beginning of instance storage for class, <em>c</em>.</p></div>
................................................................................
<div class="paragraph"><div class="title">ThisClassInstOp(c, o)</div><p>The name of instance operation, <em>o</em>, in the current class.</p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="instrument">INSTRUMENTATION</h2>
<div class="sectionbody">
<div class="paragraph"><p>If the <tt>-instrument</tt> option is used, <strong>pycca</strong> will emit instrumentation
code at the beginning of each function associated with matching classes.
When <strong>pycca</strong> includes instrumentation code, the preprocessor symbol,
<tt>INSTRUMENT</tt> will be defined.
The actual instrumentation is delegated to a macro,
<tt>INSTR_FUNC(s)</tt>, where <tt>s</tt> is a string indicating the specific
function being invoked.
Users may define the <tt>INSTR_FUNC(s)</tt> macro
(<em>e.g.</em> in the implementation prolog code) to override the default
supplied by <strong>pycca</strong>.
As of version 4.1, <strong>pycca</strong> supplies a default version of <tt>INSTR_FUNC</tt>
as well as one that is intended to work with a <strong>tack</strong> generated
test harness.
The default definition supplied by <strong>pycca</strong> is:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>#ifdef INSTRUMENT
#   ifndef INSTR_FUNC
#       ifdef TACK
#           include "harness.h"
#           define INSTR_FUNC(s) harness_stub_printf("instrument",\
                "func %s file %s line %u", (s), __FILE__, __LINE__)
#       else
#           define INSTR_FUNC(s) printf("%s: %s %d\n", (s), __FILE__, __LINE__)
#       endif /* TACK */
#   endif /* INSTR_FUNC */
#endif /* INSTRUMENT */</tt></pre>
</div></div>
<div class="paragraph"><p><strong>N.B.</strong> because the instrumentation macro is inserted into the output
before any passed
along "C" code, old compilers that do not allow variable declarations
in a block after code statements will most likely produce compiler
errors if any local variables are declared in the instrumented function.
Such is the limitation of a program like <strong>pycca</strong> that does not
examine the "C" code passed along.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="data-portal">DATA PORTAL</h2>
<div class="sectionbody">
<div class="paragraph"><p>When the <tt>-dataportal</tt> option is given, <strong>pycca</strong> will generate a
set of data structures that allow access to the attributes of class
instances from outside of the domain.
This facility is provided for the following purposes:</p></div>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Bridging data values into and out of the domain for use by
................................................................................
</li>
<li>
<p>
Testing, where generated events are used to force execution paths.
</p>
</li>
</ol></div>
<div class="paragraph"><p>The only values available through this interface are declared <tt>attribute</tt>
values and the type code of a subtype that is related to a supertype.
The internal pointer references used for relationship navigation
are not accessible.</p></div>
<div class="paragraph"><p>The files <tt>pycca_portal.h</tt> or <tt>pycca_portal.c</tt> contain the code and
declarations needed to use the portal facility.
These files may be obtained by invoking <strong>pycca</strong> with the <tt>-portalcode</tt> option.
These files contain the common code that can be used to read
and update the class attributes within the domain
and generate events to the instances of the domain.
The functions require a parameter which is a pointer to the
data structure that <strong>pycca</strong> generates.
This variable is named <tt>&lt;domain name&gt;_portal</tt>, where <tt>&lt;domain name&gt;</tt>
is replaced with the name of the domain.
An external declaration of the variable is inserted into the generated
header file.
Classes and attributes are encoded as small integers and these definitions
are also placed in the generated header file.
A macro definition giving the total number of instances is also placed
in the generated header file.
This is the same numeric encoding that is placed in the generated
header file when the <tt>-ids</tt> option is given.</p></div>
<div class="paragraph"><p>Some care must be taken when accessing class attributes for classes
that are subtypes of a generalization that is implemented via a <tt>union</tt>.
In the case of a union, there are as many instances of each of the
subtypes as there are of the ultimate supertype of the generalization.
However, how the storage space of the subtype is being interpreted is
determined by a type code that is stored in the supertype.
Accessing a union subtype that is a different type than that currently
related to the supertype will not yield the correct value.
So for supertype classes,
................................................................................
terms specified in this license.</p></div>
</div>
</div>
</div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Version 4.3<br />
Last updated 2013-08-21 17:28:18 PDT

</div>
</div>
</body>
</html>





|







 







|
>
>
>



>
>
>







 







|







 







<
<
<
<
<
<







 







<
<
<
<
<
<







 







>
>







 







|
|







 







|







 







|







 







|







 







|







|







|







|







 







|







 







|







 







|

|









|





|




|


|







|





|




|


|









|








|





|


|












|





|







|







 







|












|

|










|

|












|

|







 







|



|

|




|



|







 







|

|

|

|



|

|




|

|





|

|




|
|

|





|
|







 







|

|




|





|

|

|







 







|

|




|




|












|







|



|







 







|









|







|


|


|







|













|



|







 







|









|









|


|










|




|







 







|













|







 







|







 







|







 







|







 







|




|








|
|

|













|













|

|



|

|



|

|







 







|





|





|


|







 







|





|





|






|







 







|







 







|







 







|


|







 







|







 







|







 







|







 







|












|







 







|











|







 







|




|














|



|







 







|







 







|







 







|

|







 







|





|







 







|







 







|







 







|







 







|







 







|







 







|
|
|
|
|

|
|
|
|
|

|
|







 







|







 







|
|



|







 







|




|


|
|







 







|
|
|







 







|







 







|







 







|







 







|







 







|







 







|







|







 







|











|







 







|
|







 







|
|
|

|







 







|
|
|
|


|







 







|
|







 







|



|







 







|







 







|







 







|



|
|
|
|
|

|







|








|











|
|






|











|











|







 







|



|







 







|
|







 







|
|










|







 







|
|












|










|


|
|
|

|

|
|
|

|
|
|













|







 







|







 







|


|

|

|


|





|









|













|







 







|



|

|





|








|

|







 







|
|
>




1
2
3
4
5
6
7
8
9
10
11
12
13
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
...
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
...
417
418
419
420
421
422
423






424
425
426
427
428
429
430
...
450
451
452
453
454
455
456






457
458
459
460
461
462
463
...
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
...
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
...
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
...
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
....
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
....
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
....
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
....
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
....
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
....
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
....
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
....
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
....
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
....
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
....
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
....
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
....
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
....
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
....
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
....
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
....
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
....
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
....
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
....
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
....
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
....
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
....
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
....
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
....
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
....
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
....
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
....
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
....
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
....
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
....
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
....
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
....
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
....
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
....
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
....
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
....
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
....
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
....
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
....
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
....
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
....
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
....
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
....
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
....
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
....
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
....
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
....
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
....
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
....
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
....
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
....
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
....
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
....
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
....
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
....
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
....
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
....
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
....
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
....
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
....
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
....
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
....
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
....
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
....
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.9" />
<title>PYCCA(1)</title>
<style type="text/css">
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */

/* Default font. */
body {
  font-family: Georgia,serif;
................................................................................

ul, ol, li > p {
  margin-top: 0;
}
ul > li     { color: #aaa; }
ul > li > * { color: black; }

.monospaced, code, pre {
  font-family: "Courier New", Courier, monospace;
  font-size: inherit;
  color: navy;
  padding: 0;
  margin: 0;
}
pre {
  white-space: pre-wrap;
}

#author {
  color: #527bbd;
  font-weight: bold;
  font-size: 1.1em;
}
#email {
................................................................................

div.exampleblock > div.content {
  border-left: 3px solid #dddddd;
  padding-left: 0.5em;
}

div.imageblock div.content { padding-left: 0; }
span.image img { border-style: none; vertical-align: text-bottom; }
a.image:visited { color: white; }

dl {
  margin-top: 0.8em;
  margin-bottom: 0.8em;
}
dt {
................................................................................


/*
 * xhtml11 specific
 *
 * */







div.tableblock {
  margin-top: 1.0em;
  margin-bottom: 1.5em;
}
div.tableblock > table {
  border: 3px solid #527bbd;
}
................................................................................


/*
 * html5 specific
 *
 * */







table.tableblock {
  margin-top: 1.0em;
  margin-bottom: 1.5em;
}
thead, p.tableblock.header {
  font-weight: bold;
  color: #527bbd;
................................................................................
body.manpage div.sectionbody {
  margin-left: 3em;
}

@media print {
  body.manpage div#toc { display: none; }
}


</style>
<script type="text/javascript">
/*<![CDATA[*/
var asciidoc = {  // Namespace.

/////////////////////////////////////////////////////////////////////
// Table Of Contents generator
................................................................................
The language that <strong>pycca</strong> translates is a simple configuration language
that allows the specification of domains, classes and state machines.
Any associated processing is specified in ordinary "C" code.
The language is translated into the necessary data structures required by
STSA with the included "C" code passed through into the definitions.</p></div>
<div class="paragraph"><p><strong>Pycca</strong> generates two files from its input.
One file is the generated "C" code,
named by appending a <code>.c</code> suffix to the basename of the first input file.
The other file is a generated header file which has a <code>.h</code> suffix.
More than one input file may be given in the invocation.
Subsequent files are processes as if all the files had been concatenated
together.
Typically, second and subsequent files hold domain population
information so that a domain may be populated differently without
modifying the file containing its logic.
However, additional domains may also be processed with the resulting
................................................................................
</p>
</dd>
<dt class="hdlist1">
-noline
</dt>
<dd>
<p>
    Do not output <code>#line</code> directives in the generated file that reference
    the <strong>pycca</strong> file.
    Normally, the generated "C" code contains line
    directives to so that compiler error messages reference the <strong>pycca</strong>
    source rather than the generated code.
    However, some compilers and debuggers are confused by these directives.
</p>
</dd>
................................................................................
<dt class="hdlist1">
-header file
</dt>
<dd>
<p>
    Use <em>file</em> as the name of the header file that contains the interface
    declarations for the software architectural mechanisms.
    By default, the file <code>mechs.h</code> is assumed to be the mechanisms interface
    file.
</p>
</dd>
</dl></div>
</div>
</div>
<div class="sect1">
................................................................................
</dt>
<dd>
<p>
any text appearing between matching parentheses, (&#8230;),
is taken to be a list of comma separated "C" variable or parameter declarations.
As of pycca version 3.0,
parameter lists and attribute declarations are parsed.
Because of the inherent ambiguity of <code>typedef</code> type aliases
and the complexity of certain "C" declarations that involve constant
expressions,
it is possible for <strong>pycca</strong> to incorrectly parse the declaration.
These issues can usually be solved with an appropriate typedef included
in the implementation prolog section.
</p>
</dd>
................................................................................
The token name is given to match as it appears in the syntax definition below.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
MPOINTS
</dt>
<dd>
<p>
<code>-&gt;&gt;</code> or <code>-&gt;&gt;c</code> or <code>-&gt;&gt;n</code>
</p>
</dd>
<dt class="hdlist1">
MLPOINTS
</dt>
<dd>
<p>
<code>-&gt;&gt;l</code>
</p>
</dd>
<dt class="hdlist1">
MCPOINTS
</dt>
<dd>
<p>
<code>-ddd&gt;&gt;</code>, where <em>ddd</em> is a sequence of decimal digits
</p>
</dd>
<dt class="hdlist1">
POINTS
</dt>
<dd>
<p>
<code>-&gt;</code>
</p>
</dd>
<dt class="hdlist1">
NAME
</dt>
<dd>
<p>
................................................................................
</div>
<div class="sect1">
<h2 id="_syntax">SYNTAX</h2>
<div class="sectionbody">
<div class="paragraph"><p>The following is a <em>yacc</em> style syntax of the language accepted by <strong>pycca</strong>.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>translation
    :
    |   domainDefs
    ;

domainDefs
    :   domain
    |   domainDefs domain
................................................................................

attrValue
    :   CODE
    |   POINTS NAME
    |   POINTS NAME '.' NAME
    |   MPOINTS nameList END
    |   '-'
    ;</code></pre>
</div></div>
</div>
</div>
<div class="sect1">
<h2 id="_semantics">SEMANTICS</h2>
<div class="sectionbody">
<div class="paragraph"><p>The <strong>pycca</strong> language allows the definition of <em>domains</em>.
................................................................................
constructs of the <strong>pycca</strong> language.</p></div>
<div class="sect2">
<h3 id="_domain">DOMAIN</h3>
<div class="paragraph"><p>Domain definitions start with the <strong>domain</strong> keyword followed by the
name of the domain and stops at the matching <strong>end</strong> keyword.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>domain myDomain
    # Put your domain definition here
end</code></pre>
</div></div>
<div class="paragraph"><p>The procedural interface to a domain consists of a set of <em>domain operations</em>.
Domain operations are converted into ordinary "C" functions.
They are made external in scope and their prototype is inserted into the
generated header file.
To help manage the global namespace, the name of the domain and an underscore
are prepended to the "C" function that is generated for a domain operation.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>domain myDomain
    domain operation
    init(void)
    {
        // the domain initialization is done here
    }
end</code></pre>
</div></div>
<div class="paragraph"><p>So this would generate:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>void myDomain_init(void)
{
    // the domain initialization is done here
}</code></pre>
</div></div>
<div class="paragraph"><p>If a domain operation returns a value, then the type is
specified by following the interface with a colon (:) and a variable type.
If no return type is specified,
then the function is typed as <strong>void</strong>.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>domain myDomain
    domain operation
    getStatus(void) : (int)
    {
        return 3 ;
    }
end</code></pre>
</div></div>
<div class="paragraph"><p>This would generate:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>int myDomain_getStatus(void)
{
    return 3 ;
}</code></pre>
</div></div>
<div class="paragraph"><p>Since domain operations form the external interface of the domain,
it is convenient to be able to associate comments and declarations
in the pycca source and have that information placed in the
generated header file.
An optional "C" segment may precede the domain operation definition
and this will be placed in the generated header.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>domain myDomain
    domain operation {
    /*
     * This operation is used to modify parameters.
     */}
    modParam(int a)
    {
        // modify parameters here!
    }
}</code></pre>
</div></div>
<div class="paragraph"><p>This construct would result in the comment being passed to the generated
header file (and only the generated header) as:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>/*
 * This operation is used to modify parameters.
 */
extern void myDomain_modParam(int a) ;</code></pre>
</div></div>
<div class="paragraph"><p>Although this construct is intended primarily to pass comments associated with
domain operations through to the generated header file that serves as the
interface specification to the domain,
the "C" code lines (like all other pycca constructs enclosed in <strong>{}</strong>)
is passed through unmodified (except for whitespace trimming) and may be used
to pass through pre-processor include directives or for any other useful
purposes.</p></div>
<div class="paragraph"><p>Complementary to domain operations are external operations.
They are defined similarly to domain operations.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>domain myDomain
    external operation
    getReactorTemp(int reactor)
    {
        // any code here is not passed through
    }
}</code></pre>
</div></div>
<div class="paragraph"><p>External operations define the external function dependencies of the
domain.
The domain expects these functions to be supplied from elsewhere.
The above example generates external declarations such as:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>extern void eop_myDomain_getReactorTemp(int reactor) ;</code></pre>
</div></div>
<div class="paragraph"><p>in both the generated header file and in the code file.
The intent of the external operation declarations is to aid in generating
bridge functions for the domain.
For each external operation, a function must be provided that
satisfies the semantics of the operation by bridging to domain
functions of another domain.
................................................................................
done via a macro.
Other bridges may be more complex, mapping encoded identifiers in one
domain to encoded identifiers in another domain.
Any code associated with the external operation does <strong>not</strong> get placed
in the generated code.
However, this code may be used in other pycca-based tools.
To invoke an external operation from with in the code of a domain,
use the <code>ExternalOp()</code> macro described below.</p></div>
</div>
<div class="sect2">
<h3 id="_classes">CLASSES</h3>
<div class="paragraph"><p>A <em>Domain</em> contains <em>classes</em>.
A <em>class</em> is <strong>template</strong> for data and behavior.
A particular <strong>instance</strong> of a class (often called an <strong>object</strong>)
performs the computational actions.
All instances of a given class have the same attribute data and
same general behavior.
A class has a name and optionally attributes and a state machine.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c1
    # class definition appears here.
end</code></pre>
</div></div>
<div class="sect3">
<h4 id="_class_attributes">CLASS ATTRIBUTES</h4>
<div class="paragraph"><p>Attributes are declared in the same way as structure members in "C",
but without any punctuation.
Attributes are optional, but useful classes usually have attributes.
Following the lexical conventions,
the "C" declarations appear in parentheses.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c1
    attribute (int a1)
end</code></pre>
</div></div>
<div class="paragraph"><p>The default value of an instance can also be specified.
The default value is used only if no value is specified when
an initial instance of the class is defined.
Default values are used only when specifying the set of initial instances.
For dynamically created instances,
all attribute values are set by running code.
The default value must evaluate to a valid "C" compile-time constant expression
(since it will be used as an initializer)
and since it is passed through must be enclosed in braces.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c1
    attribute (int a2) default {sizeof(int) + 32}
end</code></pre>
</div></div>
</div>
<div class="sect3">
<h4 id="_class_references">CLASS REFERENCES</h4>
<div class="paragraph"><p>Sometimes classes need to refer to other classes or themselves in
order to implement relationships.
A reference is a special kind of attribute
................................................................................
as a pointer to a structure that matches the class name.</p></div>
<div class="sect4">
<h5 id="_singular_references">SINGULAR REFERENCES</h5>
<div class="paragraph"><p>Usually a single valued reference is used to implement
traversal of a relationship on the side that is <em>one</em> or <em>one-conditional</em>.
In the case of a singular reference,
a simple pointer member holds the address of the referenced instance
and <code>NULL</code> may be used to indicate conditionality.
So</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c1
    reference R1 -&gt; c1
end</code></pre>
</div></div>
<div class="paragraph"><p>is translated to</p></div>
<div class="listingblock">
<div class="content">
<pre><code>struct c1 {
    ...
    struct c1 *R1 ;
    ...
} ;</code></pre>
</div></div>
</div>
<div class="sect4">
<h5 id="_multiple_references">MULTIPLE REFERENCES</h5>
<div class="paragraph"><p>A reference may also implement a relationship traversal for the side
that is "many" or "many-conditional".
This type of reference storage is more complicated since we must
................................................................................
relationships.
Static relationships don&#8217;t change in time over the course of program
execution.
They are occur relatively frequently in some applications and which
instance are related to each other is known at compile time.
Two different storage strategies are available for static multiple
references.</p></div>
<div class="paragraph"><p>Using the <code>-&gt;&gt;</code> symbol will cause <strong>pycca</strong> to insert an
array of pointers.
The <code>-&gt;&gt;</code> notation comes in several alternate forms that are used
to control the details of how the array of pointers is allocated.
If <code>-&gt;&gt;</code> or <code>-&gt;&gt;n</code> is used to define the multiple reference,
then the class structure has a pointer member defined for it
that will point to a <code>NULL</code> terminated array of class references.
For example, the class fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c2
    reference R2 -&gt;&gt; c1
end</code></pre>
</div></div>
<div class="paragraph"><p>translates into the "C" structure fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    struct c1 *const*const R2 ;</code></pre>
</div></div>
<div class="paragraph"><p>If <code>-&gt;&gt;c</code> is used to define the reference, then the array
of class references is <strong>counted</strong> and the class structure will have
two members defined for it, a pointer to the array and a count value.
In this case the class fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c3
    reference R3 -&gt;&gt;c c5
end</code></pre>
</div></div>
<div class="paragraph"><p>translates into the "C" structure fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    struct c5 *const*const R3 ;
    unsigned R3__count ;</code></pre>
</div></div>
<div class="paragraph"><p>The <em>&lt;name&gt;__count</em> member should be accessed using the <code>RefCountMember()</code>
macro described below to insulate any code from the member naming convention.</p></div>
<div class="paragraph"><p>In both cases,
<strong>pycca</strong> will examine the initial instance population and build an array of
pointers in constant memory that point to the related instances and will
initialize the class instance with the pointer to the reference array.
If a <code>NULL</code> terminated array was requested then the array of references
will have a <code>NULL</code> value as its last element.
If a counted array was requested, the array contains just as many
pointers as indicated by the initial instance population and a count
of the number of pointers in the array is set in the initializer
of the referrring instance.</p></div>
<div class="paragraph"><p>For dynamic relationships,
two alternatives are provided.
If the reference specification is of the form "-ddd&gt;&gt;",
................................................................................
of class references is allocated in non-constant memory.
When the count form is used,
then the class instances will have an array of pointers of the specified size
defined as part of their class structure.
For example, the class fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c6
    reference R4 -20&gt;&gt; c7
end</code></pre>
</div></div>
<div class="paragraph"><p>translates into the "C" structure fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    struct c7 *R4[20] ;</code></pre>
</div></div>
<div class="paragraph"><p>Where the <em>R4</em> member is an array of of class references
(<em>i.e.</em> pointers of type <em>struct c7 *</em> in this case).
The array will be initialized for each instance with the references specified
in the instance definition for the instance and any unused slots will be set to
<code>NULL</code>.
Action code can then manage that storage to implement dynamic one-to-many
type relationships where a <code>NULL</code> value is used to indicate that a reference
storage slot is not being used.</p></div>
<div class="paragraph"><p>Finally, if the reference specification is of the form <code>-&gt;&gt;l</code>,
a doubly linked list is set up to manage the multiple relationship.
This entails two things.
First, a set of links is added as a member of the class that defines
the reference.
Second, a corresponding set of links is added as a member of the class to which
the reference is made.
This allows a list be built starting at the referring class and threading
................................................................................
Thus the memory for the links is relatively easily managed and
referenced instances may be easily added and removed from the list.
A set of macros, defined below, is provided to hide the details of the
linking, unlinking and traversal mechanism.</p></div>
<div class="paragraph"><p>For example, the class fragment:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c8
    reference R10 -&gt;&gt;l c9
end</code></pre>
</div></div>
<div class="paragraph"><p>adds the following member to <em>struct c8</em>:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    rlink_t R10 ;</code></pre>
</div></div>
<div class="paragraph"><p>and adds the following member to <em>struct c9</em>:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    rlink_t R10__links ;</code></pre>
</div></div>
<div class="paragraph"><p>Any initial instances of <em>c9</em> that are referenced by <em>c8</em> are linked
together as part of the initializers defined by the initial instance
population.</p></div>
</div>
</div>
<div class="sect3">
<h4 id="_class_constructors_and_destructors">CLASS CONSTRUCTORS AND DESTRUCTORS</h4>
<div class="paragraph"><p>A class may define a constructor or a destructor.
Neither constructors nor destructors can take parameters.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c3
    attribute (int count)
    constructor {
        self-&gt;count = 0 ;
    }
    destructor {
        reportCount(self-&gt;count) ;
    }
end</code></pre>
</div></div>
<div class="paragraph"><p>If any class that contains a constructor also has an initial instance
population specified,
then <strong>pycca</strong> will generate a function of the form, <code>&lt;domain name&gt;_Ctor</code>
where &lt;domain name&gt; is replaced by the name of the domain.
This function will invoke the constructor for all initial instances of
all classes that have defined a set of initial instances and also
have defined a constructor.
It is up to the user to invoke this function during the application
initialization phase (<em>e.g.</em> in some domain operation that is invoked
at initialization time).</p></div>
................................................................................
<div class="sect3">
<h4 id="_class_operations">CLASS OPERATIONS</h4>
<div class="paragraph"><p>A class may define class based operations.
Class operations do reference any particular instance and provide a means of
factoring common class operations into a single function.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c4
    class operation
    common(
        int a,
        char *b) : (int)
    {
        // Common class operation code.
        // No defined instance variable.
        return -1 ;
    }
end</code></pre>
</div></div>
</div>
<div class="sect3">
<h4 id="_instance_operations">INSTANCE OPERATIONS</h4>
<div class="paragraph"><p>A class may define instance based operations.
Instance operations have an implicit first parameter which is a pointer
to the instance on which the operation is to be performed.
It is not necessary to declare the <code>self</code> variable as <strong>pycca</strong> will
insert it.
However, since this is "C", it is necessary to supply a value for the
implied <code>self</code> parameter when invoking an instance operation.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c5
    attribute (int count)
    instance operation
    addFive()
    {
        // Can reference "self"
        self-&gt;count += 5 ;
    }
end</code></pre>
</div></div>
</div>
<div class="sect3">
<h4 id="_instance_storage">INSTANCE STORAGE</h4>
<div class="paragraph"><p>A separate pool of storage of instances is generated for each class.
Instances may be declared as initial instances, as slots in the
storage pool for dynamically created instances or the pool may contain both
initially defined instances and slots for dynamic instance creation.
If a class definition contains a <em>slots</em> statement, then the storage
pool for the class will contain at least the given number of instance
storage locations.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c6
    attribute (int count)
    population dynamic
    slots 5
end</code></pre>
</div></div>
<div class="paragraph"><p>The above example insures that there are five dynamically allocatable
instances of class <em>c6</em>.</p></div>
<div class="sect4">
<h5 id="_initial_instances">INITIAL INSTANCES</h5>
<div class="paragraph"><p>The <strong>instance</strong> and <strong>table</strong> statements are used to define
initial class instances.
................................................................................
for that class may be defined.
Instances may be named or anonymous.
Named instances are useful when creating initial instances that
have instance references in them.
Anonymous instances cannot be referred to directly by other
initial instances.
Named instances also have the advantage of being able to be
located at run time using the <code>Instance()</code> macro.</p></div>
<div class="paragraph"><p>The values of all attributes that do not have a defined default
value must be specified.
For attributes that have a defined default value,
they are given that default value if not mentioned in the
instance definition.
Otherwise the default value is overrided when mention in the instance
definition.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c6
    attribute (int count) default {0}
    attribute (int age)
    reference R13 -&gt; c7
end

instance c6@i1
    (int age) {22}
    (int count) {17}
    R13 -&gt; i14
end</code></pre>
</div></div>
<div class="paragraph"><p>The above example defines a named initial instance, <strong>i1</strong>, of class, <strong>c6</strong>.
The default value of <code>(int count)</code> is overridden to be 17 rather than
the default of 0.
The singular reference, <strong>R13</strong>, is set to point to the <strong>i14</strong> instance of
class, <strong>c7</strong>.</p></div>
<div class="paragraph"><p>When there are a number of instances of a particular class,
the <strong>instance</strong> statement can be tedious to use and obscures the
nature of the instances as a group.
In this case, the <strong>table</strong> command allows many instances to be defined
in a tabular arrangement.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>table
    c6      (int age)       (int count)     R13
    @i2     {19}            {26}            -&gt; i8
    @       -               {27}            -&gt; i9
    @i3     {42}            {28}            -&gt; i10
end</code></pre>
</div></div>
<div class="paragraph"><p>The above example shows three more initial instances for class <strong>c6</strong>.
The attributes are listed as a heading, followed by lines that
give the name of the instance and the values of the attributes it is to have.
The heading need only contain those attributes that you wish to define
to be different from the default.
If the instance name is not given (<em>i.e.</em> a plain <em>@</em> is present)
................................................................................
Neither <strong>constant</strong> nor <strong>static</strong> class storage types
may have a <strong>slots</strong> statement to declare dynamic instances.
Pycca will issue a warning for <strong>constant</strong> or <strong>static</strong> classes whose
initial instance population is empty and no storage pool will be
defined for such classes.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c7
    attribute (int count)
    attribute (int year)
    population constant
end

instance c7
    (int count) 3
    (int year) 1977
end

instance c7
    (int count) 7
    (int year) 1978
end</code></pre>
</div></div>
<div class="paragraph"><p>The above example declares two anonymous instances of the constant class, <strong>c7</strong>.
The storage pool for <strong>c7</strong> will be declared as <em>const</em> and its size is
fixed at two.</p></div>
</div>
</div>
</div>
................................................................................
type state machines.
For Moore machines,
action code is associated with the state and that code is executed
upon the transition into the state.
There are quite a number of rules for state machines as we shall see below.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class Dog
    machine
        initial state born
        final state die

        state born()
        {
            // "C" code for the "born" state goes here
................................................................................
        transition grow - Age -&gt; die

        state die()
        {
            // "C" code for the "die" state goes here
        }
    end
end</code></pre>
</div></div>
<div class="paragraph"><p>Each machine may specify a default initial state using the
<strong>initial state</strong> statement.
If none is given, then the first state defined is taken to be
the default initial state.
A state may be marked as a final state using the <strong>final state</strong>
statement.
................................................................................
Thus it is not allowed for the same event to cause a transition
into states that have a different parameter signatures.
<strong>Pycca</strong> detects this error, issuing an appropriate error message.</p></div>
<div class="paragraph"><p>The state action is supplied by the "C" code in the enclosing
braces.
When an event causes a transition into a state,
the given "C" code executes.
The code may refer to <code>self</code> which is declared as a pointer
to a class instance and contains the reference to the instance
to which the event was directed.</p></div>
<div class="paragraph"><p>Transitions are specified by the <strong>transition</strong> statement.
This statement lists the current state, event and new state.
<strong>Pycca</strong> allows the state machine to be specified in any order.
You may list all the state definitions followed by the transitions
or any combination you find clearest.
................................................................................
<div class="paragraph"><p>The STSA supports dynamic instance creation.
Each class has its own storage pool.
This is in keeping with the minimal system assumptions that STSA
makes.
Class instances may be created in a synchronous manner or in an
asynchronous manner.
Synchronous creation involves invoking a create function from STSA.
Pycca provides a convenience macro, <code>PYCCA_createInstance</code>, to
help in the interface to STSA.
Synchronously created instances may be placed in any state when
they are created.
Usually the default initial state is chosen using the
<code>InitialStateNumber()</code> macro (or just 0 for creating instances that
have no associated state machine).
It is important to remember that synchronously created instances
<em>do not execute the action of their initial state</em>.
They are simply allocated from the class storage pool, run the
constructor if any and are placed in the state.
So for example:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>ClassRefVar(Dog, d) ;
d = PYCCA_createInstance(Dog, InitialStateNumber(Dog)) ;</code></pre>
</div></div>
<div class="paragraph"><p>will create an instance of <em>Dog</em> held in the <code>d</code> variable in its
default initial state, but state action of the default initial state
has not been run.</p></div>
<div class="paragraph"><p>The other form of instance creation is asynchronous instance creation.
Any <strong>transition</strong> statement where the current state is named by the
period character (.) is a creation transition.
The period state name represents an initial pseudo state where
the instance has been created and will be delivered a event causing
a transition into the new state given in the <strong>transition</strong> statement.
For asynchronous creation, the state action into which the
instance transition upon receiving the creation event is executed.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class Dog
    machine
        transition . - Born -&gt; born
        transition born - GrowUp -&gt; grown
        state born()
        {
            puts("Dog is born") ;
        }

        state grown()
        {
            puts("Dog is grown") ;
        }
    end
end</code></pre>
</div></div>
<div class="paragraph"><p>defines a class with a creation event, <code>Born</code>.
Executing the statement:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>PYCCA_generateCreation(Born, Dog, self) ;</code></pre>
</div></div>
<div class="paragraph"><p>will cause the creation event <code>Born</code> to be queued.
When that event is dispatched, an instance of Dog will
be created in the initial pseudo state (with the constructor
executed if any) and the
<code>Born</code> event will be delivered to the new instance.
The event will cause a transition from the initial pseudo state
into the <code>born</code> state
and the action associated with that state will be executed.</p></div>
<div class="paragraph"><p>The creation rules may seem complex, but they cover all the
required circumstances.
It is worth noting that any state that is an initial state and
which does not have any <em>incoming</em> transitions should have
an empty state action.
Since there is never any transition into the state,
................................................................................
<h4 id="_generalizations_implemented_by_reference">GENERALIZATIONS IMPLEMENTED BY REFERENCE</h4>
<div class="paragraph"><p>A class defines a storage for generalization relationship implmented
by reference using the <strong>subtype &#8230; reference</strong> statement.
This statement gives a list of classes that are to be considered
as the subtype classes.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c8
    subtype R9 reference
        cs1
        cs2
        cs3
    end
end</code></pre>
</div></div>
<div class="paragraph"><p><strong>Pycca</strong> will translate a <strong>subtype &#8230; reference</strong> statement into
two structure members:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>struct c8 {
    SubtypeCode R9__code ;
    MechInstance R9 ;
} ;</code></pre>
</div></div>
<div class="paragraph"><p>The <strong>R9</strong> member holds a pointer to one of the subtypes of the <strong>R9</strong>
reference.
The <strong>R9__code</strong> member holds an integer encoding of the type of the
<strong>R9</strong> pointer.
In this scheme of subtyping,
the subtype instances are quite distinct from the supertype and
................................................................................
<div class="paragraph"><p>In simple cases,
typically a generalization hierarchy that is only a single level deep,
it is sometimes more convenient to hold the subtype classes of the supertype
directly in the storage of the supertype instances as a union data type.
Considering the above example, it would appear in union form as below:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class c8
    subtype R9 union
        cs1
        cs2
        cs3
    end
end</code></pre>
</div></div>
<div class="paragraph"><p>In this case,
<strong>pycca</strong> would translate this subtype statement into:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>struct c8 {
    SubtypeCode R9__code ;
    union {
        struct cs1 R9_cs1 ;
        struct cs2 R9_cs2 ;
        struct cs3 R9_cs3 ;
    } R9 ;
} ;</code></pre>
</div></div>
<div class="paragraph"><p>Keeping subtypes in a union data structure contained within a member
of the supertype can make managing dynamic instances easier,
especially in the case of dynamic migration of one subtype into another.
As long as the size of the subtype classes is similar,
there is no waste of memory and there may be some savings.
However, complex hierarchies, such as those where one supertype class
................................................................................
In practice the full power of polymorphic events is rarely needed.
<strong>Pycca</strong> includes checks to insure that the polymorphism is properly
defined.
The following example shows a situation with a two level generalization
hierachy.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>class super1
    subtype R1 reference
        sub_1_A
        sub_1_B
    end
    polymorphic event
        e1
        e2
................................................................................
    machine
        transition s1 - e2 -&gt; s1
        state s1()
        {
            puts("Consume e2 at this level") ;
        }
    end
end</code></pre>
</div></div>
<div class="paragraph"><p>In this example, the supertype class, <strong>super1</strong>, has a
generalization relationship, <strong>R1</strong>, with two subtypes,
<strong>sub_1_A</strong> and <strong>sub_1_B</strong>.
The <strong>super1</strong> class defines two polymorphic events, <strong>e1</strong> and <strong>e2</strong>.
This means that the subtypes of <strong>super1</strong> must either consume the
polymorphic events directly or they must be consumed by
................................................................................
For example, header files needed by the "C" code in actions
needs to be put into the generated file at a location dictated by the
compiler.
<strong>Pycca</strong> allows both <strong>prolog</strong> and <strong>epilog</strong> code to be inserted in
both the <strong>interface</strong> and <strong>implementation</strong> files.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>implementation prolog {
#include &lt;stddef.h&gt;
#include "myHeader.h"
}</code></pre>
</div></div>
<div class="paragraph"><p>Prolog code is placed in the generated "C" file before any of the
passed through code.
Similarly for the <strong>interface</strong> prolog.
It is placed before the domain function prototypes.
Epilog code is placed at the end.
Note also that prolog and epilog code is cumulative in that there
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <code>NULL</code>
if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_generateSelf(e, c)</div><p>Generate an event to self.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</p>
</dd>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class of <code>self</code>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_generateToSelf(e)</div><p>Generate an event to self.
This macro will use the current class context.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <code>NULL</code>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_generateCreation(e, c, s)</div><p>Generate a creation event.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <code>NULL</code>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
<dt class="hdlist1">
d
</dt>
<dd>
<p>
The delay time, in milliseconds.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_generateDelayedSelf(e, c, d)</div><p>Generate a delayed event to <code>self</code>.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
The name of the event to generate.
................................................................................
</p>
</dd>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class of <code>self</code>.
</p>
</dd>
<dt class="hdlist1">
d
</dt>
<dd>
<p>
The delay time, in milliseconds.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_generateDelayedToSelf(e, d)</div><p>Generate a delayed event to <code>self</code>.
This macro will use the current class context.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <code>NULL</code>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_cancelDelayedSelf(e, c)</div><p>Cancel a delayed event that was sent to <code>self</code>.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
The name of the event to generate.
</p>
</dd>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class of <code>self</code>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_cancelDelayedToSelf(e)</div><p>Cancel a delayed event that was sent to <code>self</code>.
This macro will use the current class context.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <code>NULL</code>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_remainDelayedSelf(e, c)</div><p>Retrive the time remaining on a self-directed delayed event.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</p>
</dd>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class of <code>self</code>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_remainDelayedToSelf(e)</div><p>Retrive the time remaining on a self-directed delayed event.
This macro will use the current class context.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</li>
</ol></div>
<div class="paragraph"><div class="title">Sending a <em>Bark</em> Event</div><p>Assuming that <em>dog</em> is an instance of class <em>Dog</em> and that the <em>Bark</em>
event takes a single parameter, <em>howLoud</em>, then the following will send
the <em>Bark</em> event to the <em>dog</em> instance of <em>Dog</em>.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>MechEcb bark = PYCCA_newEvent(Bark, Dog, dog, self) ;
PYCCA_eventParam(bark, Dog, Bark, howLoud) = 20 ;
PYCCA_postEvent(bark) ;</code></pre>
</div></div>
<div class="paragraph"><div class="title">PYCCA_newEvent(e, c, i, s)</div><p>Returns a <em>MechEcb</em> for an ordinary event.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <code>NULL</code>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_newSelfEvent(e, c)</div><p>Returns a <em>MechEcb</em> for an ordinary event where the target instance
and the sending instance are <code>self</code>.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
The name of the event to generate.
................................................................................
<dd>
<p>
The name of the class of the instance receiving the event.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_newEventToSelf(e)</div><p>Returns a <em>MechEcb</em> for an ordinary event where the target instance
and the sending instance are <code>self</code>.
This macro will use the current class context.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
e
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <code>NULL</code>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_newCreationEvent(e, c, s)</div><p>Returns a <em>MechEcb</em> for a creation event.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <code>NULL</code>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_newCreationEventForThisClass(e, s)</div><p>Returns a <em>MechEcb</em> for a creation event for creating an instance of
the current class context.</p></div>
<div class="dlist"><dl>
................................................................................
</p>
</dd>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the instance that is sending the event. This may be <code>NULL</code>
    if the event originates from a <em>domain operation</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_eventParam(ecb, c, e, p)</div><p>Retrieve the value of an event parameter.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
The initial state that the class is to be placed in.
    This argument is the actual numeric code for the state and should
    be specified by a macro.
    This is usually specified as <em>InitialStateNumber(c)</em>,
    to create the instance in its default initial state
    but a class may be created in any of its states as
    specified by the <em>StateNumber(c, s)</em> macro.
    For classes that do not have an associated state machine use <code>0</code>.
    <em>N.B.</em> that the action of the initial state is <strong>not</strong> executed when
    an instance is synchronously created in this manner.
    To both create an instance and execute an action, you must create
    the instance asynchronously using a creation event.
</p>
</dd>
</dl></div>
................................................................................
</dt>
<dd>
<p>
A pointer to the instance that is to have its state changed.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_selectOneInstWhere(i, c, expr)</div><p>This macro expands to a linear search of class named, <code>c</code>, for the first
instance where <code>expr</code> is true.
The <code>i</code> argument is the name of a
variable which is of type pointer to <code>c</code> structure.
The expanded code searches the storage pool for <code>c</code>
stopping at the first instance that is in use and that satisfies
<code>expr</code>.
<code>Expr</code> is presumed to contain accesses to the attributes of <code>c</code>
in the form of <code>i&#8594;a</code>.
The value of <code>i</code> variable is modified and at the end of the loop will either
point to the first instance of <code>c</code> where <code>expr</code> evaluates to non-zero
or will point past the end of
the storage pool for the class (as given by the <code>EndStorage(c)</code> macro,
<strong>i.e.</strong> if <code>i</code> &gt;= EndStorage(c) then the search failed).
Note that this macro tests for whether or not the instance is
currently allocated and therefore is only useful for classes that are
either dynamically allocated or have a state machine.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
i
</dt>
................................................................................
</dt>
<dd>
<p>
A "C" expression that will be intepreted as a boolean.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_selectOneInstOfThisClassWhere(i, expr)</div><p>This macro operates the same as <code>PYCCA_selectOneInstWhere</code> except that
the current class context is used to supply the class name.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
i
</dt>
<dd>
<p>
................................................................................
</dt>
<dd>
<p>
A "C" expression that will be intepreted as a boolean.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_selectOneStaticInstWhere(i, c, expr)</div><p>This macro is like <code>PYCCA_selectOneInstWhere</code> except that it does not
assume that <code>c</code> is has a dynamic pool associated with it.
For static and constant populations, there may not be an
instance allocation block created and this macro does not include
the test that the instance in the storage pool is actually in use.</p></div>
<div class="paragraph"><div class="title">PYCCA_selectOneStaticInstOfThisClassWhere(i, expr)</div><p>This macro is like <code>PYCCA_selectOneInstWhere</code> except that it uses the
current class context to supply the class name.</p></div>
<div class="paragraph"><div class="title">PYCCA_forAllInst(i, c)</div><p>This macro is a convenience macro that sets up a loop such that iterates
across all instances of a class.
The macro should be followed by a statement (possibly compound and
enclosed in braces (<strong>{}</strong>).
In the statement, <strong>i</strong> will iteratively take on the value of every
instance defined for the class, <strong>c</strong>.</p></div>
................................................................................
</dt>
<dd>
<p>
The name of the class of the instance corresponding to <em>i</em>.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_forAllInstOfThisClass(i)</div><p>This macro is like <code>PYCCA_forAllInst</code> except that it uses the
current class context to supply the class name.</p></div>
<div class="paragraph"><div class="title">PYCCA_forAllRelated(v, i, r)</div><p>This macro is a convenience macro that sets up a loop such that iterates
across the instances that are related to the class.
This macro assumes that the related instances were declared using the
<code>&#8594;&gt;c</code>, syntax, <em>i.e.</em> the related instances are of the counted type.
The macro should be followed by a statement (possibly compound and
enclosed in braces (<strong>{}</strong>).
In the macro, <strong>v</strong> should be declared as <code>ClassRefSetVar</code> or a
<code>ClassRefConstSetVar</code>. Then <strong>v</strong> is iterated over the set of related instances.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
v
</dt>
<dd>
<p>
The name of a reference set variable.
................................................................................
</dt>
<dd>
<p>
The name of the relationship across which the iteration occurs.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_forAllRelatedTerm(v, i, r)</div><p>This macro is the same as <code>PYCCA_forAllRelated()</code> except that the relationship
must have been declared using the <code>&#8594;&gt;n</code> syntax, <em>i.e.</em> the relationship
storage consists of a <code>NULL</code> terminated array of instance pointers.</p></div>
</div>
<div class="sect2">
<h3 id="_generalization_navigation">GENERALIZATION NAVIGATION</h3>
<div class="paragraph"><p>When a generalization relationship is implemented as a union
data type, the instances of the subtypes do not use a pointer to
navigate to the supertype.
Rather it is only necessary to <em>up cast</em> the self pointer to
................................................................................
<div class="paragraph"><div class="title">PYCCA_unionSupertype(sub, supc, r)</div><p>Navigate to the supertype for instances contained in a union.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sub
</dt>
<dd>
<p>
A pointer to the subtype instance. This is frequently <code>self</code>.
</p>
</dd>
<dt class="hdlist1">
supc
</dt>
<dd>
<p>
................................................................................
<div class="paragraph"><div class="title">PYCCA_unionSubtype(sup, r, subc)</div><p>Navigate to the subtype instance contained in a union.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sup
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <code>self</code>.
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
................................................................................
<div class="paragraph"><div class="title">PYCCA_referenceSubtype(sup, r, subc)</div><p>Navigate to the subtype instance by pointer reference.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sup
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <code>self</code>.
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
................................................................................
the subtype class, <em>subc</em> across the relationship, <em>r</em>.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sup
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <code>self</code>.
</p>
</dd>
<dt class="hdlist1">
supc
</dt>
<dd>
<p>
................................................................................
For subtypes that have a constructor, an explicit call is required.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sup
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <code>self</code>.
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
................................................................................
<p>
The name of the subtype class.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_initUnionInstanceToState(sup, r, subc, st)</div><p>Initialize a subtype instance that is contained in a union based
supertype specifying a particular state.
This macro is like the <code>PYCCA_initUnionInstance</code> macro but also
allows you to specify the state into which the instance is placed.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
sup
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <code>self</code>.
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
st
</dt>
<dd>
<p>
The state name of a <code>subc</code> class state.
</p>
</dd>
</dl></div>
<div class="paragraph"><div class="title">PYCCA_relateSubtypeByRef(s, supc, r, t, subc)</div><p>Relate a supertype instance to a subtype instance when the relationship
is being stored by reference.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
s
</dt>
<dd>
<p>
A pointer to the supertype instance. This is frequently <code>self</code>.
</p>
</dd>
<dt class="hdlist1">
supc
</dt>
<dd>
<p>
................................................................................
</dl></div>
</div>
<div class="sect2">
<h3 id="_dynamic_relationship_management">DYNAMIC RELATIONSHIP MANAGEMENT</h3>
<div class="paragraph"><p>These macro aid in managing the references associated with dynamic
relationships.
In particular, one-to-many relationships implemented by a counted pointer
array (<em>i.e.</em> those using the <code>-ddd&gt;&gt;</code> syntax)
require you to find a slot whose value is <code>NULL</code> and store the reference there.
Unrelating instances is similar.</p></div>
<div class="paragraph"><div class="title">PYCCA_relateToMany(n, o, r, m)</div><p>Relate two instances in an one-to-many relationship that is implemented
using a counted pointer array.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
n
</dt>
................................................................................
</dt>
<dd>
<p>
A pointer to an instance on the many side of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>The <code>n</code> variable is ranged over the counted pointer array where instances
of <code>r</code> are stored
until an empty slot is found (as indicated by a <code>NULL</code> value) and then many
side instance is then assigned to that slot.
If no slot is found, then the expression <code>n &gt;= o&#8594;r + COUNTOF(o&#8594;r)</code>
is true.</p></div>
<div class="paragraph"><div class="title">PYCCA_unrelateFromMany(n, o, r, m)</div><p>Unrelate two instances from a one-to-many relationship that is implemented
by a counted pointer array.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
n
</dt>
................................................................................
</dt>
<dd>
<p>
A pointer to an instance on the many side of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>The <code>n</code> variable is ranged over the counted pointer array where instances
of <code>r</code> are stored a slot containing the value of <code>m</code> is found
and then that slot is assigned <code>NULL</code>.
If no matching slot is found, then the expression <code>n &gt;= o&#8594;r + COUNTOF(o&#8594;r)</code>
is true.</p></div>
<div class="paragraph"><p>For one-to-many relationships implemented by linked lists (<em>i.e.</em> those
using the <code>-&gt;&gt;l</code> syntax), the following macros are useful.</p></div>
<div class="paragraph"><div class="title">PYCCA_linkToMany(o, r, m)</div><p>Relate two instances in an one-to-many relationship that is implemented
using linked lists.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
o
</dt>
<dd>
................................................................................
</dt>
<dd>
<p>
A pointer to an instance on the many side of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>The <code>m</code> instance is added to the linked list of instances that are related
to the <code>o</code> instance across relationship <code>r</code>.</p></div>
<div class="paragraph"><div class="title">PYCCA_unlinkFromMany(m, r)</div><p>Unrelate an instance in a one-to-many relationship that is implemented
using linked lists.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
m
</dt>
<dd>
................................................................................
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
The name of the relationship in which <code>m</code> participates.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>The <code>m</code> instance is unlinked from the list associated with relationship <code>r</code>.</p></div>
<div class="paragraph"><div class="title">PYCCA_isLinkEmpty(o, r)</div><p>Test if there are any instance in a one-to-many relationship implemented
using linked lists.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
o
</dt>
<dd>
................................................................................
<dd>
<p>
The name of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro evaluates to a boolean that is true if there are no instances
linked from <code>o</code> across the relationship, <code>r</code>, and false otherwise.</p></div>
<div class="paragraph"><div class="title">PYCCA_isLinkNotEmpty(o, r)</div><p>Test if there are no instances in a one-to-many relationship implemented
using linked lists.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
o
</dt>
<dd>
................................................................................
<dd>
<p>
The name of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro evaluates to a boolean that is true if there is at least one
instance linked from <code>o</code> across the relationship, <code>r</code>, and false otherwise.</p></div>
<div class="paragraph"><div class="title">PYCCA_forAllLinkedInst(o, r, l)</div><p>Iterate over the instances of a one-to-many relationship implemented using
linked lists.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
o
</dt>
<dd>
................................................................................
</p>
</dd>
<dt class="hdlist1">
l
</dt>
<dd>
<p>
The name of a variable of type <code>rlink_t *</code>
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro expands to a <code>for</code> loop construct where all the instances related
to <code>o</code> across <code>r</code> are visited.
The link variable, <code>l</code>, is successively assigned values of the links
related on the many side to <code>o</code>.
The value of the link variable, <code>l</code>, is <em>not</em> a pointer to an instance.
The instance pointer must be recovered by using the
<code>PYCCA_linkToInstRef()</code> or <code>PYCCA_linkToInstRefOfThisClass()</code>
macros described below.</p></div>
<div class="dlist"><div class="title">PYCCA_linkToInstRef(l, c, r)</div><dl>
<dt class="hdlist1">
l
</dt>
<dd>
<p>
The name of a variable of type <code>rlink_t *</code>
</p>
</dd>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class on the many side of the relationship
to which <code>l</code> refers.
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
The name of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro converts a link pointer of type <code>rlink_t *</code> that is a link
in relationship, <code>r</code>, to pointer to an instance of class, <code>c</code>.</p></div>
<div class="dlist"><div class="title">PYCCA_linkToInstRefOfThisClass()</div><dl>
<dt class="hdlist1">
l
</dt>
<dd>
<p>
The name of a variable of type <code>rlink_t *</code>
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
The name of the relationship.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro is like <code>PYCCA_linkToInstRef()</code> except that it uses the
current class context to determine the class of the referenced instance.</p></div>
</div>
<div class="sect2">
<h3 id="_instance_identifiers">Instance Identifiers</h3>
<div class="paragraph"><p>It is sometimes useful to use have an means to identify an instance of
a particular class outside of a domain.
The pointer value of the instance is <strong>not</strong> suitable for this purpose,
but the array index of the instance in its storage pool is satisfactory.
The macros in this group provide a means of generating a small integer value
for a instance that can be used as an identifier external to the domain
or to translate an instance identifier into a pointer reference to the instance.</p></div>
<div class="paragraph"><div class="title">PYCCA_idOfSelf</div><p>This macro generates an integer identifier for the <code>self</code> reference.</p></div>
<div class="dlist"><div class="title">PYCCA_idOfRef(c, r)</div><dl>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class.
................................................................................
</p>
</dd>
<dt class="hdlist1">
r
</dt>
<dd>
<p>
The reference value for a member of class, <code>c</code>.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro generates an integer identifier for a reference, <code>r</code> of class, <code>c</code>.</p></div>
<div class="dlist"><div class="title">PYCCA_idOfInst(c, n)</div><dl>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class.
................................................................................
</dt>
<dd>
<p>
The name of a named instance.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro generates an integer identifier for the named instance, <code>n</code> of
class, <code>c</code>.</p></div>
<div class="dlist"><div class="title">PYCCA_refOfId(c, i)</div><dl>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
The name of the class.
................................................................................
</dt>
<dd>
<p>
An integer identifier for an instance of the class.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro returns an instance reference to an instance of class, <code>c</code>, that
is identifed by the integer identifier, <code>i</code>.</p></div>
<div class="dlist"><div class="title">PYCCA_refOfThisClassId(i)</div><dl>
<dt class="hdlist1">
i
</dt>
<dd>
<p>
An integer identifier for an instance of the class.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro is like <code>PYCCA_refOfId()</code> except that it uses the current
class context to determine the class of the instance identifier.</p></div>
<div class="dlist"><div class="title">PYCCA_checkId(c, i)</div><dl>
<dt class="hdlist1">
c
</dt>
<dd>
<p>
................................................................................
</dt>
<dd>
<p>
An integer identifier for an instance of the class.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro generates an invocation of the <code>assert()</code> macro to test
that the identifier, <code>i</code> is valid for class, <code>c</code>.
This is useful if a domain operation accepts an integer identifier for
an instance and wants to assert its validity.</p></div>
<div class="dlist"><div class="title">PYCCA_checkThisClassId(i)</div><dl>
<dt class="hdlist1">
i
</dt>
<dd>
<p>
An integer identifier for an instance of the class.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This macro is like <code>PYCCA_checkId()</code> except that it uses the current
class context to determine the class of the instance identifier.</p></div>
</div>
<div class="sect2">
<h3 id="_encoding_macros">ENCODING MACROS</h3>
<div class="paragraph"><p>This set of macros gives access to the various encodings and
naming conventions used by <strong>pycca</strong> in the generated code.
These macros are used by the <em>PYCCA_</em> macros and are sometimes useful
in normal state action code.
As of version 2.6, new macros were added that can use the class context
that <strong>pycca</strong> generates.</p></div>
<div class="paragraph"><div class="title">ClassRefType(c)</div><p>Expands to the type of a reference to an instance of class named, <code>c</code>.</p></div>
<div class="paragraph"><div class="title">ThisClassRefType</div><p>Expands to the type of a reference to an instance of the current class
context.</p></div>
<div class="paragraph"><div class="title">ClassRefVar(c, v)</div><p>Declare a variable named <code>v</code> that refers to the class named, <code>c</code>.</p></div>
<div class="paragraph"><div class="title">ThisClassRefVar(v)</div><p>Declare a variable named <code>v</code> that refers to the current class.</p></div>
<div class="paragraph"><div class="title">ClassConstRefVar(c, v)</div><p>Declare a variable named <code>v</code> that refers to the class name <code>c</code>.
This macro is used for references to classes that have constant populations.</p></div>
<div class="paragraph"><div class="title">ThisClassConstRefVar(v)</div><p>Declare a variable named <code>v</code> that refers to a constant instance of the
current class.</p></div>
<div class="paragraph"><div class="title">ClassRefSetVar(c, v)</div><p>Declare a variable named <code>v</code> that refers to a set of instances of the
class named <code>c</code>.</p></div>
<div class="paragraph"><div class="title">ThisClassRefSetVar(v)</div><p>Declare a variable named <code>v</code> that refers to a set of instances of the
current class.</p></div>
<div class="paragraph"><div class="title">ClassConstRefSetVar(c, v)</div><p>Declare a variable named <code>v</code> that revers to a set of constant instances of the
class named <code>c</code>.</p></div>
<div class="paragraph"><div class="title">ThisClassConstRefSetVar(c, v)</div><p>Declare a variable named <code>v</code> that revers to a set of constant instances of the
current class.</p></div>
<div class="paragraph"><div class="title">SubCodeMember(r)</div><p>For generalization relationships, the super type holds an encoded values
that signifies the type of the sub type to which it is currently related.
This macro gives the structure member name in the super type instance
for relationship, <em>r</em>.</p></div>
<div class="paragraph"><div class="title">SubCodeValue(c, r, s)</div><p>For generalization relationships, the super type holds an encoded values
that signifies the type of the sub type to which it is currently related.
This macro gives the subtype code number for class, <em>c</em>, relationship, <em>r</em>
and subtype name, <em>s</em>.</p></div>
<div class="paragraph"><div class="title">SubTypesMember(r, s)</div><p>For subtypes held in a union, this macro gives the name of the union
member for subtype, <em>s</em>, in relationship, <em>r</em>.
Use the <em>PYCCA_unionSubtype()</em> macro to simply obtain the address
of the union subtype member.</p></div>
<div class="paragraph"><div class="title">RefCountMember(r)</div><p>For multiple references defined with the <code>-&gt;&gt;c</code> construct,
this macro gives the name of the class structure member that
holds the count of class references along the relationship given
by the <em>r</em> argument.</p></div>
<div class="paragraph"><div class="title">EventNumber(c, e)</div><p>The number of the ordinary event for the event named, <em>e</em>, in class, <em>c</em>.</p></div>
<div class="paragraph"><div class="title">ThisClassEventNumber(e)</div><p>The number of the ordinary event for the event named, <em>e</em>, in the current class.</p></div>
<div class="paragraph"><div class="title">PolyEventNumber(c, e)</div><p>The number of the polymorphic event for the event named, <em>e</em>, in class, <em>c</em>.</p></div>
<div class="paragraph"><div class="title">InitialStateNumber(c)</div><p>The number of the default initial state for instances of class, <em>c</em>.</p></div>
................................................................................
<div class="paragraph"><div class="title">ThisClassStateNumber(s)</div><p>The number encoding the state, <em>s</em>, for the current class.</p></div>
<div class="paragraph"><div class="title">SelfStateNumber</div><p>The number encoding the state for the current state of the <em>self</em> instance.</p></div>
<div class="paragraph"><div class="title">EventParamType(c, e)</div><p>The type name of the data structure for event, <em>e</em>, in class, <em>c</em>.
This macro is now <strong>deprecated</strong> as it interfers with a type name
used in the architecture mechanisms.
It is retained for backwards compatiblity but
will be removed in a future release.
Use the <code>EventParamDecl()</code> macro instead.</p></div>
<div class="paragraph"><div class="title">EventParamDecl(c, e)</div><p>The type name of the data structure for event, <em>e</em>, in class, <em>c</em>.</p></div>
<div class="paragraph"><div class="title">ThisClassEventParamDecl(e)</div><p>The type name of the data structure for event, <em>e</em>, in the current class.</p></div>
<div class="paragraph"><div class="title">ClassData(c)</div><p>A pointer to the class data structure for <em>c</em>.</p></div>
<div class="paragraph"><div class="title">ThisClassData</div><p>A pointer to the class data structure for the current class.</p></div>
<div class="paragraph"><div class="title">RefCountMember(r)</div><p>The name of the structure member that holds the reference count
for a muli-reference relationship.</p></div>
<div class="paragraph"><div class="title">BeginStorage(c)</div><p>The address of the beginning of instance storage for class, <em>c</em>.</p></div>
................................................................................
<div class="paragraph"><div class="title">ThisClassInstOp(c, o)</div><p>The name of instance operation, <em>o</em>, in the current class.</p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="instrument">INSTRUMENTATION</h2>
<div class="sectionbody">
<div class="paragraph"><p>If the <code>-instrument</code> option is used, <strong>pycca</strong> will emit instrumentation
code at the beginning of each function associated with matching classes.
When <strong>pycca</strong> includes instrumentation code, the preprocessor symbol,
<code>INSTRUMENT</code> will be defined.
The actual instrumentation is delegated to a macro,
<code>INSTR_FUNC(s)</code>, where <code>s</code> is a string indicating the specific
function being invoked.
Users may define the <code>INSTR_FUNC(s)</code> macro
(<em>e.g.</em> in the implementation prolog code) to override the default
supplied by <strong>pycca</strong>.
As of version 4.1, <strong>pycca</strong> supplies a default version of <code>INSTR_FUNC</code>
as well as one that is intended to work with a <strong>tack</strong> generated
test harness.
The default definition supplied by <strong>pycca</strong> is:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>#ifdef INSTRUMENT
#   ifndef INSTR_FUNC
#       ifdef TACK
#           include "harness.h"
#           define INSTR_FUNC(s) harness_stub_printf("instrument",\
                "func %s file %s line %u", (s), __FILE__, __LINE__)
#       else
#           define INSTR_FUNC(s) printf("%s: %s %d\n", (s), __FILE__, __LINE__)
#       endif /* TACK */
#   endif /* INSTR_FUNC */
#endif /* INSTRUMENT */</code></pre>
</div></div>
<div class="paragraph"><p><strong>N.B.</strong> because the instrumentation macro is inserted into the output
before any passed
along "C" code, old compilers that do not allow variable declarations
in a block after code statements will most likely produce compiler
errors if any local variables are declared in the instrumented function.
Such is the limitation of a program like <strong>pycca</strong> that does not
examine the "C" code passed along.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="data-portal">DATA PORTAL</h2>
<div class="sectionbody">
<div class="paragraph"><p>When the <code>-dataportal</code> option is given, <strong>pycca</strong> will generate a
set of data structures that allow access to the attributes of class
instances from outside of the domain.
This facility is provided for the following purposes:</p></div>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Bridging data values into and out of the domain for use by
................................................................................
</li>
<li>
<p>
Testing, where generated events are used to force execution paths.
</p>
</li>
</ol></div>
<div class="paragraph"><p>The only values available through this interface are declared <code>attribute</code>
values and the type code of a subtype that is related to a supertype.
The internal pointer references used for relationship navigation
are not accessible.</p></div>
<div class="paragraph"><p>The files <code>pycca_portal.h</code> or <code>pycca_portal.c</code> contain the code and
declarations needed to use the portal facility.
These files may be obtained by invoking <strong>pycca</strong> with the <code>-portalcode</code> option.
These files contain the common code that can be used to read
and update the class attributes within the domain
and generate events to the instances of the domain.
The functions require a parameter which is a pointer to the
data structure that <strong>pycca</strong> generates.
This variable is named <code>&lt;domain name&gt;_portal</code>, where <code>&lt;domain name&gt;</code>
is replaced with the name of the domain.
An external declaration of the variable is inserted into the generated
header file.
Classes and attributes are encoded as small integers and these definitions
are also placed in the generated header file.
A macro definition giving the total number of instances is also placed
in the generated header file.
This is the same numeric encoding that is placed in the generated
header file when the <code>-ids</code> option is given.</p></div>
<div class="paragraph"><p>Some care must be taken when accessing class attributes for classes
that are subtypes of a generalization that is implemented via a <code>union</code>.
In the case of a union, there are as many instances of each of the
subtypes as there are of the ultimate supertype of the generalization.
However, how the storage space of the subtype is being interpreted is
determined by a type code that is stored in the supertype.
Accessing a union subtype that is a different type than that currently
related to the supertype will not yield the correct value.
So for supertype classes,
................................................................................
terms specified in this license.</p></div>
</div>
</div>
</div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Version 4.5<br />
Last updated
 2015-05-26 09:40:07 PDT
</div>
</div>
</body>
</html>

Changes to pycca/doc/pycca.txt.

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//  pycca.txt - documentation for pycca
// ABSTRACT:
//  This file contains asciidoc(1) source for the pycca documentation.
//*--
PYCCA(1)
========
Andrew Mangogna <mangoa01@users.sourceforge.net>
:Revision: 4.3
:Date: Wed Aug 21 17:19:49 PDT 2013

NAME
----
pycca - Pass Your C Code Along

SYNOPSIS
--------







|
|







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//  pycca.txt - documentation for pycca
// ABSTRACT:
//  This file contains asciidoc(1) source for the pycca documentation.
//*--
PYCCA(1)
========
Andrew Mangogna <mangoa01@users.sourceforge.net>
:Revision: 4.5
:Date: Thu Jan 15 07:25:10 PST 2015

NAME
----
pycca - Pass Your C Code Along

SYNOPSIS
--------

Changes to pycca/src/pycca.tcl.

41
42
43
44
45
46
47








48
49
50
51
52
53
54
..
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

package require Tcl 8.6
package require cmdline

set iswrapped [expr {[lindex [file system [info script]] 0] ne "native"}]
if {$iswrapped} {
    set top [file join $::starkit::topdir lib application]








} else {
    set top [file dirname [info script]]
}

set cmdOpts {
    {version {Print out version information and exit}}
    {noline {No #line directives in the output}}
................................................................................
array set options [cmdline::getoptions argv $cmdOpts $usage]
# Generating the data bridge implies that we will also put out
# the class and attribute identifiers.
if {$options(dataportal)} {
    set options(ids) true
}

set ::pycca_version 4.3.1

if {$options(version)} {
    chan puts "pycca: version $::pycca_version"
    chan puts {
This software is copyrighted 2007 - 2013 by G. Andrew Mangogna.
The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files.

The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,







>
>
>
>
>
>
>
>







 







|




|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
..
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

package require Tcl 8.6
package require cmdline

set iswrapped [expr {[lindex [file system [info script]] 0] ne "native"}]
if {$iswrapped} {
    set top [file join $::starkit::topdir lib application]
    if {$::tcl_platform(os) eq "Linux"} {
        set libs [glob -nocomplain\
            -directory [file join $::starkit::topdir lib]\
            P-linux-*]
        foreach lib $libs {
            lappend ::auto_path $lib
        }
    }
} else {
    set top [file dirname [info script]]
}

set cmdOpts {
    {version {Print out version information and exit}}
    {noline {No #line directives in the output}}
................................................................................
array set options [cmdline::getoptions argv $cmdOpts $usage]
# Generating the data bridge implies that we will also put out
# the class and attribute identifiers.
if {$options(dataportal)} {
    set options(ids) true
}

set ::pycca_version 4.5

if {$options(version)} {
    chan puts "pycca: version $::pycca_version"
    chan puts {
This software is copyrighted 2007 - 2015 by G. Andrew Mangogna.
The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files.

The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,

Changes to tack/build/linux/tack.

cannot compute difference between binary files

Changes to tack/build/linux/tack.tpj.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
format  {TclDevKit Project File}
fmtver  2.0
fmttool {TclDevKit TclApp} 5.3

##  Saved at : Sun Oct 27 16:25:13 PDT 2013
##  By       : andrewm@zabox

########
#####
###
##
#

................................................................................
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/mechs.c}
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/mechs.h}
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/mechsIO.c}
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/mechsIO.h}
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/pycca_portal.h}
Path                   {File /home/andrewm/working/tcl-cm3/tack/package-harness-2.1-tcl.tm}
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/pycca_portal.c}

Pkg/Architecture       linux-glibc2.3-ix86
Pkg/Reference          Mk4tcl
Pkg/Reference          {Tcl 8.6}
Pkg/Reference          cmdline
Pkg/Reference          csv
Pkg/Reference          logger
Pkg/Reference          msgcat
Pkg/Reference          ral
................................................................................
System/TempDir         {}
System/Verbose         0
Wrap/Compile/NoTbcload 0
Wrap/Compile/Tcl       0
Wrap/Compile/Version   {}
Wrap/FSMode            {}
Wrap/Icon              {}
Wrap/InputPrefix       /opt/ActiveTcl-8.6/bin/base-tcl8.6-thread-linux-ix86
Wrap/Interpreter       {}
Wrap/Merge             0
Wrap/NoProvided        0
Wrap/NoSpecials        0
Wrap/Output            /home/andrewm/working/tcl-cm3/tack/build/linux/tack
Wrap/Output/OSXApp     0

#
##
###
#####
########




|
|







 







>
|







 







|












1
2
3
4
5
6
7
8
9
10
11
12
13
..
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
format  {TclDevKit Project File}
fmtver  2.0
fmttool {TclDevKit TclApp} 5.3

##  Saved at : Thu Sep 15 16:31:39 PDT 2016
##  By       : andrewm@Office-NUC

########
#####
###
##
#

................................................................................
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/mechs.c}
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/mechs.h}
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/mechsIO.c}
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/mechsIO.h}
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/pycca_portal.h}
Path                   {File /home/andrewm/working/tcl-cm3/tack/package-harness-2.1-tcl.tm}
Path                   {File /home/andrewm/working/tcl-cm3/tack/libtack/pycca_portal.c}
Pkg/Architecture       linux-glibc2.19-x86_64
Pkg/Architecture       linux-glibc2.3-x86_64
Pkg/Reference          Mk4tcl
Pkg/Reference          {Tcl 8.6}
Pkg/Reference          cmdline
Pkg/Reference          csv
Pkg/Reference          logger
Pkg/Reference          msgcat
Pkg/Reference          ral
................................................................................
System/TempDir         {}
System/Verbose         0
Wrap/Compile/NoTbcload 0
Wrap/Compile/Tcl       0
Wrap/Compile/Version   {}
Wrap/FSMode            {}
Wrap/Icon              {}
Wrap/InputPrefix       /home/andrewm/opt/ActiveTcl-8.6/bin/base-tcl8.6-thread-linux-x86_64
Wrap/Interpreter       {}
Wrap/Merge             0
Wrap/NoProvided        0
Wrap/NoSpecials        0
Wrap/Output            /home/andrewm/working/tcl-cm3/tack/build/linux/tack
Wrap/Output/OSXApp     0

#
##
###
#####
########

Changes to tack/doc/tack.html.

1
2
3
4
5
6
7
8







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
..
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
..
68
69
70
71
72
73
74



75
76
77
78
79
80
81
..
88
89
90
91
92
93
94
95



96
97
98


99

100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
...
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
...
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
...
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
...
390
391
392
393
394
395
396
397
















































































































































398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413

414
415
416
417
418
419
420
421
422
423
424
425
...
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
...
473
474
475
476
477
478
479



















480
481
482
483
484
485
486
...
500
501
502
503
504
505
506


507














508
509
510
511
512
513
514


515
516
517





518
519
520
521
522
523
524
525
526
527
528
529
530
531
...
537
538
539
540
541
542
543






















544
545
546

547
548
549
550
551
552
553
...
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
...
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
...
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
...
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
...
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
...
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
....
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
....
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
....
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
....
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
....
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
....
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
....
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
....
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
....
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
....
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
....
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
....
1621
1622
1623
1624
1625
1626
1627
1628
1629

1630
1631
1632
1633
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.3" />
<title>TACK(1)</title>
<style type="text/css">







/* Sans-serif font. */
h1, h2, h3, h4, h5, h6,
div.title, caption.title,
thead, p.table.header,
div#toctitle,
span#author, span#revnumber, span#revdate, span#revremark,
div#footer {
  font-family: Arial,Helvetica,sans-serif;
}

/* Serif font. */
div.sectionbody {
  font-family: Georgia,"Times New Roman",Times,serif;
}

/* Monospace font. */
tt {
  font-size: inherit;
}

body {
  margin: 1em 5% 1em 5%;
}

a {
  color: blue;
  text-decoration: underline;
................................................................................
}

strong {
  font-weight: bold;
  color: #083194;
}

tt {
  font-size: inherit;
  color: navy;
}

h1, h2, h3, h4, h5, h6 {
  color: #527bbd;
  margin-top: 1.2em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

................................................................................
}
h3 {
  float: left;
}
h3 + * {
  clear: left;
}




div.sectionbody {
  margin-left: 0;
}

hr {
  border: 1px solid silver;
................................................................................

ul, ol, li > p {
  margin-top: 0;
}
ul > li     { color: #aaa; }
ul > li > * { color: black; }

pre {



  padding: 0;
  margin: 0;
}




span#author {
  color: #527bbd;
  font-weight: bold;
  font-size: 1.1em;
}
span#email {
}
span#revnumber, span#revdate, span#revremark {
}

div#footer {
  font-size: small;
  border-top: 2px solid silver;
  padding-top: 0.5em;
  margin-top: 4.0em;
}
div#footer-text {
  float: left;
  padding-bottom: 0.5em;
}
div#footer-badges {
  float: right;
  padding-bottom: 0.5em;
}

div#preamble {
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}
div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
div.admonitionblock {
  margin-top: 1.0em;
  margin-bottom: 1.5em;
}
div.admonitionblock {
  margin-top: 2.0em;
................................................................................
}

div.quoteblock, div.verseblock {
  padding-left: 1.0em;
  margin-left: 1.0em;
  margin-right: 10%;
  border-left: 5px solid #f0f0f0;
  color: #777777;
}

div.quoteblock > div.attribution {
  padding-top: 0.5em;
  text-align: right;
}

................................................................................

div.exampleblock > div.content {
  border-left: 3px solid #dddddd;
  padding-left: 0.5em;
}

div.imageblock div.content { padding-left: 0; }
span.image img { border-style: none; }
a.image:visited { color: white; }

dl {
  margin-top: 0.8em;
  margin-bottom: 0.8em;
}
dt {
................................................................................
div.compact ul, div.compact ol,
div.compact p, div.compact p,
div.compact div, div.compact div {
  margin-top: 0.1em;
  margin-bottom: 0.1em;
}

div.tableblock > table {
  border: 3px solid #527bbd;
}
thead, p.table.header {
  font-weight: bold;
  color: #527bbd;
}
tfoot {
  font-weight: bold;
}
td > div.verse {
  white-space: pre;
}
p.table {
  margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
  border-style: none;
}
div.tableblock > table[frame="hsides"] {
  border-left-style: none;
  border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
  border-top-style: none;
  border-bottom-style: none;
}


div.hdlist {
  margin-top: 0.8em;
  margin-bottom: 0.8em;
}
div.hdlist tr {
  padding-bottom: 15px;
................................................................................
  vertical-align: top;
}
div.colist td img {
  margin-top: 0.3em;
}

@media print {
  div#footer-badges { display: none; }
}

div#toc {
  margin-bottom: 2.5em;
}

div#toctitle {
  color: #527bbd;
  font-size: 1.1em;
  font-weight: bold;
  margin-top: 1.0em;
  margin-bottom: 0.1em;
}

div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
  margin-top: 0;
  margin-bottom: 0;
}
div.toclevel2 {
  margin-left: 2em;
  font-size: 0.9em;
}
................................................................................
  font-size: 0.9em;
}
div.toclevel4 {
  margin-left: 6em;
  font-size: 0.9em;
}

/* Overrides for manpage documents */
















































































































































h1 {
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  border-top: 2px solid silver;
  border-bottom: 2px solid silver;
}
h2 {
  border-style: none;
}
div.sectionbody {
  margin-left: 5%;
}

@media print {
  div#toc { display: none; }
}


</style>
<script type="text/javascript">
/*<![CDATA[*/
window.onload = function(){asciidoc.footnotes();}
var asciidoc = {  // Namespace.

/////////////////////////////////////////////////////////////////////
// Table Of Contents generator
/////////////////////////////////////////////////////////////////////

/* Author: Mihai Bazon, September 2002
................................................................................
    this.element = el;
    this.text = text;
    this.toclevel = toclevel;
  }

  function tocEntries(el, toclevels) {
    var result = new Array;
    var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
    // Function that scans the DOM tree for header elements (the DOM2
    // nodeIterator API would be a better technique but not supported by all
    // browsers).
    var iterate = function (el) {
      for (var i = el.firstChild; i != null; i = i.nextSibling) {
        if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
          var mo = re.exec(i.tagName);
................................................................................
      }
    }
    iterate(el);
    return result;
  }

  var toc = document.getElementById("toc");



















  var entries = tocEntries(document.getElementById("content"), toclevels);
  for (var i = 0; i < entries.length; ++i) {
    var entry = entries[i];
    if (entry.element.id == "")
      entry.element.id = "_toc_" + i;
    var a = document.createElement("a");
    a.href = "#" + entry.element.id;
................................................................................
/////////////////////////////////////////////////////////////////////

/* Based on footnote generation code from:
 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
 */

footnotes: function () {


  var cont = document.getElementById("content");














  var noteholder = document.getElementById("footnotes");
  var spans = cont.getElementsByTagName("span");
  var refs = {};
  var n = 0;
  for (i=0; i<spans.length; i++) {
    if (spans[i].className == "footnote") {
      n++;


      // Use [\s\S] in place of . so multi-line matches work.
      // Because JavaScript has no s (dotall) regex flag.
      note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];





      noteholder.innerHTML +=
        "<div class='footnote' id='_footnote_" + n + "'>" +
        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
        n + "</a>. " + note + "</div>";
      spans[i].innerHTML =
        "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
        "' title='View footnote' class='footnote'>" + n + "</a>]";
      var id =spans[i].getAttribute("id");
      if (id != null) refs["#"+id] = n;
    }
  }
  if (n == 0)
    noteholder.parentNode.removeChild(noteholder);
  else {
................................................................................
        n = refs[href];
        spans[i].innerHTML =
          "[<a href='#_footnote_" + n +
          "' title='View footnote' class='footnote'>" + n + "</a>]";
      }
    }
  }






















}

}

/*]]>*/
</script>
</head>
<body class="manpage">
<div id="header">
<h1>
TACK(1) Manual Page
................................................................................
<div class="paragraph"><p>One use case for a tack generated test harness is to build an
executable where the domain source file has been compiled with code coverage.
A test script may then send commands to the domain running in the
harness and the executed
code statements of the domain can be recorded and examined.
This is typically done by compiling the domain code to include
code coverage tracking and analyzing the results of test runs
(<strong>e.g.</strong> when using <tt>gcc</tt>, compiling with <tt>--coverage</tt> and using <tt><strong>gcov</strong></tt>(1)
to analyze the result).</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<div class="dlist"><dl>
................................................................................
</p>
</dd>
<dt class="hdlist1">
-libtack
</dt>
<dd>
<p>
    Create a directory named <tt>libtack</tt> in the current working directory and
    copy the <strong>tack</strong> library files into that directory. The library that
    <strong>tack</strong> requires is distributed as part of the <strong>tack</strong> program itself
    to insure consistency. This option should be used to obtain a copy of
    the library source files that correspond to the version of <strong>tack</strong> in use.
    After copying the files, <strong>tack</strong> exits successfully.
</p>
</dd>
................................................................................
<dt class="hdlist1">
-output <em>file</em>
</dt>
<dd>
<p>
    Specify the directory or file where the generated output is placed.
    If <em>file</em> is a directory, then output is placed in the given directory
    and the base file name is the same as <em>FILE</em> with <tt>.c</tt> and <tt>.h</tt> suffixes.
    The default value for <em>file</em> is <tt>.</tt> (<em>i.e.</em> the current directory).
    If <em>file</em> is not a directory, then it is used as the basename for
    the generated files.
</p>
</dd>
<dt class="hdlist1">
-save
</dt>
<dd>
<p>
    Output a file that contains a serialization of the internal data structures
    that <strong>tack</strong> accumulated when reading the harness specification file.
    The file is named the same as the specification file or the output
    file with a <tt>.ral</tt> suffix.
    This file contains all the information in the harness specification file in
    a parsed form.  The contents are useful for <strong>tack</strong> companion programs that
    need to know the characteristics of the generated test harness.
</p>
</dd>
<dt class="hdlist1">
-level <em>debuglevel</em>
................................................................................
extent possible.
Care should be taken to insure that a correct invocation of <strong>pycca</strong>
has occurred before invoking <strong>tack</strong>.
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>Pycca <span style="color: #990000">./</span>mydomain<span style="color: #990000">.</span>ral</tt></pre></div></div>
<div class="dlist"><dl>
<dt class="hdlist1">
Domain <em>name</em> <em>configuration</em>
................................................................................
The <em>configuration</em> argument is in turn a Tcl script that is evaluated
in a context where the Domain Commands, described below, are available to define
the test harness configuration.
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>Domain mydomain <span style="color: #FF0000">{</span>
    Driver init
    Stub samplePoint
<span style="color: #FF0000">}</span></tt></pre></div></div>
................................................................................
The <strong>Driver</strong> command defines the characteristics of a domain operation.
The <em>name</em> argument must match the name of a domain operation of the
enclosing domain.
The <em>configuration</em> argument is a script that is evaluated in a context
where the data types of the parameters and return value can
be described.
The <em>configuration</em> argument is optional if the corresponding domain
operation accepts no arguments and has a <tt>void</tt> return type.
</p>
</dd>
<dt class="hdlist1">
Stub <em>name</em> ?<em>configuration</em>?
</dt>
<dd>
<p>
................................................................................
<li>
<p>
int64_t
</p>
</li>
</ul></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>Driver startRobot <span style="color: #FF0000">{</span>
    Param robotId <span style="color: #990000">-&gt;</span> unsigned
    Param speed <span style="color: #990000">-&gt;</span> <span style="color: #FF0000">{</span>unsigned long<span style="color: #FF0000">}</span>
    RetType bool <span style="color: #990000">-&gt;</span> bool
................................................................................
<p>
The <strong>Param</strong> command defines the data type associated with the stub
input parameter called, <em>name</em>.
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>Stub readPoint <span style="color: #FF0000">{</span>
    Param pointId <span style="color: #990000">-&gt;</span> unsigned
    Param pointSet <span style="color: #990000">-&gt;</span> unsigned
<span style="color: #FF0000">}</span></tt></pre></div></div>
................................................................................
<p>
The <strong>Param</strong> command defines the data type associated with the event
parameter called, <em>name</em>.
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>Class RobotArm <span style="color: #FF0000">{</span>
    Attribute Length <span style="color: #990000">-&gt;</span> unsigned
    Attribute Speed <span style="color: #990000">-&gt;</span> unsigned
    Event Start <span style="color: #FF0000">{</span>
................................................................................
<p>
A <strong>pycca</strong> generated domain.
</p>
<div class="ulist"><ul>
<li>
<p>
The <strong>pycca</strong> must be generated with at least
the <tt>-save</tt> and <tt>-dataportal</tt> options
</p>
</li>
<li>
<p>
Using the <tt>-instrument</tt> option is also useful to compile in action
instrumentation.
</p>
</li>
<li>
<p>
<strong>pycca</strong> generates both "C" source and header files.
</p>
</li>
<li>
<p>
It is often desirable to compile the "C" source with the
<tt>--coverage</tt> GNU C compiler option.
</p>
</li>
</ul></div>
</li>
<li>
<p>
A <strong>tack</strong> configuration file.
................................................................................
<li>
<p>
The <strong>tack</strong> library of common code.
</p>
<div class="ulist"><ul>
<li>
<p>
Running <strong>tack</strong> with the <tt>-libtack</tt> option will create a copy of the
library code and an example Makefile.
</p>
</li>
<li>
<p>
<strong>libtack</strong> is "C" source that includes the common test harness code
along with a copy of the Single Threaded Software Architecture (STSA) that is
suitable for compiling under a POSIX environment.
</p>
</li>
<li>
<p>
<strong>libtack</strong> must be compiled with the <tt>-DMECH_SM_TRACE</tt> pre-processor option.
This option enable state machine event dispatch tracing and
<strong>libtack</strong> can be used to obtain the trace data.
</p>
</li>
<li>
<p>
The test harness executable must be linked against <strong>libtack</strong>.
................................................................................
<li>
<p>
The STSA requires that the application supply two functions:
</p>
<div class="ulist"><ul>
<li>
<p>
<tt>void sysDeviceInit(void);</tt>
</p>
</li>
<li>
<p>
<tt>void sysDomainInit(void);</tt>
</p>
</li>
</ul></div>
</li>
<li>
<p>
It is necessary to arrange for the function <tt>void harness_init();</tt> to be
invoked before any other test harness initialization occurs.
</p>
</li>
<li>
<p>
For each domain in the test harness, it is necessary to invoke
<tt>&lt;domain name&gt;_harness_init();</tt>, where &lt;domain name&gt; is replaced by the
actual name of the domain.
</p>
</li>
<li>
<p>
Any initialization needed by a domain can then be invoked.
This is shown in the example below for a domain called, <strong>myDomain</strong>, and
................................................................................
a <strong>tack</strong> specification file called, <strong>myHarness</strong>.
</p>
</li>
</ul></div>
</li>
</ul></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000">"mechs.h"</span>
<span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000">"harness.h"</span>
<span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000">"myHarness.h"</span>
<span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000">"myDomain.h"</span>
................................................................................
</div>
<div class="sect1">
<h2 id="_interacting_with_a_test_harness">INTERACTING WITH A TEST HARNESS</h2>
<div class="sectionbody">
<div class="paragraph"><p>When the code described above have been compiled and linked together to
form an executable,
running the resulting executable causes two TCP network services to be
available on <tt>localhost</tt> that are used to interact with the domain(s)
that are controlled by the harness.</p></div>
<div class="ulist"><ul>
<li>
<p>
The <tt>DRIVER_PORT</tt> (number 3902 by default) can be used to invoke domain
operation, access instance attribute values, send events to instances
and create and delete instances.
Commands are sent to the <tt>DRIVER_PORT</tt> and responses received as
described below
</p>
</li>
<li>
<p>
The <tt>STUB_PORT</tt> (number 3903 by default) is carries the output of
from invoking a <strong>tack</strong> generated stub function.
The output indicates which stub function was invoked and the
argument values passed to it.
</p>
</li>
</ul></div>
<div class="paragraph"><p>Both port numbers can be changed by redefining the pre-processor symbols
to different TCP port numbers.
A TCP connection to the <tt>DRIVER_PORT</tt> can be used to control the
test harness by sending command requests
and a TCP connection to the <tt>STUB_PORT</tt> can be used to monitor the
invocation of external operations of domains via the generated stub functions.
<strong>Tack</strong> is supplied with a Tcl package named, <strong>harness</strong>, that hides the
details of the command protocol.</p></div>
<div class="sect2">
<h3 id="_driver_command_protocol">DRIVER COMMAND PROTOCOL</h3>
<div class="paragraph"><p>Driver port commands are ASCII string terminated by both carriage return
and linefeed characters (CR LF terminated in the same way as HTTP).
................................................................................
The enclosing braces are removed from the word.
To include a brace or a backslash in a word,
precede it by a backslash (\) character
(The quoting conventions are modeled after Tcl).
Commands are of the form:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>&lt;category&gt; &lt;domain&gt; ....</tt></pre>
</div></div>
<div class="paragraph"><p>where &lt;category&gt; is one of the following string literals:</p></div>
<div class="ulist"><ul>
<li>
<p>
dop
</p>
................................................................................
<div class="paragraph"><p>Response to driver commands consist of a single ASCII string record,
terminated by CR/LF.
The record consists of pairs whitespace separated words.
The word pairs are of the form of a keyword / value pair.
Every response is at least:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>code &lt;completion code&gt; result &lt;result value&gt;</tt></pre>
</div></div>
<div class="paragraph"><p>Completion codes are either <strong>success</strong> or <strong>error</strong>.
Result values are string representing the result of the command,
or, in the case where the completion code is <strong>error</strong>, a human
readable error message.
The remainder of the response consists of the components of the command
except for any arguments or parameters.
................................................................................
is a significant challenge.</p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_copyright">COPYRIGHT</h2>
<div class="sectionbody">
<div class="paragraph"><p>&#169; Copyright 2011-2013 by G. Andrew Mangogna.</p></div>
<div class="paragraph"><p>The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files.</p></div>
<div class="paragraph"><p>The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
................................................................................
terms specified in this license.</p></div>
</div>
</div>
</div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Version 3.6<br />
Last updated 2013-10-23 13:41:13 PDT

</div>
</div>
</body>
</html>





|


>
>
>
>
>
>
>
|



|
|
|



<
<
<
<
<
<
<
<
<
<







 







<
<
<
<
<







 







>
>
>







 







|
>
>
>



>
>
|
>
|




|

|


|





|



|




|



|







 







|







 







|







 







<
<
<
<
<
<
<






<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|


|



|







|







 







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|





|


|
|



|

>




<







 







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|






>
>
|
|
|
>
>
>
>
>




<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>







 







|







 







|







 







|
|












|







 







|







 







|







 







|







 







|







 







|







 







|







 







|




|











|







 







|












|







 







|




|






|






|







 







|







 







|




|


|





|








|

|







 







|







 







|







 







|







 







|
|
>




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25










26
27
28
29
30
31
32
..
41
42
43
44
45
46
47





48
49
50
51
52
53
54
..
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
...
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
...
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
...
264
265
266
267
268
269
270







271
272
273
274
275
276
















277
278
279
280
281
282
283
...
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
...
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540

541
542
543
544
545
546
547
...
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
...
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
...
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685



686
687
688
689
690
691
692
...
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
...
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
...
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
...
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
...
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
...
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
...
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
....
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
....
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
....
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
....
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
....
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
....
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
....
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
....
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
....
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
....
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
....
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
....
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.9" />
<title>TACK(1)</title>
<style type="text/css">
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */

/* Default font. */
body {
  font-family: Georgia,serif;
}

/* Title font. */
h1, h2, h3, h4, h5, h6,
div.title, caption.title,
thead, p.table.header,
#toctitle,
#author, #revnumber, #revdate, #revremark,
#footer {
  font-family: Arial,Helvetica,sans-serif;
}











body {
  margin: 1em 5% 1em 5%;
}

a {
  color: blue;
  text-decoration: underline;
................................................................................
}

strong {
  font-weight: bold;
  color: #083194;
}






h1, h2, h3, h4, h5, h6 {
  color: #527bbd;
  margin-top: 1.2em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

................................................................................
}
h3 {
  float: left;
}
h3 + * {
  clear: left;
}
h5 {
  font-size: 1.0em;
}

div.sectionbody {
  margin-left: 0;
}

hr {
  border: 1px solid silver;
................................................................................

ul, ol, li > p {
  margin-top: 0;
}
ul > li     { color: #aaa; }
ul > li > * { color: black; }

.monospaced, code, pre {
  font-family: "Courier New", Courier, monospace;
  font-size: inherit;
  color: navy;
  padding: 0;
  margin: 0;
}
pre {
  white-space: pre-wrap;
}

#author {
  color: #527bbd;
  font-weight: bold;
  font-size: 1.1em;
}
#email {
}
#revnumber, #revdate, #revremark {
}

#footer {
  font-size: small;
  border-top: 2px solid silver;
  padding-top: 0.5em;
  margin-top: 4.0em;
}
#footer-text {
  float: left;
  padding-bottom: 0.5em;
}
#footer-badges {
  float: right;
  padding-bottom: 0.5em;
}

#preamble {
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}
div.imageblock, div.exampleblock, div.verseblock,
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
div.admonitionblock {
  margin-top: 1.0em;
  margin-bottom: 1.5em;
}
div.admonitionblock {
  margin-top: 2.0em;
................................................................................
}

div.quoteblock, div.verseblock {
  padding-left: 1.0em;
  margin-left: 1.0em;
  margin-right: 10%;
  border-left: 5px solid #f0f0f0;
  color: #888;
}

div.quoteblock > div.attribution {
  padding-top: 0.5em;
  text-align: right;
}

................................................................................

div.exampleblock > div.content {
  border-left: 3px solid #dddddd;
  padding-left: 0.5em;
}

div.imageblock div.content { padding-left: 0; }
span.image img { border-style: none; vertical-align: text-bottom; }
a.image:visited { color: white; }

dl {
  margin-top: 0.8em;
  margin-bottom: 0.8em;
}
dt {
................................................................................
div.compact ul, div.compact ol,
div.compact p, div.compact p,
div.compact div, div.compact div {
  margin-top: 0.1em;
  margin-bottom: 0.1em;
}








tfoot {
  font-weight: bold;
}
td > div.verse {
  white-space: pre;
}

















div.hdlist {
  margin-top: 0.8em;
  margin-bottom: 0.8em;
}
div.hdlist tr {
  padding-bottom: 15px;
................................................................................
  vertical-align: top;
}
div.colist td img {
  margin-top: 0.3em;
}

@media print {
  #footer-badges { display: none; }
}

#toc {
  margin-bottom: 2.5em;
}

#toctitle {
  color: #527bbd;
  font-size: 1.1em;
  font-weight: bold;
  margin-top: 1.0em;
  margin-bottom: 0.1em;
}

div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
  margin-top: 0;
  margin-bottom: 0;
}
div.toclevel2 {
  margin-left: 2em;
  font-size: 0.9em;
}
................................................................................
  font-size: 0.9em;
}
div.toclevel4 {
  margin-left: 6em;
  font-size: 0.9em;
}

span.aqua { color: aqua; }
span.black { color: black; }
span.blue { color: blue; }
span.fuchsia { color: fuchsia; }
span.gray { color: gray; }
span.green { color: green; }
span.lime { color: lime; }
span.maroon { color: maroon; }
span.navy { color: navy; }
span.olive { color: olive; }
span.purple { color: purple; }
span.red { color: red; }
span.silver { color: silver; }
span.teal { color: teal; }
span.white { color: white; }
span.yellow { color: yellow; }

span.aqua-background { background: aqua; }
span.black-background { background: black; }
span.blue-background { background: blue; }
span.fuchsia-background { background: fuchsia; }
span.gray-background { background: gray; }
span.green-background { background: green; }
span.lime-background { background: lime; }
span.maroon-background { background: maroon; }
span.navy-background { background: navy; }
span.olive-background { background: olive; }
span.purple-background { background: purple; }
span.red-background { background: red; }
span.silver-background { background: silver; }
span.teal-background { background: teal; }
span.white-background { background: white; }
span.yellow-background { background: yellow; }

span.big { font-size: 2em; }
span.small { font-size: 0.6em; }

span.underline { text-decoration: underline; }
span.overline { text-decoration: overline; }
span.line-through { text-decoration: line-through; }

div.unbreakable { page-break-inside: avoid; }


/*
 * xhtml11 specific
 *
 * */

div.tableblock {
  margin-top: 1.0em;
  margin-bottom: 1.5em;
}
div.tableblock > table {
  border: 3px solid #527bbd;
}
thead, p.table.header {
  font-weight: bold;
  color: #527bbd;
}
p.table {
  margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
  border-style: none;
}
div.tableblock > table[frame="hsides"] {
  border-left-style: none;
  border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
  border-top-style: none;
  border-bottom-style: none;
}


/*
 * html5 specific
 *
 * */

table.tableblock {
  margin-top: 1.0em;
  margin-bottom: 1.5em;
}
thead, p.tableblock.header {
  font-weight: bold;
  color: #527bbd;
}
p.tableblock {
  margin-top: 0;
}
table.tableblock {
  border-width: 3px;
  border-spacing: 0px;
  border-style: solid;
  border-color: #527bbd;
  border-collapse: collapse;
}
th.tableblock, td.tableblock {
  border-width: 1px;
  padding: 4px;
  border-style: solid;
  border-color: #527bbd;
}

table.tableblock.frame-topbot {
  border-left-style: hidden;
  border-right-style: hidden;
}
table.tableblock.frame-sides {
  border-top-style: hidden;
  border-bottom-style: hidden;
}
table.tableblock.frame-none {
  border-style: hidden;
}

th.tableblock.halign-left, td.tableblock.halign-left {
  text-align: left;
}
th.tableblock.halign-center, td.tableblock.halign-center {
  text-align: center;
}
th.tableblock.halign-right, td.tableblock.halign-right {
  text-align: right;
}

th.tableblock.valign-top, td.tableblock.valign-top {
  vertical-align: top;
}
th.tableblock.valign-middle, td.tableblock.valign-middle {
  vertical-align: middle;
}
th.tableblock.valign-bottom, td.tableblock.valign-bottom {
  vertical-align: bottom;
}


/*
 * manpage specific
 *
 * */

body.manpage h1 {
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  border-top: 2px solid silver;
  border-bottom: 2px solid silver;
}
body.manpage h2 {
  border-style: none;
}
body.manpage div.sectionbody {
  margin-left: 3em;
}

@media print {
  body.manpage div#toc { display: none; }
}


</style>
<script type="text/javascript">
/*<![CDATA[*/

var asciidoc = {  // Namespace.

/////////////////////////////////////////////////////////////////////
// Table Of Contents generator
/////////////////////////////////////////////////////////////////////

/* Author: Mihai Bazon, September 2002
................................................................................
    this.element = el;
    this.text = text;
    this.toclevel = toclevel;
  }

  function tocEntries(el, toclevels) {
    var result = new Array;
    var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
    // Function that scans the DOM tree for header elements (the DOM2
    // nodeIterator API would be a better technique but not supported by all
    // browsers).
    var iterate = function (el) {
      for (var i = el.firstChild; i != null; i = i.nextSibling) {
        if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
          var mo = re.exec(i.tagName);
................................................................................
      }
    }
    iterate(el);
    return result;
  }

  var toc = document.getElementById("toc");
  if (!toc) {
    return;
  }

  // Delete existing TOC entries in case we're reloading the TOC.
  var tocEntriesToRemove = [];
  var i;
  for (i = 0; i < toc.childNodes.length; i++) {
    var entry = toc.childNodes[i];
    if (entry.nodeName.toLowerCase() == 'div'
     && entry.getAttribute("class")
     && entry.getAttribute("class").match(/^toclevel/))
      tocEntriesToRemove.push(entry);
  }
  for (i = 0; i < tocEntriesToRemove.length; i++) {
    toc.removeChild(tocEntriesToRemove[i]);
  }

  // Rebuild TOC entries.
  var entries = tocEntries(document.getElementById("content"), toclevels);
  for (var i = 0; i < entries.length; ++i) {
    var entry = entries[i];
    if (entry.element.id == "")
      entry.element.id = "_toc_" + i;
    var a = document.createElement("a");
    a.href = "#" + entry.element.id;
................................................................................
/////////////////////////////////////////////////////////////////////

/* Based on footnote generation code from:
 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
 */

footnotes: function () {
  // Delete existing footnote entries in case we're reloading the footnodes.
  var i;
  var noteholder = document.getElementById("footnotes");
  if (!noteholder) {
    return;
  }
  var entriesToRemove = [];
  for (i = 0; i < noteholder.childNodes.length; i++) {
    var entry = noteholder.childNodes[i];
    if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
      entriesToRemove.push(entry);
  }
  for (i = 0; i < entriesToRemove.length; i++) {
    noteholder.removeChild(entriesToRemove[i]);
  }

  // Rebuild footnote entries.
  var cont = document.getElementById("content");
  var spans = cont.getElementsByTagName("span");
  var refs = {};
  var n = 0;
  for (i=0; i<spans.length; i++) {
    if (spans[i].className == "footnote") {
      n++;
      var note = spans[i].getAttribute("data-note");
      if (!note) {
        // Use [\s\S] in place of . so multi-line matches work.
        // Because JavaScript has no s (dotall) regex flag.
        note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
        spans[i].innerHTML =
          "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
          "' title='View footnote' class='footnote'>" + n + "</a>]";
        spans[i].setAttribute("data-note", note);
      }
      noteholder.innerHTML +=
        "<div class='footnote' id='_footnote_" + n + "'>" +
        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
        n + "</a>. " + note + "</div>";



      var id =spans[i].getAttribute("id");
      if (id != null) refs["#"+id] = n;
    }
  }
  if (n == 0)
    noteholder.parentNode.removeChild(noteholder);
  else {
................................................................................
        n = refs[href];
        spans[i].innerHTML =
          "[<a href='#_footnote_" + n +
          "' title='View footnote' class='footnote'>" + n + "</a>]";
      }
    }
  }
},

install: function(toclevels) {
  var timerId;

  function reinstall() {
    asciidoc.footnotes();
    if (toclevels) {
      asciidoc.toc(toclevels);
    }
  }

  function reinstallAndRemoveTimer() {
    clearInterval(timerId);
    reinstall();
  }

  timerId = setInterval(reinstall, 500);
  if (document.addEventListener)
    document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
  else
    window.onload = reinstallAndRemoveTimer;
}

}
asciidoc.install();
/*]]>*/
</script>
</head>
<body class="manpage">
<div id="header">
<h1>
TACK(1) Manual Page
................................................................................
<div class="paragraph"><p>One use case for a tack generated test harness is to build an
executable where the domain source file has been compiled with code coverage.
A test script may then send commands to the domain running in the
harness and the executed
code statements of the domain can be recorded and examined.
This is typically done by compiling the domain code to include
code coverage tracking and analyzing the results of test runs
(<strong>e.g.</strong> when using <code>gcc</code>, compiling with <code>--coverage</code> and using <code><strong>gcov</strong></code>(1)
to analyze the result).</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<div class="dlist"><dl>
................................................................................
</p>
</dd>
<dt class="hdlist1">
-libtack
</dt>
<dd>
<p>
    Create a directory named <code>libtack</code> in the current working directory and
    copy the <strong>tack</strong> library files into that directory. The library that
    <strong>tack</strong> requires is distributed as part of the <strong>tack</strong> program itself
    to insure consistency. This option should be used to obtain a copy of
    the library source files that correspond to the version of <strong>tack</strong> in use.
    After copying the files, <strong>tack</strong> exits successfully.
</p>
</dd>
................................................................................
<dt class="hdlist1">
-output <em>file</em>
</dt>
<dd>
<p>
    Specify the directory or file where the generated output is placed.
    If <em>file</em> is a directory, then output is placed in the given directory
    and the base file name is the same as <em>FILE</em> with <code>.c</code> and <code>.h</code> suffixes.
    The default value for <em>file</em> is <code>.</code> (<em>i.e.</em> the current directory).
    If <em>file</em> is not a directory, then it is used as the basename for
    the generated files.
</p>
</dd>
<dt class="hdlist1">
-save
</dt>
<dd>
<p>
    Output a file that contains a serialization of the internal data structures
    that <strong>tack</strong> accumulated when reading the harness specification file.
    The file is named the same as the specification file or the output
    file with a <code>.ral</code> suffix.
    This file contains all the information in the harness specification file in
    a parsed form.  The contents are useful for <strong>tack</strong> companion programs that
    need to know the characteristics of the generated test harness.
</p>
</dd>
<dt class="hdlist1">
-level <em>debuglevel</em>
................................................................................
extent possible.
Care should be taken to insure that a correct invocation of <strong>pycca</strong>
has occurred before invoking <strong>tack</strong>.
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>Pycca <span style="color: #990000">./</span>mydomain<span style="color: #990000">.</span>ral</tt></pre></div></div>
<div class="dlist"><dl>
<dt class="hdlist1">
Domain <em>name</em> <em>configuration</em>
................................................................................
The <em>configuration</em> argument is in turn a Tcl script that is evaluated
in a context where the Domain Commands, described below, are available to define
the test harness configuration.
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>Domain mydomain <span style="color: #FF0000">{</span>
    Driver init
    Stub samplePoint
<span style="color: #FF0000">}</span></tt></pre></div></div>
................................................................................
The <strong>Driver</strong> command defines the characteristics of a domain operation.
The <em>name</em> argument must match the name of a domain operation of the
enclosing domain.
The <em>configuration</em> argument is a script that is evaluated in a context
where the data types of the parameters and return value can
be described.
The <em>configuration</em> argument is optional if the corresponding domain
operation accepts no arguments and has a <code>void</code> return type.
</p>
</dd>
<dt class="hdlist1">
Stub <em>name</em> ?<em>configuration</em>?
</dt>
<dd>
<p>
................................................................................
<li>
<p>
int64_t
</p>
</li>
</ul></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>Driver startRobot <span style="color: #FF0000">{</span>
    Param robotId <span style="color: #990000">-&gt;</span> unsigned
    Param speed <span style="color: #990000">-&gt;</span> <span style="color: #FF0000">{</span>unsigned long<span style="color: #FF0000">}</span>
    RetType bool <span style="color: #990000">-&gt;</span> bool
................................................................................
<p>
The <strong>Param</strong> command defines the data type associated with the stub
input parameter called, <em>name</em>.
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>Stub readPoint <span style="color: #FF0000">{</span>
    Param pointId <span style="color: #990000">-&gt;</span> unsigned
    Param pointSet <span style="color: #990000">-&gt;</span> unsigned
<span style="color: #FF0000">}</span></tt></pre></div></div>
................................................................................
<p>
The <strong>Param</strong> command defines the data type associated with the event
parameter called, <em>name</em>.
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>Class RobotArm <span style="color: #FF0000">{</span>
    Attribute Length <span style="color: #990000">-&gt;</span> unsigned
    Attribute Speed <span style="color: #990000">-&gt;</span> unsigned
    Event Start <span style="color: #FF0000">{</span>
................................................................................
<p>
A <strong>pycca</strong> generated domain.
</p>
<div class="ulist"><ul>
<li>
<p>
The <strong>pycca</strong> must be generated with at least
the <code>-save</code> and <code>-dataportal</code> options
</p>
</li>
<li>
<p>
Using the <code>-instrument</code> option is also useful to compile in action
instrumentation.
</p>
</li>
<li>
<p>
<strong>pycca</strong> generates both "C" source and header files.
</p>
</li>
<li>
<p>
It is often desirable to compile the "C" source with the
<code>--coverage</code> GNU C compiler option.
</p>
</li>
</ul></div>
</li>
<li>
<p>
A <strong>tack</strong> configuration file.
................................................................................
<li>
<p>
The <strong>tack</strong> library of common code.
</p>
<div class="ulist"><ul>
<li>
<p>
Running <strong>tack</strong> with the <code>-libtack</code> option will create a copy of the
library code and an example Makefile.
</p>
</li>
<li>
<p>
<strong>libtack</strong> is "C" source that includes the common test harness code
along with a copy of the Single Threaded Software Architecture (STSA) that is
suitable for compiling under a POSIX environment.
</p>
</li>
<li>
<p>
<strong>libtack</strong> must be compiled with the <code>-DMECH_SM_TRACE</code> pre-processor option.
This option enable state machine event dispatch tracing and
<strong>libtack</strong> can be used to obtain the trace data.
</p>
</li>
<li>
<p>
The test harness executable must be linked against <strong>libtack</strong>.
................................................................................
<li>
<p>
The STSA requires that the application supply two functions:
</p>
<div class="ulist"><ul>
<li>
<p>
<code>void sysDeviceInit(void);</code>
</p>
</li>
<li>
<p>
<code>void sysDomainInit(void);</code>
</p>
</li>
</ul></div>
</li>
<li>
<p>
It is necessary to arrange for the function <code>void harness_init();</code> to be
invoked before any other test harness initialization occurs.
</p>
</li>
<li>
<p>
For each domain in the test harness, it is necessary to invoke
<code>&lt;domain name&gt;_harness_init();</code>, where &lt;domain name&gt; is replaced by the
actual name of the domain.
</p>
</li>
<li>
<p>
Any initialization needed by a domain can then be invoked.
This is shown in the example below for a domain called, <strong>myDomain</strong>, and
................................................................................
a <strong>tack</strong> specification file called, <strong>myHarness</strong>.
</p>
</li>
</ul></div>
</li>
</ul></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000">"mechs.h"</span>
<span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000">"harness.h"</span>
<span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000">"myHarness.h"</span>
<span style="font-weight: bold"><span style="color: #000080">#include</span></span> <span style="color: #FF0000">"myDomain.h"</span>
................................................................................
</div>
<div class="sect1">
<h2 id="_interacting_with_a_test_harness">INTERACTING WITH A TEST HARNESS</h2>
<div class="sectionbody">
<div class="paragraph"><p>When the code described above have been compiled and linked together to
form an executable,
running the resulting executable causes two TCP network services to be
available on <code>localhost</code> that are used to interact with the domain(s)
that are controlled by the harness.</p></div>
<div class="ulist"><ul>
<li>
<p>
The <code>DRIVER_PORT</code> (number 3902 by default) can be used to invoke domain
operation, access instance attribute values, send events to instances
and create and delete instances.
Commands are sent to the <code>DRIVER_PORT</code> and responses received as
described below
</p>
</li>
<li>
<p>
The <code>STUB_PORT</code> (number 3903 by default) is carries the output of
from invoking a <strong>tack</strong> generated stub function.
The output indicates which stub function was invoked and the
argument values passed to it.
</p>
</li>
</ul></div>
<div class="paragraph"><p>Both port numbers can be changed by redefining the pre-processor symbols
to different TCP port numbers.
A TCP connection to the <code>DRIVER_PORT</code> can be used to control the
test harness by sending command requests
and a TCP connection to the <code>STUB_PORT</code> can be used to monitor the
invocation of external operations of domains via the generated stub functions.
<strong>Tack</strong> is supplied with a Tcl package named, <strong>harness</strong>, that hides the
details of the command protocol.</p></div>
<div class="sect2">
<h3 id="_driver_command_protocol">DRIVER COMMAND PROTOCOL</h3>
<div class="paragraph"><p>Driver port commands are ASCII string terminated by both carriage return
and linefeed characters (CR LF terminated in the same way as HTTP).
................................................................................
The enclosing braces are removed from the word.
To include a brace or a backslash in a word,
precede it by a backslash (\) character
(The quoting conventions are modeled after Tcl).
Commands are of the form:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>&lt;category&gt; &lt;domain&gt; ....</code></pre>
</div></div>
<div class="paragraph"><p>where &lt;category&gt; is one of the following string literals:</p></div>
<div class="ulist"><ul>
<li>
<p>
dop
</p>
................................................................................
<div class="paragraph"><p>Response to driver commands consist of a single ASCII string record,
terminated by CR/LF.
The record consists of pairs whitespace separated words.
The word pairs are of the form of a keyword / value pair.
Every response is at least:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>code &lt;completion code&gt; result &lt;result value&gt;</code></pre>
</div></div>
<div class="paragraph"><p>Completion codes are either <strong>success</strong> or <strong>error</strong>.
Result values are string representing the result of the command,
or, in the case where the completion code is <strong>error</strong>, a human
readable error message.
The remainder of the response consists of the components of the command
except for any arguments or parameters.
................................................................................
is a significant challenge.</p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_copyright">COPYRIGHT</h2>
<div class="sectionbody">
<div class="paragraph"><p>&#169; Copyright 2011-2016 by G. Andrew Mangogna.</p></div>
<div class="paragraph"><p>The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files.</p></div>
<div class="paragraph"><p>The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
................................................................................
terms specified in this license.</p></div>
</div>
</div>
</div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Version 3.7<br />
Last updated
 2016-09-15 16:30:22 PDT
</div>
</div>
</body>
</html>

Changes to tack/doc/tack.txt.

1
2
3
4
5
6
7
8
..
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
// This software is copyrighted 2011 - 2013 by G. Andrew Mangogna.
// The following terms apply to all files associated with the software unless
// explicitly disclaimed in individual files.
// 
// The author hereby grants permission to use, copy, modify, distribute,
// and license this software and its documentation for any purpose, provided
// that existing copyright notices are retained in all copies and that this
// notice is included verbatim in any distributions. No written agreement,
................................................................................
//  tack.txt - documentation for tack
// ABSTRACT:
//  This file contains asciidoc(1) source for the tack documentation.
//*--
TACK(1)
========
Andrew Mangogna <mangoa01@users.sourceforge.net>
:Revision: 3.6
:Date: Wed Oct 23, 2013  1:40:50 PM

NAME
----
tack - Test Harness Generation

SYNOPSIS
--------
................................................................................
*_N.B._* that the event dispatch data is all numerically encoded as
*pycca* does not place string data into generated domains.
Thus programatically decoding the numerical data back to human readable strings
is a significant challenge.

COPYRIGHT
---------
(C) Copyright 2011-2013 by G. Andrew Mangogna.

The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files.

The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
|







 







|
|







 







|







1
2
3
4
5
6
7
8
..
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
// This software is copyrighted 2011 - 2016 by G. Andrew Mangogna.
// The following terms apply to all files associated with the software unless
// explicitly disclaimed in individual files.
// 
// The author hereby grants permission to use, copy, modify, distribute,
// and license this software and its documentation for any purpose, provided
// that existing copyright notices are retained in all copies and that this
// notice is included verbatim in any distributions. No written agreement,
................................................................................
//  tack.txt - documentation for tack
// ABSTRACT:
//  This file contains asciidoc(1) source for the tack documentation.
//*--
TACK(1)
========
Andrew Mangogna <mangoa01@users.sourceforge.net>
:Revision: 3.7
:Date: Thu Sep 15 16:27:47 PDT 2016

NAME
----
tack - Test Harness Generation

SYNOPSIS
--------
................................................................................
*_N.B._* that the event dispatch data is all numerically encoded as
*pycca* does not place string data into generated domains.
Thus programatically decoding the numerical data back to human readable strings
is a significant challenge.

COPYRIGHT
---------
(C) Copyright 2011-2016 by G. Andrew Mangogna.

The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files.

The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this

Changes to tack/libtack/mechs.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121





122















123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
...
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
...
547
548
549
550
551
552
553














554




















555
556
557
558
559
560
561
562
563
564
565
566
567

568
569
570
571
572
573

574
575
576
577
578
579
580
...
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
























604

605




606
607
608
609
610



611
612
613
614
615

616
617
618
619
620
621
622
...
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
...
846
847
848
849
850
851
852

853
854
855


856
857
858
859
860
861

862
863
864

865
866
867

868
869
870

871
872
873
874
875
876
877

878
879
880
881
882
883
884
885
886
887
888
889
890
....
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
/*
 * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT IT.
 * This file corresponds to Version 1.6 of the STSA literate
 * program.
 */
/*
 * This software is copyrighted 2007 - 2013 by G. Andrew
 * Mangogna.  The following terms apply to all files associated
 * with the software unless explicitly disclaimed in individual
 * files.
 *
 * The authors hereby grant permission to use, copy, modify,
 * distribute, and license this software and its documentation
 * for any purpose, provided that existing copyright notices
................................................................................
void
endCriticalSection(void)
{
    if (sigprocmask(SIG_UNBLOCK, &mechSigMask, NULL) != 0) {
        mechFatalError(mechSignalOpFailed, strerror(errno)) ;
    }
}
static MechFatalErrHandler errHandler ;

MechFatalErrHandler
mechSetFatalErrHandler(
    MechFatalErrHandler newHandler)
{
    MechFatalErrHandler prevHandler = errHandler ;
    errHandler = newHandler ;
    return prevHandler ;
}
static char const * const errMsgs[] = {
    "no error",     /* place holder */
    "can't happen transition: %p: %u - %u -> CH\n",
    "event in flight error: %p -> %p %u\n",
    "no available Event Control Blocks\n",
    "no available instance slots: %p\n",
    "synchronization queue overflow\n",
    #ifdef __unix__
    "interval timer operation failed: %s\n",
    "signal operation failed: %s\n",
    "blocking on pselect() failed: %s\n",
    #endif /* __unix__ */
} ;





















static void
mechFatalError(
    MechErrorCode errNum,
    ...)
{
    va_list ap ;
    /*
     * All hope is lost here. Make sure we don't
     * execute any asynchronous code.
     */
    beginCriticalSection() ;
    va_start(ap, errNum) ;
    if (errHandler) {
        errHandler(errMsgs[errNum], ap) ;
    }
#   ifndef MECH_NINCL_STDIO
    else {
        vfprintf(stderr, errMsgs[errNum], ap) ;
    }
#   endif /* MECH_NINCL_STDIO */

#   ifndef MECH_TEST
    exit(errNum) ;
#   endif /* MECH_TEST */
}
static inline 
void *
mechInstNext(
    InstAllocBlock iab,
    void *ptr)
................................................................................
                iter->instOrClass.targetInst == targetInst &&
                iter->eventNumber == event) {
            return iter ;
        }
    }
    return NULL ;
}
static
void
insertIntoDelayedQueue(
    MechEcb ecb)
{
    /*
     * We walk down the queue to find the correct slot.
     * That slot is the first place in the queue where our
     * delay value is less than the delay value at that
................................................................................
    eventQueueRemove(ecb) ;
    /*
     * Return the ECB back to the pool.
     */
    mechEventDelete(ecb) ;
}
#define MECH_DELAY_EXPIRED  UINT32_MAX














#define MECH_DELAY_EXPIRED  UINT32_MAX




















static void
transferExpiredEvents(void)
{
    /*
     * Iterate through the delayed event queue looking for
     * those entries that have been marked as expired.
     */
    for (MechEcb iter = eventQueueBegin(&delayedEventQueue) ;
            iter != eventQueueEnd(&delayedEventQueue) &&
            iter->delay == MECH_DELAY_EXPIRED ; ) {
        /*
         * Advance the iterator, because we are about to
         * invalidate it by removing the entry from the queue.

         */
        MechEcb ecb = iter ;
        iter = iter->next ;

        /*
         * Remove the delayed and insert onto the normal event queue.

         */
        eventQueueRemove(ecb) ;
        eventQueueInsert(ecb, &eventQueue) ;
        assert(ecb->referenceCount != 0) ;
    }
}
static void
................................................................................
    if (!eventQueueEmpty(&delayedEventQueue)) {
        MechEcb ecb = eventQueueBegin(&delayedEventQueue) ;
        assert(ecb->delay != 0) ;
        sysTimerStart(ecb->delay) ;
        ecb->delay = 0 ;
    }
}
static inline
void
stopDelayedQueueTiming(void)
{
    /*
     * Avoid the whole thing if there is nothing in the delayed
     * event queue.
     */
    if (!eventQueueEmpty(&delayedEventQueue)) {
        /*
         * Stop the timer, obtaining the residual time.
         */
        MechDelayTime remain = sysTimerStop() ;
        /*
























         * It is possible that some events expired before

         * we could get the timer stopped.




         */
        transferExpiredEvents() ;
        /*
         * If any events expired, the delayed event queue might
         * now be empty.



         */
        if (!eventQueueEmpty(&delayedEventQueue)) {
            MechEcb ecb = eventQueueBegin(&delayedEventQueue) ;
            assert(ecb->delay == 0) ;
            ecb->delay = remain ;

        }
    }
}
static inline
MechDelayTime
mechMsecToTicks(
    MechDelayTime msec)
................................................................................
        }
    }
    startDelayedQueueTiming() ;
    /*
     * Return the amount of time remaining for the event.
     * If we didn't find the event, the just return 0.
     */
    if (iter == eventQueueEnd(&delayedEventQueue)) {
        remain = 0 ;
    }
    return mechTicksToMsec(remain) ;
}
static void
sysTimerMask(void)
{
    /*
     * Make sure SIGALRM does not go off.
     */
................................................................................
    sysTimerMask() ;
    transferExpiredEvents() ;
    sysTimerUnmask() ;
}
MechDelayTime
mechTimerExpireService(void)
{

    MechDelayTime nextTime = 0 ;
    /*
     * Iterate along the delayed event queue.


     */
    for (MechEcb iter = eventQueueBegin(&delayedEventQueue) ;
            iter != eventQueueEnd(&delayedEventQueue) ;
            iter = iter->next) {
        if (iter->delay == 0) {
            /*

             * Mark all the events that have zero delay time
             * as expired.
             */

            iter->delay = MECH_DELAY_EXPIRED ;
        } else if (iter->delay != MECH_DELAY_EXPIRED) {
            /*

             * Stop at the first unexpired, non-zero delay time.
             * This is the next time increment for delay.
             */

            nextTime = iter->delay ;
            iter->delay = 0 ;
            break ;
        }
        /*
         * else ... Skip any events that are already expired.
         */

    }
    /*
     * Sync to the background to request the expired events be
     * transferred to the event queue.
     */
    mechSyncRequest(mechExpiredEventService) ;

    return nextTime ;
}
#ifdef MECH_SM_TRACE
static MechTraceCallback traceCallback ;

MechTraceCallback
................................................................................
         * synchronization queue.
         */
        while (mechInvokeOneSyncFunc()) {
            ; /* empty */
        }
        #endif /* __ARM_ARCH_7M__ */
        /*
         * Dispatch one event off of the event queue.
         */
        if (!mechDispatchOneEvent()) {
            /*
             * Check if this thread of control is complete
             * and wait if there is no additional work to
             * be done.
             */
            mechWait() ;
        }
    }
}


|



|







 







<
<
<
<
<
<
<
<
<
<













>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>











|
|
|
|
|
|
|
|
|
|
|
|







 







|
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>












|
>





|
>







 







|
<



|
|







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>
>
>
>
|
|
|
|
|
>
>
>
|
|
|
|
|
>







 







|
<
<
|







 







>
|

<
>
>

<
<
|
<
|
>
|
<
|
>
|
<
|
>
|
|
|
>
|
|
<
|

|

>

<
<
<
<
<







 







|











1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
92
93
94
95
96
97
98










99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
...
485
486
487
488
489
490
491
492

493
494
495
496
497
498
499
...
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
...
628
629
630
631
632
633
634
635

636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
...
818
819
820
821
822
823
824
825


826
827
828
829
830
831
832
833
...
921
922
923
924
925
926
927
928
929
930

931
932
933


934

935
936
937

938
939
940

941
942
943
944
945
946
947
948

949
950
951
952
953
954





955
956
957
958
959
960
961
....
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
/*
 * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT IT.
 * This file corresponds to Version 1.7 of the STSA literate
 * program.
 */
/*
 * This software is copyrighted 2007 - 2014 by G. Andrew
 * Mangogna.  The following terms apply to all files associated
 * with the software unless explicitly disclaimed in individual
 * files.
 *
 * The authors hereby grant permission to use, copy, modify,
 * distribute, and license this software and its documentation
 * for any purpose, provided that existing copyright notices
................................................................................
void
endCriticalSection(void)
{
    if (sigprocmask(SIG_UNBLOCK, &mechSigMask, NULL) != 0) {
        mechFatalError(mechSignalOpFailed, strerror(errno)) ;
    }
}










static char const * const errMsgs[] = {
    "no error",     /* place holder */
    "can't happen transition: %p: %u - %u -> CH\n",
    "event in flight error: %p -> %p %u\n",
    "no available Event Control Blocks\n",
    "no available instance slots: %p\n",
    "synchronization queue overflow\n",
    #ifdef __unix__
    "interval timer operation failed: %s\n",
    "signal operation failed: %s\n",
    "blocking on pselect() failed: %s\n",
    #endif /* __unix__ */
} ;
static void
MechDefaultFatalErrorHandler(
    MechErrorCode errNum,
    char const *fmt,
    va_list ap)
{
#   ifndef MECH_NINCL_STDIO
    vfprintf(stderr, errMsgs[errNum], ap) ;
#   endif /* MECH_NINCL_STDIO */
}
static MechFatalErrHandler errHandler = MechDefaultFatalErrorHandler ;
MechFatalErrHandler
mechSetFatalErrHandler(
    MechFatalErrHandler newHandler)
{
    MechFatalErrHandler prevHandler = errHandler ;
    if (newHandler) {
        errHandler = newHandler ;
    }
    return prevHandler ;
}
static void
mechFatalError(
    MechErrorCode errNum,
    ...)
{
    va_list ap ;
    /*
     * All hope is lost here. Make sure we don't
     * execute any asynchronous code.
     */
    beginCriticalSection() ;

    assert(errHandler != NULL) ;
    assert(errNum < (sizeof(errMsgs) / sizeof(errMsgs[0]))) ;

    va_start(ap, errNum) ;
    errHandler(errNum, errMsgs[errNum], ap) ;
    /*
     *  If the handler does return, we insist that all errors
     *  are fatal. So we abort() unless we are testing.
     */
#   ifndef MECH_TEST
    abort() ;
#   endif /* MECH_TEST */
}
static inline 
void *
mechInstNext(
    InstAllocBlock iab,
    void *ptr)
................................................................................
                iter->instOrClass.targetInst == targetInst &&
                iter->eventNumber == event) {
            return iter ;
        }
    }
    return NULL ;
}
static void

insertIntoDelayedQueue(
    MechEcb ecb)
{
    /*
     * We walk down the queue to find the correct slot.
     * That slot is the first place in the queue where our
     * delay value is less than the delay value at that
................................................................................
    eventQueueRemove(ecb) ;
    /*
     * Return the ECB back to the pool.
     */
    mechEventDelete(ecb) ;
}
#define MECH_DELAY_EXPIRED  UINT32_MAX
static MechEcb
expireDelayedEvents(void)
{
    /*
     * Iterate along the delayed event queue.
     */
    for (MechEcb iter = eventQueueBegin(&delayedEventQueue) ;
            iter != eventQueueEnd(&delayedEventQueue) ;
            iter = iter->next) {
        if (iter->delay == 0) {
            /*
             * Mark all the events that have zero delay time
             * as expired.
             */
            iter->delay = MECH_DELAY_EXPIRED ;
        } else if (iter->delay != MECH_DELAY_EXPIRED) {
            /*
             * Stop at the first non-zero delay time.  This
             * marks the boundary of events that need
             * additional delay time.  The first such event
             * is the next amount of time to delay.
             */
            return iter ;
        }
        /*
         * else ... Skip any events that might already be
         * expired.
         */
    }
    /*
     * We have run the queue without finding an unexpired
     * event.
     */
    return NULL ;
}
static void
transferExpiredEvents(void)
{
    /*
     * Iterate through the delayed event queue looking for
     * those entries that have been marked as expired.
     */
    for (MechEcb iter = eventQueueBegin(&delayedEventQueue) ;
            iter != eventQueueEnd(&delayedEventQueue) &&
            iter->delay == MECH_DELAY_EXPIRED ; ) {
        /*
         * Advance the iterator, because we are about to
         * invalidate it by removing the entry from the
         * queue.
         */
        MechEcb ecb = iter ;
        iter = iter->next ;

        /*
         * Remove the ECB from the delayed queue and insert
         * it into event queue for dispatch.
         */
        eventQueueRemove(ecb) ;
        eventQueueInsert(ecb, &eventQueue) ;
        assert(ecb->referenceCount != 0) ;
    }
}
static void
................................................................................
    if (!eventQueueEmpty(&delayedEventQueue)) {
        MechEcb ecb = eventQueueBegin(&delayedEventQueue) ;
        assert(ecb->delay != 0) ;
        sysTimerStart(ecb->delay) ;
        ecb->delay = 0 ;
    }
}
static void

stopDelayedQueueTiming(void)
{
    /*
     * Avoid the whole thing if there is nothing in the
     * delayed event queue.
     */
    if (!eventQueueEmpty(&delayedEventQueue)) {
        /*
         * Stop the timer, obtaining the residual time.
         */
        MechDelayTime remain = sysTimerStop() ;
        /*
         * There are two cases here. It is possible for the
         * remaining time returned from sysTimerStop() to be
         * zero. This can happen if the physical timing
         * resource (which might be running asynchronously
         * to the processor) happens to expire within a
         * single tick as we are stopping it.
         */
        if (remain == 0) {
            /*
             * Since the timer has expired we must mark any
             * events with a zero delay time value as
             * expired and, since we are running in the
             * background here, transfer the expired events
             * to be dispatched.
             */
            expireDelayedEvents() ;
            transferExpiredEvents() ;
            /*
             * At this point, either the delayed event queue
             * is empty, or the event at the head of the
             * queue has a non-zero delay time.
             */
        } else {
            /*
             * It is possible that the timing resource
             * expired and its interrupt service ran just
             * before we could get the timer stopped. That
             * would mean that there are expired events on
             * the delayed queue at this point and we need
             * to transfer them off the delayed queue to be
             * dispatched.
             */
            transferExpiredEvents() ;
            /*
             * If any events expired, the delayed event
             * queue might now be empty. However, if the
             * queue is not empty, we must make sure the
             * entry at the head preserves the remaining
             * amount of time that needs to elapse.
             */
            if (!eventQueueEmpty(&delayedEventQueue)) {
                MechEcb ecb = eventQueueBegin(&delayedEventQueue) ;
                assert(ecb->delay == 0) ;
                ecb->delay = remain ;
            }
        }
    }
}
static inline
MechDelayTime
mechMsecToTicks(
    MechDelayTime msec)
................................................................................
        }
    }
    startDelayedQueueTiming() ;
    /*
     * Return the amount of time remaining for the event.
     * If we didn't find the event, the just return 0.
     */
    return iter == eventQueueEnd(&delayedEventQueue) ?


            0 : mechTicksToMsec(remain) ;
}
static void
sysTimerMask(void)
{
    /*
     * Make sure SIGALRM does not go off.
     */
................................................................................
    sysTimerMask() ;
    transferExpiredEvents() ;
    sysTimerUnmask() ;
}
MechDelayTime
mechTimerExpireService(void)
{
    MechEcb unexpired ;
    MechDelayTime nextTime ;
    /*

     * Sync to the background to request the expired events
     * be transferred to the event queue.
     */


    mechSyncRequest(mechExpiredEventService) ;

    /*
     * Mark the delayed events as expired, returning a
     * pointer to the first unexpired event.

     */
    unexpired = expireDelayedEvents() ;
    if (unexpired) {

        /*
         * If there is an unexpired event, then its delay
         * time is the next time to expire. We return that
         * time and zero out the delay time.
         */
        assert(unexpired->delay != 0) ;
        nextTime = unexpired->delay ;
        unexpired->delay = 0 ;

    } else {
        /*
         * Otherwise, there is nothing else to time.
         */
        nextTime = 0 ;
    }






    return nextTime ;
}
#ifdef MECH_SM_TRACE
static MechTraceCallback traceCallback ;

MechTraceCallback
................................................................................
         * synchronization queue.
         */
        while (mechInvokeOneSyncFunc()) {
            ; /* empty */
        }
        #endif /* __ARM_ARCH_7M__ */
        /*
         * Dispatch one event from the event queue.
         */
        if (!mechDispatchOneEvent()) {
            /*
             * Check if this thread of control is complete
             * and wait if there is no additional work to
             * be done.
             */
            mechWait() ;
        }
    }
}

Changes to tack/libtack/mechs.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT IT.
 * This file corresponds to Version 1.5 of the STSA literate
 * program.
 */
/*
 * This software is copyrighted 2007 - 2011 by G. Andrew
 * Mangogna.  The following terms apply to all files associated
 * with the software unless explicitly disclaimed in individual
 * files.
 *
 * The authors hereby grant permission to use, copy, modify,
 * distribute, and license this software and its documentation
 * for any purpose, provided that existing copyright notices
................................................................................
typedef unsigned short int AttributeOffset ;
typedef enum {
    mechCantHappen = 1,
    mechEventInFlight,
    mechNoECB,
    mechNoInstSlot,
    mechSyncOverflow,
    #if defined(__unix__) || defined(__APPLE_CC__)
    mechTimerOpFailed,
    mechSignalOpFailed,
    mechSelectWaitFailed,
    #endif /* __unix__ || __APPLE_CC__ */
} MechErrorCode ;
typedef struct mechinstance {
    AllocCount alloc ;
    StateCode currentState ;
    struct mechclass const *instClass ;
} *MechInstance ;
typedef void (*InstCtor)(MechInstance) ;
................................................................................
    HierarchyDispatch hierarchy ;
} const *PolyDispatchBlock ;
typedef struct mechclass {
    InstAllocBlock iab ;
    ObjectDispatchBlock odb ;
    PolyDispatchBlock pdb ;
} const *MechClass ;
typedef void (*MechFatalErrHandler)(char const *, va_list) ;
typedef EventParamType SyncParamType ;
typedef SyncParamType *SyncParamRef ;
typedef void (*SyncFunc)(SyncParamRef) ;
typedef void (*FDServiceFunc)(int) ;
typedef struct mechecb {
    struct mechecb *next ;
    struct mechecb *prev ;


|



|







 







|



|







 







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT IT.
 * This file corresponds to Version 1.7 of the STSA literate
 * program.
 */
/*
 * This software is copyrighted 2007 - 2014 by G. Andrew
 * Mangogna.  The following terms apply to all files associated
 * with the software unless explicitly disclaimed in individual
 * files.
 *
 * The authors hereby grant permission to use, copy, modify,
 * distribute, and license this software and its documentation
 * for any purpose, provided that existing copyright notices
................................................................................
typedef unsigned short int AttributeOffset ;
typedef enum {
    mechCantHappen = 1,
    mechEventInFlight,
    mechNoECB,
    mechNoInstSlot,
    mechSyncOverflow,
    #ifdef __unix__
    mechTimerOpFailed,
    mechSignalOpFailed,
    mechSelectWaitFailed,
    #endif /* __unix__ */
} MechErrorCode ;
typedef struct mechinstance {
    AllocCount alloc ;
    StateCode currentState ;
    struct mechclass const *instClass ;
} *MechInstance ;
typedef void (*InstCtor)(MechInstance) ;
................................................................................
    HierarchyDispatch hierarchy ;
} const *PolyDispatchBlock ;
typedef struct mechclass {
    InstAllocBlock iab ;
    ObjectDispatchBlock odb ;
    PolyDispatchBlock pdb ;
} const *MechClass ;
typedef void (*MechFatalErrHandler)(MechErrorCode, char const *, va_list) ;
typedef EventParamType SyncParamType ;
typedef SyncParamType *SyncParamRef ;
typedef void (*SyncFunc)(SyncParamRef) ;
typedef void (*FDServiceFunc)(int) ;
typedef struct mechecb {
    struct mechecb *next ;
    struct mechecb *prev ;

Changes to tack/main.tcl.

1
2
3
4
5
6
7
8
..
32
33
34
35
36
37
38















39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
..
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# This software is copyrighted 2011 - 2013 by G. Andrew Mangogna.
# The following terms apply to all files associated with the software unless
# explicitly disclaimed in individual files.
# 
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentation for any purpose, provided
# that existing copyright notices are retained in all copies and that this
# notice is included verbatim in any distributions. No written agreement,
................................................................................
# are acquiring the software on behalf of the Department of Defense,
# the software shall be classified as "Commercial Computer Software"
# and the Government shall have only "Restricted Rights" as defined in
# Clause 252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing,
# the authors grant the U.S. Government and others acting in its behalf
# permission to use and distribute the software in accordance with the
# terms specified in this license.
















package require Tcl 8.6
package require cmdline
package require logger
package require ral

set iswrapped [expr {[lindex [file system [info script]] 0] ne "native"}]
if {$iswrapped} {
    set top [file join $::starkit::topdir lib application]
} else {
    set top [file dirname [info script]]
}
source [file join $top tack.tcl]

set opts {
    {version {Print out version information and exit}}
    {libtack {Output a copy of the tack runtime library}}
    {harness {Output a copy of the Tcl harness package}}
    {save {Save internal data structures}}
................................................................................
    {output.arg {.} {Directory or file where output is placed}}
    {level.arg warn {Logging level}}
}

set usage "\[options] configfile\noptions:"
array set options [::cmdline::getoptions argv $opts $usage]

set version 3.6

if {$options(version)} {
    chan puts "tack: version $::version"
    chan puts {
This software is copyrighted 2011 - 2013 by G. Andrew Mangogna.
The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files.

The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






<
<
<
<
<
<







 







|




|







1
2
3
4
5
6
7
8
..
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59






60
61
62
63
64
65
66
..
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# This software is copyrighted 2011 - 2016 by G. Andrew Mangogna.
# The following terms apply to all files associated with the software unless
# explicitly disclaimed in individual files.
# 
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentation for any purpose, provided
# that existing copyright notices are retained in all copies and that this
# notice is included verbatim in any distributions. No written agreement,
................................................................................
# are acquiring the software on behalf of the Department of Defense,
# the software shall be classified as "Commercial Computer Software"
# and the Government shall have only "Restricted Rights" as defined in
# Clause 252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing,
# the authors grant the U.S. Government and others acting in its behalf
# permission to use and distribute the software in accordance with the
# terms specified in this license.

set iswrapped [expr {[lindex [file system [info script]] 0] ne "native"}]
if {$iswrapped} {
    set top [file join $::starkit::topdir lib application]
    if {$::tcl_platform(os) eq "Linux"} {
        set libs [glob -nocomplain\
            -directory [file join $::starkit::topdir lib]\
            P-linux-*]
        foreach lib $libs {
            lappend ::auto_path $lib
        }
    }
} else {
    set top [file dirname [info script]]
}

package require Tcl 8.6
package require cmdline
package require logger
package require ral







source [file join $top tack.tcl]

set opts {
    {version {Print out version information and exit}}
    {libtack {Output a copy of the tack runtime library}}
    {harness {Output a copy of the Tcl harness package}}
    {save {Save internal data structures}}
................................................................................
    {output.arg {.} {Directory or file where output is placed}}
    {level.arg warn {Logging level}}
}

set usage "\[options] configfile\noptions:"
array set options [::cmdline::getoptions argv $opts $usage]

set version 3.7

if {$options(version)} {
    chan puts "tack: version $::version"
    chan puts {
This software is copyrighted 2011 - 2016 by G. Andrew Mangogna.
The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files.

The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,