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

📄 xlc_codegen.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 5 页
字号:
#ifndef lintstatic char SccsId[] = "  @(#)xlc_codegen.c	4.1   LPS_ULT_TRN   7/2/90";#endif/* file:	xlc_codegen.c - Translator code generator routines * created:	laf     13-FEB-1986 14:22:08  * edit:	gh	18-MAR-1986 16:42:23 - major changes were glyph  *			passing to dispose_of_char, and PORTAB.H stuff *		mb	18-APR-1986 17:42:07 - major changes to entire  *			file, added new routines and modified existing  *			routine to meet the design spec. *		mb	23-APR-1986 13:41:07 - added init of ps states  *			for codegen *		gh	14-MAY-1986 12:38:13 Updating oprintf () to output *			8-bit chars as octal codes *		laf	25-JUN-1986 19:51:13 Added output of FontBBox and *			FontMatrix to output_font *		laf     26-JUN-1986 10:03:02 Took out dispose_font  *			routine and created xlc__dll.c module *		laf     2-JUL-1986 10:50:15 Re-created the routine  *			"dispose_font" in this module, and made it call *			"dll", which is the routine that lives in xlc_dll. *			This change was made to avoid conflicts with macros *			between the two modules in the future. * *		araj	 2-JUL-1986 14:47:34  *			added a print string to close the  *			translator dictionary upon EOF * *		araj	 3-Jul-1986 *			move the code that defines DLL fonts into  *			XLC_DLL, and replaced  it with a call to *			DEFINE_DLL_FONTS(); *		nv	 18-JUL-1986 15:29:03 Add provisions for dispose_font *			passing another parameter to dll. * *		araj	 26-JUL-1986 15:21:26  *			Renamed PS_STR to OLD_PS_STR *			Renamed TPS_STR to PS_STR * *		araj	 26-JUL-1986 15:42:14  *			renamed oprintf to old_oprintf *			renamed toprintf to oprintf *			changed open font to use old_oprintf *			as the string it outputs uses a %% to *			output a PS comment *		gh	 29-JUL-1986 14:36:11 Added the output of a <ff> *			char right after the preamble is output * *		araj	 30-JUL-1986 20:08:13  *			Redesigned and streamlined output sixel *		gh	 31-JUL-1986 14:28:18  *			Changed declaration of obuf_sum to UBYTE pointer * *		gh	 11-AUG-1986 13:30:55 *			Adding 'include dbug.h'.  Deleted M$OUTPUT_PREAMBLE *			from XLM_CODEGEN.H and placed code in ps_init with *			preprocessor condition around the outputting of err hand *		mgb	 20-AUG-1986 11:19:15 Adding sheet length to current *			ps state. *		nv	 3-SEP-1986 10:15:46 Added 'font_table_entry'  *			parameter to dispose_font. *		mgb	 4-SEP-1986 15:47:51 Added wipe_all and  *			dispose_replace_all to handle dll. *		nv	 5-SEP-1986 19:00:36 Removed boxnumber from *			'dispose_restore_all'. *		mgb	 16-SEP-1986 17:55:30 Take out support for *			octal representation of special char. *		mgb	 26-SEP-1986 18:13:25 move imagepic from preamble *			to string and added code to output it. *		nv	 7-OCT-1986 14:51:22 Added 'dispose_of_error' function. *			Added type_of_error_condition as external variable. *		mgb	 4-NOV-1986 13:43:37 Changed test in dispose of eof  *			from & to a && and set wpf to true in dispose of  *			sixels. *		mgb	 13-JAN-1987 15:21:13 added changes to make sixel *			output in hex or bin an option during convert time. *			Added code in output of the preamble to output the *			right PS code for selected options and made two *			subroutines to covert sixels, one to hex and the other *			to binary. The call to output sixel is now done  *			indirectly to one of these routines. * *		araj	 27-MAR-1987 13:06:15  *			Added support for two new output modes *			GL only, and true 7 bit *			We can now output in *				Full 8 bit binary *				7 bit C0/GL *				7 bit GL *				8 bit GL/GR only *			Note in current implementation, 7 bit C0/GL *			and 7 bit GL are the same. * *		araj	 27-MAR-1987 13:36:02  *			removed tps_char and old_ps_str that  *			were unused. * *		araj	 27-MAR-1987 21:34:10  *			added TRN$.H in list of include * *		araj	 30-MAR-1987 12:42:59  *			changed to use official names for gl_only *			gl_gr_only * *		araj	 3-APR-1987 23:55:10  *			modified dispose_of_error, to also  *			do a printf of the error message *			if withoutput is enebled * *		araj	 3-APR-1987 23:56:00  *			modified dispose of set paper tray to reset the VM counters *			when doing a wipe all. *			This was causing a miscount of the fonts, and the undue rejection *			of some, as the counter was not reset when the fonts were cleared,  *			but was incremented when they were restored. * *		mgb	 10-JUL-1987 20:10:51  *			Took print string of imagepic hex and bin and put them *			in the preamble. After printing preamble the string *			TRN$XLATE_DICT begin is printed becuse if in no  *			preamble mode it will be needed. * *		mgb	 14-JUL-1987 14:10:20  *			added switch to print/noprint preamble * *		mgb	 3-DEC-1987 13:56:51  *			Added test to dispose_eof() that will end the  *			file at bareunit +1 (entry level) for form opposed *			going back to base level. * *		mgb	 7-JAN-1988 16:22:43  *			took out all the oprintf and print string stuf and *			put them in xlc_iface. * *		kws	 24-MAY-1988 13:51:02  *			Increase ps_st from 6 elements to 8 to mask out *			PostScript context stack bug. * *		mgb	25-MAY-1988 13:51 *			renamed all symbols with font_table... to  *			vax_font_table... * *		mgb	25-MAY-1988 13:52 *			changed ps_font... to paired_font... * *	mgb	25-MAY-1988 13:52 *		Took out vm_wasted and vm_being_used * *	mgb	25-MAY-1988 13:52 *		Took out paired_font_table [] since it is no longer needed * *	mgb	25-MAY-1988 13:52 *		Took out vm_wasted and vm_being_used. Replaced them with *		vm_available * *	tep	26 May 1988 10:33 - added routine output_sixel_as_font() * *	mgb	 6-JUN-1988 14:23 - added spacing to font cache  *		( dispose_add_spacing_to_cache () ) * *	mgb	 6-JUN-1988 14:51 - added spacing level to PS machine * *	tep	15 June 1988 15:35 - finished changes to do sixelfont * *	kws	 29-JUL-1988 16:36:39 Change references to boxnumber in *		dispose_of_char, dispose_add_spacing_to_cache, & *		dispose_cache_spacing to spaced_boxnumber for spaced *		fonts and unspaced_boxnumber for fonts that do not *		need their spacing changed. *   *	ejs  	 1-SEP-1988 18:54 *		Modified references to cur_ps_st and vax_font_table.  Added *		call to font_init. * *	kws	 18-AUG-1988 12:54:06 Define decbind before outputting *		prologue. * *	kws	 19-AUG-1988 15:06:28 Output setpacking and setcachelimit *		in ps_init.  This was originally part of the prologue. * *	kws	 23-AUG-1988 14:59:47 Split ps_init () into ps_init_file (), *		dispose_prologue (), and ps_init_subjob (). * *	kws	 24-AUG-1988 17:31:11 Split dispose_eof into dispose_eof (), *		and dispose_end_of_subjob (). * *	kws	 6-SEP-1988 15:24:58 Keep track of VM used for downloaded *		and spaced fonts.  Recover VM for spaced fonts if needed. * *	kws	 23-SEP-1988 16:14:08 Create spaced fonts from built-in *		font dictionaries for built-in fonts and from the downloaded *		font for DLL fonts. * *	kws	 23-SEP-1988 17:48:58 Have dispose_tray_select save back *		to page level after outputting setpapertray operator. * *	araj	 9-NOV-1988 16:45 Add processing for default tray is process *		tray select * *	ejs	 8-DEC-1988 12:44 Modified the process_char to detect AP *		changes and take a shortcut. * *	ejs	 8-DEC-1988 22:51 algorithmic attributes are filtered when the *		glyph is received in process_char.  This will relieve the *		thrashing that currently occurs when an attribute is passed  *		that can not be processed (every character faults). * *		Also compressed the restore and the moveto in the shortcut. * *	araj	 8-DEC-1988 19:21   remove restore_all and copy_font, *		they have been unused for quite a while * *	araj	 8-DEC-1988 19:22   changed dispose_delete_font_from_cache *		to dispose_delete_box_from_cache, as the intent was *		to destroy a box, not a font, to destroy the box, *		we would find the font in it, then destroy the box containing *		the font. Now the code is straigh forward, given a box_number,  *		delete the box * *	araj	 8-DEC-1988 19:24   Changed wipe_all to call invalidate_space_cache *		instead of duplicating the code. Same with delete_box_from_cache * *	araj	 8-DEC-1988 19:25   Added a new function, dispose_delete_font, *		to be used by the font dictionary when it deletes a font, so the  *		entry in the cache can be re-used *	 *  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). * *	kws	 22-DEC-1988 18:14:39  *		Have a "save" and "restore" around each subjob.  This *		is a temporary fix for the invalidrestore errors  *		received when device control library modules are sent *		between the first and second subjobs. * *	araj	29-DEC-1988 14:56 *		Temporarily disabled the optimization in vchar that turns *		vchar_space of the peoper width into normal spaces. *		The proper width is that of the (possibly) respaced *	    PS font, not that of the original dlled font. * *	araj	26-JAN-1989 15:32 *	    Temporary patch to power up code, so that cache limit,  *	    sixel font and defpapertray get defined. *	    Although they are the only 3 issues at this time, *	    the whole scan item and init job/subjob will have to be *	    completely revisited. * *	cp	20-MAR-1989 *	    Changed NULLPTR to NULL.  Removed extraneous '&' operators. *	    Removed keyword 'extern' before variables 'paper_tray' and *	    'next_element_for_swap' for Ultrix port. * *	cp	24-MAR-1989 *	    Integrated Alain's changes.  Function process_tray_select() *	    replaces dispose_tray_select().  Variable cg_st.cgst_paper_tray *	    replaces paper_tray. * *	ejs 13-APR-1989 13:13 *	    Added exec_newsheet to dispose_end_of_subjob. * *	cp 14-APR-1989 21:38:35  *	    Changed ps_st.psst...tray to cur_ps_st->psst... * *	araj	20-APR-1989 20:38 *	    Ensured that we would not issue a scale command of 0, *	    even when we have very very thin pixels * *	cp	24-APR-1989 18:48 *	    Removed extraneous definition of NULLPTR. *//************************************************************************ *                                                                      * *      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.                                            * ************************************************************************/#include "portab.h"#include "capdl.hc"#include "xlate.h"#include "dbug.h"#include "trn$.hc"#include "xlc_font_dictionary.hc"#include "xlc_font_init.hc"#include "xlm_codegen.h" #include "xlc_codegen.hc" #include "xlc_graph.hc"#include "xlm_io.hc"#include "xlc_ps.hc"#include "xlc_iface.hc"#define SPACE (0x20)/************************************************************************//* * This module includes the following routines: * ------------------------------------------- * oprintf () * convert10 () * convert16 () *//************************************************************************//****************************************************************** * * PRIMARY ACTION ROUTINES, DISPOSE_XXX   *  *      ps_init_file ()  *      ps_init_subjob ()  *	dispose_prologue () *      dispose_showpage ()  *      dispose_condshowpg ()  *      dispose_eof ()   *	dispose_end_of_subjob () *      dispose_of_Char (glyph_ptr)   *      dispose_vchar (glyph_ptr)  *      dispose_decvec (decvec_ptr)  *      dispose_sixel (sixel_ptr)  *	dispose_font (boxnumber,left_half_is_empty) *      dispose_copy_font (destination_buffer,source_buffer)  *      process_tray_select () *  *******************************************************************//****************************************************************** *  * SECONDARY ACTION ROUTINES, DISPOSE_XXX   *  *      save () *      restore () *      check_state_change (object_type) *  *      set_font (font) *      set_spacing () *      set_open () *      set_ap () *      set_origin () *      set_orient () *      set_scale () *      set_buff_size () *      set_thickness () *  *      open_show () *      close_show () *      open_font (boxnumber) *** (TBD) ***  *      close_font () *** (TBD) ***   *      open_sixel () *      close_sixel () *      open_decvec () *      close_decvec () *      close_all () *  *      output_font (source_buffer,lr_half) *** (T.B.D.) ***  *      output_sixel_in_bin () *      output_sixel_in_hex () *      output_sixel_as_font () *      output_vchar (attrs,width,drawerase) *      output_showpage () *  *      update_ap_r (x) *      update_ap_a (x,y) *      update_showpage () *      update_sixel () *      update_buff_size () *      update_paired_fontdict () *** (TBD) ***   *  ******************************************************************//* * External variables referenced: *//****************************************************************** * The advent of setup modules have changed the concept of jobs * and files within the translator.  In the past, the translator * would be called once for each file in the job.  With V3 the * DPS symbiont will call the translator to process setup modules. * Therefore, the translator can be called multiple times to process * a single file based on the number of setup modules specified * on the command line.  Each invocation of the Translator for a * single file is called a *subjob*.  The Translator and PostScript * state must be held consistant across subjobs to ensure that the * file is printed properly.  The DPS symbiont tells the translator * to reset after the last of the subjobs (i.e. the file associated * with the setup modules).  Normal end of file processing is done  * after the subjobs are done. *******************************************************************//***************************************************************** * The old ps_init has been turned into three routines.  ps_init_file, * dispose_of_prologue, and ps_init_subjob.  ps_init_file () initializes * the state of the PostScript machine, Translator "PostScript state" * variables, and the internal dll and spacing font cache.  It is * called at the start of every file.  dispose_of_prologue () loads the * prologue into the PS machine in a three step process.  ps_init_subjob () * opens the Translator dictionary (TRN$XLATE_DICT) to be used with * each subjob.  It is called at the start of each subjob.  The calling * of these three routines is controlled in xlc_main.c *********************************************************************/ ps_init_file ()/****************************************************************** ******************************************************************/{WORD boxnumber;LONG sixel_index;/* * Initialize "postscript state" (ALL VARIABLES ARE STORED IN * UNITS OF "CENTIPOINTS", where a centipoint is 1/7200th of a inch.)  * ------------------------------------------------------------- */stack_ptr = BAREUNIT;	/* init stack pointer to bareunit */cur_ps_st = &ps_st[stack_ptr];cur_ps_st -> curchar.ap.xval = -1; /* Initialize PS pos to weird value so a moveto */cur_ps_st -> curchar.ap.yval = -1; /* will get generated before the 1st char output */cur_ps_st -> curchar.attr_data.attr_baseline_offset = -1; /* will get generated before the 1st char output */cur_ps_st -> origin.xval = cur_ps_st -> origin.yval = 0;	/* page origin */cur_ps_st -> scale_factor.xval = DEFAULT_SCALE_X;cur_ps_st -> scale_factor.yval = DEFAULT_SCALE_Y;/*    FONT font_dict;	*/cur_ps_st -> curchar.char_data.char_font = END_OF_DICTIONARY;cur_ps_st -> curchar.font_data.horizontal_spacing = -1;cur_ps_st -> orientation = ORIENT_PS;cur_ps_st -> sheet_len = 0;cur_ps_st -> line_thickness = desired_st.line_thickness 			    = DEFAULT_THICKNESS;cur_ps_st -> sixel_buf_size = 0;cur_ps_st -> open = ALLCLOSED;cur_ps_st -> psst_paper_tray = TRAY_DEV_DEF;cg_st.cgst_wpf = FALSE;for (sixel_index = 0; sixel_index <= BLK_SIZE; sixel_index++){    sixel_buffer [sixel_index] = 0;}

⌨️ 快捷键说明

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