QED for Visual Studio, from 1992, 1994, 2014
This commit is contained in:
20
visual-studio-1994/QED.sln
Normal file
20
visual-studio-1994/QED.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QED", "QED.vcxproj", "{91604E0F-11A2-419F-9293-941C15D87F28}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{91604E0F-11A2-419F-9293-941C15D87F28}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{91604E0F-11A2-419F-9293-941C15D87F28}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{91604E0F-11A2-419F-9293-941C15D87F28}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{91604E0F-11A2-419F-9293-941C15D87F28}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
142
visual-studio-1994/QED.vcxproj
Normal file
142
visual-studio-1994/QED.vcxproj
Normal file
@@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName />
|
||||
<SccLocalPath />
|
||||
<ProjectGuid>{91604E0F-11A2-419F-9293-941C15D87F28}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>.\Release\</OutDir>
|
||||
<IntDir>.\Release\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>.\Debug\</OutDir>
|
||||
<IntDir>.\Debug\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\Release\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\Release\QED.pch</PrecompiledHeaderOutputFile>
|
||||
<ObjectFileName>.\Release\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Release\</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Release\QED.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Release\QED.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Link>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OutputFile>.\Release\QED.exe</OutputFile>
|
||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;Setargv.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\Debug\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\Debug\QED.pch</PrecompiledHeaderOutputFile>
|
||||
<ObjectFileName>.\Debug\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Midl>
|
||||
<TypeLibraryName>.\Debug\QED.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Debug\QED.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Link>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OutputFile>.\Debug\QED.exe</OutputFile>
|
||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;Setargv.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Address.c" />
|
||||
<ClCompile Include="Blkio.c" />
|
||||
<ClCompile Include="Com.c" />
|
||||
<ClCompile Include="Getchar.c" />
|
||||
<ClCompile Include="Getfile.c" />
|
||||
<ClCompile Include="Glob.c" />
|
||||
<ClCompile Include="Main.c" />
|
||||
<ClCompile Include="Misc.c" />
|
||||
<ClCompile Include="Move.c" />
|
||||
<ClCompile Include="Pattern.c" />
|
||||
<ClCompile Include="pseudoheap.c" />
|
||||
<ClCompile Include="Putchar.c" />
|
||||
<ClCompile Include="Setaddr.c" />
|
||||
<ClCompile Include="String.c" />
|
||||
<ClCompile Include="Subs.c" />
|
||||
<ClCompile Include="Vars.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
671
visual-studio-1994/com.c
Normal file
671
visual-studio-1994/com.c
Normal file
@@ -0,0 +1,671 @@
|
||||
/*% cc -c -O %
|
||||
*/
|
||||
#include "vars.h"
|
||||
#define OUT 10
|
||||
#define BACKWARD 11
|
||||
#define FORWARD 12
|
||||
char jumpcs[] = "0123456789o`'";
|
||||
void
|
||||
jump() /* this should be pronounced with a Swedish accent */
|
||||
{
|
||||
register int i;
|
||||
register cond;
|
||||
register c;
|
||||
|
||||
if(stackp->type==TTY)
|
||||
error('y');
|
||||
c = getchar();
|
||||
cond = TRUE;
|
||||
if(c=='t' || c=='f'){
|
||||
cond = ((c=='t') == truth());
|
||||
c = getchar();
|
||||
}
|
||||
i = posn(c, jumpcs);
|
||||
if(i==-1){ /* to handle y[tf] without labels for globals */
|
||||
ungetchar(c);
|
||||
if(cond){
|
||||
while((c = getc())!='\n')
|
||||
if(c==EOF)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(i<=9){
|
||||
stacktype(BUF);
|
||||
ungetchar(c);
|
||||
i = getnum();
|
||||
stacktype(BUF); /* we may have popped stack! */
|
||||
if(cond){
|
||||
/* getchar will handle problems if off end of buffer */
|
||||
bbempty = TRUE;
|
||||
stackp->lineno = i;
|
||||
stackp->charno = 0;
|
||||
}
|
||||
}
|
||||
else if(i==OUT){
|
||||
if(cond){
|
||||
if(stackp==stack)
|
||||
error('y');
|
||||
if(stackp->type==GLOB){
|
||||
--nestlevel;
|
||||
stackp->globp = "";
|
||||
}else
|
||||
popinp();
|
||||
}
|
||||
}
|
||||
else if(i==FORWARD || i==BACKWARD){
|
||||
stacktype(BUF);
|
||||
getlabel(); /* must eat label even if not yumping */
|
||||
stacktype(BUF);
|
||||
if(cond)
|
||||
search(i==FORWARD);
|
||||
}
|
||||
}
|
||||
stacktype(t)
|
||||
{
|
||||
if(stackp->type != t)
|
||||
error('y');
|
||||
}
|
||||
getlabel(){
|
||||
register char *p, c;
|
||||
p = genbuf;
|
||||
for(c=getchar(); posn(c," \"\t\n")<0; c=getchar()){
|
||||
*p++ = c;
|
||||
*p = '\0';
|
||||
}
|
||||
if(p==genbuf)
|
||||
error('y');
|
||||
}
|
||||
int *looper(a1,a2,str,dir)
|
||||
register int *a1, *a2;
|
||||
register char *str;
|
||||
{
|
||||
register char *p1;
|
||||
register char *p2;
|
||||
while(dir ? a1<=a2 : a1>=a2){
|
||||
p2 = getline(*a1, linebuf);
|
||||
while(*p2==' ' || *p2=='\t')
|
||||
p2++;
|
||||
if(*p2++=='"' && *p2!=' ' && *p2!='\t' && *p2!='\0') {
|
||||
for(p1=str; *p2 && (*p1 == *p2); p2++)
|
||||
p1++;
|
||||
if(*p1==0 && (*p2==0 || *p2==' ' || *p2=='\t'))
|
||||
return(a1);
|
||||
}
|
||||
if(dir)
|
||||
a1++;
|
||||
else
|
||||
--a1;
|
||||
}
|
||||
return((int *)0);
|
||||
}
|
||||
search(forward)
|
||||
{
|
||||
register int *a1;
|
||||
struct buffer *bufp;
|
||||
bufp = stackp->bufptr;
|
||||
if(forward){
|
||||
if((a1 = looper(bufp->zero + (stackp->lineno + 1),
|
||||
bufp->dol,genbuf,1))==0){
|
||||
a1 = looper(bufp->zero + 1,bufp->zero + (stackp->lineno - 1),genbuf,1);
|
||||
}
|
||||
}else{
|
||||
if((a1 = looper(bufp->zero + (stackp->lineno - 1),
|
||||
bufp->zero + 1,genbuf,0))==0){
|
||||
a1 = looper(bufp->dol,bufp->zero + stackp->lineno + 1,genbuf,0);
|
||||
}
|
||||
}
|
||||
if(a1){
|
||||
stackp->lineno = a1 - bufp->zero;
|
||||
stackp->charno = 0;
|
||||
}
|
||||
}
|
||||
int pchar;
|
||||
setapp()
|
||||
{
|
||||
register c;
|
||||
c=getchar();
|
||||
if(posn(c, lchars)>=0) {
|
||||
pchar = c;
|
||||
c = getchar();
|
||||
}
|
||||
if(c==' ' || c=='\t'){
|
||||
oneline++;
|
||||
if(c=='\t')
|
||||
ungetchar(c);
|
||||
}
|
||||
else if(c!='\n')
|
||||
error('x');
|
||||
}
|
||||
#define LDCHUNK 512
|
||||
append(f, a)
|
||||
int (*f)();
|
||||
int *a;
|
||||
{
|
||||
register *a1, *a2, *rdot;
|
||||
int nline, tl;
|
||||
struct integer { int iint; };
|
||||
appflag++;
|
||||
nline = 0;
|
||||
dot = a;
|
||||
while ((*f)()==0) {
|
||||
if (lastdol>=endcore) {
|
||||
if (sbrk(LDCHUNK*(sizeof *endcore))==(char *)-1)
|
||||
error('c');
|
||||
endcore += LDCHUNK;
|
||||
}
|
||||
tl = putline();
|
||||
nline++;
|
||||
lock++;
|
||||
++dol;
|
||||
a1 = ++lastdol;
|
||||
fixbufs(1);
|
||||
a2 = a1+1;
|
||||
rdot = ++dot;
|
||||
while (a1 > rdot)
|
||||
*--a2 = *--a1;
|
||||
*rdot = tl;
|
||||
unlock();
|
||||
if(oneline)
|
||||
break;
|
||||
}
|
||||
appflag=0;
|
||||
oneline=0;
|
||||
if(pchar) {
|
||||
a1 = addr1; addr1 = dot;
|
||||
a2 = addr2; addr2 = dot;
|
||||
display(pchar);
|
||||
pchar = 0;
|
||||
addr1 = a1; addr2 = a2;
|
||||
}
|
||||
return(nline);
|
||||
}
|
||||
char bformat = 'p';
|
||||
bcom()
|
||||
{
|
||||
register dir, n;
|
||||
register psize;
|
||||
register *olddot=addr2; /* for b. */
|
||||
dir=1;
|
||||
if((peekc=getchar())!='\n'){ /* really nextchar() */
|
||||
if (peekc=='-' || peekc=='+' || peekc=='.') {
|
||||
if(peekc=='-')
|
||||
dir= -1;
|
||||
else if(peekc=='.')
|
||||
dir=0;
|
||||
getchar(); /* eat peekc */
|
||||
}
|
||||
if((n=getnum())>0)
|
||||
pagesize=n;
|
||||
}
|
||||
psize=pagesize;
|
||||
if(dir==0)
|
||||
psize/=2;
|
||||
if(posn(nextchar(), lchars)>=0)
|
||||
bformat=getchar();
|
||||
if(dir<=0) {
|
||||
if((addr1=addr2-(psize-1))<=zero)
|
||||
addr1=zero+1;
|
||||
if(dir==0){
|
||||
display(bformat);
|
||||
puts("^^^^^");
|
||||
addr2++;
|
||||
}
|
||||
}
|
||||
if (dir>=0) {
|
||||
addr1=addr2;
|
||||
if((addr2+=(psize-1))>dol)
|
||||
addr2=dol;
|
||||
}
|
||||
display(bformat);
|
||||
if(dir==0)
|
||||
dot=olddot;
|
||||
}
|
||||
void
|
||||
delete()
|
||||
{
|
||||
register *a1, *a2, *a3;
|
||||
setdot();
|
||||
a1 = addr1;
|
||||
a2 = addr2;
|
||||
if(a1==zero) {
|
||||
if(a2!=zero)
|
||||
*(a1++);
|
||||
else
|
||||
return; /* 0,$d on an empty buffer */
|
||||
}
|
||||
*(a2++);
|
||||
a3 = lastdol;
|
||||
lock++;
|
||||
dol -= a2 - a1;
|
||||
lastdol -= a2 - a1;
|
||||
fixbufs(a1-a2);
|
||||
do
|
||||
*a1++ = *a2++;
|
||||
while (a2<=a3);
|
||||
a1 = addr1;
|
||||
if (a1 > dol)
|
||||
a1 = dol;
|
||||
dot = a1;
|
||||
unlock();
|
||||
modified();
|
||||
}
|
||||
allnums()
|
||||
{
|
||||
register int i;
|
||||
register char *p;
|
||||
setdot();
|
||||
for(i=0; i<NBUFS; i++){
|
||||
p = string[i].str;
|
||||
if(*p!='\0' && alldigs(p)){
|
||||
putct(bname[i]);
|
||||
puts(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
numcom(z)
|
||||
{
|
||||
register n;
|
||||
register struct string *sp;
|
||||
register char *l;
|
||||
char c;
|
||||
int numeric;
|
||||
extern char digits[]; /* defined in getchar.c = "0123456789" */
|
||||
|
||||
/*
|
||||
* Must generate error if attempt is made to do arithmetic on
|
||||
* a register which is not numeric; this is done by remembering
|
||||
* (via `numeric') whether the initial string was numeric or not.
|
||||
*/
|
||||
sp = &string[z];
|
||||
numeric = alldigs(sp->str);
|
||||
n = my_atoi(sp->str);
|
||||
for(;;){
|
||||
switch(c=getchar()){
|
||||
default:
|
||||
goto Done;
|
||||
case ':':
|
||||
n=getsigned();
|
||||
goto Not_numeric;
|
||||
case 'a':
|
||||
n=addr2-zero;
|
||||
goto Not_numeric;
|
||||
case 'r':
|
||||
if(z+1>=NBUFS)
|
||||
error('z');
|
||||
n = addr1-zero;
|
||||
numset(z+1, addr2-zero);
|
||||
goto Not_numeric;
|
||||
case 'n':
|
||||
nonzero();
|
||||
l = getline(*addr2,linebuf);
|
||||
do; while(*l++);
|
||||
n = l - linebuf - 1;
|
||||
goto Not_numeric;
|
||||
case 'P':
|
||||
n = getpid();
|
||||
Not_numeric:
|
||||
numeric = TRUE; /* It's numeric now! */
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if(n<0)
|
||||
putchar('-');
|
||||
putdn(my_abs(n));
|
||||
goto Numeric;
|
||||
case '+':
|
||||
n += getsigned();
|
||||
goto Numeric;
|
||||
case '-':
|
||||
n -= getsigned();
|
||||
goto Numeric;
|
||||
case '*':
|
||||
n *= getsigned();
|
||||
goto Numeric;
|
||||
case '/':
|
||||
n /= getsigned();
|
||||
goto Numeric;
|
||||
case '%':
|
||||
n %= getsigned();
|
||||
goto Numeric;
|
||||
case '!':
|
||||
if(posn(c=getchar(), "=><")<0)
|
||||
error('#');
|
||||
settruth(condition(n, getsigned(), c, 1));
|
||||
goto Numeric;
|
||||
case '<':
|
||||
case '>':
|
||||
case '=':
|
||||
settruth(condition(n, getsigned(), c, 0));
|
||||
Numeric:
|
||||
if(numeric == FALSE)
|
||||
error('#');
|
||||
break;
|
||||
}
|
||||
}
|
||||
Done:
|
||||
ungetchar(c);
|
||||
numset(z, n);
|
||||
}
|
||||
condition(n, m, cond, negate)
|
||||
register n, m, cond, negate;
|
||||
{
|
||||
int retval;
|
||||
if(cond=='=')
|
||||
retval = (n==m);
|
||||
else if(cond=='<')
|
||||
retval = (n<m);
|
||||
else if(cond=='>')
|
||||
retval = (n>m);
|
||||
else
|
||||
error("!");
|
||||
return(negate^retval);
|
||||
}
|
||||
numset(z, n)
|
||||
register z;
|
||||
register n;
|
||||
{
|
||||
startstring();
|
||||
numbuild(n);
|
||||
setstring(z);
|
||||
}
|
||||
numbuild(n)
|
||||
register n;
|
||||
{
|
||||
register i;
|
||||
if(n<0){
|
||||
addstring('-');
|
||||
n = -n;
|
||||
}
|
||||
i = n/10;
|
||||
if(i)
|
||||
numbuild(i);
|
||||
addstring(n%10+'0');
|
||||
}
|
||||
void
|
||||
strcom(z)
|
||||
{
|
||||
register char *q;
|
||||
register n;
|
||||
int getchar();
|
||||
register struct string *sp;
|
||||
int cond, c, negate;
|
||||
setdot();
|
||||
sp = &string[z];
|
||||
if(nextchar()=='#'){
|
||||
getchar(); /* eat the '#' */
|
||||
numcom(z);
|
||||
return;
|
||||
}
|
||||
negate=FALSE;
|
||||
switch(cond=getchar()){
|
||||
default:
|
||||
error('x');
|
||||
case 'p':
|
||||
puts(sp->str);
|
||||
break;
|
||||
case 'l':
|
||||
putl(sp->str);
|
||||
break;
|
||||
case ':':
|
||||
startstring();
|
||||
for(;;){
|
||||
c = getquote("\n", getchar);
|
||||
if(c=='\n'){
|
||||
setstring(z);
|
||||
return;
|
||||
}
|
||||
addstring(c&0177);
|
||||
}
|
||||
case '\'':
|
||||
startstring();
|
||||
dupstring(getname('z'));
|
||||
setstring(z);
|
||||
break;
|
||||
case '.':
|
||||
nonzero();
|
||||
startstring();
|
||||
copystring(getline(*addr2, linebuf));
|
||||
setstring(z);
|
||||
break;
|
||||
case '/':
|
||||
nonzero();
|
||||
compile('/');
|
||||
if(execute(addr2)==0){
|
||||
clearstring(z);
|
||||
settruth(FALSE);
|
||||
return;
|
||||
}
|
||||
q = loc1;
|
||||
startstring();
|
||||
while(q < loc2)
|
||||
addstring(*q++);
|
||||
setstring(z);
|
||||
settruth(TRUE);
|
||||
return;
|
||||
case 's':
|
||||
substitute(stackp!=&stack[0], z);
|
||||
return;
|
||||
case '+':
|
||||
strinc(z, getsigned());
|
||||
break;
|
||||
case '-':
|
||||
strinc(z, -getsigned());
|
||||
break;
|
||||
case 'n':
|
||||
setcount(sp->len);
|
||||
break;
|
||||
case 'e':
|
||||
startstring();
|
||||
addstring(lasterr);
|
||||
setstring(z);
|
||||
break;
|
||||
case '(':
|
||||
n=getsigned();
|
||||
if(my_abs(n) > sp->len)
|
||||
error('[');
|
||||
if(n>=0){
|
||||
sp->str += n;
|
||||
sp->len -= n;
|
||||
}
|
||||
else{
|
||||
sp->str += sp->len+n;
|
||||
sp->len = -n;
|
||||
}
|
||||
break;
|
||||
case ')':
|
||||
n=getsigned();
|
||||
if(my_abs(n) > sp->len)
|
||||
error('[');
|
||||
if(n<0){
|
||||
sp->str[sp->len+n]='\0';
|
||||
sp->len += n;
|
||||
} else if(n==0)
|
||||
clearstring(z);
|
||||
else {
|
||||
sp->str[n]='\0';
|
||||
sp->len=n;
|
||||
}
|
||||
break;
|
||||
case '[':
|
||||
cpstr(sp->str, linebuf);
|
||||
loc2=0; /* Tell execute that it's already in linebuf */
|
||||
compile(getchar());
|
||||
if(execute(0)==0){
|
||||
settruth(FALSE);
|
||||
setcount(-1);
|
||||
} else {
|
||||
settruth(TRUE);
|
||||
setcount(loc2-linebuf-1);
|
||||
}
|
||||
return;
|
||||
case 'C':
|
||||
startstring();
|
||||
clean(z);
|
||||
setstring(z);
|
||||
break;
|
||||
case '!':
|
||||
if(posn(cond=getchar(), "=><")<0)
|
||||
error('x');
|
||||
negate=TRUE;
|
||||
case '=':
|
||||
case '<':
|
||||
case '>':
|
||||
settruth(FALSE);
|
||||
q=sp->str;
|
||||
for(;;){
|
||||
c=getchar();
|
||||
if(c=='\n' && *q==0){
|
||||
if(cond == '=')
|
||||
settruth(!negate);
|
||||
return;
|
||||
}
|
||||
if(*q++!=c){
|
||||
if(cond=='<')
|
||||
settruth(negate ^ (*--q < c));
|
||||
else if(cond=='>')
|
||||
settruth(negate ^ (*--q > c));
|
||||
while(c!='\n')
|
||||
c=getchar();
|
||||
return;
|
||||
}
|
||||
}
|
||||
case '{':
|
||||
q = genbuf;
|
||||
while(posn(c=getchar(), "} \t\n")<0 && c!=EOF)
|
||||
*q++ = c;
|
||||
*q = '\0';
|
||||
if((q=getenv(genbuf)) == 0)
|
||||
clearstring(z);
|
||||
else{
|
||||
startstring();
|
||||
copystring(q);
|
||||
setstring(z);
|
||||
}
|
||||
break;
|
||||
/* end of switch */
|
||||
}
|
||||
}
|
||||
strinc(z, n)
|
||||
{
|
||||
register char *q;
|
||||
q=string[z].str;
|
||||
while(*q)
|
||||
*q++ += n;
|
||||
}
|
||||
locn(ap, aq)
|
||||
char *ap, *aq;
|
||||
{
|
||||
register char *p, *q, *lastq;
|
||||
p=ap;
|
||||
q=aq;
|
||||
for(;;){
|
||||
lastq=q;
|
||||
while(*p==*q){
|
||||
if(*p++==0 || *p==0)
|
||||
return(lastq - aq);
|
||||
q++;
|
||||
}
|
||||
if(*q==0)
|
||||
return(-1);
|
||||
p=ap;
|
||||
q=lastq+1;
|
||||
}
|
||||
}
|
||||
#define EMPTY (TRUE+1) /* ==> ignore this buf in G/V */
|
||||
ncom(c)
|
||||
{
|
||||
register struct buffer *bufp;
|
||||
struct buffer *stop;
|
||||
register char *f, *lp;
|
||||
int globflag;
|
||||
|
||||
setnoaddr();
|
||||
syncbuf();
|
||||
globflag = FALSE;
|
||||
if(c == 'f')
|
||||
stop = bufp = curbuf;
|
||||
else{
|
||||
bufp = buffer;
|
||||
stop = buffer+NBUFS-1;
|
||||
if(c=='G')
|
||||
globflag = TRUE;
|
||||
}
|
||||
do{
|
||||
lp = linebuf;
|
||||
f = string[FILE(bufp-buffer)].str;
|
||||
if(c=='N' && (!bufp->cflag || *f==0))
|
||||
continue;
|
||||
if(bufp->dol==bufp->zero && *f=='\0'){
|
||||
if(globflag)
|
||||
bufp->gmark = EMPTY;
|
||||
if(globflag || bufp!=curbuf)
|
||||
continue;
|
||||
}
|
||||
*lp++ = bname[bufp-buffer];
|
||||
*lp++ = (bufp->cflag) ? '\'' : ' ';
|
||||
*lp++ = (bufp==curbuf) ? '.' : ' ';
|
||||
numset(FILEBUF, bufp->dol-bufp->zero);
|
||||
cpstr(string[FILEBUF].str, lp);
|
||||
lp += string[FILEBUF].len;
|
||||
f = string[FILE(bufp-buffer)].str; /* in case strings got g.c.'d */
|
||||
if(*f)
|
||||
*lp++ = '\t';
|
||||
if(globflag){
|
||||
cpstr(f, lp);
|
||||
loc2 = 0; /* ==> we are about to search for 1st time */
|
||||
bufp->gmark = execute((int *)0);
|
||||
} else {
|
||||
*lp = '\0';
|
||||
lp = linebuf;
|
||||
while(*lp)
|
||||
putchar(*lp++);
|
||||
putl(f);
|
||||
}
|
||||
}while(bufp++!=stop);
|
||||
}
|
||||
allstrs()
|
||||
{
|
||||
register int i;
|
||||
char *p;
|
||||
setdot();
|
||||
for(i=0; i<NBUFS; i++){
|
||||
p=string[i].str;
|
||||
if(*p!=0){
|
||||
putct(bname[i]);
|
||||
putl(p);
|
||||
}
|
||||
}
|
||||
putct('P');
|
||||
putl(string[SAVPAT].str);
|
||||
putct('R');
|
||||
putl(string[SAVRHS].str);
|
||||
if(*string[BROWSE].str) {
|
||||
putct('B');
|
||||
putl(string[BROWSE].str);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* clean (string) to support zaC
|
||||
* strips leading and trailing white space from a string
|
||||
* and replaces interior white space by single blanks
|
||||
*/
|
||||
clean(z) {
|
||||
register char *s;
|
||||
register char *d;
|
||||
register char c;
|
||||
d = genbuf;
|
||||
for (s = string[z].str; (c = *s) == ' ' || c == '\t'; s++);
|
||||
while (c = *s++) {
|
||||
if (c == ' ' || c == '\t') {
|
||||
*d++ = ' ';
|
||||
while(*s == ' ' || *s == '\t')
|
||||
s++;
|
||||
} else {
|
||||
*d++ = c;
|
||||
}
|
||||
}
|
||||
while (d > genbuf && d[-1] == ' ')
|
||||
--d;
|
||||
*d = 0;
|
||||
copystring(genbuf);
|
||||
}
|
||||
378
visual-studio-1994/getchar.c
Normal file
378
visual-studio-1994/getchar.c
Normal file
@@ -0,0 +1,378 @@
|
||||
/*% cc -c -O %
|
||||
*/
|
||||
#include "vars.h"
|
||||
char digits[] = "0123456789"; /* getnum() & my_atoi() work even on non-ASCII systems */
|
||||
getnum()
|
||||
{
|
||||
register n, i;
|
||||
n=0;
|
||||
while((i=posn(nextchar(), digits)) >= 0){
|
||||
getchar();
|
||||
n = n*10 + i;
|
||||
}
|
||||
return(n);
|
||||
}
|
||||
|
||||
getsigned(){
|
||||
register sign;
|
||||
if(nextchar()=='-'){
|
||||
getchar();
|
||||
sign = -1;
|
||||
}
|
||||
else
|
||||
sign = 1;
|
||||
return(getnum()*sign);
|
||||
}
|
||||
|
||||
my_atoi(s)
|
||||
register char *s;
|
||||
{
|
||||
register n, i;
|
||||
int sign;
|
||||
|
||||
n = 0;
|
||||
sign = 1;
|
||||
if(*s == '-'){
|
||||
sign = -1;
|
||||
s++;
|
||||
}
|
||||
while(*s){
|
||||
i = posn(*s++, digits);
|
||||
if(i < 0)
|
||||
return(sign*n); /* error handling done elsewhere */
|
||||
n = n*10 + i;
|
||||
}
|
||||
return(sign*n);
|
||||
}
|
||||
|
||||
alldigs(s)
|
||||
register char *s;
|
||||
{
|
||||
if(*s == '-')
|
||||
s++;
|
||||
while(*s)
|
||||
if(posn(*s++, digits) < 0)
|
||||
return(FALSE);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
char bname[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~";
|
||||
getname(e)
|
||||
{
|
||||
int getc();
|
||||
return(getnm(e, getc));
|
||||
}
|
||||
getaz(e)
|
||||
{
|
||||
int getchar();
|
||||
return(getnm(e, getchar));
|
||||
}
|
||||
getnm(e, f)
|
||||
int (*f)();
|
||||
{
|
||||
register i;
|
||||
i = posn((*f)(), bname);
|
||||
if(i < 0)
|
||||
error(e);
|
||||
return(i);
|
||||
}
|
||||
char special[] = "xgBbBcfFlprzN\"\\'";
|
||||
int qcount;
|
||||
int afterq;
|
||||
getchar()
|
||||
{
|
||||
register c;
|
||||
register peek;
|
||||
|
||||
peek=peekc;
|
||||
c=getc();
|
||||
if(tflag && !peek && stackp!= &stack[0]){
|
||||
if(c==EOF)
|
||||
puts("[*EOF*]");
|
||||
else
|
||||
putchar(c);
|
||||
}
|
||||
return(c);
|
||||
}
|
||||
getc()
|
||||
{
|
||||
register c;
|
||||
register struct buffer *bufp;
|
||||
register struct stack *sp;
|
||||
int *lp;
|
||||
int numeric;
|
||||
int delta;
|
||||
int literal;
|
||||
int i;
|
||||
char *p;
|
||||
static char bufbuf[LBSIZE];
|
||||
|
||||
if(c = peekc) /* assignment = */
|
||||
peekc = 0;
|
||||
else if(qcount) {
|
||||
--qcount;
|
||||
c = '\\';
|
||||
} else if(c = afterq) /* assignment = */
|
||||
afterq = 0;
|
||||
else {
|
||||
for(;;popinp()){
|
||||
sp=stackp;
|
||||
switch(sp->type){
|
||||
case TTY:
|
||||
case XTTY:
|
||||
if(cprflag && sp == &stack[0] &&
|
||||
lastttyc == '\n')
|
||||
write(2, "*", 1);
|
||||
c = ttyc();
|
||||
if(sp != &stack[0] && c == '\n') {
|
||||
if(stackp->type == TTY)
|
||||
continue;
|
||||
else /* XTTY */
|
||||
popinp();
|
||||
}
|
||||
break;
|
||||
case GLOB:
|
||||
if ((c = *stackp->globp++) == 0){
|
||||
popinp();
|
||||
c = EOF;
|
||||
}
|
||||
break;
|
||||
case STRING:
|
||||
case BFILEN:
|
||||
case PAT:
|
||||
case RHS:
|
||||
case BRWS:
|
||||
case FILEN:
|
||||
if(string[sp->strname].len < sp->charno){
|
||||
c=EOF;
|
||||
continue;
|
||||
}
|
||||
c=string[sp->strname].str[sp->charno++];
|
||||
if(c==0)
|
||||
continue;
|
||||
break;
|
||||
case BUF:
|
||||
bufp=sp->bufptr;
|
||||
if(bufp==curbuf)
|
||||
syncbuf();
|
||||
lp=bufp->zero+sp->lineno;
|
||||
if(bbempty){
|
||||
if(lp>bufp->dol)
|
||||
continue;
|
||||
p = getline(*lp, bufbuf);
|
||||
bbempty = FALSE;
|
||||
for(i=sp->charno; i-- && *p; p++)
|
||||
;
|
||||
}else
|
||||
p = bufbuf+sp->charno;
|
||||
sp->charno++;
|
||||
if((c = *p) == '\0'){
|
||||
/*
|
||||
* Leave the last newline in the buffer out.
|
||||
*/
|
||||
bbempty = TRUE;
|
||||
if(lp>=bufp->dol)
|
||||
continue;
|
||||
sp->lineno++;
|
||||
sp->charno=0;
|
||||
c='\n';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
literal = FALSE;
|
||||
if(c == '\\' && !stackp->literal){
|
||||
Getc:
|
||||
c = getc();
|
||||
i = posn(c, cspec);
|
||||
switch(i) {
|
||||
case LITERAL:
|
||||
if(posn(peekc=getc(), "bfFlprz!") >= 0)
|
||||
literal = TRUE;
|
||||
goto Getc; /* business as usual... */
|
||||
case QUOTE:
|
||||
c = '\\';
|
||||
break;
|
||||
case NEWL:
|
||||
c = '\n';
|
||||
break;
|
||||
case STRING:
|
||||
delta = 0;
|
||||
numeric = 0;
|
||||
c = getc();
|
||||
if(c == '#'){
|
||||
numeric++;
|
||||
c = getc();
|
||||
}
|
||||
if(c == '+' || c == '-'){
|
||||
delta = 1;
|
||||
if(c == '-')
|
||||
delta = -delta;
|
||||
c=getc();
|
||||
}
|
||||
ungetchar(c);
|
||||
c = getname('z');
|
||||
if(delta){
|
||||
if(numeric){
|
||||
if(!alldigs(string[c].str))
|
||||
error('#');
|
||||
numset(c, my_atoi(string[c].str)+delta);
|
||||
} else
|
||||
strinc(c, delta);
|
||||
}
|
||||
pushinp(i, c, literal);
|
||||
literal = FALSE;
|
||||
c=getc();
|
||||
break;
|
||||
case BUF:
|
||||
case BFILEN:
|
||||
c = getname(cspec[i]);
|
||||
if(i == BUF)
|
||||
bbempty = TRUE;
|
||||
/* fall through */
|
||||
case TTY:
|
||||
case FILEN:
|
||||
case PAT:
|
||||
case RHS:
|
||||
pushinp(i, c, literal);
|
||||
literal = FALSE;
|
||||
/* fall through */
|
||||
case NOTHING:
|
||||
c = getc();
|
||||
break;
|
||||
case CURBN:
|
||||
c = bname[curbuf-buffer];
|
||||
break;
|
||||
case BACKSLASH:
|
||||
qcount++;
|
||||
break;
|
||||
default:
|
||||
afterq = c;
|
||||
c = '\\';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastc = c;
|
||||
return(c);
|
||||
}
|
||||
ttyc()
|
||||
{
|
||||
char c;
|
||||
initflag = 0;
|
||||
if(read(0, &c, 1) > 0)
|
||||
lastttyc = c&0177;
|
||||
else
|
||||
lastttyc = EOF;
|
||||
return(lastttyc);
|
||||
}
|
||||
posn(c, s)
|
||||
register char c;
|
||||
register char *s;
|
||||
{
|
||||
register char *is;
|
||||
is = s;
|
||||
while(*s)
|
||||
if(c == *s++)
|
||||
return(s - is - 1);
|
||||
return(-1);
|
||||
}
|
||||
pushinp(type, arg, literal)
|
||||
register arg;
|
||||
{
|
||||
register struct stack *s;
|
||||
|
||||
s = ++stackp;
|
||||
if(s == stack+STACKSIZE)
|
||||
error('l');
|
||||
stackp->literal = literal;
|
||||
if(tflag){
|
||||
putchar('[');
|
||||
if(literal)
|
||||
putchar('\'');
|
||||
putchar(cspec[type]);
|
||||
}
|
||||
s->type=type;
|
||||
s->charno = 0;
|
||||
switch(type){
|
||||
case BFILEN:
|
||||
s->strname = FILE(arg);
|
||||
break;
|
||||
case STRING:
|
||||
s->strname = arg;
|
||||
break;
|
||||
case FILEN:
|
||||
s->strname = savedfile;
|
||||
break;
|
||||
case PAT:
|
||||
s->strname = SAVPAT;
|
||||
break;
|
||||
case RHS:
|
||||
s->strname = SAVRHS;
|
||||
break;
|
||||
case BRWS:
|
||||
s->strname = BROWSE;
|
||||
break;
|
||||
case BUF:
|
||||
if((s->bufptr=buffer+arg) == curbuf && appflag)
|
||||
error('\\');
|
||||
s->lineno=1;
|
||||
break;
|
||||
case GLOB:
|
||||
s->globp = (char *)arg;
|
||||
break;
|
||||
}
|
||||
if(tflag){
|
||||
if(type==BFILEN || type==STRING || type==BUF)
|
||||
putchar(bname[arg]);
|
||||
putchar('=');
|
||||
}
|
||||
}
|
||||
popinp(){
|
||||
if(stackp->type == BUF)
|
||||
bbempty = TRUE;
|
||||
if(tflag){
|
||||
putchar(']');
|
||||
flush();
|
||||
}
|
||||
--stackp;
|
||||
}
|
||||
gettty()
|
||||
{
|
||||
register c, gf;
|
||||
register char *p;
|
||||
p = linebuf;
|
||||
gf = stackp->type;
|
||||
while((c=getchar()) != '\n') {
|
||||
if (c==EOF) {
|
||||
if (gf == GLOB)
|
||||
peekc=c;
|
||||
return(c);
|
||||
}
|
||||
if (c == 0)
|
||||
continue;
|
||||
*p++ = c;
|
||||
if (p >= &linebuf[LBSIZE-2])
|
||||
error('l');
|
||||
}
|
||||
*p++ = 0;
|
||||
if (!oneline && linebuf[0]=='.' && linebuf[1]==0)
|
||||
return(EOF);
|
||||
return(0);
|
||||
}
|
||||
getquote(p, f)
|
||||
register char *p;
|
||||
int (*f)();
|
||||
{
|
||||
register c;
|
||||
c = (*f)();
|
||||
if(c == '\\') {
|
||||
if(peekc == 0)
|
||||
nextchar(); /* prime peekc */
|
||||
if(posn(peekc, p) >= 0) {
|
||||
c = peekc | 0200;
|
||||
(*f)(); /* clear peekc */
|
||||
}
|
||||
}
|
||||
return(c);
|
||||
}
|
||||
184
visual-studio-1994/misc.c
Normal file
184
visual-studio-1994/misc.c
Normal file
@@ -0,0 +1,184 @@
|
||||
/*% cc -c -O %
|
||||
*/
|
||||
#include "vars.h"
|
||||
#define SIGINT 2
|
||||
bufinit(n)
|
||||
int *n;
|
||||
{
|
||||
struct buffer *bufp;
|
||||
register *fend;
|
||||
fend=n;
|
||||
for(bufp=buffer;bufp!=buffer+NBUFS;bufp++){
|
||||
bufp->zero=fend;
|
||||
bufp->dot=fend;
|
||||
bufp->dol=fend;
|
||||
bufp->cflag = FALSE;
|
||||
}
|
||||
}
|
||||
chngbuf(bb)
|
||||
int bb;
|
||||
{
|
||||
syncbuf();
|
||||
newbuf(bb);
|
||||
savedfile = FILE(curbuf-buffer);
|
||||
}
|
||||
newbuf(bb){
|
||||
curbuf = buffer+bb;
|
||||
zero=curbuf->zero;
|
||||
dot=curbuf->dot;
|
||||
dol=curbuf->dol;
|
||||
cflag = curbuf->cflag;
|
||||
}
|
||||
fixbufs(n)
|
||||
register n;
|
||||
{
|
||||
register struct buffer *bufp;
|
||||
lock++;
|
||||
for(bufp=curbuf+1;bufp!=buffer+NBUFS;bufp++){
|
||||
bufp->zero+=n;
|
||||
bufp->dot+=n;
|
||||
bufp->dol+=n;
|
||||
}
|
||||
unlock();
|
||||
}
|
||||
syncbuf()
|
||||
{
|
||||
/* curbuf->zero = zero; /* we never assign to it, so needn't save */
|
||||
curbuf->dot=dot;
|
||||
curbuf->dol=dol;
|
||||
curbuf->cflag = cflag!=FALSE; /* Normalize to fit in a char */
|
||||
}
|
||||
error(code)
|
||||
{
|
||||
extern savint; /* error during a ! > < | ?? */
|
||||
unlock();
|
||||
if(code){
|
||||
for(;stackp != stack ;--stackp)
|
||||
if(stackp->type == BUF || stackp->type == STRING){
|
||||
putchar('?');
|
||||
if(stackp->type == BUF){
|
||||
putchar('b');
|
||||
putchar(bname[stackp->bufptr - buffer]);
|
||||
putlong((long)stackp->lineno);
|
||||
putchar('.');
|
||||
}else{
|
||||
putchar('z');
|
||||
putchar(bname[stackp->lineno]);
|
||||
}
|
||||
putlong((long)stackp->charno);
|
||||
putchar(' ');
|
||||
}
|
||||
putchar('?');
|
||||
putchar(lasterr=(code&~FILERR));
|
||||
if(code&FILERR){
|
||||
putchar(' ');
|
||||
putl(string[FILEBUF].str);
|
||||
} else
|
||||
putchar('\n');
|
||||
}
|
||||
if(eflag && code)
|
||||
exit(code);
|
||||
nestlevel = 0;
|
||||
listf = FALSE;
|
||||
gflag = FALSE;
|
||||
biggflag = FALSE;
|
||||
stackp = stack;
|
||||
peekc = 0;
|
||||
if(code && code!='?'){ /* if '?', system cleared tty input buf */
|
||||
while(lastttyc!='\n' && lastttyc!=EOF){
|
||||
getchar();
|
||||
}
|
||||
}
|
||||
lseek(0, 0L, 2);
|
||||
if (io > 0) {
|
||||
close(io);
|
||||
io = -1;
|
||||
cflag = TRUE; /* well, maybe not, but better be safe */
|
||||
}
|
||||
appflag=0;
|
||||
if(savint>=0){
|
||||
signal(SIGINT, savint);
|
||||
savint= -1;
|
||||
}
|
||||
reset();
|
||||
}
|
||||
init()
|
||||
{
|
||||
register char *p;
|
||||
register pid;
|
||||
lock++;
|
||||
close(tfile);
|
||||
tfname = "c:\\tmp\\qxxxxx";
|
||||
pid = getpid() & 0x7fff; /* DPM 95/11/07 Windows95 pids are big */
|
||||
for (p = &tfname[11]; p > &tfname[6];) {
|
||||
*--p = (pid%10) + '0';
|
||||
pid /= 10;
|
||||
}
|
||||
close(creat(tfname, 0600));
|
||||
tfile = open(tfname, 2);
|
||||
tfile2 = open(tfname, 2);
|
||||
/*
|
||||
* unlink temp file - D. P. Mitchell 85/01/04
|
||||
*/
|
||||
/* unlink(tfname); */
|
||||
/* DPM 90/12/22 (not supported in some UNIX dialects
|
||||
ioctl(tfile, FIOCLEX, 0);
|
||||
ioctl(tfile2, FIOCLEX, 0);
|
||||
*/
|
||||
brk(fendcore);
|
||||
bufinit(fendcore);
|
||||
newbuf(0);
|
||||
lastdol=dol;
|
||||
endcore = fendcore - 2;
|
||||
stackp=stack;
|
||||
stackp->type=TTY;
|
||||
unlock();
|
||||
}
|
||||
comment()
|
||||
{
|
||||
register c, mesg;
|
||||
|
||||
c = getchar();
|
||||
mesg = 0;
|
||||
if(c == '\"') {
|
||||
mesg++;
|
||||
c = getchar();
|
||||
}
|
||||
while(c != '\n' && c != '\"') {
|
||||
if(mesg)
|
||||
putchar(c);
|
||||
c = getchar();
|
||||
}
|
||||
if(mesg) {
|
||||
if(c == '\n')
|
||||
putchar(c);
|
||||
flush();
|
||||
}
|
||||
}
|
||||
my_abs(int n)
|
||||
{
|
||||
return(n<0?-n:n);
|
||||
}
|
||||
/*
|
||||
* Slow, but avoids garbage collection
|
||||
*/
|
||||
settruth(t)
|
||||
register t;
|
||||
{
|
||||
if(my_atoi(string[TRUTH].str) != t)
|
||||
numset(TRUTH, t);
|
||||
}
|
||||
setcount(c)
|
||||
register c;
|
||||
{
|
||||
if(my_atoi(string[COUNT].str) != c)
|
||||
numset(COUNT, c);
|
||||
}
|
||||
truth(){
|
||||
return(my_atoi(string[TRUTH].str) != FALSE);
|
||||
}
|
||||
modified(){
|
||||
cflag=TRUE;
|
||||
eok=FALSE;
|
||||
qok=FALSE;
|
||||
}
|
||||
Reference in New Issue
Block a user