/ | \ -------------------------------------- --- GEcho 1.00 * Origin: Home by the C (Auke.Reitsma@net.hcc.nl) (2:281/400.20) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2F00028 Date: 02/09/98 From: AUKE REITSMA Time: 09:57pm \/To: JAVIER KOHEN (Read 1 times) Subj: Linked List Stuff in SNIPPETS Hi Javier, (Other DJGPP 2.01 users: do me a favor and 'validate' Javier's problem!) On 30 Jan 98, 14:01, you wrote to Auke Reitsma JK> Auke, I was using your LL stuff in a personal project, when I JK> found a weird thing. It will work perfectly when using just one JK> list, but when I created a second one, it'll report no more JK> memory; only that this happened with DJGPP 2.01 but it didn't JK> with Borland C... furthermore, even under DJFPP it works right JK> once in a while! That's weird indeed! JK> What could thid be, DJGPP or LLS? Either or both ... assuming that you did test it with the program you provided. I tried it (BC3.1) and it worked OK. JK> BTW, DJGPP keeps reporting that enough memory is available even JK> when the program exits with: "Out of memory: JK> LLScreate(LLvendedores).". So there is really something funny going on. Not "funny ha ha", but funny ARRRGG" ... JK> Here's the snippet: ... A number of independent test suggestions follow. JK> int main(void) JK> { JK> int LLclientes, LLvendedores; JK> struct cliente tmpClien; JK> struct vendedor tmpVend; First test. Insert here: LLSsystemInit( 2 ); /* 2 is the initial number of lists */ This bypasses part of the code of LLScreate(). So if it DOES work now, it implicates a specific part of the code. If not it _might_ be OK. JK> LLclientes = LLScreate(sizeof (tmpClien)); ... JK> LLvendedores = LLScreate(sizeof (tmpVend)); JK> if (-1 == LLvendedores) { ... JK> } Second test. Insert here: printf( "%d\n", LLScheck( 1 )); That might report or indicate where the list 'construction' fails. Really a somewhat dirty trick because I happen to know that the second list will have number 1 ;-) JK> LLSdelete(LLclientes); ... Please perform the two tests separately and combined. Then report the sults! BTW, did you compile LLS.c with NDEBUG defined? If so try it without NDEBUG being defined too ... If your compiler/debugger has capability to trace through the code, try to find which malloc call fails. If not, put a printf( "Error at XXX\n" ); before each return ERR_MEMORY in LLS.c -- with different XXX'es of course. Greetings from _____ /_|__| Auke Reitsma, Delft, The Netherlands. / | \ -------------------------------------- --- GEcho 1.00 * Origin: Home by the C (Auke.Reitsma@net.hcc.nl) (2:281/400.20) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2F00029 Date: 02/11/98 From: PETER LOUWEN Time: 12:37am \/To: JAVIER KOHEN (Read 1 times) Subj: Re: 3D rotation + perspective -=> Quoting Javier Kohen to All <=- JK> Does anybody have any idea on implementing DLLs in DOS? 1. An old idea is to write a TSR that hooks some user interrupt, that erforms whatever tasks you had in mind. 2. Obtain TPDRV.ZIP: ----- Quote This unit is an extension to the process unit. The unit supports multi programming as well as parallel programming. My aim was to create dynamic libraries for DOS non-protected mode applications. You can load drivers for example for sound cards, video cards etc., dynamically into memory. The drivers are EXE files with a simple structure, coded in Pascal, assembler or C. To avoid complication with DOS you should rename the .EXE files as .DRV. email:dieter.pawelczak@eikon.e-technik.tu-muenchen.de www:http://www.eikon.e-technik.tu-muenchen.de/~et_514/ ----- Unquote It's for BP7, but you may be able to convert it to C. Peter ... Compile, run, curse ... Recompile, rerun, recurse ... --- EBO-BBS Diemen - NL * Origin: EBO-BBS Diemen (http://home.worldonline.nl/~biginski) (2:280/901) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2G00000 Date: 02/11/98 From: ANTHONY TIBBS Time: 05:48pm \/To: BRIAN LUNERGAN (Read 1 times) Subj: Rookie seeks help with a project... BL> I have a sysop friend who has done just that to your rookie C++ BL> author. The project is simple. Read a large text file into memory (his BL> files.bbs file) and then rewrite the file, checking each line for BL> certain unwanted text, keeping those lines that pass the "filter", and BL> discarding those that don't. He has one version he did in Pascal, but BL> it has a hard-coded limit of 800 lines. Part of my assignment is to BL> lift that lines restriction so that he can deal with much larger BL> files. OK, there are a few ways you could do it. Personally, if speed isn't a >major< concern (you'll have to add configuration options, etc.) but... I wipped this up in about 10 minutes, so the code is ugly. I use a similar algorithm for re-writing a `schedule' file... [tested, but not extensively] /*** **** Requires STRISTR.C from Snippets. ***/ #include "snip_str.h" #include /* No offence to Bob- but I had to use something.. Since this >is< the ** C echo, 'C??' is a bad word. ;-) */ #define MAXLINELEN 512 /* Max line length */ #define REPLACE_CHAR '' /* Char to `strike' with */ char *szBadWords[]={"Bob", "Stout", "C++", NULL}; int main (void) { FILE *hInput; /* Input file */ FILE *hOutput; /* Output file */ char szILine [MAXLINELEN]; /* Temporary holding buffer */ char *pszMatch; /* Ptr for current 'word' match */ unsigned int nCurBadWord=0; /* Index for current bad word */ unsigned int nTempCnt; /* Temporary counter */ printf ("Filtering FILES.BBS...\n"); hInput=fopen ("FILES.BBS", "r"); if (!hInput) { printf ("FILES.BBS could not be opened!\n"); return 1; } hOutput=fopen ("$$$TEMP.$$$", "w"); if (!hOutput) { fclose (hInput); printf ("Temporary work file could not be opened!\n"); return 1; } /* Keep moving until EOF */ while ((fgets (szILine, MAXLINELEN, hInput)) != NULL) { /* Skip blank lines. */ if (*szILine == '\0' || *szILine == '\r' || *szILine == '\n') { fputs (szILine, hOutput); continue; } nCurBadWord=0; while (szBadWords [nCurBadWord]) { pszMatch = stristr (szILine, szBadWords [nCurBadWord]); if (pszMatch) { char *p; p = pszMatch; while ((p - pszMatch) < strlen (szBadWords[nCurBadWord])) { *p = REPLACE_CHAR; p++; } } nCurBadWord++; } fputs (szILine, hOutput); } fclose (hOutput); fclose (hInput); unlink ("FILES.BBS"); rename ("$$$TEMP.$$$", "FILES.BBS"); return 0; } --- PointEd 2.0 * Origin: The Tibbs' Point - Ottawa, Ontario, Canada (1:163/215.38) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2G00001 Date: 02/10/98 From: ERIK WARMELINK Time: 07:50pm \/To: WILLIAM MCBRINE (Read 1 times) Subj: Comment parsing William, 10 Feb schreef je Michael Stapleton: MS> Comment extraction is not as easy as one might first think. You MS> basically need a complete code parser to deal with all cases. WM> ? WM> Some pseudocode: WM> Read source file until '/' or EOF WM> If '/', check next character: WM> If '/', read comment (C++) to EOL (optional) WM> If '*', read comment (C) to '*/' WM> Loop WM> What have I missed? String constants. Once you have handled that, consider the preprocessor. :-) Bye, Erik --- * Origin: erik@flits102-126.flits.rug.nl (2:282/1.60) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2G00002 Date: 02/10/98 From: ROBERT HORNE Time: 07:36pm \/To: ALL (Read 1 times) Subj: Overlays How do I make an external .OVR file from an overlayed program? I know it can be done in Turbo Pascal, and I was wondering if it could also be done in C/C++. I have Turbo C++ 3.0. Thanx in advance! Robert Horne * OLX 2.1 TD * True Multitasking = 3 PCs and a chair with wheels! --- Maximus 2.02 * Origin: Digital Encounters * Kamloops BC Canada 250/374-6168 (1:353/710) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2H00000 Date: 02/09/98 From: GEORGE WHITE Time: 09:00am \/To: PATRICK WOODCOCK (Read 1 times) Subj: Include files Hi Patrick, You asked: PW> I am a begginer at C programming as you can probably tell with PW>this question. Don't worry, we all were once. PW>My problem is though, that I got my copy of C off a freeware disk and so PW>it didn't come with many of those nice include files. It should come with all the required ones. PW>Does anyone know where I could get include files. I've tried on a BBS PW>but the include files wheren't the ones in my C book. I especially need PW>ones like CONIO.H and GRAPHICS.H as I hope to include nice graphics in PW>my programs. If you don't have them supplied, then there is, in general, no source for them as the libraries for the compiler you have probably don't have the functions prototyped in them. As you haven't told us: a) which compiler, b) where exactly you got it (CD name), there is not really anything we can help with. Quoting CONIO.H and GRAPHICS.H as missing files suggests that the C book you are using targets the Borland compiler as these files are for Borland language extensions. The files themselves are of little use withou the library support for the functions they prototype. PW>It would be most useful to know where to get these files but I PW>understand that C is not one of those programming languages that are PW>standardised. C _is_ standardised at an international level. Language extensions are not standardised and as there is no graphics standard that can be applied across potential target platforms (the target systems are not even required to have a display) the standard does not provide one. It does provide for basic character input and output, but that is all. The same lack of graphics limitations also apply to all non platform specific languages I've used. George * SLMR 2.1a * All Trademarks acknowledged (just in case ). --- Maximus/2 3.01 * Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2H00001 Date: 02/09/98 From: GEORGE WHITE Time: 09:14am \/To: VICTOR KEMP (Read 1 times) Subj: interrupt function Hi Victor, You asked: VK>Hi, can someone please tell me what exactly happens when VK>you declare a function as 'interrupt'. If it's compiler VK>specific then I'm using Turbo C++ v3.0. (I figure that it VK>will behave the same way in c as c++ though). I'll try. It's generally similar across all compilers that provide interrupt support, and is not the same in C as C++. VK>It appears that it is disabling all(at least some unrelated) hardware VK>interrupts while in the function, is this true? I don't VK>seem to be getting any even if I give it an STI VK>instruction. I would really like to be able to wait for an VK>interrupt to occur from within the interrupt function, but VK>waiting for it just makes it sit there forever. A function declared as "interrupt" is designed to be hooked to a specific machine interrupt, and is called whenever the interrupt is activated. Because of this it cannot sensibly re-enable interrupts until it completes as the IBM PC interrupt control hardware cannot conveniently support use this way. Look at getvect() and setvect() to see how to install the interrupt handler (it does include at simple example of an interrpt function). You emphatically do not call an "interrupt" function and wait for the interrupt to occur, rather the "interrupt" function should do the necessary work to process the interrupt and return as quickly as possible, and store any data retrieved in a buffer for the rest of the program to access outside interrupt time. George * SLMR 2.1a * All Trademarks acknowledged (just in case ). --- Maximus/2 3.01 * Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F2H00002 Date: 02/09/98 From: GEORGE WHITE Time: 09:00am \/To: PATRICK WOODCOCK (Read 1 times) Subj: Include files Hi Patrick, You asked: PW> I am a begginer at C programming as you can probably tell with PW>this question. Don't worry, we all were once. PW>My problem is though, that I got my copy of C off a freeware disk and so PW>it didn't come with many of those nice include files. It should come with all the required ones. PW>Does anyone know where I could get include files. I've tried on a BBS PW>but the include files wheren't the ones in my C book. I especially need PW>ones like CONIO.H and GRAPHICS.H as I hope to include nice graphics in PW>my programs. If you don't have them supplied, then there is, in general, no source for them as the libraries for the compiler you have probably don't have the functions prototyped in them. As you haven't told us: a) which compiler, b) where exactly you got it (CD name), there is not really anything we can help with. Quoting CONIO.H and GRAPHICS.H as missing files suggests that the C book you are using targets the Borland compiler as these files are for Borland language extensions. The files themselves are of little use withou the library support for the functions they prototype. PW>It would be most useful to know where to get these files but I PW>understand that C is not one of those programming languages that are PW>standardised. C _is_ standardised at an international level. Language extensions are not standardised and as there is no graphics standard that can be applied across potential target platforms (the target systems are not even required to have a display) the standard does not provide one. It does provide for basic character input and output, but that is all. The same lack of graphics limitations also apply to all non platform specific languages I've used. George * SLMR 2.1a * All Trademarks acknowledged (just in case ). --- Maximus/2 3.01 * Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4)