Annotation of OpenXM/src/cfep/MyDocument.h, Revision 1.4
1.1 takayama 1: //
2: // MyDocument.h
3: // cfep
4: //
5: // Created by Nobuki Takayama
6: // Copyright (c) 2006 openxm.org
7: //
8:
9: #import <Cocoa/Cocoa.h>
10: #import "MyEnvironment.h"
11: #import "MyDecoder.h"
12:
13: #define START_OF_RESULT_OF_OX_TEXMACS 0x2
14: #define END_OF_EVALUATION_OF_OX_TEXMACS 0x5
15: #define UTF8_2 0x6 // 110. header of utf8 2 byte data
16: #define UTF8_3 0xe // 1110. header of utf8 3 byte data
17: #define MYDECODER 0x3e // 1111 10. header of MyDecoder 3 byte data
18: // u0 u1 u2
19: // 110* ****/1 10** **** UTF8_2
20: // 1110 ****/2 10** ****/3 10** **** UTF8_3
21: // 1111 10**/4 1111 0***/5 1111 0*** MYDECODER
22: // /state
23:
24: // unicode of @"【"
25: #define BEGIN_INPUT_CELL 0x3010
26: // @"】"
27: #define END_INPUT_CELL 0x3011
28: // @"《"
29: #define BEGIN_OUTPUT_CELL 0x300a
30: // @"》"
31: #define END_OUTPUT_CELL 0x300b
32:
33:
34: @interface MyDocument : NSDocument
35: {
36:
37:
38: IBOutlet NSTextView *textViewIn;
39: IBOutlet NSTextView *textViewOut;
40: IBOutlet NSTextField *inputCounterField;
41: IBOutlet NSTextField *outputCounterField;
42: IBOutlet NSProgressIndicator *myIndicator;
43:
44:
45: NSData *dataFromFile;
46: NSData *textDataFromFile;
47: NSData *rtfDataFromFile;
48:
49: NSString *OpenXM_HOME ;
50: int onlySelectedArea;
51: int inputCounter;
52: int outputCounter;
53: int redirectPrint;
54:
55: // For notebook style
56: int notebookMode;
57: int doInsertNewInputCell;
58: int ox_texmacs_level;
59: // For select engine menu.
60: int oxEngine; // cf. peer_type. temporal.
1.3 takayama 61: // For error handling.
1.1 takayama 62: NSMutableArray *errorLines;
63: // For debug the tunnel
64: int debugMyTunnel;
1.2 takayama 65: // asir-contrib is loaded or not.
66: int asir_contrib;
67: // pretty printing
68: int prettyPrint;
1.4 ! takayama 69: // cf. NoEngine
! 70: int restartMode;
1.1 takayama 71: //////////
72: NSTask *task;
73: NSPipe *inboundPipe;
74: NSPipe *outboundPipe;
75: NSPipe *errPipe;
76: NSFileHandle *inboundFileHandle;
77: NSFileHandle *outboundFileHandle;
78: NSFileHandle *errFileHandle;
79:
80: int inEvaluation;
81: NSString *myDocumentKey;
82: MyDecoder *myDecoder;
83: /////////
84: // Parameters below should be synchronized with values in myEnvironemnt.
85: enum peer_type peer;
86: NSData *peerEndEvaluteMark;
87: NSString *peerStartupString;
88: NSDictionary *myDefaultTypingAttributes;
89:
90: }
91:
92: -(IBAction) oxEvaluate:(id) sender;
93: -(IBAction) oxInterrupt:(id) sender;
94: -(IBAction) oxRenderOutput: (id) sender;
95: -(IBAction) oxEvaluateSelected: (id) sender;
96: -(IBAction) oxEvaluateRegisteredString: (id) sender;
97: -(IBAction) checkSelectedArea: (id) sender;
98: -(IBAction) clearTextViewOut: (id) sender ;
99:
100: // loading
101: -(void)loadtextViewWithData:(NSData *)data;
102: -(void)loadtextViewWithRTFData:(NSData *)data;
103: -(void) loadtextViewWithTextData:(NSData *)data ;
104:
105: // initilizers
106: -(void) initAux ;
107: -(id) openMyModel ;
108: -(void) closeMyModel;
109: -(id) restartMyModel ;
110:
111: -(NSString *) getMyDocumentKey;
112:
113: // messenges
114: -(void) sayTheMessageAboutX ;
115:
116: -(int) oxEvaluateString: (NSString *)msg withMark: (BOOL) yes;
117: - (void)outputString:(NSString *)amt;
118: - (void)outputErrorString:(NSString *)amt;
119: -(void) printErrorMessage: (NSString *)msg;
120: -(void)outputStringInNotebookMode: (NSString *)msg;
121: -(void)outputErrorStringInNotebookMode: (NSString *)msg;
122: -(void)outputStringInNotebookMode: (NSString *)msg withColor: (NSColor *)color;
123:
124: - (void)messageDialog:(NSString *)msg with:(int) no;
125: -(void) printDocument: (id) sender;
126: -(void) showHelp: (id) sender;
127: -(void) changeInputCounterField: (int) inc;
128: -(void) changeOutputCounterField: (int) inc;
129: -(void) changeOutputCounterFieldWithString: (NSString *) msg;
130: -(void) startIndicator;
131: -(void) stopIndicator;
132:
133: -(void) readInboundData: (NSNotification *) sender;
134: -(void) readErrData: (NSNotification *) sender;
135:
136: -(int) selectIllegalCharacter ;
137: -(NSRange) selectBlockForwardFrom: (int) offset with: (int) first and: (int) last ;
138: -(NSRange) selectBlockForward ;
139:
140: // managing errors. (channel 0)
141: -(void) errorActionFor: (NSString *)cmd;
142: -(void) clearLines;
143: -(void) addLine: (int) n;
144: -(int) nextLine: (int) flag ;
145: -(int) gotoLine: (int) n;
146: -(int) gotoNextError: (id) sender; // Can be an action.
147: // managing OpenGL messages. (channel 1 and 2)
148: -(int) openGLActionFor: (NSString *)cmd;
149: -(int) openGLInitActionFor: (NSString *)cmd;
1.3 takayama 150: -(void) showListOfOglComm: (int) gid;
151: -(void) openGLMeta: (NSString *) cmd to: (int) gid;
1.2 takayama 152: // managing png messages. (channel 10)
153: -(void) pngActionFor: (NSString *)cmd;
1.1 takayama 154: // notebookMode
155: -(void) insertInputCell;
156: -(NSString *)getContentsOfInputCell;
157: -(void)prepareOutputCell;
158: -(int)getOutOfOutputCell;
159: -(int)specialCharacterInNotebookMode: (int) c;
160: // Add menus
161: -(void) addMenuExec;
162: -(void) setBasicStyle: (id) sender;
163: -(void) setNotebookStyle: (id) sender;
164: -(void) updateInterfaceStyleMenu;
165: -(void) setEngineRisaAsir: (id) sender;
166: -(void) setEngineKanSm1: (id) sender;
167: -(void) updateSelectEngineMenu;
168: -(void) setEngineRisaAsir: (id) sender;
169: -(void) setEngineKanSm1: (id) sender;
170: -(void) setDebugMyTunnel: (id) sender;
1.2 takayama 171: -(void) loadAsirContrib: (id) sender;
172: -(NSMenuItem *) menuItemLoadLibrary: (int) oxengine;
173: -(void) setPrettyPrint: (id) sender;
1.1 takayama 174: -(void) mytest: (id) sender;
175:
176: @end
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>