1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
option: symbols=" "
L_=c,fortran77,lisp,pascal,perl,python,scheme,sh,tcl
l_=!words2items $(replyoption$i)
L_=!listintersect $l_ and $L_
L_=!item 1 of $L_
!default L_=c
!if $L_=c
code_reserved_=int,float,double,unsigned,signed,long,short,char,void,struct,\
static,volatile,const,union,switch,case,goto,default,\
return,if,else,for,while,do,break,continue,sizeof,typedef,\
public,void,extern,enum
!endif
!if $L_=fortran77
code_reserved_=program,do,write,return,end,stop,subroutine,function,\
integer,real,character,logical,dimension,continue,read,parameter,\
if,then,endif,elseif,while,enddo,until,exit,\
data,block
!endif
!if $L_=pascal
code_reserved_=begin,end,procedure,function,program,\
intrinsic,return,and,or,not,repeat,until,to,case,true,false,\
if,then,else,for,do,while,break,continue,type,var,record,\
var,type,packed,array,of,integer,real,char,mod,div,\
write,writeln,label,record,goto,boolean,true,false,with
!endif
!if $L_=perl
code_reserved_=sub,if,else,elsif,for,local,print,foreach,while,until
!endif
good=!replace internal , by , $ in $(replygood$i)
good=!singlespace $good
good=!trim $good
wims_exec_error=
!distribute item $oef_codelim into codelim_1,codelim_2
!default codelim_1=1000000
!default codelim_2=$codelim_1
codelen=!nospace $(reply$i)
codelen=!replace internal $ by t in $codelen
codelen=!charcnt $codelen
!if $codelen > $codelim_2
test=NaN lengthoverflow
!exit
!endif
!if $code_allow_$code_deny_ != $empty
illegal_name=
names_=!varlist $(reply$i)
!if $code_allow_!=$empty
names_=!listcomplement $names_ and $code_allow_,$code_reserved_
!for n_ in $names_
l_=!charcnt $n_
!if $l_>1
illegal_name=$n_
!break
!endif
!next n_
!else
names_=!listintersect $names_ and $code_deny_
illegal_name=!item 1 of $names_
!endif
!if $illegal_name!=$empty
test=NaN illegalname
!exit
!endif
!endif
!if $L_ notwordof perl sh
m_reply_out=!exec $L_ $oef_presrc\
$(reply$i)\
$oef_postsrc
!else
r_=!replace internal $ by $$$$ in $oef_presrc\
$(reply$i)\
$oef_postsrc
!if $L_=sh
m_reply_out=!sh $r_
!endif
!if $L_=perl
m_reply_out=!perl $r_
!endif
!endif
m_reply_err=!trim $wims_exec_error
tmpdir=../chroot/tmp/sessions/$wims_session
tmpdir=!translate internal _ to $ $ in $tmpdir
tmpdir=!word 1 of $tmpdir
m_reply_err=!replace internal $tmpdir/ by $ in $m_reply_err
wims_exec_error=
dd=!replace internal , by , $ in $m_reply_out
dd=!singlespace $dd
dd=!trim $dd
m_reply$i=$dd
!if $dd=$empty and nonempty iswordof $(replyoption$i)
error=empty_out
!exit
!endif
!if $wims_read_parm=nocompare
!exit
!endif
!if $good=$empty
Test=bad $i
!exit
!endif
diag=
replyGood$i=
!if $dd issametext $good and $codelen <= $codelim_2
diag=yes
!endif
!if $diag=yes
diareply$i=good
!if $codelen <= $codelim_1
!advance freegot
!else
freegot=$[$freegot+($codelim_2-$codelen+1)/($codelim_2-$codelim_1+1)]
partialgood$i=yes
!endif
!else
diareply$i=bad
!endif
|