| 
									
										
										
										
											2008-10-18 22:14:51 -04:00
										 |  |  | ! Copyright (C) 2008 Doug Coleman. | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							|  |  |  | USING: alien alien.c-types alien.strings | 
					
						
							| 
									
										
										
										
											2008-11-14 21:18:16 -05:00
										 |  |  | combinators.short-circuit fry kernel layouts sequences | 
					
						
							| 
									
										
										
										
											2008-12-02 03:44:19 -05:00
										 |  |  | specialized-arrays.alien accessors ;
 | 
					
						
							| 
									
										
										
										
											2008-10-18 22:14:51 -04:00
										 |  |  | IN: unix.utilities | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : more? ( alien -- ? )
 | 
					
						
							|  |  |  |     { [ ] [ *void* ] } 1&& ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : advance ( void* -- void* )
 | 
					
						
							|  |  |  |     cell swap <displaced-alien> ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : alien>strings ( alien encoding -- strings )
 | 
					
						
							|  |  |  |     [ [ dup more? ] ] dip
 | 
					
						
							|  |  |  |     '[ [ advance ] [ *void* _ alien>string ] bi ] | 
					
						
							|  |  |  |     [ ] produce nip ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : strings>alien ( strings encoding -- alien )
 | 
					
						
							| 
									
										
										
										
											2008-12-02 03:44:19 -05:00
										 |  |  |     '[ _ malloc-string ] void*-array{ } map-as f suffix underlying>> ;
 |