[MLton-commit] r5012
Vesa Karvonen
vesak at mlton.org
Sat Dec 30 18:01:30 PST 2006
Changed approach. The public headers are now macroized and used both as
inputs to mlnlffigen and to gcc (to generate C-side stubs). When the
public headers are compiled with gcc, some static checks are being
performed to help ensure consistency.
----------------------------------------------------------------------
U mltonlib/trunk/org/mlton/vesak/libc/unstable/Makefile
D mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/c/
U mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/config-gen.c
A mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/declare.h
A mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/define.h
U mltonlib/trunk/org/mlton/vesak/libc/unstable/libc.mlb
_U mltonlib/trunk/org/mlton/vesak/libc/unstable/public/
D mltonlib/trunk/org/mlton/vesak/libc/unstable/public/common.h
A mltonlib/trunk/org/mlton/vesak/libc/unstable/public/errno.h
U mltonlib/trunk/org/mlton/vesak/libc/unstable/public/stdio.h
A mltonlib/trunk/org/mlton/vesak/libc/unstable/public/string.h
A mltonlib/trunk/org/mlton/vesak/libc/unstable/public/time.h
----------------------------------------------------------------------
Modified: mltonlib/trunk/org/mlton/vesak/libc/unstable/Makefile
===================================================================
--- mltonlib/trunk/org/mlton/vesak/libc/unstable/Makefile 2006-12-30 08:28:52 UTC (rev 5011)
+++ mltonlib/trunk/org/mlton/vesak/libc/unstable/Makefile 2006-12-31 02:01:21 UTC (rev 5012)
@@ -8,18 +8,18 @@
target_id := $(target_arch)-$(target_os)
lib_file := libc-nlffi-$(target_id).a
-mlb_file := libc.mlb
-config_h := public/config-$(target_id).h
-cc_opts := -Wall -std=c99
+config_h := public/config/$(target_id).h
+cc_opts := -Wall -Werror -pedantic -std=c99
bin_dir := .bin/$(target_id)
gen_dir := generated/$(target_id)
-c_dir := detail/c
-c_files := $(wildcard $(c_dir)/*.c)
-o_files := $(patsubst $(c_dir)/%.c,$(bin_dir)/%.o,$(c_files))
+dummy_c := generated/dummy.c
+std_h_files := $(wildcard public/*.h)
+all_h_files := $(wildcard detail/*.h) $(config_h) $(std_h_files)
+
.PHONY : all clean help
help :
@@ -28,27 +28,45 @@
@echo " clean Removes generated files"
@echo " help Prints this message"
-all : $(gen_dir)/$(mlb_file) $(lib_file)
+all : $(gen_dir)/config/lib.mlb $(gen_dir)/std/lib.mlb $(lib_file)
clean :
- rm -rf $(gen_dir) $(bin_dir) $(config_h) $(lib_file)
+ rm -rf \
+ $(bin_dir) \
+ $(config_h) \
+ $(dummy_c) \
+ $(gen_dir) \
+ $(lib_file)
$(config_h) : detail/config-gen.c
- mkdir -p $(bin_dir)
+ @mkdir -p $(bin_dir) $(@D)
gcc $(cc_opts) -o $(bin_dir)/config-gen $<
$(bin_dir)/config-gen > $@
-$(gen_dir)/$(mlb_file) : $(config_h) $(wildcard public/*.h)
- mkdir -p $(gen_dir)
- mlnlffigen -dir $(gen_dir) \
- -mlbfile $(mlb_file) \
- -cppopt '-U$(target_arch) -DTARGET_ARCH=$(target_arch)' \
- -cppopt '-U$(target_os) -DTARGET_OS=$(target_os)' \
- -linkage static $^
+$(gen_dir)/config/lib.mlb : $(config_h) $(gen_dir)
+ mlnlffigen -dir $(@D) \
+ -mlbfile $(@F) \
+ -linkage static $(config_h)
-$(lib_file) : $(o_files)
- ar cr $@ $^
+$(gen_dir)/std/lib.mlb : $(all_h_files) $(gen_dir)
+ mlnlffigen -dir $(@D) \
+ -mlbfile $(@F) \
+ -cppopt '-include detail/declare.h' \
+ -cppopt '-include $(config_h)' \
+ -linkage static $(std_h_files)
-$(bin_dir)/%.o : $(c_dir)/%.c
- mkdir -p $(bin_dir)
- gcc $(cc_opts) -c -o $@ $<
+$(lib_file) : $(all_h_files) $(dummy_c)
+ gcc $(cc_opts) \
+ -c \
+ -o $(bin_dir)/libc-nlffi.o \
+ $(patsubst public/%.h,-include %.h,$(std_h_files)) \
+ -include detail/define.h \
+ $(patsubst %.h,-include %.h,$(std_h_files)) \
+ $(dummy_c)
+ ar cr $@ $(bin_dir)/libc-nlffi.o
+
+$(dummy_c) :
+ @touch $@
+
+$(gen_dir) :
+ @mkdir -p $@
Modified: mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/config-gen.c
===================================================================
--- mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/config-gen.c 2006-12-30 08:28:52 UTC (rev 5011)
+++ mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/config-gen.c 2006-12-31 02:01:21 UTC (rev 5012)
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
/************************************************************************/
@@ -48,18 +49,18 @@
choose_integer_type(const size_t size, const integer_kind kind) {
switch (kind) {
case signed_integer:
- if (sizeof(signed char) == size) return "signed char";
+ if (sizeof(signed char) == size) return "char";
if (sizeof(short) == size) return "short";
if (sizeof(int) == size) return "int";
if (sizeof(long) == size) return "long";
if (sizeof(long long) == size) return "long long";
break;
case unsigned_integer:
- if (sizeof(unsigned char) == size) return "unsigned char";
- if (sizeof(unsigned short) == size) return "unsigned short";
- if (sizeof(unsigned int) == size) return "unsigned int";
- if (sizeof(unsigned long) == size) return "unsigned long";
- if (sizeof(unsigned long long) == size) return "unsigned long long";
+ if (sizeof(unsigned char) == size) return "char";
+ if (sizeof(unsigned short) == size) return "short";
+ if (sizeof(unsigned int) == size) return "int";
+ if (sizeof(unsigned long) == size) return "long";
+ if (sizeof(unsigned long long) == size) return "long long";
break;
}
fail("Couldn't find a %s type of %zd bytes.",
@@ -71,10 +72,7 @@
static void
print_header(void) {
- printf("#ifndef CONFIG_H\n"
- "#define CONFIG_H\n"
- "\n"
- "/* THIS FILE IS GENERATED. DO NOT EDIT! */\n");
+ printf("/* THIS FILE IS GENERATED. DO NOT EDIT! */\n");
}
static void
@@ -89,13 +87,14 @@
print_integer_type(const size_t size,
const integer_kind kind,
const char *name) {
- printf("typedef %s %s;\n", choose_integer_type(size, kind), name);
+ printf("typedef %8s %-12s %s;\n",
+ kind == signed_integer ? "signed" : "unsigned",
+ choose_integer_type(size, kind),
+ name);
}
static void
print_footer(void) {
- printf("\n"
- "#endif\n");
}
/************************************************************************/
@@ -151,6 +150,11 @@
INTEGER_TYPE(intmax_t);
INTEGER_TYPE(uintmax_t);
+ print_separator("time.h");
+
+ INTEGER_TYPE(clock_t);
+ INTEGER_TYPE(time_t);
+
print_separator("wchar.h");
INTEGER_TYPE(wchar_t);
Added: mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/declare.h
===================================================================
--- mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/declare.h 2006-12-30 08:28:52 UTC (rev 5011)
+++ mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/declare.h 2006-12-31 02:01:21 UTC (rev 5012)
@@ -0,0 +1,27 @@
+/* Copyright (C) 2006 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ */
+
+#define CONSTANT(name, type) \
+extern const type name##_;
+
+#define FUNCTION(name, result, args) \
+result name args;
+
+#define PSEUDO_CONSTANT(name, type) \
+type name##_get(void);
+
+#define PSEUDO_VARIABLE(name, type) \
+type name##_get(void); \
+void name##_set(type name##_);
+
+#define ABSTRACT_STRUCT(name) \
+struct name;
+
+#define ABSTRACT_TYPE(name) \
+typedef struct name name;
+
+/* mlnlffigen can't parse restrict */
+#define restrict
Property changes on: mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/declare.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/define.h
===================================================================
--- mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/define.h 2006-12-30 08:28:52 UTC (rev 5011)
+++ mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/define.h 2006-12-31 02:01:21 UTC (rev 5012)
@@ -0,0 +1,33 @@
+/* Copyright (C) 2006 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ */
+
+#define STATIC_ASSERT(c) \
+extern void static_assert(int static_assert[(c) ? 1 : -1])
+
+#define ASSERT_EXISTS(name, type) \
+extern int exists_##name(type* assert_exists); \
+extern void exists_aux_##name(int assert_exists[sizeof(exists_##name(&name))]);
+
+#define CONSTANT(name, type) \
+STATIC_ASSERT(sizeof(type) == sizeof(name)); \
+const type name##_ = name;
+
+#define FUNCTION(name, result, args) \
+typedef result name##_type args; \
+ASSERT_EXISTS(name, name##_type)
+
+#define PSEUDO_CONSTANT(name, type) \
+STATIC_ASSERT(sizeof(type) == sizeof(name)); \
+type name##_get(void) {return name;}
+
+#define PSEUDO_VARIABLE(name, type) \
+STATIC_ASSERT(sizeof(type) == sizeof(name)); \
+type name##_get(void) {return name;} \
+void name##_set(type name##_) {name = name##_;}
+
+#define ABSTRACT_STRUCT(name)
+
+#define ABSTRACT_TYPE(name)
Property changes on: mltonlib/trunk/org/mlton/vesak/libc/unstable/detail/define.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: mltonlib/trunk/org/mlton/vesak/libc/unstable/libc.mlb
===================================================================
--- mltonlib/trunk/org/mlton/vesak/libc/unstable/libc.mlb 2006-12-30 08:28:52 UTC (rev 5011)
+++ mltonlib/trunk/org/mlton/vesak/libc/unstable/libc.mlb 2006-12-31 02:01:21 UTC (rev 5012)
@@ -4,4 +4,5 @@
* See the LICENSE file or http://mlton.org/License for details.
*)
-generated/$(TARGET_ARCH)-$(TARGET_OS)/libc.mlb
+generated/$(TARGET_ARCH)-$(TARGET_OS)/config/lib.mlb
+generated/$(TARGET_ARCH)-$(TARGET_OS)/std/lib.mlb
Property changes on: mltonlib/trunk/org/mlton/vesak/libc/unstable/public
___________________________________________________________________
Name: svn:ignore
- config-*-*.h
+ config
Deleted: mltonlib/trunk/org/mlton/vesak/libc/unstable/public/common.h
===================================================================
--- mltonlib/trunk/org/mlton/vesak/libc/unstable/public/common.h 2006-12-30 08:28:52 UTC (rev 5011)
+++ mltonlib/trunk/org/mlton/vesak/libc/unstable/public/common.h 2006-12-31 02:01:21 UTC (rev 5012)
@@ -1,21 +0,0 @@
-#ifndef COMMON_H
-#define COMMON_H
-
-/* Copyright (C) 2006 Vesa Karvonen
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- */
-
-#if !defined(TARGET_ARCH) || !defined(TARGET_OS)
-#error TARGET_ARCH and TARGET_OS must be defined
-#endif
-
-#define STRINGIFY(x) STRINGIFY_DELAY(x)
-#define STRINGIFY_DELAY(x) #x
-
-#include STRINGIFY(config-TARGET_ARCH-TARGET_OS.h)
-
-#define restrict /* mlnlffigen can't parse restrict ATM */
-
-#endif
Added: mltonlib/trunk/org/mlton/vesak/libc/unstable/public/errno.h
===================================================================
--- mltonlib/trunk/org/mlton/vesak/libc/unstable/public/errno.h 2006-12-30 08:28:52 UTC (rev 5011)
+++ mltonlib/trunk/org/mlton/vesak/libc/unstable/public/errno.h 2006-12-31 02:01:21 UTC (rev 5012)
@@ -0,0 +1,11 @@
+/* Copyright (C) 2006 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ */
+
+CONSTANT(EDOM , int)
+CONSTANT(EILSEQ , int)
+CONSTANT(ERANGE , int)
+
+PSEUDO_VARIABLE(errno , int)
Property changes on: mltonlib/trunk/org/mlton/vesak/libc/unstable/public/errno.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: mltonlib/trunk/org/mlton/vesak/libc/unstable/public/stdio.h
===================================================================
--- mltonlib/trunk/org/mlton/vesak/libc/unstable/public/stdio.h 2006-12-30 08:28:52 UTC (rev 5011)
+++ mltonlib/trunk/org/mlton/vesak/libc/unstable/public/stdio.h 2006-12-31 02:01:21 UTC (rev 5012)
@@ -1,80 +1,75 @@
-#ifndef STDIO_H
-#define STDIO_H
-
/* Copyright (C) 2006 Vesa Karvonen
*
* This code is released under the MLton license, a BSD-style license.
* See the LICENSE file or http://mlton.org/License for details.
*/
-#include "common.h"
+ABSTRACT_TYPE(FILE)
+ABSTRACT_TYPE(fpos_t)
-typedef struct FILE FILE;
-typedef struct fpos_t fpos_t;
+CONSTANT(BUFSIZ , size_t)
+CONSTANT(EOF , int)
+CONSTANT(FILENAME_MAX , int)
+CONSTANT(FOPEN_MAX , int)
+CONSTANT(L_tmpnam , int)
+CONSTANT(SEEK_CUR , int)
+CONSTANT(SEEK_END , int)
+CONSTANT(SEEK_SET , int)
+CONSTANT(TMP_MAX , int)
+CONSTANT(_IOFBF , int)
+CONSTANT(_IOLBF , int)
+CONSTANT(_IONBF , int)
-extern const int EOF_;
-extern const int FILENAME_MAX_;
-extern const int FOPEN_MAX_;
-extern const int L_tmpnam_;
-extern const int SEEK_CUR_;
-extern const int SEEK_END_;
-extern const int SEEK_SET_;
-extern const int TMP_MAX_;
-extern const int _IOFBF_;
-extern const int _IOLBF_;
-extern const int _IONBF_;
-extern const size_t BUFSIZ_;
+PSEUDO_CONSTANT(stderr , FILE *)
+PSEUDO_CONSTANT(stdin , FILE *)
+PSEUDO_CONSTANT(stdout , FILE *)
-FILE *stderr_(void);
-FILE *stdin_(void);
-FILE *stdout_(void);
+FUNCTION(clearerr , void , (FILE *stream))
+FUNCTION(fclose , int , (FILE *stream))
+FUNCTION(feof , int , (FILE *stream))
+FUNCTION(ferror , int , (FILE *stream))
+FUNCTION(fflush , int , (FILE *stream))
+FUNCTION(fgetc , int , (FILE *stream))
+FUNCTION(fgetpos , int , (FILE * restrict stream, fpos_t * restrict pos))
+FUNCTION(fgets , char * , (char * restrict s, int n, FILE * restrict stream))
+FUNCTION(fopen , FILE * , (const char * restrict filename, const char * restrict mode))
+FUNCTION(fputc , int , (int c, FILE *stream))
+FUNCTION(fputs , int , (const char * restrict s, FILE * restrict stream))
+FUNCTION(fread , size_t , (void * restrict ptr, size_t size, size_t nmemb, FILE * restrict stream))
+FUNCTION(freopen , FILE * , (const char * restrict filename, const char * restrict mode, FILE * restrict stream))
+FUNCTION(fseek , int , (FILE *stream, long int offset, int whence))
+FUNCTION(fsetpos , int , (FILE *stream, const fpos_t *pos))
+FUNCTION(ftell , long , (FILE *stream))
+FUNCTION(fwrite , size_t , (const void * restrict ptr, size_t size, size_t nmemb, FILE * restrict stream))
+FUNCTION(getc , int , (FILE *stream))
+FUNCTION(getchar , int , (void))
+FUNCTION(gets , char * , (char *s))
+FUNCTION(perror , void , (const char *s))
+FUNCTION(putc , int , (int c, FILE *stream))
+FUNCTION(putchar , int , (int c))
+FUNCTION(puts , int , (const char *s))
+FUNCTION(remove , int , (const char *filename))
+FUNCTION(rename , int , (const char *old, const char *new))
+FUNCTION(rewind , void , (FILE *stream))
+FUNCTION(setbuf , void , (FILE * restrict stream, char * restrict buf))
+FUNCTION(setvbuf , int , (FILE * restrict stream, char * restrict buf, int mode, size_t size))
+FUNCTION(tmpfile , FILE * , (void))
+FUNCTION(tmpnam , char * , (char *s))
+FUNCTION(ungetc , int , (int c, FILE *stream))
-int remove(const char *filename);
-int rename(const char *old, const char *new);
-FILE *tmpfile(void);
-char *tmpnam(char *s);
-int fclose(FILE *stream);
-int fflush(FILE *stream);
-FILE *fopen(const char * restrict filename, const char * restrict mode);
-FILE *freopen(const char * restrict filename, const char * restrict mode,
-FILE * restrict stream);
-void setbuf(FILE * restrict stream, char * restrict buf);
-int setvbuf(FILE * restrict stream, char * restrict buf, int mode, size_t size);
-/* int fprintf(FILE * restrict stream, const char * restrict format, ...); */
-/* int fscanf(FILE * restrict stream, const char * restrict format, ...); */
-/* int printf(const char * restrict format, ...); */
-/* int scanf(const char * restrict format, ...); */
-/* int snprintf(char * restrict s, size_t n, const char * restrict format, ...); */
-/* int sprintf(char * restrict s, const char * restrict format, ...); */
-/* int sscanf(const char * restrict s, const char * restrict format, ...); */
-/* int vfprintf(FILE * restrict stream, const char * restrict format, va_list arg); */
-/* int vfscanf(FILE * restrict stream, const char * restrict format, va_list arg); */
-/* int vprintf(const char * restrict format, va_list arg); */
-/* int vscanf(const char * restrict format, va_list arg); */
-/* int vsnprintf(char * restrict s, size_t n, const char * restrict format, va_list arg); */
-/* int vsprintf(char * restrict s, const char * restrict format, va_list arg); */
-/* int vsscanf(const char * restrict s, const char * restrict format, va_list arg); */
-int fgetc(FILE *stream);
-char *fgets(char * restrict s, int n, FILE * restrict stream);
-int fputc(int c, FILE *stream);
-int fputs(const char * restrict s, FILE * restrict stream);
-int getc(FILE *stream);
-int getchar(void);
-char *gets(char *s);
-int putc(int c, FILE *stream);
-int putchar(int c);
-int puts(const char *s);
-int ungetc(int c, FILE *stream);
-size_t fread(void * restrict ptr, size_t size, size_t nmemb, FILE * restrict stream);
-size_t fwrite(const void * restrict ptr, size_t size, size_t nmemb, FILE * restrict stream);
-int fgetpos(FILE * restrict stream, fpos_t * restrict pos);
-int fseek(FILE *stream, long int offset, int whence);
-int fsetpos(FILE *stream, const fpos_t *pos);
-long int ftell(FILE *stream);
-void rewind(FILE *stream);
-void clearerr(FILE *stream);
-int feof(FILE *stream);
-int ferror(FILE *stream);
-void perror(const char *s);
-
+#if 0
+FUNCTION(fprintf , int , (FILE * restrict stream, const char * restrict format, ...))
+FUNCTION(fscanf , int , (FILE * restrict stream, const char * restrict format, ...))
+FUNCTION(printf , int , (const char * restrict format, ...))
+FUNCTION(scanf , int , (const char * restrict format, ...))
+FUNCTION(snprintf , int , (char * restrict s, size_t n, const char * restrict format, ...))
+FUNCTION(sprintf , int , (char * restrict s, const char * restrict format, ...))
+FUNCTION(sscanf , int , (const char * restrict s, const char * restrict format, ...))
+FUNCTION(vfprintf , int , (FILE * restrict stream, const char * restrict format, va_list arg))
+FUNCTION(vfscanf , int , (FILE * restrict stream, const char * restrict format, va_list arg))
+FUNCTION(vprintf , int , (const char * restrict format, va_list arg))
+FUNCTION(vscanf , int , (const char * restrict format, va_list arg))
+FUNCTION(vsnprintf , int , (char * restrict s, size_t n, const char * restrict format, va_list arg))
+FUNCTION(vsprintf , int , (char * restrict s, const char * restrict format, va_list arg))
+FUNCTION(vsscanf , int , (const char * restrict s, const char * restrict format, va_list arg))
#endif
Added: mltonlib/trunk/org/mlton/vesak/libc/unstable/public/string.h
===================================================================
--- mltonlib/trunk/org/mlton/vesak/libc/unstable/public/string.h 2006-12-30 08:28:52 UTC (rev 5011)
+++ mltonlib/trunk/org/mlton/vesak/libc/unstable/public/string.h 2006-12-31 02:01:21 UTC (rev 5012)
@@ -0,0 +1,28 @@
+/* Copyright (C) 2006 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ */
+
+FUNCTION(memchr , void * , (const void *s, int c, size_t n))
+FUNCTION(memcmp , int , (const void *s1, const void *s2, size_t n))
+FUNCTION(memcpy , void * , (void * restrict s1, const void * restrict s2, size_t n))
+FUNCTION(memmove , void * , (void *s1, const void *s2, size_t n))
+FUNCTION(memset , void * , (void *s, int c, size_t n))
+FUNCTION(strcat , char * , (char * restrict s1, const char * restrict s2))
+FUNCTION(strchr , char * , (const char *s, int c))
+FUNCTION(strcmp , int , (const char *s1, const char *s2))
+FUNCTION(strcoll , int , (const char *s1, const char *s2))
+FUNCTION(strcpy , char * , (char * restrict s1, const char * restrict s2))
+FUNCTION(strcspn , size_t , (const char *s1, const char *s2))
+FUNCTION(strerror , char * , (int errnum))
+FUNCTION(strlen , size_t , (const char *s))
+FUNCTION(strncat , char * , (char * restrict s1, const char * restrict s2, size_t n))
+FUNCTION(strncmp , int , (const char *s1, const char *s2, size_t n))
+FUNCTION(strncpy , char * , (char * restrict s1, const char * restrict s2, size_t n))
+FUNCTION(strpbrk , char * , (const char *s1, const char *s2))
+FUNCTION(strrchr , char * , (const char *s, int c))
+FUNCTION(strspn , size_t , (const char *s1, const char *s2))
+FUNCTION(strstr , char * , (const char *s1, const char *s2))
+FUNCTION(strtok , char * , (char * restrict s1, const char * restrict s2))
+FUNCTION(strxfrm , size_t , (char * restrict s1, const char * restrict s2, size_t n))
Property changes on: mltonlib/trunk/org/mlton/vesak/libc/unstable/public/string.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: mltonlib/trunk/org/mlton/vesak/libc/unstable/public/time.h
===================================================================
--- mltonlib/trunk/org/mlton/vesak/libc/unstable/public/time.h 2006-12-30 08:28:52 UTC (rev 5011)
+++ mltonlib/trunk/org/mlton/vesak/libc/unstable/public/time.h 2006-12-31 02:01:21 UTC (rev 5012)
@@ -0,0 +1,30 @@
+/* Copyright (C) 2006 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ */
+
+ABSTRACT_STRUCT(tm)
+
+CONSTANT(CLOCKS_PER_SEC , clock_t)
+
+FUNCTION(asctime , char * , (const struct tm *timeptr))
+FUNCTION(clock , clock_t , (void))
+FUNCTION(ctime , char * , (const time_t *timer))
+FUNCTION(difftime , double , (time_t time1, time_t time0))
+FUNCTION(gmtime , struct tm * , (const time_t *timer))
+FUNCTION(localtime , struct tm * , (const time_t *timer))
+FUNCTION(mktime , time_t , (struct tm *timeptr))
+FUNCTION(strftime , size_t , (char * restrict s, size_t maxsize, const char * restrict format, const struct tm * restrict timeptr))
+FUNCTION(time , time_t , (time_t *timer))
+
+#if 0
+ABSTRACT_STRUCT(tmx)
+
+CONSTANT(_LOCALTIME , int)
+CONSTANT(_NO_LEAP_SECONDS , int)
+
+FUNCTION(mkxtime , time_t , (struct tmx *timeptr))
+FUNCTION(strfxtime , size_t , (char * restrict s, size_t maxsize, const char * restrict format, const struct tmx * restrict timeptr))
+FUNCTION(zonetime , struct tmx * , (const time_t *timer))
+#endif
Property changes on: mltonlib/trunk/org/mlton/vesak/libc/unstable/public/time.h
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the MLton-commit
mailing list