#: 8539 S3/Languages 02-Dec-90 13:28:11 Sb: #'C' problem Fm: Jim Peasley 72726,1153 To: 'C' mavens Anybody want to help save my sanity?? I'm trying to parse out the year from an input string passed to a function, and can't see where I'm going wrong. Sample C code : ------------------------------------------------------------------------ print_event(Inline) char Inline[81]; { int e_yr; ... ... char ev_yr[3]; char *inptr = Inline; ... ... p strncpy(ev_yr,inptr + 6,2); /* copy bytes 6 & 7 to ev_yr */ itoa(e_yr,ev_yr,10); /* convert int e_yr to char ev_yr base 10 */ printf("\nEvent year = %s",ev_yr); <=== always prints "2" ... ... ------------------------------------------------------------------------ I'm using Turbo C and stepping through the code line-by-line, and still can't see what's wrong... anybody else see the problem?? BTW - Turbo C is a neato development environment - lots of on-screen help and it's lightning FAST, but the CoCo C compiler catches some errors that TC seems to ignore. ...Jim There is 1 Reply. #: 8540 S3/Languages 02-Dec-90 15:00:12 Sb: #8539-#'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - Off the top: Are you REALLY passing an ARRAY of characters to the function, or did you pass a pointer to that array? If you called the function with the name of the array, you passed a pointer: char junk[81]; gets(junk); do_function(junk); .. as in this scenario. It'll also be easier to manipulate (and faster) in the target function. I've never passed an array in TC, but don't think you CAN under MW C. Also - on your reference to strncpy(), you said you were copying the 6th and 7th characters... you actually started the copy at the 7th character when you did this: strncpy(target, source+6, 2); Pete There is 1 Reply. #: 8553 S3/Languages 02-Dec-90 20:10:40 Sb: #8540-#'C' problem Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; Yep, commenting error on the 6/7 bytes - stepping thru the program, I can look at the variable (or pointer + offset) and see the value at any time. Just got thru with 2 weeks of classroom 'C' and I guess all of it hasn't sunk in yet. That's what I'm trying to do now, practice until I get all the 'not quite clear' points so that I understand them. The name of the array is what's being passed to the function, and I'm declaring a local pointer to the char array. Have any ideas on why strncpy doesn't seem to be doing it's thing? ...Jim There is 1 Reply. #: 8568 S3/Languages 03-Dec-90 08:53:21 Sb: #8553-#'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - If you're passing the NAME of the array, then that's automatically a pointer to the array: saying: assuming: char myarray[81]; saying : myarray is the same as &myarray[0] So, if you called a function with 'myarray like so: do_it(myarray); You'd need to declare it at the receiving end like this: do_it(stuff) char *stuff; /* myarray arrived as a pointer to the base of itself*/ { char woof[3]; strncpy(woof,myarray+5, 2); /* grab chars 6 & 7 */ .... } Pete There is 1 Reply. #: 8582 S3/Languages 04-Dec-90 00:20:40 Sb: #8568-#'C' problem Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; Yeah, your way seems to be a bit more self-documenting than the way I was doing it... but at this point in the game, any way that works is what I'm shooting for! ;-) > do_it(stuff) > char *stuff; /* myarray arrived as a pointer to the base of itself*/ > { > char woof[3]; Hopefully, this'll all become more automatic as time goes on. ...Jim There is 1 Reply. #: 8589 S3/Languages 04-Dec-90 08:44:46 Sb: #8582-#'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) I'm sure it will (become more automatic). Even with my ASM background, the prodigous use of pointers was baffling. It became clear to me later on that if you simply point to things, vice moving them around, things are MUCH quicker. Probably some of the best tutorial hours I spent were staring at Carl Kreider's code - any of it. I highly reccomend scanning the DL's (esp. the UG LIB) for anything by Carl. He's really a wonderful programmer. Pete There are 2 Replies. #: 8631 S3/Languages 07-Dec-90 10:12:19 Sb: #8589-#'C' problem Fm: Carl Kreider 71076,76 To: Pete Lyall 76703,4230 (X) (Blush) 8-) I don't get around so much, but I get by every so often. I caught the 6809 lib unix time stuff bug and will fix it this weekend and upload fixed version. I can't believe that took this long to find! Carl There are 2 Replies. #: 8632 S3/Languages 07-Dec-90 13:18:03 Sb: #8631-#'C' problem Fm: Pete Lyall 76703,4230 To: Carl Kreider 71076,76 (X) It has been found and worked around in the past. And stop blushing... it makes the other characters on the screen hard to read .. (grin).. Pete There is 1 Reply. #: 8668 S3/Languages 10-Dec-90 09:43:45 Sb: #8632-'C' problem Fm: Carl Kreider 71076,76 To: Pete Lyall 76703,4230 (X) Well, I stll feel dumb. But i is fixed now, which of course breaks your work around .... (grin)... Carl #: 8688 S3/Languages 12-Dec-90 09:44:06 Sb: #8631-#'C' problem Fm: Paul K. Ward 73477,2004 To: Carl Kreider 71076,76 (X) Carl, I have been talking to a professional photographer here on some brochure and advertising issues. Name is RC Kreider, the son of one of five brothers who left central PA years ago to ove to (move to, oops) Ohio and Illinois. Any relation, I wonder? Paul There is 1 Reply. #: 8691 S3/Languages 12-Dec-90 12:20:14 Sb: #8688-'C' problem Fm: Carl Kreider 71076,76 To: Paul K. Ward 73477,2004 Probably are related. My kin landed in PA late 1700's or so and then moved into Ohioo,Ill, Ind, Kansas, and so on. Lots of roving preachers. #: 8639 S3/Languages 08-Dec-90 11:32:10 Sb: #8589-#'C' problem Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; My weekly question on "C" this week is on memcpy and strcat. I seem to be missing the boat somehow, and would appreciate a "pointer" to whtre I'm erring. >> inline = "01/22/54Tiny Tim*Birthday" << addr. passed to funct. 'print_event' print_event(inline,yr) char *inline; int yr; { int s_len, ev_len; char date[6], *eptr, name[32]; memcpy(date,inline,5); /* pull in 1st 5 bytes */ strcat(date,'\0'); /* and null term it */ eptr = strchr(inline,'*'); /* loo' for delimiter */ s_len = strlen(eptr); /* get length of event + '*' */ ev_len = strlen(inline + 8); /* get length of instring - date*/ memcpy(name,(inline + 8),(ev_len - s_len)); /* copy only name */ strcat(name,'\0'); /* and null term it */ printf("\n%s %s",date,name); return; } >> date = "01/22 %#Tiny Tim%#&$!"#$!" >> name = "Tiny Tim%$#!%$%!"#$#$" In both cases, my strings don't get null terminated and it prints garbage chars after them. ...Jim There are 3 Replies. #: 8640 S3/Languages 08-Dec-90 12:40:47 Sb: #8639-#'C' problem Fm: Bruce MacKenzie 71725,376 To: Jim Peasley 72726,1153 (X) Jim, Strcat[date,'/0']; is not the way to null terminate a string. Strcat assumes the string pointed to by date is already null terminated. It searches along it until it finds a null (from the output it obviously doesn't find a null until it's searched along several characters beyond the space set aside for the string). It then tacks on the second string, a null string in this case, at that position. To null terminate date all you need do is explicitly assign the null: date[5]=0; There are 2 Replies. #: 8649 S3/Languages 08-Dec-90 15:44:43 Sb: #8640-'C' problem Fm: Jim Peasley 72726,1153 To: Bruce MacKenzie 71725,376 (X) Thanks Bruce, I've been tearing my hair out over this one. Originally, I was trying to use strncpy, but found a caveat that I had overlooked : "if s2 is longIr than s1, the string is not null terminated". Since s2 will always be longer in my case, I thought I'd try memcpy and explicitly put a '\0' at the end. Never occurred to me that strcat has to find the original '\0' in order to know where to begin concatenating! I'll try yours and Pete's suggestion in a bit and let you know. Thanks, ...Jim #: 8655 S3/Languages 09-Dec-90 11:16:54 Sb: #8640-#'C' problem Fm: Jim Peasley 72726,1153 To: Bruce MacKenzie 71725,376 (X) Bruce; (&& Pete && JJ) Explicitly assigning the null byte worked like a champ! Thanks guys. Lots of things in 'C' are not too intuitive, but learning thns way, I'll not soon forget lessons learned! success = ((goal != experiment && frust_lvl[i] < MAX)?try_again(),++i:ask_cis()); ...Jim There is 1 Reply. #: 8669 S3/Languages 10-Dec-90 16:46:27 Sb: #8655-#'C' problem Fm: Bruce MacKenzie 71725,376 To: Jim Peasley 72726,1153 (X) Jim, Good deal. Keep with it and I hope you learn to love C as much as I do. It's a neat language. There are 2 Replies. #: 8683 S3/Languages 11-Dec-90 23:32:33 Sb: #8669-'C' problem Fm: Jim Peasley 72726,1153 To: Bruce MacKenzie 71725,376 (X) Bruce; Yah, I'm beginning to like it (he sez, gnashing teeth and pulling hair!). ...Jim #: 8727 S3/Languages 14-Dec-90 00:00:58 Sb: #8669-#'C' problem Fm: Jim Peasley 72726,1153 To: Bruce MacKenzie 71725,376 (X) Bruce; Maybe you can help- #define INFILE c:\\system\\dates.fil FILE *fp; main(argc,argv) { add_event(); etc. } add_event() { char outstring[80]; etc. if ((fp = fopen(INFILE,"a+")) == NULL) fprintf(stderr,"Cannot open output file\n"); else { if (fputs(outstring,fp) == EOF) fprintf(stderr,"File write failed\n"); } f lose(fp); clearerr(fp); return; } This code fragment doesn't want to write to the output file for some reason. Reads work fine using the same #define for INFILE, and checking the last char of "fputs(outstring,fp)" returns the correct char. I'm obviously doing something wrong, but for the life of me, can't see what it is! Can you give me a clue? Thanks, ...Jim p.s. not to worry about the obvious MS-DOS file spec, I've ifdef'd similar calls for OS9! There is 1 Reply. #: 8736 S3/Languages 14-Dec-90 09:05:09 Sb: #8727-#'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - Other than the fact that your #defined name isn't in quotes, I don't see any immediate problem (granted, I'm still on my first cup of coffee...) Pete There is 1 Reply. #: 8744 S3/Languages 15-Dec-90 01:37:38 Sb: #8736-#'C' problem Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; Again, I missed the quotes in the translation... they're there in the source though, and the pgm. will read from the file O.K., so I know that it's getting expanded properly. Since I posted the message, I've tried 'fopen(INFILE,"a")', "a+", "at", and "at+", all without the expected results. Using the debugger, and watching the HD lights, I can see that the fopen and fputs statements, as well as the fclose statement cause some disk activity, but nothing appears in the file after the data that's already there. Actually, the new data doesn't appear ANYwhere! Oh, and using the debugger, the outstring is what it should be. Messing with it tonight though, I notice that the file IS being appended - it's grown by 130+ bytes, although when I list it or look at it with an editor, none of my fresh input is there! Curioser && curioser by the minute! ...Jim There is 1 Reply. #: 8748 S3/Languages 15-Dec-90 08:13:46 Sb: #8744-#'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - Let me see the ACTUAL code. Is it in TC? If yes, I can diddle with that, as I have an AT with TC 2.0 on it... Pete There is 1 Reply. #: 8754 S3/Languages 15-Dec-90 15:03:57 Sb: #8748-#'C' problem Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) O.K. Pete, I'll shoot you the code and a small data file in PKZIP format (since you're using TC) to DL10 in a bit. ...Jim There is 1 Reply. #: 8760 S3/Languages 15-Dec-90 19:17:09 Sb: #8754-#'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - I dl'ed and compiled it, and ran it (on instinct anyway). I think you'll be in for a surprise... Your added data DID make it into the file. Two gotchas: 1) The original file had a PHYSICAL control Z at the end of the data. That means that does won't recognize any data beyond that point (I used a Unix 'vi' editor clone on the data file, which ignores CTRL Z, to find this out). DOS no longer requires a CTRL Z at the end of text files, so I'd remove it if I were you. 2) Your added records (your birthday?.. hmm - you're 4 years older than Marsha) had no EOL's on them. I also noted you had problems with 'system(CLS)'.... why not do it the direct way (under dos) and use 'clrscr()'. That should get you rolling, hopefully. If not, I only did about a 5 minute cursory scan, and may not have dug out all the nasties. Pete There are 3 Replies. #: 8782 S3/Languages 16-Dec-90 10:41:31 Sb: #8760-'C' problem Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Thanks Pete, I'll peruse your msg. and get back later today. Got some Xmas parties to attend & some honey-dews. ...Jim #: 8786 S3/Languages 16-Dec-90 12:10:08 Sb: #8760-#'C' problem Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; 15 mims before we have to go, so... YES!! Never thought to use another editor to look at the file. Using 'WRITE' under W3.0 shows the CTL-Z. I see what you mean about the newlines, and have added one to the end of the string to be stored. However, after deleting the CTL-Z from the original file, another one seems to have crept back in. It's gotta be DOS that's doing this, as the file on my CoCo has NO control chars, and I simply PCDOSed it over. Have to think about this a bit and do some reading in the 4.01 manual to try and get around this. BTW, some reading this thread may wonder why I'm asking DOS type questions in this forum. My intent is to become familiar with and proficient enough with the 2 OS's that I can port programs to OS-9. I've got a wealth of DOS sourc available at work & it'd be a shame to let them 'go to waste' . Thanks again, ...Jim There are 3 Replies. #: 8787 S3/Languages 16-Dec-90 12:50:14 Sb: #8786-#'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - Hmm - how are you creating the file? My autoexec.bat and config.sys files don't have CTRL Z's in them. Are you using 'copy con: filename.ext'? Are you using edlin? These might be culprits (dunno if EDLIN appends CTRL Z or not...I just tried it, and it does appear to, as you have to use a CTRL Z to get out of insert mode). Enjoy the parties... I have to go tree shopping later m'self. Pete P.S. Don't plan on getting anything significant done after the parties... There is 1 Reply. #: 8813 S3/Languages 18-Dec-90 00:38:40 Sb: #8787-#'C' problem Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; The original incarnation of the date file was PCDOS'd over from the CoCo, but I never thought to look at it for stray control chars. I don't _think_ that PCDOS is doing it, but haven't checked yet. If I remember the sequence correctly, the first attempt at appending the file using 'fputs' seems to work o.k. with subsequent appends being 'invisible'. This is definitely on my list of things to investigate, but it'll probably be after the holidays and the house gets put back together before I get back to it. (Having some foundation work done, and the downstairs is all torn apart!) Later, ...Jim There is 1 Reply. #: 8819 S3/Languages 18-Dec-90 08:55:25 Sb: #8813-'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) JIm - Another possiblity is to use kermit to move the file between machines. It also handles the EOL conversions properly (when not in image [-i] mode). Pete #: 8791 S3/Languages 16-Dec-90 17:57:00 Sb: #8786-#'C' problem Fm: James Jones 76257,562 To: Jim Peasley 72726,1153 (X) I bet that this may be some remnant of MS-DOS's CP/M-like origins. Some utility or program on the PC side may well be padding with CTRL-Z. CP/M, which MS-DOS was written to sort of behave like, at least at first, couldn't tell how long files were other than the number of 128-byte sectors they contained, so the convention for text files came up of marking the end of the good stuff with a CTRL-Z character. Anything past that was junk remaining in the last 128-byte sector of the sort that CP/M disks used. There is 1 Reply. #: 8814 S3/Languages 18-Dec-90 00:38:45 Sb: #8791-'C' problem Fm: Jim Peasley 72726,1153 To: James Jones 76257,562 (X) JJ; I think you're right on here... what had me scratching my head was the fact that I could step through the code and "see" the fopen and fputs lines being executed and the corresponding disk activity, yet not see anything new in the file! I'm having a hard enough time getting up to speed without craziness like this! Anyway, fprintf seems to solve the problem for now, and I'll investigate further after the holidaze. Thanks, ...Jim #: 8800 S3/Languages 17-Dec-90 07:39:16 Sb: #8786-#'C' problem Fm: Mark B. Sheffield 76247,1332 To: Jim Peasley 72726,1153 (X) Jim - Be sure to check how the file was opened (translated mode or not). In translated mode, reads will stop when they encounter a ^Z. Similar wierdness happens when writing. There is a global variable that you can set to specify the default mode (translated or not). Check your compiler manual, give it a try, and let me know. Translated mode can cause all kinds of headaches, so I make sure to never use it (except when it sneaks up on me ;-) ) -mark There is 1 Reply. #: 8815 S3/Languages 18-Dec-90 00:38:51 Sb: #8800-#'C' problem Fm: Jim Peasley 72726,1153 To: Mark B. Sheffield 76247,1332 (X) Mark; Do you mean the "t"ext and "b"inary modifiers to the "a"ppend, "r"ead and "w"rite modes? as in "at+", "ab+", etc.? I tried all the append combinations with about the same results - no new data that was visible, although the file size grew with each attempt! This invisible EOF character thing has me intrigued. It's things like this that make me realize just how nice OS-9 is!! BTW, I'm waiting by the front door with my screwdriver in hand! ...Jim There is 1 Reply. #: 8828 S3/Languages 19-Dec-90 08:13:02 Sb: #8815-'C' problem Fm: Mark B. Sheffield 76247,1332 To: Jim Peasley 72726,1153 (X) Jim - Yes. In addition to opening a file +t for text mode, you can open it +b for binary. In MSC 5.0/5.1 the default mode is t. Sooo, it will default to text mode. You have two choices: set the extern global _fmode to O_BINARY ("b"), I think; OR fopen the file +b. Give this a try and let me konw how it works. And BTW, keep your screwdriver ready! -mark #: 8811 S3/Languages 17-Dec-90 23:38:12 Sb: #8760-#'C' problem Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; Finally got the results that I was looking for by using "fprintf". Still don't know how those control ciars snuck in there when using "fputs". On another subject, have you ever investigated those C function libraries (order now and we'll throw in the source code for only $19.95!) that you see advertised in the back of the computer mags, or in the card packs that seem to find their way to your mailbox after subscribing to almost any DOS mag? For someone in my position - ie. 'greenhorn' - having libs of common functions such as get_date(), get_phone(), or get_ssn() would save lots of time, but on the other hand, I probably wouldn't learn anything. Any experience with them? Maybe it'd be a good idea for someone to collect and AR them (I'll volunteer) if anyone has any good generic routines they'd like to share. C'mon back? ..Jim There is 1 Reply. #: 8818 S3/Languages 18-Dec-90 08:53:16 Sb: #8811-'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - I wouldn't say that you wouldn't learn anything - on the contrary... looking at someone else's (good) code is often the best tutorial there is. Don't forget that DOS mechanisms for getting date and such will be different than in os9. The best tool for sharpening your C skills is a flat nose.. the one you get from falling on your face from trying, and retrying to get code to compile and work. Take it from someone who took years to break the C-phobia (83-86). There is just no substitute for writing volumes of code. Pete #: 8642 S3/Languages 08-Dec-90 13:31:34 Sb: #8639-#'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - I saw Bruce's answer - that's the crux of the problem. Strcat assumes that the string is already null terminated (that's how it knows where to append whatever it's appending). Memcpy() is useful for raw bytes (i.e. like copying whole structures).... strncpy or strcpy are usually fine for characters. Also, with mem???(), I believe there's a possibility of a byte order problem if you move between CPU families. I'm not sure of that though... Anyway, given your situation, here's how I might approach it: ** the year, and have passed it to the function. */ print_record(recptr, year) char *record; int year; { char date[6], name[32]; char *evptr; date[0] = '\0'; /* just to be sure... */ name[0] = '\0'; /* that they're empty */ strncpy(date, recptr, 5); /* get MM/YY */ date[6] = '\0'; /* null terminate it */ evptr = strchr(recptr, '*'); /* find the delimiter */ if(evptr == NULL) { fprintf(stderr,"No delimiter found in record '%s'\n", recptr); return(-1); /* return error to caller */ } /* This will do 2 things: a) Terminate the name field ** and b) bump evptr so that it points to the event. */ *evptr++ = 0; strncpy(name, recptr+8, 31); /* copy upto 31 chars */ name[31] = '\0'; /* just in case we truncated name */ printf("Date: %s Name: %s Event: %s\n", date, name, evptr); } ================================================================= Pete P.S. I enjoy the questions There is 1 Reply. #: 8650 S3/Languages 08-Dec-90 15:44:46 Sb: #8642-#'C' problem Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; > P.S. I enjoy the questions > You don't know how happy that makes me! Having a place to ask inane questions is a _real_ security blanket. Hope your patience is in good supply; I start a M68000 assembler course at the local JC in January! ;-) Are you up and running with the MM/1 yet? ...Jim There is 1 Reply. #: 8656 S3/Languages 09-Dec-90 12:22:07 Sb: #8650-#'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - Well, we'll be going through it together.. though not at school. I'm taking compiler writing and calculus this semester... I have just taught myself (more accurate: am still teaching myself) 8086/80286 ASM, at least to the point where I can disassemble code, change it, and reassemble to get it to do what I want. I haven't yet learned 68K ASM, but will be shortly. It looks a LOT easier than *86 low level stuff. Nope - I still don't have an MM/1. Sore subject. Pete There is 1 Reply. #: 8682 S3/Languages 11-Dec-90 23:32:29 Sb: #8656-#'C' problem Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; re:learning M68000 asm. A lot of us will probably be dipping in to the font of knowledge just after the first of the year. Good to know we'll have company! Hope my MM/1 comes in time to use it for homework assignments. Do you know if the supplied S/W includes an assembler? ...Jim There are 2 Replies. #: 8686 S3/Languages 12-Dec-90 08:54:03 Sb: #8682-'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) I believe that the equivalent of RMA will be included in the package. Pete #: 8689 S3/Languages 12-Dec-90 09:46:24 Sb: #8682-'C' problem Fm: Paul K. Ward 73477,2004 To: Jim Peasley 72726,1153 (X) Jim, Assember is included as the back end of the Microware C compiler. Paul #: 8643 S3/Languages 08-Dec-90 13:37:45 Sb: #8639-#'C' problem Fm: James Jones 76257,562 To: Jim Peasley 72726,1153 (X) memcpy(), unlike strcpy(), doesn't null-terminate the destination. strcat() wants pointers as arguments, so you needed strcat(whatever, ""), but...strcat itself looks for a null terminator to know where to start copying, so you can't use it to force null termination. (Sort of a catch-NUL. :-) There is 1 Reply. #: 8651 S3/Languages 08-Dec-90 15:44:49 Sb: #8643-'C' problem Fm: Jim Peasley 72726,1153 To: James Jones 76257,562 (X) JJ; I'm beginning to 'C' the light! Hallelujah!! What worries me even more, is I'm going over my first struggling attempts and making the code more terse. AAaargh! (first pgms. were written ala PL/I - one evaluation per line) ...Jim #: 8588 S3/Languages 04-Dec-90 08:40:01 Sb: 'C' problem Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Yep - it's like that for a bit. Your feet look like swiss cheese after you've shot yourself there a few hundred times. Learning C is worth the anguish though. You'll be happy you invested the time later. Keep chugging, and as always, free advice is only a modem-call away. Pete #: 8584 S3/Languages 04-Dec-90 05:51:37 Sb: help on shell Fm: Kevin Darling (UG Pres) 76703,4227 To: MAS 76336,3226 (X) Robert - that is a little strange. But is it just that you don't see a BS take effect right away? The login shell is doing a ReadLn, and so nothing will happen until a CR is sent over. Also, I don't think pipes send signals on ^C or ^E. Can you give us a short piece of the code that the main app is using to send down the pipe to the login shell? best - kev #: 8600 S3/Languages 04-Dec-90 20:55:54 Sb: #login shell tst prg Fm: MAS 76336,3226 To: 76703,4230 (X) PART 1 OF TEST PROGRAM ************************************************************************* Here is a sample test program! Plese see "#### WRITE 3 ####": BS is not recognized by the login shell. ************************************************************************* /* os9exec() login and piping */ #include #include #include extern int errno; extern char **environ; extern int os9fork(); main() { int i; int c[2], std[3], pid, ret; char buffer[2]; char *argblk[2]; char bs[2]; bs[0] = (char) 8; argblk[0] = "/h0/cmds/login"; argblk[1] = 0; if ((c[0] = open("/pipe",S_IREAD|S_IWRITE)) == -1) { printf("Unable to open() read pipe : #%d\n",errno); exit(0); } if ((c[1] = open("/pipe",S_IREAD|S_IWRITE)) == -1) { printf("Unable to open() write pipe : #%d\n",errno); exit(0); } std[0] = dup(0); std[1] = dup(1); std[2] = dup(2); close(0); dup(c[0]); close(1); dup(c[1]); close(2); dup(c[1]); pid = os9exec(os9fork,argblk[0],argblk,environ,0,0,3); close(0); dup(std[0]); close(std[0]); close(1); dup(std[1]); close(std[1]); close(2); dup(std[2]); close(std[2]); if (pid == -1) { printf("\n*** Can't os9exec() ***\n"); exit(0); } for(i=0;i<5;i++) /* read from login pipe till pipe is empty */ { for(;;) { ret = getstat(1,c[1]); if (ret > 0) { read(c[1],buffer,1); printf("SHELL OUTPUT CHR> %c : %x 0) { read(c[1],buffer,1); printf("SHELL OUTPUT CHR> %c : %x 0) { read(c[1],buffer,1); printf("SHELL OUTPUT CHR> %c : %x d\\n ...\n"); for(i=0;i<5;i++) /* read from login pipe till pipe is empty */ { for(;;) { ret = getstat(1,c[1]); if (ret > 0) { read(c[1],buffer,1); printf("SHELL OUTPUT CHR> %c : %x 0) { read(c[1],buffer,1); printf("SHELL OUTPUT CHR> %c : %x #include #include extern int errno; extern char **environ; extern int os9fork(); main() { int i; int c[2], std[3], pid, ret; char buffer[2]; char *argblk[2]; char bs[2]; bs[0] = (char) 8; argblk[0] = "/h0/cmds/login"; argblk[1] = 0; if ((c[0] = open("/pipe",S_IREAD|S_IWRITE)) == -1) { printf("Unable to open() read pipe : #%d\n",errno); exit(0); } if ((c[1] = open("/pipe",S_IREAD|S_IWRITE)) == -1) { printf("Unable to open() write pipe : #%d\n",errno); exit(0); } std[0] = dup(0); std[1] = dup(1); std[2] = dup(2); close(0); dup(c[0]); close(1); dup(c[1]); close(2); dup(c[1]); pid = os9exec(os9fork,argblk[0],argblk,environ,0,0,3); close(0); dup(std[0]); close(std[0]); close(1); dup(std[1]); close(std[1]); close(2); dup(std[2]); close(std[2]); if (pid == -1) { printf("\n*** Can't os9exec() ***\n"); exit(0); } for(i=0;i<5;i++) /* read from login pipe till pipe is empty */ { for(;;) { ret = getstat(1,c[1]); if (ret > 0) { read(c[1],buffer,1); printf("SHELL OUTPUT CHR> %c : %x 0) { read(c[1],buffer,1); printf("SHELL OUTPUT CHR> %c : %x 0) { read(c[1],buffer,1); printf("SHELL OUTPUT CHR> %c : %x d\\n ...\n"); for(i=0;i<5;i++) /* read from login pipe till pipe is empty */ { for(;;) { ret = getstat(1,c[1]); if (ret > 0) { read(c[1],buffer,1); printf("SHELL OUTPUT CHR> %c : %x 0) { read(c[1],buffer,1); printf("SHELL OUTPUT CHR> %c : %x key=0; /* init root node contents */ root_ptr->lp=NULL; root_ptr->rp=NULL; I'm not sure why the example code I looked at casts the pointer returned by malloc as it did but I figure at least it provides more documentation as to what is doing on. It also ocurred to me that if pointer arithmetic is used the compiler needs to know how big the pointed to object is. Am I correct in my assumption or is there more to this? How do I reference the fields in the second node? This fails at execution time and I think I see why: node_ptr->lp->lp=NULL; This fails at compile time but I'm not sure what to try next. (*(node_ptr->lp))->lp=NULL; Suggestions? Any books that cover this sort of thing that anyone can recommend? Thanks, -J There are 2 Replies. #: 8675 S3/Languages 11-Dec-90 00:29:36 Sb: #8674-Dynamic Structure Alloc Fm: Pete Lyall 76703,4230 To: Jay Truesdale 72176,3565 (X) Jay - First of all, great questions! Now lets see if I can answer them.... The statement where you do root_ptr = (struct b_tree_rec *) malloc(sizeof(node)); . root_ptr is declared to be of type 'struct b_tree_rec *' above... malloc is of type 'char *'. Since a pointer to a char is a different animal than a pointer to a 'struct b_tree_rec' (NOTE: pointer math and size of objects was right on ethe money), then we must 'cast' or 'coerce' the source type to produce the same type as expected by the receiving variable, in this case rec_ptr. Some compilers will blow you out if you try to assign different types, and some are very lax. On the getting to the second node, I believe it'd be something like this: node_ptr = (struct b_tree_rec *) malloc(sizeof(node)); ... error checking ... ... allocation and linking of subsequent notes .... /* get at left node and determine the key */ curr_node = root_ptr->lp; curr_key = curr_node->key; Hope that helps.... Pete #: 8700 S3/Languages 12-Dec-90 21:42:10 Sb: #8674-#Dynamic Structure Alloc Fm: Jay Truesdale 72176,3565 To: Jay Truesdale 72176,3565 (X) Pete: Thanks for the confirmation about why I need to worry about what the pointer points to (pointer math) and why I need to cast the pointer returned by malloc. I think that I have to do the same cast for the same reasons to do what I really want to do, reference down the tree. If I want to get the key value contained in the left node while "at" the root node then (root_ptr->lp) references the pointer field in the root node which contains a pointer to the next node. I want to dereference this to get what this points to (the next node). The pointer contained in this field is of type b_tree_rec so I need to cast the de-reference operation to the proper type??? I then can use the -> operator to retrieve the contents to the next node like this: ((struct b_tree_rec *)(root_ptr->lp))->key This appears to work as my short test program gets the results I expected. I'm not sure why I need to cast the de-reference operation as I declared the "lp" field as being a pointer to type b_tree_rec in the structure template definition right before main. Thanks in advance, -J There is 1 Reply. #: 8708 S3/Languages 13-Dec-90 09:05:57 Sb: #8700-#Dynamic Structure Alloc Fm: Pete Lyall 76703,4230 To: Jay Truesdale 72176,3565 (X) Jay - I'm not sure why you have to cast that second dereferenced pointer either.. should be implicit because of the declaration. If you DON'T, does it break? I recall before that you were doing root_ptr->lp->key, or something like that. It may be a precedence thing, where you need to cluster the binding that way you want it (i.e. (root_ptr->lp)->key. Maybe that'll let you avoid the cast? Pete There is 1 Reply. #: 8761 S3/Languages 15-Dec-90 19:41:52 Sb: #8708-#Dynamic Structure Alloc Fm: Jay Truesdale 72176,3565 To: Pete Lyall 76703,4230 (X) Pete: If I use "node_ptr->rp" then this 'is' a member of the pointed to structure, this is probably why "node_ptr->rp->rp" failed, isn't any way to get to there from here! 'rp' is a pointer to type b_tree_rec. To get the 'next' item in my B-Tree I need to use the indirection operator to get to where "node_ptr->rp" points to. If I use *(node_ptr->rp) I get an error #102 bus trap error so I assume that I'm referencing an area in the memory map that has nothing there. I may try using this as an argument to printf in hex format to try and figure out what's going on. If I use (*)(node_ptr->rp) I get a bunch of compile errors: "btree.c", line 169: **** primary expected **** print_tree( (*)(node_ptr->rp) ); ^ "btree.c", line 169: **** expression missing **** print_tree( (*)(node_ptr->rp) ); ^ "btree.c", line 169: **** not a function **** print_tree( (*)(node_ptr->rp) ); ^ errors in compilation : 3 If I cast the pointer like this "(struct b_tree_rec *)(node_ptr->rp)" it both compiles and works. Guess I'll go do some more reading and experimenting and see if I can figure this one out. (Maybe I should have purchased that "Data Structures in C" book I saw last week...) -J There are 2 Replies. #: 8784 S3/Languages 16-Dec-90 12:01:30 Sb: #8761-Dynamic Structure Alloc Fm: Pete Lyall 76703,4230 To: Jay Truesdale 72176,3565 (X) Jay - Well, in that case (as always), empirical proof is more solid that theoretical conjecture (grin)! In other words, go with what works. Pete #: 8827 S3/Languages 19-Dec-90 08:07:29 Sb: #8761-Dynamic Structure Alloc Fm: Bill Dickhaus 70325,523 To: Jay Truesdale 72176,3565 (X) Jay, What should work is: (node_ptr->rp)->rp If rp is defined as a pointer to the structure, then you shouldn't have to cast the "(node_ptr->rp)" part. The trick here is the parentheses not the cast, I think. I use this all the time with OS9 LII without any problems. Bill #: 8702 S3/Languages 13-Dec-90 03:46:49 Sb: #C and buffers Fm: Dan Charrois 70721,1506 To: all I have a question about buffers and C that has no doubt been asked before, and I apologize for that. But anyways, given the following code: main() { printf("First line"); sleep(1); Circle(1,100); sleep(1); } Why does the system sleep for 1 Second, draw the Circle, sleep another second, and THEN print "First line" right before exiting? I gather that it must have something to do with buffered output since if I tack a \n after 'line' things work as expected, but how can I get the code above to work the way it would intuitively seem to? I noticed that I could use write and it worked alright (perhaps), except I still wouldn't know how to print formatted output this way. I'd appreciate hearing from anyone who has even the slightest idea on what exactly is going on. Dan There are 2 Replies. #: 8705 S3/Languages 13-Dec-90 06:29:18 Sb: #8702-#C and buffers Fm: James Jones 76257,562 To: Dan Charrois 70721,1506 (X) That's exactly what it has to do with. You can get it to do what you want also by inserting the line "fflush(stdout);" before the first sleep call. There is 1 Reply. #: 8717 S3/Languages 13-Dec-90 13:54:28 Sb: #8705-C and buffers Fm: Dan Charrois 70721,1506 To: James Jones 76257,562 (X) Thanks, James. I'll give that a try.. Seems to make sense, though I don't think I would have thought of that approach. #: 8709 S3/Languages 13-Dec-90 09:09:16 Sb: #8702-#C and buffers Fm: Pete Lyall 76703,4230 To: Dan Charrois 70721,1506 (X) Dan - If you want to avoid the "\n", try tacking an: fflush(stdout); This tells the buffering logic to toss the buffer contents even though an end of line (typical flag for dumping the buffer) hasn't been seen. If you don't mind losing the speed advantage of buffereing, you could just unbuffer the stream by: setbuf(stdout, NULL); Pete There is 1 Reply. #: 8718 S3/Languages 13-Dec-90 13:56:23 Sb: #8709-C and buffers Fm: Dan Charrois 70721,1506 To: Pete Lyall 76703,4230 (X) Thanks Pete. The speed isn't too important really, so I think I'll try the setbuf() approach first instead of using fflush() all the time. #: 8756 S3/Languages 15-Dec-90 17:22:45 Sb: #FORTRAN available? Fm: Mike Passer 72750,420 To: All Hello! Does anyone out there know the whereabouts of a FORTRAN compiler for OS9 Level II on the Color Computer? If anyone has even half a lead, please let me know! Thanks, Mike Passer There are 2 Replies. #: 8763 S3/Languages 15-Dec-90 19:53:00 Sb: #8756-FORTRAN available? Fm: Kevin Darling (UG Pres) 76703,4227 To: Mike Passer 72750,420 (X) Mike - call MW at 515-224-1929.... I met someone last year who bought the FORTRAN package from them, and uses it on his CoCo-3. I believe it was around $300 (?). - kev #: 8765 S3/Languages 15-Dec-90 20:17:51 Sb: #8756-#FORTRAN available? Fm: Mike Passer 72750,420 To: Mike Passer 72750,420 (X) Kevin, $300! Gasp! Choke! I thought the MW version might have come down just a little - $100, I'm afraid, is about my limit. However, thanks for the suggestion, and I will give them a call, though I've heard that they no longer sell the 6809 compilers. Thanks! Mike There is 1 Reply. #: 8767 S3/Languages 15-Dec-90 21:06:24 Sb: #8765-#FORTRAN available? Fm: Kevin Darling (UG Pres) 76703,4227 To: Mike Passer 72750,420 (X) Mike - remember that Basic09 was $250 before Tandy bought enough to bring the price down . Perhaps the FORTRAN price will drop a bit in the future. There is 1 Reply. #: 8770 S3/Languages 15-Dec-90 21:56:15 Sb: #8767-#FORTRAN available? Fm: Mike Passer 72750,420 To: Kevin Darling (UG Pres) 76703,4227 (X) Kevin, And now they're going for $10.00 at Radio Shack bargain tables! Too bad Tandy never decided to market FORTRAN for the Coco! :> I was actually hoping that someone out there in OS9 land had a dormant license that he was willing to sell me, but, I guess if it were that dormant, they wouldn't be looking _here_. I've heard about a small FORTRAN source for Unix, but don't know where on earth to start looking for it (besides the Unix and Computer Language Forums). I have the MW C compiler (still waiting for Radio Shack to mail me my cc2 and one pass compiler modules :>) and could give the old college try at porting it over (no, I don't value my sanity). On another subject, after reading the OS9 technical information section in the Level II manual, I wondered if there might be a modified system out there somewhere that does something besides print the "FAILED" message when system startup doesn't go as planned--maybe a hex code saying how far along it was, or something along those lines? Also, it says that the kernel initializes the system, inolving "Loading any required modules that were not loaded from the OS-9 Boot file." Does this mean that I could theoretically break up my boot and put the files in the execution directory (I know this is not a good idea - 8k blocks) and that OS9 would load them for me? Is this what happens with grfdrv, and, if so, why can't it go into OS9Boot? (If you hung on through this much rambling, take a break!) Ths again! Mike There is 1 Reply. #: 8771 S3/Languages 15-Dec-90 22:13:00 Sb: #8770-#FORTRAN available? Fm: Kevin Darling (UG Pres) 76703,4227 To: Mike Passer 72750,420 (X) In the upgrade, we modified REL so that it printed a number to tell how far you'd gotten (eg: BOOT FAILED #9 = no shell). That meant of course that we also had to modify os9p1, os9p2, sysgo, and perhaps one or two others to set an error byte before calling the D.Crash vector. So it's not an easy patch. You're right.. the system normally does not load any extra modules on boot. The exceptions are that CC3Go forks shell (which gets temporarily loaded), and CC3IO will load windint/grfint or vdgint, plus grfdrv. But none of those are the core kernel. The reason grfdrv can't go in the boot, is because it must sit alone in an 8K block.... it creates its own 64K "map" whenever it accesses the video memory and buffers. Actually, this isn't strictly true (it could straddle a coupla 8K blocks), altho the upgrade sure depends upon it. Umm, oh.. the important reason is because it's mapped out of the main system map, into its own map. Putting it into the boot would use up 8K of main system space (precious!) for no reason. Sorry, brain foggy ;-). kev There is 1 Reply. #: 8788 S3/Languages 16-Dec-90 14:47:06 Sb: #8771-FORTRAN available? Fm: Mike Passer 72750,420 To: Kevin Darling (UG Pres) 76703,4227 (X) Kev, Thanks for that info -- I don't quite have the distinction between system and user maps down yet, but I know that not having enough system memory can get you into trouble. Thus, the loading of grfdrv at the end of the boot make sense. Looking forward to seeing that upgrade someday. There's not too many things more frustrating that trying to figure out what caused that Boot Failed message (save Christmas shopping at the Crystal Mall in Waterford, CT or figure out what's really going on in the Gulf). Thanks, Mike #: 8809 S3/Languages 17-Dec-90 21:07:31 Sb: #malloc() problem Fm: Bob van der Poel 76510,2203 To: all Does anyone know of any problems with the malloc() C function. I'm finding that my data (saved in a malloc()ed buffer) is corrupted from time to time. I suspect a wild pointer in MY code, but I thought I'd check since I can't find the problem here. Also, I noticed that memory returned with free() does not seem to get reused unless the request size is identical to the original. Is there a fix for this? Or does it clear up when there is no more easy memory available? BTW, this question concerns the 6809 C compiler using the Krieder library, but since I hope to port the code to 68K any comments in that area will also be appreciated. There is 1 Reply. #: 8810 S3/Languages 17-Dec-90 22:22:05 Sb: #8809-malloc() problem Fm: Pete Lyall 76703,4230 To: Bob van der Poel 76510,2203 (X) If you're using Carl's malloc(), it's supposed to be clean... Pete #: 8892 S3/Languages 25-Dec-90 15:55:01 Sb: Pascal Fm: Paul Rinear 73757,1413 To: Anyone Greetings, I'm trying to use the OS9 Pascal package. With PASCAL in memory, and also in CMDS, and with a Pascal source code file in the working directory, typing PASCAL < filename #20k returns Error #244. Can you help me get started? Paul R. #: 8996 S3/Languages 01-Jan-91 23:55:16 Sb: #'C' help Fm: Jim Peasley 72726,1153 To: all Can anybody point me to some example code that uses the "tm" structure on pg. 31 of the Kreider lib docs?? I'm trying to implement a date routine and it looks as thohgh the LOCALTIME function in utime.h is what I'm after. Thanks, ...Jim There is 1 Reply. #: 8998 S3/Languages 02-Jan-91 13:18:00 Sb: #8996-#'C' help Fm: Tom Napolitano 70215,1130 To: Jim Peasley 72726,1153 (X) Jim, Your timing is perfect. For a use of localtime(), check out swave.ar in library 6. I used it in all three programs therein. Also, be sure to grab the latest of Carl's library uploads (December 1990). He fixed the utime function; the old version caused my programs to be off by a month. (Missing a month sometimes causes people problems). (Sorry about that). tom n There is 1 Reply. #: 9010 S3/Languages 03-Jan-91 23:44:58 Sb: #8998-'C' help Fm: Jim Peasley 72726,1153 To: Tom Napolitano 70215,1130 (X) Ahhh... Thanks, Tom! That was just what I needed!! Guess I'll have to re-DL the CLIBs again -- my version is dated 8/88. ...Jim #: 9018 S3/Languages 04-Jan-91 21:31:42 Sb: #Not a hot topic Fm: Paul Rinear 73757,1413 To: Anyone At the risk of being rude: has anyone printed out the Kreider C library docs from clibdo.ar ? I can't find the mroff that is said to be in there. The source code is there, but there seem to be pieces missing that are needed to compile it. Bet nobody replies to this.... There are 2 Replies. #: 9019 S3/Languages 04-Jan-91 22:04:23 Sb: #9018-Not a hot topic Fm: Pete Lyall 76703,4230 To: Paul Rinear 73757,1413 (X) Lot's of us have... in fact I did some camera ready stuff a few years back, and distributed it to those interested. Before you ask, I no longer have it. Re: mroff - what's wrong/missing? Mroff is supposed to be here in either DL9 or DL6. Worst case, someone could shoot you a binary of it (I'm no longer running a 6809, or I would). Pete P.S. Not sure I understand your "bet nobody replies to this"... Actually, that was the only 'rude' part of your message. We pride ourselves on being responsive and accurate here. You'll find you'll get lots of help without resorting to reverse psychology. #: 9020 S3/Languages 04-Jan-91 22:07:17 Sb: #9018-#Not a hot topic Fm: Pete Lyall 76703,4230 To: Paul Rinear 73757,1413 (X) Did you do a "BRO mroff*" in DL6? There you'll find two files: Mroff.ar and Mroff2.ar. The latter is only executable and documentation, if that's all you need. Pete There is 1 Reply. #: 9044 S3/Languages 06-Jan-91 17:12:40 Sb: #9020-#Not a hot topic Fm: Paul Rinear 73757,1413 To: Pete Lyall 76703,4230 (X) Thanks, and sorry for being rude It was one of those days. There is 1 Reply. #: 9047 S3/Languages 06-Jan-91 18:09:22 Sb: #9044-Not a hot topic Fm: Pete Lyall 76703,4230 To: Paul Rinear 73757,1413 (X) No problem. #: 9043 S3/Languages 06-Jan-91 16:34:41 Sb: #'C' help Fm: Jim Peasley 72726,1153 To: All Got a question and I don't know whether it's related to the way OS-9 does redirection, or whether it's related to 'C'. Any input welcome! I'm developing a 'C' program that uses cursor positioning calls, and running it from the active window, it works just fine. However, when redirecting it to another window, even before starting a shell on the non-active window, the cursor positioning code seems to generate a LF rather than aligning the text in the proper column... i.e. all the text that is supposed to be tabular is at the left side of the screen! I'm using Bruce's window descriptors (they're all the same) and it exhibits the same behavior whether the window is hardware or gfx, type 07 or type 02. Anybody know what's going on here? Thanks, ...Jim There are 3 Replies. #: 9045 S3/Languages 06-Jan-91 18:07:16 Sb: #9043-#'C' help Fm: James Jones 76257,562 To: Jim Peasley 72726,1153 (X) Hmmm...sounds like somehow you're emitting a CR there, and if that is done using I$Writeln instead of I$Write, and the path descriptor has the option set to cause CRs to be followed by LFs, then that could happen. Could you post a code fragment to show what is happening? (Don't forget the SU (save unformatted) when you do that.) There is 1 Reply. #: 9057 S3/Languages 08-Jan-91 00:31:56 Sb: #9045-#'C' help Fm: Jim Peasley 72726,1153 To: James Jones 76257,562 (X) JJ; Originally, I had a \n after printing the date and name strings due to the difference in the way DOS and OS-9 handle flushing the buffer. With the newline, all the data is positioned at the left side of the screen -- only when redirecting. I have since added a fflush(stdout); statement after the name and date, and again, in an active window, things work fine, but redirecting causes the cursor positioning to get "eaten" and the following data is positioned right after the name string. -------- code fragment from pgm. ---------- #define CURSOR pos_cur ... ... CURSOR(1,curline); printf("%s %s",date,name); fflush(stdout); if (span > 0) { CURSOR(45,curline); printf("%2d%s %s\n",span,suff,eptr); } else { CURSOR(50,curline); printf("%s\n",eptr); } Any ideas on why redirecting stdout would cause cursor positioning to be hosed? ...Jim There is 1 Reply. #: 9060 S3/Languages 08-Jan-91 05:36:01 Sb: #9057-#'C' help Fm: James Jones 76257,562 To: Jim Peasley 72726,1153 (X) No, I can't think of any reason for redirection would do that. I lack experience with doing window-related stuff, so about all I can say is that folks have had trouble, or said they've had trouble, with situations in which they have emitted escape sequences containing CR because for some reason (if they use C standard I/O, it will happen for SCF devices) I$Writeln is used to write the data instead of I$Write, because in that case they got an extra LF. If that is what is happening to you, then the only solution I know of is to set the _RBF bit in the _flags field in the FILE structure that you're using before you do any output, since that will force it to use I$Write. This, unfortunately, also means that you'll have to explicitly emit LFs after CRs that you want to have LFs following, since SCF doesn't distinguish between CR as part of an escape sequence and other CRs (which is kind of a shame). There is 1 Reply. #: 9068 S3/Languages 08-Jan-91 22:07:36 Sb: #9060-'C' help Fm: Jim Peasley 72726,1153 To: James Jones 76257,562 (X) JJ; I guess your reply means that I'll have to go and read the manual, eh? (RTFM, if I remember my acronyms correctly ;-) ) Seriously, I'll reference your msg. while looking thru tee manual and see if I can dope out a solution. ...Jim #: 9046 S3/Languages 06-Jan-91 18:08:35 Sb: #9043-#'C' help Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - Shouldn't be C, because C doesn't evem know about I/O (technically).. Anything differen't in the descriptors? Also - do you have the CC3io patch in place? Pete There are 2 Replies. #: 9058 S3/Languages 08-Jan-91 00:32:05 Sb: #9046-#'C' help Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; All the /w descriptors are dittos. And CC3io? I _think_ that I've patched it... I usually follow patches pretty closely. (This is one of my New Year's resolutions -- to *accurately* LOG all system changes on the MM/1!) See previous msg. to JJ for code fragment and more info. re: portability Not _too_ bad, if you start with it in mind, but somewhat of a pain. I've gotten the program to run on both machines, but there's just one more thing (isn't there always?) that I'd like to change. Taking a note from your 'more' program, I'm using "read(1,keyin,1);" where "keyin[1]" to get a user response without having to press . Under DOS, I've tried "read(stdin,keyin,1);" which the manual says SHOULD work, but alas, the value returned is "\5" rather that the "y" or "n" I'm expecting. What is different about the DOS version of "read"? Any ideas? I'd kindaolike to use the same function for both versions if I could. ...Jim There are 2 Replies. #: 9061 S3/Languages 08-Jan-91 05:37:24 Sb: #9058-#'C' help Fm: James Jones 76257,562 To: Jim Peasley 72726,1153 (X) I'd be very surprised if that worked. read() wants a path number (or a "file handle" in MS-DOSese). stdin is a FILE *, and goodness knows how it will be interpreted when handed to a function wanting a path number. There are 2 Replies. #: 9069 S3/Languages 08-Jan-91 22:07:39 Sb: #9061-#'C' help Fm: Jim Peasley 72726,1153 To: James Jones 76257,562 (X) JJ; Yep, I had this pointed out to me today by another 'greenhorn'. We tried it, but still it didn't work as the OS-9 version dsd -- required hitting to accept the keystroke. ...Jim There is 1 Reply. #: 9071 S3/Languages 08-Jan-91 22:47:09 Sb: #9069-'C' help Fm: James Jones 76257,562 To: Jim Peasley 72726,1153 (X) OK...that has to do with input, rather than output. Unless you do something to make C standard I/O do otherwise, like turn off buffering or set the _RBF flag, it will use I$ReadLn on SCF paths open for input to read data. That accumulates data until it either runs out of buffer or it reads a CR (well, the EOL character for the path, but that's usually CR). #: 9081 S3/Languages 10-Jan-91 23:21:04 Sb: #9061-#'C' help Fm: Jim Peasley 72726,1153 To: James Jones 76257,562 (X) JJ; RE: your Internet message about SIMM memory What did you have to pay for the 1Meg. SIMMS? Fry's had them about a month ago for $37.50 for 1x8's and $39.50 for 1x9's and I passed them up thinking they'd go down even more.... Now they're up to $44.50 for the 1x8's. Judging from the trade rags that I get to read at work, it looks like the 4Meg. SIMM production is being ramped up both here and in Japan, and we can look for falling prices RSN. One report I saw estimated < $200 by mid-summer, but I wouldn't hold my breath given the current world situation. ...Jim There is 1 Reply. #: 9088 S3/Languages 11-Jan-91 06:53:24 Sb: #9081-#'C' help Fm: James Jones 76257,562 To: Jim Peasley 72726,1153 (X) I paid about $47 each for them, which looked pretty consistent with everything else in the issue of *Computer Shopper* I scanned. I *do* hope that you're right about the 4M SIMMs. 9 Mbytes in my MM/1 would be very nice. There is 1 Reply. #: 9100 S3/Languages 11-Jan-91 23:09:54 Sb: #9088-'C' help Fm: Jim Peasley 72726,1153 To: James Jones 76257,562 (X) JJ; > hope that you're right about the 4M SIMMs. 9 Mbytes in my MM/1 would be > very nice. Yeah, but how would you ike 128 Meg? The NewsClip forum I get these tidbits from mentions that they're (Fujitsu?) starting a pilot line for 64Meg chips with limited delivery schedules starting in 1992-93 time frame. Also mentioned frequently are unbelievable capacities for 2" floppies- in the order of > 10MB, and credit card sized removable RAM memories with like capacities. Some truly amazing things coming down the pipeline! ...Jim /exit s reply 9089 Paul; I just went through the same thing. You'll need to "make" a new version of MROFF - see my previous message to Pete. Hmmm, wonder if Mark would object if I uploaded the binary for the updated MROFF? Anybody? ...Jim #: 9063 S3/Languages 08-Jan-91 08:47:43 Sb: #9058-#'C' help Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) JIm - In DOS, best bet is getch(), which is a non-echoing single key read. Pete There are 2 Replies. #: 9070 S3/Languages 08-Jan-91 22:07:43 Sb: #9063-#'C' help Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; Hmmm.. I originally used getch() (or was it getc()? ), but the difference is that one returns an int and the other a *char. Maybe I'll try casting the result and see what happens. Wouldn't it be nice if all popular (and not so popular) systems had corresponding calls that worked alike?? ...Jim There is 1 Reply. #: 9074 S3/Languages 09-Jan-91 08:07:50 Sb: #9070-'C' help Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Getch() returns an int, which is the same as char in C. Pete #: 9082 S3/Languages 10-Jan-91 23:21:13 Sb: #9063-'C' help Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; Thanks for all the input and advice... I got the program working on both systems to my satisfaction. For all those following the thread and wondering, the program I'm working on is a C version of my DATECK.B09 program in DL10. Tim Kientzle, I think, posted a message on the Net asking for such a program during a discussion of OSK software, and I though I'd try converting it as an excercise. If anyone would like to 'beta' test it, let me know and I'll mail you the code for your comments and input. The program, generally called from Startup, checks the next 30 days for significant events like birthdays, anniversaries, etc., and will let you search by month or name. This is a learning excercise for me, so any input on additional functions or bells/whistles is solicited. Program willrrun on both OS-9 systems and PC-DOS systems. I gave my boss a copy so he could track when performance reviews and appraisals are due. (brownie points?... Nahhh!) ...Jim #: 9059 S3/Languages 08-Jan-91 00:32:13 Sb: #9046-#'C' help Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; One more unrelated question if you please... my recent "C" class finished in the 'hurry-up' mode, and we didn't get to cover MAKE. I spent the better part of Sunday downloading the latest version of CLIB, CLIBT, and CLIBDOC between teenagers and line noise. Now I'd like to print out the MAN pages using MROFF, but ahe version I've got barfs on some of the added formatting codes, so I've got to re-compile the source in the CLIBDOC file. Could you give it a quick run through for me please? I've separately compiled the 4 .c sources using cc -r prgname.c and placed the output in a RELS directory which, if I'm interpreting MAKEFILE correctly is where they're supposed to be. Trying to run MAKEFILE though gives me an error #216g Where am I going wrong? Thanks, ...Jim There is 1 Reply. #: 9064 S3/Languages 08-Jan-91 08:53:33 Sb: #9059-#'C' help Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - Running make usually requires that the Makefile be named just that (in Unix the capital is significant - is os9 it's not). The make file is a list of depenancies, and the Make program recurses down the list. Ex: foo: part1.r part2.r foo.h part1.r: part2.r: This makefile pretty much uses all defaults. That is, the .r's are implicity built from .c's. It first looks at the target (foo), and then what makes it up. It then checks the constituent parts, and sees what makes THEM up. For now, forget a RELS dir, and just put all your .r files in the current dir. Also, delete any macro relating to OBJS or RELS in the makefile. Pete There are 2 Replies. #: 9067 S3/Languages 08-Jan-91 22:07:33 Sb: #9064-'C' help Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Ahhh! Now I see the problem... I don't have the Make program!! Egads, and bosh! Will peruse the libs for same. ...Jim #: 9083 S3/Languages 10-Jan-91 23:21:18 Sb: #9064-#'C' help Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; Nabbed Tim K's MAKE and got MROFF compiled with no problems... maybe I'm getting the hang of this stuff, eh? The learning curve seems to be flattening out a bit. Also played around a bit with yours and Mark's man.c, and got an idea for the next project... integrating a 'more'-like util into 'man' and using an environment file for the input to man so that the libs don't have to be 'hard-coded'. (dreams of grandeur, tempened by inexperience!!) ...Jim There is 1 Reply. #: 9085 S3/Languages 11-Jan-91 00:41:18 Sb: #9083-#'C' help Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - Already had a MAN with 'more' in it.... Didn't it surface? Durn - I have more code buried in the binary coffers around here.... Pete There is 1 Reply. #: 9099 S3/Languages 11-Jan-91 23:09:46 Sb: #9085-'C' help Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Hmmm... dunno about an integrated version. I was talking about Mark's version that he included in CLIBDOC.AR which he had hacked for his system. That one does indeed have 'more' "in" it, but not integrated. ...Jim #: 9053 S3/Languages 07-Jan-91 06:47:48 Sb: #9043-#'C' help Fm: Bill Dickhaus 70325,523 To: Jim Peasley 72726,1153 (X) Jim, Are you using termcap, or just using the actual control codes? Bill There are 2 Replies. #: 9066 S3/Languages 08-Jan-91 21:35:14 Sb: #9053-'C' help Fm: Jim Peasley 72726,1153 To: Bill Dickhaus 70325,523 (X) Bill; I don know nuttin' about no stinkin' termcaps! ;-) I'm using the cursor positioning routine "pos_cur" that I found in screen.h. It works fine as long as I don't try to redirect output to another window. I can run the program from /w2 and things are as they should be, but if I to /w3 and redirect back to /w2, the cursor positioning gols to he** in a handbasket. See message #9057 for more details. ...Jim #: 9084 S3/Languages 10-Jan-91 23:21:27 Sb: #9053-'C' help Fm: Jim Peasley 72726,1153 To: Bill Dickhaus 70325,523 (X) Bill; Haven't gotten into the why's yet, but playing around with different ways of calling the program, if I call it like so - dateck <>>>/w2 , it works the way it's supposed to, but only redirecting stdout, messes up the cursor positioning. This prob is on my list of rainy day things to do, but after 5 rainless years, it may be a while! (that's a dry gryn) ...Jim #: 9103 S3/Languages 12-Jan-91 11:49:02 Sb: #9082-#'C' help Fm: Steve Wegert 76703,4255 To: Jim Peasley 72726,1153 (X) Jim, I use your Basic09 version regularly. I'd be happy to test your C version. Steve There is 1 Reply. #: 9118 S3/Languages 13-Jan-91 20:35:14 Sb: #9103-#'C' help Fm: Jim Peasley 72726,1153 To: Steve Wegert 76703,4255 (X) Steve; O.K., you got it. I'll upload it to DL10, I guess, marked for your use only. Since you're using the Basic09 version, it'll use the same file, so I'll just upload the source, as I know you've got the compiler also. Command line options are "+", "?", month N, or namestring. There's a bit of sanity checking for date input and I find that for annual recurring events such as Christmas which always fall on the same date, entering the year as "00" saves having to change it annually. Maybe someone reading this knows the rules for figuring when dates such as Thanksgiving, Easter, etc. fall -- I think I _used_ to know, but have forgotten. Might be an idea to incorporate some date calcs for such holidays in the program. While I've got you, if I wanted to send it to someone other tha a sysop, I'd have to use Email, but not having done it before, I'm not sure of the procedure... do I just type UPL at the compose message prompt? Will this work for binaries also? And what's the maxsize? ...Jim There is 1 Reply. #: 9129 S3/Languages 14-Jan-91 08:28:09 Sb: #9118-#'C' help Fm: Steve Wegert 76703,4255 To: Jim Peasley 72726,1153 (X) Jim, Thanks for the file. I see the gents here have flagged it for me. I'll nab it directly and give it a work out. Regarding the use of CompuServe mail via the forum ... It a lead pipe cinch. Create a message any way you're comfortable ... and jes, you can type UPL at the MESSAGE prompt and upload your efforts via protocol. Instead of SAVEing the message type MAIL and it will prmpt you for an address. Now ... a couple of cautions: Mailing via the forum may be limited to ASCII files only (Not sure .. I"ll have to check. Other limitations will make this a non-issue, however). You're limited to a 'message' length in file size ... apprx 2K. You'd be better served going to CompuServe Mail and uploading the the thing. Once it's uploaded, you have some neat options as 'send to multiple users' that may be helpful in a use like this. Over there ... the file size limits are more forgiving. On a text transfer it's 50,000 . Binaries can go up to 512,000. Help any? There is 1 Reply. #: 9148 S3/Languages 15-Jan-91 00:19:26 Sb: #9129-#'C' help Fm: Jim Peasley 72726,1153 To: Steve Wegert 76703,4255 (X) Steve; While you're playing with the program, I'm not sure how much 'C' experience you have, but I'd appreciate some feedback on my coding style - readability, commenting level, etc. I'm not too thrilled with the ANSI recommendation on style, and have tried to format the source to be as "readable" as possible; i.e. indentation levels, braces underneath one another, etc.. Also, input on use of #defines, macros, and function calls would be appreciated. 'C' isn't all that difficult if the original programmer wants to make his/her programs understandable, imho. That's what I'm striving for. ...Jim There is 1 Reply. #: 9154 S3/Languages 15-Jan-91 08:02:28 Sb: #9148-'C' help Fm: Steve Wegert 76703,4255 To: Jim Peasley 72726,1153 (X) How much C experience do I have ??? My usual level of expertise .... just enough to be dangerous! :-) Actually .. I'm working steadily at understanding C code. Sounds as if your programming goals should make this a snap. Steve #: 9208 S3/Languages 20-Jan-91 11:13:23 Sb: #9103-#'C' help Fm: Steve Wegert 76703,4255 To: [F] Jim 72726,1153 (X) Jim, I've had a quick chance to play with the C version of dateck and have run up against some concerns with what I'm sure you've considered as improvements. Having to go hunting for screen.h tipped me off to some impending problems. Looks like you're supporting CoCo specific screen control. Doesn't look veddy pretty on my Wyse 50. :-) The BASIC09 version was a straight ASCII version ... jes? Also ... it looks as if you've limited it's use to a single dates.file. I have my system set up for dial up use and support a hand full of users... some of which maintain their own dates.file. Any chance of changing that back? Would make multi-user life better. Steve There is 1 Reply. #: 9244 S3/Languages 22-Jan-91 23:01:49 Sb: #9208-#'C' help Fm: Jim Peasley 72726,1153 To: Steve Wegert 76703,4255 (X) Steve; re: Multi-users Did you modify the original B09 source to allow multiple users? I just checked my latest source, and it's exactly the same as the C version. Are you saying that the program needs to look at the userid and select the relevant file depending on UID? I'm kinda in the dark on this one, as both the C and B09 source call for the dates.file to be in /DD/SYS... i.e. no provision for multi-dates.files. re: screen control Yeah, the B09 version used TABs to position the cursor, and in C, I opted to go with the rudimentary calls in SCREEN.H. What happens on the WYSE? and more importantly, can you point me to some generic C calls for positioning the next output to be at a certain column/row? I could do a little calculating of the name field and write say, 60 - n blanks, but I was hoping to eliminate that sort of stuff. Appreciate the feedback! ...Jim There are 3 Replies. #: 9249 S3/Languages 22-Jan-91 23:56:48 Sb: #9244-#'C' help Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 (X) Jim - Regarding multiple users... best technique (unix apps do this) is get the user's ID, and then use that to do a getpwuid() [forget if that's exactly what it's called... see the password(3) function of the Clib docs]. That will return a pointer to a structure that is the user's password file entry broken down. One of the members of the structure is a pointer to a string that is the name of that user's home [login] directory. Once you know that, your program can chd() there, and then open the dateck data file. This way, every user inherently gets access to his own file, and the program is automatically multi-user. Re: independent screen positioning... you just discovered what termcap is for. Termcap allows you to make generic calls that are used to manipulate any terminal that's being used (assming it has been defined by an entry in the /dd/sys/termcap file, and you know the name of the terminal the user is using. Pop over to DL3 and snag the two man pages discussing termcap that I recently uploaded. I'll be happy to answer questions after that. Consider it an investment in the future too, as OSK uses termcap too. Pete There is 1 Reply. #: 9272 S3/Languages 25-Jan-91 00:31:31 Sb: #9249-#'C' help Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; re: multi-users and getuid() Dunno if I want to get this esoteric in a pgm. that I'd like to keep as MS-DOS compatible as possible. The problem thbt Steve's having is because I changed the file pointer to look specifically in the /dd/sys directory from the original B09 program. Did this during a cleanup of my root dir. Will play around with it tho, and see what I can come up with. re: termcap related screen positioning Will go snarf the files now. Sounds like just what I was looking for. More than likely will be back with questions later...! Thanks, ...Jim There is 1 Reply. #: 9275 S3/Languages 25-Jan-91 11:47:57 Sb: #9272-'C' help Fm: Pete Lyall 76703,4230 To: Jim Peasley 72726,1153 Esoteric? Consider it a stylistic issue, and one that will prep you for other work under both OSK and Unix. It's still up to you, of course.... Also - there's always: #ifdef MSDOS ...blah blah... #else PWENT = getpwuid(getuid()); ... #endif Pete #: 9252 S3/Languages 23-Jan-91 06:20:11 Sb: #9244-#'C' help Fm: Steve Wegert 76703,4255 To: Jim Peasley 72726,1153 (X) Ack Just hate when that happens. Nope ... I don't recall modifying the BASIC09 source at all. I'll check to be sure, but the version I'm running looks for dates.file in the currect data directory. With the public execute bit set on the module, and it looking to the current data directory for dates.file, it handily supports multiple user use. On the screen control issh ... I see the date screen report all scrunched to the left of the tube, each line with a couple of stray ascii charcters leading and trailing. I'll see if I can't upload an example. Steve There is 1 Reply. #: 9273 S3/Languages 25-Jan-91 00:31:40 Sb: #9252-'C' help Fm: Jim Peasley 72726,1153 To: Steve Wegert 76703,4255 Steve; Ahh... looking at the original AR file, you're right... I did modify my copy to specifically look in the /dd/sys directory during a cleanup of my root dir. You can easilt modify the C source to emulate the B09 program by just deleting the "/dd/sys" portion of the INFILE def. That way your users will have access to their own dates.file in their OWN data dir. re: messed up output on the WYSE I'm going after Pete's termcap files right now, and will see what I can do to make it a bit less machine specific. In the meantime, if you wished you could do something like : s_len = strlen(name); for (pos = 0; pos <= (54 - s_len); ++pos) fputs (x20,1); /* not too sure on this.. haven't tried it */ in place of the CURSOR(x,y); statements. Don't have a clue where the stray ASCII chars are coming from. Will get back to you after perusing the Termcap stuff. ...Jim #: 9254 S3/Languages 23-Jan-91 06:43:23 Sb: #9244-'C' help Fm: Steve Wegert 76703,4255 To: Jim Peasley 72726,1153 (X) Ok ... took a peek at my copy of the B09 source for version 1.2 (12/2/89) and saw that filenam="dates.file". No reference to /dd/sys at all. Perhaps you have changed that in a later version. I was able to redirect standard out and err to a file and capture the output of dateck that I see on my Wyse 50 (well almost ... there's a couple of screen control characters missing at the begining of the date hit lines, but you'll get the picture). Capture follows: <<>> !%Today is February 23, 91 Searching 02/23 to 03/25 : 02/28 Ash WednesdayM%!& 1st 03/17 St. Patrick's DayM& 1st <<>> I had to change the ^B's to to keep the CIS editor from sending me to Mars, but you get the general drift. I see Pete's already pointed you to termcap, so 'nuff said there. Steve #: 9245 S3/Languages 22-Jan-91 23:02:28 Sb: #ASM code Fm: Jim Peasley 72726,1153 To: Any HP users Anybody have any experience with ASM on the HP-9000? I'm in a 68000 ASM class with about 50 other students, and needless to say, the lab instructor's time is at a premium. What I'm looking for is the cmds to asm and link my source file to produce an executable. I can get it to asm O.K., but can't get it to link with the externs to produce runnable code. Any input welcome!!! (gotta use the HP until my MM/1 arrives!) ..Jim There is 1 Reply. #: 9251 S3/Languages 23-Jan-91 03:41:31 Sb: #9245-ASM code Fm: Kevin Darling (UG Pres) 76703,4227 To: Jim Peasley 72726,1153 (X) Jim - I'd suggest a quick question in the HP forum (go hp)... luck! #: 9280 S3/Languages 25-Jan-91 21:59:14 Sb: #9273-#'C' help Fm: Steve Wegert 76703,4255 To: Jim Peasley 72726,1153 (X) Thanks for the tips, Jim. I'll try and diddle this weekend. Steve There are 2 Replies. #: 9284 S3/Languages 25-Jan-91 23:07:24 Sb: #9280-'C' help Fm: Jim Peasley 72726,1153 To: Steve Wegert 76703,4255 (X) I'll be interested to hear how it comes out. I'd try it myself, but it looks as though this wkend is already eaten up... Homework tonight, class tomorrow 8-1, & the rest of Sat. and Sun. I've gotta replace a patio door - frame and all. Then there's always the Superbowl, although I might miss it seeing as how the 49ers aren't playing! ...Jim #: 9301 S3/Languages 27-Jan-91 18:29:04 Sb: #9280-#'C' help Fm: Jim Peasley 72726,1153 To: Steve Wegert 76703,4255 (X) Steve; I got a chance to play around with the pgm. a bit today, and got it to print in a tabular fashion without using pos_cur. I eliminated the CURSOR calls in the print_event function, but haven't had a chance to remove them from the add_event function yet. Just uploaded the source to DL10, marked for you. Let me know if this solves your "garbaged-up" output on the WYSE. ...Jim There is 1 Reply. #: 9311 S3/Languages 28-Jan-91 22:00:36 Sb: #9301-#'C' help Fm: Steve Wegert 76703,4255 To: Jim Peasley 72726,1153 (X) Jim, Had a few minutes to test out the new source. Your changes did eliminate the cursor control characters I was seeing ... as well as your change to the path for dates.files again allows multiple users their own dates.file. However ... I'm now seeing a '1st' in the type of event field, if there's nothing normally there. For instance, a run of dateck brings up Ash Wednesday. There's nothing special suposed to be in the type of event field, yet I see a '1st'. I'm also seeing something wierd with todays date ... the year seems to be munged. Popping the source into my handy editor and searching for '1st', I get one hit. A comment line in some code testing for the 1st. Nowhere else. Can't for the life of me see how that's getting printed, tho. Thoughts? Today is February 28, 91 Searching 12/01 to 12/31 : 12/12 Hanukkah 1st 12/25 Christmas 1st 12/10 Steve's Birthday 34th Birthday There is 1 Reply. #: 9332 S3/Languages 29-Jan-91 23:23:14 Sb: #9311-#'C' help Fm: Jim Peasley 72726,1153 To: Steve Wegert 76703,4255 (X) Steve; Glad to hear that we can do away with the pos_cur(x,y) stuff... now all I need to do is figure out how to position the input fields in the add_event function! Maybe this weekend. > However ... I'm now seeing a '1st' in the type of event field, if there's > nothing normally there. For instance, a run of dateck brings up Ash > Wednesday. There's nothing special suposed to be in the type of event > field, yet I see a '1st'. > I'm also seeing something wierd with todays date ... the year seems to > be munged. The 1st that you're seeing is due to the fact that I changed the logic a bit to not display a year span for annually recurring events like Christmas, etc. By setting the year field for such dates to 00, no year span gets printed. However... for events such as Ash Wednesday, Easter, Thanksgiving, etc. that do not fall on the same date each year, it's necessary to manually edit the dates.file to re-set these dates to the current day/year. At some point, I'd like ts incorporate a way to dynamically calculate these dates, but I don't remember how most of them are calculated. Labor Day I know, but not the rest of them! Anyone??? > I'm also seeing something wierd with ttdays date ... the year seems to > be munged. What version of the Kreider libs do you have? I remember a message from someone saying that the localtime() function was fixed? in the 12/10/90 release - that's what I'm using. ...Jim p.s. You share the same B'day as our oldest daughter. (19 this year) There is 1 Reply. #: 9334 S3/Languages 30-Jan-91 08:00:39 Sb: #9332-'C' help Fm: Steve Wegert 76703,4255 To: Jim Peasley 72726,1153 Ahh ... editing the date's file is an easy task. I might be a release behind on the Kreider libs ... I'll go fetch and recompile. Steve #: 9283 S3/Languages 25-Jan-91 23:07:20 Sb: #9275-'C' help Fm: Jim Peasley 72726,1153 To: Pete Lyall 76703,4230 (X) Pete; .. I guess you're right - mumble,mumble. Still, I had never heard of termcaps until STERM v1.3, and can't think of any other OS-9 pgms that use them. I DO see the value tho. Guess I'm just going thru an input overload at the present time! Got your 2 files from DL3 last night, but after printing out CLIBDOC, I need to get some more ribbons before getting into them. ...Jim #: 9495 S3/Languages 14-Feb-91 01:13:52 Sb: #'C' fopen help Fm: SCOTT HOWELL 70270,641 To: all Why does'nt Microware 'C' have a binary attribute for opening files. For example Turbo 'C' has ...fopen("scott","wb") while Microware 'C' has only ...fopen("scott","w"). There are 3 Replies. #: 9497 S3/Languages 14-Feb-91 05:13:10 Sb: #9495-'C' fopen help Fm: James Jones 76257,562 To: SCOTT HOWELL 70270,641 (X) It doesn't have it because the binary attribute is an ANSIism more recent than the version of fopen() in the library. You won't find it in many Unix versions of fopen(), for that matter, because the main reason it's there is to let systems that have CRLF as line terminator do appropriate translation so that to C programs, lines appear to end with the single character represented by '\n'. #: 9500 S3/Languages 14-Feb-91 10:04:50 Sb: #9495-'C' fopen help Fm: Pete Lyall 76703,4230 To: SCOTT HOWELL 70270,641 (X) Scott - All files in OS9 are inherently opened in 'binary' mode. That 'wb', 'rb' stuff is a DOS'ism. Pete #: 9512 S3/Languages 15-Feb-91 05:35:37 Sb: #9495-'C' fopen help Fm: Bill Dickhaus 70325,523 To: SCOTT HOWELL 70270,641 (X) Microware 'C' was written to follow the K&R "standard", which doesn't include the "wb" mode. Even so, with OS9 the two modes would be equivalent. What really differentiates between "text" and "binary" mode is the type of read and/or the path options, not the open. Bill #: 9498 S3/Languages 14-Feb-91 06:38:28 Sb: #R.S.B. Query Fm: Ches Looney 73016,1336 To: R.S.B. Users A question for users of R.S.B. Should I be able to use binary programs with R.S.B.? I have been able to transfer RS basic programs to OS9 files and use them with R.S.B. successfully; however, I have been unable to use machine language (binary) programs. Such programs may get to a first screen and lock up or may not even get to a visible first step before locking up OS9 so that a cold start is required. I have sent electronic mail to Chris Burke; does he still check in to CIS? Any ideas?? Thanks, Ches. There is 1 Reply. #: 9501 S3/Languages 14-Feb-91 13:15:27 Sb: #9498-#R.S.B. Query Fm: Kevin Darling 76703,4227 To: Ches Looney 73016,1336 (X) Ches - almost all binary programs would probably fail to run, I should think. They may depend upon ROM routines being at a certain place, or diddle the GIME directly (very likely), and so on. Someone did claim that they'd run Mikeyterm under RSB tho. There is 1 Reply. #: 9502 S3/Languages 14-Feb-91 14:35:27 Sb: #9501-R.S.B. Query Fm: Ches Looney 73016,1336 To: Kevin Darling 76703,4227 (X) Interesting, Les said that the current release of LYRA had been coded to work on a hard disk with R.S.B. Maybe he can point me in the right direction next time he checks in - I've left him a message on CoCo Forum. Your comments on ROM routine location dependency seconded my intuitive suspicion; however, LYRA and Shanghai load and run OK on Owlware Basic buggered to work thru OS9 files on the hard disk. But thats still operating from RS Basic as the home-base where I gather R.S.B. is totally moved into RAM in non-specific locations. Maybe LYRA runs under some very specific arrangements of modules with R.S.B. Thanks for the response. Ches. #: 9534 S3/Languages 16-Feb-91 17:33:10 Sb: #the **p syntax in 'C' Fm: SCOTT HOWELL 70270,641 To: all I have seen this syntax infrequently in college 'C' text and in source code, but I have yet found a good explaination. It is in reference to pointers and I beleieve it is called 'double indirection'??? the syntax is char **p = & dummy or char **match(p,name) What does the ** actually say There are 2 Replies. #: 9538 S3/Languages 17-Feb-91 00:35:53 Sb: #9534-the **p syntax in 'C' Fm: Sandy Tipper 72060,76 To: SCOTT HOWELL 70270,641 (X) Actually, it means two different but related things, depending on where you find it. In both of your examples, it was in a declaration statement, (the first was complicated bu the fact that it included an initialization, and the second was the declaration of a function). the simplest example of this type is : char **p; This is a declaration of the variable p. The first (RIGHTmost) asterisk means that p is a pointer. Fair enough, but a pointer to what? The second asterisk tells us that the what is a pointer itself. So p is a pointer to a pointer. But what is the pointer that p is pointing to pointing at? A char. So p is a pointer to a pointer to char. In your example, the initialization is of p, setting up p to contain the address of a variable (p points to that variable). That variable had better be a pointer to char. Later in the code, after the definitions and declarations have been all done, the asterisk has a different meaning altogether: instead of explaining what the variable being declared is, it is an operator, "doing" something to the expression it is operating on. If i is an int, and p is a pointer to int, and pp is a pointer to pointer to int, then follow this: i = 4; p = &i; pp = &p; Question: what is **pp ? First, read it as *(*pp) So pp is pointing to p, so *pp evaluates as equivalent to p. And p is pointing to i, so *p evaluates as equivalent to i. So **pp is equivalent to i. So **pp is 4. See? Sandy #: 9539 S3/Languages 17-Feb-91 11:44:39 Sb: #9534-the **p syntax in 'C' Fm: Pete Lyall 76703,4230 To: SCOTT HOWELL 70270,641 (X) Scott - char **p = &dummy; Says: p is a pointer to a pointer that points to a char type. The &dummy says assign the address of dummy (i.e. a pointer) to that slot. Typically double indirects are used with arrays of pointer, like **argv for instance. The 'char **match(p,name) says that match is a function that returns a pointer to a pointer to a type of char. Pete #: 9837 S3/Languages 17-Mar-91 10:51:59 Sb: #termcap.l docs? Fm: Ken Drexler 75126,3427 To: Pete Lyall Pete, I am trying to write a terminal independent clearscreen function in c and want to use your termcap library from Mark Griffith's sterm package. I have grabbed the unix termcap manual posted here but it does not have the special functions you added to get around the lack of an environment under 6809/OS9. Also from reading sterm.c, the parameters for each function do not seem to correspond to the unix manual page. Have you posted the documents for your version of the tercap.l or a header file for use with it? If so, where should I look? Thanks for the help. Ken There is 1 Reply. #: 9855 S3/Languages 18-Mar-91 11:23:49 Sb: #9837-termcap.l docs? Fm: Pete Lyall 76703,4230 To: Ken Drexler 75126,3427 Ken - As far as the termcap.l stuff, the biggest thing that changes is that if you don't allocate a buffer for the tgetent() function, you may use a NULL and a buffer will be auto-allocated for you. I used it this way for convenience, but there may be some memory allocation bugs. Simmy Turner took to just allocating the buffers manually. As far as the ttytype file, see the 'update' command, if it's here. My 6809 stuff is offline, but I could get to it if you have no other paths. Essentially, the ttytype file looks like this: [+|-|@]devname crttype There may be multiple lines, one per device. The syntax is: + = enabled local terminal @ = enabled modem based terminal - = disabled terminal ..WHOOPS! I just realized I'm combining two descriptions here! One is the 'ttylist' file associated with Mtsmon, and the other is ttytype.. sorry! The layout is just: /devname crt_type /t2 vt100 /w1 coco3 /t3 wyse50 etc. The file may be in /dd/sys or /r0/sys (latter is faster), and is manipulated with a utility I called 'ttyset', which should be in DL9. Sorry about the confusion, and toggle me if you need to be further confused! Pete #: 9902 S3/Languages 23-Mar-91 00:04:05 Sb: #C Problem Fm: Robert DeBolt 76417,2225 To: ALL Hi! I have been tinkering with an experimental interpreter (written in C) of an object-oriented "Forth-like" language I call "XX". It now only handles longs and doubles. In checking out the arithmetic operators, I found the following anomaly: -100 / -5 = -20 ??? Here is a sample program to prove my point: /* Module: testlong.c */ #include main() { long x,y,q; x = -100L; y = -5L; q = x/y; pflinit(); printf("x/y=%ld/%ld=%ld\n",x,y,q); } The printed result is: x/y=-100/-5=-20 Is this a compiler bug, or am I missing something about integer division? What would be the best solution to work arounr it? if (x<0L && y<0L) q = -x/y; else q = x/y; Maybe? Thanks, Bob. list type There is 1 Reply. #: 9904 S3/Languages 23-Mar-91 00:50:40 Sb: #9902-#C Problem Fm: Pete Lyall 76703,4230 To: Robert DeBolt 76417,2225 (X) Bob - Hadn't seen that problem before..... are you using the Kreider libraries in DL3? If not, grab clib.l and clibt.l there, recompile, and let us know how you fare. Lots of bugs were fixed when Carl re-did the libraries. Pete There is 1 Reply. #: 9908 S3/Languages 23-Mar-91 08:46:21 Sb: #9904-C Problem Fm: Robert DeBolt 76417,2225 To: Pete Lyall 76703,4230 (X) Pete, Yup. DL'd clibt.ar dated 90/12/07. Problem is still there. Bob #: 9903 S3/Languages 23-Mar-91 00:27:16 Sb: #9855-#termcap.l docs? Fm: Ken Drexler 75126,3427 To: Pete Lyall 76703,4230 (X) Pete, Thanks for the information. It was the 0 for the buffer address in particular that had me confused. With that clarification, the termcap docs posted here may do the job. Ken There is 1 Reply. #: 9905 S3/Languages 23-Mar-91 00:51:29 Sb: #9903-#termcap.l docs? Fm: Pete Lyall 76703,4230 To: Ken Drexler 75126,3427 (X) Bueno.... the termcap docs were ..uh.. lifted directly from 4.3BSD. Pete There is 1 Reply. #: 10050 S3/Languages 30-Mar-91 00:23:54 Sb: #9905-termcap.l docs? Fm: Ken Drexler 75126,3427 To: Pete Lyall 76703,4230 (X) Pete, Thanks for the further note. Since getting on last weekend, I have written a manual page for your crtbypth and crtbynam functions and taken a shot at a termcap.h. I am not satisified with the latter (i.e. it does not lead to graceful compiles) and am reworking it. When I get them all smoothed out I will upload them for what ever use they might be. Ken #: 10123 S3/Languages 05-Apr-91 18:04:45 Sb: #CLIB.L Bug? Fm: Hugo Bueno 71211,3662 To: All I think I've found a bug in the latest Kreider library. Using the program below, I get a wrong result of Fri Mar 5 18:59:20 1991 even though today is April 5th. #include #include main() { long curr_time; curr_time = time((long *)0); puts(ctime(&curr_time)); } The version of the lib that I'm using is 30,575 bytes long and was created 12/7/90 (I think). Have there been any updates since then? There is 1 Reply. #: 10128 S3/Languages 05-Apr-91 23:51:12 Sb: #10123-CLIB.L Bug? Fm: Pete Lyall 76703,4230 To: Hugo Bueno 71211,3662 (X) There was a problem that Carl worked on regarding a month index being off by one. Perhaps when he fixed it, he broke other functions that used it (cringe). Try Carl directly at 71076,76. Pete #: 10132 S3/Languages 06-Apr-91 06:48:27 Sb: clib bug Fm: Hugo Bueno 71211,3662 To: 71076,76 Carl, Please see my message 10123 for a bug report on your latest clib.l. Hugo #: 10169 S3/Languages 08-Apr-91 14:34:12 Sb: #Unknown Procedures Fm: Erich Schulman 75140,3175 To: ALL I downloaded a Basic09 file from this forum using Mikeyterm 4.7 in the CAPT protocol. I TRSCOPYed it to OS-9 and set the attributes. The program loaded. When I ran it, I got ERROR 043. It didn't like SHELL "cls". From edit, I c*/cls/display c and retried. OK until the program asked me to confirm my inputs. I got another ERROR 043, this time for the RUN inkey(confirm).How do I make inkey available to Basic09? And for once I am able to writing Basic09, is there a way I can test for availability of a needed module so that my programs won't have to crash that way?a There is 1 Reply. #: 10172 S3/Languages 08-Apr-91 15:44:35 Sb: #10169-#Unknown Procedures Fm: Pete Lyall 76703,4230 To: Erich Schulman 75140,3175 (X) Erich - The ERROR 43 says 'cannot find the module' essentially. In the 1st case, you didn't have a CLS program. In the second case, it appears that it couldn't find the 'inkey' code in your execution directory. Is it there, and are the attributes set to allow its execution? Another easy (and somewhat speedier) technique is to merge a copy of the Inkey routine onto the end of the packed module (once you have packed it, that is). As far as availability, one method might be to use the SYSCALL module to effect a F$Link to see if a module were in memory. Proper methodology dictates that you'd also have to do a corresponding F$unlink to bring the link count back to normal. Pete There are 2 Replies. #: 10173 S3/Languages 08-Apr-91 15:44:58 Sb: #10172-Unknown Procedures Fm: Pete Lyall 76703,4230 To: Pete Lyall 76703,4230 (X) Hmmm... make MODULE = Procedure. #: 10181 S3/Languages 09-Apr-91 03:40:31 Sb: #10172-#Unknown Procedures Fm: Erich Schulman 75140,3175 To: Pete Lyall 76703,4230 (X) I know inkey was on the same disk. I think it was in the execution dir. I never set its attributes (I thought RS would make all their programs executable, but I have already found that to be not so). I'll see how that goes. Then I'll try again with merging. At least I've made it this far! There is 1 Reply. #: 10184 S3/Languages 09-Apr-91 08:57:14 Sb: #10181-#Unknown Procedures Fm: Pete Lyall 76703,4230 To: Erich Schulman 75140,3175 (X) Erich - Keep plugging... I'm sure you're almost there. Pete There is 1 Reply. #: 10206 S3/Languages 11-Apr-91 08:47:03 Sb: #10184-Unknown Procedures Fm: Erich Schulman 75140,3175 To: Pete Lyall 76703,4230 (X) inkey was executable already. Perhaps my biggest Basic09 problem is that all of my Basic09 disks have so little available space (26 free sectors each, I believe). #: 10223 S3/Languages 12-Apr-91 09:29:36 Sb: #9908-C Problem Fm: Carl Kreider 71076,76 To: Robert DeBolt 76417,2225 (X) The long divide bug you found is very old indeed. It exists in the origional Microware library. I will fix it in mine before I upload the next version of the library. In the meantime, at offset $617d is 6c 01 in clib.l or offset $7d02 is 6c 01 in clibt.l change that to 63 01 Carl #: 10224 S3/Languages 12-Apr-91 09:30:16 Sb: #10132-#clib bug Fm: Carl Kreider 71076,76 To: Hugo Bueno 71211,3662 (X) Ah, the fruits of haste.... I fixed an off by one bug in localtime() last December, which, since ctime() calls localtime() broke ctime(). I neither looked at it or thought about it. So, here is the deal.. at offset $14c5 is 83 00 01 in both clib.l and clibt.l change that to 12 12 12 and the problem will go away. Sorry to one and all. And tell anybody else you know. I will put up a fresh copy when I look at the math problem Bob DeBolt found. Carl There are 2 Replies. #: 10227 S3/Languages 12-Apr-91 17:23:56 Sb: #10224-clib bug Fm: Hugo Bueno 71211,3662 To: Carl Kreider 71076,76 (X) Thanks very much for your reply and bugfix for clib.l. Your work is much appreciated! Hugo #: 10276 S3/Languages 15-Apr-91 02:42:24 Sb: #10224-#clib bug Fm: Paul K. Ward 73477,2004 To: Carl Kreider 71076,76 (X) Carl, Mike H. has an LHarc for your MM/1 -- if you need it, let me know. Paul IMS There is 1 Reply. #: 10278 S3/Languages 15-Apr-91 02:48:33 Sb: #10276-clib bug Fm: James Jones 76257,562 To: Paul K. Ward 73477,2004 (X) Actually, it can already be found in the 680xx DL area here, so Carl needn't hit you up for it. #: 10255 S3/Languages 14-Apr-91 08:44:28 Sb: #PACKing In Basic09 Fm: Erich Schulman 75140,3175 To: ALL I tried to PACK a Basic09 procedure, but every time I get ERROR 214 (no permission). The only permissions that are off are Directory and Single User. What does it take to PACk? There are 2 Replies. #: 10261 S3/Languages 14-Apr-91 17:28:49 Sb: #10255-PACKing In Basic09 Fm: Kevin Darling 76703,4227 To: Erich Schulman 75140,3175 (X) Erich - offhand, I might guess that you were swapping disks before doing the Pack, perhaps? Pack normally tries to go to the default exec dir disk. You can also force it: pack* >/d0/cmds/myprogram or the like. #: 10314 S3/Languages 16-Apr-91 22:39:34 Sb: #10255-#PACKing In Basic09 Fm: Jim Peasley 72726,1153 To: Erich Schulman 75140,3175 (X) Erich; Sounds like you're trying to 'PACK' a source file from the OS9> prompt. To pack a file, all one need do is 'load' it into BASIC09, and type pack a the B: prompt. This places an executable of the source in /dd/cmds with the execute permissions already set. Is this what's happening?? ...Jim There is 1 Reply. #: 10325 S3/Languages 17-Apr-91 16:32:15 Sb: #10314-#PACKing In Basic09 Fm: Erich Schulman 75140,3175 To: Jim Peasley 72726,1153 (X) I was in Basic09. The first reply (disk switching) seems to have the answer. Under OS-9, I have to do a ***lot*** of disk switching. Just two OS-9 configurations and making MultiVue bootable alone required a total of 500-600 disk insertions. There are 2 Replies. #: 10326 S3/Languages 17-Apr-91 20:48:27 Sb: #10325-#PACKing In Basic09 Fm: Robert A. Hengstebeck 76417,2751 To: Erich Schulman 75140,3175 (X) You might want to consider getting a second drive. If you have either the FD501 or FD502 drive from Tandy, you can put a used $25 - $45 360K 1/2 height IBM compatable drive in there. I have a FD501 setup in which I removed the original single sided drive, and replaced it with a 720K and a 360K disk drives. I use the 360K drive as drive /d0, and the 720K as drive /d1. This in combination with the LR Tech 40Meg HD as /H0 makes for a beautiful set. This sure beats disk swapping anytime. There is 1 Reply. #: 10330 S3/Languages 17-Apr-91 21:56:47 Sb: #10326-#PACKing In Basic09 Fm: Erich Schulman 75140,3175 To: Robert A. Hengstebeck 76417,2751 (X) I am not going to =consider= getting a second drive: I am **going** to get a second drive! I wasn't on OS-9 for 10 minutes before realizing the need for it. It is at the top of my hardware purchase list. I have been wondering about using a IBM PC drive, it would sure save $$$. I have the FD-502. For a PC's drive, would any advance preparation be needed to make it work on the COCO3? And how would I need to (if at all) modify the instructions for installing a 2nd drive that appear in the manual that accompanied the FD502? How about a 1.2Mb 5.25" PC drive? I have more than a few such PC disks, and I would like to transfer their data to DECB and/or OS-9 once I have a transfer utility. If I got a dime for every time I've had to switch disks I could pay off the national debt:-). I know I will miss diskswapping as much as I miss CLOADing/CSAVEing and now reading 80 columns on a regular TV set. There are 3 Replies. #: 10333 S3/Languages 17-Apr-91 23:45:30 Sb: #10330-#PACKing In Basic09 Fm: Stephen Hamilton 71570,1546 To: Erich Schulman 75140,3175 (X) Erich, I have another bit of help for you also that may be of some intrest. Depending on your set up, you should be able to use you 502 as a double sided drive under OS9. Although this wont solve all your problems, it will allow you to at least have BASIC09 on the same disk as your other OS9 directories, ie. CMDS, SYS, OS9BOOT. If you have DMODE, it's a big help in pulling this off As far as adding an IBM drive, it shouldn't be any problem, make sure the jumpers in the drive are set right. Also, be sure and check the controler ribbon conectors. These may have to be changed as TANDY decided to leave out a few pins on some of them making accessing side two immpossible. Back to the original subject. DMODE will change your drive configuration for you while using that drive. The easiest way to do this is to type DMODE /d0 sid=2. Then FORMAT /d1 a new disk. It will be double sided. Put your original disk back in and run CONFIG. Your new boot that will be on your new disk will cointain the double sided drive module. Then DSAVE /d0 /d0 ! SHELL. This will copy the filess from your single sided disk to your double sided one. Do the same DSAVE again with the BASIC09 disk. All you OS9 directories are now on one disk, this should help out with BASIC09 problem as well as saving some trouble. Give me a call back and let me know how it turns out. Steve Hamilton 71570,1546 There is 1 Reply. #: 10381 S3/Languages 21-Apr-91 22:17:34 Sb: #10333-#PACKing In Basic09 Fm: Erich Schulman 75140,3175 To: Stephen Hamilton 71570,1546 (X) I tried to get the source code in DMODE.ASM into rma for assembly. What I got was a *long* list of errors scrolling up my screen which was eventually ended by ERROR 001 (unconditional abort). I used rma dmode.asm to load the assembler and the source code. Should I have added certain options? Or am I doing something else wrong? This was my first time trying to load downloaded source code. There is 1 Reply. #: 10406 S3/Languages 22-Apr-91 23:10:20 Sb: #10381-PACKing In Basic09 Fm: Stephen Hamilton 71570,1546 To: Erich Schulman 75140,3175 (X) Erich, I'm having some trouble with my RS232 right now, left amessage asking for a temporary serial OS9 Term prog on here earlier about it, so I having trouble with my uploading capability. Here's what I'll do though. If yo like, leave me your address in the E-Mail section, private, and I'll send you a disk with DMODE, WMODE, and a couple of other items thqat should help you, can probably get it to you before the weekend. Steve 71570,1546 #: 10340 S3/Languages 18-Apr-91 12:10:32 Sb: #10330-PACKing In Basic09 Fm: Robert A. Hengstebeck 76417,2751 To: Erich Schulman 75140,3175 (X) As Stephan stated, the FD502 is a 360K disk drive. Check your connectors in the case to make sure that the pins are not pulled. If they are you can make another cable using the standard connectors and 36 wire ribbon. You will have to remove two wires from one side of the ribbon. The controller for the disk drive as far as I know can only support double density disks, that is 360K or 720K. I accidently bought a 1.2 Meg disk drive and used it in my configuration, and found out that it wouldn't work. Fortunately I found another person who had a 720K drive, and swapped with him. The problem, was that the 1.2 Meg drive has a data transfer rate that is higher than the controller could handle. Maybe that problem has been resolved by now, but check here before you do it. #: 10345 S3/Languages 18-Apr-91 23:53:39 Sb: #10330-#PACKing In Basic09 Fm: Stephen Hamilton 71570,1546 To: Erich Schulman 75140,3175 (X) Erich, Just a note to my note. Try using COBBLER insted of CONFIG. COBBLER makes an exact duplicate of your OS9BOOT with any changes that you have made while online, ie. DMODE sid=2, XMODE, TMODE, etc. Then use DSAVE as previously stated. Another reason to use it is you don't have to go through all that trouble you would for CONFIG, switching disks, selecting modules, etc. If you need DMODE, I can get it for you, I'm not sure if it's in this DataBase or not (I think it's Freeware, hope I didn't just offer the wrong thing in fornt of God and the whole world .) To get the correct syntax for DMODE, just type DMODE /D1 and it will list the parameters. Hope this is some help to you, Talk to you later. Steve 71570,1546 There are 2 Replies. #: 10347 S3/Languages 19-Apr-91 14:14:26 Sb: #10345-PACKing In Basic09 Fm: Erich Schulman 75140,3175 To: Stephen Hamilton 71570,1546 (X) Ohhhhhhhh. DMODE is in a SIG. No wonder I couldn't find it in my Lvl2 manual. I was getting ready to ask you if you had the command right or if you're using Level 1, 3 or 4. I'll see if I can find it in a LIB here. As long as it is not ar'ed I can get to my OS-9 disk. I have a copy of Sterm I will use to get ar et.al. later, but I have to re-reconfig to be able to use that (cf. CoCo Forum, sec. 9). I plan on doing that tonight. #: 10348 S3/Languages 19-Apr-91 14:28:41 Sb: #10345-#PACKing In Basic09 Fm: Erich Schulman 75140,3175 To: Stephen Hamilton 71570,1546 (X) I found an ar'ed dmode which, as I said, is not usbale at present. I did find DMODE/ASM. This I did d'load since I do have the Lvl2 Dev Kit and I ought to be able to assemble the source code. There is 1 Reply. #: 10350 S3/Languages 19-Apr-91 19:12:20 Sb: #10348-#PACKing In Basic09 Fm: Stephen Hamilton 71570,1546 To: Erich Schulman 75140,3175 (X) Erich, If you have any problem with the DMODE.ASM, I'll be happy to upload my DMODE without the AR, it's fairly short so it shoudn't be too much to down load fo you. Another good one to usee is WMODE, does the same thing to your screen settings. You would be able to boot up with an 80 or 40 column screen if you desire. If I can be of any further help, just call. Steve 71570,1546 There is 1 Reply. #: 10353 S3/Languages 19-Apr-91 22:48:30 Sb: #10350-#PACKing In Basic09 Fm: Erich Schulman 75140,3175 To: Stephen Hamilton 71570,1546 (X) I found WMODE in Lib10. But it's ar'ed :-c There is 1 Reply. #: 10362 S3/Languages 20-Apr-91 10:02:10 Sb: #10353-PACKing In Basic09 Fm: Stephen Hamilton 71570,1546 To: Erich Schulman 75140,3175 (X) Erich, OK, I'll try and upload them myself here in an unarked format, get back to you in a little while. Steve 71570,1546 #: 10346 S3/Languages 19-Apr-91 00:07:00 Sb: #10325-PACKing In Basic09 Fm: Jim Peasley 72726,1153 To: Erich Schulman 75140,3175 (X) Erich; Glad to hear you got it figgered out. Yep, OS-9 and especially MV _really_ needs to be run from a Hard -isk to make it pleasurable. Might consider saving the $ towards one... they're becoming very cheap -- at least the MFM and RLL ones under 40 Meg. ...Jim #: 10467 S3/Languages 26-Apr-91 00:21:29 Sb: #Packing in Basic09 Fm: Stephen Hamilton 71570,1546 To: 75140,3175 (X) Erich, ok, your disk is on the waay to you, should get there in a couple of days, hope it helps you out some. Steve 71570,1546 There is 1 Reply. #: 10470 S3/Languages 26-Apr-91 01:00:16 Sb: #10467-Packing in Basic09 Fm: Erich Schulman 75140,3175 To: Stephen Hamilton 71570,1546 (X) Great: via these threads I am finally starting to get OS-9LII to work for me rather than the other way around. I may be getting a PC drive to add to this system as early as Tuesday. How do I get the drive connected inside the case (horizontal FD-502 system)? I want to be sure I get it right. This is not in my immediate plans, but can I support a third floppy drive? I think it would be useful for me, but I am giving higher priorities to more RAM, a faster modem, more programs, and a few other items. #: 10543 S3/Languages 01-May-91 21:30:22 Sb: #10470-Packing in Basic09 Fm: Kevin Darling 76703,4227 To: Erich Schulman 75140,3175 Erich - take apart the FD502 case, and I believe it has the second drive connector already there. The only caveat is that I believe Tandy installs a small fan when a 2nd drive is added, as the power supply in there is a little overloaded and will run very hot with both drives turning. You might consider adding an external fan on the back, or something. Oh. Tell us what jumpers are marked on the 2nd drive you get... will give us all a clue as to how you should set them. best - kev Press !> #: 10613 S3/Languages 07-May-91 22:30:16 Sb: #C-Help Fm: Brother Jeremy, CSJW 76477,142 To: All I am just starting to get into "C". I had downloaded Carl Kreiders's C Library and Mike Sweet's CGFX ver. 7. Do I replace the stock Tandy C stuff with these, or do I merge them, and if so, please tell me how. I am still at the learning point, so an Idiot's guide to C is probably what I should see, see what is I need to see for C. (I should be shot for that one.) --Thank you, Br. Jeremy, CSJW. There are 2 Replies. #: 10620 S3/Languages 08-May-91 06:14:15 Sb: #10613-C-Help Fm: Dan Robins 73007,2473 To: Brother Jeremy, CSJW 76477,142 (X) Brother, Carl's library DOES replace the current ones that came with the C Compiler. What I did, was make a backup of the original...delete Tandy's version and then pile Carl's libs in there. The CGFX library is an ADDITION (unless you have the Developer's Kit...then it would replace that version of the same type LIB). In either case....you'll make calls that the LIBs call for....and you'll utilize the LIBs when you go the LINK them in. Dan #: 10622 S3/Languages 08-May-91 09:19:39 Sb: #10613-#C-Help Fm: Pete Lyall 76703,4230 To: Brother Jeremy, CSJW 76477,142 (X) Br. J - You replace the Tandy/Microware clib.l with Carl's. Also, replace the T/MW cstart.r file as well. These will be in your ??/LIB directory. Next - run (don't walk) out and purchase a copy of the Waite Group's " "C Primer Plus". An absolutely fabulous book that is well written without being haughty or aloof, is loaded with examples to reinforce the text, and is sprinkled with humour to make the initial exposure to C bearable. After buying 6 or so other texts, it parted the clouds for me. Others have also raved about it, and I found out the local University uses it as their C text (of course, _they're_ Lutherans.. ). Pete P.S. It's worth the trauma. All of our previously 'assembler only' hacks who learned C never went back. Figure on about 30 days before the lightbulb gets to full wattage. P.P.S. A quick edit/compile/debug cycle is best for learning. Keeping as many of the compiler modules in memory, and using a RAMDISK or hard disk is optimal. We also have a replacement 'cc' command that helps facilitate this. There is 1 Reply. #: 10637 S3/Languages 09-May-91 23:02:12 Sb: #10622-C-Help Fm: Brother Jeremy, CSJW 76477,142 To: Pete Lyall 76703,4230 (X) Thank you for your advice. I know what you mean about the lightbulb. In the morning when Brother says rise and shine, I'm lucky if I can glow dimly. But I am having fun learning programming. Maybe soon I will have some good code too upload. -Br. Jeremy, CSJW. #: 10852 S3/Languages 27-May-91 19:04:20 Sb: Kreider clib Fm: Paul Rinear 73757,1413 To: Carl Kreider Carl, Here is a message you posted : #: 10869 S3/Languages 29-May-91 22:24:06 Sb: #C_Help Fm: Brother Jeremy, CSJW 76477,142 To: All OH SAY CAN YOU "C"...? Sorry I couldn't resist. I am in the process of working on a program called MVWORD. I recently uploaded a file (MVWORD.AR). I am currently working on the dialog boxes. While I am writing this in BASIC09, the current version of GFX2 does not easily allow for Dialog Boxes (radio buttons, etc..hint, hint KD?) I noted that on page 12 of ver 7 of Mike Sweets CFGX library reference, there is an example of some code for dialog box functions. At the moment I do not have access to a C compiler, but I was wondering if some one did, I you might be willing to make a small demo program using this code and upload it? In fact, if one of the C-programmer's out there would be willing to write some demo programs using the CGFX library and post both the source and the executable modules (I hope that's the correct terminology) it would be of great help to all of us struggling C programmers. Thank you for your help, Brother Jeremy, CSJW . CIS 76477,142 There are 2 Replies. #: 10876 S3/Languages 30-May-91 11:15:31 Sb: #10869-C_Help Fm: Mike Haaland 72300,1433 To: Brother Jeremy, CSJW 76477,142 (X) ~ There's quite a bit of source code (in C) in DL10 that uses CGFX.L. Grab EDPTR.AR, SKEL.AR, to name just a few... They'll get you started. Mike #: 10877 S3/Languages 30-May-91 11:15:37 Sb: #10869-#C_Help Fm: Mike Haaland 72300,1433 To: Brother Jeremy, CSJW 76477,142 (X) ~ Almost forgot, there's a good dialog box routine in EDCON.AR also. Mike There are 2 Replies. #: 10880 S3/Languages 30-May-91 23:07:29 Sb: #10877-#C_Help Fm: Brother Jeremy, CSJW 76477,142 To: Mike Haaland 72300,1433 (X) Mike it was so good to meet you at the "Fest". Thank you for your advice. I hope that before too long, I might have some real code to upload for MVWORD. --Br. Jeremy, CSJW There is 1 Reply. #: 10886 S3/Languages 31-May-91 11:11:06 Sb: #10880-#C_Help Fm: Mike Haaland 72300,1433 To: Brother Jeremy, CSJW 76477,142 (X) ~ You quite welcome! Nice to meet you at the Fest too! Did you get the C compiler yet? Or are you still looking for it? Maybe EDCON.AR is a revision without the source code? Anyway, a very simular routine IS in edptr.ar. I'm sure cause I uploaded it. Mike There is 1 Reply. #: 10888 S3/Languages 01-Jun-91 00:53:02 Sb: #10886-#C_Help Fm: Brother Jeremy, CSJW 76477,142 To: Mike Haaland 72300,1433 (X) I have the compiler. At the moment my system is set up with 2 40tr. ss drives, and 512k of memory. I have to just find a block of time when I can sit down and put a systems disk together. Of course if the Lord provides, a hard drive, 40tr. dobule sided drives, a onemeg upgrade, etc. my life would be easier. I have gathered together various hints on the compiler, so it is mainly a matter of choosing what would work best for me. Any suggestions? --Br. Jeremy, CSJW. There is 1 Reply. #: 10923 S3/Languages 03-Jun-91 19:03:53 Sb: #10888-#C_Help Fm: Mike Haaland 72300,1433 To: Brother Jeremy, CSJW 76477,142 (X) Well, Do you have Tandy Drives on your CoCo? If they are FD-502's they are double sided. You just need to make a boot with the dual sided descriptors in them and fix the drive cable. If they're FD-501's then they're single sided. Personally I like the CC.AR in DL 3 as a front end to the CoCo compiler. es /R0 for temporary files and really speeds up compiles. If you run into any Q's, just fire 'em this direction. Mike There is 1 Reply. #: 10996 S3/Languages 08-Jun-91 11:16:15 Sb: #10923-C_Help Fm: Brother Jeremy, CSJW 76477,142 To: Mike Haaland 72300,1433 (X) Unfortunately they are '501's. -Jeremy, CSJW. #: 10881 S3/Languages 31-May-91 00:24:46 Sb: #10877-C_Help Fm: Brother Jeremy, CSJW 76477,142 To: Mike Haaland 72300,1433 (X) I dl'd the EDCON program, but it does not include the C source, and there did not seem to be any dialog boxes within it. Is it possible that the older version 2.0 I think, had these. --Br. Jeremy, CSJW #: 10889 S3/Languages 01-Jun-91 01:06:29 Sb: #CCEnv Fm: Brother Jeremy, CSJW 76477,142 To: All Does anyone have any information on a company named FoxWare, or its owner Chris Fox. He had produced a program called CCEnv. It was reviewed by Dale Puckett in the Nov 88 issue of Rainbow. It was a graphic based driver for OS-9 compilers. If it is not available, does anyone have a legal copy with documentation that they would like to sell? --Br. Jeremy, CSJW There is 1 Reply. #: 10893 S3/Languages 01-Jun-91 08:07:45 Sb: #10889-#CCEnv Fm: Hugo Bueno 71211,3662 To: Brother Jeremy, CSJW 76477,142 (X) I think that the Foxware product was vaporware. As I remember it, the ad you mentioned was the only one ever printed. Now, I just recently saw a message on the bitnet coco list that members of the Australian os9 group have posted their own version of a CCenv which is modeled after the turbo c environment. It'll probably make its way here at some point. Hugo -------------------------------------->UUCP on a Color Computer 3<---- Hugo Bueno | Delphi: MRGOOD Fanwood, NJ | Compuserve: 71211,3662 | UUCP: ...!(rutgers,njin)!fdurt!kc2wz!bluehaus!hugo | or hugo@bluehaus.uucp ---------------------------------------------------------------------- There is 1 Reply. #: 10914 S3/Languages 02-Jun-91 23:52:02 Sb: #10893-CCEnv Fm: Brother Jeremy, CSJW 76477,142 To: Hugo Bueno 71211,3662 (X) Thank you, I will keep my eyes and ears open. -Br. Jeremy, CSJW #: 10992 S3/Languages 08-Jun-91 07:56:32 Sb: #Cobol Needed..... Fm: Steven Barlett 71635,1562 To: all work, 17142558151 I am interested in finding a Cobol Compiler for OS9> level 2. If anyone has information as to where I may purchase Cobol Please let me know. I am developing software in Cobol and would like to see more business software developed for the CoCo... 3 ... 4 and so on. Please leave me a mail message in this forum if you have any information for me. Thank you, Steven Barlett 71635,1562 There is 1 Reply. #: 11060 S3/Languages 13-Jun-91 21:52:06 Sb: #10992-Cobol Needed..... Fm: Bob Palmer 74646,2156 To: Steven Barlett 71635,1562 Have you tried a message on the Microware forum requesting pricing information? There is (maybe was?) an official Microware produced COBOL compiler which was available for level II. Advertizement was last seen in 68 micro magazine - now defunct. Sorry I cannot help more. edit #: 11429 S3/Languages 22-Jul-91 10:56:52 Sb: #C++ Fm: Mark Wuest 74030,332 To: all Does anyone know of a forum here in CI$ for C++ programmers (other than laguages under unixforum)? I am actually going to have to do our next project at work in C++ starting with almost no reusable class{}'es. Any ideas? Mark There is 1 Reply. #: 11433 S3/Languages 22-Jul-91 11:11:38 Sb: #11429-#C++ Fm: Pete Lyall 76703,4230 To: Mark Wuest 74030,332 (X) Mark - If you go to BPROGB (Borland B), they have a section set aside for C++'ers, as well as a download library. Pete There is 1 Reply. #: 11436 S3/Languages 22-Jul-91 13:51:41 Sb: #11433-C++ Fm: Mark Wuest 74030,332 To: Pete Lyall 76703,4230 (X) Pete: I'll go look - I didn't even think of looking in PC-type areas! Thanks mucho, Mark #: 11444 S3/Languages 22-Jul-91 22:24:29 Sb: #C Compiler Problem Fm: Jay Truesdale 72176,3565 To: all I'm using a coco 3 with OS9 level 2. Consider the following C code fragment: struct _mtable { char _mnem[8]; int _mvi; char _mvc; }; struct _mtable mtable[3] = { "!dummy", 0, 1, "abcd", 1, 2, "add", 18, 10, }; This will even compile. Now consider the following assembler code generated by the C Compiler: * *struct _mtable mtable[3] = { vsect mtable: * * "!dummy", 0, 1, fdb _1 fcb 0 fcb 1 * * "abcd", 1, 2, fdb _2 fcb 1 fcb 2 .....etc. On page 1-5 of my Tandy C manual is states that a data type of INT is two bytes in size. My question is why the field corresponding to the INT type in the above assembler code is generated in assembler by an FCB which means "fill constant BYTE" which is one byte not two! The problem comes up later when the values exceed 255, the assembler rightly complains. I'm baffled, anyone got a clue here??? Thanks, -J There are 3 Replies. #: 11451 S3/Languages 23-Jul-91 00:04:19 Sb: #11444-C Compiler Problem Fm: Pete Lyall 76703,4230 To: Jay Truesdale 72176,3565 (X) Jay - Looking over the code (the assembler output got munched a bit... next time use STORE UNFORMATTED), it looks as if you may have a compiler bug on your hands. The code looks rational. What happens if you declare the _mvi as a SHORT? Also, try allocating the structure without initializing it and see what happens. Pete #: 11456 S3/Languages 23-Jul-91 07:38:38 Sb: #11444-#C Compiler Problem Fm: Kevin Darling 76703,4227 To: Jay Truesdale 72176,3565 (X) Hi Jay - the C book I have says that you can't do that kind of initialization. What you have to do instead is this (and don't leave out the {}'s !!)... struct _mtable { char _mnen[8]; int _mvi; char _mvc; }; struct _mtable mtable[3] = { { {'!','d','u','m','m','y','\0'}, 0, 1}, { {'a','b','c','d','\0'}, 2, 3}, { {'a','d','d','\0'}, 1000, 4} }; But since that's a terrific pain, I finally recalled that we discussed this back in Jan 1990 (when I first was looking at C and began to take notes :-). One way to "get around" it is to do the init yourself: struct _mtable mtable[3] = { { {},0,1 }, { {},2,3 }, { {},4,5 }}; char *istring[] = {"!dummy","abcd","add"}; main() { int n; for (n=0;n<3;n++) strcopy(mtable[n]._mnen,istring[n]); } Hope this helps. best - kevin There are 2 Replies. #: 11458 S3/Languages 23-Jul-91 08:59:12 Sb: #11456-#C Compiler Problem Fm: Pete Lyall 76703,4230 To: Kevin Darling 76703,4227 (X) Kev - Good eye.... because of the late hour of my reply, I didn't catch the pointer assignment to declared string space. That still doesn't directly explain why his ints are FCB 1's instead of FDB 1's though.. Pete There is 1 Reply. #: 11472 S3/Languages 24-Jul-91 05:19:09 Sb: #11458-#C Compiler Problem Fm: Kevin Darling 76703,4227 To: Pete Lyall 76703,4230 (X) Pete - Thanks kindly, but no good eye here. Took silly me hours to figure out (partly because you said it looked okay at first :-). "That still doesn't directly explain why his ints are FCB 1's instead of FDB 1's though.." Yeah, that's pretty strange. Playing around, it appears that when it expects the string array parts, it counts up each item (anything inside quotes counts as one item) after that as _one_ char (to be put into the string array). In other words, using: * "abcdefgh",0,1, fdb _1 all items (even this line) counted as "one" char, and fcb 0 this continues until the end of the _entire_ array[3] fcb 1 at which time rzb's fill up any extra space to make 33 (11 bytes in each unit * 3 units in array) * { "abcdefgh",0,1}, fdb _1 fcb 0 using the {} around each full array unit here fcb 1 does slightly better... this forces the compiler rzb 5 to at least lump each unit's stuff together :-) rzb 2 rzb 1 = 11 bytes/unit = correct size, at least :-) * {{ "abcdefgh"},0,1}, fdb _1 rzb 7 more {}'s forced the compiler to try to fdb 0 add up the first [8] array, then the INT, fcb 1 then the CHAR. Almost correct! In other words, it was trying to fill up the "char _mnen[8]" unit first... and I think it was using ","s to find them. More {}'s forced it to lump things together better. Of course, the _mnen assignment source had to be changed to make it all perfect. kevin There is 1 Reply. #: 11477 S3/Languages 24-Jul-91 08:51:21 Sb: #11472-C Compiler Problem Fm: Pete Lyall 76703,4230 To: Kevin Darling 76703,4227 (X) Kev - See my remark to JJ about 6809 using the quoted strings as pointers to type char *. I believe that's the only thing MW/6809 C knows to do with a quoted string. The fdb _1 (as I'm sure you know) is just allocating a constant somewhere else (usually near the end of the .r file) that is: _1 fcb 'a','b','c','d','e','f','h' (or equivalent) And the 'fdb _1' is just a pointer to it. Pete #: 11462 S3/Languages 23-Jul-91 19:59:44 Sb: #11456-#C Compiler Problem Fm: James Jones 76257,562 To: Kevin Darling 76703,4227 (X) Hmmm...might better check that C book, Kevin. :-) Initializing an array of characters with a string constant *is* kosher C. Now, what might give a compiler that's not careful some trouble is if the field is a pointer to character, because in that case a less-than-careful compiler might emit the assembly language for the string right where the poi