summaryrefslogtreecommitdiff
path: root/ldmicro/lib/linuxUI/linuxLD.cpp
blob: e43ed7026a698b46bf907db7512aca5d9aaa1bcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "linuxUI.h"
#include <iostream>

std::vector<HEAPRECORD> HeapRecords;

HANDLE HeapCreate(DWORD  flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
{
    HANDLE hHeap = NULL;
    HEAPRECORD hHeapRecord;
    hHeapRecord.dwMaximumSize = dwMaximumSize;
    // hHeap = malloc(dwInitialSize);

    if (hHeap == NULL)
        return NULL;
    
    hHeapRecord.dwSize = dwInitialSize;
    hHeapRecord.hHeap = hHeap;
    hHeapRecord.dwAllocatedSizeOffset = 0;
    hHeapRecord.HeapID = HeapRecords.size()+1;
    HeapRecords.push_back(hHeapRecord);

    return hHeap;
}

size_t max(size_t A, size_t B)
{
    if(A>B)
        return A;
    else
        return B;
}

LPVOID HeapAlloc(HANDLE hHeap, DWORD  dwFlags, SIZE_T dwBytes)
{
        LPVOID p = malloc(dwBytes);
        return p;
}

BOOL HeapFree(HANDLE hHeap, DWORD  dwFlags, LPVOID lpMem)
{
        free(lpMem);
        return TRUE;
}

void OutputDebugString(char* str)
{

}

double GetTickCount(void) 
{
  timespec now;
  if (clock_gettime(CLOCK_MONOTONIC, &now))
    return 0;
  return now.tv_sec * 1000.0 + now.tv_nsec / 1000000.0;

}