alien.data: remove deprecated malloc-object word

db4
Slava Pestov 2010-09-18 17:56:08 -07:00 committed by Slava Pestov
parent 8912253b5c
commit f9c9814e57
4 changed files with 3 additions and 20 deletions

View File

@ -15,8 +15,6 @@ HELP: <c-object>
{ $description "Creates a byte array suitable for holding a value with the given C type." } { $description "Creates a byte array suitable for holding a value with the given C type." }
{ $errors "Throws an " { $link no-c-type } " error if the type does not exist." } ; { $errors "Throws an " { $link no-c-type } " error if the type does not exist." } ;
{ <c-object> malloc-object } related-words
HELP: memory>byte-array HELP: memory>byte-array
{ $values { "alien" c-ptr } { "len" "a non-negative integer" } { "byte-array" byte-array } } { $values { "alien" c-ptr } { "len" "a non-negative integer" } { "byte-array" byte-array } }
{ $description "Reads " { $snippet "len" } " bytes starting from " { $snippet "base" } " and stores them in a new byte array." } ; { $description "Reads " { $snippet "len" } " bytes starting from " { $snippet "base" } " and stores them in a new byte array." } ;
@ -28,12 +26,6 @@ HELP: malloc-array
{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } { $warning "Don't forget to deallocate the memory with a call to " { $link free } "." }
{ $errors "Throws an error if the type does not exist, if the requested size is negative, if a direct specialized array class appropriate to the type is not loaded, or if memory allocation fails." } ; { $errors "Throws an error if the type does not exist, if the requested size is negative, if a direct specialized array class appropriate to the type is not loaded, or if memory allocation fails." } ;
HELP: malloc-object
{ $values { "type" "a C type" } { "alien" alien } }
{ $description "Allocates an unmanaged memory block large enough to hold a value of a C type." }
{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." }
{ $errors "Throws an error if the type does not exist or if memory allocation fails." } ;
HELP: malloc-byte-array HELP: malloc-byte-array
{ $values { "byte-array" byte-array } { "alien" alien } } { $values { "byte-array" byte-array } { "alien" alien } }
{ $description "Allocates an unmanaged memory block of the same size as the byte array, and copies the contents of the byte array there." } { $description "Allocates an unmanaged memory block of the same size as the byte array, and copies the contents of the byte array there." }
@ -92,7 +84,6 @@ ARTICLE: "malloc" "Manual memory management"
$nl $nl
"Allocating a C datum with a fixed address:" "Allocating a C datum with a fixed address:"
{ $subsections { $subsections
malloc-object
malloc-byte-array malloc-byte-array
} }
"The " { $vocab-link "libc" } " vocabulary defines several words which directly call C standard library memory management functions:" "The " { $vocab-link "libc" } " vocabulary defines several words which directly call C standard library memory management functions:"

View File

@ -53,12 +53,6 @@ M: pointer <c-direct-array>
: (c-object) ( type -- array ) : (c-object) ( type -- array )
heap-size (byte-array) ; inline heap-size (byte-array) ; inline
: malloc-object ( type -- alien )
1 swap heap-size calloc ; inline
: (malloc-object) ( type -- alien )
heap-size malloc ; inline
: malloc-byte-array ( byte-array -- alien ) : malloc-byte-array ( byte-array -- alien )
binary-object [ nip malloc dup ] 2keep memcpy ; binary-object [ nip malloc dup ] 2keep memcpy ;

View File

@ -46,7 +46,6 @@ $nl
{ $link heap-size } { $link heap-size }
{ $link <c-object> } { $link <c-object> }
{ $link <c-array> } { $link <c-array> }
{ $link malloc-object }
{ $link malloc-array } { $link malloc-array }
} }
"If your program looks up C types dynamically or from words which do not have a stack effect, you must enable this flag, because in these situations the C type lookup code is not folded away and the word properties must be consulted at runtime." } ; "If your program looks up C types dynamically or from words which do not have a stack effect, you must enable this flag, because in these situations the C type lookup code is not folded away and the word properties must be consulted at runtime." } ;

View File

@ -36,10 +36,9 @@ FUNCTION: HRESULT RevokeDragDrop ( HWND hWnd ) ;
FUNCTION: void ReleaseStgMedium ( LPSTGMEDIUM pmedium ) ; FUNCTION: void ReleaseStgMedium ( LPSTGMEDIUM pmedium ) ;
: com-query-interface ( interface iid -- interface' ) : com-query-interface ( interface iid -- interface' )
[ { void* }
void* malloc-object &free [ IUnknown::QueryInterface ole32-error ]
[ IUnknown::QueryInterface ole32-error ] keep *void* with-out-parameters ;
] with-destructors ;
: com-add-ref ( interface -- interface ) : com-add-ref ( interface -- interface )
[ IUnknown::AddRef drop ] keep ; inline [ IUnknown::AddRef drop ] keep ; inline