Compare commits

...

8 Commits
r1 ... master

Author SHA1 Message Date
Kelvin Sherlock
91f4b65920 version bump. 2021-07-07 18:44:01 -04:00
Kelvin Sherlock
1155573111 buffer allocation was wrong which caused excess allocations
it also may have written past the end of the buffer and lost
characters (including formatting characters, resulting in display glitches).
2021-07-07 18:43:53 -04:00
Kelvin Sherlock
8085d2c934 reset the connection state when opening/closing the window. 2021-07-07 16:50:09 -04:00
Kelvin Sherlock
eb69b619c9 bug in buffer growth algorithm. 2019-07-13 14:22:35 -04:00
Kelvin Sherlock
41674ac33d update makefile 2019-07-09 13:38:14 -04:00
Kelvin Sherlock
316f1423a9 no special memory for handle. 2019-07-08 23:22:07 -04:00
ksherlock
8a5efb4fa7
Create README.md 2019-07-08 22:43:32 -04:00
Kelvin Sherlock
9133fa7a94 add screenshot 2019-07-08 22:36:57 -04:00
5 changed files with 19 additions and 11 deletions

View File

@ -2,6 +2,13 @@
BIN_OBJ = o/main.a o/connection.a
NDA_OBJ = o/nda.a o/connection.a o/tools.a
.PHONY: all clean clobber
all : dict dict.nda
clean:
$(RM) -r o
clobber : clean
$(RM) dict dict.nda
dict : $(BIN_OBJ)
iix link o/main o/connection keep=$@

3
README.md Normal file
View File

@ -0,0 +1,3 @@
An RFC 2229 [DICT](http://www.dict.org/) protocol client, in NDA form.
![screenshot](images/image-1.png)

BIN
images/image-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

14
nda.c
View File

@ -46,7 +46,6 @@ void NDAResourceShutDown(NDAResourceCookie *cookie);
Word NDAResourceStartUp(Word memID, Word access, NDAResourceCookie *cookie);
Word MyID;
Word ipid;
Word FlagTCP;
Word ToolsLoaded;
GrafPortPtr MyWindow;
@ -107,7 +106,7 @@ void AppendText(word length, char *cp) {
size = TextHandleUsed + length;
if (size > TextHandleSize) {
size += 4095;
size &= 4096;
size &= ~4095;
if (h) {
HUnlock(h);
@ -116,11 +115,10 @@ void AppendText(word length, char *cp) {
HLock(h);
TextHandleSize = size;
} else {
TextHandle = h = NewHandle(size, MyID, attrLocked, 0);
TextHandle = h = NewHandle(size, MyID, attrLocked|attrNoSpec, 0);
if (_toolErr) return;
TextHandleSize = size;
}
HLock(h);
}
BlockMove(cp, *h + TextHandleUsed, length);
TextHandleUsed += length;
@ -155,7 +153,7 @@ void SetText(void) {
longword oldStart, oldEnd;
TESetSelection((Pointer)-1, (Pointer)-1, TECtrlHandle);
TESetText(teDataIsTextBox2|teTextIsPtr, (Ref)*TextHandle, TextHandleUsed, NULL, NULL, TECtrlHandle);
TESetText(teDataIsTextBox2|teTextIsPtr, (Ref)*TextHandle, TextHandleUsed, 0, NULL, TECtrlHandle);
TextHandleUsed = 0;
@ -396,7 +394,6 @@ pascal word HandleRequest(word request, longword dataIn, longword dataOut) {
if (request == TCPIPSaysNetworkDown) {
FlagTCP = false;
ipid = 0;
UpdateStatus(true);
}
SetCurResourceApp(oldRApp);
@ -435,7 +432,6 @@ void NDAInit(Word code) {
ToolsLoaded = false;
MyID = MMStartUp();
ipid = 0;
st = st_none;
} else {
if (ToolsLoaded)
@ -449,6 +445,7 @@ void NDAClose(void) {
AcceptRequests(ReqName, MyID, NULL);
ConnectionAbort(&connection);
st = st_none;
CloseWindow(MyWindow);
MyWindow = NULL;
@ -470,6 +467,7 @@ GrafPortPtr NDAOpen(void) {
TextHandle = NULL;
TextHandleSize = 0;
TextHandleSize = 0;
st = st_none;
if (!ToolsLoaded) {
if (NDAStartUpTools(MyID, &ss)) {
@ -542,7 +540,7 @@ void DoDefine(void) {
handle = (Handle)GetCtlHandleFromID(MyWindow, rCtrlTE);
TESetText(teDataIsTextBlock, (Ref)"", 0, NULL, NULL, handle);
TESetText(teDataIsTextBlock|teTextIsPtr, (Ref)"", 0, 0, NULL, handle);
GetLETextByID(MyWindow, rCtrlLE, (StringPtr)word_to_define);

View File

@ -114,7 +114,7 @@ resource rText (0x4) {
resource rComment (1) {
"Dict NDA\n\n"
"Written by Kelvin W Sherlock\n"
"2018-2019"
"2018-2021"
};
resource rVersion (1) {
@ -123,9 +123,9 @@ resource rVersion (1) {
0,
0,
alpha,
0
1
},
verUS,
"Dict",
"(C) 2018-2019 Kelvin Sherlock "
"(C) 2018-2021 Kelvin Sherlock "
};