Initial commit

This commit is contained in:
Bassem Girgis
2018-12-20 17:34:07 -06:00
parent 7a2d899662
commit 81b4b9e273
34743 changed files with 5940233 additions and 0 deletions

View File

@@ -0,0 +1 @@
include ../example.mk

View File

@@ -0,0 +1,27 @@
module runme;
import tango.io.Stdout;
static import example;
void main() {
/*
* Call our gcd() function.
*/
int x = 42;
int y = 105;
int g = example.gcd( x, y );
Stdout.format( "The gcd of {} and {} is {}.", x, y, g ).newline;
/*
* Manipulate the Foo global variable.
*/
// Output its current value
Stdout.format( "Foo = {}", example.Foo ).newline;
// Change its value
example.Foo = 3.1415926;
// See if the change took effect
Stdout.format( "Foo = {}", example.Foo ).newline;
}

View File

@@ -0,0 +1,27 @@
module runme;
import std.stdio;
static import example;
void main() {
/*
* Call our gcd() function.
*/
int x = 42;
int y = 105;
int g = example.gcd(x, y);
writefln("The gcd of %s and %s is %s.", x, y, g);
/*
* Manipulate the Foo global variable.
*/
// Output its current value
writefln("Foo = %s", example.Foo);
// Change its value
example.Foo = 3.1415926;
// See if the change took effect
writefln("Foo = %s", example.Foo);
}

View File

@@ -0,0 +1,18 @@
/* File : example.c */
/* A global variable */
double Foo = 3.0;
/* Compute the greatest common divisor of positive integers */
int gcd(int x, int y) {
int g;
g = y;
while (x > 0) {
g = x;
x = y % x;
y = g;
}
return g;
}

View File

@@ -0,0 +1,7 @@
/* File : example.i */
%module example
%inline %{
extern int gcd(int x, int y);
extern double Foo;
%}