# # The Xarph Search Engine 2.1 # import string import cgi import urllib import time ## ## Helper Functions: ## true = 1 false = 0 ## ## CGI related stuff: ## # # PrintFile # def PrintFile( strFileName ): file = open( strFileName, 'r' ) strLine = file.readline() while strLine != '': print strLine strLine = file.readline() file.close() # # PrintHeader # # This prints the necessary header info for a html file. # def PrintHeader(): print 'Content-type: text/html\n\n' # # SwitchToURL # # This switches the browser to a new URL in a stupid-browser-friendly way. # def SwitchToURL( data, strURL ): print 'Almost There...' print '' print 'Click Here To See Results of Search' # # RunEngine # def RunEngine( data ): strURL = data[5] + urllib.quote( data[3] ) + data[6] SwitchToURL( data, strURL ) ## ## Search Data ## # # Search data is passed in a standard format: # # data[0] = original form from cgi.FieldStorage() # data[1] = original Keyword text # data[2] = engine which should be used to process the data. # data[3] = current Keyword text # data[4] = should a new browser window be launched? # data[5] = URL prefix # data[6] = URL postfix # # # Each engine has a entry function which takes the search data as an arguement. # It returns true iff processing is done on the search. # ## ## Xarph Search ## # # XProcessOptions # def XProcessOptions( data ): return true # # XConvertText # def XConvertText( strText ): lWords = string.split( strText ) lNewWords = [] for strWord in lWords: if( len( strWord ) > 0 ): if( strWord[0] == '|' or strWord[0] == '/' ): lNewWords.append( strWord[1:] ) elif( strWord[0] == '+' or strWord[0] == '-' ): lNewWords.append( strWord ) else: lNewWords.append( '+' + strWord ) return string.join( lNewWords ) # # XarphSearch # def XarphSearch( data ): if( XProcessOptions( data ) ): data[3] = XConvertText( data[1] ) data[5] = 'http://www.altavista.digital.com/cgi-bin/query?pg=q&what=web&fmt=.&q=' data[6] = '' RunEngine( data ) # # CNFSearch # def CNFSearch( data ): EquipList = [ ( 'pg', 'Mann PG Pattern Generator' ), ( '10x', '10x i-line Stepper' ), ( '10x stepper', '' ), ( 'stepper', '' ), ( '5x', "5x g-line Stepper" ), ( '5x stepper', '' ), ( 'htg', 'HTG Contact Aligner' ), ( 'contact aligner', '' ), ( 'suss', 'Karl Suss MA6' ), ( 'karl suss', '' ), ( 'yes', 'YES Oven' ), ( 'yes oven', '' ), ( 'ebmf', 'EBMF E-Beam' ), ( 'zeiss', 'Zeiss DSM 982 SEM' ), ( '982', '' ), ( 'hitachi', 'Hitachi S800 SEM' ), ( 's800', '' ), ( 'amray', 'Amray 1830 SEM' ), ( 'pecvd', 'IPE PECVD' ), ( 'sputterer', 'CVC Sputter Deposition' ), ( 'sputter', '' ), ( 'cha', 'CHA Thermal Evaporator' ), ( 'thermal evaporator', '' ), ( 'ebeam', 'CVC SC4500 Evaporator' ), ( 'ebeam evaporator', '' ), ( 'egun', '' ), ( 'egun evaporator', '' ), ( 'cvc', '' ), ( 'cvc evaporator', '' ), ( 'dual e-gun', 'Dual E-Gun Evaporator' ), ( 'grandson', 'PlasmaTherm SSL720 RIE' ), ( 'new cl2', '' ), ( 'ssl720', '' ), ( '720', '' ), ( 'old man', 'PlasmaTherm PK1250 RIE [Cl]' ), ( 'pk1250', '' ), ( 'jr', 'PlasmaTherm PT72 RIE [F]' ), ( '72', '' ), ( 'jr.', '' ), ( 'release', '' ), ( 'ecr', 'PlasmaQuest ECR' ), ( 'mie', 'MRC MIE' ), ( 'applied materials', 'Applied Materials RIE [F]' ), ( 'applied', '' ), ( 'ion mill', 'Ion Mill' ), ( 'branson', 'Branson Barrel Etcher' ), ( 'poly', 'Polysilicon' ), ( 'poly tube', '' ), ( 'tft poly', 'TFT Polysilicon' ), ( 'tft poly tube', '' ), ( 'nitride', 'Nitride' ), ( 'nitride tube', '' ), ( 'dry oxide', 'HCL Oxide' ), ( 'dry oxide tube', '' ), ( 'tca', 'TCA Wet Oxide' ), ( 'tca tube', '' ), ( 'wet oxide', '' ), ( 'wet oxide tube', '' ), ( 'mos clean', 'MOS Clean' ), ( 'clean', '' ), ( 'tft mos clean', 'TFT MOS Clean' ), ( 'tft clean', '' ), ( 'anneal', 'Annealing' ), ( 'annealling', '' ), ( 'lto', 'LTO 410' ), ( 'lto tube', '' ), ( 'vlto', '' ), ( 'vlto tube', '' ), ( 'auger', 'Scanning Auger Microprobe' ), ( 'iv', 'Keithley I-V' ), ( 'probe', '' ), ( 'probe station', '' ), ( 'test', '' ), ( 'testing', '' ), ( 'ion implanter', 'Varian Ion Implanter' ), ( 'implanter', '' ), ( 'slr', 'PlasmaTherm 770 ICP' ), ( 'bosch', '' ), ( 'slr 770', '' ), ( 'slr-770', '' ), ( 'help', 'nothing' ) ] machine = '' for equip in EquipList: if( equip[1] != '' ): machine = equip[1] if( equip[0] == string.lower( data[3] ) ): break if( machine == 'nothing' ): data[5] = 'http://kale.ee.cornell.edu/Fred/search/CNFHelp.html' print 'machine = ' + ("%s" % data[3]) # RunEngine( data ) timeNow = time.localtime( time.time() ) print '
' print '
' print '' print '' print '' print '' print '' print '
' # # Weather # def Weather( data ): pass # # DejaNews # def DejaNews( data ): pass ## ## Start() ## def Start(): PrintHeader() data = [ cgi.FieldStorage(), '', '', '', false, '', '' ] if( data[0].has_key( "keywords" ) ): data[1] = data[3] = data[0][ "keywords" ].value if( data[0].has_key( "WhichOne" ) ): data[2] = data[0][ "WhichOne" ].value if( data[2] == "CNF" ): CNFSearch( data ) elif( data[2] == "Xarph" ): XarphSearch( data ) elif( data[2] == "WeatherUnderground" ): Weather( data ) elif( data[2] == "DejaNews" ): DejaNews( data ) else: data[5] = 'http://kale.ee.cornell.edu/search/Help.html' data[3] = '' RunEngine( data ) Start()