[gforth] / gforth / libcc.fs  

gforth: gforth/libcc.fs

Diff for /gforth/libcc.fs between version 1.10 and 1.11

version 1.10, Mon Apr 9 10:26:35 2007 UTC version 1.11, Wed Apr 25 17:59:36 2007 UTC
Line 328 
Line 328 
     \ addr points to the return type index of a c-function descriptor      \ addr points to the return type index of a c-function descriptor
     dup { descriptor }      dup { descriptor }
     c@+ { ret } count 2dup { d: pars } chars + count { d: c-name }      c@+ { ret } count 2dup { d: pars } chars + count { d: c-name }
     print-c-prefix-lines  
     ." void " descriptor wrapper-function-name 2dup type drop free throw      ." void " descriptor wrapper-function-name 2dup type drop free throw
     .\" (void)\n"      .\" (void)\n"
     .\" {\n  Cell MAYBE_UNUSED *sp = gforth_SP;\n  Float MAYBE_UNUSED *fp = gforth_FP;\n  "      .\" {\n  Cell MAYBE_UNUSED *sp = gforth_SP;\n  Float MAYBE_UNUSED *fp = gforth_FP;\n  "
Line 341 
Line 340 
     endif      endif
     .\" }\n" ;      .\" }\n" ;
   
   variable c-source-file-id
   0 c-source-file-id !
   
   : c-source-file ( -- file-id )
       c-source-file-id @ ?dup-if
           exit
       endif
       s" xxx.c" w/o create-file throw dup c-source-file-id !
       ['] print-c-prefix-lines over outfile-execute ;
   
 : compile-wrapper-function ( -- )  : compile-wrapper-function ( -- )
       c-source-file-id @ assert( dup )
       close-file throw 0 c-source-file-id !
     s" gcc -fPIC -shared -Wl,-soname,xxx.so.1 -Wl,-export_dynamic -o xxx.so.1 -O xxx.c" system      s" gcc -fPIC -shared -Wl,-soname,xxx.so.1 -Wl,-export_dynamic -o xxx.so.1 -O xxx.c" system
     $? abort" compiler generated error" ;      $? abort" compiler generated error" ;
 \    s" ar rcs xxx.a xxx.o" system  \    s" ar rcs xxx.a xxx.o" system
Line 358 
Line 369 
     noname create 2,      noname create 2,
     parse-name { d: c-name }      parse-name { d: c-name }
     here parse-function-types c-name string,      here parse-function-types c-name string,
     s" xxx.c" w/o create-file throw >r ( R:file-id )      ['] gen-wrapper-function c-source-file outfile-execute
     ['] gen-wrapper-function r@ outfile-execute  
     r> close-file throw  
   does> ( ... -- ... )    does> ( ... -- ... )
     dup 2@ { xt-defer xt-cfr }      dup 2@ { xt-defer xt-cfr }
     compile-wrapper-function      compile-wrapper-function
Line 413 
Line 422 
 \ c-function void test6 -- void  \ c-function void test6 -- void
   
 \c #include <string.h>  \c #include <string.h>
   \c #include <stdlib.h>
   
   cr here hex.
   
 c-function strlen strlen a -- n  c-function strlen strlen a -- n
   c-function labs labs n -- n
   
 cr s\" fooo\0" 2dup dump drop .s strlen cr .s cr  cr s\" fooo\0" 2dup dump drop .s strlen cr .s drop cr
   \ -5 labs .s drop cr


Generate output suitable for use with a patch program
Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help