ivtools-patch Mailing List for ivtools (Page 5)
Brought to you by:
johnston
You can subscribe to this list here.
| 1999 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2000 |
Jan
(17) |
Feb
(14) |
Mar
(7) |
Apr
(7) |
May
(20) |
Jun
(18) |
Jul
(5) |
Aug
(9) |
Sep
(4) |
Oct
(2) |
Nov
(2) |
Dec
(1) |
| 2001 |
Jan
(3) |
Feb
(2) |
Mar
(5) |
Apr
(7) |
May
(9) |
Jun
(15) |
Jul
(10) |
Aug
(2) |
Sep
(10) |
Oct
(15) |
Nov
(14) |
Dec
(2) |
| 2002 |
Jan
(8) |
Feb
(13) |
Mar
(10) |
Apr
(3) |
May
(2) |
Jun
(7) |
Jul
(5) |
Aug
(3) |
Sep
(1) |
Oct
(1) |
Nov
(10) |
Dec
|
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
(4) |
Nov
(1) |
Dec
(3) |
| 2004 |
Jan
(2) |
Feb
(6) |
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2005 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
(4) |
Nov
(1) |
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
| 2010 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ivt...@li...> - 2001-10-12 21:59:03
|
Patch: ivtools-011012-johnston-075
For: ivtools-0.9.6
Author: joh...@us...
Subject: finalize stream stuff
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- finalize stream stuff, and some other minor interpreter-related changes.
Index: ComTerp/assignfunc.c
diff -c ComTerp/assignfunc.c:1.1 ComTerp/assignfunc.c:1.2
*** ComTerp/assignfunc.c:1.1 Thu Jan 4 15:31:42 2001
--- src/ComTerp/assignfunc.c Fri Oct 12 14:56:20 2001
***************
*** 92,101 ****
push_stack(*(ComValue*)op1val);
delete (ComValue*)op1val;
push_stack(operand2);
- push_funcstate(2,0);
static ModFunc* subfunc = new ModFunc(comterp());
! subfunc->execute();
! pop_funcstate();
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
--- 92,99 ----
push_stack(*(ComValue*)op1val);
delete (ComValue*)op1val;
push_stack(operand2);
static ModFunc* subfunc = new ModFunc(comterp());
! subfunc->exec(2,0);
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
***************
*** 125,134 ****
push_stack(*(ComValue*)op1val);
delete (ComValue*)op1val;
push_stack(operand2);
- push_funcstate(2,0);
static MpyFunc* subfunc = new MpyFunc(comterp());
! subfunc->execute();
! pop_funcstate();
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
--- 123,130 ----
push_stack(*(ComValue*)op1val);
delete (ComValue*)op1val;
push_stack(operand2);
static MpyFunc* subfunc = new MpyFunc(comterp());
! subfunc->exec(2,0);
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
***************
*** 158,167 ****
push_stack(*(ComValue*)op1val);
delete (ComValue*)op1val;
push_stack(operand2);
- push_funcstate(2,0);
static AddFunc* subfunc = new AddFunc(comterp());
! subfunc->execute();
! pop_funcstate();
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
--- 154,161 ----
push_stack(*(ComValue*)op1val);
delete (ComValue*)op1val;
push_stack(operand2);
static AddFunc* subfunc = new AddFunc(comterp());
! subfunc->exec(2,0);
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
***************
*** 191,200 ****
push_stack(*(ComValue*)op1val);
delete (ComValue*)op1val;
push_stack(operand2);
- push_funcstate(2,0);
static SubFunc* subfunc = new SubFunc(comterp());
! subfunc->execute();
! pop_funcstate();
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
--- 185,192 ----
push_stack(*(ComValue*)op1val);
delete (ComValue*)op1val;
push_stack(operand2);
static SubFunc* subfunc = new SubFunc(comterp());
! subfunc->exec(2,0);
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
***************
*** 224,233 ****
push_stack(*(ComValue*)op1val);
delete (ComValue*)op1val;
push_stack(operand2);
- push_funcstate(2,0);
static DivFunc* subfunc = new DivFunc(comterp());
! subfunc->execute();
! pop_funcstate();
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
--- 216,223 ----
push_stack(*(ComValue*)op1val);
delete (ComValue*)op1val;
push_stack(operand2);
static DivFunc* subfunc = new DivFunc(comterp());
! subfunc->exec(2,0);
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
***************
*** 256,265 ****
one.type(ComValue::IntType);
one.int_ref() = 1;
push_stack(one);
- push_funcstate(2,0);
static AddFunc* subfunc = new AddFunc(comterp());
! subfunc->execute();
! pop_funcstate();
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
--- 246,253 ----
one.type(ComValue::IntType);
one.int_ref() = 1;
push_stack(one);
static AddFunc* subfunc = new AddFunc(comterp());
! subfunc->exec(2,0);
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
***************
*** 289,298 ****
one.type(ComValue::IntType);
one.int_ref() = 1;
push_stack(one);
- push_funcstate(2,0);
static AddFunc* subfunc = new AddFunc(comterp());
! subfunc->execute();
! pop_funcstate();
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*(ComValue*)op1val);
--- 277,284 ----
one.type(ComValue::IntType);
one.int_ref() = 1;
push_stack(one);
static AddFunc* subfunc = new AddFunc(comterp());
! subfunc->exec(2,0);
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*(ComValue*)op1val);
***************
*** 324,333 ****
one.type(ComValue::IntType);
one.int_ref() = 1;
push_stack(one);
- push_funcstate(2,0);
static SubFunc* subfunc = new SubFunc(comterp());
! subfunc->execute();
! pop_funcstate();
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
--- 310,317 ----
one.type(ComValue::IntType);
one.int_ref() = 1;
push_stack(one);
static SubFunc* subfunc = new SubFunc(comterp());
! subfunc->exec(2,0);
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*result);
***************
*** 357,366 ****
one.type(ComValue::IntType);
one.int_ref() = 1;
push_stack(one);
- push_funcstate(2,0);
static SubFunc* subfunc = new SubFunc(comterp());
! subfunc->execute();
! pop_funcstate();
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*(ComValue*)op1val);
--- 341,348 ----
one.type(ComValue::IntType);
one.int_ref() = 1;
push_stack(one);
static SubFunc* subfunc = new SubFunc(comterp());
! subfunc->exec(2,0);
ComValue* result = new ComValue(pop_stack());
_comterp->localtable()->insert(operand1.symbol_val(), result);
push_stack(*(ComValue*)op1val);
Index: ComTerp/comvalue.c
diff -c ComTerp/comvalue.c:1.5 ComTerp/comvalue.c:1.6
*** ComTerp/comvalue.c:1.5 Fri Sep 28 16:00:09 2001
--- src/ComTerp/comvalue.c Fri Oct 12 14:56:21 2001
***************
*** 289,295 ****
break;
case ComValue::StreamType:
! out << "<stream:" << svp->stream_mode() << ">";
break;
case ComValue::CommandType:
--- 289,295 ----
break;
case ComValue::StreamType:
! out << "<stream:" << svp->stream_mode() << "(" << symbol_pntr(((ComFunc*)svp->stream_func())->funcid()) << ")" << ">";
break;
case ComValue::CommandType:
Index: ComTerp/iofunc.c
diff -c ComTerp/iofunc.c:1.4 ComTerp/iofunc.c:1.5
*** ComTerp/iofunc.c:1.4 Tue Jul 3 17:01:13 2001
--- src/ComTerp/iofunc.c Fri Oct 12 14:56:21 2001
***************
*** 151,159 ****
ComValue val(*avl->GetAttrVal(i));
push_stack(formatstr);
push_stack(val);
! push_funcstate(2,0);
! execute();
! pop_funcstate();
avl->Next(i);
if (!avl->Done(i)) out << "\n";
}
--- 151,157 ----
ComValue val(*avl->GetAttrVal(i));
push_stack(formatstr);
push_stack(val);
! exec(2,0);
avl->Next(i);
if (!avl->Done(i)) out << "\n";
}
Index: ComTerp/listfunc.c
diff -c ComTerp/listfunc.c:1.5 ComTerp/listfunc.c:1.6
*** ComTerp/listfunc.c:1.5 Wed Oct 10 10:14:56 2001
--- src/ComTerp/listfunc.c Fri Oct 12 14:56:21 2001
***************
*** 55,67 ****
if (strmlstv.is_false()) {
/* stream to list conversion */
- NextFunc nextfunc(comterp());
boolean done = false;
while (!done) {
! push_stack(listv);
! push_funcstate(1,0);
! nextfunc.execute();
! pop_funcstate();
AttributeValue* newval = new AttributeValue(comterp()->pop_stack());
if (newval->is_unknown()) {
done = true;
--- 55,63 ----
if (strmlstv.is_false()) {
/* stream to list conversion */
boolean done = false;
while (!done) {
! NextFunc::execute_impl(comterp(), listv);
AttributeValue* newval = new AttributeValue(comterp()->pop_stack());
if (newval->is_unknown()) {
done = true;
Index: ComTerp/statfunc.c
diff -c ComTerp/statfunc.c:1.1 ComTerp/statfunc.c:1.2
*** ComTerp/statfunc.c:1.1 Thu Jan 4 15:31:42 2001
--- src/ComTerp/statfunc.c Fri Oct 12 14:56:21 2001
***************
*** 51,67 ****
for (avl->First(it); !avl->Done(it); avl->Next(it)) {
count++;
push_stack(*avl->GetAttrVal(it));
! push_funcstate(2,0);
! addfunc.execute();
! pop_funcstate();
}
if (_meanfunc) {
DivFunc divfunc(comterp());
ComValue divisor(count, ComValue::IntType);
push_stack(divisor);
! push_funcstate(2,0);
! divfunc.execute();
! pop_funcstate();
}
} else {
push_stack(vallist);
--- 51,63 ----
for (avl->First(it); !avl->Done(it); avl->Next(it)) {
count++;
push_stack(*avl->GetAttrVal(it));
! addfunc.exec(2,0);
}
if (_meanfunc) {
DivFunc divfunc(comterp());
ComValue divisor(count, ComValue::IntType);
push_stack(divisor);
! divfunc.exec(2,0);
}
} else {
push_stack(vallist);
***************
*** 98,118 ****
/* square value and add to sum of squares */
push_stack(*avl->GetAttrVal(it));
push_stack(*avl->GetAttrVal(it));
! push_funcstate(2,0);
! mpyfunc.execute();
! pop_funcstate();
push_stack(sqrsumval);
! push_funcstate(2,0);
! addfunc.execute();
! pop_funcstate();
sqrsumval = comterp()->pop_stack();
/* add value to running sum */
push_stack(sumval);
push_stack(*avl->GetAttrVal(it));
! push_funcstate(2,0);
! addfunc.execute();
! pop_funcstate();
sumval = comterp()->pop_stack();
}
--- 94,108 ----
/* square value and add to sum of squares */
push_stack(*avl->GetAttrVal(it));
push_stack(*avl->GetAttrVal(it));
! mpyfunc.exec(2,0);
push_stack(sqrsumval);
! addfunc.exec(2,0);
sqrsumval = comterp()->pop_stack();
/* add value to running sum */
push_stack(sumval);
push_stack(*avl->GetAttrVal(it));
! addfunc.exec(2,0);
sumval = comterp()->pop_stack();
}
***************
*** 121,151 ****
push_stack(sumval);
ComValue countval(count, ComValue::IntType);
push_stack(countval);
! push_funcstate(2,0);
! divfunc.execute();
! pop_funcstate();
ComValue meanval(comterp()->pop_stack());
push_stack(meanval);
push_stack(meanval);
! push_funcstate(2,0);
! mpyfunc.execute();
! pop_funcstate();
ComValue mnsquaredval(comterp()->pop_stack());
/* subract mean squared from sum of squares to get variance */
SubFunc subfunc(comterp());
push_stack(sqrsumval);
push_stack(mnsquaredval);
! push_funcstate(2,0);
! subfunc.execute();
! pop_funcstate();
/* compute standard deviation if StdDevFunc */
if (_stddevfunc) {
SqrtFunc sqrtfunc(comterp());
! push_funcstate(1,0);
! sqrtfunc.execute();
! pop_funcstate();
}
} else {
--- 111,133 ----
push_stack(sumval);
ComValue countval(count, ComValue::IntType);
push_stack(countval);
! divfunc.exec(2,0);
ComValue meanval(comterp()->pop_stack());
push_stack(meanval);
push_stack(meanval);
! mpyfunc.exec(2,0);
ComValue mnsquaredval(comterp()->pop_stack());
/* subract mean squared from sum of squares to get variance */
SubFunc subfunc(comterp());
push_stack(sqrsumval);
push_stack(mnsquaredval);
! subfunc.exec(2,0);
/* compute standard deviation if StdDevFunc */
if (_stddevfunc) {
SqrtFunc sqrtfunc(comterp());
! sqrtfunc.exec(1,0);
}
} else {
Index: ComTerp/strmfunc.c
diff -c ComTerp/strmfunc.c:1.7 ComTerp/strmfunc.c:1.8
*** ComTerp/strmfunc.c:1.7 Thu Oct 11 15:20:29 2001
--- src/ComTerp/strmfunc.c Fri Oct 12 14:56:21 2001
***************
*** 108,114 ****
reset_stack();
/* setup for concatenation */
! static ConcatNextFunc* cnfunc = new ConcatNextFunc(comterp());
AttributeValueList* avl = new AttributeValueList();
avl->Append(new AttributeValue(operand1));
avl->Append(new AttributeValue(operand2));
--- 108,119 ----
reset_stack();
/* setup for concatenation */
! static ConcatNextFunc* cnfunc = nil;
!
! if (!cnfunc) {
! cnfunc = new ConcatNextFunc(comterp());
! cnfunc->funcid(symbol_add("concat"));
! }
AttributeValueList* avl = new AttributeValueList();
avl->Append(new AttributeValue(operand1));
avl->Append(new AttributeValue(operand2));
***************
*** 141,151 ****
/* stream first argument until nil */
if (oneval->is_known()) {
if (oneval->is_stream()) {
! NextFunc nextfunc(comterp());
! push_stack(*oneval);
! push_funcstate(1,0);
! nextfunc.execute();
! pop_funcstate();
if (comterp()->stack_top().is_unknown()) {
*oneval = ComValue::nullval();
comterp()->pop_stack();
--- 146,153 ----
/* stream first argument until nil */
if (oneval->is_known()) {
if (oneval->is_stream()) {
! ComValue valone(*oneval);
! NextFunc::execute_impl(comterp(), valone);
if (comterp()->stack_top().is_unknown()) {
*oneval = ComValue::nullval();
comterp()->pop_stack();
***************
*** 161,171 ****
/* stream 2nd argument until nil */
if (twoval->is_known() && !done) {
if (twoval->is_stream()) {
! NextFunc nextfunc(comterp());
! push_stack(*twoval);
! push_funcstate(1,0);
! nextfunc.execute();
! pop_funcstate();
if (comterp()->stack_top().is_unknown())
*twoval = ComValue::nullval();
} else {
--- 163,170 ----
/* stream 2nd argument until nil */
if (twoval->is_known() && !done) {
if (twoval->is_stream()) {
! ComValue valtwo(*twoval);
! NextFunc::execute_impl(comterp(), valtwo);
if (comterp()->stack_top().is_unknown())
*twoval = ComValue::nullval();
} else {
***************
*** 190,196 ****
ComValue operand1(stack_arg(0));
#ifdef STREAM_MECH
! if (operand1.is_stream()) {
reset_stack();
AttributeValueList* avl = operand1.stream_list();
if (avl) {
--- 189,195 ----
ComValue operand1(stack_arg(0));
#ifdef STREAM_MECH
! if (operand1.is_stream() && nargs()==1) {
reset_stack();
AttributeValueList* avl = operand1.stream_list();
if (avl) {
***************
*** 207,212 ****
--- 206,215 ----
} else
push_stack(ComValue::nullval());
return;
+ } else if (operand1.is_stream()) {
+ fprintf(stderr, "no more than doubly nested streams supported as of yet\n");
+ push_stack(ComValue::nullval());
+ return;
}
#endif
***************
*** 246,252 ****
ComValue operand1(stack_arg(0));
#ifdef STREAM_MECH
! if (operand1.is_stream()) {
reset_stack();
AttributeValueList* avl = operand1.stream_list();
if (avl) {
--- 249,255 ----
ComValue operand1(stack_arg(0));
#ifdef STREAM_MECH
! if (operand1.is_stream() && nargs()==1) {
reset_stack();
AttributeValueList* avl = operand1.stream_list();
if (avl) {
***************
*** 269,274 ****
--- 272,281 ----
} else
push_stack(ComValue::nullval());
return;
+ } else if (operand1.is_stream()) {
+ fprintf(stderr, "no more than doubly nested streams supported as of yet\n");
+ push_stack(ComValue::nullval());
+ return;
}
#endif
***************
*** 311,326 ****
ComValue streamv(stack_arg_post_eval(0));
reset_stack();
if (!streamv.is_stream()) return;
if (streamv.stream_mode()<0) {
/* internal execution -- handled by stream func */
! push_stack(streamv);
! push_funcstate(1, 0);
! ((ComFunc*)streamv.stream_func())->execute();
! pop_funcstate();
! if (comterp()->stack_top().is_null()) streamv.stream_list()->clear();
} else if (streamv.stream_mode()>0) {
--- 318,336 ----
ComValue streamv(stack_arg_post_eval(0));
reset_stack();
+ execute_impl(comterp(), streamv);
+ }
+
+ void NextFunc::execute_impl(ComTerp* comterp, ComValue& streamv) {
+
if (!streamv.is_stream()) return;
if (streamv.stream_mode()<0) {
/* internal execution -- handled by stream func */
! comterp->push_stack(streamv);
! ((ComFunc*)streamv.stream_func())->exec(1, 0);
! if (comterp->stack_top().is_null()) streamv.stream_list()->clear();
} else if (streamv.stream_mode()>0) {
***************
*** 338,364 ****
if (val->is_stream()) {
/* stream argument, use stream func to get next one */
- push_stack(*val);
- push_funcstate(1,0);
if (val->stream_mode()<0 && val->stream_func()) {
/* internal use */
! ((ComFunc*)val->stream_func())->execute();
! if (comterp()->stack_top().is_null())
val->stream_list()->clear();
} else {
/* external use */
! this->execute();
}
- pop_funcstate();
narg++;
} else {
/* non-stream argument, push as is */
! push_stack(*val);
if (val->is_key())
nkey++;
else
--- 348,373 ----
if (val->is_stream()) {
/* stream argument, use stream func to get next one */
if (val->stream_mode()<0 && val->stream_func()) {
/* internal use */
! comterp->push_stack(*val);
! ((ComFunc*)val->stream_func())->exec(1,0);
! if (comterp->stack_top().is_null())
val->stream_list()->clear();
} else {
/* external use */
! ComValue cval(*val);
! NextFunc::execute_impl(comterp, cval);
}
narg++;
} else {
/* non-stream argument, push as is */
! comterp->push_stack(*val);
if (val->is_key())
nkey++;
else
***************
*** 368,381 ****
avl->Next(i);
}
! push_funcstate(narg, nkey);
! funcptr->execute();
! pop_funcstate();
}
! if (comterp()->stack_top().is_null()) streamv.stream_list()->clear();
} else
! push_stack(ComValue::nullval());
}
--- 377,389 ----
avl->Next(i);
}
! funcptr->exec(narg, nkey);
}
! if (comterp->stack_top().is_null()) streamv.stream_list()->clear();
} else
! comterp->push_stack(ComValue::nullval());
}
+
Index: ComTerp/strmfunc.h
diff -c ComTerp/strmfunc.h:1.5 ComTerp/strmfunc.h:1.6
*** ComTerp/strmfunc.h:1.5 Thu Oct 11 15:20:29 2001
--- src/ComTerp/strmfunc.h Fri Oct 12 14:56:21 2001
***************
*** 109,114 ****
--- 109,115 ----
NextFunc(ComTerp*);
virtual void execute();
+ static void execute_impl(ComTerp*, ComValue& strmv);
virtual boolean post_eval() { return true; }
virtual const char* docstring() {
return "val=%s(stream) -- return next value from stream"; }
Index: ComUnidraw/grlistfunc.c
diff -c ComUnidraw/grlistfunc.c:1.1 ComUnidraw/grlistfunc.c:1.2
*** ComUnidraw/grlistfunc.c:1.1 Thu Jan 4 15:33:09 2001
--- src/ComUnidraw/grlistfunc.c Fri Oct 12 14:56:39 2001
***************
*** 64,72 ****
}
} else {
ListAtFunc atfunc(comterp());
! push_funcstate(funcstate()->nargs(), funcstate()->nkeys(), pedepth());
! atfunc.execute();
! pop_funcstate();
return;
}
push_stack(ComValue::nullval());
--- 64,70 ----
}
} else {
ListAtFunc atfunc(comterp());
! atfunc.exec(funcstate()->nargs(), funcstate()->nkeys(), pedepth());
return;
}
push_stack(ComValue::nullval());
***************
*** 99,107 ****
}
} else {
ListSizeFunc atfunc(comterp());
! push_funcstate(funcstate()->nargs(), funcstate()->nkeys(), pedepth());
! atfunc.execute();
! pop_funcstate();
return;
}
push_stack(ComValue::nullval());
--- 97,103 ----
}
} else {
ListSizeFunc atfunc(comterp());
! atfunc.exec(funcstate()->nargs(), funcstate()->nkeys(), pedepth());
return;
}
push_stack(ComValue::nullval());
Index: FrameUnidraw/framefunc.c
diff -c FrameUnidraw/framefunc.c:1.1 FrameUnidraw/framefunc.c:1.2
*** FrameUnidraw/framefunc.c:1.1 Thu Jan 4 15:33:12 2001
--- src/FrameUnidraw/framefunc.c Fri Oct 12 14:56:40 2001
***************
*** 146,154 ****
push_stack(topval);
push_stack(abskey);
MoveFrameFunc moveframefunc(comterp(), ed);
! moveframefunc.push_funcstate(1, 1, pedepth());
! moveframefunc.execute();
! moveframefunc.pop_funcstate();
pop_stack();
const int otherslen=avl->Number()-1;
int others[otherslen];
--- 146,152 ----
push_stack(topval);
push_stack(abskey);
MoveFrameFunc moveframefunc(comterp(), ed);
! moveframefunc.exec(1, 1, pedepth());
pop_stack();
const int otherslen=avl->Number()-1;
int others[otherslen];
*** /dev/null Fri Oct 12 14:56:55 PDT 2001
--- patches/ivtools-011012-johnston-075
*************** patches/ivtools-011012-johnston-075
*** 0 ****
--- 1 ----
+ ivtools-011012-johnston-075
|
|
From: <ivt...@li...> - 2001-10-11 22:23:07
|
Patch: ivtools-011011-johnston-074
For: ivtools-0.9.6
Author: joh...@us...
Subject: more misc. comterp stream fixups
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- more miscellaneous comterp stream fixups
Index: Attribute/attrlist.c
diff -c Attribute/attrlist.c:1.2 Attribute/attrlist.c:1.3
*** Attribute/attrlist.c:1.2 Wed Oct 10 10:14:55 2001
--- src/Attribute/attrlist.c Thu Oct 11 15:20:27 2001
***************
*** 1,4 ****
--- 1,5 ----
/*
+ * Copyright (c) 2001 Scott E. Johnston
* Copyright (c) 1996-1999 Vectaport Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
***************
*** 285,290 ****
--- 286,300 ----
return this;
}
+ void AttributeList::clear() {
+ ALIterator it;
+ for( First(it); !Done(it); ) {
+ Attribute* attr = GetAttr(it);
+ Remove(it);
+ delete attr;
+ }
+ }
+
/*****************************************************************************/
AttributeValueList::AttributeValueList (AttributeValueList* s) {
***************
*** 426,429 ****
--- 436,448 ----
return out;
}
+
+ void AttributeValueList::clear() {
+ ALIterator it;
+ for( First(it); !Done(it); ) {
+ AttributeValue* av = GetAttrVal(it);
+ Remove(it);
+ delete av;
+ }
+ }
Index: Attribute/attrlist.h
diff -c Attribute/attrlist.h:1.2 Attribute/attrlist.h:1.3
*** Attribute/attrlist.h:1.2 Thu Jun 14 10:21:22 2001
--- src/Attribute/attrlist.h Thu Oct 11 15:20:27 2001
***************
*** 1,4 ****
--- 1,5 ----
/*
+ * Copyright (c) 2001 Scott E. Johnston
* Copyright (c) 1996-1999 Vectaport Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
***************
*** 126,132 ****
--- 127,136 ----
// returning responsibility for freeing the associated memory.
// This requires saving a pointer to the Attribute before calling this method.
+ void clear();
+ // empty AttributeList, deleting all Attributes.
+
public:
friend ostream& operator << (ostream& s, const AttributeList&);
// print list to ostream.
***************
*** 208,213 ****
--- 212,220 ----
friend ostream& operator << (ostream& s, const AttributeValueList&);
// print list to ostream.
+
+ void clear();
+ // empty AttributeValueList, deleting all AttributeValue's.
protected:
void Remove(ALIterator&);
Index: Attribute/attrvalue.c
diff -c Attribute/attrvalue.c:1.7 Attribute/attrvalue.c:1.8
*** Attribute/attrvalue.c:1.7 Wed Oct 10 11:22:27 2001
--- src/Attribute/attrvalue.c Thu Oct 11 15:20:27 2001
***************
*** 997,1002 ****
if (is_stream()) {
Resource::unref(_v.streamval.listptr);
_v.streamval.listptr = list;
! Resource::ref(list);
}
}
--- 997,1015 ----
if (is_stream()) {
Resource::unref(_v.streamval.listptr);
_v.streamval.listptr = list;
! if (!list)
! stream_mode(0);
! else
! Resource::ref(list);
}
+ }
+
+ int AttributeValue::stream_mode() {
+ if (is_stream()) {
+ if (!stream_list() || stream_list()->Number()==0)
+ return 0;
+ else
+ return _stream_mode;
+ } else
+ return 0;
}
Index: Attribute/attrvalue.h
diff -c Attribute/attrvalue.h:1.5 Attribute/attrvalue.h:1.6
*** Attribute/attrvalue.h:1.5 Fri Sep 28 16:00:07 2001
--- src/Attribute/attrvalue.h Thu Oct 11 15:20:27 2001
***************
*** 241,247 ****
void object_compview(boolean flag) { _object_compview = flag; }
// true if object is wrapped with a ComponentView
! int stream_mode() { return is_stream() ? _stream_mode : 0; }
// 0 = disabled, negative = internal, positive = external
void stream_mode(int mode) { if (is_stream()) _stream_mode = mode; }
// 0 = disabled, negative = internal, positive = external
--- 241,247 ----
void object_compview(boolean flag) { _object_compview = flag; }
// true if object is wrapped with a ComponentView
! int stream_mode();
// 0 = disabled, negative = internal, positive = external
void stream_mode(int mode) { if (is_stream()) _stream_mode = mode; }
// 0 = disabled, negative = internal, positive = external
Index: ComTerp/boolfunc.c
diff -c ComTerp/boolfunc.c:1.3 ComTerp/boolfunc.c:1.4
*** ComTerp/boolfunc.c:1.3 Wed Sep 26 01:51:10 2001
--- src/ComTerp/boolfunc.c Thu Oct 11 15:20:28 2001
***************
*** 185,190 ****
--- 185,193 ----
case ComValue::StringType:
result.boolean_ref() = operand1.symbol_val()<0;
break;
+ case ComValue::StreamType:
+ result.boolean_ref() = !operand1.stream_mode();
+ break;
}
reset_stack();
push_stack(result);
Index: ComTerp/comterp.c
diff -c ComTerp/comterp.c:1.12 ComTerp/comterp.c:1.13
*** ComTerp/comterp.c:1.12 Wed Oct 10 10:14:56 2001
--- src/ComTerp/comterp.c Thu Oct 11 15:20:28 2001
***************
*** 230,241 ****
#ifdef STREAM_MECH
/* if func has StreamType ComValue's for arguments */
! /* create a StreamType ComValue to hold all its */
/* arguments, along with a pointer to the func. */
boolean has_streams = false;
if (!((ComFunc*)sv.obj_val())->post_eval())
for(int i=0; i<sv.narg()+sv.nkey(); i++) {
! has_streams = stack_top(-i).is_stream();
if (has_streams) break;
}
if (has_streams) {
--- 230,247 ----
#ifdef STREAM_MECH
/* if func has StreamType ComValue's for arguments */
! /* create another StreamType ComValue to hold all its */
/* arguments, along with a pointer to the func. */
boolean has_streams = false;
if (!((ComFunc*)sv.obj_val())->post_eval())
for(int i=0; i<sv.narg()+sv.nkey(); i++) {
! if (!stack_top(-i).is_symbol())
! has_streams = stack_top(-i).is_stream();
! else {
! AttributeValue* testval =
! lookup_symval(&stack_top(-i));
! has_streams = testval ? testval->is_stream() : false;
! }
if (has_streams) break;
}
if (has_streams) {
***************
*** 750,755 ****
--- 756,789 ----
}
return comval;
+ }
+
+ AttributeValue* ComTerp::lookup_symval(ComValue* comval) {
+ if (comval->bquote()) return nil;
+
+ if (comval->type() == ComValue::SymbolType) {
+ void* vptr = nil;
+
+ if (!comval->global_flag() && localtable()->find(vptr, comval->symbol_val()) ) {
+ return (AttributeValue*)vptr;
+ } else if (_alist) {
+ int id = comval->symbol_val();
+ AttributeValue* aval = _alist->find(id);
+ if (aval) {
+ return aval;
+ }
+ return nil;
+ } else if (globaltable()->find(vptr, comval->symbol_val())) {
+ return (AttributeValue*)vptr;
+ } else
+ return nil;
+
+ } else if (comval->is_object(Attribute::class_symid())) {
+
+ return ((Attribute*)comval->obj_val())->Value();
+
+ }
+ return nil;
}
ComValue& ComTerp::lookup_symval(int symid) {
Index: ComTerp/comterp.h
diff -c ComTerp/comterp.h:1.2 ComTerp/comterp.h:1.3
*** ComTerp/comterp.h:1.2 Thu Jun 14 10:21:26 2001
--- src/ComTerp/comterp.h Thu Oct 11 15:20:28 2001
***************
*** 118,123 ****
--- 118,127 ----
ComValue& lookup_symval(ComValue&);
// look up a ComValue associated with a symbol (specified in the
// input ComValue) in the local or global symbol tables.
+ AttributeValue* lookup_symval(ComValue*);
+ // look up a pointer to an AttributeValue associated with a symbol
+ // (specified in the input ComValue) in the local or global symbol
+ // tables. Do not alter the input ComValue.
ComValue& lookup_symval(int symid);
// look up a ComValue associated with a symbol (specified with a
// symbol id) in the local or global symbol tables.
Index: ComTerp/listfunc.h
diff -c ComTerp/listfunc.h:1.2 ComTerp/listfunc.h:1.3
*** ComTerp/listfunc.h:1.2 Fri Sep 28 14:34:04 2001
--- src/ComTerp/listfunc.h Thu Oct 11 15:20:28 2001
***************
*** 44,50 ****
virtual void execute();
virtual boolean post_eval() { return true; }
virtual const char* docstring() {
! return "lst=%s([olst]) -- create an empty list or copy existing one"; }
};
//: list member command for ComTerp.
--- 44,50 ----
virtual void execute();
virtual boolean post_eval() { return true; }
virtual const char* docstring() {
! return "lst=%s([olst|strm]) -- create an empty list or copy existing one"; }
};
//: list member command for ComTerp.
Index: ComTerp/strmfunc.c
diff -c ComTerp/strmfunc.c:1.6 ComTerp/strmfunc.c:1.7
*** ComTerp/strmfunc.c:1.6 Wed Oct 10 10:14:56 2001
--- src/ComTerp/strmfunc.c Thu Oct 11 15:20:29 2001
***************
*** 308,324 ****
}
void NextFunc::execute() {
! ComValue streamv(stack_arg(0));
reset_stack();
if (!streamv.is_stream()) return;
if (streamv.stream_mode()<0) {
push_stack(streamv);
push_funcstate(1, 0);
((ComFunc*)streamv.stream_func())->execute();
pop_funcstate();
} else if (streamv.stream_mode()>0) {
ComFunc* funcptr = (ComFunc*)streamv.stream_func();
AttributeValueList* avl = streamv.stream_list();
int narg=0;
--- 308,330 ----
}
void NextFunc::execute() {
! ComValue streamv(stack_arg_post_eval(0));
reset_stack();
if (!streamv.is_stream()) return;
if (streamv.stream_mode()<0) {
+
+ /* internal execution -- handled by stream func */
push_stack(streamv);
push_funcstate(1, 0);
((ComFunc*)streamv.stream_func())->execute();
pop_funcstate();
+ if (comterp()->stack_top().is_null()) streamv.stream_list()->clear();
+
} else if (streamv.stream_mode()>0) {
+
+ /* external execution -- handled by this func */
ComFunc* funcptr = (ComFunc*)streamv.stream_func();
AttributeValueList* avl = streamv.stream_list();
int narg=0;
***************
*** 330,363 ****
AttributeValue* val = avl->GetAttrVal(i);
if (val->is_stream()) {
push_stack(*val);
push_funcstate(1,0);
if (val->stream_mode()<0 && val->stream_func()) {
/* internal use */
((ComFunc*)val->stream_func())->execute();
! if (comterp()->stack_top().is_null()) val->stream_list(nil);
! }
! else {
/* external use */
this->execute();
}
pop_funcstate();
narg++;
} else {
push_stack(*val);
if (val->is_key())
nkey++;
else
narg++;
}
avl->Next(i);
}
push_funcstate(narg, nkey);
funcptr->execute();
pop_funcstate();
- if (comterp()->stack_top().is_null()) streamv.stream_list(nil);
}
! }
}
--- 336,381 ----
AttributeValue* val = avl->GetAttrVal(i);
if (val->is_stream()) {
+
+ /* stream argument, use stream func to get next one */
push_stack(*val);
push_funcstate(1,0);
if (val->stream_mode()<0 && val->stream_func()) {
/* internal use */
((ComFunc*)val->stream_func())->execute();
! if (comterp()->stack_top().is_null())
! val->stream_list()->clear();
!
! } else {
!
/* external use */
this->execute();
+
}
pop_funcstate();
narg++;
} else {
+
+ /* non-stream argument, push as is */
push_stack(*val);
if (val->is_key())
nkey++;
else
narg++;
+
}
avl->Next(i);
}
+
push_funcstate(narg, nkey);
funcptr->execute();
pop_funcstate();
}
!
! if (comterp()->stack_top().is_null()) streamv.stream_list()->clear();
!
! } else
! push_stack(ComValue::nullval());
}
Index: ComTerp/strmfunc.h
diff -c ComTerp/strmfunc.h:1.4 ComTerp/strmfunc.h:1.5
*** ComTerp/strmfunc.h:1.4 Thu Oct 4 10:21:36 2001
--- src/ComTerp/strmfunc.h Thu Oct 11 15:20:29 2001
***************
*** 109,114 ****
--- 109,115 ----
NextFunc(ComTerp*);
virtual void execute();
+ virtual boolean post_eval() { return true; }
virtual const char* docstring() {
return "val=%s(stream) -- return next value from stream"; }
*** /dev/null Thu Oct 11 15:20:41 PDT 2001
--- patches/ivtools-011011-johnston-074
*************** patches/ivtools-011011-johnston-074
*** 0 ****
--- 1 ----
+ ivtools-011011-johnston-074
|
|
From: <ivt...@li...> - 2001-10-11 21:50:16
|
Patch: ivtools-011011-johnston-073
For: ivtools-0.9.6
Author: joh...@us...
Subject: touchups to glyph-based graphics, back out fopen use of "r+"
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- touchups to glyph-based graphics (Graphic31). There were
difficult-to-decipher problems in allocate/requisition which clipped
graphics by one row or one column. So I just padded things a bit.
This is only used in the addtool (custom toolbutton) mechanism of
comdraw.
- revert to using "r" instead of "r+" in fopen calls for graphics
files to be read in. I had added "r+" when gcc-3.0 needed it to allow
rewinding. Now gcc-3.0.1 has that fixed, and "r+" got in the way of
read-only access (CD-ROMS).
Index: IVGlyph/figure.c
diff -c IVGlyph/figure.c:1.1 IVGlyph/figure.c:1.2
*** IVGlyph/figure.c:1.1 Thu Jan 4 15:32:07 2001
--- src/IVGlyph/figure.c Thu Oct 11 14:46:14 2001
***************
*** 657,668 ****
corners(left, bottom, right, top, *_t);
}
! rx.natural(right - left);
rx.stretch(0.0);
rx.shrink(0.0);
rx.alignment(-left / rx.natural());
! ry.natural(top - bottom);
ry.stretch(0.0);
ry.shrink(0.0);
ry.alignment(-bottom / ry.natural());
--- 657,668 ----
corners(left, bottom, right, top, *_t);
}
! rx.natural(right - left + 1);
rx.stretch(0.0);
rx.shrink(0.0);
rx.alignment(-left / rx.natural());
! ry.natural(top - bottom + 1);
ry.stretch(0.0);
ry.shrink(0.0);
ry.alignment(-bottom / ry.natural());
***************
*** 1466,1472 ****
Canvas* c, Coord l, Coord b, Coord r, Coord t, Graphic31* gs
) {
c->push_clipping();
! c->clip_rect(_a.left(), _a.bottom(), _a.right(), _a.top());
if (_bg != nil) {
c->fill_rect(l, b, r, t, _bg);
}
--- 1466,1472 ----
Canvas* c, Coord l, Coord b, Coord r, Coord t, Graphic31* gs
) {
c->push_clipping();
! c->clip_rect(_a.left()-1, _a.bottom()-1, _a.right()+1, _a.top()+1);
if (_bg != nil) {
c->fill_rect(l, b, r, t, _bg);
}
Index: OverlayUnidraw/ovcatalog.c
diff -c OverlayUnidraw/ovcatalog.c:1.6 OverlayUnidraw/ovcatalog.c:1.7
*** OverlayUnidraw/ovcatalog.c:1.6 Fri Sep 14 12:14:30 2001
--- src/OverlayUnidraw/ovcatalog.c Thu Oct 11 14:46:20 2001
***************
*** 189,195 ****
_valid = fbuf.attach(fileno(stdin)) != 0;
name = nil;
} else {
! fptr = fopen(name, "r+");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
if (compressed) {
--- 189,195 ----
_valid = fbuf.attach(fileno(stdin)) != 0;
name = nil;
} else {
! fptr = fopen(name, "r");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
if (compressed) {
***************
*** 201,207 ****
#else
boolean stdin_flag = strcmp(name, "-")==0;
if (!stdin_flag) {
! fptr = fopen(name, "r+");
fptr = fptr ? OvImportCmd::CheckCompression(fptr, name, compressed) : nil;
_valid = fptr != nil;
if (compressed) {
--- 201,207 ----
#else
boolean stdin_flag = strcmp(name, "-")==0;
if (!stdin_flag) {
! fptr = fopen(name, "r");
fptr = fptr ? OvImportCmd::CheckCompression(fptr, name, compressed) : nil;
_valid = fptr != nil;
if (compressed) {
Index: OverlayUnidraw/ovimport.c
diff -c OverlayUnidraw/ovimport.c:1.16 OverlayUnidraw/ovimport.c:1.17
*** OverlayUnidraw/ovimport.c:1.16 Fri Sep 14 12:25:35 2001
--- src/OverlayUnidraw/ovimport.c Thu Oct 11 14:46:20 2001
***************
*** 208,216 ****
}
for (ListItr(StreamList) k(_sl); k.more(); k.next()) {
- #if __GNUG__>=3
- delete k.cur()->rdbuf();
- #endif
delete k.cur();
}
--- 208,213 ----
***************
*** 761,767 ****
const char* OvImportCmd::ReadCreator (const char* pathname) {
! FILE* file = fopen(pathname, "r+");
const int creator_size = 32;
static char creator[creator_size];
--- 758,764 ----
const char* OvImportCmd::ReadCreator (const char* pathname) {
! FILE* file = fopen(pathname, "r");
const int creator_size = 32;
static char creator[creator_size];
***************
*** 2194,2200 ****
int& ncols, int& nrows, boolean& compressed, boolean& tiled, int& twidth,
int& theight
) {
! FILE* file = fopen(pathname, "r+");
file = CheckCompression(file, pathname, compressed);
tiled = false;
--- 2191,2197 ----
int& ncols, int& nrows, boolean& compressed, boolean& tiled, int& twidth,
int& theight
) {
! FILE* file = fopen(pathname, "r");
file = CheckCompression(file, pathname, compressed);
tiled = false;
***************
*** 2617,2623 ****
Bitmap* OvImportCmd::PBM_Bitmap (const char* pathname) {
Bitmap* bitmap = nil;
! FILE* file = fopen(pathname, "r+");
boolean compressed;
file = CheckCompression(file, pathname, compressed);
--- 2614,2620 ----
Bitmap* OvImportCmd::PBM_Bitmap (const char* pathname) {
Bitmap* bitmap = nil;
! FILE* file = fopen(pathname, "r");
boolean compressed;
file = CheckCompression(file, pathname, compressed);
Index: FrameUnidraw/framecatalog.c
diff -c FrameUnidraw/framecatalog.c:1.4 FrameUnidraw/framecatalog.c:1.5
*** FrameUnidraw/framecatalog.c:1.4 Mon Jul 16 15:22:23 2001
--- src/FrameUnidraw/framecatalog.c Thu Oct 11 14:46:23 2001
***************
*** 71,77 ****
#endif
name = nil;
} else {
! fptr = fopen(name, "r+");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
#if __GNUG__<3
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
--- 71,77 ----
#endif
name = nil;
} else {
! fptr = fopen(name, "r");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
#if __GNUG__<3
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
Index: GraphUnidraw/graphcatalog.c
diff -c GraphUnidraw/graphcatalog.c:1.4 GraphUnidraw/graphcatalog.c:1.5
*** GraphUnidraw/graphcatalog.c:1.4 Mon Jul 16 15:22:25 2001
--- src/GraphUnidraw/graphcatalog.c Thu Oct 11 14:46:24 2001
***************
*** 88,94 ****
#endif
name = nil;
} else {
! fptr = fopen(name, "r+");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
#if __GNUG__<3
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
--- 88,94 ----
#endif
name = nil;
} else {
! fptr = fopen(name, "r");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
#if __GNUG__<3
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
*** /dev/null Thu Oct 11 14:46:30 PDT 2001
--- patches/ivtools-011011-johnston-073
*************** patches/ivtools-011011-johnston-073
*** 0 ****
--- 1 ----
+ ivtools-011011-johnston-073
|
|
From: <ivt...@li...> - 2001-10-10 18:24:05
|
Patch: ivtools-011010-johnston-072
For: ivtools-0.9.6
Author: joh...@us...
Subject: ensure ComValue::is_true() returns true for StreamType
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- ensure ComValue::is_true() returns true for StreamType that exists.
Index: Attribute/attrvalue.c
diff -c Attribute/attrvalue.c:1.6 Attribute/attrvalue.c:1.7
*** Attribute/attrvalue.c:1.6 Fri Sep 28 16:00:07 2001
--- src/Attribute/attrvalue.c Wed Oct 10 11:22:27 2001
***************
*** 247,252 ****
--- 247,254 ----
return (boolean) int_val()!=-1;
case AttributeValue::ObjectType:
return (boolean) obj_val();
+ case AttributeValue::StreamType:
+ return stream_mode() != 0;
default:
return 0;
}
*** /dev/null Wed Oct 10 11:22:36 PDT 2001
--- patches/ivtools-011010-johnston-072
*************** patches/ivtools-011010-johnston-072
*** 0 ****
--- 1 ----
+ ivtools-011010-johnston-072
|
|
From: <ivt...@li...> - 2001-10-10 17:19:29
|
Patch: ivtools-011010-johnston-071
For: ivtools-0.9
Author: joh...@us...
Subject: attribute/stream/comterp work
Requires:
This is an intermediate patch to ivtools-0.9. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- fix the AttributeValueList constructor so it does a list copy as it
advertises.
- evaluate symbols when popping them off the stack to build a stream object. This may not be desirable in the long run, and it really wasn't causing any problem to delay this that I know of. Hmmm...
- make the default value of the second "at" argument zero instead of
nil, so that if nil is supplied it can be used to return nil (to
terminate stream handling).
- set up to "stream" over an AttributeList.
Index: Attribute/attrlist.c
diff -c Attribute/attrlist.c:1.1 Attribute/attrlist.c:1.2
*** Attribute/attrlist.c:1.1 Thu Jan 4 15:31:38 2001
--- src/Attribute/attrlist.c Wed Oct 10 10:14:55 2001
***************
*** 294,300 ****
ALIterator i;
for (s->First(i); !s->Done(i); s->Next(i)) {
! Append(s->GetAttrVal(i));
}
}
}
--- 294,300 ----
ALIterator i;
for (s->First(i); !s->Done(i); s->Next(i)) {
! Append(new AttributeValue(*s->GetAttrVal(i)));
}
}
}
Index: ComTerp/comterp.c
diff -c ComTerp/comterp.c:1.11 ComTerp/comterp.c:1.12
*** ComTerp/comterp.c:1.11 Mon Oct 8 13:05:06 2001
--- src/ComTerp/comterp.c Wed Oct 10 10:14:56 2001
***************
*** 241,247 ****
if (has_streams) {
AttributeValueList* avl = new AttributeValueList();
for(int i=0; i<sv.narg()+sv.nkey(); i++)
! avl->Prepend(new AttributeValue(pop_stack(false)));
ComValue val(sv.obj_val(), avl);
val.stream_mode(1); // for external use
push_stack(val);
--- 241,247 ----
if (has_streams) {
AttributeValueList* avl = new AttributeValueList();
for(int i=0; i<sv.narg()+sv.nkey(); i++)
! avl->Prepend(new AttributeValue(pop_stack(true)));
ComValue val(sv.obj_val(), avl);
val.stream_mode(1); // for external use
push_stack(val);
Index: ComTerp/listfunc.c
diff -c ComTerp/listfunc.c:1.4 ComTerp/listfunc.c:1.5
*** ComTerp/listfunc.c:1.4 Mon Oct 8 13:05:06 2001
--- src/ComTerp/listfunc.c Wed Oct 10 10:14:56 2001
***************
*** 94,103 ****
void ListAtFunc::execute() {
ComValue listv(stack_arg(0));
! ComValue nv(stack_arg(1));
reset_stack();
! if (listv.is_type(ComValue::ArrayType) && nv.int_val()>=0) {
AttributeValueList* avl = listv.array_val();
if (avl && nv.int_val()<avl->Number()) {
int count = 0;
--- 94,103 ----
void ListAtFunc::execute() {
ComValue listv(stack_arg(0));
! ComValue nv(stack_arg(1, false, ComValue::zeroval()));
reset_stack();
! if (listv.is_type(ComValue::ArrayType) && !nv.is_nil() && nv.int_val()>=0) {
AttributeValueList* avl = listv.array_val();
if (avl && nv.int_val()<avl->Number()) {
int count = 0;
Index: ComTerp/strmfunc.c
diff -c ComTerp/strmfunc.c:1.5 ComTerp/strmfunc.c:1.6
*** ComTerp/strmfunc.c:1.5 Mon Oct 8 10:31:11 2001
--- src/ComTerp/strmfunc.c Wed Oct 10 10:14:56 2001
***************
*** 77,82 ****
--- 77,95 ----
ComValue stream(this, avl);
stream.stream_mode(-1); // for internal use (use by this func)
push_stack(stream);
+ } else if (operand1.is_attributelist()) {
+ AttributeValueList* avl = new AttributeValueList();
+ AttributeList* al = (AttributeList*)operand1.obj_val();
+ Iterator i;
+ for(al->First(i); !al->Done(i); al->Next(i)) {
+ Attribute* attr = al->GetAttr(i);
+ AttributeValue* av =
+ new AttributeValue(Attribute::class_symid(), (void*)attr);
+ avl->Append(av);
+ }
+ ComValue stream(this, avl);
+ stream.stream_mode(-1); // for internal use (use by this func)
+ push_stack(stream);
}
}
*** /dev/null Wed Oct 10 10:15:13 PDT 2001
--- patches/ivtools-011010-johnston-071
*************** patches/ivtools-011010-johnston-071
*** 0 ****
--- 1 ----
+ ivtools-011010-johnston-071
|
|
From: <ivt...@li...> - 2001-10-08 20:19:37
|
Patch: ivtools-011008-johnston-070 For: ivtools-0.9.6 Author: joh...@us... Subject: NetBSD compile fix Requires: This is an intermediate patch to ivtools-0.9.6. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - NetBSD compile fix Index: src_tiff/tif_compat.c diff -c src_tiff/tif_compat.c:1.1 src_tiff/tif_compat.c:1.2 *** src_tiff/tif_compat.c:1.1 Thu Jan 4 15:31:57 2001 --- src/TIFF/tif_compat.c Mon Oct 8 13:18:19 2001 *************** *** 27,33 **** */ #include "tiffioP.h" ! #if defined(unix) || defined(__unix) || defined(MSDOS) || defined(VMS) || defined(AIXV3) || defined(__CYGWIN__) #include <sys/stat.h> long --- 27,33 ---- */ #include "tiffioP.h" ! #if defined(unix) || defined(__unix) || defined(MSDOS) || defined(VMS) || defined(AIXV3) || defined(__CYGWIN__) || defined(__NetBSD__) #include <sys/stat.h> long *** /dev/null Mon Oct 8 13:18:35 PDT 2001 --- patches/ivtools-011008-johnston-070 *************** patches/ivtools-011008-johnston-070 *** 0 **** --- 1 ---- + ivtools-011008-johnston-070 |
|
From: <ivt...@li...> - 2001-10-08 20:10:37
|
Patch: ivtools-011008-johnston-069
For: ivtools-0.9.6
Author: joh...@us...
Subject: final touchups to streaming operators
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- make ",," concat operator lower priority than the "," tuple
operator. This means these two examples behave in a similar fashion:
s=1,2,,3 # yields {1,2} followed by a 3
s=1,2,3,,4 # yields {1,2,3} followed by a 4
and you can construct 2-d structures in a pleasing way:
s=1,2,3,,4,5,6,,7,8,9 # 3x3 grid
- ensure streaming doesn't happen on post-evaluated commands.
- create a hidden :strmlst argument to the list command, to have a way
at looking at the AttributeValueList associated with a stream object.
Index: ComUtil/optable.c
diff -c ComUtil/optable.c:1.4 ComUtil/optable.c:1.5
*** ComUtil/optable.c:1.4 Thu Oct 4 10:21:34 2001
--- src/ComUtil/optable.c Mon Oct 8 13:05:04 2001
***************
*** 90,96 ****
{"--", "decr_after", 110, TRUE, OPTYPE_UNARY_POSTFIX },
{"**", "repeat", 90, FALSE, OPTYPE_BINARY },
{"..", "iterate", 80, FALSE, OPTYPE_BINARY },
- {",,", "concat", 75, FALSE, OPTYPE_BINARY },
{"%", "mod", 70, FALSE, OPTYPE_BINARY },
{"*", "mpy", 70, FALSE, OPTYPE_BINARY },
{"/", "div", 70, FALSE, OPTYPE_BINARY },
--- 90,95 ----
***************
*** 109,115 ****
{"|", "bit_or", 42, FALSE, OPTYPE_BINARY },
{"&&", "and", 41, FALSE, OPTYPE_BINARY },
{"||", "or", 40, FALSE, OPTYPE_BINARY },
! {",", "tuple", 35, FALSE, OPTYPE_BINARY },
{"%=", "mod_assign", 30, TRUE, OPTYPE_BINARY },
{"*=", "mpy_assign", 30, TRUE, OPTYPE_BINARY },
{"+=", "add_assign", 30, TRUE, OPTYPE_BINARY },
--- 108,115 ----
{"|", "bit_or", 42, FALSE, OPTYPE_BINARY },
{"&&", "and", 41, FALSE, OPTYPE_BINARY },
{"||", "or", 40, FALSE, OPTYPE_BINARY },
! {",", "tuple", 35, FALSE, OPTYPE_BINARY },
! {",,", "concat", 33, FALSE, OPTYPE_BINARY },
{"%=", "mod_assign", 30, TRUE, OPTYPE_BINARY },
{"*=", "mpy_assign", 30, TRUE, OPTYPE_BINARY },
{"+=", "add_assign", 30, TRUE, OPTYPE_BINARY },
***************
*** 912,918 ****
-- decr_after 110 Y UNARY POSTFIX
** repeat 90 N BINARY
.. iterate 80 N BINARY
- ,, concat 75 N BINARY
% mod 70 N BINARY
* mpy 70 N BINARY
/ div 70 N BINARY
--- 912,917 ----
***************
*** 932,937 ****
--- 931,937 ----
&& and 41 N BINARY
|| or 40 N BINARY
, tuple 35 N BINARY
+ ,, concat 33 N BINARY
%= mod_assign 30 Y BINARY
*= mpy_assign 30 Y BINARY
+= add_assign 30 Y BINARY
Index: ComTerp/comterp.c
diff -c ComTerp/comterp.c:1.10 ComTerp/comterp.c:1.11
*** ComTerp/comterp.c:1.10 Thu Oct 4 10:21:36 2001
--- src/ComTerp/comterp.c Mon Oct 8 13:05:06 2001
***************
*** 233,242 ****
/* create a StreamType ComValue to hold all its */
/* arguments, along with a pointer to the func. */
boolean has_streams = false;
! for(int i=0; i<sv.narg()+sv.nkey(); i++) {
! has_streams = stack_top(-i).is_stream();
! if (has_streams) break;
! }
if (has_streams) {
AttributeValueList* avl = new AttributeValueList();
for(int i=0; i<sv.narg()+sv.nkey(); i++)
--- 233,243 ----
/* create a StreamType ComValue to hold all its */
/* arguments, along with a pointer to the func. */
boolean has_streams = false;
! if (!((ComFunc*)sv.obj_val())->post_eval())
! for(int i=0; i<sv.narg()+sv.nkey(); i++) {
! has_streams = stack_top(-i).is_stream();
! if (has_streams) break;
! }
if (has_streams) {
AttributeValueList* avl = new AttributeValueList();
for(int i=0; i<sv.narg()+sv.nkey(); i++)
Index: ComTerp/listfunc.c
diff -c ComTerp/listfunc.c:1.3 ComTerp/listfunc.c:1.4
*** ComTerp/listfunc.c:1.3 Fri Sep 28 15:14:34 2001
--- src/ComTerp/listfunc.c Mon Oct 8 13:05:06 2001
***************
*** 41,46 ****
--- 41,48 ----
void ListFunc::execute() {
ComValue listv(stack_arg_post_eval(0));
+ static int strmlst_symid = symbol_add("strmlst"); // hidden debug keyword
+ ComValue strmlstv(stack_key_post_eval(strmlst_symid));
reset_stack();
AttributeValueList* avl;
***************
*** 50,69 ****
else {
avl = new AttributeValueList();
if (listv.is_stream()) {
! NextFunc nextfunc(comterp());
! boolean done = false;
! while (!done) {
! push_stack(listv);
! push_funcstate(1,0);
! nextfunc.execute();
! pop_funcstate();
! AttributeValue* newval = new AttributeValue(comterp()->pop_stack());
! if (newval->is_unknown()) {
! done = true;
! delete newval;
! } else
! avl->Append(newval);
}
}
}
Resource::ref(avl);
--- 52,85 ----
else {
avl = new AttributeValueList();
if (listv.is_stream()) {
! if (strmlstv.is_false()) {
!
! /* stream to list conversion */
! NextFunc nextfunc(comterp());
! boolean done = false;
! while (!done) {
! push_stack(listv);
! push_funcstate(1,0);
! nextfunc.execute();
! pop_funcstate();
! AttributeValue* newval = new AttributeValue(comterp()->pop_stack());
! if (newval->is_unknown()) {
! done = true;
! delete newval;
! } else
! avl->Append(newval);
! }
!
! } else {
! /* simply return stream's internal list for debug purposes */
! if (listv.stream_list()) {
! ComValue retval(listv.stream_list());
! push_stack(retval);
! } else
! push_stack(ComValue::nullval());
! return;
}
+
}
}
Resource::ref(avl);
Index: comterp/README
diff -c comterp/README:1.6 comterp/README:1.7
*** comterp/README:1.6 Thu Oct 4 10:21:38 2001
--- src/comterp_/README Mon Oct 8 13:05:07 2001
***************
*** 85,91 ****
-- decr_after 110 R-to-L unary-postfix
** repeat 90 L-to-R binary
.. iterate 80 L-to-R binary
- ,, concat 75 L-to-R binary
% mod 70 L-to-R binary
* mpy 70 L-to-R binary
/ div 70 L-to-R binary
--- 85,90 ----
***************
*** 105,110 ****
--- 104,110 ----
&& and 41 L-to-R binary
|| or 40 L-to-R binary
, tuple 35 L-to-R binary
+ ,, concat 33 L-to-R binary
%= mod_assign 30 R-to-L binary
*= mpy_assign 30 R-to-L binary
+= add_assign 30 R-to-L binary
Index: man1_ivtools/comterp.1
diff -c man1_ivtools/comterp.1:1.6 man1_ivtools/comterp.1:1.7
*** man1_ivtools/comterp.1:1.6 Thu Oct 4 10:22:06 2001
--- src/man/man1/comterp.1 Mon Oct 8 13:05:24 2001
***************
*** 95,101 ****
-- decr_after 110 R-to-L unary-postfix
** repeat 90 L-to-R binary
.. iterate 80 L-to-R binary
- ,, concat 75 L-to-R binary
% mod 70 L-to-R binary
* mpy 70 L-to-R binary
/ div 70 L-to-R binary
--- 95,100 ----
***************
*** 115,120 ****
--- 114,120 ----
&& and 41 L-to-R binary
|| or 40 L-to-R binary
, tuple 35 L-to-R binary
+ ,, concat 33 L-to-R binary
%= mod_assign 30 R-to-L binary
*= mpy_assign 30 R-to-L binary
+= add_assign 30 R-to-L binary
*** /dev/null Mon Oct 8 13:05:26 PDT 2001
--- patches/ivtools-011008-johnston-069
*************** patches/ivtools-011008-johnston-069
*** 0 ****
--- 1 ----
+ ivtools-011008-johnston-069
|
|
From: <ivt...@li...> - 2001-10-08 17:33:07
|
Patch: ivtools-011008-johnston-068
For: ivtools-0.9.6
Author: joh...@us...
Subject: further stream operator fixes, plus config file tweak.
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- further stream operator fixes, plus config file tweak.
Index: ComTerp/strmfunc.c
diff -c ComTerp/strmfunc.c:1.4 ComTerp/strmfunc.c:1.5
*** ComTerp/strmfunc.c:1.4 Thu Oct 4 10:21:36 2001
--- src/ComTerp/strmfunc.c Mon Oct 8 10:31:11 2001
***************
*** 200,205 ****
--- 200,210 ----
ComValue operand2(stack_arg(1));
reset_stack();
+ if (operand1.is_nil() || operand2.is_nil()) {
+ push_stack(ComValue::nullval());
+ return;
+ }
+
int n = operand2.int_val();
if (n<=0) return;
***************
*** 256,261 ****
--- 261,271 ----
ComValue operand2(stack_arg(1));
reset_stack();
+
+ if (operand1.is_nil() || operand2.is_nil()) {
+ push_stack(ComValue::nullval());
+ return;
+ }
int start = operand1.int_val();
int stop = operand2.int_val();
Index: config_ivtools/local.def
diff -c config_ivtools/local.def:1.3 config_ivtools/local.def:1.4
*** config_ivtools/local.def:1.3 Thu Aug 16 12:22:41 2001
--- config/local.def Mon Oct 8 10:31:28 2001
***************
*** 44,50 ****
--- 44,54 ----
* Assume the use of gcc-2.3.3 or greater
*/
#undef LanguageCCDefines
+ #if LibStdCPlusPlusV3
#define LanguageCCDefines -Dcplusplus_2_1 -Wno-deprecated
+ #else
+ #define LanguageCCDefines -Dcplusplus_2_1
+ #endif
#include <gcc.def>
/*
*** /dev/null Mon Oct 8 10:31:29 PDT 2001
--- patches/ivtools-011008-johnston-068
*************** patches/ivtools-011008-johnston-068
*** 0 ****
--- 1 ----
+ ivtools-011008-johnston-068
|
|
From: <ivt...@li...> - 2001-10-04 17:26:40
|
Patch: ivtools-011004-johnston-067
For: ivtools-0.9.6
Author: joh...@us...
Subject: now we're cooking with gas
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- Now the streams are really flowing. The ",," concatenation operator
works for the most part, allowing for the composition of complex
streams like this:
s=0,,1,,2,,3**3,,4+100
which generates the sequence:
100 101 102 103 103 103 104 nil
Probably a few minor issues left to clean up. So far I've discovered:
0,1**2
works partially as expected, generating a {0,1} followed by a {0,1}.
But then it generates a {0,nil} repeatedly, never terminating. Hmmmm.
Index: ComUtil/optable.c
diff -c ComUtil/optable.c:1.3 ComUtil/optable.c:1.4
*** ComUtil/optable.c:1.3 Fri Sep 28 14:34:01 2001
--- src/ComUtil/optable.c Thu Oct 4 10:21:34 2001
***************
*** 90,96 ****
{"--", "decr_after", 110, TRUE, OPTYPE_UNARY_POSTFIX },
{"**", "repeat", 90, FALSE, OPTYPE_BINARY },
{"..", "iterate", 80, FALSE, OPTYPE_BINARY },
! {",,", "stream", 75, FALSE, OPTYPE_BINARY },
{"%", "mod", 70, FALSE, OPTYPE_BINARY },
{"*", "mpy", 70, FALSE, OPTYPE_BINARY },
{"/", "div", 70, FALSE, OPTYPE_BINARY },
--- 90,96 ----
{"--", "decr_after", 110, TRUE, OPTYPE_UNARY_POSTFIX },
{"**", "repeat", 90, FALSE, OPTYPE_BINARY },
{"..", "iterate", 80, FALSE, OPTYPE_BINARY },
! {",,", "concat", 75, FALSE, OPTYPE_BINARY },
{"%", "mod", 70, FALSE, OPTYPE_BINARY },
{"*", "mpy", 70, FALSE, OPTYPE_BINARY },
{"/", "div", 70, FALSE, OPTYPE_BINARY },
***************
*** 912,918 ****
-- decr_after 110 Y UNARY POSTFIX
** repeat 90 N BINARY
.. iterate 80 N BINARY
! ,, stream 75 N BINARY
% mod 70 N BINARY
* mpy 70 N BINARY
/ div 70 N BINARY
--- 912,918 ----
-- decr_after 110 Y UNARY POSTFIX
** repeat 90 N BINARY
.. iterate 80 N BINARY
! ,, concat 75 N BINARY
% mod 70 N BINARY
* mpy 70 N BINARY
/ div 70 N BINARY
Index: ComTerp/comterp.c
diff -c ComTerp/comterp.c:1.9 ComTerp/comterp.c:1.10
*** ComTerp/comterp.c:1.9 Fri Sep 28 14:34:04 2001
--- src/ComTerp/comterp.c Thu Oct 4 10:21:36 2001
***************
*** 931,936 ****
--- 931,937 ----
add_command("lt_or_eq", new LessThanOrEqualFunc(this));
add_command("stream", new StreamFunc(this));
+ add_command("concat", new ConcatFunc(this));
add_command("repeat", new RepeatFunc(this));
add_command("iterate", new IterateFunc(this));
add_command("next", new NextFunc(this));
Index: ComTerp/strmfunc.c
diff -c ComTerp/strmfunc.c:1.3 ComTerp/strmfunc.c:1.4
*** ComTerp/strmfunc.c:1.3 Fri Sep 28 14:34:04 2001
--- src/ComTerp/strmfunc.c Thu Oct 4 10:21:36 2001
***************
*** 48,125 ****
void StreamFunc::execute() {
ComValue operand1(stack_arg(0));
! if (nargs()==1) {
! reset_stack();
! if (operand1.is_stream()) {
!
! /* invoked by the next command */
! AttributeValueList* avl = operand1.stream_list();
! if (avl) {
! Iterator i;
! avl->First(i);
! AttributeValue* retval = avl->Done(i) ? nil : avl->GetAttrVal(i);
! if (retval) {
! push_stack(*retval);
! avl->Remove(retval);
! delete retval;
! } else {
! operand1.stream_list(nil);
! push_stack(ComValue::nullval());
! }
! } else
push_stack(ComValue::nullval());
-
- } else {
-
- /* conversion operator */
- if (operand1.is_array()) {
- AttributeValueList* avl = new AttributeValueList(operand1.array_val());
- ComValue stream(this, avl);
- stream.stream_mode(-1); // for internal use (use by this func)
- push_stack(stream);
}
!
! }
} else {
! #if 0
! if (operand1.is_stream()) {
! reset_stack();
! AttributeValueList* avl = operand1.stream_list();
! if (avl) {
! Iterator i;
! avl->First(i);
! AttributeValue* repval = avl->GetAttrVal(i);
! avl->Next(i);
! AttributeValue* cntval = avl->GetAttrVal(i);
! if (cntval->int_val()>0)
! push_stack(*repval);
! else
! push_stack(ComValue::nullval());
! cntval->int_ref()--;
! } else
! push_stack(ComValue::nullval());
! return;
}
! ComValue* operand2 = new ComValue(stack_arg(1));
! reset_stack();
! if (!operand1->is_type(ComValue::ArrayType)) {
! AttributeValueList* avl = new AttributeValueList();
! avl->Append(operand1);
! avl->Append(operand2);
! ComValue retval(avl);
! push_stack(retval);
! } else {
! AttributeValueList* avl = operand1->array_val();
! avl->Append(operand2);
! push_stack(*operand1);
! delete operand1;
}
! #endif
! }
}
/*****************************************************************************/
--- 48,171 ----
void StreamFunc::execute() {
ComValue operand1(stack_arg(0));
! reset_stack();
!
! if (operand1.is_stream()) {
! /* invoked by the next command */
! AttributeValueList* avl = operand1.stream_list();
! if (avl) {
! Iterator i;
! avl->First(i);
! AttributeValue* retval = avl->Done(i) ? nil : avl->GetAttrVal(i);
! if (retval) {
! push_stack(*retval);
! avl->Remove(retval);
! delete retval;
! } else {
! operand1.stream_list(nil);
push_stack(ComValue::nullval());
}
! } else
! push_stack(ComValue::nullval());
!
} else {
! /* conversion operator */
! if (operand1.is_array()) {
! AttributeValueList* avl = new AttributeValueList(operand1.array_val());
! ComValue stream(this, avl);
! stream.stream_mode(-1); // for internal use (use by this func)
! push_stack(stream);
}
! }
! }
!
! /*****************************************************************************/
!
! int ConcatFunc::_symid;
!
! ConcatFunc::ConcatFunc(ComTerp* comterp) : StrmFunc(comterp) {
! }
!
! void ConcatFunc::execute() {
! ComValue operand1(stack_arg_post_eval(0));
! ComValue operand2(stack_arg_post_eval(1));
! reset_stack();
!
! /* setup for concatenation */
! static ConcatNextFunc* cnfunc = new ConcatNextFunc(comterp());
! AttributeValueList* avl = new AttributeValueList();
! avl->Append(new AttributeValue(operand1));
! avl->Append(new AttributeValue(operand2));
! ComValue stream(cnfunc, avl);
! stream.stream_mode(-1); // for internal use (use by ConcatNextFunc)
! push_stack(stream);
! }
!
! /*****************************************************************************/
!
! int ConcatNextFunc::_symid;
!
! ConcatNextFunc::ConcatNextFunc(ComTerp* comterp) : StrmFunc(comterp) {
! }
!
! void ConcatNextFunc::execute() {
! ComValue operand1(stack_arg(0));
!
! /* invoked by next func */
! reset_stack();
! AttributeValueList* avl = operand1.stream_list();
! if (avl) {
! Iterator i;
! avl->First(i);
! AttributeValue* oneval = avl->GetAttrVal(i);
! avl->Next(i);
! AttributeValue* twoval = avl->GetAttrVal(i);
! boolean done = false;
! /* stream first argument until nil */
! if (oneval->is_known()) {
! if (oneval->is_stream()) {
! NextFunc nextfunc(comterp());
! push_stack(*oneval);
! push_funcstate(1,0);
! nextfunc.execute();
! pop_funcstate();
! if (comterp()->stack_top().is_unknown()) {
! *oneval = ComValue::nullval();
! comterp()->pop_stack();
! } else
! done = true;
! } else {
! push_stack(*oneval);
! *oneval = ComValue::nullval();
! done = true;
! }
}
!
! /* stream 2nd argument until nil */
! if (twoval->is_known() && !done) {
! if (twoval->is_stream()) {
! NextFunc nextfunc(comterp());
! push_stack(*twoval);
! push_funcstate(1,0);
! nextfunc.execute();
! pop_funcstate();
! if (comterp()->stack_top().is_unknown())
! *twoval = ComValue::nullval();
! } else {
! push_stack(*twoval);
! *twoval = ComValue::nullval();
! }
! } else if (!done)
! push_stack(ComValue::nullval());
!
! } else
! push_stack(ComValue::nullval());
!
! return;
}
/*****************************************************************************/
Index: ComTerp/strmfunc.h
diff -c ComTerp/strmfunc.h:1.3 ComTerp/strmfunc.h:1.4
*** ComTerp/strmfunc.h:1.3 Fri Sep 28 14:34:04 2001
--- src/ComTerp/strmfunc.h Thu Oct 4 10:21:36 2001
***************
*** 41,56 ****
};
! //: , (stream) operator.
class StreamFunc : public StrmFunc {
public:
StreamFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return ",, is the stream operator"; }
CLASS_SYMID("StreamFunc");
};
--- 41,83 ----
};
! //: stream command
class StreamFunc : public StrmFunc {
public:
StreamFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return "strm=%s(list) -- convert list to stream"; }
CLASS_SYMID("StreamFunc");
+
+ };
+
+ //: ,, (concat) operator.
+ class ConcatFunc : public StrmFunc {
+ public:
+ ConcatFunc(ComTerp*);
+
+ virtual void execute();
+ virtual boolean post_eval() { return true; }
+ virtual const char* docstring() {
+ return ",, is the concat operator"; }
+
+ CLASS_SYMID("ConcatFunc");
+
+ };
+
+ //: hidden func used by next command for ,, (concat) operator.
+ class ConcatNextFunc : public StrmFunc {
+ public:
+ ConcatNextFunc(ComTerp*);
+
+ virtual void execute();
+ virtual const char* docstring() {
+ return "hidden func used by next command for ,, (concat) operator."; }
+
+ CLASS_SYMID("ConcatNextFunc");
};
Index: comterp/README
diff -c comterp/README:1.5 comterp/README:1.6
*** comterp/README:1.5 Fri Sep 28 14:34:06 2001
--- src/comterp_/README Thu Oct 4 10:21:38 2001
***************
*** 85,91 ****
-- decr_after 110 R-to-L unary-postfix
** repeat 90 L-to-R binary
.. iterate 80 L-to-R binary
! ,, stream 75 L-to-R binary
% mod 70 L-to-R binary
* mpy 70 L-to-R binary
/ div 70 L-to-R binary
--- 85,91 ----
-- decr_after 110 R-to-L unary-postfix
** repeat 90 L-to-R binary
.. iterate 80 L-to-R binary
! ,, concat 75 L-to-R binary
% mod 70 L-to-R binary
* mpy 70 L-to-R binary
/ div 70 L-to-R binary
Index: man1_ivtools/comterp.1
diff -c man1_ivtools/comterp.1:1.5 man1_ivtools/comterp.1:1.6
*** man1_ivtools/comterp.1:1.5 Fri Sep 28 14:34:39 2001
--- src/man/man1/comterp.1 Thu Oct 4 10:22:06 2001
***************
*** 95,101 ****
-- decr_after 110 R-to-L unary-postfix
** repeat 90 L-to-R binary
.. iterate 80 L-to-R binary
! ,, stream 75 L-to-R binary
% mod 70 L-to-R binary
* mpy 70 L-to-R binary
/ div 70 L-to-R binary
--- 95,101 ----
-- decr_after 110 R-to-L unary-postfix
** repeat 90 L-to-R binary
.. iterate 80 L-to-R binary
! ,, concat 75 L-to-R binary
% mod 70 L-to-R binary
* mpy 70 L-to-R binary
/ div 70 L-to-R binary
*** /dev/null Thu Oct 4 10:22:09 PDT 2001
--- patches/ivtools-011004-johnston-067
*************** patches/ivtools-011004-johnston-067
*** 0 ****
--- 1 ----
+ ivtools-011004-johnston-067
|
|
From: <ivt...@li...> - 2001-10-01 19:28:04
|
Patch: ivtools-011001-johnston-066 For: ivtools-0.9.6 Author: joh...@us... Subject: missing include file from last patch Requires: This is an intermediate patch to ivtools-0.9.6. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - missing include file from last patch Index: src_x11/xdrag.c diff -c src_x11/xdrag.c:1.3 src_x11/xdrag.c:1.4 *** src_x11/xdrag.c:1.3 Mon Oct 1 10:35:22 2001 --- src/IV-X11/xdrag.c Mon Oct 1 12:26:30 2001 *************** *** 38,43 **** --- 38,44 ---- #include <IV-X11/xdrag.h> #include <X11/Xatom.h> #include <OS/host.h> + #include <OS/math.h> #include <OS/types.h> #include <string.h> #include <strstream.h> Index: src_x11/xselection.c diff -c src_x11/xselection.c:1.3 src_x11/xselection.c:1.4 *** src_x11/xselection.c:1.3 Mon Oct 1 10:35:22 2001 --- src/IV-X11/xselection.c Mon Oct 1 12:26:30 2001 *************** *** 30,35 **** --- 30,36 ---- #include <IV-X11/xdisplay.h> #include <IV-X11/xselection.h> #include <IV-X11/xwindow.h> + #include <OS/math.h> #include <OS/string.h> #include <OS/table.h> #include <X11/Xatom.h> *** /dev/null Mon Oct 1 12:26:56 PDT 2001 --- patches/ivtools-011001-johnston-066 *************** patches/ivtools-011001-johnston-066 *** 0 **** --- 1 ---- + ivtools-011001-johnston-066 |
|
From: <ivt...@li...> - 2001-10-01 18:28:47
|
Patch: ivtools-011001-johnston-065
For: ivtools-0.9.6
Author: joh...@us...
Subject: fix problem with KDE X server interaction
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- fix problem with interacting with the KDE X server. Seems all other
X servers allow a negative "length" argument, which causes the server
to index backwards from a data pointer. This was not documented in
the man pages, so the KDE folks "fixed" the problem by changing the
code instead of the man page. So I have to fix the code as well.
Index: src_x11/xdrag.c
diff -c src_x11/xdrag.c:1.2 src_x11/xdrag.c:1.3
*** src_x11/xdrag.c:1.2 Thu Jun 14 10:21:33 2001
--- src/IV-X11/xdrag.c Mon Oct 1 10:35:22 2001
***************
*** 135,141 ****
XChangeProperty(
display, destination, property, XA_STRING, 8,
! PropModePrepend, (unsigned char*)value, length
);
}
--- 135,143 ----
XChangeProperty(
display, destination, property, XA_STRING, 8,
! PropModePrepend,
! (unsigned char*)value + (length<0 ? length : 0),
! Math::abs(length)
);
}
Index: src_x11/xselection.c
diff -c src_x11/xselection.c:1.2 src_x11/xselection.c:1.3
*** src_x11/xselection.c:1.2 Tue Sep 18 09:33:20 2001
--- src/IV-X11/xselection.c Mon Oct 1 10:35:22 2001
***************
*** 33,39 ****
#include <OS/string.h>
#include <OS/table.h>
#include <X11/Xatom.h>
- #include <stdio.h>
/*
* SelectionManager -- inter client communications mechanism
--- 33,38 ----
***************
*** 70,85 ****
void SelectionManager::put_value(const void* data, int length, int format) {
SelectionManagerRep& s = *rep();
- if (!s.x_req_.property) {
- fprintf(stderr, "property value of zero received from XSelectionRequestEvent\n");
- fprintf(stderr, "restart window manager and/or server to correct\n");
- fprintf(stderr, "selection mechanism effectively disabled\n");
- return;
- }
XChangeProperty(
s.xdisplay_, s.x_req_.requestor, s.x_req_.property,
/* type */ XA_STRING, format, PropModeReplace,
! (const unsigned char*)data, length
);
XEvent xe;
XSelectionEvent& xs = xe.xselection;
--- 69,79 ----
void SelectionManager::put_value(const void* data, int length, int format) {
SelectionManagerRep& s = *rep();
XChangeProperty(
s.xdisplay_, s.x_req_.requestor, s.x_req_.property,
/* type */ XA_STRING, format, PropModeReplace,
! (const unsigned char*)data - (length<0 ? length : 0),
! Math::abs(length)
);
XEvent xe;
XSelectionEvent& xs = xe.xselection;
*** /dev/null Mon Oct 1 10:35:48 PDT 2001
--- patches/ivtools-011001-johnston-065
*************** patches/ivtools-011001-johnston-065
*** 0 ****
--- 1 ----
+ ivtools-011001-johnston-065
|
|
From: <ivt...@li...> - 2001-09-28 23:01:58
|
Patch: ivtools-010928-johnston-064
For: ivtools-0.9.6
Author: joh...@us...
Subject: equate lists to arrays in all the comterp API's
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- equate lists to arrays in all the API of ComValue, and make
type(strm) return ListType instead of ArrayType.
Index: Attribute/attrvalue.c
diff -c Attribute/attrvalue.c:1.5 Attribute/attrvalue.c:1.6
*** Attribute/attrvalue.c:1.5 Mon Sep 24 17:21:22 2001
--- src/Attribute/attrvalue.c Fri Sep 28 16:00:07 2001
***************
*** 165,171 ****
}
void AttributeValue::clear() {
- unref_as_needed();
unsigned char* buf = (unsigned char*)(void*)&_v;
for (int i=0; i<sizeof(double); i++) buf[i] = '\0';
}
--- 165,170 ----
***************
*** 208,213 ****
--- 207,214 ----
unsigned int& AttributeValue::obj_type_ref() { return _v.objval.type; }
AttributeValueList*& AttributeValue::array_ref() { return _v.arrayval.ptr; }
unsigned int& AttributeValue::array_type_ref() { return _v.arrayval.type; }
+ AttributeValueList*& AttributeValue::list_ref() { return _v.arrayval.ptr; }
+ unsigned int& AttributeValue::list_type_ref() { return _v.arrayval.type; }
unsigned int& AttributeValue::keyid_ref() { return _v.keyval.keyid; }
unsigned int& AttributeValue::keynarg_ref() { return _v.keyval.keynarg; }
***************
*** 589,594 ****
--- 590,603 ----
return _v.arrayval.type;
}
+ AttributeValueList* AttributeValue::list_val() {
+ return list_ref();
+ }
+
+ unsigned int AttributeValue::list_type_val() {
+ return _v.arrayval.type;
+ }
+
unsigned int AttributeValue::keyid_val() {
return _v.keyval.keyid;
}
***************
*** 612,617 ****
--- 621,633 ----
return 0;
}
+ int AttributeValue::list_len() {
+ if (is_type(AttributeValue::ArrayType))
+ return array_val()->Number();
+ else
+ return 0;
+ }
+
int AttributeValue::command_symid() { return _command_symid; }
void AttributeValue::command_symid(int id, boolean alias) {
_command_symid = (alias ? -1 : 1) * id; }
***************
*** 689,695 ****
case AttributeValue::ArrayType:
{
! out << "array of length " << svp->array_len();
ALIterator i;
AttributeValueList* avl = svp->array_val();
avl->First(i);
--- 705,711 ----
case AttributeValue::ArrayType:
{
! out << "list of length " << svp->array_len();
ALIterator i;
AttributeValueList* avl = svp->array_val();
avl->First(i);
***************
*** 943,949 ****
_type_syms[i++] = symbol_add("DoubleType");
_type_syms[i++] = symbol_add("StringType");
_type_syms[i++] = symbol_add("SymbolType");
! _type_syms[i++] = symbol_add("ArrayType");
_type_syms[i++] = symbol_add("StreamType");
_type_syms[i++] = symbol_add("CommandType");
_type_syms[i++] = symbol_add("KeywordType");
--- 959,965 ----
_type_syms[i++] = symbol_add("DoubleType");
_type_syms[i++] = symbol_add("StringType");
_type_syms[i++] = symbol_add("SymbolType");
! _type_syms[i++] = symbol_add("ListType");
_type_syms[i++] = symbol_add("StreamType");
_type_syms[i++] = symbol_add("CommandType");
_type_syms[i++] = symbol_add("KeywordType");
Index: Attribute/attrvalue.h
diff -c Attribute/attrvalue.h:1.4 Attribute/attrvalue.h:1.5
*** Attribute/attrvalue.h:1.4 Mon Sep 24 17:21:22 2001
--- src/Attribute/attrvalue.h Fri Sep 28 16:00:07 2001
***************
*** 104,110 ****
enum ValueType { UnknownType, CharType, UCharType, ShortType, UShortType,
IntType, UIntType, LongType, ULongType, FloatType, DoubleType,
StringType, SymbolType, ArrayType, StreamType, CommandType, KeywordType,
! ObjectType, EofType, BooleanType, OperatorType, BlankType };
// enum for attribute value types.
AttributeValue(ValueType type);
--- 104,112 ----
enum ValueType { UnknownType, CharType, UCharType, ShortType, UShortType,
IntType, UIntType, LongType, ULongType, FloatType, DoubleType,
StringType, SymbolType, ArrayType, StreamType, CommandType, KeywordType,
! ObjectType, EofType, BooleanType, OperatorType, BlankType,
! ListType = ArrayType
! };
// enum for attribute value types.
AttributeValue(ValueType type);
***************
*** 141,154 ****
AttributeValue(int class_symid, void* objptr);
// ObjectType constructor.
AttributeValue(AttributeValueList* listptr);
! // ArrayType constructor.
AttributeValue(void* comfunc, AttributeValueList* vallist);
// StreamType constructor.
AttributeValue(const char* val);
// StringType constructor.
virtual ~AttributeValue();
! // set to UnknownType and unref pointer if ArrayType.
void clear();
// clear bytes of multi-value union
--- 143,156 ----
AttributeValue(int class_symid, void* objptr);
// ObjectType constructor.
AttributeValue(AttributeValueList* listptr);
! // ArrayType/ListType constructor.
AttributeValue(void* comfunc, AttributeValueList* vallist);
// StreamType constructor.
AttributeValue(const char* val);
// StringType constructor.
virtual ~AttributeValue();
! // set to UnknownType and unref pointer if ArrayType/ListType or StreamType.
void clear();
// clear bytes of multi-value union
***************
*** 187,192 ****
--- 189,196 ----
unsigned int& obj_type_ref(); // classid of object by reference.
AttributeValueList*& array_ref(); // values in list by reference.
unsigned int& array_type_ref(); // type of values in list by reference
+ AttributeValueList*& list_ref(); // values in list by reference.
+ unsigned int& list_type_ref(); // type of values in list by reference
unsigned int& keyid_ref(); // symbol id of keyword by reference.
unsigned int& keynarg_ref(); // number of arguments after keyword by reference.
***************
*** 208,213 ****
--- 212,219 ----
unsigned int& class_symid(); // classid of object by value.
AttributeValueList* array_val(); // values in list by value.
unsigned int array_type_val(); // type of values in list by value
+ AttributeValueList* list_val(); // values in list by value.
+ unsigned int list_type_val(); // type of values in list by value
unsigned int keyid_val(); // symbol id of keyword by value.
unsigned int keynarg_val(); // number of arguments after keyword by value.
***************
*** 219,225 ****
void global_flag(boolean flag);
// set global flag of a symbol
int array_len();
! // length of list of values when ArrayType.
int command_symid();
// symbol id of associated command name, for use with ComTerp.
--- 225,233 ----
void global_flag(boolean flag);
// set global flag of a symbol
int array_len();
! // length of list of values when ArrayType/ListType.
! int list_len();
! // length of list of values when ArrayType/ListType.
int command_symid();
// symbol id of associated command name, for use with ComTerp.
***************
*** 279,285 ****
// same as AttributeValue::is_num().
boolean is_array() { return is_type(ArrayType); }
! // returns true if ArrayType.
boolean is_stream() { return is_type(StreamType); }
// returns true if StreamType.
boolean is_key() { return is_type(KeywordType); }
--- 287,295 ----
// same as AttributeValue::is_num().
boolean is_array() { return is_type(ArrayType); }
! // returns true if ArrayType/ListType.
! boolean is_list() { return is_type(ArrayType); }
! // returns true if ArrayType/ListType.
boolean is_stream() { return is_type(StreamType); }
// returns true if StreamType.
boolean is_key() { return is_type(KeywordType); }
Index: ComTerp/comvalue.c
diff -c ComTerp/comvalue.c:1.4 ComTerp/comvalue.c:1.5
*** ComTerp/comvalue.c:1.4 Fri Sep 28 14:34:04 2001
--- src/ComTerp/comvalue.c Fri Sep 28 16:00:09 2001
***************
*** 276,282 ****
}
if (!first) out << "}";
} else {
! out << "array of length " << svp->array_len();
ALIterator i;
AttributeValueList* avl = svp->array_val();
avl->First(i);
--- 276,282 ----
}
if (!first) out << "}";
} else {
! out << "list of length " << svp->array_len();
ALIterator i;
AttributeValueList* avl = svp->array_val();
avl->First(i);
Index: ComTerp/comvalue.h
diff -c ComTerp/comvalue.h:1.2 ComTerp/comvalue.h:1.3
*** ComTerp/comvalue.h:1.2 Mon Sep 24 17:21:25 2001
--- src/ComTerp/comvalue.h Fri Sep 28 16:00:09 2001
***************
*** 79,85 ****
ComValue(int class_symid, void* ptr);
// ObjectType constructor.
ComValue(AttributeValueList* listptr);
! // ArrayType constructor.
ComValue(void* funcptr, AttributeValueList* listptr);
// StreamType constructor.
ComValue(const char* val);
--- 79,85 ----
ComValue(int class_symid, void* ptr);
// ObjectType constructor.
ComValue(AttributeValueList* listptr);
! // ArrayType/ListType constructor.
ComValue(void* funcptr, AttributeValueList* listptr);
// StreamType constructor.
ComValue(const char* val);
*** /dev/null Fri Sep 28 16:00:37 PDT 2001
--- patches/ivtools-010928-johnston-064
*************** patches/ivtools-010928-johnston-064
*** 0 ****
--- 1 ----
+ ivtools-010928-johnston-064
|
|
From: <ivt...@li...> - 2001-09-28 22:15:43
|
Patch: ivtools-010928-johnston-063
For: ivtools-0.9.6
Author: joh...@us...
Subject: make list(strm) work
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- makes list(strm) work. Now you can convert streams to lists and
lists to streams (with stream(lst)).
Index: ComTerp/listfunc.c
diff -c ComTerp/listfunc.c:1.2 ComTerp/listfunc.c:1.3
*** ComTerp/listfunc.c:1.2 Fri Sep 28 14:34:04 2001
--- src/ComTerp/listfunc.c Fri Sep 28 15:14:34 2001
***************
*** 57,63 ****
push_funcstate(1,0);
nextfunc.execute();
pop_funcstate();
! AttributeValue* newval = new AttributeValue(pop_stack());
if (newval->is_unknown()) {
done = true;
delete newval;
--- 57,63 ----
push_funcstate(1,0);
nextfunc.execute();
pop_funcstate();
! AttributeValue* newval = new AttributeValue(comterp()->pop_stack());
if (newval->is_unknown()) {
done = true;
delete newval;
*** /dev/null Fri Sep 28 15:14:52 PDT 2001
--- patches/ivtools-010928-johnston-063
*************** patches/ivtools-010928-johnston-063
*** 0 ****
--- 1 ----
+ ivtools-010928-johnston-063
|
|
From: <ivt...@li...> - 2001-09-28 21:36:45
|
Patch: ivtools-010928-johnston-062
For: ivtools-0.9.6
Author: joh...@us...
Subject: partial implementation of new stream and list concepts
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- partial implementation of new stream and list concepts in comterp.
Now ",," is the stream concatenator, and "," remains the list
concatenator. stream(lst) converts a list to a stream, and list(strm)
will converts a stream to a list (as soon as I debug it).
Index: ComUtil/optable.c
diff -c ComUtil/optable.c:1.2 ComUtil/optable.c:1.3
*** ComUtil/optable.c:1.2 Thu Aug 16 12:20:53 2001
--- src/ComUtil/optable.c Fri Sep 28 14:34:01 2001
***************
*** 90,95 ****
--- 90,96 ----
{"--", "decr_after", 110, TRUE, OPTYPE_UNARY_POSTFIX },
{"**", "repeat", 90, FALSE, OPTYPE_BINARY },
{"..", "iterate", 80, FALSE, OPTYPE_BINARY },
+ {",,", "stream", 75, FALSE, OPTYPE_BINARY },
{"%", "mod", 70, FALSE, OPTYPE_BINARY },
{"*", "mpy", 70, FALSE, OPTYPE_BINARY },
{"/", "div", 70, FALSE, OPTYPE_BINARY },
***************
*** 108,114 ****
{"|", "bit_or", 42, FALSE, OPTYPE_BINARY },
{"&&", "and", 41, FALSE, OPTYPE_BINARY },
{"||", "or", 40, FALSE, OPTYPE_BINARY },
! {",", "stream", 35, FALSE, OPTYPE_BINARY },
{"%=", "mod_assign", 30, TRUE, OPTYPE_BINARY },
{"*=", "mpy_assign", 30, TRUE, OPTYPE_BINARY },
{"+=", "add_assign", 30, TRUE, OPTYPE_BINARY },
--- 109,115 ----
{"|", "bit_or", 42, FALSE, OPTYPE_BINARY },
{"&&", "and", 41, FALSE, OPTYPE_BINARY },
{"||", "or", 40, FALSE, OPTYPE_BINARY },
! {",", "tuple", 35, FALSE, OPTYPE_BINARY },
{"%=", "mod_assign", 30, TRUE, OPTYPE_BINARY },
{"*=", "mpy_assign", 30, TRUE, OPTYPE_BINARY },
{"+=", "add_assign", 30, TRUE, OPTYPE_BINARY },
***************
*** 911,916 ****
--- 912,918 ----
-- decr_after 110 Y UNARY POSTFIX
** repeat 90 N BINARY
.. iterate 80 N BINARY
+ ,, stream 75 N BINARY
% mod 70 N BINARY
* mpy 70 N BINARY
/ div 70 N BINARY
***************
*** 929,935 ****
| bit_or 42 N BINARY
&& and 41 N BINARY
|| or 40 N BINARY
! , stream 35 N BINARY
%= mod_assign 30 Y BINARY
*= mpy_assign 30 Y BINARY
+= add_assign 30 Y BINARY
--- 931,937 ----
| bit_or 42 N BINARY
&& and 41 N BINARY
|| or 40 N BINARY
! , tuple 35 N BINARY
%= mod_assign 30 Y BINARY
*= mpy_assign 30 Y BINARY
+= add_assign 30 Y BINARY
Index: ComTerp/comterp.c
diff -c ComTerp/comterp.c:1.8 ComTerp/comterp.c:1.9
*** ComTerp/comterp.c:1.8 Mon Sep 24 17:21:25 2001
--- src/ComTerp/comterp.c Fri Sep 28 14:34:04 2001
***************
*** 942,947 ****
--- 942,948 ----
add_command("list", new ListFunc(this));
add_command("at", new ListAtFunc(this));
add_command("size", new ListSizeFunc(this));
+ add_command("tuple", new TupleFunc(this));
add_command("sum", new SumFunc(this));
add_command("mean", new MeanFunc(this));
Index: ComTerp/comvalue.c
diff -c ComTerp/comvalue.c:1.3 ComTerp/comvalue.c:1.4
*** ComTerp/comvalue.c:1.3 Mon Sep 24 17:21:25 2001
--- src/ComTerp/comvalue.c Fri Sep 28 14:34:04 2001
***************
*** 51,57 ****
ComValue::ComValue(ComValue& sv) {
*this = sv;
! ref_as_needed();}
ComValue::ComValue(AttributeValue& sv) {
*(AttributeValue*)this = sv;
--- 51,58 ----
ComValue::ComValue(ComValue& sv) {
*this = sv;
! ref_as_needed();
! }
ComValue::ComValue(AttributeValue& sv) {
*(AttributeValue*)this = sv;
Index: ComTerp/listfunc.c
diff -c ComTerp/listfunc.c:1.1 ComTerp/listfunc.c:1.2
*** ComTerp/listfunc.c:1.1 Thu Jan 4 15:31:42 2001
--- src/ComTerp/listfunc.c Fri Sep 28 14:34:04 2001
***************
*** 1,4 ****
--- 1,5 ----
/*
+ * Copyright (c) 2001 Scott E. Johnston
* Copyright (c) 2000 IET Inc.
* Copyright (c) 1999 Vectaport Inc.
*
***************
*** 23,28 ****
--- 24,30 ----
*/
#include <ComTerp/listfunc.h>
+ #include <ComTerp/strmfunc.h>
#include <ComTerp/comvalue.h>
#include <ComTerp/comterp.h>
#include <Attribute/aliterator.h>
***************
*** 38,49 ****
}
void ListFunc::execute() {
! ComValue listv(stack_arg(0));
reset_stack();
! AttributeValueList* avl = listv.is_array()
! ? new AttributeValueList(listv.array_val())
! : new AttributeValueList();
Resource::ref(avl);
ComValue retval(avl);
push_stack(retval);
--- 40,71 ----
}
void ListFunc::execute() {
! ComValue listv(stack_arg_post_eval(0));
reset_stack();
+
+ AttributeValueList* avl;
! if (listv.is_array())
! avl = new AttributeValueList(listv.array_val());
! else {
! avl = new AttributeValueList();
! if (listv.is_stream()) {
! NextFunc nextfunc(comterp());
! boolean done = false;
! while (!done) {
! push_stack(listv);
! push_funcstate(1,0);
! nextfunc.execute();
! pop_funcstate();
! AttributeValue* newval = new AttributeValue(pop_stack());
! if (newval->is_unknown()) {
! done = true;
! delete newval;
! } else
! avl->Append(newval);
! }
! }
! }
Resource::ref(avl);
ComValue retval(avl);
push_stack(retval);
***************
*** 117,120 ****
--- 139,168 ----
push_stack(ComValue::nullval());
}
+
+ /*****************************************************************************/
+
+ int TupleFunc::_symid;
+
+ TupleFunc::TupleFunc(ComTerp* comterp) : ComFunc(comterp) {
+ }
+
+ void TupleFunc::execute() {
+ ComValue* operand1 = new ComValue(stack_arg(0));
+ ComValue* operand2 = new ComValue(stack_arg(1));
+ reset_stack();
+
+ if (!operand1->is_type(ComValue::ArrayType)) {
+ AttributeValueList* avl = new AttributeValueList();
+ avl->Append(operand1);
+ avl->Append(operand2);
+ ComValue retval(avl);
+ push_stack(retval);
+ } else {
+ AttributeValueList* avl = operand1->array_val();
+ avl->Append(operand2);
+ push_stack(*operand1);
+ delete operand1;
+ }
+ }
Index: ComTerp/listfunc.h
diff -c ComTerp/listfunc.h:1.1 ComTerp/listfunc.h:1.2
*** ComTerp/listfunc.h:1.1 Thu Jan 4 15:31:42 2001
--- src/ComTerp/listfunc.h Fri Sep 28 14:34:04 2001
***************
*** 1,4 ****
--- 1,5 ----
/*
+ * Copyright (c) 2001 Scott E. Johnston
* Copyright (c) 2000 IET Inc.
* Copyright (c) 1999 Vectaport Inc.
*
***************
*** 35,46 ****
class ComValue;
//: create list command for ComTerp.
! // lst=list([olst]) -- create an empty list or copy existing one.
class ListFunc : public ComFunc {
public:
ListFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
return "lst=%s([olst]) -- create an empty list or copy existing one"; }
};
--- 36,48 ----
class ComValue;
//: create list command for ComTerp.
! // lst=list([olst|strm]) -- create list, copy list, or convert stream
class ListFunc : public ComFunc {
public:
ListFunc(ComTerp*);
virtual void execute();
+ virtual boolean post_eval() { return true; }
virtual const char* docstring() {
return "lst=%s([olst]) -- create an empty list or copy existing one"; }
};
***************
*** 66,70 ****
--- 68,86 ----
virtual const char* docstring() {
return "val=size(list|attrlist) -- return the size of the list"; }
};
+
+ //: , (tuple) operator.
+ class TupleFunc : public ComFunc {
+ public:
+ TupleFunc(ComTerp*);
+
+ virtual void execute();
+ virtual const char* docstring() {
+ return ", is the tuple operator"; }
+
+ CLASS_SYMID("TupleFunc");
+
+ };
+
#endif /* !defined(_listfunc_h) */
Index: ComTerp/strmfunc.c
diff -c ComTerp/strmfunc.c:1.2 ComTerp/strmfunc.c:1.3
*** ComTerp/strmfunc.c:1.2 Mon Sep 24 17:21:25 2001
--- src/ComTerp/strmfunc.c Fri Sep 28 14:34:04 2001
***************
*** 46,68 ****
}
void StreamFunc::execute() {
! ComValue* operand1 = new ComValue(stack_arg(0));
ComValue* operand2 = new ComValue(stack_arg(1));
reset_stack();
!
if (!operand1->is_type(ComValue::ArrayType)) {
! AttributeValueList* avl = new AttributeValueList();
! avl->Append(operand1);
! avl->Append(operand2);
! ComValue retval(avl);
! push_stack(retval);
} else {
! AttributeValueList* avl = operand1->array_val();
! avl->Append(operand2);
! push_stack(*operand1);
! delete operand1;
}
!
}
/*****************************************************************************/
--- 46,125 ----
}
void StreamFunc::execute() {
! ComValue operand1(stack_arg(0));
!
! if (nargs()==1) {
! reset_stack();
!
! if (operand1.is_stream()) {
!
! /* invoked by the next command */
! AttributeValueList* avl = operand1.stream_list();
! if (avl) {
! Iterator i;
! avl->First(i);
! AttributeValue* retval = avl->Done(i) ? nil : avl->GetAttrVal(i);
! if (retval) {
! push_stack(*retval);
! avl->Remove(retval);
! delete retval;
! } else {
! operand1.stream_list(nil);
! push_stack(ComValue::nullval());
! }
! } else
! push_stack(ComValue::nullval());
!
! } else {
!
! /* conversion operator */
! if (operand1.is_array()) {
! AttributeValueList* avl = new AttributeValueList(operand1.array_val());
! ComValue stream(this, avl);
! stream.stream_mode(-1); // for internal use (use by this func)
! push_stack(stream);
! }
!
! }
! } else {
!
! #if 0
! if (operand1.is_stream()) {
! reset_stack();
! AttributeValueList* avl = operand1.stream_list();
! if (avl) {
! Iterator i;
! avl->First(i);
! AttributeValue* repval = avl->GetAttrVal(i);
! avl->Next(i);
! AttributeValue* cntval = avl->GetAttrVal(i);
! if (cntval->int_val()>0)
! push_stack(*repval);
! else
! push_stack(ComValue::nullval());
! cntval->int_ref()--;
! } else
! push_stack(ComValue::nullval());
! return;
! }
!
ComValue* operand2 = new ComValue(stack_arg(1));
reset_stack();
!
if (!operand1->is_type(ComValue::ArrayType)) {
! AttributeValueList* avl = new AttributeValueList();
! avl->Append(operand1);
! avl->Append(operand2);
! ComValue retval(avl);
! push_stack(retval);
} else {
! AttributeValueList* avl = operand1->array_val();
! avl->Append(operand2);
! push_stack(*operand1);
! delete operand1;
}
! #endif
! }
}
/*****************************************************************************/
Index: ComTerp/strmfunc.h
diff -c ComTerp/strmfunc.h:1.2 ComTerp/strmfunc.h:1.3
*** ComTerp/strmfunc.h:1.2 Mon Sep 24 17:21:25 2001
--- src/ComTerp/strmfunc.h Fri Sep 28 14:34:04 2001
***************
*** 48,54 ****
virtual void execute();
virtual const char* docstring() {
! return ", is the stream operator"; }
CLASS_SYMID("StreamFunc");
--- 48,54 ----
virtual void execute();
virtual const char* docstring() {
! return ",, is the stream operator"; }
CLASS_SYMID("StreamFunc");
Index: comterp/README
diff -c comterp/README:1.4 comterp/README:1.5
*** comterp/README:1.4 Wed Sep 26 01:58:38 2001
--- src/comterp_/README Fri Sep 28 14:34:06 2001
***************
*** 85,90 ****
--- 85,91 ----
-- decr_after 110 R-to-L unary-postfix
** repeat 90 L-to-R binary
.. iterate 80 L-to-R binary
+ ,, stream 75 L-to-R binary
% mod 70 L-to-R binary
* mpy 70 L-to-R binary
/ div 70 L-to-R binary
***************
*** 103,109 ****
| bit_or 42 L-to-R binary
&& and 41 L-to-R binary
|| or 40 L-to-R binary
! , stream 35 L-to-R binary
%= mod_assign 30 R-to-L binary
*= mpy_assign 30 R-to-L binary
+= add_assign 30 R-to-L binary
--- 104,110 ----
| bit_or 42 L-to-R binary
&& and 41 L-to-R binary
|| or 40 L-to-R binary
! , tuple 35 L-to-R binary
%= mod_assign 30 R-to-L binary
*= mpy_assign 30 R-to-L binary
+= add_assign 30 R-to-L binary
***************
*** 172,186 ****
LIST COMMANDS:
! lst=list([olst]) -- create an empty list or copy existing one
val=at(list|attrlist n) -- return nth item in a list
num=size(list|attrlist) -- return size of a list
STREAM COMMANDS:
! val=next(stream) -- return next value from stream
CONTROL COMMANDS (using post evaluation):
--- 173,190 ----
LIST COMMANDS:
! lst=list([olst|strm]) -- create list, copy list, or convert stream
val=at(list|attrlist n) -- return nth item in a list
num=size(list|attrlist) -- return size of a list
+
STREAM COMMANDS:
+
+ val=next(strm) -- return next value from stream
! strm=stream(list) -- convert list to stream
CONTROL COMMANDS (using post evaluation):
Index: man1_ivtools/comterp.1
diff -c man1_ivtools/comterp.1:1.4 man1_ivtools/comterp.1:1.5
*** man1_ivtools/comterp.1:1.4 Wed Sep 26 01:58:59 2001
--- src/man/man1/comterp.1 Fri Sep 28 14:34:39 2001
***************
*** 95,100 ****
--- 95,101 ----
-- decr_after 110 R-to-L unary-postfix
** repeat 90 L-to-R binary
.. iterate 80 L-to-R binary
+ ,, stream 75 L-to-R binary
% mod 70 L-to-R binary
* mpy 70 L-to-R binary
/ div 70 L-to-R binary
***************
*** 113,119 ****
| bit_or 42 L-to-R binary
&& and 41 L-to-R binary
|| or 40 L-to-R binary
! , stream 35 L-to-R binary
%= mod_assign 30 R-to-L binary
*= mpy_assign 30 R-to-L binary
+= add_assign 30 R-to-L binary
--- 114,120 ----
| bit_or 42 L-to-R binary
&& and 41 L-to-R binary
|| or 40 L-to-R binary
! , tuple 35 L-to-R binary
%= mod_assign 30 R-to-L binary
*= mpy_assign 30 R-to-L binary
+= add_assign 30 R-to-L binary
***************
*** 183,197 ****
.SH LIST COMMANDS:
! lst=list([olst]) -- create an empty list or copy existing one
val=at(list|attrlist n) -- return nth item in a list
num=size(list|attrlist) -- return size of a list
! .SH LIST COMMANDS:
val=next(stream) -- return next value from stream
.SH CONTROL COMMANDS (using post evaluation):
--- 184,200 ----
.SH LIST COMMANDS:
! lst=list([olst|strm]) -- create list, copy list, or convert stream
val=at(list|attrlist n) -- return nth item in a list
num=size(list|attrlist) -- return size of a list
! .SH STREAM COMMANDS:
val=next(stream) -- return next value from stream
+
+ strm=stream(list) -- convert list to stream
.SH CONTROL COMMANDS (using post evaluation):
*** /dev/null Fri Sep 28 14:34:42 PDT 2001
--- patches/ivtools-010928-johnston-062
*************** patches/ivtools-010928-johnston-062
*** 0 ****
--- 1 ----
+ ivtools-010928-johnston-062
|
|
From: <ivt...@li...> - 2001-09-25 17:52:13
|
Patch: ivtools-010926-johnston-060
For: ivtools-0.9.6
Author: joh...@us...
Subject: change while loop :notnil to :nilchk
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- change the while command's :notnil flag to :nilchk, to make sense
for both cases, with and without :until.
Index: ComTerp/postfunc.c
diff -c ComTerp/postfunc.c:1.5 ComTerp/postfunc.c:1.6
*** ComTerp/postfunc.c:1.5 Wed Sep 26 01:51:10 2001
--- src/ComTerp/postfunc.c Wed Sep 26 01:58:36 2001
***************
*** 165,178 ****
void WhileFunc::execute() {
static int body_symid = symbol_add("body");
static int until_symid = symbol_add("until");
! static int notnil_symid = symbol_add("notnil");
ComValue untilflag(stack_key_post_eval(until_symid));
! ComValue notnilflag(stack_key_post_eval(notnil_symid));
ComValue* bodyexpr = nil;
while (1) {
if (untilflag.is_false()) {
ComValue doneexpr(stack_arg_post_eval(0));
! if (notnilflag.is_false() ? doneexpr.is_false() : doneexpr.is_unknown()) break;
}
delete bodyexpr;
ComValue keybody(stack_key_post_eval(body_symid, false, ComValue::unkval(), true));
--- 165,178 ----
void WhileFunc::execute() {
static int body_symid = symbol_add("body");
static int until_symid = symbol_add("until");
! static int nilchk_symid = symbol_add("nilchk");
ComValue untilflag(stack_key_post_eval(until_symid));
! ComValue nilchkflag(stack_key_post_eval(nilchk_symid));
ComValue* bodyexpr = nil;
while (1) {
if (untilflag.is_false()) {
ComValue doneexpr(stack_arg_post_eval(0));
! if (nilchkflag.is_false() ? doneexpr.is_false() : doneexpr.is_unknown()) break;
}
delete bodyexpr;
ComValue keybody(stack_key_post_eval(body_symid, false, ComValue::unkval(), true));
***************
*** 182,188 ****
bodyexpr = new ComValue(keybody);
if (untilflag.is_true()) {
ComValue doneexpr(stack_arg_post_eval(0));
! if (notnilflag.is_false() ? doneexpr.is_true() : doneexpr.is_unknown()) break;
}
}
reset_stack();
--- 182,188 ----
bodyexpr = new ComValue(keybody);
if (untilflag.is_true()) {
ComValue doneexpr(stack_arg_post_eval(0));
! if (nilchkflag.is_false() ? doneexpr.is_true() : doneexpr.is_unknown()) break;
}
}
reset_stack();
Index: ComTerp/postfunc.h
diff -c ComTerp/postfunc.h:1.2 ComTerp/postfunc.h:1.3
*** ComTerp/postfunc.h:1.2 Wed Sep 26 01:51:10 2001
--- src/ComTerp/postfunc.h Wed Sep 26 01:58:36 2001
***************
*** 82,88 ****
};
//: while-loop command for ComTerp.
! // val=while([testexpr [bodyexpr]] :notnil :until :body expr ) -- while loop.
class WhileFunc : public ComFunc {
public:
WhileFunc(ComTerp*);
--- 82,88 ----
};
//: while-loop command for ComTerp.
! // val=while([testexpr [bodyexpr]] :nilchk :until :body expr ) -- while loop.
class WhileFunc : public ComFunc {
public:
WhileFunc(ComTerp*);
***************
*** 90,96 ****
virtual boolean post_eval() { return true; }
virtual const char* docstring() {
! return "val=%s([testexpr [bodyexpr]] :notnil :until :body expr ) -- while loop"; }
};
#endif /* !defined(_postfunc_h) */
--- 90,96 ----
virtual boolean post_eval() { return true; }
virtual const char* docstring() {
! return "val=%s([testexpr [bodyexpr]] :nilchk :until :body expr ) -- while loop"; }
};
#endif /* !defined(_postfunc_h) */
Index: comterp/README
diff -c comterp/README:1.3 comterp/README:1.4
*** comterp/README:1.3 Mon Sep 24 17:21:28 2001
--- src/comterp_/README Wed Sep 26 01:58:38 2001
***************
*** 192,198 ****
val=for(initexpr whileexpr [nextexpr [bodyexpr]] :body expr) -- for loop
! val=while([testexpr [bodyexpr]] :until :body expr ) -- while loop
OTHER COMMANDS
--- 192,198 ----
val=for(initexpr whileexpr [nextexpr [bodyexpr]] :body expr) -- for loop
! val=while([testexpr [bodyexpr]] :nilchk :until :body expr ) -- while loop
OTHER COMMANDS
Index: man1_ivtools/comterp.1
diff -c man1_ivtools/comterp.1:1.3 man1_ivtools/comterp.1:1.4
*** man1_ivtools/comterp.1:1.3 Mon Sep 24 17:22:27 2001
--- src/man/man1/comterp.1 Wed Sep 26 01:58:59 2001
***************
*** 201,207 ****
val=for(initexpr whileexpr [nextexpr [bodyexpr]] :body expr) -- for loop
! val=while([testexpr [bodyexpr]] :until :body expr ) -- while loop
.SH OTHER COMMANDS
--- 201,207 ----
val=for(initexpr whileexpr [nextexpr [bodyexpr]] :body expr) -- for loop
! val=while([testexpr [bodyexpr]] :nilchk :until :body expr ) -- while loop
.SH OTHER COMMANDS
*** /dev/null Wed Sep 26 01:59:04 PDT 2001
--- patches/ivtools-010926-johnston-060
*************** patches/ivtools-010926-johnston-060
*** 0 ****
--- 1 ----
+ ivtools-010926-johnston-060
|
|
From: <ivt...@li...> - 2001-09-25 17:52:01
|
Patch: ivtools-010926-johnston-059
For: ivtools-0.9.6
Author: joh...@us...
Subject: add partial-string and symbol comparison to all equality operators, :notnil test to while loop
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- adds partial-string (:n) and symbol (:sym) comparison to the rest of
the equality operators (!=, >, <, >=, <=).
- add test for :notnil to while loop.
Index: ComTerp/boolfunc.c
diff -c ComTerp/boolfunc.c:1.2 ComTerp/boolfunc.c:1.3
*** ComTerp/boolfunc.c:1.2 Wed Sep 26 01:03:15 2001
--- src/ComTerp/boolfunc.c Wed Sep 26 01:51:10 2001
***************
*** 1,4 ****
--- 1,5 ----
/*
+ * Copyright (c) 2001 Scott E. Johnston
* Copyright (c) 2000 IET Inc.
* Copyright (c) 1994-1997 Vectaport Inc.
*
***************
*** 29,34 ****
--- 30,38 ----
#define TITLE "BoolFunc"
+ static int sym_symid = symbol_add("sym");
+ static int n_symid = symbol_add("n");
+
/*****************************************************************************/
AndFunc::AndFunc(ComTerp* comterp) : NumFunc(comterp) {
***************
*** 190,201 ****
}
void EqualFunc::execute() {
- static int sym_symid = symbol_add("sym");
boolean symflag = stack_key(sym_symid).is_true();
ComValue& operand1 = stack_arg(0, symflag);
ComValue& operand2 = stack_arg(1, symflag);
- static int n_symid = symbol_add("n");
- ComValue& nval =stack_key(n_symid);
promote(operand1, operand2);
ComValue result(operand1);
result.type(ComValue::BooleanType);
--- 194,204 ----
}
void EqualFunc::execute() {
boolean symflag = stack_key(sym_symid).is_true();
+ ComValue& nval = stack_key(n_symid);
+
ComValue& operand1 = stack_arg(0, symflag);
ComValue& operand2 = stack_arg(1, symflag);
promote(operand1, operand2);
ComValue result(operand1);
result.type(ComValue::BooleanType);
***************
*** 259,270 ****
}
void NotEqualFunc::execute() {
- static int sym_symid = symbol_add("sym");
boolean symflag = stack_key(sym_symid).is_true();
ComValue& operand1 = stack_arg(0);
ComValue& operand2 = stack_arg(1);
- static int n_symid = symbol_add("n");
- ComValue& nval =stack_key(n_symid);
promote(operand1, operand2);
ComValue result(operand1);
result.type(ComValue::BooleanType);
--- 262,272 ----
}
void NotEqualFunc::execute() {
boolean symflag = stack_key(sym_symid).is_true();
+ ComValue& nval = stack_key(n_symid);
+
ComValue& operand1 = stack_arg(0);
ComValue& operand2 = stack_arg(1);
promote(operand1, operand2);
ComValue result(operand1);
result.type(ComValue::BooleanType);
***************
*** 322,327 ****
--- 324,332 ----
}
void GreaterThanFunc::execute() {
+ boolean symflag = stack_key(sym_symid).is_true();
+ ComValue& nval = stack_key(n_symid);
+
ComValue& operand1 = stack_arg(0);
ComValue& operand2 = stack_arg(1);
promote(operand1, operand2);
***************
*** 359,364 ****
--- 364,377 ----
case ComValue::DoubleType:
result.boolean_ref() = operand1.double_val() > operand2.double_val();
break;
+ case ComValue::SymbolType:
+ const char* str1 = operand1.symbol_ptr();
+ const char* str2 = operand2.symbol_ptr();
+ if (nval.is_unknown())
+ result.boolean_ref() = strcmp(str1, str2)>0;
+ else
+ result.boolean_ref() = strncmp(str1, str2, nval.int_val())>0;
+ break;
}
reset_stack();
push_stack(result);
***************
*** 368,373 ****
--- 381,389 ----
}
void GreaterThanOrEqualFunc::execute() {
+ boolean symflag = stack_key(sym_symid).is_true();
+ ComValue& nval = stack_key(n_symid);
+
ComValue& operand1 = stack_arg(0);
ComValue& operand2 = stack_arg(1);
promote(operand1, operand2);
***************
*** 405,410 ****
--- 421,434 ----
case ComValue::DoubleType:
result.boolean_ref() = operand1.double_val() >= operand2.double_val();
break;
+ case ComValue::SymbolType:
+ const char* str1 = operand1.symbol_ptr();
+ const char* str2 = operand2.symbol_ptr();
+ if (nval.is_unknown())
+ result.boolean_ref() = strcmp(str1, str2)>=0;
+ else
+ result.boolean_ref() = strncmp(str1, str2, nval.int_val())>=0;
+ break;
}
reset_stack();
push_stack(result);
***************
*** 414,419 ****
--- 438,446 ----
}
void LessThanFunc::execute() {
+ boolean symflag = stack_key(sym_symid).is_true();
+ ComValue& nval = stack_key(n_symid);
+
ComValue& operand1 = stack_arg(0);
ComValue& operand2 = stack_arg(1);
promote(operand1, operand2);
***************
*** 451,456 ****
--- 478,491 ----
case ComValue::DoubleType:
result.boolean_ref() = operand1.double_val() < operand2.double_val();
break;
+ case ComValue::SymbolType:
+ const char* str1 = operand1.symbol_ptr();
+ const char* str2 = operand2.symbol_ptr();
+ if (nval.is_unknown())
+ result.boolean_ref() = strcmp(str1, str2)<0;
+ else
+ result.boolean_ref() = strncmp(str1, str2, nval.int_val())<0;
+ break;
}
reset_stack();
push_stack(result);
***************
*** 460,465 ****
--- 495,503 ----
}
void LessThanOrEqualFunc::execute() {
+ boolean symflag = stack_key(sym_symid).is_true();
+ ComValue& nval = stack_key(n_symid);
+
ComValue& operand1 = stack_arg(0);
ComValue& operand2 = stack_arg(1);
promote(operand1, operand2);
***************
*** 496,501 ****
--- 534,547 ----
break;
case ComValue::DoubleType:
result.boolean_ref() = operand1.double_val() <= operand2.double_val();
+ break;
+ case ComValue::SymbolType:
+ const char* str1 = operand1.symbol_ptr();
+ const char* str2 = operand2.symbol_ptr();
+ if (nval.is_unknown())
+ result.boolean_ref() = strcmp(str1, str2)<=0;
+ else
+ result.boolean_ref() = strncmp(str1, str2, nval.int_val())<=0;
break;
}
reset_stack();
Index: ComTerp/boolfunc.h
diff -c ComTerp/boolfunc.h:1.2 ComTerp/boolfunc.h:1.3
*** ComTerp/boolfunc.h:1.2 Thu Aug 16 12:20:58 2001
--- src/ComTerp/boolfunc.h Wed Sep 26 01:51:10 2001
***************
*** 1,4 ****
--- 1,5 ----
/*
+ * Copyright (c) 2001 Scott E. Johnston
* Copyright (c) 2000 IET Inc.
* Copyright (c) 1994-1997,1999 Vectaport Inc.
*
***************
*** 68,73 ****
--- 69,75 ----
//: == (equality) operator.
// also useful for partial string comparison with :n keyword, i.e.
// eq("string1" "string2" :n 6) returns true.
+ // also useful for symbol comparison with :sym keyword.
class EqualFunc : public NumFunc {
public:
EqualFunc(ComTerp*);
***************
*** 80,139 ****
//: != (non-equality) operator.
class NotEqualFunc : public NumFunc {
public:
NotEqualFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return "!= is the not-equal operator"; }
};
//: > (greater than) operator.
class GreaterThanFunc : public NumFunc {
public:
GreaterThanFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return "> is the greater-than operator"; }
};
//: >= (greater than or equal) operator.
class GreaterThanOrEqualFunc : public NumFunc {
public:
GreaterThanOrEqualFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return ">= is the greater-than-or-equal operator"; }
};
//: < (less than) operator.
class LessThanFunc : public NumFunc {
public:
LessThanFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return "> is the less-than operator"; }
};
//: <= (less than or equal) operator.
class LessThanOrEqualFunc : public NumFunc {
public:
LessThanOrEqualFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return ">= is the less-than-or-equal operator"; }
};
--- 82,154 ----
//: != (non-equality) operator.
+ // also useful for partial string comparison with :n keyword.
+ // neq("string1" "string2" :n 6) returns false.
+ // also useful for symbol comparison with :sym keyword.
class NotEqualFunc : public NumFunc {
public:
NotEqualFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return "!= is the not-equal operator\nbool=neq(str1 str2 :n len) -- partial string comparison\nbool=neq(sym1 sym2 :sym) -- symbol comparison"; }
};
//: > (greater than) operator.
+ // also useful for partial string comparison with :n keyword, i.e.
+ // gt("string1" "string2" :n 6) returns false.
+ // also useful for symbol comparison with :sym keyword.
class GreaterThanFunc : public NumFunc {
public:
GreaterThanFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return "> is the greater-than operator\nbool=gt(str1 str2 :n len) -- partial string comparison\nbool=gt(sym1 sym2 :sym) -- symbol comparison"; }
};
//: >= (greater than or equal) operator.
+ // also useful for partial string comparison with :n keyword.
+ // also useful for symbol comparison with :sym keyword.
class GreaterThanOrEqualFunc : public NumFunc {
public:
GreaterThanOrEqualFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return ">= is the greater-than-or-equal operator\nbool=gt_or_eq(str1 str2 :n len) -- partial string comparison\nbool=gt_or_eq(sym1 sym2 :sym) -- symbol comparison"; }
};
//: < (less than) operator.
+ // also useful for partial string comparison with :n keyword, i.e.
+ // lt("string2" "string1" :n 6) returns false.
+ // also useful for symbol comparison with :sym keyword.
class LessThanFunc : public NumFunc {
public:
LessThanFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return "< is the less-than operator\nbool=lt(str1 str2 :n len) -- partial string comparison\nbool=lt(sym1 sym2 :sym) -- symbol comparison"; }
};
//: <= (less than or equal) operator.
class LessThanOrEqualFunc : public NumFunc {
+ // also useful for partial string comparison with :n keyword.
+ // also useful for symbol comparison with :sym keyword.
public:
LessThanOrEqualFunc(ComTerp*);
virtual void execute();
virtual const char* docstring() {
! return "<= is the less-than-or-equal operator\nbool=lt_or_eq(str1 str2 :n len) -- partial string comparison\nbool=lt_or_eq(sym1 sym2 :sym) -- symbol comparison"; }
};
Index: ComTerp/postfunc.c
diff -c ComTerp/postfunc.c:1.4 ComTerp/postfunc.c:1.5
*** ComTerp/postfunc.c:1.4 Tue Jul 3 17:01:13 2001
--- src/ComTerp/postfunc.c Wed Sep 26 01:51:10 2001
***************
*** 1,4 ****
--- 1,5 ----
/*
+ * Copyright (c) 2001 Scott E. Johnston
* Copyright (c) 1998 Vectaport Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
***************
*** 164,175 ****
void WhileFunc::execute() {
static int body_symid = symbol_add("body");
static int until_symid = symbol_add("until");
ComValue untilflag(stack_key_post_eval(until_symid));
ComValue* bodyexpr = nil;
while (1) {
if (untilflag.is_false()) {
ComValue doneexpr(stack_arg_post_eval(0));
! if (doneexpr.is_false()) break;
}
delete bodyexpr;
ComValue keybody(stack_key_post_eval(body_symid, false, ComValue::unkval(), true));
--- 165,178 ----
void WhileFunc::execute() {
static int body_symid = symbol_add("body");
static int until_symid = symbol_add("until");
+ static int notnil_symid = symbol_add("notnil");
ComValue untilflag(stack_key_post_eval(until_symid));
+ ComValue notnilflag(stack_key_post_eval(notnil_symid));
ComValue* bodyexpr = nil;
while (1) {
if (untilflag.is_false()) {
ComValue doneexpr(stack_arg_post_eval(0));
! if (notnilflag.is_false() ? doneexpr.is_false() : doneexpr.is_unknown()) break;
}
delete bodyexpr;
ComValue keybody(stack_key_post_eval(body_symid, false, ComValue::unkval(), true));
***************
*** 179,185 ****
bodyexpr = new ComValue(keybody);
if (untilflag.is_true()) {
ComValue doneexpr(stack_arg_post_eval(0));
! if (doneexpr.is_true()) break;
}
}
reset_stack();
--- 182,188 ----
bodyexpr = new ComValue(keybody);
if (untilflag.is_true()) {
ComValue doneexpr(stack_arg_post_eval(0));
! if (notnilflag.is_false() ? doneexpr.is_true() : doneexpr.is_unknown()) break;
}
}
reset_stack();
Index: ComTerp/postfunc.h
diff -c ComTerp/postfunc.h:1.1 ComTerp/postfunc.h:1.2
*** ComTerp/postfunc.h:1.1 Thu Jan 4 15:31:42 2001
--- src/ComTerp/postfunc.h Wed Sep 26 01:51:10 2001
***************
*** 1,4 ****
--- 1,5 ----
/*
+ * Copyright (c) 2001 Scott E. Johnston
* Copyright (c) 1998,1999 Vectaport Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
***************
*** 81,87 ****
};
//: while-loop command for ComTerp.
! // val=while([testexpr [bodyexpr]] :until :body expr ) -- while loop.
class WhileFunc : public ComFunc {
public:
WhileFunc(ComTerp*);
--- 82,88 ----
};
//: while-loop command for ComTerp.
! // val=while([testexpr [bodyexpr]] :notnil :until :body expr ) -- while loop.
class WhileFunc : public ComFunc {
public:
WhileFunc(ComTerp*);
***************
*** 89,95 ****
virtual boolean post_eval() { return true; }
virtual const char* docstring() {
! return "val=%s([testexpr [bodyexpr]] :until :body expr ) -- while loop"; }
};
#endif /* !defined(_postfunc_h) */
--- 90,96 ----
virtual boolean post_eval() { return true; }
virtual const char* docstring() {
! return "val=%s([testexpr [bodyexpr]] :notnil :until :body expr ) -- while loop"; }
};
#endif /* !defined(_postfunc_h) */
*** /dev/null Wed Sep 26 01:51:24 PDT 2001
--- patches/ivtools-010926-johnston-059
*************** patches/ivtools-010926-johnston-059
*** 0 ****
--- 1 ----
+ ivtools-010926-johnston-059
|
|
From: <ivt...@li...> - 2001-09-25 17:51:59
|
Patch: ivtools-010926-johnston-058
For: ivtools-0.9.6
Author: joh...@us...
Subject: fix != comparison of symbols in comterp
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- fix != comparison of symbols. Found this problem when experimenting
with the new stream objects. A while loop terminates on either 0 or
nil, but a stream terminates with only nil. To differentiate nil from
0 I looked at the return type:
s=0..255
while(`type(v=next(s))!=`type(nil) print("%d\n" v))
This didn't work without this patch.
Index: ComTerp/boolfunc.c
diff -c ComTerp/boolfunc.c:1.1 ComTerp/boolfunc.c:1.2
*** ComTerp/boolfunc.c:1.1 Thu Jan 4 15:31:42 2001
--- src/ComTerp/boolfunc.c Wed Sep 26 01:03:15 2001
***************
*** 259,266 ****
--- 259,270 ----
}
void NotEqualFunc::execute() {
+ static int sym_symid = symbol_add("sym");
+ boolean symflag = stack_key(sym_symid).is_true();
ComValue& operand1 = stack_arg(0);
ComValue& operand2 = stack_arg(1);
+ static int n_symid = symbol_add("n");
+ ComValue& nval =stack_key(n_symid);
promote(operand1, operand2);
ComValue result(operand1);
result.type(ComValue::BooleanType);
***************
*** 296,301 ****
--- 300,315 ----
case ComValue::DoubleType:
result.boolean_ref() = operand1.double_val() != operand2.double_val();
break;
+ case ComValue::StringType:
+ case ComValue::SymbolType:
+ if (nval.is_unknown())
+ result.boolean_ref() = operand1.symbol_val() != operand2.symbol_val();
+ else {
+ const char* str1 = operand1.symbol_ptr();
+ const char* str2 = operand2.symbol_ptr();
+ result.boolean_ref() = strncmp(str1, str2, nval.int_val())!=0;
+ }
+ break;
case ComValue::UnknownType:
result.boolean_ref() = operand2.is_known();
break;
*** /dev/null Wed Sep 26 01:03:39 PDT 2001
--- patches/ivtools-010926-johnston-058
*************** patches/ivtools-010926-johnston-058
*** 0 ****
--- 1 ----
+ ivtools-010926-johnston-058
|
|
From: <ivt...@li...> - 2001-09-18 16:41:19
|
Patch: ivtools-010918-johnston-056 For: ivtools-0.9.6 Author: joh...@us... Subject: safety check property returned from KDE 2.1.1, ComValue StreamObject Requires: This is an intermediate patch to ivtools-0.9.6. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - safety check a null property value returned by KDE 2.1.1 (either the window manager or server) from a XSelectionRequestEvent. This is in turn passed back to the server with an XChangeProperty call, which makes for a failed request. Here is the e-mail to bugs.kde.org: Subject: Re: X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 18 (X_ChangeProperty) Value in failed request: 0x0 Date: Fri, 14 Sep 2001 16:35:39 -0700 From: Scott Johnston <sc...@ac...> To: 29...@bu... >From http://bugs.kde.org/db/29/29816.html: I have independently verified this problem, with the caveat that it doesn't happen immediately after startup. Looking at the code, I think this probably due to an XSelectionRequestEvent generated by the server (the window manager?) with a property value of 0, which in turns gets passed back to the server in a later XChangeProperty call. For the time being I will modify the code to test for this and print an error message suggesting a restart of the window manager (the server?) It would seem the real fix lies elsewhere, given the fact this is a long-time working feature in fairly stable code. Best wishes, Scott Johnston http://www.ivtools.org - add a StreamObject to AttributeValue/ComValue. This consists of a pointer to a ComFunc to use in getting the next value out of a stream, and local data storage to indicate current position. Sort of a prodecural iterator. Index: Attribute/attrvalue.c diff -c Attribute/attrvalue.c:1.3 Attribute/attrvalue.c:1.4 *** Attribute/attrvalue.c:1.3 Thu Jun 14 10:21:22 2001 --- src/Attribute/attrvalue.c Tue Sep 18 09:33:15 2001 *************** *** 58,64 **** AttributeValue::AttributeValue() { clear(); type(UnknownType); ! _aggregate_type = UnknownType; } AttributeValue::AttributeValue(unsigned char v) { --- 58,64 ---- AttributeValue::AttributeValue() { clear(); type(UnknownType); ! _command_symid = -1; } AttributeValue::AttributeValue(unsigned char v) { *************** *** 142,147 **** --- 142,154 ---- Resource::ref(ptr); } + AttributeValue::AttributeValue(void* comfuncptr, int iter_curr, int iter_end) { + _type = AttributeValue::StreamType; + _v.streamval.ptr = comfuncptr; + _v.streamval.iter_curr = iter_curr; + _iter_end = iter_end; + } + AttributeValue::AttributeValue(const char* string) { _type = AttributeValue::StringType; _v.dfintval = symbol_add((char*)string); *************** *** 168,174 **** const void* v2 = &sv._v; memcpy(v1, v2, sizeof(double)); _type = sv._type; ! _aggregate_type = sv._aggregate_type; #if 0 // disable symbol reference counting if (_type == StringType || _type == SymbolType) { char* sptr = (char *)string_ptr(); --- 175,181 ---- const void* v2 = &sv._v; memcpy(v1, v2, sizeof(double)); _type = sv._type; ! _command_symid = sv._command_symid; #if 0 // disable symbol reference counting if (_type == StringType || _type == SymbolType) { char* sptr = (char *)string_ptr(); *************** *** 184,190 **** AttributeValue::ValueType AttributeValue::type() const { return _type; } void AttributeValue::type(AttributeValue::ValueType type) { _type = type; } - AttributeValue::ValueType AttributeValue::aggregate_type() const { return _aggregate_type; } unsigned char& AttributeValue::uchar_ref() { return _v.ucharval; } char& AttributeValue::char_ref() { return _v.charval; } --- 191,196 ---- *************** *** 607,614 **** return 0; } ! unsigned int AttributeValue::command_symid() { return _command_symid; } ! void AttributeValue::command_symid(unsigned int id, boolean alias) { _command_symid = (alias ? -1 : 1) * id; } ostream& operator<< (ostream& out, const AttributeValue& sv) { --- 613,620 ---- return 0; } ! int AttributeValue::command_symid() { return _command_symid; } ! void AttributeValue::command_symid(int id, boolean alias) { _command_symid = (alias ? -1 : 1) * id; } ostream& operator<< (ostream& out, const AttributeValue& sv) { *************** *** 896,902 **** const void* v2 = &av._v; memcpy(v1, v2, sizeof(double)); _type = av._type; ! _aggregate_type = av._aggregate_type; #if 0 // this end of reference counting disabled as well if (_type == StringType || _type == SymbolType) symbol_add((char *)string_ptr()); --- 902,908 ---- const void* v2 = &av._v; memcpy(v1, v2, sizeof(double)); _type = av._type; ! _command_symid = av._command_symid; #if 0 // this end of reference counting disabled as well if (_type == StringType || _type == SymbolType) symbol_add((char *)string_ptr()); Index: Attribute/attrvalue.h diff -c Attribute/attrvalue.h:1.2 Attribute/attrvalue.h:1.3 *** Attribute/attrvalue.h:1.2 Thu Jun 14 10:21:22 2001 --- src/Attribute/attrvalue.h Tue Sep 18 09:33:15 2001 *************** *** 60,65 **** --- 60,72 ---- unsigned int type; } arrayval_struct; + //: void* pointer to ComFunc object plus optional type id + // used in attr_value. + typedef struct { + void *ptr; + unsigned int iter_curr; + } streamval_struct; + //: keyword symbol id, plus number of arguments that follow. // used in attr_value. typedef struct { *************** *** 83,88 **** --- 90,96 ---- symval_struct symval; objval_struct objval; arrayval_struct arrayval; + streamval_struct streamval; keyval_struct keyval; } attr_value; *************** *** 132,137 **** --- 140,147 ---- // ObjectType constructor. AttributeValue(AttributeValueList* listptr); // ArrayType constructor. + AttributeValue(void* comfunc, int iter_curr, int iter_end); + // StreamType constructor. AttributeValue(const char* val); // StringType constructor. *************** *** 148,155 **** // return type enum. void type(ValueType); // set type enum. - ValueType aggregate_type() const; - // set type used for aggregate values (ArrayType, StreamType). int type_size() { return type_size(type()); } // return sizeof of value of this type. static int type_size(ValueType); --- 158,163 ---- *************** *** 211,219 **** int array_len(); // length of list of values when ArrayType. ! unsigned int command_symid(); // symbol id of associated command name, for use with ComTerp. ! void command_symid(unsigned int, boolean alias=false); // set symbol id of associated command name, for use with ComTerp. boolean command_alias(); // returns true if command is an alias, not the first name. --- 219,227 ---- int array_len(); // length of list of values when ArrayType. ! int command_symid(); // symbol id of associated command name, for use with ComTerp. ! void command_symid(int, boolean alias=false); // set symbol id of associated command name, for use with ComTerp. boolean command_alias(); // returns true if command is an alias, not the first name. *************** *** 257,262 **** --- 265,272 ---- boolean is_array() { return is_type(ArrayType); } // returns true if ArrayType. + boolean is_stream() { return is_type(StreamType); } + // returns true if StreamType. boolean is_unknown() { return is_type(UnknownType); } // returns true if UnknownType. boolean is_null() { return is_unknown(); } *************** *** 320,328 **** ValueType _type; attr_value _v; union { ! ValueType _aggregate_type; // used for ArrayType. ! unsigned int _command_symid; // used for CommandType. boolean _object_compview; // used for ObjectType. }; static int* _type_syms; --- 330,338 ---- ValueType _type; attr_value _v; union { ! int _command_symid; // used for CommandType. boolean _object_compview; // used for ObjectType. + unsigned int _iter_end; }; static int* _type_syms; Index: ComTerp/comvalue.c diff -c ComTerp/comvalue.c:1.1 ComTerp/comvalue.c:1.2 *** ComTerp/comvalue.c:1.1 Thu Jan 4 15:31:42 2001 --- src/ComTerp/comvalue.c Tue Sep 18 09:33:17 2001 *************** *** 64,76 **** ComValue::ComValue() { type(UnknownType); ! _aggregate_type = UnknownType; zero_vals(); } ComValue::ComValue(ValueType valtype) { type(valtype); ! _aggregate_type = UnknownType; zero_vals(); } --- 64,76 ---- ComValue::ComValue() { type(UnknownType); ! _command_symid = -1; zero_vals(); } ComValue::ComValue(ValueType valtype) { type(valtype); ! _command_symid = -1; zero_vals(); } *************** *** 116,122 **** _narg = token->narg; _nkey = token->nkey; _nids = token->nids; ! _aggregate_type = UnknownType; _pedepth = 0; _bquote = 0; } --- 116,122 ---- _narg = token->narg; _nkey = token->nkey; _nids = token->nids; ! _command_symid = -1; _pedepth = 0; _bquote = 0; } Index: src_x11/xselection.c diff -c src_x11/xselection.c:1.1 src_x11/xselection.c:1.2 *** src_x11/xselection.c:1.1 Thu Jan 4 15:31:53 2001 --- src/IV-X11/xselection.c Tue Sep 18 09:33:20 2001 *************** *** 33,38 **** --- 33,39 ---- #include <OS/string.h> #include <OS/table.h> #include <X11/Xatom.h> + #include <stdio.h> /* * SelectionManager -- inter client communications mechanism *************** *** 69,74 **** --- 70,81 ---- void SelectionManager::put_value(const void* data, int length, int format) { SelectionManagerRep& s = *rep(); + if (!s.x_req_.property) { + fprintf(stderr, "property value of zero received from XSelectionRequestEvent\n"); + fprintf(stderr, "restart window manager and/or server to correct\n"); + fprintf(stderr, "selection mechanism effectively disabled\n"); + return; + } XChangeProperty( s.xdisplay_, s.x_req_.requestor, s.x_req_.property, /* type */ XA_STRING, format, PropModeReplace, *** /dev/null Tue Sep 18 09:33:53 PDT 2001 --- patches/ivtools-010918-johnston-056 *************** patches/ivtools-010918-johnston-056 *** 0 **** --- 1 ---- + ivtools-010918-johnston-056 |
|
From: <ivt...@li...> - 2001-09-14 19:26:33
|
Patch: ivtools-010914-johnston-055
For: ivtools-0.9.6
Author: joh...@us...
Subject: better ColorRast error messages, fix up of import command lines
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- better error messages when someone tries to open an idraw format
PostScript file that has ColorRast objects in it. These are rasters
that are color-printer ready, and do not conform the idraw format. A
future version upgrade of this format will include support for these.
As an aside, these ColorRast objects cannot be filtered through
pstoedit either (pstoedit -f idraw), because they have separate
sources for R, G, and B. A future pstoedit back-end for the ivtools
drawtool format would be needed to make this work instead, one that
relied on the ghostscript mechanism for dumping out rasters to PNG
files.
- modifies the pstoedit import command lines to always use a temporary
file for output with a %d indicator to support multi-page files.
Index: UniIdraw/idcatalog.c
diff -c UniIdraw/idcatalog.c:1.2 UniIdraw/idcatalog.c:1.3
*** UniIdraw/idcatalog.c:1.2 Thu Jun 14 10:22:01 2001
--- src/UniIdraw/idcatalog.c Fri Sep 14 12:14:28 2001
***************
*** 265,270 ****
--- 265,274 ----
else if (strcmp(_buf, "SSten") == 0) child = ReadSStencil(in);
else if (strcmp(_buf, "FSten") == 0) child = ReadFStencil(in);
else if (strcmp(_buf, "Rast") == 0) child = ReadRaster(in);
+ else if (strcmp(_buf, "ColorRast") ==0) {
+ child = nil;
+ cerr << "Support for reading idraw PostScript with color-printer ready rasters not yet available.\n";
+ }
else if (strcmp(_buf, "eop") == 0) break;
else {
Index: OverlayUnidraw/ovcatalog.c
diff -c OverlayUnidraw/ovcatalog.c:1.5 OverlayUnidraw/ovcatalog.c:1.6
*** OverlayUnidraw/ovcatalog.c:1.5 Thu Aug 16 12:21:54 2001
--- src/OverlayUnidraw/ovcatalog.c Fri Sep 14 12:14:30 2001
***************
*** 341,346 ****
--- 341,350 ----
else if (strcmp(_buf, "SSten") == 0) child = ReadSStencil(in);
else if (strcmp(_buf, "FSten") == 0) child = ReadFStencil(in);
else if (strcmp(_buf, "Rast") == 0) child = ReadRaster(in);
+ else if (strcmp(_buf, "ColorRast") ==0) {
+ child = nil;
+ cerr << "Support for reading idraw PostScript with color-printer ready rasters not yet available.\n";
+ }
else if (strcmp(_buf, "eop") == 0) break;
else {
Index: OverlayUnidraw/ovimport.c
diff -c OverlayUnidraw/ovimport.c:1.14 OverlayUnidraw/ovimport.c:1.15
*** OverlayUnidraw/ovimport.c:1.14 Thu Aug 16 12:21:54 2001
--- src/OverlayUnidraw/ovimport.c Fri Sep 14 12:14:30 2001
***************
*** 1531,1545 ****
if (pathname && !return_fd) {
char buffer[BUFSIZ];
if (compressed)
! sprintf(buffer, "gzip -c %s | pstoedit -f idraw", pathname, "%d");
else
! sprintf(buffer, "pstoedit -f idraw %s", pathname, "%d");
pptr = popen(buffer, "r");
cerr << "input opened with " << buffer << "\n";
if (pptr)
new_fd = fileno(pptr);
} else
! new_fd = Pipe_Filter(*in, "pstoedit -f idraw");
#if __GNUG__<3
ifstream new_in;
new_in.rdbuf()->attach(new_fd);
--- 1531,1545 ----
if (pathname && !return_fd) {
char buffer[BUFSIZ];
if (compressed)
! sprintf(buffer, "tf=`ivtmpnam`;gzip -c %s | pstoedit -f idraw - $tf.%s;cat $tf.*;rm $tf.*", pathname, "%d");
else
! sprintf(buffer, "tf=`ivtmpnam`;pstoedit -f idraw %s $tf.%s;cat $tf.*;rm $tf.*", pathname, "%d");
pptr = popen(buffer, "r");
cerr << "input opened with " << buffer << "\n";
if (pptr)
new_fd = fileno(pptr);
} else
! new_fd = Pipe_Filter(*in, "tf=`ivtmpnam`;pstoedit -f idraw - $tf.%d;cat $tf.*;rm $tf.*");
#if __GNUG__<3
ifstream new_in;
new_in.rdbuf()->attach(new_fd);
***************
*** 1681,1687 ****
pclose(pptr);
}
} else
! comp = PNM_Image_Filter(*in, return_fd, pnmfd, "pnmtopng");
} else
cerr << "pnmtopgm not found (part of ivtools)\n";
}
--- 1681,1687 ----
pclose(pptr);
}
} else
! comp = PNM_Image_Filter(*in, return_fd, pnmfd, "pngtopnm");
} else
cerr << "pnmtopgm not found (part of ivtools)\n";
}
*** /dev/null Fri Sep 14 12:14:39 PDT 2001
--- patches/ivtools-010914-johnston-055
*************** patches/ivtools-010914-johnston-055
*** 0 ****
--- 1 ----
+ ivtools-010914-johnston-055
|
|
From: <ivt...@li...> - 2001-09-05 17:27:27
|
Patch: ivtools-010905-johnston-054
For: ivtools-0.9.6
Author: joh...@us...
Subject: fix to pnmtopgm script
Requires:
This is an intermediate patch to ivtools-0.9.6. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- this fixes the pnmtopgm script to do the right thing for PBM files.
Index: scripts_ivtools/pnmtopgm.sh
diff -c scripts_ivtools/pnmtopgm.sh:1.1 scripts_ivtools/pnmtopgm.sh:1.2
*** scripts_ivtools/pnmtopgm.sh:1.1 Thu Jan 4 15:33:49 2001
--- src/scripts/pnmtopgm.sh Wed Sep 5 10:23:03 2001
***************
*** 26,32 ****
case "$filetype" in
*PBM* )
! pbmtopgm "$file"
exit 0
;;
--- 26,32 ----
case "$filetype" in
*PBM* )
! pnmdepth 255 "$file"
exit 0
;;
*** /dev/null Wed Sep 5 10:23:07 PDT 2001
--- patches/ivtools-010905-johnston-054
*************** patches/ivtools-010905-johnston-054
*** 0 ****
--- 1 ----
+ ivtools-010905-johnston-054
|
|
From: <ivt...@li...> - 2001-09-05 17:26:52
|
Patch: ivtools-010820-johnston-053
For: ivtools-0.9.5
Author: joh...@us...
Subject: finalize 0.9.6
Requires:
This is an intermediate patch to ivtools-0.9.5. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- finalize 0.9.6
Index: top_ivtools/CHANGES
diff -c top_ivtools/CHANGES:1.6 top_ivtools/CHANGES:1.7
*** top_ivtools/CHANGES:1.6 Wed Jul 25 17:43:07 2001
--- ./CHANGES Mon Aug 20 12:51:18 2001
***************
*** 1,3 ****
--- 1,25 ----
+ Aug 20th 2001 ivtools-0.9.6
+
+ - minor adjustments to adapt to gcc-3.0.1. One advantage of upgrading
+ to gcc-3.0.1 is that incremental import of rasters from URL's works
+ again.
+
+ - introduce all the bitwise operators from C to comterp: &, |, ^, and
+ ~. This change is slightly backward incompatible, in that "^" had
+ been used as a shortcut for the pow command (raise something to a
+ power). Scripts that rely on that single operator will need to be
+ rewritten. Sorry for doing that -- but it is the first incompatible
+ change in I can't remember how long, and something I wanted to get
+ done before version 1.0 (where the syntax and semantics of comterp get
+ "frozen", ready for wider use).
+
+ - renames the tiftopnm bash script to a less confusing ivtiftopnm
+ (less confusing in that people won't think it is part of netpbm).
+ ivtiftopnm is a wrapper script for tifftopnm, which doesn't accept
+ stdin input directly (because of its need for random access to the
+ tiff file).
+
+
Jul 25th 2001 ivtools-0.9.5
** Most of the outstanding problems with gcc-3.0 and libstdc++-v3 have
Index: top_ivtools/INSTALL
diff -c top_ivtools/INSTALL:1.9 top_ivtools/INSTALL:1.10
*** top_ivtools/INSTALL:1.9 Wed Jul 25 17:43:07 2001
--- ./INSTALL Mon Aug 20 12:51:18 2001
***************
*** 1,7 ****
INSTALL for ivtools-0.9
! Instructions for building ivtools-0.9.5 from source:
0. Compilation Environment
--- 1,7 ----
INSTALL for ivtools-0.9
! Instructions for building ivtools-0.9.6 from source:
0. Compilation Environment
Index: top_ivtools/README
diff -c top_ivtools/README:1.6 top_ivtools/README:1.7
*** top_ivtools/README:1.6 Wed Jul 25 17:43:07 2001
--- ./README Mon Aug 20 12:51:18 2001
***************
*** 2,8 ****
README for ivtools 0.9
! This directory contains a release of ivtools 0.9.5. You should read
the rest of this file for information on what ivtools is and the
INSTALL file for instructions on how to build it.
--- 2,8 ----
README for ivtools 0.9
! This directory contains a release of ivtools 0.9.6. You should read
the rest of this file for information on what ivtools is and the
INSTALL file for instructions on how to build it.
Index: top_ivtools/VERSION
diff -c top_ivtools/VERSION:1.6 top_ivtools/VERSION:1.7
*** top_ivtools/VERSION:1.6 Wed Jul 25 17:43:07 2001
--- ./VERSION Mon Aug 20 12:51:18 2001
***************
*** 1 ****
! Release 0.9.5
--- 1 ----
! Release 0.9.6
Index: include_std/version.h
diff -c include_std/version.h:1.6 include_std/version.h:1.7
*** include_std/version.h:1.6 Wed Jul 25 17:44:04 2001
--- src/include/ivstd/version.h Mon Aug 20 12:52:03 2001
***************
*** 1,3 ****
! #define IvtoolsVersion 0.9.5
! #define VersionString "0.9.5"
! #define ReleaseString "ivtools-0.9.5"
--- 1,3 ----
! #define IvtoolsVersion 0.9.6
! #define VersionString "0.9.6"
! #define ReleaseString "ivtools-0.9.6"
Index: config_ivtools/params.def
diff -c config_ivtools/params.def:1.9 config_ivtools/params.def:1.10
*** config_ivtools/params.def:1.9 Wed Jul 25 17:44:11 2001
--- config/params.def Mon Aug 20 12:52:11 2001
***************
*** 27,33 ****
* Name of the software release
*/
#ifndef Release
! #define Release ivtools-0.9.5
#endif
RELEASE = Release
--- 27,33 ----
* Name of the software release
*/
#ifndef Release
! #define Release ivtools-0.9.6
#endif
RELEASE = Release
***************
*** 36,42 ****
* VersionNumber
*/
#ifndef Version
! #define Version 0.9.5
#endif
VERSION = Version
--- 36,42 ----
* VersionNumber
*/
#ifndef Version
! #define Version 0.9.6
#endif
VERSION = Version
*** /dev/null Mon Aug 20 12:52:14 PDT 2001
--- patches/ivtools-010820-johnston-053
*************** patches/ivtools-010820-johnston-053
*** 0 ****
--- 1 ----
+ ivtools-010820-johnston-053
|
|
From: <ivt...@li...> - 2001-08-16 20:22:47
|
Patch: ivtools-010816-johnston-052 For: ivtools-0.9.5 Author: joh...@us... Subject: rename tiftopnm script to ivtiftopnm Requires: This is an intermediate patch to ivtools-0.9.5. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - this patch renames the tiftopnm bash script to a less confusing ivtiftopnm (less confusing in that people won't think it is part of netpbm). ivtiftopnm is a wrapper script for tifftopnm, which doesn't accept stdin input directly (because of its need for random access to the tiff file). Index: top_ivtools/MANIFEST diff -c top_ivtools/MANIFEST:1.8 top_ivtools/MANIFEST:1.9 *** top_ivtools/MANIFEST:1.8 Thu Aug 16 12:20:49 2001 --- ./MANIFEST Thu Aug 16 13:16:57 2001 *************** *** 1743,1753 **** ivtools-0.9/src/scripts/ivgd.cpp ivtools-0.9/src/scripts/ivgetjpg.bash ivtools-0.9/src/scripts/ivmkmf.cpp ivtools-0.9/src/scripts/mkdirhier.sh ivtools-0.9/src/scripts/mkgif89a.bash ivtools-0.9/src/scripts/mkgif89ac.bash ivtools-0.9/src/scripts/pnmtopgm.sh - ivtools-0.9/src/scripts/ivtiftopnm.bash ivtools-0.9/src/tests/Imakefile ivtools-0.9/src/tests/Makefile ivtools-0.9/src/tests/y2k/Imakefile --- 1743,1753 ---- ivtools-0.9/src/scripts/ivgd.cpp ivtools-0.9/src/scripts/ivgetjpg.bash ivtools-0.9/src/scripts/ivmkmf.cpp + ivtools-0.9/src/scripts/ivtiftopnm.bash ivtools-0.9/src/scripts/mkdirhier.sh ivtools-0.9/src/scripts/mkgif89a.bash ivtools-0.9/src/scripts/mkgif89ac.bash ivtools-0.9/src/scripts/pnmtopgm.sh ivtools-0.9/src/tests/Imakefile ivtools-0.9/src/tests/Makefile ivtools-0.9/src/tests/y2k/Imakefile Index: top_ivtools/MANIFEST.comterp diff -c top_ivtools/MANIFEST.comterp:1.3 top_ivtools/MANIFEST.comterp:1.4 *** top_ivtools/MANIFEST.comterp:1.3 Thu Aug 16 12:20:49 2001 --- ./MANIFEST.comterp Thu Aug 16 13:16:57 2001 *************** *** 276,280 **** src/scripts/mkdirhier.sh src/scripts/mkgif89a.bash src/scripts/mkgif89ac.bash - src/scripts/pnmtopgm.sh src/scripts/ivtiftopnm.bash --- 276,280 ---- src/scripts/mkdirhier.sh src/scripts/mkgif89a.bash src/scripts/mkgif89ac.bash src/scripts/ivtiftopnm.bash + src/scripts/pnmtopgm.sh Index: scripts_ivtools/Imakefile diff -c scripts_ivtools/Imakefile:1.2 scripts_ivtools/Imakefile:1.3 *** scripts_ivtools/Imakefile:1.2 Mon Feb 12 17:26:39 2001 --- src/scripts/Imakefile Thu Aug 16 13:17:52 2001 *************** *** 38,44 **** InstallScriptAs(mkgif89ac.bash,$(BINDIR),mkgif89ac) InstallScriptAs(ivgetjpg.bash,$(BINDIR),ivgetjpg) InstallScriptAs(cntsrclines.bash,$(BINDIR),cntsrclines) ! InstallScriptAs(tiftopnm.bash,$(BINDIR),tiftopnm) InstallScriptAs(pnmtopgm.sh,$(BINDIR),pnmtopgm) --- 38,44 ---- InstallScriptAs(mkgif89ac.bash,$(BINDIR),mkgif89ac) InstallScriptAs(ivgetjpg.bash,$(BINDIR),ivgetjpg) InstallScriptAs(cntsrclines.bash,$(BINDIR),cntsrclines) ! InstallScriptAs(ivtiftopnm.bash,$(BINDIR),ivtiftopnm) InstallScriptAs(pnmtopgm.sh,$(BINDIR),pnmtopgm) Index: scripts_ivtools/ivtiftopnm.bash diff -c /dev/null scripts_ivtools/ivtiftopnm.bash:1.1 *** /dev/null Thu Aug 16 13:17:54 2001 --- src/scripts/ivtiftopnm.bash Thu Aug 16 13:17:52 2001 *************** *** 0 **** --- 1,18 ---- + #!/bin/bash + # + # ivtiftopnm [file] + # + # bash script to wrap tifftopnm which can't handle stdin + # + # Parameters: + # $1 optional tiff image filename + # + case "$#" in + 0) tempfile=`tmpnam` + cat >$tempfile + tifftopnm $tempfile + rm $tempfile + ;; + *) tifftopnm $1 + ;; + esac Index: scripts_ivtools/tiftopnm.bash diff -c scripts_ivtools/tiftopnm.bash:1.1 scripts_ivtools/tiftopnm.bash:removed *** scripts_ivtools/tiftopnm.bash:1.1 Thu Jan 4 15:33:49 2001 --- src/scripts/tiftopnm.bash Thu Aug 16 13:17:54 2001 *************** *** 1,18 **** - #!/bin/bash - # - # tiftopnm [file] - # - # bash script to wrap tifftopnm which can't handle stdin - # - # Parameters: - # $1 optional tiff image filename - # - case "$#" in - 0) tempfile=`tmpnam` - cat >$tempfile - tifftopnm $tempfile - rm $tempfile - ;; - *) tifftopnm $1 - ;; - esac --- 0 ---- *** /dev/null Thu Aug 16 13:18:04 PDT 2001 --- patches/ivtools-010816-johnston-052 *************** patches/ivtools-010816-johnston-052 *** 0 **** --- 1 ---- + ivtools-010816-johnston-052 |
|
From: <ivt...@li...> - 2001-08-16 19:41:04
|
Patch: ivtools-010816-johnston-051
For: ivtools-0.9.5
Author: joh...@us...
Subject: bitwise comterp operators, other tweaks
Requires:
This is an intermediate patch to ivtools-0.9.5. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- introduce all the bitwise operators from C to comterp: &, |, ^, and
~. This change is slightly backward incompatible, in that "^" had
been used as a shortcut for the pow command (raise something to a
power). Scripts that rely on that single operator will need to be
rewritten. Sorry for doing that -- but it is the first incompatible
change in I can't remember how long, and something I wanted to get
done before version 1.0 (where the syntax and semantics of comterp get
"frozen", ready for wider use).
- many other tweaks with respect to importing, adapting to gcc-3.0.1,
etc.. With the new libstdc++-v3 (shared library has a version of
4.0), importing a JPEG from a URL all of sudden works again.
Index: top_ivtools/MANIFEST
diff -c top_ivtools/MANIFEST:1.7 top_ivtools/MANIFEST:1.8
*** top_ivtools/MANIFEST:1.7 Wed Jun 20 14:12:01 2001
--- ./MANIFEST Thu Aug 16 12:20:49 2001
***************
*** 142,147 ****
--- 142,149 ----
ivtools-0.9/src/ComTerp/_comutil.h
ivtools-0.9/src/ComTerp/assignfunc.c
ivtools-0.9/src/ComTerp/assignfunc.h
+ ivtools-0.9/src/ComTerp/bitfunc.c
+ ivtools-0.9/src/ComTerp/bitfunc.h
ivtools-0.9/src/ComTerp/boolfunc.c
ivtools-0.9/src/ComTerp/boolfunc.h
ivtools-0.9/src/ComTerp/bquotefunc.c
***************
*** 1745,1751 ****
ivtools-0.9/src/scripts/mkgif89a.bash
ivtools-0.9/src/scripts/mkgif89ac.bash
ivtools-0.9/src/scripts/pnmtopgm.sh
! ivtools-0.9/src/scripts/tiftopnm.bash
ivtools-0.9/src/tests/Imakefile
ivtools-0.9/src/tests/Makefile
ivtools-0.9/src/tests/y2k/Imakefile
--- 1747,1753 ----
ivtools-0.9/src/scripts/mkgif89a.bash
ivtools-0.9/src/scripts/mkgif89ac.bash
ivtools-0.9/src/scripts/pnmtopgm.sh
! ivtools-0.9/src/scripts/ivtiftopnm.bash
ivtools-0.9/src/tests/Imakefile
ivtools-0.9/src/tests/Makefile
ivtools-0.9/src/tests/y2k/Imakefile
Index: top_ivtools/MANIFEST.comterp
diff -c top_ivtools/MANIFEST.comterp:1.2 top_ivtools/MANIFEST.comterp:1.3
*** top_ivtools/MANIFEST.comterp:1.2 Fri Jun 15 16:24:50 2001
--- ./MANIFEST.comterp Thu Aug 16 12:20:49 2001
***************
*** 95,100 ****
--- 95,102 ----
src/ComTerp/_comutil.h
src/ComTerp/assignfunc.c
src/ComTerp/assignfunc.h
+ src/ComTerp/bitfunc.c
+ src/ComTerp/bitfunc.h
src/ComTerp/boolfunc.c
src/ComTerp/boolfunc.h
src/ComTerp/comfunc.c
***************
*** 275,278 ****
src/scripts/mkgif89a.bash
src/scripts/mkgif89ac.bash
src/scripts/pnmtopgm.sh
! src/scripts/tiftopnm.bash
--- 277,280 ----
src/scripts/mkgif89a.bash
src/scripts/mkgif89ac.bash
src/scripts/pnmtopgm.sh
! src/scripts/ivtiftopnm.bash
Index: top_ivtools/MANIFEST.perceps
diff -c top_ivtools/MANIFEST.perceps:1.1 top_ivtools/MANIFEST.perceps:1.2
*** top_ivtools/MANIFEST.perceps:1.1 Thu Jan 4 15:31:33 2001
--- ./MANIFEST.perceps Thu Aug 16 12:20:49 2001
***************
*** 19,24 ****
--- 19,25 ----
ComTerp/_comterp.h
ComTerp/_comutil.h
ComTerp/assignfunc.h
+ ComTerp/bitfunc.h
ComTerp/boolfunc.h
ComTerp/bquotefunc.h
ComTerp/comfunc.h
Index: ComUtil/optable.c
diff -c ComUtil/optable.c:1.1 ComUtil/optable.c:1.2
*** ComUtil/optable.c:1.1 Thu Jan 4 15:31:36 2001
--- src/ComUtil/optable.c Thu Aug 16 12:20:53 2001
***************
*** 81,88 ****
} DefaultOperatorTable[] = {
{".", "dot", 130, FALSE, OPTYPE_BINARY },
{"`", "bquote", 125, TRUE, OPTYPE_UNARY_PREFIX },
- {"^", "power", 120, TRUE, OPTYPE_BINARY },
{"!", "negate", 110, TRUE, OPTYPE_UNARY_PREFIX },
{"++", "incr", 110, TRUE, OPTYPE_UNARY_PREFIX },
{"++", "incr_after", 110, TRUE, OPTYPE_UNARY_POSTFIX },
{"-", "minus", 110, TRUE, OPTYPE_UNARY_PREFIX },
--- 81,88 ----
} DefaultOperatorTable[] = {
{".", "dot", 130, FALSE, OPTYPE_BINARY },
{"`", "bquote", 125, TRUE, OPTYPE_UNARY_PREFIX },
{"!", "negate", 110, TRUE, OPTYPE_UNARY_PREFIX },
+ {"~", "bit_not", 110, TRUE, OPTYPE_UNARY_PREFIX },
{"++", "incr", 110, TRUE, OPTYPE_UNARY_PREFIX },
{"++", "incr_after", 110, TRUE, OPTYPE_UNARY_POSTFIX },
{"-", "minus", 110, TRUE, OPTYPE_UNARY_PREFIX },
***************
*** 95,106 ****
--- 95,111 ----
{"/", "div", 70, FALSE, OPTYPE_BINARY },
{"+", "add", 60, FALSE, OPTYPE_BINARY },
{"-", "sub", 60, FALSE, OPTYPE_BINARY },
+ {"<<", "lshift", 55, FALSE, OPTYPE_BINARY },
+ {">>", "rshift", 55, FALSE, OPTYPE_BINARY },
{"<", "lt", 50, FALSE, OPTYPE_BINARY },
{"<=", "lt_or_eq", 50, FALSE, OPTYPE_BINARY },
{">", "gt", 50, FALSE, OPTYPE_BINARY },
{">=", "gt_or_eq", 50, FALSE, OPTYPE_BINARY },
{"!=", "not_eq", 45, FALSE, OPTYPE_BINARY },
{"==", "eq", 45, FALSE, OPTYPE_BINARY },
+ {"&", "bit_and", 44, FALSE, OPTYPE_BINARY },
+ {"^", "bit_xor", 43, FALSE, OPTYPE_BINARY },
+ {"|", "bit_or", 42, FALSE, OPTYPE_BINARY },
{"&&", "and", 41, FALSE, OPTYPE_BINARY },
{"||", "or", 40, FALSE, OPTYPE_BINARY },
{",", "stream", 35, FALSE, OPTYPE_BINARY },
***************
*** 897,904 ****
-------- ------- -------- ---- ----
. dot 130 N BINARY
` bquote 125 Y UNARY PREFIX
- ^ power 120 Y BINARY
! negate 110 Y UNARY PREFIX
++ incr 110 Y UNARY PREFIX
++ incr_after 110 Y UNARY POSTFIX
- minus 110 Y UNARY PREFIX
--- 902,909 ----
-------- ------- -------- ---- ----
. dot 130 N BINARY
` bquote 125 Y UNARY PREFIX
! negate 110 Y UNARY PREFIX
+ ~ bit_not 110 Y UNARY PREFIX
++ incr 110 Y UNARY PREFIX
++ incr_after 110 Y UNARY POSTFIX
- minus 110 Y UNARY PREFIX
***************
*** 911,922 ****
--- 916,932 ----
/ div 70 N BINARY
+ add 60 N BINARY
- sub 60 N BINARY
+ << lshift 55 N BINARY
+ >> rshift 55 N BINARY
< lt 50 N BINARY
<= lt_or_eq 50 N BINARY
> gt 50 N BINARY
>= gt_or_eq 50 N BINARY
!= not_eq 45 N BINARY
== eq 45 N BINARY
+ & bit_and 44 N BINARY
+ ^ bit_xor 43 N BINARY
+ | bit_or 42 N BINARY
&& and 41 N BINARY
|| or 40 N BINARY
, stream 35 N BINARY
Index: ComTerp/Imakefile
diff -c ComTerp/Imakefile:1.2 ComTerp/Imakefile:1.3
*** ComTerp/Imakefile:1.2 Thu Jun 14 10:21:26 2001
--- src/ComTerp/Imakefile Thu Aug 16 12:20:58 2001
***************
*** 18,23 ****
--- 18,24 ----
#define ObjA(file) MakeObjectFromSrcFlags(file, -D__ACE_INLINE__)
Obj(assignfunc)
+ Obj(bitfunc)
Obj(boolfunc)
Obj(bquotefunc)
Obj(comfunc)
Index: ComTerp/bitfunc.c
diff -c /dev/null ComTerp/bitfunc.c:1.1
*** /dev/null Thu Aug 16 12:21:00 2001
--- src/ComTerp/bitfunc.c Thu Aug 16 12:20:58 2001
***************
*** 0 ****
--- 1,330 ----
+ /*
+ * Copyright (c) 2001 Scott Johnston
+ * Copyright (c) 2000 IET Inc.
+ * Copyright (c) 1994-1997 Vectaport Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of the copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission. The copyright holders make
+ * no representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+ #include <ComTerp/bitfunc.h>
+ #include <ComTerp/comvalue.h>
+ #include <ComTerp/comterp.h>
+ #include <string.h>
+
+ #define TITLE "BitFunc"
+
+ /*****************************************************************************/
+
+ BitAndFunc::BitAndFunc(ComTerp* comterp) : NumFunc(comterp) {
+ }
+
+ void BitAndFunc::execute() {
+ ComValue& operand1 = stack_arg(0);
+ ComValue& operand2 = stack_arg(1);
+ promote(operand1, operand2);
+ ComValue result(operand1);
+
+ switch (result.type()) {
+ case ComValue::CharType:
+ result.char_ref() = operand1.char_val() & operand2.char_val();
+ break;
+ case ComValue::UCharType:
+ result.uchar_ref() = operand1.uchar_val() & operand2.uchar_val();
+ break;
+ case ComValue::ShortType:
+ result.short_ref() = operand1.short_val() & operand2.short_val();
+ break;
+ case ComValue::UShortType:
+ result.ushort_ref() = operand1.ushort_val() & operand2.ushort_val();
+ break;
+ case ComValue::IntType:
+ result.int_ref() = operand1.int_val() & operand2.int_val();
+ break;
+ case ComValue::UIntType:
+ result.uint_ref() = operand1.uint_val() & operand2.uint_val();
+ break;
+ case ComValue::LongType:
+ result.long_ref() = operand1.long_val() & operand2.long_val();
+ break;
+ case ComValue::ULongType:
+ result.ulong_ref() = operand1.ulong_val() & operand2.ulong_val();
+ break;
+ case ComValue::FloatType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::DoubleType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::BooleanType:
+ result.boolean_ref() = operand1.boolean_val() & operand2.boolean_val();
+ break;
+ }
+ reset_stack();
+ push_stack(result);
+ }
+
+ BitXorFunc::BitXorFunc(ComTerp* comterp) : NumFunc(comterp) {
+ }
+
+ void BitXorFunc::execute() {
+ ComValue& operand1 = stack_arg(0);
+ ComValue& operand2 = stack_arg(1);
+ promote(operand1, operand2);
+ ComValue result(operand1);
+
+ switch (result.type()) {
+ case ComValue::CharType:
+ result.char_ref() = operand1.char_val() ^ operand2.char_val();
+ break;
+ case ComValue::UCharType:
+ result.uchar_ref() = operand1.uchar_val() ^ operand2.uchar_val();
+ break;
+ case ComValue::ShortType:
+ result.short_ref() = operand1.short_val() ^ operand2.short_val();
+ break;
+ case ComValue::UShortType:
+ result.ushort_ref() = operand1.ushort_val() ^ operand2.ushort_val();
+ break;
+ case ComValue::IntType:
+ result.int_ref() = operand1.int_val() ^ operand2.int_val();
+ break;
+ case ComValue::UIntType:
+ result.uint_ref() = operand1.uint_val() ^ operand2.uint_val();
+ break;
+ case ComValue::LongType:
+ result.long_ref() = operand1.long_val() ^ operand2.long_val();
+ break;
+ case ComValue::ULongType:
+ result.ulong_ref() = operand1.ulong_val() ^ operand2.ulong_val();
+ break;
+ case ComValue::FloatType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::DoubleType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::BooleanType:
+ result.boolean_ref() = operand1.boolean_val() ^ operand2.boolean_val();
+ break;
+ }
+ reset_stack();
+ push_stack(result);
+ }
+
+ BitOrFunc::BitOrFunc(ComTerp* comterp) : NumFunc(comterp) {
+ }
+
+ void BitOrFunc::execute() {
+ ComValue& operand1 = stack_arg(0);
+ ComValue& operand2 = stack_arg(1);
+ promote(operand1, operand2);
+ ComValue result(operand1);
+
+ switch (result.type()) {
+ case ComValue::CharType:
+ result.char_ref() = operand1.char_val() | operand2.char_val();
+ break;
+ case ComValue::UCharType:
+ result.uchar_ref() = operand1.uchar_val() | operand2.uchar_val();
+ break;
+ case ComValue::ShortType:
+ result.short_ref() = operand1.short_val() | operand2.short_val();
+ break;
+ case ComValue::UShortType:
+ result.ushort_ref() = operand1.ushort_val() | operand2.ushort_val();
+ break;
+ case ComValue::IntType:
+ result.int_ref() = operand1.int_val() | operand2.int_val();
+ break;
+ case ComValue::UIntType:
+ result.uint_ref() = operand1.uint_val() | operand2.uint_val();
+ break;
+ case ComValue::LongType:
+ result.long_ref() = operand1.long_val() | operand2.long_val();
+ break;
+ case ComValue::ULongType:
+ result.ulong_ref() = operand1.ulong_val() | operand2.ulong_val();
+ break;
+ case ComValue::FloatType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::DoubleType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::BooleanType:
+ result.boolean_ref() = operand1.boolean_val() | operand2.boolean_val();
+ break;
+ }
+ reset_stack();
+ push_stack(result);
+ }
+
+ BitNotFunc::BitNotFunc(ComTerp* comterp) : NumFunc(comterp) {
+ }
+
+ void BitNotFunc::execute() {
+ ComValue& operand1 = stack_arg(0);
+ ComValue result(operand1);
+ switch (operand1.type()) {
+ case ComValue::CharType:
+ result.char_ref() = ~ operand1.char_val();
+ break;
+ case ComValue::UCharType:
+ result.uchar_ref() = ~ operand1.uchar_val();
+ break;
+ case ComValue::ShortType:
+ result.short_ref() = ~ operand1.short_val();
+ break;
+ case ComValue::UShortType:
+ result.ushort_ref() = ~ operand1.ushort_val();
+ break;
+ case ComValue::IntType:
+ result.int_ref() = ~ operand1.int_val();
+ break;
+ case ComValue::UIntType:
+ result.uint_ref() = ~ operand1.uint_val();
+ break;
+ case ComValue::LongType:
+ result.long_ref() = ~ operand1.long_val();
+ break;
+ case ComValue::ULongType:
+ result.ulong_ref() = ~ operand1.ulong_val();
+ break;
+ case ComValue::FloatType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::DoubleType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::BooleanType:
+ result.boolean_ref() = ~ operand1.boolean_val();
+ break;
+ case ComValue::UnknownType:
+ result.boolean_ref() = true;
+ break;
+ case ComValue::ArrayType:
+ case ComValue::ObjectType:
+ result.boolean_ref() = false;
+ break;
+ case ComValue::SymbolType:
+ case ComValue::StringType:
+ result.boolean_ref() = operand1.symbol_val()<0;
+ break;
+ }
+ reset_stack();
+ push_stack(result);
+ }
+
+ LeftShiftFunc::LeftShiftFunc(ComTerp* comterp) : NumFunc(comterp) {
+ }
+
+ void LeftShiftFunc::execute() {
+ ComValue& operand1 = stack_arg(0);
+ ComValue& operand2 = stack_arg(1);
+ promote(operand1, operand2);
+ ComValue result(operand1);
+
+ switch (result.type()) {
+ case ComValue::CharType:
+ result.char_ref() = operand1.char_val() << operand2.char_val();
+ break;
+ case ComValue::UCharType:
+ result.uchar_ref() = operand1.uchar_val() << operand2.uchar_val();
+ break;
+ case ComValue::ShortType:
+ result.short_ref() = operand1.short_val() << operand2.short_val();
+ break;
+ case ComValue::UShortType:
+ result.ushort_ref() = operand1.ushort_val() << operand2.ushort_val();
+ break;
+ case ComValue::IntType:
+ result.int_ref() = operand1.int_val() << operand2.int_val();
+ break;
+ case ComValue::UIntType:
+ result.uint_ref() = operand1.uint_val() << operand2.uint_val();
+ break;
+ case ComValue::LongType:
+ result.long_ref() = operand1.long_val() << operand2.long_val();
+ break;
+ case ComValue::ULongType:
+ result.ulong_ref() = operand1.ulong_val() << operand2.ulong_val();
+ break;
+ case ComValue::FloatType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::DoubleType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::BooleanType:
+ result.boolean_ref() = operand1.boolean_val() << operand2.boolean_val();
+ break;
+ }
+ reset_stack();
+ push_stack(result);
+ }
+
+ RightShiftFunc::RightShiftFunc(ComTerp* comterp) : NumFunc(comterp) {
+ }
+
+ void RightShiftFunc::execute() {
+ ComValue& operand1 = stack_arg(0);
+ ComValue& operand2 = stack_arg(1);
+ promote(operand1, operand2);
+ ComValue result(operand1);
+
+ switch (result.type()) {
+ case ComValue::CharType:
+ result.char_ref() = operand1.char_val() >> operand2.char_val();
+ break;
+ case ComValue::UCharType:
+ result.uchar_ref() = operand1.uchar_val() >> operand2.uchar_val();
+ break;
+ case ComValue::ShortType:
+ result.short_ref() = operand1.short_val() >> operand2.short_val();
+ break;
+ case ComValue::UShortType:
+ result.ushort_ref() = operand1.ushort_val() >> operand2.ushort_val();
+ break;
+ case ComValue::IntType:
+ result.int_ref() = operand1.int_val() >> operand2.int_val();
+ break;
+ case ComValue::UIntType:
+ result.uint_ref() = operand1.uint_val() >> operand2.uint_val();
+ break;
+ case ComValue::LongType:
+ result.long_ref() = operand1.long_val() >> operand2.long_val();
+ break;
+ case ComValue::ULongType:
+ result.ulong_ref() = operand1.ulong_val() >> operand2.ulong_val();
+ break;
+ case ComValue::FloatType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::DoubleType:
+ result.type(ComValue::UnknownType);
+ break;
+ case ComValue::BooleanType:
+ result.boolean_ref() = operand1.boolean_val() >> operand2.boolean_val();
+ break;
+ }
+ reset_stack();
+ push_stack(result);
+ }
+
Index: ComTerp/bitfunc.h
diff -c /dev/null ComTerp/bitfunc.h:1.1
*** /dev/null Thu Aug 16 12:21:00 2001
--- src/ComTerp/bitfunc.h Thu Aug 16 12:20:58 2001
***************
*** 0 ****
--- 1,103 ----
+ /*
+ * Copyright (c) 2001 Scott Johnston
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of the copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission. The copyright holders make
+ * no representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+ /*
+ * This is a collection of bitwise operators. They inherit the
+ * C-like promotion mechanism of NumFunc.
+ */
+
+ #if !defined(_bitfunc_h)
+ #define _bitfunc_h
+
+ #include <ComTerp/numfunc.h>
+
+ //: & (bitwise-and) operator.
+ class BitAndFunc : public NumFunc {
+ public:
+ BitAndFunc(ComTerp*);
+
+ virtual void execute();
+ virtual const char* docstring() {
+ return "& is the bitwise-and operator"; }
+ };
+
+ //: ^ (bitwise-xor) operator.
+ class BitXorFunc : public NumFunc {
+ public:
+ BitXorFunc(ComTerp*);
+
+ virtual void execute();
+ virtual const char* docstring() {
+ return "^ is the bitwise-xor operator"; }
+
+ };
+
+ //: | (bitwise-or) operator.
+ class BitOrFunc : public NumFunc {
+ public:
+ BitOrFunc(ComTerp*);
+
+ virtual void execute();
+ virtual const char* docstring() {
+ return "| is the bitwise-or operator"; }
+
+ };
+
+ //: ~ (bitwise-not) operator.
+ class BitNotFunc : public NumFunc {
+ public:
+ BitNotFunc(ComTerp*);
+
+ virtual void execute();
+ virtual const char* docstring() {
+ return "~ is the bitwise-not operator"; }
+
+ };
+
+ //: << (left-shift) operator.
+ class LeftShiftFunc : public NumFunc {
+ public:
+ LeftShiftFunc(ComTerp*);
+
+ virtual void execute();
+ virtual const char* docstring() {
+ return "<< is the left-shift operator"; }
+ };
+
+ //: >> (right-shift) operator.
+ class RightShiftFunc : public NumFunc {
+ public:
+ RightShiftFunc(ComTerp*);
+
+ virtual void execute();
+ virtual const char* docstring() {
+ return ">> is the right-shift operator"; }
+ };
+
+ #endif /* !defined(_bitfunc_h) */
+
+
+
+
+
+
Index: ComTerp/boolfunc.h
diff -c ComTerp/boolfunc.h:1.1 ComTerp/boolfunc.h:1.2
*** ComTerp/boolfunc.h:1.1 Thu Jan 4 15:31:42 2001
--- src/ComTerp/boolfunc.h Thu Aug 16 12:20:58 2001
***************
*** 49,55 ****
virtual void execute();
virtual const char* docstring() {
! return "|| is the and operator"; }
};
--- 49,55 ----
virtual void execute();
virtual const char* docstring() {
! return "|| is the or operator"; }
};
Index: ComTerp/comterp.c
diff -c ComTerp/comterp.c:1.6 ComTerp/comterp.c:1.7
*** ComTerp/comterp.c:1.6 Tue Jul 3 17:01:13 2001
--- src/ComTerp/comterp.c Thu Aug 16 12:20:58 2001
***************
*** 25,30 ****
--- 25,31 ----
#include <ComTerp/_comterp.h>
#include <ComTerp/_comutil.h>
#include <ComTerp/assignfunc.h>
+ #include <ComTerp/bitfunc.h>
#include <ComTerp/boolfunc.h>
#include <ComTerp/bquotefunc.h>
#include <ComTerp/comfunc.h>
***************
*** 892,897 ****
--- 893,904 ----
add_command("decr", new DecrFunc(this));
add_command("decr_after", new DecrAfterFunc(this));
+ add_command("bit_and", new BitAndFunc(this));
+ add_command("bit_xor", new BitXorFunc(this));
+ add_command("bit_or", new BitOrFunc(this));
+ add_command("bit_not", new BitNotFunc(this));
+ add_command("lshift", new LeftShiftFunc(this));
+ add_command("rshift", new RightShiftFunc(this));
add_command("and", new AndFunc(this));
add_command("or", new OrFunc(this));
add_command("negate", new NegFunc(this));
Index: comterp/README
diff -c comterp/README:1.1 comterp/README:1.2
*** comterp/README:1.1 Thu Jan 4 15:31:45 2001
--- src/comterp_/README Thu Aug 16 12:21:03 2001
***************
*** 76,83 ****
--------- ------------ -------- ----- ----
. dot 130 L-to-R binary
` bquote 125 R-to-L unary-prefix
- ^ power 120 R-to-L binary
! negate 110 R-to-L unary-prefix
++ incr 110 R-to-L unary-prefix
++ incr_after 110 R-to-L unary-postfix
- minus 110 R-to-L unary-prefix
--- 76,83 ----
--------- ------------ -------- ----- ----
. dot 130 L-to-R binary
` bquote 125 R-to-L unary-prefix
! negate 110 R-to-L unary-prefix
+ ~ bit_not 110 R-to-L unary-prefix
++ incr 110 R-to-L unary-prefix
++ incr_after 110 R-to-L unary-postfix
- minus 110 R-to-L unary-prefix
***************
*** 90,101 ****
--- 90,106 ----
/ div 70 L-to-R binary
+ add 60 L-to-R binary
- sub 60 L-to-R binary
+ << lshift 55 L-to-R binary
+ >> rshift 55 L-to-R binary
< lt 50 L-to-R binary
<= lt_or_eq 50 L-to-R binary
> gt 50 L-to-R binary
>= gt_or_eq 50 L-to-R binary
!= not_eq 45 L-to-R binary
== eq 45 L-to-R binary
+ & bit_and 44 L-to-R binary
+ ^ bit_xor 43 L-to-R binary
+ | bit_or 42 L-to-R binary
&& and 41 L-to-R binary
|| or 40 L-to-R binary
, stream 35 L-to-R binary
Index: OverlayUnidraw/ovcatalog.c
diff -c OverlayUnidraw/ovcatalog.c:1.4 OverlayUnidraw/ovcatalog.c:1.5
*** OverlayUnidraw/ovcatalog.c:1.4 Mon Jul 16 15:22:19 2001
--- src/OverlayUnidraw/ovcatalog.c Thu Aug 16 12:21:54 2001
***************
*** 213,219 ****
_valid = 1;
name = nil;
}
! if (!_valid) return false;
filebuf fbuf(stdin_flag ? stdin : fptr, ios_base::in);
#endif
--- 213,219 ----
_valid = 1;
name = nil;
}
! if (!_valid && !ParamList::urltest(name)) return false;
filebuf fbuf(stdin_flag ? stdin : fptr, ios_base::in);
#endif
Index: OverlayUnidraw/ovimport.c
diff -c OverlayUnidraw/ovimport.c:1.13 OverlayUnidraw/ovimport.c:1.14
*** OverlayUnidraw/ovimport.c:1.13 Mon Jul 16 15:22:19 2001
--- src/OverlayUnidraw/ovimport.c Thu Aug 16 12:21:54 2001
***************
*** 1,4 ****
--- 1,5 ----
/*
+ * Copyright (c) 2001 Scott Johnston
* Copyright (c) 1996-1999 Vectaport Inc., R.B. Kissh & Associates
* Copyright (c) 1994-1995 Vectaport Inc., Cartoactive Systems
* Copyright (c) 1990, 1991 Stanford University
***************
*** 284,291 ****
}
void ReadPpmIterator::getPixels(strstream& in) {
! // cerr << "pcount: " << in.pcount() << "\ttellg: " << in.tellg() << endl;
! while((in.pcount() - in.tellg()) >= 3) {
u_char r, g, b;
in.get((char&)r);
in.get((char&)g);
--- 285,292 ----
}
void ReadPpmIterator::getPixels(strstream& in) {
! // cerr << "pcount: " << in.pcount() << "\ttellg: " << in.tellg() << endl;
! while((in.pcount() - in.tellg()) >= 3 && in.good() && !in.eof()) {
u_char r, g, b;
in.get((char&)r);
in.get((char&)g);
***************
*** 1355,1361 ****
static boolean use_curl = OverlayKit::bincheck("curl");
static boolean use_wget = OverlayKit::bincheck("wget");
if (use_curl)
! sprintf(buffer,"curl %s", path);
else if (use_w3c)
sprintf(buffer,"w3c -q %s", path);
else if (use_wget)
--- 1356,1362 ----
static boolean use_curl = OverlayKit::bincheck("curl");
static boolean use_wget = OverlayKit::bincheck("wget");
if (use_curl)
! sprintf(buffer,"curl -s %s", path);
else if (use_w3c)
sprintf(buffer,"w3c -q %s", path);
else if (use_wget)
***************
*** 1590,1605 ****
} else
comp = PNM_Image_Filter(*in, return_fd, pnmfd, "giftopnm");
} else
! cerr << "giftopnm not found\n";
} else if (strncmp(creator, "TIFF", 4)==0) {
if (pathname && !return_fd && strcmp(pathname,"-")!=0 && !compressed)
comp = TIFF_Image(pathname);
else {
! if (OverlayKit::bincheck("tiftopnm"))
! comp = PNM_Image_Filter(*in, return_fd, pnmfd, "tiftopnm");
! else
! cerr << "tiftopnm not found\n";
}
} else if (strncmp(creator, "X11", 3)==0) {
--- 1591,1612 ----
} else
comp = PNM_Image_Filter(*in, return_fd, pnmfd, "giftopnm");
} else
! cerr << "giftopnm not found (part of netpbm)\n";
} else if (strncmp(creator, "TIFF", 4)==0) {
if (pathname && !return_fd && strcmp(pathname,"-")!=0 && !compressed)
comp = TIFF_Image(pathname);
else {
! if (OverlayKit::bincheck("tifftopnm")) {
! if (OverlayKit::bincheck("ivtiftopnm"))
! comp = PNM_Image_Filter(*in, return_fd, pnmfd, "ivtiftopnm");
! else if (OverlayKit::bincheck("ivtiftopnm"))
! comp = PNM_Image_Filter(*in, return_fd, pnmfd, "tiftopnm");
! else
! cerr << "ivtiftopnm or tiftopnm not found (part of ivtools)\n";
! } else {
! cerr << "tifftopnm not found (part of netpbm)\n";
! }
}
} else if (strncmp(creator, "X11", 3)==0) {
***************
*** 1609,1615 ****
if (OverlayKit::bincheck("xbmtopbm"))
comp = PNM_Image_Filter(*in, return_fd, pnmfd, "xbmtopbm");
else
! cerr << "xbmtopbm not found\n";
}
} else if (strncmp(creator, "JPEG", 4)==0) {
--- 1616,1622 ----
if (OverlayKit::bincheck("xbmtopbm"))
comp = PNM_Image_Filter(*in, return_fd, pnmfd, "xbmtopbm");
else
! cerr << "xbmtopbm not found (part of netpbm)\n";
}
} else if (strncmp(creator, "JPEG", 4)==0) {
***************
*** 1650,1656 ****
comp = PNM_Image_Filter(*in, return_fd, pnmfd, "djpeg -pnm");
}
} else
! cerr << "djpeg or stdcmapppm not found\n";
} else if (strncmp(creator, "PNG", 3)==0) {
if (OverlayKit::bincheck("pngtopnm")) {
--- 1657,1663 ----
comp = PNM_Image_Filter(*in, return_fd, pnmfd, "djpeg -pnm");
}
} else
! cerr << "djpeg (part of libjpeg) or stdcmapppm (part of ivtools) not found\n";
} else if (strncmp(creator, "PNG", 3)==0) {
if (OverlayKit::bincheck("pngtopnm")) {
***************
*** 1674,1682 ****
pclose(pptr);
}
} else
! comp = PNM_Image_Filter(*in, return_fd, pnmfd, "pngtopnm");
} else
! cerr << "pngtopnm not found\n";
}
--- 1681,1689 ----
pclose(pptr);
}
} else
! comp = PNM_Image_Filter(*in, return_fd, pnmfd, "pnmtopng");
} else
! cerr << "pnmtopgm not found (part of ivtools)\n";
}
Index: OverlayUnidraw/ovprecise.c
diff -c OverlayUnidraw/ovprecise.c:1.1 OverlayUnidraw/ovprecise.c:1.2
*** OverlayUnidraw/ovprecise.c:1.1 Thu Jan 4 15:33:06 2001
--- src/OverlayUnidraw/ovprecise.c Thu Aug 16 12:21:54 2001
***************
*** 1,4 ****
--- 1,5 ----
/*
+ * Copyright (c) 2001 Scott Johnston
* Copyright (c) 1998-1999 Vectaport Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
***************
*** 90,96 ****
if (movestr) {
istrstream in(movestr);
! float xmove, ymove;
in >> xmove >> ymove;
switch (cur_unit) {
--- 91,97 ----
if (movestr) {
istrstream in(movestr);
! float xmove = 0, ymove = 0;
in >> xmove >> ymove;
switch (cur_unit) {
***************
*** 99,105 ****
case 3: xmove *= ivinches; ymove *= ivinches; break;
}
! if (in.good() && (xmove!=0.0 || ymove!=0.0)) {
MoveCmd* moveCmd = new MoveCmd(GetEditor(), xmove, ymove);
moveCmd->Execute();
moveCmd->Log();
--- 100,106 ----
case 3: xmove *= ivinches; ymove *= ivinches; break;
}
! if (xmove!=0.0 || ymove!=0.0) {
MoveCmd* moveCmd = new MoveCmd(GetEditor(), xmove, ymove);
moveCmd->Execute();
moveCmd->Log();
***************
*** 135,143 ****
default_scalestr);
if (scalestr) {
istrstream in(scalestr);
! float xscale, yscale;
in >> xscale >> yscale;
! if (in.good() && xscale !=0.0 && yscale != 0.0) {
ScaleCmd* scaleCmd = new ScaleCmd(GetEditor(), xscale, yscale);
scaleCmd->Execute();
scaleCmd->Log();
--- 136,144 ----
default_scalestr);
if (scalestr) {
istrstream in(scalestr);
! float xscale = 0.0, yscale = 0.0;
in >> xscale >> yscale;
! if (xscale !=0.0 && yscale != 0.0) {
ScaleCmd* scaleCmd = new ScaleCmd(GetEditor(), xscale, yscale);
scaleCmd->Execute();
scaleCmd->Log();
***************
*** 173,181 ****
default_rotatestr);
if (rotatestr) {
istrstream in(rotatestr);
! float angle;
in >> angle;
! if (in.good() && angle!=0.0) {
RotateCmd* rotateCmd = new RotateCmd(GetEditor(), angle);
rotateCmd->Execute();
rotateCmd->Log();
--- 174,182 ----
default_rotatestr);
if (rotatestr) {
istrstream in(rotatestr);
! float angle = 0.0;
in >> angle;
! if (angle!=0.0) {
RotateCmd* rotateCmd = new RotateCmd(GetEditor(), angle);
rotateCmd->Execute();
rotateCmd->Log();
***************
*** 218,226 ****
default_pagestr);
if (pagestr) {
istrstream in(pagestr);
! int xpage, ypage;
in >> xpage >> ypage;
! if (in.good() && xpage !=0 && ypage != 0) {
Viewer* viewer = GetEditor()->GetViewer();
viewer->SetPage(new OverlayPage(xpage, ypage, true));
viewer->Update();
--- 219,227 ----
default_pagestr);
if (pagestr) {
istrstream in(pagestr);
! int xpage = 0, ypage = 0;
in >> xpage >> ypage;
! if (xpage !=0 && ypage != 0) {
Viewer* viewer = GetEditor()->GetViewer();
viewer->SetPage(new OverlayPage(xpage, ypage, true));
viewer->Update();
***************
*** 256,264 ****
default_widthstr);
if (widthstr) {
istrstream in(widthstr);
! float width;
in >> width;
! if (in.good() && width>=0.0) {
Catalog* catalog = unidraw->GetCatalog();
PSBrush* br = catalog->FindBrush(0xffff, width);
BrushCmd* brushCmd = new BrushCmd(GetEditor(), br);
--- 257,265 ----
default_widthstr);
if (widthstr) {
istrstream in(widthstr);
! float width = 0;
in >> width;
! if (width>=0.0) {
Catalog* catalog = unidraw->GetCatalog();
PSBrush* br = catalog->FindBrush(0xffff, width);
BrushCmd* brushCmd = new BrushCmd(GetEditor(), br);
Index: include_std/vector.h
diff -c include_std/vector.h:1.1 include_std/vector.h:1.2
*** include_std/vector.h:1.1 Tue Mar 27 09:32:39 2001
--- src/include/ivstd/vector.h Thu Aug 16 12:22:28 2001
***************
*** 4,9 ****
--- 4,10 ----
#define _max_save max
#undef min
#undef max
+ #include_next <iterator>
#include_next <vector.h>
#define min _min_save
#define max _max_save
Index: man1_ivtools/comterp.1
diff -c man1_ivtools/comterp.1:1.1 man1_ivtools/comterp.1:1.2
*** man1_ivtools/comterp.1:1.1 Thu Jan 4 15:33:56 2001
--- src/man/man1/comterp.1 Thu Aug 16 12:22:35 2001
***************
*** 86,93 ****
--------- ------------ -------- ----- ----
. dot 130 R-to-L binary
` bquote 125 R-to-L unary-prefix
- ^ power 120 R-to-L binary
! negate 110 R-to-L unary-prefix
++ incr 110 R-to-L unary-prefix
++ incr_after 110 R-to-L unary-postfix
- minus 110 R-to-L unary-prefix
--- 86,93 ----
--------- ------------ -------- ----- ----
. dot 130 R-to-L binary
` bquote 125 R-to-L unary-prefix
! negate 110 R-to-L unary-prefix
+ ~ bit_not 110 R-to-L unary-prefix
++ incr 110 R-to-L unary-prefix
++ incr_after 110 R-to-L unary-postfix
- minus 110 R-to-L unary-prefix
***************
*** 100,111 ****
--- 100,116 ----
/ div 70 L-to-R binary
+ add 60 L-to-R binary
- sub 60 L-to-R binary
+ << lshift 55 L-to-R binary
+ >> rshift 55 L-to-R binary
< lt 50 L-to-R binary
<= lt_or_eq 50 L-to-R binary
> gt 50 L-to-R binary
>= gt_or_eq 50 L-to-R binary
!= not_eq 45 L-to-R binary
== eq 45 L-to-R binary
+ & bit_and 44 L-to-R binary
+ ^ bit_xor 43 L-to-R binary
+ | bit_or 42 L-to-R binary
&& and 41 L-to-R binary
|| or 40 L-to-R binary
, stream 35 L-to-R binary
Index: config_ivtools/gcc.def
diff -c config_ivtools/gcc.def:1.1 config_ivtools/gcc.def:1.2
*** config_ivtools/gcc.def:1.1 Thu Jan 4 15:34:05 2001
--- config/gcc.def Thu Aug 16 12:22:41 2001
***************
*** 7,13 ****
#ifndef DependCCFlags
#if 1 /* without -D__GNUG__ */
! #define DependCCFlags -DMAKEDEPEND $(CCDEFINES) $(CCINCLUDES) -I$(GPLUSPLUS_INCLUDE_DIR) \
-I$(TOOL_INCLUDE_DIR) -UHAVE_ACE
#else /* with -D__GNUG__ */
#define DependCCFlags -D__GNUG__ -DMAKEDEPEND $(CCDEFINES) $(CCINCLUDES) -I$(GPLUSPLUS_INCLUDE_DIR) \
--- 7,13 ----
#ifndef DependCCFlags
#if 1 /* without -D__GNUG__ */
! #define DependCCFlags -w -DMAKEDEPEND $(CCDEFINES) $(CCINCLUDES) -I$(GPLUSPLUS_INCLUDE_DIR) \
-I$(TOOL_INCLUDE_DIR) -UHAVE_ACE
#else /* with -D__GNUG__ */
#define DependCCFlags -D__GNUG__ -DMAKEDEPEND $(CCDEFINES) $(CCINCLUDES) -I$(GPLUSPLUS_INCLUDE_DIR) \
Index: config_ivtools/local.def
diff -c config_ivtools/local.def:1.2 config_ivtools/local.def:1.3
*** config_ivtools/local.def:1.2 Fri Apr 27 15:06:29 2001
--- config/local.def Thu Aug 16 12:22:41 2001
***************
*** 44,50 ****
* Assume the use of gcc-2.3.3 or greater
*/
#undef LanguageCCDefines
! #define LanguageCCDefines -Dcplusplus_2_1
#include <gcc.def>
/*
--- 44,50 ----
* Assume the use of gcc-2.3.3 or greater
*/
#undef LanguageCCDefines
! #define LanguageCCDefines -Dcplusplus_2_1 -Wno-deprecated
#include <gcc.def>
/*
*** /dev/null Thu Aug 16 12:22:46 PDT 2001
--- patches/ivtools-010816-johnston-051
*************** patches/ivtools-010816-johnston-051
*** 0 ****
--- 1 ----
+ ivtools-010816-johnston-051
|
|
From: <ivt...@li...> - 2001-07-26 00:47:17
|
Patch: ivtools-010725-johnston-050 For: ivtools-0.9.4 Author: joh...@us... Subject: Requires: This is an intermediate patch to ivtools-0.9.4. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: Index: top_ivtools/CHANGES diff -c top_ivtools/CHANGES:1.5 top_ivtools/CHANGES:1.6 *** top_ivtools/CHANGES:1.5 Fri Jun 15 16:24:50 2001 --- ./CHANGES Wed Jul 25 17:43:07 2001 *************** *** 1,3 **** --- 1,47 ---- + Jul 25th 2001 ivtools-0.9.5 + + ** Most of the outstanding problems with gcc-3.0 and libstdc++-v3 have + ** been resolved. Only known problem is with incremental importing + ** (and display) of rasters from URL's. This is a long-standing + ** stable feature of ivtools. Perhaps newer versions of gcc-3.* and + ** libstdc++-v3 will fix the problem. + + - fixes a problem with importing files introduced when migrating away + from the use of istream::gets (required for gcc-3.0 and libstdc++ v3). + istream::gets would automatically skip the newline delimeter. When + using istream::get in libstdc++ v3 I needed to manually skip the + newline delimeter. + + - globally change optimization from -O6 to -O2, which makes gcc-3.0 + compile time much more reasonable. + + - all the necessary changes to support ACE and gcc-3.0 at the same + time. The majority of the work is in deferring (or avoiding) an + fclose on a fdopen'ed socket, by a) saving a FILE* in some class to be + fclose'd later, or b) rewriting without iostreams. Now there should + no longer be any dangling FILE*'s to worry about. + + - adds built-in support for PNG rasters. That means they can be + imported and save/restored by pathname (like JPEG and GIF). This + requires that pngtopnm be available to be invoked by the ivtools + drawing editors. + + - added test for whether socklen_t is typedef'ed to the configure + script. Seems older versions of FreeBSD doen't have this. + + - fix the test for whether the X11 Shared Memory extensions exists in + the server, and whether it can be utilized (which requires co-resident + client and server). + + - add a -c argument (copy instead of move) to every install command + for the benefit of the BSD's. + + - use "r+" for fopen of files to be rewound, otherwise they never get + rewound. This is a recently introduced problem. "r+" is supposed to + mean opening for reading and writing, but it seems necessary for + rewinding as well. + + Jun 15th 2001 ivtools-0.9.4 - monstrous amount of changes required by forthcoming gcc-3.0. The Index: top_ivtools/COPYING diff -c top_ivtools/COPYING:1.1 top_ivtools/COPYING:1.2 *** top_ivtools/COPYING:1.1 Thu Jan 11 15:02:32 2001 --- ./COPYING Wed Jul 25 17:43:07 2001 *************** *** 1,340 **** ! GNU GENERAL PUBLIC LICENSE ! Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. ! Preamble - The licenses for most software are designed to take away your - freedom to share and change it. By contrast, the GNU General Public - License is intended to guarantee your freedom to share and change free - software--to make sure the software is free for all its users. This - General Public License applies to most of the Free Software - Foundation's software and to any other program whose authors commit to - using it. (Some other Free Software Foundation software is covered by - the GNU Library General Public License instead.) You can apply it to - your programs, too. - - When we speak of free software, we are referring to freedom, not - price. Our General Public Licenses are designed to make sure that you - have the freedom to distribute copies of free software (and charge for - this service if you wish), that you receive source code or can get it - if you want it, that you can change the software or use pieces of it - in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid - anyone to deny you these rights or to ask you to surrender the rights. - These restrictions translate to certain responsibilities for you if you - distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether - gratis or for a fee, you must give the recipients all the rights that - you have. You must make sure that they, too, receive or can get the - source code. And you must show them these terms so they know their - rights. - - We protect your rights with two steps: (1) copyright the software, and - (2) offer you this license which gives you legal permission to copy, - distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain - that everyone understands that there is no warranty for this free - software. If the software is modified by someone else and passed on, we - want its recipients to know that what they have is not the original, so - that any problems introduced by others will not reflect on the original - authors' reputations. - - Finally, any free program is threatened constantly by software - patents. We wish to avoid the danger that redistributors of a free - program will individually obtain patent licenses, in effect making the - program proprietary. To prevent this, we have made it clear that any - patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and - modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains - a notice placed by the copyright holder saying it may be distributed - under the terms of this General Public License. The "Program", below, - refers to any such program or work, and a "work based on the Program" - means either the Program or any derivative work under copyright law: - that is to say, a work containing the Program or a portion of it, - either verbatim or with modifications and/or translated into another - language. (Hereinafter, translation is included without limitation in - the term "modification".) Each licensee is addressed as "you". - - Activities other than copying, distribution and modification are not - covered by this License; they are outside its scope. The act of - running the Program is not restricted, and the output from the Program - is covered only if its contents constitute a work based on the - Program (independent of having been made by running the Program). - Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's - source code as you receive it, in any medium, provided that you - conspicuously and appropriately publish on each copy an appropriate - copyright notice and disclaimer of warranty; keep intact all the - notices that refer to this License and to the absence of any warranty; - and give any other recipients of the Program a copy of this License - along with the Program. - - You may charge a fee for the physical act of transferring a copy, and - you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion - of it, thus forming a work based on the Program, and copy and - distribute such modifications or work under the terms of Section 1 - above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the Program, - and can be reasonably considered independent and separate works in - themselves, then this License, and its terms, do not apply to those - sections when you distribute them as separate works. But when you - distribute the same sections as part of a whole which is a work based - on the Program, the distribution of the whole must be on the terms of - this License, whose permissions for other licensees extend to the - entire whole, and thus to each and every part regardless of who wrote it. - - Thus, it is not the intent of this section to claim rights or contest - your rights to work written entirely by you; rather, the intent is to - exercise the right to control the distribution of derivative or - collective works based on the Program. - - In addition, mere aggregation of another work not based on the Program - with the Program (or with a work based on the Program) on a volume of - a storage or distribution medium does not bring the other work under - the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, - under Section 2) in object code or executable form under the terms of - Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - - The source code for a work means the preferred form of the work for - making modifications to it. For an executable work, complete source - code means all the source code for all modules it contains, plus any - associated interface definition files, plus the scripts used to - control compilation and installation of the executable. However, as a - special exception, the source code distributed need not include - anything that is normally distributed (in either source or binary - form) with the major components (compiler, kernel, and so on) of the - operating system on which the executable runs, unless that component - itself accompanies the executable. - - If distribution of executable or object code is made by offering - access to copy from a designated place, then offering equivalent - access to copy the source code from the same place counts as - distribution of the source code, even though third parties are not - compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program - except as expressly provided under this License. Any attempt - otherwise to copy, modify, sublicense or distribute the Program is - void, and will automatically terminate your rights under this License. - However, parties who have received copies, or rights, from you under - this License will not have their licenses terminated so long as such - parties remain in full compliance. - - 5. You are not required to accept this License, since you have not - signed it. However, nothing else grants you permission to modify or - distribute the Program or its derivative works. These actions are - prohibited by law if you do not accept this License. Therefore, by - modifying or distributing the Program (or any work based on the - Program), you indicate your acceptance of this License to do so, and - all its terms and conditions for copying, distributing or modifying - the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the - Program), the recipient automatically receives a license from the - original licensor to copy, distribute or modify the Program subject to - these terms and conditions. You may not impose any further - restrictions on the recipients' exercise of the rights granted herein. - You are not responsible for enforcing compliance by third parties to - this License. - - 7. If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent issues), - conditions are imposed on you (whether by court order, agreement or - otherwise) that contradict the conditions of this License, they do not - excuse you from the conditions of this License. If you cannot - distribute so as to satisfy simultaneously your obligations under this - License and any other pertinent obligations, then as a consequence you - may not distribute the Program at all. For example, if a patent - license would not permit royalty-free redistribution of the Program by - all those who receive copies directly or indirectly through you, then - the only way you could satisfy both it and this License would be to - refrain entirely from distribution of the Program. - - If any portion of this section is held invalid or unenforceable under - any particular circumstance, the balance of the section is intended to - apply and the section as a whole is intended to apply in other - circumstances. - - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of any - such claims; this section has the sole purpose of protecting the - integrity of the free software distribution system, which is - implemented by public license practices. Many people have made - generous contributions to the wide range of software distributed - through that system in reliance on consistent application of that - system; it is up to the author/donor to decide if he or she is willing - to distribute software through any other system and a licensee cannot - impose that choice. - - This section is intended to make thoroughly clear what is believed to - be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in - certain countries either by patents or by copyrighted interfaces, the - original copyright holder who places the Program under this License - may add an explicit geographical distribution limitation excluding - those countries, so that distribution is permitted only in or among - countries not thus excluded. In such case, this License incorporates - the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions - of the General Public License from time to time. Such new versions will - be similar in spirit to the present version, but may differ in detail to - address new problems or concerns. - - Each version is given a distinguishing version number. If the Program - specifies a version number of this License which applies to it and "any - later version", you have the option of following the terms and conditions - either of that version or of any later version published by the Free - Software Foundation. If the Program does not specify a version number of - this License, you may choose any version ever published by the Free Software - Foundation. - - 10. If you wish to incorporate parts of the Program into other free - programs whose distribution conditions are different, write to the author - to ask for permission. For software which is copyrighted by the Free - Software Foundation, write to the Free Software Foundation; we sometimes - make exceptions for this. Our decision will be guided by the two goals - of preserving the free status of all derivatives of our free software and - of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY - FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN - OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES - PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED - OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS - TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE - PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, - REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING - WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR - REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, - INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING - OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED - TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY - YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest - possible use to the public, the best way to achieve this is to make it - free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest - to attach them to the start of each source file to most effectively - convey the exclusion of warranty; and each file should have at least - the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - Also add information on how to contact you by electronic and paper mail. - - If the program is interactive, make it output a short notice like this - when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - - The hypothetical commands `show w' and `show c' should show the appropriate - parts of the General Public License. Of course, the commands you use may - be called something other than `show w' and `show c'; they could even be - mouse-clicks or menu items--whatever suits your program. - - You should also get your employer (if you work as a programmer) or your - school, if any, to sign a "copyright disclaimer" for the program, if - necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - - This General Public License does not permit incorporating your program into - proprietary programs. If your program is a subroutine library, you may - consider it more useful to permit linking proprietary applications with the - library. If this is what you want to do, use the GNU Library General - Public License instead of this License. --- 1,13 ---- ! From Sept. 6th 2000 to May 18th 2001 I represented that ivtools was ! dual-licensed under its original BSD-like license and the GPL. On May ! 18th 2001 I became aware of the complete requirements for ! dual-licensing against GPL, and decided to discontinue dual licensing ! for the time being. ivtools is still free software, as defined by the ! Free Software Foundation, it's just not dual-licensed with the GPL. I ! would still be amenable to the creation of a dual distribution (with ! provisions for possible GPL-only enhancements) if requested by other ! collaborators. ! Scott Johnston Index: top_ivtools/COPYRIGHT diff -c top_ivtools/COPYRIGHT:1.3 top_ivtools/COPYRIGHT:1.4 *** top_ivtools/COPYRIGHT:1.3 Fri May 18 11:50:50 2001 --- ./COPYRIGHT Wed Jul 25 17:43:07 2001 *************** *** 1,15 **** - As of September 6th 2000 the portion of ivtools for which Vectaport - Inc. holds the copyright is made available under the GPL as - well as the following license. See the file COPYING for details on - the GPL. - - As of May 18th 2001 I realize that this approach to dual-licensing - does not completely conform to a recently revised FSF description of - how to dual-license with GPL. So instead the above paragraph can be - taken as a statement of the author's interest in collaborating with - programmers who prefer GPL for their work, as well as a willingness to - facilitate dual distributions. - /* * Copyright (c) 2001 Scott Johnston * Copyright (c) 2000 Vectaport Inc., IET Inc --- 1,3 ---- Index: top_ivtools/INSTALL diff -c top_ivtools/INSTALL:1.8 top_ivtools/INSTALL:1.9 *** top_ivtools/INSTALL:1.8 Wed Jul 11 16:24:12 2001 --- ./INSTALL Wed Jul 25 17:43:07 2001 *************** *** 1,15 **** INSTALL for ivtools-0.9 ! Instructions for building ivtools-0.9.4 from source: 0. Compilation Environment Things you will need (or might want) before building ivtools: 0.a. a Unix machine. We know it has been built on Linux, NetBSD, ! Solaris, Irix, Dec Alpha, HPUX, and SunOS. Alternately it can be ! built on Windows NT with the Cygwin utilities from RedHat. See README.cygwin for details. 0.b. The gcc compiler. Recently we've been building and testing with --- 1,15 ---- INSTALL for ivtools-0.9 ! Instructions for building ivtools-0.9.5 from source: 0. Compilation Environment Things you will need (or might want) before building ivtools: 0.a. a Unix machine. We know it has been built on Linux, NetBSD, ! FreeBSD, Solaris, Irix, Dec Alpha, HPUX, and SunOS. Alternately it ! can be built on Windows NT with the Cygwin utilities from RedHat. See README.cygwin for details. 0.b. The gcc compiler. Recently we've been building and testing with *************** *** 54,62 **** http://www.cs.wustl.edu/%7Eschmidt/ACE.html ! We are currently using ACE-5.1 built without threads support. Follow ! these steps to build it from source, or use the Debian binary if you ! happen to be working on that platform (libace5.1-dev): tar xvfz ACE-5.1.tar.gz cd ACE_wrappers --- 54,63 ---- http://www.cs.wustl.edu/%7Eschmidt/ACE.html ! We are currently using ACE-5.1 (or the latest copy of ACE) built ! without threads support. Follow these steps to build it from source, ! or use the Debian binary if you happen to be working on that platform ! (libace5.1-dev): tar xvfz ACE-5.1.tar.gz cd ACE_wrappers *************** *** 70,76 **** make Then use "--with-ace=$ACE_ROOT" when running the configure script as ! described below. 0.f if you want to build the ivxt example program, which demonstrates the embedding of a ivtools drawing editor inside Motif widgets, you'll --- 71,77 ---- make Then use "--with-ace=$ACE_ROOT" when running the configure script as ! described below. 0.f if you want to build the ivxt example program, which demonstrates the embedding of a ivtools drawing editor inside Motif widgets, you'll Index: top_ivtools/README diff -c top_ivtools/README:1.5 top_ivtools/README:1.6 *** top_ivtools/README:1.5 Fri Jun 15 16:24:50 2001 --- ./README Wed Jul 25 17:43:07 2001 *************** *** 2,8 **** README for ivtools 0.9 ! This directory contains a release of ivtools 0.9.4. You should read the rest of this file for information on what ivtools is and the INSTALL file for instructions on how to build it. --- 2,8 ---- README for ivtools 0.9 ! This directory contains a release of ivtools 0.9.5. You should read the rest of this file for information on what ivtools is and the INSTALL file for instructions on how to build it. Index: top_ivtools/VERSION diff -c top_ivtools/VERSION:1.5 top_ivtools/VERSION:1.6 *** top_ivtools/VERSION:1.5 Fri Jun 15 16:24:50 2001 --- ./VERSION Wed Jul 25 17:43:07 2001 *************** *** 1 **** ! Release 0.9.4 --- 1 ---- ! Release 0.9.5 Index: TopoFace/topoelt.c diff -c TopoFace/topoelt.c:1.1 TopoFace/topoelt.c:1.2 *** TopoFace/topoelt.c:1.1 Thu Jan 4 15:31:40 2001 --- src/TopoFace/topoelt.c Wed Jul 25 17:43:12 2001 *************** *** 23,29 **** --- 23,31 ---- #include <TopoFace/topoelt.h> #include <math.h> + #ifndef MAXFLOAT #define MAXFLOAT HUGE_VAL + #endif /****************************************************************************/ Index: include_std/version.h diff -c include_std/version.h:1.5 include_std/version.h:1.6 *** include_std/version.h:1.5 Fri Jun 15 16:25:50 2001 --- src/include/ivstd/version.h Wed Jul 25 17:44:04 2001 *************** *** 1,3 **** ! #define IvtoolsVersion 0.9.4 ! #define VersionString "0.9.4" ! #define ReleaseString "ivtools-0.9.4" --- 1,3 ---- ! #define IvtoolsVersion 0.9.5 ! #define VersionString "0.9.5" ! #define ReleaseString "ivtools-0.9.5" Index: config_ivtools/params.def diff -c config_ivtools/params.def:1.8 config_ivtools/params.def:1.9 *** config_ivtools/params.def:1.8 Mon Jul 16 11:15:38 2001 --- config/params.def Wed Jul 25 17:44:11 2001 *************** *** 27,33 **** * Name of the software release */ #ifndef Release ! #define Release ivtools-0.9.4 #endif RELEASE = Release --- 27,33 ---- * Name of the software release */ #ifndef Release ! #define Release ivtools-0.9.5 #endif RELEASE = Release *************** *** 36,42 **** * VersionNumber */ #ifndef Version ! #define Version 0.9.4 #endif VERSION = Version --- 36,42 ---- * VersionNumber */ #ifndef Version ! #define Version 0.9.5 #endif VERSION = Version *** /dev/null Wed Jul 25 17:44:14 PDT 2001 --- patches/ivtools-010725-johnston-050 *************** patches/ivtools-010725-johnston-050 *** 0 **** --- 1 ---- + ivtools-010725-johnston-050 |
|
From: <ivt...@li...> - 2001-07-16 22:25:45
|
Patch: ivtools-010716-johnston-049
For: ivtools-0.9.4
Author: joh...@us...
Subject: use "r+" for fopen of files to be rewound, fix shared memory extension testing
Requires:
This is an intermediate patch to ivtools-0.9.4. To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:
patch -p0 <ThisFile
Summary of Changes:
- use "r+" for fopen of files to be rewound, otherwise they never get
rewound. This is a recently introduced problem. "r+" is supposed to
mean opening for reading and writing, but it seems necessary for
rewinding as well.
- fix shared memory extension testing. Now if the server is remote
the test for shared memory will fail, but things will carry on as they
were meant to.
Index: src_x11/xraster.c
diff -c src_x11/xraster.c:1.2 src_x11/xraster.c:1.3
*** src_x11/xraster.c:1.2 Wed Jul 11 16:47:36 2001
--- src/IV-X11/xraster.c Mon Jul 16 15:22:04 2001
***************
*** 187,192 ****
--- 187,199 ----
int i;
shared_memory = XShmQueryExtension(dpy) ? true : false;
+ boolean pixmaps;
+ int *major, *minor;
+ if (shared_memory) {
+ int major, minor, pixmaps;
+ XShmQueryVersion(dpy, &major, &minor, &pixmaps);
+ shared_memory = pixmaps;
+ }
if (shared_memory) {
image = XShmCreateImage(
***************
*** 219,225 ****
image->data = nil;
XDestroyImage(image);
image = nil;
! XShmDetach(dpy, &shminfo);
XSync(dpy, False); // necessary?
shmdt(shminfo.shmaddr);
shmctl(shminfo.shmid, IPC_RMID, 0);
--- 226,232 ----
image->data = nil;
XDestroyImage(image);
image = nil;
! // XShmDetach(dpy, &shminfo);
XSync(dpy, False); // necessary?
shmdt(shminfo.shmaddr);
shmctl(shminfo.shmid, IPC_RMID, 0);
Index: src_x11/xwindow.c
diff -c src_x11/xwindow.c:1.2 src_x11/xwindow.c:1.3
*** src_x11/xwindow.c:1.2 Thu Jun 14 10:21:33 2001
--- src/IV-X11/xwindow.c Mon Jul 16 15:22:04 2001
***************
*** 2132,2136 ****
}
} while (!done);
}
-
-
--- 2132,2134 ----
Index: OverlayUnidraw/ovcatalog.c
diff -c OverlayUnidraw/ovcatalog.c:1.3 OverlayUnidraw/ovcatalog.c:1.4
*** OverlayUnidraw/ovcatalog.c:1.3 Fri Jun 15 15:44:34 2001
--- src/OverlayUnidraw/ovcatalog.c Mon Jul 16 15:22:19 2001
***************
*** 189,195 ****
_valid = fbuf.attach(fileno(stdin)) != 0;
name = nil;
} else {
! fptr = fopen(name, "r");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
if (compressed) {
--- 189,195 ----
_valid = fbuf.attach(fileno(stdin)) != 0;
name = nil;
} else {
! fptr = fopen(name, "r+");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
if (compressed) {
***************
*** 201,207 ****
#else
boolean stdin_flag = strcmp(name, "-")==0;
if (!stdin_flag) {
! fptr = fopen(name, "r");
fptr = fptr ? OvImportCmd::CheckCompression(fptr, name, compressed) : nil;
_valid = fptr != nil;
if (compressed) {
--- 201,207 ----
#else
boolean stdin_flag = strcmp(name, "-")==0;
if (!stdin_flag) {
! fptr = fopen(name, "r+");
fptr = fptr ? OvImportCmd::CheckCompression(fptr, name, compressed) : nil;
_valid = fptr != nil;
if (compressed) {
Index: OverlayUnidraw/ovimport.c
diff -c OverlayUnidraw/ovimport.c:1.12 OverlayUnidraw/ovimport.c:1.13
*** OverlayUnidraw/ovimport.c:1.12 Mon Jul 9 17:13:55 2001
--- src/OverlayUnidraw/ovimport.c Mon Jul 16 15:22:19 2001
***************
*** 760,766 ****
const char* OvImportCmd::ReadCreator (const char* pathname) {
! FILE* file = fopen(pathname, "r");
const int creator_size = 32;
static char creator[creator_size];
--- 760,766 ----
const char* OvImportCmd::ReadCreator (const char* pathname) {
! FILE* file = fopen(pathname, "r+");
const int creator_size = 32;
static char creator[creator_size];
***************
*** 2187,2193 ****
int& ncols, int& nrows, boolean& compressed, boolean& tiled, int& twidth,
int& theight
) {
! FILE* file = fopen(pathname, "r");
file = CheckCompression(file, pathname, compressed);
tiled = false;
--- 2187,2193 ----
int& ncols, int& nrows, boolean& compressed, boolean& tiled, int& twidth,
int& theight
) {
! FILE* file = fopen(pathname, "r+");
file = CheckCompression(file, pathname, compressed);
tiled = false;
***************
*** 2610,2616 ****
Bitmap* OvImportCmd::PBM_Bitmap (const char* pathname) {
Bitmap* bitmap = nil;
! FILE* file = fopen(pathname, "r");
boolean compressed;
file = CheckCompression(file, pathname, compressed);
--- 2610,2616 ----
Bitmap* OvImportCmd::PBM_Bitmap (const char* pathname) {
Bitmap* bitmap = nil;
! FILE* file = fopen(pathname, "r+");
boolean compressed;
file = CheckCompression(file, pathname, compressed);
Index: FrameUnidraw/framecatalog.c
diff -c FrameUnidraw/framecatalog.c:1.3 FrameUnidraw/framecatalog.c:1.4
*** FrameUnidraw/framecatalog.c:1.3 Fri Jun 15 15:44:38 2001
--- src/FrameUnidraw/framecatalog.c Mon Jul 16 15:22:23 2001
***************
*** 71,77 ****
#endif
name = nil;
} else {
! fptr = fopen(name, "r");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
#if __GNUG__<3
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
--- 71,77 ----
#endif
name = nil;
} else {
! fptr = fopen(name, "r+");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
#if __GNUG__<3
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
Index: GraphUnidraw/graphcatalog.c
diff -c GraphUnidraw/graphcatalog.c:1.3 GraphUnidraw/graphcatalog.c:1.4
*** GraphUnidraw/graphcatalog.c:1.3 Fri Jun 15 15:44:40 2001
--- src/GraphUnidraw/graphcatalog.c Mon Jul 16 15:22:25 2001
***************
*** 88,94 ****
#endif
name = nil;
} else {
! fptr = fopen(name, "r");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
#if __GNUG__<3
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
--- 88,94 ----
#endif
name = nil;
} else {
! fptr = fopen(name, "r+");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
#if __GNUG__<3
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
Index: DrawServ/drawcatalog.c
diff -c DrawServ/drawcatalog.c:1.3 DrawServ/drawcatalog.c:1.4
*** DrawServ/drawcatalog.c:1.3 Fri Jun 15 15:44:41 2001
--- src/DrawServ/drawcatalog.c Mon Jul 16 15:22:26 2001
***************
*** 73,79 ****
#endif
name = nil;
} else {
! fptr = fopen(name, "r");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
#if __GNUG__<3
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
--- 73,79 ----
#endif
name = nil;
} else {
! fptr = fopen(name, "r+");
fptr = OvImportCmd::CheckCompression(fptr, name, compressed);
#if __GNUG__<3
_valid = fptr ? fbuf.attach(fileno(fptr)) != 0 : false;
*** /dev/null Mon Jul 16 15:22:36 PDT 2001
--- patches/ivtools-010716-johnston-049
*************** patches/ivtools-010716-johnston-049
*** 0 ****
--- 1 ----
+ ivtools-010716-johnston-049
|