コード例 #1
0
ファイル: t4.c プロジェクト: 00001/plan9port
void
getspec(void)
{
	int	icol, i;

	qcol = findcol() + 1;/* must allow one extra for line at right */
	garray(qcol);
	sep[-1] = -1;
	for (icol = 0; icol < qcol; icol++) {
		sep[icol] = -1;
		evenup[icol] = 0;
		cll[icol][0] = 0;
		for (i = 0; i < MAXHEAD; i++) {
			csize[icol][i][0] = 0;
			vsize[icol][i][0] = 0;
			font[icol][i][0] = lefline[icol][i] = 0;
			flags[icol][i] = 0;
			style[icol][i] = 'l';
		}
	}
	for (i = 0; i < MAXHEAD; i++)
		lefline[qcol][i] = 0;	/* fixes sample55 looping */
	nclin = ncol = 0;
	oncol = 0;
	left1flg = rightl = 0;
	readspec();
	Bprint(&tabout, ".rm");
	for (i = 0; i < ncol; i++)
		Bprint(&tabout, " %2s", reg(i, CRIGHT));
	Bprint(&tabout, "\n");
}
コード例 #2
0
ファイル: t4.c プロジェクト: 5432935/crossbridge
void getspec(void)
{
int icol, i;
for(icol=0; icol<MAXCOL; icol++)
	{
	sep[icol]= -1;
	evenup[icol]=0;
	cll[icol][0]=0;
	for(i=0; i<MAXHEAD; i++)
		{
		csize[i][icol][0]=0;
		vsize[i][icol][0]=0;
		font[i][icol][0] = lefline[i][icol] = 0;
		ctop[i][icol]=0;
		style[i][icol]= 'l';
		}
	}
nclin=ncol=0;
oncol =0;
left1flg=rightl=0;
readspec();
fprintf(tabout, ".rm");
for(i=0; i<ncol; i++)
	fprintf(tabout, " %02d", 80+i);
fprintf(tabout, "\n");
}
コード例 #3
0
ファイル: tiffinput.cpp プロジェクト: amanforindia/oiio
bool
TIFFInput::seek_subimage (int subimage, int miplevel, ImageSpec &newspec)
{
    if (subimage < 0)       // Illegal
        return false;
    if (m_emulate_mipmap) {
        // Emulating MIPmap?  Pretend one subimage, many MIP levels.
        if (subimage != 0)
            return false;
        subimage = miplevel;
    } else {
        // No MIPmap emulation
        if (miplevel != 0)
            return false;
    }

    if (subimage == m_subimage) {
        // We're already pointing to the right subimage
        newspec = m_spec;
        return true;
    }

    // If we're emulating a MIPmap, only resolution is allowed to change
    // between MIP levels, so if we already have a valid level in m_spec,
    // we don't need to re-parse metadata, it's guaranteed to be the same.
    bool read_meta = !(m_emulate_mipmap && m_tif && m_subimage >= 0);

    if (! m_tif) {
        // Use our own error handler to keep libtiff from spewing to stderr
        lock_guard lock (lasterr_mutex);
        TIFFSetErrorHandler (my_error_handler);
        TIFFSetWarningHandler (my_error_handler);
    }

    if (! m_tif) {
        m_tif = TIFFOpen (m_filename.c_str(), "rm");
        if (m_tif == NULL) {
            error ("Could not open file: %s",
                   lasterr.length() ? lasterr.c_str() : m_filename.c_str());
            return false;
        }
        m_subimage = 0;
    }
    
    m_next_scanline = 0;   // next scanline we'll read
    if (TIFFSetDirectory (m_tif, subimage)) {
        m_subimage = subimage;
        readspec (read_meta);
        newspec = m_spec;
        if (newspec.format == TypeDesc::UNKNOWN) {
            error ("No support for data format of \"%s\"", m_filename.c_str());
            return false;
        }
        return true;
    } else {
        error ("%s", lasterr.length() ? lasterr.c_str() : m_filename.c_str());
        m_subimage = -1;
        return false;
    }
}
コード例 #4
0
ファイル: tiffinput.cpp プロジェクト: 400notout/oiio
bool
TIFFInput::seek_subimage (int subimage, int miplevel, ImageSpec &newspec)
{
    if (subimage < 0)       // Illegal
        return false;
    if (m_emulate_mipmap) {
        // Emulating MIPmap?  Pretend one subimage, many MIP levels.
        if (subimage != 0)
            return false;
        subimage = miplevel;
    } else {
        // No MIPmap emulation
        if (miplevel != 0)
            return false;
    }

    if (subimage == m_subimage) {
        // We're already pointing to the right subimage
        newspec = m_spec;
        return true;
    }

    if (! m_tif) {
        // Use our own error handler to keep libtiff from spewing to stderr
        lock_guard lock (lasterr_mutex);
        TIFFSetErrorHandler (my_error_handler);
        TIFFSetWarningHandler (my_error_handler);
    }

    if (! m_tif) {
        m_tif = TIFFOpen (m_filename.c_str(), "rm");
        if (m_tif == NULL) {
            error ("Could not open file: %s",
                   lasterr.length() ? lasterr.c_str() : m_filename.c_str());
            return false;
        }
        m_subimage = 0;
    }
    
    m_next_scanline = 0;   // next scanline we'll read
    if (TIFFSetDirectory (m_tif, subimage)) {
        m_subimage = subimage;
        readspec ();
        newspec = m_spec;
        if (newspec.format == TypeDesc::UNKNOWN) {
            error ("No support for data format of \"%s\"", m_filename.c_str());
            return false;
        }
        return true;
    } else {
        error ("%s", lasterr.length() ? lasterr.c_str() : m_filename.c_str());
        m_subimage = -1;
        return false;
    }
}
コード例 #5
0
ファイル: t5.c プロジェクト: dank101/4.4BSD-Alpha
gettbl()
{
int icol, ch;
cstore=cspace= chspace();
textflg=0;
for (nlin=nslin=0; gets1(cstore); nlin++)
	{
	stynum[nlin]=nslin;
	if (prefix(".TE", cstore))
		{
		leftover=0;
		break;
		}
	if (prefix(".TC", cstore) || prefix(".T&", cstore))
		{
		readspec();
		nslin++;
		}
	if (nlin>=MAXLIN)
		{
		leftover=(int)cstore;
		break;
		}
	fullbot[nlin]=0;
	if (cstore[0] == '.' && !isdigit(cstore[1]))
		{
		instead[nlin] = cstore;
		while (*cstore++);
		continue;
		}
	else instead[nlin] = 0;
	if (nodata(nlin))
		{
		if (ch = oneh(nlin))
			fullbot[nlin]= ch;
		nlin++;
		nslin++;
		instead[nlin]=(char *)0;
		fullbot[nlin]=0;
		}
	table[nlin] = (struct colstr *)alocv((ncol+2)*sizeof(table[0][0]));
	if (cstore[1]==0)
	switch(cstore[0])
		{
		case '_': fullbot[nlin]= '-'; continue;
		case '=': fullbot[nlin]= '='; continue;
		}
	stynum[nlin] = nslin;
	nslin = min(nslin+1, nclin-1);
	for (icol = 0; icol <ncol; icol++)
		{
		table[nlin][icol].col = cstore;
		table[nlin][icol].rcol=0;
		ch=1;
		if (match(cstore, "T{")) /* text follows */
			table[nlin][icol].col =
				(char *)gettext(cstore, nlin, icol,
					font[stynum[nlin]][icol],
					csize[stynum[nlin]][icol]);
		else
			{
			for(; (ch= *cstore) != '\0' && ch != tab; cstore++)
					;
			*cstore++ = '\0';
			switch(ctype(nlin,icol)) /* numerical or alpha, subcol */
				{
				case 'n':
					table[nlin][icol].rcol = 
					    (char *)maknew(table[nlin][icol].col);
					break;
				case 'a':
					table[nlin][icol].rcol = table[nlin][icol].col;
					table[nlin][icol].col = "";
					break;
				}
			}
		while (ctype(nlin,icol+1)== 's') /* spanning */
			table[nlin][++icol].col = "";
		if (ch == '\0') break;
		}
	while (++icol <ncol+2)
		{
		table[nlin][icol].col = "";
		table [nlin][icol].rcol=0;
		}
	while (*cstore != '\0')
		 cstore++;
	if (cstore-cspace > MAXCHS)
		cstore = cspace = chspace();
	}
last = cstore;
permute();
if (textflg) untext();
return;
}