[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] RE: Mingwin Patch

From: Brent Fulgham
Subject: [Help-smalltalk] RE: Mingwin Patch
Date: Thu, 27 Feb 2003 16:29:21 -0800

> I'd like you to expand on what's needed from glib and what's winx and
> whether it's possible to extract code from them into GNU Smalltalk's
> tarball.

The only thing needed from GLIB is the implementation of ftruncate, which
appears to be as simple as:

#include <stdlib.h>
#include <stdio.h>

ftruncate (int fd, unsigned int size)
  HANDLE hfile;
  unsigned int curpos;

  g_return_val_if_fail (fd >= 0, -1);
  hfile = (HANDLE) _get_osfhandle (fd);
  curpos = SetFilePointer (hfile, 0, NULL, FILE_CURRENT);
  if (curpos == 0xFFFFFFFF
      || SetFilePointer (hfile, size, NULL, FILE_BEGIN) == 0xFFFFFFFF
      || !SetEndOfFile (hfile))
      gint error = GetLastError ();

      switch (error)
          errno = EBADF;
          errno = EIO;
      return -1;
  return 0;

This code is GPL'd, so should pose no integration problem.

 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.

Integrating this into the sources will remove the library dependency
> Also I'll change WIN32 and _WIN32 to __MINGW32__.

Are you sure you want to?  I would rather see "CYGWIN" special-cased
(since it follows POSIX semantics) while MINGW32 and plain-old Windows
WIN32 use the same "Windows-y" behavior.

Stand by for WINX information...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]