alien.data: remove deprecated malloc-object word
parent
8912253b5c
commit
f9c9814e57
|
@ -15,8 +15,6 @@ HELP: <c-object>
|
|||
{ $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." } ;
|
||||
|
||||
{ <c-object> malloc-object } related-words
|
||||
|
||||
HELP: memory>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." } ;
|
||||
|
@ -28,12 +26,6 @@ HELP: malloc-array
|
|||
{ $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." } ;
|
||||
|
||||
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
|
||||
{ $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." }
|
||||
|
@ -92,7 +84,6 @@ ARTICLE: "malloc" "Manual memory management"
|
|||
$nl
|
||||
"Allocating a C datum with a fixed address:"
|
||||
{ $subsections
|
||||
malloc-object
|
||||
malloc-byte-array
|
||||
}
|
||||
"The " { $vocab-link "libc" } " vocabulary defines several words which directly call C standard library memory management functions:"
|
||||
|
|
|
@ -53,12 +53,6 @@ M: pointer <c-direct-array>
|
|||
: (c-object) ( type -- array )
|
||||
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 )
|
||||
binary-object [ nip malloc dup ] 2keep memcpy ;
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ $nl
|
|||
{ $link heap-size }
|
||||
{ $link <c-object> }
|
||||
{ $link <c-array> }
|
||||
{ $link malloc-object }
|
||||
{ $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." } ;
|
||||
|
|
|
@ -36,10 +36,9 @@ FUNCTION: HRESULT RevokeDragDrop ( HWND hWnd ) ;
|
|||
FUNCTION: void ReleaseStgMedium ( LPSTGMEDIUM pmedium ) ;
|
||||
|
||||
: com-query-interface ( interface iid -- interface' )
|
||||
[
|
||||
void* malloc-object &free
|
||||
[ IUnknown::QueryInterface ole32-error ] keep *void*
|
||||
] with-destructors ;
|
||||
{ void* }
|
||||
[ IUnknown::QueryInterface ole32-error ]
|
||||
with-out-parameters ;
|
||||
|
||||
: com-add-ref ( interface -- interface )
|
||||
[ IUnknown::AddRef drop ] keep ; inline
|
||||
|
|
Loading…
Reference in New Issue