From: Chris Koeritz
Date: Sun, 12 Nov 2017 15:36:03 +0000 (-0500)
Subject: Merge branch 'master' of feistymeow.org:feisty_meow
X-Git-Tag: 2.140.98^2~23^2
X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=7b39f7e279005c8466ef508220a532ce2aa4abf8;hp=3fbd372b35b15a19fb171d5ae34294ff7b1e6485;p=feisty_meow.git
Merge branch 'master' of feistymeow.org:feisty_meow
---
diff --git a/_config.yml b/_config.yml
new file mode 100644
index 00000000..c50ff38d
--- /dev/null
+++ b/_config.yml
@@ -0,0 +1 @@
+theme: jekyll-theme-merlot
\ No newline at end of file
diff --git a/customize/fred/fred_common.alias b/customize/fred/fred_common.alias
deleted file mode 100644
index 77f4e48d..00000000
--- a/customize/fred/fred_common.alias
+++ /dev/null
@@ -1,11 +0,0 @@
-
-# some aliases that i don't expect very many people to ever want. they are
-# based on some of the mount configurations available at home or abroad.
-
-# moo and unmoo mount the local folders i use most.
-define_yeti_alias moo='check_mount /z/stuffing ; check_mount /z/walrus ; check_mount /z/chunky ; check_mount /z/fredgrid'
-define_yeti_alias unmoo='sudo umount /z/stuffing ; sudo umount /z/walrus ; sudo umount /z/chunky ; sudo umount /z/fredgrid'
-
-# load in the gffs build scripts.
-source "$FEISTY_MEOW_SCRIPTS/buildor/gffs_builders.sh"
-
diff --git a/customize/fred/fred_variables.sh b/customize/fred/fred_variables.sh
deleted file mode 100644
index 47e90fd6..00000000
--- a/customize/fred/fred_variables.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-
-# these are my personal overrides. --fred.
-
-if [ -z "$USER_CUSTOMIZATIONS_LOADED" ]; then
- # if we don't see the nethack variable defined, this probably hasn't run yet.
-
- # The cloud directory is our new repository that's always available. It serves as our
- # personal cloud for data.
- export CLOUD_BASE=$HOME/cloud
-
- # The gruntose web site is expected to reside below, if it exists at all.
- export WEBBED_SITES=$HOME/web
- if [ "$(hostname)" = "zooty.koeritz.com" ]; then
- export WEBBED_SITES=/var/www
- fi
-
- # add a bunch of folders to the list for checkin & checkout. these are
- # definitely personal, and some of them are fairly dated (the yeti and
- # hoople folders, for example).
- REPOSITORY_LIST+="cloud ebooks web antique antique/inova_codebase bigdata"
-
- # point to our local certificate for ssh usage.
- export SVN_SSH="ssh -i $HOME/.ssh/id_dsa_sourceforge"
-
- # Error and success noises for CLAM.
- export CLAM_ERROR_SOUND='/z/walrus/media/sounds/effects/bwaaang.wav /z/walrus/media/sounds/cartoons/doh4.wav'
- export CLAM_FINISH_SOUND='/z/walrus/media/sounds/cartoons/meepmeep.wav'
-
- # Setup for nethack adventure.
- export NETHACKOPTIONS="name:Manjusri-W,dogname:Fred,catname:Zonker"
-
- # mail setup for home machines.
-# export REPLYTO=fred@gruntose.com
-# export from="Fred T. Hamster "
-
- # set our browser for seti and others that use the variable.
-# export BROWSER=/usr/bin/firefox
-
- # editor and other mixed settings...
- export EDITOR="$(which vim)"
- if [ -z "$EDITOR" ]; then
- EDITOR="$(which vi)"
- if [ -z "$EDITOR" ]; then
- EDITOR="$(which emacs)"
- if [ -z "$EDITOR" ]; then
- echo "Cannot find a friendly editor."
- fi
- fi
- fi
- export VISUAL="$EDITOR"
- # the editors for revision control must wait while document is edited,
- # so gvim and others launched to x window are not appropriate.
- export GIT_EDITOR="$EDITOR"
- export SVN_EDITOR="$EDITOR"
-
- # this hideous mess is necessitated by our not having found the source of the
- # settings yet. we override a few colors that look bad on a dark background.
- export LS_COLORS='no=00:fi=00:di=01;37:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;35:*.rpm=00;33:*.deb=00;33:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;35:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;35:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
-
- # options for the lame mp3 encoder.
- export LAMEOPT="--alt-preset extreme"
-
- # customization sentinel can be set now.
- export USER_CUSTOMIZATIONS_LOADED=true
-fi
-
-
diff --git a/customize/fred/java_profile.sh b/customize/fred/java_profile.sh
deleted file mode 100644
index 30128a22..00000000
--- a/customize/fred/java_profile.sh
+++ /dev/null
@@ -1,134 +0,0 @@
-#!/bin/bash
-
-# Author: Chris Koeritz
-
-# this script tries to intuit where java is installed on this machine.
-
-############################
-
-source $FEISTY_MEOW_SCRIPTS/core/functions.sh
-
-# this reports when we have totally failed to figure out where a folder
-# is actually located on the machine.
-function intuition_failure()
-{
- missing="$1"; shift
- if [ ! -z "$SHELL_DEBUG" ]; then
- echo "Could not intuit '$missing' variable."
- fi
- # remove the variable because its value is busted.
- unset $missing
-}
-
-############################
-
-# set some fairly liberal limits for ant.
-#no. export ANT_OPTS="-Xms512m -Xmx768m -XX:MaxPermSize=768m"
-
-############################
-
-# start guessing some settings...
-
-# this bin portion works for most javas...
-export JAVA_BIN_PIECE=bin
-
-if [ ! -d "$JAVA_HOME" ]; then
- # try a recent version.
- export JAVA_HOME=/usr/lib/jvm/java-8-oracle
-fi
-if [ ! -d "$JAVA_HOME" ]; then
- # or an older version.
- export JAVA_HOME=/usr/lib/jvm/java-7-oracle
-fi
-if [ ! -d "$JAVA_HOME" ]; then
- JAVA_HOME="$(ls -d c:/tools/*jdk* 2>/dev/null)"
-fi
-if [ ! -d "$JAVA_HOME" ]; then
- JAVA_HOME="$(ls -d "c:/Program Files"/*jdk* 2>/dev/null)"
-fi
-if [ ! -d "$JAVA_HOME" ]; then
- JAVA_HOME="$(ls -d "c:/Program Files (x86)"/*jdk* 2>/dev/null)"
-fi
-if [ ! -d "$JAVA_HOME" ]; then
- if [ ! -z "$(grep -i 'd:' /proc/mounts 2>/dev/null)" ]; then
- # try using a windows version.
- JAVA_HOME="$(ls -d d:/tools/*jdk* 2>/dev/null)"
- fi
-fi
-# this should go last, since it changes the bin dir.
-if [ ! -d "$JAVA_HOME" ]; then
- # if that didn't work, try the location for mac os x.
- JAVA_HOME=/Library/Java/Home
- JAVA_BIN_PIECE=Commands
-fi
-# last thing is to tell them we couldn't find it.
-if [ ! -d "$JAVA_HOME" ]; then
- unset JAVA_HOME
- unset JAVA_BIN_PIECE
- if [ -z "$(whichable java 2>/dev/null)" ]; then
- intuition_failure JAVA_HOME
- fi
-fi
-
-############################
-
-# intuit where we have our local eclipse.
-if [ ! -d "$ECLIPSE_DIR" ]; then
- export ECLIPSE_DIR=/usr/local/eclipse
-fi
-if [ ! -d "$ECLIPSE_DIR" ]; then
- ECLIPSE_DIR=$HOME/eclipse
-fi
-if [ ! -d "$ECLIPSE_DIR" ]; then
- ECLIPSE_DIR=$HOME/apps/eclipse
-fi
-if [ ! -d "$ECLIPSE_DIR" ]; then
- ECLIPSE_DIR="c:/tools/eclipse"
-fi
-if [ ! -d "$ECLIPSE_DIR" ]; then
- if [ ! -z "$(grep -i 'd:' /proc/mounts 2>/dev/null)" ]; then
- ECLIPSE_DIR="d:/tools/eclipse"
- fi
-fi
-if [ ! -d "$ECLIPSE_DIR" ]; then
- if [ ! -z "$(grep -i 'e:' /proc/mounts 2>/dev/null)" ]; then
- ECLIPSE_DIR="e:/tools/eclipse"
- fi
-fi
-# final option is to whine.
-if [ ! -d "$ECLIPSE_DIR" ]; then
- unset ECLIPSE_DIR
-else
- if [ ! -z "$(uname -a | grep -i cygwin)" ]; then
- # fix the path for cygwin's bizarre requirement of /cygdrive/X.
- ECLIPSE_DIR=$(echo $ECLIPSE_DIR | sed -e 's/^\(.\):/\/cygdrive\/\1/')
- fi
-fi
-if [ -z "$ECLIPSE_DIR" -a -z "$(whichable eclipse 2>/dev/null)" ]; then
- intuition_failure ECLIPSE_DIR
-fi
-
-############################
-
-# use the variables we just set in our path, and try to make them override
-# any other paths to different versions.
-
-if [ ! -z "$JAVA_HOME" ]; then
- j="$JAVA_HOME"
- if [ ! -z "$(uname -a | grep -i cygwin)" ]; then
- j=$(echo $j | sed -e 's/^\(.\):/\/cygdrive\/\1/')
- fi
- export PATH=$j/$JAVA_BIN_PIECE:$PATH
-fi
-if [ ! -z "$ECLIPSE_DIR" ]; then
- e="$ECLIPSE_DIR"
- if [ ! -z "$(uname -a | grep -i cygwin)" ]; then
- e=$(echo $e | sed -e 's/^\(.\):/\/cygdrive\/\1/')
- fi
- export PATH=$e:$PATH
-fi
-
-############################
-
-#echo "java_profile: JAVA_HOME='$JAVA_HOME' ECLIPSE_DIR='$ECLIPSE_DIR'"
-
diff --git a/customize/fred/refred.sh b/customize/fred/refred.sh
deleted file mode 100644
index 06faf847..00000000
--- a/customize/fred/refred.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-# cleans up the ownership for all my files.
-function refred()
-{
- sudo chown -R fred:fred /home/fred /home/games /home/archives
- sudo bash $FEISTY_MEOW_SCRIPTS/files/normal_perm.sh /var/log
-}
-
-# this block should execute when the script is actually run, rather
-# than when it's just being sourced.
-if [[ $0 =~ .*refred\.sh.* ]]; then
- THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )"
- export LIGHTWEIGHT_INIT=true
- source "$THISDIR/../../scripts/core/launch_feisty_meow.sh"
- refred
-fi
-
diff --git a/customize/fred/scripts/create_disco_dirs.sh b/customize/fred/scripts/create_disco_dirs.sh
deleted file mode 100644
index ff273ba8..00000000
--- a/customize/fred/scripts/create_disco_dirs.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-
-mkdir $HOME/disco
-pushd $HOME/disco &>/dev/null
-mkdir -p burn converted grind rip
-popd &>/dev/null
-
diff --git a/customize/fred/scripts/curies_musix_wand.sh b/customize/fred/scripts/curies_musix_wand.sh
deleted file mode 100644
index 3a5fe7cc..00000000
--- a/customize/fred/scripts/curies_musix_wand.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-
-# this script is meant to be run on curie with our super alpha prime source of music plugged in.
-
-source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
-
-#hmmm: add the goodness around these like the nice updater.
-
-if [[ ! ( $(hostname) =~ .*curie.* ) ]]; then
- echo this script is only designed to run on curie with the
- echo fred music prime external disc plugged in.
- exit 1
-fi
-
-# synch our local copy on curie with the music drive, source of all goodness.
-function get_music_from_alpha_site()
-{
- sep
- echo "getting musix and basement from fred music prime device"
- rsync -av /media/fred/fredmusicprime/musix/* /z/musix/
- rsync -av /media/fred/fredmusicprime/basement/* /z/basement/
- sep
- echo
-}
-
-# updates the music on a remote host to our current local copy on curie.
-function update_musix_pile()
-{
- sep
- local host="$1"; shift
- echo "$host: synching musix and basement"
- rsync -avz /z/musix/* ${host}:/z/musix/
- rsync -avz /z/basement/* ${host}:/z/basement/
- sep
- echo
-}
-
-# make sure the local machine, curie, is in good shape.
-get_music_from_alpha_site
-
-# run through the steps of updating all our machines.
-for i in surya banshee wildmutt euphrosyne; do
- update_musix_pile $i
-done
-
-
diff --git a/customize/fred/scripts/gamesaver.sh b/customize/fred/scripts/gamesaver.sh
deleted file mode 100644
index 0cd6b725..00000000
--- a/customize/fred/scripts/gamesaver.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/bash
-
-# a helpful script that scrapes any active game saves from wine's storage
-# area into a spooling saves folder for archiving.
-
-source $FEISTY_MEOW_SCRIPTS/core/functions.sh
-
-WINE_SOURCE_DIR="$HOME/wine_goods/My Games"
-SPOOLING_OUTPUT_DIR="$HOME/spooling_saves"
-
-if [ ! -d "$WINE_SOURCE_DIR" ]; then
- WINE_SOURCE_DIR="c:/users/fred/My Documents/My Games"
-fi
-if [ ! -d "$WINE_SOURCE_DIR" ]; then
- echo "Failing to find the game save directories."
- exit 1
-fi
-
-# copies the files for a particular game out to a spooling folder.
-function copyem()
-{
- game_name="$1"; shift
- source_dir="$1"; shift
- out_dir="$1"; shift
-
- if [ -d "$source_dir" ]; then
- echo $game_name
- cp -v -n "$source_dir"/* "$out_dir"/
- sep 28
- fi
-}
-
-# make the output folders if they don't exist.
-for i in skyrim fallout_new_vegas fallout_3/Saves oblivion fallout_4/Saves ; do
- if [ ! -d "$SPOOLING_OUTPUT_DIR/$i" ]; then
- mkdir -p "$SPOOLING_OUTPUT_DIR/$i"
- fi
-done
-
-# now run through and copy our save files from the potentially weird locations
-# they reside in.
-
-sep 28
-
-copyem "skyrim" "$WINE_SOURCE_DIR/Skyrim/Saves" "$SPOOLING_OUTPUT_DIR/skyrim"
-
-copyem "fallout new vegas" "$WINE_SOURCE_DIR/FalloutNV/Saves" "$SPOOLING_OUTPUT_DIR/fallout_new_vegas"
-
-copyem "fallout 3" "$WINE_SOURCE_DIR/Fallout3/Saves" "$SPOOLING_OUTPUT_DIR/fallout_3/Saves"
-
-copyem "oblivion" "$WINE_SOURCE_DIR/Oblivion/Saves" "$SPOOLING_OUTPUT_DIR/oblivion/"
-
-copyem "fallout 4" "$WINE_SOURCE_DIR/Fallout4/Saves" "$SPOOLING_OUTPUT_DIR/fallout_4/Saves"
-
-
diff --git a/customize/fred/scripts/pick_credentials.sh b/customize/fred/scripts/pick_credentials.sh
deleted file mode 100644
index 8b4b55e6..00000000
--- a/customize/fred/scripts/pick_credentials.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-# chooses the right certificate to use for logging in via ssh.
-
-#hmmm: not the slightest bit general here currently.
-# what about having a main key variable and a sourceforge key variable?
-# better yet, an array of site patterns and keys for those sites.
-
-keyfile="$HOME/.ssh/id_dsa_fred"
-
-if [ ! -z "$(echo $* | grep -i sourceforge)" ]; then
- keyfile="$HOME/.ssh/id_dsa_sourceforge"
-fi
-
-if [ ! -f "$keyfile" ]; then
- unset keyfile
-fi
diff --git a/customize/fred/scripts/sftp.sh b/customize/fred/scripts/sftp.sh
deleted file mode 100644
index c668500c..00000000
--- a/customize/fred/scripts/sftp.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-source "$FEISTY_MEOW_LOADING_DOCK/custom/scripts/pick_credentials.sh"
-
-# a wrapper for the file transfers using secure shell.
-\sftp -i "$keyfile" $*
-
diff --git a/customize/fred/scripts/ssh.sh b/customize/fred/scripts/ssh.sh
deleted file mode 100644
index 316228c1..00000000
--- a/customize/fred/scripts/ssh.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-
-# wraps our calling the secure shell and lets us pick our credentials.
-
-source "$FEISTY_MEOW_LOADING_DOCK/custom/scripts/pick_credentials.sh"
-
-# save the former terminal title if we're running in X with xterm.
-prior_title=
-which xprop &>/dev/null
-if [ $? -eq 0 ]; then
- if [[ "$TERM" =~ .*"xterm".* ]]; then
- prior_title="$(xprop -id $WINDOWID | perl -nle 'print $1 if /^WM_NAME.+= \"(.*)\"$/')"
- fi
-fi
-
-# force the TERM variable to a more generic version for other side.
-# we don't want the remote side still thinking it's running xterm.
-export TERM=linux
-
-#hmmm: it would be good to set an interrupt handler here and
-# trap ctrl-c, since otherwise we are getting exited from and losing a chance
-# to reset the terminal title. this actually happens a lot, since some X11
-# or other background process is left running and the ssh never actually quits,
-# forcing one to hit ctrl-c.
-
-if [ ! -z "$keyfile" ]; then
- \ssh -i "$keyfile" -X -C $*
-#-c blowfish-cbc
-else
- \ssh -X -C $*
-#-c blowfish-cbc
-fi
-
-if [ $? -eq 0 ]; then
- # we don't want to emit anything extra if this is being driven by git.
- if [ -z "$(echo $* | grep git)" ]; then
- # re-run the terminal labeller after coming back from ssh.
- # we check the exit value because we don't want to update this for a failed connection.
- if [ -z "$prior_title" ]; then
-#echo prior title nil new label
- bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh
- else
-#echo "using old prior title of '$prior_title'"
- bash $FEISTY_MEOW_SCRIPTS/tty/set_term_title.sh "$prior_title"
- fi
- fi
-fi
-
-
diff --git a/customize/fred/scripts/synch_from_surya.sh b/customize/fred/scripts/synch_from_surya.sh
deleted file mode 100644
index d1864369..00000000
--- a/customize/fred/scripts/synch_from_surya.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-
-echo "Updating walrus and musix from surya"
-rsync -avz surya:/z/walrus/* /z/walrus/
-rsync -avz surya:/z/musix/* /z/musix/
-
diff --git a/customize/fred/scripts/update_barkuptree.sh b/customize/fred/scripts/update_barkuptree.sh
deleted file mode 100644
index 539672bf..00000000
--- a/customize/fred/scripts/update_barkuptree.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-#hmmm: plug in stuff from the updater for soapbox.
-
-rsync -av /z/backups/archive_backups/* /media/fred/barkuptreedrive/archive_backups/
-rsync -av /z/walrus/* /media/fred/barkuptreedrive/walrus/
-rsync -av /z/musix/* /media/fred/barkuptreedrive/musix/
diff --git a/customize/fred/scripts/update_soapbox.sh b/customize/fred/scripts/update_soapbox.sh
deleted file mode 100644
index df5921c0..00000000
--- a/customize/fred/scripts/update_soapbox.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-
-# updates my little 1 TB "soapbox" style usb drive with items that it should contain.
-
-source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
-
-function get_source()
-{
- folder="$1"; shift
- echo getting latest codes in $folder...
- pushd "$folder"
- if [ $? -ne 0 ]; then
- echo Changing to the folder $folder failed.
- exit 1
- fi
- bash "$FEISTY_MEOW_SCRIPTS/rev_control/rev_checkin.sh"
- if [ $? -ne 0 ]; then
- echo Checking out the latest codes has failed somehow for $folder.
- exit 1
- fi
- popd
-}
-
-sep
-
-ls /media/fred/soapboxdrive
-if [ $? -ne 0 ]; then
- echo The soapbox drive is not mounted currently, so cannot be updated.
- exit 1
-fi
-
-sep
-
-echo synching walrus...
-rsync -av /z/walrus/* /media/fred/soapboxdrive/walrus/
-if [ $? -ne 0 ]; then
- echo The walrus sync failed.
- exit 1
-fi
-
-sep
-
-echo synching musix...
-rsync -av /z/musix/* /media/fred/soapboxdrive/musix/
-if [ $? -ne 0 ]; then
- echo The musix sync failed.
- exit 1
-fi
-
-sep
-
-echo getting latest fred codes...
-pushd /media/fred/soapboxdrive
-get_source extra_brain
-
-sep
-
-echo getting latest gffs codes...
-get_source gffs
-popd
-
-sep
-
-echo Updated all portions of the soapbox drive successfully.
-
diff --git a/customize/how_to_customize.txt b/customize/how_to_customize.txt
deleted file mode 100644
index be796df1..00000000
--- a/customize/how_to_customize.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-
-this folder has some examples of how various people (or one person right now)
-do their custom scripts.
-
-the folder can have alias files (ending in .alias) that are written in bash,
-and it can also have shell scripts that are sourced into the main-line of
-script initialization (any files ending in .sh).
-
-when you have some custom scripts you want to use, copy them from your own
-folder to the $FEISTY_MEOW_LOADING_DOCK/custom directory.
-
-
-(needs to talk about the scripts directory which is handled specially.
-are there any keyword matched filenames with special functions?)
-
-
diff --git a/customize/mik/mik.alias b/customize/mik/mik.alias
deleted file mode 100644
index e21f7d5c..00000000
--- a/customize/mik/mik.alias
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-define_yeti_alias lsd='ls -l'
-define_yeti_alias h='history'
-define_yeti_alias dw='du | grep Waves'
-define_yeti_alias rm='rm'
-define_yeti_alias d1='du --max-depth=1'
-define_yeti_alias df='/bin/df'
-
-define_yeti_alias rebob='chowngrp -R bob /home/bob ; chowngrp -R bob /home/games ; chowngrp -R bob /home/archives ; chowngrp -R bob /Data ; chowngrp -R bob /fatty ; chowngrp -R bob /srv/ftp '
-
-define_yeti_alias ipod=gtkpod
-
diff --git a/documentation/clam_manual/clam_docs.html b/documentation/clam_manual/clam_docs.html
index 6872a4e1..b5380512 100644
--- a/documentation/clam_manual/clam_docs.html
+++ b/documentation/clam_manual/clam_docs.html
@@ -646,7 +646,7 @@
are
generated. All files generated by compilation are stored in the
repository
- directory (by default, either "~/feisty_meow" in Linux or "l:\" in
+ directory (by default, either "/opt/feistymeow.org/feisty_meow" in Linux or "l:\" in
win32). There are three TYPEs supported so far:
@@ -671,7 +671,7 @@
be given
an include directory named after the project, such as
- "~/feisty_meow/include/basis".
+ "/opt/feistymeow.org/feisty_meow/include/basis".
The include directory is created as a copy of the headers in the
project's
directory . Library projects will also have their final products
diff --git a/documentation/doc_fodder/bash_tools.html b/documentation/doc_fodder/bash_tools.html
deleted file mode 100644
index 655b028c..00000000
--- a/documentation/doc_fodder/bash_tools.html
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
-
-
- Feisty Meow Concerns Bash Scripts
-
-
-
-
-
-
-
-
-
-
-
-
- GPL-Licensed Bash Code
-
-
- Contributed by Chris Koeritz (Koeritz@Gruntose.COM )
-See the GNU Public
-License for details of licensing.
-
- Caveats: please refer to the Perl
-Scripts page which shares the same constraints as these Bash
-Scripts do.
-
- Direct Cognition :
-View the scripts directory itself rather than navigating with the links
-below: scripts .
-
-
-
-
-
-
-
-
-
-
-
-
-
- Assorted Bash Script Files
-
-
- This documentation page isn't quite ready yet.
-In fact, this file is still in its very first few iterations and is
-pretty
-limited so far...
-
-
-
- Some manipulation methods for a
-particular type of movie and TV show database. These expect a db
-in the form of a CSV file with three fields per line: (1) index number,
-(2) show or movie name and (3) show episode title. The third
-field is defined as blank for movies. The movie_seeker finds a
-given movie (or pattern) in the database. The movie_stripper
-pulls out all the unique movie or show names in the database. The
-show_stripper pulls out the episode names for a particular show name
-(or pattern).
-
-
- These are CGI correspondents to
-the above movie database searches. They're used on the Gruntose
-web site.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/documentation/doc_fodder/perl_tools.html b/documentation/doc_fodder/perl_tools.html
deleted file mode 100644
index 8eaad288..00000000
--- a/documentation/doc_fodder/perl_tools.html
+++ /dev/null
@@ -1,352 +0,0 @@
-
-
-
-
-
-
-
-
- Feisty Meow Concerns Perl Scripts
-
-
-
-
-
-
-
-
-
-
-
-
- Some Hopefully Useful GPL-Licensed Perl Code
-
-
- Contributed by Chris Koeritz (Koeritz@Gruntose.COM )
-See the GNU Public
-License for details of licensing.
-
- Caveats:
-
- No warranty, express, implied or imagined, is offered for
-these files. If you destroy your life by running one of them, I
-will have sympathy, but that's about it.
- Some of these shell scripts depend on environment variables.
-The most frequent case of this is FEISTY_MEOW_APEX, which should point to the
-top-level
-directory where the Feisty Meow scripts are stored on your
-machine. This variable is set by default when the scripts are in
-the ~/feisty_meow folder. Consult your operating
-system documentation if you are
-unfamiliar with the concept or management of environment variables.
- These files are provided as possibly useful shell scripts
-rather than as full-fledged reusable and object oriented components.
- Improvements and contributions are gladly accepted.
-They will be processed as fast as our schedule permits. Please
-send any changes to the Gruntose Curator at fred@gruntose.com .
- These files are mostly portable between Unix and the
-various Windoze OSes, but in many cases you may want to fix the
-defaults or path names to make them more suitable for your own needs.
- Some of the scripts invoke external programs that are
-available for most Unixes. For Windoze users, a set of GNU Unix
-utilities is available at "http://www.mingw.org/ ".
- An alternative, but not recommended, GNU suite is
-at "http://www.cygwin.com/ ".
- Direct Cognition :
-View the scripts directory itself rather than navigating with the links
-below: scripts .
-
-
-
-
-
-
-
-
-
-
-
-
- Library Files
-
-
-
- The "differ" utilities can be used to compare two
-directories of text or binary files against each other. The two
-directories are presumably close in contents. This can be useful
-when one is revising a set of files and wants to synchronize an older
-copy against a newer version. Support for "differ.pl "
-is provided
-here.
-
- Contains a handy set of utilities for manipulating
-filenames. These can help to make perl scripts portable across
-the two well-known types of filename separators ('/' and '\').
-They also provide support for ripping up filenames into their
-components.
-
- This is a simple utility that manages a file with a
-number in it. This is somewhat more useful than it sounds.
-Functions are provided to get the current number and to change the
-number.
-
-
- This library supports the "snarf" utilities.
-The
-utilities manipulate archive files with the ".snarf" extension.
-These
-packed
-snarf files are compressed chunks of directory hierarchies. Bob
-files
-are useful because they track a number per distinct "snarf" types that
-is
-used to make uniquely named new archives of the appropriate type.
-This
-number is an ever increasing integer that's stored in a well-known
-(configurable) location. When a snarf file is unpacked (using the
-"unsnarf" tool), the number is updated on the local machine so that the
-next generated file will
-be one greater than the previous number. If one is travelling
-between
-two machines with the same snarf file, this will have the effect of
-keeping
-the number updated on both sides.
-
-
- Support for the zapdirs utility. This library
-cleans out the directory that it is passed by removing files that are
-not considered important (using "filename_helper.pl
-"). The list of important files is something you might want to
-look at to ensure that you won't get burned by zapdirs.
-
-
-
-
-
-
-
-
-
-
-
-
- Applications
-
-
- Processes Unix format text files for pcdos by
-forcing the line endings to be Carriage Return plus Line Feed (CRLF).
-
-
- Turns the files passed on the command line into a
-stream of CGI compatible text output. The javascript show_file method
-(see the
-source for this page) is preferred since it is lighter weight and
-doesn't
-need cgi, but there are some situations where cgi is the only option
-(older
-browsers or requirements of no javascript).
-
-
- Replaces the suffix of all filenames in the current
-directory
-with a different suffix. Suffix here is defined as the set of
-characters
-after the last period ('.') in the name. Note this will not work
-for
-names without suffices.
-
-
- Copies files from a source directory into a
-destination directory. The files are only copied when they are
-missing in the destination or when the destination version has
-different contents. The syntax looks like this:
- cpdiff source destination
-The assumption is that the files in the source directory are somehow
-better, newer or more complete than the set of files in the destination.
-
-
- Similar to cpdiff, but this utility sets the
-destination file's time stamp to "now". This should cause the new
-or changed files in the destination directory to be more recent than
-anything else in there. This is helpful sometimes for forcing
-compilation of modified source files.
-
-
-
-
- Compares two directory hierarchies and the files
-they
-contain. The first parameter is a directory
-to compare against "this" directory;
-every subdirectory "here" will be traversed in order to build the
-output file that shows the differences. An optional second
-argument can be used to specify a different directory than the current
-one as the source of the comparison (the first argument is always the
-destination of the comparison).
-
- Collects the contents of the files whose names are
-passed on the command line into one gigundo stream which is passed to
-standard output. The output can be piped into another file as desired.
-
- Performs some useful activities for the shell
-environment. Using the environment variable for FEISTY_MEOW_SCRIPTS (which
-is set in the appropriate startup files to be the shell scripts
-directory, where all this stuff lives), generate_aliases will create
-all of the aliases files for the combinations of operating systems and
-types of shells supported. Currently this includes Linux, Unix,
-PCDOS, OS/2 and MS-WIN32 (9x, NT, 2K, XP, etc) for
-supported operating systems. The shell languages supported are
-dos's command, nt's cmd, unix's sh and bash, and perl. This script will also look for
-any files ending in ".sh" or ".pl" and it will create aliases for them
-in forms appropriate to the different shells. The .zz_feisty_loading
-subdirectory is created under the home directory as a storage place for the generated script
-files.
-
-
- Generates a signature file from the nechung
-database
-using the 'nechung' application. See the Feisty Meow Concerns Codebase for the nechung
-application.
- The database for nechung resides in the whole Feisty Meow Concerns code package in "feisty_meow/infobase".
-
-
- Renames all of the files passed on the command line
-such that they are only in lower-case. Useful if you're tired of
-passing mistakenly re-capitalized names from a defective 8.3 OS (e.g.
-Doze95/98) to
-a file system where you care about the case.
-
- Finds all executable files in the current directory
-(and subdirectories) and runs them. The output of the programs is
-sent to standard output. Standard error is used to report which
-file is being worked on, plus the running programs' own standard error
-streams are merged into runner's standard error stream. This
-makes it nice to do something like:
- runner >runs.log
-where the runs.log file will contain the output of each program that
-was executed and the console will be sent messages as each program is
-started and finished (and errors show up at the console also).
-
-
- Makes deleting files and directories a little less
-nerve-wracking. If you substitute safedel as an alias for rm or
-del or deltree or whatever, it will make a zipped backup of the items
-before they are actually deleted. Safedel keeps track of a number
-that is attached to each zip to enforce uniquely numbered
-archives. They are stored in a directory named "zz_safedel_keep"
-that is stored under the temorary directory (specified by the
-environment
-variable named TMP). A report of the contents of the compressed
-trash
-is appended to a file named "zz_safedel.rpt" in the TMP directory.
-Occasional
-cleaning of the deleted files folder is recommend, but this utility has
-saved
-my various parts several times already.
-
-
-
- A snarf utility that packages up the
-important configuration files in a Linux installation.
-
-
- A selective snarf of the source hierarchy.
-This
-collects the code that I manage. As such, this is probably
-irrelevant to anyone but CAK.
-
- Gathers all "important" files from the home
-directory.
- This
-is somewhat personally tuned but it includes files and directories that
-have
-"project", "notes", or "crucial" in their name.
-
-
- A source code grabbing snarfer. The entire
-source
-code hierarchy is snarfed. Note that one should edit the
-hierarchy
-location to make it appropriate for your local source code.
-
-
- Offers a directory listing along with total file
-sizes
-and disk free space.
-
-
-
- This is a helper utility that synchronizes the binary
-outputs from a build process with an existing installed location. Given a target directory, the executable
-programs and dynamic libraries that exist there will be synchronized
-with the build repository's versions. This is kind of a quickie
-upgrade process, as long as the files in the target location are not
-locked by other processes.
-
-
- Uses the snarfer utilities to undo a previously
-snarfed file. A folder named "snarf_BASE" is created for the
-contents, where BASE
-is replaced with the basename of the snarf file (that is, without the
-".snarf"
-suffix). The number that tracks the snarf files of this type is
-updated
-such that the next snarf file will be at least one higher than this
-snarf's
-sorta
-unique number. The number will be managed correctly if you're
-always
-unsnarfing the most recent snarf files before creating any new snarfs.
-
-
- Since all of my file deletion commands are aliases
-to safedel , it is hard to actually remove a
-file. If I'm really really sure that a file or directory needs to
-be
-permanently deleted, then this command can be used. It shows the
-names
-it is removing also, but it does _not_ ask for confirmation.
-
-
- Tests the system for survival
-past the year 2038, which is when the Unix time scale runs out of bits
-for the number of seconds since 1970 measured in a 32 bit integer.
-
-
- Removes empty directories and directories
-containing only
-unimportant crud (see "filename_helper.pl ").
-If there are no arguments, then the current directory is cleaned up;
-any subdirectories
-will be traversed into and removed if it seems appropriate.
-Otherwise,
-zapdirs operates on the arguments passed to it as if they are directory
-names
-to be cleaned.
-
-
-
-
-
-
-
-
-
diff --git a/documentation/doc_fodder/readme.txt b/documentation/doc_fodder/readme.txt
deleted file mode 100644
index 7194c944..00000000
--- a/documentation/doc_fodder/readme.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-these are bits of documentation that could be scavenged.
diff --git a/documentation/google_apis/google_apis_and_credentials.odt b/documentation/google_apis/google_apis_and_credentials.odt
new file mode 100755
index 00000000..77ba9a00
Binary files /dev/null and b/documentation/google_apis/google_apis_and_credentials.odt differ
diff --git a/documentation/google_apis/google_apis_and_credentials.pdf b/documentation/google_apis/google_apis_and_credentials.pdf
new file mode 100755
index 00000000..850665ec
Binary files /dev/null and b/documentation/google_apis/google_apis_and_credentials.pdf differ
diff --git a/documentation/history_anat.txt b/documentation/history_anat.txt
index 216407a7..46f95fc2 100644
--- a/documentation/history_anat.txt
+++ b/documentation/history_anat.txt
@@ -74,18 +74,22 @@ octopi/
Octopus design pattern and CROMP protocol reference implementations. Assorted applications
based on these.
-database/
+infobase/
Some files considered critical to the operations of Feisty Meow Concerns Ltd. This includes
the database of fortunes used by the Nechung Oracle Program.
-documentation/
- Helpful guides and information for Feisty Meow. Also includes a code documentation generator
- configuration for feisty meow that produces a nice set of web docs, using doxygen.
+infobase/feisty_inits
+ Some example startup files for use with feisty meow. These are deployed automatically by
+ the "connect_feisty_meow" command.
-examples/
+infobase/examples/
Some files that show how to get work done with Feisty Meow or that show how to do certain
tasks in different scripting / programming languages.
+documentation/
+ Helpful guides and information for Feisty Meow. Also includes a code documentation generator
+ configuration for feisty meow that produces a nice set of web docs, using doxygen.
+
kona/
Our burgeoning Java libraries. Not much to see here yet, but there is some code piling
up for these that we will try to release soon.
diff --git a/examples/bashisms/dot.bash_logout b/examples/bashisms/dot.bash_logout
index bb76b864..ab2ba32b 100644
--- a/examples/bashisms/dot.bash_logout
+++ b/examples/bashisms/dot.bash_logout
@@ -1,3 +1,6 @@
# runs the nechung oracle program at exit from bash.
-nechung
+sep 79
+$FEISTY_MEOW_GENERATED_STORE/runtime/binaries/nechung
+echo
+
diff --git a/examples/bashisms/script_location.sh b/examples/bashisms/script_location.sh
index a01dc95a..7fa942a6 100644
--- a/examples/bashisms/script_location.sh
+++ b/examples/bashisms/script_location.sh
@@ -5,3 +5,6 @@
# personal aliases or functions disrupting the results.
ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && /bin/pwd )"
+# another slightly tighter version:
+export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+
diff --git a/examples/building/vs_var.bat b/examples/building/vs_var.bat
new file mode 100644
index 00000000..de9ecc14
--- /dev/null
+++ b/examples/building/vs_var.bat
@@ -0,0 +1,2 @@
+
+"c:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/Tools/vsvars32.bat"
diff --git a/examples/graphics/pdf_picture_extractor.sh b/examples/graphics/pdf_picture_extractor.sh
new file mode 100644
index 00000000..bb46a0df
--- /dev/null
+++ b/examples/graphics/pdf_picture_extractor.sh
@@ -0,0 +1,9 @@
+var=0
+for i in *; do
+ var=$(($var + 1))
+ mkdir -p ~/pictures_converted/$var/
+ pdfimages -j $i ~/pictures_converted/$var/
+ mv ~/pictures_converted/$var/* ~/pictures_converted/$(basename $i .pdf).jpg
+done
+
+
diff --git a/examples/legacy/gpg-daemon-launcher.sh b/examples/legacy/gpg-daemon-launcher.sh
index 89054055..f59c6d1f 100644
--- a/examples/legacy/gpg-daemon-launcher.sh
+++ b/examples/legacy/gpg-daemon-launcher.sh
@@ -11,7 +11,7 @@
# starts up the gpg-agent, but only if it's not already running.
-source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
+source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
if [ -z "$(psa gpg-agent)" ]; then
gpg-agent --daemon --enable-ssh-support --write-env-file "${HOME}/.gpg-agent-info" &>$TMP/zz_gpg-agent-daemon.log
diff --git a/examples/os_related/block_ip_address.sh b/examples/os_related/block_ip_address.sh
new file mode 100644
index 00000000..68919bee
--- /dev/null
+++ b/examples/os_related/block_ip_address.sh
@@ -0,0 +1 @@
+sudo ufw deny from ${ip_address} to any
diff --git a/examples/os_related/set_tcp_config.sh b/examples/os_related/set_tcp_config.sh
new file mode 100644
index 00000000..7fc3d76e
--- /dev/null
+++ b/examples/os_related/set_tcp_config.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# this script modifies the linux kernel for maximum tcp buffer size, which can
+# improve long-haul transfers over a wan.
+
+# new maximum buffer size to set.
+new_max=4194304
+
+echo "net.core.wmem_max=$new_max" >> /etc/sysctl.conf
+echo "net.core.rmem_max=$new_max" >> /etc/sysctl.conf
+
+echo "net.ipv4.tcp_rmem= 10240 87380 $new_max" >> /etc/sysctl.conf
+echo "net.ipv4.tcp_wmem= 10240 87380 $new_max" >> /etc/sysctl.conf
+
+echo "net.ipv4.tcp_window_scaling = 1" >> /etc/sysctl.conf
+
+echo "net.ipv4.tcp_timestamps = 1" >> /etc/sysctl.conf
+
+echo "net.ipv4.tcp_sack = 1" >> /etc/sysctl.conf
+
+echo "net.ipv4.tcp_no_metrics_save = 1" >> /etc/sysctl.conf
+
+echo "net.core.netdev_max_backlog = 5000" >> /etc/sysctl.conf
+
diff --git a/experiments/readme.txt b/experiments/readme.txt
new file mode 100644
index 00000000..06a8a18a
--- /dev/null
+++ b/experiments/readme.txt
@@ -0,0 +1,7 @@
+
+
+this is the testing lab where we work on new technologies.
+
+if something is still in here, it means it's not ready yet.
+
+
diff --git a/experiments/vnc/dot.vnc/xstartup.001 b/experiments/vnc/dot.vnc/xstartup.001
new file mode 100755
index 00000000..40b174bf
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.001
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# set up gnome desktop environment for vnc.
+
+# references:
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://www.centos.org/docs/5/html/5.2/Virtualization/sect-Virtualization-Tips_and_tricks-Configuring_a_VNC_Server.html
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+
+xsetroot -solid darkgreen
+vncconfig -iconic &
+
+#######
+gnome-session --session=ubuntu &
+#valid values for session that we've seen:
+# ubuntu
+# gnome
+# 2d-gnome (?)
+# unity
+#######
+
+x-terminal-emulator -geometry 100x32 -ls -title "$VNCDESKTOP Desktop" &
+
+#######
+# are these alternatives also?
+x-session-manager &
+#x-window-manager &
+#######
+
+# we don't see this running at home, but it sure seems needed on vmbuilder.
+gnome-panel &
+
+#gnome-settings-daemon &
+#gnome-shell &
+
+#######
+# one or the other of the window managers here.
+#hmmm: but mutter doesn't work at all.
+metacity &
+#mutter &
+#######
+
+nautilus &
+
diff --git a/experiments/vnc/dot.vnc/xstartup.002 b/experiments/vnc/dot.vnc/xstartup.002
new file mode 100755
index 00000000..1df643d6
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.002
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+# set up gnome desktop environment for vnc.
+
+# references:
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://www.centos.org/docs/5/html/5.2/Virtualization/sect-Virtualization-Tips_and_tricks-Configuring_a_VNC_Server.html
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+
+xsetroot -solid darkgreen
+vncconfig -iconic &
+
+#######
+gnome-session --session=ubuntu &
+#valid values for session that we've seen:
+# ubuntu
+# gnome
+# 2d-gnome (?)
+# unity
+#######
+
+x-terminal-emulator -geometry 100x32 -ls -title "$VNCDESKTOP Desktop" &
+
+#######
+# are these alternatives also?
+x-session-manager &
+#x-window-manager &
+#######
+
+gnome-terminal-server &
+
+# we don't see this running at home, but it sure seems needed on vmbuilder.
+gnome-panel &
+
+#gnome-settings-daemon &
+#gnome-shell &
+
+#######
+# one or the other of the window managers here.
+#hmmm: but mutter doesn't work at all.
+metacity &
+#mutter --replace &
+#######
+
+nautilus &
+
+# experimental additions since still getting lots of weird isssues:
+indicator-multiload &
+compiz &
+gnome-keyring-daemon &
+ibus-daemon &
+zeitgeist-daemon &
+
+# just nice to have started already.
+kwalletd &
+
+
+
diff --git a/experiments/vnc/dot.vnc/xstartup.003 b/experiments/vnc/dot.vnc/xstartup.003
new file mode 100755
index 00000000..d2a26678
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.003
@@ -0,0 +1,105 @@
+#!/bin/sh
+
+# set up gnome desktop environment for vnc.
+
+# references:
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://www.centos.org/docs/5/html/5.2/Virtualization/sect-Virtualization-Tips_and_tricks-Configuring_a_VNC_Server.html
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+############################
+
+# boilerplate that people seem to agree on.
+
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+
+xsetroot -solid darkgreen
+vncconfig -iconic &
+
+############################
+
+# the chaos zone. all of these are still being tested.
+
+#######
+gnome-session --session=ubuntu &
+#valid values for session that we've seen:
+# ubuntu
+# gnome
+# 2d-gnome (?)
+# unity
+#######
+
+#######
+# are these alternatives also?
+x-session-manager &
+#x-window-manager &
+#######
+
+gnome-terminal-server &
+
+# we don't see this running at home, but it sure seems needed on vmbuilder.
+gnome-panel &
+
+# no longer exists?
+#gnome-settings-daemon &
+
+# do we need this?
+#gnome-shell &
+
+#######
+# one or the other of the window managers here.
+#hmmm: but mutter doesn't work at all.
+metacity &
+#mutter --replace &
+#######
+
+# this just brings up an initial file exploring window, although at one point i needed to
+# have nautilus running to see icons on the desktop.
+####right now there are no visible icons on the desktop, so is it failing?
+nautilus &
+
+############################
+
+# experimental additions since still getting lots of weird isssues:
+indicator-multiload &
+gnome-keyring-daemon &
+ibus-daemon &
+zeitgeist-daemon &
+
+############################
+
+# these processes are just nice to have started already.
+#
+# you know you were going to want them.
+
+# password tools from kde.
+kwalletd &
+
+############################
+
+# limbo of useless boneheads.
+#
+# these things just don't seem to work.
+
+# this never ever shows up.
+#x-terminal-emulator -geometry 100x32 -ls -title "$VNCDESKTOP Desktop" &
+
+############################
+
+# ------------------------------
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# dungeon of pain and suffering.
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# ------------------------------
+#
+# adding these in just makes things go splatfooey.
+
+# compiz causes xterm to no longer be a distinct window, which is how things were
+# originally before i started fixing them.
+#compiz &
+
+############################
+
diff --git a/experiments/vnc/dot.vnc/xstartup.004 b/experiments/vnc/dot.vnc/xstartup.004
new file mode 100755
index 00000000..b4158bbb
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.004
@@ -0,0 +1,106 @@
+#!/bin/sh
+
+# set up gnome desktop environment for remote access via vnc.
+
+# this script depends on the gnome desktop.
+
+# references:
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+############################
+
+# boilerplate that people seem to agree on.
+
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+
+xsetroot -solid darkgreen
+vncconfig -iconic &
+
+############################
+
+# the chaos zone. all of these are still being tested.
+
+#######
+gnome-session --session=gnome &
+#valid values for session that we've seen:
+# ubuntu
+# gnome
+# 2d-gnome (?)
+# unity
+#######
+
+#######
+# are these alternatives also?
+#x-session-manager &
+#x-window-manager &
+#######
+
+gnome-terminal-server &
+
+# we don't see this running at home, but it sure seems needed on vmbuilder.
+gnome-panel &
+
+# no longer exists?
+#gnome-settings-daemon &
+
+# do we need this?
+#gnome-shell &
+
+#######
+# one or the other of the window managers here.
+#hmmm: but mutter doesn't work at all.
+metacity &
+#mutter --replace &
+#######
+
+# this just brings up an initial file exploring window, although at one point i needed to
+# have nautilus running to see icons on the desktop.
+####right now there are no visible icons on the desktop, so is it failing?
+nautilus &
+
+############################
+
+# experimental additions since still getting lots of weird isssues:
+indicator-multiload &
+gnome-keyring-daemon &
+ibus-daemon &
+zeitgeist-daemon &
+
+############################
+
+# these processes are just nice to have started already.
+#
+# you know you were going to want them.
+
+# password tools from kde.
+kwalletd &
+
+############################
+
+# limbo of useless boneheads.
+#
+# these things just don't seem to work.
+
+# this never ever shows up.
+#x-terminal-emulator -geometry 100x32 -ls -title "$VNCDESKTOP Desktop" &
+
+############################
+
+# ------------------------------
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# dungeon of pain and suffering.
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# ------------------------------
+#
+# adding these in just makes things go splatfooey.
+
+# compiz causes xterm to no longer be a distinct window, which is how things were
+# originally before i started fixing them.
+#compiz &
+
+############################
+
diff --git a/experiments/vnc/dot.vnc/xstartup.005 b/experiments/vnc/dot.vnc/xstartup.005
new file mode 100755
index 00000000..1833bb77
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.005
@@ -0,0 +1,133 @@
+#!/bin/sh
+
+# set up gnome desktop environment for remote access via vnc.
+
+# this script depends on the gnome desktop.
+
+# references:
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+############################
+
+# boilerplate that people seem to mostly agree on.
+
+unset SESSION_MANAGER
+unset DBUS_SESSION_BUS_ADDRESS
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+xsetroot -solid darkgreen
+vncconfig -iconic &
+
+############################
+
+# the chaos zone. all of these are still being tested.
+
+#not helping
+#if [ -x /etc/X11/xinit/xinitrc ]; then
+# exec /etc/X11/xinit/xinitrc
+#fi
+#if [ -f /etc/X11/xinit/xinitrc ]; then
+# exec sh /etc/X11/xinit/xinitrc
+#fi
+
+#... some new stuff that hopefully will help out.
+
+/usr/lib/gnome-session/gnome-session-binary âsession=ubuntu &
+/usr/lib/x86_64-linux-gnu/unity/unity-panel-service &
+/usr/lib/unity-settings-daemon/unity-settings-daemon &
+
+for indicator in /usr/lib/x86_64-linux-gnu/indicator-*; do
+ basename=âbasename \${indicator}â
+ dirname=âdirname \${indicator}â
+ service=\${dirname}/\${basename}/\${basename}-service
+ \${service} &
+done
+unity
+
+
+# items marked with #H: below were on until recently.
+
+#######
+#H: gnome-session --session=gnome &
+#valid values for session that we've seen:
+# ubuntu
+# gnome
+# 2d-gnome (?)
+# unity
+#######
+
+#######
+# are these alternatives also?
+#x-session-manager &
+#x-window-manager &
+#######
+
+#H: gnome-terminal-server &
+
+# we don't see this running at home, but it sure seems needed on vmbuilder.
+#H: gnome-panel &
+
+# no longer exists?
+#gnome-settings-daemon &
+
+# do we need this?
+#gnome-shell &
+
+#######
+# one or the other of the window managers here.
+#hmmm: but mutter doesn't work at all.
+#H: metacity &
+#mutter --replace &
+#######
+
+# this just brings up an initial file exploring window, although at one point i needed to
+# have nautilus running to see icons on the desktop.
+####right now there are no visible icons on the desktop, so is it failing?
+#H: nautilus &
+
+############################
+
+# experimental additions since still getting lots of weird isssues:
+#H: indicator-multiload &
+#H: gnome-keyring-daemon &
+#H: ibus-daemon &
+#H: zeitgeist-daemon &
+
+############################
+
+# these processes are just nice to have started already.
+#
+# you know you were going to want them.
+
+# password tools from kde.
+#H: kwalletd &
+
+############################
+
+# limbo of useless boneheads.
+#
+# these things just don't seem to work.
+
+# this never ever shows up.
+#x-terminal-emulator -geometry 100x32 -ls -title "$VNCDESKTOP Desktop" &
+
+############################
+
+# ------------------------------
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# dungeon of pain and suffering.
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# ------------------------------
+#
+# adding these in just makes things go splatfooey.
+
+# compiz causes xterm to no longer be a distinct window, which is how things were
+# originally before i started fixing them.
+#compiz &
+# maybe needed now though??
+
+############################
+
diff --git a/experiments/vnc/dot.vnc/xstartup.006 b/experiments/vnc/dot.vnc/xstartup.006
new file mode 100755
index 00000000..d8544fc2
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.006
@@ -0,0 +1,136 @@
+#!/bin/sh
+
+# set up gnome desktop environment for remote access via vnc.
+
+# this script depends on the gnome desktop.
+
+# references:
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+############################
+
+# boilerplate that people seem to mostly agree on.
+
+unset SESSION_MANAGER
+unset DBUS_SESSION_BUS_ADDRESS
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+xsetroot -solid darkgreen
+vncconfig -iconic &
+
+############################
+
+# the chaos zone. all of these are still being tested.
+
+#not helping
+#if [ -x /etc/X11/xinit/xinitrc ]; then
+# exec /etc/X11/xinit/xinitrc
+#fi
+#if [ -f /etc/X11/xinit/xinitrc ]; then
+# exec sh /etc/X11/xinit/xinitrc
+#fi
+
+
+
+# items marked with #H: below were on until recently.
+
+#######
+gnome-session --session=ubuntu &
+#valid values for session that we've seen:
+# ubuntu
+# gnome
+# 2d-gnome (?)
+# unity
+#######
+
+
+#... some new stuff that hopefully will help out.
+#/usr/lib/gnome-session/gnome-session-binary âsession=ubuntu &
+unity-panel-service &
+unity-settings-daemon &
+
+#seeing if indicator multiload does this:
+#for indicator in /usr/lib/x86_64-linux-gnu/indicator-*; do
+# basename=âbasename \${indicator}â
+# dirname=âdirname \${indicator}â
+# service=\${dirname}/\${basename}/\${basename}-service
+# \${service} &
+#done
+#unity
+
+
+#######
+# are these alternatives also?
+#x-session-manager &
+#x-window-manager &
+#######
+
+#H: gnome-terminal-server &
+
+# we don't see this running at home, but it sure seems needed on vmbuilder.
+#H: gnome-panel &
+
+# do we need this?
+#gnome-shell &
+
+#######
+# one or the other of the window managers here.
+#hmmm: but mutter doesn't work at all.
+#H: metacity &
+#mutter --replace &
+#######
+
+# this just brings up an initial file exploring window, although at one point i needed to
+# have nautilus running to see icons on the desktop.
+####right now there are no visible icons on the desktop, so is it failing?
+nautilus &
+
+############################
+
+# experimental additions since still getting lots of weird isssues:
+indicator-multiload &
+gnome-keyring-daemon &
+#H: ibus-daemon &
+#H: zeitgeist-daemon &
+
+############################
+
+# these processes are just nice to have started already.
+#
+# you know you were going to want them.
+
+# password tools from kde.
+kwalletd &
+
+############################
+
+# limbo of useless boneheads.
+#
+# these things just don't seem to work.
+
+# this never ever shows up.
+#x-terminal-emulator -geometry 100x32 -ls -title "$VNCDESKTOP Desktop" &
+
+# no longer exists?
+#gnome-settings-daemon &
+
+############################
+
+# ------------------------------
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# dungeon of pain and suffering.
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# ------------------------------
+#
+# adding these in just makes things go splatfooey.
+
+# compiz causes xterm to no longer be a distinct window, which is how things were
+# originally before i started fixing them.
+#compiz &
+# maybe needed now though??
+
+############################
+
diff --git a/experiments/vnc/dot.vnc/xstartup.007 b/experiments/vnc/dot.vnc/xstartup.007
new file mode 100755
index 00000000..c597b49b
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.007
@@ -0,0 +1,130 @@
+#!/bin/sh
+
+# set up gnome desktop environment for remote access via vnc.
+
+# this script depends on the gnome desktop.
+
+# references:
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+############################
+# items marked with #H: below were on until recently.
+############################
+
+# boilerplate that people seem to mostly agree on.
+
+unset SESSION_MANAGER
+unset DBUS_SESSION_BUS_ADDRESS
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+xsetroot -solid darkgreen
+vncconfig -iconic &
+
+############################
+
+# the chaos zone. all of these are still being tested.
+
+#not helping
+#if [ -x /etc/X11/xinit/xinitrc ]; then
+# exec /etc/X11/xinit/xinitrc
+#fi
+#if [ -f /etc/X11/xinit/xinitrc ]; then
+# exec sh /etc/X11/xinit/xinitrc
+#fi
+
+#######
+gnome-session --session=ubuntu &
+# valid values for session that we've seen: ubuntu, gnome, unity, 2d-gnome (?)
+#######
+
+#... some new stuff that hopefully will help out.
+#/usr/lib/gnome-session/gnome-session-binary âsession=ubuntu &
+unity-panel-service &
+unity-settings-daemon &
+
+#seeing if indicator multiload does this:
+#for indicator in /usr/lib/x86_64-linux-gnu/indicator-*; do
+# basename=âbasename \${indicator}â
+# dirname=âdirname \${indicator}â
+# service=\${dirname}/\${basename}/\${basename}-service
+# \${service} &
+#done
+#unity
+
+
+#######
+# are these alternatives also?
+x-session-manager &
+#x-window-manager &
+#######
+
+# we don't see this running at home, but it sure seems needed on vmbuilder.
+#H: gnome-panel &
+
+# do we need this?
+gnome-shell &
+
+#######
+# one or the other of the window managers here.
+#hmmm: but mutter doesn't work at all.
+#H: metacity &
+#mutter --replace &
+#######
+
+# this just brings up an initial file exploring window, although at one point i needed to
+# have nautilus running to see icons on the desktop.
+####right now there are no visible icons on the desktop, so is it failing?
+nautilus &
+
+############################
+
+# experimental additions since still getting lots of weird isssues:
+indicator-multiload &
+gnome-keyring-daemon &
+#H: ibus-daemon &
+#H: zeitgeist-daemon &
+
+############################
+
+# these processes are just nice to have started already.
+#
+# you know you were going to want them.
+
+# password tools from kde.
+kwalletd &
+
+############################
+
+# limbo of useless boneheads.
+#
+# these things just don't seem to work.
+
+# this never ever shows up.
+#x-terminal-emulator -geometry 100x32 -ls -title "$VNCDESKTOP Desktop" &
+
+# no longer exists?
+#gnome-settings-daemon &
+
+#doesn't seem to help.
+#gnome-terminal-server &
+
+############################
+
+# ------------------------------
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# dungeon of pain and suffering.
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# ------------------------------
+#
+# adding these in just makes things go splatfooey.
+
+# compiz causes xterm to no longer be a distinct window, which is how things were
+# originally before i started fixing them.
+#compiz &
+# maybe needed now though??
+
+############################
+
diff --git a/experiments/vnc/dot.vnc/xstartup.008 b/experiments/vnc/dot.vnc/xstartup.008
new file mode 100755
index 00000000..a6d4d261
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.008
@@ -0,0 +1,140 @@
+#!/bin/sh
+
+# set up gnome desktop environment for remote access via vnc.
+
+# this script depends on the gnome desktop. to install the minimal
+# parts of gnome needed (as far as i know), run this command:
+# sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
+
+# references:
+# best? https://askubuntu.com/questions/475023/how-to-make-vnc-server-work-with-ubuntu-desktop-without-xfce
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+############################
+# items marked with #H: below were on until recently.
+############################
+
+# boilerplate that people seem to mostly agree on.
+
+unset SESSION_MANAGER
+unset DBUS_SESSION_BUS_ADDRESS
+export XKL_XMODMAP_DISABLE=1
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+xsetroot -solid darkgreen
+vncconfig -iconic &
+
+############################
+
+# the chaos zone. all of these are still being tested.
+
+# solid leads are building this chunk.
+/usr/bin/gnome-panel &
+/usr/lib/gnome-settings-daemon &
+
+
+
+#######
+gnome-session --session=ubuntu &
+# valid values for session that we've seen: ubuntu, gnome, unity, 2d-gnome (?)
+#######
+
+#... some new stuff that hopefully will help out.
+#/usr/lib/gnome-session/gnome-session-binary âsession=ubuntu &
+#unity-panel-service &
+#unity-settings-daemon &
+
+#seeing if indicator multiload does this:
+#for indicator in /usr/lib/x86_64-linux-gnu/indicator-*; do
+# basename=âbasename \${indicator}â
+# dirname=âdirname \${indicator}â
+# service=\${dirname}/\${basename}/\${basename}-service
+# \${service} &
+#done
+#unity
+
+
+#######
+# are these alternatives also?
+x-session-manager &
+#x-window-manager &
+#######
+
+
+# do we need this?
+gnome-shell &
+
+#######
+# one or the other of the window managers here.
+#hmmm: but mutter doesn't work at all.
+#H: metacity &
+#mutter --replace &
+#######
+
+# this just brings up an initial file exploring window, although at one point i needed to
+# have nautilus running to see icons on the desktop.
+####right now there are no visible icons on the desktop, so is it failing?
+nautilus &
+
+############################
+
+# experimental additions since still getting lots of weird isssues:
+indicator-multiload &
+gnome-keyring-daemon &
+#H: ibus-daemon &
+#H: zeitgeist-daemon &
+
+############################
+
+# these processes are just nice to have started already.
+#
+# you know you were going to want them.
+
+# password tools from kde.
+kwalletd &
+
+############################
+
+# limbo of useless boneheads.
+#
+# these things just don't seem to work.
+
+# this never ever shows up.
+#x-terminal-emulator -geometry 100x32 -ls -title "$VNCDESKTOP Desktop" &
+
+#doesn't seem to help.
+#gnome-terminal-server &
+
+#not helping
+#if [ -x /etc/X11/xinit/xinitrc ]; then
+# exec /etc/X11/xinit/xinitrc
+#fi
+#if [ -f /etc/X11/xinit/xinitrc ]; then
+# exec sh /etc/X11/xinit/xinitrc
+#fi
+
+############################
+
+# ------------------------------
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# dungeon of pain and suffering.
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# ------------------------------
+#
+# adding these in just makes things go splatfooey.
+
+#trying something wacky; minimalist as heck...
+#and it doesn't work at all. of course.
+#startx&
+#exit 0
+
+# compiz causes xterm to no longer be a distinct window, which is how things were
+# originally before i started fixing them.
+#compiz &
+# maybe needed now though??
+
+############################
+
diff --git a/experiments/vnc/dot.vnc/xstartup.009 b/experiments/vnc/dot.vnc/xstartup.009
new file mode 100755
index 00000000..1eb6fd4c
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.009
@@ -0,0 +1,144 @@
+#!/bin/sh
+
+# set up gnome desktop environment for remote access via vnc.
+
+# this script depends on the gnome desktop. to install the minimal
+# parts of gnome needed (as far as i know), run this command:
+# sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal kwalletmanager
+
+# references:
+# best? https://askubuntu.com/questions/475023/how-to-make-vnc-server-work-with-ubuntu-desktop-without-xfce
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+############################
+
+# boilerplate that people seem to mostly agree on.
+
+unset SESSION_MANAGER
+unset DBUS_SESSION_BUS_ADDRESS
+export XKL_XMODMAP_DISABLE=1
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+xsetroot -solid darkgreen
+vncconfig -iconic &
+
+############################
+
+# the chaos zone. all of these are still being tested.
+
+# solid leads are building this chunk.
+/usr/bin/gnome-panel &
+/usr/lib/gnome-settings-daemon &
+/usr/bin/metacity &
+/usr/bin/nautilus &
+/usr/bin/gnome-terminal &
+
+# password tools from kde.
+kwalletd &
+
+
+#######
+#gnome-session --session=ubuntu &
+# valid values for session that we've seen: ubuntu, gnome, unity, 2d-gnome (?)
+#######
+
+#... some new stuff that hopefully will help out.
+#/usr/lib/gnome-session/gnome-session-binary âsession=ubuntu &
+#unity-panel-service &
+#unity-settings-daemon &
+
+#seeing if indicator multiload does this:
+#for indicator in /usr/lib/x86_64-linux-gnu/indicator-*; do
+# basename=âbasename \${indicator}â
+# dirname=âdirname \${indicator}â
+# service=\${dirname}/\${basename}/\${basename}-service
+# \${service} &
+#done
+#unity
+
+
+#######
+# are these alternatives also?
+#x-session-manager &
+#x-window-manager &
+#######
+
+
+# do we need this?
+#gnome-shell &
+
+
+# this just brings up an initial file exploring window, although at one point i needed to
+# have nautilus running to see icons on the desktop.
+####right now there are no visible icons on the desktop, so is it failing?
+#nautilus &
+
+############################
+
+# experimental additions since still getting lots of weird isssues:
+#indicator-multiload &
+#gnome-keyring-daemon &
+#H: ibus-daemon &
+#H: zeitgeist-daemon &
+
+############################
+
+# these processes are just nice to have started already.
+#
+# you know you were going to want them.
+
+# password tools from kde.
+#kwalletd &
+
+############################
+
+# limbo of useless boneheads and configs in training.
+#
+# these things just don't seem to work.
+
+# this never ever shows up.
+#x-terminal-emulator -geometry 100x32 -ls -title "$VNCDESKTOP Desktop" &
+
+#doesn't seem to help.
+#gnome-terminal-server &
+
+#not helping
+#if [ -x /etc/X11/xinit/xinitrc ]; then
+# exec /etc/X11/xinit/xinitrc
+#fi
+#if [ -f /etc/X11/xinit/xinitrc ]; then
+# exec sh /etc/X11/xinit/xinitrc
+#fi
+
+#######
+# one or the other of the window managers here.
+#hmmm: but mutter doesn't work at all.
+#H: metacity &
+#mutter --replace &
+#######
+
+############################
+
+# ------------------------------
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# dungeon of pain and suffering.
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# ------------------------------
+#
+# adding these in just makes things go splatfooey.
+
+#trying something wacky; minimalist as heck...
+#and it doesn't work at all. of course.
+#startx&
+#exit 0
+
+# compiz causes xterm to no longer be a distinct window, which is how things were
+# originally before i started fixing them.
+#compiz &
+# maybe needed now though??
+
+############################
+
diff --git a/experiments/vnc/dot.vnc/xstartup.010 b/experiments/vnc/dot.vnc/xstartup.010
new file mode 100755
index 00000000..6330427c
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.010
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# set up gnome desktop environment for remote access via vnc.
+
+# this script depends on the gnome desktop. to install the minimal
+# parts of gnome needed (as far as i know), run this command:
+# sudo apt-get install gnome-panel gnome-settings-daemon gnome-terminal kwalletmanager metacity nautilus
+
+# references:
+#
+# best leads: https://askubuntu.com/questions/475023/how-to-make-vnc-server-work-with-ubuntu-desktop-without-xfce
+#
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+############################
+
+# reset some variables that could be a problem.
+
+unset SESSION_MANAGER
+unset DBUS_SESSION_BUS_ADDRESS
+export XKL_XMODMAP_DISABLE=1
+
+############################
+
+# load some extra configuration files if they exist.
+
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+
+############################
+
+# set background to solid color; avoids using bandwidth to transfer pictures.
+xsetroot -solid darkgreen
+#this does what again?
+vncconfig -iconic &
+
+############################
+
+# solid leads (from the best article above) got us this working
+# and pretty minimal set of apps to run.
+
+/usr/bin/gnome-panel &
+/usr/lib/gnome-settings-daemon &
+/usr/bin/metacity &
+/usr/bin/nautilus &
+/usr/bin/gnome-terminal &
+
+############################
+
+# password tools from kde.
+kwalletd &
+
+############################
+
+# ------------------------------
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# dungeon of pain and suffering.
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# ------------------------------
+
+# all content has been deleted from the config dungeon. the damaged configs
+# have been set free to roam in their natural environment of the internet.
+
diff --git a/experiments/vnc/dot.vnc/xstartup.011 b/experiments/vnc/dot.vnc/xstartup.011
new file mode 100755
index 00000000..8dc54aae
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.011
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# set up gnome desktop environment for remote access via vnc.
+
+# this script depends on the gnome desktop. to install the minimal
+# parts of gnome needed (as far as i know), run this command:
+# sudo apt-get install gnome-panel gnome-settings-daemon gnome-terminal kwalletmanager metacity nautilus
+
+# references:
+#
+# best leads: https://askubuntu.com/questions/475023/how-to-make-vnc-server-work-with-ubuntu-desktop-without-xfce
+#
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+############################
+
+# reset some variables that could be a problem.
+
+unset SESSION_MANAGER
+unset DBUS_SESSION_BUS_ADDRESS
+export XKL_XMODMAP_DISABLE=1
+
+############################
+
+# load some extra configuration files if they exist.
+
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+
+############################
+
+# set background to solid color; avoids using bandwidth to transfer pictures.
+xsetroot -solid darkgreen
+#this does what again?
+vncconfig -iconic &
+
+############################
+
+# solid leads (from the best article above) got us this working
+# and pretty minimal set of apps to run.
+
+/usr/bin/gnome-panel &
+/usr/lib/gnome-settings-daemon &
+/usr/bin/metacity &
+/usr/bin/nautilus &
+/usr/bin/gnome-terminal &
+
+############################
+
+# ------------------------------
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# dungeon of pain and suffering.
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# ------------------------------
+
+# all content has been deleted from the config dungeon. the damaged configs
+# have been set free to roam in their natural environment of the internet.
+
diff --git a/experiments/vnc/dot.vnc/xstartup.012 b/experiments/vnc/dot.vnc/xstartup.012
new file mode 100755
index 00000000..7e5fc79b
--- /dev/null
+++ b/experiments/vnc/dot.vnc/xstartup.012
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# set up gnome desktop environment for remote access via vnc.
+
+# NOTE: it is important to be running the vncserver as a user who is NOT
+# already running x windowing system. otherwise, weird and possibly
+# bad things can happen, e.g. your apps show up on display zero
+# rather than on the vnc desktop.
+
+# this script depends on the gnome desktop. to install the minimal
+# parts of gnome needed (as far as i know), run this command:
+#
+# sudo apt-get install gnome-panel gnome-settings-daemon gnome-terminal kwalletmanager metacity nautilus
+
+# references:
+#
+# best leads: https://askubuntu.com/questions/475023/how-to-make-vnc-server-work-with-ubuntu-desktop-without-xfce
+#
+# https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
+# https://www.digitalocean.com/community/questions/how-to-install-ubuntu-desktop-and-vnc
+# https://ubuntuforums.org/showthread.php?t=1903220
+# https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
+
+############################
+
+# reset some variables that could be a problem.
+
+unset SESSION_MANAGER
+unset DBUS_SESSION_BUS_ADDRESS
+export XKL_XMODMAP_DISABLE=1
+
+############################
+
+# load some extra configuration files if they exist.
+
+[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+
+############################
+
+# set background to solid color; avoids using bandwidth to transfer pictures.
+xsetroot -solid darkgreen
+#this does what again?
+vncconfig -iconic &
+
+############################
+
+# solid leads from the "best" article above gave us the workable, minimal set
+# of x window apps below.
+/usr/bin/gnome-panel &
+/usr/lib/gnome-settings-daemon &
+/usr/bin/metacity &
+/usr/bin/nautilus &
+/usr/bin/gnome-terminal &
+
+############################
+
+# ------------------------------
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# dungeon of pain and suffering.
+# "&@}*(@^!$)_-{%:~`|#=;" !!!!
+# ------------------------------
+
+# all content has been deleted from the config dungeon. the damaged configs
+# have been set free to roam in their natural environment of the internet.
+
diff --git a/experiments/vnc/init.d/vncserver.001 b/experiments/vnc/init.d/vncserver.001
new file mode 100755
index 00000000..2b6e6dd2
--- /dev/null
+++ b/experiments/vnc/init.d/vncserver.001
@@ -0,0 +1,27 @@
+#!/bin/bash
+PATH="$PATH:/usr/bin/"
+export USER="fred"
+DISPLAY="1"
+DEPTH="16"
+GEOMETRY="1024x768"
+OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
+. /lib/lsb/init-functions
+
+case "$1" in
+start)
+log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
+;;
+
+stop)
+log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
+;;
+
+restart)
+$0 stop
+$0 start
+;;
+esac
+exit 0
+
diff --git a/experiments/vnc/init.d/vncserver.002 b/experiments/vnc/init.d/vncserver.002
new file mode 100755
index 00000000..73bdec08
--- /dev/null
+++ b/experiments/vnc/init.d/vncserver.002
@@ -0,0 +1,27 @@
+#!/bin/bash
+PATH="$PATH:/usr/bin/"
+export USER="fred"
+DISPLAY="1"
+DEPTH="16"
+GEOMETRY="1200x800"
+OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
+. /lib/lsb/init-functions
+
+case "$1" in
+start)
+log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
+;;
+
+stop)
+log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
+;;
+
+restart)
+$0 stop
+$0 start
+;;
+esac
+exit 0
+
diff --git a/experiments/vnc/init.d/vncserver.003 b/experiments/vnc/init.d/vncserver.003
new file mode 100755
index 00000000..73bdec08
--- /dev/null
+++ b/experiments/vnc/init.d/vncserver.003
@@ -0,0 +1,27 @@
+#!/bin/bash
+PATH="$PATH:/usr/bin/"
+export USER="fred"
+DISPLAY="1"
+DEPTH="16"
+GEOMETRY="1200x800"
+OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
+. /lib/lsb/init-functions
+
+case "$1" in
+start)
+log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
+;;
+
+stop)
+log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
+;;
+
+restart)
+$0 stop
+$0 start
+;;
+esac
+exit 0
+
diff --git a/experiments/vnc/init.d/vncserver.004 b/experiments/vnc/init.d/vncserver.004
new file mode 100755
index 00000000..9e95549c
--- /dev/null
+++ b/experiments/vnc/init.d/vncserver.004
@@ -0,0 +1,28 @@
+#!/bin/bash
+PATH="$PATH:/usr/bin/"
+export USER="fred"
+DISPLAY="1"
+DEPTH="16"
+GEOMETRY="1200x800"
+XAUTHORITY="/home/$USER/.Xauthority.vnc"
+OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
+. /lib/lsb/init-functions
+
+case "$1" in
+start)
+log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
+;;
+
+stop)
+log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
+;;
+
+restart)
+$0 stop
+$0 start
+;;
+esac
+exit 0
+
diff --git a/experiments/vnc/init.d/vncserver.005 b/experiments/vnc/init.d/vncserver.005
new file mode 100755
index 00000000..5cf5e2bd
--- /dev/null
+++ b/experiments/vnc/init.d/vncserver.005
@@ -0,0 +1,30 @@
+#!/bin/bash
+PATH="$PATH:/usr/bin/"
+export USER="fredhuff"
+# fredhuff is a different user than my normal user who is logged in on
+# desktop zero. this is important for display isolation.
+DISPLAY="1"
+DEPTH="16"
+GEOMETRY="1200x800"
+XAUTHORITY="/home/$USER/.Xauthority.vnc"
+OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
+. /lib/lsb/init-functions
+
+case "$1" in
+start)
+log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
+;;
+
+stop)
+log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
+su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
+;;
+
+restart)
+$0 stop
+$0 start
+;;
+esac
+exit 0
+
diff --git a/feisty_inits/dot.bashrc-normal-user b/feisty_inits/dot.bashrc-normal-user
deleted file mode 100644
index 74a77747..00000000
--- a/feisty_inits/dot.bashrc-normal-user
+++ /dev/null
@@ -1,36 +0,0 @@
-
-# example ~/.bashrc: this code initializes the feisty meow environment
-# for "normal" users (not intended for the root user).
-
-##############
-
-# drag in the default version of this file. this may not be needed if your
-# .bashrc script already has substantial code or already does this.
-source /etc/bash.bashrc
-
-##############
-
-# set the history sizes to be much larger, and do this whether we load the
-# feisty meow environment or not.
-
-export HISTSIZE=1000000
-export HISTFILESIZE=8000000
-
-##############
-
-# change this to your name...
-export NAME='Frunkooleon Q. GrendervaspPleaseChangeThis'
-
-##############
-
-# sets up the feisty_meow scripts if appropriate for the environment.
-if [ "${TERM}" != "dumb" -a -z "$PBS_ENVIRONMENT" ]; then
- source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh
-
- # if not commented out, then feisty meow will run all the unit tests during builds.
- #export RUN_ALL_TESTS=true
-
-fi
-
-##############
-
diff --git a/feisty_inits/dot.bashrc-root b/feisty_inits/dot.bashrc-root
deleted file mode 100644
index 205e6a13..00000000
--- a/feisty_inits/dot.bashrc-root
+++ /dev/null
@@ -1,30 +0,0 @@
-
-# example ~/.bashrc: this code provides a macro to initialize the
-# feisty meow environment for the "root" user.
-
-##############
-
-# drag in the default version of this file. this may not be needed if your
-# .bashrc script already has substantial code or already does this.
-source /etc/bash.bashrc
-
-##############
-
-# set the history sizes to be much larger, and do this whether we load the
-# feisty meow environment or not.
-
-export HISTSIZE=1000000
-export HISTFILESIZE=8000000
-
-##############
-
-# change this to your name...
-export NAME='Frunkooleon Q. GrendervaspPleaseChangeThis'
-
-##############
-
-# the "fredme" macro enables the feisty_meow environment.
-alias fredme='source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh'
-
-##############
-
diff --git a/feisty_inits/dot.bashrc-windows-user b/feisty_inits/dot.bashrc-windows-user
deleted file mode 100644
index 6a652f78..00000000
--- a/feisty_inits/dot.bashrc-windows-user
+++ /dev/null
@@ -1,13 +0,0 @@
-
-# some example path additions to make windoze less awful.
-# they depend on msys style paths, but can work under cygwin if you do:
-# ln -s /cygdrive/c /c; ln -s /cygdrive/d /d; and so on.
-# this is just an example because your installation paths are almost certainly
-# different.
-export PATH=/bin:$PATH:/d/utilities/emacs-23.2/bin:/d/utilities/vim/vim71:/d/system/perl/site/bin:/d/system/perl/bin:/d/tools/doxygen/bin:/d/tools/graphviz/Graphviz/bin
-
-if [ "${TERM}" != "dumb" -a -z "$PBS_ENVIRONMENT" ]; then
- # windows startup of the feisty meow script environment.
- source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh
-fi
-
diff --git a/graphiq/.settings/language.settings.xml b/graphiq/.settings/language.settings.xml
index 222349d9..15187192 100644
--- a/graphiq/.settings/language.settings.xml
+++ b/graphiq/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
diff --git a/graphiq/library/user_interface/menu_base.cpp b/graphiq/library/user_interface/menu_base.cpp
index 38c9aab5..3c657c8d 100644
--- a/graphiq/library/user_interface/menu_base.cpp
+++ b/graphiq/library/user_interface/menu_base.cpp
@@ -117,7 +117,7 @@ void menu_base::add_item(menu_item *to_invoke)
menu_item *menu_base::get_item(int index)
{
- bounds_return(index, 0, _items->elements(), NIL);
+ bounds_return(index, 0, _items->elements(), NULL_POINTER);
return dynamic_cast(_items->borrow(index));
}
@@ -145,7 +145,7 @@ void menu_base::add_submenu(menu_base *sub)
menu_base *menu_base::get_submenu(int index)
{
- bounds_return(index, 0, _menus->elements(), NIL);
+ bounds_return(index, 0, _menus->elements(), NULL_POINTER);
return dynamic_cast(_menus->borrow(index));
}
@@ -167,7 +167,7 @@ menu_common_base *menu_base::evaluate_trigger(char trigger)
{
//hmmm: implement this too....
if (!trigger){}
-return NIL;
+return NULL_POINTER;
}
void menu_base::activate()
diff --git a/graphiq/library/user_interface/menu_base.h b/graphiq/library/user_interface/menu_base.h
index 57ecc156..802e541d 100644
--- a/graphiq/library/user_interface/menu_base.h
+++ b/graphiq/library/user_interface/menu_base.h
@@ -107,7 +107,7 @@ public:
menu_common_base *evaluate_trigger(char trigger);
//!< returns the item or menu associated with the "trigger" value.
- /*!< use of dynamic cast enables one to tell what has been returned. NIL
+ /*!< use of dynamic cast enables one to tell what has been returned. NULL_POINTER
is returned if there is nothing that answers to that trigger value.
note that this does not invoke any activation functions. */
@@ -131,7 +131,7 @@ public:
void add_item(menu_item *to_invoke);
//!< adds a new menu_item onto this menu.
menu_item *get_item(int index);
- //!< gets the item at position "index". NIL is returned if out of range.
+ //!< gets the item at position "index". NULL_POINTER is returned if out of range.
bool zap_item(int index);
//!< removes the item at "index" if possible.
bool enable_item(int index, bool enable = true);
diff --git a/huffware/readme.txt b/huffware/readme.txt
index 130938de..2f298202 100644
--- a/huffware/readme.txt
+++ b/huffware/readme.txt
@@ -1,4 +1,5 @@
+########
This folder is in active development, but it is intended to hold all of the
LSL (linden scripting language) free and open source assets from our
@@ -19,3 +20,6 @@ huffotronic update server and client scripts to work properly.
Also note that these products are currently licensed according to this file:
"licenses/license--free_in_osgrid_and_personal_opensims_only_v1.9.txt"
+########
+
+
diff --git a/hypermedia/javascript/readme.txt b/hypermedia/javascript/readme.txt
new file mode 100644
index 00000000..072fc868
--- /dev/null
+++ b/hypermedia/javascript/readme.txt
@@ -0,0 +1,7 @@
+
+
+this folder is way out of date.
+
+more interesting javascripts should be on their way soon.
+
+
diff --git a/infobase/configuration/cron/aa_cron_defaults.crontab b/infobase/configuration/cron/aa_cron_defaults.crontab
new file mode 100644
index 00000000..51a73ff4
--- /dev/null
+++ b/infobase/configuration/cron/aa_cron_defaults.crontab
@@ -0,0 +1,72 @@
+
+#[aa cron defaults]
+#
+# cron default bits to add at top of crontab...
+# by fred t. hamster, GNU GPL v3 license.
+
+# every one of the crontab examples in feisty meow depends on the the stanzas
+# below. (unfortunately there is no way to include cron files in other cron
+# files, so the functional parts here should just be pasted directly into the
+# user's crontab at the top.)
+
+# set a user name for writing unique log files. this is important because
+# cron doesn't have the normal variable 'USER' defined. cron does define
+# HOME, which is pretty lucky for us...
+# please change the name to the user running the cronjob, or to whatever
+# unique string you'd like to use:
+CRONUSER=FILL-CRONUSER-HERE
+
+# set the shell to bash. (not the default for some cron implementations.)
+SHELL=/bin/bash
+
+# set the top-level folder for feisty meow here; important because cron gets
+# almost nothing from the user's environment. this folder needs to be updated
+# for your own particular install location.
+FEISTY_MEOW_APEX=/opt/feistymeow.org/feisty_meow
+#FEISTY_MEOW_APEX=$HOME/feisty_meow
+
+# crontab miniature docs:
+#
+# below is the short form key to the crontab positional entries for times:
+# m h dom mon dow command
+#
+# below is a longer form that spells out the meaning of each position:
+# minute(s) hour(s) dayOfMonth(s) month(s) dayOfWeek(s) command
+#
+# each field is optionally plural because cron allows each of the positions to
+# indicate multiple values. generally it is simpler and sufficient to have a
+# single value in the field, but there are also good reasons that some tasks
+# would have a more complicated formula (such as, "every couple of days" rather
+# than "every day").
+#
+# the wildcard '*' indicates that every valid value is okay for that field.
+# the wildcard form of a crontab line is this: "* * * * * command"
+# that "command" will execute every single minute.
+
+# the guts of the crontab would follow below. this usually is a set of valid
+# crontab lines that spell the time or times for commands to be executed. my
+# crontabs usually have from 3 to 8 entries because i tend to atomicize the
+# tasks, rather than writing big complicated multi-purpose scripts. not saying
+# that's always better, it's just how i roll (my crontabs)...
+#
+# also, it is fine to have a really long command with multiple sub-commands;
+# just put it inside parentheses to group a bunch of commands together. there
+# are many examples of doing this in the other crontab examples in this folder.
+#
+# further, it's often important to send the output from the cron job to an
+# output location. doing this keeps cron from sending you a lot of emails
+# with cron job output on some systems. you can use the normal output
+# redirection operators to do this (e.g. '>', '2>', '&>', '>>' and '&>>').
+# /dev/null works as an output target if you don't ever want to see the
+# results from your cron jobs. i usually prefer to write log files in the
+# /tmp directory with the ${CRONUSER} variable added in the file name.
+# below is a live example which we almost always include, so it's embedded
+# here for convenience.
+
+#[nechung fortune]
+# runs every minute and recreates a fortune for thunderbird signature.
+# a lot of the detail below is to get the feisty meow environment loaded for
+# the new_sig command.
+* * * * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; perl $FEISTY_MEOW_SCRIPTS/text/new_sig.pl) &>>/tmp/${CRONUSER}-cron-nechung_fortune.log
+
+
diff --git a/infobase/configuration/cron/acroread_cleaner.crontab b/infobase/configuration/cron/acroread_cleaner.crontab
deleted file mode 100644
index 0a543cf2..00000000
--- a/infobase/configuration/cron/acroread_cleaner.crontab
+++ /dev/null
@@ -1,8 +0,0 @@
-
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-#[acroread cleaner]
-* * * * * /bin/rm -f $HOME'/C:\nppdf32Log\debuglog.txt'
-
diff --git a/infobase/configuration/cron/backup_all_mysql_databases.crontab b/infobase/configuration/cron/backup_all_mysql_databases.crontab
deleted file mode 100644
index 662c2175..00000000
--- a/infobase/configuration/cron/backup_all_mysql_databases.crontab
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
-#[backup all mysql databases]
-# backs up our databases on a weekly basis.
-28 4 * * 2 (source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; mysqldump -u root '-pPASSWORD' --all-databases | gzip > /z/stuffing/archives/database_backup_$(hostname)_$(date_stringer).sql.gz) &>/tmp/database_backup_${USER}.log
-
-
diff --git a/infobase/configuration/cron/backup_git_account.crontab b/infobase/configuration/cron/backup_git_account.crontab
new file mode 100644
index 00000000..a08e239a
--- /dev/null
+++ b/infobase/configuration/cron/backup_git_account.crontab
@@ -0,0 +1,5 @@
+
+#[backup git account]
+# archives the whole ~git folder with all account databases into a compressed tar file.
+34 20 * * 5 tar -czf /z/stuffing/archives/git_archive_$(date +"\%Y_\%m_\%d_\%H\%M_\%S" | tr -d '/\n/').tar.gz /home/git &>>/tmp/${CRONUSER}-cron-backup_git_account.log
+
diff --git a/infobase/configuration/cron/backup_maildir.crontab b/infobase/configuration/cron/backup_maildir.crontab
index 259511f0..5e9e501d 100644
--- a/infobase/configuration/cron/backup_maildir.crontab
+++ b/infobase/configuration/cron/backup_maildir.crontab
@@ -1,13 +1,5 @@
-
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
#[backup maildir]
-# backs up the maildir folder for fred monthly
-* * 1 * * (source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; tar -czf /z/stuffing/archives/maildir_backup_$(date_stringer).tar.gz $HOME/Maildir) &>/tmp/maildir_backup_${USER}.log
-
+# backs up the maildir folder for fred bi-monthly.
+8 4 3,14 * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; tar -czf /z/stuffing/archives/maildir_backup_$(date_stringer).tar.gz $HOME/Maildir) &>/tmp/${CRONUSER}-cron-backup_maildir.log
diff --git a/infobase/configuration/cron/backup_mailman.crontab b/infobase/configuration/cron/backup_mailman.crontab
new file mode 100644
index 00000000..4eade1b1
--- /dev/null
+++ b/infobase/configuration/cron/backup_mailman.crontab
@@ -0,0 +1,6 @@
+
+#[backup_mailman_archives]
+# creates a monthly backup of all the mailman list server's archives.
+14 2 28 * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; tar -czf /z/stuffing/archives/mailman_backup_$(hostname)_$(date_stringer).tar.gz /var/lib/mailman ) &>/tmp/${CRONUSER}-cron-mailman_backup.log
+
+
diff --git a/infobase/configuration/cron/backup_mysql_databases.crontab b/infobase/configuration/cron/backup_mysql_databases.crontab
new file mode 100644
index 00000000..4f9c3b10
--- /dev/null
+++ b/infobase/configuration/cron/backup_mysql_databases.crontab
@@ -0,0 +1,5 @@
+
+#[backup mysql databases]
+# backs up all of our mysql databases on a weekly basis.
+28 4 * * 2 (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; mysqldump -u root '-pPASSWORD' --all-databases | gzip > /z/stuffing/archives/database_backup_$(hostname)_$(date_stringer).sql.gz) &>>/tmp/${CRONUSER}-cron-backup_mysql_databases.log
+
diff --git a/infobase/configuration/cron/backup_photo_albums.crontab b/infobase/configuration/cron/backup_photo_albums.crontab
index 51e80c88..8a51b931 100644
--- a/infobase/configuration/cron/backup_photo_albums.crontab
+++ b/infobase/configuration/cron/backup_photo_albums.crontab
@@ -1,6 +1,5 @@
#[backup photo albums]
# back up the pictures in coppermine gallery every month.
-34 6 4 * * (source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; tar -czf /z/stuffing/archives/photo_albums_backup_$(date_stringer).tar.gz /home/albums ; refred) &>/tmp/albums_backup_${USER}.log
-
+34 6 4 * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; tar -czf /z/stuffing/archives/photo_albums_backup_$(date_stringer).tar.gz /home/albums ; refred) &>>/tmp/${CRONUSER}-cron-backup_photo_albums.log
diff --git a/infobase/configuration/cron/backup_serene_system.crontab b/infobase/configuration/cron/backup_serene_system.crontab
new file mode 100644
index 00000000..7742731d
--- /dev/null
+++ b/infobase/configuration/cron/backup_serene_system.crontab
@@ -0,0 +1,5 @@
+
+#[backup serene system]
+# backs up config files and important parts of home directories to off-machine storage.
+14 2 * * */7 (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; bash $FEISTY_MEOW_SCRIPTS/archival/serene_backer_upper.sh) &>>/tmp/${CRONUSER}-cron-backup_serene_system.log
+
diff --git a/infobase/configuration/cron/backup_trac.crontab b/infobase/configuration/cron/backup_trac.crontab
index 0b8fcc01..8fcd8b24 100644
--- a/infobase/configuration/cron/backup_trac.crontab
+++ b/infobase/configuration/cron/backup_trac.crontab
@@ -1,9 +1,5 @@
-
#[backup trac]
# backs up trac every week.
-28 7 * * 2 bash $HOME/feisty_meow/scripts/archival/backup_trac.sh /home/trac /z/stuffing/archives
-
-
-
+28 7 * * 2 bash $FEISTY_MEOW_APEX/scripts/archival/backup_trac.sh /home/trac /z/stuffing/archives &>>/tmp/${CRONUSER}-cron-backup_trac.log
diff --git a/infobase/configuration/cron/bookmarks_builder.crontab b/infobase/configuration/cron/bookmarks_builder.crontab
index ddae6716..29f4fde3 100644
--- a/infobase/configuration/cron/bookmarks_builder.crontab
+++ b/infobase/configuration/cron/bookmarks_builder.crontab
@@ -1,12 +1,5 @@
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
#[bookmarks builder]
# regenerate the bookmarks pages.
-24 10 * * * (source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; bash $HOME/feisty_meow/scripts/bookmarks/create_marks.sh ) &>>/tmp/zz_bookmarkingering_$USER.log
-
+24 10 * * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; bash $FEISTY_MEOW_SCRIPTS/bookmarks/create_marks.sh ) &>>/tmp/${CRONUSER}-cron-bookmarks_builder.log
diff --git a/infobase/configuration/cron/chkrootkit.crontab b/infobase/configuration/cron/chkrootkit.crontab
index 1bd47407..1087ce00 100644
--- a/infobase/configuration/cron/chkrootkit.crontab
+++ b/infobase/configuration/cron/chkrootkit.crontab
@@ -1,11 +1,7 @@
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
#[chkrootkit]
# this runs chkrootkit to demonstrate a bug in the vm kernel currently
# provided by...? hmmm: who's the vendor?
-3 * * * * (/usr/sbin/chkrootkit -q &>/var/www/rootkit_report_quiet.txt )
-4 * * * * (/usr/sbin/chkrootkit -x &>/var/www/rootkit_report_expert.txt )
+3 * * * * (/usr/sbin/chkrootkit -q &>/var/www/rootkit_report_quiet.txt ) &>>/tmp/${CRONUSER}-cron-chkrootkit.log
+4 * * * * (/usr/sbin/chkrootkit -x &>/var/www/rootkit_report_expert.txt ) &>>/tmp/${CRONUSER}-cron-chkrootkit.log
diff --git a/infobase/configuration/cron/doxygen.crontab b/infobase/configuration/cron/doxygen.crontab
index 48016ecc..035ee8e6 100644
--- a/infobase/configuration/cron/doxygen.crontab
+++ b/infobase/configuration/cron/doxygen.crontab
@@ -1,12 +1,6 @@
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
-# this is out of date!
-
#[doxygen]
-20 4 * * * (source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; cd $HOME/hoople/docs; make) &>>/tmp/zz_doxy_make_$USER.log
+# update the feisty meow documentation once on each of tuesday, thursday and saturday.
+20 4 * * 2,4,6 (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; cd $FEISTY_MEOW_APEX/documentation; make) &>>/tmp/${CRONUSER}-cron-doxygen.log
+
diff --git a/infobase/configuration/cron/emit_crontab.crontab b/infobase/configuration/cron/emit_crontab.crontab
new file mode 100644
index 00000000..152dd4b0
--- /dev/null
+++ b/infobase/configuration/cron/emit_crontab.crontab
@@ -0,0 +1,5 @@
+
+#[emit crontab]
+# meta-operation to backup the crontab file using cron itself.
+28 */8 * * * crontab -l >$HOME/$(hostname).$CRONUSER.crontab
+
diff --git a/infobase/configuration/cron/git_account_backup.crontab b/infobase/configuration/cron/git_account_backup.crontab
deleted file mode 100644
index d57e65f6..00000000
--- a/infobase/configuration/cron/git_account_backup.crontab
+++ /dev/null
@@ -1,11 +0,0 @@
-
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
-#[git account backup]
-# archives the whole ~git folder with all account databases into a compressed tar file.
-34 20 * * 5 tar -czf /z/stuffing/archives/git_archive_$(date +"\%Y_\%m_\%d_\%H\%M_\%S" | tr -d '/\n/').tar.gz /home/git >/home/git/archiving_log.txt
-
diff --git a/infobase/configuration/cron/letsencrypt_renewal.crontab b/infobase/configuration/cron/letsencrypt_renewal.crontab
index 6494aa4f..4a343de0 100644
--- a/infobase/configuration/cron/letsencrypt_renewal.crontab
+++ b/infobase/configuration/cron/letsencrypt_renewal.crontab
@@ -1,9 +1,5 @@
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
#[letsencrypt renewal]
# run the letsencrypt certificate renewal process every 4 hours.
-37 */4 * * * letsencrypt renew &>>/tmp/letsencrypt_last_run.txt
+37 */4 * * * letsencrypt renew &>>/tmp/${CRONUSER}-cron-letsencrypt_renewal.log
diff --git a/infobase/configuration/cron/linux_config_snarf.crontab b/infobase/configuration/cron/linux_config_snarf.crontab
deleted file mode 100644
index f8d51b08..00000000
--- a/infobase/configuration/cron/linux_config_snarf.crontab
+++ /dev/null
@@ -1,11 +0,0 @@
-
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
-#[linux config snarf]
-# do a backup of the config files once a week.
-28 7 * * 4 (source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; cd /z/stuffing/archives; perl $HOME/feisty_meow/scripts/archival/snarf_linux_config.pl) &>>/tmp/zz_linux_config_snarf_$USER.log
-
diff --git a/infobase/configuration/cron/mailman_attribute_fix.crontab b/infobase/configuration/cron/mailman_attribute_fix.crontab
index 489c156c..72ea73e8 100644
--- a/infobase/configuration/cron/mailman_attribute_fix.crontab
+++ b/infobase/configuration/cron/mailman_attribute_fix.crontab
@@ -1,10 +1,5 @@
-# m h dom mon dow command
-
-SHELL=/bin/bash
-
#[mailman attribute fix]
-# fix the mailman binaries.
+# fix the mailman log files so that an obnoxious bug doesn't happen on the mailman web site.
23 5 * * * chmod -R 02775 /var/lib/mailman/logs &>/dev/null
-
diff --git a/infobase/configuration/cron/nechung_fortune.crontab b/infobase/configuration/cron/nechung_fortune.crontab
index 6f11b83e..8a4feee5 100644
--- a/infobase/configuration/cron/nechung_fortune.crontab
+++ b/infobase/configuration/cron/nechung_fortune.crontab
@@ -1,10 +1,7 @@
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
#[nechung fortune]
-* * * * * (export LIGHTWEIGHT_INIT=true; source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; perl $HOME/feisty_meow/scripts/text/new_sig.pl) &>>/tmp/zz_nechung_fortune_$USER.log
+# runs every minute and recreates a fortune for thunderbird signature.
+# a lot of the detail below is to get the feisty meow environment loaded for
+# the new_sig command.
+* * * * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; perl $FEISTY_MEOW_SCRIPTS/text/new_sig.pl) &>>/tmp/${CRONUSER}-cron-nechung_fortune.log
diff --git a/infobase/configuration/cron/opensim_restart.crontab b/infobase/configuration/cron/opensim_restart.crontab
index 22fbdfff..e3a64113 100644
--- a/infobase/configuration/cron/opensim_restart.crontab
+++ b/infobase/configuration/cron/opensim_restart.crontab
@@ -1,12 +1,5 @@
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
#[opensim restart]
-# make sure opensim is started if we can't detect it as running.
-*/5 * * * * export FOOP=/tmp/opensim_restart_$USER.log; export LIGHTWEIGHT_INIT=true; source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh &>>$FOOP ; bash $HOME/feisty_meow/scripts/opensim/maybe_restart_opensim.sh &>>$FOOP ; /bin/chmod g+w $FOOP
-
+# ensure opensim is started if we can't detect it as running.
+*/5 * * * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; bash $FEISTY_MEOW_SCRIPTS/opensim/maybe_restart_opensim.sh) &>>/tmp/${CRONUSER}-cron-opensim_restart.log
diff --git a/infobase/configuration/cron/pack_feisty_for_web.crontab b/infobase/configuration/cron/pack_feisty_for_web.crontab
new file mode 100644
index 00000000..9b5130e7
--- /dev/null
+++ b/infobase/configuration/cron/pack_feisty_for_web.crontab
@@ -0,0 +1,5 @@
+
+#[pack feisty for web]
+# this packs up our source code distributions every 8 days.
+16 22 */8 * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; bash $FEISTY_MEOW_SCRIPTS/archival/pack_feisty_meow.sh) &>>/tmp/${CRONUSER}-cron-pack_feisty_for_web.log
+
diff --git a/infobase/configuration/cron/process_check.crontab b/infobase/configuration/cron/process_check.crontab
index 7ee3d4f5..39e1ed75 100644
--- a/infobase/configuration/cron/process_check.crontab
+++ b/infobase/configuration/cron/process_check.crontab
@@ -1,12 +1,5 @@
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
#[process check]
# a crontab for periodically dumping the process state.
-* * * * * (export LIGHTWEIGHT_INIT=true; source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; bash $HOME/feisty_meow/scripts/processes/show_hot_ones.sh) &>>/home/$USER/zz_hot_processes.log
-
+* * * * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; bash $FEISTY_MEOW_SCRIPTS/processes/show_hot_ones.sh) &>>/tmp/${CRONUSER}-cron-active_processes.log
diff --git a/infobase/configuration/cron/random_sound.crontab b/infobase/configuration/cron/random_sound.crontab
index 99f17e16..fe1e07b5 100644
--- a/infobase/configuration/cron/random_sound.crontab
+++ b/infobase/configuration/cron/random_sound.crontab
@@ -1,10 +1,4 @@
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
#[random sound]
-* * * * * (export LIGHTWEIGHT_INIT=true; source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; bash $HOME/feisty_meow/scripts/multimedia/randomly_play.sh) &>>/tmp/zz_random_sound_$USER.log
+* * * * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; bash $FEISTY_MEOW_SCRIPTS/multimedia/randomly_play.sh) &>>/tmp/${CRONUSER}-cron-random_sound.log
diff --git a/infobase/configuration/cron/repositories_updater.crontab b/infobase/configuration/cron/repositories_updater.crontab
deleted file mode 100644
index c5c118f0..00000000
--- a/infobase/configuration/cron/repositories_updater.crontab
+++ /dev/null
@@ -1,12 +0,0 @@
-
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-#[repositories updater]
-# update the source code to the latest, every day at 3am or so.
-14 3 * * * (cd ~/hoople1 ; cvs update . ; cd ~/hoople2 ; svn update . ; cd ~/yeti ; svn update . ) &>/dev/null
-# this packs up our source code distributions once a day.
-32 6 * * * (source $HOME/yeti/scripts/core/profile.sh; bash $HOME/yeti/scripts/archival/pack_yeti.sh ; bash $HOME/yeti/scripts/archival/pack_hoople1.sh ; bash $HOME/yeti/scripts/archival/pack_hoople2.sh) &>$HOME/.tmp/zz_packing_cron.log
-
-
diff --git a/infobase/configuration/cron/run_grid_container_non_work_hours.crontab b/infobase/configuration/cron/run_grid_container_non_work_hours.crontab
deleted file mode 100644
index 3a008e00..00000000
--- a/infobase/configuration/cron/run_grid_container_non_work_hours.crontab
+++ /dev/null
@@ -1,41 +0,0 @@
-
-# m h dom mon dow command
-
-SHELL=/bin/bash
-
-USER=jurgis
-
-#[run grid container non-work-hours]
-
-# we need these for the GenesisII GFFS environment.
-GENII_INSTALL_DIR=/home/jurgis/gffs/code/GenesisII/trunk
-XSEDE_TESTS_FOLDER=$GENII_INSTALL_DIR/toolkit
-GENII_USER_DIR=/home/jurgis/.tmp/dot-genesis-xcg3
-JAVA_HOME=/usr/lib/jvm/java-6-sun
-
-##############
-
-# variegated scheme: we run the container during non-working hours.
-
-# during non-weekday hours, make sure grid container is started if can't detect it as running.
- # first is for weekdays, during non-working hours.
-#*/10 0-8,19-23 * * 1-5 export FOOP=/tmp/container_restarter_${USER}_$(hostname).log; bash $XSEDE_TESTS_FOLDER/library/maybe_restart_container.sh &>>$FOOP ; /bin/chmod g+w $FOOP
- # second is for weekends.
-#*/10 * * * 0,6 export FOOP=/tmp/container_restarter_${USER}_$(hostname).log; bash $XSEDE_TESTS_FOLDER/library/maybe_restart_container.sh &>>$FOOP ; /bin/chmod g+w $FOOP
-
-# stop the container during working hours, so it doesn't hose up our desktop performance.
-#*/10 9-18 * * 1-5 export FOOP=/tmp/container_restarter_${USER}_$(hostname).log; bash $XSEDE_TESTS_FOLDER/library/zap_genesis_javas.sh &>>$FOOP ; /bin/chmod g+w $FOOP
-
-##############
-
-# a fairly rude scheme; always stop the container.
-
-#*/5 * * * * export FOOP=/tmp/container_restarter_${USER}_$(hostname).log; bash $XSEDE_TESTS_FOLDER/library/zap_genesis_javas.sh &>>$FOOP ; /bin/chmod g+w $FOOP
-
-##############
-
-#current scheme, always run it.
-*/5 * * * * export FOOP=/tmp/container_restarter_${USER}_$(hostname).log; set &>$FOOP ; bash $XSEDE_TESTS_FOLDER/library/maybe_restart_container.sh &>>$FOOP ; /bin/chmod g+w $FOOP
-
-##############
-
diff --git a/infobase/configuration/cron/serene_backup.crontab b/infobase/configuration/cron/serene_backup.crontab
deleted file mode 100644
index aa6e8ca2..00000000
--- a/infobase/configuration/cron/serene_backup.crontab
+++ /dev/null
@@ -1,9 +0,0 @@
-
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-#[serene backup]
-# backs up config files and important parts of home directories to off-machine storage.
-14 2 * * */7 (source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; bash $HOME/feisty_meow/scripts/archival/serene_backer_upper.sh) &>/tmp/offmachine_backup.log
-
diff --git a/infobase/configuration/cron/snarf_linux_configuration.crontab b/infobase/configuration/cron/snarf_linux_configuration.crontab
new file mode 100644
index 00000000..bf7dcc3e
--- /dev/null
+++ b/infobase/configuration/cron/snarf_linux_configuration.crontab
@@ -0,0 +1,5 @@
+
+#[snarf linux configuration]
+# do a backup of the linux configuration files once a week.
+28 7 * * 4 (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; cd /z/stuffing/archives; perl $FEISTY_MEOW_SCRIPTS/archival/snarf_linux_config.pl) &>>/tmp/${CRONUSER}-cron-snarf_linux_configuration.log
+
diff --git a/infobase/configuration/cron/swim_upstream.crontab b/infobase/configuration/cron/swim_upstream.crontab
deleted file mode 100644
index f7ca01f4..00000000
--- a/infobase/configuration/cron/swim_upstream.crontab
+++ /dev/null
@@ -1,14 +0,0 @@
-
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
-#[swim upstream]
-# this cron job updates the feisty meow repository on source forge based on
-# the real one at feistymeow.org.
-# update the source code to the latest, every day at 3am or so.
-14 */2 * * * (export LIGHTWEIGHT_INIT=true; source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; bash $HOME/feisty_meow/scripts/rev_control/push_repo_upstream.sh $HOME/repos/sf-feistymeow-trunk ) &>>/tmp/zz_nechung_fortune_$USER.log
-
-
diff --git a/infobase/configuration/cron/synch_and_swim_downstream.crontab b/infobase/configuration/cron/synch_and_swim_downstream.crontab
new file mode 100644
index 00000000..222d7c6f
--- /dev/null
+++ b/infobase/configuration/cron/synch_and_swim_downstream.crontab
@@ -0,0 +1,8 @@
+
+#[synch and swim downstream]
+# updates local code repositories from master versions before uploading any changes to downstream
+# repositories, such as sourceforge or github. the uploading process (which we think of as sending
+# those updated items swimming downstream to their dependent repositories) is done automatically in
+# our makefiles. that's why the code below relies on the top-level makefile in home.
+14 * * * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; cd $HOME ; bash $FEISTY_MEOW_SCRIPTS/rev_control/rgetem.sh ; make ) &>>/tmp/${CRONUSER}-cron-synch_and_swim_downstream.log
+
diff --git a/infobase/configuration/cron/tell_zooty_our_ip.crontab b/infobase/configuration/cron/tell_zooty_our_ip.crontab
index bdf45d5e..bf625c30 100644
--- a/infobase/configuration/cron/tell_zooty_our_ip.crontab
+++ b/infobase/configuration/cron/tell_zooty_our_ip.crontab
@@ -1,10 +1,5 @@
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-#[tell zooty our ip address]
-# special for firewall host; get zooty informed of our IP so we can make
-# the back-connection and get home.
-0,14,28,42,56 * * * * (bash /home/fred/feisty_meow/scripts/security/tell_zooty_our_ip.sh serene.feistymeow.org fred fred ) &>>/tmp/zooty_tell_report.txt
+#[tell zooty our ip]
+# firewall host only--inform serene/zooty of our home IP address to enable back-connections.
+0,14,28,42,56 * * * * (bash $FEISTY_MEOW_APEX/scripts/security/tell_zooty_our_ip.sh serene.feistymeow.org fred $CRONUSER ) &>>/tmp/${CRONUSER}-cron-tell_zooty_our_ip.log
diff --git a/infobase/configuration/cron/time_synch.crontab b/infobase/configuration/cron/time_synch.crontab
index ef5a747e..77e41d5c 100644
--- a/infobase/configuration/cron/time_synch.crontab
+++ b/infobase/configuration/cron/time_synch.crontab
@@ -1,18 +1,14 @@
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-#[time synch crontab]
+#[time synch]
# standard to synch to local machine.
-0,4,8,12,16,20,24,28,32,36,40,44,48,52,56 * * * * /usr/sbin/sntp -P no -r greendragon
-or
-0,4,8,12,16,20,24,28,32,36,40,44,48,52,56 * * * * /usr/bin/rdate -s -n greendragon
+#0,4,8,12,16,20,24,28,32,36,40,44,48,52,56 * * * * /usr/sbin/sntp -P no -r greendragon &>>/tmp/${CRONUSER}-cron-time_synch.log
+#or
+0,4,8,12,16,20,24,28,32,36,40,44,48,52,56 * * * * /usr/bin/rdate -s -n greendragon &>>/tmp/${CRONUSER}-cron-time_synch.log
# -n is nntp which may not work with govt servers.
# one machine on the network uses this version, to synch externally.
-#0 0,4,8,12,16,20 * * * /usr/sbin/sntp -P no -r time.nist.gov
+#0 0,4,8,12,16,20 * * * /usr/sbin/sntp -P no -r time.nist.gov &>>/tmp/${CRONUSER}-cron-time_synch.log
#or
-0 0,4,8,12,16,20 * * * /usr/bin/rdate -s time-c.nist.gov
+0 0,4,8,12,16,20 * * * /usr/bin/rdate -s time.nist.gov &>>/tmp/${CRONUSER}-cron-time_synch.log
diff --git a/infobase/configuration/cron/update_apt_based_linux.crontab b/infobase/configuration/cron/update_apt_based_linux.crontab
new file mode 100644
index 00000000..cb6568c8
--- /dev/null
+++ b/infobase/configuration/cron/update_apt_based_linux.crontab
@@ -0,0 +1,7 @@
+
+
+#[update apt based linux crontab]
+# does a daily update of an apt-based linux box at pi o'clock.
+14 3 * * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; bash $FEISTY_MEOW_SCRIPTS/system/naive_system_updater.sh) &>>/tmp/${CRONUSER}-cron-update_aptbased_linux.log
+
+
diff --git a/infobase/configuration/cron/uptime_report.crontab b/infobase/configuration/cron/uptime_report.crontab
index 8aaab715..e1b31a67 100644
--- a/infobase/configuration/cron/uptime_report.crontab
+++ b/infobase/configuration/cron/uptime_report.crontab
@@ -1,11 +1,5 @@
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
#[uptime report]
# the script writes the current time and current uptime to the log file.
-0 * * * * (source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; bash $HOME/feisty_meow/scripts/system/write_uptime_report.sh) &>>/tmp/zz_uptime_report_$USER.log
+0 * * * * (source $FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh; bash $FEISTY_MEOW_SCRIPTS/system/write_uptime_report.sh) &>>/tmp/${CRONUSER}-cron-uptime_report.log
diff --git a/infobase/configuration/cron/web_group_perm_fix.crontab b/infobase/configuration/cron/web_group_perm_fix.crontab
index 906b1122..a46493ef 100644
--- a/infobase/configuration/cron/web_group_perm_fix.crontab
+++ b/infobase/configuration/cron/web_group_perm_fix.crontab
@@ -1,10 +1,5 @@
-# m h dom mon dow command
-
-SHELL=/bin/bash
-
#[web group perm fix]
# fix the web directories for group access.
0 * * * * chmod -R g+w /var/www &>/dev/null
-
diff --git a/infobase/configuration/cron/whack_knotify4.crontab b/infobase/configuration/cron/whack_knotify4.crontab
deleted file mode 100644
index 7bfe07bb..00000000
--- a/infobase/configuration/cron/whack_knotify4.crontab
+++ /dev/null
@@ -1,11 +0,0 @@
-
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-#[whack knotify]
-# whack this troublesome process that can go cpu crazy on a logout.
-# so far this is the best solution to this major annoyance.
-*/3 * * * * killall knotify4 &>/dev/null
-
-
diff --git a/infobase/configuration/cron/zooty_archive_packer.crontab b/infobase/configuration/cron/zooty_archive_packer.crontab
deleted file mode 100644
index 69d3d447..00000000
--- a/infobase/configuration/cron/zooty_archive_packer.crontab
+++ /dev/null
@@ -1,12 +0,0 @@
-
-SHELL=/bin/bash
-
-# m h dom mon dow command
-
-USER=fred
-
-#[zooty archive packer]
-# this packs up our archives once a day.
-32 6 0 * * (source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh; bash $HOME/feisty_meow/scripts/archival/pack_yeti.sh ; bash $HOME/feisty_meow/scripts/archival/pack_hoople.sh ) &>>/tmp/zz_packing_cron_$USER.log
-
-
diff --git a/infobase/configuration/dns/restore_resolv.conf.sh b/infobase/configuration/dns/restore_resolv.conf.sh
new file mode 100644
index 00000000..7fca7348
--- /dev/null
+++ b/infobase/configuration/dns/restore_resolv.conf.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+# gets rid of any customized resolv.conf file for the local machine and reinstates the standard link for it.
+
+sudo rm /etc/resolv.conf
+sudo ln -s /var/run/resolvconf/resolv.conf /etc/resolv.conf
+sudo resolvconf -u
diff --git a/infobase/configuration/eclipse/cpp-fredstyle_2013_03_07.xml b/infobase/configuration/eclipse/cpp-fredstyle_2013_03_07.xml
deleted file mode 100644
index 373c8ddb..00000000
--- a/infobase/configuration/eclipse/cpp-fredstyle_2013_03_07.xml
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/infobase/configuration/eclipse/feisty_meow-cpp_style-2013_03_07.xml b/infobase/configuration/eclipse/feisty_meow-cpp_style-2013_03_07.xml
new file mode 100644
index 00000000..373c8ddb
--- /dev/null
+++ b/infobase/configuration/eclipse/feisty_meow-cpp_style-2013_03_07.xml
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/infobase/configuration/eclipse/feisty_meow-java_style-2017-01-02.xml b/infobase/configuration/eclipse/feisty_meow-java_style-2017-01-02.xml
new file mode 100644
index 00000000..6afa0a7e
--- /dev/null
+++ b/infobase/configuration/eclipse/feisty_meow-java_style-2017-01-02.xml
@@ -0,0 +1,295 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/infobase/configuration/eclipse/java_style-fredstyle_2013_04_02.xml b/infobase/configuration/eclipse/java_style-fredstyle_2013_04_02.xml
deleted file mode 100644
index 71b50e8e..00000000
--- a/infobase/configuration/eclipse/java_style-fredstyle_2013_04_02.xml
+++ /dev/null
@@ -1,291 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/infobase/configuration/network_manager/modify-NetworkManager.conf b/infobase/configuration/network_manager/modify-NetworkManager.conf
new file mode 100644
index 00000000..719fefa3
--- /dev/null
+++ b/infobase/configuration/network_manager/modify-NetworkManager.conf
@@ -0,0 +1,16 @@
+
+
+the file /etc/NetworkManager/NetworkManager.conf needs to be modified at this line:
+
+ dns=dnsmasq
+
+if that line is present, screwy stuff happens when we're trying to use our dhcp assigned
+dns info. things don't resolve that should.
+
+with this setting commented out, e.g.:
+
+ #dns=dnsmasq
+
+the dns resolution problems go away.
+
+
diff --git a/infobase/configuration/quake3/quake3_server_start.txt b/infobase/configuration/quake3/quake3_server_start.txt
index ef4e9bb5..a498a3a4 100644
--- a/infobase/configuration/quake3/quake3_server_start.txt
+++ b/infobase/configuration/quake3/quake3_server_start.txt
@@ -10,6 +10,6 @@ that i don't know but which i have heard of.
this just automates the copying of the config file before running quake.
-cp ~/feisty_meow/infobase/quake3/fred_free_for_all.cfg /usr/local/games/quake3/baseq3/ ; nohup quake3 +set dedicated 1 +exec fred_free_for_all.cfg
+cp $FEISTY_MEOW_APEX/infobase/quake3/fred_free_for_all.cfg /usr/local/games/quake3/baseq3/ ; nohup quake3 +set dedicated 1 +exec fred_free_for_all.cfg
diff --git a/infobase/configuration/trac/trac_startup.sh b/infobase/configuration/trac/trac_startup.sh
index 87c5668c..7326c815 100644
--- a/infobase/configuration/trac/trac_startup.sh
+++ b/infobase/configuration/trac/trac_startup.sh
@@ -7,7 +7,7 @@
#
# Author: Chris Koeritz
-source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
+source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
# we only try to do something if trac is missing.
if [ "$(psfind tracd)" ]; then
diff --git a/infobase/configuration/vim/dot.vimrc b/infobase/configuration/vim/dot.vimrc
index 317fef33..f8fe7a21 100644
--- a/infobase/configuration/vim/dot.vimrc
+++ b/infobase/configuration/vim/dot.vimrc
@@ -1,6 +1,8 @@
"
" this file is an example .vimrc for the vim editor. it should be in your home directory.
"
+" also, this config uses the elflord color scheme. this may require installing the full
+" vim package, e.g.: sudo apt-get install vim
" cranks up the register saved buffer size to 1000 lines, since otherwise the cut buffer will only
" preserve the default 50 lines for a paste to another file. this makes all registers go up to
diff --git a/infobase/feisty_inits/dot.bashrc-normal-user b/infobase/feisty_inits/dot.bashrc-normal-user
new file mode 100644
index 00000000..edc83b70
--- /dev/null
+++ b/infobase/feisty_inits/dot.bashrc-normal-user
@@ -0,0 +1,39 @@
+
+##############
+
+# initializes the feisty meow environment for "normal" users (not intended for the root user).
+
+##############
+
+# drag in the default version of this file. this may not be needed if your
+# .bashrc script already has substantial code or already does this.
+source /etc/bash.bashrc
+
+##############
+
+# set the history sizes to be much larger, and do this whether we load the
+# feisty meow environment or not.
+
+export HISTSIZE=1000000
+export HISTFILESIZE=8000000
+
+##############
+
+# system-wide install:
+export FEISTY_MEOW_APEX="/opt/feistymeow.org/feisty_meow"
+# personal install:
+#export FEISTY_MEOW_APEX="$HOME/feisty_meow"
+
+# sets up the feisty_meow scripts if appropriate for the environment.
+if [ "${TERM}" != "dumb" -a -z "$PBS_ENVIRONMENT" ]; then
+ source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
+fi
+
+# if not commented out, then feisty meow will run all the unit tests during builds.
+#export RUN_ALL_TESTS=true
+
+# turns on noisy debugging in feisty meow scripts if uncommented.
+#export DEBUG_FEISTY_MEOW=true
+
+##############
+
diff --git a/infobase/feisty_inits/dot.bashrc-root b/infobase/feisty_inits/dot.bashrc-root
new file mode 100644
index 00000000..20a9023f
--- /dev/null
+++ b/infobase/feisty_inits/dot.bashrc-root
@@ -0,0 +1,37 @@
+
+##############
+
+# provides a macro to initialize the feisty meow environment for the "root" user.
+
+##############
+
+# drag in the default version of this file. this may not be needed if your
+# .bashrc script already has substantial code or already does this.
+source /etc/bash.bashrc
+
+##############
+
+# set the history sizes to be much larger, and do this whether we load the
+# feisty meow environment or not.
+
+export HISTSIZE=1000000
+export HISTFILESIZE=8000000
+
+##############
+
+# system-wide install:
+export FEISTY_MEOW_APEX="/opt/feistymeow.org/feisty_meow"
+# personal install:
+#export FEISTY_MEOW_APEX="$HOME/feisty_meow"
+
+# the "fredme" macro enables the feisty_meow environment.
+alias fredme='source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"'
+
+# if not commented out, then feisty meow will run all the unit tests during builds.
+#export RUN_ALL_TESTS=true
+
+# turns on noisy debugging in feisty meow scripts if uncommented.
+#export DEBUG_FEISTY_MEOW=true
+
+##############
+
diff --git a/infobase/fortunes.dat b/infobase/fortunes.dat
index 22f958e3..4b508630 100644
--- a/infobase/fortunes.dat
+++ b/infobase/fortunes.dat
@@ -26,10 +26,10 @@ Sem chung nga jik di dak o.
~
religious letter games...
- DEVIL
- EVIL
- GOOD
- GOD
+ devil
+ evil
+ good
+ god
~
Nam Myoho Renge Kyo
~
@@ -145,7 +145,7 @@ nechung: unable to open fortunes.dat file. (just kidding)
~
are you only using half your brain?
if you can only think in terms of logical conclusions, rational assumptions,
-and common sense OR
+and common sense -or-
if you can only think in terms of intuitive jumps, esthetic motivations,
and the fluid nature of reality,
then you probably are stuck on one side of your head. try moving into
@@ -7449,7 +7449,7 @@ A woman drove me to drink and I didn't even have the decency to thank her.
"Sir, if I were your wife, I would put poison in your coffee."
-- Lady Nancy Astor speaking to Winston Churchill
"Madam, if I were your husband, I would drink it."
- -- Churchill's reply
+ -- Winston Churchill's reply
~
If God had intended us to drink beer, He would have given us stomachs.
-- David Daye
@@ -17680,7 +17680,7 @@ If you would make a man happy, do not add to his possessions but
subtract from the sum of his desires.
-- Seneca
~
-Live life like your hair is on fire. -- Ashley Brilliant
+Live life like your hair is on fire. -- Ashleigh Brilliant
~
City people have a hard time handling the silences when they first
come out to the country. After a certain period of solitude, I myself
@@ -20463,10 +20463,10 @@ exist? Yes, provided it is never known. Known, it will only disappoint us.
-- Umberto Eco
~
The subjects that were dearest to the examiners were almost invariably those I
-fancied least... I should have liked to be asked to say what I knew. They
+fancied least. ... I should have liked to be asked to say what I knew. They
always tried to ask what I did not know. When I would have willingly displayed
my knowledge, they sought to expose my ignorance. This sort of treatment had
-only one result: I did not too well in examinations.
+only one result: I did not do well at examinations...
-- Winston Churchill
~
One of the great movements in my lifetime among educated people is the need to
@@ -32769,14 +32769,14 @@ Nature provides a free lunch, but only if we control our appetites.
~
Those who get too big for their briches will be exposed in the end. -- Anon.
~
-We're not talking about the same thing," he said. "For you the world is weird
+"We're not talking about the same thing," he said. "For you the world is weird
because if you're not bored with it you're at odds with it. For me the world
is weird because it is stupendous, awesome, mysterious, unfathomable; my
interest has been to convince you that you must accept responsibility for being
here, in this marvelous world, in this marvelous desert, in this marvelous
time. I wanted to convince you that you must learn to make every act count,
since you are going to be here for only a short while, in fact, too short for
-witnessing all the marvels of it.
+witnessing all the marvels of it."
-- Don Juan, Yaqui Shaman
~
Always and never are two words you should always remember never to use.
@@ -37906,7 +37906,7 @@ for a happy and joyful life, it is still possible to live a happy and joyful
life.
-- H.H. the Dalai Lama
~
-COMPLICATED SIMPLICITY
+Complicated Simplicity
Emptiness is the simplest and most unelaborated thing we could imagine, but
then there is this whole literature about all these very discursive details
@@ -37930,7 +37930,7 @@ If you can't be a good example, then you'll just have
to be a horrible warning.
-- Catherine Aird
~
-THE MIND OF CLEAR LIGHT
+The mind of clear light
Is spiritual practice really worthwhile? Is it really possible to eliminate
from within ourselves the forces that give rise to suffering? As is said,
@@ -38061,7 +38061,8 @@ paragate means go beyond and transcend; parasamgate means go utterly beyond,
go thoroughly beyond; and bodhi svaha means firmly rooted in enlightenment.
-- H.H. the Dalai Lama
~
-ENDURING SUCCESS
+Enduring Success
+
It is often seen that human beings can endure problems quite well, but
cannot endure success. When we are successful and have everything we desire,
it can easily go to our heads. There is a great danger of losing our common
@@ -41391,7 +41392,7 @@ ourselves from it.
~
Completely understanding his dire circumstances, the man had a strong
feeling that the only way to be saved from deportation was to extend loving-
-kindness to Calcuttaâs police inspector general. He placed a photograph of
+kindness to Calcutta's police inspector general. He placed a photograph of
the police inspector general on his desk. He then completely focused his
attention on it, extending his feeling of loving-kindness toward the man. In
fact, he sat up the entire night looking at the photograph and practicing his
@@ -41414,7 +41415,7 @@ transformed, rest in equanimity in the space of reality.
Shambhala Publications
~
According the First Noble Truth, the first step in discovering truth and
-relieving our own and anyone elseâs suffering is to acknowledge the pain and
+relieving our own and anyone else's suffering is to acknowledge the pain and
suffering that are present in our lives. Sometimes people assume that
Buddhism is a pessimistic sort of tradition because of this teaching. In
fact, however, recognizing that pain is simply part of being alive can be a
@@ -41436,7 +41437,7 @@ old age, sickness, and death.
In brief, whatever is dawning, be right there with an uncontrived mind. Do
not involve yourself with stopping, or starting, or with any modification
whatsoever. Whatever arises, stay uncontrivedly right with that arising.
-Donât reel your mind in, donât cast around for an object of meditation out
+Don't reel your mind in, don't cast around for an object of meditation out
there. Be right there with the meditator, your very own mind. Unfound when
sought, your own mind is primordially empty mindnature. Seeking also is
unnecessary; the seeker--yourself--is that [which one is seeking].
@@ -41445,16 +41446,16 @@ Unwaveringly remain right with that very seeker.
Publications
~
Thus, all compounded and uncompounded phenomena--the ten directions, the
-three times, the three worlds, and so forth--are none other than oneâs own
+three times, the three worlds, and so forth--are none other than one's own
mind, as is stated in the Great Sovereign of Practices, the Victory over the
-Three Worlds: "If one realizes, in accordance with oneâs own unmistaken
+Three Worlds: "If one realizes, in accordance with one's own unmistaken
mind or the power of the mind, that discerning consciousness is the very
nature of the buddhas, bodhisattvas, and the like, one is enlightened. If one
fails to understand this, everything appears as the vessel and contents that
constitute samsara. The three worlds are simply this; the great elements
are simply this."
-- Padmasambhava, "A Garland of Views: A Guide to View, Meditation, and
- Result in the Nine Vehicles", from Padmasambhavaâs classic text with a
+ Result in the Nine Vehicles", from Padmasambhava's classic text with a
commentary by Jamgön Mipham, published by Shambhala Publications
~
The Hinayana counsels a life of discipline--not the onerous, punishing kind,
@@ -41463,7 +41464,7 @@ avoided because they really seem to pile up. Rather than being seen as moral
wrongdoings, however, they are seen as obstacles and obscurations to true
wakefulness and as such are to be eschewed. To do so, tremendous precision is
required. I mean, take just one of the most basic precepts, common to every
-religion under the sun: "donât lie." If you can read to the end of this
+religion under the sun: "don't lie." If you can read to the end of this
paragraph without telling a lie, please alert the media.
-- Susan Piver, "Start Here Now", published by Shambhala Publications
~
@@ -41479,15 +41480,15 @@ different forms of suffering but prefer not to think about what they entail.
We only need to watch a birth to know how traumatic and painful the passage
through the birth canal must be for the baby. Aging is distasteful to
everyone but small children, who long to be grown up. Everyone else likes to
-be told they donât look a day older.
- Even reading about diseases or hearing of othersâ sicknesses fills us
+be told they don't look a day older.
+ Even reading about diseases or hearing of others' sicknesses fills us
with a dread that we might contract them. When we actually fall ill
ourselves, we feel afraid and helpless. As for death, everyone avoids talking
about it. Humans also experience the constant frustration of not getting what
-they want and getting what they donât want. When we first meet people, they
+they want and getting what they don't want. When we first meet people, they
may seem successful and happy, but as soon as we get to know them better, we
discover they all have a tale of woe to tell.
- -- "Atishaâs Lamp for the Path to Enlightenment", commentary by Geshe
+ -- "Atisha's Lamp for the Path to Enlightenment", commentary by Geshe
Sonam Rinchen, translated and edited by Ruth Sonam, published by
Shambhala Publications
~
@@ -41504,23 +41505,23 @@ time, you are empty.
~
Traditionally, many subtle distinctions are made about the various
characteristics and levels of the development of bodhichitta. Chagme Rinpoche
-mentions these and says, âIf you are studying to become a scholar, you need
+mentions these and says, "If you are studying to become a scholar, you need
to know all of these distinctions. But if you are a practitioner, these
-distinctions are extremely unimportant.â For example, I arrived here at
+distinctions are extremely unimportant." For example, I arrived here at
these teachings by traveling in airplanes and automobiles. Now, I might
-wonder, âWho built the airplane I traveled in? How does it work?â But, in
-fact, I donât know the answers to any of these things because it is not
+wonder, "Who built the airplane I traveled in? How does it work?" But, in
+fact, I don't know the answers to any of these things because it is not
important for me to know these things. What is important is that I got on an
airplane and flew thousands of miles and was able to get here. In the same
-way, I regularly travel by automobile, and I might wonder, âHow do you make
-an automobile? Who made this automobile? How does it work exactly?â From
+way, I regularly travel by automobile, and I might wonder, "How do you make
+an automobile? Who made this automobile? How does it work exactly?" From
one point of view, of course, it is good to know these things, but from the
point of view of actually getting somewhere, it is not important. What is
important is that I got in a car and I came here. So, from one point of view,
it might be important to know all about the various aspects and
characteristics of bodhichitta, but according to Karma Chagme, it is perfectly
-okay if you donât.
- -- Khenchen Thrangu, "Luminous Clarity: A Commentary on Karma Chagmeâs
+okay if you don't.
+ -- Khenchen Thrangu, "Luminous Clarity: A Commentary on Karma Chagme's
Union of Mahamudra and Dzogchen", published by Shambhala Publications
~
- You are a deeply selfish person. -
@@ -41564,25 +41565,25 @@ It is said in the Supreme Continuum of the Great Vehicle:
-- Choying Tobden Dorje, from "The Complete Nyingma Tradition from Sutra to
Tantra, Books 15 to 17, Volume 1", published by Shambhala Publications
~
- First, Iâll begin with self, which sometimes goes by the name ego, or
+ First, I'll begin with self, which sometimes goes by the name ego, or
more familiarly, I and me. What is this self, really? We can investigate by
trying to analyze this self, to locate it or pin it down, to see if it even
exists in the first place. This can be a highly illuminating contemplation,
but for the purposes of this book, I would like to focus more on our everyday
-experience. Letâs identify how having a self feels. In our mind stream,
+experience. Let's identify how having a self feels. In our mind stream,
there is always some kind of feeling of having a self, which is at the center
of all our thoughts and emotions. One Tibetan phrase targets this phenomenon
-precisely: dak che dzin. Dak means âselfâ; che means âimportantâ or
-âdearâ; dzin means âholdingâ or âregarding.â This term has various
+precisely: dak che dzin. Dak means "self"; che means "important" or
+"dear"; dzin means "holding" or "regarding." This term has various
translations, which all capture different nuances: self-centeredness, self-
clinging, ego-clinging, self-absorption. I like to use all of these terms in
-different contexts, but my favorite translation is âself-importance.â
+different contexts, but my favorite translation is "self-importance."
This word may make us think dak che dzin has mostly to do with being proud
and arrogant, but such pride is nowhere near the whole story. Self-importance
includes both self-cherishing and self-protection. It is the source of the
-five main types of painful emotions, known as the âfive poisonsâ:
+five main types of painful emotions, known as the "five poisons":
attachment, aggression, jealousy, arrogance, and stupidity. It can manifest
-as feeling like weâre better than others, but just as easily it can manifest
+as feeling like we're better than others, but just as easily it can manifest
as low self-esteem, or even self-hatred. The bottom line is that we regard
this selfâwhatever or wherever it isâas the most important thing in the
entire universe.
@@ -41595,7 +41596,7 @@ people who want dinner do not ring the bell.
~
In reality, nothing can save us from a state of chaos or confusion unless
we have acknowledged it and actually experienced it. Otherwise, even though
-we may be in the midst of chaos, we donât even notice it, although we are
+we may be in the midst of chaos, we don't even notice it, although we are
subject to it. On the path of meditation, the first real glimpse of our
confusion and the general chaos is when we begin to feel uncomfortable. We
feel that something is a nuisance. Something is bugging us constantly.
@@ -41604,8 +41605,8 @@ to see ourselves being a nuisance to ourselves when we uncover all kinds of
thought problems, emotional hang-ups, and physical problems in meditation.
Before we work with anyone else, we have to deal with being a nuisance to
ourselves. We have to pull ourselves together. We might get angry with
-ourselves, saying, "I could do better than this. Whatâs wrong with me? I
-seem to be getting worse. Iâm going backward." We might get angry with
+ourselves, saying, "I could do better than this. What's wrong with me? I
+seem to be getting worse. I'm going backward." We might get angry with
the whole world, including ourselves. Everything, the entire universe,
becomes the expression of total insult. We have to relate to that experience
rather than rejecting it. If you hope to be helpful to others, first you have
@@ -41754,7 +41755,7 @@ Los Angeles: a scattered city, like a teenager's sexual curiosity.
San Francisco: a clean city, like an elegant, genteel Christian graveyard.
-Santa Fe: a picturesque city, like a painterâ s bright, simple palette,
+Santa Fe: a picturesque city, like a painter's bright, simple palette,
imitating Tibet.
Boston: a sophisticated city, like London without queens and dukes and falling
@@ -41787,23 +41788,23 @@ are invited.
Kornfield, published by Shambhala Publications
~
Even though we may actually recognize the nature of awareness, we should not
-hold on to that mindfulness tightly, thinking, âI have indeed recognized it."
+hold on to that mindfulness tightly, thinking, "I have indeed recognized it."
If we do hold on to it tightly, it will be like when a thread is twisted too
taut: one cannot sew with it, because it knots up. In the same way, if one
is too tense, one's mindfulness will be obscured. If mindfulness is not
grasped too tightly but left in the natural flow, sometimes it will be clear
and sometimes not. But we should not get caught up in whether it is clear or
not. If genuine mindfulness is left without being altered, gradually we will
-come to know, through our own experience, âThis is awareness, and this is
-ignorance; this is mind, and this is wisdom.â
+come to know, through our own experience, "This is awareness, and this is
+ignorance; this is mind, and this is wisdom."
-- Dilgo Khyentse, from "Primordial Purity", published by Shambhala
Publications
~
He says Tibetans are unique because we value the practice of Buddhism. He
gives the example of Tibetan mothers who in the course of a day point
-repeatedly toward suffering. They tell their children: donât kill the ant,
-it will suffer; donât pour hot water on the soil, the earthworm will feel
-the sting and the heat will cause it great pain; donât pull the dogâs tail
+repeatedly toward suffering. They tell their children: don't kill the ant,
+it will suffer; don't pour hot water on the soil, the earthworm will feel
+the sting and the heat will cause it great pain; don't pull the dog's tail
so hard. We are told to think for the animals and insects who cannot voice
their pain but for whom suffering is as acute as it is for humans. From a
young age, he says, we are reminded that nobody is free from suffering. I
@@ -41838,7 +41839,7 @@ enlightened nature itself.
Pondering this, most people seem like mad sea captains.
The root of practice is renunciation.
- So if you donât use the key points of mind training
+ So if you don't use the key points of mind training
To till the soil of your mind, hardened toward liberation,
When death comes and you beat your chest with regret,
it will be too late!
@@ -41846,11 +41847,11 @@ enlightened nature itself.
-- Jigme Lingpa, from "Steps to the Great Perfection: The Mind-Training
Tradition of the Dzogchen Masters", published by Shambhala Publications
~
-We donât have to try to surrender. That sounds too effortful. Then we will
+We don't have to try to surrender. That sounds too effortful. Then we will
have a surrender competition. There is going to be a spiritual marathon, a
spiritual Olympics, how about that? Indeed, there is a spiritual Olympics.
It is not officially announced. Many people are working really hard trying to
-be the best meditator, the best ascetic, the most enlightened. So donât try
+be the best meditator, the best ascetic, the most enlightened. So don't try
to surrender with your personal will or deliberate effort. It sounds like too
much work, trying to surrender to everything. Instead, go inside. That is
all you need to do sometimes. Go inside and let yourself be in touch with
@@ -41858,7 +41859,7 @@ your heart. You know how to be in touch with your heart. Your heart is
waiting to be recognized. This is why the Tibetan masters often said there
are many forms or levels of meditation. The highest level is what they call
effortless meditation. When they teach how to meditate, especially the
-masters from the Nyingma tradition, they always say, "Donât do anything."
+masters from the Nyingma tradition, they always say, "Don't do anything."
Rest in the present moment. Relax in the natural state of your mind, because
if you can relax, rest in the natural state of your own mind, then you will be
in touch with your own heart, with your original heart, with your innocent
@@ -42055,7 +42056,7 @@ fun and healthy vibes that I felt like "i never need to feel fear again".
that feeling lasted for days after the festival was over. hopefully memory of
that thought never fades.
~
- Donât become easily discouraged. If you never try to go beyond that
+ Don't become easily discouraged. If you never try to go beyond that
stage of initial discouragement because there are thoughts arising in your
meditation, you are never going to have the true experiences of meditation.
You need to go beyond that initial stage. You need to keep trying. If you
@@ -42063,18 +42064,18 @@ keep making that effort to go beyond that initial discouragement, you will
arrive at the experience of not getting caught up in your thoughts and mental
events.
Sometimes you may even observe an increase in the frequency of thoughts.
-When that happens, donât get discouraged. My enlightened master Jigme
+When that happens, don't get discouraged. My enlightened master Jigme
Phuntsok Rinpoche says:
"One sign that your meditation is beginning to be effective is that both
subtle thoughts and obvious thoughts become more noticeable than before. This
-is not a bad sign; itâs a good sign. When water rushes in a strong river
-current, you donât see the fish or rocks beneath the rapids. But when the
+is not a bad sign; it's a good sign. When water rushes in a strong river
+current, you don't see the fish or rocks beneath the rapids. But when the
current slows and the water becomes clear, then you can see the fish, the
rocks, and everything below the surface distinctly. Similarly, if you never
pay attention to your mind, and your thoughts and emotions are uncontrolled,
-you donât even know how many thoughts go by. But when your mind becomes
-more stable and calm, you begin to see your thoughts more clearly. Donât be
-discouraged. Take heart at this sign. Donât hold yourself too loosely or
+you don't even know how many thoughts go by. But when your mind becomes
+more stable and calm, you begin to see your thoughts more clearly. Don't be
+discouraged. Take heart at this sign. Don't hold yourself too loosely or
too tightly. Maintain your meditation in the right way without concern and
gradually your meditation experience will increase and stabilize."
Remember: Do not follow the past. Do not anticipate the future. Remain
@@ -42094,11 +42095,11 @@ austerities and urge her to take further action. Due to her abundant good
karma in past lives, she is preordained to serve him. Sujata sets to work
preparing the rice milk offering in the fashion of the one thousand cows
milked to feed the five hundred and so forth. In observing miracles around
-the cooking pot, she prays that they foretell the Bodhisattvaâs imminent
+the cooking pot, she prays that they foretell the Bodhisattva's imminent
supreme awakening. She brings the rice porridge in a golden bowl to Gautama
where he is sitting along the river and offers it to him after reverentially
making prostrations. According to this story, the Bodhisattva regains his
-former strength and splendor upon consuming Sujataâs excellent food. In
+former strength and splendor upon consuming Sujata's excellent food. In
this version, it is his first meal after the six years of austerities and has
instantly restored him to wholeness. After bathing and meditating at the
river, Gautama proceeds to the tree of enlightenment. All these events have
@@ -42120,7 +42121,7 @@ liberated in this life from samsara, cyclic existence. Over many years the
Karmapa received from this great bodhisattva the teachings that Gampopa
himself had been given by his masters. First, Gampopa transmitted to him the
teachings of the Kadampa tradition, including the classical scholastic studies
-known as the âgradual path,â which emphasize the development of
+known as the "gradual path," which emphasize the development of
renunciation and altruism. They henceforth became an educational constant for
the Kagyu lineage and the basis of the study of the Vajrayana. Dusum Khyenpa
then received from his master the teachings and transmissions related to the
@@ -42149,7 +42150,7 @@ Dusum Khyenpa would attain complete enlightenment.
Aubèle, published by Shambhala Publications
~
One cannot force or grasp a spiritual experience, because it is as delicate as
-the whisper of the wind. But one can purify oneâs motivation, oneâs body,
+the whisper of the wind. But one can purify one's motivation, one's body,
and train oneself to cultivate it. Because we come from a culture which
teaches us there is always something external to be obtained which will lead
us to fulfillment, we lose contact with our innate wisdom. As the Indian
@@ -42238,7 +42239,7 @@ Some people are born on third base and go through life thinking they hit a
triple.
-- Barry Switzer
~
- First, letâs take a look at how physical and emotional health supports
+ First, let's take a look at how physical and emotional health supports
our spiritual health. What is spiritual health? One way that the Buddhist
teachings define spiritual health is having a sense of interconnection with
other living beings on the planet, as well as respect for the natural
@@ -42259,15 +42260,15 @@ dislike, we ourselves become spiritually rich.
Breathing Practices for Healing the Body and Cultivating Wisdom",
published by Shambhala Publications
~
-Our worries may zoom around the state of the world. âWhat happens if the
+Our worries may zoom around the state of the world. "What happens if the
economy plummets? If the ozone layer keeps decreasing? If we have more
anthrax attacks? If terrorists take over the country? If we lose our civil
-liberties fighting terrorism?â Here, our creative writing ability leads to
+liberties fighting terrorism?" Here, our creative writing ability leads to
fantastic scenarios that may or may not happen, but regardless, we manage to
work ourselves into a state of unprecedented despair. This, in turn, often
leads to raging anger at the powers that be or alternatively, to apathy,
-simply thinking that since everything is rotten, thereâs no use doing
-anything. In either case, weâre so gloomy that we neglect to act
+simply thinking that since everything is rotten, there's no use doing
+anything. In either case, we're so gloomy that we neglect to act
constructively in ways that remedy difficulties and create goodness.
-- Thubten Chodron, in "Taming the Mind", published by Shambhala Publications
~
@@ -42283,7 +42284,7 @@ that thought never fades.
The dawn of the Great Eastern Sun is based on actual experience. It is not a
concept. You realize that you can uplift yourself, that you can appreciate
your existence as a human being. Whether you are a gas station attendant or
-the president of your country doesnât really matter. When you experience
+the president of your country doesn't really matter. When you experience
the goodness of being alive, you can respect who and what you are. You need
not be intimidated by lots of bills to pay, diapers to change, food to cook,
or papers to be filed. Fundamentally, in spite of all those responsibilities,
@@ -42300,14 +42301,14 @@ delight; in the fourth, freedom even from delight. Above these are the four
levels of the realm of formlessness, whose inhabitants have transcended form
altogether and have no bodies or forms at all. Here deities experience
successively even more subtle states of mind: the infinity of space, the
-infinity of consciousness, ânothing at all,â and neither perception nor
+infinity of consciousness, "nothing at all," and neither perception nor
nonperception.
These states can certainly appear enormously attractive from our human
point of view. In fact, they correspond to what many think religious practice
is all aboutâattaining some kind of heaven or some sort of tranquillity or
bliss. But from the Buddhist viewpoint, the sublimity even of these states is
-not a worthy ultimate goal. One may ask, âWhat can possibly be wrong with
-such attainments?â
+not a worthy ultimate goal. One may ask, "What can possibly be wrong with
+such attainments?"
It is important to remember that the divine states of the desire realm,
the form realm, and the formless realm, like all the other states known in the
other five realms, are still part of samsara and subject to karma,
@@ -42328,7 +42329,7 @@ rice plants and wild grasses on both sides, putting each foot down on the
earth in mindfulness, knowing that I walk on the wondrous earth. In such
moments, existence is a miraculous and mysterious reality. People usually
consider walking on water or in thin air a miracle. But I think the real
-miracle is to walk on earth... a miracle we donât even recognize."
+miracle is to walk on earth... a miracle we don't even recognize."
-- from Jan Chozen Bays, MD, "How to Train a Wild Elephant & Other Adventures
in Mindfulness", published by Shambhala Publications
~
@@ -42345,10 +42346,10 @@ Tuvaá¹aka Sutta: The Discourse on Being Quick
(The Buddha said,)
"Let them completely destroy the root
Of conceptual differentiation,
-That is, [the idea] âI am the thinker.â
+That is, [the idea] 'I am the thinker.'
Ever mindful, they train to subdue their cravings.
-"They shouldnât get entrenched in any teachings they know
+"They shouldn't get entrenched in any teachings they know
Whether their own or that of others.
Good people say that
Being entrenched is not release.
@@ -42356,9 +42357,9 @@ Being entrenched is not release.
"They would not, because of this, think themselves
Better, worse, or equal [to others].
Experiencing many things,
-They donât take a stand in thoughts of themselves."
+They don't take a stand in thoughts of themselves."
- The Buddhaâs first teachings in this poem are particularly important.
+ The Buddha's first teachings in this poem are particularly important.
Here he emphasizes the destruction of the root source for conceptual
proliferation which he describes as being either the idea "I am the
thinker" or the thought "I am." While the grammar of the Pali phrase
@@ -42447,24 +42448,6 @@ five strengths are practiced:
the strength of wisdom awareness.
-- Gampopa, in "The Jewel Ornament of Liberation", published by Shambhala
Publications
-~
- Your eggnog to rum ratio should be 23% to 77%. I would then spice the
-eggnog with nutmeg and use more than you're comfortable with because sailors
-used to use it as [a] hallucinogen...
- Also, enter on a reindeer. And if you enter on a reindeer, stay on the
-reindeer. And if you canât reach something because youâre too high up
-sitting on the reindeer, just ask for help. That goes for life, too. Donât
-be afraid to ask for help and stay on that reindeer.
- -- T.J. Millerâs recipe for the perfect holiday party
-~
-if you can't beat them, join them, and subvert them from the inside.
- -- fred t. hamster
-~
-regarding christmas cards...
-"i would create my own as a desktop publishing activity, with all new current
-stuff. but it's way too much effort. basically, i can either give you a
-present or make you a card. which do you prefer?"
- -- thus spake slackathustra.
~
III. Path of Insight
@@ -42489,4 +42472,549 @@ of the branches of enlightenment:
the perfect equanimity branch.
-- The Jewel Ornament of Liberation, by Gampopa, published by Shambhala
Publications
+~
+IV. Path of Meditation
+
+The path of meditation practice begins after the realization of special
+insight. It has two paths:
+ A. the path of worldly meditation practice and
+ B. the path of meditation practice beyond the world.
+A.
+ Worldly Meditation Practice consists of the first, second, third, and
+fourth meditative stages, and the formless stages of increasing the infinite
+nature of space, increasing the infinity of consciousness, increasing the
+nothing-whatsoever-ness, and increasing neither perception nor non-perception.
+There are three purposes to practicing this meditation:
+
++ suppressing the afflicting emotions which are the subject of
+abandonment in the path of meditation;
++ establishing the special qualities of the Four Immeasurables and so
+forth; and
++ creating the foundation for the path beyond the world.
+
+B.
+ Meditation Practice Beyond the World consists of the furthering of calm
+abiding and special insight, focused on the two types of wisdom. During the
+path of insight there were two "patient acceptances" and two
+"awarenesses" corresponding to each of the Four Noble Truths, making a
+total of sixteen. The eight patient acceptances were completed in the path of
+insight. One becomes familiarized with the eight awarenesses in the path of
+meditation through the calm abiding and special insight related to the four
+meditative concentrations and three of the formless absorptions. Furthermore,
+part of the awareness of phenomena is to familiarize oneself with all the
+realization of dharma-as-such. Part of the continuity awareness is to
+familiarize oneself with all the realization of primordial wisdom. The state
+of neither perception nor non-perception is merely worldly meditation because
+the movement of sensation is so unclear.
+ Why is this called the path of meditation? Because there, one becomes
+familiar with the realizations that one achieved in the path of insight. At
+this stage, there are eight of the thirty-seven branches of enlightenment:
+
++ perfect view,
++ perfect conception, perfect speech, perfect action,
++ perfect livelihood,
++ perfect effort,
++ perfect mindfulness, and
++ perfect absorption.
+ -- Gampopa, from "The Jewel Ornament of Liberation", published by Shambhala
+Publications
+~
+ Your eggnog to rum ratio should be 23% to 77%. I would then spice the
+eggnog with nutmeg and use more than you're comfortable with because sailors
+used to use it as [a] hallucinogen...
+ Also, enter on a reindeer. And if you enter on a reindeer, stay on the
+reindeer. And if you can't reach something because you're too high up
+sitting on the reindeer, just ask for help. That goes for life, too. Don't
+be afraid to ask for help and stay on that reindeer.
+ -- T.J. Miller's recipe for the perfect holiday party
+~
+if you can't beat them, join them, and subvert them from the inside.
+ -- fred t. hamster
+~
+regarding christmas cards...
+"i would create my own as a desktop publishing activity, with all new current
+stuff. but it's way too much effort. basically, i can either give you a
+present or make you a card. which do you prefer?"
+ -- thus spake slackathustra.
+~
+Hope is not a strategy.
+Luck is not a factor.
+Fear is not an option.
+ -- James Cameron
+~
+A man is the sum of his actions, of what he has done, of what he can do,
+nothing else.
+ -- John Galsworthy
+~
+The Order of the Four Noble Truths
+
+We do analytical meditation to understand the various unsatisfactory
+conditions or sufferings of cyclic existence. When we gain an experience of
+them, we then place our mind firmly on that experience using stabilizing
+meditation. The more we meditate on suffering, the more we are motivated to
+rid ourselves of it. We will want to find out its causes and cease creating
+them. Thus, after contemplating true suffering, we contemplate true origin.
+Investigating this, we will see that suffering arises from karma, which is
+produced in dependence on the disturbing attitudes. These in turn are rooted
+in self-grasping ignorance. We will want to eliminate this ignorance, and
+will see that because it is a faulty attitude or misconception, it can be
+eliminated. Thus we will be certain that we can attain the true cessation of
+suffering and its origin. Through further contemplating the four noble
+truths, we will recognize that the way to abandon self-grasping ignorance is
+to meditate on the true path, since this path is principally the wisdom
+realizing the non-existence of the self that is adhered to by ignorance. This
+is the order in which the four noble truths unfold in meditation and thus is
+the order in which to practice them. So, although the actual order in which
+the four occur is first the causes and then the effects, when the Buddha
+taught for the purpose of practice, he explained the results first.
+ -- Geshe Jampa Tegchok, "Transforming Adversity Into Joy and Courage: An
+ Explanation of the Thirty-Seven Practices of Bodhisattvas", published by
+ Shambhala Publications
+~
+Take Refuge in the Buddha
+ We live in an ocean of cyclic existence whose depth and extent cannot be
+measured. We are troubled again and again by the afflictions of desire and
+hatred as if repeatedly attacked by sharks.
+ Our mental and physical aggregates are impelled by former contaminated
+actions and afflictions and serve as a basis for present suffering as well as
+inducing future suffering. While such cyclic existence lasts, we have various
+thoughts of pleasure and displeasure: "If I do this, what will people think?
+If I do not do this, I will be too late; I won't make any profit." When we
+see something pleasant we think, "Oh, if I could only have that!" We see
+that others are prosperous, and we generate jealousy, unable to bear their
+prosperity. We see an attractive man or woman, and we want a relationship.
+We are not satisfied with a passing relationship but want it to last forever.
+And then, once staying together with that person, we desire someone else.
+When we see someone we do not like, we become angry and quarrel after a single
+word; we feel we cannot remain even for an hour near this hated person but
+must leave immediately. Day and night, night and day we spend our lives in
+the company of the afflictions, generating desire for the pleasant and anger
+at the unpleasant, and continue thus even when dreaming, unable to remain
+relaxed, our minds completely and utterly mixed with thoughts of desire and
+hatred without interruption.
+ Only a Buddha has extinguished all defects and gained all attainments.
+Therefore, one should mentally go for refuge to a Buddha, praise him or her
+with speech, and respect him or her physically. One should enter the teaching
+of such a being.
+ -- from "The Essence of Tantra," by the Dalai Lama, in The Great Exposition
+ of the Secret Mantra, Volume I: Tantra in Tibet by Tsongkhapa, published
+ by Shambhala Publications
+~
+V. Path of Perfection
+
+ After the vajra-like absorption, one actualizes the nature of awareness,
+the awareness of exhaustion, and awareness of the unborn. The vajra-like
+absorption is the state at the edge of the path of meditation and is included
+in the preparation and unobstructed stages. This absorption is called
+"vajra-like" because it is unobstructed, hard, stable, of one taste, and
+all-pervasive.
+ "Unobstructed" means that it cannot be affected by the action of the
+world. "Hard" means it cannot be destroyed by obscurations. "Stable"
+means it cannot be shaken by discursive thoughts. "One taste" means
+everything is of one taste. "All pervasive" means that it observes the
+suchness of all knowledge.
+ The "awareness of the exhaustion of causes" that arises after this
+absorption is the primordial wisdom awareness that observes the Four Noble
+Truths by the power of the exhaustion of all causes. The "awareness of the
+unborn" is the primordial wisdom that observes the Four Noble Truths by the
+power of abandoning the result, suffering. In other words, this primordial
+wisdom clearly observes the exhaustion of the cause and non-production of the
+result and is called the "awareness of the exhaustion and non-production."
+ Why is this called the path of perfection? Because the training is
+perfected and one enters the city of nirvanaâthis is why it is called the
+path of perfection. At this stage, there are ten attainments of no-more-
+training: starting with perfect view of no-more-training through the perfect
+absorption of no-more-training and then the full liberation of no-more-
+training and the perfect primordial wisdom of no-more-trainingâthese ten
+attainments of no-more-training are included in the five unafflicted skandas:
+
+ perfect speech of no-more-training, perfect action, and perfect
+livelihood are in the heap of moral ethics;
+ perfect mindfulness of no-more-training and perfect absorption are in
+the heap of absorption;
+ perfect view of no-more-training, perfect conception, and perfect
+effort are in the heap of wisdom awareness;
+ perfect, full liberation is in the heap of full liberation;
+ perfect awareness is in the heap of seeing the primordial wisdom of
+full liberation.
+ -- Gampopa, from "The Jewel Ornament of Liberation", published by Shambhala
+ Publications
+~
+i try to think of 10,008 impossible things before breakfast,
+and i'm near ecstatic if any of those is worth writing down.
+ -- fred t. hamster
+~
+businesses or products mashed up with despots:
+- fidelity castro
+- mao zeding-dong
+- pol potstickers
+- donald trump
+~
+Relaxing in the midst of chaos,
+learning not to panic--this is the spiritual path.
+ -- Pema Chödrön, "When Things Fall Apart"
+~
+Driving all blames into oneself applies whenever we complain about anything,
+even that our coffee is cold or the bathroom is dirty. We may think that we
+are the voice of the world, that we are speaking on behalf of others, but we
+are simply speaking on behalf of ourselves. According to this slogan,
+everything is due to our own ego fixation, which makes us very vulnerable.
+Consequently, we provide an ideal target. We get hit, but nobody meant to hit
+us--we are actually inviting the bullets.
+ -- Chögyam Trungpa, "The Profound Treasury of the Ocean of Dharma: The
+ Bodhisattva Path of Wisdom and Compassion", published by Shambhala
+ Publications
+~
+I skate to where the puck is going to be, not where it has been.
+â --âWayne Gretzky
+~
+Aren't surveys inherently biased, because they only include people who are
+willing to be surveyed? What about people who value their time?
+ -- fred t. hamster
+~
+if throwing your dirty clothes at the hamper causes an avalanche,
+then it's time to do the laundry. #NoteToSelf
+ -- fred t. hamster
+~
+stoner marxism:
+"from each according to his stash, to each according to his jones."
+ -- fred t. hamster
+~
+i learned everything i needed to know about the 2016 election cycle by
+listening to devo in the 70s. "We're pinheads now. We are not whole."
+ -- fred t. hamster
+~
+"i made a sample with my organ!"
+"that's disgusting!"
+"an electronic organ, dork."
+"oh, i get it."
+"i sampled the sound of orgasm."
+"gahh!"
+ -- fred t. hamster
+~
+"the universe is flat in all directions" is what an infinitely dimensional
+person might say as she perceives all realities simultaneously.
+ -- fred t. hamster
+~
+Out of ten soldiers who are perfect in drill and the manual of arms, only one
+knows the purpose of the sights on his gun or can hit the broad side of a barn.
+ -- General Burnside, of his civil war recruits
+~
+music is the balm that soothes.
+anger is the bomb that kills.
+so don't listen to your anger if you want to feel right about life.
+ -- fred t. hamster
+~
+don't torture yourself with overblown expectations of how much you can
+accomplish. stretch goals are fine, "burst" goals are not.
+ -- fred t. hamster
+~
+In the gap between two thoughts,
+Thought-free wakefulness manifests unceasingly.
+ -- Milarepa
+~
+After Yeshe Tsogyal had helped countless beings in Tibet with her body,
+speech, and mind, the naga Nanda made offerings and with tears in his eyes he
+sang to her:
+
+ Kyema!
+ Guru, mother, Yeshe Tsogyal,
+ Key to the mysteries of Padmasambhava,
+ With mercy taking up the pains of others.
+
+ Free from concepts,
+ "Clean" and "unclean" have no hold on you.
+ Eager for the benefit of others,
+ You bury underground all love of self,
+ Mistress holder of the Teachings,
+ Mother of Victorious Ones, I bow to you.
+
+ -- Excerpted from: "Lady of the Lotus-Born: The Life and Enlightenment of
+ Yeshe Tsogyal" (translated by the Padmakara Translation Group), published
+ by Shambhala Publications
+~
+The mind captivated by a state of craving has no clue as to what pain and
+pleasure really are. When we hanker after objects, do we experience peace and
+bliss? Are we in control? Do we feel at ease? Or do we feel restless?
+Stressed and worried? Insecure and desperate? The slippery thing about
+attachment is that, in our bewilderment, we can't tell the difference
+between pleasure and pain, love and desire, happiness and sorrow. The craving
+mind can mistake anything for pleasure--even pain! It's like an addiction.
+ -- Dzigar Kongtrül, "Light Comes Through: Buddhist Teachings on Awakening
+ to Our Natural Intelligence", published by Shambhala Publications
+~
+The path of dharma, its fruit, and everything included within great gnosis,
+too, are nothing more than the realization of the significance of the
+nonduality of phenomena. At this point, there is attainment of the signs of
+cultivating bodhicitta. When realized in this manner, there is no need for
+training on a multitude of paths. Therefore, the unmistaken path is simply
+the realization of the nature of one's own mind just as it is.
+ -- Rongzom Chökyi Zangpo's treatise on Dzogchen as the culmination of the
+ MahÄyÄna, Entering the way of the Great Vehicle, translated by Dominic
+ Sur, 2017, published by Shambhala Publications
+~
+Lineage is not like a baton that one person passes to another person and then
+to another, leaving the ones behind empty-handed. It's like the flame of a
+lamp. If you light one lamp and then keep lighting more lamps, the first lamp
+still has the flame. There are no distinctions. There is a continuum.
+ -- Dzongsar Jamyang Khyentse, from "The Guru Drinks Bourbon?", published by
+ Shambhala Publications
+~
+A computer lets you make more mistakes faster than any other invention with
+the possible exceptions of handguns and Tequila.
+ -- Mitch Ratcliffe
+~
+Even with realization, if you do not directly cut through, it is like tossing
+out a tempered sharp weapon: the view will not protect you, and you are bound
+by fear. The yoga that brings together view and conduct is like the weapons
+carried by warriors that vanquish all the enemy hosts.
+ -- Machik Lapdrön, "Chöd: The Sacred Teachings on Severence", by Jamgön
+ Kongtrul Lodrö Taye, translated by Sarah Harding, published by Shambhala
+ Publications
+~
+The system of two truths is propounded solely for didactic purposes, as an
+entry to the path. On the ultimate level, the division into two truths has no
+place. There is only the inconceivable dharmadhÄtu, pure suchness, the
+ultimate mode of being. As it is written in the sutra,
+
+ There is but one truth: absence of all origin,
+ Yet some will crow about there being four.
+ But in the essence of enlightenment,
+ Not one is foundâwhy speak of four?
+
+But whereas on the ultimate level, the two truths are not posited, on the
+relative level, they are. For there is certainly a difference between the way
+things are and the way they appear. As was said earlier, "These the two
+truths are declared to be."
+ -- The Wisdom Chapter: Jamgön Miphamâs Commentary on the Ninth Chapter of
+ The Way of the Bodhisattva, translated by the Padmakara Translation
+ Group, published by Shambhala Publications
+~
+ People who embark upon the path of the Mahayana, the supreme path of
+beings of great scope leading to omniscience, should try to acquire four
+circumstances. They should (1) live in solitude, in a place that has all the
+necessary conditions and is in harmony with the Dharma. They should (2)
+frequent a teacher who is learned in the Tripitaka and steeped in the practice
+of the three trainings. By doing this, they will avoid the inferior attitudes
+of ordinary folk as well as the wrong behavior that leads to suffering, and
+they will acquire all the good qualities deriving from the Dharma of
+transmission and realization. They should in addition (3) nourish an intense
+wish to practice in accordance with the teaching expounded by their master and
+should (4) zealously adopt the supreme protection afforded by the merit
+accumulated in their past and present existences. The venerable Nagarjuna
+refers to these four conditions as the ââfour wheels,ââ the idea being
+that, just as someone riding in a (horse-drawn) chariot can cover in a short
+time a distance that would take many days for a cow or ox, a Bodhisattva
+taking advantage of these four conditions will progress speedily toward
+omniscience. Nagarjuna refers to them in his Suhrllekha when he says:
+
+ Your dwelling place befits the task,
+ You keep the company of holy beings.
+ With highest aspirations and a store of merit,
+ You have indeed the ââfour wheelsââ all complete.
+
+ -- from "Treasury of Precious Qualities, Book One: Sutra Teachings", by
+ Jigme Lingpa, translated by the Padmakara Translation Group, published
+ by Shambhala Publications
+~
+
+ We are far removed from eighth-century Tibet, where we meet her, but
+Yeshé Tsogyal continues to be present and available. She lives outside
+linear time, but visits it: her limitless emanations form a bridge from her
+lifetime to the present. She promised to remain accessible to any spiritual
+seeker wishing to follow her lead. In her own words,
+
+ And so, from now until the scouring of samsara,
+ My stream of emanations, primary and secondary,
+ Will flow unceasing.
+ Especially to those who in the future meditate
+ Upon the subtle veins and energies,
+ Iâll show myself--at best directly,
+ Else in visions, or at least in dreams,
+ Appearing as a common person, or as the secret consort.
+ I shall clear the obstacles of those who keep samaya,
+ Bringing progress to their practice,
+ Helping to attain with speed the blissful warmth and thence
+ accomplishment.
+
+ As promised, she continuously appears to lead and inspire the faithful in
+dreams, visions, and real life. As well, her human reincarnations ceaselessly
+return to the world, guiding others in whatever capacity is needed.
+ -- from "The Life and Visions of Yeshé Tsogyal", by Drimé Kunga and Yeshé
+ Tsogyal Translated by Chönyi Drolma, published by Shambhala Publications
+~
+ It is impossible to conceive how many beings, from beginningless time in
+samsara, have been related to us--as parents, as enemies, or as people
+indifferent to us. In fact, all beings have been linked to us in these three
+ways innumerable times. When they were our enemies, they injured us; when
+they were our parents or our friends, they cherished and aided us; when they
+were neither, they ignored us. It would be impossible to calculate the number
+of relationships that we have experienced. Once when the noble Katyayana went
+begging for alms, he came across a group of people and, perceiving the karmic
+links that bound them together, commented:
+
+ He strikes his mother, eats his fatherâs flesh;
+ His hated foe he dandles on his lap.
+ Here is a wife that sucks her husbandâs bones--
+ At this samsara how can I not laugh?
+
+ -- from "Treasury of Precious Qualities, Book One: Sutra Teachings", by
+ Jigme Lingpa, translated by the Padmakara Translation Group, published
+ by Shambhala Publications
+~
+ When the actual process of dying begins, you pass through eight phases--
+the first four involve the collapse of the four elements, and the last four
+involve the collapse of consciousness into the innermost level of mind, called
+the mind of clear light.
+ In the final phase of dying, when all coarse consciousnesses dissolve into
+the all-empty, which is the fundamental innate mind of clear light, the myriad
+objects of the world, as well as concepts such as sameness and difference, are
+pacified in this subtlest mind. At that time, all appearances of environments
+and beings withdraw of their own accord. Even for a nonpractitioner, coarse
+appearances also withdraw; this withdrawal of conventional appearances,
+however, is not due to a perception of reality attained through meditation.
+When, in the last phase, the temporary winds that carry consciousness have all
+dissolved, the mind (whether of a practitioner or a nonpractitioner) becomes
+as if undifferentiated, and an immaculate openness dawns.
+ -- H.H. the Dalai Lama, from "The Heart of Meditation", translated and
+ edited by Jeffrey Hopkins, published by Shambhala Publications
+~
+ Thereâs a common misunderstanding among all the human beings who have
+ever been born on the earth that the best way to live is to try to avoid pain
+and just try to get comfortable. You can see this even in insects and animals
+and birds.
+ A much more interesting, kind, adventurous, and joyful approach to life is
+to begin to develop our curiosity, not caring whether the object of our
+inquisitiveness is bitter or sweet.
+ When people start to meditate or to work with any kind of spiritual
+discipline, they often think that somehow theyâre going to improve, which is
+a sort of subtle aggression against who they really are. Itâs a bit
+like saying, âIf I jog, Iâll be a much better person.â Or the scenario
+may be that they find fault with others; they might say, âIf it werenât
+for my husband, Iâd have a perfect marriage.â And âIf it werenât for
+my mind, my meditation would be excellent.â
+ But loving-kindness--maitri--toward ourselves doesnât mean getting rid
+of anything. Maitri means that we can still be crazy after all these years.
+We can still be angry after all these years. We can still be timid or jealous
+or full of feelings of unworthiness. Meditation practice isnât about trying
+to throw ourselves away and become something better. Itâs about befriending
+who we are already.
+ Perhaps we will experience what is traditionally described as the fruition
+of maitri--playfulness...
+ -- Pema Chödrön, from "Awakening Loving-Kindness", published by Shambhala
+ Publications
+~
+ In texts we inherited from India, the basic principle is sometimes called
+the âfundamental innate mind of clear lightâ and the âfundamental innate
+wisdom of clear lightââ these two terms having the same meaning. In other
+texts, it is called the âspace-diamond pervading space,â whereas in even
+others it is called the âjewel mind,â as, for example, when it is said,
+âSeparate from the jewel mind, there is no buddha and no sentient being.â
+ Then, in Tibet, in some texts, it is called âordinary consciousnessâ
+and âinnermost awareness.â These terms are used in the context of speaking
+about freedom from thought, which is psychologically and experientially
+described as âself-release,â ânaked release,â and âunimpeded
+penetrationâ; we will be discussing these in detail later. The innermost
+awareness is said to be the basis of the appearance of all of the round of
+suffering (called âcyclic existenceâ) and also the basis of liberation
+(called ânirvanaâ). Everything, without exception, is complete in the
+continuum of innermost awareness. It is even said to be ânaturally arisen,â
+since it has always been and always will be.
+ -- H.H. the Dalai Lama, from "The Heart of Meditation", translated and
+ edited by Jeffrey Hopkins, published by Shambhala Publications
+~
+When phenomena are indeed seen to be devoid of true existence, great
+compassion will well up effortlessly, a compassion that will never abandon
+living beings who circle in samsara through their clinging to true existence.
+For as it has been taught, it is in the nature of things that such an attitude
+is born.
+ -- from "The Wisdom Chapter: Jamgön Miphamâs Commentary on the Ninth
+ Chapter of The Way of the Bodhisattva", published by Shambhala
+ Publications
+~
+When resting evenly in meditation with the points of body,
+If appearances cease and you are without thoughts,
+These are the doings of a lethargic shamatha.
+But when you rouse yourself with mindfulness,
+Itâs like a candle, self-luminous and shining bright,
+Or like a flower thatâs naturally vivid and clear.
+Like looking with your eyes at the glow of the sky,
+Awareness-emptiness is naked, open, and clear.
+
+That nonconceptuality thatâs luminous and clear
+Is the arising of the shamatha experience.
+On the basis of that meditative experience,
+While supplicating the precious jewels,
+Gain certainty by studying and contemplating the dharma.
+Take the vipashyana that brings the understanding of no self
+And tie the sturdy rope of shamatha to that.
+Then that strong noble being with love and compassion
+Through the mighty strength of rousing bodhichitta to benefit others,
+Having been lifted up with a pure aspiration
+To the completely pure path of seeing,
+There, vipashyana directly realizes the purity that cannot be seen
+And then the faults of mindâs hopes and fears will be known.
+Without going anywhere, youâll arrive at the Buddhaâs ground.
+Without looking at anything, youâll see dharmakaya.
+Without achieving anything, your aim will be spontaneously accomplished.
+ -- from "The Hundred Thousand Songs of Milarepa", By Tsangnyon Heruka,
+ Translated by Christopher Stagg, published by Shambhala Publications
+~
+Trying to find the pain in life is the renunciation of hinayana. Trying to
+find the ambition in life, trying to reach higher goals, is the
+bodhisattvaâs ambition in the mahayana. Trying to find the subtleties of
+life is the tantric discovery of mystical experience in the vajrayana. Â
+ -- Milarepa, from "Milarepa: Lessons from the Life and Songs of Tibetâs
+ Great Yogi", by Chögyam Trungpa, published by Shambhala Publications
+~
+The root of our current unsatisfactory condition in a cycle of death and
+rebirth is our innate tendency to view the personal self in a reified manner
+(LRCM: 574). We also have innate tendencies to view all other phenomena in a
+reified manner. To achieve wisdom, or to know emptiness, means to overcome
+this reifying view, to realize that the self or essential being as thus
+conceived does not exist at all. In order reach this realization, according
+to Tsong kha pa, one must use reason to refute the existence, and to prove the
+nonexistence, of this reified self or essence. Having intellectually arrived
+at the correct philosophical viewâthat the self lacks a shred of intrinsic
+natureâone proceeds along the path to spiritual liberation through intense,
+deep, and extensive meditative familiarization with this view. At the same
+time, however, the practitioner also cultivates compassionate engagement with
+other living beings, making a commitment to help all of them reach perfect
+happiness.
+ -- from "Ask a Farmer: Ultimate Analysis and Conventional Existence in
+ Tsong kha paâs Lam rim chen mo", by Guy Newland from Changing Minds:
+ Contributions to the Study of Buddhism and Tibet in Honor of Jeffrey
+ Hopkins, edited by Guy Newland, published by Shambhala Publications
+~
+inexplicably ted was awoken,
+incredibly loud noise of the broken,
+his cat invaded the stash,
+seeking out some tasty hash,
+sis boom *bong* goes crash--ted won't be tokin'.
+ -- fred t. hamster
+~
+shania the stony gal really dug her twerkin',
+slingin' her booty all around was really workin',
+but the other dancers looked askance,
+and asked "can this chick actually dance?",
+shania wasn't so much dancin' as berzerkin'!
+ -- fred t. hamster
+~
+ All art is composed of subtle and gross elements. There is no way for
+artists to express without elements. When people use expressions such as hot-
+headed, cold-hearted, dry-humored, or all wet, it shows that they naturally
+connect subtle element temperaments with gross element expressions. But
+artists must go beyond outwardly expressing the elements in an obvious way in
+order to gain experience with the inner subtle elements, which are the source
+of the outer gross elements. Then they can make art which reflects what
+people need.
+ According to the Buddhist point of view, an artistâs intention is
+compassion. Buddhist artists create in order to make a link with other beings
+through their inner pure elements, and to transform their outer ordinary gross
+elements into enlightenment by means of that connection. Â
+ -- Thinley Norbu, from "Magic Dance: The Display of the Self-Nature of the
+ Five Wisdom Dakinis", published by Shambhala Publications
+~
+Never admit defeat. Just move the front.
+ -- fred t. hamster
diff --git a/infobase/pictures/cake_icon/cakephp-logo-for_website.xcf b/infobase/pictures/cake_icon/cakephp-logo-for_website.xcf
new file mode 100644
index 00000000..c889c132
Binary files /dev/null and b/infobase/pictures/cake_icon/cakephp-logo-for_website.xcf differ
diff --git a/infobase/pictures/cake_icon/favicon.ico b/infobase/pictures/cake_icon/favicon.ico
new file mode 100644
index 00000000..39eaf912
Binary files /dev/null and b/infobase/pictures/cake_icon/favicon.ico differ
diff --git a/kona/.classpath b/kona/.classpath
index 18bf7466..310fd8d4 100644
--- a/kona/.classpath
+++ b/kona/.classpath
@@ -10,5 +10,9 @@
+
+
+
+
diff --git a/kona/lib/SizeOf.jar b/kona/lib/SizeOf.jar
new file mode 100644
index 00000000..34641d2d
Binary files /dev/null and b/kona/lib/SizeOf.jar differ
diff --git a/kona/lib/commons-compress-1.8.1.jar b/kona/lib/commons-compress-1.8.1.jar
new file mode 100644
index 00000000..66b0a56b
Binary files /dev/null and b/kona/lib/commons-compress-1.8.1.jar differ
diff --git a/kona/lib/commons-io-2.4.jar b/kona/lib/commons-io-2.4.jar
new file mode 100644
index 00000000..90035a4f
Binary files /dev/null and b/kona/lib/commons-io-2.4.jar differ
diff --git a/kona/lib/commons-lang3-3.5.jar b/kona/lib/commons-lang3-3.5.jar
new file mode 100644
index 00000000..6328c8de
Binary files /dev/null and b/kona/lib/commons-lang3-3.5.jar differ
diff --git a/kona/src/org/feistymeow/algorithms/BinarySearchTree.java b/kona/src/org/feistymeow/algorithms/BinarySearchTree.java
new file mode 100644
index 00000000..07cb3e6b
--- /dev/null
+++ b/kona/src/org/feistymeow/algorithms/BinarySearchTree.java
@@ -0,0 +1,170 @@
+package org.feistymeow.algorithms;
+
+
+//hmmm: move to better folder path.
+
+// inspired by http://pages.cs.wisc.edu/~cs367-1/readings/Binary-Search-Trees/
+
+/**
+ * The type of node held in our binary search tree.
+ */
+class TreeNode
+{
+ private K key;
+ private V value;
+ private TreeNode left, right;
+
+ public TreeNode(K key, V value, TreeNode left, TreeNode right) {
+ this.key = key;
+ this.value = value;
+ this.left = left;
+ this.right = right;
+ }
+
+ public K getKey() { return key; }
+ public V getValue() { return value; }
+
+
+ public TreeNode getLeft() { return left; }
+ public TreeNode getRight() { return right; }
+
+ public void setKey(K newK) { key = newK; }
+ public void setLeft(TreeNode newL) { left = newL; }
+ public void setRight(TreeNode newR) { right = newR; }
+
+ public void setValue(V newV) { value = newV; }
+}
+
+class DuplicateException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+ DuplicateException() {}
+}
+
+/**
+ * A binary search tree implementation.
+ *
+ * Insert, Delete and Search are done in O(n log(n)) time.
+ */
+public class BinarySearchTree, V>
+{
+ private TreeNode root; // ptr to the root of the BinarySearchTree
+
+ public BinarySearchTree() { root = null; }
+
+
+ // add key and associated value to this BinarySearchTree;
+ // error if key is already there
+ public void insert(K key, V value) throws DuplicateException {
+ root = insert(root, value, key);
+ }
+
+ private TreeNode insert(TreeNode n, V value, K key) throws DuplicateException {
+ if (n == null) {
+ return new TreeNode(key, value, null, null);
+ }
+
+ if (n.getKey().equals(key)) {
+ throw new DuplicateException();
+ }
+
+ if (key.compareTo(n.getKey()) < 0) {
+ // add key to the left subtree
+ n.setLeft( insert(n.getLeft(), value, key) );
+ return n;
+ }
+
+ else {
+ // add key to the right subtree
+ n.setRight( insert(n.getRight(), value, key) );
+ return n;
+ }
+ }
+
+ // remove the node containing key from this BinarySearchTree if it is there;
+ // otherwise, do nothing
+ public void delete(K key) {
+ root = delete(root, key);
+ }
+
+
+ private K smallest(TreeNode n)
+ // precondition: n is not null
+ // postcondition: return the smallest value in the subtree rooted at n
+
+ {
+ if (n.getLeft() == null) {
+ return n.getKey();
+ } else {
+ return smallest(n.getLeft());
+ }
+ }
+
+ private TreeNode delete(TreeNode n, K key)
+ {
+ if (n == null) {
+ return null;
+ }
+
+ if (key.equals(n.getKey())) {
+
+ if (n.getLeft() == null && n.getRight() == null) {
+ return null;
+ }
+ if (n.getLeft() == null) {
+ return n.getRight();
+ }
+ if (n.getRight() == null) {
+ return n.getLeft();
+ }
+
+ // if we get here, then n has 2 children
+ K smallVal = smallest(n.getRight());
+ n.setKey(smallVal);
+ n.setRight( delete(n.getRight(), smallVal) );
+ return n;
+ }
+
+ else if (key.compareTo(n.getKey()) < 0) {
+ n.setLeft( delete(n.getLeft(), key) );
+ return n;
+ }
+
+ else {
+ n.setRight( delete(n.getRight(), key) );
+ return n;
+ }
+ }
+
+
+ // if key is in this BinarySearchTree, return its associated value; otherwise, return null
+ public boolean lookup(K key) {
+ return lookup(root, key);
+ }
+
+ private boolean lookup(TreeNode n, K key) {
+ if (n == null) {
+ return false;
+ }
+
+ if (n.getKey().equals(key)) {
+ return true;
+ }
+
+ if (key.compareTo(n.getKey()) < 0) {
+ // key < this node's key; look in left subtree
+ return lookup(n.getLeft(), key);
+ }
+
+ else {
+ // key > this node's key; look in right subtree
+ return lookup(n.getRight(), key);
+ }
+ }
+
+// // print the values in this BinarySearchTree in sorted order (to p)
+// public void print(PrintStream p) {
+//
+// }
+}
+
diff --git a/kona/src/org/feistymeow/algorithms/RectangleIntersector.java b/kona/src/org/feistymeow/algorithms/RectangleIntersector.java
new file mode 100644
index 00000000..e177621f
--- /dev/null
+++ b/kona/src/org/feistymeow/algorithms/RectangleIntersector.java
@@ -0,0 +1,205 @@
+package org.feistymeow.algorithms;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Vector;
+
+import org.feistymeow.algorithms.RectangleIntersector.SortedElement;
+import org.feistymeow.algorithms.RectangleIntersector.SortedElementComparator;
+
+/**
+ * reports if any two rectangles in a list intersect. uses screen coordinates.
+ */
+public class RectangleIntersector
+{
+ public RectangleIntersector()
+ {
+
+ }
+
+ public static class Point
+ {
+ Point(double x, double y)
+ {
+ this.x = x;
+ this.y = y;
+ }
+
+ double x, y;
+ }
+
+ public static class Rectangle
+ {
+ Rectangle(Point ul, Point lr)
+ {
+ this.ul = ul;
+ this.lr = lr;
+ }
+
+ Point ul, lr;
+ }
+
+ public static boolean doesPointOverlap(Point p, Rectangle r)
+ {
+ return p.x <= r.lr.x && p.x >= r.ul.x && p.y <= r.lr.y && p.y >= r.ul.y;
+ }
+
+ public static boolean doRectanglesOverlap(Rectangle r1, Rectangle r2)
+ {
+ return doesPointOverlap(r1.ul, r2) || doesPointOverlap(r1.lr, r2) || doesPointOverlap(r2.ul, r1) || doesPointOverlap(r2.lr, r1);
+ }
+
+ /**
+ * find any overlapping pair of rectangles in the list provided.
+ */
+ public static Vector findOverlapBruteForce(Vector list)
+ {
+ // terrible brute force algorithm below.
+ for (int i = 0; i < list.size(); i++) {
+ for (int j = i; j < list.size(); j++) {
+ if (doRectanglesOverlap(list.get(i), list.get(j))) {
+ ArrayList toReturn = new ArrayList();
+ toReturn.add(list.get(i));
+ toReturn.add(list.get(j));
+ }
+ }
+ }
+ return null;
+ }
+
+ public static class SortedElement
+ {
+ double value; // the key.
+ boolean lowerEdge; // is this the left side?
+ Rectangle source; // where did this value come from.
+
+ public SortedElement(double value, boolean lowerEdge, Rectangle source)
+ {
+ this.value = value;
+ this.lowerEdge = lowerEdge;
+ this.source = source;
+ }
+ }
+
+ public static class SortedElementComparator implements Comparator
+ {
+ @Override
+ public int compare(SortedElement k1, SortedElement k2)
+ {
+ SortedElementKey key1 = new SortedElementKey(k1.value);
+ return key1.compareTo(new SortedElementKey(k2.value));
+ }
+
+ Double value;
+ }
+
+ public static class SortedElementKey implements Comparable
+ {
+ public SortedElementKey(double key)
+ {
+ this.key = key;
+ }
+
+ @Override
+ public int compareTo(SortedElementKey k2)
+ {
+ return (key == k2.key) ? 0 : (key < k2.key) ? -1 : 1;
+ }
+
+ double key;
+ }
+
+ /**
+ * find any overlapping pair of rectangles in the list provided.
+ *
+ * this is classed as a good answer... if it works.
+ */
+ public static Vector findOverlap(Vector list)
+ {
+ // first phase, produce a sorted list of the x coordinates of the rectangles.
+ // this completes in O(n log(n)) time.
+ ArrayList xEdges = new ArrayList();
+ for (Rectangle r : list) {
+ xEdges.add(new SortedElement(r.lr.x, true, r));
+ xEdges.add(new SortedElement(r.ul.x, false, r));
+ }
+ // we're assuming this is an efficient sort; i've heard rumors that it's a heapsort.
+ // if so we're good. if not, we'd write our own heapsort (see feisty meow nucleus sorts.h).
+ xEdges.sort(new SortedElementComparator());
+
+ // second phase, crawl across the sorted list and build up a binary search tree
+ // with the y coordinates from the rectangles. we will use this to check for
+ // intersections.
+ BinarySearchTree bst = new BinarySearchTree();
+
+ for (SortedElement scanner : xEdges) {
+ Rectangle source = scanner.source;
+ if (scanner.lowerEdge) {
+ // for x, this is the left edge.
+ // search for compatible top and bottom.
+
+//that means what? a value that is less than or equal the top and gte the bottom?
+//we can traverse the tree manually, looking for any in the range we want, but that means
+ //digging in and changing the bst to allow us to single step downwards, or some such.
+
+ //hmmm: POSTPONE. i want to do more things on the board, and this problem's gone WAY overtime.
+//hmmm: need to fix this implementation; it is bustard.
+
+
+ // we want to add the two y components of the rectangle to our tree.
+ bst.insert(new SortedElementKey(source.lr.y), new SortedElement(source.lr.y, true, source));
+ bst.insert(new SortedElementKey(source.ul.y), new SortedElement(source.ul.y, false, source));
+ } else {
+ // for x, this is the right edge.
+ // we will remove from the bst the two values for our top and bottom y.
+ bst.delete(new SortedElementKey(source.lr.y));
+ bst.delete(new SortedElementKey(source.ul.y));
+
+
+ }
+
+//what is missing?
+
+
+ }
+
+
+ return null;
+ }
+
+ public static void main(String[] argv)
+ {
+ Rectangle r1 = new Rectangle(new Point(0, 0), new Point(1, 1));
+ Rectangle r2 = new Rectangle(new Point(3, 2), new Point(4, 3));
+ Rectangle r3 = new Rectangle(new Point(2, 3), new Point(3, 4));
+ Rectangle r4 = new Rectangle(new Point(5, 6), new Point(7, 9));
+
+ Vector list1 = new Vector(Arrays.asList(r1, r2, r3));
+ Vector list2 = new Vector(Arrays.asList(r1, r2));
+ Vector list3 = new Vector(Arrays.asList(r1, r3, r4));
+
+ RectangleIntersector secto = new RectangleIntersector();
+
+ Vector answer1 = secto.findOverlap(list1);
+ Vector answer2 = secto.findOverlap(list2);
+ Vector answer3 = secto.findOverlap(list3);
+
+ if (answer1 == null) {
+ System.out.println("FAILURE: test 1 did not find intersection in list");
+ } else {
+ System.out.println("OKAY: test 1 found intersections " + answer1.get(0) + " " + answer1.get(1));
+ }
+ if (answer2 != null) {
+ System.out.println("FAILURE: test 2 found an intersection in list that has none");
+ } else {
+ System.out.println("OKAY: test 2 no intersections found");
+ }
+ if (answer3 != null) {
+ System.out.println("FAILURE: test 3 found an intersection in list that has none");
+ } else {
+ System.out.println("OKAY: test 3 no intersections found");
+ }
+ }
+
+}
diff --git a/kona/src/org/feistymeow/algorithms/SubstringFinder.java b/kona/src/org/feistymeow/algorithms/SubstringFinder.java
new file mode 100644
index 00000000..4e568b67
--- /dev/null
+++ b/kona/src/org/feistymeow/algorithms/SubstringFinder.java
@@ -0,0 +1,76 @@
+package org.feistymeow.algorithms;
+
+/**
+ * used to find strings in other strings.
+ *
+ * part of google interview prep.
+ */
+
+public class SubstringFinder
+{
+
+ /**
+ * returns the position of 'x' in 'y', or returns a negative number.
+ */
+ public int findXinY(String x, String y)
+ {
+ if ((x == null) || (y == null))
+ return -1; // nulls are invalid to compare.
+ if (y.length() < x.length())
+ return -1; // x cannot be found in shorter string.
+ for (int yIter = x.length() - 1; yIter < y.length(); yIter++) {
+ boolean good = true;
+ /*
+ * xIter has to start at valid value in x, and that needs to be at end of x. board actually had uncorrected error here, where
+ * xIter started at yIter, which is really wrong.
+ */
+ // simplified xIter which was inducing all sorts of OBOBs. even though i found the end in yIter,
+ // i go forwards on xIter.
+ for (int xIter = 0; xIter < x.length(); xIter++) {
+ int yComparePosition = (yIter - x.length() + 1) + xIter;
+ if (x.charAt(xIter) != y.charAt(yComparePosition)) {
+ // System.out.println("no match -- y[" + yIter + "]=" + y.charAt(yPosn) + " x[" + xIter + "]=" + x.charAt(xIter));
+ good = false;
+ break;
+ }
+ }
+ if (good) {
+ int toReturn = yIter - x.length() + 1;
+ // System.out.println("found at position " +toReturn );
+ return toReturn;
+ }
+ }
+
+ return -1;
+ }
+
+ public static void main(String[] argv)
+ {
+ SubstringFinder sf = new SubstringFinder();
+
+ String x1 = "petunia";
+ String y1 = "sometimes my flowers are roses and sometimes they are petunias and sometimes they are turnips.";
+ if (sf.findXinY(x1, y1) != 54) {
+ System.out.println("FAILURE: did not find at right index for test 1");
+ } else {
+ System.out.println("OKAY: found substring at right index for test 1");
+ }
+
+ String x2 = "qn";
+ String y2 = "xaqno";
+ if (sf.findXinY(x2, y2) != 2) {
+ System.out.println("FAILURE: did not find at right index for test 2");
+ } else {
+ System.out.println("OKAY: found substring at right index for test 2");
+ }
+
+ String x3 = "qn";
+ String y3 = "xaqon";
+ if (sf.findXinY(x3, y3) >= 0) {
+ System.out.println("FAILURE: found non-existent string for test 3");
+ } else {
+ System.out.println("OKAY: did not find substring for test 3");
+ }
+
+ }
+}
diff --git a/kona/src/org/feistymeow/algorithms/SumFinder.java b/kona/src/org/feistymeow/algorithms/SumFinder.java
new file mode 100644
index 00000000..533880c0
--- /dev/null
+++ b/kona/src/org/feistymeow/algorithms/SumFinder.java
@@ -0,0 +1,83 @@
+package org.feistymeow.algorithms;
+
+import java.util.HashSet;
+
+/**
+ * example algorithms from google interview videos. these focus on finding a number as a sum within a list of numbers.
+ */
+class SumFinder
+{
+ /*
+ * spec notes:
+ *
+ * the numbers are ints, both positive and negative.
+ *
+ * don't worry about overflow for math ops involving the sum or list members.
+ *
+ * the input list is not necessarily sorted.
+ *
+ * the result is just a boolean of whether the requested sum was found or not. it would be easy enough to return a pair though, with the
+ * two numbers that added to the sum.
+ *
+ * this solution assumes that the list fits in memory.
+ */
+ boolean findSumInList(int sum, int list[])
+ {
+ HashSet wanting = new HashSet();
+ for (int curr : list) {
+ if (wanting.contains(curr)) {
+ // we found a match for the complement we had stored earlier, so return true.
+ return true;
+ }
+ wanting.add(sum - curr);
+ }
+ return false;
+ }
+
+ /*
+ * implement more general case also that can use any number of numbers in the set to sum?
+ *
+ * e.g. if the number itself equals the sum, fine and dandy. or if three numbers sum to it, that's also a match. this should return a set
+ * of all matches, where a match is a collection of ints that add to the sum.
+ */
+ // returning from this other method...
+ // return = new ArrayList(Arrays.asList(curr, sum - curr));
+
+ // test app for above methods...
+
+ public static void main(String argv[])
+ {
+ SumFinder finder = new SumFinder();
+
+ int list_1[] = { 7, 5, 8, 2, 9, 4, 1, 2 };
+ int sum_1 = 8;
+
+ if (!finder.findSumInList(sum_1, list_1)) {
+ System.out.println("FAILURE: ON TEST CASE 1");
+ } else {
+ System.out.println("OKAY: ON TEST CASE 1");
+ }
+
+ //////////////
+
+ int list_2[] = { 1, 9, 3, 2, 4, 4, 1 };
+ int sum_2 = 8;
+
+ if (!finder.findSumInList(sum_2, list_2)) {
+ System.out.println("FAILURE: ON TEST CASE 2");
+ } else {
+ System.out.println("OKAY: ON TEST CASE 2");
+ }
+
+ //////////////
+
+ int list_3[] = { 1, 9, 3, 2 };
+ int sum_3 = 8;
+
+ if (finder.findSumInList(sum_3, list_3)) {
+ System.out.println("FAILURE: ON TEST CASE 3");
+ } else {
+ System.out.println("OKAY: ON TEST CASE 3");
+ }
+ }
+}
diff --git a/kona/src/org/feistymeow/textual/SimpleDictionary.java b/kona/src/org/feistymeow/textual/SimpleDictionary.java
new file mode 100644
index 00000000..9008ac97
--- /dev/null
+++ b/kona/src/org/feistymeow/textual/SimpleDictionary.java
@@ -0,0 +1,49 @@
+package org.feistymeow.textual;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class SimpleDictionary extends HashSet
+// or alternatively, BinaryTree
+// => what is BST implem for java! is it balanced?
+{
+
+ private static final long serialVersionUID = 1L;
+
+ public SimpleDictionary(Set words)
+ {
+ addAll(words);
+ computeLongestWord();
+ }
+
+ public SimpleDictionary(String words[])
+ {
+ for (String word : words) {
+ add(word);
+ }
+ computeLongestWord();
+ }
+
+ public int computeLongestWord()
+ {
+ previouslyComputedLongestWord = 1;
+
+ // hmmm: iterate on set to find longest.
+
+ // kludge implem placeholder.
+ previouslyComputedLongestWord = 100;
+ return previouslyComputedLongestWord;
+ }
+
+ public boolean lookup(String toFind)
+ {
+ return contains(toFind);
+ }
+
+ public int longestWord()
+ {
+ return previouslyComputedLongestWord;
+ }
+
+ int previouslyComputedLongestWord;
+}
diff --git a/kona/src/org/feistymeow/textual/WordBreakFinder.java b/kona/src/org/feistymeow/textual/WordBreakFinder.java
new file mode 100644
index 00000000..17388a87
--- /dev/null
+++ b/kona/src/org/feistymeow/textual/WordBreakFinder.java
@@ -0,0 +1,73 @@
+package org.feistymeow.textual;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class WordBreakFinder
+{
+ public WordBreakFinder(SimpleDictionary lookups) {
+ _lookups = lookups;
+ }
+
+ public Set findStringsWithGoodSpacing(String orig) {
+ HashSet toReturn = new HashSet();
+ int startingChunk = Math.min(orig.length(), _lookups.longestWord());
+ for (int i = startingChunk; i >= 1; i--) {
+ String first = orig.substring(0, i);
+ if (!_lookups.lookup(first)) {
+ // fail fast. this length chunk of the word doesn't match.
+ continue;
+ }
+ String second = orig.substring(i, orig.length());
+ // first part of string is listed in dictionary. we can trivially add it if the other part is empty.
+ if (second.length() == 0) {
+ toReturn.add(first);
+ continue;
+ }
+ Set matches = findStringsWithGoodSpacing(second);
+ if (matches != null) {
+ for (String matched : matches) {
+ toReturn.add(first + " " + matched);
+ }
+ }
+ }
+ if (toReturn.isEmpty()) return null;
+ return toReturn;
+ }
+
+ SimpleDictionary _lookups;
+
+ public static void main(String argv[]) {
+ String smallWordList[] = {
+ "hops", "barley", "malt", "beer", "turnip"
+ };
+ SimpleDictionary lookups = new SimpleDictionary(smallWordList);
+ WordBreakFinder finder = new WordBreakFinder(lookups);
+
+ String toBreak = "maltbeerbeerturniphops";
+ Set matches = finder.findStringsWithGoodSpacing(toBreak);
+ if (matches != null) {
+ System.out.println("matches found:");
+ for (String match : matches) {
+ System.out.println(match);
+ }
+ } else {
+ System.out.println("ERROR: failed to find matches!");
+ }
+
+ toBreak = "maltbeerbeturniphops";
+ matches = finder.findStringsWithGoodSpacing(toBreak);
+ if (matches != null) {
+ System.out.println("ERROR: matches found:");
+ for (String match : matches) {
+ System.out.println(match);
+ }
+ } else {
+ System.out.println("found no matches, which is correct.");
+ }
+ }
+
+}
+
+
+
diff --git a/kona/src/org/gffs/application/MemoryFootprint.java b/kona/src/org/gffs/application/MemoryFootprint.java
new file mode 100644
index 00000000..6b2ac288
--- /dev/null
+++ b/kona/src/org/gffs/application/MemoryFootprint.java
@@ -0,0 +1,59 @@
+package org.gffs.application;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import net.sourceforge.sizeof.SizeOf;
+
+/**
+ * can retrieve the size of java objects to assist tuning of caches and memory usage. this requires the SizeOf jar and -javaagent setting to
+ * point at that jar. this is the project page: https://sourceforge.net/projects/sizeof/?source=typ_redirect
+ */
+public class MemoryFootprint
+{
+ static private Log _logger = LogFactory.getLog(MemoryFootprint.class);
+
+ // static SizeOf _sizeEstimater = new SizeOf();
+ static {
+ // don't count statics in the memory size.
+ SizeOf.skipStaticField(true);
+ // only complain about large objects if they're bigger than the limit below.
+ SizeOf.setMinSizeToLog(5 * 1024 * 1024);
+ }
+
+ /**
+ * can report the size of the object 'o' if instrumentation has been set up. if instrumentation is absent, all object sizes will be
+ * reported as zero.
+ */
+ public static long getFootprint(Object o)
+ {
+ if (!_logger.isDebugEnabled()) {
+ _logger.error("abusive memory footprint called when not in debug mode. a logging statement is wrong.");
+ return 0;
+ }
+ try {
+ return SizeOf.sizeOf(o);
+ } catch (Exception e) {
+ _logger.debug("error retrieving SizeOf object; is SizeOf.jar in javaagent?");
+ return 0;
+ }
+ }
+
+ /**
+ * reports the size of the object 'o' plus the size of all other objects reachable from it.
+ */
+ public static long getDeepFootprint(Object o)
+ {
+ if (!_logger.isDebugEnabled()) {
+ _logger.error("abusive memory footprint called when not in debug mode. a logging statement is wrong.");
+ return 0;
+ }
+
+ try {
+ return SizeOf.deepSizeOf(o);
+ } catch (Exception e) {
+ _logger.debug("error retrieving SizeOf object; is SizeOf.jar in javaagent?");
+ return 0;
+ }
+ }
+}
diff --git a/kona/src/org/gffs/application/ProgramTools.java b/kona/src/org/gffs/application/ProgramTools.java
new file mode 100644
index 00000000..f13640d1
--- /dev/null
+++ b/kona/src/org/gffs/application/ProgramTools.java
@@ -0,0 +1,149 @@
+package org.gffs.application;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.gffs.filesystem.FileSystemHelper;
+
+/**
+ * Some utility functions for getting information about the running application.
+ *
+ * @author Chris Koeritz
+ */
+public class ProgramTools
+{
+ public static Log _logger = LogFactory.getLog(ProgramTools.class);
+
+ /**
+ * produces a list of the stack for a certain number of its elements, called stack frames. this will ignore the fact that this function is
+ * invoked, and start counting stack frames from the immediate caller's perspective (including it).
+ */
+ public static String showLastFewOnStack(int howManyFrames)
+ {
+ StackTraceElement[] elements = Thread.currentThread().getStackTrace();
+ StringBuilder toReturn = new StringBuilder();
+ /*
+ * don't start at the very first frame; we want to skip backwards to the direct caller of this function.
+ */
+ int startFrame = 3;
+ int endFrame = Math.min(howManyFrames + 3, elements.length - 1);
+ for (int i = startFrame; i < endFrame; i++) {
+ if (toReturn.length() != 0) {
+ toReturn.append("\n<= ");
+ }
+ toReturn.append(getStackFrame(i));
+ }
+ return toReturn.toString();
+ }
+
+ /**
+ * returns the Nth frame backwards starting from this function. 0 is this method, 1 is the invoker, 2 is the invoker's invoker, etc.
+ */
+ public static String getStackFrame(int which)
+ {
+ StackTraceElement[] elements = Thread.currentThread().getStackTrace();
+ /* a little self-protection to avoid accessing missing parts of the array. */
+ if (which >= elements.length)
+ which = elements.length - 1;
+ return elements[which].toString();
+ }
+
+ /**
+ * returns the location where the code is running, as best as can be determined. finds the running location based on our jar files, or if
+ * that's not available, on the assumption of app path being within an appropriate installation (even if not at the top). this method
+ * cannot use standard genesis properties to look up the path, because this function needs to operate before anything else is loaded (for
+ * OSGi usage).
+ */
+ static public String getInstallationDirectory()
+ {
+ String appPath = null;
+ // see if we can intuit our location from living in a jar.
+ URL url = ProgramTools.class.getProtectionDomain().getCodeSource().getLocation();
+ try {
+ // get the app path but switch back slashes to forward ones.
+ appPath = new File(url.toURI().getSchemeSpecificPart()).toString().replace('\\', '/');
+ } catch (URISyntaxException e) {
+ String msg = "failed to convert code source url to app path: " + url;
+ _logger.error(msg);
+ throw new RuntimeException(msg);
+ }
+ if (_logger.isTraceEnabled())
+ _logger.trace("got source path as: " + appPath);
+ if (appPath.endsWith(".jar")) {
+ // we need to chop off the jar file part of the name.
+ int lastSlash = appPath.lastIndexOf("/");
+ // if (lastSlash < 0)
+ // lastSlash = appPath.lastIndexOf("\\");
+ if (lastSlash < 0) {
+ String msg = "could not find a slash character in the path: " + appPath;
+ _logger.error(msg);
+ throw new RuntimeException(msg);
+ }
+ appPath = appPath.substring(0, lastSlash);
+ if (_logger.isTraceEnabled())
+ _logger.trace("truncated path since inside jar: " + appPath);
+ }
+ appPath = appPath.concat("/..");
+
+ if (_logger.isTraceEnabled())
+ _logger.trace("jar-intuited startup bundle path: " + appPath);
+
+ File startupDir = new File(appPath);
+ if (!startupDir.exists() || !startupDir.isDirectory()) {
+ throw new RuntimeException(
+ "the location where we believe the installation is running from does not actually exist as a directory.");
+ }
+
+ //hmmm: below may not be very general since it does osgi? but it will work if people use a bundles dir.
+
+ /*
+ * make sure we can find our own bundles directory, which is a crucial thing for osgi. if we can't find it, then we really don't know
+ * where home is.
+ */
+ File testingBundlesDir = new File(startupDir, "bundles");
+ File testingExtDir = new File(startupDir, "ext");
+ String lastStartupDirState = "not-equal"; // a string we should never see as a full path.
+
+ while (!testingBundlesDir.exists() || !testingExtDir.exists()) {
+ if (_logger.isDebugEnabled()) {
+ if (_logger.isTraceEnabled())
+ _logger.debug("failed to find bundles directory at '" + startupDir.getAbsolutePath() + "', popping up a level.");
+ }
+
+ if (lastStartupDirState.equals(FileSystemHelper.sanitizeFilename(startupDir.getAbsolutePath()))) {
+ throw new RuntimeException(
+ "caught the startup directory not changing, which means we have hit the root and failed to find our bundles and ext directories.");
+ }
+ // reset for next time.
+ lastStartupDirState = FileSystemHelper.sanitizeFilename(startupDir.getAbsolutePath());
+
+ // pop up a level, since we didn't find our bundles directory.
+ startupDir = new File(startupDir, "..");
+ testingBundlesDir = new File(startupDir, "bundles");
+ testingExtDir = new File(startupDir, "ext");
+
+ if (startupDir.getParent() == null) {
+ throw new RuntimeException("failed to find the bundles and ext directories after hitting top of file system paths.");
+ }
+ }
+
+ // we successfully found the bundles directory, even if we may have had to jump a few hoops.
+ if (_logger.isTraceEnabled()) {
+ _logger.debug("successfully found bundles directory under path: " + appPath);
+ }
+
+ // now resolve the path to an absolute location without relative components.
+ try {
+ appPath = FileSystemHelper.sanitizeFilename(startupDir.getCanonicalPath());
+ } catch (IOException e) {
+ _logger.error("could not open osgi directory: " + appPath);
+ }
+ if (_logger.isTraceEnabled())
+ _logger.debug("startup path after resolution with File: " + appPath);
+ return appPath;
+ }
+}
diff --git a/kona/src/org/gffs/cache/CacheList.java b/kona/src/org/gffs/cache/CacheList.java
new file mode 100644
index 00000000..dc2d2133
--- /dev/null
+++ b/kona/src/org/gffs/cache/CacheList.java
@@ -0,0 +1,77 @@
+package org.gffs.cache;
+
+/*
+ * Copyright 2006 University of Virginia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+abstract class CacheList
+{
+ protected int _myRole;
+
+ protected RoleBasedCacheNode _head;
+ protected RoleBasedCacheNode _tail;
+
+ protected CacheList(int role)
+ {
+ _myRole = role;
+
+ _head = _tail = null;
+ }
+
+ public abstract void insert(RoleBasedCacheNode node);
+
+ public RoleBasedCacheNode removeFirst()
+ {
+ if (_head == null)
+ return null;
+
+ RoleBasedCacheNode ret = _head;
+
+ _head = _head.getNext(_myRole);
+ if (_head != null)
+ _head.setPrevious(_myRole, null);
+ else
+ _tail = null;
+
+ ret.clearLinks(_myRole);
+ return ret;
+ }
+
+ public RoleBasedCacheNode peekFirst()
+ {
+ if (_head == null)
+ return null;
+
+ return _head;
+ }
+
+ public void remove(RoleBasedCacheNode node)
+ {
+ if (node.getPrevious(_myRole) == null) // At the head of the list
+ _head = node.getNext(_myRole);
+ else
+ node.getPrevious(_myRole).setNext(_myRole, node.getNext(_myRole));
+
+ if (node.getNext(_myRole) == null) // At the tail of the list
+ _tail = node.getPrevious(_myRole);
+ else
+ node.getNext(_myRole).setPrevious(_myRole, node.getPrevious(_myRole));
+
+ node.clearLinks(_myRole);
+ }
+
+ public void clear()
+ {
+ _head = null;
+ _tail = null;
+ }
+}
\ No newline at end of file
diff --git a/kona/src/org/gffs/cache/LRUList.java b/kona/src/org/gffs/cache/LRUList.java
new file mode 100644
index 00000000..137e2a3b
--- /dev/null
+++ b/kona/src/org/gffs/cache/LRUList.java
@@ -0,0 +1,43 @@
+package org.gffs.cache;
+
+/*
+ * Copyright 2006 University of Virginia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+
+class LRUList extends CacheList
+{
+ public LRUList()
+ {
+ super(RoleBasedCacheNode.ROLE_LRU);
+ }
+
+ @Override
+ public void insert(RoleBasedCacheNode node)
+ {
+ // LRU inserts ALWAYS go at the tail
+ if (_tail == null) {
+ _head = _tail = node;
+ return;
+ }
+
+ _tail.setNext(_myRole, node);
+ node.setPrevious(_myRole, _tail);
+ _tail = node;
+ }
+
+ public void noteUse(RoleBasedCacheNode node)
+ {
+ remove(node);
+ insert(node);
+ }
+}
\ No newline at end of file
diff --git a/kona/src/org/gffs/cache/RoleBasedCacheNode.java b/kona/src/org/gffs/cache/RoleBasedCacheNode.java
new file mode 100644
index 00000000..5168d14f
--- /dev/null
+++ b/kona/src/org/gffs/cache/RoleBasedCacheNode.java
@@ -0,0 +1,100 @@
+package org.gffs.cache;
+
+/*
+ * Copyright 2006 University of Virginia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+import java.util.Date;
+
+class RoleBasedCacheNode
+{
+ static public final int ROLE_LRU = 0;
+ static public final int ROLE_TIMEOUT = 1;
+ static private final int _NUM_ROLES = 2;
+
+ private Object[] _next;
+ private Object[] _previous;
+
+ private KeyType _key;
+ private DataType _data;
+
+ private Date _invalidationDate;
+
+ public RoleBasedCacheNode(KeyType key, DataType data, Date invalidationDate)
+ {
+ _next = new Object[_NUM_ROLES];
+ _previous = new Object[_NUM_ROLES];
+
+ for (int lcv = 0; lcv < _NUM_ROLES; lcv++) {
+ _next[lcv] = null;
+ _previous[lcv] = null;
+ }
+
+ _key = key;
+ _data = data;
+ _invalidationDate = invalidationDate;
+ }
+
+ public KeyType getKey()
+ {
+ return _key;
+ }
+
+ public DataType getData()
+ {
+ return _data;
+ }
+
+ public Date getInvalidationDate()
+ {
+ return _invalidationDate;
+ }
+
+ public void setInvalidationDate(long millisecondsFromNow)
+ {
+ _invalidationDate = new Date(System.currentTimeMillis() + millisecondsFromNow);
+ }
+
+ @SuppressWarnings("unchecked")
+ public RoleBasedCacheNode getPrevious(int role)
+ {
+ return RoleBasedCacheNode.class.cast(_previous[role]);
+ }
+
+ @SuppressWarnings("unchecked")
+ public RoleBasedCacheNode getNext(int role)
+ {
+ return RoleBasedCacheNode.class.cast(_next[role]);
+ }
+
+ public void setPrevious(int role, RoleBasedCacheNode previous)
+ {
+ _previous[role] = previous;
+ }
+
+ public void setNext(int role, RoleBasedCacheNode next)
+ {
+ _next[role] = next;
+ }
+
+ public void clearLinks(int role)
+ {
+ _previous[role] = null;
+ _next[role] = null;
+ }
+
+ public void clearLinks()
+ {
+ for (int lcv = 0; lcv < _NUM_ROLES; lcv++)
+ clearLinks(lcv);
+ }
+}
\ No newline at end of file
diff --git a/kona/src/org/gffs/cache/TimedOutLRUCache.java b/kona/src/org/gffs/cache/TimedOutLRUCache.java
new file mode 100644
index 00000000..43dbc44d
--- /dev/null
+++ b/kona/src/org/gffs/cache/TimedOutLRUCache.java
@@ -0,0 +1,335 @@
+package org.gffs.cache;
+
+/*
+ * Copyright 2006 University of Virginia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This cache attempt to efficiently handle cached items that may time out after a certain period of time. It does this by maintaining 3
+ * separate data structures. The first is a HashMap which allows for quick access to the cached data based off of the key. The second is a
+ * linked list which maintains the LRU property of the items. The third is a list ordered by timeout so that items that have timed out can be
+ * identified quickly (i.e., a straight traversal of this list). All data structures share the exact same data node (not equivalent, but
+ * identical instances of the node class). This means that once a node is identified through any of the means indicated (key, LRU property,
+ * timeout property), the node for all three data structures has been identified and does not need to be looked up in the others.
+ *
+ * @author mmm2a
+ *
+ * @param
+ * @param
+ */
+public class TimedOutLRUCache
+{
+ static Log _logger = LogFactory.getLog(TimedOutLRUCache.class);
+
+ private HashMap> _map;
+ private LRUList _lruList;
+ private TimeoutList _timeoutList;
+
+ private int _maxElements;
+ private long _defaultTimeoutMS;
+ private Thread _activeTimeoutThread = null;
+ private boolean _logCacheEjection = false;
+ public String _cacheName = null; // the name for this cache.
+
+ public TimedOutLRUCache(int maxElements, long defaultTimeoutMS, String cacheName)
+ {
+ if (maxElements < 1)
+ throw new IllegalArgumentException("\"maxElements\" must be greater than 0.");
+ _cacheName = cacheName;
+ if (_cacheName == null)
+ throw new IllegalArgumentException("must provide a non-null cache name");
+
+ _maxElements = maxElements;
+ _defaultTimeoutMS = defaultTimeoutMS;
+ _map = new HashMap>(_maxElements);
+ _lruList = new LRUList();
+ _timeoutList = new TimeoutList();
+ }
+
+ /**
+ * returns the number of elements held in the cache currently.
+ */
+ public int size()
+ {
+ return _map.size();
+ }
+
+ /**
+ * allows this cache to log when items are removed due to overloading or timing out.
+ */
+ public void setCacheEjectionLogging(boolean logRemovals)
+ {
+ _logCacheEjection = logRemovals;
+ }
+
+ public void activelyTimeoutElements(boolean activelyTimeout)
+ {
+ synchronized (_map) {
+ if (_activeTimeoutThread == null) {
+ if (activelyTimeout)
+ startActiveTimeout();
+ } else {
+ if (!activelyTimeout)
+ stopActiveTimeout();
+ }
+ }
+ }
+
+ public String debugPrefix()
+ {
+ return _cacheName + ": ";
+ }
+
+ public void put(KeyType key, DataType data, long timeoutMS)
+ {
+ RoleBasedCacheNode newNode =
+ new RoleBasedCacheNode(key, data, new Date(System.currentTimeMillis() + timeoutMS));
+
+ synchronized (_map) {
+ RoleBasedCacheNode oldNode = _map.remove(key);
+ if (oldNode != null) {
+ _lruList.remove(oldNode);
+ _timeoutList.remove(oldNode);
+ }
+
+ if (_map.size() >= _maxElements)
+ clearStale();
+
+ while (_map.size() >= _maxElements) {
+ RoleBasedCacheNode node = _lruList.removeFirst();
+ if (_logCacheEjection && _logger.isDebugEnabled())
+ _logger.debug(debugPrefix() + "overloaded cache: removing cached item with key: " + node.getKey());
+ _timeoutList.remove(node);
+ _map.remove(node.getKey());
+ }
+
+ _map.put(key, newNode);
+ _lruList.insert(newNode);
+ _timeoutList.insert(newNode);
+
+ _map.notify();
+ }
+ }
+
+ public void put(KeyType key, DataType data)
+ {
+ put(key, data, _defaultTimeoutMS);
+ }
+
+ public int getMaximumElements()
+ {
+ return _maxElements;
+ }
+
+ /**
+ * tickles the object so that it won't expire for another default expiration period. true is returned if the object was there and got
+ * updated.
+ */
+ public boolean refresh(KeyType key)
+ {
+ synchronized (_map) {
+ RoleBasedCacheNode node = _map.get(key);
+ if (node == null)
+ return false;
+ _lruList.remove(node);
+ node.setInvalidationDate(_defaultTimeoutMS);
+ // move the node to the end of the LRU list, since we just accessed it.
+ _lruList.insert(node);
+ // also fix its position in the timeout list.
+ _timeoutList.remove(node);
+ _timeoutList.insert(node);
+ return true;
+ }
+ }
+
+ // hmmm: highly experimental memory analysis code here!
+ // private final long CHECK_INTERVAL = 1000 * 60; // one minute interval between deep checks currently.
+ private final long CHECK_INTERVAL = 1000 * 10;// hmmm: way too fast interval, being used for debugging.
+
+ private Date _nextDeepSizeCheck = new Date((new Date().getTime()) + CHECK_INTERVAL);
+
+ public DataType get(KeyType key)
+ {
+ Date now = new Date();
+
+ if (now.after(_nextDeepSizeCheck)) {
+
+ /*
+ * hmmm: size check code below, not right yet.
+ *
+ * would be nice to break that output into k, m, g, etc.
+ *
+ * trying the deep footprint on 'this' is giving unrealistic very small sizes.
+ *
+ * also the deep size check is dying with a stack overflow during the large rns directory test, so we cannot use it yet.
+ */
+ // if (_logger.isDebugEnabled()) {
+ // long sizeUsed = MemoryFootprint.getDeepFootprint(_map) + MemoryFootprint.getDeepFootprint(_lruList)
+ // + MemoryFootprint.getDeepFootprint(_timeoutList);
+ // _logger.debug(SizeOf.humanReadable(sizeUsed) + " consumed by "+ _cacheName);
+ // }
+
+ _nextDeepSizeCheck = new Date((new Date().getTime()) + CHECK_INTERVAL);
+ }
+
+ synchronized (_map) {
+ RoleBasedCacheNode node = _map.get(key);
+ if (node == null)
+ return null;
+ _lruList.remove(node);
+ if (node.getInvalidationDate().before(now)) {
+ // this entry has become stale.
+ if (_logCacheEjection && _logger.isDebugEnabled())
+ _logger.debug(debugPrefix() + "timed-out entry in get: removing cached item with key: " + node.getKey());
+ _map.remove(key);
+ _timeoutList.remove(node);
+ return null;
+ }
+ // move the node to the end of the LRU list, since we just accessed it.
+ _lruList.insert(node);
+ return node.getData();
+ }
+ }
+
+ public List getAll()
+ {
+ ArrayList toReturn = new ArrayList();
+ synchronized (_map) {
+ for (KeyType key : _map.keySet()) {
+ toReturn.add(_map.get(key).getData());
+ }
+ }
+ return toReturn;
+ }
+
+ public List getAllReferenced(List references)
+ {
+ ArrayList toReturn = new ArrayList();
+ synchronized (_map) {
+ for (KeyType key : references) {
+ //// for (KeyType key : _map.keySet()) {
+ if (_map.containsKey(key)) {
+ toReturn.add(_map.get(key).getData());
+ } else {
+ _logger.error(debugPrefix() + "failed to locate referenced object in cache: " + key);
+ }
+ }
+ }
+ return toReturn;
+ }
+
+ public void clearStale()
+ {
+ Date now = new Date();
+
+ synchronized (_map) {
+ while (true) {
+ RoleBasedCacheNode node = _timeoutList.peekFirst();
+ if (node == null)
+ break;
+
+ if (node.getInvalidationDate().compareTo(now) <= 0) {
+ if (_logCacheEjection && _logger.isDebugEnabled())
+ _logger.debug(debugPrefix() + "removing timed-out node: " + node.getKey());
+ _map.remove(node.getKey());
+ _timeoutList.removeFirst();
+ _lruList.remove(node);
+ } else {
+ break;
+ }
+ }
+ }
+ }
+
+ public void remove(KeyType key)
+ {
+ synchronized (_map) {
+ RoleBasedCacheNode node = _map.remove(key);
+ if (node != null) {
+ _lruList.remove(node);
+ _timeoutList.remove(node);
+ }
+ }
+ }
+
+ public Set keySet()
+ {
+ synchronized (_map) {
+ return new HashSet(_map.keySet());
+ }
+ }
+
+ public void clear()
+ {
+ synchronized (_map) {
+ _map.clear();
+ _lruList.clear();
+ _timeoutList.clear();
+ }
+ }
+
+ public void startActiveTimeout()
+ {
+ _activeTimeoutThread = new Thread(new ActiveTimeoutWorker(), "Active Cache Timeout Thread");
+ _activeTimeoutThread.setDaemon(true);
+ _activeTimeoutThread.start();
+ }
+
+ public void stopActiveTimeout()
+ {
+ Thread tmp = _activeTimeoutThread;
+ _activeTimeoutThread = null;
+ synchronized (_map) {
+ _map.notify();
+ }
+
+ try {
+ tmp.join();
+ } catch (InterruptedException cause) {
+ }
+ }
+
+ private class ActiveTimeoutWorker implements Runnable
+ {
+ public void run()
+ {
+ synchronized (_map) {
+ while (_activeTimeoutThread != null) {
+ try {
+ clearStale();
+ RoleBasedCacheNode firstNode = _timeoutList.peekFirst();
+ if (firstNode == null) {
+ _map.wait();
+ } else {
+ Date nextStale = firstNode.getInvalidationDate();
+ long timeout = nextStale.getTime() - System.currentTimeMillis();
+ if (timeout > 0) {
+ _map.wait(timeout);
+ }
+ }
+ } catch (InterruptedException ie) {
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/kona/src/org/gffs/cache/TimeoutList.java b/kona/src/org/gffs/cache/TimeoutList.java
new file mode 100644
index 00000000..c59069bf
--- /dev/null
+++ b/kona/src/org/gffs/cache/TimeoutList.java
@@ -0,0 +1,56 @@
+package org.gffs.cache;
+
+/*
+ * Copyright 2006 University of Virginia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+class TimeoutList extends CacheList
+{
+ public TimeoutList()
+ {
+ super(RoleBasedCacheNode.ROLE_TIMEOUT);
+ }
+
+ @Override
+ public void insert(RoleBasedCacheNode node)
+ {
+ // We'll start at the end because most likely we're adding to the end
+ if (_tail == null) {
+ // The list is empty
+ _head = _tail = node;
+ return;
+ }
+
+ RoleBasedCacheNode tmp;
+ for (tmp = _tail; tmp != null; tmp = tmp.getPrevious(_myRole)) {
+ if (tmp.getInvalidationDate().compareTo(node.getInvalidationDate()) <= 0) {
+ // current node invalidates before me, so I should go after him
+ node.setPrevious(_myRole, tmp);
+ node.setNext(_myRole, tmp.getNext(_myRole));
+ tmp.setNext(_myRole, node);
+ if (node.getNext(_myRole) == null) {
+ // Adding to the tail
+ _tail = node;
+ } else {
+ node.getNext(_myRole).setPrevious(_myRole, node);
+ }
+
+ return;
+ }
+ }
+
+ // We add to the head of the list
+ node.setNext(_myRole, _head);
+ _head.setPrevious(_myRole, node);
+ _head = node;
+ }
+}
\ No newline at end of file
diff --git a/kona/src/org/gffs/cache/improvements_readme.txt b/kona/src/org/gffs/cache/improvements_readme.txt
new file mode 100644
index 00000000..227eb784
--- /dev/null
+++ b/kona/src/org/gffs/cache/improvements_readme.txt
@@ -0,0 +1,18 @@
+
+
+it would be nice to fix the role based cache node and how these classes
+are intertwingled.
+it seems better to have some interfaces for the different concerns, like timeout and
+ordering.
+and then to inherit interfaces to build the real object as a composite,
+rather than stuffing all characteristics any cache node has into one object,
+the role based cache node.
+
+also the structures like cachelist are not separable from the stored type right now.
+
+these guys DO store any kind of type that you can implement with the parts,
+and they do it well, but the internal organization could be cleaned a bit and i think
+it would reduce the code size and also the complexity of the objects.
+
+
+
diff --git a/kona/src/org/gffs/compression/PackTar.java b/kona/src/org/gffs/compression/PackTar.java
new file mode 100644
index 00000000..c7a4cddb
--- /dev/null
+++ b/kona/src/org/gffs/compression/PackTar.java
@@ -0,0 +1,150 @@
+package org.gffs.compression;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.apache.commons.compress.archivers.ArchiveEntry;
+import org.apache.commons.compress.archivers.ArchiveOutputStream;
+import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
+import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
+import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.filefilter.IOFileFilter;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class PackTar
+{
+ static private Log _logger = LogFactory.getLog(PackTar.class);
+
+ /**
+ * returns the "longName" with the "prefix" stripped off the front. if the name doesn't contain the prefix, then an error is thrown.
+ */
+ public static String stripOutPrefix(String prefix, String longName) throws IOException
+ {
+ int indy = longName.indexOf(prefix, 0);
+ if (indy < 0)
+ throw new IOException("failure to find prefix in string, prefix=" + prefix + " and string=" + longName);
+ return longName.substring(indy + prefix.length());
+ }
+
+ /**
+ * adds the file pointed at by "source" to the archive in "tarOut" as a compressed file. if "source" is a directory, then the directory is
+ * recursed and added. the names in the archive will be stripped of the "prefix" string before being added to the archive; for example, if
+ * the source path "/home/fred/wumpus" and the prefix string is "/home/fred/", then the files in the archive will be named "wumpus/A",
+ * "wumpus/B", etc.
+ */
+ public static void compressArchive(ArchiveOutputStream tarOut, String prefix, File source) throws IOException
+ {
+ _logger.debug("entered into compress archive on source " + source + " prefix " + prefix + " and tarout " + tarOut);
+
+ if (!source.exists()) {
+ // Don't unpack into an existing directory.
+ String msg = "Directory " + source.getAbsolutePath() + " doesn't exist yet. Cannot pack.";
+ _logger.error(msg);
+ throw new IOException(msg);
+ }
+
+ // traverse the whole tree of the directory (or just write this directly if it's a file).
+ if (source.isFile()) {
+ String choppedName = stripOutPrefix(prefix, source.getPath());
+ if (_logger.isDebugEnabled())
+ _logger.debug("adding a file to the archive (chopped): " + choppedName);
+ ArchiveEntry f = tarOut.createArchiveEntry(source, choppedName);
+ tarOut.putArchiveEntry(f);
+ IOUtils.copy(new FileInputStream(source), tarOut);
+ tarOut.closeArchiveEntry();
+ } else if (source.isDirectory()) {
+ // traverse the directory tree at just this height and add everything recursively.
+
+ if (_logger.isDebugEnabled())
+ _logger.debug("iterating over a directory to add its contents to the archive: " + source);
+
+ Iterator spidey = FileUtils.iterateFiles(source, new IOFileFilter()
+ {
+ @Override
+ public boolean accept(File arg0)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean accept(File arg0, String arg1)
+ {
+ return true;
+ }
+ }, TrueFileFilter.INSTANCE);
+
+ File item = null;
+ while (spidey.hasNext()) {
+ item = spidey.next();
+
+ if (_logger.isTraceEnabled())
+ _logger.debug("recursing on item: " + item);
+
+ compressArchive(tarOut, prefix, item);
+ }
+ } else {
+ String msg = "source is not a file or directory although it exists. unknown how to process.";
+ _logger.error(msg);
+ throw new IOException(msg);
+ }
+
+ }
+
+ /**
+ * returns the same string as presented, but ensures that the last character will be a directory separator (/).
+ */
+ public static String findAppropriatePrefix(String toChop)
+ {
+ if (toChop.endsWith("/"))
+ return toChop; // already ready.
+ else
+ return toChop + "/"; // add a slash on the end.
+ }
+
+ public synchronized static void compressTarGZ(File tarFile, File dest) throws IOException
+ {
+ TarArchiveOutputStream tarOut = new TarArchiveOutputStream(new GzipCompressorOutputStream(new FileOutputStream(tarFile)));
+ compressArchive(tarOut, findAppropriatePrefix(dest.getPath()), dest);
+ tarOut.close();
+ }
+
+ public synchronized static void compressTar(File tarFile, File dest) throws IOException
+ {
+ TarArchiveOutputStream tarOut = new TarArchiveOutputStream(new FileOutputStream(tarFile));
+ compressArchive(tarOut, findAppropriatePrefix(dest.getPath()), dest);
+ tarOut.close();
+ }
+
+ public synchronized static void compressZip(File zipFile, File dest) throws IOException
+ {
+ ZipArchiveOutputStream tarOut = new ZipArchiveOutputStream(new FileOutputStream(zipFile));
+ compressArchive(tarOut, findAppropriatePrefix(dest.getPath()), dest);
+ tarOut.close();
+ }
+
+ static public void main(String[] args) throws Throwable
+ {
+ // future: could use our cool code above to handle any archive type they pass.
+ if (args.length != 2) {
+ System.err.println("USAGE: PackTar {tar.gz file} {source location}");
+ System.exit(1);
+ }
+
+ try {
+ PackTar.compressTarGZ(new File(args[0]), new File(args[1]));
+ } catch (Throwable t) {
+ _logger.error("failed to compress tar file " + args[0] + " from " + args[1]);
+ System.exit(1);
+ }
+
+ System.out.println("successfully compressed archive file " + args[0] + " from " + args[1]);
+ }
+
+}
diff --git a/kona/src/org/gffs/compression/UnpackTar.java b/kona/src/org/gffs/compression/UnpackTar.java
new file mode 100644
index 00000000..596b0e31
--- /dev/null
+++ b/kona/src/org/gffs/compression/UnpackTar.java
@@ -0,0 +1,168 @@
+package org.gffs.compression;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.attribute.PosixFilePermission;
+import java.util.HashSet;
+import org.apache.commons.compress.archivers.ArchiveEntry;
+import org.apache.commons.compress.archivers.ArchiveInputStream;
+import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
+import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
+import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class UnpackTar
+{
+ static private Log _logger = LogFactory.getLog(UnpackTar.class);
+
+ /**
+ * takes a tar.gz file as the "tarFile" parameter, then decompresses and unpacks the file into the "dest" location.
+ */
+
+ public enum archiveType {
+ TAR,
+ ZIP,
+ TGZ
+ };
+
+ public static void uncompressArchive(ArchiveInputStream tarIn, File dest, archiveType archType, boolean grantUserPermsToGroup)
+ throws IOException
+ {
+
+ if (dest.exists()) {
+ // Don't unpack into an existing directory
+ throw new IOException("Directory " + dest.getAbsolutePath() + " already exists. Unpacking exiting");
+ }
+ dest.mkdir();
+
+ ArchiveEntry tarEntry = tarIn.getNextEntry();
+ while (tarEntry != null) {
+ // New code by ASG 2016-02-21. Added extracting user permission bits and OR ing them with group permissions
+ int mode = 0;
+ int defaultMode = 0750; // assume somewhat standard executable permissions if we cannot get the mode.
+ switch (archType) {
+ case TAR:
+ case TGZ:
+ mode = ((TarArchiveEntry) tarEntry).getMode();
+ break;
+ case ZIP:
+ mode = ((ZipArchiveEntry) tarEntry).getUnixMode();
+ break;
+ }
+ if (mode == 0) {
+ mode = defaultMode;
+ }
+ if (_logger.isTraceEnabled())
+ _logger.debug("The mode on '" + tarEntry.getName() + "' is " + Integer.toOctalString(mode));
+ if (grantUserPermsToGroup) {
+ int temp = mode & 0700;
+ temp = temp / 8; // Shift it right 3 bit positions
+ mode = mode | temp;
+ if (_logger.isTraceEnabled())
+ _logger.debug("Now mode on '" + tarEntry.getName() + "' is " + Integer.toOctalString(mode));
+ }
+ // End of extracting and Or ing the permission bits.
+
+ // create a file with the same name as the tarEntry
+ File destPath = new File(dest, tarEntry.getName());
+ if (_logger.isTraceEnabled())
+ _logger.debug("working on: " + destPath.getCanonicalPath());
+ if (tarEntry.isDirectory()) {
+ destPath.mkdirs();
+ } else {
+ destPath.createNewFile();
+
+ // byte [] btoRead = new byte[(int)tarEntry.getSize()];
+ byte[] btoRead = new byte[8192];
+ BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(destPath));
+ int len = 0;
+ boolean wroteAnything = false;
+ while ((len = tarIn.read(btoRead)) != -1) {
+ if (_logger.isTraceEnabled())
+ _logger.debug("read " + len + " bytes");
+ wroteAnything = true;
+ bout.write(btoRead, 0, len);
+ }
+ if (!wroteAnything) {
+ _logger.error("zero bytes read from: " + destPath.getCanonicalPath());
+ }
+
+ bout.close();
+ }
+ // using PosixFilePermission to set file permissions that we extracted earlier.
+ HashSet perms = new HashSet();
+ // add owners permission
+ if ((mode & 0400) != 0)
+ perms.add(PosixFilePermission.OWNER_READ);
+ if ((mode & 0200) != 0)
+ perms.add(PosixFilePermission.OWNER_WRITE);
+ if ((mode & 0100) != 0)
+ perms.add(PosixFilePermission.OWNER_EXECUTE);
+ // add group permissions
+ if ((mode & 0040) != 0)
+ perms.add(PosixFilePermission.GROUP_READ);
+ if ((mode & 0020) != 0)
+ perms.add(PosixFilePermission.GROUP_WRITE);
+ if ((mode & 0010) != 0)
+ perms.add(PosixFilePermission.GROUP_EXECUTE);
+ // add others permissions
+ if ((mode & 0004) != 0)
+ perms.add(PosixFilePermission.OTHERS_READ);
+ if ((mode & 0002) != 0)
+ perms.add(PosixFilePermission.OTHERS_WRITE);
+ if ((mode & 0001) != 0)
+ perms.add(PosixFilePermission.OTHERS_EXECUTE);
+
+ Files.setPosixFilePermissions(Paths.get(destPath.getCanonicalPath()), perms);
+ tarEntry = tarIn.getNextEntry();
+ }
+ tarIn.close();
+ }
+
+ public synchronized static void uncompressTarGZ(File tarFile, File dest, boolean grantUserPermsToGroup) throws IOException
+ {
+ TarArchiveInputStream tarIn = new TarArchiveInputStream(new GzipCompressorInputStream(new FileInputStream(tarFile)));
+
+ uncompressArchive(tarIn, dest, archiveType.TGZ, grantUserPermsToGroup);
+ }
+
+ public synchronized static void uncompressTar(File tarFile, File dest, boolean grantUserPermsToGroup) throws IOException
+ {
+ TarArchiveInputStream tarIn = new TarArchiveInputStream(new FileInputStream(tarFile));
+
+ uncompressArchive(tarIn, dest, archiveType.TAR, grantUserPermsToGroup);
+ }
+
+ public synchronized static void uncompressZip(File zipFile, File dest, boolean grantUserPermsToGroup) throws IOException
+ {
+ ZipArchiveInputStream tarIn = new ZipArchiveInputStream(new FileInputStream(zipFile));
+
+ uncompressArchive(tarIn, dest, archiveType.ZIP, grantUserPermsToGroup);
+ }
+
+ static public void main(String[] args) throws Throwable
+ {
+ if (args.length != 2) {
+ System.err.println("USAGE: UnpackTar {tar.gz file} {output location}");
+ System.exit(1);
+ }
+
+ try {
+ UnpackTar.uncompressTarGZ(new File(args[0]), new File(args[1]), false);
+ } catch (Throwable t) {
+ _logger.error("failed to uncompress tar file " + args[0] + " into " + args[1]);
+ System.exit(1);
+ }
+
+ System.out.println("successfully uncompressed tar file " + args[0] + " into " + args[1]);
+ }
+
+}
diff --git a/kona/src/org/gffs/filesystem/FileSystemHelper.java b/kona/src/org/gffs/filesystem/FileSystemHelper.java
new file mode 100644
index 00000000..fd6fccc8
--- /dev/null
+++ b/kona/src/org/gffs/filesystem/FileSystemHelper.java
@@ -0,0 +1,89 @@
+package org.gffs.filesystem;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class FileSystemHelper
+{
+ private static Log _logger = LogFactory.getLog(FileSystemHelper.class);
+
+ /**
+ * returns true if the path contains a symbolic link anywhere within it.
+ */
+ public static boolean pathContainsLink(String path) throws FileNotFoundException
+ {
+ // replace any backslashes with forward slashes.
+ path = path.replaceAll("\\+", "/");
+
+ // make sure path is absolute.
+ if (!path.startsWith("/")) {
+ String msg = "path passed in was not absolute: '" + path + "'";
+ _logger.error(msg);
+ throw new FileNotFoundException(msg);
+ }
+
+ // replace any double slashes with single ones.
+ path = path.replaceAll("//", "/");
+ String[] components = path.split("/");
+
+ String currentPath = ""; // never expected to be a link.
+ for (String component : components) {
+ currentPath = currentPath + "/" + component;
+ if (isFileSymLink(new File(currentPath))) {
+ return true;
+ }
+ }
+ return false;
+
+ /*
+ * future: this could be more useful if it returned the position of the link as a component in path, but then we also need to accept a
+ * starting point for the link searching so they can find all of them.
+ */
+ }
+
+ /**
+ * returns true if the path specified is actually a symbolic link.
+ */
+ public static boolean isFileSymLink(File path)
+ {
+ Path nioPath = path.toPath();
+ return Files.isSymbolicLink(nioPath);
+ }
+
+ /**
+ * makes the string a more friendly filesystem path for java. this includes turning backslashes into forward slashes.
+ */
+ public static String sanitizeFilename(String toClean)
+ {
+ if (toClean == null)
+ return toClean; // can't fix nothing.
+ // _logger.debug("before='" + toClean + "'");
+
+ String toReturn = toClean.replace('\\', '/');
+
+ // future: any other cleanings we should do on the path?
+
+ // _logger.debug("after='" + toReturn + "'");
+ return toReturn;
+ }
+
+ static public void main(String[] args)
+ {
+ String uglyPath = "C:\\Program Files\\GenesisII\\";
+ String fixedPath = sanitizeFilename(uglyPath);
+ String expectedPath = "C:/Program Files/GenesisII/";
+ if (!fixedPath.equals(expectedPath)) {
+ System.err.println("FAILURE IN PARSING! result is not right: '" + fixedPath + "' when it should be '" + expectedPath);
+ System.exit(1);
+ } else {
+ System.err.println("parsing occurred as expected.");
+ }
+ System.exit(0);
+ }
+
+}
diff --git a/kona/src/org/gffs/io/IOUtils.java b/kona/src/org/gffs/io/IOUtils.java
new file mode 100644
index 00000000..b71bac17
--- /dev/null
+++ b/kona/src/org/gffs/io/IOUtils.java
@@ -0,0 +1,109 @@
+package org.gffs.io;
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+
+import org.apache.log4j.Logger;
+
+public class IOUtils
+{
+ static private Logger _logger = Logger.getLogger(IOUtils.class);
+
+ static final private int BUFFER_SIZE = 1024 * 8;
+
+ static private final int COPY_SIZE = 1024 * 8;
+
+ static public void copy(InputStream in, OutputStream out) throws IOException
+ {
+ byte[] data = new byte[BUFFER_SIZE];
+ int read;
+
+ while ((read = in.read(data)) > 0)
+ out.write(data, 0, read);
+ }
+
+ static public void close(Closeable closeable)
+ {
+ if (closeable != null) {
+ try {
+ closeable.close();
+ } catch (Throwable cause) {
+ _logger.error("Error trying to close closeable item.", cause);
+ }
+ }
+ }
+
+ static public void recursiveDelete(File target)
+ {
+ if (!target.exists())
+ return;
+
+ if (target.isDirectory())
+ for (File newTarget : target.listFiles())
+ recursiveDelete(newTarget);
+
+ target.delete();
+ }
+
+ static public void copy(File source, File target) throws IOException
+ {
+ InputStream in = null;
+ OutputStream out = null;
+
+ try {
+ in = new FileInputStream(source);
+ out = new FileOutputStream(target);
+ copy(in, out);
+ } finally {
+ close(in);
+ close(out);
+ }
+ }
+
+ static public void serialize(String filePath, Object obj) throws IOException
+ {
+ serialize(new File(filePath), obj);
+ }
+
+ static public void serialize(File target, Object obj) throws IOException
+ {
+ FileOutputStream fos = null;
+
+ try {
+ fos = new FileOutputStream(target);
+ ObjectOutputStream oos = new ObjectOutputStream(fos);
+ oos.writeObject(obj);
+ oos.close();
+ } finally {
+ close(fos);
+ }
+ }
+
+ static public Type deserialize(Class cl, String sourcePath) throws FileNotFoundException, IOException
+ {
+ return deserialize(cl, new File(sourcePath));
+ }
+
+ static public Type deserialize(Class cl, File source) throws FileNotFoundException, IOException
+ {
+ FileInputStream fin = null;
+
+ try {
+ fin = new FileInputStream(source);
+ ObjectInputStream ois = new ObjectInputStream(fin);
+ return cl.cast(ois.readObject());
+ } catch (ClassNotFoundException e) {
+ throw new IOException("Unable to deserialize from file.", e);
+ } finally {
+ close(fin);
+ }
+ }
+}
diff --git a/kona/src/org/gffs/network/DeadHostChecker.java b/kona/src/org/gffs/network/DeadHostChecker.java
new file mode 100644
index 00000000..4b4a833d
--- /dev/null
+++ b/kona/src/org/gffs/network/DeadHostChecker.java
@@ -0,0 +1,197 @@
+package org.gffs.network;
+
+import java.util.HashMap;
+
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+//import edu.virginia.vcgr.genii.client.ClientProperties;
+
+/**
+ * Manages a list of hosts that have proven to be down recently. Has support to not immediately fail the host, as this can lead to too quick
+ * an assumption that the host is down, but after N tries, the host is out. It will then be tested again periodically so we know when it comes
+ * back online.
+ */
+public class DeadHostChecker
+{
+ static private Log _logger = LogFactory.getLog(DeadHostChecker.class);
+
+ //need better substitute for cli props.
+ public static class ClientProperties {
+ int timeout = 2 * 60 * 1000; // 2 minutes timeout by default, in ms.
+
+ ClientProperties() {
+ }
+ }
+ static public ClientProperties props;
+
+
+ // this value specifies how many attempts can fail before the host is considered down.
+ static private final int HOW_MANY_DOWNS_ALLOWED = 1;
+
+ /*
+ * this is the longest amount of time between checking of dead hosts that we'll ever pause. exponential backoff will occur up until this
+ * delay time, and then stay at this delay time afterwards.
+ */
+ static private final int MAXIMUM_ALLOWABLE_CHECKING_DELAY = 60 * 1000 * 5; // current is 5 minutes max for exponential backoff on retries.
+
+ public static class HostKey
+ {
+ public String hostname;
+ public int port;
+
+ HostKey(String hostname, int port)
+ {
+ this.hostname = hostname;
+ this.port = port;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return new HashCodeBuilder(37, 839). // two randomly chosen prime numbers
+ // if deriving: appendSuper(super.hashCode()).
+ append(hostname).append(port).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof HostKey))
+ return false; // wrong object.
+ HostKey realo = (HostKey) o;
+ return realo.hostname.equals(hostname) && (realo.port == port);
+ }
+
+ @Override
+ public String toString()
+ {
+ return hostname + ":" + port;
+ }
+ }
+
+ static final HashMap deadHosts = new HashMap();
+
+ public static class RetryInfo
+ {
+ public long nextTime;
+ public int delay;
+ public int downCount = 0;
+
+ public RetryInfo()
+ {
+ // We just failed, so base a delay on the overall timeout to delay our next attempt.
+ delay = initialDelay();
+ nextTime = System.currentTimeMillis() + delay;
+ }
+
+ int initialDelay()
+ {
+ return props.timeout / 2;
+ }
+
+ boolean isThisHostDead()
+ {
+ if (downCount < HOW_MANY_DOWNS_ALLOWED) {
+ return false;
+ }
+ if (System.currentTimeMillis() > nextTime) {
+ // this host is being allowed a retry.
+ nextTime = System.currentTimeMillis() + delay;
+ return false;
+ }
+ return true;
+ }
+
+ void recordDown()
+ {
+ downCount++;
+ }
+ }
+
+ /**
+ * checks the host in our records and returns true if it is considered alive and false if it is considered dead.
+ */
+ public static boolean evaluateHostAlive(String host, int port)
+ {
+ HostKey key = new HostKey(host, port);
+
+ // Added July 14, 2015 by ASG to deal with dead hosts and not bother trying to talk to them. The timeouts kill us.
+ synchronized (deadHosts) {
+ if (deadHosts.containsKey(host)) {
+ RetryInfo inf = deadHosts.get(key);
+ if (inf == null) {
+ _logger.warn("logic error: dead hosts list said it had host " + key + " was listed but we got a null record for it.");
+ return true;
+ }
+ return !inf.isThisHostDead();
+ } else {
+ // up as far as we know; no record exists.
+ if (_logger.isTraceEnabled())
+ _logger.debug("host " + key + " is fine as far as we know.");
+ return true;
+ }
+ }
+ }
+
+ public static void addHostToDeadPool(String host, int port)
+ {
+ HostKey key = new HostKey(host, port);
+
+ synchronized (deadHosts) {
+ RetryInfo inf = deadHosts.get(key);
+ if (inf == null) {
+ // Not there, set it up and add it.
+ inf = new RetryInfo();
+ deadHosts.put(key, inf);
+ }
+
+ boolean alreadyDead = false;
+ if (inf.isThisHostDead()) {
+ // this one is already down so expand the timeout.
+ if (_logger.isDebugEnabled())
+ _logger.warn("host " + key + " is considered dead already; increasing delay.");
+ inf.delay *= 2;
+ inf.nextTime = System.currentTimeMillis() + inf.delay;
+
+ if (inf.delay > MAXIMUM_ALLOWABLE_CHECKING_DELAY) {
+ inf.delay = MAXIMUM_ALLOWABLE_CHECKING_DELAY;
+ }
+ // flag this so we don't say something again below.
+ alreadyDead = true;
+ }
+
+ // we definitely saw this host as down at least once, so record that now.
+ inf.recordDown();
+
+ if (!inf.isThisHostDead()) {
+ // still up, although we needed to record that failure.
+ if (_logger.isDebugEnabled())
+ _logger.debug("host " + key + " is not dead yet but suffered a connection problem.");
+ } else {
+ // this is dead now. say something about it if we didn't already.
+ if (!alreadyDead && _logger.isDebugEnabled())
+ _logger.warn("host " + key + " is newly considered dead due to communication problems.");
+ }
+ }
+ }
+
+ public static void removeHostFromDeadPool(String host, int port)
+ {
+ HostKey key = new HostKey(host, port);
+
+ // Well, the host was reported alive again, so remove if it is in deadHosts.
+ synchronized (deadHosts) {
+ if (deadHosts.containsKey(key)) {
+ if (_logger.isDebugEnabled()) {
+ // if it's not present, we don't say anything.
+ _logger.debug("host " + key + " is being removed from dead host pool.");
+ }
+ // drop it from the list.
+ deadHosts.remove(key);
+ }
+ }
+ }
+
+}
diff --git a/kona/src/org/gffs/network/URLDownloader.java b/kona/src/org/gffs/network/URLDownloader.java
new file mode 100644
index 00000000..f7c590f7
--- /dev/null
+++ b/kona/src/org/gffs/network/URLDownloader.java
@@ -0,0 +1,41 @@
+package org.gffs.network;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.gffs.io.IOUtils;
+
+public abstract class URLDownloader
+{
+ static final private int CONNECTION_TIMEOUT = 1000 * 8;
+ static final private int READ_TIMEOUT = 1000 * 8;
+
+ static public InputStream connect(URL url) throws IOException
+ {
+ URLConnection connection = url.openConnection();
+ connection.setConnectTimeout(CONNECTION_TIMEOUT);
+ connection.setReadTimeout(READ_TIMEOUT);
+ connection.connect();
+ return connection.getInputStream();
+ }
+
+ static public void download(URL source, File target) throws IOException
+ {
+ InputStream in = null;
+ OutputStream out = null;
+
+ try {
+ in = connect(source);
+ out = new FileOutputStream(target);
+ IOUtils.copy(in, out);
+ } finally {
+ IOUtils.close(in);
+ IOUtils.close(out);
+ }
+ }
+}
\ No newline at end of file
diff --git a/kona/src/org/gffs/readme.txt b/kona/src/org/gffs/readme.txt
new file mode 100644
index 00000000..c67792f8
--- /dev/null
+++ b/kona/src/org/gffs/readme.txt
@@ -0,0 +1,9 @@
+
+
+gffs.org is a hypothetical organization i invented in order to be able
+to use the GFFS assets from UVa without retaining the cumbersome and huge
+paths involved.
+those assets are released under the Apache ASL v2 license, and so they're
+provided here under the same license.
+
+
diff --git a/kona/src/org/gffs/version/Version.java b/kona/src/org/gffs/version/Version.java
new file mode 100644
index 00000000..3137099a
--- /dev/null
+++ b/kona/src/org/gffs/version/Version.java
@@ -0,0 +1,100 @@
+package org.gffs.version;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class Version implements Comparable
+{
+ static final private Pattern VERSION_PATTERN = Pattern.compile("^(\\d+)\\.(\\d+)\\.(\\d+)\\s+Build\\s+(\\d+)$");
+
+ private int _majorVersion;
+ private int _minorVersion;
+ private int _subMinorVersion;
+ private int _buildNumber;
+
+ public Version(int major, int minor, int subminor, int buildNumber)
+ {
+ _majorVersion = major;
+ _minorVersion = minor;
+ _subMinorVersion = subminor;
+ _buildNumber = buildNumber;
+ }
+
+ public Version(String str)
+ {
+ parseString(str);
+ }
+
+ public void parseString(String verString)
+ {
+ Matcher matcher = VERSION_PATTERN.matcher(verString);
+ if (!matcher.matches())
+ throw new IllegalArgumentException("Version string wasn't of the form ###.###.### Build ####");
+
+ _majorVersion = Integer.parseInt(matcher.group(1));
+ _minorVersion = Integer.parseInt(matcher.group(2));
+ _subMinorVersion = Integer.parseInt(matcher.group(3));
+ _buildNumber = Integer.parseInt(matcher.group(4));
+ }
+
+ public Version(File propFile)
+ {
+ Properties props = new Properties();
+ try {
+ FileInputStream fis = new FileInputStream(propFile);
+ props.load(fis);
+ String appVer = props.getProperty("genii.app-version");
+ String buildNum = props.getProperty("genii.build-number");
+ String formattedString = appVer + " Build " + buildNum;
+ parseString(formattedString);
+ } catch (Throwable t) {
+ throw new RuntimeException("failure to parse version from file: " + propFile, t);
+ }
+ }
+
+ public boolean equals(Version other)
+ {
+ return compareTo(other) == 0;
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof Version)
+ return equals((Version) other);
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return (_majorVersion << 3) ^ (_minorVersion << 2) ^ (_subMinorVersion << 1) ^ _buildNumber;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.format("%d.%d.%d Build %d", _majorVersion, _minorVersion, _subMinorVersion, _buildNumber);
+ }
+
+ @Override
+ public int compareTo(Version o)
+ {
+ int diff = _majorVersion - o._majorVersion;
+ if (diff != 0)
+ return diff;
+ diff = _minorVersion - o._minorVersion;
+ if (diff != 0)
+ return diff;
+ diff = _subMinorVersion - o._subMinorVersion;
+ if (diff != 0)
+ return diff;
+ return _buildNumber - o._buildNumber;
+ }
+
+ static public Version EMPTY_VERSION = new Version(0, 0, 0, 0);
+}
\ No newline at end of file
diff --git a/kona/src/org/gffs/version/VersionManager.java b/kona/src/org/gffs/version/VersionManager.java
new file mode 100644
index 00000000..16d9b505
--- /dev/null
+++ b/kona/src/org/gffs/version/VersionManager.java
@@ -0,0 +1,41 @@
+package org.gffs.version;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.gffs.application.ProgramTools;
+
+public class VersionManager
+{
+ static private final String VERSION_FILENAME = "current.version";
+
+ private Version _currentVersion;
+ private File _versionFile;
+
+ public VersionManager()
+ {
+ _versionFile = new File(ProgramTools.getInstallationDirectory(), VERSION_FILENAME);
+ _currentVersion = null;
+ }
+
+ public Version getCurrentVersion() throws IOException
+ {
+ if (_currentVersion == null) {
+ // we go with the installer scheme to start with, where there's a current.version in the
+ // top-level.
+ if (!_versionFile.exists()) {
+ // try failing over to the source code's version of the file inside the installer
+ // directory.
+ _versionFile = new File(ProgramTools.getInstallationDirectory(), "installer/" + VERSION_FILENAME);
+ if (!_versionFile.exists()) {
+ _currentVersion = Version.EMPTY_VERSION;
+ }
+ }
+ if (_versionFile.exists()) {
+ _currentVersion = new Version(_versionFile);
+ }
+ }
+
+ return _currentVersion;
+ }
+}
diff --git a/makefile b/makefile
index 0a56f9bb..458d476f 100644
--- a/makefile
+++ b/makefile
@@ -2,7 +2,13 @@ include variables.def
PROJECT = feisty_meow_sources
FIRST_TARGETS += start_make
-BUILD_BEFORE = nucleus scripts octopi graphiq hypermedia kona production
+BUILD_BEFORE = scripts \
+ infobase walrus \
+ nucleus octopi graphiq \
+ kona \
+ documentation huffware hypermedia \
+ production \
+ experiments
LAST_TARGETS += end_make
include rules.def
diff --git a/nucleus/.cproject b/nucleus/.cproject
index d05aaa79..858a68d5 100644
--- a/nucleus/.cproject
+++ b/nucleus/.cproject
@@ -21,9 +21,15 @@
+
+
+
+
+
+
diff --git a/nucleus/.settings/language.settings.xml b/nucleus/.settings/language.settings.xml
index ab2e34fe..2afeb1de 100644
--- a/nucleus/.settings/language.settings.xml
+++ b/nucleus/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
diff --git a/nucleus/.settings/org.eclipse.cdt.codan.core.prefs b/nucleus/.settings/org.eclipse.cdt.codan.core.prefs
index d1c7b011..cf61d79d 100644
--- a/nucleus/.settings/org.eclipse.cdt.codan.core.prefs
+++ b/nucleus/.settings/org.eclipse.cdt.codan.core.prefs
@@ -1,67 +1,73 @@
eclipse.preferences.version=1
org.eclipse.cdt.codan.checkers.errnoreturn=Warning
-org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
+org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false}
org.eclipse.cdt.codan.checkers.errreturnvalue=Error
-org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"}
+org.eclipse.cdt.codan.checkers.nocommentinside=-Error
+org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Nesting comments\\")"}
+org.eclipse.cdt.codan.checkers.nolinecomment=-Error
+org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Line comments\\")"}
org.eclipse.cdt.codan.checkers.noreturn=Error
-org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
+org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return value\\")",implicit\=>false}
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
-org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"}
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
-org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"}
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"}
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
-org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"}
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>true,empty_case_param\=>false}
+org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false}
org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
-org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",unknown\=>false,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
-org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"}
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
-org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
+org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true}
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"}
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"}
org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
-org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"}
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
-org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"}
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
-org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Label statement not found\\")"}
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
-org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"}
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"}
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
-org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Name convention for function\\")",pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"}
org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
-org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid overload\\")"}
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
-org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"}
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"}
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
-org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"}
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
-org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"}
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false}
+org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",paramNot\=>false}
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false}
+org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",else\=>false,afterelse\=>false}
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"}
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
+org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",macro\=>true}
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
+org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused static function\\")",macro\=>true}
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")}
+org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")}
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"}
+org.eclipse.cdt.qt.core.qtproblem=Warning
+org.eclipse.cdt.qt.core.qtproblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>true,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>null}
diff --git a/nucleus/applications/bookmark_tools/bookmark_tree.cpp b/nucleus/applications/bookmark_tools/bookmark_tree.cpp
index 04dd9d5f..33ce8b05 100644
--- a/nucleus/applications/bookmark_tools/bookmark_tree.cpp
+++ b/nucleus/applications/bookmark_tools/bookmark_tree.cpp
@@ -279,7 +279,7 @@ inner_mark_tree *bookmark_tree::process_category(const string_array &items)
}
LOG(astring("category name \"") + category_name
+ "\" in conflict with existing: " + catnames);
- inner_mark_tree *fake_it = NIL;
+ inner_mark_tree *fake_it = NULL_POINTER;
//hmmm: neither of these are right; they need to use a comparator that
// uses our magic comparison function.
@@ -321,7 +321,7 @@ inner_mark_tree *bookmark_tree::process_category(const string_array &items)
LOG("==> failure to find a match for either category!");
deadly_error(class_name(), func, "collision resolution code failed; "
"please fix category error");
- return NIL;
+ return NULL_POINTER;
}
// now that we know these names are unique, we'll add them into the list
// so future categories can't reuse these.
diff --git a/nucleus/applications/bookmark_tools/js_marks_maker.cpp b/nucleus/applications/bookmark_tools/js_marks_maker.cpp
index 49578283..67a88e98 100644
--- a/nucleus/applications/bookmark_tools/js_marks_maker.cpp
+++ b/nucleus/applications/bookmark_tools/js_marks_maker.cpp
@@ -233,7 +233,7 @@ int marks_maker_javascript::write_marks_page(const astring &output_filename,
// traverse the tree in prefix order.
tree::iterator itty = _categories.access_root().start(tree::prefix);
- tree *curr = NIL;
+ tree *curr = NULL_POINTER;
while ( (curr = itty.next()) ) {
inner_mark_tree *nod = (inner_mark_tree *)curr;
// print out the category on this node.
diff --git a/nucleus/applications/bookmark_tools/marks_checker.cpp b/nucleus/applications/bookmark_tools/marks_checker.cpp
index ba8a2a82..0c84ac8c 100644
--- a/nucleus/applications/bookmark_tools/marks_checker.cpp
+++ b/nucleus/applications/bookmark_tools/marks_checker.cpp
@@ -19,7 +19,6 @@
#include "bookmark_tree.h"
-#include
#include
#include
#include
@@ -40,6 +39,7 @@
#include
#include
#include
+#include "../../library/algorithms/sorts.h"
using namespace algorithms;
using namespace application;
@@ -301,7 +301,7 @@ int marks_checker::test_all_links()
FUNCDEF("test_all_links");
// traverse the tree in prefix order.
tree::iterator itty = _categories.access_root().start(tree::prefix);
- tree *curr = NIL;
+ tree *curr = NULL_POINTER;
while ( (curr = itty.next()) ) {
inner_mark_tree *nod = dynamic_cast(curr);
if (!nod)
@@ -318,7 +318,7 @@ int marks_checker::test_all_links()
checking_thread *new_thread = new checking_thread(*lin, _bad_lines,
*this);
- unique_int id = _checkers.add_thread(new_thread, true, NIL);
+ unique_int id = _checkers.add_thread(new_thread, true, NULL_POINTER);
}
}
@@ -376,7 +376,7 @@ void marks_checker::write_new_files()
badness_file.close();
}
-marks_checker *main_program = NIL;
+marks_checker *main_program = NULL_POINTER;
void marks_checker::handle_OS_signal(int formal(sig_id))
{
@@ -384,7 +384,7 @@ void marks_checker::handle_OS_signal(int formal(sig_id))
BASE_LOG("caught break signal... now writing files.");
if (main_program) main_program->write_new_files();
BASE_LOG("exiting after handling break.");
- main_program = NIL;
+ main_program = NULL_POINTER;
exit(0);
}
@@ -440,7 +440,7 @@ LOG("after reading input...");
ret = test_all_links();
write_new_files();
- main_program = NIL;
+ main_program = NULL_POINTER;
curl_global_cleanup(); // shut down cURL engine again.
diff --git a/nucleus/applications/bookmark_tools/marks_sorter.cpp b/nucleus/applications/bookmark_tools/marks_sorter.cpp
index 8201799b..41d47b48 100644
--- a/nucleus/applications/bookmark_tools/marks_sorter.cpp
+++ b/nucleus/applications/bookmark_tools/marks_sorter.cpp
@@ -134,7 +134,7 @@ int marks_sorter::write_new_marks(const astring &output_filename)
// traverse the tree in prefix order.
tree::iterator itty = _categories.access_root().start(tree::prefix);
- tree *curr = NIL; // the current node.
+ tree *curr = NULL_POINTER; // the current node.
while ( (curr = itty.next()) ) {
inner_mark_tree *nod = (inner_mark_tree *)curr;
diff --git a/nucleus/applications/bundler/bundle_creator.cpp b/nucleus/applications/bundler/bundle_creator.cpp
index 17a2a8d0..04c5b173 100644
--- a/nucleus/applications/bundler/bundle_creator.cpp
+++ b/nucleus/applications/bundler/bundle_creator.cpp
@@ -103,7 +103,7 @@ public:
bundle_creator()
: application_shell(),
_app_name(filename(_global_argv[0]).basename()),
- _bundle(NIL), _stub_size(0), _keyword() {}
+ _bundle(NULL_POINTER), _stub_size(0), _keyword() {}
virtual ~bundle_creator() {
WHACK(_bundle);
diff --git a/nucleus/applications/bundler/unpacker_stub.cpp b/nucleus/applications/bundler/unpacker_stub.cpp
index 85872476..87c6a766 100644
--- a/nucleus/applications/bundler/unpacker_stub.cpp
+++ b/nucleus/applications/bundler/unpacker_stub.cpp
@@ -446,7 +446,7 @@ int unpacker_stub::execute()
}
}
- byte_filer *targo = NIL;
+ byte_filer *targo = NULL_POINTER;
if (keyword_good) targo = new byte_filer(curr._payload, "wb");
byte_array uncompressed(256 * KILOBYTE); // fluff it out to begin with.
byte_array temp(256 * KILOBYTE);
diff --git a/nucleus/applications/nechung/cgi_nechung.cpp b/nucleus/applications/nechung/cgi_nechung.cpp
index 7fc24c4f..46ddbaf9 100644
--- a/nucleus/applications/nechung/cgi_nechung.cpp
+++ b/nucleus/applications/nechung/cgi_nechung.cpp
@@ -81,9 +81,9 @@ int main(int argc, char *argv[])
// send the header for html text.
printf("content-type: text/html\n\n");
// send the preliminary gunk.
- printf("\n");
-//old text color #33ccff
+ printf("\n");
+//text=\"#00ee00\" bgcolor=\"#000000\" link=\"#66ff99\" "
+// "vlink=\"#cc33cc\" alink=\"#ff9900\">\n");
printf("\n");
printf("\n");
@@ -113,6 +113,7 @@ int main(int argc, char *argv[])
printf(" \n");
printf(" \n");
printf("\n");
+ printf("\n");
return 0;
}
diff --git a/nucleus/library/algorithms/makefile b/nucleus/library/algorithms/makefile
index 8cf4b298..8dd60e43 100644
--- a/nucleus/library/algorithms/makefile
+++ b/nucleus/library/algorithms/makefile
@@ -2,7 +2,7 @@ include cpp/variables.def
PROJECT = algorithms
TYPE = library
-SOURCE = placeholder.cpp
+SOURCE = sorts.cpp
TARGETS = algorithms.lib
include cpp/rules.def
diff --git a/nucleus/library/algorithms/placeholder.cpp b/nucleus/library/algorithms/placeholder.cpp
deleted file mode 100644
index 953ca62c..00000000
--- a/nucleus/library/algorithms/placeholder.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-// sole purpose of this is to make the lib be generated,
-// even though we currently do not have any code that lives inside it.
-
-int __private_private_bogus_placeholder_xj27_qx19() { return 32; }
-
-
diff --git a/nucleus/library/algorithms/shell_sort.h b/nucleus/library/algorithms/shell_sort.h
deleted file mode 100644
index 7e9b2539..00000000
--- a/nucleus/library/algorithms/shell_sort.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef SHELL_SORT_CLASS
-#define SHELL_SORT_CLASS
-
-//////////////
-// Name : shell_sort
-// Author : Chris Koeritz
-//////////////
-// Copyright (c) 1991-$now By Author. This program is free software; you can
-// redistribute it and/or modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation:
-// http://www.gnu.org/licenses/gpl.html
-// or under the terms of the GNU Library license:
-// http://www.gnu.org/licenses/lgpl.html
-// at your preference. Those licenses describe your legal rights to this
-// software, and no other rights or warranties apply.
-// Please send updates for this code to: fred@gruntose.com -- Thanks, fred.
-//////////////
-
-namespace algorithms {
-
-//! Orders an array in O(n log n) time.
-/*!
- This algorithm is based on Kernighan and Ritchie's "The C Programming Language".
-*/
-
-template
-void shell_sort(type v[], int n, bool reverse = false)
- //!< this function sorts a C array of the "type" with "n" elements.
- /*!< the "type" of object must support comparison operators. if "reverse"
- is true, then the list is sorted highest to lowest. */
-{
- type temp;
- int gap, i, j;
- // the gap sizes decrease quadratically(?). they partition the array of
- // items that need to be sorted into first two groups, then four, then
- // eight, ....
- // within each gap's worth of the array, the next loop takes effect...
- for (gap = n / 2; gap > 0; gap /= 2) {
- // the i indexed loop is the base for where the comparisons are made in
- // the j indexed loop. it makes sure that each item past the edge of
- // the gap sized partition gets considered.
- for (i = gap; i < n; i++) {
- // the j indexed loop looks at the values in our current gap and ensures
- // that they are in sorted order.
- if (!reverse) {
- // normal ordering.
- for (j = i - gap; j >= 0 && v[j] > v[j + gap]; j = j - gap) {
- // swap the elements that are disordered.
- temp = v[j]; v[j] = v[j + gap]; v[j + gap] = temp;
- }
- } else {
- // reversed ordering.
- for (j = i - gap; j >= 0 && v[j] < v[j + gap]; j = j - gap) {
- // swap the elements that are disordered.
- temp = v[j]; v[j] = v[j + gap]; v[j + gap] = temp;
- }
- }
- }
- }
-}
-
-} // namespace.
-
-#endif // outer guard.
-
diff --git a/nucleus/library/algorithms/sorts.cpp b/nucleus/library/algorithms/sorts.cpp
new file mode 100644
index 00000000..dc964a5a
--- /dev/null
+++ b/nucleus/library/algorithms/sorts.cpp
@@ -0,0 +1,2 @@
+
+#include "sorts.h"
diff --git a/nucleus/library/algorithms/sorts.h b/nucleus/library/algorithms/sorts.h
new file mode 100644
index 00000000..c6e21abe
--- /dev/null
+++ b/nucleus/library/algorithms/sorts.h
@@ -0,0 +1,374 @@
+#ifndef ASSORTED_SORTS_GROUP
+#define ASSORTED_SORTS_GROUP
+
+//////////////
+// Name : sorts
+// Author : Chris Koeritz
+//////////////
+// Copyright (c) 1991-$now By Author. This program is free software; you can
+// redistribute it and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation:
+// http://www.gnu.org/licenses/gpl.html
+// or under the terms of the GNU Library license:
+// http://www.gnu.org/licenses/lgpl.html
+// at your preference. Those licenses describe your legal rights to this
+// software, and no other rights or warranties apply.
+// Please send updates for this code to: fred@gruntose.com -- Thanks, fred.
+//////////////
+
+#include
+
+namespace algorithms {
+
+ /*
+ * general considerations:
+ *
+ * + Generic objects to be sorted must support comparison operators.
+ *
+ * + If the "reverse" flag is true, the arrays will be sorted in reverse order.
+ * Reverse order here means "descending", such that array element i is always greater than or equal to array element i+1.
+ * Normal order is "ascending", such that element i is always less than or equal to array element i+1.
+ *
+ */
+
+ //! dumps the contents of the list out, assuming that the type can be turned into an int.
+ template
+ basis::astring dump_list(type v[], int size)
+ {
+ basis::astring ret;
+ for (int i = 0; i < size; i++) {
+ ret += basis::a_sprintf("%d ", (int)v[i]);
+ }
+ return ret;
+ }
+
+ //! shell sort algorithm.
+ /*!
+ * Sorts a C array of the "type" with "n" elements.
+ * Operates on the original array.
+ * Performs within O(n^2) time (depending on the gap size used).
+ * Algorithm is based on Kernighan and Ritchie's "The C Programming Language".
+ */
+ template
+ void shell_sort(type v[], int n, bool reverse = false)
+ {
+ type temp;
+ int gap, i, j;
+ /* the gap sizes decrease quadratically(?). they partition the array of
+ * items that need to be sorted into first two groups, then four, then
+ * eight, etc. the inner loop iterates across each gap's worth of the array.
+ */
+ for (gap = n / 2; gap > 0; gap /= 2) {
+ // the i indexed loop is the base for where the comparisons are made in
+ // the j indexed loop. it makes sure that each item past the edge of
+ // the gap sized partition gets considered.
+ for (i = gap; i < n; i++) {
+ // the j indexed loop looks at the values in our current gap and ensures
+ // that they are in sorted order.
+ if (!reverse) {
+ // normal ordering.
+ for (j = i - gap; j >= 0 && v[j] > v[j + gap]; j = j - gap) {
+ // swap the elements that are disordered.
+ temp = v[j];
+ v[j] = v[j + gap];
+ v[j + gap] = temp;
+ }
+ } else {
+ // reversed ordering.
+ for (j = i - gap; j >= 0 && v[j] < v[j + gap]; j = j - gap) {
+ // swap the elements that are disordered.
+ temp = v[j];
+ v[j] = v[j + gap];
+ v[j + gap] = temp;
+ }
+ }
+ }
+ }
+ }
+
+//////////////
+
+ /*!
+ * sorted array merge
+ *
+ * merges two sorted arrays into a single sorted array.
+ */
+ template
+ basis::array merge(basis::array &first, basis::array &second, bool reverse)
+ {
+ basis::array to_return;
+ // operate until we've consumed both of the arrays.
+ while ((first.length() > 0) || (second.length() > 0)) {
+ if (first.length() <= 0) {
+ // nothing left in first, so use the second.
+ to_return += second[0];
+ second.zap(0, 0);
+ } else if (second.length() <= 0) {
+ to_return += first[0];
+ first.zap(0, 0);
+ } else if ((!reverse && (first[0] <= second[0])) || (reverse && (first[0] >= second[0]))) {
+ // the first list has a better value to add next.
+ to_return += first[0];
+ first.zap(0, 0);
+ } else {
+ // the second list has a better value to add next.
+ to_return += second[0];
+ second.zap(0, 0);
+ }
+ }
+ return to_return;
+ }
+
+ /*!
+ * merge sort
+ *
+ * operates in O(n log(n)) time.
+ * returns a new array with sorted data.
+ */
+ template
+ basis::array merge_sort(const basis::array &v, bool reverse = false)
+ {
+ if (v.length() <= 1) {
+ return basis::array(v);
+ }
+ int midway = v.length() / 2;
+ basis::array firstPart = merge_sort(v.subarray(0, midway - 1), reverse);
+ basis::array secondPart = merge_sort(v.subarray(midway, v.length() - 1), reverse);
+ return merge(firstPart, secondPart, reverse);
+ }
+
+//////////////
+
+ /*!
+ * a heap is a structure that can quickly return the highest (or lowest) value,
+ * depending on how the priority of the item is defined.
+ * a "normal" heap keeps the highest element available first; a reverse sorted heap
+ * keeps the lowest element available first.
+ * restructuring the heap is fast, and is O(n log(n)).
+ * the implicit structure is a binary tree
+ * represented in a flat array, where the children of a node at position n are
+ * in positions n * 2 + 1 and n * 2 + 2 (zero based).
+ */
+//hmmm: move this class out to basis?.
+ template
+ class heap
+ {
+ public:
+ heap(type to_sort[], int n, bool reverse)
+ {
+ _total = n;
+ _reverse = reverse;
+ _heapspace = to_sort;
+ heapify();
+ }
+
+ //! swaps the values in the heap stored at positions a and b.
+ void swap_values(int a, int b)
+ {
+ type temp = _heapspace[a];
+ _heapspace[a] = _heapspace[b];
+ _heapspace[b] = temp;
+ }
+
+ //! get the index of the parent of the node at i.
+ /*! this will not return the parent index of the root, since there is no parent. */
+ int parent_index(int i)
+ {
+ return i / 2; // rely on integer division to shave off remainder.
+ }
+
+ //! returns the left child of node at position i.
+ int left_child(int i)
+ {
+ return 2 * i + 1;
+ }
+
+ //! returns the right child of node at position i.
+ int right_child(int i)
+ {
+ return 2 * i + 2;
+ }
+
+ //! re-sorts the heapspace to maintain the heap ordering.
+ void heapify()
+ {
+ int start = parent_index(_total - 1);
+ // iterate from the back of the array towards the front, so depth-first.
+ while (start >= 0) {
+ // sift down the node at the index 'start' such that all nodes below it are heapified.
+ sift_down(start, _total - 1);
+ start--; // move the start upwards towards the root.
+ }
+ }
+
+ void sift_down(int start, int end)
+ {
+ int root = start;
+
+ // while the current root still has a kid...
+ while (left_child(root) <= end) {
+ int child = left_child(root);
+ // figure out which child to swap with.
+ int swap = root;
+ // check if the root should be swapped with this kid.
+ if ((!_reverse && (_heapspace[swap] > _heapspace[child]))
+ || (_reverse && (_heapspace[swap] < _heapspace[child])))
+ {
+ swap = child;
+ }
+ // check if the other child should be swapped with the root or left kid.
+ if ((child + 1 <= end)
+ && ((!_reverse && (_heapspace[swap] > _heapspace[child + 1]))
+ || (_reverse && (_heapspace[swap] < _heapspace[child + 1]))))
+ {
+ swap = child + 1;
+ }
+ if (swap == root) {
+ // the root has the largest (or smallest) element, so we're done.
+ return;
+ } else {
+ swap_values(root, swap);
+ root = swap;
+ // repeat to continue sifting down the child now.
+ }
+ }
+ }
+
+ //! re-sorts the heapspace to maintain the heap ordering. this uses sift_up.
+ void alt_heapify()
+ {
+ int end = 1; // start at first child.
+
+ while (end < _total) {
+ // sift down the node at the index 'start' such that all nodes below it are heapified.
+ sift_up(0, end++);
+ }
+ }
+
+ //! start is how far up in the heap to sort. end is the node to sift.
+ void sift_up(int start, int end)
+ {
+ int child = end;
+ // loop until we hit the starting node, where we're done.
+ while (child > start) {
+ int parent = parent_index(child);
+ if ((!_reverse && (_heapspace[parent] < _heapspace[child]))
+ || (_reverse && (_heapspace[parent] > _heapspace[child])))
+ {
+ swap_values(parent, child);
+ child = parent;
+ // continue sifting at the parent now.
+ } else {
+ // done sorting.
+ return;
+ }
+ }
+ }
+
+ private:
+ bool _reverse; // is the sorting in reverse?
+ int _total; // how many total elements are there?
+ int *_heapspace; // track a pointer to the array.
+ };
+
+ /*!
+ * heap sort
+ *
+ * operates in O(n log(n)).
+ * sorts the original array.
+ */
+ template
+ void heap_sort(type v[], int n, bool reverse = false)
+ {
+ // reverse the sense of "reverse", since our algorithm expects a normal heap (with largest on top).
+ heap hap(v, n, !reverse);
+
+ int end = n - 1;
+ while (end > 0) {
+ // a[0] is the root and largest value for a normal heap. The swap moves it to the real end of the list and takes it out of consideration.
+ hap.swap_values(end, 0);
+ // reduce the heap size by 1.
+ end--;
+ // that swap ruined the heap property, so re-heapify.
+ hap.sift_down(0, end);
+ }
+ }
+
+//////////////
+
+ //! swaps the values in the array stored at positions a and b.
+ template
+ void swap_values(type array[], int a, int b)
+ {
+ type temp = array[a];
+ array[a] = array[b];
+ array[b] = temp;
+ }
+
+ // hoare's partition implementation.
+ template
+ int partition(type a[], int start, int end, bool reverse)
+ {
+// printf("before partition: %s\n", dump_list(a + start, end - start + 1).s());
+ int pivot = a[start];
+ int i = start - 1;
+ int j = end + 1;
+ while (true) {
+ do {
+ i++;
+ } while ((!reverse && (a[i] < pivot)) || (reverse && (a[i] > pivot)));
+ do {
+ j--;
+ } while ((!reverse && (a[j] > pivot)) || (reverse && (a[j] < pivot)));
+
+ if (i >= j) {
+// printf("after partition: %s\n", dump_list(a + start, end - start + 1).s());
+ return j;
+ }
+ swap_values(a, i, j);
+ }
+ }
+
+ //! the recursive version of quick sort that does the work for our convenience method.
+ template
+ void inner_quick_sort(type v[], int start, int end, bool reverse)
+ {
+ if (start < end) {
+ // figure out where to pivot, and sort both halves around the pivot index.
+ int pivot = partition(v, start, end, reverse);
+ inner_quick_sort(v, start, pivot, reverse);
+ inner_quick_sort(v, pivot + 1, end, reverse);
+ }
+ }
+
+ /*!
+ * quick sort
+ *
+ * operates in O(n log(n)) time on average, worst case O(n^2).
+ * sorts the original array.
+ */
+ template
+ void quick_sort(type v[], int n, bool reverse = false)
+ {
+ inner_quick_sort(v, 0, n - 1, reverse);
+ }
+
+ //////////////
+
+ //! handy method for randomizing the order of a list. not strictly a sorting function...
+ template
+ void randomize_list(type v[], int n)
+ {
+ mathematics::chaos randomizer;
+ for (int i = 0; i < n; i++) {
+ // we will swap with any element that is not prior to the current index; thus we allow
+ // swapping the element with itself and later, but not with anything earlier.
+ int swap_index = randomizer.inclusive(i, n - 1);
+ swap_values(v, i, swap_index);
+ }
+ }
+
+} // namespace.
+
+#endif // outer guard.
+
diff --git a/nucleus/library/application/callstack_tracker.cpp b/nucleus/library/application/callstack_tracker.cpp
index c9f43bab..4194bbee 100644
--- a/nucleus/library/application/callstack_tracker.cpp
+++ b/nucleus/library/application/callstack_tracker.cpp
@@ -200,9 +200,9 @@ int callstack_tracker::full_trace_size() const
frame_tracking_instance::frame_tracking_instance(const char *class_name,
const char *func, const char *file, int line, bool add_frame)
: _frame_involved(add_frame),
- _class(class_name? strdup(class_name) : NIL),
- _func(func? strdup(func) : NIL),
- _file(file? strdup(file) : NIL),
+ _class(class_name? strdup(class_name) : NULL_POINTER),
+ _func(func? strdup(func) : NULL_POINTER),
+ _file(file? strdup(file) : NULL_POINTER),
_line(line)
{
if (_frame_involved) {
@@ -215,9 +215,9 @@ frame_tracking_instance::frame_tracking_instance(const char *class_name,
frame_tracking_instance::frame_tracking_instance
(const frame_tracking_instance &to_copy)
: _frame_involved(false), // copies don't get a right to this.
- _class(to_copy._class? strdup(to_copy._class) : NIL),
- _func(to_copy._func? strdup(to_copy._func) : NIL),
- _file(to_copy._file? strdup(to_copy._file) : NIL),
+ _class(to_copy._class? strdup(to_copy._class) : NULL_POINTER),
+ _func(to_copy._func? strdup(to_copy._func) : NULL_POINTER),
+ _file(to_copy._file? strdup(to_copy._file) : NULL_POINTER),
_line(to_copy._line)
{
}
@@ -231,9 +231,9 @@ void frame_tracking_instance::clean()
program_wide_stack_trace().pop_frame();
}
_frame_involved = false;
- free(_class); _class = NIL;
- free(_func); _func = NIL;
- free(_file); _file = NIL;
+ free(_class); _class = NULL_POINTER;
+ free(_func); _func = NULL_POINTER;
+ free(_file); _file = NULL_POINTER;
_line = 0;
}
@@ -252,9 +252,9 @@ void frame_tracking_instance::assign(const char *class_name, const char *func,
{
clean();
_frame_involved = false; // copies don't get a right to this.
- _class = class_name? strdup(class_name) : NIL;
- _func = func? strdup(func) : NIL;
- _file = file? strdup(file) : NIL;
+ _class = class_name? strdup(class_name) : NULL_POINTER;
+ _func = func? strdup(func) : NULL_POINTER;
+ _file = file? strdup(file) : NULL_POINTER;
_line = line;
}
diff --git a/nucleus/library/application/command_line.h b/nucleus/library/application/command_line.h
index 989aac5d..d75a14c6 100644
--- a/nucleus/library/application/command_line.h
+++ b/nucleus/library/application/command_line.h
@@ -205,7 +205,7 @@ private:
extern int _global_argc;
extern char **_global_argv;
//! this macro allocates space for the command-line storage areas.
-#define DEFINE_ARGC_AND_ARGV int _global_argc = 0; char **_global_argv = NIL
+#define DEFINE_ARGC_AND_ARGV int _global_argc = 0; char **_global_argv = NULL_POINTER
//! this macro assigns our command-line parameters for this program.
#define SET_ARGC_ARGV(argc, argv) { \
diff --git a/nucleus/library/application/dll_root.cpp b/nucleus/library/application/dll_root.cpp
index 7eab74b3..b54b9e2c 100644
--- a/nucleus/library/application/dll_root.cpp
+++ b/nucleus/library/application/dll_root.cpp
@@ -54,7 +54,7 @@ DllMain(application_instance instance, DWORD reason, LPVOID reserved)
// mainly for debugging purposes. having the value for DLL_NAME actually
// stored should allow us to know which dll is being debugged.
- static CDynLinkLibrary *dll_link = NIL;
+ static CDynLinkLibrary *dll_link = NULL_POINTER;
static int dll_entry_count = 0;
diff --git a/nucleus/library/application/hoople_service.cpp b/nucleus/library/application/hoople_service.cpp
index 317ada24..1a7ea8d9 100644
--- a/nucleus/library/application/hoople_service.cpp
+++ b/nucleus/library/application/hoople_service.cpp
@@ -58,7 +58,7 @@ int &hoople_service::_timer_period() { static int _tim = 0; return _tim; }
//////////////
-static hoople_service *_global_hoople_service = NIL;
+static hoople_service *_global_hoople_service = NULL_POINTER;
// this static object is set by the setup() method. it should only come
// into existence once during a program's lifetime.
@@ -208,7 +208,7 @@ bool hoople_service::launch_event_loop(hoople_service &alert,
MSG msg;
msg.hwnd = 0; msg.message = 0; msg.wParam = 0; msg.lParam = 0;
- while (!alert.is_defunct() && (GetMessage(&msg, NIL, 0, 0)) {
+ while (!alert.is_defunct() && (GetMessage(&msg, NULL_POINTER, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
diff --git a/nucleus/library/application/launch_manager.cpp b/nucleus/library/application/launch_manager.cpp
index 2bc32d2a..86c2131d 100644
--- a/nucleus/library/application/launch_manager.cpp
+++ b/nucleus/library/application/launch_manager.cpp
@@ -140,7 +140,7 @@ launch_manager::launch_manager(configured_applications &config)
FUNCDEF("constructor");
// start the application checking thread.
- _checker->start(NIL);
+ _checker->start(NULL_POINTER);
_checker->reschedule(200); // make it start pretty quickly.
}
diff --git a/nucleus/library/application/memory_checker.cpp b/nucleus/library/application/memory_checker.cpp
index 2426c785..2917b6db 100644
--- a/nucleus/library/application/memory_checker.cpp
+++ b/nucleus/library/application/memory_checker.cpp
@@ -88,7 +88,7 @@ public:
#endif
void construct(void *ptr, int size, char *where, int line) {
- _next = NIL;
+ _next = NULL_POINTER;
_chunk = ptr;
_size = size;
_where = strdup(where); // uses malloc, not new, so we're safe.
@@ -104,13 +104,13 @@ public:
}
void destruct() {
- free(_chunk); _chunk = NIL;
- free(_where); _where = NIL;
- _next = NIL;
+ free(_chunk); _chunk = NULL_POINTER;
+ free(_where); _where = NULL_POINTER;
+ _next = NULL_POINTER;
_size = 0;
_line = 0;
#ifdef ENABLE_CALLSTACK_TRACKING
- free(_stack); _stack = NIL;
+ free(_stack); _stack = NULL_POINTER;
#endif
}
};
@@ -140,7 +140,7 @@ class memory_bin
{
public:
void construct() {
- _head = NIL;
+ _head = NULL_POINTER;
_count = 0;
_lock = (mutex_base *)malloc(sizeof(mutex_base));
_lock->construct();
@@ -169,7 +169,7 @@ public:
_lock->lock();
// search the bin to locate the item specified.
memlink *current = _head; // current will scoot through the list.
- memlink *previous = NIL; // previous remembers the parent node, if any.
+ memlink *previous = NULL_POINTER; // previous remembers the parent node, if any.
while (current) {
if (current->_chunk == to_release) {
#ifdef MEMORY_CHECKER_STATISTICS
@@ -256,7 +256,7 @@ public:
_bins[i].destruct();
}
free(_bins);
- _bins = NIL;
+ _bins = NULL_POINTER;
}
int compute_slot(void *ptr) {
@@ -317,7 +317,7 @@ public:
// this is fairly resource intensive, so don't dump the state out that often.
char *text_form(bool show_outstanding) {
- char *to_return = NIL;
+ char *to_return = NULL_POINTER;
if (show_outstanding) {
to_return = report_allocations();
} else {
@@ -382,7 +382,7 @@ if (!_mems) printf("memory_checker::destruct being invoked twice!\n");
_mems->destruct();
free(_mems);
- _mems = NIL;
+ _mems = NULL_POINTER;
}
void *memory_checker::provide_memory(size_t size, char *file, int line)
diff --git a/nucleus/library/application/redirecter.cpp b/nucleus/library/application/redirecter.cpp
index c0b7e864..552563b1 100644
--- a/nucleus/library/application/redirecter.cpp
+++ b/nucleus/library/application/redirecter.cpp
@@ -84,9 +84,9 @@ private:
stdio_redirecter::stdio_redirecter()
:
#ifdef __WIN32__
- _child_in(NIL), _child_out(NIL), _child_err(NIL),
- _parent_in(NIL), _parent_out(NIL), _parent_err(NIL),
- _app_handle(NIL),
+ _child_in(NULL_POINTER), _child_out(NULL_POINTER), _child_err(NULL_POINTER),
+ _parent_in(NULL_POINTER), _parent_out(NULL_POINTER), _parent_err(NULL_POINTER),
+ _app_handle(NULL_POINTER),
#endif
_command(new astring),
_parms(new astring),
@@ -105,9 +105,9 @@ stdio_redirecter::stdio_redirecter(const astring &command,
const astring ¶meters)
:
#ifdef __WIN32__
- _child_in(NIL), _child_out(NIL), _child_err(NIL),
- _parent_in(NIL), _parent_out(NIL), _parent_err(NIL),
- _app_handle(NIL),
+ _child_in(NULL_POINTER), _child_out(NULL_POINTER), _child_err(NULL_POINTER),
+ _parent_in(NULL_POINTER), _parent_out(NULL_POINTER), _parent_err(NULL_POINTER),
+ _app_handle(NULL_POINTER),
#endif
_command(new astring(command)),
_parms(new astring(parameters)),
@@ -181,10 +181,10 @@ outcome stdio_redirecter::create_pipes()
SECURITY_ATTRIBUTES sa;
ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
sa.nLength= sizeof(SECURITY_ATTRIBUTES);
- sa.lpSecurityDescriptor = NIL;
+ sa.lpSecurityDescriptor = NULL_POINTER;
sa.bInheritHandle = true;
- HANDLE in_temp = NIL, out_temp = NIL, err_temp = NIL;
+ HANDLE in_temp = NULL_POINTER, out_temp = NULL_POINTER, err_temp = NULL_POINTER;
// create pipes that we will hook up to the child process. these are
// currently inheritable based on the security attributes.
@@ -276,12 +276,12 @@ outcome stdio_redirecter::launch_program(int &new_process_id)
// fork off the process.
PROCESS_INFORMATION pi;
- BOOL success = CreateProcess(NIL, to_unicode_temp(cmd), sec_attr, NIL,
- true, CREATE_NEW_CONSOLE, NIL, NIL, &si, &pi);
+ BOOL success = CreateProcess(NULL_POINTER, to_unicode_temp(cmd), sec_attr, NULL_POINTER,
+ true, CREATE_NEW_CONSOLE, NULL_POINTER, NULL_POINTER, &si, &pi);
// cleanup junk we allocated.
- if (sec_attr != NIL) GlobalFree(sec_attr);
- if (sec_desc != NIL) GlobalFree(sec_desc);
+ if (sec_attr != NULL_POINTER) GlobalFree(sec_attr);
+ if (sec_desc != NULL_POINTER) GlobalFree(sec_desc);
if (success) {
// toss out the thread handle since we don't use it.
@@ -301,8 +301,8 @@ outcome stdio_redirecter::launch_program(int &new_process_id)
}
#endif
- _stdout_reader->start(NIL);
- _stderr_reader->start(NIL);
+ _stdout_reader->start(NULL_POINTER);
+ _stderr_reader->start(NULL_POINTER);
return OKAY;
}
@@ -353,8 +353,8 @@ void stdio_redirecter::close_input()
#ifdef __UNIX__
close(_output_fds[1]); // shut down input to the child program.
#elif defined(__WIN32__)
- if (_child_in) { CloseHandle(_child_in); _child_in = NIL; }
- if (_parent_in) { CloseHandle(_parent_in); _parent_in = NIL; }
+ if (_child_in) { CloseHandle(_child_in); _child_in = NULL_POINTER; }
+ if (_parent_in) { CloseHandle(_parent_in); _parent_in = NULL_POINTER; }
#endif
}
@@ -383,11 +383,11 @@ void stdio_redirecter::zap_program()
close_input();
- if (_child_out) { CloseHandle(_child_out); _child_out = NIL; }
- if (_parent_out) { CloseHandle(_parent_out); _parent_out = NIL; }
+ if (_child_out) { CloseHandle(_child_out); _child_out = NULL_POINTER; }
+ if (_parent_out) { CloseHandle(_parent_out); _parent_out = NULL_POINTER; }
- if (_child_err) { CloseHandle(_child_err); _child_err = NIL; }
- if (_parent_err) { CloseHandle(_parent_err); _parent_err = NIL; }
+ if (_child_err) { CloseHandle(_child_err); _child_err = NULL_POINTER; }
+ if (_parent_err) { CloseHandle(_parent_err); _parent_err = NULL_POINTER; }
// shut down the child process if it's still there.
if (_app_handle) {
@@ -410,7 +410,7 @@ void stdio_redirecter::zap_program()
}
}
CloseHandle(_app_handle);
- _app_handle = NIL;
+ _app_handle = NULL_POINTER;
}
#endif
@@ -449,7 +449,7 @@ outcome stdio_redirecter::write(const byte_array &to_write, int &written)
#elif defined(__WIN32__)
DWORD writ = 0;
BOOL ret = WriteFile(_parent_in, to_write.observe(), to_write.length(),
- &writ, NIL);
+ &writ, NULL_POINTER);
written = writ;
if (ret) return OKAY;
else return ACCESS_DENIED;
@@ -490,7 +490,7 @@ void stdio_redirecter::std_thread_action(bool is_stdout)
// read some data from the file. the function will return when a write
// operation completes or we get that much data.
DWORD bytes_read = 0;
- BOOL ret = ReadFile(where, buff.access(), BUFFER_SIZE, &bytes_read, NIL);
+ BOOL ret = ReadFile(where, buff.access(), BUFFER_SIZE, &bytes_read, NULL_POINTER);
//hmmm: if (ret && !bytes_read) {///set eof!!! }
#endif
if (ret && bytes_read) {
diff --git a/nucleus/library/application/registry_config.cpp b/nucleus/library/application/registry_config.cpp
index 0fcbb01b..9542f9e2 100644
--- a/nucleus/library/application/registry_config.cpp
+++ b/nucleus/library/application/registry_config.cpp
@@ -114,8 +114,8 @@ bool registry_configurator::put(const astring §ion_in, const astring &entry,
LOG("failed to open the key, trying to create it.");
DWORD dispose; // the disposition of the call (created or existing).
ret = RegCreateKeyEx((HKEY)translate_hive(_hive),
- to_unicode_temp(section), 0, NIL, REG_OPTION_NON_VOLATILE,
- KEY_ALL_ACCESS, NIL, &key, &dispose);
+ to_unicode_temp(section), 0, NULL_POINTER, REG_OPTION_NON_VOLATILE,
+ KEY_ALL_ACCESS, NULL_POINTER, &key, &dispose);
if (ret != ERROR_SUCCESS) {
LOG("failed to create the key!!");
return false;
diff --git a/nucleus/library/application/shared_memory.cpp b/nucleus/library/application/shared_memory.cpp
index c26a09c5..313a3c0d 100644
--- a/nucleus/library/application/shared_memory.cpp
+++ b/nucleus/library/application/shared_memory.cpp
@@ -48,7 +48,7 @@ namespace application {
shared_memory::shared_memory(int size, const char *identity)
: _locking(new rendezvous(identity)),
- _the_memory(NIL),
+ _the_memory(NULL_POINTER),
_valid(false),
_identity(new astring(identity)),
_size(size)
@@ -132,7 +132,7 @@ shared_memory::~shared_memory()
::CloseHandle(_the_memory);
#else
//hmmm: fix.
- _the_memory = NIL;
+ _the_memory = NULL_POINTER;
#endif
WHACK(_locking);
WHACK(_identity);
@@ -181,10 +181,10 @@ void shared_memory::unlock(abyte * &to_unlock)
abyte *shared_memory::locked_grab_memory()
{
FUNCDEF("locked_grab_memory")
- abyte *to_return = NIL;
+ abyte *to_return = NULL_POINTER;
if (!_the_memory) return to_return;
#ifdef __UNIX__
- to_return = (abyte *)mmap(NIL, _size, PROT_READ | PROT_WRITE,
+ to_return = (abyte *)mmap(NULL_POINTER, _size, PROT_READ | PROT_WRITE,
MAP_SHARED, int(_the_memory), 0);
#elif defined(__WIN32__)
to_return = (abyte *)::MapViewOfFile((HANDLE)_the_memory, FILE_MAP_ALL_ACCESS,
diff --git a/nucleus/library/application/window_classist.h b/nucleus/library/application/window_classist.h
index 5b9a1ccb..67f7b7d6 100644
--- a/nucleus/library/application/window_classist.h
+++ b/nucleus/library/application/window_classist.h
@@ -60,7 +60,7 @@ namespace application {
// this is a placeholder implementation for other platforms.
window_handle create_simplistic_window(const basis::astring &formal(window_title),
- const basis::astring &formal(class_name)) { return NIL; }
+ const basis::astring &formal(class_name)) { return NULL_POINTER; }
void whack_simplistic_window(window_handle formal(f_window)) {}
#else
@@ -127,7 +127,7 @@ window_handle create_simplistic_window(const basis::astring &window_title,
register_class(class_name);
window_handle f_window = CreateWindow(basis::to_unicode_temp(class_name),
basis::to_unicode_temp(window_title), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
- 0, CW_USEDEFAULT, 0, NIL, NIL, GET_INSTANCE_HANDLE(), NIL);
+ 0, CW_USEDEFAULT, 0, NULL_POINTER, NULL_POINTER, GET_INSTANCE_HANDLE(), NULL_POINTER);
ShowWindow(f_window, SW_HIDE);
UpdateWindow(f_window);
return f_window;
@@ -135,7 +135,7 @@ window_handle create_simplistic_window(const basis::astring &window_title,
void whack_simplistic_window(window_handle f_window)
{
- SendMessage(f_window, WM_CLOSE, NIL, NIL);
+ SendMessage(f_window, WM_CLOSE, NULL_POINTER, NULL_POINTER);
//hmmm: is this enough?
}
diff --git a/nucleus/library/application/windoze_helper.cpp b/nucleus/library/application/windoze_helper.cpp
index a78392c9..1dfbefad 100644
--- a/nucleus/library/application/windoze_helper.cpp
+++ b/nucleus/library/application/windoze_helper.cpp
@@ -308,7 +308,7 @@ bool event_poll(MSG &message)
message.message = 0;
message.wParam = 0;
message.lParam = 0;
- if (!PeekMessage(&message, NIL, 0, 0, PM_REMOVE))
+ if (!PeekMessage(&message, NULL_POINTER, 0, 0, PM_REMOVE))
return false;
TranslateMessage(&message);
DispatchMessage(&message);
@@ -438,9 +438,9 @@ istring system_error_text(u_int to_name)
return strerror(to_name);
#elif defined(__WIN32__)
char error_text[1000];
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NIL, to_name,
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL_POINTER, to_name,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)error_text,
- sizeof(error_text) - 1, NIL);
+ sizeof(error_text) - 1, NULL_POINTER);
istring to_return = error_text;
// trim off the ridiculous carriage return they add.
while ( (to_return[to_return.end()] == '\r')
@@ -569,7 +569,7 @@ basis::char_star_array break_line(istring &app, const istring ¶meters)
.stuff(to_return[to_return.last()], len);
}
// add the sentinel to the list of strings.
- to_return += NIL;
+ to_return += NULL_POINTER;
#ifdef DEBUG_PORTABLE
for (int q = 0; to_return[q]; q++) {
printf("%d: %s\n", q, to_return[q]);
@@ -740,8 +740,8 @@ u_int launch_process(const istring &app_name_in, const istring &command_line,
// }
}
istring parms = app_name + " " + command_line;
- bool success = CreateProcess(NIL, to_unicode_temp(parms), NIL, NIL, false,
- create_flag, NIL, NIL, &startup_info, &process_info);
+ bool success = CreateProcess(NULL_POINTER, to_unicode_temp(parms), NULL_POINTER, NULL_POINTER, false,
+ create_flag, NULL_POINTER, NULL_POINTER, &startup_info, &process_info);
if (!success)
return system_error();
// success then, merge back into stream.
diff --git a/nucleus/library/application/windoze_helper.h b/nucleus/library/application/windoze_helper.h
index b0ec409f..071e0fcd 100644
--- a/nucleus/library/application/windoze_helper.h
+++ b/nucleus/library/application/windoze_helper.h
@@ -140,9 +140,9 @@
namespace application {
-// istring module_name(const void *module_handle = NIL);
+// istring module_name(const void *module_handle = NULL_POINTER);
//!< returns the name of the module for the "module_handle" where supported.
- /*!< if the handle is NIL, then the program name is returned. */
+ /*!< if the handle is NULL_POINTER, then the program name is returned. */
// u_int system_error();
diff --git a/nucleus/library/basis/array.h b/nucleus/library/basis/array.h
index 7deb974d..9b466ce4 100644
--- a/nucleus/library/basis/array.h
+++ b/nucleus/library/basis/array.h
@@ -76,11 +76,11 @@ public:
that's in use and we want NEW_AT_END, then the existing contents are
jammed up into the front end of the array. */
- array(int number = 0, const contents *init = NIL,
+ array(int number = 0, const contents *init = NULL_POINTER,
int flags = EXPONENTIAL_GROWTH | FLUSH_INVISIBLE);
//!< Constructs an array with room for "number" objects.
- /*!< The initial contents are copied from "init" unless NIL is passed in
- instead. If "init" is not NIL, then it must point to an array of objects
+ /*!< The initial contents are copied from "init" unless NULL_POINTER is passed in
+ instead. If "init" is not NULL_POINTER, then it must point to an array of objects
that contains at least "number". The "flags" are a value based on the
special flags being added bit-wise. If "flags" contains SIMPLE_COPY, then
memmove() is used rather than using the C++ object's assignment operator.
@@ -99,10 +99,10 @@ public:
virtual ~array(); //!< destroys the memory allocated for the objects.
- void reset(int number = 0, const contents *initial_contents = NIL);
+ void reset(int number = 0, const contents *initial_contents = NULL_POINTER);
//!< Resizes this array and sets the contents from an array of contents.
- /*< If "initial_contents" is not NIL, then it must contain an array of
- "contents" with at least "number" objects in it. If it is NIL, then
+ /*< If "initial_contents" is not NULL_POINTER, then it must contain an array of
+ "contents" with at least "number" objects in it. If it is NULL_POINTER, then
the size of the array is changed but the contents are not. note that
any pre-existing elements that were previously out of range might still
have their prior contents; the newly available elements are not necessarily
@@ -289,7 +289,7 @@ public:
class double_array : public array
{
public:
- double_array(int len = 0, double *data = NIL)
+ double_array(int len = 0, double *data = NULL_POINTER)
: root_object(),
array(len, data, SIMPLE_COPY | EXPONE) {}
double_array(const array &to_copy) : array(to_copy) {}
@@ -313,7 +313,7 @@ public:
template
array::array(int num, const contents *init, int flags)
-: root_object(), c_active_length(0), c_real_length(0), c_mem_block(NIL), c_offset(NIL), c_flags(flags)
+: root_object(), c_active_length(0), c_real_length(0), c_mem_block(NULL_POINTER), c_offset(NULL_POINTER), c_flags(flags)
{
if (c_flags > 7) {
#ifdef DEBUG_ARRAY
@@ -329,7 +329,7 @@ array::array(int num, const contents *init, int flags)
template
array::array(const array &cf)
-: root_object(), c_active_length(0), c_real_length(0), c_mem_block(NIL), c_offset(NIL), c_flags(cf.c_flags)
+: root_object(), c_active_length(0), c_real_length(0), c_mem_block(NULL_POINTER), c_offset(NULL_POINTER), c_flags(cf.c_flags)
{
allocator_reset(cf.c_active_length, 1); // get some space.
operator = (cf); // assignment operator does the rest.
@@ -338,9 +338,9 @@ array::array(const array &cf)
template
array::~array()
{
- c_offset = NIL;
+ c_offset = NULL_POINTER;
if (c_mem_block) delete [] c_mem_block;
- c_mem_block = NIL;
+ c_mem_block = NULL_POINTER;
c_active_length = 0;
c_real_length = 0;
}
@@ -421,7 +421,7 @@ template
array array::concatenation(const array &s1) const
{
// tailor the return array to the new size needed.
- array to_return(this->length() + s1.length(), NIL, s1.c_flags);
+ array to_return(this->length() + s1.length(), NULL_POINTER, s1.c_flags);
to_return.overwrite(0, *this); // put the first part into the new array.
to_return.overwrite(this->length(), s1); // add the second segment.
return to_return;
@@ -430,7 +430,7 @@ array array::concatenation(const array &s1) const
template
array array::concatenation(const contents &s1) const
{
- array to_return(this->length() + 1, NIL, c_flags);
+ array to_return(this->length() + 1, NULL_POINTER, c_flags);
to_return.overwrite(0, *this);
if (!this->simple())
to_return.access()[to_return.last()] = s1;
@@ -442,9 +442,9 @@ array array::concatenation(const contents &s1) const
template
array array::subarray(int start, int end) const
{
- bounds_return(start, 0, this->last(), array(0, NIL, c_flags));
- bounds_return(end, 0, this->last(), array(0, NIL, c_flags));
- if (start > end) return array(0, NIL, c_flags);
+ bounds_return(start, 0, this->last(), array(0, NULL_POINTER, c_flags));
+ bounds_return(end, 0, this->last(), array(0, NULL_POINTER, c_flags));
+ if (start > end) return array(0, NULL_POINTER, c_flags);
return array(end - start + 1, &(this->observe()[start]), c_flags);
}
@@ -522,8 +522,8 @@ outcome array::allocator_reset(int initial, int blocking)
if (c_mem_block) {
// remove old contents.
delete [] c_mem_block;
- c_mem_block = NIL;
- c_offset = NIL;
+ c_mem_block = NULL_POINTER;
+ c_offset = NULL_POINTER;
}
c_active_length = initial; // reset the length to the reporting size.
c_real_length = initial + blocking; // compute the real length.
@@ -611,7 +611,7 @@ outcome array::resize(int new_size, how_to_copy way)
if (c_real_length < new_size) {
// there's really not enough space overall, no fooling. we now will
// create a new block.
- c_mem_block = NIL; // zero out the pointer so reset doesn't delete it.
+ c_mem_block = NULL_POINTER; // zero out the pointer so reset doesn't delete it.
delete_old = true;
int blocking = 1;
if (exponential()) blocking = new_size + 1;
@@ -854,7 +854,7 @@ void array::snarf(array &new_contents)
class char_star_array : public array
{
public:
- char_star_array() : array(0, NIL, SIMPLE_COPY | EXPONE
+ char_star_array() : array(0, NULL_POINTER, SIMPLE_COPY | EXPONE
| FLUSH_INVISIBLE) {}
~char_star_array() {
// clean up all the memory we're holding.
diff --git a/nucleus/library/basis/astring.cpp b/nucleus/library/basis/astring.cpp
index 916ec0fd..b9ae54d0 100644
--- a/nucleus/library/basis/astring.cpp
+++ b/nucleus/library/basis/astring.cpp
@@ -69,7 +69,11 @@ astring::astring(char initial, int repeat)
{
if (!initial) initial = ' '; // for nulls, we use spaces.
int new_size = c_character_manager.length() - 1;
- memset(c_character_manager.access(), initial, new_size);
+
+ /*hmmm: eclipse was badgering me into adding types on this, but it's not really an error in my code seemingly.
+ * eclipse seems to want a ? type in the last parameter, not a size_t or int. why? doesn't it know size_t?
+ */
+ memset((void *)c_character_manager.access(), (int)initial, (size_t)new_size);
c_character_manager.put(new_size, '\0');
c_held_string = (char * const *)c_character_manager.internal_offset_mem();
}
@@ -117,7 +121,7 @@ astring::astring(special_flag flag, const char *initial, ...)
va_end(args);
}
-astring::~astring() { c_held_string = NIL; }
+astring::~astring() { c_held_string = NULL_POINTER; }
const astring &astring::empty_string() { return bogonic(); }
@@ -415,7 +419,7 @@ void astring::get_type_character(const char * &traverser, va_list &args,
}
// action time: the output string is given a tasty value.
char temp[LONGEST_SPRINTF];
- char *temp2 = NIL; // for dynamic only.
+ char *temp2 = NULL_POINTER; // for dynamic only.
switch (next_argument) {
//hmmm: this switch is where support would need to be added for having two
// arguments (for the '*' case).
@@ -431,7 +435,7 @@ void astring::get_type_character(const char * &traverser, va_list &args,
if (!to_print) {
// bogus string; put in a complaint.
use_dynamic_sprintf = false;
- ::sprintf(temp, "{error:parm=NIL}");
+ ::sprintf(temp, "{error:parm=NULL_POINTER}");
} else if (strlen(to_print) < LONGEST_SPRINTF - 2) {
// we're within our bounds, plus some safety room, so just do a
// regular sprintf.
@@ -552,7 +556,7 @@ void astring::copy(char *array_to_stuff, int how_many) const
if (!array_to_stuff) return;
array_to_stuff[0] = '\0';
if ( (how_many <= 0) || (length() <= 0) ) return;
- strncpy(array_to_stuff, observe(), minimum(how_many, int(length())));
+ strncpy(array_to_stuff, observe(), (size_t)minimum(how_many, int(length())));
array_to_stuff[minimum(how_many, int(length()))] = '\0';
}
diff --git a/nucleus/library/basis/astring.h b/nucleus/library/basis/astring.h
index 810e3dd5..5ff890e2 100644
--- a/nucleus/library/basis/astring.h
+++ b/nucleus/library/basis/astring.h
@@ -110,7 +110,7 @@ public:
virtual const char *observe() const;
//!< observes the underlying pointer to the zero-terminated string.
/*!< this does not allow the contents to be modified. this method should
- never return NIL. */
+ never return NULL_POINTER. */
const char *c_str() const { return observe(); }
//!< synonym for observe. mimics the STL method name.
const char *s() const { return observe(); }
@@ -121,7 +121,7 @@ public:
virtual char *access();
//!< provides access to the actual string held.
- /*!< this should never return NIL. be very careful with the returned
+ /*!< this should never return NULL_POINTER. be very careful with the returned
pointer: don't destroy or corrupt its contents (e.g., do not mess with
its zero termination). */
char *c_str() { return access(); }
diff --git a/nucleus/library/basis/base_string.h b/nucleus/library/basis/base_string.h
index c2c2cf45..06df036a 100644
--- a/nucleus/library/basis/base_string.h
+++ b/nucleus/library/basis/base_string.h
@@ -35,11 +35,11 @@ public:
virtual const char *observe() const = 0;
//!< observes the underlying pointer to the zero-terminated string.
/*!< this does not allow the contents to be modified. this method should
- never return NIL. */
+ never return NULL_POINTER. */
virtual char *access() = 0;
//!< provides access to the actual string held.
- /*!< this should never return NIL. be very careful with the returned
+ /*!< this should never return NULL_POINTER. be very careful with the returned
pointer: don't destroy or corrupt its contents (e.g., do not mess with
its zero termination). */
diff --git a/nucleus/library/basis/byte_array.h b/nucleus/library/basis/byte_array.h
index cd5239fa..454b3864 100644
--- a/nucleus/library/basis/byte_array.h
+++ b/nucleus/library/basis/byte_array.h
@@ -35,7 +35,7 @@ namespace basis {
class byte_array : public array, public virtual orderable
{
public:
- byte_array(int number = 0, const abyte *initial_contents = NIL)
+ byte_array(int number = 0, const abyte *initial_contents = NULL_POINTER)
: array(number, initial_contents, SIMPLE_COPY | EXPONE) {}
//!< constructs an array of "number" bytes from "initial_contents".
diff --git a/nucleus/library/basis/definitions.h b/nucleus/library/basis/definitions.h
index 421df898..8d022ab0 100644
--- a/nucleus/library/basis/definitions.h
+++ b/nucleus/library/basis/definitions.h
@@ -28,8 +28,11 @@ namespace basis {
// Constants...
-//! The value representing a pointer to nothing, or nothing itself.
-#define NIL 0
+//! The value representing a pointer to nothing.
+#define NULL_POINTER 0
+
+////! A null pointer with a type of (void *).
+//#define NULL_VOID_POINTER (void *)NULL_POINTER
//! A fundamental constant measuring the number of bits in a byte.
#define BITS_PER_BYTE 8
@@ -46,21 +49,6 @@ namespace basis {
//! A fairly important unit which is seldom defined...
typedef unsigned char abyte;
-/* ridiculous! all to shut microsoft up about ambiguous byte definitions,
-which seems like a bug.
-struct byte {
- byte(unsigned char b = 0) : c_data(b) {}
-// byte(char b) : c_data(b) {}
- operator unsigned char() const { return c_data; }
- operator char() const { return c_data; }
- operator int() const { return c_data; }
- operator unsigned int() const { return c_data; }
- operator bool() const { return (bool)c_data; }
- byte operator &(byte and_with) { return c_data & and_with; }
- byte operator |(byte or_with) { return c_data & or_with; }
- unsigned char c_data;
-};
-*/
#if defined(UNICODE) && defined(__WIN32__)
//! the flexichar type is always appropriate to hold data for win32 calls.
@@ -183,6 +171,10 @@ public:
// the returned object junk in almost all cases.
// 4996 turns off warnings about deprecated functions, which are mostly
// nonsense, since these are mainly the core posix functions.
+#else
+//hmmm: trying to fix complaints about size_t being '?'.
+// typedef long long __int64;
+ //#define __SIZE_TYPE__ long unsigned int
#endif // ms visual c++.
//////////////
diff --git a/nucleus/library/basis/functions.h b/nucleus/library/basis/functions.h
index 777461a9..821d3e62 100644
--- a/nucleus/library/basis/functions.h
+++ b/nucleus/library/basis/functions.h
@@ -114,11 +114,11 @@ template type sign(type a)
//! deletion with clearing of the pointer.
/*! this function simplifies the two step process of deleting a pointer and
-then clearing it to NIL. this makes debugging a bit easier since an access
-of NIL should always cause a fault, rather than looking like a possibly
+then clearing it to NULL_POINTER. this makes debugging a bit easier since an access
+of NULL_POINTER should always cause a fault, rather than looking like a possibly
valid object. */
template
-void WHACK(contents * &ptr) { if (ptr) { delete ptr; ptr = NIL; } }
+void WHACK(contents * &ptr) { if (ptr) { delete ptr; ptr = NULL_POINTER; } }
//! Returns an object that is defined statically.
/*! Thus the returned object will never be recreated once this function
diff --git a/nucleus/library/basis/mutex.cpp b/nucleus/library/basis/mutex.cpp
index 73de68c8..3f19f7a5 100644
--- a/nucleus/library/basis/mutex.cpp
+++ b/nucleus/library/basis/mutex.cpp
@@ -59,7 +59,7 @@ void mutex::construct()
ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
#endif
if (ret != 0) {
- printf("failed to initialize mutex attributes!\n"); fflush(NIL);
+ printf("failed to initialize mutex attributes!\n"); fflush(NULL_POINTER);
}
c_os_mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
pthread_mutex_init((pthread_mutex_t *)c_os_mutex, &attr);
diff --git a/nucleus/library/basis/utf_conversion.cpp b/nucleus/library/basis/utf_conversion.cpp
index 807ecb60..a703d0ef 100644
--- a/nucleus/library/basis/utf_conversion.cpp
+++ b/nucleus/library/basis/utf_conversion.cpp
@@ -702,7 +702,7 @@ namespace basis {
transcode_to_utf16::~transcode_to_utf16()
{
delete[] _converted;
- _converted = NIL;
+ _converted = NULL_POINTER;
}
int transcode_to_utf16::length() const
@@ -755,7 +755,7 @@ namespace basis {
transcode_to_utf8::~transcode_to_utf8()
{
delete[] _converted;
- _converted = NIL;
+ _converted = NULL_POINTER;
}
int transcode_to_utf8::length() const
diff --git a/nucleus/library/basis/utf_conversion.h b/nucleus/library/basis/utf_conversion.h
index dcb8b16b..6b1185e0 100644
--- a/nucleus/library/basis/utf_conversion.h
+++ b/nucleus/library/basis/utf_conversion.h
@@ -309,7 +309,7 @@ public:
null_transcoder(const astring &utf8_input, bool make_own_copy);
~null_transcoder() {
if (_make_own_copy) delete [] _converted;
- _converted = NIL;
+ _converted = NULL_POINTER;
}
int length() const;
diff --git a/nucleus/library/configuration/application_configuration.cpp b/nucleus/library/configuration/application_configuration.cpp
index af502e78..d5ca0802 100644
--- a/nucleus/library/configuration/application_configuration.cpp
+++ b/nucleus/library/configuration/application_configuration.cpp
@@ -207,7 +207,7 @@ astring application_configuration::application_name()
to_return = get_cmdline_from_proc();
#elif defined(_MSC_VER)
flexichar low_buff[MAX_ABS_PATH + 1];
- GetModuleFileName(NIL, low_buff, MAX_ABS_PATH - 1);
+ GetModuleFileName(NULL_POINTER, low_buff, MAX_ABS_PATH - 1);
astring buff = from_unicode_temp(low_buff);
buff.to_lower(); // we lower-case the name since windows seems to UC it.
to_return = buff;
diff --git a/nucleus/library/configuration/configuration_list.cpp b/nucleus/library/configuration/configuration_list.cpp
index 97b79650..6e41063e 100644
--- a/nucleus/library/configuration/configuration_list.cpp
+++ b/nucleus/library/configuration/configuration_list.cpp
@@ -57,7 +57,7 @@ const configlet *configuration_list::find(const configlet &to_find) const
return &curr;
}
}
- return NIL;
+ return NULL_POINTER;
}
bool configuration_list::zap(const configlet &dead_item)
diff --git a/nucleus/library/configuration/configuration_list.h b/nucleus/library/configuration/configuration_list.h
index 0aea0ca7..fbf2b7fa 100644
--- a/nucleus/library/configuration/configuration_list.h
+++ b/nucleus/library/configuration/configuration_list.h
@@ -46,9 +46,9 @@ public:
const configlet *find(const configlet &to_find) const;
//!< locates the actual configlet with the section and entry of "to_find".
/*!< note that this might fail if no matching section and entry are found,
- thus returning NIL. the returned object is still kept in the list, so
+ thus returning NULL_POINTER. the returned object is still kept in the list, so
do not try to destroy it. also note that the object passed in must be
- the same type as the object to be found; otherwise, NIL will be
+ the same type as the object to be found; otherwise, NULL_POINTER will be
returned. */
bool zap(const configlet &dead_item);
diff --git a/nucleus/library/configuration/ini_configurator.cpp b/nucleus/library/configuration/ini_configurator.cpp
index 67436f83..c5b2edf6 100644
--- a/nucleus/library/configuration/ini_configurator.cpp
+++ b/nucleus/library/configuration/ini_configurator.cpp
@@ -335,8 +335,8 @@ bool ini_configurator::put_profile_string(const astring §ion,
const astring &entry, const astring &to_store)
{
return bool(WritePrivateProfileString(to_unicode_temp(section),
- entry.length() ? (flexichar *)to_unicode_temp(entry) : NIL,
- to_store.length() ? (flexichar *)to_unicode_temp(to_store) : NIL,
+ entry.length() ? (flexichar *)to_unicode_temp(entry) : NULL_POINTER,
+ to_store.length() ? (flexichar *)to_unicode_temp(to_store) : NULL_POINTER,
to_unicode_temp(name())));
}
@@ -345,8 +345,8 @@ void ini_configurator::get_profile_string(const astring §ion,
flexichar *return_buffer, int buffer_size)
{
GetPrivateProfileString(section.length() ?
- (flexichar *)to_unicode_temp(section) : NIL,
- entry.length() ? (flexichar *)to_unicode_temp(entry) : NIL,
+ (flexichar *)to_unicode_temp(section) : NULL_POINTER,
+ entry.length() ? (flexichar *)to_unicode_temp(entry) : NULL_POINTER,
to_unicode_temp(default_value),
return_buffer, buffer_size, to_unicode_temp(name()));
}
diff --git a/nucleus/library/configuration/system_values.cpp b/nucleus/library/configuration/system_values.cpp
index c9b74f19..6461a0fe 100644
--- a/nucleus/library/configuration/system_values.cpp
+++ b/nucleus/library/configuration/system_values.cpp
@@ -15,11 +15,11 @@
#include "ini_configurator.h"
#include "system_values.h"
-#include
#include
#include
#include
#include
+#include "../algorithms/sorts.h"
using namespace algorithms;
using namespace basis;
@@ -73,7 +73,7 @@ public:
return curr;
}
}
- return NIL;
+ return NULL_POINTER;
}
};
diff --git a/nucleus/library/crypto/blowfish_crypto.cpp b/nucleus/library/crypto/blowfish_crypto.cpp
index 37543df8..f5f7681b 100644
--- a/nucleus/library/crypto/blowfish_crypto.cpp
+++ b/nucleus/library/crypto/blowfish_crypto.cpp
@@ -206,7 +206,7 @@ bool blowfish_crypto::encrypt(const byte_array &source,
EVP_CIPHER_CTX *session = EVP_CIPHER_CTX_new();
EVP_CIPHER_CTX_init(session);
- EVP_EncryptInit_ex(session, EVP_bf_cbc(), NIL, _key->observe(),
+ EVP_EncryptInit_ex(session, EVP_bf_cbc(), NULL_POINTER, _key->observe(),
init_vector().observe());
EVP_CIPHER_CTX_set_key_length(session, _key_size);
@@ -260,7 +260,7 @@ bool blowfish_crypto::decrypt(const byte_array &source,
EVP_CIPHER_CTX *session = EVP_CIPHER_CTX_new();
EVP_CIPHER_CTX_init(session);
LOG(a_sprintf("key size %d bits.\n", BITS_PER_BYTE * _key->length()));
- EVP_DecryptInit_ex(session, EVP_bf_cbc(), NIL, _key->observe(),
+ EVP_DecryptInit_ex(session, EVP_bf_cbc(), NULL_POINTER, _key->observe(),
init_vector().observe());
EVP_CIPHER_CTX_set_key_length(session, _key_size);
diff --git a/nucleus/library/crypto/rsa_crypto.cpp b/nucleus/library/crypto/rsa_crypto.cpp
index 36c89ed8..165f66b6 100644
--- a/nucleus/library/crypto/rsa_crypto.cpp
+++ b/nucleus/library/crypto/rsa_crypto.cpp
@@ -31,6 +31,7 @@
#include
#include
+#include
#include
using namespace basis;
@@ -55,7 +56,7 @@ SAFE_STATIC(mutex, __single_stepper, )
// protects unsafe areas of rsa crypto from access by multiple threads at once.
rsa_crypto::rsa_crypto(int key_size)
-: _key(NIL)
+: _key(NULL_POINTER)
{
FUNCDEF("ctor(int)");
LOG("prior to generating key");
@@ -64,7 +65,7 @@ rsa_crypto::rsa_crypto(int key_size)
}
rsa_crypto::rsa_crypto(const byte_array &key)
-: _key(NIL)
+: _key(NULL_POINTER)
{
FUNCDEF("ctor(byte_array)");
static_ssl_initializer();
@@ -75,7 +76,7 @@ rsa_crypto::rsa_crypto(const byte_array &key)
}
rsa_crypto::rsa_crypto(RSA *key)
-: _key(NIL)
+: _key(NULL_POINTER)
{
FUNCDEF("ctor(RSA)");
static_ssl_initializer();
@@ -86,7 +87,7 @@ rsa_crypto::rsa_crypto(RSA *key)
rsa_crypto::rsa_crypto(const rsa_crypto &to_copy)
: root_object(),
- _key(NIL)
+ _key(NULL_POINTER)
{
FUNCDEF("copy ctor");
static_ssl_initializer();
@@ -118,12 +119,20 @@ RSA *rsa_crypto::generate_key(int key_size)
static_ssl_initializer();
LOG("into generate key");
auto_synchronizer mutt(__single_stepper());
- RSA *to_return = RSA_generate_key(key_size, 65537, NIL, NIL);
- if (!to_return) {
+ RSA *to_return = RSA_new();
+ BIGNUM *e = BN_new();
+ BN_set_word(e, 65537);
+//hmmm: only one value of e?
+ int ret = RSA_generate_key_ex(to_return, key_size, e, NULL_POINTER);
+ if (!ret) {
continuable_error(static_class_name(), func,
- a_sprintf("failed to generate a key of %d bits.", key_size));
+ a_sprintf("failed to generate a key of %d bits: error is %ld.", key_size, ERR_get_error()));
+ BN_free(e);
+ RSA_free(to_return);
+ return NULL;
}
LOG("after key generated");
+ BN_free(e);
return to_return;
}
@@ -146,17 +155,17 @@ bool rsa_crypto::set_key(byte_array &key)
// get the public key bits first.
byte_array n;
if (!structures::detach(key, n)) return false;
- BIGNUM *the_n = BN_bin2bn(n.access(), n.length(), NIL);
+ BIGNUM *the_n = BN_bin2bn(n.access(), n.length(), NULL_POINTER);
if (!the_n) return false;
byte_array e;
if (!structures::detach(key, e)) return false;
- BIGNUM *the_e = BN_bin2bn(e.access(), e.length(), NIL);
+ BIGNUM *the_e = BN_bin2bn(e.access(), e.length(), NULL_POINTER);
if (!the_e) return false;
if (type == 'u') {
// done with public key.
#ifdef NEWER_OPENSSL
- RSA_set0_key(_key, the_n, the_e, NIL);
+ RSA_set0_key(_key, the_n, the_e, NULL_POINTER);
#else
_key->n = the_n; _key->e = the_e;
#endif
@@ -166,28 +175,28 @@ bool rsa_crypto::set_key(byte_array &key)
// the rest is for a private key.
byte_array d;
if (!structures::detach(key, d)) return false;
- BIGNUM *the_d = BN_bin2bn(d.access(), d.length(), NIL);
+ BIGNUM *the_d = BN_bin2bn(d.access(), d.length(), NULL_POINTER);
if (!the_d) return false;
byte_array p;
if (!structures::detach(key, p)) return false;
- BIGNUM *the_p = BN_bin2bn(p.access(), p.length(), NIL);
+ BIGNUM *the_p = BN_bin2bn(p.access(), p.length(), NULL_POINTER);
if (!the_p) return false;
byte_array q;
if (!structures::detach(key, q)) return false;
- BIGNUM *the_q = BN_bin2bn(q.access(), q.length(), NIL);
+ BIGNUM *the_q = BN_bin2bn(q.access(), q.length(), NULL_POINTER);
if (!the_q) return false;
byte_array dmp1;
if (!structures::detach(key, dmp1)) return false;
- BIGNUM *the_dmp1 = BN_bin2bn(dmp1.access(), dmp1.length(), NIL);
+ BIGNUM *the_dmp1 = BN_bin2bn(dmp1.access(), dmp1.length(), NULL_POINTER);
if (!the_dmp1) return false;
byte_array dmq1;
if (!structures::detach(key, dmq1)) return false;
- BIGNUM *the_dmq1 = BN_bin2bn(dmq1.access(), dmq1.length(), NIL);
+ BIGNUM *the_dmq1 = BN_bin2bn(dmq1.access(), dmq1.length(), NULL_POINTER);
if (!the_dmq1) return false;
byte_array iqmp;
if (!structures::detach(key, iqmp)) return false;
- BIGNUM *the_iqmp = BN_bin2bn(iqmp.access(), iqmp.length(), NIL);
+ BIGNUM *the_iqmp = BN_bin2bn(iqmp.access(), iqmp.length(), NULL_POINTER);
if (!the_iqmp) return false;
// we can set the n, e and d now.
@@ -217,7 +226,7 @@ bool rsa_crypto::set_key(byte_array &key)
bool rsa_crypto::set_key(RSA *key)
{
FUNCDEF("set_key [RSA]");
- if (!key) return NIL;
+ if (!key) return NULL_POINTER;
// test the incoming key.
auto_synchronizer mutt(__single_stepper());
int check = RSA_check_key(key);
@@ -266,7 +275,7 @@ bool rsa_crypto::private_key(byte_array &privkey) const
if (!worked) return false;
privkey[posn] = abyte('r'); // switch public key flag to private.
// convert the multiple private portions into binary.
- //const BIGNUM **the_n = NIL, **the_e = NIL, **the_d = NIL;
+ //const BIGNUM **the_n = NULL_POINTER, **the_e = NULL_POINTER, **the_d = NULL_POINTER;
BIGNUM **the_n = new BIGNUM *, **the_e = new BIGNUM *, **the_d = new BIGNUM *;
BIGNUM **the_p = new BIGNUM *, **the_q = new BIGNUM *;
BIGNUM **the_dmp1 = new BIGNUM *, **the_dmq1 = new BIGNUM *, **the_iqmp = new BIGNUM *;
diff --git a/nucleus/library/crypto/ssl_init.cpp b/nucleus/library/crypto/ssl_init.cpp
index 128cd54d..161874cb 100644
--- a/nucleus/library/crypto/ssl_init.cpp
+++ b/nucleus/library/crypto/ssl_init.cpp
@@ -70,8 +70,12 @@ ssl_init::~ssl_init()
FUNCDEF("dtor");
LOG("prior to crypto cleanup");
CRYPTO_cleanup_all_ex_data();
- LOG("prior to err remove state");
- ERR_remove_state(0);
+
+//hmmm: deprecated
+// LOG("prior to err remove state");
+// ERR_remove_thread_state(NULL);
+
+
//THIS HAD TO be removed in most recent openssl; does it exist?
// LOG("prior to mem leaks fp");
// CRYPTO_mem_leaks_fp(stderr);
diff --git a/nucleus/library/crypto/ssl_init.h b/nucleus/library/crypto/ssl_init.h
index fc1d8af2..27b52d96 100644
--- a/nucleus/library/crypto/ssl_init.h
+++ b/nucleus/library/crypto/ssl_init.h
@@ -18,6 +18,8 @@
#include
#include
+#include
+
namespace crypto {
//! provides some initialization for the RSA and blowfish crypto.
@@ -28,11 +30,10 @@ namespace crypto {
very bottom and it will be managed globally for the entire program.
*/
-//we define NEWER_OPENSSL for those places where we're using openssl 1.1.1.
-#if defined(_MSC_VER)
+// we define NEWER_OPENSSL for those places where we're using more recent versions.
+// this forces the code to choose newer methods over deprecated ones.
+#if OPENSSL_VERSION_NUMBER > 0x10100000L
#define NEWER_OPENSSL
-#else
-// #define OLDER_OPENSSL
#endif
class ssl_init : public virtual basis::nameable
diff --git a/nucleus/library/filesystem/byte_filer.cpp b/nucleus/library/filesystem/byte_filer.cpp
index 0384d2ec..e091996b 100644
--- a/nucleus/library/filesystem/byte_filer.cpp
+++ b/nucleus/library/filesystem/byte_filer.cpp
@@ -44,7 +44,7 @@ class file_hider
public:
FILE *fp; // the real file pointer.
- file_hider() : fp(NIL) {}
+ file_hider() : fp(NULL_POINTER) {}
};
//////////////
@@ -88,8 +88,8 @@ bool byte_filer::open(const astring &fname, const astring &perms)
close();
_auto_close = true; // reset since we know we're opening this.
_filename->reset(fname);
- _handle->fp = _filename->raw().t()? fopen(_filename->raw().s(), perms.s()) : NIL;
- if (_handle->fp == NIL) return false;
+ _handle->fp = _filename->raw().t()? fopen(_filename->raw().s(), perms.s()) : NULL_POINTER;
+ if (_handle->fp == NULL_POINTER) return false;
return good();
}
@@ -97,7 +97,7 @@ void byte_filer::close()
{
_filename->reset("");
if (_auto_close && _handle->fp) fclose(_handle->fp);
- _handle->fp = NIL;
+ _handle->fp = NULL_POINTER;
}
bool byte_filer::good() { return !!_handle->fp; }
diff --git a/nucleus/library/filesystem/directory.cpp b/nucleus/library/filesystem/directory.cpp
index c9ce8e99..f1341e68 100644
--- a/nucleus/library/filesystem/directory.cpp
+++ b/nucleus/library/filesystem/directory.cpp
@@ -15,7 +15,6 @@
#include "directory.h"
#include "filename.h"
-#include
#include
#include
#include
@@ -27,6 +26,8 @@
#include
#include
#include
+
+#include "../algorithms/sorts.h"
#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
#include
#include
diff --git a/nucleus/library/filesystem/directory_tree.cpp b/nucleus/library/filesystem/directory_tree.cpp
index 54a8ca9b..a7611721 100644
--- a/nucleus/library/filesystem/directory_tree.cpp
+++ b/nucleus/library/filesystem/directory_tree.cpp
@@ -51,7 +51,7 @@ public:
dir_tree_iterator(const filename_tree *initial,
tree::traversal_directions dir)
- : filename_tree::iterator(initial, dir), _current(NIL) {}
+ : filename_tree::iterator(initial, dir), _current(NULL_POINTER) {}
};
//////////////
@@ -71,7 +71,7 @@ directory_tree::directory_tree(const astring &path, const char *pattern,
: _scanned_okay(false),
_path(new astring(path)),
_pattern(new astring(pattern)),
- _real_tree(NIL),
+ _real_tree(NULL_POINTER),
_ignore_files(ignore_files),
_creator(new fname_tree_creator)
{
@@ -181,7 +181,7 @@ void directory_tree::traverse(const astring &path, const char *pattern,
// and recursively traverse that sub-node also.
const string_array &dirs = curr.directories();
for (int i = 0; i < dirs.length(); i++) {
- filename_tree *new_branch = NIL;
+ filename_tree *new_branch = NULL_POINTER;
astring new_path = path + filename::default_separator() + dirs[i];
#ifdef DEBUG_DIRECTORY_TREE
LOG(astring("seeking path: ") + new_path);
@@ -324,7 +324,7 @@ filename_tree *directory_tree::goto_current(dir_tree_iterator &scanning)
scanning._current = (filename_tree *)scanning.next();
}
// now check that we're healthy.
- if (!scanning._current) return NIL; // all done.
+ if (!scanning._current) return NULL_POINTER; // all done.
// cast the tree to the right type.
return dynamic_cast(scanning._current);
@@ -377,7 +377,7 @@ bool directory_tree::current(dir_tree_iterator &scanning,
filename_list *directory_tree::access(dir_tree_iterator &scanning)
{
filename_tree *tof = goto_current(scanning);
- if (!tof) return NIL;
+ if (!tof) return NULL_POINTER;
return &tof->_files;
}
@@ -440,7 +440,7 @@ filename_tree *directory_tree::seek(const astring &dir_name_in,
bool found = false;
// start looking at all the items in the list, even though we might have
// to abandon the iteration if we find a match.
- filename_tree *check = NIL;
+ filename_tree *check = NULL_POINTER;
for (posn = 0; posn < examining.length(); posn++) {
check = examining[posn];
filename current(check->_dirname);
@@ -473,21 +473,21 @@ filename_tree *directory_tree::seek(const astring &dir_name_in,
break;
}
}
- if (!found) return NIL; // we found nothing comparable.
+ if (!found) return NULL_POINTER; // we found nothing comparable.
// we found a partial match. that means we should start looking at this
// node's children for the exact match.
if (!check) {
// this is a serious logical error!
LOG("serious logical error: tree was not located.");
- return NIL;
+ return NULL_POINTER;
}
examining.reset(); // clear the existing nodes.
for (int i = 0; i < check->branches(); i++)
examining += (filename_tree *)check->branch(i);
}
- return NIL; // we found nothing that looked like that node.
+ return NULL_POINTER; // we found nothing that looked like that node.
}
bool directory_tree::calculate(bool just_size)
@@ -841,14 +841,14 @@ outcome directory_tree::add_path(const astring &new_item, bool just_size)
// find the common root, break up the path into pieces, and tell us where
// we matched.
string_array pieces;
- filename_tree *last_match = NIL;
+ filename_tree *last_match = NULL_POINTER;
int comp_index;
astring reassembled; // this will hold the common root.
outcome ret = find_common_root(new_item, true, last_match, reassembled,
pieces, comp_index);
if (!last_match) {
LOG(astring("serious error finding common root for ") + new_item
- + ", got NIL tree.");
+ + ", got null tree.");
return common::FAILURE; // something serious isn't right.
}
@@ -929,7 +929,7 @@ outcome directory_tree::remove_path(const astring &zap_item)
FUNCDEF("remove_path");
// find the common root, if one exists. if not, we're not going to do this.
string_array pieces;
- filename_tree *last_match = NIL;
+ filename_tree *last_match = NULL_POINTER;
int comp_index;
astring reassembled;
outcome ret = find_common_root(zap_item, false, last_match, reassembled,
diff --git a/nucleus/library/filesystem/directory_tree.h b/nucleus/library/filesystem/directory_tree.h
index 6ad56a0e..bd55d2df 100644
--- a/nucleus/library/filesystem/directory_tree.h
+++ b/nucleus/library/filesystem/directory_tree.h
@@ -174,7 +174,7 @@ public:
static filename_list *access(dir_tree_iterator &scanning);
//!< more dangerous operation that lets the actual list be manipulated.
- /*!< NIL is returned if there was a problem accessing the tree
+ /*!< NULL_POINTER is returned if there was a problem accessing the tree
at the iterator position. */
static bool depth(dir_tree_iterator &scanning, int &depth);
@@ -201,7 +201,7 @@ private:
static filename_tree *goto_current(dir_tree_iterator &scanning);
//!< goes to the current node for "scanning" and returns the tree there.
- /*!< if there are no nodes left, NIL is returned. */
+ /*!< if there are no nodes left, NULL_POINTER is returned. */
void traverse(const basis::astring &path, const char *pattern,
filename_tree &add_to);
diff --git a/nucleus/library/filesystem/file_time.h b/nucleus/library/filesystem/file_time.h
index 0e89d356..9467b607 100644
--- a/nucleus/library/filesystem/file_time.h
+++ b/nucleus/library/filesystem/file_time.h
@@ -35,7 +35,7 @@ public:
file_time(FILE *the_FILE);
//!< sets up the file_time information given a the file stream of interest.
- /*!< If the stream is NIL, then the file_time is set up with an invalid
+ /*!< If the stream is NULL_POINTER, then the file_time is set up with an invalid
time. */
file_time(const basis::astring &filename);
diff --git a/nucleus/library/filesystem/filename_list.cpp b/nucleus/library/filesystem/filename_list.cpp
index 28ec7386..2ebe6d04 100644
--- a/nucleus/library/filesystem/filename_list.cpp
+++ b/nucleus/library/filesystem/filename_list.cpp
@@ -102,7 +102,7 @@ const file_info *filename_list::find(const filename &to_check) const
if (to_check.raw() == get(i)->raw()) return get(i);
#endif
}
- return NIL;
+ return NULL_POINTER;
}
int filename_list::locate(const filename &to_find) const
diff --git a/nucleus/library/filesystem/filename_list.h b/nucleus/library/filesystem/filename_list.h
index 89c91c2d..74d258b8 100644
--- a/nucleus/library/filesystem/filename_list.h
+++ b/nucleus/library/filesystem/filename_list.h
@@ -60,7 +60,7 @@ public:
const file_info *find(const filename &to_check) const;
//!< locates the record of information for the filename "to_check".
/*!< do not modify the returned object. it contains the current state
- of the file in question. if the file wasn't in the list, then NIL is
+ of the file in question. if the file wasn't in the list, then NULL_POINTER is
returned. */
int locate(const filename &to_find) const;
diff --git a/nucleus/library/filesystem/huge_file.cpp b/nucleus/library/filesystem/huge_file.cpp
index 21158ca4..ae838295 100644
--- a/nucleus/library/filesystem/huge_file.cpp
+++ b/nucleus/library/filesystem/huge_file.cpp
@@ -289,14 +289,14 @@ basis::outcome huge_file::touch()
if (filename(_real_file->name()).exists()) {
// file exists, so just update time.
#ifndef __WIN32__
- int ret = utimes(_real_file->name().observe(), NIL);
+ int ret = utimes(_real_file->name().observe(), NULL_POINTER);
if (ret != 0)
return FAILURE;
#else
// open the file, although the function says create in its name...
HANDLE f = CreateFile(_real_file->name().observe(),
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
- NIL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NIL);
+ NULL_POINTER, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL_POINTER);
if (!f) {
LOG(a_sprintf("failed to open file %s", _real_file->name().observe()));
return FAILURE;
@@ -308,7 +308,7 @@ basis::outcome huge_file::touch()
FILETIME *t = new FILETIME;
SystemTimeToFileTime(st, t);
// set the file's time.
- SetFileTime(f, NIL, t, t);
+ SetFileTime(f, NULL_POINTER, t, t);
#endif
} else {
// file doesn't exist yet.
diff --git a/nucleus/library/loggers/critical_events.cpp b/nucleus/library/loggers/critical_events.cpp
index 79f87261..a3002d13 100644
--- a/nucleus/library/loggers/critical_events.cpp
+++ b/nucleus/library/loggers/critical_events.cpp
@@ -70,9 +70,9 @@ astring critical_events::system_error_text(basis::un_int to_name)
return strerror(to_name);
#elif defined(_MSC_VER)
char error_text[1000];
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NIL, to_name,
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL_POINTER, to_name,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)error_text,
- sizeof(error_text) - 1, NIL);
+ sizeof(error_text) - 1, NULL_POINTER);
astring to_return = error_text;
// trim off the ridiculous carriage return they add.
while ( (to_return[to_return.end()] == '\r')
@@ -141,7 +141,7 @@ void critical_events::alert_message(const char *info, const char *title)
to_print += info;
program_wide_logger::get().log(to_print, ALWAYS_PRINT);
- fflush(NIL); // flush all output streams.
+ fflush(NULL_POINTER); // flush all output streams.
}
void critical_events::alert_message(const astring &info) { alert_message(info.s()); }
diff --git a/nucleus/library/loggers/file_logger.cpp b/nucleus/library/loggers/file_logger.cpp
index bd8c22a6..d21f7b59 100644
--- a/nucleus/library/loggers/file_logger.cpp
+++ b/nucleus/library/loggers/file_logger.cpp
@@ -60,7 +60,7 @@ int static_chaos() {
file_logger::file_logger()
: _filename(new astring()),
_file_limit(DEFAULT_LOG_FILE_SIZE),
- _outfile(NIL),
+ _outfile(NULL_POINTER),
_flock(new mutex)
{
name("");
@@ -69,7 +69,7 @@ file_logger::file_logger()
file_logger::file_logger(const astring &initial_filename, int limit)
: _filename(new astring()),
_file_limit(limit),
- _outfile(NIL),
+ _outfile(NULL_POINTER),
_flock(new mutex)
{
name(initial_filename);
diff --git a/nucleus/library/loggers/program_wide_logger.cpp b/nucleus/library/loggers/program_wide_logger.cpp
index f5f6e374..2bd278e7 100644
--- a/nucleus/library/loggers/program_wide_logger.cpp
+++ b/nucleus/library/loggers/program_wide_logger.cpp
@@ -26,7 +26,7 @@ standard_log_base &program_wide_logger::get() { return *c_the_wide_log; }
standard_log_base *program_wide_logger::set(standard_log_base *new_log)
{
- if (!new_log) return NIL; // can't fool me that easily.
+ if (!new_log) return NULL_POINTER; // can't fool me that easily.
standard_log_base *old_log = c_the_wide_log;
c_the_wide_log = new_log;
return old_log;
diff --git a/nucleus/library/nodes/doubly_linked_list.cpp b/nucleus/library/nodes/doubly_linked_list.cpp
new file mode 100644
index 00000000..27c28864
--- /dev/null
+++ b/nucleus/library/nodes/doubly_linked_list.cpp
@@ -0,0 +1,265 @@
+/*
+*
+* Name : doubly_linked_list
+* Author : Chris Koeritz
+**
+* Copyright (c) 1998-$now By Author. This program is free software; you can
+* redistribute it and/or modify it under the terms of the GNU General Public
+* License as published by the Free Software Foundation; either version 2 of
+* the License or (at your option) any later version. This is online at:
+* http://www.fsf.org/copyleft/gpl.html
+* Please send any updates to: fred@gruntose.com
+*/
+
+/*
+ * POLICIES:
+ *
+ * + the cursor should never be stored to or deleted; it is merely a scanner that runs through the list.
+ * + the cursor can point at the head or tail. any storage action is taken to mean that it applies to the closest real object, if one exists. any query action is taken similarly.
+ */
+
+#include "doubly_linked_list.h"
+
+#include "node.h"
+
+#include
+
+namespace nodes {
+
+// nice names for the positions of the next link and the previous link in
+// our node's indices.
+const int PREVIOUS = 0;
+const int NEXT = 1;
+
+//////////////
+
+// iterator functions:
+
+void doubly_linked_list::iterator::operator ++()
+{
+ if (is_tail()) return; // already at the end.
+ _cursor = _cursor->get_link(NEXT);
+}
+
+void doubly_linked_list::iterator::operator --()
+{
+ if (is_head()) return; // already at the front.
+ _cursor = _cursor->get_link(PREVIOUS);
+}
+
+bool doubly_linked_list::iterator::operator ==(const iterator &to_compare) const
+{ return _cursor == to_compare._cursor; }
+
+const node *doubly_linked_list::iterator::observe()
+{
+ if (!_manager || _manager->empty()) return NULL_POINTER;
+ if (*this == _manager->head()) next();
+ if (*this == _manager->tail()) previous();
+ return _cursor;
+}
+
+node *doubly_linked_list::iterator::access()
+{
+ if (!_manager || _manager->empty()) return NULL_POINTER;
+ if (*this == _manager->head()) next();
+ if (*this == _manager->tail()) previous();
+ return _cursor;
+}
+
+bool doubly_linked_list::iterator::is_head() const
+{
+ if (!_manager) return false;
+ return _cursor == _manager->_head;
+}
+
+bool doubly_linked_list::iterator::is_tail() const
+{
+ if (!_manager) return false;
+ return _cursor == _manager->_tail;
+}
+
+void doubly_linked_list::iterator::jump_head()
+{
+ if (!_manager) return;
+ _cursor = _manager->_head;
+}
+
+void doubly_linked_list::iterator::jump_tail()
+{
+ if (!_manager) return;
+ _cursor = _manager->_tail;
+}
+
+//////////////
+
+doubly_linked_list::doubly_linked_list()
+: _head(NULL_POINTER), _tail(NULL_POINTER)
+{
+ _head = new node(2);
+ _tail = new node(2);
+ _head->set_link(NEXT, _tail);
+ _tail->set_link(PREVIOUS, _head);
+}
+
+doubly_linked_list::~doubly_linked_list()
+{
+ iterator zapper = head();
+ while (!empty())
+ zap(zapper);
+ WHACK(_head);
+ WHACK(_tail);
+}
+
+bool doubly_linked_list::empty() const
+{
+ if (_head->get_link(NEXT) == _tail) return true;
+ return false;
+}
+
+bool doubly_linked_list::set_index(iterator &where, int new_index)
+{
+ if (where._manager != this) return false;
+ if (empty()) return false;
+ node *skipper = _head->get_link(NEXT);
+ for (int i = 0; i < new_index; i++) {
+ skipper = skipper->get_link(NEXT);
+ if (skipper == _tail) return false; // out of bounds now.
+ }
+ where._cursor = skipper;
+ return true;
+}
+
+bool doubly_linked_list::forward(iterator &where, int count)
+{
+ if (where._manager != this) return false;
+ if (count <= 0) return true;
+ if (items_from_tail(where) < count) return false;
+ if (where.is_head()) where.next(); // skip the head guard.
+ for (int i = 0; i < count; i++) where.next();
+ return true;
+}
+
+bool doubly_linked_list::backward(iterator &where, int count)
+{
+ if (where._manager != this) return false;
+ if (count <= 0) return true;
+ if (items_from_head(where) < count) return false;
+ if (where.is_tail()) where.previous(); // skip the tail guard.
+ for (int i = 0; i < count; i++) where.previous();
+ return true;
+}
+
+int doubly_linked_list::elements() const
+{
+ if (empty()) return 0;
+ int to_return = 0;
+ node *skipper = _head->get_link(NEXT);
+ while (skipper != _tail) {
+ to_return++;
+ skipper = skipper->get_link(NEXT);
+ }
+ return to_return;
+}
+
+int doubly_linked_list::items_from_head(const iterator &where) const
+{
+ if (where._manager != this) return 0;
+ if (where.is_head()) return 0; // make sure it's not there already.
+ int index = 0;
+ node *skipper = _head->get_link(NEXT);
+ while ( (where._cursor != skipper) && (skipper != _tail) ) {
+ index++;
+ skipper = skipper->get_link(NEXT);
+ }
+ return index;
+}
+
+int doubly_linked_list::items_from_tail(const iterator &where) const
+{
+ if (where._manager != this) return 0;
+ if (where.is_tail()) return 0; // make sure it's not there already.
+ int index = 0;
+ node *skipper = _tail->get_link(PREVIOUS);
+ while ( (where._cursor != skipper) && (skipper != _head) ) {
+ index++;
+ skipper = skipper->get_link(PREVIOUS);
+ }
+ return index;
+}
+
+/*
+node *list::get()
+{
+ if (empty()) return NULL_POINTER; // make sure the list isn't empty.
+ if (_cursor == _head) return _head->get_link(NEXT);
+ // check special case for pointing at the head.
+ if (_cursor == _tail) return _tail->get_link(PREVIOUS);
+ // check special case for pointing at the tail.
+ return _cursor;
+}
+*/
+
+node *doubly_linked_list::remove(iterator &where)
+{
+ if (where._manager != this) return NULL_POINTER;
+ if (empty()) return NULL_POINTER;
+ if (where._cursor == _head)
+ where._cursor = _head->get_link(NEXT);
+ if (where._cursor == _tail)
+ where._cursor = _tail->get_link(PREVIOUS);
+ node *old_cursor = where._cursor;
+ node *old_previous = old_cursor->get_link(PREVIOUS);
+ node *old_next = old_cursor->get_link(NEXT);
+ old_cursor->set_link(PREVIOUS, NULL_POINTER);
+ old_cursor->set_link(NEXT, NULL_POINTER);
+ old_previous->set_link(NEXT, old_next);
+ old_next->set_link(PREVIOUS, old_previous);
+ where._cursor = old_next;
+ return old_cursor;
+}
+
+void doubly_linked_list::zap(iterator &where) { delete remove(where); }
+
+void doubly_linked_list::append(iterator &where, node *new_node)
+{
+ if (where._manager != this) return;
+ while (new_node->links() < 2) new_node->insert_link(0, NULL_POINTER);
+ if (empty()) where._cursor = _head;
+ if (where._cursor == _tail)
+ where._cursor = _tail->get_link(PREVIOUS);
+ // shift from the tail sentinel to the tail element.
+ node *save_next = where._cursor->get_link(NEXT);
+ where._cursor->set_link(NEXT, new_node);
+ new_node->set_link(PREVIOUS, where._cursor);
+ new_node->set_link(NEXT, save_next);
+ save_next->set_link(PREVIOUS, new_node);
+ where._cursor = new_node;
+}
+
+void doubly_linked_list::insert(iterator &where, node *new_node)
+{
+ if (where._manager != this) return;
+ while (new_node->links() < 2) new_node->insert_link(0, NULL_POINTER);
+ if (empty()) where._cursor = _tail;
+ if (where._cursor == _head)
+ where._cursor = _head->get_link(NEXT);
+ // shift from head sentinel to the head element.
+ node *save_prior = where._cursor->get_link(PREVIOUS);
+ where._cursor->set_link(PREVIOUS, new_node);
+ new_node->set_link(NEXT, where._cursor);
+ new_node->set_link(PREVIOUS, save_prior);
+ save_prior->set_link(NEXT, new_node);
+ where._cursor = new_node;
+}
+
+void doubly_linked_list::zap_all()
+{
+ iterator zapper = head();
+ while (!empty()) zap(zapper);
+}
+
+} // namespace.
+
+
+
+
diff --git a/nucleus/library/nodes/doubly_linked_list.h b/nucleus/library/nodes/doubly_linked_list.h
new file mode 100644
index 00000000..987e2480
--- /dev/null
+++ b/nucleus/library/nodes/doubly_linked_list.h
@@ -0,0 +1,194 @@
+#ifndef DOUBLY_LINKED_LIST_CLASS
+#define DOUBLY_LINKED_LIST_CLASS
+
+/*
+* Name : doubly_linked_list
+* Author : Chris Koeritz
+**
+* Copyright (c) 1998-$now By Author. This program is free software; you can
+* redistribute it and/or modify it under the terms of the GNU General Public
+* License as published by the Free Software Foundation; either version 2 of
+* the License or (at your option) any later version. This is online at:
+* http://www.fsf.org/copyleft/gpl.html
+* Please send any updates to: fred@gruntose.com
+*/
+
+namespace nodes {
+
+class node; // forward.
+
+//! Implements a guarded, doubly linked list structure.
+/*!
+ The list is viewed one element at a time, through the monocular of an
+ iterator, which keeps track of the current position in the list. the
+ iterator's cursor can be shifted around at will. nodes can be added to
+ the list before or after the cursor, and the node pointed at by the cursor
+ can be queried or modified. Using multiple iterators is fine as long as
+ you guarantee that they either are all just reading the list or that you
+ have a valid access pattern of reads and writes such that no iterator's
+ cursor is affected. Note that this list is not thread safe.
+*/
+
+
+//hmmm: is this class really for real? it's doing all sorts of stuff with nodes, rather than with the list object itself.
+// consider dropping the current implementation and providing more standard list operations, on an object that is actually using itself in its definition, rather than a different class (node).
+// this would be easy to do if we just break down and define the dl list as a node itself. then we have something to work with.
+
+//current iterator implementation here is bunk.
+
+
+class doubly_linked_list
+{
+public:
+ doubly_linked_list();
+ //!< constructs a blank list.
+
+ ~doubly_linked_list();
+ //!< invalidates all contents of the list and destroys all child nodes.
+
+ int elements() const;
+ //!< returns the number of items currently in the list.
+ /*!< this is a costly operation. */
+
+ bool empty() const;
+ //!< returns true if the list is empty.
+ /*!< this is really quick compared to checking the number of elements. */
+
+ //! iterators allow the list to be traversed.
+ /*! NOTE: it is an error to use an iterator on one list with a different
+ list; the methods will do nothing or return empty results in this
+ situation. */
+
+ class iterator {
+ public:
+ iterator(const doubly_linked_list *mgr, node *start) : _cursor(start), _manager(mgr) {}
+ //!< opens up an iterator on a list.
+ /*!< the preferred method to construct an iterator is to use the
+ head/tail functions in list. */
+
+ void operator ++(); //!< go to next item.
+ void operator --(); //!< go to previous item.
+ void operator ++(int) { ++(*this); } //!< post-fix synonym for ++.
+ void operator --(int) { --(*this); } //!< post-fix synonym for --.
+
+
+ void next() { (*this)++; } //!< synonym for ++.
+ void previous() { (*this)--; } //!< synonyms for --.
+
+ bool operator ==(const iterator &to_compare) const;
+ //!< returns true if the two iterators are at the same position.
+
+ bool is_head() const;
+ //!< returns true if the cursor is at the head of the list.
+ /*!< Note: head() and tail() only return true if the iterator is
+ actually positioned _at_ the head or tail guard. for example, if the
+ cursor is pointing at the last actual element in the list (but not at
+ the guard itself), then is_tail() returns false. so, in iteration,
+ your iterator will actually go past the last valid element before
+ is_tail() returns true. thus it is very important to check is_tail()
+ *before* looking at the node with observe() or access(), since those
+ two will shift the list position to the nearest valid node and away
+ from the guard. */
+ bool is_tail() const;
+ //!< returns true if the cursor is at the tail of the list.
+
+ void jump_head(); //!< set the iterator to the head.
+ void jump_tail(); //!< set the iterator to the tail.
+
+ const node *observe(); //!< peek at the current element.
+ /*!< Note: observe() and access() will return the first element if the
+ list is positioned at the head (or the last if at the tail), and will
+ not return NULL_POINTER for these two positions as long as the list has some
+ elements in it. the cursor will also have been moved to point at the
+ element that is returned.
+ Another Note: it is extremely important that you do not mess with the
+ links owned by the node (or at least the first two links).
+ A Third Note: these two functions can return NULL_POINTER if the list is empty. */
+ node *access(); //!< obtain access to the current element.
+
+ private:
+ node *_cursor; //!< the current position.
+ friend class doubly_linked_list; //!< lists have full access to this object.
+ const doubly_linked_list *_manager; //!< our friendly manager.
+ };
+
+ iterator head() const { return iterator(this, _head); }
+ //!< returns an iterator located at the head of the list.
+ iterator tail() const { return iterator(this, _tail); }
+ //!< returns an iterator located at the tail of the list.
+
+ int index(const iterator &it) const { return items_from_head(it); }
+ //!< returns the zero-based index of the cursor's position from the head.
+ /*!< this is a synonym for items_from_head(). */
+
+ bool set_index(iterator &to_set, int new_index);
+ //!< positions the iterator "to_set" at the index specified.
+
+ // storage and retrieval actions.
+ // Note: all of these methods shift the iterator onto the next valid node
+ // if it is positioned at the beginning or end of the list.
+
+ void append(iterator &where, node *new_node);
+ //!< adds a "new_node" into the list immediately after "where".
+ /*!< the nodes previously following the current node (if any) will follow
+ after the "new_node". this does not change the current position.
+ ownership of "new_node" is taken over by the list. */
+
+ void insert(iterator &where, node *new_node);
+ //!< places a "new_node" immediately before the current node in the list.
+ /*!< the "new_node" will follow the prior precursor to the current node.
+ this does not change the current position. ownership of "new_node"
+ is taken over by the list. after the call, the iterator points at
+ the new node. */
+
+ node *remove(iterator &where);
+ //!< extracts the current item from "where" and repairs the hole.
+ /*!< NULL_POINTER is returned if the list was empty. the current position is set
+ to the node that used to be after the node that has been removed. after
+ the call, the iterator points at the new node. */
+
+ void zap(iterator &where);
+ //!< wipes out the item at "where", including its contents.
+ /*!< the current position is reset to the item after the now defunct
+ item (or the tail). */
+
+ void zap_all();
+ //!< destroys all the list elements and makes the list empty.
+ /*!< any existing iterators will be invalidated by this. */
+
+ // the following positioning functions could fail if the request is out of
+ // bounds. for example, forward cannot go beyond the end of the list. in
+ // such cases, false is returned and the list pointer is not moved.
+
+ bool forward(iterator &where, int count);
+ //!< moves the list pointer "count" items towards the tail.
+ /*!< Note: forward and backward operate on elements; the head and tail
+ guard are not included in the count. Also, negative values of "count"
+ are ignored. */
+ bool backward(iterator &where, int count);
+ //!< moves the list pointer "count" items towards the head.
+
+ int items_from_head(const iterator &where) const;
+ //!< Returns the number of elements between the current item and the head.
+ /*!< zero is returned if this is at the first element or the head. */
+ int items_from_tail(const iterator &where) const;
+ //!< Returns the number of elements between the current item and the tail.
+ /*!< zero is returned if this is at the last element or the tail. */
+
+private:
+ friend class iterator;
+ node *_head; //!< pointer to the first item.
+ node *_tail; //!< pointer to the last item.
+
+ bool skip_or_ignore(iterator &where, int count);
+ //!< zips the list to the position indicated by "count", if it can.
+
+ // not permitted.
+ doubly_linked_list(const doubly_linked_list &);
+ doubly_linked_list &operator =(const doubly_linked_list &);
+};
+
+} // namespace.
+
+#endif
+
diff --git a/nucleus/library/nodes/list.cpp b/nucleus/library/nodes/list.cpp
deleted file mode 100644
index 3429f8e7..00000000
--- a/nucleus/library/nodes/list.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-
-
-
-/*****************************************************************************\
-* *
-* Name : list *
-* Author : Chris Koeritz *
-* *
-*******************************************************************************
-* Copyright (c) 1998-$now By Author. This program is free software; you can *
-* redistribute it and/or modify it under the terms of the GNU General Public *
-* License as published by the Free Software Foundation; either version 2 of *
-* the License or (at your option) any later version. This is online at: *
-* http://www.fsf.org/copyleft/gpl.html *
-* Please send any updates to: fred@gruntose.com *
-\*****************************************************************************/
-
-// POLICIES:
-//
-// the cursor should never be stored to or deleted; it is merely a scanner that
-// runs through the list.
-//
-// the cursor can point at the head or tail. any storage action is taken to
-// mean that it applies to the closest real object, if one exists. any query
-// action is taken similarly.
-
-#include "list.h"
-#include "node.h"
-
-#include
-
-namespace nodes {
-
-// nice names for the positions of the next link and the previous link in
-// our node's indices.
-const int PREVIOUS = 0;
-const int NEXT = 1;
-
-//////////////
-
-// iterator functions:
-
-void list::iterator::operator ++()
-{
- if (is_tail()) return; // already at the end.
- _cursor = _cursor->get_link(NEXT);
-}
-
-void list::iterator::operator --()
-{
- if (is_head()) return; // already at the front.
- _cursor = _cursor->get_link(PREVIOUS);
-}
-
-bool list::iterator::operator ==(const iterator &to_compare) const
-{ return _cursor == to_compare._cursor; }
-
-const node *list::iterator::observe()
-{
- if (!_manager || _manager->empty()) return NIL;
- if (*this == _manager->head()) next();
- if (*this == _manager->tail()) previous();
- return _cursor;
-}
-
-node *list::iterator::access()
-{
- if (!_manager || _manager->empty()) return NIL;
- if (*this == _manager->head()) next();
- if (*this == _manager->tail()) previous();
- return _cursor;
-}
-
-bool list::iterator::is_head() const
-{
- if (!_manager) return false;
- return _cursor == _manager->_head;
-}
-
-bool list::iterator::is_tail() const
-{
- if (!_manager) return false;
- return _cursor == _manager->_tail;
-}
-
-void list::iterator::jump_head()
-{
- if (!_manager) return;
- _cursor = _manager->_head;
-}
-
-void list::iterator::jump_tail()
-{
- if (!_manager) return;
- _cursor = _manager->_tail;
-}
-
-//////////////
-
-list::list()
-: _head(NIL), _tail(NIL)
-{
- _head = new node(2);
- _tail = new node(2);
- _head->set_link(NEXT, _tail);
- _tail->set_link(PREVIOUS, _head);
-}
-
-list::~list()
-{
- iterator zapper = head();
- while (!empty())
- zap(zapper);
- WHACK(_head);
- WHACK(_tail);
-}
-
-bool list::empty() const
-{
- if (_head->get_link(NEXT) == _tail) return true;
- return false;
-}
-
-bool list::set_index(iterator &where, int new_index)
-{
- if (where._manager != this) return false;
- if (empty()) return false;
- node *skipper = _head->get_link(NEXT);
- for (int i = 0; i < new_index; i++) {
- skipper = skipper->get_link(NEXT);
- if (skipper == _tail) return false; // out of bounds now.
- }
- where._cursor = skipper;
- return true;
-}
-
-bool list::forward(iterator &where, int count)
-{
- if (where._manager != this) return false;
- if (count <= 0) return true;
- if (items_from_tail(where) < count) return false;
- if (where.is_head()) where.next(); // skip the head guard.
- for (int i = 0; i < count; i++) where.next();
- return true;
-}
-
-bool list::backward(iterator &where, int count)
-{
- if (where._manager != this) return false;
- if (count <= 0) return true;
- if (items_from_head(where) < count) return false;
- if (where.is_tail()) where.previous(); // skip the tail guard.
- for (int i = 0; i < count; i++) where.previous();
- return true;
-}
-
-int list::elements() const
-{
- if (empty()) return 0;
- int to_return = 0;
- node *skipper = _head->get_link(NEXT);
- while (skipper != _tail) {
- to_return++;
- skipper = skipper->get_link(NEXT);
- }
- return to_return;
-}
-
-int list::items_from_head(const iterator &where) const
-{
- if (where._manager != this) return 0;
- if (where.is_head()) return 0; // make sure it's not there already.
- int index = 0;
- node *skipper = _head->get_link(NEXT);
- while ( (where._cursor != skipper) && (skipper != _tail) ) {
- index++;
- skipper = skipper->get_link(NEXT);
- }
- return index;
-}
-
-int list::items_from_tail(const iterator &where) const
-{
- if (where._manager != this) return 0;
- if (where.is_tail()) return 0; // make sure it's not there already.
- int index = 0;
- node *skipper = _tail->get_link(PREVIOUS);
- while ( (where._cursor != skipper) && (skipper != _head) ) {
- index++;
- skipper = skipper->get_link(PREVIOUS);
- }
- return index;
-}
-
-/*
-node *list::get()
-{
- if (empty()) return NIL; // make sure the list isn't empty.
- if (_cursor == _head) return _head->get_link(NEXT);
- // check special case for pointing at the head.
- if (_cursor == _tail) return _tail->get_link(PREVIOUS);
- // check special case for pointing at the tail.
- return _cursor;
-}
-*/
-
-node *list::remove(iterator &where)
-{
- if (where._manager != this) return NIL;
- if (empty()) return NIL;
- if (where._cursor == _head)
- where._cursor = _head->get_link(NEXT);
- if (where._cursor == _tail)
- where._cursor = _tail->get_link(PREVIOUS);
- node *old_cursor = where._cursor;
- node *old_previous = old_cursor->get_link(PREVIOUS);
- node *old_next = old_cursor->get_link(NEXT);
- old_cursor->set_link(PREVIOUS, NIL);
- old_cursor->set_link(NEXT, NIL);
- old_previous->set_link(NEXT, old_next);
- old_next->set_link(PREVIOUS, old_previous);
- where._cursor = old_next;
- return old_cursor;
-}
-
-void list::zap(iterator &where) { delete remove(where); }
-
-void list::append(iterator &where, node *new_node)
-{
- if (where._manager != this) return;
- while (new_node->links() < 2) new_node->insert_link(0, NIL);
- if (empty()) where._cursor = _head;
- if (where._cursor == _tail)
- where._cursor = _tail->get_link(PREVIOUS);
- // shift from the tail sentinel to the tail element.
- node *save_next = where._cursor->get_link(NEXT);
- where._cursor->set_link(NEXT, new_node);
- new_node->set_link(PREVIOUS, where._cursor);
- new_node->set_link(NEXT, save_next);
- save_next->set_link(PREVIOUS, new_node);
- where._cursor = new_node;
-}
-
-void list::insert(iterator &where, node *new_node)
-{
- if (where._manager != this) return;
- while (new_node->links() < 2) new_node->insert_link(0, NIL);
- if (empty()) where._cursor = _tail;
- if (where._cursor == _head)
- where._cursor = _head->get_link(NEXT);
- // shift from head sentinel to the head element.
- node *save_prior = where._cursor->get_link(PREVIOUS);
- where._cursor->set_link(PREVIOUS, new_node);
- new_node->set_link(NEXT, where._cursor);
- new_node->set_link(PREVIOUS, save_prior);
- save_prior->set_link(NEXT, new_node);
- where._cursor = new_node;
-}
-
-void list::zap_all()
-{
- iterator zapper = head();
- while (!empty()) zap(zapper);
-}
-
-} // namespace.
-
-
-
-
diff --git a/nucleus/library/nodes/list.h b/nucleus/library/nodes/list.h
deleted file mode 100644
index 455ebaa4..00000000
--- a/nucleus/library/nodes/list.h
+++ /dev/null
@@ -1,190 +0,0 @@
-#ifndef LIST_CLASS
-#define LIST_CLASS
-
-/*****************************************************************************\
-* *
-* Name : list *
-* Author : Chris Koeritz *
-* *
-*******************************************************************************
-* Copyright (c) 1998-$now By Author. This program is free software; you can *
-* redistribute it and/or modify it under the terms of the GNU General Public *
-* License as published by the Free Software Foundation; either version 2 of *
-* the License or (at your option) any later version. This is online at: *
-* http://www.fsf.org/copyleft/gpl.html *
-* Please send any updates to: fred@gruntose.com *
-\*****************************************************************************/
-
-
-
-namespace nodes {
-
-class node; // forward.
-
-//! Implements a guarded, doubly linked list structure.
-/*!
- The list is viewed one element at a time, through the monocular of an
- iterator, which keeps track of the current position in the list. the
- iterator's cursor can be shifted around at will. nodes can be added to
- the list before or after the cursor, and the node pointed at by the cursor
- can be queried or modified. Using multiple iterators is fine as long as
- you guarantee that they either are all just reading the list or that you
- have a valid access pattern of reads and writes such that no iterator's
- cursor is affected. Note that this list is not thread safe.
-*/
-
-class list
-{
-public:
- list();
- //!< constructs a blank list.
-
- ~list();
- //!< invalidates all contents of the list and destroys all child nodes.
-
- int elements() const;
- //!< returns the number of items currently in the list.
- /*!< this is a costly operation. */
-
- bool empty() const;
- //!< returns true if the list is empty.
- /*!< this is really quick compared to checking the number of elements. */
-
- //! iterators allow the list to be traversed.
- /*! NOTE: it is an error to use an iterator on one list with a different
- list; the methods will do nothing or return empty results in this
- situation. */
-
- class iterator {
- public:
- iterator(const list *mgr, node *start) : _cursor(start), _manager(mgr) {}
- //!< opens up an iterator on a list.
- /*!< the preferred method to construct an iterator is to use the
- head/tail functions in list. */
-
- void operator ++(); //!< go to next item.
- void operator --(); //!< go to previous item.
- void operator ++(int) { ++(*this); } //!< post-fix synonym for ++.
- void operator --(int) { --(*this); } //!< post-fix synonym for --.
-
-
- void next() { (*this)++; } //!< synonym for ++.
- void previous() { (*this)--; } //!< synonyms for --.
-
- bool operator ==(const iterator &to_compare) const;
- //!< returns true if the two iterators are at the same position.
-
- bool is_head() const;
- //!< returns true if the cursor is at the head of the list.
- /*!< Note: head() and tail() only return true if the iterator is
- actually positioned _at_ the head or tail guard. for example, if the
- cursor is pointing at the last actual element in the list (but not at
- the guard itself), then is_tail() returns false. so, in iteration,
- your iterator will actually go past the last valid element before
- is_tail() returns true. thus it is very important to check is_tail()
- *before* looking at the node with observe() or access(), since those
- two will shift the list position to the nearest valid node and away
- from the guard. */
- bool is_tail() const;
- //!< returns true if the cursor is at the tail of the list.
-
- void jump_head(); //!< set the iterator to the head.
- void jump_tail(); //!< set the iterator to the tail.
-
- const node *observe(); //!< peek at the current element.
- /*!< Note: observe() and access() will return the first element if the
- list is positioned at the head (or the last if at the tail), and will
- not return NIL for these two positions as long as the list has some
- elements in it. the cursor will also have been moved to point at the
- element that is returned.
- Another Note: it is extremely important that you do not mess with the
- links owned by the node (or at least the first two links).
- A Third Note: these two functions can return NIL if the list is empty. */
- node *access(); //!< obtain access to the current element.
-
- private:
- node *_cursor; //!< the current position.
- friend class list; //!< lists have full access to this object.
- const list *_manager; //!< our friendly manager.
- };
-
- iterator head() const { return iterator(this, _head); }
- //!< returns an iterator located at the head of the list.
- iterator tail() const { return iterator(this, _tail); }
- //!< returns an iterator located at the tail of the list.
-
- int index(const iterator &it) const { return items_from_head(it); }
- //!< returns the zero-based index of the cursor's position from the head.
- /*!< this is a synonym for items_from_head(). */
-
- bool set_index(iterator &to_set, int new_index);
- //!< positions the iterator "to_set" at the index specified.
-
- // storage and retrieval actions.
- // Note: all of these methods shift the iterator onto the next valid node
- // if it is positioned at the beginning or end of the list.
-
- void append(iterator &where, node *new_node);
- //!< adds a "new_node" into the list immediately after "where".
- /*!< the nodes previously following the current node (if any) will follow
- after the "new_node". this does not change the current position.
- ownership of "new_node" is taken over by the list. */
-
- void insert(iterator &where, node *new_node);
- //!< places a "new_node" immediately before the current node in the list.
- /*!< the "new_node" will follow the prior precursor to the current node.
- this does not change the current position. ownership of "new_node"
- is taken over by the list. after the call, the iterator points at
- the new node. */
-
- node *remove(iterator &where);
- //!< extracts the current item from "where" and repairs the hole.
- /*!< NIL is returned if the list was empty. the current position is set
- to the node that used to be after the node that has been removed. after
- the call, the iterator points at the new node. */
-
- void zap(iterator &where);
- //!< wipes out the item at "where", including its contents.
- /*!< the current position is reset to the item after the now defunct
- item (or the tail). */
-
- void zap_all();
- //!< destroys all the list elements and makes the list empty.
- /*!< any existing iterators will be invalidated by this. */
-
- // the following positioning functions could fail if the request is out of
- // bounds. for example, forward cannot go beyond the end of the list. in
- // such cases, false is returned and the list pointer is not moved.
-
- bool forward(iterator &where, int count);
- //!< moves the list pointer "count" items towards the tail.
- /*!< Note: forward and backward operate on elements; the head and tail
- guard are not included in the count. Also, negative values of "count"
- are ignored. */
- bool backward(iterator &where, int count);
- //!< moves the list pointer "count" items towards the head.
-
- int items_from_head(const iterator &where) const;
- //!< Returns the number of elements between the current item and the head.
- /*!< zero is returned if this is at the first element or the head. */
- int items_from_tail(const iterator &where) const;
- //!< Returns the number of elements between the current item and the tail.
- /*!< zero is returned if this is at the last element or the tail. */
-
-private:
- friend class iterator;
- node *_head; //!< pointer to the first item.
- node *_tail; //!< pointer to the last item.
-
- bool skip_or_ignore(iterator &where, int count);
- //!< zips the list to the position indicated by "count", if it can.
-
- // not permitted.
- list(const list &);
- list &operator =(const list &);
-};
-
-} // namespace.
-
-#endif
-
diff --git a/nucleus/library/nodes/makefile b/nucleus/library/nodes/makefile
index b114f9e7..e13af90d 100644
--- a/nucleus/library/nodes/makefile
+++ b/nucleus/library/nodes/makefile
@@ -2,7 +2,7 @@ include cpp/variables.def
PROJECT = nodes
TYPE = library
-SOURCE = list.cpp node.cpp packable_tree.cpp path.cpp symbol_tree.cpp tree.cpp
+SOURCE = doubly_linked_list.cpp node.cpp packable_tree.cpp path.cpp singly_linked_list.cpp symbol_tree.cpp tree.cpp
TARGETS = nodes.lib
include cpp/rules.def
diff --git a/nucleus/library/nodes/node.cpp b/nucleus/library/nodes/node.cpp
index 465fa5df..8a6b4dc7 100644
--- a/nucleus/library/nodes/node.cpp
+++ b/nucleus/library/nodes/node.cpp
@@ -26,8 +26,8 @@ namespace nodes {
// the internal_link class anonymously hangs onto a pointer to the object.
struct internal_link {
node *_connection;
- internal_link(node *destination = NIL) : _connection(destination) {}
- virtual ~internal_link() { _connection = NIL; }
+ internal_link(node *destination = NULL_POINTER) : _connection(destination) {}
+ virtual ~internal_link() { _connection = NULL_POINTER; }
};
class node_link_amorph : public amorph
@@ -53,7 +53,7 @@ int node::links() const { return _links->elements(); }
// set_empty: assumes used correctly by internal functions--no bounds return.
void node::set_empty(int link_num)
{
- internal_link *blank_frank = new internal_link(NIL);
+ internal_link *blank_frank = new internal_link(NULL_POINTER);
_links->put(link_num, blank_frank);
}
@@ -84,7 +84,7 @@ void node::insert_link(int where, node *to_insert)
node *node::get_link(int link_number) const
{
- bounds_return(link_number, 0, _links->elements()-1, NIL);
+ bounds_return(link_number, 0, _links->elements()-1, NULL_POINTER);
return (*_links)[link_number]->_connection;
}
diff --git a/nucleus/library/nodes/node.h b/nucleus/library/nodes/node.h
index 1b1a6d64..1c80f81b 100644
--- a/nucleus/library/nodes/node.h
+++ b/nucleus/library/nodes/node.h
@@ -73,12 +73,12 @@ public:
node *get_link(int link_number) const;
//!< Returns the node that is connected to the specified "link_number".
- /*!< if the link is not set, then NIL is returned. */
+ /*!< if the link is not set, then NULL_POINTER is returned. */
void zap_link(int link_number);
//!< the specified link is removed from the node.
- void insert_link(int where, node *to_add = NIL);
+ void insert_link(int where, node *to_add = NULL_POINTER);
//!< adds a new link prior to the position specified in "where".
/*!< thus a "where" value of less than or equal to zero will add a new
link as the first element. a "where" value greater than or equal to
diff --git a/nucleus/library/nodes/packable_tree.cpp b/nucleus/library/nodes/packable_tree.cpp
index aa85c375..831538af 100644
--- a/nucleus/library/nodes/packable_tree.cpp
+++ b/nucleus/library/nodes/packable_tree.cpp
@@ -130,7 +130,7 @@ throw_error(current_node->class_name(), func, "failure calculating size");
int packable_tree::recursive_packed_size() const
{
- packable_tree *curr = NIL;
+ packable_tree *curr = NULL_POINTER;
int accum = 0; // where we accumulate the length of the packed form.
for (iterator zip2 = start(postfix); (curr = (packable_tree *)zip2.next()); )
calcit(accum, curr);
@@ -141,7 +141,7 @@ int packable_tree::recursive_packed_size() const
void packable_tree::recursive_pack(byte_array &packed_form) const
{
- packable_tree *curr = NIL;
+ packable_tree *curr = NULL_POINTER;
for (iterator zip2 = start(postfix); (curr = (packable_tree *)zip2.next()); )
packit(packed_form, curr);
@@ -161,10 +161,10 @@ packable_tree *packable_tree::recursive_unpack(byte_array &packed_form,
// get the first command out of the package.
if (!cmd.unpack(packed_form)) {
//complain.
- return NIL;
+ return NULL_POINTER;
}
- packable_tree *new_branch = NIL;
+ packable_tree *new_branch = NULL_POINTER;
bool failure = false; // set to true if errors occurred.
// the packed tree is traversed by grabbing a command and then doing what
diff --git a/nucleus/library/nodes/packable_tree.h b/nucleus/library/nodes/packable_tree.h
index a003db04..a32335f3 100644
--- a/nucleus/library/nodes/packable_tree.h
+++ b/nucleus/library/nodes/packable_tree.h
@@ -44,7 +44,7 @@ public:
static packable_tree *recursive_unpack(basis::byte_array &packed_form,
packable_tree_factory &creator);
//!< unpacks a tree stored in "packed_form" and returns it.
- /*!< if NIL is returned, then the unpack failed. the "creator" is needed
+ /*!< if NULL_POINTER is returned, then the unpack failed. the "creator" is needed
for making new derived packable_tree objects of the type stored. */
// standard pack, unpack and packed_size methods must be implemented by the derived tree.
diff --git a/nucleus/library/nodes/path.cpp b/nucleus/library/nodes/path.cpp
index d84325a7..4a2c0c90 100644
--- a/nucleus/library/nodes/path.cpp
+++ b/nucleus/library/nodes/path.cpp
@@ -71,7 +71,7 @@ node *path::pop()
{
node *to_return;
if (_stack->acquire_pop(to_return) != common::OKAY)
- return NIL;
+ return NULL_POINTER;
return to_return;
}
diff --git a/nucleus/library/nodes/path.h b/nucleus/library/nodes/path.h
index af6261f4..0c333415 100644
--- a/nucleus/library/nodes/path.h
+++ b/nucleus/library/nodes/path.h
@@ -57,7 +57,7 @@ public:
node *current() const;
node *follow() const;
//!< Returns the node specified by this path.
- /*!< if the path is not valid, NIL is returned. */
+ /*!< if the path is not valid, NULL_POINTER is returned. */
node *pop();
//!< returns the top node on the path stack.
@@ -81,7 +81,7 @@ public:
"to_follow" is set to one of the possible paths. */
node *operator [] (int index) const;
- //!< returns the node stored at "index", or NIL if "index" is invalid.
+ //!< returns the node stored at "index", or NULL_POINTER if "index" is invalid.
private:
path_node_stack *_stack; //!< implementation of our pathway.
diff --git a/nucleus/library/nodes/singly_linked_list.cpp b/nucleus/library/nodes/singly_linked_list.cpp
new file mode 100644
index 00000000..97eec6a8
--- /dev/null
+++ b/nucleus/library/nodes/singly_linked_list.cpp
@@ -0,0 +1,3 @@
+
+#include "singly_linked_list.h"
+
diff --git a/nucleus/library/nodes/singly_linked_list.h b/nucleus/library/nodes/singly_linked_list.h
new file mode 100644
index 00000000..4c4a2110
--- /dev/null
+++ b/nucleus/library/nodes/singly_linked_list.h
@@ -0,0 +1,72 @@
+#ifndef SINGLY_LINKED_LIST_CLASS
+#define SINGLY_LINKED_LIST_CLASS
+
+/*
+* Name : singly_linked_list
+* Author : Chris Koeritz
+**
+* Copyright (c) 1998-$now By Author. This program is free software; you can
+* redistribute it and/or modify it under the terms of the GNU General Public
+* License as published by the Free Software Foundation; either version 2 of
+* the License or (at your option) any later version. This is online at:
+* http://www.fsf.org/copyleft/gpl.html
+* Please send any updates to: fred@gruntose.com
+*/
+#include "node.h"
+
+namespace nodes {
+
+//class node; // forward.
+
+//! Implements a singly-linked list structure.
+
+class singly_linked_list : public node
+{
+public:
+ singly_linked_list() : node(1) {}
+
+ //hmmm: clean up all children?
+ ~singly_linked_list() {}
+
+ // symbol for the rest of the list linked here.
+ static const int NEXT_NODE = 0;
+
+ int elements() const;
+ //!< returns the number of items currently in the list, including this node.
+ /*!< this is a costly operation. */
+
+ singly_linked_list *next() { return (singly_linked_list *)get_link(NEXT_NODE); }
+
+ void set_next(singly_linked_list *new_next) { set_link(NEXT_NODE, new_next); }
+
+ //! returns true if this list has a cycle in it.
+ static bool has_cycle(singly_linked_list *check) {
+ singly_linked_list *a = check;
+ singly_linked_list *b = check;
+ while ((a != NULL_POINTER) && (b!= NULL_POINTER) ) {
+ a = a->next(); // move position of a forward once.
+ // move position of b forward twice.
+ b = b->next();
+ if (b != NULL_POINTER) b = b->next();
+
+ if (a == b) {
+ // argh, our single skipper and double skipper have arrived at the same node.
+ // the only way that can happen is if there's a cycle in the list.
+ return true;
+ }
+ }
+ // if we fell out of the list iteration with a null for either pointer,
+ // then there was no cycle in the list.
+ return false;
+ }
+
+private:
+ // not permitted.
+ singly_linked_list(const singly_linked_list &);
+ singly_linked_list &operator =(const singly_linked_list &);
+};
+
+} // namespace.
+
+#endif
+
diff --git a/nucleus/library/nodes/symbol_tree.cpp b/nucleus/library/nodes/symbol_tree.cpp
index dd96fea5..0cf01c6c 100644
--- a/nucleus/library/nodes/symbol_tree.cpp
+++ b/nucleus/library/nodes/symbol_tree.cpp
@@ -141,7 +141,7 @@ symbol_tree *symbol_tree::find(const astring &to_find, find_methods how,
#ifdef DEBUG_SYMBOL_TREE
FUNCDEF("find");
#endif
- if (comp == NIL) comp = astring_comparator;
+ if (comp == NULL_POINTER) comp = astring_comparator;
#ifdef DEBUG_SYMBOL_TREE
LOG(astring("finding node called ") + to_find);
#endif
@@ -151,7 +151,7 @@ symbol_tree *symbol_tree::find(const astring &to_find, find_methods how,
// perform the upward recursion first, since it's pretty simple.
if (how == recurse_upward) {
symbol_tree *our_parent = dynamic_cast(parent());
- if (!our_parent) return NIL; // done recursing.
+ if (!our_parent) return NULL_POINTER; // done recursing.
return our_parent->find(to_find, how, comp);
}
@@ -164,7 +164,7 @@ symbol_tree *symbol_tree::find(const astring &to_find, find_methods how,
if (!found) {
if (how == recurse_downward) {
// see if we can't find that name in a sub-node.
- symbol_tree *answer = NIL;
+ symbol_tree *answer = NULL_POINTER;
for (int i = 0; i < branches(); i++) {
// we will try each branch in turn and see if it has a child named
// appropriately.
@@ -178,7 +178,7 @@ symbol_tree *symbol_tree::find(const astring &to_find, find_methods how,
return answer;
}
}
- return NIL;
+ return NULL_POINTER;
}
return *found;
}
diff --git a/nucleus/library/nodes/symbol_tree.h b/nucleus/library/nodes/symbol_tree.h
index c8d4f6dc..d5144779 100644
--- a/nucleus/library/nodes/symbol_tree.h
+++ b/nucleus/library/nodes/symbol_tree.h
@@ -81,8 +81,8 @@ public:
symbol_tree *find(const basis::astring &to_find,
find_methods how,
///= just_branches,
- basis::string_comparator_function *comp = NIL);
- //!< returns the node specified by "to_find" or NIL.
+ basis::string_comparator_function *comp = NULL_POINTER);
+ //!< returns the node specified by "to_find" or NULL_POINTER.
/*!< this should be fairly quick due to the symbol table's hashing.
the "how" method specifies the type of recursion to be used in searching
if any. if "how" is passed as "just_branches", then only the branches are
@@ -90,7 +90,7 @@ public:
"recurse_downward", then all sub-trees under the branches are checked
also. if "how" is given as "recurse_upward", then "this" node and parent
nodes are checked. the "comp" parameter will be used for comparing the
- strings if it's passed as non-NIL. */
+ strings if it's passed as non-null. */
void sort();
//!< sorts the sub-nodes of this symbol_tree.
diff --git a/nucleus/library/nodes/tree.cpp b/nucleus/library/nodes/tree.cpp
index 0a2fbf9e..59ca5d70 100644
--- a/nucleus/library/nodes/tree.cpp
+++ b/nucleus/library/nodes/tree.cpp
@@ -50,7 +50,7 @@ bool tree::iterator::next_node(tree *&to_return)
#ifdef DEBUG_TREE
FUNCDEF("next_node");
#endif
- to_return = NIL;
+ to_return = NULL_POINTER;
#ifdef DEBUG_TREE
if ( (_order != to_branches)
&& (_order != reverse_branches) ) {
@@ -255,7 +255,7 @@ tree *tree::iterator::next()
#ifdef DEBUG_TREE
FUNCDEF("next");
#endif
- tree *to_return = NIL;
+ tree *to_return = NULL_POINTER;
bool found_tree = false;
while (!found_tree) {
bool still_running = next_node(to_return);
@@ -270,7 +270,7 @@ tree *tree::iterator::next()
tree::tree()
: node(1)
-{ set_link(BACKWARDS_BRANCH, NIL); }
+{ set_link(BACKWARDS_BRANCH, NULL_POINTER); }
tree::~tree()
{
@@ -278,7 +278,7 @@ tree::~tree()
// cousin.
tree *my_parent = parent();
if (my_parent) my_parent->prune(this);
- my_parent = NIL; // disavow since we are loose now.
+ my_parent = NULL_POINTER; // disavow since we are loose now.
#if 0
@@ -298,7 +298,7 @@ tree::~tree()
// newer version of delete doesn't recurse; it just iterates instead,
// which avoids the massive recursive depth of the original approach.
tree *curr_node = this;
- while (curr_node != NIL) {
+ while (curr_node != NULL_POINTER) {
// make a breadcrumb for getting back to 'here' in the tree.
tree *way_back = curr_node;
// our main operation here is to go down a node without using any
@@ -306,7 +306,7 @@ tree::~tree()
// or there are no kids at all.
curr_node = curr_node->branch(0);
- if (curr_node = NIL) {
+ if (curr_node = NULL_POINTER) {
// wayback has no children, so we can take action.
// if wayback is the same as "this", then we exit from iterations since
@@ -342,7 +342,7 @@ int tree::branches() const { return links() - 1; }
tree *tree::branch(int branch_number) const
{
branch_number++;
- bounds_return(branch_number, 1, branches(), NIL);
+ bounds_return(branch_number, 1, branches(), NULL_POINTER);
return (tree *)get_link(branch_number);
}
@@ -352,8 +352,8 @@ int tree::which(tree *branch_to_find) const
tree *tree::root() const
{
const tree *traveler = this;
- // keep looking at the backwards branch until it is a NIL. the tree with
- // a NIL BACKWARDS_BRANCH is the root. return that tree.
+ // keep looking at the backwards branch until it is a NULL_POINTER. the tree with
+ // a NULL_POINTER BACKWARDS_BRANCH is the root. return that tree.
while (traveler->get_link(BACKWARDS_BRANCH))
traveler = (tree *)traveler->get_link(BACKWARDS_BRANCH);
return const_cast(traveler);
@@ -369,7 +369,7 @@ void tree::attach(tree *new_branch)
void tree::insert(int branch_place, tree *new_branch)
{
branch_place++;
- insert_link(links(), NIL);
+ insert_link(links(), NULL_POINTER);
if (branch_place >= links())
branch_place = links() - 1;
for (int i = links() - 1; i > branch_place; i--)
@@ -390,7 +390,7 @@ outcome tree::prune_index(int branch_to_cut)
branch_to_cut++;
bounds_return(branch_to_cut, 1, branches(), basis::common::NOT_FOUND);
tree *that_branch = (tree *)get_link(branch_to_cut);
- that_branch->set_link(BACKWARDS_BRANCH, NIL);
+ that_branch->set_link(BACKWARDS_BRANCH, NULL_POINTER);
zap_link(branch_to_cut);
return basis::common::OKAY;
}
@@ -415,7 +415,7 @@ if (to_follow.size()) {}
/*
tree *traveller = this;
path to_accumulate(root());
- while (traveller->parent() != NIL) {
+ while (traveller->parent() != NULL_POINTER) {
// int branch_number = traveller->parent()->which(traveller);
// if (branch_number == BRANCH_NOT_FOUND) non_continuable_error
// (class_name(), "generate_path", "branch not found during path construction");
diff --git a/nucleus/library/nodes/tree.h b/nucleus/library/nodes/tree.h
index 31d0a99f..b116d1e2 100644
--- a/nucleus/library/nodes/tree.h
+++ b/nucleus/library/nodes/tree.h
@@ -49,7 +49,7 @@ public:
virtual tree *branch(int branch_number) const;
//!< Returns the specified branch of this tree.
- /*!< NIL is returned if the "branch_number" refers to a branch that
+ /*!< NULL_POINTER is returned if the "branch_number" refers to a branch that
does not exist. */
virtual int which(tree *branch_to_find) const;
@@ -61,7 +61,7 @@ public:
virtual tree *parent() const;
//!< Returns the tree node that is the immediate ancestor of this one.
- /*!< if this is the root node, then NIL is returned. */
+ /*!< if this is the root node, then NULL_POINTER is returned. */
virtual tree *root() const;
//!< Locates and returns the absolute root of the tree containing this tree.
@@ -124,7 +124,7 @@ public:
tree *next();
//!< Returns a pointer to the next tree in the direction of traversal.
- /*!< If the traversal is finished, NIL is returned. */
+ /*!< If the traversal is finished, NULL_POINTER is returned. */
void whack(tree *to_whack);
//!< destroys the tree "to_whack".
@@ -140,10 +140,10 @@ public:
bool next_node(tree *&to_return);
//!< sets "to_return" to the next tree in the direction of tree traversal.
/*!< if the next node could not be found in one invocation of next_node,
- then "to_return" is set to NIL. the function returns a boolean which
+ then "to_return" is set to NULL_POINTER. the function returns a boolean which
is true only if the iteration process can be continued by another call
to next_node. if the function returns false, the iteration is
- complete and "to_return" will always be NIL. */
+ complete and "to_return" will always be NULL_POINTER. */
};
iterator start(traversal_directions direction) const;
diff --git a/nucleus/library/processes/ethread.cpp b/nucleus/library/processes/ethread.cpp
index 15b39564..33f0a90b 100644
--- a/nucleus/library/processes/ethread.cpp
+++ b/nucleus/library/processes/ethread.cpp
@@ -88,7 +88,7 @@ ethread::ethread()
: _thread_ready(false),
_thread_active(false),
_stop_thread(false),
- _data(NIL),
+ _data(NULL_POINTER),
#ifdef _MSC_VER
_handle(0),
#else
@@ -106,7 +106,7 @@ ethread::ethread(int sleep_timer, timed_thread_types how)
: _thread_ready(false),
_thread_active(false),
_stop_thread(false),
- _data(NIL),
+ _data(NULL_POINTER),
#ifdef _MSC_VER
_handle(0),
#else
@@ -229,7 +229,7 @@ void ethread::one_shot_thread_driver(void *hidden_pointer)
FUNCDEF("one_shot_thread_driver");
ethread *manager = (ethread *)hidden_pointer;
#ifndef _MSC_VER
- if (!manager) return NIL;
+ if (!manager) return NULL_POINTER;
#else
if (!manager) return;
#endif
@@ -245,8 +245,8 @@ void ethread::one_shot_thread_driver(void *hidden_pointer)
_current_threads().decrement();
#endif
#ifndef _MSC_VER
- pthread_exit(NIL);
- return NIL;
+ pthread_exit(NULL_POINTER);
+ return NULL_POINTER;
#else
_endthread();
#endif
@@ -263,7 +263,7 @@ void ethread::periodic_thread_driver(void *hidden_pointer)
FUNCDEF("periodic_thread_driver");
ethread *manager = (ethread *)hidden_pointer;
#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
- if (!manager) return NIL;
+ if (!manager) return NULL_POINTER;
#elif defined(_MSC_VER)
if (!manager) return;
#endif
@@ -317,8 +317,8 @@ void ethread::periodic_thread_driver(void *hidden_pointer)
_current_threads().decrement();
#endif
#ifndef _MSC_VER
- pthread_exit(NIL);
- return NIL;
+ pthread_exit(NULL_POINTER);
+ return NULL_POINTER;
#else
_endthread();
#endif
diff --git a/nucleus/library/processes/launch_process.cpp b/nucleus/library/processes/launch_process.cpp
index 20e10fda..45880744 100644
--- a/nucleus/library/processes/launch_process.cpp
+++ b/nucleus/library/processes/launch_process.cpp
@@ -66,7 +66,7 @@ bool launch_process::event_poll(MSG &message)
message.message = 0;
message.wParam = 0;
message.lParam = 0;
- if (!PeekMessage(&message, NIL, 0, 0, PM_REMOVE))
+ if (!PeekMessage(&message, NULL_POINTER, 0, 0, PM_REMOVE))
return false;
TranslateMessage(&message);
DispatchMessage(&message);
@@ -146,7 +146,7 @@ char_star_array launch_process::break_line(astring &app, const astring ¶mete
.stuff(to_return[to_return.last()], len);
}
// add the sentinel to the list of strings.
- to_return += NIL;
+ to_return += NULL_POINTER;
#ifdef DEBUG_LAUNCH_PROCESS
for (int q = 0; to_return[q]; q++) {
LOG(a_sprintf("%d: %s\n", q, to_return[q]));
@@ -293,8 +293,8 @@ basis::un_int launch_process::run(const astring &app_name_in, const astring &com
// }
}
astring parms = app_name + " " + command_line;
- bool success = CreateProcess(NIL, to_unicode_temp(parms), NIL, NIL, false,
- create_flag, NIL, NIL, &startup_info, &process_info);
+ bool success = CreateProcess(NULL_POINTER, to_unicode_temp(parms), NULL_POINTER, NULL_POINTER, false,
+ create_flag, NULL_POINTER, NULL_POINTER, &startup_info, &process_info);
if (!success)
return critical_events::system_error();
// success then, merge back into stream.
diff --git a/nucleus/library/processes/launch_process.h b/nucleus/library/processes/launch_process.h
index 44ce4857..c13453d4 100644
--- a/nucleus/library/processes/launch_process.h
+++ b/nucleus/library/processes/launch_process.h
@@ -28,7 +28,7 @@ namespace processes {
class char_star_array : public basis::array
{
public:
- char_star_array() : basis::array(0, NIL, SIMPLE_COPY | EXPONE | FLUSH_INVISIBLE) {}
+ char_star_array() : basis::array(0, NULL_POINTER, SIMPLE_COPY | EXPONE | FLUSH_INVISIBLE) {}
~char_star_array() {
// clean up all the memory we're holding.
for (int i = 0; i < length(); i++) {
diff --git a/nucleus/library/processes/mailbox.cpp b/nucleus/library/processes/mailbox.cpp
index 52b89adf..afc4919b 100644
--- a/nucleus/library/processes/mailbox.cpp
+++ b/nucleus/library/processes/mailbox.cpp
@@ -188,7 +188,7 @@ int mailbox::waiting(const unique_int &id) const
bool mailbox::pick_up(const unique_int &id, letter * &package)
{
- package = NIL;
+ package = NULL_POINTER;
auto_synchronizer l(*_transaction_lock);
return _packages->get(id, package);
}
diff --git a/nucleus/library/processes/post_office.cpp b/nucleus/library/processes/post_office.cpp
index 523e4bb3..4eceba57 100644
--- a/nucleus/library/processes/post_office.cpp
+++ b/nucleus/library/processes/post_office.cpp
@@ -102,7 +102,7 @@ public:
unique_int _thread_id;
unique_int _id;
- tagged_mail_stop(const unique_int &id = 0, mail_stop *route = NIL,
+ tagged_mail_stop(const unique_int &id = 0, mail_stop *route = NULL_POINTER,
const unique_int &thread_id = 0)
: _route(route), _thread_id(thread_id), _id(id) {}
@@ -128,7 +128,7 @@ public:
tagged_mail_stop *curr = borrow(i);
if (curr && (curr->_id == id)) return curr;
}
- return NIL;
+ return NULL_POINTER;
}
bool zap(const unique_int &id) {
@@ -363,13 +363,13 @@ bool post_office::register_route(const unique_int &id,
if (found) return false; // already exists.
postal_carrier *po = new postal_carrier(*this, id);
- unique_int thread_id = _threads->add_thread(po, false, NIL);
+ unique_int thread_id = _threads->add_thread(po, false, NULL_POINTER);
// add the thread so we can record its id.
tagged_mail_stop *new_stop = new tagged_mail_stop(id, &carrier_path,
thread_id);
_routes->append(new_stop);
// add the mail stop to our listings.
- po->start(NIL);
+ po->start(NULL_POINTER);
// now start the thread so it can begin cranking.
return true;
}
diff --git a/nucleus/library/processes/process_control.cpp b/nucleus/library/processes/process_control.cpp
index bfc49cca..04d2e0e2 100644
--- a/nucleus/library/processes/process_control.cpp
+++ b/nucleus/library/processes/process_control.cpp
@@ -98,21 +98,21 @@ public:
/// HANDLE hSnapShot;
process_implementation_hider()
- : psapi_dll(NIL), vdm_dll(NIL), enumerate_processes(NIL),
- enumerate_modules(NIL), get_module_name(NIL),
+ : psapi_dll(NULL_POINTER), vdm_dll(NULL_POINTER), enumerate_processes(NULL_POINTER),
+ enumerate_modules(NULL_POINTER), get_module_name(NULL_POINTER),
//#ifdef _MSCVER
-// tasker_16bit(NIL),
+// tasker_16bit(NULL_POINTER),
//#endif
- kernel32_dll(NIL), create_snapshot(NIL), first_process(NIL),
- next_process(NIL) {}
+ kernel32_dll(NULL_POINTER), create_snapshot(NULL_POINTER), first_process(NULL_POINTER),
+ next_process(NULL_POINTER) {}
~process_implementation_hider() {
if (psapi_dll) FreeLibrary(psapi_dll);
if (vdm_dll) FreeLibrary(vdm_dll);
if (kernel32_dll) FreeLibrary(kernel32_dll);
- psapi_dll = NIL;
- vdm_dll = NIL;
- kernel32_dll = NIL;
+ psapi_dll = NULL_POINTER;
+ vdm_dll = NULL_POINTER;
+ kernel32_dll = NULL_POINTER;
}
#endif
};
@@ -377,7 +377,7 @@ bool process_control::get_processes_with_psapi(process_entry_array &to_fill)
// loop over the process enumeration function until we are sure that we
// have allocated a large enough space for all existing processes.
bool got_all = false;
- basis::un_int *pid_list = NIL;
+ basis::un_int *pid_list = NULL_POINTER;
basis::un_int max_size = 428 * sizeof(basis::un_int);
basis::un_int actual_size = 0;
while (!got_all) {
@@ -518,7 +518,7 @@ bool process_control::get_processes_with_ps(process_entry_array &to_fill)
_rando->inclusive(1, 400000));
a_sprintf cmd("ps wax --format \"%%p %%a\" >%s", tmpfile.s());
//hmmm: add more info as we expand the process entry.
- FILE *output = NIL; // initialize now to establish variable for our macro.
+ FILE *output = NULL_POINTER; // initialize now to establish variable for our macro.
int sysret = system(cmd.s());
if (negative(sysret)) {
LOG("got negative return from system()!");
diff --git a/nucleus/library/processes/rendezvous.cpp b/nucleus/library/processes/rendezvous.cpp
index 46545a30..b93d0764 100644
--- a/nucleus/library/processes/rendezvous.cpp
+++ b/nucleus/library/processes/rendezvous.cpp
@@ -68,7 +68,7 @@ astring unix_rendez_file(const astring &lock_name)
#endif
rendezvous::rendezvous(const astring &root_name)
-: _handle(NIL),
+: _handle(NULL_POINTER),
_locked(false),
_root_name(new astring(root_name))
{
@@ -90,7 +90,7 @@ rendezvous::rendezvous(const astring &root_name)
_handle = locking_file;
#endif
#ifdef __WIN32__
- _handle = CreateMutex(NIL, false, to_unicode_temp(lock_name));
+ _handle = CreateMutex(NULL_POINTER, false, to_unicode_temp(lock_name));
if (!_handle) return;
#endif
}
@@ -120,7 +120,7 @@ rendezvous::~rendezvous()
}
fclose((FILE *)_handle);
- _handle = NIL;
+ _handle = NULL_POINTER;
}
#endif
#ifdef __WIN32__
diff --git a/nucleus/library/processes/safe_callback.cpp b/nucleus/library/processes/safe_callback.cpp
index ca62be94..a79c8f78 100644
--- a/nucleus/library/processes/safe_callback.cpp
+++ b/nucleus/library/processes/safe_callback.cpp
@@ -64,14 +64,14 @@ public:
// returns true if the "object" is listed as valid.
bool listed(void *object) {
auto_synchronizer l(_lock);
- live_object_info *loi = NIL;
+ live_object_info *loi = NULL_POINTER;
return _objects.find(object, loi);
}
// adds the "object" to the list, or if it's already there, ups the refcount.
void add(void *object) {
auto_synchronizer l(_lock);
- live_object_info *loi = NIL;
+ live_object_info *loi = NULL_POINTER;
if (!_objects.find(object, loi)) {
// this is a new item.
_objects.add(object, new live_object_info);
@@ -85,7 +85,7 @@ public:
// references.
void remove(void *object) {
auto_synchronizer l(_lock);
- live_object_info *loi = NIL;
+ live_object_info *loi = NULL_POINTER;
if (!_objects.find(object, loi)) {
// this item doesn't exist??? bad usage has occurred..
return;
diff --git a/nucleus/library/processes/thread_cabinet.cpp b/nucleus/library/processes/thread_cabinet.cpp
index 19bc679f..875f9d8c 100644
--- a/nucleus/library/processes/thread_cabinet.cpp
+++ b/nucleus/library/processes/thread_cabinet.cpp
@@ -224,7 +224,7 @@ ethread *thread_cabinet::get_thread(int index)
LOCKIT;
thread_record *rec = _threads->borrow(index);
if (rec) return rec->_thread;
- return NIL;
+ return NULL_POINTER;
}
} //namespace.
diff --git a/nucleus/library/security/nt_security.cpp b/nucleus/library/security/nt_security.cpp
index e8f55797..428fbf64 100644
--- a/nucleus/library/security/nt_security.cpp
+++ b/nucleus/library/security/nt_security.cpp
@@ -31,7 +31,7 @@
#endif
nt_security::nt_security()
-: m_sDirServiceProvider(NIL)
+: m_sDirServiceProvider(NULL_POINTER)
{
// Eventually, construction of nt_security should determine if WinNT://
// or LDAP://, etc is the service provider and set a private member variable
diff --git a/nucleus/library/structures/amorph.h b/nucleus/library/structures/amorph.h
index 6d817e8a..c4992cfb 100644
--- a/nucleus/library/structures/amorph.h
+++ b/nucleus/library/structures/amorph.h
@@ -29,7 +29,7 @@
An amorph has a specified number of fields at any one time, but the number
can be changed with "zap", "insert" and "adjust". Fields in the amorph
- are either full or empty, where an empty field in the amorph has NIL as
+ are either full or empty, where an empty field in the amorph has NULL_POINTER as
its content. "put" adds a new field to the amorph. "get" retrieves the
contents of a field as a constant. "acquire" is used to check a field
out of the amorph, meaning that the amorph no longer possesses that field.
@@ -67,7 +67,7 @@ public:
//!< the maximum number of elements currently allowed in this amorph.
int valid_fields() const { return _fields_used; }
- //!< Returns the number of fields that have non-NIL contents.
+ //!< Returns the number of fields that have non-null contents.
/*!< This might be different from the number of total elements. */
void adjust(int new_max);
@@ -84,7 +84,7 @@ public:
basis::outcome put(int field, const contents *data);
//!< Enters an object into the field at index "field" in the amorph.
- /*!< If "data" is NIL, then the field is cleared. The amorph considers the
+ /*!< If "data" is NULL_POINTER, then the field is cleared. The amorph considers the
pointer "data" to be its own property after put is invoked; "data"
should not be destructed since the amorph will automatically do so.
This restriction does not hold if the object is checked back out of
@@ -99,11 +99,11 @@ public:
//!< a synonym for append.
//! Returns a constant pointer to the information at the index "field".
- /*! If no information is stored or the field is out range, then NIL is
+ /*! If no information is stored or the field is out range, then NULL_POINTER is
returned. */
const contents *get(int field) const;
//! Returns a pointer to the information at the index "field".
- /*! Also returns NIL for invalid indexes. DO NOT destroy the returned
+ /*! Also returns NULL_POINTER for invalid indexes. DO NOT destroy the returned
pointer; it is still owned by the amorph. */
contents *borrow(int field);
@@ -153,7 +153,7 @@ public:
const contents *next_valid(int &field) const;
//!< Returns the contents of the next valid element at or after "field".
/*!< "field" is set to the location where an entry was found, if one was
- actually found. If none exists at "field" or after it, then NIL is
+ actually found. If none exists at "field" or after it, then NULL_POINTER is
returned. */
int find(const contents *to_locate, basis::outcome &o);
@@ -176,9 +176,9 @@ private:
/*!< This is only used for the debugging version. */
void set_nil(int start, int end);
- // Puts NIL in the indices between start and end.
+ // Puts NULL_POINTER in the indices between start and end.
/*!< Does not delete whatever used to reside there; it just sets the
- pointers to NIL. */
+ pointers to NULL_POINTER. */
// not to be used: amorphs should not be copied because it is intended that
// they support storing heavyweight objects that either have no copy
@@ -245,7 +245,7 @@ int amorph_packed_size(const amorph &to_pack);
template
amorph::amorph(int elements)
-: basis::array(elements, NIL, basis::array::SIMPLE_COPY
+: basis::array(elements, NULL_POINTER, basis::array::SIMPLE_COPY
| basis::array::EXPONE | basis::array::FLUSH_INVISIBLE),
_fields_used(0)
{
@@ -266,7 +266,7 @@ template
void amorph::set_nil(int start, int end)
{
for (int i = start; i <= end; i++)
- basis::array::put(i, (contents *)NIL);
+ basis::array::put(i, (contents *)NULL_POINTER);
}
template
@@ -313,7 +313,7 @@ const contents *amorph::get(int field) const
{
FUNCDEF("get");
CHECK_FIELDS;
- bounds_return(field, 0, elements() - 1, NIL);
+ bounds_return(field, 0, elements() - 1, NULL_POINTER);
return basis::array::observe()[field];
}
@@ -337,7 +337,7 @@ void amorph::adjust(int new_maximum)
basis::array::insert(old_max, new_fields);
for (int i = old_max; i < new_maximum; i++) {
- basis::array::put(i, NIL);
+ basis::array::put(i, NULL_POINTER);
}
}
@@ -398,13 +398,13 @@ const contents *amorph::next_valid(int &field) const
{
FUNCDEF("next_valid");
CHECK_FIELDS;
- bounds_return(field, 0, elements() - 1, NIL);
+ bounds_return(field, 0, elements() - 1, NULL_POINTER);
for (int i = field; i < elements(); i++)
if (basis::array::get(i)) {
field = i;
return basis::array::get(i);
}
- return NIL;
+ return NULL_POINTER;
}
template
@@ -412,7 +412,7 @@ basis::outcome amorph::clear(int field)
{
FUNCDEF("clear");
CHECK_FIELDS;
- return this->put(field, NIL);
+ return this->put(field, NULL_POINTER);
}
template
@@ -423,7 +423,7 @@ contents *amorph::acquire(int field)
contents *to_return = borrow(field);
if (to_return) {
_fields_used--;
- basis::array::access()[field] = NIL;
+ basis::array::access()[field] = NULL_POINTER;
}
return to_return;
}
@@ -449,7 +449,7 @@ contents *amorph::borrow(int field)
{
FUNCDEF("borrow");
CHECK_FIELDS;
- bounds_return(field, 0, elements() - 1, NIL);
+ bounds_return(field, 0, elements() - 1, NULL_POINTER);
return basis::array