These things don't fit in a ~/.diary file or calendar. It's a chronicle of my software progress. As part of my commonplace book project, I felt it proper to include a software diary.
This paper is online as Marty's software diary
Along the lines of my family diary, this is focused solely on my software exploits of the moment. For now, it's devoted largely to my shell functions, leading to updates for my book.
Notably, I'm collecting (harvesting, really) the better parts of the journey in a late section: lessons.
separating my personal and technical (principally shell function) notes. Or more appropriately giving the right public exposure, and how to do it.
a Big question as I work is the tug-of-war between Emacs on one hand and the shell command line on the other. Since the base-plate of my shell functions method is the command line, history and its editing, this should make Emacs less useful. I'm writing this (original source text) with Bill Joy's next editor: cat. But, I'll likely edit this with Emacs well before I'm finished. This problem still remains, it has less to do with curating the function history, and more to do with the development cycle.
since I've recently added org-mode it seems appropriate to bring it in to this process.
journaling my daily progress – with two machines I'm working on, I'm both leaving a daily trail of functions I've written that day, and a version history of my function libraries What's needed are the words behind the action.
The two-machine challenge was cleared long-ago. With Dropbox. My software and personal environment is now on Dropbox. This home
function locates what might have been in multi-machine HOME
usage.
the technical challenge for the public face - if not the private - is connecting disparate source streams, and linking them where appropriate. this will require standards for storage, placement on my server, on a public page, and the underlying tools to manage the task.
This is solved by using an OrgMode project, which consolidates collections of pages. The key and recent update is a thing called ftp_common
, which returns the relative working directory on the server from the root login. Also a companion function identifying the data file, ftp_map
.
and the thing to capture is some sense of the flow of ideas as functions are born and join a library (or two), the libraries grow and divide, and subsequently mature into applications. the challenge here is both the building, distributing and learning how to manage the collection.
The solution is in pieces. A recent objective, and nearing the summit, is to convert a function collection, a family at it's dependent members in to an application. So, i'm whittling down the libraries. Basically into two: functionlib and retiredlib. Miscellaneous libraries exist for local, not too general applications. One such is wordcontlib
, another was applib
but it's found it's way into the stand-alone app.
$ ftp_map; ftp_map cat; declare -f ftp_common
/Users/martymcgowan/Dropbox/lib/ftp_map.txt
#
# ----------------------------------------- my Commonplace Book --
#
commonplace pwd | sed 's/.*Dropbox//'
#
# ------------------------------------------- McGowans.Org HOME --
#
Dropbox/home echo /
#
# -------------------------------------------- the Family Pages --
# ------------------------------ and Marty HOME --
#
Dropbox/pubs pwd | sed 's/.*Dropbox//'
#
# --------------------------------------------- Obsolete Marty3 --
#
Dropbox/marty3 pwd | sed 's/.*Dropbox//'
ftp_common ()
{
: date: 2019-06-01;
case $PWD in
*.bak* | *.ver* | *.upload*)
app_trace $PWD: no FTP for .bak, .ver, ,upload;
return
;;
esac;
ftp_user;
: app_trace FTP_SITE: $FTP_SITE.;
set -- $(ftp_map);
[[ -f $1 ]] || touch $1;
: app_trace $PWD $1;
sed 's/ *#.*//' $1 | awk NF | {
while read dir cmmd; do
app_trace "dir: $dir. cmmd: $cmmd";
case $PWD in
*$dir*)
app_trace "$PWD: $cmmd";
eval "$cmmd";
return;
app_trace NEVER Get HERE
;;
esac;
done;
app_trace no COMMAND for $PWD
}
}
This maybe is a bit over the top. But I've paid for it.
$ declare -f home
home ()
{
: ~ set or fetch the name of the portable File System;
: intended for DROPBOX, but lets use a portable idea.;
case $# in
0)
: ${ALT_HOME:-$HOME}
;;
*)
[[ -d $1 ]] && ALT_HOME=$1
;;
esac;
export ALT_HOME;
echo ${ALT_HOME:-$HOME}
}
$ ...
For example $ home $HOME/Dropbox
.
pp** lessons :markdown:tiddlywiki: So, on to the current history.
reading backwards thru the diary. what still works
is broken when the awk script is:
replacing (o) a number of tools, adding (*) others.
The tracing pinnacle is these two functions:
this one is Gold, I've restored the simple version where the backups are pushed down the ./.bak/.bak/ … directory path.
these functions "regularize" the function interface, giving the shell programmer a means of asserting:
for example, in the latter case, for my personal expense management, answer the question, is this argument an account or not. See (2/23/15)
using the report_ mechanisms, followed by a use(s) of the set – idiom
the *F*unction B*o*DY, distinguishing bash and ksh formats; more work is required here. (2/12/15)
where library functions are any used by other functions. A command function is only used from the command-line. The tracecall function tests the call-depth to see if the function is on the command line, among other attributes. (1/31/15)
which feeds the next function. with a number of function arguments, produce a list, through recursive descent, of all called functions.
motivated by OrgMode's tangle feature,
function callgraph_eg
{
in=~/tmp/callgraph.in;
out=~/tmp/callgraph.out;
report_needcount 1 $# function ... && return 1;
foreach fun_call $* | tee $in | callgraph | (ref:callgraph)
egrep -v '(comment|trace_)' | tee $out;
comment in: $in;
comment out: $out
}
function my_callgraph
{
file=~/tmp/callgraph.out;
trace_call $file : $*;
newest $file $* || {
for f in $*;
do
. $f;
done;
callgraph_eg $(functions $*)
};
( orgheader;
echo;
fbdy my_callgraph callgraph_eg;
cat $file ) > $1.org
}
the guts of the work are the (callgraph) command, a short python program to produce the OrgMode indented calling structure, which shows every called function, and each caller's tree the first time it appears in descent order.
this has not materialized along lines I envisaged (1/31/15), but I'm expecting OrgMode to supply the means as I learn more
This was called omiam, which stood for I AM an Object Method, stiff in comparison to famiam for family.