jack@stevie.cs.unlv.edu (The Prism) (09/12/89)
Much thanks for responses to previous questions! But, I've another... When I call OpenDiskFont to load a font, I get a guru. I have successfully opened the diskfont.library prior to my call to OpenDiskFont, and I have a valid TextAttr structure, the pointer to which is passed to OpenDiskFont. Below is my code: ------------------ .... struct TextFont *tf; struct Library *DiskFontBase struct TextAttr biggerfont = { "courier.font", 18, 0, 0 }; main() { .... if(openlibraries()) exit(0); setup_fonts(); .... } openlibraries() { .... /* prior to this line, I've opened up the intuition, graphics, and dos libraries */ if((DiskFontBase = (struct Library *)OpenLibrary("diskfont.library",0)) == (struct Library *) NULL) { fprintf(stderr,"OpenLibrary(diskfont.library) returns error\n"); return(1); } .... return(0); } .... setup_fonts() { fprintf(stderr,"going into OpenDiskFont()\n"); if((tf = OpenDiskFont(&biggerfont))==(struct TextFont *)NULL) fprintf(stderr,"OpenDiskFont(biggerfont) returns error\n"); fprintf(stderr,"back from OpenDiskFont()\n"); } --------------------------- I get the message "going into OpenDiskFont()" message, then I get the guru.
ken@cbmvax.UUCP (Ken Farinsky - CATS) (09/12/89)
In article <1319@jimi.cs.unlv.edu> jack@jimi.cs.unlv.edu (The Prism) writes: > >Much thanks for responses to previous questions! But, I've another... > >When I call OpenDiskFont to load a font, I get a guru. > >I have successfully opened the diskfont.library prior to my call to >OpenDiskFont, and I have a valid TextAttr structure, the pointer to which >is passed to OpenDiskFont. Below is my code: >------------------ > >.... > >struct TextFont *tf; >struct Library *DiskFontBase try this: struct Library *DiskfontBase ^ -ken. -- -------------------------------------------------------------- Ken Farinsky -- CATS Commodore Business Machines PHONE 215-431-9421 UUCP ...{uunet,rutgers}!cbmvax!ken --------------------------------------------------------------
joe@cbmvax.UUCP (Joe O'Hara - QA) (09/12/89)
In article <1319@jimi.cs.unlv.edu> jack@jimi.cs.unlv.edu (The Prism) writes: > >Much thanks for responses to previous questions! But, I've another... > >When I call OpenDiskFont to load a font, I get a guru. > >.... > >struct Library *DiskFontBase ^^^^^^^^^^^^^ should be *DiskfontBase >--------------------------- > >I get the message "going into OpenDiskFont()" message, then I get the guru. -- ======================================================================== Joe O'Hara || Comments represent my own opinions, Commodore Electronics Ltd || not my employers. Any similarity to Software QA || to any other opinions, living or dead, || is purely coincidental. ========================================================================
cmcmanis%pepper@Sun.COM (Chuck McManis) (09/13/89)
In article <1319@jimi.cs.unlv.edu> jack@jimi.cs.unlv.edu (The Prism) writes: >When I call OpenDiskFont to load a font, I get a guru. >I have successfully opened the diskfont.library prior to my call to >OpenDiskFont, and I have a valid TextAttr structure, the pointer to which >is passed to OpenDiskFont. Below is my code: >struct Library *DiskFontBase ^^^- Bug I've flame Commodore a bit about this on BIX, you'll probably want to now as well. Your bug is that the global that OpenDiskFont() is expecting the library base to be in is "DiskfontBase" and *NOT* "DiskFontBase" (note the lower case 'f' in 'font'). The more things like this happen, the more I think there must be a better way for shared libraries to work than with "magic" global variables. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't you. "If I were driving a Macintosh, I'd have to stop before I could turn the wheel."
ahh@glyph.UUCP (Andy Heffernan) (09/13/89)
In article <1319@jimi.cs.unlv.edu> jack@jimi.cs.unlv.edu (The Prism) writes: >When I call OpenDiskFont to load a font, I get a guru. [portions of code removed] >struct Library *DiskFontBase; ^ The correct name is 'DiskfontBase' (note small 'f'). The jump through the real library vector lands you into uncharted territory as it is never initialized. (The library was opened, but the pointer was put in the wrong place.) Boing!
esker@abaa.uucp (Lawrence Esker) (09/13/89)
In article <124522@sun.Eng.Sun.COM> cmcmanis@sun.UUCP (Chuck McManis) writes: >>struct Library *DiskFontBase > ^^^- Bug > >I've flame Commodore a bit about this on BIX, you'll probably want to ^^^^^ ^^^^^^^^^ >now as well. Your bug is that the global that OpenDiskFont() is expecting >the library base to be in is "DiskfontBase" and *NOT* "DiskFontBase" (note >the lower case 'f' in 'font'). The more things like this happen, the more >I think there must be a better way for shared libraries to work than with >"magic" global variables. Commodore has no responsibility for an upper/lower case bug. What system can you name that still uses the C language and escape bugs from upper/lower case typo errors. If anyone is at fault, it is K&R. Personally, I like the case dependence of K&R and am willing to live with the consequences of making typo mistakes. However, lets not start a preferences war over it here in c.s.a.t. -- ---------- Lawrence W. Esker ---------- Modern Amish: Thou shalt not need any computer that is not IBM compatible. UseNet Path: __!mailrus!sharkey!itivax!abaa!esker == esker@abaa.UUCP
walker@sas.UUCP (Doug Walker) (09/15/89)
Ah yes, this happened to me the first time I used the diskfont stuff too. You successfully open the library, but the base name is supposed to be struct Library *DiskfontBase; not struct Library *DiskFontBase; the symbol DiskfontBase is resolved from the libraries, but it is unininitialized; this causes your crash. --Doug