📄 xlc_codegen.c
字号:
*/dispose_decvec (decvec_ptr)DECVEC *decvec_ptr;{ /* Set all desired states in desired_st table */ cg_st.cgst_wpf = TRUE;/* Check for any state changes *//* If any changes update ps_st and issue PS command */if ((1 != cur_ps_st -> scale_factor.xval) || (1 != cur_ps_st -> scale_factor.yval) || (cg_st.cgst_orientation != cur_ps_st -> orientation) || (cg_st.cgst_sheet_len != cur_ps_st -> sheet_len) || (cg_st.cgst_origin.xval != cur_ps_st -> origin.xval) || (cg_st.cgst_origin.yval != cur_ps_st -> origin.yval) || (decvec_ptr -> dv_ap.xval != cur_ps_st -> curchar.ap.xval) || (decvec_ptr -> dv_ap.yval != cur_ps_st -> curchar.ap.yval) || (decvec_ptr -> thickness != cur_ps_st -> line_thickness) || (DECVECOPEN != cur_ps_st -> open)) { decvec_ptr -> dv_ap.yval = decvec_ptr -> dv_ap.yval + (0.5 * decvec_ptr -> thickness); decvec_ptr -> dvend.yval = decvec_ptr -> dvend.yval + (0.5 * decvec_ptr -> thickness); M$CLOSE_ALL(); M$CHECK_STATE_CHANGE_SCALE(1,1); M$CHECK_STATE_CHANGE_ORIENT(cg_st.cgst_orientation, cg_st.cgst_sheet_len); M$CHECK_STATE_CHANGE_ORIGIN(cg_st.cgst_origin.xval, cg_st.cgst_origin.yval); M$CHECK_STATE_CHANGE_AP(decvec_ptr -> dv_ap.xval,decvec_ptr -> dv_ap.yval); M$CHECK_STATE_CHANGE_THICK(decvec_ptr -> thickness); M$CHECK_STATE_CHANGE_OPEN(DECVECOPEN,0); }/* Output the object and *//* Update ps_st based on objects impact */oprintf (str_lineto, decvec_ptr -> dvend.xval, decvec_ptr -> dvend.yval); /* update_decvec here */cur_ps_st -> line_thickness = decvec_ptr -> thickness;M$UPDATE_AP_A(-1, -1);}/* * * dispose_sixel * */dispose_sixel ( ahp, avp, im_hor_grid, vert_grid, byte_cnt, sf_hor_grid, sf_byte_cnt, sixel_buff )UBYTE sixel_buff [];LONG ahp, avp;LONG byte_cnt, sf_byte_cnt;LONG im_hor_grid, sf_hor_grid, vert_grid;{ /* Set all desired states in desired_st table */ cg_st.cgst_wpf = TRUE;/* Check for any state changes *//* If any changes update ps_st and issue PS command *//* M$CHECK_STATE_CHANGE_ALL() */if ((1 != cur_ps_st -> scale_factor.xval) || (1 != cur_ps_st -> scale_factor.yval) || (cg_st.cgst_orientation != cur_ps_st -> orientation) || (cg_st.cgst_sheet_len != cur_ps_st -> sheet_len) || (ahp + cg_st.cgst_origin.xval != cur_ps_st -> origin.xval) || (avp + cg_st.cgst_origin.yval - SIXEL_BASELINE_OFFSET + vert_grid != cur_ps_st -> origin.yval) || (0 != cur_ps_st -> curchar.ap.xval) || (0 != cur_ps_st -> curchar.ap.yval) || (byte_cnt != cur_ps_st -> sixel_buf_size) || (SIXELOPEN != cur_ps_st -> open)) { M$CLOSE_ALL(); M$CHECK_STATE_CHANGE_SCALE(1,1); M$CHECK_STATE_CHANGE_ORIENT(cg_st.cgst_orientation, cg_st.cgst_sheet_len); M$CHECK_STATE_CHANGE_ORIGIN(ahp + cg_st.cgst_origin.xval,avp + cg_st.cgst_origin.yval - SIXEL_BASELINE_OFFSET + vert_grid); M$CHECK_STATE_CHANGE_AP(0,0); if ( cg_st.cgst_image_mode != trn$k_image_sixel_font ) M$CHECK_STATE_CHANGE_BUFF(byte_cnt); M$CHECK_STATE_CHANGE_OPEN(SIXELOPEN,0); }/* Output the object and *//* Update ps_st based on objects impact */ /* call output_sixel_ routine selected by pointer in init */ /* parameter list changed 3 June 1988 to support sixelfont */(*cg_st.cgst_output_sixel_ptr)( ahp, avp, im_hor_grid, sf_hor_grid, vert_grid, byte_cnt, sf_byte_cnt, sixel_buff );M$UPDATE_SIXEL(byte_cnt);}/* * * dispose_cache_font * */dispose_cache_font (boxnumber, left_half_is_empty, vax_font_table_entry)WORD boxnumber, left_half_is_empty, vax_font_table_entry;{ WORD i; desired_st.open = FONTOPEN; /* Check for any state changes; if any, update ps_st and issue * PS command */ M$CHECK_STATE_CHANGE_ALL() { M$CLOSE_ALL(); M$CHECK_STATE_CHANGE_OPEN(FONTOPEN,boxnumber); /* boxnumber is just a dummy value for this macro */ } /* Download the font into the "box" */ PS_VM_TRACE_MACRO("%d dm1\n",(cg_st.cgst_vm_size-cg_st.cgst_vm_available)); /* Send command to dump VM */ dll (boxnumber, left_half_is_empty, vax_font_table_entry); PS_VM_TRACE_MACRO("%d dm2\n",(cg_st.cgst_vm_size-cg_st.cgst_vm_available)); /* Send command to dump VM */ /* Now see if this is a true paired font */ if (vax_font_table[vax_font_table_entry] .opposite_entry > vax_font_table_entry) /* Then download the other half */ { PS_VM_TRACE_MACRO("%d dm1\n",(cg_st.cgst_vm_size-cg_st.cgst_vm_available)); /* Send command to dump VM */ dll (boxnumber, 0, vax_font_table[vax_font_table_entry] .opposite_entry); PS_VM_TRACE_MACRO("%d dm2\n",(cg_st.cgst_vm_size-cg_st.cgst_vm_available)); /* Send command to dump VM */ } M$SAVE(); /* Close DLL_LEVEL */ M$SAVE(); /* Close SPACED_LEVEL */ /* Wipe out spacing_font_table because all spaced fonts have been * wiped out of PS machine after downloading font. */ invalidate_spaced_font_cache (); /* Redefine all downloaded fonts including the newest one */ PS_VM_TRACE_MACRO("%d dm3\n",(cg_st.cgst_vm_size-cg_st.cgst_vm_available)); /* Send command to dump VM */ define_dll_fonts(); PS_VM_TRACE_MACRO("%d dm4\n",(cg_st.cgst_vm_size-cg_st.cgst_vm_available)); /* Send command to dump VM */ M$SAVE(); /* Close DEFINE_LEVEL */ cur_ps_st -> open = ALLCLOSED; ps_str (str_scale);}/* * * dispose_cache_spacing * */dispose_cache_spacing (spaced_boxnumber, unspaced_boxnumber, spacing)WORD spaced_boxnumber, unspaced_boxnumber, spacing;{ desired_st.open = SPACINGOPEN; /* Check for any state changes; if any, update ps_st and issue * PS command */ M$CHECK_STATE_CHANGE_ALL() { M$CLOSE_ALL(); M$CHECK_STATE_CHANGE_OPEN(SPACINGOPEN,spaced_boxnumber); /* spaced_boxnumber is just a dummy value for M$CHECK_STATE_CHANGE_OPEN */ } /* set spacing */ oprintf (str_spacing, spaced_boxnumber + SPACING_OFFSET, unspaced_boxnumber, spacing); M$SAVE(); /* Close SPACED_LEVEL */ /* Redefine all downloaded and spaced fonts including the newest one */ PS_VM_TRACE_MACRO("%d dm3\n",(cg_st.cgst_vm_size-cg_st.cgst_vm_available)); /* Send command to dump VM */ define_dll_fonts(); PS_VM_TRACE_MACRO("%d dm4\n",(cg_st.cgst_vm_size-cg_st.cgst_vm_available)); /* Send command to dump VM */ PS_VM_TRACE_MACRO("%d dm5\n",(cg_st.cgst_vm_size-cg_st.cgst_vm_available)); /* Send command to dump VM */ define_spaced_fonts(); PS_VM_TRACE_MACRO("%d dm6\n",(cg_st.cgst_vm_size-cg_st.cgst_vm_available)); /* Send command to dump VM */ M$SAVE(); /* Close DEFINE_LEVEL */ cur_ps_st -> open = ALLCLOSED; ps_str (str_scale);}/* * * dispose_add_font_to_cache * */dispose_add_font_to_cache (paired_font_number) {WORD boxnumber, left_half_is_empty, vax_font_table_entry;BYTE opposite_entry;LONG paired_virtual_memory_needs;opposite_entry = vax_font_table[paired_font_number] .opposite_entry;paired_virtual_memory_needs = vax_font_table [paired_font_number] .virtual_memory_needs;if (opposite_entry != UNUSED) paired_virtual_memory_needs += vax_font_table[opposite_entry] .virtual_memory_needs;/* Find out how much room in VM is left */ /* If garbage is contributing to a nearly full virtual memory... */ if (cg_st.cgst_vm_available - VIRTUAL_MEMORY_SAFETY_MARGIN - paired_virtual_memory_needs < 0) { /* then it is time to collect garbage */ dispose_cleanup (); } /* * Account for VM available in the printer and VM used * by all downloaded fonts for this font. */cg_st.cgst_vm_available -= paired_virtual_memory_needs; cg_st.cgst_vm_downloaded_used += paired_virtual_memory_needs;/* Find next available openning in the Font Cache */ boxnumber = 0; while ( (dll_font_table [boxnumber] .dll_active) && (boxnumber < DLL_FONT_TABLE_SIZE) ) boxnumber++; /* find next available slot */ /* Is Font Cache full? */ if (boxnumber == DLL_FONT_TABLE_SIZE) { /* Here if yes */ boxnumber = cg_st.cgst_next_element_for_swap ++; if (cg_st.cgst_next_element_for_swap == DLL_FONT_TABLE_SIZE) cg_st.cgst_next_element_for_swap = 0; dispose_delete_box_from_cache (boxnumber); } /* Set font Downloaded in dll_font_table */ dll_font_table [boxnumber] .dll_font = paired_font_number; dll_font_table [boxnumber] .dll_active = ACTIVE; /* Download the font into the "box" */ left_half_is_empty = (vax_font_table_mapping_index [paired_font_number] != MAP_LEFT) && (vax_font_table [paired_font_number].opposite_entry == UNUSED); dispose_cache_font (boxnumber + NUMBER_OF_FIXED_FONT_BOXES, left_half_is_empty, paired_font_number); return (boxnumber);/* Done with down loading the font */ }/* * * dispose_add_spacing_to_cache * */dispose_add_spacing_to_cache (paired_font_number, unspaced_boxnumber, spacing) WORD paired_font_number, unspaced_boxnumber, spacing;{WORD spaced_boxnumber=0;/* * Find out if there is enough VM for the spaced font. */if (cg_st.cgst_vm_available - VIRTUAL_MEMORY_SAFETY_MARGIN - SPACED_FONT_VM_NEEDS < 0) { /* Clean up spaced fonts */ wipe_spacing (); cg_st.cgst_vm_available += cg_st.cgst_vm_spaced_used; cg_st.cgst_vm_spaced_used = 0; /* If there still is not enough VM for the spaced font then * cleanup all VM. */ if (cg_st.cgst_vm_available - VIRTUAL_MEMORY_SAFETY_MARGIN - SPACED_FONT_VM_NEEDS < 0) { dispose_cleanup (); } } /* * Account for VM available in the printer and VM used * by all spaced fonts for this spaced font. */cg_st.cgst_vm_available -= SPACED_FONT_VM_NEEDS; cg_st.cgst_vm_spaced_used += SPACED_FONT_VM_NEEDS;/* Find next available openning in the Spacing Cache */ while ( (spacing_font_table [spaced_boxnumber] .space_active != INACTIVE) && (spaced_boxnumber < SPACING_FONT_TABLE_SIZE) ) spaced_boxnumber++; /* find next available slot */ /* Is Spacing Cache full? */ if (spaced_boxnumber == SPACING_FONT_TABLE_SIZE) { /* Here if yes */ wipe_spacing (); cg_st.cgst_vm_available += cg_st.cgst_vm_spaced_used; cg_st.cgst_vm_spaced_used = 0; spaced_boxnumber = 0; } /* Set font Downloaded in dll_font_table */ spacing_font_table [spaced_boxnumber] .space_font = vax_font_table_box_number[paired_font_number]; spacing_font_table [spaced_boxnumber] .spacing = spacing;spacing_font_table [spaced_boxnumber] .space_active = ACTIVE;dispose_cache_spacing (spaced_boxnumber, unspaced_boxnumber, spacing);return (spaced_boxnumber);}/* * * dispose_delete_box_from_cache * * There are no more entries available in the cache, the entry "box_number" * has been selected as the one to be thrown away. Find out what font(s) were * in that box, (There could be pairing), mark them as not loaded in vax_font_table *//* * WARNING !!! DANGER !!! CAREFUL !!! * * At this time, there is no pairing on the PS side * fonts are downloaded individually. * This code does not deal with potential pairing. * When doing pairing on the PS side, make sure to complete this code */ dispose_delete_box_from_cache (box_number)WORD box_number;{WORD spaced_box_number; /* Search loop index *//* * The dll_font_table[box].dll_font tells us what font is downloaded in this box * The vax_font_table[font].box_number tells us in what box a font is downloaded. * * If we are destroying "box", need to update the vax_font_table entry for the font in that box * * NOTE, more will be needded when doing font_pairing on the PS side. */ vax_font_table_box_number [dll_font_table[box_number].dll_font]= END_OF_DICTIONARY;/* * If there is a spaced copy of the box being deleted, invalidate spaced font table. * * Note, the following code only checks the box_number field, and does not check the active field. * This means that we de-activate inactive entries, seems cheaper than testing the active flag * */ for (spaced_box_number = 0; spaced_box_number < SPACING_FONT_TABLE_SIZE; spaced_box_number ++) { if (spacing_font_table[spaced_box_number].space_font == box_number) spacing_font_table[spaced_box_number].space_active = INACTIVE; } /* Mark the cache entry as inactive */ dll_font_table [box_number].dll_active = INACTIVE;}/* * * dispose_cleanup * */dispose_cleanup (){ cg_st.cgst_vm_available = cg_st.cgst_vm_size; cg_st.cgst_vm_downloaded_used = cg_st.cgst_vm_spaced_used = 0; wipe_all ();}/* * * wipe_all * */wipe_all (){ WORD i; M$CLOSE_ALL(); ps_str (str_next_line); while (stack_ptr > (SPACED_LEVEL - 1)) { M$RESTORE(); } invalidate_spaced_font_cache (); while (stack_ptr > (DLL_LEVEL - 1)) { M$RESTORE(); } /* Invalidate DLL font table */ cg_st.cgst_next_element_for_swap = 0; for (i = 0; i < DLL_FONT_TABLE_SIZE; i++) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -