• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

contrib/maloc/tools/tests/aloc/mainc.c

00001 /*
00002  * ***************************************************************************
00003  * MALOC = < Minimal Abstraction Layer for Object-oriented C >
00004  * Copyright (C) 1994--2008 Michael Holst
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00019  *
00020  * rcsid="$Id: mainc.c,v 1.12 2008/03/12 05:14:00 fetk Exp $"
00021  * ***************************************************************************
00022  */
00023 
00024 /*
00025  * ***************************************************************************
00026  * File:     main.c
00027  *
00028  * Purpose:  Test the C interface to the VIO library.
00029  *
00030  * Author:   Michael Holst
00031  * ***************************************************************************
00032  */
00033 
00034 #include <maloc/maloc.h>
00035 
00036 #define VEMBED(rctag) VPRIVATE const char* rctag; \
00037     static void* use_rcsid=(0 ? &use_rcsid : (void*)&rcsid);
00038 VEMBED(rcsid="$Id: mainc.c,v 1.12 2008/03/12 05:14:00 fetk Exp $")
00039 
00040 extern void outputMyStuff(Vio *sock);
00041 
00042 int main(int argc, char *argv[])
00043 {
00044     Vio *sock;
00045 
00046     char *oskey = "INET";      /* FILE, PIPE, UNIX, INET, MPI1 */
00047     char *osfmt = "ASC";       /* ASC, XDR */
00048     char *osnam = "1";         /* socket number or filename */
00049     char *ohval = "localhost"; /* hostname to send things to */
00050 
00051     /* open and connect to the socket */
00052     Vio_start();
00053     VJMPERR1( VNULL != (sock=Vio_ctor(oskey,osfmt,ohval,osnam,"w")) );
00054     VJMPERR1( 0 <= Vio_connect(sock,0) );
00055 
00056     /* write some data to the socket */
00057     outputMyStuff(sock);
00058 
00059     /* disconnect and close the socket */
00060     Vio_connectFree(sock);
00061     Vio_dtor(&sock);
00062     Vio_stop();
00063 
00064     return 1;
00065 
00066   VERROR1:
00067     fprintf(stderr,"Problem occurred.\n");
00068     return 0;
00069 }
00070 
00071 void outputMyStuff(Vio *sock)
00072 {
00073     Vio_printf(sock,"%s\n","bhsingle");
00074 
00075     Vio_printf(sock,"%s %d\n","putl",4);
00076     Vio_printf(sock,"%e %e %e %e\n",0.0,1.0,0.0,0.0);
00077     Vio_printf(sock,"%e %e %e %e\n",0.0,0.0,1.0,0.0);
00078     Vio_printf(sock,"%e %e %e %e\n",0.0,0.0,0.0,1.0);
00079 
00080     Vio_printf(sock,"%s %d\n","list",7);
00081     Vio_printf(sock,"%s %d %d\n","fill",3,3);
00082     Vio_printf(sock,"%e %e %e\n",0.1,0.9,0.1);
00083     Vio_printf(sock,"%e %e %e\n",0.1,0.1,0.9);
00084     Vio_printf(sock,"%e %e %e\n",0.1,0.1,0.1);
00085     Vio_printf(sock,"%s %d %d\n","line",1,4);
00086     Vio_printf(sock,"%e %e %e\n",0.1,0.9,0.1);
00087     Vio_printf(sock,"%e %e %e\n",0.1,0.1,0.9);
00088     Vio_printf(sock,"%e %e %e\n",0.1,0.1,0.1);
00089     Vio_printf(sock,"%e %e %e\n",0.1,0.9,0.1);
00090     Vio_printf(sock,"%s %d\n","list",-7);
00091 
00092     Vio_printf(sock,"%s %d\n","list",2);
00093     Vio_printf(sock,"%s %d %d\n","fill",2,3);
00094     Vio_printf(sock,"%e %e %e\n",0.9,0.9,0.1);
00095     Vio_printf(sock,"%e %e %e\n",0.1,0.9,0.9);
00096     Vio_printf(sock,"%e %e %e\n",0.1,0.1,0.1);
00097     Vio_printf(sock,"%s %d %d\n","line",1,4);
00098     Vio_printf(sock,"%e %e %e\n",0.9,0.9,0.1);
00099     Vio_printf(sock,"%e %e %e\n",0.1,0.9,0.9);
00100     Vio_printf(sock,"%e %e %e\n",0.1,0.1,0.1);
00101     Vio_printf(sock,"%e %e %e\n",0.9,0.9,0.1);
00102     Vio_printf(sock,"%s %d\n","list",-2);
00103 
00104     Vio_printf(sock,"%s %d\n","list",3);
00105     Vio_printf(sock,"%s %d %d\n","fill",4,3);
00106     Vio_printf(sock,"%e %e %e\n",0.9,0.9,0.1);
00107     Vio_printf(sock,"%e %e %e\n",0.1,0.9,0.9);
00108     Vio_printf(sock,"%e %e %e\n",0.1,0.1,0.1);
00109     Vio_printf(sock,"%s %d %d\n","line",1,4);
00110     Vio_printf(sock,"%e %e %e\n",0.9,0.9,0.1);
00111     Vio_printf(sock,"%e %e %e\n",0.1,0.9,0.9);
00112     Vio_printf(sock,"%e %e %e\n",0.1,0.1,0.1);
00113     Vio_printf(sock,"%e %e %e\n",0.9,0.9,0.1);
00114     Vio_printf(sock,"%s %d\n","list",-3);
00115 
00116     Vio_printf(sock,"%s %d\n","putl",-1);
00117 }
00118 

Generated on Wed Oct 20 2010 11:12:15 for APBS by  doxygen 1.7.2