static int MakePS(int help) { char *token; int device; if (help) { p_stderr("gist: ps command syntax:\n ps psout\n"); p_stderr(" Opens a PostScript file psout for output.\n"); p_stderr(" Subsequent send commands will write to psout,\n"); p_stderr(" unless the send to list is modified (see send).\n"); return 0; } token= strtok(0, " \t\n"); if (!token) { p_stderr("gist: (SYNTAX) psout name missing in ps command\n"); return 0; } if (CheckEOL("ps")) return 0; device= FindDevice(); if (device>=8) return 0; CreatePS(device, token); return 0; }
int on_launch(int argc, char *argv[]) { int i, j; char *arg; nOut= 0; for (i=0 ; i<8 ; i++) { outNames[i]= 0; outEngines[i]= 0; outDraw[i]= outSend[i]= outLengths[i]= 0; } noDisplay= amBatch= x_only= 0; defaultDPI= 100; inName= 0; p_quitter(&on_quit); p_idler(&on_idle); p_stdinit(&on_stdin); g_stdout = p_stdout; for (i=1 ; i<argc ; i++) { arg= argv[i]; if (arg[0]=='-') { int fileType= -1; arg++; if (strcmp(arg, "cgm")==0) { fileType= 0; i++; if (i>=argc) return MessageAndExit("Missing file or display name"); arg= argv[i]; } else if (strcmp(arg, "ps")==0) { fileType= 1; i++; if (i>=argc) return MessageAndExit("Missing file or display name"); arg= argv[i]; } else if (strcmp(arg, "in")==0) { i++; if (i>=argc) return MessageAndExit("Missing file or display name"); if (inName) return HelpAndExit(); else inName= argv[i]; } else if (strcmp(arg, "display")==0 || strcmp(arg, "d")==0) { fileType= 2; i++; if (i>=argc) return MessageAndExit("Missing file or display name"); arg= argv[i]; } else if (strcmp(arg, "f")==0) { amBatch= 1; fileType= 1; arg= "*stdout*"; } else if (strcmp(arg, "nd")==0) noDisplay= 1; else if (strcmp(arg, "b")==0) amBatch= 1; else if (strcmp(arg, "nowarn")==0) no_warnings= 1; else if (strcmp(arg, "geometry")==0) { char *suffix; int w=0,h=0; i++; if (i>=argc) MessageAndExit("Missing geometry"); arg = argv[i]; w = (int)strtol(arg, &suffix, 10); if (suffix!=arg && *suffix=='x') { arg = suffix+1; h = (int)strtol(arg, &suffix, 10); } if (w < 10 || h < 10) MessageAndExit("Invalid geometry"); gx75width = gx100width = w; gx75height = gx100height = h; } else if (strcmp(arg, "75")==0) defaultDPI= 75; else if (strcmp(arg, "100")==0) defaultDPI= 100; else if (strcmp(arg, "gks")==0) { gx75width= gx75height= 600; /* 8x8 X window size */ gx100width= gx100height= 800; /* 8x8 X window size */ cgmScaleToFit= 1; /* 8x8 PostScript plotting area */ gtDoEscapes= 0; } else if (strcmp(arg, "x")==0) x_only= 1; else if (strcmp(arg, "gks")==0) { cgmScaleToFit= 1; gtDoEscapes= 0; } else if (strcmp(arg, "fmbug")==0) epsFMbug= 1; else if (strcmp(arg, "bg0fg1")==0) bg0fg1= 1; else if (strcmp(arg, "esc0")==0) gtDoEscapes= 0; else if (strcmp(arg, "esc1")==0) gtDoEscapes= 1; else return HelpAndExit(); if (fileType>=0) { if (nOut>=8) return MessageAndExit("At most 8 output files/displays allowed"); for (j=0 ; j<nOut ; j++) if (strcmp(outNames[j], arg)==0) return MessageAndExit("Duplicate output filenames not allowed"); outNames[nOut]= arg; outTypes[nOut]= fileType; nOut++; } } else if (arg[0]<='9' && arg[0]>='0') { if (GetPageGroup(arg)) return MessageAndExit("Try again"); } else if (!inName) { inName= arg; } else { return HelpAndExit(); } } if (inName && OpenCGM(inName)) inName= 0; if (amBatch) { if (!inName) return MessageAndExit("Must specify an input CGM file to use -b or -f"); if (!nOut) return MessageAndExit("Must specify some output file to use -b"); noDisplay= 1; } /* Create CGM and PostScript engines */ for (i=0 ; i<nOut ; i++) { if (outTypes[i]==0) CreateCGM(i, outNames[i]); else if (outTypes[i]==1) CreatePS(i, outNames[i]); } /* If page list specified, do implied send command */ if (amBatch && nPageGroups<=0) { mPage[0]= 1; nPage[0]= 32767; sPage[0]= 1; nPageGroups= 1; } if (nPageGroups>0) { for (i=0 ; i<8 ; i++) { if (!outSend[i]) GpDeactivate(outEngines[i]); if (outSend[i] && !GpActivate(outEngines[i])) n_active_groups++; } } g_initializer(&argc, argv); return 0; }
MRESULT EXPENTRY fnwpClient(HWND hwnd,USHORT msg,MPARAM mp1,MPARAM mp2) { POINTL ptl; HPS hps; RECTL rcl; ORIG Origin; BYTE bVkey; BYTE chKey; PSWP pswp; USHORT usCxMaxWnd; static ORIG OrigRestor; USHORT Command; CHAR szMessage[100]; CHAR szCaption[81]; ULONG cbDataSize; switch(msg) { case WM_CREATE: CreatePS(hwnd); if (bFalseStart) WinPostMsg(hwndClient,UM_FALSE_START,0,0); else WinPostMsg(hwndClient,UM_INITMENUS,0,0); break; case UM_FALSE_START: if (bConfigurationOnly > 1) MessageBox(HWND_DESKTOP,szFalseStart2); else MessageBox(HWND_DESKTOP,szFalseStart1); case WM_CLOSE: WinPostMsg(hwnd,WM_QUIT,0L,0L); break; case UM_INITMENUS: sprintf(pszPath,"~%s...",szConfigDDname); WinSendMsg(WinWindowFromID(stInst.hwndFrame,FID_MENU),MM_SETITEMTEXT,(MPARAM)IDM_CONFIG_DD,pszPath); if (strlen(szConfigAppName) != 0) { sprintf(pszPath,"~%s...",szConfigAppName); WinSendMsg(WinWindowFromID(stInst.hwndFrame,FID_MENU),MM_SETITEMTEXT,(MPARAM)IDM_CONFIG_APP,pszPath); PrfQueryProfileString(HINI_USERPROFILE,szConfigAppName,"Configuration",0L, stInst.paszStrings[CONFIGAPPLIBRARYSPEC], stInst.ulMaxPathLen); if (strlen(stInst.paszStrings[CONFIGAPPLIBRARYSPEC]) == 0) MenuItemEnable(stInst.hwndFrame,IDM_CONFIG_APP,FALSE); cbDataSize = sizeof(HOBJECT); if (!PrfQueryProfileData(hSourceProfile,szConfigAppName,"WPSobject",&stPageCFG.hObject,&cbDataSize)) stPageCFG.hObject = 0; } if (bConfigurationOnly) MenuItemEnable(stInst.hwndFrame,IDM_SELECT,FALSE); if (!bUninstall) MenuItemEnable(stInst.hwndFrame,IDM_UNINSTALL,FALSE); if (!bPreviousInstallation) if (!bCOMiInstalled) MenuItemEnable(stInst.hwndFrame,IDM_SETUP,FALSE); // MenuItemEnable(stInst.hwndFrame,IDM_TRANSFER,FALSE); break; case WM_DESTROY: GpiDestroyPS(hpsPs); break; case WM_HELP: if (SHORT1FROMMP(mp2) & CMDSRC_PUSHBUTTON) { DisplayHelpPanel(SHORT1FROMMP(mp1)); return((MRESULT)FALSE); } break; case HM_QUERY_KEYS_HELP: return (MRESULT)HLPP_KEYS; case WM_ACTIVATE: if(SHORT1FROMMP(mp1)) { WinSetFocus(HWND_DESKTOP,stInst.hwndFrame); WinSendMsg(WinQueryHelpInstance(hwndClient),HM_SET_ACTIVE_WINDOW,0L,0L); } break; case WM_PAINT: ClientPaint(hwnd); break; case WM_COMMAND: InstallCommand(hwnd,SHORT1FROMMP(mp1)); break; default: return WinDefWindowProc(hwnd,msg,mp1,mp2); } return(FALSE); }