Dear all,
during a recent exchange that I had with Oleh Komashko, the idea came up
thet it'd be quite nice to have a short-hand function for printing out
messages in scripts, in a standardised and recognisable form. So I wrote a
little prototype in hansl, that you see below:
<hansl>
set verbose off
function void message(string m, scalar l[60])
d = "-"
lm = strlen(m)
scalar k = lm + 8 > l ? l - 8 : lm
s = ""
if lm == 0
loop i=1..l --quiet
s = s ~ d
endloop
else
loop i=1..3 --quiet
s = s ~ d
endloop
s = s ~ " " ~ m[1:k] ~ " "
loop i=k+6..l --quiet
s = s ~ d
endloop
endif
printf "%s\n", s
end function
message("Ha")
message("")
message("A shorter one", 40)
message("An inordinately long one, which should be truncated, really")
</hansl>
My question is: would it be a good idea to turn this into a native
function?
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------