Changeset 10381 in project


Ignore:
Timestamp:
04/07/08 21:02:20 (11 years ago)
Author:
felix
Message:

doc updates

Location:
chicken/branches/beyond-hope
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • chicken/branches/beyond-hope/TODO

    r10370 r10381  
    11TODO for macro/module system                                    -*- Outline -*-
     2
     3* merge trunk into branch
    24
    35* current module approach problems
     
    57   not done for static se's of global macros
    68
    7 * reimplement macros from chicken-more-macros hygienically
     9* reimplement macros from chicken-ffi-macros hygienically
    810
    911* test hygiene
     
    1214* test local define{-values,-syntax,} expansion
    1315* test extended lambda-lists
    14 * test examples from r5rs spec
    1516* test macro-expansions
    1617** quoted literals
     
    2223* test benchmarks
    2324
    24 * reimplement chicken-more-macros hygienically
    25 
    2625* remove define-macro and ##sys#lisp-transformer, once all macros are converted
    2726
    2827* add low-level support for modules
    2928* find suitable design for modules
    30 ** s48
    31 ** gauche
    3229
    33 * update manual
     30* update manual/NEWS
    3431** expand unit (move stuff from eval)
    3532** document extensions
     
    3734** ack synrules authors
    3835** removals
    39    define-macro
    40    define-record
    4136   run-time and compile-time situations for eval-when
    4237
     
    4944* eggs to be adapted/obsoleted
    5045** syntax-case (eval/expand integration?)
     46*** sxml-match
    5147** codewalk
    5248   must probably go... influences modules, crunch
     
    5551** syntactic-closures?
    5652** simple-macros
     53** alexpander
  • chicken/branches/beyond-hope/manual/Accessing external objects

    r9418 r10381  
    104104
    105105
    106 === define-foreign-record
    107 
    108  [syntax] (define-foreign-record NAME [DECL ...] SLOT ...)
    109 
    110 Defines accessor procedures for a C structure definition. {{NAME}} should either be a symbol
    111 or a list of the form {{(TYPENAME FOREIGNNAME)}}. If {{NAME}} is a symbol, then a C declaration
    112 will be generated that defines a C struct named {{struct NAME}}. If {{NAME}} is a list, then
    113 no struct declaration will be generated and {{FOREIGNNAME}} should name an existing C record type.
    114 A foreign-type specifier named {{NAME}} (or {{TYPENAME}}) will be defined as a pointer to
    115 the given C structure.
    116 A {{SLOT}} definition should be a list of one of the following forms:
    117 
    118  (TYPE SLOTNAME)
    119 
    120 or
    121 
    122  (TYPE SLOTNAME SIZE)
    123 
    124 The latter form defines an array of {{SIZE}} elements of the type {{TYPE}} embedded in the
    125 structure.
    126 For every slot, the following accessor procedures will be generated:
    127 
    128 
    129 ==== TYPENAME-SLOTNAME
    130 
    131  (TYPENAME-SLOTNAME FOREIGN-RECORD-POINTER [INDEX])
    132 
    133 A procedure of one argument (a pointer to a C structure), that returns
    134 the slot value of the slot {{SLOTNAME}}. If a {{SIZE}} has been given in the slot definition, then
    135 an additional argument {{INDEX}} is required that specifies the index of an array-element.
    136 
    137 
    138 ==== TYPENAME-SLOTNAME-set!
    139  
    140  (TYPENAME-SLOTNAME-set! FOREIGN-RECORD-POINTER [INDEX] VALUE)
    141 
    142 A procedure of two arguments (a pointer to a C structure) and a value, that
    143 sets the slot value of the slot {{SLOTNAME}} in the structure. If a {{SIZE}} has been given in
    144 the slot definition, then an additional argument {{INDEX}} is required for the array index.
    145 
    146 
    147 If a slot type is of the form {{(const ...)}}, then no setter procedure will be generated.
    148 Slots of the types {{(struct ...)}} or {{(union ...)}} are accessed as pointers to the embedded
    149 struct (or union) and no setter will be generated.
    150 
    151 Additionally, special record-declarations ({{DECL ...}}) may be given, where each declaration consists
    152 of a list of the form {{(KEYWORD ARGUMENT ...)}}. The available declarations are:
    153 
    154 ==== constructor
    155 
    156  (constructor: NAME)
    157 
    158 Generate a constructor-procedure with no arguments that has the name {{NAME}} (a symbol) that returns a pointer to a structure of this
    159 type. The storage will be allocated with {{malloc(3)}}.
    160 
    161 
    162 ==== destructor
    163 
    164  (destructor: NAME)
    165 
    166 Generate a destructor function with the name {{NAME}} that takes a pointer to a structure of this
    167 type as its single argument and releases the storage with {{free(3)}}. If the argument is {{#f}},
    168 the destructor procedure does nothing.
    169 
    170 
    171 ==== rename
    172 
    173  (rename: EXPRESSION)
    174 
    175 Evaluates {{EXPRESSION}} at compile-/macro-expansion-time and applies the result, which should be
    176 a procedure, to the string-representation of the name of each accessor-procedure generated. Another (or the same)
    177 string should be returned, which in turn is taken as the actual name of the accessor.
    178 
    179 
    180 An example:
    181 
    182 <enscript highlight=scheme>
    183 (require-for-syntax 'srfi-13)
    184 
    185 (define-foreign-record Some_Struct
    186   (rename: (compose string-downcase (cut string-translate <> "_" "-")))
    187   (constructor: make-some-struct)
    188   (destructor: free-some-struct)
    189   (int xCoord)
    190   (int yCoord) )
    191 </enscript>
    192 
    193 will generate the following procedures:
    194 
    195 <enscript highlight=scheme>
    196 (make-some-struct)              --> C-POINTER
    197 (free-some-struct C-POINTER)
    198 
    199 (some-struct-xcoord C-POINTER)  --> NUMBER
    200 (some-struct-ycoord C-POINTER)  --> NUMBER
    201 
    202 (some-struct-xcoord-set! C-POINTER NUMBER)
    203 (some-struct-ycoord-set! C-POINTER NUMBER)
    204 </enscript>
    205 
    206 
    207106=== define-foreign-enum
    208107
  • chicken/branches/beyond-hope/manual/Non-standard macros and special forms

    r10377 r10381  
    334334definitions should only appear at toplevel.
    335335
    336 ==== define-macro
    337 
    338  [syntax] (define-macro (NAME VAR ... [. VAR]) EXP1 ...)
    339  [syntax] (define-macro NAME (lambda (VAR ... [. VAR]) EXP1 ...))
    340  [syntax] (define-macro NAME1 NAME2)
    341 
    342 Define a globally visible macro special form. The macro is available
    343 as soon as it is defined, i.e. it is registered at compile-time. If
    344 the file containing this definition invokes {{eval}} and the
    345 declaration {{run-time-macros}} (or the command line option
    346 {{-run-time-macros}}) has been used, then the
    347 macro is visible in evaluated expressions during runtime. The second
    348 possible syntax for {{define-macro}} is allowed for portability
    349 purposes only. In this case the second argument '''must''' be a
    350 lambda-expression or a macro name.  Only global macros can be defined using this form.
    351 {{(define-macro NAME1 NAME2)}} simply copies the macro definition
    352 from {{NAME2}} to {{NAME1}}, creating an alias.
    353 
    354 Extended lambda list syntax ({{#!optional}}, etc.) can be used but note
    355 that arguments are source expressions and thus default values for optional
    356 or keyword arguments should take this into consideration.
    357 
    358336==== define-for-syntax
    359337
Note: See TracChangeset for help on using the changeset viewer.