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

SCM Repository

[smlnj] Annotation of /sml/trunk/src/runtime/c-libs/smlnj-runtime/export-heap.c
ViewVC logotype

Annotation of /sml/trunk/src/runtime/c-libs/smlnj-runtime/export-heap.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 250 - (view) (download) (as text)

1 : monnier 249 /* export-heap.c
2 :     *
3 :     * COPYRIGHT (c) 1995 by AT&T Bell Laboratories.
4 :     */
5 :    
6 :     #include "ml-osdep.h"
7 :     #include <stdio.h>
8 :     #include <string.h>
9 :     #include "ml-base.h"
10 :     #include "ml-values.h"
11 :     #include "ml-state.h"
12 :     #include "heap-io.h"
13 :     #include "ml-c.h"
14 :     #include "cfun-proto-list.h"
15 :    
16 :    
17 :     /* _ml_RunT_export_heap : string -> bool
18 :     *
19 :     * Export the world to the given file and return false (the exported version
20 :     * returns true).
21 :     */
22 :     ml_val_t _ml_RunT_export_heap (ml_state_t *msp, ml_val_t arg)
23 :     {
24 :     char fname[1024];
25 :     FILE *file;
26 :     int sts;
27 :    
28 :     QualifyImageName (strcpy(fname, STR_MLtoC(arg)));
29 :    
30 :     if ((file = fopen(fname, "wb")) == NULL)
31 :     return RAISE_ERROR(msp, "unable to open file for writing");
32 :    
33 :     msp->ml_arg = ML_true;
34 :     sts = ExportHeapImage (msp, file);
35 :     fclose (file);
36 :    
37 :     if (sts == SUCCESS)
38 :     return ML_false;
39 :     else
40 :     return RAISE_ERROR(msp, "export failed");
41 :    
42 :     } /* end of _ml_RunT_export_heap */
43 :    

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