diff options
author | Matthias Clasen <mclasen@redhat.com> | 2010-10-15 12:37:21 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2010-10-15 13:02:50 -0400 |
commit | 0ff28d72f68c25d85fa851fc214f9478d9cb2396 (patch) | |
tree | da6bb8dda1fa3ea3caa30328ab89c2d45ebd13ef /examples | |
parent | ef7fddac3bfecfe855c55b78803df304376136eb (diff) | |
download | gtk+-0ff28d72f68c25d85fa851fc214f9478d9cb2396.tar.gz |
examples: build examples that are included in the docs
We build the examples that are included in the 'getting started'
chapter of the docs to prevent them from bitrotting. Also
remove the awk scripts used to extract the old examples from
the tutorial, since the tutorial is gone. I'm still leaving
the examples themeselves in place, for possible inclusion in
'getting started' later on.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am (renamed from examples/Makefile) | 28 | ||||
-rw-r--r-- | examples/README.1ST | 41 | ||||
-rw-r--r-- | examples/extract.awk | 69 | ||||
-rwxr-xr-x | examples/extract.sh | 30 | ||||
-rwxr-xr-x | examples/find-examples.sh | 4 |
5 files changed, 15 insertions, 157 deletions
diff --git a/examples/Makefile b/examples/Makefile.am index 6d54beabb2..e5a9f8d876 100644 --- a/examples/Makefile +++ b/examples/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS = arrow \ +DIST_SUBDIRS = arrow \ aspectframe \ base \ buttonbox \ @@ -28,18 +28,20 @@ SUBDIRS = arrow \ spinbutton \ statusbar \ table \ - tictactoe \ - wheelbarrow + tictactoe +# wheelbarrow -all: - list='$(SUBDIRS)'; \ - for subdir in $$list; do \ - (cd $$subdir && $(MAKE)); \ - done +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/gdk \ + -DGDK_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED \ + $(GTK_DEBUG_FLAGS) \ + $(GTK_DEP_CFLAGS) -clean: - list='$(SUBDIRS)'; \ - for subdir in $$list; do \ - (cd $$subdir && $(MAKE) clean); \ - done +LDADD = \ + $(top_builddir)/gdk/$(gdktargetlib) \ + $(top_builddir)/gtk/$(gtktargetlib) \ + $(GTK_DEP_LIBS) +bin_PROGRAMS = hello-world window-default diff --git a/examples/README.1ST b/examples/README.1ST deleted file mode 100644 index f66a60ab08..0000000000 --- a/examples/README.1ST +++ /dev/null @@ -1,41 +0,0 @@ -GTK Example Code - Tony Gale <gale@gtk.org> 980623 --------------------------------------------------- - -I have written an awk script to automatically extract the code -examples from the GTK Tutorial (in sgml), so they only have to be -changed in one place. - -It's called 'extract.awk', and there is a shell wrapper to invoke -it called 'extract.sh' - -It takes the following switches: - -c : Just do checking rather than output files - -f <filename> : Extract a specific file - -d : Extract file(s) to current directory - -Without the -d switch, the code will be placed in the appropriate -sub-directory. Those sub-directories will be created if they do not -exist. - -Without the -f switch, all code examples will be extracted. - -The shell wrapper assumes that the GTK Tutorial is in the -file "../docs/gtk_tut.sgml" - -It works by looking for sections of text in the tutorial surrounded -by, for example: - -/* example-start helloworld helloworld.c */ - -and - -/* example-end */ - -Where "helloworld" is the directory into which the file will be -placed (which can also be a directory spec like hello/hello1), and -"helloworld.c" is the file name for the code. - -So, the code between these lines would be extracted to the file -helloworld/helloworld.c - -It also handles replacing the sgml tag '&' with '&' diff --git a/examples/extract.awk b/examples/extract.awk deleted file mode 100644 index a1efd673c7..0000000000 --- a/examples/extract.awk +++ /dev/null @@ -1,69 +0,0 @@ -# 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 -# -v : Verbose - -BEGIN {in_example=0; check=0; spec_example=""; do_output=0; flatten=0; verbose=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]=""; - } else if ( ARGV[i] == "-v" ) { - verbose = 1; - ARGV[i] = ""; - } - } -} - -$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 } - -in_example==1 && check==0 && do_output==1 { gsub(/&/, "\\&", $0); - gsub(/</, "<", $0); - gsub(/>/, ">", $0); - print $0 >file_name } - -$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 ) { - if (file_name != "") - close(file_name); - file_name = sprintf("%s/%s",$3, $4); - command = sprintf("mkdir -p %s", $3); - system(command); - } else { - file_name = $4; - } - if (verbose == 1) - printf("%s\n", file_name); - do_output=1; - } - } - - -END {} - - - diff --git a/examples/extract.sh b/examples/extract.sh deleted file mode 100755 index e7536a929f..0000000000 --- a/examples/extract.sh +++ /dev/null @@ -1,30 +0,0 @@ -#! /bin/sh -# extract - extract C source files from GTK Tutorial -# Copyright (C) Tony Gale 1998 -# Contact: gale@gtk.org -# -# extract.awk command Switches: -# -c : Just do checking rather than output files -# -f <filename> : Extract a specific file -# -d : Extract files to current directory - -TUTORIAL=../docs/tutorial/gtk-tut.sgml - -if [ -x /usr/bin/gawk ]; then - gawk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5 -else - if [ -x /usr/bin/nawk ]; then - nawk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5 - else - if [ -x /usr/bin/awk ]; then - awk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5 - else - if [ -x /bin/awk ]; then - awk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5 - else - echo "Can't find awk... please edit extract.sh by hand" - fi - fi - fi -fi - diff --git a/examples/find-examples.sh b/examples/find-examples.sh deleted file mode 100755 index 51de23f88c..0000000000 --- a/examples/find-examples.sh +++ /dev/null @@ -1,4 +0,0 @@ -find . -name CVS -prune -o \ - -not \( -type d -o -name Makefile.am -o -name find-examples.sh \) -print | - sed 's%\./\(.*\)% examples/\1 \\%' -echo " examples/find-examples.sh" |