Path: news.cs.au.dk!not-for-mail From: Flemming Gram Christensen Newsgroups: comp.lang.beta Subject: Re: More newbie questions ... Date: 31 May 2000 12:10:11 +0200 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 161 Message-ID: References: <20000530105522.17371.qmail@noatun.mjolner.dk> <3933D308.6DFBD114@skynet.be> <39342244.49C38422@skynet.be> NNTP-Posting-Host: odin.mjolner.dk X-Trace: xinwen.cs.au.dk 959767814 16992646 255.255.255.255 (31 May 2000 10:10:14 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 31 May 2000 10:10:14 GMT X-Newsreader: Gnus v5.7/Emacs 20.4 Xref: news.cs.au.dk comp.lang.beta:12370 Atle writes: > Flemming Gram Christensen wrote: > > > > > > ORIGIN '~beta/basiclib/betaenv'; > > INCLUDE '~beta/basiclib/formatio'; > > --PROGRAM: descriptor-- > It looks like INCLUDE provides the library as well ( -lformatio ). Includes lets you use the library formatio. You can refer to functions found therein. > But what is ORIGIN? Is this like in Windows, they have something called WinMain() and LibMain()? > Or was is DLLEnter() and DLLExit()? Will ORIGIN affect the startup code? No. Each .bet file results in one .obj file. The origin/include is a bit longer story. You can find a complete description in the documentation: /beta/doc/beta/fragment.html Short Story: BETA programs is build from patterns, SLOTS (holes), and pieces (to put into holes). the --program:descriptor-- begins a pieces (really called fragment) named 'program' of type descriptor. The origin line specifies where to find a hole to put the program:descriptor fragment into. If you look into the file beta/basiclib/betaenv.bet you will find: .... program: (* descriptor executed by this environment *) <>; theProgram: ^|program; ... The <>; defines a hole named 'program' of type 'descriptor'. This is how large programs are split up into manageable pieces. The SLOT/ORIGIN defines the context for your program. You should not dig into this the first week, though. > I tried debugging with xxgdb, but (of course) this didn't quite work. Is there a special debugger, or is there a way to make xxdgb > understand Beta (references to program lines?)? I do not know xxdgb, bug gdb will not work, so?. Allthough you can use gdb to look at the assembler code. To do sourcelevel debugging you must use the mjolner.exe tool. Look in the documentation beta/doc/valhalla-tut/ > > (# > > r:[8]^text; > Declaring a dynamic reference (pointer?) to an 8-elm array of text (Y/N)? No. Declaring an array (repetition) of 8 dynamic references to Text. You cannot do reference assignments of arrays like in C. Just copy: (# r,s:[7]@integer; do r->s; (* copies all elements *) #); > > > singleText:^text; > Declaring a dynref to the 'iterator' (BTW: Are there 'iterators')? Dynamic reference to a Text object. How do you mean iterators? > > > > (* > > struct s { > > char name[25]; > > char addr[25]; > > char tlf[25]; > > }; *) > > > > (* I prefer Texts and not char arrays, this is not C! *) > Would there be any reason to use a char array (except C-compatability)? No. Not even for that. If you need to call C code I will give you an example. > > Person: > > (# name,addr,phone:^text; > > print: > > (# > > do 'Name: '->puttext; name[]->putline; > > 'Addr: '->puttext; addr[]->putline; > > 'Phone: '->puttext; phone[]->putline; > > #); > > #); > > Atle:^Person; (* dynamic reference to Person *); > > do (* build a repetition (array) of text objects *) > > 'atle' -> r[1][]; > > 'beta' -> r[2][]; > > 'compiler'-> r[3][]; > > 'debug' -> r[4][]; > > 'error' -> r[5][]; > > 'free' -> r[6][]; > > 'group' -> r[7][]; > > > > (for i:r.range (* range = 8 *) repeat > > r[i][]->putline; > > for); > > > > (for i:r.range (* range = 8 *) repeat > > r[i][]->singleText[]; > > singleText[]->putline; > > for); > > > > (* Instantiate (allocate) Person object *) > > &Person[]->Atle[]; > > 'Atle R.' -> Atle.name[]; > > 'Norway' -> Atle.addr[]; > > '12343241'->Atle.phone[]; > > Atle.print; > > #) > Can Person be instantiated and initialized in one go? No, no constructors. > How would it look in the style of "&Person('Atle', 'Norway', '12345') -> Atle[];" > Could a stack allocation happen by changing & to @? This is not stack allocation, but a static part-object. It is inlined into the surrounding object. Then you do not need the &Person[]->Atle[]; > > > > Please ask questions. > Thanks! I love it when I can get questions answered like this. I can have things figured out in minutes that might take hours > otherwise! > > More advanded output are also available. > Of course, the ultimate output will be to an X-window. > I got the impression that there is no AWT-like interface, but I find this rather hard to believe. There is look into beta/guienv/ for a platform independent library. Eg. try beta/demo/guienv/*.bet Or look into beta/demo/Xt for pure Xwindows interface. (very easy for doing Xlib or Xt or Xaw programming). > Will Beta be augmented with an AWT (or other GUI-tool), or will it be windowing system specific, like C/C++? I like the idea of an > Abstract Windowing Toolkit, in most cases I will not need anything more than that, and Beta seems ideal for implementing it. > > > I could also imagine something more advanced than X, taking up where NeXt left off and extending ideas from Java, having a > 'Universal Terminal Interface', providing capabilities depending on the hardware it is running on, uploading as much as possible to > the terminal, and thereby overcoming this artificial barrier between text 'mode' and graphics 'mode'. There is no need for a 'mode' > - just that some hardware doesn't support some functions, all part of the View. > In an MVC setup, only the View would change, and the rest of the application could be the same. > > Is this in line with the Beta philosophy? Sure. Come again! Regards -- /Flemming Gram Christensen