Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

ksystem.h File Reference

Systems funtions. More...

#include "ktypes.h"
#include "kmemory.h"

Defines

#define k_malloc(bytes)   k_malloc_info (bytes, __K_FILE__, __K_LINE__)
 Allocates a memory zone with file & line indications.
#define k_realloc(ptr, bytes)   k_realloc_info (ptr, bytes, __K_FILE__, __K_LINE__)
 Re-allocates a memory zone with file & line indications.
#define k_free(ptr)
 Frees a memory zone.
#define k_free_info(ptr, sFile, iLine)
 Frees a memory zone.
#define k_delete(ptr)
 Deletes a memory zone.

Functions

KTL_API KPtr k_malloc_info (KInt64 bytes, KString file, KInt32 line)
 Allocates a memory zone with file & line indications.
KTL_API KPtr k_realloc_info (KPtr ptr, KInt64 bytes, KString file, KInt32 line)
 Re-allocates a memory zone with file & line indications.
KTL_API void ktl_free (KPtr pPtr)
 Frees a memory zone.
KTL_API KPtr k_memcpy (KPtr dst, KCPtr src, KInt64 bytes)
 Copies the values from a memory zone to another one.
KTL_API KPtr k_memset (KPtr ptr, KInt value, KInt64 bytes)
 Sets bytes of a memory zone to a specified value.
KTL_API KPtr k_memmove (KPtr dst, KCPtr src, KInt64 bytes)
 Copies the values from a memory zone to another one.
KTL_API KInt64 k_bzero (KPtr ptr, KInt64 bytes)
 Sets all bytes of a memory zone to the value zero.
KTL_API void k_print_sizeof ()
 Writes to the standard output the size in bytes of all the main types.
KTL_API void k_pauseIfWin32 ()
 Pauses the main thread.


Detailed Description

Systems funtions.

Version:
KToolLib-1.0
Author:
Fabien Gallot
Date:
18/03/2009
Note:
Copyright © 2008-2010 iKlax Media SAS (www.iklaxmedia.com). All rights reserved.

Define Documentation

#define k_delete ptr   ) 
 

Value:

if (knull != ptr) { \ delete ptr; \ ptr = knull; \ }
Deletes a memory zone.

Sets the pointer to the memory zone to knull.

Parameters:
ptr the memory zone to be deleted

#define k_free ptr   ) 
 

Value:

if (ptr != knull) { \ if (k_del_memory_zone (ptr, __K_FILE__, __K_LINE__)) \ ktl_free (ptr); \ ptr = knull; \ }
Frees a memory zone.

If k_init_scan_memory is called before, the memory control must be used. Sets the pointer to the memory zone to knull.

Parameters:
ptr the memory zone to be freed

#define k_free_info ptr,
sFile,
iLine   ) 
 

Value:

if (ptr != knull) { \ if (k_del_memory_zone (ptr, sFile, iLine)) \ ktl_free (ptr); \ ptr = knull; \ }
Frees a memory zone.

If k_init_scan_memory is called before, the memory control must be used. Sets the pointer to the memory zone to knull.

Parameters:
ptr the memory zone to be freed
sFile the file name where this function is called
iLine the line number where this function is called

#define k_malloc bytes   )     k_malloc_info (bytes, __K_FILE__, __K_LINE__)
 

Allocates a memory zone with file & line indications.

If k_init_scan_memory is called before, the memory control must be used

Parameters:
bytes the size in byte of the structure to be allocated
Returns:
the allocated zone if successful otherwise knull

#define k_realloc ptr,
bytes   )     k_realloc_info (ptr, bytes, __K_FILE__, __K_LINE__)
 

Re-allocates a memory zone with file & line indications.

If k_init_scan_memory is called before, the memory control must be used. The k_bzero function must be called on the allocated zone

Parameters:
ptr the pointer to the memory zone to be re-allocated
bytes the new size in byte of the structure to re-allocated
Returns:
the re-allocated zone if successful otherwise knull


Function Documentation

KTL_API KInt64 k_bzero KPtr  ptr,
KInt64  bytes
 

Sets all bytes of a memory zone to the value zero.

Identical tp k_memset (ptr, 0, bytes);

Parameters:
ptr the pointer to the memory zone to fill
bytes the number of bytes to be set to the value zero
Returns:
the filled number of bytes if successful otherwise 0

KTL_API KPtr k_malloc_info KInt64  bytes,
KString  file,
KInt32  line
 

Allocates a memory zone with file & line indications.

Used with k_malloc macro. If k_init_scan_memory is called before, the memory control must be used

Parameters:
bytes the size in byte of the structure to be allocated
file the file name where this function is called
line the line number where this function is called
Returns:
the allocated zone if successful otherwise knull

KTL_API KPtr k_memcpy KPtr  dst,
KCPtr  src,
KInt64  bytes
 

Copies the values from a memory zone to another one.

Parameters:
dst the pointer to the destination memory zone where the content is to be copied
src the pointer to the content of data to be copied
bytes the number of bytes to copy
Returns:
the pointer dst is returned

KTL_API KPtr k_memmove KPtr  dst,
KCPtr  src,
KInt64  bytes
 

Copies the values from a memory zone to another one.

Identical to memmove of stdlib

Parameters:
dst the pointer to the destination memory zone where the content is to be copied
src the pointer to the content of data to be copied
bytes the number of bytes to copy
Returns:
the pointer dst is returned

KTL_API KPtr k_memset KPtr  ptr,
KInt  value,
KInt64  bytes
 

Sets bytes of a memory zone to a specified value.

Parameters:
ptr the pointer to the memory zone to fill
value the value to be set
bytes the number of bytes to be set to the value
Returns:
the pointer to the memory zone

KTL_API void k_pauseIfWin32  ) 
 

Pauses the main thread.

This functions has an effect only on Win32 systems, and does nothing on others platforms

KTL_API KPtr k_realloc_info KPtr  ptr,
KInt64  bytes,
KString  file,
KInt32  line
 

Re-allocates a memory zone with file & line indications.

Used with k_realloc macro. If k_init_scan_memory is called before, the memory control must be used. The k_bzero function must be called on the allocated zone

Parameters:
ptr the pointer to the memory zone to be re-allocated
bytes the new size in byte of the structure to re-allocated
file the file name where this function is called
line the line number where this function is called
Returns:
the re-allocated zone if successful otherwise knull

KTL_API void ktl_free KPtr  pPtr  ) 
 

Frees a memory zone.

If k_init_scan_memory is called before, the memory control must be used. Sets the pointer to the memory zone to knull.

Parameters:
pPtr the memory zone to be freed


Generated on Tue Mar 9 10:49:30 2010 for iKlax Tools Library (KToolLib) by doxygen 1.3.8