Annotation of OpenXM/src/cfep/MyDocument.h, Revision 1.2
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.
61: // OnState or OffState in the execution menu
62: NSMenuItem *menuItemNotebookMode;
63: NSMenuItem *menuItemBasicMode;
64: NSMenuItem *menuItemRisaAsir;
65: NSMenuItem *menuItemKanSm1;
66: NSMenuItem *menuItemOutputDebugMessages; //cf. debugMyTunnel;
1.2 ! takayama 67: NSMenuItem *menuItemPrettyPrint; //cf. prettyPrint;
1.1 takayama 68: // For error handling.
69: NSMutableArray *errorLines;
70: // For debug the tunnel
71: int debugMyTunnel;
1.2 ! takayama 72: // asir-contrib is loaded or not.
! 73: int asir_contrib;
! 74: // pretty printing
! 75: int prettyPrint;
1.1 takayama 76: //////////
77: NSTask *task;
78: NSPipe *inboundPipe;
79: NSPipe *outboundPipe;
80: NSPipe *errPipe;
81: NSFileHandle *inboundFileHandle;
82: NSFileHandle *outboundFileHandle;
83: NSFileHandle *errFileHandle;
84:
85: int inEvaluation;
86: NSString *myDocumentKey;
87: MyDecoder *myDecoder;
88: /////////
89: // Parameters below should be synchronized with values in myEnvironemnt.
90: enum peer_type peer;
91: NSData *peerEndEvaluteMark;
92: NSString *peerStartupString;
93: NSDictionary *myDefaultTypingAttributes;
94:
95: }
96:
97: -(IBAction) oxEvaluate:(id) sender;
98: -(IBAction) oxInterrupt:(id) sender;
99: -(IBAction) oxRenderOutput: (id) sender;
100: -(IBAction) oxEvaluateSelected: (id) sender;
101: -(IBAction) oxEvaluateRegisteredString: (id) sender;
102: -(IBAction) checkSelectedArea: (id) sender;
103: -(IBAction) clearTextViewOut: (id) sender ;
104:
105: // loading
106: -(void)loadtextViewWithData:(NSData *)data;
107: -(void)loadtextViewWithRTFData:(NSData *)data;
108: -(void) loadtextViewWithTextData:(NSData *)data ;
109:
110: // initilizers
111: -(void) initAux ;
112: -(id) openMyModel ;
113: -(void) closeMyModel;
114: -(id) restartMyModel ;
115:
116: -(NSString *) getMyDocumentKey;
117:
118: // messenges
119: -(void) sayTheMessageAboutX ;
120:
121: -(int) oxEvaluateString: (NSString *)msg withMark: (BOOL) yes;
122: - (void)outputString:(NSString *)amt;
123: - (void)outputErrorString:(NSString *)amt;
124: -(void) printErrorMessage: (NSString *)msg;
125: -(void)outputStringInNotebookMode: (NSString *)msg;
126: -(void)outputErrorStringInNotebookMode: (NSString *)msg;
127: -(void)outputStringInNotebookMode: (NSString *)msg withColor: (NSColor *)color;
128:
129: - (void)messageDialog:(NSString *)msg with:(int) no;
130: -(void) printDocument: (id) sender;
131: -(void) showHelp: (id) sender;
132: -(void) changeInputCounterField: (int) inc;
133: -(void) changeOutputCounterField: (int) inc;
134: -(void) changeOutputCounterFieldWithString: (NSString *) msg;
135: -(void) startIndicator;
136: -(void) stopIndicator;
137:
138: -(void) readInboundData: (NSNotification *) sender;
139: -(void) readErrData: (NSNotification *) sender;
140:
141: -(int) selectIllegalCharacter ;
142: -(NSRange) selectBlockForwardFrom: (int) offset with: (int) first and: (int) last ;
143: -(NSRange) selectBlockForward ;
144:
145: // managing errors. (channel 0)
146: -(void) errorActionFor: (NSString *)cmd;
147: -(void) clearLines;
148: -(void) addLine: (int) n;
149: -(int) nextLine: (int) flag ;
150: -(int) gotoLine: (int) n;
151: -(int) gotoNextError: (id) sender; // Can be an action.
152: // managing OpenGL messages. (channel 1 and 2)
153: -(int) openGLActionFor: (NSString *)cmd;
154: -(int) openGLInitActionFor: (NSString *)cmd;
1.2 ! takayama 155: // managing png messages. (channel 10)
! 156: -(void) pngActionFor: (NSString *)cmd;
1.1 takayama 157: // notebookMode
158: -(void) insertInputCell;
159: -(NSString *)getContentsOfInputCell;
160: -(void)prepareOutputCell;
161: -(int)getOutOfOutputCell;
162: -(int)specialCharacterInNotebookMode: (int) c;
163: // Add menus
164: -(void) addMenuExec;
165: -(void) setBasicStyle: (id) sender;
166: -(void) setNotebookStyle: (id) sender;
167: -(void) updateInterfaceStyleMenu;
168: -(void) setEngineRisaAsir: (id) sender;
169: -(void) setEngineKanSm1: (id) sender;
170: -(void) updateSelectEngineMenu;
171: -(void) setEngineRisaAsir: (id) sender;
172: -(void) setEngineKanSm1: (id) sender;
173: -(void) setDebugMyTunnel: (id) sender;
1.2 ! takayama 174: -(void) loadAsirContrib: (id) sender;
! 175: -(NSMenuItem *) menuItemLoadLibrary: (int) oxengine;
! 176: -(void) setPrettyPrint: (id) sender;
1.1 takayama 177: -(void) mytest: (id) sender;
178:
179: @end
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>