-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathas_splitmessage.pro
More file actions
34 lines (24 loc) · 909 Bytes
/
as_splitmessage.pro
File metadata and controls
34 lines (24 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FUNCTION as_splitmessage, messageInput, xsize
@as_scatterheader.macro
messageLines = StrSplit(messageInput, String(Byte([13B])),/EXTRACT)
newMessage = ''
FOREACH message, messageLines DO BEGIN
message = message[0]
spaces = [StrSplit(message,' '),StrLen(message)]
atEnd = 0
loop = 1
endChar = -1
While 0 NE 1 DO BEGIN
startChar = spaces[(Where(spaces GE endChar))[0]]
endChar = spaces[(Where((!d.X_CH_SIZE*(spaces-startChar)) LT xsize))[-1]]
endChar = endChar > spaces[(Where(spaces GT endChar))[0]]
newMessage = newMessage + StrMid(message,startChar, endChar-startChar)
newMessage = newMessage + String([13B])
IF endChar GE StrLen(message) THEN BEGIN
BREAK
ENDIF
ENDWHILE
ENDFOREACH
newMessage = StrMid(newMessage[0],0,StrLen(newMessage[0])-1)
RETURN, newMessage
END