code:
/* 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 */
}


code:
<title>%%TITLE%% - GNU Project - Free Software Foundation (FSF)</title>

%%TITLE%%

<address>Free Software Foundation</address>
<address>last updated %%DATE%%</address>

This manual (%%PACKAGE%%) is available in the following formats:

HTML
    (%%HTML_MONO_SIZE%%K bytes) - entirely on one web page.

HTML - with one web page per
    node.

%%IF HTML_SECTION%%

HTML - with one web page per
    section.

%%ENDIF HTML_SECTION%%
%%IF HTML_CHAPTER%%

HTML - with one web page per
    chapter.

%%ENDIF HTML_CHAPTER%%

HTML compressed
    (%%HTML_MONO_GZ_SIZE%%K gzipped characters) - entirely on
    one web page.

HTML compressed
    (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file) -
    with one web page per node.

%%IF HTML_SECTION%%

HTML compressed
    (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file) -
    with one web page per section.

%%ENDIF HTML_SECTION%%
%%IF HTML_CHAPTER%%

HTML compressed
    (%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file) -
    with one web page per chapter.

%%ENDIF HTML_CHAPTER%%

Info document
    (%%INFO_TGZ_SIZE%%K bytes gzipped tar file).

ASCII text
    (%%ASCII_SIZE%%K bytes).

ASCII text compressed
    (%%ASCII_GZ_SIZE%%K bytes gzipped).

TeX dvi file
    (%%DVI_GZ_SIZE%%K bytes gzipped).

PostScript file
    (%%PS_GZ_SIZE%%K bytes gzipped).

PDF file
    (%%PDF_SIZE%%K bytes).

Texinfo source
    (%%TEXI_TGZ_SIZE%%K bytes gzipped tar file).

You can buy printed copies of
some manuals (among other items) from the Free Software Foundation;
this helps support FSF activities.

(This page generated by the %%SCRIPTNAME%%
script.)

Please send FSF & GNU inquiries to
<gnu@gnu.org>.
There are also other ways to contact
the FSF.

Please send broken links and other corrections or suggestions to
<%%EMAIL%%>.

Copyright © 2010 Free Software Foundation, Inc.

Verbatim copying and distribution of this entire article is
permitted in any medium, provided this notice is preserved.

license: mit


code:
From: Mikael Djurfeldt <mdj@mdj.nada.kth.se>
Subject: Re: After GOOPS integration: Computation with native types!
To: Keisuke Nishida <kxn30@po.cwru.edu>
Cc: djurfeldt@nada.kth.se, guile@sourceware.cygnus.com
Cc: djurfeldt@nada.kth.se
Date: 17 Aug 2000 03:01:13 +0200

Keisuke Nishida <kxn30@po.cwru.edu> writes:

> Do I need to include some special feature in my VM?  Hmm, but maybe
> I shouldn't do that now...

Probably not, so I probably shouldn't answer, but...  :)

You'll need to include some extremely efficient mechanism to do
multi-method dispatch.  The SCM_IM_DISPATCH form, with its
implementation at line 2250 in eval.c, is the current basis for
efficient dispatch in GOOPS.

I think we should develop a new instruction for the VM which
corresponds to the SCM_IM_DISPATCH form.

This form serves both the purpose to map argument types to the correct
code, and as a cache of compiled methods.

Notice that I talk about cmethods below, not methods.  In GOOPS, the
GF has a set of methods, but each method has a "code-table" mapping
argument types to code compiled for those particular concrete types.
(So, in essence, GOOPS methods abstractly do a deeper level of type
dispatch.)

The SCM_IM_DISPATCH form has two shapes, depending on whether we use
sequential search (few cmethods) or hashed lookup (many cmethods).

Shape 1:

 (#@dispatch args N-SPECIALIZED #((TYPE1 ... ENV FORMALS FORM1 ...) ...) GF)

Shape 2:

 (#@dispatch args N-SPECIALIZED HASHSET MASK
             #((TYPE1 ... ENV FORMALS FORM1 ...) ...)
             GF)

`args' is (I hope!) a now historic obscure optimization.

N-SPECIALIZED is the maximum number of arguments t do type checking
on.  This is used early termination of argument checking where the
already checked arguments are enough to pick out the cmethod.

The vector is the cache proper.

During sequential search the argument types are simply checked against
each entry.

The method for hashed dispatch is described in:

http://www.parc.xerox.com/csl/groups/sda/publications/papers/Kiczales-Andreas-PCL

In this method, each class has a hash code.  Dispatch means summing
the hash codes for all arguments (up til N-SPECIALIZED) and using the
sum to pick a location in the cache.  The cache is sequentially
searched for an argument type match from that point.

Kiczales introduced a clever method to maximize the probability of a
direct cache hit.  We actually have 8 separate sets of hash codes for
all types.  The hash set to use is selected specifically per GF and is
optimized to give fastest average hit.

What we could try to do as soon as the VM is complete enough is to
represent the cmethods as chunks of byte code.  In the current GOOPS
code, the compilation step (which is currently empty) is situated in
`compile-cmethod' in guile-oops/compile.scm.  [Apologies for the
terrible code.  That particular part was written at Arlanda airport
after a sleepless night (packing luggage, not coding), on my way to
visit Marius (who, BTW, didn't take GOOPS seriously.  ;-)]


code:
;;; groupings.alist					 -*-scheme-*-

;; 	Copyright (C) 2002, 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

;;; Commentary:

;; This file describes interface element groupings.
;; See (scripts scan-api) commentary for more info.
;; NOTE: Order matters; put simple ones first, composites after.
;;
;; TODO: Add goops, add math, etc etc.
;;       Group `guile-C-API' needs much more serious thought.

;;; Code:

(

 ;; Integrity checks

 (C+scheme
  (description "in both groups `scheme' and `C' -- should be empty!")
  (grok () (lambda (x)
             (and (in-group? x 'Scheme)
                  (in-group? x 'C)))))

 ;; Embedded foreign libraries

 (embedded-libltdl
  (description "begins with lt_ -- should become empty over time")
  (grok () (lambda (x)
             (name-prefix? x "lt_"))))

 ;; By name

 (libguile-internal
  (description "begins with scm_i_")
  (grok () (lambda (x)
             (name-prefix? x "scm_i_"))))

 (gdb
  (description "begins with gdb_")
  (grok () (lambda (x)
             (name-prefix? x "gdb_"))))

 (coop
  (description "begins with coop_")
  (grok () (lambda (x)
             (name-prefix? x "coop_"))))

 (gh
  (description "begins with gh_")
  (grok () (lambda (x)
             (name-prefix? x "gh_"))))

 (g-fdes
  (description "begins with g and ends with fds")
  (grok () (lambda (x)
             (name-prefix? x "g.+fds$"))))

 (r-fdes
  (description "begins with r and ends with fds")
  (grok () (lambda (x)
             (name-prefix? x "r.+fds$"))))

 (scm
  (description "begins with scm_")
  (grok () (lambda (x)
             (name-prefix? x "scm_"))))

 (k
  (description "constants")
  (grok () (lambda (x)
             (name-prefix? x "[_A-Z0-9]+$"))))

 (POSIX
  (description "POSIX support")
  (members                              ; from docs

   ;; ports and file descriptors
   port-revealed set-port-revealed! fileno port->fdes fdopen fdes->ports
   fdes->inport fdes->outport primitive-move->fdes move->fdes
   release-port-handle fsync open open-fdes close close-fdes unread-char
   unread-string pipe dup->fdes dup->inport dup->outport dup dup->port
   duplicate-port redirect-port dup2 port-mode close-all-ports-except
   port-for-each setvbuf fcntl flock select
   O_RDONLY O_WRONLY O_RDWR O_APPEND O_CREAT _IONBF _IOLBF _IOFBF
   F_DUPFD F_GETFD F_SETFD F_GETFL F_SETFL F_GETOWN F_SETOWN FD_CLOEXEC
   LOCK_SH LOCK_EX LOCK_UN LOCK_NB

   ;; file system
   access? stat lstat readlink chown chmod utime delete-file copy-file
   rename-file link symlink mkdir rmdir opendir directory-stream? readdir
   rewinddir closedir sync mknod tmpnam mkstemp! dirname basename
   R_OK W_OK X_OK F_OK
   stat:perms stat:type stat:blocks stat:blksize stat:ctime stat:mtime
   stat:atime stat:size stat:rdev stat:gid stat:uid stat:nlink stat:mode
   stat:ino stat:dev

   ;; user information
   passwd:name passwd:passwd passwd:uid passwd:gid passwd:gecos passwd:dir
   passwd:shell group:name group:passwd group:gid group:mem
   getpwuid getpwnam name setpwent getpwent endpwent setpw getpw getgrgid
   getgrnam setgrent getgrent endgrent setgr getgr cuserid getlogin

   ;; time
   tm:sec set-tm:sec tm:min set-tm:min tm:hour set-tm:hour tm:mday set-tm:mday
   tm:mon set-tm:mon tm:year set-tm:year tm:wday set-tm:wday tm:yday
   set-tm:yday tm:isdst set-tm:isdst tm:gmtoff set-tm:gmtoff tm:zone
   set-tm:zone tms:clock tms:utime tms:stime tms:cutime tms:cstime
   current-time gettimeofday localtime gmtime mktime tzset strftime strptime
   times get-internal-real-time get-internal-run-time

   ;; runtime environment
   program-arguments command-line getenv setenv environ putenv

   ;; proceses
   chdir getcwd umask chroot getpid getgroups getppid getuid getgid geteuid
   getegid setuid setgid seteuid setegid getpgrp setpgid setsid waitpid
   status:exit-val status:term-sig status:stop-sig system primitive-exit execl
   execlp execle primitive-fork nice setpriority getpriority
   WNOHANG WUNTRACED

   ;; signals
   kill raise sigaction restore-signals alarm pause sleep usleep setitimer
   getitimer SIGHUP SIGINT

   ;; terminals and ptys
   isatty? ttyname ctermid tcgetpgrp tcsetpgrp

   ;; pipes -- not included because they are in (ice-9 popen)

   ;; system identification
   utsname:sysname utsname:nodename utsname:release utsname:version
   utsname:machine uname gethostname sethostname software-type

   ;; locales
   setlocale
   LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME

   ;; encryption
   crypt getpass))

 (math
  (description "math functions")
  (members $abs $acos $acosh $asin $asinh $atan $atan2 $atanh $cos $cosh
           $exp $expt $log $sin $sinh $sqrt $tan $tanh))

 ;; By composition (these must be AFTER their constituent groupings)

 (guile-C-API
  (description "the official guile API available to C programs")
  (grok () (lambda (x)
             (and (in-group? x 'C)
                  (or (in-group? x 'gh)
                      (in-group? x 'coop)
                      (in-group? x 'gdb))))))

 ;; Add new grouping descriptions here.
 )

;;; groupings.alist ends here