Jump to content
Excelsior Forums

qnr

Members
  • Content count

    0
  • Joined

  • Last visited

Everything posted by qnr

  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. 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. 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. XDS 2.6 beta

    Thank you so much for the release.
  5. Hello

    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. DISPLAY.SYM LIBRARY

    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. Slightly off-topic for an Excelsior/XDS board, but just wanted to let people know there is a #modula-2 channel on irc.freenode.net #modula-2 is just a general channel for discussing Modula-2 or Oberon-2 - you don't have to feel pressured to provide any support or anything. Just stop on by and have fun discussing something we all like. You can access the channel via your browser at: http://webchat.freenode.net/?channels=modula-2 Edit: Added "Excelsior/"
  12. Just a reminder that the channel is still available, and that activity is picking up on it a bit.
  13. I see the views count going up all the time, but not a single response to any of the threads.
  14. 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
  15. 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.
  16. 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.
  17. Well, yeah, but I meant what the small kernel that there was
  18. OK, thanks, just checking -- I was worried that the community was disappearing
  19. Thanks, just wanted to bring it up since it's an old thread and you might not know there were new posts. I've gotten everything to compile now.
  20. GTK+ in Modula 2

    OK, looking over FreePascal mailing list archives, it turns out that they also had the same problem. One of the developers inadvertently uncommented some lines, which caused the error. The friendly people on #fpc on irc.freenode.net pointed me towards: http://fpc64.firmos.at:8060/changelog/FPC/?cs=11627 which shows: 155 155 156 156 // new GtkFileChooser Widget 157 157 {$include gtkfilechooser.inc} 158 - {$include gtkfilechooserdefault.inc} 158 + //{$include gtkfilechooserdefault.inc} - no exports 159 159 {$include gtkfilechooserdialog.inc} 160 - {$include gtkfilechooserembed.inc} 161 - {$include gtkfilechooserentry.inc} 160 + //{$include gtkfilechooserembed.inc} - no exports 161 + //{$include gtkfilechooserentry.inc} - no exports 162 162 {$include gtkfilechooserprivate.inc} 163 163 {$include gtkfilechooserutils.inc} 164 164 {$include gtkfilechooserwidget.inc} This led me to comment out the appropriate lines in gtk2.def and gtk2.mod In gtk2.def: basically everything from (approximately line 14051) [tt]-- from gtkfilechooserdefault.inc[/tt] through the line just before [tt]-- from gtkiconview.inc[/tt] in gtk2.mod: basically everything from (approximately line 8681) [tt] -- from gtkfilechooserdefault.inc [/tt] through the line just before [tt]-- from gtkiconview.inc [/tt] After this, Hello.prj successfully built, However, running ./Hello doesn't work yet, giving this: [tt] terry@dorsai:~/xds-gtk2$ ./Hello #RTS: unhandled exception #3: invalid location Source file LineNo CodeOffset Procedure name src/pango.mod 193 08067a7d PANGO_CONTEXT_GET_CLASS:F Hello.mod 59 0804fdb8 main:F [/tt] Which I haven't looked in to yet.
  21. GTK+ in Modula 2

    So, just to clarify, this is what I'm getting at the moment (manually breaking the lines here for ease of reading): Running xc =p Hello.prj gives this: terry@dorsai:~/xds-gtk2$ xc =p Hello.prj O2/M2 development system v2.51 TS (c) 1999-2003 Excelsior, LLC. (build 10.05.2005) Make project "Hello.prj" #project is up to date gcc -o Hello obj/Hello.o obj/atk.o obj/gdk2.o obj/gdk2pixbuf.o obj/glib2.o obj/gtk2.o obj/pango.o \ /usr/local/xds/lib/x86/libts.a /usr/local/xds/lib/x86/libxds.a -lm -lncurses -lgtk -lgtk-x11-2.0 -lgdk \ -lgdk-x11-2.0 -lpango-1.0 -lglib-2.0 -lgmodule-2.0 -lgobject-2.0 -latk-1.0 -lgdk_pixbuf-2.0 obj/gtk2.o: In function `GTK_TYPE_FILE_CHOOSER_DEFAULT': src/gtk2.mod:8691: undefined reference to `_gtk_file_chooser_default_get_type' obj/gtk2.o: In function `GTK_TYPE_FILE_CHOOSER_EMBED': src/gtk2.mod:8711: undefined reference to `_gtk_file_chooser_embed_get_type' obj/gtk2.o: In function `GTK_TYPE_FILE_CHOOSER_ENTRY': src/gtk2.mod:8734: undefined reference to `_gtk_file_chooser_entry_get_type' collect2: ld returned 1 exit status make: *** [Hello] Error 1 external command fault 2: make -f tmp.mkf This is my xc-gtk2.tem file: !set link = "make -f %s", mkfname#mkfext ! "M\t= %s\n",mkfname#>mkfext !if defined topspeed then ! "TSLIBS\t= %s\n","libts"#libext !else ! "TSLIBS\t= \n" !end !if defined include_place then ! "INCL\t= %s\n", include_place !else ! "INCL\t= .\n" !end !if not genlib then ! "XDSLIB\t= %s\n","libxds"#libext !end !if xmapp then ! "XLIBS\t= -L/usr/X11R6/lib -lXm -lXt -lX11\n" !if (env_target="x86linux") then ! "XMACLIBS\t= %s %s\n","libmac_X11"#libext,"libmac_Xm"#libext !end !elsif xapp then ! "XLIBS\t= -L/usr/X11R6/lib -lX11\n" !if (env_target="x86linux") then ! "XMACLIBS\t= %s\n","libmac_X11"#libext !end !end !if genlib then !if defined libname and (libname#"") then ! "TARGET\t= %s\n",libname#>libext !elsif defined project and (project#"") then ! "TARGET\t= %s\n",project#>exeext !else ! "TARGET\t= %s\n","libhello"#>libext !end !else !if defined exename and (exename#"") then ! "TARGET\t= %s\n",exename#>exeext !elsif defined project and (project#"") then ! "TARGET\t= %s\n",project#>exeext !else ! { main : "TARGET\t= %s\n",#>exeext } !end !end !if not defined usestaticclibs then !new usestaticclibs- !end !if defined ccomp then !elsif env_target="free_bsd" then ! "CDEFS\t= -D_unix -D_free_bsd -DX2C_no_spawn -DX2C_strcmp\n" ! "CF\t= -O2 -c -I$(INCL)\n" ! "CC\t= cc\n" !new ccomp = $$(CC) $$(CDEFS) $$(CF) -o %s %s !elsif (env_target="linux") or (env_target="x86linux") then ! "CDEFS\t= -D_unix -D_linux -DX2C_no_spawn -DX2C_strcmp\n" ! "CF\t= -O2 -g -I$(INCL) -c\n" ! "CC\t= gcc\n" !if defined linuxaout_support and linuxaout_support then ! "OBJFF\t= -bi486-linuxaout\n" !else ! "OBJFF\t=\n" !end !if usestaticclibs then ! "LFLAGS\t= -static\n" ! else ! "LFLAGS\t=\n" !end !new ccomp = $$(CC) $$(OBJFF) $$(CDEFS) $$(CF) -o %s %s !end !if defined asmcomp then !elsif (env_target="x86linux") or (env_target="linux") then !new asmcomp = as -o %s %s !end # ------------------ objects enumeration ------------------ # ------------------- ! "OBJ="; { obj : " \\\n\t%s",# } # ------------------- target make rules ------------------- # ----------------- !if genlib then ! "$(TARGET) : $(M) $(OBJ)\n" !if (env_target="linux") or (env_target="x86linux") or (env_target="free_bsd") or (env_target="sunos4") or \ (env_target="aix") then ! "\trm -f $(TARGET)\n" ! "\tar q $(TARGET) $(OBJ)\n" ! "\tranlib $(TARGET)\n" !else ! "\tar q $(TARGET) $(OBJ)\n" !end !else ! "$(TARGET) : $(OBJ) $(XDSLIB)\n" !if (env_target="x86linux") then ! "\tgcc $(LFLAGS) -o $(TARGET) $(OBJ) $(XLIBS) $(TSLIBS) $(XDSLIB) $(XMACLIBS) -lm -lncurses -lgtk \ -lgtk-x11-2.0 -lgdk -lgdk-x11-2.0 -lpango-1.0 -lglib-2.0 -lgmodule-2.0 -lgobject-2.0 -latk-1.0 -lgdk_pixbuf-2.0 \n" !elsif (env_target="linux") or (env_target="aix") then ! "\tgcc $(LFLAGS) -o $(TARGET) $(OBJFF) $(OBJ) $(XLIBS) $(XDSLIB) -lm\n" !else ! "\tcc $(LFLAGS) -o $(TARGET) $(OBJ) $(XLIBS) $(XDSLIB) -lm\n" !end !end # ----------------- Dependency information ---------------- # ---------------------- ! { asm : "%-12s : $(M)",#>objext; " %s\n\t",#asmext; asmcomp,#>objext,#asmext; "\n\n" } ! { c : { header : "%-24s : %s\n",^#>objext,#header } \ "%-24s : $(M) %s\n\t",#>objext,#; ccomp,#>objext,#; "\n\n" } # end of makefile And this is my Hello.prj file (results are the same with .so): -O2+ -lookup = *.sym = . -lookup = *.def = . -lookup = *.mod = . -lookup = *.obj = . -lookup = *.lib = /usr/lib -template = xc-gtk2.tem !module ./Hello.mod !module /usr/lib/libglib-2.0.la !module /usr/lib/libgmodule-2.0.la !module /usr/lib/libgobject-2.0.la !module /usr/lib/libatk-1.0.la !module /usr/lib/libpango-1.0.la !module /usr/lib/libgdk_pixbuf-2.0.la !module /usr/lib/libgdk.la !module /usr/lib/libgtk.la !module /usr/lib/libgtk-x11-2.0.la
  22. GTK+ in Modula 2

    Ahh -- that may explain it. I have only GTK+ 2.0 on my system. ( I searched my entire gnome tree with "find /opt/gnome/include/ -name '*.h' |xargs grep gtk_file_chooser_default_get_type" and nothing came up.) Well, I just did a grep of ./usr lib and on my system, it looks like [tt]gtk_file_chooser_default_get_type[/tt] comes from [tt]libgtk-x11-2.0[/tt] (same with [tt]gtk_file_chooser_embed_get_type[/tt] and [tt]gtk_file_chooser_entry_get_type[/tt])
  23. GTK+ in Modula 2

    Anyone had any luck getting this going? I'm still getting errors.
  24. Can anyone help me in getting a clearer understanding of how strings work in the X11 and Xm libraries? In general, when I'm working with example Motif programs in C I have pretty good luck, except when it comes to having to use certain types of strings. For example, I have to go through a couple of extra steps to be able to use checks of argv^[0] Another example, I can't figure out how to use XmStringCreateLocalized, I have to use other options, like XmStringCreate, or XmStringCreateLtoR Any pointers or links to resources would be appreciated. Thanks, Terry
  25. OK, the first one I think I figured out, and involves my confusion over when C is using pointers (I think) In the C code, it is: printf ("usage: %s bitmap-file\n", argv[0]) exit (1); it seems to work when I use: printf("usage: %s bitmap-file\n", argv^[0]^ ); HALT(1) I'm still having some major problems though. I can get things to work in Motif 1.2 terms, but I'm having more difficulty trying to do things the "right" way in Motif 2.1/2.2 terms.
×