1#!/usr/bin/env python
2
3#
4# The contents of this file are subject to the Mozilla Public
5# License Version 1.1 (the "License"); you may not use this file
6# except in compliance with the License. You may obtain a copy of
7# the License at http://www.mozilla.org/MPL/
8#
9# Software distributed under the License is distributed on an "AS
10# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11# implied. See the License for the specific language governing
12# rights and limitations under the License.
13#
14# The Original Code is State Machine Compiler (SMC).
15#
16# The Initial Developer of the Original Code is Charles W. Rapp.
17# Portions created by Charles W. Rapp are
18# Copyright (C) 2000 - 2003 Charles W. Rapp.
19# All Rights Reserved.
20#
21# Contributor(s):
22#       Port to Python by Francois Perrad, francois.perrad@gadz.org
23#
24# Function
25#   Main
26#
27# Description
28#  This routine starts the finite state machine running.
29#
30# RCS ID
31# $Id: checkstring.py,v 1.1 2005/05/28 17:48:29 cwrapp Exp $
32#
33# CHANGE LOG
34# $Log: checkstring.py,v $
35# Revision 1.1  2005/05/28 17:48:29  cwrapp
36# Added Python examples 1 - 4 and 7.
37#
38#
39
40import sys
41
42import AppClass
43
44retcode = 0
45if len(sys.argv) < 2:
46	print "No string to check.\n"
47	retcode = 2
48elif len(sys.argv) > 2:
49	print "Only one argument is accepted.\n"
50	retcode = 3
51else:
52	appobject = AppClass.AppClass()
53	str = sys.argv[1]
54	if appobject.CheckString(str) == False:
55		result = "not acceptable"
56		retcode = 1
57	else:
58		result = "acceptable"
59	print 'The string "%s" is %s.\n' % (str, result)
60sys.exit(retcode)
61