-
Notifications
You must be signed in to change notification settings - Fork 1
/
EXAMPLE
41 lines (27 loc) · 792 Bytes
/
EXAMPLE
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
39
40
41
pcalc usage examples
a. To avoid shell expansion include scripts in quotes.
shell prompt# pcalc 'DEC=1 (12 + 3) * 3 echo ""'
45
b. Script that writes a header file, inrementing version/build number
with every compilation. use: pcalc @script > build.h
--------- cut here ------------
DEC = 1
echo "/*"
echo " * Build version number header generated by pcalc"
date " * Build date %d/%m/%y %H:%M:%S\n"
echo " */"
echo ""
date "#define BUILDDATE \"%d/%m/%y %H:%M:%S\"\n"
RESTORE aa
_echo "#define VERSION " aa
aa = aa + 1
STORE aa
echo ""
-------------- cut here ---------------
It outputs a 'C' file, but with small modification it can do most any language.
c. Add the shopping list items on the command line:
shell# pcalc \
10 * 12 + \
12 * 9.99 + \
322+ 35
Have fun.