]> Pileus Git - ~andy/gtk/commitdiff
New files to automagically extract code examples from the tutorial.
authorBST 1998 Tony Gale <gale@gtk.org>
Thu, 4 Jun 1998 11:15:55 +0000 (11:15 +0000)
committerTony Gale <gale@src.gnome.org>
Thu, 4 Jun 1998 11:15:55 +0000 (11:15 +0000)
Thu Jun  4 12:12:11 BST 1998  Tony Gale  <gale@gtk.org>

        * examples/extract.sh, examples/extract.awk:
          New files to automagically extract code examples from the
          tutorial.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
examples/extract.awk [new file with mode: 0644]
examples/extract.sh [new file with mode: 0755]

index 1503c8a478002e1b9d7c594880084a2a6c348a4c..64f295c8e4592b21273f3d7cc73e41c25bf86307 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Jun  4 12:12:11 BST 1998  Tony Gale  <gale@gtk.org>
+
+       * examples/extract.sh, examples/extract.awk:
+         New files to automagically extract code examples from the
+         tutorial.
+
 Tue Jun  2 20:04:45 1998  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_page_select) (gtk_notebook_focus)
index 1503c8a478002e1b9d7c594880084a2a6c348a4c..64f295c8e4592b21273f3d7cc73e41c25bf86307 100644 (file)
@@ -1,3 +1,9 @@
+Thu Jun  4 12:12:11 BST 1998  Tony Gale  <gale@gtk.org>
+
+       * examples/extract.sh, examples/extract.awk:
+         New files to automagically extract code examples from the
+         tutorial.
+
 Tue Jun  2 20:04:45 1998  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_page_select) (gtk_notebook_focus)
index 1503c8a478002e1b9d7c594880084a2a6c348a4c..64f295c8e4592b21273f3d7cc73e41c25bf86307 100644 (file)
@@ -1,3 +1,9 @@
+Thu Jun  4 12:12:11 BST 1998  Tony Gale  <gale@gtk.org>
+
+       * examples/extract.sh, examples/extract.awk:
+         New files to automagically extract code examples from the
+         tutorial.
+
 Tue Jun  2 20:04:45 1998  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_page_select) (gtk_notebook_focus)
index 1503c8a478002e1b9d7c594880084a2a6c348a4c..64f295c8e4592b21273f3d7cc73e41c25bf86307 100644 (file)
@@ -1,3 +1,9 @@
+Thu Jun  4 12:12:11 BST 1998  Tony Gale  <gale@gtk.org>
+
+       * examples/extract.sh, examples/extract.awk:
+         New files to automagically extract code examples from the
+         tutorial.
+
 Tue Jun  2 20:04:45 1998  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_page_select) (gtk_notebook_focus)
index 1503c8a478002e1b9d7c594880084a2a6c348a4c..64f295c8e4592b21273f3d7cc73e41c25bf86307 100644 (file)
@@ -1,3 +1,9 @@
+Thu Jun  4 12:12:11 BST 1998  Tony Gale  <gale@gtk.org>
+
+       * examples/extract.sh, examples/extract.awk:
+         New files to automagically extract code examples from the
+         tutorial.
+
 Tue Jun  2 20:04:45 1998  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_page_select) (gtk_notebook_focus)
index 1503c8a478002e1b9d7c594880084a2a6c348a4c..64f295c8e4592b21273f3d7cc73e41c25bf86307 100644 (file)
@@ -1,3 +1,9 @@
+Thu Jun  4 12:12:11 BST 1998  Tony Gale  <gale@gtk.org>
+
+       * examples/extract.sh, examples/extract.awk:
+         New files to automagically extract code examples from the
+         tutorial.
+
 Tue Jun  2 20:04:45 1998  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_page_select) (gtk_notebook_focus)
index 1503c8a478002e1b9d7c594880084a2a6c348a4c..64f295c8e4592b21273f3d7cc73e41c25bf86307 100644 (file)
@@ -1,3 +1,9 @@
+Thu Jun  4 12:12:11 BST 1998  Tony Gale  <gale@gtk.org>
+
+       * examples/extract.sh, examples/extract.awk:
+         New files to automagically extract code examples from the
+         tutorial.
+
 Tue Jun  2 20:04:45 1998  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_page_select) (gtk_notebook_focus)
diff --git a/examples/extract.awk b/examples/extract.awk
new file mode 100644 (file)
index 0000000..44cd32a
--- /dev/null
@@ -0,0 +1,57 @@
+# extract - extract C source files from GTK Tutorial
+# Copyright (C) Tony Gale 1998
+# Contact: gale@gtk.org
+#
+# Command Switches:
+# -c : Just do checking rather than output files
+# -f <filename> : Extract a specific file
+# -d : Extract files to current directory
+BEGIN {in_example=0; check=0; spec_example=""; do_output=0; flatten=0
+       for (i=0 ; i < ARGC ; i++) {
+       if ( ARGV[i] == "-c" ) {
+         check = 1;
+         ARGV[i]="";
+       } else if ( ARGV[i] == "-f" ) {
+         spec_example=ARGV[i+1];
+         ARGV[i]="";
+         ARGV[i+1]="";
+         if ( length(spec_example) == 0 ) {
+           print "usage: -f <filename>";
+           exit;
+         }
+       } else if ( ARGV[i] == "-d" ) {
+         flatten = 1;
+         ARGV[i]="";
+       }
+       }
+      }
+
+$2 == "example-start" && in_example == 1 { printf("\nERROR: nested example at line %d\n", NR) > "/dev/stderr";
+                                          exit}
+
+$2 == "example-start"                   { in_example=1 }
+
+$2 == "example-start" && check == 0 \
+  { if ( (spec_example == "") || (spec_example == $4) ) {
+    if ( flatten == 0 ) {
+      file_name = sprintf("%s/%s",$3, $4);
+      command = sprintf("mkdir -p %s", $3);
+      system(command);
+    } else {
+      file_name = $4;
+    }
+    do_output=1;
+  }
+  }
+
+in_example==1 && check==0 && do_output==1 { gsub(/&amp;/, "\\&", $0);
+                                           print $0 >file_name } 
+
+$2 == "example-end" && in_example == 0           { printf("\nERROR: multiple ends at line %d\n", NR) > "/dev/stderr";
+                                           exit}
+$2 == "example-end"                      { in_example=0; do_output=0 }
+
+
+END {}
+
diff --git a/examples/extract.sh b/examples/extract.sh
new file mode 100755 (executable)
index 0000000..b19e19a
--- /dev/null
@@ -0,0 +1,2 @@
+#! /bin/sh
+awk -f extract.awk ../docs/gtk_tut.sgml $1 $2 $3 $4 $5