void cleanup() { if(MilApplication != 0) { if(MilImageX != 0) { MdigGrabWait(MilDigitizer, M_GRAB_END); for(int n = 0; n < nmilbuff; n++) { MbufFree(MilImage[n]); } MilImageX = MilImageY = 0; } /* Release defaults. */ MappFreeDefault(MilApplication, MilSystem, M_NULL, MilDigitizer, M_NULL); MilApplication = 0; } }
int MosMain(void) { MIL_ID MilApplication, /* Application identifier. */ MilSystem, /* System identifier. */ MilDisplay, /* Display identifier. */ MilImage; /* Image buffer identifier. */ /* Allocate a default MIL application, system, display and image. */ MappAllocDefault(M_SETUP, &MilApplication, &MilSystem, &MilDisplay, M_NULL, &MilImage); /* If no allocation errors. */ if (!MappGetError(M_GLOBAL, M_NULL)) { /* Perform graphic operations in the display image. */ MgraColor(M_DEFAULT, 0xF0); MgraFont(M_DEFAULT, M_FONT_DEFAULT_LARGE); MgraText(M_DEFAULT, MilImage, 160L, 230L, MIL_TEXT(" Welcome to MIL !!! ")); MgraColor(M_DEFAULT, 0xC0); MgraRect(M_DEFAULT, MilImage, 100L, 150L, 530L, 340L); MgraRect(M_DEFAULT, MilImage, 120L, 170L, 510L, 320L); MgraRect(M_DEFAULT, MilImage, 140L, 190L, 490L, 300L); /* Print a message. */ MosPrintf(MIL_TEXT("\nSYSTEM ALLOCATION:\n")); MosPrintf(MIL_TEXT("------------------\n\n")); MosPrintf(MIL_TEXT("System allocation successful.\n\n")); MosPrintf(MIL_TEXT(" \"Welcome to MIL !!!\"\n\n")); } else MosPrintf(MIL_TEXT("System allocation error !\n\n")); /* Wait for a key press. */ MosPrintf(MIL_TEXT("Press <Enter> to end.\n")); MosGetch(); /* Free defaults. */ MappFreeDefault(MilApplication, MilSystem, MilDisplay, M_NULL, MilImage); return 0; }