To initiate discussion of this initial working release,
and seeing local discussion is kept to this forum
(although I think the editor may warrant its own messageboard),
here are some errata corresponding to this release:
s.cc is no longer needed, it was used to track a bug when using malloc.
the opendir() call seems to be generating errors sometimes,
perhaps malloc errors but not debugged yet: this call is superfluous
to the design of the editor as of now and may be removed from
term::expand(). start the program on different machines like this:
route add -net 224.0.0.0 netmask 224.0.0.0 dev eth0
./main 1234
(and on other machine)
route add -net 224.0.0.0 netmask 224.0.0.0 dev eth0
./main 4321
(all participants currently must start with the editor
in the initial empty state.)
further documentation or discussion should be forthcoming
with your interest.
ciao,
- D. Jeffery
Comments
If anyone was having trouble running this program just apply this
simple patch which uses gcc-3.3 (or try 3.4 or fix it all up); I recall
it was a working program when I had it.
ciao,
- M.Kyaeppd
diff -Naur v0.10/line.cc v0.11/line.cc
--- v0.10/line.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/line.cc 2012-04-14 00:38:50.000000000 -0700
#include "line.h"
#include "buffer.h"
#include
+#include // strlen
//buffer( 20 ); // segfault if you use 'size'
diff -Naur v0.10/main.cc v0.11/main.cc
--- v0.10/main.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/main.cc 2012-04-14 05:45:20.000000000 -0700
if( FD_ISSET( fileno( stdin ), &inputs ) )
{
char inbuf;
+
for(;;)
{
rc = read( fileno( stdin ), &inbuf, 1 );
fcntl( fileno( stdin ), F_GETFL, 0 ) | O_ASYNC | O_NONBLOCK );
fcntl( fileno( stdin ), F_SETOWN, getpid() );
- init_mcast_socket();
+ ms = init_mcast_socket();
+
puck.que = q = new queue( &puck.pad, ms, to, id );
- puck.pad.clear();
+// puck.pad.clear();
#if 0
puck.pad.debug();
#endif // debug
diff -Naur v0.10/makefile v0.11/makefile
--- v0.10/makefile 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/makefile 2012-04-14 00:45:27.000000000 -0700
s.cc -version -o s.s
as -V -Qy -o s.o s.s
-%.o: %.cc; g++ -c $<
+%.o: %.cc; g++-3.3 -c $<
#main: main.cc kbd.cc kbd_tty.cc
# term.cc note.cc script.cc line.cc buffer.cc
diff -Naur v0.10/mcast.cc v0.11/mcast.cc
--- v0.10/mcast.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/mcast.cc 2012-04-14 06:12:34.000000000 -0700
#include // udphdr
#include // getpid
-#include // printf
+#include // printf, perror
/*
#include
#include
extern int ms; // multicast socket
extern struct sockaddr_in to;
extern u_int id;
-
+#define sin to
int init_mcast_socket()
{
- struct sockaddr_in sin; // address for bind
+ int err = 0;
+ //struct sockaddr_in sin; // address for bind
sin.sin_addr.s_addr = htonl( INADDR_ANY );
sin.sin_port = htons( 9876 );
int msock_reuse = 1;
setsockopt( ms, SOL_SOCKET, SO_REUSEADDR, &msock_reuse, sizeof( int ) );
- bind( ms, ( struct sockaddr* )&sin, sizeof( sin ) );
+ err = bind( ms, ( struct sockaddr* )&sin, sizeof( sin ) );
+ printf( "bind:%x:", err );
+ perror( "::" );
u_char msock_ttl = 4;
setsockopt( ms, IPPROTO_IP, IP_MULTICAST_TTL,
if( setsockopt( ms, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof( mreq ) )
< 0 ) printf( "failed
" );
-
+
+ fflush( stdout );
+
return ms;
}
diff -Naur v0.10/queue.cc v0.11/queue.cc
--- v0.10/queue.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/queue.cc 2012-04-14 06:08:05.000000000 -0700
//#include // malloc, free
#include // stdin, fileno
#include // read
+#include // memcpy
+#include // exit
char message[ 1500 ]; // dynamic allocation segfaults below
diff -Naur v0.10/script.cc v0.11/script.cc
--- v0.10/script.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/script.cc 2012-04-14 06:13:38.000000000 -0700
//#include "null.h"
#include "script.h"
#include // NULL
+#include // strlen
line_s::~line_s()
{
diff -Naur v0.10/term.cc v0.11/term.cc
--- v0.10/term.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/term.cc 2012-04-14 00:37:12.000000000 -0700
#include
#include "term.h"
#include
+#include // memcpy
//#define debug_flag
If anyone was having trouble running this program just apply this
simple patch which uses gcc-3.3 (or try 3.4 or fix it all up); I recall
it was a working program when I had it.
ciao,
- M.Kyaeppd
diff -Naur v0.10/line.cc v0.11/line.cc
--- v0.10/line.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/line.cc 2012-04-14 00:38:50.000000000 -0700
#include "line.h"
#include "buffer.h"
#include
+#include // strlen
//buffer( 20 ); // segfault if you use 'size'
diff -Naur v0.10/main.cc v0.11/main.cc
--- v0.10/main.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/main.cc 2012-04-14 05:45:20.000000000 -0700
if( FD_ISSET( fileno( stdin ), &inputs ) )
{
char inbuf;
+
for(;;)
{
rc = read( fileno( stdin ), &inbuf, 1 );
fcntl( fileno( stdin ), F_GETFL, 0 ) | O_ASYNC | O_NONBLOCK );
fcntl( fileno( stdin ), F_SETOWN, getpid() );
- init_mcast_socket();
+ ms = init_mcast_socket();
+
puck.que = q = new queue( &puck.pad, ms, to, id );
- puck.pad.clear();
+// puck.pad.clear();
#if 0
puck.pad.debug();
#endif // debug
diff -Naur v0.10/makefile v0.11/makefile
--- v0.10/makefile 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/makefile 2012-04-14 00:45:27.000000000 -0700
s.cc -version -o s.s
as -V -Qy -o s.o s.s
-%.o: %.cc; g++ -c $<
+%.o: %.cc; g++-3.3 -c $<
#main: main.cc kbd.cc kbd_tty.cc
# term.cc note.cc script.cc line.cc buffer.cc
diff -Naur v0.10/mcast.cc v0.11/mcast.cc
--- v0.10/mcast.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/mcast.cc 2012-04-14 06:12:34.000000000 -0700
#include // udphdr
#include // getpid
-#include // printf
+#include // printf, perror
/*
#include
#include
extern int ms; // multicast socket
extern struct sockaddr_in to;
extern u_int id;
-
+#define sin to
int init_mcast_socket()
{
- struct sockaddr_in sin; // address for bind
+ int err = 0;
+ //struct sockaddr_in sin; // address for bind
sin.sin_addr.s_addr = htonl( INADDR_ANY );
sin.sin_port = htons( 9876 );
int msock_reuse = 1;
setsockopt( ms, SOL_SOCKET, SO_REUSEADDR, &msock_reuse, sizeof( int ) );
- bind( ms, ( struct sockaddr* )&sin, sizeof( sin ) );
+ err = bind( ms, ( struct sockaddr* )&sin, sizeof( sin ) );
+ printf( "bind:%x:", err );
+ perror( "::" );
u_char msock_ttl = 4;
setsockopt( ms, IPPROTO_IP, IP_MULTICAST_TTL,
if( setsockopt( ms, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof( mreq ) )
< 0 ) printf( "failed
" );
-
+
+ fflush( stdout );
+
return ms;
}
diff -Naur v0.10/queue.cc v0.11/queue.cc
--- v0.10/queue.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/queue.cc 2012-04-14 06:08:05.000000000 -0700
//#include // malloc, free
#include // stdin, fileno
#include // read
+#include // memcpy
+#include // exit
char message[ 1500 ]; // dynamic allocation segfaults below
diff -Naur v0.10/script.cc v0.11/script.cc
--- v0.10/script.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/script.cc 2012-04-14 06:13:38.000000000 -0700
//#include "null.h"
#include "script.h"
#include // NULL
+#include // strlen
line_s::~line_s()
{
diff -Naur v0.10/term.cc v0.11/term.cc
--- v0.10/term.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/term.cc 2012-04-14 00:37:12.000000000 -0700
#include
#include "term.h"
#include
+#include // memcpy
//#define debug_flag
If anyone was having trouble running this program just apply this
simple patch which uses gcc-3.3 (or 3.4 or fix it all up.) I remember having
a working program when I had it before.
cheers,
- M. Kyaeppd
diff -Naur v0.10/line.cc v0.11/line.cc
--- v0.10/line.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/line.cc 2012-04-14 00:38:50.000000000 -0700
#include "line.h"
#include "buffer.h"
#include
+#include // strlen
//buffer( 20 ); // segfault if you use 'size'
diff -Naur v0.10/main.cc v0.11/main.cc
--- v0.10/main.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/main.cc 2012-04-14 05:45:20.000000000 -0700
if( FD_ISSET( fileno( stdin ), &inputs ) )
{
char inbuf;
+
for(;;)
{
rc = read( fileno( stdin ), &inbuf, 1 );
fcntl( fileno( stdin ), F_GETFL, 0 ) | O_ASYNC | O_NONBLOCK );
fcntl( fileno( stdin ), F_SETOWN, getpid() );
- init_mcast_socket();
+ ms = init_mcast_socket();
+
puck.que = q = new queue( &puck.pad, ms, to, id );
- puck.pad.clear();
+// puck.pad.clear();
#if 0
puck.pad.debug();
#endif // debug
diff -Naur v0.10/makefile v0.11/makefile
--- v0.10/makefile 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/makefile 2012-04-14 00:45:27.000000000 -0700
s.cc -version -o s.s
as -V -Qy -o s.o s.s
-%.o: %.cc; g++ -c $<
+%.o: %.cc; g++-3.3 -c $<
#main: main.cc kbd.cc kbd_tty.cc
# term.cc note.cc script.cc line.cc buffer.cc
diff -Naur v0.10/mcast.cc v0.11/mcast.cc
--- v0.10/mcast.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/mcast.cc 2012-04-14 06:12:34.000000000 -0700
#include // udphdr
#include // getpid
-#include // printf
+#include // printf, perror
/*
#include
#include
extern int ms; // multicast socket
extern struct sockaddr_in to;
extern u_int id;
-
+#define sin to
int init_mcast_socket()
{
- struct sockaddr_in sin; // address for bind
+ int err = 0;
+ //struct sockaddr_in sin; // address for bind
sin.sin_addr.s_addr = htonl( INADDR_ANY );
sin.sin_port = htons( 9876 );
int msock_reuse = 1;
setsockopt( ms, SOL_SOCKET, SO_REUSEADDR, &msock_reuse, sizeof( int ) );
- bind( ms, ( struct sockaddr* )&sin, sizeof( sin ) );
+ err = bind( ms, ( struct sockaddr* )&sin, sizeof( sin ) );
+ printf( "bind:%x:", err );
+ perror( "::" );
u_char msock_ttl = 4;
setsockopt( ms, IPPROTO_IP, IP_MULTICAST_TTL,
if( setsockopt( ms, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof( mreq ) )
< 0 ) printf( "failed
" );
-
+
+ fflush( stdout );
+
return ms;
}
diff -Naur v0.10/queue.cc v0.11/queue.cc
--- v0.10/queue.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/queue.cc 2012-04-14 06:08:05.000000000 -0700
//#include // malloc, free
#include // stdin, fileno
#include // read
+#include // memcpy
+#include // exit
char message[ 1500 ]; // dynamic allocation segfaults below
diff -Naur v0.10/script.cc v0.11/script.cc
--- v0.10/script.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/script.cc 2012-04-14 06:13:38.000000000 -0700
//#include "null.h"
#include "script.h"
#include // NULL
+#include // strlen
line_s::~line_s()
{
diff -Naur v0.10/term.cc v0.11/term.cc
--- v0.10/term.cc 2005-07-29 17:04:22.000000000 -0700
+++ v0.11/term.cc 2012-04-14 00:37:12.000000000 -0700
#include
#include "term.h"
#include
+#include // memcpy
//#define debug_flag
this is a bugfix release. simply apply both patches in order to the program and compile with gcc 3.x.
diff -Naur v0.11/atom.cc b/atom.cc
--- v0.11/atom.cc 2005-07-29 17:04:22.000000000 -0700
+++ b/atom.cc 2012-04-20 03:36:09.000000000 -0700
#include // strcat, strlen
#include // snprintf
+extern FILE* _file;
+
char* atom::ptrtocx( atom* object )
{
switch( object -> id_mask )
int size;
if( it == 0 ) size = 1;
else size = ( int )log10( it ) + 1;
- _name = new char[ size + 1 + strlen( pname ) ];
+ _name = new char[ size + 1 + strlen( pname ) + 1 ];
snprintf( _name, size + 1, "%d", it );
}
else
{
int size = strlen( object -> cx -> name );
- _name = new char[ size + 1 + strlen( pname ) ];
+ _name = new char[ size + 1 + strlen( pname ) + 1 ];
strcpy( _name, object -> cx -> name );
}
if( pname[ 0 ] != '' ) // root
char* name,* pname;
//if( object -> parent -> parent -> id_mask == ID_SCRIPT_DIR )
pname = ptrtocx( object -> parent -> parent );
+ //pname = ptrtocx( object -> parent );
int size;
/*
if( object -> cx == NULL )
int size;
if( it == 0 ) size = 1;
else size = ( int )log10( it ) + 1;
- name = new char[ size + 1 + strlen( pname ) ];
+ name = new char[ size + 1 + strlen( pname ) + 1 ];
snprintf( name, size + 1, "%d", it );
}
*/
if( object -> cx == NULL )
{
int size = strlen( ( ( line* )( object -> parent ) ) -> text );
- name = new char[ size + 1 + strlen( pname ) ];
+ name = new char[ size + 1 + strlen( pname ) + 1 ];
strcpy( name, ( ( line_s* )( object -> parent ) ) -> text );
char* _c = strchr( name, '.' );
if( _c ) *_c = '';
else
{
int size = strlen( object -> cx -> name );
- name = new char[ size + 1 + strlen( pname ) ];
+ name = new char[ size + 1 + strlen( pname ) + 1 ];
strcpy( name, object -> cx -> name );
}
if( pname[ 0 ] != '' ) // root
diff -Naur v0.11/context.cc b/context.cc
--- v0.11/context.cc 2005-07-29 17:04:22.000000000 -0700
+++ b/context.cc 2012-04-20 03:53:34.000000000 -0700
{
}
-context::context( context* _up, atom* _a , char* _name )
+context::context( context* _up, atom* _a , char* _name ) // please new[] _name
: a( _a ), name( _name ), up( _up )
, first( NULL ), last( NULL ), prev( NULL ), next( NULL )
{
}
+#include // strchr
+#include // strlen, strcat, bzero, memcpy
+#include // debug
+#include // sync()
+
+char* context::rename( char* _name )
+{
+ char* __name = NULL;
+ if( name ) __name = name;
+ name = new char[ strlen( _name ) + 1 ];
+ memcpy( name, _name, strlen( _name ) + 1 );
+ if( __name ) delete[] __name;
+ return name;
+}
+
+char* context::path()
+{
+ char* cx = a -> ptrtocx( a );
+ char* _here = NULL;
+ char* _path = new char[ strlen( cx ) + 1 ];
+ char* _name = new char[ strlen( cx ) + 1 ];
+ strcpy( _name, cx );
+ bzero( _path, strlen( _name ) + 1 );
+ for(;;)
+ {
+ _here = strrchr( _name, '.' );
+ int bah;
+ if( _here == NULL )
+ {
+ strcat( _path, _name );
+ break;
+ }
+ *_here++ = ''; // shortening _name
+ bah = strlen( _here ) + 1;
+
+ char* _this = new char[ bah ]; // how to, int strchr - strchr
+
+ memcpy( _this, _here, bah );
+ strcat( _path, _this );
+ strcat( _path, "/" ); // for a total of bah added to _path
+
+ delete[] _this;
+ }
+ delete[] _name;
+
+ return _path;
+}
+ //char* _this = strchr( _here, '.' );
+ //if( _this != NULL )
+ // *_this = '';
+
/*
atom* context::findcx( char* );
int context::possess( int );
diff -Naur v0.11/context.h b/context.h
--- v0.11/context.h 2005-07-29 17:04:22.000000000 -0700
+++ b/context.h 2012-04-18 09:12:44.000000000 -0700
~context();
context( context*, atom*, char* );
+ char* rename( char* );
+ char* path();
+
// atom* findcx( char* );
// int possess( int );
// int colorize( int );
diff -Naur v0.11/main.cc b/main.cc
--- v0.11/main.cc 2012-04-20 03:17:29.000000000 -0700
+++ b/main.cc 2012-04-20 03:50:53.000000000 -0700
signal( SIGTERM, term );
signal( SIGABRT, term );
+ sync();
+
if( argc < 2 )
{
printf( "usage: %s
", argv[ 0 ] );
puck.que = q = new queue( &puck.pad, ms, to, id );
-// puck.pad.clear();
+ puck.pad.clear();
#if 0
puck.pad.debug();
#endif // debug
diff -Naur v0.11/program.cc b/program.cc
--- v0.11/program.cc 2005-07-29 17:04:22.000000000 -0700
+++ b/program.cc 2012-04-20 02:29:48.000000000 -0700
void term( int signal );
+//#include // debug
+//#include // sync()
+
void program::mcast( void* state )
{
// printf( "y" );
// fflush( stdout );
+//FILE* _file = fopen( "/home/mdasoh/atom.log", "a" );
+//fprintf( _file, ":for:
" );
+//fflush( stdout );
+//fclose( _file );
+//sync();
que -> disperse();
}
diff -Naur v0.11/script.cc b/script.cc
--- v0.11/script.cc 2012-04-20 03:17:29.000000000 -0700
+++ b/script.cc 2012-04-20 03:43:17.000000000 -0700
line* script::ins( line* here )
{
- line* brand = new line( this ),
+ line* brand = new line( this ), // parent
* there = here -> next;
brand -> last = here;
brand -> next = there;
if( there != NULL ) there -> last = brand;
here -> next = brand;
- // if( bot == here )
- // bot = brand;
+ if( bot == here )
+ bot = brand;
return brand;
}
}
#endif
-FILE* _file;
+#include "context.h" // debug
int script::load( char* path )
{
-fprintf( _file, "2
" );
-fflush( _file );
-
close( top );
bot = top = new line( this ); line* current = top;
- if( 0 != chdir( path ) )
-fprintf( _file, "2.0
" );
-fflush( _file );
+ if( 0 == chdir( path ) ); // solved
+ else if( 0 == chdir( "./" ) );
+ else if( 0 == chdir( "/" ) );
+ else
+{
+printf( "2.0.error
" ); // reopen output
+fflush( stdout );
+}
struct dirent** dir; int entries;
sync();
-fprintf( _file, "2.1
" );
-fflush( _file );
-
// entries = scandir( "./", &dir, nodots, alphasort );
// entries = scandir( "./", &dir, 0, alphasort );
entries = scandir( "./", &dir, 0, 0 );
if( entries == -1 )
-fprintf( _file, "2.2.0
" );
-
-fprintf( _file, "2.2
" );
-fflush( _file );
sync();
}
else return 1;
-fprintf( _file, "3
" );
-fflush( _file );
-
- return entries;
+ return entries;
}
void script::save( char* file )
diff -Naur v0.11/term.cc b/term.cc
--- v0.11/term.cc 2012-04-20 03:17:29.000000000 -0700
+++ b/term.cc 2012-04-20 03:47:21.000000000 -0700
}
}
-extern FILE* _file;
-
+#include "context.h"
// update each here for cursors within this context
void term::expand( u_int cursor )
{
} // else
if( _row == 0 ) s -> top = lines;
-// if it has a name, loop through parent contexts
-// if( strlen( lines -> text ) == 0 )
+ if(0) // uncomment if you want to browse paths beginning with root
{
lines -> scr -> id_mask = ID_SCRIPT_DIR;
atom* _a = lines -> parent;
- if( _a == NULL )
+
+ char* cx = new char[ strlen( lines -> text ) + 1 ];
+ strcpy( cx, lines -> text );
+ if( lines -> parent -> parent )
{
+ lines -> scr -> cx = new
+ context( lines -> parent -> parent -> cx, lines -> scr, cx );
}
-_file = fopen( "atom.log", "a" );
-fprintf( _file, "1
" );
-fflush( _file );
- lines -> scr -> load( "/root/hier" );
-fprintf( _file, "4
" );
-fflush( _file );
- char* cx; // strange bug, do investigate further
-// if( lines == s -> top || strlen( lines -> last -> text ) != 23 )
-{
- cx = lines -> ptrtocx( lines -> scr );
-}
-// else { cx = new char[ 1 ]; cx[ 0 ] = ''; }
- lines -> clear();
-// lines -> ins( 0, "" );
-// cx[ 40 ] = '';
- lines -> ins( 0, cx );
- delete[] cx;
-fprintf( _file, "5
" );
-fflush( _file );
-fclose( _file );
+ else
+ {
+ lines -> scr -> cx = new
+ context( NULL, lines -> scr, cx );
+ }
+ char* cx_path = lines -> scr -> cx -> path();
+ lines -> scr -> load( cx_path );
+ delete[] cx_path;
}
}
if( _row > 0 )
if( _row - _orig == note::rows ) _orig++;
if( _row > xorig + note::rows || _row + count <= xorig ) return;
+
redraw();
}
diff -Naur v0.11/thread.h b/thread.h
--- v0.11/thread.h 2005-07-29 17:04:22.000000000 -0700
+++ b/thread.h 2012-04-20 03:22:13.000000000 -0700
// printf( "%%" );
// fflush( stdout );
- thread* top = new thread;
+ register thread* top = new struct thread; // malloc failure centers on this
// printf( "%%" );
// fflush( stdout );
top -> next = next;
- top -> addr = v; // failure centers on this
+ top -> addr = v; // with allegro, malloc failure centers on this
top -> state = state;
( thread* )top_thread = top;