[AWS] Interesting projects that might be useful for aws

David Marceau davidmarceau@sympatico.ca
Sat, 27 Mar 2004 12:44:48 -0500


snopy launches a python interpreter and calls python module calls to use Ada's
Snobol:
http://snopy.sourceforge.net/

It resembles another project:
http://sourceforge.net/projects/pyada/
Provides a Python interpreter binding for Ada 95 programs.

There might be a use for bridging aws with python.  
Here is an example of ada using python's smtplib via pyada:

WITH Interfaces.C.Strings;
USE  Interfaces.C.Strings;

with Interfaces.C;
use  Interfaces.C;

with Ada.Text_IO;

WITH Python;
USE  Python;

with GenVAdef;
use  GenVAdef;

PROCEDURE omacsmtptest IS

   PROCEDURE Run( s: IN String ) IS
      result: int;
      cstr:   chars_ptr;
      BEGIN
	 cstr := New_String( s );
	 result := PyRun_SimpleString( cstr );
	 Free( cstr );
	 END Run;

	 BEGIN
	    Py_Initialize;
	    
	    begin
	       
	       --# Import smtplib for the actual sending function
	       Run( "import smtplib" );

	       --# Import the email modules we'll need
	       Run( "from email.MIMEText import MIMEText" );
	       
	       
	       Run( "textfile = ""omacsmtptest.adb"" " );
	       
	       --# Open a plain text file for reading.  For this example, assume that
	       --# the text file contains only ASCII characters.
	       Run( "fp = open(textfile, 'rb')" );
	       
	       --# Create a text/plain message
	       Run( "msg = MIMEText(fp.read())" );
	       Run( "fp.close()" );
	       
	       --# me == the sender's email address
	       --# you == the recipient's email address
	       Run( "msg['Subject'] = 'The contents of %s' % textfile" );
	       Run( "msg['From'] = ""davidmarceau@sympatico.ca""" );
	       Run( "msg['To'] = ""davidmarceau@sympatico.ca""" );
	       
	       --# Send the message via our own SMTP server, but don't include the
	       --# envelope header.
	       Run( "s = smtplib.SMTP('smtp1.sympatico.ca')" );
	       Run( "s.set_debuglevel(1)" );
msg.as_string() )" );
	       Run( "s.sendmail('davidmarceau@sympatico.ca',
'davidmarceau@sympatico.ca', msg.as_string() )" );
	       Run( "s.quit()" );
	       
	       END;
	    	    
	    Py_Finalize;
	    END omacsmtptest;