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/num64/runtime/c-libs/win32-io/win32-io.c
ViewVC logotype

Diff of /sml/branches/num64/runtime/c-libs/win32-io/win32-io.c

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

revision 5252, Sat Jun 1 19:56:51 2019 UTC revision 5253, Sat Jun 1 21:11:08 2019 UTC
# Line 42  Line 42 
42   */   */
43  ml_val_t _ml_win32_IO_close(ml_state_t *msp, ml_val_t arg)  ml_val_t _ml_win32_IO_close(ml_state_t *msp, ml_val_t arg)
44  {  {
45    HANDLE h = (HANDLE) WORD_MLtoC(arg);    HANDLE h = (HANDLE) INT32_MLtoC(arg);
46    
47    if (CloseHandle(h)) {    if (CloseHandle(h)) {
48      return ML_unit;      return ML_unit;
# Line 54  Line 54 
54  }  }
55    
56    
57  /* _ml_win32_IO_set_file_pointer: (word32 * word32 * word32) -> word32  /* _ml_win32_IO_set_file_pointer: (word32 * Position.int * word32) -> word64
58   *                                 handle   dist     how   *                                 handle   dist     how
59   */   */
60  ml_val_t _ml_win32_IO_set_file_pointer(ml_state_t *msp, ml_val_t arg)  ml_val_t _ml_win32_IO_set_file_pointer(ml_state_t *msp, ml_val_t arg)
61  {  {
62    HANDLE h = (HANDLE) WORD_MLtoC(REC_SEL(arg,0));      HANDLE h = (HANDLE) INT32_MLtoC(REC_SEL(arg,0));
   LONG dist = (LONG) WORD_MLtoC(REC_SEL(arg,1));  
63    DWORD how = (DWORD) WORD_MLtoC(REC_SEL(arg,2));    DWORD how = (DWORD) WORD_MLtoC(REC_SEL(arg,2));
64    Word_t w;      LARGE_INTEGER dist, pos;
   ml_val_t res;  
65    
66    w = SetFilePointer(h,dist,NULL,how);      dist.QuadPart = INT64_MLtoC(REC_SEL(arg,1));
67    WORD_ALLOC(msp, res, w);  
68    return res;      if (SetFilePointerEx(h, dist, &pos, how)) {
69            return INT64_CtoML(msp, pos.QuadPart);
70        }
71        else {
72            return RAISE_SYSERR(msp,-1);
73        }
74  }  }
75    
76  /* remove CRs ('\r') from buf of size *np; sets *np to be the new buf size  /* remove CRs ('\r') from buf of size *np; sets *np to be the new buf size

Legend:
Removed from v.5252  
changed lines
  Added in v.5253

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