Das folgende Beispielprogramm dient zum Durchlaufen der EUKLID Design-Datenstruktur (siehe auch weitere AQL-Programme im Verzeichnis #/examples.aql).
PROGRAMM #/aql/count_element.aql:
var count_total
var count_total_del
function counter_total ()
count_total = 0
count_total_del = 0
for i in top.list_all do
count_total = count_total + 1
if i.deleted then
count_total_del = count_total_del + 1
end
end
end
function write_number (str, count , count_del)
[str;-13] ‘:‘ [count;10]
if count > 0 then
[(100 * count / count_total );10] ‘ %‘
[count_del;15] [(count_del * 100 / count);10] ‘%‘
else ‘ -‘
end
nl
end
function counter_element ( prim )
var count
var count_del
count = 0
count_del = 0
for i in top.[”list_” + prim.content] do
count = count + 1
if i.deleted then
count_del = count_del + 1
end
end
write_number (prim.content, count , count_del)
end
nl
‘Characteristics of file : ‘ [top.name]
nl
‘=============================================‘
nl
nl
counter_total ()
‘element # % of total # deleted % deleted ‘ nl
‘----------------------------------------------------------- ‘ nl
for prim in application.list_prim sort by .content do
counter_element ( prim )
end
‘----------------------------------------------------------- ‘ nl
nl
write_number (”total ”, count_total , count_total_del)
nl
/* that’s all, folks */
AUSGABE: Characteristics of file : std ============================================= element # % of total # deleted % deleted --------------------------------------------------------------- angle : 2 3 % 2 100% circle : 3 5 % 0 0% contour : 0 - coord : 4 7 % 4 100% dummy : 0 - ellips : 0 - group : 0 - layer : 0 - length : 17 29 % 17 100% line : 6 10 % 0 0% measure : 0 - nilprim : 1 1 % 1 100% number : 0 - plane : 0 - point : 10 17 % 0 0% posmeas : 0 - posttext : 1 1 % 1 100% prop : 6 10 % 6 100% rawval : 1 1 % 1 100% spline : 0 - string : 4 7 % 4 100% symbol : 0 - tab : 0 - tab_instance : 0 - text : 0 - user : 0 - variable : 0 - vector : 0 - viewdata : 1 1 % 0 0% world : 1 1 % 0 0% --------------------------------------------------------------- total : 57 100 % 36 63%
◀ Datenstruktur | Syntaxdiagramme ▶ |