Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/smlnj-c/c-calls.sml
ViewVC logotype

Diff of /sml/trunk/src/smlnj-c/c-calls.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 7, Sun Jan 18 00:59:30 1998 UTC revision 8, Sun Jan 18 01:01:29 1998 UTC
# Line 11  Line 11 
11    
12  functor CCalls (structure CCInfo : CC_INFO) : C_CALLS  =  functor CCalls (structure CCInfo : CC_INFO) : C_CALLS  =
13      struct      struct
14          structure SU = System.Unsafe          structure U = Unsafe
15          structure SUC = System.Unsafe.CInterface          structure UC = U.CInterface
16    
17          val maxWordSzB = 4          val maxWordSzB = 4
18    
# Line 33  Line 33 
33          val say : string -> unit = print          val say : string -> unit = print
34    
35          (* implementation of an abstract pointer type *)          (* implementation of an abstract pointer type *)
36          abstraction CAddress : sig eqtype caddr          structure CAddress :> sig eqtype caddr
37                                     val NULL : caddr                                     val NULL : caddr
38                                     val index : (caddr * int) -> caddr                                     val index : (caddr * int) -> caddr
39                                     val difference : (caddr * caddr) -> word                                     val difference : (caddr * caddr) -> word
# Line 305  Line 305 
305              end              end
306    
307          val libname = "SMLNJ-CCalls"          val libname = "SMLNJ-CCalls"
308          fun cfun x = SUC.c_function libname x          fun cfun x = UC.c_function libname x
309    
310  (**     (* for debugging *)  (**     (* for debugging *)
311          fun cfun s = (print "binding C function '";          fun cfun s = (print "binding C function '";
312                        print s;                        print s;
313                        print "'\n";                        print "'\n";
314                        SUC.c_function libname s)                        UC.c_function libname s)
315  **)  **)
316    
317          fun cbind (mf as (moduleName, funName)) =          fun cbind (mf as (moduleName, funName)) =
318              let val f = SU.Assembly.A.bind_cfun mf              let val f = UC.bindCFun mf
319              in              in
320                  if (SU.cast f <> 0) then SU.cast f                  if (U.cast f <> 0) then U.cast f
321                  else (print ("can't find "^moduleName ^ "." ^ funName^"\n");                  else (print ("can't find "^moduleName ^ "." ^ funName^"\n");
322                        raise SUC.CFunNotFound(moduleName ^ "." ^ funName))                        raise UC.CFunNotFound(moduleName ^ "." ^ funName))
323          end          end
324    
325          type arg_desc = string     (* type requirement *)          type arg_desc = string     (* type requirement *)

Legend:
Removed from v.7  
changed lines
  Added in v.8

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0