rpmio/tficl.c

Go to the documentation of this file.
00001 /*
00002 ** stub main for testing Ficl
00003 ** $Id: tficl.c,v 1.3 2003/06/26 18:19:26 jbj Exp $
00004 */
00005 /*
00006 ** Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu)
00007 ** All rights reserved.
00008 **
00009 ** Get the latest Ficl release at http://ficl.sourceforge.net
00010 **
00011 ** I am interested in hearing from anyone who uses Ficl. If you have
00012 ** a problem, a success story, a defect, an enhancement request, or
00013 ** if you would like to contribute to the Ficl release, please
00014 ** contact me by email at the address above.
00015 **
00016 ** L I C E N S E  and  D I S C L A I M E R
00017 ** 
00018 ** Redistribution and use in source and binary forms, with or without
00019 ** modification, are permitted provided that the following conditions
00020 ** are met:
00021 ** 1. Redistributions of source code must retain the above copyright
00022 **    notice, this list of conditions and the following disclaimer.
00023 ** 2. Redistributions in binary form must reproduce the above copyright
00024 **    notice, this list of conditions and the following disclaimer in the
00025 **    documentation and/or other materials provided with the distribution.
00026 **
00027 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00028 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030 ** ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00031 ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00032 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00033 ** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00034 ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00035 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00036 ** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00037 ** SUCH DAMAGE.
00038 */
00039 
00040 #include <stdio.h>
00041 #include <stdlib.h>
00042 
00043 #include "ficl.h"
00044 
00045 
00046 int main(int argc, char **argv)
00047 {
00048     int returnValue = 0;
00049     char buffer[256];
00050     ficlVm *vm;
00051         ficlSystem *system;
00052 
00053     system = ficlSystemCreate(NULL);
00054     ficlSystemCompileExtras(system);
00055     vm = ficlSystemCreateVm(system);
00056 
00057     returnValue = ficlVmEvaluate(vm, ".ver .( " __DATE__ " ) cr quit");
00058 
00059     /*
00060     ** load files specified on command-line
00061     */
00062     if (argc  > 1)
00063     {
00064         sprintf(buffer, ".( loading %s ) cr load %s\n cr", argv[1], argv[1]);
00065         returnValue = ficlVmEvaluate(vm, buffer);
00066     }
00067 
00068     while (returnValue != FICL_VM_STATUS_USER_EXIT)
00069     {
00070             fputs(FICL_PROMPT, stdout);
00071         fgets(buffer, sizeof(buffer), stdin);
00072         returnValue = ficlVmEvaluate(vm, buffer);
00073     }
00074 
00075     ficlSystemDestroy(system);
00076     return 0;
00077 }
00078 

Generated on Tue Feb 19 23:28:21 2008 for rpm by  doxygen 1.5.1