⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cagraph.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 2 页
字号:
#ifndef lintstatic char SccsId[] = "  @(#)cagraph.c	4.1   LPS_ULT_TRN   7/2/90";#endif/* file: cagraph.c * *	COPYRIGHT  (c)  DIGITAL  EQUIPMENT CORPORATION 1985, *      1986, 1987, 1988, 1989.  ALL RIGHTS RESERVED. * *	THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE *	USED AND COPIED ONLY IN ACCORDANCE  WITH THE TERMS OF *	SUCH  LICENSE  AND  WITH  THE  INCLUSION OF THE ABOVE *	COPYRIGHT  NOTICE.  THIS SOFTWARE OR ANY OTHER COPIES *	THEREOF   MAY  NOT  BE  PROVIDED  OR  OTHERWISE  MADE *	AVAILABLE  TO  ANY  OTHER  PERSON.  NO  TITLE  TO AND *	OWNERSHIP  OF  THE  SOFTWARE  IS  HEREBY TRANSFERRED. * *	THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE *	WITHOUT  NOTICE  AND SHOULD  NOT BE  CONSTRUED  AS A *	COMMITMENT  BY  DIGITAL EQUIPMENT CORPORATION. * *	DIGITAL  ASSUMES  NO RESPONSIBILITY  FOR THE  USE  OR *	RELIABILITY  OF ITS SOFTWARE ON EQUIPMENT THAT IS NOT *	SUPPLIED BY DIGITAL. * *//* *----------------------------------------------------------- * *  begin edit_history * *   2-FEB-1988 16:45 mhs *      Initial Entry of combination of cagraph and dugraph. * *  15-FEB-1988 10:56 mhw *      Add include of camac.lib for non-dump oprintf. * *  13-APR-1988 12:16 mhs *      Move state pointer set operations to new "ac_" *      routines in castate module. * *   1-JUN-1988 15:10 mhs/araj *	Add support for new get_sixel_macro routine, and fix *	numerous bugs with sixel initialisation. * *  29-JUN-1988 15:21 mhs *	Add ca_graphics_init routine so that graphics vars in *	xl_st can be initialised on powerup. * *   3-OCT-1988 13:15 mhw *	Added code to dec_gri to test for the maximum allowable repeat count. * *  21-NOV-1988 09:10 mhw *	Added call to empty_jfy_buf to dec_gr_enter routine because the *	justify buffer should be emptied when graphics mode is entered. *	 * *  18-DEC-1988 15:19 ejs *		Major changes to data structutes.  GLYPH has been modified *		to allow struct copies more easily.  The PS output is not *		changed (barring bugs of course). * *   4-APR-1989 10:37 ejs *		Added ca_zap_repeat.   Used to reset the repeat count if a *		command should follow the DEC_GRI instead of a sixel. * *  end edit_history * *----------------------------------------------------------- *//* *----------------------------------------------------------- * *   begin description * *   Filename:  cagraph.c * *   SIXELS TO HEX conversion program * *   This program will convert a sixel file into a hex file.   *   There will be no attempts to parse the ANSI command  *   sequence. In fact, only the sixel data after the q will  *   be dealt with in the program.  Aspect Ratio, Color and *   any other parameters will be ignored. * *   Only one  sixel row at a time will be dealt with and  *   then written to a file before going on to the next  *   sixel row. * *   This module includes the following routines: * *   ca_graphics_init() *   dec_gri() *   ca_zap_repeat *   dec_gra() *   dec_gci() *   dec_gcr() *   dec_gnl() *   dec_gr_sxl() * *   end description * *----------------------------------------------------------- *//* Translator edit history for this file * * REVISION HISTORY  * * Rev 0		10-FEB-86	Michael Blumenreich * Original	 * * Rev 0.1		25-MAR-86	Michael Blumenreich * Added transportability to storage buffers and variables  * * 15-JUL-1986 13:08:57 		laf * Added check for a repeat count of zero to "gr_repeat" (QAR 509) * 28-AUG-1986 21:09:18 		Araj * Removed "-1" in computation of Byte count in Exit_Graphic. * This "-1" caused us to loose the last sixel of the last line, if * the sixel byte count was "1" modulo 8, and there was no  * overprinting, or the overprinting was bigger than the  * overprinted area. * For instance ESC P q ~ ESC \ would not print * nor would    ESC P q !3~ $ !9~ ESC \, * in the first case byte count was 1, in the seconf the  * overprinting was 1 modulo 8, and larger than the overprinted  * area. * On the other end, ESC P q ~~ ESC \ would print * so would          ESC P q !17~ $ !9~ ESC \, * in the first case, byte count was 2 modulo 8, in the second,  * byte count was 1 modulo 8, so was old byte count, but old byte  * count was > than byte count (overprinting smaller than  * overprinted). * * 29-AUG-1986 13:30:26		nv * Changed the evaluation of v_g to be as follows: *	v_g = (6.0 * (hor_grid) * aspect_ratio.xval) / aspect_ratio.yval; * Changed the definition of 'hor_grid' and 'max_buff_size' from 'double' * to 'LONG'. * * 26-SEP-1986 20:14:31 	araj *				retyped Mikes changes for improved performance *				aspect ratio * 30-SEP-1986 10:15:07 	mgb *				added default setting to Hor. Grid when input *				parameter is greater than 9. * 2-OCT-1986 17:48:45 		mgb *				moved check_ap after defining v_g and h_g * * 8-OCT-1986 18:12:59 		araj *				Modified GR_CR to invalidate the  *				raster flag, and modified GR_AR *				to check the raster_flag in  *				conjunction with byte_cnt and *				old_byte_cnt, to ensure that *				no GR_NL, or Sixel, was received  *				before the AR command. *				Ensuring that no GR_NL had been  *				received did not match QA  *				requirements. * * 10-DEC-1986 11:41:35 	mgb *				Adding parameters to call to check_ap * * 29-APR-1987 10:58:21 	mgb *				Changed call to vpos_rel() to  *				vpos_rel_w_wrap() because vpos_rel() uses *				the wrong bottom limit. */#define cagraph (1)/*  begin include_file    */#include    "portab.h"	    /* general portability constants */#include    "cpsys.hc"	    /* general defs, typedefs, etc. */#include    "cpast.hc"	    /* ANSI State Table & Token Table Declarations */#include    "cpglobal.hc"   /* global defs for parser */#include    "caglobal.hc"   /* global defs for action routines */#include    "camac.lib_hc"  /* non-dump version of oprintf */#ifdef DUMP#include    "dumpu.hc"      /* Dump Utility                             */#include    "xlc_iface.hc"  /* defines for oprintf			*/#endif DUMP/*  end   include_file    *//* * Initialise the Graphics State */VOID ca_graphics_init()   {    xl_st.cur_sxl.sixel_code = 0;    xl_st.cur_sxl.sixel_color = 0;    xl_st.cur_sxl.sixel_repeat = 1;    xl_st.cur_sxl.sixel_ap.xval = 0;    xl_st.cur_sxl.sixel_ap.yval = 0;    xl_st.cur_sxl.sixel_size.xval = 200;    xl_st.cur_sxl.sixel_size.yval = 100;    xl_st.hor_grid = 200;    xl_st.aspect_ratio.xval = 200;    xl_st.aspect_ratio.yval = 100;   }/********************************************************************** * * This routine is called when  * *       <esc> P P1 ; P2 ; P3 ... q   * * has been parsed by the parser. The Aspect Ratio and Grid size will * be selected from P1 and P3. P1 will define the Aspect Ratio and Grid * size and if P3 is defined it will redefine the grid using the SSU. *  * All initialization will be done here. * *	Some Ratios cannot lead to integer # of pixels in both H and V *	so an approximation of the AR is now used to make sure we get  *	an exact Vertical grid *	For instance, parameter 2 is 20.x H 96 V, AR =4.5/1 * *	But rounding 20.x to 21 in H and using 4.5/1 gives us *	a non integer V * *	So we'll replace 4.5/1 by 96/21, so V will be exact  *	and H won't be too bad *	 **********************************************************************/VOID dec_gr_enter()   {#ifdef DUMP   {    oprintf("DECGRAPHICS \n");       pprint();   }#endif    /* First empty the justify buffer */    empty_jfy_buf();    /*     * Save current ahp to use as left margin on carriage return and to      * restore the original position when exiting graphics mode     */    gr_left_bound = MAX (xl_st.h_fmt_bound.min, xl_st.curchar.ap.xval);    /*     * Initialise the sixel active position using the most recent     * position from previous sixels or text processing - note that     * our x value must be our graphic left bound instead     */    xl_st.cur_sxl.sixel_ap.xval = gr_left_bound;    xl_st.cur_sxl.sixel_ap.yval = xl_st.curchar.ap.yval;    /*     * Compute the horizontal and vertical grids and the aspect ratio     */    if (cp_pbuf[0] > MAX_SXL_PARM)       {	cp_pbuf[0] = 0;	    /* if too large a value supplied, use default */       }    PDLI_GET_SIXEL_MACRO_GRID((WORD)cp_pbuf[0], &xl_st.aspect_ratio, 			      &xl_st.cur_sxl.sixel_size);    /*     * Check to see if the user is overwriting the P1 value with a P3     * value for the horizontal grid/etc.     */    if ( (cp_pcnt > 1) && (cp_pbuf[2] > 0) )       {	/* xl_st.cur_sxl_sixel.size.xval = P3 * SSU */	xl_st.cur_sxl.sixel_size.xval = cp_pbuf[2] * (LONG)xl_st.sizeunit;       }    /*     * Compute the final values for the horizontal and physical     * grids (note that the horizontal grid is just passed through

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -