Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ is going to write a text editor

Name: Anonymous 2008-02-03 19:23

First, we must agree on what language to write it in.

I nominate C, for efficiency purposes, and that I am most comfortable in it. I also nominate Scheme, because I am proficient in it.

Name: Anonymous 2008-02-04 21:39

I do not accept the GNU/Viral license.

Name: Anonymous 2008-02-04 21:44

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main( int argc, char* argv[] ) {
    return 0;
}

Name: Anonymous 2008-02-04 21:49

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ncurses.h"

int main( int argc, char* argv[] ) {
    printf( "negropenis\n" );
    return 0;
}

Name: Anonymous 2008-02-04 21:56

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ncurses.h"

int main( int argc, char* argv[] ) {
    printf( "negropenLISP\n" );
    return main(1, "LISP");
}

Name: Anonymous 2008-02-04 22:31


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ncurses.h"

int fact(int n);

int main( int argc, char* argv[] ) {
    printf( "negropenLISP\n" );
    printf( "The 3rd factorial is %d\n", fact(4) );
    return main(1, "LISP");
}

int fact(int n) {
    if (1 >= n) return 1;
    return n*fact(n-1);
}

Name: Anonymous 2008-02-04 22:54

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ncurses.h"

int lisp(int n);

int main( int lispc, char* lispv[] ) {
    lispf( "negropenLISP\n" );
    lispf( "Lisp lisp lisp lisp %d\n", lisp(4) );
    return main(1, "LISP");
}

int lisp(int n) {
    if (1 >= n) return 1;
    return n*lisp(n-1);
}

Name: Anonymous 2008-02-04 23:39


#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>

int main(void) {
   
    size_t n = 0;
    const char buf[] = "\\|/-";
    pid_t pid;

    setbuf(stdout, NULL);

    if(signal(SIGCHLD, exit) == SIG_ERR) {
        perror("signal");
        return -1;
    }

    if((pid = fork()) == -1) {
        perror("fork");
        return -1;
    }

    if(pid == 0) {
        getchar();
        exit(0);
    }

    for(n = 0; n < 1024; n++) {

        if(n == sizeof buf - 1)
            n = 0;
       
        putchar(buf[n]);
        putchar(buf[(n + 1) % (sizeof(buf) - 1)]);
        putchar(buf[(n + 2) % (sizeof(buf) - 1)]);
        putchar(buf[(n + 3) % (sizeof(buf) - 1)]);
       
        usleep(100000);
       
        putchar('\r');
        putchar('\r');
        putchar('\r');
        putchar('\r');
    }

    return 0;
}


:PpP

Name: Anonymous 2008-02-05 0:11


10 PRINT "TEXT EDITOR"
20 OPEN "FILE.TXT" FOR OUTPUT AS 1
21 PRINT "TYPE :wq! TO SAVE+EXIT."
30 INPUT A$
31 IF A$=":wq!" THEN CLOSE 1:END
40 PRINT #1,A$
41 GOTO 30

Name: Anonymous 2008-02-05 0:26

(loop (print (eval (read))))

Name: Anonymous 2008-02-05 1:02

(loop
  (read)
  (format t "?~%"))

Behold, I have created mighty ed!

Name: Anonymous 2008-02-05 1:36

/*
 *   Notepad application
 *   Copyright (C) 1984-1995 Microsoft Inc.
 */


#include "precomp.h"
#include <htmlhelp.h>

#define DeepTrouble() MessageBox(hwndNP, szErrSpace, szNN, MB_SYSTEMMODAL|MB_OK|MB_ICONHAND);

UINT     lGotoLine;                  /* line number to goto to */

TCHAR    chMerge;
HWND     hwndNP = 0;                 /* handle to notepad parent window    */
HWND     hwndEdit = 0;               /* handle to main text control item  */
HANDLE   hEdit;                      /* Handle to storage for edit item   */
HWND     hDlgFind = NULL;            /* handle to modeless FindText window */
HANDLE   hStdCursor;                 /* handle to arrow or beam cursor    */
HANDLE   hWaitCursor;                /* handle to hour glass cursor       */
HANDLE   hInstanceNP;                /* Module instance handle            */
HANDLE   hFont;                      /* handle to Unicode font            */
LOGFONT  FontStruct;                 /* font dialog structure             */
INT      iPointSize=120;             /* current point size unit=1/10 pts  */
TCHAR    szFileName[MAX_PATH+1];     /* Current notepad filename          */
TCHAR    szSearch[CCHKEYMAX];        /* Search string                     */
TCHAR    szReplace[CCHKEYMAX];       /* replace string                    */

BOOL     fUntitled = TRUE;           /* TRUE iff notepad has no title      */

HMENU hSysMenuSetup;                 /* Save Away for disabled Minimize   */

DWORD     dwEmSetHandle = 0;          /* Is EM_SETHANDLE in process?       */
HANDLE   hAccel;                     /* Handle to accelerator table       */
BOOL     fRunBySetup = FALSE;        /* Did SlipUp WinExec us??           */
BOOL     fWrap = 0;                  /* Flag for word wrap                */
TCHAR    szNotepad[] = TEXT("Notepad");/* Name of notepad window class       */

BOOL fInSaveAsDlg = FALSE;

/* variables for the new File/Open, File/Saveas,Find Text and Print dialogs */
OPENFILENAME OFN;                     /* passed to the File Open/save APIs */
TCHAR szOpenFilterSpec[CCHFILTERMAX]; /* default open filter spec          */
TCHAR szSaveFilterSpec[CCHFILTERMAX]; /* default save filter spec          */
NP_FILETYPE g_ftOpenedAs=FT_UNKNOWN;  /* current file was opened           */
NP_FILETYPE g_ftSaveAs;               /* current file was opened           */

FINDREPLACE FR;                       /* Passed to FindText()              */
PAGESETUPDLG g_PageSetupDlg;
UINT wFRMsg;                          /* message used in communicating     */
                                      /* with Find/Replace dialog          */

DWORD dwCurrentSelectionStart = 0L;      /* WM_ACTIVATEAPP selection pos */
DWORD dwCurrentSelectionEnd   = 0L;      /* WM_ACTIVATEAPP selection pos */
UINT wHlpMsg;                        /* message used in invoking help     */

/* Strings loaded from resource file passed to LoadString at initialization time */
/* To add resource string:
 * 1) create IDS_ macro definition in notepad.h
 * 2) create string in resource file
 * 3) create 'TCHAR*' variable directly below and in notepad.h file
 * 4) add &variable to rgsz
 * 5) increment CSTRINGS
 */
TCHAR *szDiskError =(TCHAR *)IDS_DISKERROR;  /* Can't open File, check disk  */
TCHAR *szFNF       =(TCHAR *)IDS_FNF;        /* File not found               */
TCHAR *szFAE       =(TCHAR *)IDS_FAE;        /* File already exists          */
TCHAR *szSCBC      =(TCHAR *)IDS_SCBC;       /* Save changes before closing? */
TCHAR *szUntitled  =(TCHAR *)IDS_UNTITLED;   /* untitled                     */
TCHAR *szCFS       =(TCHAR *)IDS_CFS;        /* Can't find string            */
TCHAR *szErrSpace  =(TCHAR *)IDS_ERRSPACE;   /* Memory space exhausted       */
TCHAR *szNpTitle   =(TCHAR *)IDS_NOTEPAD;    /* Notepad -                    */
TCHAR *szFTL       =(TCHAR *)IDS_FTL;        /* File too large for notepad   */
TCHAR *szNN        =(TCHAR *)IDS_NN;         /* Notepad Note!                */
TCHAR *szPDIE      =(TCHAR *)IDS_PRINTDLGINIT; /* Print dialog init error    */
TCHAR *szCP        =(TCHAR *)IDS_CANTPRINT;  /* Can't print                  */
TCHAR *szNVF       =(TCHAR *)IDS_NVF;        /* Not a valid filename.        */
TCHAR *szCREATEERR =(TCHAR *)IDS_CREATEERR;  /* cannot create file           */
TCHAR *szNoWW      =(TCHAR *)IDS_NOWW;       /* Too much text to word wrap   */
TCHAR *szMerge     =(TCHAR *)IDS_MERGE1;     /* search string for merge      */

TCHAR *szHelpFile  =(TCHAR *)IDS_HELPFILE;   /* Name of helpfile.            */
TCHAR *szBadMarg   =(TCHAR *)IDS_BADMARG;    /* Bad margins.                 */
TCHAR *szFileOpenFail =(TCHAR *)IDS_FILEOPENFAIL;  /* Can't open File */
TCHAR *szAnsiText  =(TCHAR *)IDS_ANSITEXT; /* File/Open ANSI filter spec. string */
TCHAR *szAllFiles  =(TCHAR *)IDS_ALLFILES;   /* File/Open Filter spec. string */
TCHAR *szOpenCaption = (TCHAR *)IDS_OPENCAPTION; /* caption for File/Open dlg */
TCHAR *szSaveCaption = (TCHAR *)IDS_SAVECAPTION; /* caption for File/Save dlg */
TCHAR *szCannotQuit = (TCHAR *)IDS_CANNOTQUIT;  /* cannot quit during a WM_QUERYENDSESSION */
TCHAR *szLoadDrvFail = (TCHAR *)IDS_LOADDRVFAIL;  /* LOADDRVFAIL from PrintDlg */
TCHAR *szErrUnicode =(TCHAR *)IDS_ERRUNICODE;  /* Unicode character existence error */
TCHAR *szACCESSDENY = (TCHAR *)IDS_ACCESSDENY; /* Access denied on Open */
TCHAR *szFontTooBig = (TCHAR *)IDS_FONTTOOBIG; /* font too big or page too small */
TCHAR *szCommDlgErr = (TCHAR *)IDS_COMMDLGERR; /* common dialog error %x */
TCHAR *szCommDlgInitErr = (TCHAR *)IDS_COMMDLGINIT; /* common dialog error %x */


TCHAR *szLineError    = (TCHAR*)IDS_LINEERROR;   /* line number error        */
TCHAR *szLineTooLarge = (TCHAR*)IDS_LINETOOLARGE;/* line number out of range */

Name: Anonymous 2008-02-05 1:48

>>91
the fuck

Name: Anonymous 2008-02-05 3:03

>>92
looks like you weren't around when MS released the source to notepad...

Name: Anonymous 2008-02-05 8:20

>>93
Looks like you weren't around when GNU released the source to Windows 98.

Name: Anonymous 2008-02-05 9:31

>>94
This might surprise you, but it looks like you weren't around when I invented that meme.

Name: Anonymous 2008-02-05 9:32

So why did he use /*the game*/ instead of // the game as a single-line comment?

Name: Anonymous 2008-02-05 11:41

>>96
C IS NOT C++ FUCK OFF

Name: Anonymous 2008-02-05 11:49

>>97
C99 SUPPORTS SINGLE-LINE COMMENTS LERN2ISO9899:1999

Name: Anonymous 2008-02-05 12:09

There are four engineers traveling in a car -- a mechanical engineer,
a chemical engineer, an electrical engineer, and a computer engineer. The car breaks down.

"Sounds to me as if the pistons have seized. We'll have to strip
down the engine before we can get the car working again", says the
mechanical engineer.

"Well", says the chemical engineer, "it sounded to me as if the fuel
might be contaminated. I think we should clear out the fuel system."

"I thought it might be an grounding problem", says the electrical
engineer, "or maybe a faulty plug lead."

They all turn to the computer scientist, who up to then had said
nothing, and asked "Well, what do you think?"

"I put on my wizard robe and hat. My other car is a cdr." The computer scientist pulls out a cudder from his pocket, and shoves it down the throats of the engineers. "Take that, motherfuckers!!!!"

Name: Anonymous 2008-02-05 12:09

>>98
GNU IS NOT UNIX FUCK OFF

Name: Anonymous 2008-02-05 14:59

>>99
I came

Name: Anonymous 2008-02-05 15:02

>>98
Notepad waas written in a time when C99 didn't exist

Name: Anonymous 2008-02-05 21:30

>>93
link/pointer to said notepad source

Name: Anonymous 2008-02-06 12:38

YOU WILL NOT DIE

Name: Anonymous 2008-02-06 15:40

>>103
NotepadSource *notepad_source;

Name: Anonymous 2008-02-06 21:59

Name: Anonymous 2008-02-07 6:09

>>106
That's a lot of bloat.

Name: ​​​​​​​​​​ 2010-10-22 6:43

Name: ​​​​​​​​​​ 2010-10-24 2:36

Name: Anonymous 2010-11-25 17:43

Name: Anonymous 2011-02-03 6:20

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List