ftp.nice.ch/pub/next/text/tex/apps/TeXview-kp0.25.s.tar.gz#/HyperTeXview/context.c

This is context.c in view mode; [Download] [Up]

#include "structures.h"
#include "context.h"
#include "external.h"
#include <strings.h>

extern void freepages();
void initialize_char_array() ;
extern int debugon ;

void save_context(DviContext *dc) {
memcpy(dc->TeXfonts, TeXfonts, sizeof(dc->TeXfonts)) ;
dc->TeXfontlist  = TeXfontlist  ;
dc->fontlist   = fontlist   ;  
dc->curid = curid ;    
dc->landscape  = landscape  ; 
dc -> dvifile   = dvifile   ; 
memcpy(dc->Tbasename, Tbasename, sizeof(dc->Tbasename)) ; 
memcpy(dc->oldbasename, oldbasename, sizeof(dc->oldbasename)) ;
memcpy(dc->LastFormat, LastFormat, sizeof(dc->LastFormat)) ;
memcpy(dc->CustomFormat, CustomFormat, sizeof(dc->CustomFormat)) ;    
dc->curpos  = curpos  ;                     
dc->thispage  = thispage  ;                   
dc->rthispage  = rthispage  ;
dc->prevpage  = prevpage  ;                 
dc->pagenum = pagenum ;
#ifdef DEBUG
 if (debugon > 2 ) {
printf("saved pagenum as %i\n",pagenum);
  }
#endif
dc->seq  = seq  ;         
dc->conv  = conv  ;
dc->pxlconv  = pxlconv  ;         
dc->iconv  = iconv  ;                
dc->vconv  = vconv  ;                        
dc->viconv  = viconv  ;
dc->alpha  = alpha  ;                  
dc->mag  = mag  ;                 
dc->screendpi   = screendpi   ;             
dc->hh  = hh  ;
dc->vv  = vv  ;                   
dc->fnt  = fnt  ;                     
dc->curfnt  = curfnt  ;  
memcpy(dc->frames, frames, sizeof(dc->frames)) ;             
dc->virpos  = virpos  ; 
dc->virlim  = virlim  ;       
dc->ffont  = ffont  ;          
dc->hhoffset = hhoffset ;
dc->vvoffset  = vvoffset  ;       
dc->hhmin  = hhmin  ;
dc->hhmax  = hhmax  ;
dc->vvmin  = vvmin  ;
dc->vvmax  = vvmax  ; 
dc->hsize  = hsize  ;
dc->vsize  = vsize  ;
dc->hmarg  = hmarg  ;
dc->vmarg  = vmarg  ;  
dc->hhsize  = hhsize  ;
dc->vvsize  = vvsize  ;
dc->hhmarg  = hhmarg  ;
dc->vvmarg  = vvmarg  ;
dc->rhhsize  = rhhsize  ;
dc->rvvsize  = rvvsize  ;
dc->rhhmarg  = rhhmarg  ;
dc->rvvmarg  = rvvmarg  ;
dc->hbody  = hbody  ;
dc->vbody  = vbody  ;
dc->hpos  = hpos  ;
dc->vpos  = vpos  ;
dc->hpot  = hpot  ;
dc->vpot  = vpot  ;
dc->vscreen   = vscreen   ;            
dc->vwindow  = vwindow  ;
dc->vwindowheight  = vwindowheight  ;
dc->hwindow  = hwindow  ;
dc->hwindowwidth  = hwindowwidth  ;
dc->dvimag  = dvimag  ;
dc->num  = num  ;
dc->den  = den  ;          
dc->memalloc  = memalloc  ;
dc->numalloc  = numalloc  ;
dc->pageinterrupted  = pageinterrupted  ;
dc->messagebit  = messagebit  ;                 
dc->borderson  = borderson  ;
dc->dualpage  = dualpage  ;
dc->orientationset  = orientationset  ;
dc->reopenscreen  = reopenscreen  ;
dc->vscreenheight  = vscreenheight  ;
dc->interlaceon  = interlaceon  ;
dc->first  = first  ;
dc->x  = x  ;
dc->y  = y  ;
dc->tracking  = tracking  ;
dc->zoomed  = zoomed  ;
dc->mocked  = mocked  ;
memcpy(dc->realname, realname, sizeof(dc->realname)) ;
memcpy(dc->safebuf, safebuf, sizeof(dc->safebuf)) ;
memcpy(dc->filenamebuf, filenamebuf, sizeof(dc->filenamebuf)) ;
dc->redrawbars  = redrawbars  ;
dc->turnitoff  = turnitoff  ;
dc->nloc  = nloc  ;
dc->spage  = spage  ;
dc->sno  = sno  ;
dc->redrawpage  = redrawpage  ;
dc->rowsize  = rowsize  ;
dc->colsize  = colsize  ;
dc->autofront  = autofront  ;
dc->autoactivate  = autoactivate  ;
dc->actualdpi  = actualdpi  ;
dc->pages = pages ;
dc->last = last ;
dc->currentpage = currentpage;
dc->ht_highlight = ht_highlight ;
dc->ht_last_page = ht_last_page ;
dc->last_pagenum = last_pagenum ;
dc->lasthh = lasthh ;
dc->lastvv = lastvv ;
dc->last_thing = last_thing;
dc->last_string = last_string;

}

void get_context(DviContext *dc) {
memcpy(TeXfonts, dc->TeXfonts, sizeof(dc->TeXfonts)) ;
TeXfontlist = dc->TeXfontlist ;
fontlist  = dc->fontlist  ;    
curid = dc->curid ;  
landscape = dc->landscape ; 
dvifile  = dc->dvifile  ; 
memcpy(Tbasename, dc->Tbasename, sizeof(dc->Tbasename)) ; 
memcpy(oldbasename, dc->oldbasename, sizeof(dc->oldbasename)) ;
memcpy(LastFormat, dc->LastFormat, sizeof(dc->LastFormat)) ;
memcpy(CustomFormat, dc->CustomFormat, sizeof(dc->CustomFormat)) ;      
curpos = dc->curpos ;                     
thispage = dc->thispage ;                   
rthispage = dc->rthispage ;
prevpage = dc->prevpage ;                 
pagenum = dc->pagenum ;
seq = dc->seq ;         
conv = dc->conv ;
pxlconv = dc->pxlconv ;         
iconv = dc->iconv ;                
vconv = dc->vconv ;                        
viconv = dc->viconv ;
alpha = dc->alpha ;                  
mag = dc->mag ;                 
screendpi = dc->screendpi ;             
hh = dc->hh ;
vv = dc->vv ;                   
fnt = dc->fnt ;                     
curfnt = dc->curfnt ;  
memcpy(frames, dc->frames, sizeof(dc->frames)) ;             
virpos = dc->virpos ; 
virlim = dc->virlim ;       
ffont = dc->ffont ;          
hhoffset = dc->hhoffset ;
vvoffset = dc->vvoffset ;       
hhmin = dc->hhmin ;
hhmax = dc->hhmax ;
vvmin = dc->vvmin ;
vvmax = dc->vvmax ; 
hsize = dc->hsize ;
vsize = dc->vsize ;
hmarg = dc->hmarg ;
vmarg = dc->vmarg ;  
hhsize = dc->hhsize ;
vvsize = dc->vvsize ;
hhmarg = dc->hhmarg ;
vvmarg = dc->vvmarg ;
rhhsize = dc->rhhsize ;
rvvsize = dc->rvvsize ;
rhhmarg = dc->rhhmarg ;
rvvmarg = dc->rvvmarg ;
hbody = dc->hbody ;
vbody = dc->vbody ;
hpos = dc->hpos ;
vpos = dc->vpos ;
hpot = dc->hpot ;
vpot = dc->vpot ;
vscreen  = dc->vscreen  ;            
vwindow = dc->vwindow ;
vwindowheight = dc->vwindowheight ;
hwindow = dc->hwindow ;
hwindowwidth = dc->hwindowwidth ;
dvimag = dc->dvimag ;
num = dc->num ;
den = dc->den ;          
memalloc = dc->memalloc ;
numalloc = dc->numalloc ;
pageinterrupted = dc->pageinterrupted ;
messagebit = dc->messagebit ;                 
borderson = dc->borderson ;
dualpage = dc->dualpage ;
orientationset = dc->orientationset ;
reopenscreen = dc->reopenscreen ;
vscreenheight = dc->vscreenheight ;
interlaceon = dc->interlaceon ;
first = dc->first ;
x = dc->x ;
y = dc->y ;
tracking = dc->tracking ;
zoomed = dc->zoomed ;
mocked = dc->mocked ;
memcpy(realname, dc->realname, sizeof(dc->realname)) ;
memcpy(safebuf, dc->safebuf, sizeof(dc->safebuf)) ;
memcpy(filenamebuf, dc->filenamebuf, sizeof(dc->filenamebuf)) ;
redrawbars = dc->redrawbars ;
turnitoff = dc->turnitoff ;
nloc = dc->nloc ;
spage = dc->spage ;
sno = dc->sno ;
redrawpage = dc->redrawpage ;
rowsize = dc->rowsize ;
colsize = dc->colsize ;
autofront = dc->autofront ;
autoactivate = dc->autoactivate ;
actualdpi = dc->actualdpi ;
pages = dc->pages ;
last = dc->last ;
currentpage = dc->currentpage ;
ht_highlight = dc->ht_highlight ;
ht_last_page = dc->ht_last_page ;
last_pagenum = dc->last_pagenum ;
lasthh = dc->lasthh ;
lastvv = dc->lastvv ;
last_thing = dc->last_thing;
last_string = dc->last_string;
}

void clear_context(void) { /* Clear a context */

int i ;

// Leave this for fontint()

//TeXfontdesctype *tft ;
//for (i=0; i<256; i++)
//      if (tft = TeXfonts[i])
//         TeXfonts[i] = NULL ;  
 //      tft->loaded = 0 ;

TeXfontlist = NULL ;
fontlist  = NULL  ;  
curid = 0;    
landscape = 0 ; 
dvifile  = NULL ;
initialize_char_array(Tbasename, 100) ;
initialize_char_array(oldbasename, 100) ;
initialize_char_array(LastFormat, 100) ;
initialize_char_array(CustomFormat, 100) ;
curpos = 0 ;                     
thispage = 0 ;                   
rthispage = 0 ;
prevpage = 0 ;                 
pagenum = 0 ;
seq = 0 ;         
conv = 0 ;
pxlconv = 0 ;         
iconv = 0 ;                
vconv = 0 ;                        
viconv = 0 ;
alpha = 0 ;                  
mag = 0 ;                 
screendpi = 83.0 ;   /* Change this to read the default preference */          
hh = 0 ;
vv = 0 ;                   
fnt = 0 ;                     
curfnt = 0 ;  
for (i=0; i<MAXFRAME; i++) {
     frames[i].curp = NULL; 
     frames[i].curl = NULL;
     frames[i].tfnt = NULL;
     frames[i].curf = NULL;
     frames[i].ff = NULL;
   }             
virpos = 0 ; 
virlim = 0 ;       
ffont = NULL ;          
hhoffset = 0 ;
vvoffset = 0 ;       
hhmin = 0 ;
hhmax = 0;
vvmin = 0 ;
vvmax = 0 ; 
hsize = 0 ;
vsize = 0 ;
hmarg = 0 ;
vmarg = 0 ;  
hhsize = 8.5 ;
vvsize = 11.0 ;
hhmarg = 1.0 ;
vvmarg = 1.0 ;
rhhsize = 0 ;
rvvsize = 0 ;
rhhmarg = 0 ;
rvvmarg = 0 ;
hbody = 0 ;
vbody = 0 ;
hpos = 0 ;
vpos = 0 ;
hpot = 32768 ;
vpot = 0 ;
vscreen  = 380  ;            
vwindow = 0 ;
vwindowheight = 0 ;
hwindow = 0 ;
hwindowwidth = 0 ;
dvimag = 0 ;
num = 0 ;
den = 0 ;          
memalloc = 0 ;
numalloc = 0 ;
pageinterrupted = 0 ;
messagebit = 0 ;                 
borderson = 1 ;
dualpage = 0 ;
orientationset = 0 ;
reopenscreen = 0 ;
vscreenheight = 400 ;
interlaceon = 1 ;
first = 0 ;
x = 0 ;
y = 0 ;
tracking = 0 ;
zoomed = 0 ;
mocked = 0 ;
initialize_char_array(realname, 200) ;
initialize_char_array(safebuf, 200) ;
initialize_char_array(filenamebuf, 200) ;
redrawbars = 0 ;
turnitoff = 0 ;
nloc = 0 ;
spage = 0 ;
sno = 0 ;
redrawpage = 0 ;
rowsize = 0 ;
colsize = 0 ;
autofront = 1 ;
autoactivate = 0 ;
actualdpi = 100 ;
pages = NULL ;
last = NULL ;
currentpage = NULL ;
ht_highlight = 0 ;
ht_last_page = 0 ;
last_pagenum = 0 ;
lasthh = 0 ;
lastvv = 0 ;
last_thing = 0 ;
last_string = NULL ;

}

void initialize_char_array(char *start, int length)
{
  char *c = start ;
  int i ;

  for(i = 0; i < length; i++)
    *(c+i) = '\0' ;
}

void print_context()  /* Useful debugging tool */
{
//  TeXfontdesctype *tft ;
//for (i=0; i<256; i++)
//if (tft = TeXfonts[i])
//         TeXfonts[i] = NULL ;  

//TeXfonts[0] = dc->TeXfonts[0] ;     
printf("TeXfontlist=%p\n", TeXfontlist) ;
printf("fontlist=%p\n", fontlist) ;  
printf("curid = %i\n", curid) ;    
printf("dvifile = %p\n", dvifile) ;
//initialize_char_array(Tbasename, 100) ;
//initialize_char_array(oldbasename, 100) ;
//initialize_char_array(LastFormat, 100) ;
//initialize_char_array(CustomFormat, 100) ;
printf("thispage = %d\n", thispage) ; 
printf("rthispage = %d\n", rthispage) ;
printf("prevpage = %d\n", prevpage) ;
printf("pagenum = %d\n", pagenum) ;
printf("curpos = %d\n", curpos) ;
printf("curpos = %d\n", curpos) ;                   
//seq = 0 ;         
//conv = 0 ;
//pxlconv = 0 ;         
//iconv = 0 ;                
//vconv = 0 ;                        
//viconv = 0 ;
//alpha = 0 ;                  
//mag = 0 ;                 
screendpi = 83.0 ;   /* Change this to read the default preference */          
//hh = 0 ;
//vv = 0 ;                   
//fnt = 0 ;                     
//curfnt = 0 ;  
//for (i=0; i<MAXFRAME; i++) {
//     frames[i].curp = NULL; 
//     frames[i].curl = NULL;
//     frames[i].tfnt = NULL;
//     frames[i].curf = NULL;
//     frames[i].ff = NULL;
 //  }             
//frames[0] = dc->frames[0] ;         
//virpos = 0 ; 
//virlim = 0 ;       
//ffont = NULL ;          
//hhoffset = 0 ;
//vvoffset = 0 ;       
//hhmin = 0 ;
//hhmax = 0;
//vvmin = 0 ;
//vvmax = 0 ; 
//hsize = 0 ;
//vsize = 0 ;
//hmarg = 0 ;
//vmarg = 0 ;  
//hhsize = 8.5 ;
//vvsize = 11.0 ;
//hhmarg = 1.0 ;
//vvmarg = 1.0 ;
//rhhsize = 0 ;
//rvvsize = 0 ;
//rhhmarg = 0 ;
//rvvmarg = 0 ;
//hbody = 0 ;
//vbody = 0 ;
//hpos = 0 ;
//vpos = 0 ;
//hpot = 32768 ;
//vpot = 0 ;
//vscreen  = 380  ;            
//vwindow = 0 ;
//vwindowheight = 0 ;
//hwindow = 0 ;
//hwindowwidth = 0 ;
//dvimag = 0 ;
//num = 0 ;
//den = 0 ;          
//memalloc = 0 ;
//numalloc = 0 ;
//pageinterrupted = 0 ;
//messagebit = 0 ;                 
//borderson = 1 ;
//dualpage = 0 ;
//orientationset = 0 ;
//reopenscreen = 0 ;
//vscreenheight = 400 ;
//interlaceon = 1 ;
//first = 0 ;
//x = 0 ;
//y = 0 ;
//tracking = 0 ;
//zoomed = 0 ;
//mocked = 0 ;
//realname[0] = dc->realname[0] ;
//initialize_char_array(realname, 200) ;
//safebuf[0] = dc->safebuf[0] ;
//initialize_char_array(safebuf, 200) ;
//filenamebuf[0] = dc->filenamebuf[0] ;
//initialize_char_array(filenamebuf, 200) ;
//redrawbars = 0 ;
//turnitoff = 0 ;
//nloc = 0 ;
//spage = 0 ;
//sno = 0 ;
//redrawpage = 0 ;
//rowsize = 0 ;
//colsize = 0 ;
//autofront = 1 ;
//autoactivate = 0 ;
//actualdpi = 100 ;
//freepages() ;
printf("pages = %p\n", pages) ;
printf("last = %p\n", last) ;
printf("currentpage = %p\n", currentpage) ;
//printf("in clear_context: %p\n", (void *)pages);
//curid = 0 ;
//ht_highlight = 0 ;
//ht_highlight_tag = nil ;
//ht_last_page = 0 ;
//ht_last_clicked = nil ;
//last_pagenum = 0 ;
//lasthh = 0 ;
//lastvv = 0 ;
//last_thing = 0 ;
//last_string = NULL ;

}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.