1. Zachary Anderson
  2. cil-template

Commits

Zachary Anderson  committed e3e3724

Updated scripts for Cilly change. Fixed README.

  • Participants
  • Parent commits 8b517ea
  • Branches default

Comments (0)

Files changed (4)

File README

View file
 
 Then, enter the test directory and build a program like so:
 
-$ ciltutcc -o test1 test1.c
-$ ./test1
+$ ciltutcc -o tut1 --enable-tut1 test/tut1.c
+test/tut1.c:9: Deleted assignment: #line 9 "test/tut1.c"
+deleted = 0;
+$ ./tut1
+r = 37
 
 The generated ciltutcc takes all of the usual gcc arguments, in addition to the
 following:

File bin/ciltutcc

View file
 use lib "$FindBin::RealBin/../cil/bin";
 use lib "$FindBin::RealBin/../cil/lib";
 
-use CilConfig;
+use App::Cilly::CilConfig;
 use Ciltut;
 
 $::ciltuthome = "$FindBin::RealBin/..";

File lib/Ciltut.pm

View file
 $::version_minor = 0;
 $::version_sub = 0;
 
-use Cilly;
+use App::Cilly;
 
 # NOTE: If perl chokes, complaining about 'our', or
 # "Array found where operator expected", it's because
 # you need perl version 5.6.0 or later.
-our @ISA = qw(Cilly);
+our @ISA = qw(App::Cilly);
 
 sub new {
     my ($proto, @args) = @_;
     # Save choice in global vars for printHelp (can be called from Cilly::new)
     $Ciltut::compiler = "$bin/ciltutcc" . ($use_debug ? ".exe" : ".exe_opt");
 
-    my $self = Ciltut->Cilly::new(@args);
+    my $self = Ciltut->App::Cilly::new(@args);
 
     # New variables for Ciltut
     $self->{COMPILER} = $Ciltut::compiler;

File test/test1.c

-
-#include <stdio.h>
-#include <string.h>
-
-#include <ciltut.h>
-
-
- 
-#define MAXN  100000000  
-#define P1    1562501    
-#define P2    50000000   
-#define P3    5000       
- 
-unsigned sieve[P1];
- 
-#define GET(b) ((sieve[(b)>>5]>>((b)&31))&1)
- 
-void make()
-{
-    register unsigned i, j, k;
-    memset(sieve, 0, sizeof(sieve));
-
-    for (k = 1; k <= P3; k++) { TRACKCONDS
-        if (GET(k)==0) for(j=2*k+1,i=2*k*(k+1);i<P2;i+=j) sieve[i>>5]|=1<<(i&31);
-    }
-}
- 
-int isprime(int p) { return p==2 || (p>2 && (p&1)==1 && (GET((p-1)>>1)==0)); }
- 
-int main()
-{
-    int i, n;
-    make();
-    for (n = 0, i = 0; i <= MAXN; i++)
-        if (isprime(i)) n++;
-    printf("The number of primes below 10^8 is %d.\n", n);
-    return 0;
-}