TurtleEdit Quick Reference
Main window of TurtleEdit consists of two panes; Upper pane is for editing texts or programming codes, lower pane is used to display outputs from your code. The lower pane is not editable. You can open and edit only single file at the same time.

Functionality of this editor is just minimal, so that you will not figure out any difficulty for use of it. Please note that there is no way to turn off the display of line-number nor line-wrap feature. All multibyte codes are displayed with orange boxes to be distinguishable from ASCII characters.
Launching external programs
Just by pressing [Compile] and [Run] buttons, you can execute pre-registerd external programs, such as compilers and compiled executables. To use this feature, you need to register the locations of those codes beforehand. Open "Settings" in Run menu, and configure the command lines in text fields.

In the text field named "Compile command", describe how source codes to be compiled. In the command line, %f is replaced by the file name being edited, %b the base name of the file (for example, "program" is set if file name is "program.c";, %d directory name where the opened file is stored, %c directory name where TurtleEdit locates, and %h home directory, respectively. To include white space in the command intentionally, use %s.
When the content in editing pane is stored, the location of the file is set as current working directory.
For C users, "Compile command" will be (something like)
cc %f -lm
In the "Command for execution" text field, describe how to execute compiled codes, which is activated when [Run] button pressed.
In the "Additional exec PATH" field, give a list of addition items for PATH environmental variable separated by ":". (In Windows version, use semicolon instead of colon as separater.)
Typical settings are preset so that you can choose one of them from "Preset values".
"Path to TurtleField" and "Auto Launch" are used only when you want to use TurtleField graphics software from TurtleEdit. You need not to configure these items in common cases.
Choose appropriate character code and fonts.
By pressing [OK] button, all the settings are stored.
For example, to use LaTeX installed in /opt/local/bin, corresponding command lines would be
Compile command: /opt/local/bin/latex %f Command for execution: /opt/local/bin/xdvi %b Additional exec PATH: /opt/local/bin
where the additional PATH name /opt/local/bin/opt is used when /local/bin/xdvi launch other executables.
TIPS
In Windows, user backslash in the path name "C:\Users\daresore".
To launch external terminal emulator with a shell, you can specify the "Command for execution" field as
Mac: open -a Terminal command_name KDE(Linux): konsole -e command_name Windows: CMD command_name
To describe command lines including white space(s) such like
/bin/bash -c "dvipdfmx file_name.dvi && acroread file_name.pdf"
use %s to express space like
/bin/bash -c dvipdfmx%s%b.dvi&&acroread%s%b.pdf
In the "Command for execution" text field. %b is replaced by the part of file name where [dot]extension is ommited.
To learn computer programming with TurtleEdit
After settings were done, TurtleEdit can be used as an extremely simple IDE (Integrated Development Environment).
- Write source code in editing pane
- Save the code to file (use File menu)
- Press [Compile] button. Error messages will be displayed in the output pane, if any.
- After compilation succeeds, press [Run] button. If the code behaves in some unexpected manner, press [Break] button to terminate the code.
Before pressing [Run] button, you MUST perform [Compile] to generate successfully an executable code.
Otherwise, [Run] button will not try to make the code run.
If you use interpreter languages for which compilation is not necessary,
assign the command to execute your code or to check syntax for [Compile] button.
For Ruby, for example, "ruby -cw %f"
would be a nice choice.
If you are writing a code with console input, please take care about the buffering of i/o. For example, if you executed the following code
#include <stdio.h> main(){ int x ; printf("x? ") ; scanf("%d",&x) ; printf("x=%d\n",x) ; }
prompt "x?" will not appear in the expected timing because of buffering. You need to modify this code as
printf("x? ") ; fflush(stdout) ; scanf("%d",&x) ;
to flush buffered data, or call setbuf() function before calling printf() as
setbuf(stdout,NULL) ; printf("x? ") ; scanf("%d",&x) ;
to prohibit buffering.
To input data from keyboard, click the output pane first. When the pane is activated and becomes ready, you see red cursor on it. Then, type keyboard.
Notes
The data size that executable codes can output to Output Pane is limited to prevent unexpected errors such as infinite looping. The maximum data size of about 1 mega bytes.
To learn regular expressions
You can perform filtering of the text data in the editing pane with regular expressions. Choose "RegEX Filter" in Filter menu, another window show up. Input regular expression, then press [OK]. Matched data will be displayed in the output pane.
For the format of regular expression, check manuals and documents of Java. Note that, by default, dot does not match end-of-line.
You can choose one of the three behaviors of filtering:
- Matched string: only matched strings are output.
- Matched line: only matched lines are output.
- Lines containing pattern.
If Line number is checked, outputs in Output pane include line numbers.
Using "RegEx Replace" in Filter menu, you can replace the matched pattern to other string, and the result is displayed in output pane. Filtering does NOT change text in editing pane.
You can also utilize external commands such as sort, uniq, awk, etc., to process the text in the upper pane. To do that, choose "External command" in Filter menu. Please don't forget to check "Plunge text" before command execution.
Using "Swap buffers" in Filter menu, you can exchange the contents in upper and lower panes. This functionality might be useful to apply several filtering rules in sequential steps.