main
   open "commands.dat" as inputFile
   read command from inputFile
   while  inputFile
       process command
       read command from inputFile
   close inputFile


On first draft I did:
process
     if the command requires additional input
        read the input
     call correct encryption routine


process
     input:  input, a file stream
             inputName, a string
             outputName, a string
	     command, a char
     output: none
     This routine will be big, so make it simple

     switch command
        case 'A'
	    FileToNumber(inputName, outputName)
	case 'a'
	    FileFromNumber(inputName, outputName)
	case 'I'
	    FileIncrement(inputName, outputName, 1)
	case 'i'
	    FileIncrement(inputName, outputName, -1)
        case 'o'
	    ReverseFileByWord(inputName, outputName)
	case 'O'
	    ReverseFileByMessage(inputName, outputName)
	case 'C'
	    read shift from input
	    CeasarFile(inputName, outputName, shift)
        case 'S'
	    read dir from input
	    SelfCeasarFile(inputName, outputName, dir)
	case 'P'
	    FileToPigLatin(inputName, outputName)
	case 'p'
	    FileFromPigLatin(inputName, outputName)
	case '<'
	    CopyFile(inputName, outputName)
	case '+'
	    read secondInput from input
	    MergeFiles(inputName, secondInput, outputName)
	case '='
	    CompareFiles(inputName, outputName)

read
     input:  input, a file stream
     output: inputName, a string
             outputName, a string
	     command, a char

     read inputName
     read command
     read outputName

FileToNumber
   open  inputFile
   message = ""

   read  character from inputFile 
   Make sure this reads white space as well
   while  inputFile
       message = message +  CharToHexString( character)
       read  character from inputFile
   write message to output file

CharToHexString
   div and mod?
   find the first hex digit of the input character
   convert the hex digit to a character and add it to the return value
   find the second hex digit of the input character
   convert the hex digit to a character and add it to the return value
   return the new string

FileFromNumber
   open the input file
   read the inputMessage from the file
   close the input file

   outputMessage = ""
   pos = 0
   while pos < length of inputMessage
      get the first character
      if more characters
         get second character
	 if both characters are ValidHexDigit
	     HexStringToAsciiCharacter both characters to a single ascii chararacter
	     add new character to outputMessage
	 else
	    add both characters to outputMessage
      else
         add the first character to the outputMessage

   write outputMessage to output file

ValidHexDigit
   if the charactar is between 0 and 9, or betwen a and f 
      return true
   else 
      return false

HexStringToAsciiChar
    convert first character value from ascii to hex
    convert second character value from ascii to hex
    value = first_digit * 16 + second_digit
    return value

FileIncrement
   open input file
   outputMessage = ""

   for each character in the message
      if the character is a hex value
         newCharacter = DoSimpleAddition(character, dir)
	 outputMessage = outputMessage + newCharacter 
      else
         outputMessage = outputMessage + character
    write outputMessage to outputFile

DoSimpleAddition
    convert the character to hex value
    newValue = converted char + dir
    move the new value to the range 0 to 16
    conver newValue to character
    return the character

ReverseFileByWord
    open the input file

    while not at the end of the inputMessage
       copy white space to outputMessage
       build a word
       reverseWord
       add reverseWord to outputMessage

    print outputMessage to outputFile

ReverseFileByMessage
    read inputMessage from inputFile

    for last letter to first letter in inputMessage
        add letter to outputMessage
    write outputMessage to outputFile

CeaserFile
    read inputMessage from inputFile
    for each letter in the inputMessage
       if the letter is an alphabetic letter
          outputMessage += EncryptLetter(letter, shift)
       else
          outptuMessage += letter

    write outputMessage to outputFile

SelfCeaserFile
    read inputMessage from inputFile
    shift = 'a'
    for each letter in the inputMessage
       if the letter is an alphabetic letter
          if (dir = +) 
              outputMessage += EncryptLetter(letter, shift)
	  else 
              outputMessage += EncryptLetter(letter, -shift)
       else
          outptuMessage += letter
    write outputMessage to outputFile

EncryptLetter
   Careful about coersion here
   Add shift to letter
   If the letter is out of range
      bring the letter back into range
   return new letter

FileToPigLatin
    read inputMessage from inputFile

    for each letter in inputMessage
       if the letter is whitespace
          add the letter to the output message
       else 
          build word
	  PigLatin the word
	  add the pigLatinWord to the outputMessage

    write outputMessage to outputFile

PigLatinWord
    pos = 0
    while the letter at pos is not a vowel
        add the letter to the postfix
    add the letters from pos on to the return word
    add "-" to the return word
    add the postfix to the return word
    add "ay" to the return word

FileFromPigLatin
    read inputMessage from inputFile

    for each letter in inputMessage
       if the letter is whitespace
          add the letter to the output message
       else 
          build word
	  UnPigLatin the word
	  add the newWord to the outputMessage

    write outputMessage to outputFile

UnPigLatinWord
    find the - in the word
    If ther is no -
       return the word
    else
       for each letter from the - to the letter a
          add the letter to the outputWord
       add the letters fromt he beginning to - to the outputWord
       return  the outputWord

CopyFile
    read inputMessage from inputFile
    write outputMessage to outputFile

MergeFiles
    read inputMessage from inputFile
    write outputMessage to outputFile
    read inputMessage from secondInputFile
    write outputMessage to outputFile

CompareFiles
    read message1 from inputFile
    read message2 from secondInputFile
    if message1 == message 2
       print files match
    else
       print files do not match