home *** CD-ROM | disk | FTP | other *** search
- /* «RM120»«PL99999»«TS4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76» */
- #include <stdio.h>
- #define EXTERN extern
- #include <typedef.h>
-
-
- void InitGraphic()
- {
- extern char *malloc();
- extern char *fgets();
-
- FILE *fd;
- char *inbuff[85];
- int fil, i;
-
- GotoXY(1,1);
- if (!HardwarePresent()) {
- ClearScreen();
- GotoXY(1,2);
- fprintf(stderr,
- "Fatal error: graphics hardware not found or not properly activated.\n");
- exit(1);
- }
- MessageGlb = TRUE;
- BrkGlb = FALSE;
- GrafModeGlb = FALSE;
-
- ErrorProc[0] = "InitGraphic";
- ErrorCode[0] = "ERROR.MSG missing";
-
- if (NULL == (fd = fopen("error.msg", "r"))) {
- ErrorProc[1] = "** UNKNOWN **";
- for (i = 2; i <= MaxProcsGlb; i++)
- ErrorProc[i] = ErrorProc[1];
- for (i = 1; i <= MaxErrsGlb; i++)
- ErrorCode[i] = ErrorProc[1];
- error(0,0);
- }
- else {
- for (i = 0; i < MaxProcsGlb; i++) {
- if (NULL == (fgets(inbuff, 80, fd))) {
- fprintf(stderr,
- "Premature EOF while reading procs from Error.msg\n");
- fclose(fd);
- exit(1);
- }
- else {
- if (NULL == (ErrorProc[i] = malloc(1 + strlen(inbuff)))) {
- fprintf(stderr,
- "Out of memory loading error.msg (proc)\n");
- fclose(fd);
- exit(1);
- }
- strcpy(ErrorProc[i], inbuff);
- }
- }
- for (i = 0; i < MaxErrsGlb; i++) {
- if (NULL == (fgets(inbuff, 80, fd))) {
- fprintf(stderr,
- "Premature EOF while reading errs from Error.msg\n");
- fclose(fd);
- exit(1);
- }
- else {
- if (NULL == (ErrorCode[i] = malloc(1 + strlen(inbuff)))) {
- fprintf(stderr,
- "Out of memory loading error.msg (errs)\n");
- fclose(fd);
- exit(1);
- }
- strcpy(ErrorCode[i], inbuff);
- }
- }
- fgets(inbuff, 80, fd);
- strcpy(PcGlb, inbuff);
- fclose(fd);
- }
-
- for (i = 1; i <= MaxWorldsGlb; i++)
- DefineWorld(i, (double)0, (double)0, (double)XScreenMaxGlb,
- (double)YMaxGlb);
- MaxWorldGlb = 1;
-
- for (i = 1; i <= MaxWindowsGlb; i++) {
- DefineWindow(i,0,0,XMaxGlb,YMaxGlb);
- Stack[i].W.size = 0;
- Stack[i].Contents = NULL;
- RemoveHeader(i);
- }
- MaxWindowGlb = 1;
-
- if (strlen(CharFile) > 0) {
- if (0 > (fil = open(CharFile, BREAD)))
- error(0, 1);
- else
- read(fil, CharSet, 285);
- close(fil);
- }
- BrkGlb = TRUE;
-
- if (RamScreenGlb) {
- if (AllocateRAMScreen()) {
- fprintf(stderr, "RAM Screen cannot be allocated.\n");
- RamScreenGlb = FALSE; /* RAM Screen not allocated */
- }
- else {
- SelectScreen(2);
- ClearScreen();
- }
- }
-
- SelectScreen(1);
- WindowNdxGlb = 1;
- SelectWorld(1);
- SelectWindow(1);
- SetColorWhite();
- SetClippingOn();
- SetAspect((double)AspectFactor);
- DirectModeGlb = FALSE;
- PieGlb = FALSE;
- SetMessageOn();
- SetHeaderOff();
- SetHeaderToTop();
- ErrCodeGlb = 0;
- SetLineStyle(0);
- VStepGlb = IVStepGlb;
- EnterGraphic();
- X1Glb = 0;
- X2Glb = 0;
- Y1Glb = 0;
- Y2Glb = 0;
- AxisGlb = FALSE;
- HatchGlb = FALSE;
- }
-
-