From 75337648cfcf0c1f5afd8b355b495972cb33c43a Mon Sep 17 00:00:00 2001
From: Eduardo Cavazos <dharmatech@finkelstein.stackeffects.info>
Date: Mon, 22 Dec 2008 06:37:33 -0600
Subject: [PATCH] Update 'size-of' and move to extra from unmaintained

---
 extra/size-of/size-of.factor | 38 ++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 extra/size-of/size-of.factor

diff --git a/extra/size-of/size-of.factor b/extra/size-of/size-of.factor
new file mode 100644
index 0000000000..d40ea6f8ba
--- /dev/null
+++ b/extra/size-of/size-of.factor
@@ -0,0 +1,38 @@
+
+USING: io io.encodings.ascii io.files io.files.temp io.launcher
+       locals math.parser sequences sequences.deep ;
+
+IN: size-of
+
+! Use 'size-of' to find out the size in bytes of a C type.
+!
+! The 'headers' argument is a list of header files to use. You may
+! pass 'f' to only use 'stdio.h'.
+!
+! Examples:
+! 
+!   f "int" size-of .
+! 
+!   { "X11/Xlib.h" } "XAnyEvent" size-of .
+
+:: size-of ( HEADERS TYPE -- n )
+
+  [let | C-FILE   [ "size-of.c" temp-file ]
+         EXE-FILE [ "size-of"   temp-file ]
+         INCLUDES [ HEADERS [| FILE | { "#include <" FILE ">" } concat ] map ] |
+
+    {
+      "#include <stdio.h>"
+      INCLUDES
+      "main() { printf( \"%i\" , sizeof( " TYPE " ) ) ; }"
+    }
+
+    flatten C-FILE  ascii  set-file-lines
+
+    { "gcc" C-FILE "-o" EXE-FILE } try-process
+
+    EXE-FILE ascii <process-reader> contents string>number ] ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ 
\ No newline at end of file