diff options
author | Andy Wingo <wingo@pobox.com> | 2014-04-28 18:51:21 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2014-04-28 18:51:21 +0200 |
commit | d7a67c3e918acd8ca46dc7792a8ca98b33cb94e8 (patch) | |
tree | 7ccf125978778d1ac6bb656245305c76db8e02d0 /doc/example-smob | |
parent | 475772ea57c97d0fa0f9ed9303db137d9798ddd3 (diff) | |
parent | 4338f2f91e1dd63a40384077d091295d90047926 (diff) | |
download | guile-d7a67c3e918acd8ca46dc7792a8ca98b33cb94e8.tar.gz |
Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
.gitignore
doc/example-smob/Makefile
doc/ref/api-smobs.texi
doc/ref/libguile-concepts.texi
doc/ref/libguile-smobs.texi
libguile.h
libguile/finalizers.c
libguile/finalizers.h
libguile/goops.c
module/language/tree-il/compile-glil.scm
module/oop/goops.scm
Diffstat (limited to 'doc/example-smob')
-rw-r--r-- | doc/example-smob/ChangeLog-2008 | 56 | ||||
-rw-r--r-- | doc/example-smob/Makefile | 12 | ||||
-rw-r--r-- | doc/example-smob/README | 6 | ||||
-rw-r--r-- | doc/example-smob/image-type.c | 115 | ||||
-rw-r--r-- | doc/example-smob/image-type.h | 3 | ||||
-rw-r--r-- | doc/example-smob/myguile.c | 37 |
6 files changed, 0 insertions, 229 deletions
diff --git a/doc/example-smob/ChangeLog-2008 b/doc/example-smob/ChangeLog-2008 deleted file mode 100644 index 931860849..000000000 --- a/doc/example-smob/ChangeLog-2008 +++ /dev/null @@ -1,56 +0,0 @@ -2008-01-22 Neil Jerram <neil@ossau.uklinux.net> - - * COPYING: Removed. - -2004-09-24 Marius Vollmer <mvo@zagadka.de> - - * image-type.c: Updated from manual. - -2002-02-28 Marius Vollmer <mvo@zagadka.ping.de> - - * image-type.c (image_tag): Changed type to scm_t_bits. - (make_image): Use scm_gc_malloc instead of scm_must_malloc. - (free_image): Use scm_gc_free instead of free. Return zero. - -2001-05-30 Martin Grabmueller <mgrabmue@cs.tu-berlin.de> - - * image-type.c: Adapted to new typing and naming convention. - -2001-04-26 Neil Jerram <neil@ossau.uklinux.net> - - * image-type.c (make_image): Don't need to use SCM_NIMP before - SCM_STRINGP. - (clear_image): Use SCM_SMOB_PREDICATE. - (clear_image, mark_image, free_image, print_image): Use - SCM_SMOB_DATA rather than SCM_CDR. - -2000-06-20 Mikael Djurfeldt <mdj@thalamus.nada.kth.se> - - * image-type.c: Removed unused scm_smobfuns structure. - (init_image_type): Use standard smob type interface. - -Fri Jun 25 22:21:04 1999 Greg Badros <gjb@cs.washington.edu> - - * image-type.c: Updated example to use scm_make_smob_type_mfpe, - SCM_RETURN_NEWSMOB, SCM_NEWSMOB function and macros. - -1998-10-19 Jim Blandy <jimb@zwingli.cygnus.com> - - * image-type.c, myguile.c: Terminate copyright comments. - - * COPYING: New file. - * image-type.c myguile.c: Add copyright notice. - -1998-10-16 Jim Blandy <jimb@zwingli.cygnus.com> - - * Makefile (myguile): Fix link command, to put the Guile libraries - after the object files. The old command worked on my machine, but - I don't see how. - -1998-10-15 Jim Blandy <jimb@zwingli.cygnus.com> - - Created this directory for the Guile 1.3 release. Thanks to Jay - Glascoe for suggesting that we provide a complete, buildable - example! - * ChangeLog, Makefile, README, image-type.c, image-type.h, - myguile: New files. diff --git a/doc/example-smob/Makefile b/doc/example-smob/Makefile deleted file mode 100644 index d368d7b21..000000000 --- a/doc/example-smob/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CFLAGS = `pkg-config guile-2.2 --cflags` -LIBS = `pkg-config guile-2.2 --libs` - -O_FILES = image-type.o myguile.o - -all: myguile - -myguile: $(O_FILES) - $(CC) $(O_FILES) $(LIBS) -o myguile - -clean: - -rm -rf myguile $(O_FILES) diff --git a/doc/example-smob/README b/doc/example-smob/README deleted file mode 100644 index 1380db123..000000000 --- a/doc/example-smob/README +++ /dev/null @@ -1,6 +0,0 @@ -This is the example code for the ``Defining New Types (Smobs)'' -chapter of the Guile manual. - -When you try to execute the code, if the system complains that it -can't find libguile.so, you need to add the directory containing the -installed Guile libraries to your LD_LIBRARY_PATH environment variable. diff --git a/doc/example-smob/image-type.c b/doc/example-smob/image-type.c deleted file mode 100644 index fc28a7de1..000000000 --- a/doc/example-smob/image-type.c +++ /dev/null @@ -1,115 +0,0 @@ -/* image-type.c - * - * Copyright (C) 1998, 2000, 2004, 2006, 2011 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 3, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; see the file COPYING.LESSER. If - * not, write to the Free Software Foundation, Inc., 51 Franklin - * Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdlib.h> -#include <libguile.h> - -static scm_t_bits image_tag; - -struct image -{ - int width, height; - char *pixels; - - /* The name of this image */ - SCM name; - - /* A function to call when this image is - modified, e.g., to update the screen, - or SCM_BOOL_F if no action necessary */ - SCM update_func; -}; - -static SCM -make_image (SCM name, SCM s_width, SCM s_height) -{ - SCM smob; - struct image *image; - int width = scm_to_int (s_width); - int height = scm_to_int (s_height); - - /* Step 1: Allocate the memory block. - */ - image = (struct image *) scm_gc_malloc (sizeof (struct image), "image"); - - /* Step 2: Initialize it with straight code. - */ - image->width = width; - image->height = height; - image->pixels = NULL; - image->name = SCM_BOOL_F; - image->update_func = SCM_BOOL_F; - - /* Step 3: Create the smob. - */ - SCM_NEWSMOB (smob, image_tag, image); - - /* Step 4: Finish the initialization. - */ - image->name = name; - image->pixels = scm_gc_malloc_pointerless (width * height, "image pixels"); - - return smob; -} - -SCM -clear_image (SCM image_smob) -{ - int area; - struct image *image; - - scm_assert_smob_type (image_tag, image_smob); - - image = (struct image *) SCM_SMOB_DATA (image_smob); - area = image->width * image->height; - memset (image->pixels, 0, area); - - /* Invoke the image's update function. - */ - if (scm_is_true (image->update_func)) - scm_call_0 (image->update_func); - - scm_remember_upto_here_1 (image_smob); - - return SCM_UNSPECIFIED; -} - -static int -print_image (SCM image_smob, SCM port, scm_print_state *pstate) -{ - struct image *image = (struct image *) SCM_SMOB_DATA (image_smob); - - scm_puts ("#<image ", port); - scm_display (image->name, port); - scm_puts (">", port); - - /* non-zero means success */ - return 1; -} - -void -init_image_type (void) -{ - image_tag = scm_make_smob_type ("image", sizeof (struct image)); - scm_set_smob_print (image_tag, print_image); - - scm_c_define_gsubr ("clear-image", 1, 0, 0, clear_image); - scm_c_define_gsubr ("make-image", 3, 0, 0, make_image); -} diff --git a/doc/example-smob/image-type.h b/doc/example-smob/image-type.h deleted file mode 100644 index 38fcf74c4..000000000 --- a/doc/example-smob/image-type.h +++ /dev/null @@ -1,3 +0,0 @@ -/* file "image-type.h" */ - -void init_image_type (void); diff --git a/doc/example-smob/myguile.c b/doc/example-smob/myguile.c deleted file mode 100644 index 30200dd03..000000000 --- a/doc/example-smob/myguile.c +++ /dev/null @@ -1,37 +0,0 @@ -/* myguile.c - * - * Copyright (C) 1998, 2006 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 3, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; see the file COPYING.LESSER. If - * not, write to the Free Software Foundation, Inc., 51 Franklin - * Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <libguile.h> -#include "image-type.h" - -static void -inner_main (void *closure, int argc, char **argv) -{ - /* module initializations would go here */ - init_image_type(); - scm_shell (argc, argv); -} - -int -main (int argc, char **argv) -{ - scm_boot_guile (argc, argv, inner_main, 0); - return 0; /* never reached */ -} |