*** attr.c.orig Fri Aug 25 00:50:35 2000 --- attr.c Fri Aug 25 00:50:35 2000 *************** *** 304,307 **** --- 304,308 ---- pStrSeg->des = canvasFontDes; pStrSeg->direction = canvasFontDirection; + pStrSeg->dontreencode = canvasFontDontReencode; pStrSeg->double_byte = canvasFontDoubleByte; pStrSeg->double_byte_mod_bytes = canvasFontDoubleByteModBytes; *** auxtext.c.orig Fri Aug 25 00:50:36 2000 --- auxtext.c Fri Aug 25 00:50:36 2000 *************** *** 1574,1577 **** --- 1574,1581 ---- writeFileFailed = TRUE; } + /* + * When the new file format (version 38) is implemented, make sure to + * save the DontReencode related information (dontreencode) in the file! + */ if (fprintf(FP, "'%s',%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,", *************** *** 1862,1865 **** --- 1866,1870 ---- pStrSeg->double_byte_vertical = canvasFontDoubleByteVertical; pStrSeg->direction = canvasFontDirection; + pStrSeg->dontreencode = canvasFontDontReencode; pStrSeg->underline_on = curUnderlineOn; *** color.c.orig Fri Aug 25 00:50:37 2000 --- color.c Fri Aug 25 00:50:37 2000 *************** *** 1729,1733 **** sprintf(left_str, TgLoadString(colorLayerOn[i] ? STID_TURN_COLOR_LAYER_NUM_OFF : ! STID_TURN_COLOR_LAYER_NUM_OFF), colorMenuItems[i], i); sprintf(right_str, TgLoadCachedString(CSTID_SET_COLOR_TO), --- 1729,1733 ---- sprintf(left_str, TgLoadString(colorLayerOn[i] ? STID_TURN_COLOR_LAYER_NUM_OFF : ! STID_TURN_COLOR_LAYER_NUM_ON), colorMenuItems[i], i); sprintf(right_str, TgLoadCachedString(CSTID_SET_COLOR_TO), *** drawing.c.orig Fri Aug 25 00:50:38 2000 --- drawing.c Fri Aug 25 00:50:38 2000 *************** *** 3183,3186 **** --- 3183,3195 ---- if (something_changed) { if (*gstWiringInfo.first_port_name != '\0') { + char signal_name[MAXSTRING]; + struct AttrRec *first_attr_ptr=FindAttrWithName( + gstWiringInfo.first_port_obj, "signal_name=", NULL); + + *signal_name = '\0'; + if (first_attr_ptr != NULL) { + UtilStrCpyN(signal_name, sizeof(signal_name), + first_attr_ptr->attr_value.s); + } if (gstWiringInfo.num_ports_to_connect == 99) { /* rename signal_name */ *************** *** 3188,3192 **** sprintf(gszMsgBox, TgLoadCachedString(CSTID_SET_SIGNAME_FOR_NAMED_PORT), ! gstWiringInfo.first_port_name); } else if (gstWiringInfo.num_ports_to_connect == 999) { /* clear signal_name */ --- 3197,3201 ---- sprintf(gszMsgBox, TgLoadCachedString(CSTID_SET_SIGNAME_FOR_NAMED_PORT), ! signal_name, gstWiringInfo.first_port_name); } else if (gstWiringInfo.num_ports_to_connect == 999) { /* clear signal_name */ *************** *** 3194,3198 **** sprintf(gszMsgBox, TgLoadCachedString(CSTID_CLEAR_SIGNAME_FOR_NAMED_PORT), ! gstWiringInfo.first_port_name); } else { sprintf(gszMsgBox, --- 3203,3207 ---- sprintf(gszMsgBox, TgLoadCachedString(CSTID_CLEAR_SIGNAME_FOR_NAMED_PORT), ! signal_name, gstWiringInfo.first_port_name); } else { sprintf(gszMsgBox, *************** *** 3362,3374 **** return TRUE; } else if (button_ev->button == Button2 && curChoice == DRAWTEXT && ! textCursorShown && (button_ev->state & ControlMask)) { ! if (!MouseInCurText(input)) { ! *pn_status = MainMenu(); ! return TRUE; ! } else { MoveEditText(input); *pn_status = INVALID; ! return TRUE; } } else if ((button_ev->button == Button2 && curChoice == NOTHING && (button_ev->state & ShiftMask)) || --- 3371,3383 ---- return TRUE; } else if (button_ev->button == Button2 && curChoice == DRAWTEXT && ! textCursorShown) { ! if (((button_ev->state & ControlMask) == ControlMask && ! MouseInCurText(input)) || MouseOnCurTextBoundary(input)) { MoveEditText(input); *pn_status = INVALID; ! } else { ! *pn_status = MainMenu(); } + return TRUE; } else if ((button_ev->button == Button2 && curChoice == NOTHING && (button_ev->state & ShiftMask)) || *** dup.c.orig Fri Aug 25 00:50:39 2000 --- dup.c Fri Aug 25 00:50:39 2000 *************** *** 572,583 **** strcpy(xbm_ptr->filename, XBmPtr->filename); strcpy(xbm_ptr->write_date, XBmPtr->write_date); ! xbm_ptr->num_epsf_lines = num_epsf_lines; ! xbm_ptr->epsflines = (char**)malloc(num_epsf_lines*sizeof(char*)); ! if (xbm_ptr->epsflines == NULL) FailAllocMessage(); ! for (i=0; i < num_epsf_lines; i++) { ! len = strlen(XBmPtr->epsflines[i]); ! xbm_ptr->epsflines[i] = (char*)malloc((len+1)*sizeof(char)); ! if (xbm_ptr->epsflines[i] == NULL) FailAllocMessage(); ! strcpy(xbm_ptr->epsflines[i], XBmPtr->epsflines[i]); } } --- 572,585 ---- strcpy(xbm_ptr->filename, XBmPtr->filename); strcpy(xbm_ptr->write_date, XBmPtr->write_date); ! if (num_epsf_lines > 0) { ! xbm_ptr->num_epsf_lines = num_epsf_lines; ! xbm_ptr->epsflines = (char**)malloc(num_epsf_lines*sizeof(char*)); ! if (xbm_ptr->epsflines == NULL) FailAllocMessage(); ! for (i=0; i < num_epsf_lines; i++) { ! len = strlen(XBmPtr->epsflines[i]); ! xbm_ptr->epsflines[i] = (char*)malloc((len+1)*sizeof(char)); ! if (xbm_ptr->epsflines[i] == NULL) FailAllocMessage(); ! strcpy(xbm_ptr->epsflines[i], XBmPtr->epsflines[i]); ! } } } *** file.c.orig Fri Aug 25 00:50:40 2000 --- file.c Fri Aug 25 00:50:40 2000 *************** *** 1157,1160 **** --- 1157,1162 ---- } } + SaveDontReencode(FP); + SavePSFontAliases(FP); } } *************** *** 3479,3482 **** --- 3481,3494 ---- *ObjPtr = NULL; return FreeBufAndReturn(line, ok); + } else if (strcmp(obj_name, "dont_reencode") == 0) { + int ok=ReadDontReencode(line); + + *ObjPtr = NULL; + return FreeBufAndReturn(line, ok); + } else if (strcmp(obj_name, "ps_font_aliases") == 0) { + int ok=ReadPSFontAliases(FP, line); + + *ObjPtr = NULL; + return FreeBufAndReturn(line, ok); } free(line); *************** *** 4596,4600 **** struct BBRec *page_bbox; { ! register struct ObjRec *obj_ptr; int ltx=0, lty=0, rbx=0, rby=0, rc=TRUE; double llx1=0, lly1=0, urx1=0, ury1=0; --- 4608,4612 ---- struct BBRec *page_bbox; { ! struct ObjRec *obj_ptr=NULL; int ltx=0, lty=0, rbx=0, rby=0, rc=TRUE; double llx1=0, lly1=0, urx1=0, ury1=0; *************** *** 5141,5144 **** --- 5153,5159 ---- static int numberFileInPrintOnePage=INVALID; + static char defXbmToTiffCmd[]="xbmtopbm %s | pnmtotiff -none > %s"; + static char defPsToPdfCmd[]="ps2pdf %s %s"; + void SetBopHook(buf) char *buf; *************** *** 5170,5175 **** } ! static char defXbmToTiffCmd[]="xbmtopbm %s | pnmtotiff -none > %s"; static void GenDumpInitDefaults() --- 5185,5217 ---- } ! int GetCmdUsingDefAndXDef(buf, buf_sz, def_cmd, option, verify_count) ! char *buf, *def_cmd, *option; ! int buf_sz, verify_count; ! { ! char *c_ptr=NULL; + UtilStrCpyN(buf, buf_sz, def_cmd); + if (!PRTGIF || cmdLineOpenDisplay) { + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,option)) != NULL) { + UtilStrCpyN(buf, buf_sz, c_ptr); + if (verify_count > 0) { + int count=0; + + for (c_ptr=strstr(buf,"%s"); c_ptr!=NULL; + c_ptr=strstr(++c_ptr,"%s")) { + count++; + } + if (count != verify_count) { + fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_STR), + TOOL_NAME, "PsToXbm", buf, def_cmd); + UtilStrCpyN(buf, buf_sz, def_cmd); + return FALSE; + } + } + } + } + return TRUE; + } + static void GenDumpInitDefaults() *************** *** 5267,5287 **** } } ! strcpy(psToPdfCmd, "ps2pdf %s %s"); ! if (!PRTGIF || cmdLineOpenDisplay) { ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "PsToPdf")) != NULL) { ! int count=0; ! ! strcpy(psToPdfCmd, c_ptr); ! for (c_ptr=strstr(psToPdfCmd,"%s"); c_ptr!=NULL; ! c_ptr=strstr(++c_ptr,"%s")) { ! count++; ! } ! if (count != 2) { ! sprintf(gszMsgBox, TgLoadString(STID_INVALID_XDEF_USE_ALT_STR), ! TOOL_NAME, "PsToPdf", psToPdfCmd, "ps2pdf %s %s"); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! strcpy(psToPdfCmd, "ps2pdf %s %s"); ! } ! } } strcpy(gszProducedBy, TgLoadCachedString(CSTID_PARANED_UNKNOWN)); --- 5309,5314 ---- } } ! if (!GetCmdUsingDefAndXDef(psToPdfCmd, sizeof(psToPdfCmd), defPsToPdfCmd, ! "PsToPdf", 2)) { } strcpy(gszProducedBy, TgLoadCachedString(CSTID_PARANED_UNKNOWN)); *************** *** 5899,5913 **** if ((whereToPrint != LATEX_FIG && whereToPrint != EPSI_FILE) || !minimalEPS) { if (fprintf(dumpFP, "%%%%EndProlog\n") == EOF) writeFileFailed = TRUE; if (NeedA4()) { ! if (fprintf(dumpFP, "%%%%BeginSetup\n") == EOF || ! fprintf(dumpFP, "%%%%PaperSize: a4\n") == EOF || fprintf(dumpFP, "%%%%BeginPaperSize: a4\n") == EOF || fprintf(dumpFP, "a4\n") == EOF || ! fprintf(dumpFP, "%%%%EndPaperSize\n") == EOF || ! fprintf(dumpFP, "%%%%EndSetup\n") == EOF) { writeFileFailed = TRUE; } } } } --- 5926,5959 ---- if ((whereToPrint != LATEX_FIG && whereToPrint != EPSI_FILE) || !minimalEPS) { + int need_a4=NeedA4(); + if (fprintf(dumpFP, "%%%%EndProlog\n") == EOF) writeFileFailed = TRUE; + if (need_a4 || (pageStyle == LANDSCAPE && whereToPrint == PDF_FILE)) { + if (fprintf(dumpFP, "%%%%BeginSetup\n") == EOF) { + writeFileFailed = TRUE; + } + } if (NeedA4()) { ! if (fprintf(dumpFP, "%%%%PaperSize: a4\n") == EOF || fprintf(dumpFP, "%%%%BeginPaperSize: a4\n") == EOF || fprintf(dumpFP, "a4\n") == EOF || ! fprintf(dumpFP, "%%%%EndPaperSize\n") == EOF) { writeFileFailed = TRUE; } } + if (pageStyle == LANDSCAPE && whereToPrint == PDF_FILE) { + double scale=((double)printMag)*((double)72)/((double)100.0); + double w=((double)onePageHeight)/((double)PIX_PER_INCH)*scale; + double h=((double)onePageWidth)/((double)PIX_PER_INCH)*scale; + + fprintf(dumpFP, "<< /PageSize [%1d %1d] ", round(w), round(h)); + fprintf(dumpFP, + "/ImagingBBox null /Orientation 3 >> setpagedevice\n"); + } + if (need_a4 || (pageStyle == LANDSCAPE && whereToPrint == PDF_FILE)) { + if (fprintf(dumpFP, "%%%%EndSetup\n") == EOF) { + writeFileFailed = TRUE; + } + } } } *************** *** 5977,5980 **** --- 6023,6027 ---- fprintf(dumpFP, "tgifdict begin\n"); fprintf(dumpFP, "/tgifsavedpage save def\n\n"); + fprintf(dumpFP, "1 %s\n", gPsCmd[PS_SETMITERLIMIT]); fprintf(dumpFP, "1 %s\n\n", gPsCmd[PS_SETLINEWIDTH]); *************** *** 6428,6432 **** break; case PDF_FILE: ! file_ext = PS_FILE_EXT; output_type = "PDF"; break; --- 6475,6479 ---- break; case PDF_FILE: ! file_ext = "p~f"; output_type = "PDF"; break; *************** *** 6518,6521 **** --- 6565,6569 ---- return FALSE; } + unlink(real_ps_file); } } *** font.c.orig Fri Aug 25 00:50:41 2000 --- font.c Fri Aug 25 00:50:42 2000 *************** *** 98,101 **** --- 98,102 ---- int canvasFontDes=0; int canvasFontDirection=0; + int canvasFontDontReencode=FALSE; int canvasFontDoubleByte=FALSE; int canvasFontDoubleByteModBytes=FALSE; *************** *** 589,593 **** } if (xfs == NULL) { ! if (allowFontFaceSubstitution && !IsFontDoubleByte(font_index)) { int default_info_index=InfoIndex(defaultCurFont,defaultCurStyle); char failed_font_name[MAXSTRING]; --- 590,597 ---- } if (xfs == NULL) { ! if (allowFontFaceSubstitution) { ! /* ! * Even for a double-byte font, substitute Courier font anyway! ! */ int default_info_index=InfoIndex(defaultCurFont,defaultCurStyle); char failed_font_name[MAXSTRING]; *************** *** 683,689 **** { int i=0; - KeyValInfo *pKeyValue=NULL; ! for (i=0; i < gnNumPSFontAliases; i++, pKeyValue++) { KeyValInfo *pKeyValue=(&gaPSFontAliases[i]); --- 687,692 ---- { int i=0; ! for (i=0; i < gnNumPSFontAliases; i++) { KeyValInfo *pKeyValue=(&gaPSFontAliases[i]); *************** *** 1196,1204 **** encodeCharFlags = NULL; } - if (gpszDontReencode != NULL) { - UtilFree(gpszDontReencode); - gpszDontReencode = NULL; - gnDontReencodeInitialized = FALSE; - } *cmdLineDontReencode = '\0'; } --- 1199,1202 ---- *************** *** 1222,1269 **** } ! static ! int DontReencodeInXDefOrCmdLine(pszFontName, nFontIndex, nFontStyle) ! char *pszFontName; ! int nFontIndex, nFontStyle; { char *c_ptr=NULL; ! if (!gnDontReencodeInitialized) { ! int nLen=0; ! char *pszDontReencode=NULL; ! char szDontReencode[MAXSTRING<<1]; ! *szDontReencode = '\0'; ! if (PRTGIF && !cmdLineOpenDisplay) { ! if (*cmdLineDontReencode != '\0') { ! UtilTrimBlanks(cmdLineDontReencode); ! UtilStrCpyN(szDontReencode, sizeof(szDontReencode), ! cmdLineDontReencode); ! pszDontReencode = szDontReencode; ! } ! } else { ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, ! "DontReencode")) != NULL) { ! UtilStrCpyN(szDontReencode, sizeof(szDontReencode), c_ptr); ! UtilTrimBlanks(szDontReencode); ! pszDontReencode = szDontReencode; ! } } ! if (pszDontReencode != NULL && *pszDontReencode != '\0') { ! char *c_ptr1=NULL; ! nLen = strlen(pszDontReencode)+1; ! gpszDontReencode = (char*)malloc(nLen+1); ! if (gpszDontReencode == NULL) FailAllocMessage(); ! for (c_ptr1=gpszDontReencode, c_ptr=strtok(pszDontReencode, ! " ,:;\t\n\r"); c_ptr != NULL; ! c_ptr=strtok(NULL, " ,:;\t\n\r")) { ! strcpy(c_ptr1, c_ptr); ! c_ptr1 += strlen(c_ptr)+1; } ! *c_ptr1 = '\0'; } ! gnDontReencodeInitialized = TRUE; } if (gpszDontReencode != NULL) { char szFontStr[MAXSTRING]; --- 1220,1378 ---- } ! void SaveDontReencode(FP) ! FILE *FP; { char *c_ptr=NULL; ! if (gpszDontReencode == NULL) return; ! if (fprintf(FP, "dont_reencode(\"") == EOF) { ! writeFileFailed = TRUE; ! } ! for (c_ptr=gpszDontReencode; *c_ptr != '\0'; c_ptr++) { ! if (fprintf(FP, "%s", c_ptr) == EOF) writeFileFailed = TRUE; ! c_ptr += strlen(c_ptr); ! if (c_ptr[1] != '\0') { ! if (fprintf(FP, ":") == EOF) writeFileFailed = TRUE; } ! } ! if (fprintf(FP, "\").\n") == EOF) writeFileFailed = TRUE; ! } ! int ReadDontReencode(buf) ! char *buf; ! { ! char *s=NULL, *c_ptr=NULL; ! ! if (!PRTGIF || cmdLineOpenDisplay) return TRUE; ! ! #ifndef _PRTGIF_USE_ISO_LATIN_1_ALWAYS ! s = FindChar((int)'(', buf); ! c_ptr = FindChar((int)'"', s); ! s = ReadString(c_ptr); ! *(--s) = '\0'; ! InitDontReencode(c_ptr); ! #endif /* ~_PRTGIF_USE_ISO_LATIN_1_ALWAYS */ ! ! return TRUE; ! } ! ! void SavePSFontAliases(FP) ! FILE *FP; ! { ! int i=0, count=0, total=0; ! ! if (gnNumPSFontAliases == 0 || gaPSFontAliases == NULL) return; ! ! for (i=0; i < gnNumPSFontAliases; i++) { ! KeyValInfo *pKeyValue=(&gaPSFontAliases[i]); ! ! if (pKeyValue == NULL || pKeyValue->key == NULL || ! pKeyValue->value == NULL) { ! continue; ! } ! count++; ! } ! if (count == 0) return; ! ! if (fprintf(FP, "ps_font_aliases([\n") == EOF) { ! writeFileFailed = TRUE; ! } ! for (i=0; i < gnNumPSFontAliases; i++) { ! KeyValInfo *pKeyValue=(&gaPSFontAliases[i]); ! ! if (pKeyValue == NULL || pKeyValue->key == NULL || ! pKeyValue->value == NULL) { ! continue; ! } ! total++; ! if (fprintf(FP, "\t\"%s=%s\"", pKeyValue->key, pKeyValue->value) == EOF) { ! writeFileFailed = TRUE; ! } ! if (total != count) { ! if (fprintf(FP, ",\n") == EOF) writeFileFailed = TRUE; ! } ! } ! /* ! * For the next file version, the '\t' below should be removed. ! */ ! if (fprintf(FP, "\n\t]).\n") == EOF) writeFileFailed = TRUE; ! } ! ! static ! void ProcessAPSFontAlias(fake_font_name, real_font_name) ! char *fake_font_name, *real_font_name; ! { ! if (gaPSFontAliases == NULL) { ! gaPSFontAliases = (KeyValInfo*)malloc(sizeof(KeyValInfo)); ! } else { ! gaPSFontAliases = (KeyValInfo*)realloc(gaPSFontAliases, ! (gnNumPSFontAliases+1)*sizeof(KeyValInfo)); ! } ! if (gaPSFontAliases == NULL) FailAllocMessage(); ! memset(&gaPSFontAliases[gnNumPSFontAliases], 0, sizeof(KeyValInfo)); ! ! gaPSFontAliases[gnNumPSFontAliases].key = ! UtilStrDup(fake_font_name); ! gaPSFontAliases[gnNumPSFontAliases].value = ! UtilStrDup(&real_font_name[1]); ! if (gaPSFontAliases[gnNumPSFontAliases].key == NULL || ! gaPSFontAliases[gnNumPSFontAliases].value == NULL) { ! FailAllocMessage(); ! } ! *real_font_name = '='; ! ! UtilTrimBlanks(gaPSFontAliases[gnNumPSFontAliases].key); ! UtilTrimBlanks(gaPSFontAliases[gnNumPSFontAliases].value); ! gnNumPSFontAliases++; ! } ! ! int ReadPSFontAliases(FP, buf) ! FILE *FP; ! char *buf; ! { ! char *line=NULL; ! int skip_processing=FALSE; ! ! if (!PRTGIF || cmdLineOpenDisplay) skip_processing = TRUE; ! if (gaPSFontAliases != NULL || gnNumPSFontAliases > 0) { ! skip_processing = TRUE; ! } ! while ((line=UtilGetALine(FP)) != NULL) { ! char *c_ptr=NULL, *fake_font_name=NULL, *real_font_name=NULL; ! char info[MAXSTRING]; ! ! scanLineNum++; ! if (*line == ']' || (line[0] == '\t' && line[1] == ']')) { ! free(line); ! break; ! } ! if (!skip_processing) { ! #ifndef _PRTGIF_USE_ISO_LATIN_1_ALWAYS ! c_ptr = FindChar((int)'"', line); ! c_ptr = ParseStr(c_ptr, (int)'"', info, sizeof(info)); ! fake_font_name = info; ! real_font_name = strchr(fake_font_name, '='); ! if (real_font_name == NULL || real_font_name[1] == '\0') { ! free(line); ! continue; } ! *real_font_name = '\0'; ! ProcessAPSFontAlias(fake_font_name, real_font_name); ! *real_font_name = '='; ! #endif /* ~_PRTGIF_USE_ISO_LATIN_1_ALWAYS */ } ! free(line); } + return TRUE; + } + + static + int DontReencodeInXDefOrCmdLine(pszFontName, nFontIndex, nFontStyle) + char *pszFontName; + int nFontIndex, nFontStyle; + { + char *c_ptr=NULL; + if (gpszDontReencode != NULL) { char szFontStr[MAXSTRING]; *************** *** 1578,1581 **** --- 1687,1750 ---- } + static + void CleanUpDontReencode() + { + if (gpszDontReencode != NULL) { + UtilFree(gpszDontReencode); + gpszDontReencode = NULL; + } + gnDontReencodeInitialized = FALSE; + } + + void InitDontReencode(buf) + char *buf; + { + char *c_ptr=NULL, *pszDontReencode=NULL, szDontReencode[MAXSTRING<<1]; + int nLen=0; + + if (buf == NULL && gnDontReencodeInitialized) return; + + if (buf == NULL) gnDontReencodeInitialized = TRUE; + + *szDontReencode = '\0'; + if (buf != NULL) { + if (gpszDontReencode != NULL) { + /* if it is already initialized, don't parse the content of buf */ + return; + } + UtilStrCpyN(szDontReencode, sizeof(szDontReencode), buf); + UtilTrimBlanks(szDontReencode); + pszDontReencode = szDontReencode; + } else if (PRTGIF && !cmdLineOpenDisplay) { + if (*cmdLineDontReencode != '\0') { + UtilTrimBlanks(cmdLineDontReencode); + UtilStrCpyN(szDontReencode, sizeof(szDontReencode), + cmdLineDontReencode); + pszDontReencode = szDontReencode; + } + } else { + if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, + "DontReencode")) != NULL) { + UtilStrCpyN(szDontReencode, sizeof(szDontReencode), c_ptr); + UtilTrimBlanks(szDontReencode); + pszDontReencode = szDontReencode; + } + } + if (pszDontReencode != NULL && *pszDontReencode != '\0') { + char *c_ptr1=NULL; + + nLen = strlen(pszDontReencode)+1; + gpszDontReencode = (char*)malloc(nLen+1); + if (gpszDontReencode == NULL) FailAllocMessage(); + for (c_ptr1=gpszDontReencode, c_ptr=strtok(pszDontReencode, + " ,:;\t\n\r"); c_ptr != NULL; + c_ptr=strtok(NULL, " ,:;\t\n\r")) { + strcpy(c_ptr1, c_ptr); + c_ptr1 += strlen(c_ptr)+1; + } + *c_ptr1 = '\0'; + } + } + void PrTgifInitBaseFonts() { *************** *** 1662,1671 **** } void DumpEightBitFontInfo(FP) FILE *FP; { ! int k, j; ! short *flag_ptr, flag; ! int font_index, style_index, font_count; font_count = ((PRTGIF && !cmdLineOpenDisplay) ? MAXFONTS+numFakedFonts : --- 1831,1875 ---- } + void DumpReEncodeVector(FP, vec_prefix, vec_suffix, flag_ptr) + FILE *FP; + char *vec_prefix, *vec_suffix; + short *flag_ptr; + { + int j=0; + + fprintf(FP, "%s%s%s [\n", + ((vec_prefix != NULL && *vec_prefix == '/') ? "" : "/"), + vec_prefix, vec_suffix); + for (j=0; j < 16; j++) { + short flag=0; + + if (flag_ptr != NULL) { + flag = *flag_ptr++; + } else { + /* dump the whole vector if flag_ptr is NULL */ + flag = 0xff; + } + if ((flag & 0xff) != 0) { + int k=0; + + for (k=0; k < 8; k++) { + if (flag & (1<max_bounds.descent; canvasFontDirection = canvasFontPtr->direction; + /* + * Need to fix this. + */ + canvasFontDontReencode = FALSE; + canvasFontDoubleByte = (canvasFontPtr->min_byte1 != 0 || canvasFontPtr->max_byte1 != 0); *************** *** 2060,2086 **** continue; } ! if (gaPSFontAliases == NULL) { ! gaPSFontAliases = (KeyValInfo*)malloc(sizeof(KeyValInfo)); ! } else { ! gaPSFontAliases = (KeyValInfo*)realloc(gaPSFontAliases, ! (gnNumPSFontAliases+1)*sizeof(KeyValInfo)); ! } ! if (gaPSFontAliases == NULL) FailAllocMessage(); ! memset(&gaPSFontAliases[gnNumPSFontAliases], 0, sizeof(KeyValInfo)); ! ! gaPSFontAliases[gnNumPSFontAliases].key = ! UtilStrDup(fake_font_name); ! gaPSFontAliases[gnNumPSFontAliases].value = ! UtilStrDup(&real_font_name[1]); ! if (gaPSFontAliases[gnNumPSFontAliases].key == NULL || ! gaPSFontAliases[gnNumPSFontAliases].value == NULL) { ! FailAllocMessage(); ! } *real_font_name = '='; - - UtilTrimBlanks(gaPSFontAliases[gnNumPSFontAliases].key); - UtilTrimBlanks(gaPSFontAliases[gnNumPSFontAliases].value); - gnNumPSFontAliases++; - } UtilFree(buf); --- 2259,2264 ---- continue; } ! ProcessAPSFontAlias(fake_font_name, real_font_name); *real_font_name = '='; } UtilFree(buf); *************** *** 2726,2729 **** --- 2904,2908 ---- hasAlternateDefaultFonts = TRUE; } + InitDontReencode(NULL); InitAdditionalFonts(); InitPSFontAliases(); *************** *** 4374,4377 **** --- 4553,4557 ---- struct FontSizeRec *fs_ptr, *next_fs; + CleanUpDontReencode(); if (vertFontBitmap != None) XFreePixmap(mainDisplay, vertFontBitmap); if (rotatedVertFontBitmap != None) { *** miniline.c.orig Fri Aug 25 00:50:43 2000 --- miniline.c Fri Aug 25 00:50:43 2000 *************** *** 540,543 **** --- 540,544 ---- pStrSeg->double_byte_vertical = canvasFontDoubleByteVertical; pStrSeg->direction = canvasFontDirection; + pStrSeg->dontreencode = canvasFontDontReencode; pStrSeg->underline_on = curUnderlineOn; pStrSeg->asc = canvasFontAsc; *************** *** 568,571 **** --- 569,573 ---- canvasFontDoubleByteVertical = pStrSeg->double_byte_vertical; canvasFontDirection = pStrSeg->direction; + canvasFontDontReencode = pStrSeg->dontreencode; canvasFontAsc = pStrSeg->asc; canvasFontDes = pStrSeg->des; *************** *** 4772,4775 **** --- 4774,4778 ---- { char buf[MAXSTRING], font_str[MAXSTRING], real_font_str[MAXSTRING]; + char *ps_findfont_cmd=gPsCmd[PS_FINDFONT]; float fSize=(float)0; *************** *** 4816,4820 **** --- 4819,4833 ---- if (NeedEncode(&font_str[1], font, style)) { + #ifdef _PRTGIF_USE_ISO_LATIN_1_ALWAYS + if (PRTGIF && !cmdLineOpenDisplay) { + if (preDumpSetup) PSUseReencode(NULL); + fprintf(FP, "%s %s-8 latin1.vec ", real_font_str, font_str); + ps_findfont_cmd = "TGFF8"; + } else { + fprintf(FP, "%s-8 ", font_str); + } + #else /* ~_PRTGIF_USE_ISO_LATIN_1_ALWAYS */ fprintf(FP, "%s-8 ", font_str); + #endif /* _PRTGIF_USE_ISO_LATIN_1_ALWAYS */ } else { fprintf(FP, "%s ", real_font_str); *************** *** 4825,4829 **** FormatFloat(&fSize, buf); ! fprintf(FP, "%s ", gPsCmd[PS_FINDFONT]); #ifndef _PS_USE_EUC_FONT if (double_byte) { --- 4838,4842 ---- FormatFloat(&fSize, buf); ! fprintf(FP, "%s ", ps_findfont_cmd); #ifndef _PS_USE_EUC_FONT if (double_byte) { *** ps.c.orig Fri Aug 25 00:50:44 2000 --- ps.c Fri Aug 25 00:50:44 2000 *************** *** 36,39 **** --- 36,40 ---- #include "tgifdefs.h" + #include "file.e" #include "msg.e" #include "ps.e" *************** *** 63,66 **** --- 64,68 ---- static int psUseMiniLines=FALSE; static int psUseReencode=FALSE; + static int psUseReencodeFF8=FALSE; #ifdef _PS_USE_EUC_FONT *************** *** 180,184 **** psDictCount += 2; } ! if (preDumpSetup && psUseReencode) { struct ReEncodeRec *p_reencode; --- 182,192 ---- psDictCount += 2; } ! #ifdef _PRTGIF_USE_ISO_LATIN_1_ALWAYS ! if (PRTGIF && !psUseReencodeFF8) { ! psUseReencodeFF8 = TRUE; ! psDictCount += 2; ! } ! #endif /* _PRTGIF_USE_ISO_LATIN_1_ALWAYS */ ! if (font_str != NULL && preDumpSetup && psUseReencode) { struct ReEncodeRec *p_reencode; *************** *** 370,373 **** --- 378,382 ---- psUseMiniLines = FALSE; psUseReencode = FALSE; + psUseReencodeFF8 = FALSE; psUseShortHand = FALSE; #ifdef _PS_USE_EUC_FONT *************** *** 809,812 **** --- 818,833 ---- }; + #ifdef _PRTGIF_USE_ISO_LATIN_1_ALWAYS + static char *psReEncodeFF8Macro[] = { + "/TGFF8", + " { FontDirectory 1 index known", + " { pop findfont exch pop }", + " { 1 index 4 1 roll tgifReEncodeSmall findfont } ifelse", + " } bind def", + "", + NULL + }; + #endif /* _PRTGIF_USE_ISO_LATIN_1_ALWAYS */ + static char *psShortHandMacro[] = { "/bd { bind def } bind def", *************** *** 993,996 **** --- 1014,1025 ---- } } + #ifdef _PRTGIF_USE_ISO_LATIN_1_ALWAYS + if (PRTGIF && psUseReencodeFF8) { + for (i=0; psReEncodeFF8Macro[i] != NULL; i++) { + fprintf(FP, "%s\n", psReEncodeFF8Macro[i]); + } + DumpReEncodeVector(FP, "latin1", ".vec", NULL); + } + #endif /* _PRTGIF_USE_ISO_LATIN_1_ALWAYS */ if (psUseReencode) { for (i=0; psReencodeMacro[i] != NULL; i++) { *** special.c.orig Fri Aug 25 00:50:45 2000 --- special.c Fri Aug 25 00:50:45 2000 *************** *** 816,820 **** } else { /* the port will become disconnected */ ! ccvi.change_to_connect_view = TRUE; } SetReplaceAttrValueCallback( --- 816,820 ---- } else { /* the port will become disconnected */ ! ccvi.change_to_connect_view = FALSE; } SetReplaceAttrValueCallback( *************** *** 1025,1029 **** } if (HasConnAndDisConnViewObjSubObjs(first_attr_ptr->owner, &ccvi)) { ! ccvi.change_to_connect_view = FALSE; SetReplaceAttrValueCallback( (ReplAttrValueCallback*)ChangeConnectionView, &ccvi); --- 1025,1035 ---- } if (HasConnAndDisConnViewObjSubObjs(first_attr_ptr->owner, &ccvi)) { ! if (*signal_name != '\0') { ! /* the port will become connected */ ! ccvi.change_to_connect_view = TRUE; ! } else { ! /* the port will become disconnected */ ! ccvi.change_to_connect_view = FALSE; ! } SetReplaceAttrValueCallback( (ReplAttrValueCallback*)ChangeConnectionView, &ccvi); *************** *** 1059,1063 **** } else if (input.type == ConfigureNotify) { Reconfigure(FALSE); ! } else if (input.type == ButtonPress) { if (input.xbutton.button == Button1) { if (drawPolyHighlightedNode != NULL) { --- 1065,1069 ---- } else if (input.type == ConfigureNotify) { Reconfigure(FALSE); ! } else if (input.xany.window == drawWindow && input.type == ButtonPress) { if (input.xbutton.button == Button1) { if (drawPolyHighlightedNode != NULL) { *************** *** 1074,1078 **** HandlePressForPortInDrawWindow(TRUE); } ! } else if (input.type == MotionNotify) { XEvent ev; --- 1080,1085 ---- HandlePressForPortInDrawWindow(TRUE); } ! } else if (input.xany.window == drawWindow && ! input.type == MotionNotify) { XEvent ev; *** strtbl.c.orig Fri Aug 25 00:50:46 2000 --- strtbl.c Fri Aug 25 00:50:46 2000 *************** *** 486,490 **** N_("End the wire at port '%s'... (press to abort)"), /* CSTID_SET_SIGNAME_FOR_NAMED_PORT */ ! N_("Set signal name for port '%s'..."), /* CSTID_CLK_ON_PORT_TO_RENAME_SIGNAME */ N_("Please click on a port to rename its signal name..."), --- 486,490 ---- N_("End the wire at port '%s'... (press to abort)"), /* CSTID_SET_SIGNAME_FOR_NAMED_PORT */ ! N_("Set signal name (currently '%s') for port '%s'..."), /* CSTID_CLK_ON_PORT_TO_RENAME_SIGNAME */ N_("Please click on a port to rename its signal name..."), *************** *** 494,498 **** N_("Port/pin name '%s...' too long. It is skipped in net-list generation."), /* CSTID_CLEAR_SIGNAME_FOR_NAMED_PORT */ ! N_("Clear signal name for port '%s'..."), NULL }; --- 494,498 ---- N_("Port/pin name '%s...' too long. It is skipped in net-list generation."), /* CSTID_CLEAR_SIGNAME_FOR_NAMED_PORT */ ! N_("Clear signal name (currently '%s') for port '%s'..."), NULL }; *************** *** 3526,3530 **** if (obj_under_mouse == NULL) { /* if obj_under_mouse is NULL, we are at the boundary of curTextObj */ ! SetMouseStatus(TgLoadCachedString(CSTID_START_AN_EDGE_FROM_A_PORT), TgLoadCachedString(CSTID_MOVE_EDIT_TEXT_BOX), TgLoadCachedString(CSTID_CONTEXT_MENU)); --- 3526,3530 ---- if (obj_under_mouse == NULL) { /* if obj_under_mouse is NULL, we are at the boundary of curTextObj */ ! SetMouseStatus(TgLoadCachedString(CSTID_MOVE_EDIT_TEXT_BOX), TgLoadCachedString(CSTID_MOVE_EDIT_TEXT_BOX), TgLoadCachedString(CSTID_CONTEXT_MENU)); *** text.c.orig Fri Aug 25 00:50:47 2000 --- text.c Fri Aug 25 00:50:47 2000 *************** *** 3813,3816 **** --- 3813,3821 ---- canvasFontDoubleByte = double_byte; canvasFontDirection = direction; + /* + * Need to fix this in the future. + */ + canvasFontDontReencode = FALSE; + canvasFontDoubleByteModBytes = db_mod_bytes; canvasFontDoubleByteVertical = db_vertical; *************** *** 3820,3823 **** --- 3825,3829 ---- canvasFontDoubleByteVertical = FALSE; canvasFontDirection = FontLeftToRight; + canvasFontDontReencode = FALSE; } } else { *************** *** 3844,3848 **** int w=0, asc=0, des=0, min_lbearing=0, max_rextra=0; int underline_on=0, direction=0; ! int double_byte=0, db_mod_bytes=0, db_vertical=0; int len=0, new_alloc=FALSE; char *s=NULL, *line=NULL, color_str[40], font_str[MAXSTRING], *psz=NULL; --- 3850,3854 ---- int w=0, asc=0, des=0, min_lbearing=0, max_rextra=0; int underline_on=0, direction=0; ! int double_byte=0, db_mod_bytes=0, db_vertical=0, dontreencode=FALSE; int len=0, new_alloc=FALSE; char *s=NULL, *line=NULL, color_str[40], font_str[MAXSTRING], *psz=NULL; *************** *** 3954,3957 **** --- 3960,3964 ---- db_vertical = canvasFontDoubleByteVertical; direction = canvasFontDirection; + dontreencode = canvasFontDontReencode; } pStrSeg->font = font; *************** *** 3969,3972 **** --- 3976,3980 ---- pStrSeg->double_byte_vertical = db_vertical; pStrSeg->direction = direction; + pStrSeg->dontreencode = dontreencode; *ppStrSeg = pStrSeg; *** tgif.c.orig Fri Aug 25 00:50:48 2000 --- tgif.c Fri Aug 25 00:50:48 2000 *************** *** 40,43 **** --- 40,44 ---- #include "exec.e" #include "file.e" + #include "font.e" #include "grid.e" #include "mainloop.e" *************** *** 335,338 **** --- 336,340 ---- } InitPaperSize(); + if (PRTGIF && !cmdLineOpenDisplay) InitDontReencode(NULL); if (argc <= 0) { if (cmdLineStdOut) { *** file.e.orig Fri Aug 25 00:50:49 2000 --- file.e Fri Aug 25 00:50:49 2000 *************** *** 197,200 **** --- 197,203 ---- extern void SetBopHook ARGS_DECL((char *)); extern void SetEopHook ARGS_DECL((char *)); + extern int GetCmdUsingDefAndXDef ARGS_DECL((char *buf, int buf_sz, + char *def_cmd, char *option, + int verify_count)); extern void SetOutputFileName ARGS_DECL((char *psz_file_return, char *psz_ext, int *pn_short_name, *** font.e.orig Fri Aug 25 00:50:49 2000 --- font.e Fri Aug 25 00:50:50 2000 *************** *** 40,43 **** --- 40,44 ---- extern int canvasFontDes; extern int canvasFontDirection; + extern int canvasFontDontReencode; extern int canvasFontDoubleByte; extern int canvasFontDoubleByteModBytes; *************** *** 154,157 **** --- 155,162 ---- extern int ValidCharCode ARGS_DECL((char *)); extern char * CharCodeTranslate ARGS_DECL((char *)); + extern void SaveDontReencode ARGS_DECL((FILE*)); + extern int ReadDontReencode ARGS_DECL((char*)); + extern void SavePSFontAliases ARGS_DECL((FILE*)); + extern int ReadPSFontAliases ARGS_DECL((FILE*, char*)); extern void PrepareMiniLines ARGS_DECL((MiniLinesInfo*)); extern void PrepareEightBitFontInfo ARGS_DECL((void)); *************** *** 162,165 **** --- 167,171 ---- extern int GetFontAndStyle ARGS_DECL((char *FontStr, int *pnFont, int *pnStyle, int MustFind)); + extern void InitDontReencode ARGS_DECL((char*)); extern void PrTgifInitBaseFonts ARGS_DECL((void)); extern int GetCurSzUnit ARGS_DECL((void)); *************** *** 167,171 **** extern void CurFontMsg ARGS_DECL((int nShowInMsgWindow, int nShowInStatusWindow, StrSegInfo*)); ! extern void DumpEightBitFontInfo ARGS_DECL((FILE *)); extern int GetCompatibleSize ARGS_DECL((int FontDPI, int FontSize)); --- 173,180 ---- extern void CurFontMsg ARGS_DECL((int nShowInMsgWindow, int nShowInStatusWindow, StrSegInfo*)); ! extern void DumpReEncodeVector ARGS_DECL((FILE*, char *vec_prefix, ! char *vec_suffix, ! short *flag_ptr)); ! extern void DumpEightBitFontInfo ARGS_DECL((FILE*)); extern int GetCompatibleSize ARGS_DECL((int FontDPI, int FontSize)); *** patchlvl.h.orig Fri Aug 25 00:50:50 2000 --- patchlvl.h Fri Aug 25 00:50:50 2000 *************** *** 35,39 **** #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 37 #endif /*_TGIF_PATCHLEVEL_H_*/ --- 35,39 ---- #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 38 #endif /*_TGIF_PATCHLEVEL_H_*/ *** types.h.orig Fri Aug 25 00:50:51 2000 --- types.h Fri Aug 25 00:50:51 2000 *************** *** 246,249 **** --- 246,253 ---- struct DynStrRec dyn_str; struct StrBlockRec * owner; + /* + * for file version 38! + */ + int dontreencode; } StrSegInfo; *** Makefile.noimake.orig Fri Aug 25 00:50:51 2000 --- Makefile.noimake Fri Aug 25 00:50:51 2000 *************** *** 100,103 **** --- 100,110 ---- -D_BACKGROUND_DONT_FORK -D_USE_XDRAWPOINT_TO_PUT_A_POINT + #-D_PRTGIF_USE_ISO_LATIN_1_ALWAYS + # Include the above line if you want to always use ISO 8859-1 character + # set for single-byte characters when running tgif with the -print + # commandline option. Please only use this if you are sure that you + # will *never* use other encodings. You can selectively turn off + # reencoding by using either the Tgif.DontReencode X default or the + # -dontreencode commandline option. #-D_TMP_DIR_IN_HOME_DIR # Include the above line if you want the temporary directory to be *** Imakefile.orig Fri Aug 25 00:50:52 2000 --- Imakefile Fri Aug 25 00:50:52 2000 *************** *** 54,58 **** $(MOREDEFINES) ! TGIFVERSION = 4.1.37 XCOMM Things to try to add to the DEFINES line above: --- 54,58 ---- $(MOREDEFINES) ! TGIFVERSION = 4.1.38 XCOMM Things to try to add to the DEFINES line above: *************** *** 68,71 **** --- 68,78 ---- XCOMM SCO: -DPRINT_CMD=\""lp -o raw -o nobanner"\" + XCOMM -D_PRTGIF_USE_ISO_LATIN_1_ALWAYS + XCOMM Include the above line if you want to always use ISO 8859-1 character + XCOMM set for single-byte characters when running tgif with the -print + XCOMM commandline option. Please only use this if you are sure that you + XCOMM will *never* use other encodings. You can selectively turn off + XCOMM reencoding by using either the Tgif.DontReencode X default or the + XCOMM -dontreencode commandline option. XCOMM -D_TMP_DIR_IN_HOME_DIR XCOMM Include the above line if you want the temporary directory to be *************** *** 323,327 **** MISCTAR = /**/*.man README README.tgwb Copyright License $(SPICEDIR)*.mod \ tgif.pl example.tex HISTORY /**/*.uu testdrive.pl frontend.pl \ ! Imakefile.tgwb BACKUPDIR = /mnt/halfmoon/home/william/src/tgif/v4/backup --- 330,334 ---- MISCTAR = /**/*.man README README.tgwb Copyright License $(SPICEDIR)*.mod \ tgif.pl example.tex HISTORY /**/*.uu testdrive.pl frontend.pl \ ! Imakefile.tgwb $(SPICEDIR)README BACKUPDIR = /mnt/halfmoon/home/william/src/tgif/v4/backup *************** *** 450,453 **** VMS_MAKE_TGIF.COM launch-demo.obj launch-demo-1.obj \ Copyright License make./**/* Tgif.tmpl-/**/* tgif.spec.in \ ! Imakefile.tgwb README.tgwb Target.tmpl \ > VersionInfo/Distribution/tgif-$(TGIFVERSION) --- 457,460 ---- VMS_MAKE_TGIF.COM launch-demo.obj launch-demo-1.obj \ Copyright License make./**/* Tgif.tmpl-/**/* tgif.spec.in \ ! Imakefile.tgwb README.tgwb Target.tmpl $(SPICEDIR)README \ > VersionInfo/Distribution/tgif-$(TGIFVERSION) *** HISTORY.orig Fri Aug 25 00:50:54 2000 --- HISTORY Fri Aug 25 00:50:54 2000 *************** *** 1,2 **** --- 1,20 ---- + -----------------------> tgif-4.1.37 => tgif-4.1.38 <----------------------- + 1) Fix a bug in Print Selected Objects that imported EPS objects are not + exporte. Thanks to Ralphe Neill for + pointing out the problem. + 2) For a tgif file in landscape mode, generate the correct (rotated) PDF + file. Thanks to Johan Vromans and + Goeran Hanke for the solutions. + 3) Update ja.po. Thanks to Jun Nishii for the patch. + 4) Add a README file in the spice subdirectory to include some notes on + the ports and components feature of tgif. + 5) Add a compiler option -D_PRTGIF_USE_ISO_LATIN_1_ALWAYS to always use + ISO 8859-1 character set for single-byte characters when running tgif + with the -print commandline option. Please only use this if you are + sure that you will *never* use other encoding. You can selectively + turn off reencoding by using either the Tgif.DontReencode X default + or the -dontreencode commandline option. Thanks to Ambrose Li + for the patch. + -----------------------> tgif-4.1.36 => tgif-4.1.37 <----------------------- 1) Fix a bug that may cause seg faults when reading tgif files. Thanks to *** make.comdep.orig Fri Aug 25 00:50:56 2000 --- make.comdep Fri Aug 25 00:50:56 2000 *************** *** 264,268 **** setup.e spline.e strtbl.e util.e xpixmap.e prtgif$(O) : tgifdefs.h const.h tgif_dbg.h types.h prtgif.e ! ps$(O) : tgifdefs.h const.h tgif_dbg.h types.h msg.e ps.e util.e raster$(O) : tgifdefs.h const.h tgif_dbg.h types.h expfdefs.h choice.e \ color.e dialog.e file.e font.e menu.e miniline.e msg.e \ --- 264,269 ---- setup.e spline.e strtbl.e util.e xpixmap.e prtgif$(O) : tgifdefs.h const.h tgif_dbg.h types.h prtgif.e ! ps$(O) : tgifdefs.h const.h tgif_dbg.h types.h file.e msg.e ps.e \ ! util.e raster$(O) : tgifdefs.h const.h tgif_dbg.h types.h expfdefs.h choice.e \ color.e dialog.e file.e font.e menu.e miniline.e msg.e \ *************** *** 417,422 **** $(XBM)text_cur.xbm tgif$(O) : tgifdefs.h const.h tgif_dbg.h types.h color.e dialog.e exec.e \ ! file.e grid.e mainloop.e msg.e names.e obj.e page.e setup.e \ ! strtbl.e util.e version.e tgif_dbg$(O) : util$(O) : tgifdefs.h const.h tgif_dbg.h types.h dialog.e file.e \ --- 418,423 ---- $(XBM)text_cur.xbm tgif$(O) : tgifdefs.h const.h tgif_dbg.h types.h color.e dialog.e exec.e \ ! file.e font.e grid.e mainloop.e msg.e names.e obj.e page.e \ ! setup.e strtbl.e util.e version.e tgif_dbg$(O) : util$(O) : tgifdefs.h const.h tgif_dbg.h types.h dialog.e file.e \ *** spice/README.orig Fri Aug 25 00:50:57 2000 --- spice/README Fri Aug 25 00:50:57 2000 *************** *** 0 **** --- 1,99 ---- + /* + * Author: William Chia-Wei Cheng (william@cs.ucla.edu) + * + * @(#)$Header: /mm/src/tgif/v4/spice/RCS/README,v 4.0 2000/08/17 21:22:30 william Exp $ + */ + + This file is README in the spice subdirectory of the tgif distribution. + + Here are some notes on the ports and components feature of tgif. These + features first appeared in tgif-4.1.35 and only works with the updated + files in the spice subdirectory that was in the tgif-4.1.35 release. + Also, please make sure you are running tgif-4.1.38 or newer since there + have been bug fixed! + + Please read the CONNECTING OBJECTS section of the tgif man pages in + addition to this note. + + tgif demo.obj + Select NET as the export format + Select Print() from the File Menu + demo.net is the netlist file... + Any port that's connected to the same signal name are + considered "connected" + For example, the signal name "BASE" is connected to 2 ports, + "!R2!b" and "!Q2!b" (refer to the figure). R2 is a + resistor and it has 2 ports, a and b. Q2 is a transistor + of model type SN. It has 3 ports, c, b, and e (for + collector, base, and emitter). The connection is between + port b of R2 and port b (base) of Q2. + demo.cmp is the component file... + The beginning of each component is not indented. + The first line of a component declares the component and + has the format: + : + corresponds to the "name" attribute of the component. + corresponds to the "type" attribute of the component. + All other attributes of the component are listed (indented + by a character) following the first line. + Note that the ports of a component are not listed. + For example, if you right click on the Q1 transistor and select + the Edit Attribute In Editor submenu of the Context Menu, + you can see all the attributes of this component. + Manipulating the connection... + Select the wire named "VIN" and delete it. If you print the NetList, + you will see that both the .net and the .cmp files are not changed! + As I've said, this is a poorman's implemention of ports & connections. + What happens is that port "a" of VIN has an attribute called + "signal_name" whose value is still "VIN". Similarly, port "a" + of R2 also has an attribute called "signal_name" whose value is + still "VIN". When the wire is deleted, these ports don't know + that their signalnames need to be cleared! Oh well... So, the + truth is, there's really no "connection semantics" implemented + in tgif. + To clear them, select Clear Signal Name for a Port from the + Ports and Signals submenu of the Special Menu. Mouse over a + port (the port will be highlighted) and click the left mouse + button. This will clear the signal_name attribute of the port. + Keep finding ports you want to clear... When you are done with + all the ports you want to clear, click the right mouse button. + Go ahead and clear port "a" of VIN and port "a" of R2. The + port should look different. + To make a connection (which is just setting signal_name attributes + of ports), there are 2 ways. One is to select Rename Signal + Name for a Port from the Ports and Signals submenu of the Special + Menu. This is very similiar to clearing signalnames. Let's not + do this. The 2nd way is to select Connect Two Ports by a Wire + from the Ports and Signals submenu of the Special Menu. You + must click on 2 ports. At the end, it will prompt you for a + signal name. Then it will ask you to place it. You can uncheck + Show Wire Signal Name of the Ports and Signals submenu of the + Special Menu if you don't want to see the signalname for the + (useless) wire. + How to constructor a component? + Well, this is kind of involved... I'll just mention a few major + points. + 1) A component must be instantiated from a .sym file. So, you should + build a symbol. To build the symbol, start with an empty file. + First draw what it should look like. Don't add any attributes + or ports yet. When you are done with the visual port of the + symbol, select everything and select Group from the Arrange Menu. + 2) Before you create the symbol object, you should add ports and + attributes: + a) For each port you need, instantiate "port.sym" from this + directory. Right click on it and select the "name=" attribute + from the Edit Attribute In Editor submenu of the Context Menu + and enter the port name. + b) For each attribute you need, create it simply as a text object. + A component must have attributes named "name" and "type". + Make sure you have created "name=" and "type=" text + objects (replace with the actual type of the + component). + 3) Select all the text object and the visual part of the symbol, + select Attach Attributes from the Attribute submenu of the + Special Menu. Select Hide Attributes from the Attribute submenu + of the Special Menu. + 4) Move all the ports to the right places. Select Select All from + the Edit Menu and selct Group from the Arrange Menu. Finally, + select Make Symbolic from the Special Menu and save the file as + .sym.