📄 cacfff.c
字号:
#ifndef lintstatic char SccsId[] = " @(#)cacfff.c 4.1 LPS_ULT_TRN 7/2/90";#endif/* file: cacfff.c * * COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 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 * * 10-MAR-1988 14:24 mhw * Initial Version * * 24-MAY-1988 10:26 mhw * Add references to dll_font structure defined in capdl.def * * 31-MAY-1988 14:15 mhw * Add type_size_whole and type_size_fraction for the LN04 * Changed substitute_flag to MAX_CSET_SIZE if substitute error char, * MAX_CSET_SIZE+1 if not substitution, * and 0-(MAX_CSET_SIZE-1) if character substitution * * 22-AUG-1988 10:13 mhw * Add returns after abort macros such that analyze will not continue * after an error. This is the way the Translator use to work. * * 12-SEP-1988 09:35 mhw * Changed BYTE to UBYTE for ABORT_MACRO test 62 and 67 * * 15-SEP-1988 16:04 mhw * Added character replacement, then commented out until translator * side is ready for this. It will then need to be re-activated. * This addition adds Warnings (87) and (88) and Abort (89) * * Changed Abort (68) to Warning (68) as per CFFF meeting held on * 1/12/88 and described in the Parser Notes File, note 19.1 * * Removed Abort (65) since with character replacement, Bit 31 of * the character locator can be set - it is no longer an error. * * 14-OCT-1988 14:48 mwh * Added support for overline to dll_font. * * 3-NOV-1988 09:44 mhw * Added angle brackets to stdio for ultrix support * * 1-DEC-1988 10:46 mhw * If no space character exists in a 94 character set, the substitute * flag must be set to MAX_CSET_SIZE + 1, because we create a space for * it. It was set to MAX_CSET_SIZE and so the translator substituted * a blob. * * 14-APR-1989 21:43 araj * change inclde to .lib_hc, not .lib * * end edit_history * *----------------------------------------------------------- *//* *----------------------------------------------------------- * * begin description * * Filename: cacfff.c * * * This module includes * * stars_and_dots() * substitute_blob_for_char() * analyze_font_file() * * end description * *----------------------------------------------------------- *//* file: xlc_analyze.c -- analyze the DCS buffer, which contains a CFFF font. * edit: laf 6-JUN-1986 16:12:04 Added conditional compile of fprintf's. * nv 27-JUN-1986 18:15:23 Fixed dll_char_set_id so that font files * which claim to have a USER_PREFERENCE character set are * re-identified as DEC_SUPPLEMENTAL. * laf 27-JUN-1986 20:29:53 Changed length of all tables and arrays * from MAX_CSET_SIZE to MAX_CSET_SIZE+1 so that we can always * stuff the error char in the last slot of each table so that * Nick's font code can access it easily and it can be shipped * to the PS machine just like any other character. * gh 16-JUL-1986 09:06:04 Right bearing is calculated using 'numcols' * before numcols is set - moving setting of numcols before the * right bearing is calculated. * nv 18-JUL-1986 18:07:24 Add provisions to force space characters * under certain circumstances. * nv 22-JUL-1986 12:54:07 Disabled enunciation of font file errors. * * araj 1-AUG-1986 22:43:08 * Looking for initialization problems. * Included Copyright notice, that had been forgotten. * Added use of conditional compile, to make use * of ERROR macro easier. * * araj 4-AUG-1986 15:47:31 * added test in dump routine to ensure the * character does not overflow the dump area * * Moved MAXCOLS, MAXROWS, MAXBITMAP to XLATE.H * * araj 4-AUG-1986 18:56:10 * Added two additional chack variables, * number_of_bytes_in_bitamp, and * number_of_odd_words_in_bitmap to verify that * some of the files that were rejected were * rejected because the creator was counting * bytes, not rouded up words. * * Did not do anything with this yet, * just printing it in the analyze log file. * we can decide later whether to accept or * reject such files. * nv 12-AUG-1986 16:05:30 * Put conditional compilation stuff around VM monitoring print * statement. * Added 'include "dbug.h"' at the beginning of this module. * Part of error 68 was reunited with the rest of it and shuffled * around; sometime earlier additional code had been inserted * among the code for managing 'error 68' and this created a * nonsensical stretch of code. * * laf Added conditional compile of the code that reads the * following fields out of the CFFF, because nobody uses them * in the current translator: * dll_num_char_defs * dll_monospacing_flag * dll_font_horiz_prop * dll_horiz_prop_numerator * dll_horiz_prop_denominator * dll_below_baseline_dist * * gh 18-AUG-1986 14:34:54 Laurie left nested #ifdefs that did * not start in column 1 - fixed it. This goes on her record. * nv 20-AUG-1986 10:17:02 Standardized the left margins so that * this module agrees with xlc_cont.c. * Moved conditional compilation controls to dbug.h. * Changed conditional compilation controls from '#ifdef' to * '#if'. * Add printout of font file id along with error 68. * Moved definition of MAX_CSET_SIZE to xlate.h * Removed ERROR_CODE definition -- obsolete. * Made changes so that for glyphs with no bit-map (i.e., space) * dll_char [i] .bitmap_ptr = NULL_BITMAP; this necessary so the * software which removes redundant error characters to work. * nv 21-AUG-1986 10:25:41 removed .num_wds_in_bitmap from the * DLL_FONT_CHAR structure and associated software. This happened * to involve fixing as well as changing the determination of * width for the forced space capability. * Add printout of font file id along with error 56. * Streamlined calculation of 'number_of_odd_words_in_bitmaps'. * Fixed 'dump2' print statement of number of characters * replaced by blob references. * Fixed an index in the * nv 22-AUG-1986 10:08:18 Added comments. * nv 27-AUG-1986 15:33:11 Put the checking for complete character * set (the 'ZZZZ' problem) under the conditional compilation of * COMPLETE_ANALYSIS. * Added check that dll_last_character >= dll_first_character. * In an attempt to ensure that 'divide by zero' do not occur, * added checks that the following parameters are not zero: * dll_total_vertical_size, * dll_horiz_prop_numerator, * dll_horiz_prop_denominator; * Changed 'dll_average_char_width' to 'dll_space_width' in the * software for forcing space characters under certain * circumstances. * Changed the definition of dll_spacing from UBYTE to UWORD. * nv 28-AUG-1986 18:34:06 Included checks for consistent font * widths and character widths for monospaced fonts. * gh 1-SEP-1986 10:17:14 Changed the 32-bit arithmetic flag test & * the test for the four 'Z's in the char set ID to only output * a message in COMPLETE_ANALYSIS mode, since it has been * determined that these really aren't errors. Also, the setting * of dll_type_size has been changed to fetch UWORDS from WORDS, * and a test is done before the fetch to ensure there won't be * overflow from the caculation. If there will be, an ERROR(101) * is generated. * nv 3-SEP-1986 11:13:26 Moved 'number_of_odd_words_in_bitmaps' and * 'total_portrait_bytes' from local automatics within 'analyze' * to globals declared at the beginning of this module. * nv 5-SEP-1986 19:22:57 Defined the following literals and used * the first two to replace constants where we generate our home * made 'blob': * NUMBER_OF_BLOB_ROWS, * NUMBER_OF_BLOB_COLUMNS, * BLOB_BITMAP_SIZE. * Used BLOB_BITMAP_SIZE augment the total_portrait_bytes count * when the error character is not defined within a downloaded * font file and we have to use our own homemade 'blob'. * nv 8-SEP-1986 11:40:12 Fixed main for-loop, which analyzes the * individuals characters, to disregard direct, as well as * indirect, references to 'blobs. * nv 7-OCT-1986 13:04:58 Checked that neither 'dll_type_size' nor * 'dll_total_vertical_size' exceed 3 inches. * Define MAX_FONT_SIZE to be 216 (point). * Include a check that the dll_num_char_defs equals * (end_idx - start_idx + 1). * Removed definition of ERROR_MACRO. * Replaced each use of ERROR_MACRO with 'ABORT_MACRO' except for * old errors 52 and 56 which were replaced with 'WARNING_MACRO'. * Removed the comment delimiters which used to be around errors * 52 and 56. * Also, nearby errors 52 and 56, I found other code which put * information into the dump2.dcs file but which needed to be * couched in conditional compilation to prevent possible * attempted output when the dump file was not opened; I made * that code compiled conditionally according to 'WITHOUTPUT.' * Removed superfluous 'return' statements which followed * 'ABORT_MACRO'. * Changed code compiled conditionally with respect to * ERROR_REPORT to compiled never. * nv 22-OCT-1986 10:45:08 Over-write 'dll_average_char_width' with * 'dll_space_width'. * nv 31-OCT-1986 14:19:55 Considering the change, converted * ABORT_MACRO(71) to WARNING_MACRO(71) and placed it under * 'COMPLETE_ANALYSIS'. * nv 5-NOV-1986 12:48:03 Add provisions for a spacing code of '3' * (6.8 cpi). * * araj 15-APR-1987 19:34:56 Add printing of more data for * ABORT 68 and 73 * araj 1-JUL-1987 16:10:55 Add print statement for blob size * to help debug fonts * * mgb 21-JUL-1987 12:58:19 When calculating the number of bytes * in portrait, they (the creator of the fonts) forget to * include the blob and/or rounding. Made change to be * more accepting of the fonts and print them even if they are * wrong. Now we will accept fonts even if they forget to do * rounding and/or the blob. * * mgb 9-NOV-1987 15:13:46 * For the sake of the LN04, compute the landscape bytecount, as * well as the mixed byte count, and run the font tests again (no * need to print anything, just the log with the warning/aborts is * sufficient. * * To compute landscape byte count, I modified the code that * computes portrait byte count, but invert the role of x and y * (number_rows/number_columns). * * To compute mixed byte count, take the max of portrait and * landscape on each char, * * Whereve the code did the following: * * portrait_byte_count (character_i) = f (num_rows, numcols) * total_portrait_bytes += portrait_byte_count (character_i) * * * Was changed to do: * * portrait_byte_count (character_i) = f (num_rows, num_cols) * landscape_byte_count (character_i) = f (num_cols, num_rows) * total_portrait_bytes += portrait_byte_count (character_i) * total_landscape_bytes += landscape_byte_count (character_i) * total_mixed_bytes += MAX (total_portrait_bytes, * total_landscape_bytes) * * Then at the end, of analyze, a test was added to check the * computed values against the stored values, that we currently * do for portrait. * * mgb 16-NOV-1987 15:06:26 * added the following code for mixed. * * dll_even_blob_bitmap_size_mixed = MAX (P_even, L_even); * dll_odd_blob_bitmap_size_mixed = MAX (P_odd, L_odd); * if (dll_even_blob_bitmap_size_mixed * != dll_odd_blob_bitmap_size_mixed) * number_of_odd_words_in_bm_mixed += 1; * * kws 14-JAN-1988 19:26:13 * Fixed bug in calculating mixed byte count. * * kws 14-JAN-1988 19:35:08 * Move where start_idx and end_idx are filled in. *//* begin include_file */#include "portab.h" /* portablity */#include "cpsys.hc" /* to get global def such as AL */#include "camac.lib_hc" /* Get general Macros such as MAX and MIN */#include "caglobal.hc" /* defs for this file */#define cacfff (1)/* Debug Tools */#ifdef WITHOUTPUT#include <stdio.h>GLOBAL UBYTE dump_number[] = {"dump2@.dcs"};#endif#ifdef DEBUGextern dumpdcs (); /* This is declared in dum_codegen, only if DEBUG defined */#endif /*----------*/VOID stars_and_dots (numrows, numcols, bitmap_ptr, fout)WORD numrows, numcols;PUB bitmap_ptr;PUB fout; {#ifdef WITHOUTPUT WORD i, j, k; UBYTE curbyte, outbyte; UBYTE chardump [MAXROWS][MAXCOLS]; if (numrows > MAXROWS) { fprintf (fout, "\nMore rows than allowed for dump routine MAX: %d, Actual: % d\n", MAXROWS, numrows); return; } if (numcols > MAXCOLS) { fprintf (fout, "\nMore columns than allowed for dump routine MAX: %d, Actual: %d\n", MAXCOLS, numcols); return; } /* Init the array */ for (i=0; i<numrows; i++) for (j=0; j<numcols; j++) chardump [i][j] = ' '; for (i=0; i < numrows; i++) { for (j=0; j < (numcols + 7)/8; j++) { curbyte = *bitmap_ptr++; for (k=0; k < 8; k++) { outbyte = curbyte & 0x01; if (outbyte) { chardump [i][(j*8)+k] = '*'; } else { chardump [i][(j*8)+k] = '.'; } curbyte = curbyte >> 1; } } } /* Dump out the array now to the file specified */ fprintf (fout, "\f"); /* start bitmap on new page */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -