Permalink
Browse files

= AWKPaste prerequites =

Taking care of a small subset of the prerequisites for awkpaste.  Also,
preparing to rename 'lib/' to 'src/'.

== Build process ==
 * Adding a Makefile to enable a build process as an optimizatoin for awkpaste
   and possibly awkbot, although awkbot has special needs.
    * note: cpp still outputs metric fucktons of warnings as a result of normal
      comments, this should be corrected through whatever means is necessary
      even if it means just figuring out a reasonable way for hiding a
      particular class of warning
 * Added bin/teststrap - a little script to run the tests in t/ and report on
   their status.  Doesn't work particularly well.  Things needed on it:
    * Return error code properly
    * Report success/failure accordingly though stderr
    * Might want to build it into the makefile, actually
 * Added a cpp-filter sed script, this is probably temporary as I've discovered
   it doesn't particularly work well due to the fact that it is unable to
   filter all files that are included

== Additional ==
 * Found atleast one more include directive.  include doesn't work very well
   with awk, so import is being used instead despite the fact that it's a
   deprecated feature.
 * Added lib/tempfile.awk since several things are now dependent upon it


git-svn-id: http://svn.blisted.org/trunk/awkbot@48 ebfa9934-6f10-0410-9599-894cdf3d53f0
  • Loading branch information...
1 parent fd8d688 commit 42666a612f529e59d6a533ac9d4321680fadb3de scott committed Jul 27, 2007
Showing with 71 additions and 4 deletions.
  1. +13 −0 Makefile
  2. +18 −0 bin/teststrap
  3. +28 −0 cpp-filter.sed
  4. +1 −1 lib/awkbot.awk
  5. +1 −1 lib/queue.awk
  6. +8 −0 lib/tempfile.awk
  7. +1 −1 t/irc_test.awk
  8. +1 −1 t/queue_test.awk
View
@@ -0,0 +1,13 @@
+
+# Awkbot makefile, mostly just to bootstrap the test suite, but will also run
+# cpp to perminantly generate awkbot and awkpaste..
+
+awkbot:
+ cpp -I /usr/share/awk -I lib lib/awkbot-boot.awk 2> /dev/null > bootstrap
+ cpp -I /usr/share/awk/ -I lib lib/awkbot.awk 2> /dev/null > bootstrap
+
+awkpaste:
+ cpp -I /usr/share/awk -I lib lib/awkpaste.awk 2> /dev/null > awkpaste
+
+test:
+ ./bin/teststrap
View
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+failed=1
+
+for file in t/*.awk
+do
+ tmpfile=`tempfile`
+ echo processing $file
+ # Strip comments, stolen from perl!
+ sed -f cpp-filter.sed $file | cpp -I lib -I /usr/share/awk > $tmpfile
+ echo running $file
+ awk -f $tmpfile
+ if [ $? = 1 ]
+ then
+ echo "$file failed"
+ failed=`expr $failed + 1`
+ fi
+done
View
@@ -0,0 +1,28 @@
+# if it's a comment
+/^ *#/ {
+
+ # The below would look like this, if it wasn't so way too long to fit
+ # within a terminal
+ # /^ *#
+ # *\(\(if\|ifn\|un\)def\|if\|\(el\|end\)if\|define\|include\|import
+ # \|else\|error\|pragma\)/b
+ # print
+
+ # if it's a preprocessing directive, or atleast looks like one, leave it.
+ /^ *# *if/p
+ /^ *# *else/p
+ /^ *# *ifdef/p
+ /^ *# *ifndef/p
+ /^ *# *undef/p
+ /^ *# *define/p
+ /^ *# *include/p
+ /^ *# *import/p
+ /^ *# *else/p
+ /^ *# *elif/p
+ /^ *# *endif/p
+ /^ *# *error/p
+ /^ *# *pragma/p
+ /^ *# *line/p
+ # Just delete everything else
+ d
+}
View
@@ -62,7 +62,7 @@ END {
}
# Nasty hack to clean up every few records
-NR % 3 == 0 {
+NR % 10000 == 0 {
print "DEBUG: Truncating file.."
printf "" > irc["tempfile"]
fflush(irc["tempfile"])
View
@@ -6,7 +6,7 @@
# this stuff is worth it, you can buy me a beer in return. Scott S. McCoy
# -----------------------------------------------------------------------------
-#include <assert.awk>
+#import <assert.awk>
function push (array, value,i) {
i = sizeof(array) + 1
View
@@ -0,0 +1,8 @@
+
+function tempfile (prefix ,call,result) {
+ call = "tempfile -p " prefix
+ call | getline result
+ close(call)
+ return result
+}
+
View
@@ -1,4 +1,4 @@
-
+#import <irc.awk>
BEGIN {
irc_set("debug", 1)
View
@@ -1,5 +1,5 @@
# test queue.awk
-#include <queue.awk>
+#import <queue.awk>
BEGIN {
push(queue, 1)

0 comments on commit 42666a6

Please sign in to comment.