Сделать домашней|Добавить в избранное
 
 
baltic_kurs » Материалы за Август 2010 года
Сортировать статьи по: дате | популярности | посещаемости | комментариям | алфавиту

C 15

Автор: hydrinlyRinny от 17-08-2010, 19:59
C 15 </div>
			<div class=

WELCOME

Автор: sorokasme от 4-08-2010, 12:18
WELCOME

We've decided what Haskell type to represent the C function with, what the result data will be represented by, and how its memory will be managed. We've chosen a representation for flags to the function, and worked out how to get C strings to and from code inspecting it. So let's write the complete function for compiling PCRE regular expressions from Haskell: -- file: ch17/PCRE-compile. Hs compile :: ByteString - [PCREOption] - Either String Regex compile str flags = unsafePerformIO $ useAsCString str $ pattern - do alloca $ errptr - do alloca $ erroffset - do pcre_ptr - c_pcre_compile pattern (combineOptions flags) errptr erroffset nullPtr if pcre_ptr == nullPtr then do err - peekCString =...