[LON-CAPA-cvs] cvs: modules /josh conconvert.pl

taceyjo1 lon-capa-cvs@mail.lon-capa.org
Thu, 31 Jul 2003 21:55:54 -0000


This is a MIME encoded message

--taceyjo11059688554
Content-Type: text/plain

taceyjo1		Thu Jul 31 17:55:54 2003 EDT

  Added files:                 
    /modules/josh	conconvert.pl 
  Log:
  
  
--taceyjo11059688554
Content-Type: text/plain
Content-Disposition: attachment; filename="taceyjo1-20030731175554.txt"


Index: modules/josh/conconvert.pl
+++ modules/josh/conconvert.pl
#!/bin/perl
chdir "/home/jt/hw";
print "Hello\n";
@something = glob "*";
#print "@something\n";
#foreach $something (@something) {
#	print "$something\n";
#}
$a = 1;
#unshift(@something, 'glb');
#print "@something\n";
while ($a == 1) {
#useless thing
	chdir "/home/jt/hw";
	$quest = "";
	$s1a = "";
	$s2a = "";
	$s3a = "";
	$s4a = "";
	$s1b = "";
	$s2b = "";
	$s3b = "";
	$s4b = "";
	$s1c = "";
	$s2c = "";
	$s3c = "";
	$s4c = "";
	$s1d = "";
	$s2d = "";
	$s3d = "";
	$s4d = "";
	$dpro = 0;
	
$file = pop(@something);
if ($file eq ""){
	$a= 3;
	last;
	}
open FILE, "$file";
print "$file\n";
@working = <FILE>;
foreach $working (@working){
#Question Block
	if ($working =~ m%^\w%) {
	$end = $';
	$beg = $&;
	$quest = $beg.$end;
}
	if ($quest =~ m%\?%) {
	$quest = $` . "?";
	}


#Set 1 Block
	if ($working =~ m%^/LET s1a="%) {
		$s1a = $';
		}
	if ($s1a =~ m%\"%){
		$s1a = $`;
		$s1a .= '.';
	}
if ($working =~ m%^/LET s1b="%) {
		$s1b = $';
	}
	if ($s1b =~ m%\"%){
		$s1b = $`;
		$s1b .= '.';
	}	
	if ($s1b=~ m%Statement%) {
		$s1b= "none";
	}
	if ($s1b eq ".") {
		$s1b= "none";
	}

	
if ($working =~ m%^/LET s1c="%) {
		$s1c = $';
	}
	if ($s1c =~ m%\"%){
		$s1c = $`;
		$s1c .= '.';
	}
	if ($s1c=~ m%Statement%) {
		$s1c= "none";
	}
	if ($s1c eq ".") {
		$s1c= "none";
	}
if ($working =~ m%^/LET s1d="%) {
		$s1d = $';
	}
	if ($s1d =~ m%\"%){
		$s1d = $`;
		$s1d .= '.';
	}
	if ($s1d =~ m%Statement%) {
		$s1d = "none";
	}
	if ($s1d eq ".") {
		$s1d = "none";
	}

#Set 2 Block
	if ($working =~ m%^/LET s2a="%) {
		$s2a = $';
		}
	if ($s2a =~ m%\"%){
		$s2a = $`;
		$s2a .= '.';
	}
	
if ($working =~ m%^/LET s2b="%) {
		$s2b = $';
	}
	if ($s2b =~ m%\"%){
		$s2b = $`;
		$s2b .= '.';
	}
	if ($s2b =~ m%Statement%) {
		$s2b = "none";
	}
	if ($s2b eq ".") {
		$s2b = "none";
	}

	
if ($working =~ m%^/LET s2c="%) {
		$s2c = $';
	}
	if ($s2c =~ m%\"%){
		$s2c = $`;
		$s2c .= '.';
	}
	if ($s2c =~ m%Statement%) {
		$s2c = "none";
	}
	if ($s2c eq ".") {
		$s2c = "none";
	}

if ($working =~ m%^/LET s2d="%) {
		$s2d = $';
	}
	if ($s2d =~ m%\"%){
		$s2d = $`;
		$s2d .= '.';
	}
	if ($s2d =~ m%Statement%) {
		$s2d = "none";
	}
	if ($s2d eq ".") {
		$s2d = "none";
	}
#Set 3 Block
	if ($working =~ m%^/LET s3a="%) {
		$s3a = $';
		}
	if ($s3a =~ m%\"%){
		$s3a = $`;
		$s3a .= '.';
	}
	
if ($working =~ m%^/LET s3b="%) {
		$s3b = $';
	}
	if ($s3b =~ m%\"%){
		$s3b = $`;
		$s3b .= '.';
	}
	if ($s3b =~ m%Statement%) {
		$s3b = "none";
	}
	if ($s3b eq ".") {
		$s3b = "none";
	}

	
if ($working =~ m%^/LET s3c="%) {
		$s3c = $';
	}
	if ($s3c =~ m%\"%){
		$s3c = $`;
		$s3c .= '.';
	}
	if ($s3c =~ m%Statement%) {
		$s3c = "none";
	}
	if ($s3c eq ".") {
		$s3c = "none";
	}

if ($working =~ m%^/LET s3d="%) {
		$s3d = $';
	}
	if ($s3d =~ m%\"%){
		$s3d = $`;
		$s3d .= '.';
	}
	if ($s3d =~ m%Statement%) {
		$s3d = "none";
	}
	if ($s3d eq ".") {
		$s3d = "none";
	}
	
if ($working =~ m%^/LET s4a="%) {
	$dpro = 1;
	}
#Set 4 Block
	if ($dpro == 1)
	{
	if ($working =~ m%^/LET s4a="%) {
		$s4a = $';
		}
	if ($s4a =~ m%\"%){
		$s4a = $`;
		$s4a .= '.';
	}
	
	if ($working =~ m%^/LET s4b="%) {
		$s4b = $';
	}
	if ($s4b =~ m%\"%){
		$s4b = $`;
		$s4b .= '.';
	}
	if ($s4b =~ m%Statement%) {
		$s4b = "none";
	}
	if ($s4b eq ".") {
		$s4b = "none";
	}

	
	if ($working =~ m%^/LET s4c="%) {
		$s4c = $';
	}
	if ($s4c =~ m%\"%){
		$s4c = $`;
		$s4c .= '.';
	}
	if ($s4c =~ m%Statement%) {
		$s4c = "none";
	}
	if ($s4c eq ".") {
		$s4c = "none";
	}

	if ($working =~ m%^/LET s4d="%) {
		$s4d = $';
	}
	if ($s4d =~ m%\"%){
		$s4d = $`;
		$s4d .= '.';
	}
	if ($s4d =~ m%Statement%) {
		$s4d = "none";
	}
	if ($s4d eq ".") {
		$s4d = "none";
	}
	if ($working =~ m%^/LET a4a=%) {
		$a4a = $';
	}
	if ($working =~ m%^/LET a4b=%) {
		$a4b = $';
	}
	if ($working =~ m%^/LET a4c=%) {
		$a4c = $';
	}
	if ($working =~ m%^/LET a4d=%) {
		$a4d = $';
	}
	}
	
#Ok, Lets do the answers
	if ($working =~ m%^/LET a1a=%) {
		$a1a = $';
	}
	if ($working =~ m%^/LET a1b=%) {
		$a1b = $';
	}
	if ($working =~ m%^/LET a1c=%) {
		$a1c = $';
	}
	if ($working =~ m%^/LET a1d=%) {
		$a1d = $';
	}
	if ($working =~ m%^/LET a2a=%) {
		$a2a = $';
	}
	if ($working =~ m%^/LET a2b=%) {
		$a2b = $';
	}
	if ($working =~ m%^/LET a2c=%) {
		$a2c = $';
	}
	if ($working =~ m%^/LET a2d=%) {
		$a2d = $';
	}
	if ($working =~ m%^/LET a3a=%) {
		$a3a = $';
	}
	if ($working =~ m%^/LET a3b=%) {
		$a3b = $';
	}
	if ($working =~ m%^/LET a3c=%) {
		$a3c = $';
	}
	if ($working =~ m%^/LET a3d=%) {
		$a3d = $';
	}
}

	
if ($dpro == 0)
{
$s4a = "none";
$s4b = "none";
$s4c = "none";
$s4d = "none";
$a4a = 26;
$a4b = 26;
$a4c = 26;
$a4d = 26; 
}
#print "$quest\n";
print "......................";
#print "$s1a\n";
#print "$a1a\n";

#print "$s1b\n";
#print "$a1b\n";

#print "$s1c\n";
#print "$a1c\n";

#print "$s1d\n";
#print "$a1d\n\n";

#print "$s2a\n";
#print "$a2a\n";

#print "$s2b\n";
#print "$a2b\n";

#print "$s2c\n";
#print "$a2c\n";

#print "$s2d\n";
#print "$a2d\n\n";

#print "$s3a\n";
#print "$a3a\n";

#print "$s3b\n";
#print "$a3b\n";

#print "$s3c\n";
#print "$a3c\n";

#print "$s3d\n";
#print "$a3d\n\n";
#if ($dpro == 1){
#print "$s4a\n";
#print "$a4a\n";

#print "$s4b\n";
#print "$a4b\n";

#print "$s4c\n";
#print "$a4c\n";

#print "$s4d\n";
#print "$a4d\n\n";
#}


$file .= ".problem";
chdir "/home/jt/done";
open FILE, "> $file";
print "$file";
select FILE;
print '<problem><startouttext />';
print "$quest";
print '<endouttext />';
print '<optionresponse max="10">';
print '<foilgroup options="';
print "\('True','False')\">";
print '<conceptgroup concept="One">';
print "\n";
if ($s1a ne "none"){
	print '<foil name="OneA" value="';
	if ($a1a == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s1a";
print '<endouttext />
</foil>';
}
if ($s1b ne "none"){
	print '<foil name="OneB" value="';
	if ($a1b == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s1b";
print '<endouttext />
</foil>';
}
if ($s1c ne "none"){
	print '<foil name="OneC" value="';
	if ($a1c == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s1c";
print '<endouttext />
</foil>';
}
if ($s1d ne "none"){
	print '<foil name="OneD" value="';
	if ($a1d == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s1d";
print '<endouttext />
</foil>';
}
print '</conceptgroup>';

print '<conceptgroup concept="Two">';
print "\n";
if ($s2a ne "none"){
	print '<foil name="TwoA" value="';
	if ($a2a == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s2a";
print '<endouttext />
</foil>';
}
if ($s2b ne "none"){
	print '<foil name="TwoB" value="';
	if ($a2b == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s2b";
print '<endouttext />
</foil>';
}
if ($s2c ne "none"){
	print '<foil name="TwoC" value="';
	if ($a2c == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s2c";
print '<endouttext />
</foil>';
}
if ($s2d ne "none"){
	print '<foil name="TwoD" value="';
	if ($a2d == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s2d";
print '<endouttext />
</foil>';
}
print '</conceptgroup>';

print '<conceptgroup concept="Three">';
print "\n";
if ($s3a ne "none"){
	print '<foil name="ThreeA" value="';
	if ($a3a == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s3a";
print '<endouttext />
</foil>';
}
if ($s3b ne "none"){
	print '<foil name="ThreeB" value="';
	if ($a3b == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s3b";
print '<endouttext />
</foil>';
}
if ($s3c ne "none"){
	print '<foil name="ThreeC" value="';
	if ($a3c == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s3c";
print '<endouttext />
</foil>';
}
if ($s3d ne "none"){
	print '<foil name="ThreeD" value="';
	if ($a3d == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s3d";
print '<endouttext />
</foil>';
}
print '</conceptgroup>';
if ($dpro == 1){
print '<conceptgroup concept="Four">';
print "\n";
if ($s4a ne "none"){
	print '<foil name="FourA" value="';
	if ($a4a == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s4a";
print '<endouttext />
</foil>';
}
if ($s4b ne "none"){
	print '<foil name="FourB" value="';
	if ($a4b == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s4b";
print '<endouttext />
</foil>';
}
if ($s4c ne "none"){
	print '<foil name="FourC" value="';
	if ($a4c == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s4c";
print '<endouttext />
</foil>';
}
if ($s4d ne "none"){
	print '<foil name="FourD" value="';
	if ($a4d == 1){ print 'True"><startouttext />';}
	else {print 'False"><startouttext />';}
print "\u$s4d";
print '<endouttext />
</foil>';
}
print '</conceptgroup>';
}
print '</foilgroup>
  </optionresponse>
</problem>';
select STDOUT;
print ".....Done!\n";
#Question - Done
#Set1 - Done Done
#Set2 - Done Done
#Set3 - Done Done
#Set4 - Done Done
#Output! 


}

--taceyjo11059688554--