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

📄 xlc_main.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 2 页
字号:
 */VOID process_eof(){	dispose_eof();	pdli_clean_up_host_memory ();}/*************************************************************************** * In order to print a given file, the Translator may be called multiple * times.  Once for each of the setup modules that may be used with the * file, and once for the file itself.  Each invocation of the Translator * is called a subjob.  The Translator state is kept static across subjobs. * The symbiont tells the Translator whether there are multiple subjobs for * a particular file through use of the reset_entry and reset_exit bits. * The normal file initializations are done at the beginning of the first * subjob and at the end of the last subjob.  The entire process is called * the file. ***************************************************************************//*----------*/trn$ansi_ps (getr, user_arg_g, putr, user_arg_p, itemlist)/*  * ANSI Translator entry point.  This routine consists of the main processing * loop of the Translator.  The main loop continues until an EOF  * for the subjob is received. */int     (*getr)();int	user_arg_g;int     (*putr)();int	user_arg_p;ITEM	*itemlist;{WORD	i;    /* Set default state.  Reset on entry and send preamble     * with the job.                           */    cg_st.reset_entry = TRUE;    cg_st.reset_exit = TRUE;    cg_st.print_prologue = TRUE;    cg_st.cgst_last_showpage = TRUE;    /* Initialize I/O		*/    iface_init (getr, user_arg_g, putr, user_arg_p);    /* Save the item list pointer */    cg_st.cgst_ilistptr = itemlist;			    /* Check the itemlist for the ANSI Special, resource loading, and     * emit prologue items to determine whether we are processing or have      * processed a setup module, whether a prologue should be sent with the     * job or whether just the prologue should be output.     */                                     while (cg_st.cgst_ilistptr->code != trn$_end_of_list)  {	switch (cg_st.cgst_ilistptr->code)  {	    case trn$_page_fragment:    		switch (cg_st.cgst_ilistptr->address) 		   {    		    case trn$k_multi_page:    			cg_st.cgst_last_showpage = TRUE;	break;    		    case trn$k_page_fragment:    			cg_st.cgst_last_showpage = FALSE;	break;    		   }		ITEM_TRACE_MACRO("(Got a page fragment item value of %d) print flush\n",cg_st.cgst_ilistptr->address);		break;	    case trn$_ansi_special:		/* Save address of ANSI special item.              */		item_special_ptr = (TRN$K_ANSI_SPECIAL *) cg_st.cgst_ilistptr -> address;		/* Check to see if this is a setup module.  If so, don't clean		 * up Postscript state at the end of a job.  If a setup module		 * has already come down don't reset Translator state at the		 * beginning of the job.		 */		if (item_special_ptr -> reset_entry)		    cg_st.reset_entry = TRUE;		else		    cg_st.reset_entry = FALSE;		ITEM_TRACE_MACRO(" (Got a reset entry item value of %d) print flush\n",item_special_ptr->reset_entry);		if (item_special_ptr -> reset_exit)		    cg_st.reset_exit = TRUE;		else 		    cg_st.reset_exit = FALSE;		ITEM_TRACE_MACRO("(Got a reset exit item value of %d) print flush\n",item_special_ptr->reset_exit);    		break;    	    case trn$_prologue_select:	    		    		if (cg_st.cgst_ilistptr ->address == trn$k_emit_prologue_only) {		ITEM_TRACE_MACRO("(Got a emit prologue only item value of %d) print flush\n",cg_st.cgst_ilistptr ->address);    		    /* Set output mode to seven bit gl.	*/		    cg_st.cgst_output_mode = trn$k_gl_only;    		    /* Output the prologue.	*/		    dispose_prologue (DECBIND_NULL); 		    /*		    * Flush any remaining data from the output buffer		    */			    ps_flush ();    		    /* Exit the Translator.   */		    return(SS$_NORMAL);    		   }	    case trn$_resource_table:    		/* Check the resource table for the version number of                 * the prologue that has been previously loaded into                 * the PS machine.  The resource table consists of a                 * number of entries.  A byte at the beginning of the                 * table specifies the number of entries in the table.    		 * Each entry contains:                 *                 *    1. Length field for resource type (1 byte)                 *    2. Resource type (max 32 bytes)                 *    3. Length of resource name (1 byte)                 *    4. Resource name (max 255 bytes)                 *    5. Length of resource version number (1 byte)                 *    6. Resource version number (max 32 bytes)                 */   		/* Save address of resource table.              */		resource_table_ptr = (BYTE *) cg_st.cgst_ilistptr -> address;    		/* Get the number of entries in the resource table */    		resource_table_entries = *resource_table_ptr++;		ITEM_TRACE_MACRO("(Got a resource table size of %d) print flush\n",resource_table_entries);    		/* Move pointer to resource type and put it                 * into a null terminated string.                  */    		resource_type_length = *resource_table_ptr++;		ITEM_TRACE_MACRO("(Got a resource type length %d) print flush\n",resource_type_length);    		for (i=0; i < resource_type_length; i++)                     {    		    resource_type [i] = *resource_table_ptr++;    		    }    		resource_type [i] = '\0';		ITEM_TRACE_MACRO("(Got a resource type: %s) print flush\n",resource_type);    		/* See if resource type is a prologue.  If so continue                 * through entry to check for resource name.  NOTE:                 * since strcmp returns a zero if there is a match,                 * the conditionals use the logical negation.                 */                if (!strcmp(resource_type, ansi_resource_type))     		   {		    /* Put resource name into a null terminated string. */		    resource_name_length = *resource_table_ptr++;		    ITEM_TRACE_MACRO("(Got a resource name length %d) print flush\n",resource_name_length);		    for (i=0; i < resource_name_length; i++) 			{			resource_name [i] = *resource_table_ptr++;			}		    resource_name [i] = '\0';		    /* See if resource name is for an ANSI prologue.  		     * If so get version number of prologue.		     */		    ITEM_TRACE_MACRO("(Got a resource name: %s) print flush\n",resource_name);		    if (!strcmp(resource_name, ansi_resource_name)) 		       {			/* Put resource version number into a null                          * terminated string.                          */			resource_vers_num_length = *resource_table_ptr++;			ITEM_TRACE_MACRO("(Got a resource version length %d) print flush\n",resource_vers_num_length);			for (i=0; i < resource_vers_num_length; i++) 			    {			    resource_vers_num [i] = *resource_table_ptr++;			    }			resource_vers_num [i] = '\0';			ITEM_TRACE_MACRO("(Got a resource version mumber: %s) print flush\n",resource_vers_num);    			/* Check to see if version number of the preloaded                         * prologue matches the version number of the                          * prologue associated with this version of the                         * Translator.  If they match, set a bit informing                         * xlc_codegen to not send a prologue down with                         * this job.                         */			if (!strcmp(resource_vers_num, ansi_resource_vers_num))     			    cg_st.print_prologue = FALSE;    			}    		   }    	   }	cg_st.cgst_ilistptr++;	}        /* Reset the item list pointer to again point to the top of the      * item list      */    cg_st.cgst_ilistptr = itemlist;			    /*********************************************************     *     * To fix the invalidrestore error with setup modules a     * "save" and "restore" is done around each subjob.  In     * addition the prologue must be sent with each subjob.     * The Translator must return to BAREUNIT at the end of     * subjob because device control libraries loaded between     * the first and second subjob create a state that causes     * an invalidrestore.  This is a temporary fix.  Eventually     * the Translator should only restore back to BAREUNIT on     * the final subjob.     *     * Code that was commented out below has been moved here.     * When the final complete fix is implememted the code     * will be deleted from here and returned to below.     *     *********************************************************/           ps_str ("save\n"); /* Output initial "save"	*/    /*     * Send down the prologue if it has not been previously     * loaded.     */    if (cg_st.print_prologue) 	{	dispose_prologue (DECBIND);	}    /*     * Initialize the Translator and PS machine, and internal Translator     * PS state for the file.  Send the prologue down if neccessary.     */    if (cg_st.reset_entry)        {    	/* Initialize PS state for the entire file.	*/    	ps_init_file ();    	/* Read the itemlist for default values.	*/	scan_items(cg_st.cgst_ilistptr);    	/* Set input routine to ANSI			*/	cg_st.cpinit_vals.host_ptr = ansi_input;     	/* do powerup reset */	pdl_init(&cg_st.cpinit_vals);         }    /* Initialize this subjob.	*/    /* Set VM available in PS machine.		*/    cg_st.cgst_vm_available = cg_st.cgst_vm_size;    /* Initialize paper tray values.		*/    cg_st.cgst_paper_tray = TRAY_DEV_DEF;    ps_init_subjob ();    /*     * Reset the output paper tray.     */    process_tray_select(cg_st.cgst_paper_tray);/* * We are now ready to accept data.  Call the parser to read the data stream * and begin translation. */ 	cp_parse ();     /* Finish processing the subjob.	*/    cp_eof(cg_st.cgst_last_showpage);	    /* terminate parsing of file */					    /* if needed, reset ap */    dispose_end_of_subjob ();    /* Finish processing the file if neccessary. */    if  (cg_st.reset_exit)		    /* if needed, terminate parsing of job */	{		    	    cp_eoj();	    process_eof ();	}	    /*    * Flush any remaining data from the output buffer    */    ps_flush ();    /* Exit the Translator.   */    return(SS$_NORMAL);}	/*End of translator*/

⌨️ 快捷键说明

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