Jump to content
IGNORED

New Atari BBS software.


tschak909

Recommended Posts

I dunno, could somebody who has actually written a text editor comment here, on something that could rely on using as little RAM as possible, while keeping most of it out on disk?

Have a look at CoED on the BBC Micro. It uses a similar split-buffer editor to the one used in The Last Word, but in TLW I keep the entire buffer in a single 16KB bank of RAM. CoED, however, dumps the top and bottom of the file out in stacks on disk, so the edit buffer can be very small. I'm assuming you don't need word-wrap, though, in which case things get a lot easier. Having two temp files - one for each end of the file - might be worth considering anyway.

Link to comment
Share on other sites

Okay, after throwing away the crap of the last two days, and replacing it with a more textbook example, the line editor backend is starting to breathe and work properly. I can insert and replace arbitrary lines of text and output it as needed:

 

This code:

 

https://github.com/tschak909/ataribbs/blob/master/bbslib/common/ledit.c

https://github.com/tschak909/ataribbs/blob/master/bbslib/common/ledit.h

 

Along with this test harness:


	#include <bbslib/common/ledit.h>
	#include <stdlib.h>
	#include <string.h>
	#include <stdio.h>
	
	void main()
	{
	  printf("\n\n ledit test harness.\n\n");
	  ledit_init();
	  ledit_insert_at_end("Line 1 test.");
	  ledit_insert_at_end("Line 2 is here.");
	  ledit_insert_at_end("Line 3 is right here.");
	  ledit_insert_at_end("Line 4 is HERE!");
	  ledit_insert_at_beginning("This should be on top.");
	  ledit_insert_at_beginning("TOP OF TOP!");
	  ledit_insert_after_line(2,"Dropping this second from top.");
	  ledit_debug();
	  ledit_done();
	}
	

 

Produces:

 

umX1DwU.png

 

Onward and upward, but at least the approach will work (The only thing being kept in memory are the line #s to the lines in the temp file, along with the linked list pointers), and take up a minimum of RAM.

 

-Thom

  • Like 1
Link to comment
Share on other sites

There is enough of the ledit backend ready, so that a UI can be constructed. That's my next task.

 

One pattern I am trying to adhere to is that I am trying to maintain a clean separation of front-end (UI) and back-end (logic and storage), so that different UIs can be constructed. The back-end bits do not emit any UI at all, and just deal with storage, and the front-end only calls the exposed API.

 

The one change I am going to have to make to msg, is to make it NOT take a completed character buffer to write to the message base file, but rather to allow a chunked I/O, again to keep the memory consumption as low as possible. (I am fast running out of RAM, right now in the lower 48).

 

More as it develops. Onward and upward.

 

-Thom

Link to comment
Share on other sites

BBS is in maintenance mode. I have commented out the old code in bbs(), and am starting to exercise various parts of the system, in a loop, trying to exacerbate a malloc() error.

 

-Thom

Ahhh - it has been SO long since I have had to do manual garbage cleanup. I have been spoiled.

 

However, I have had to debug code using 3rd party libraries which had almost unreproducible memory leaks. It's never fun.

Link to comment
Share on other sites

so far, the big candidates, terminal_send_file() and ledit_insert_at_end() haven't caused a leak, as they have each been running for 65535 cycles, one right after the other. This leaves the msg_put_chunked() code in question...

 

Interestingly enough, removing the call to menu() (the main UI), chopped off 12K from the BBS core, immediately...wowza.

 

-Thom

Link to comment
Share on other sites

and now, depression sinks in...

 

It's clear I have memory leaks in at least one place, if not everywhere...

 

Now I have to go walking around and plug up the holes.

 

Progress about to screech to a ($#@(R#@ halt.

That's alright, it's much better to take the time to find these leaks now, as they'd only get more difficult to find as the system grows in complexity. That's just a normal part of development, really. Writing new code is fun, and having to track down potentially obscure bugs is a pain in the ass. That's just the way it is. :)

 

..Al

  • Like 1
Link to comment
Share on other sites

That's alright, it's much better to take the time to find these leaks now, as they'd only get more difficult to find as the system grows in complexity. That's just a normal part of development, really. Writing new code is fun, and having to track down potentially obscure bugs is a pain in the ass. That's just the way it is. :)

 

..Al

Yeah, it's true, for sure... I've spent countless hours tracking down memory leaks in code bases of over 4 million+ lines... This is a lot easier in some respects..

 

I did find the source of the leak...one place... basically a strdup() iterating over character buffer lines, that didn't have a free() on the other end once the line had been chunked out to disk. :)

 

Now, I'm tracking down some open/close port stuff... I really need to refactor things so that I can enclose critical I/O sections with a macro, and have it deal with opening/closing the terminal port, nicely.

 

Once I do this, I'll be able to continue hammering on features.

 

-Thom

Link to comment
Share on other sites

I've implemented a preliminary Chat With Sysop.

 

It needs a bit more work on the ASCII side (I need to replicate and refactor the translation code to work in the chat mode.

 

Why?

 

Chat mode is special, when one side or the other starts typing, a username prompt is output, e.g.

 

 

SysOp: How may I help you?
TSCHAK: Hi.
I'm having trouble posting messages.
SysOp: I'll check it out...

 

This works just fine with ATASCII, but due to translation issues, I need to fold in some additional code for it to display properly.

 

Control-C at the operator console exits the chat.

 

Once e-mail is added, I'll add an option to leave the SysOp a message when he's either out or DnD.

 

-Thom

Link to comment
Share on other sites

Thom,

I think I broke it again. Cursor is stuck just sitting there.

 

============================================

Select File to Display: [_] Exit

           _
 _____ ___|_|___ _____ ___ ___ _ _
|     | .'| |   |     | -_|   | | |
|_|_|_|__,|_|_|_|_|_|_|___|_|_|___|

 [U] User List       [G] Goodbye
 [M] Message Boards  
 [C] Chat /w SysOp
>> [M]  Message Board

Current message board is Atari 8-Bit Developers

  _                      _    
 | |__  ___  __ _ _ _ __| |___
 | '_ \/ _ \/ _` | '_/ _` (_-<
 |_.__/\___/\__,_|_| \__,_/__/

[N]ext Board    [P]revious board
[R]ead Messages [H]eader Scan
[J]ump to Board [S]earch Messages
[M]y Messages   [Q]uick Scan
[G]oodbye       [X]it to main

>> [R]  Read Messages

Read: [ENTER]Unread, [S]earch
      [B]egin With, [Y]ours

>> [_]  Last Unread



 

Link to comment
Share on other sites

This line editor is going to eat my $#@($#@ lunch. Right now, am working on the [E]dit function, which is essentially a delete and insert operation rolled into one... checking in my work for now, and will continue working on it tomorrow.

 

In other news, I completed my first Rubik's Cube solve, ever, yesterday. I completed by 14th, roughly an hour ago.

Link to comment
Share on other sites

Managed to implement [E]dit while [E]ntering a message. Tip: When dealing with a linked list, you might as well just find the item in the list with the old data (the old line number), and just replace the fucking data. It's much easier than doing a delete and a subsequent insert in the same place.

 

Atari laptop is with me in a data center at the moment, so it's offline.

 

-Thom

Link to comment
Share on other sites

Hey Thom...

 

messing around at the office, can't get bbsconf to write the bbs.cnf file, just locks up. Running Altirra 2.6-test9 with U1MB/SIDE2 setup. Been like that for a while, at home I have a working bbs.cnf, but can't get one made here.

 

Enjoying reading through your code, sometimes hard to follow, but I get the gist of it.

 

-A.

Link to comment
Share on other sites

ok, I've officially hit the wall. I'm out of memory.

 

I need to make some serious decisions now. All this insane forward progress needs to stop, while I figure out what the fuck to do next.

 

Do I...

 

(a) put things into overlays, and overlay them into extended memory, or

(b) split things into other executables, and chain load them with an overreaching script via exit code, while holding some bits of state just below MEMHI (logged in user, etc.)

 

What the hell do I do? I have no clue how to do (a), but I could pull off (b) probably.

 

:(

 

-Thom

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...