MCPcopy Create free account
hub / github.com/SimHacker/micropolis / Tk_DefineBitmap

Function Tk_DefineBitmap

micropolis-activity/src/tk/tkbitmap.c:246–275  ·  view source on GitHub ↗
(interp, name, source, width, height)

Source from the content-addressed store, hash-verified

244 *
245 *----------------------------------------------------------------------
246 */
247
248int
249Tk_DefineBitmap(interp, name, source, width, height)
250 Tcl_Interp *interp; /* Interpreter to use for error reporting. */
251 Tk_Uid name; /* Name to use for bitmap. Must not already
252 * be defined as a bitmap. */
253 char *source; /* Address of bits for bitmap. */
254 unsigned int width; /* Width of bitmap. */
255 unsigned int height; /* Height of bitmap. */
256{
257 int new;
258 Tcl_HashEntry *predefHashPtr;
259 PredefBitmap *predefPtr;
260
261 if (!initialized) {
262 BitmapInit();
263 }
264
265 predefHashPtr = Tcl_CreateHashEntry(&predefTable, name, &new);
266 if (!new) {
267 Tcl_AppendResult(interp, "bitmap \"", name,
268 "\" is already defined", (char *) NULL);
269 return TCL_ERROR;
270 }
271 predefPtr = (PredefBitmap *) malloc(sizeof(PredefBitmap));
272 predefPtr->source = source;
273 predefPtr->width = width;
274 predefPtr->height = height;
275 Tcl_SetHashValue(predefHashPtr, predefPtr);
276 return TCL_OK;
277}
278

Callers 2

Tk_GetBitmapFromDataFunction · 0.85
BitmapInitFunction · 0.85

Calls 2

BitmapInitFunction · 0.85
Tcl_AppendResultFunction · 0.85

Tested by

no test coverage detected