Jump to content
Excelsior Forums


  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About qnr

  • Rank
  • Birthday 11/29/1957

Contact Methods

  • Website URL

Profile Information

  • Location
    Corpus Christi, TX, USA
  1. Hi, just wanted to let everyone know I have a generic "I <3 Modula-2" tee available in my shop. Later today, I'll be putting up I <3 Oberon-2, I <3 Pascal, and I <3 Wirthian Languages tees. http://thewitsend.aliboom.com/I_Heart_Modula-2_tee/p3224001_14031845.aspx
  2. qnr

    clear the screen in Modula-2

    Here is the source file. ANSI2.MOD IMPLEMENTATION MODULE ANSI2; FROM STextIO IMPORT WriteString; FROM WholeStr IMPORT CardToStr; FROM Strings IMPORT Append; TYPE strT = ARRAY [0..19] OF CHAR; VAR RowStr, ColStr, CodeStr : strT; PROCEDURE set(code : ARRAY OF CHAR); BEGIN WriteString(esc); WriteString(code); END set; PROCEDURE Reset; BEGIN set("[0m"); END Reset; PROCEDURE DefaultF; BEGIN set("[39m"); END DefaultF; PROCEDURE BlackF; BEGIN set("[30m"); END BlackF; PROCEDURE RedF; BEGIN set("[31m"); END RedF; PROCEDURE GreenF; BEGIN set("[32m"); END GreenF; PROCEDURE YellowF; BEGIN set("[33m"); END YellowF; PROCEDURE BlueF; BEGIN set("[34m"); END BlueF; PROCEDURE PurpleF; BEGIN set("[35m"); END PurpleF; PROCEDURE CyanF; BEGIN set("[36m"); END CyanF; PROCEDURE WhiteF; BEGIN set("[37m"); END WhiteF; PROCEDURE DefaultB; BEGIN set("[49m"); END DefaultB; PROCEDURE BlackB; BEGIN set("[40m"); END BlackB; PROCEDURE RedB; BEGIN set("[41m"); END RedB; PROCEDURE GreenB; BEGIN set("[42m"); END GreenB; PROCEDURE YellowB; BEGIN set("[43m"); END YellowB; PROCEDURE BlueB; BEGIN set("[44m"); END BlueB; PROCEDURE PurpleB; BEGIN set("[45m"); END PurpleB; PROCEDURE CyanB; BEGIN set("[46m"); END CyanB; PROCEDURE WhiteB; BEGIN set("[47m"); END WhiteB; (* Attributes *) PROCEDURE BoldOn; BEGIN set("[1m") END BoldOn; PROCEDURE BoldOff; BEGIN set("[22m"); END BoldOff; PROCEDURE ItalicsOn; BEGIN set("[3m"); END ItalicsOn; PROCEDURE ItalicsOff; BEGIN set("[23m"); END ItalicsOff; PROCEDURE ULOn; BEGIN set("[4m"); END ULOn; PROCEDURE ULOff; BEGIN set("[24m"); END ULOff; PROCEDURE InvOn; BEGIN set("[7m"); END InvOn; PROCEDURE InvOff; BEGIN set("[27m"); END InvOff; (* Cursor control *) PROCEDURE Home; BEGIN set("[H"); END Home; PROCEDURE generate(row, col : CARDINAL) : strT; VAR RowStr, ColStr, WholeStr : strT; BEGIN CardToStr(row, RowStr); CardToStr(col, ColStr); WholeStr := "["; Append(RowStr,WholeStr); Append(";",WholeStr); Append(ColStr,WholeStr); RETURN WholeStr; END generate; PROCEDURE HomeCur(row, col : CARDINAL); BEGIN CodeStr := generate(row, col); Append("H", CodeStr); set(CodeStr); END HomeCur; PROCEDURE Up; BEGIN set("[A"); END Up; PROCEDURE Down; BEGIN set("[b"); END Down; PROCEDURE Right; BEGIN set("[C"); END Right; PROCEDURE Left; BEGIN set("[D"); END Left; PROCEDURE Save; BEGIN set("[s"); END Save; PROCEDURE Restore; BEGIN set("[u"); END Restore; PROCEDURE SaveCA; BEGIN set("7"); END SaveCA; PROCEDURE RestoreCA; BEGIN set("8"); END RestoreCA; PROCEDURE Cls; BEGIN set("[2J"); END Cls; PROCEDURE EraseLn; BEGIN set("[2K"); END EraseLn; END ANSI2.
  3. qnr

    clear the screen in Modula-2

    If you are talking about a text screen, I have an ANSI module that I did up. Need to remember where I posted it online. If anyone wants it, I can make it available again somewhere. This is the DEF file. (What the heck, I'll just post the source file in the next post, rather than putting it online somewhere.) DEFINITION MODULE ANSI2; (* For many of the options, there are two ways of ** accomplishing the same thing. One way is to use ** the constant value with WriteString. For example, ** if you wanted to print 'Hello World, it is me.' with ** 'World' in red text on a yellow background, you ** could use: ** WriteString("Hello "+redf+yellowb+"World"+reset+", it is me."); ** or: ** WriteString("Hello "); ** WriteString(redf); ** WriteString(yellowb); ** WriteString("World"); ** WriteString(reset); ** WriteString(", it is me."); ** ** If you wanted to do it with the PROCEDURE calls, it might ** be similar to: ** WriteString("Hello "); ** RedF; YellowB; WriteString("World"); Reset; ** WriteString(", it is me."); ** ** The same applies to the attribute settings such as bold, ** inverse, etc. ** ** The cursor controls are similar, in that you can call them ** both ways. However, when you call the cursor controls ** with a constant, you will be using the defaults. For ** example, homeCur will position the cursor in the upper-left ** part of the terminal. upCur will move the cursor up 1 row. ** ** When you use the PROCEDURE calls, you may specify what you want. ** Home; and HomeCur(0, 0); are equivalent. Up; and UpCur(1); ** are eqivalent. Moving the cursor down three lines can be ** accomplished with: ** ** 1) CONST str := +downCur+downCur+downCur; ** WriteString(str); ** ** 2) Down; Down; Down; ** ** 3) DownCur(3); ** *) CONST esc = 33C; (* Set Display Attributes: ** Change the foreground or background colors, or ** the the attributes of text in the terminal *) reset = esc+"[0m"; (* Reset all attributes *) defaultf = esc+"[39m"; (* Set foreground color to default *) blackf = esc+"[30m"; (* Set foreground color to black *) redf = esc+"[31m"; (* Set foreground color to red *) greenf = esc+"[32m"; (* Set foreground color to green *) yellowf = esc+"[33m"; (* Set foreground color to yellow *) bluef = esc+"[34m"; (* set foreground color to blue *) purplef = esc+"[35m"; (* set foreground color to magenta *) cyanf = esc+"[36m"; (* set foreground color to cyan *) whitef = esc+"[37m"; (* set foreground color to white *) defaultb = esc+"[49m"; (* Set background color to default *) blackb = esc+"[40m"; (* Set background color to black *) redb = esc+"[41m"; (* Set background color to red *) greenb = esc+"[42m"; (* Set background color to green *) yellowb = esc+"[43m"; (* Set background color to yellow *) blueb = esc+"[44m"; (* Set background color to blue *) purpleb = esc+"[45m"; (* Set background color to magenta *) cyanb = esc+"[46m"; (* Set background color to cyan *) whiteb = esc+"[47m"; (* Set background color to white *) boldon = esc+"[1m"; boldoff = esc+"[22m"; italicson = esc+"[3m"; italicsoff = esc+"[23m"; ulon = esc+"[4m"; uloff = esc+"[24m"; invon = esc+"[7m"; invoff = esc+"[27m"; (* Cursor Control - These use defaults, to set the cursor to a particular position, I will be adding PROCEDURES eventually. *) homeCur = esc+"[H"; (* Sets the cursor to the upper left *) upCur = esc+"[A"; (* Move cursor up one row *) downCur = esc+"[b"; (* Move cursor down one row *) saveCur = esc+"[s"; (* Save cursor position *) unsaveCur = esc+"[u"; (* Restore saved cursor position *) saveCAtt = esc+"7"; (* Save cursor position and attributes *) restoreCAtt = esc+"8"; (* Restore cursor pos'n and attributes *) eraseScr = esc+"[2J"; (* erase screen, move cursor to home *) eraseLn = esc+"[2K"; (* erase current line *) PROCEDURE Reset; PROCEDURE DefaultF; PROCEDURE BlackF; PROCEDURE RedF; PROCEDURE GreenF; PROCEDURE YellowF; PROCEDURE BlueF; PROCEDURE PurpleF; PROCEDURE CyanF; PROCEDURE WhiteF; PROCEDURE DefaultB; PROCEDURE BlackB; PROCEDURE RedB; PROCEDURE GreenB; PROCEDURE YellowB; PROCEDURE BlueB; PROCEDURE PurpleB; PROCEDURE CyanB; PROCEDURE WhiteB; (* Attributes *) PROCEDURE BoldOn; PROCEDURE BoldOff; PROCEDURE ItalicsOn; PROCEDURE ItalicsOff; PROCEDURE ULOn; PROCEDURE ULOff; PROCEDURE InvOn; PROCEDURE InvOff; (* Cursor control *) PROCEDURE Home; (* Sets the cursor to the Home (upper left) position. Does not clear the screen. *) PROCEDURE HomeCur(row, col : CARDINAL); (* Sets the cursor to the specified position. Does not clear the screen. The rows and columns start at 1 *) PROCEDURE Up; (* Moves the cursor up by 1 row, does not wrap or scroll, stops at top *) PROCEDURE Down; (* Moves the cursor down by 1 row, does not wrap or scroll, stops at bottom *) PROCEDURE Right; (* Moves the cursor forward by 1 column. Does not wrap or scroll, stops at right edge *) PROCEDURE Left; (* Moves the cursor backward by 1 column. Stops at left edge *) PROCEDURE Save; (* *) PROCEDURE Restore; PROCEDURE SaveCA; PROCEDURE RestoreCA; PROCEDURE Cls; PROCEDURE EraseLn; END ANSI2.
  4. qnr

    XDS 2.6 beta

    Thank you so much for the release.
  5. qnr


    Hi! Glad to see you.
  6. Sounds great, I'll explore it this weekend. Edit: Oops, no I won't, I should have realized with the .zip ext that it was probably Windows only. Sounds interesting though.
  7. qnr


    I personally don't know about a DISPLAY.SYM library. However, I created an ANSI module for my own use and made it available a while back. Per my post in a different thread here on the Excelsior Forums, at http://www.excelsior-usa.com/forum/index.php?topic=1317.0 I'm currently in the process of moving all of my files to a commercial server, so you'll have to get it from the modula2.org download mirror, if you want it: http://allserv.ugent.be/~fschoonj/modula2/xds/ansi.tar.gz Somewhat important note: I tested the download, it works fine. However, I created the tarball with the intention of it being extracted into your personal library directory, so it extracts to the current working directory rather than creating a new directory.. So you need to either place the tarball into wherever you keep your personal libraries, or into a temporary directory before extracting so that the files don't get lost among any unrelated files.
  8. True - that's the route I'd take, but I was trying to keep it non-OS specific, even though the OP uses Linux
  9. Actually, what it looks like to me, is that you originally compiled the program without linking it when you used =compile, you then attempted to recompile it with =make You got the error the second time because the program was already compiled with the current timestamp, so the compiler figured that there was nothing new. If it were me, I'd say the simplest solution would be to open hola.mod back up in the editor and type a space or something then resave it so that the timestamp changes. then rerun xc =m hola.mod (or alternately forget the re-edit of the file and just run xc =m =all hola.mod to force a recompile of everything (=all makes it ignore the timestamps)).
  10. Hope you have better luck with h2d than I have, my success rate is in the 1% - 2% range. I know that it must work, looking at the posix and x11 libraries, but except for the most trivial .h files, I generally can't get more than a few lines in before something errors out \
  11. Just a reminder that the channel is still available, and that activity is picking up on it a bit.
  12. Well, there's nothing really wrong with that. If they're willing to accept C, they should be willing to accept Modula-2, C has been around even longer. The bot that I use on the #modula-2 channel of irc.freenode.org is done in XDS. People are welcome to look it over, swipe the parts you want, participate in improving it, or just tell me what crappy code it is. It is meant as a service bot for a Linux distribution, so I have made no attempt to make it portable to Windows. The bot is kind of a jumble - I lost some backups when 2 HDDs died almost simultaneously back in July, so I restarted with a version from January of 2007 and I'm trying to bring it back up to speed - along the way, making some changes in the way it accomplishes some tasks. http://gitorious.org/projects/page-six and the newest version 0.8.12 at is http://gitorious.org/projects/page-six/repos/mainline/trees/page-six-0.8.12
  13. qnr

    Enumeration problem

    Sorry I can't help, I didn't even know that enumerations could be anything other than CARDINAL (or at least non-negative) type.
  14. Yeah, I know, I follow both mailing lists and dabble in both Mocka and GM2. I've always wondered if actual real-time encounters might spur people a bit. I suppose that that is not going to happen though. I've had a #modula-2 channel on irc.freenode.net for years, and it has had perhaps 3 individual visitors in the last 18 months.
  15. Well, yeah, but I meant what the small kernel that there was