| 
									
										
										
										
											2008-03-20 21:11:45 -04:00
										 |  |  | ! Copyright (C) 2005, 2008 Slava Pestov, Alex Chapman. | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2008-07-01 17:33:45 -04:00
										 |  |  | USING: accessors arrays alien alien.c-types alien.structs | 
					
						
							|  |  |  | alien.arrays alien.strings kernel math namespaces parser | 
					
						
							|  |  |  | sequences words quotations math.parser splitting grouping | 
					
						
							| 
									
										
										
										
											2008-12-11 01:03:58 -05:00
										 |  |  | effects assocs combinators lexer strings.parser alien.parser  | 
					
						
							| 
									
										
										
										
											2009-01-21 20:55:33 -05:00
										 |  |  | fry vocabs.parser words.constant ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | IN: alien.syntax | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-03-18 19:02:24 -04:00
										 |  |  | : DLL" lexer get skip-blank parse-string dlopen parsed ; parsing | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : ALIEN: scan string>number <alien> parsed ; parsing | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-01 17:33:45 -04:00
										 |  |  | : BAD-ALIEN <bad-alien> parsed ; parsing | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | : LIBRARY: scan "c-library" set ; parsing | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : FUNCTION: | 
					
						
							|  |  |  |     scan "c-library" get scan ";" parse-tokens | 
					
						
							| 
									
										
										
										
											2008-04-26 00:12:44 -04:00
										 |  |  |     [ "()" subseq? not ] filter
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     define-function ; parsing | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : TYPEDEF: | 
					
						
							|  |  |  |     scan scan typedef ; parsing | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : C-STRUCT: | 
					
						
							| 
									
										
										
										
											2008-12-02 01:24:00 -05:00
										 |  |  |     scan in get parse-definition define-struct ; parsing | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : C-UNION: | 
					
						
							| 
									
										
										
										
											2008-12-02 01:24:00 -05:00
										 |  |  |     scan parse-definition define-union ; parsing | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : C-ENUM: | 
					
						
							|  |  |  |     ";" parse-tokens | 
					
						
							| 
									
										
										
										
											2009-01-21 20:55:33 -05:00
										 |  |  |     [ [ create-in ] dip define-constant ] each-index ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     parsing | 
					
						
							| 
									
										
										
										
											2008-12-11 01:03:58 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-21 20:55:33 -05:00
										 |  |  | : address-of ( name library -- value )
 | 
					
						
							|  |  |  |     load-library dlsym [ "No such symbol" throw ] unless* ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-11 01:03:58 -05:00
										 |  |  | : &: | 
					
						
							| 
									
										
										
										
											2009-01-21 20:55:33 -05:00
										 |  |  |     scan "c-library" get '[ _ _ address-of ] over push-all ; parsing |