You can easily detect some simple waveforms by detecting the flanks of the signal. A square has quick rising and falling flanks, a sawtooth has only quick rising or quick falling flanks, depending on the signal.
So you check for rising and falling flanks: if you detect both, it is square. If you detect only one type, it is triangle, as long as you are sure only these signals will be input.
Try with a differentiator circuit, which is easily done with an opamp. See here: http://www.physics.iitm.ac.in/courses_files/courses/eleclab03_odd/mathematical_operations.htm
The steepness of the flank is represented in the output of the differentiator.
Feed this signal and its inversion into Schmitt-Triggers and / or retriggerable monoflops, and you have logic level representation of RisingFlank and FallingFlank, which in turn you can use for further computation or display.