comparison enigma/machine.h @ 15:9e02d8696e67

Added enigma_machine::step().
author Brian Neal <bgneal@gmail.com>
date Wed, 04 Jul 2012 19:52:41 -0500
parents 919b7a0d1802
children 280facb82b80
comparison
equal deleted inserted replaced
14:919b7a0d1802 15:9e02d8696e67
100 // simulate front panel key press; returns the lamp character that is lit 100 // simulate front panel key press; returns the lamp character that is lit
101 char key_press(char c) 101 char key_press(char c)
102 { 102 {
103 step_rotors(); 103 step_rotors();
104 return electric_signal(c - 'A') + 'A'; 104 return electric_signal(c - 'A') + 'A';
105 }
106
107 // this is like key_press(), but it works in signal numbers (0-25) instead of chars:
108 int step(int n)
109 {
110 step_rotors();
111 return electric_signal(n);
105 } 112 }
106 113
107 // Process a buffer of text of length n, placing the result in an output buffer. 114 // Process a buffer of text of length n, placing the result in an output buffer.
108 void process_text(const char* input, char* output, std::size_t n) 115 void process_text(const char* input, char* output, std::size_t n)
109 { 116 {