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/branches/SMLNJ/src/runtime/gc/ml-objects.c
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/runtime/gc/ml-objects.c

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

revision 438, Wed Sep 15 16:37:27 1999 UTC revision 439, Wed Sep 15 16:37:27 1999 UTC
# Line 460  Line 460 
460    
461  /* ML_CData:  /* ML_CData:
462   *   *
463   * Allocate a Word8Vector.vector.   * Allocate a 64-bit aligned raw data object (to store abstract C data).
464   */   */
465  ml_val_t ML_AllocCData (ml_state_t *msp, int nbytes)  ml_val_t ML_AllocCData (ml_state_t *msp, int nbytes)
466  {  {
467      ml_val_t    obj;      ml_val_t    obj;
468    
469      obj = ML_AllocString (msp, nbytes);      obj = ML_AllocRaw64 (msp, (nbytes+7)>>2);
470    
471      return obj;      return obj;
472    
# Line 475  Line 475 
475    
476  /* ML_CData:  /* ML_CData:
477   *   *
478   * Allocate a Word8Vector.vector and initialize it to the given C data.   * Allocate a 64-bit aligned raw data object and initialize it to the given C data.
479   */   */
480  ml_val_t ML_CData (ml_state_t *msp, void *data, int nbytes)  ml_val_t ML_CData (ml_state_t *msp, void *data, int nbytes)
481  {  {
482      ml_val_t    obj;      ml_val_t    obj;
483    
484      if (nbytes == 0)      if (nbytes == 0)
485          return ML_string0;          return ML_unit;
486      else {      else {
487          obj = ML_AllocString (msp, nbytes);          obj = ML_AllocRaw64 (msp, (nbytes+7)>>2);
488          memcpy (GET_SEQ_DATAPTR(void, obj), data, nbytes);          memcpy (PTR_MLtoC(void, obj), data, nbytes);
489    
490          return obj;          return obj;
491      }      }
492    
493  } /* end of ML_CData */  } /* end of ML_CData */
   

Legend:
Removed from v.438  
changed lines
  Added in v.439

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