Reader1 *Reader_NewWithBuffer(byte const *buffer, size_t len) { Reader1 *rd = M_Calloc(sizeof(Reader1)); rd->size = len; rd->data = buffer; return rd; }
Rectf *Rectf_New(void) { Rectf *r = M_Calloc(sizeof *r); r->origin = Point2f_New(); r->size = Size2f_New(); return r; }
static KdTreeNode *KdTreeNode_NewWithUserData(KdTree *kdTree, const AABox *bounds, void *userData) { KdTreeNode *kdn = (KdTreeNode *) M_Calloc(sizeof *kdn); kdn->kdTree = kdTree; memcpy(&kdn->aaBox, bounds, sizeof(kdn->aaBox)); kdn->userData = userData; return kdn; }
/** * Create a new memory volume. The new volume is added to the list of * memory volumes. */ static memvolume_t *createVolume(size_t volumeSize) { memblock_t *block; memvolume_t *vol = M_Calloc(sizeof(memvolume_t)); lockZone(); // Append to the end of the volume list. if (volumeLast) volumeLast->next = vol; volumeLast = vol; vol->next = 0; if (!volumeRoot) volumeRoot = vol; // Allocate memory for the zone volume. vol->size = volumeSize; vol->zone = M_Malloc(vol->size); vol->allocatedBytes = 0; // Clear the start of the zone. memset(vol->zone, 0, sizeof(memzone_t) + sizeof(memblock_t)); vol->zone->size = vol->size; // Set the entire zone to one free block. vol->zone->blockList.next = vol->zone->blockList.prev = block = (memblock_t *) ((byte *) vol->zone + sizeof(memzone_t)); vol->zone->blockList.user = (void *) vol->zone; vol->zone->blockList.volume = vol; vol->zone->blockList.tag = PU_APPSTATIC; vol->zone->rover = vol->zone->staticRover = block; block->prev = block->next = &vol->zone->blockList; block->user = NULL; // free block block->seqFirst = block->seqLast = NULL; block->size = vol->zone->size - sizeof(memzone_t); unlockZone(); App_Log(DE2_LOG_MESSAGE, "Created a new %.1f MB memory volume.", vol->size / 1024.0 / 1024.0); Z_CheckHeap(); return vol; }
Reader1 *Reader_NewWithCallbacks(Reader_Callback_ReadInt8 readInt8, Reader_Callback_ReadInt16 readInt16, Reader_Callback_ReadInt32 readInt32, Reader_Callback_ReadFloat readFloat, Reader_Callback_ReadData readData) { Reader1 *rd = M_Calloc(sizeof(Reader1)); rd->useCustomFuncs = true; rd->func.readInt8 = readInt8; rd->func.readInt16 = readInt16; rd->func.readInt32 = readInt32; rd->func.readFloat = readFloat; rd->func.readData = readData; return rd; }
static void *stdCalloc(size_t n) { return M_Calloc(n); }
ddstring_t *Str_New(void) { ddstring_t *str = (ddstring_t *) M_Calloc(sizeof(ddstring_t)); Str_Init(str); return str; }
/** * Allocates a new command binding and gives it a unique identifier. */ static evbinding_t* B_AllocCommandBinding(void) { evbinding_t* eb = (evbinding_t *) M_Calloc(sizeof(evbinding_t)); eb->bid = B_NewIdentifier(); return eb; }
static void initDIKeyToDDKeyTlat(void) { if(keymap) return; // Already been here. keymap = M_Calloc(sizeof(byte) * NUMKKEYS); keymap[DIK_0] = '0'; keymap[DIK_1] = '1'; keymap[DIK_2] = '2'; keymap[DIK_3] = '3'; keymap[DIK_4] = '4'; keymap[DIK_5] = '5'; keymap[DIK_6] = '6'; keymap[DIK_7] = '7'; keymap[DIK_8] = '8'; keymap[DIK_9] = '9'; keymap[DIK_A] = 'a'; //keymap[DIK_ABNT_C1] = ; //keymap[DIK_ABNT_C2] = ; keymap[DIK_ADD] = DDKEY_ADD; keymap[DIK_APOSTROPHE] = '\''; //keymap[DIK_APPS] = ; //keymap[DIK_AT] = ; //keymap[DIK_AX] = ; keymap[DIK_B] = 'b'; keymap[DIK_BACK] = DDKEY_BACKSPACE; keymap[DIK_BACKSLASH] = DDKEY_BACKSLASH; keymap[DIK_C] = 'c'; //keymap[DIK_CALCULATOR] = ; keymap[DIK_CAPITAL] = DDKEY_CAPSLOCK; //keymap[DIK_COLON] = ; // On Japanese keyboard keymap[DIK_COMMA] = ','; //keymap[DIK_CONVERT] = ; keymap[DIK_D] = 'd'; keymap[DIK_DECIMAL] = DDKEY_DECIMAL; keymap[DIK_DELETE] = DDKEY_DEL; keymap[DIK_DIVIDE] = DDKEY_DIVIDE; keymap[DIK_DOWN] = DDKEY_DOWNARROW; keymap[DIK_E] = 'e'; keymap[DIK_END] = DDKEY_END; keymap[DIK_EQUALS] = DDKEY_EQUALS; keymap[DIK_ESCAPE] = DDKEY_ESCAPE; keymap[DIK_F] = 'f'; keymap[DIK_F1] = DDKEY_F1; keymap[DIK_F2] = DDKEY_F2; keymap[DIK_F3] = DDKEY_F3; keymap[DIK_F4] = DDKEY_F4; keymap[DIK_F5] = DDKEY_F5; keymap[DIK_F6] = DDKEY_F6; keymap[DIK_F7] = DDKEY_F7; keymap[DIK_F8] = DDKEY_F8; keymap[DIK_F9] = DDKEY_F9; keymap[DIK_F10] = DDKEY_F10; keymap[DIK_F11] = DDKEY_F11; keymap[DIK_F12] = DDKEY_F12; //keymap[DIK_F13] = ; //keymap[DIK_F14] = ; //keymap[DIK_F15] = ; keymap[DIK_SYSRQ] = DDKEY_PRINT; keymap[DIK_G] = 'g'; keymap[DIK_GRAVE] = '`'; keymap[DIK_H] = 'h'; keymap[DIK_HOME] = DDKEY_HOME; keymap[DIK_I] = 'i'; keymap[DIK_INSERT] = DDKEY_INS; keymap[DIK_J] = 'j'; keymap[DIK_K] = 'k'; //keymap[DIK_KANA] = ; //keymap[DIK_KANJI] = ; keymap[DIK_L] = 'l'; keymap[DIK_LBRACKET] = '['; keymap[DIK_LCONTROL] = DDKEY_LCTRL; keymap[DIK_LEFT] = DDKEY_LEFTARROW; keymap[DIK_LMENU] = DDKEY_LALT; // Left Alt keymap[DIK_LSHIFT] = DDKEY_LSHIFT; //keymap[DIK_LWIN] = ; // Left Windows logo key keymap[DIK_M] = 'm'; //keymap[DIK_MAIL] = ; //keymap[DIK_MEDIASELECT] = ; Media Select key, which displays a selection of supported media players on the system //keymap[DIK_MEDIASTOP] = ; keymap[DIK_MINUS] = '-'; // On main keyboard. keymap[DIK_MULTIPLY] = '*'; // Asterisk (*) on numeric keypad //keymap[DIK_MUTE] = ; //keymap[DIK_MYCOMPUTER] = ; keymap[DIK_N] = 'n'; keymap[DIK_NEXT] = DDKEY_PGDN; // Page down //keymap[DIK_NEXTTRACK] = ; //keymap[DIK_NOCONVERT] = ; // On Japanese keyboard keymap[DIK_NUMLOCK] = DDKEY_NUMLOCK; keymap[DIK_NUMPAD0] = DDKEY_NUMPAD0; keymap[DIK_NUMPAD1] = DDKEY_NUMPAD1; keymap[DIK_NUMPAD2] = DDKEY_NUMPAD2; keymap[DIK_NUMPAD3] = DDKEY_NUMPAD3; keymap[DIK_NUMPAD4] = DDKEY_NUMPAD4; keymap[DIK_NUMPAD5] = DDKEY_NUMPAD5; keymap[DIK_NUMPAD6] = DDKEY_NUMPAD6; keymap[DIK_NUMPAD7] = DDKEY_NUMPAD7; keymap[DIK_NUMPAD8] = DDKEY_NUMPAD8; keymap[DIK_NUMPAD9] = DDKEY_NUMPAD9; //keymap[DIK_NUMPADCOMMA] = ; // On numeric keypad of NEC PC-98 Japanese keyboard keymap[DIK_NUMPADENTER] = DDKEY_ENTER; //keymap[DIK_NUMPADEQUALS] = ; // On numeric keypad of NEC PC-98 Japanese keyboard keymap[DIK_O] = 'o'; //keymap[DIK_OEM_102] = ; // On British and German keyboards keymap[DIK_P] = 'p'; keymap[DIK_PAUSE] = DDKEY_PAUSE; keymap[DIK_PERIOD] = '.'; //keymap[DIK_PLAYPAUSE] = ; //keymap[DIK_POWER] = ; //keymap[DIK_PREVTRACK] = ; // Previous track; circumflex on Japanese keyboard keymap[DIK_PRIOR] = DDKEY_PGUP; // Page up keymap[DIK_Q] = 'q'; keymap[DIK_R] = 'r'; keymap[DIK_RBRACKET] = ']'; keymap[DIK_RCONTROL] = DDKEY_RCTRL; keymap[DIK_RETURN] = DDKEY_RETURN; // Return on main keyboard keymap[DIK_RIGHT] = DDKEY_RIGHTARROW; keymap[DIK_RMENU] = DDKEY_RALT; // Right alt keymap[DIK_RSHIFT] = DDKEY_RSHIFT; //keymap[DIK_RWIN] = ; // Right Windows logo key keymap[DIK_S] = 's'; keymap[DIK_SCROLL] = DDKEY_SCROLL; keymap[DIK_SEMICOLON] = ';'; keymap[DIK_SLASH] = '/'; //keymap[DIK_SLEEP] = ; keymap[DIK_SPACE] = ' '; //keymap[DIK_STOP] = ; // On NEC PC-98 Japanese keyboard keymap[DIK_SUBTRACT] = DDKEY_SUBTRACT; // On numeric keypad //keymap[DIK_SYSRQ] = ; keymap[DIK_T] = 't'; keymap[DIK_TAB] = DDKEY_TAB; keymap[DIK_U] = 'u'; //keymap[DIK_UNDERLINE] = ; // On NEC PC-98 Japanese keyboard //keymap[DIK_UNLABELED] = ; // On Japanese keyboard keymap[DIK_UP] = DDKEY_UPARROW; keymap[DIK_V] = 'v'; //keymap[DIK_VOLUMEDOWN] = ; //keymap[DIK_VOLUMEUP] = ; keymap[DIK_W] = 'w'; //keymap[DIK_WAKE] = ; //keymap[DIK_WEBBACK] = ; //keymap[DIK_WEBFAVORITES] = ; //keymap[DIK_WEBFORWARD] = ; //keymap[DIK_WEBHOME] = ; //keymap[DIK_WEBREFRESH] = ; //keymap[DIK_WEBSEARCH] = ; //keymap[DIK_WEBSTOP] = ; keymap[DIK_X] = 'x'; keymap[DIK_Y] = 'y'; // keymap[DIK_YEN] = ; keymap[DIK_Z] = 'z'; }