1b551488muffin/* 2b551488muffin * Copyright 1990 Sun Microsystems, Inc. All rights reserved. 3b551488muffin * Use is subject to license terms. 4b551488muffin */ 5b551488muffin 67c478bdstevel@tonic-gate/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 77c478bdstevel@tonic-gate/* All Rights Reserved */ 87c478bdstevel@tonic-gate 97c478bdstevel@tonic-gate/* 107c478bdstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California. 117c478bdstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 127c478bdstevel@tonic-gate * specifies the terms and conditions for redistribution. 137c478bdstevel@tonic-gate */ 147c478bdstevel@tonic-gate 15b551488muffin#pragma ident "%Z%%M% %I% %E% SMI" 167c478bdstevel@tonic-gate 177c478bdstevel@tonic-gate /* tt.c: subroutines for drawing horizontal lines */ 187c478bdstevel@tonic-gate# include "t..c" 19b551488muffin 20b551488muffinint 21b551488muffinctype(int il, int ic) 227c478bdstevel@tonic-gate{ 237c478bdstevel@tonic-gateif (instead[il]) 247c478bdstevel@tonic-gate return(0); 257c478bdstevel@tonic-gateif (fullbot[il]) 267c478bdstevel@tonic-gate return(0); 277c478bdstevel@tonic-gateil = stynum[il]; 287c478bdstevel@tonic-gatereturn(style[il][ic]); 297c478bdstevel@tonic-gate} 30b551488muffin 31b551488muffinint 32b551488muffinmin(int a, int b) 337c478bdstevel@tonic-gate{ 347c478bdstevel@tonic-gatereturn(a<b ? a : b); 357c478bdstevel@tonic-gate} 36b551488muffin 37b551488muffinint 38b551488muffinfspan(int i, int c) 397c478bdstevel@tonic-gate{ 407c478bdstevel@tonic-gatec++; 417c478bdstevel@tonic-gatereturn(c<ncol && ctype(i,c)=='s'); 427c478bdstevel@tonic-gate} 43b551488muffin 44b551488muffinint 45b551488muffinlspan(int i, int c) 467c478bdstevel@tonic-gate{ 477c478bdstevel@tonic-gateint k; 487c478bdstevel@tonic-gateif (ctype(i,c) != 's') return(0); 497c478bdstevel@tonic-gatec++; 507c478bdstevel@tonic-gateif (c < ncol && ctype(i,c)== 's') 517c478bdstevel@tonic-gate return(0); 527c478bdstevel@tonic-gatefor(k=0; ctype(i,--c) == 's'; k++); 537c478bdstevel@tonic-gatereturn(k); 547c478bdstevel@tonic-gate} 55b551488muffin 56b551488muffinint 57b551488muffinctspan(int i, int c) 587c478bdstevel@tonic-gate{ 597c478bdstevel@tonic-gateint k; 607c478bdstevel@tonic-gatec++; 617c478bdstevel@tonic-gatefor(k=1; c<ncol && ctype(i,c)=='s'; k++) 627c478bdstevel@tonic-gate c++; 637c478bdstevel@tonic-gatereturn(k); 647c478bdstevel@tonic-gate} 65b551488muffin 66b551488muffinvoid 67b551488muffintohcol(int ic) 687c478bdstevel@tonic-gate{ 697c478bdstevel@tonic-gate if (ic==0) 707c478bdstevel@tonic-gate fprintf(tabout, "\\h'|0'"); 717c478bdstevel@tonic-gate else 727c478bdstevel@tonic-gate fprintf(tabout, "\\h'(|\\n(%du+|\\n(%du)/2u'", ic+CLEFT, ic+CRIGHT-1); 737c478bdstevel@tonic-gate} 74b551488muffin 75b551488muffinint 76b551488muffinallh(int i) 777c478bdstevel@tonic-gate{ 787c478bdstevel@tonic-gate/* return true if every element in line i is horizontal */ 797c478bdstevel@tonic-gate/* also at least one must be horizontl */ 807c478bdstevel@tonic-gateint c, one, k; 817c478bdstevel@tonic-gateif (fullbot[i]) return(1); 827c478bdstevel@tonic-gatefor(one=c=0; c<ncol; c++) 837c478bdstevel@tonic-gate { 847c478bdstevel@tonic-gate k = thish(i,c); 857c478bdstevel@tonic-gate if (k==0) return(0); 867c478bdstevel@tonic-gate if (k==1) continue; 877c478bdstevel@tonic-gate one=1; 887c478bdstevel@tonic-gate } 897c478bdstevel@tonic-gatereturn(one); 907c478bdstevel@tonic-gate} 91b551488muffin 92b551488muffinint 93b551488muffinthish(int i, int c) 947c478bdstevel@tonic-gate{ 957c478bdstevel@tonic-gate int t; 967c478bdstevel@tonic-gate char *s; 977c478bdstevel@tonic-gate struct colstr *pc; 987c478bdstevel@tonic-gate if (c<0)return(0); 997c478bdstevel@tonic-gate if (i<0) return(0); 1007c478bdstevel@tonic-gate t = ctype(i,c); 1017c478bdstevel@tonic-gate if (t=='_' || t == '-') 1027c478bdstevel@tonic-gate return('-'); 1037c478bdstevel@tonic-gate if (t=='=')return('='); 1047c478bdstevel@tonic-gate if (t=='^') return(1); 1057c478bdstevel@tonic-gate if (fullbot[i] ) 1067c478bdstevel@tonic-gate return(fullbot[i]); 1077c478bdstevel@tonic-gate if (t=='s') return(thish(i,c-1)); 1087c478bdstevel@tonic-gate if (t==0) return(1); 1097c478bdstevel@tonic-gate pc = &table[i][c]; 1107c478bdstevel@tonic-gate s = (t=='a' ? pc->rcol : pc->col); 1117c478bdstevel@tonic-gate if (s==0 || (point(s) && *s==0)) 1127c478bdstevel@tonic-gate return(1); 1137c478bdstevel@tonic-gate if (vspen(s)) return(1); 1147c478bdstevel@tonic-gate if (t=barent( s)) 1157c478bdstevel@tonic-gate return(t); 1167c478bdstevel@tonic-gate return(0); 1177c478bdstevel@tonic-gate} 118