home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 31
/
CDASC_31_1996_juillet_aout.iso
/
vrac_os2
/
sm099c.zip
/
EXAMPLE
/
EXAMPLE.SM
< prev
next >
Wrap
Text File
|
1996-04-05
|
32KB
|
701 lines
/* =============================================================================
A = Sourcefile
B = Total number of lines
C = Empty lines
D = Commentlines
E = Lines with code
F = Functions
G = Blocks of comment
A: B: C: D: E: F: G: Glob.lin.:
--------------------------------------------------------------------------------
F-1 example.c 26 7 12 7 1 2 G-1
F-2 destroy.c 30 3 3 24 2 3 G-27
F-3 init.c 79 8 2 69 2 6 G-57
F-4 run.c 121 13 14 94 6 11 G-136
F-5 utils.c 48 3 3 42 3 3 G-257
F-6 vars.c 17 2 0 15 0 2 G-305
F-7 wndproc.c 42 7 1 34 1 1 G-322
--------------------------------------------------------------------------------
Totaly 363 43 35 285 15 28
============================================================================= */
/* =============================================================================
Index of functions:
F-1 ClientWndProc () G-325 (L-4: wndproc.c)
F-2 ClrScr () G-280 (L-24: utils.c)
F-3 GetScrSize () G-259 (L-3: utils.c)
F-4 InitScreen () G-95 (L-39: init.c)
F-5 Initialize () G-59 (L-3: init.c)
F-6 MoveHorizontally () G-189 (L-54: run.c)
F-7 MoveVertically () G-209 (L-74: run.c)
F-8 PaintBall () G-228 (L-93: run.c)
F-9 Pause () G-296 (L-40: utils.c)
F-10 RestoreScreen () G-29 (L-3: destroy.c)
F-11 Run () G-139 (L-4: run.c)
F-12 RunBall () G-178 (L-43: run.c)
F-13 RunBalls () G-157 (L-22: run.c)
F-14 Terminate () G-51 (L-25: destroy.c)
F-15 main () G-19 (L-19: example.c) */
/* =============================================================================
List of calling sequences:
L-1 ClientWndProc ()
L-2 | ClrScr ()
L-3 | | WinFillRect () External
L-4 | | WinQueryWindowRect () External
L-5 | | cleardevice () External
L-6 | | clrscr () External
L-7 | GetScrSize ()
L-8 | | WinQueryWindowRect () External
L-9 | | getmaxx () External
L-10 | | getmaxy () External
L-11 | | gettextinfo () External
L-12 | MRFROMLONG () External
L-13 | PaintBall ()
L-14 | | GpiFullArc () External
L-15 | | GpiMove () External
L-16 | | GpiSetColor () External
L-17 | | MAKEFIXED () External
L-18 | | circle () External
L-19 | | gotoxy () External
L-20 | | putch () External
L-21 | | setcolor () External
L-22 | | textcolor () External
L-23 | RunBalls ()
L-24 | | RunBall ()
L-25 | | | MoveHorizontally ()
L-26 | | | | NEWCOLOR () External
L-27 | | | | NEWSPEED () External
L-28 | | | MoveVertically ()
L-29 | | | | NEWSPEED () External
L-30 | | | PaintBall () ... [L-13]
L-31 | | WinQueryFocus () External
L-32 | WinBeginPaint () External
L-33 | WinDefWindowProc () External
L-34 | WinEndPaint () External
--------------------------------------------------------------------------------
L-35 main ()
L-36 | Initialize ()
L-37 | | InitScreen ()
L-38 | | | ClrScr () ... [L-2]
L-39 | | | DosSetPriority () External
L-40 | | | GetScrSize () ... [L-7]
L-41 | | | GpiCreatePS () External
L-42 | | | GpiSetArcParams () External
L-43 | | | GpiSetDrawingMode () External
L-44 | | | WinCreateMsgQueue () External
L-45 | | | WinCreateStdWindow () External
L-46 | | | WinInitialize () External
L-47 | | | WinOpenWindowDC () External
L-48 | | | WinRegisterClass () External
L-49 | | | WinStartTimer () External
L-50 | | | _setcursortype () External
L-51 | | | cprintf () External
L-52 | | | exit () External
L-53 | | | grapherrormsg () External
L-54 | | | graphresult () External
L-55 | | | initgraph () External
L-56 | | NEWCOLOR () External
L-57 | | NEWSPEED () External
L-58 | | atoi () External
L-59 | | memset () External
L-60 | | random () External
L-61 | | randomize () External
L-62 | Run ()
L-63 | | Pause ()
L-64 | | | DosSleep () External
L-65 | | | delay () External
L-66 | | RunBalls () ... [L-23]
L-67 | | WinDispatchMsg () External
L-68 | | WinGetMsg () External
L-69 | | getch () External
L-70 | | kbhit () External
L-71 | Terminate ()
L-72 | | RestoreScreen ()
L-73 | | | ClrScr () ... [L-2]
L-74 | | | WinDestroyMsgQueue () External
L-75 | | | WinDestroyWindow () External
L-76 | | | WinReleasePS () External
L-77 | | | WinStopTimer () External
L-78 | | | WinTerminate () External
L-79 | | | _setcursortype () External
L-80 | | | closegraph () External
L-81 | | | gotoxy () External
L-82 | | | normvideo () External
--------------------------------------------------------------------------------
Index to list of calling sequences:
F-1 ClientWndProc () L-1
F-2 ClrScr () L-2
F-3 GetScrSize () L-7
F-4 InitScreen () L-37
F-5 Initialize () L-36
F-6 MoveHorizontally () L-25
F-7 MoveVertically () L-28
F-8 PaintBall () L-13
F-9 Pause () L-63
F-10 RestoreScreen () L-72
F-11 Run () L-62
F-12 RunBall () L-24
F-13 RunBalls () L-23
F-14 Terminate () L-71
F-15 main () L-35 */
/* =============================================================================
Sourcefile...........: example.c
Total number of lines: 26
Empty lines..........: 7 (26%)
Commentlines.........: 12 (46%)
Lines with code......: 7 (26%)
Functions............: 1
Blocks of comment....: 2 */
/* G-1 L-1 Comment | *//* --------------------------------------------------------------------------
G-2 L-2 Comment | ** This dummy program is just developed as an example source code for the
G-3 L-3 Comment | ** Source Mapper (SM). The program is divided into more functions than
G-4 L-4 Comment | ** actually makes sense. That's just to have functions enough to show you
G-5 L-5 Comment | ** what SM can do.
G-6 L-6 Comment | **
G-7 L-7 Comment | ** Compiler options:
G-8 L-8 Comment | ** OS2 = Compile for OS/2.
G-9 L-9 Comment | ** DOS = Compile for grand old DOS.
G-10 L-10 Comment | ** GUI = Compile GUI version (supported for both DOS and OS2 version).
G-11 L-11 Comment | ** ------------------------------------------------------------------------ */
/* G-12 L-12 | */
/* G-13 L-13 | */
/* G-14 L-14 | */
#include "example.h"
/* G-16 L-16 | */
/* G-17 L-17 | */
/* G-18 L-18 | */
/* G-19 L-19 | */void main ( int iArgC, char *pcArgP[] )
/* G-20 L-20 Comment | *//* Program entry point. */
/*
List of callers of 'main ()':
No caller
*/
/* G-21 L-21 | */{
/* G-22 L-22 B1 | */ Initialize (iArgC, pcArgP, &Balls);
/* G-23 L-23 B1 | */ Run (&Balls);
/* G-24 L-24 B1 | */ Terminate ();
/* G-25 L-25 | */}
/* G-26 L-26 | */
/* =============================================================================
Sourcefile...........: destroy.c
Total number of lines: 30
Empty lines..........: 3 (10%)
Commentlines.........: 3 (10%)
Lines with code......: 24 (80%)
Functions............: 2
Blocks of comment....: 3 */
#include "example.h"
/* G-28 L-2 | */
/* G-29 L-3 | */void RestoreScreen ( void )
/* G-30 L-4 Comment | *//* Restore screen (color, mode, etc.) back to what it was when the program
G-31 L-5 Comment | was started. */
/*
List of callers of 'RestoreScreen ()':
Terminate () G-51
*/
/* G-32 L-6 | */{
#ifdef GUI
#ifdef OS2
/* G-35 L-9 B1 | */ WinStopTimer (hAB, hWndClient, TID_MOVE);
/* G-36 L-10 B1 | */ WinReleasePS (hPS);
/* G-37 L-11 B1 | */ WinDestroyWindow (hWndFrame);
/* G-38 L-12 B1 | */ WinDestroyMsgQueue (hMQ);
/* G-39 L-13 B1 | */ WinTerminate (hAB);
#else
/* G-41 L-15 B1 | */ closegraph (); /* Return the system to text mode */
#endif
#else
/* G-44 L-18 B1 | */ ClrScr ();
/* G-45 L-19 B1 | */ normvideo ();
/* G-46 L-20 B1 | */ gotoxy (0, iScreenH - 1);
/* G-47 L-21 B1 | */ _setcursortype (_NORMALCURSOR);
#endif
/* G-49 L-23 | */}
/* G-50 L-24 | */
/* G-51 L-25 | */void Terminate ( void )
/* G-52 L-26 Comment | *//* Get ready to exit this silly program */
/*
List of callers of 'Terminate ()':
main () G-19
*/
/* G-53 L-27 | */{
/* G-54 L-28 B1 | */ RestoreScreen ();
/* G-55 L-29 | */}
/* G-56 L-30 | */
/* =============================================================================
Sourcefile...........: init.c
Total number of lines: 79
Empty lines..........: 8 (10%)
Commentlines.........: 2 (2%)
Lines with code......: 69 (87%)
Functions............: 2
Blocks of comment....: 6 */
#include "example.h"
/* G-58 L-2 | */
/* G-59 L-3 | */void Initialize ( int iArgC, char *pcArgP[], BALLS *pBalls )
/* G-60 L-4 Comment | *//* Perform everything that's neccessary to run the balls. */
/*
List of callers of 'Initialize ()':
main () G-19
*/
/* G-61 L-5 | */{
/* G-62 L-6 B1 | */ int iC1;
/* G-63 L-7 B1 | */ BALL *pBall;
/* G-64 L-8 | */
/* G-65 L-9 B1 | */ memset (pBalls, 0, sizeof (BALLS));
/* G-66 L-10 | */
/* G-67 L-11 B1 | */ InitScreen ();
/* G-68 L-12 | */
/* G-69 L-13 B1 | */ randomize ();
/* G-70 L-14 | */
/* G-71 L-15 B1 | */ for (iC1 = 0;
/* G-72 L-16 B1 | */ iC1 < MAXBALLS;
/* G-73 L-17 B1 | */ iC1++)
/* G-74 L-18 B1 | */ {
/* G-75 L-19 B-2 | */ pBall = &pBalls->Ball[iC1];
/* G-76 L-20 B-2 | */ NEWCOLOR (pBall->iColor);
/* G-77 L-21 B-2 | */ pBall->iXPos = random (iScreenW) + 1;
/* G-78 L-22 B-2 | */ pBall->iYPos = random (iScreenH) + 1;
/* G-79 L-23 B-2 | */ pBall->iHSpeed = (iC1%2) ? NEWSPEED (MAXHSPEED) : -NEWSPEED (MAXHSPEED);
/* G-80 L-24 B-2 | */ pBall->iVSpeed = (iC1%2) ? NEWSPEED (MAXVSPEED) : -NEWSPEED (MAXVSPEED);
/* G-81 L-25 B1 | */ }
/* G-82 L-26 | */
/* G-83 L-27 B1 | */ if (iArgC > 1)
/* G-84 L-28 B1 | */ {
/* G-85 L-29 B-2 | */ pBalls->iNr = atoi (pcArgP[1]);
/* G-86 L-30 B-2 | */ pBalls->iNr = pBalls->iNr > 0 ? pBalls->iNr : 10;
/* G-87 L-31 B-2 | */ pBalls->iNr = pBalls->iNr <= MAXBALLS ? pBalls->iNr : MAXBALLS;
/* G-88 L-32 B1 | */ }
/* G-89 L-33 B1 | */ else
/* G-90 L-34 B1 | */ {
/* G-91 L-35 B-2 | */ pBalls->iNr = 10;
/* G-92 L-36 B1 | */ }
/* G-93 L-37 | */}
/* G-94 L-38 | */
/* G-95 L-39 | */void InitScreen ( void )
/* G-96 L-40 Comment | *//* Prepare screen to show the running balls. */
/*
List of callers of 'InitScreen ()':
Initialize () G-59
*/
/* G-97 L-41 | */{
#ifdef GUI
#ifdef OS2
/* G-100 L-44 B1 | */ SIZEL Size = { 0, 0 };
/* G-101 L-45 B1 | */ ARCPARAMS ap = { 4, 4, 0, 0 };
/* G-102 L-46 B1 | */ hAB = WinInitialize (0);
/* G-103 L-47 B1 | */ hMQ = WinCreateMsgQueue (hAB, 0);
/* G-104 L-48 B1 | */ WinRegisterClass (hAB, "SillyExample", ClientWndProc, CS_SIZEREDRAW, 0);
/* G-105 L-49 B1 | */ hWndFrame = WinCreateStdWindow (HWND_DESKTOP, WS_VISIBLE | WS_ANIMATE,
/* G-106 L-50 B1 | */ &ulFrameFlags,
/* G-107 L-51 B1 | */ "SillyExample", "Bounching balls",
/* G-108 L-52 B1 | */ 0, 0, 100, &hWndClient);
/* G-109 L-53 B1 | */ hDC = WinOpenWindowDC (hWndClient);
/* G-110 L-54 B1 | */ hPS = GpiCreatePS (hAB, hDC, &Size, PU_PELS | GPIF_DEFAULT |
/* G-111 L-55 B1 | */ GPIT_MICRO | GPIA_ASSOC);
/* G-112 L-56 B1 | */ GpiSetDrawingMode (hPS, DM_DRAW);
/* G-113 L-57 B1 | */ WinStartTimer (hAB, hWndClient, TID_MOVE, DELAY);
/* G-114 L-58 B1 | */ GpiSetArcParams (hPS, &ap);
/* G-115 L-59 B1 | */ DosSetPriority (0, 1, 31, 0); /* Change to a low priority (IDLE class) */
#else
/* G-117 L-61 B1 | */ int iErrorCode;
/* G-118 L-62 B1 | */ int iGraphDriver;
/* G-119 L-63 B1 | */ int iGraphMode;
/* G-120 L-64 | */
/* G-121 L-65 B1 | */ iGraphDriver = DETECT; /* Request auto-detection */
/* G-122 L-66 B1 | */ initgraph (&iGraphDriver, &iGraphMode, "");
/* G-123 L-67 B1 | */ iErrorCode = graphresult (); /* Read result of initialization */
/* G-124 L-68 B1 | */ if (iErrorCode != grOk) /* Error occured during init */
/* G-125 L-69 B1 | */ {
/* G-126 L-70 B-2 | */ cprintf ("Graphics System Error: %s\n\r", grapherrormsg (iErrorCode));
/* G-127 L-71 B-2 | */ exit (1);
/* G-128 L-72 B1 | */ }
#endif
#else
/* G-131 L-75 B1 | */ _setcursortype (_NOCURSOR);
#endif
/* G-133 L-77 B1 | */ ClrScr ();
/* G-134 L-78 B1 | */ GetScrSize (&iScreenW, &iScreenH);
/* G-135 L-79 | */}
/* =============================================================================
Sourcefile...........: run.c
Total number of lines: 121
Empty lines..........: 13 (10%)
Commentlines.........: 14 (11%)
Lines with code......: 94 (77%)
Functions............: 6
Blocks of comment....: 11 */
#include "example.h"
/* G-137 L-2 | */
#pragma argsused
/* G-139 L-4 | */void Run ( BALLS *pBalls )
/* G-140 L-5 Comment | *//* Main loop of the program. */
/*
List of callers of 'Run ()':
main () G-19
*/
/* G-141 L-6 | */{
#if defined (OS2) && defined (GUI)
/* G-143 L-8 B1 | */ while (WinGetMsg (hAB, &QMsg, 0, 0, 0))
/* G-144 L-9 B1 | */ {
/* G-145 L-10 B-2 | */ WinDispatchMsg (hAB, &QMsg);
/* G-146 L-11 B1 | */ }
#else
/* G-148 L-13 B1 | */ while (!kbhit ())
/* G-149 L-14 B1 | */ {
/* G-150 L-15 B-2 | */ RunBalls (pBalls);
/* G-151 L-16 B-2 | */ Pause (DELAY);
/* G-152 L-17 B1 | */ }
/* G-153 L-18 B1 | */ getch (); /* Remove that termination key from keyboard buffer */
#endif
/* G-155 L-20 | */}
/* G-156 L-21 | */
/* G-157 L-22 | */void RunBalls ( BALLS *pBalls )
/* G-158 L-23 Comment | *//* Let every running ball take a new step. Heading to their current direction,
G-159 L-24 Comment | and moving in their current speed. Change direction of each ball so that
G-160 L-25 Comment | no balls run outside visible screen area. */
/*
List of callers of 'RunBalls ()':
Run () G-139
ClientWndProc () G-325
*/
/* G-161 L-26 | */{
/* G-162 L-27 B1 | */ int iC1;
/* G-163 L-28 | */
#if defined (OS2) && defined (GUI)
/* G-165 L-30 B1 | */ if (WinQueryFocus (HWND_DESKTOP) != hWndClient)
/* G-166 L-31 B1 | */ {
/* G-167 L-32 Comment | */ /* Don't hogg the single input queue of OS/2 when user work in some
G-168 L-33 Comment | other window than this stupid one. */
/* G-169 L-34 B-2 | */ return;
/* G-170 L-35 B1 | */ }
#endif
/* G-172 L-37 | */
/* G-173 L-38 B1 | */ for (iC1 = 0;
/* G-174 L-39 B1 | */ iC1 < pBalls->iNr;
/* G-175 L-40 B1 | */ RunBall (&pBalls->Ball[iC1++]));
/* G-176 L-41 | */}
/* G-177 L-42 | */
/* G-178 L-43 | */void RunBall ( BALL *pBall )
/* G-179 L-44 Comment | *//* Kernel function of RunBalls(). */
/*
List of callers of 'RunBall ()':
RunBalls () G-157
*/
/* G-180 L-45 | */{
/* G-181 L-46 B1 | */ PaintBall (pBall, BLACK); /* Hide the ball from old position */
/* G-182 L-47 | */
/* G-183 L-48 B1 | */ MoveHorizontally (pBall);
/* G-184 L-49 B1 | */ MoveVertically (pBall);
/* G-185 L-50 | */
/* G-186 L-51 B1 | */ PaintBall (pBall, pBall->iColor); /* Show the ball at new position */
/* G-187 L-52 | */}
/* G-188 L-53 | */
/* G-189 L-54 | */void MoveHorizontally ( BALL *pBall )
/* G-190 L-55 Comment | *//* Move specified ball left/right.
G-191 L-56 Comment | Change speed and direction when the ball reach any edge of screen. */
/*
List of callers of 'MoveHorizontally ()':
RunBall () G-178
*/
/* G-192 L-57 | */{
/* G-193 L-58 B1 | */ pBall->iXPos += pBall->iHSpeed;
/* G-194 L-59 | */
/* G-195 L-60 B1 | */ if (pBall->iXPos > iScreenW)
/* G-196 L-61 B1 | */ {
/* G-197 L-62 B-2 | */ pBall->iHSpeed = -NEWSPEED (MAXHSPEED);
/* G-198 L-63 B-2 | */ pBall->iXPos = iScreenW;
/* G-199 L-64 B-2 | */ NEWCOLOR (pBall->iColor);
/* G-200 L-65 B1 | */ }
/* G-201 L-66 B1 | */ else
/* G-202 L-67 B1 | */ if (pBall->iXPos <= 0)
/* G-203 L-68 B1 | */ {
/* G-204 L-69 B-2 | */ pBall->iXPos = 1;
/* G-205 L-70 B-2 | */ pBall->iHSpeed = NEWSPEED (MAXHSPEED);
/* G-206 L-71 B1 | */ }
/* G-207 L-72 | */}
/* G-208 L-73 | */
/* G-209 L-74 | */void MoveVertically ( BALL *pBall )
/* G-210 L-75 Comment | *//* Move specified ball up/down.
G-211 L-76 Comment | Change speed and direction when the ball reach any edge of screen. */
/*
List of callers of 'MoveVertically ()':
RunBall () G-178
*/
/* G-212 L-77 | */{
/* G-213 L-78 B1 | */ pBall->iYPos += pBall->iVSpeed;
/* G-214 L-79 | */
/* G-215 L-80 B1 | */ if (pBall->iYPos > iScreenH)
/* G-216 L-81 B1 | */ {
/* G-217 L-82 B-2 | */ pBall->iYPos = iScreenH;
/* G-218 L-83 B-2 | */ pBall->iVSpeed = -NEWSPEED (MAXVSPEED);
/* G-219 L-84 B1 | */ }
/* G-220 L-85 B1 | */ else
/* G-221 L-86 B1 | */ if (pBall->iYPos <= 0)
/* G-222 L-87 B1 | */ {
/* G-223 L-88 B-2 | */ pBall->iYPos = 1;
/* G-224 L-89 B-2 | */ pBall->iVSpeed = NEWSPEED (MAXVSPEED);
/* G-225 L-90 B1 | */ }
/* G-226 L-91 | */}
/* G-227 L-92 | */
/* G-228 L-93 | */void PaintBall ( BALL *pBall, int iColor )
/* G-229 L-94 Comment | *//* Paint specified ball at its current position, using specified color */
/*
List of callers of 'PaintBall ()':
RunBall () G-178
ClientWndProc () G-325
*/
/* G-230 L-95 | */{
#ifdef GUI
#ifdef OS2
/* G-233 L-98 B1 | */ POINTL pt;
/* G-234 L-99 B1 | */ pt.x = pBall->iXPos;
/* G-235 L-100 B1 | */ pt.y = pBall->iYPos;
/* G-236 L-101 B1 | */ GpiMove (hPS, &pt);
/* G-237 L-102 B1 | */ GpiSetColor (hPS, iColor);
/* G-238 L-103 B1 | */ GpiFullArc (hPS, DRO_OUTLINE, MAKEFIXED (1, 0));
#else
/* G-240 L-105 B1 | */ setcolor (iColor);
/* G-241 L-106 B1 | */ circle (pBall->iXPos, pBall->iYPos, 5);
#endif
#else
/* G-244 L-109 Comment | */ /* Prevent text screen from being vertically scrolled if the ball is
G-245 L-110 Comment | positioned at bottom right corner of screen (text modes only) */
/* G-246 L-111 B1 | */ if ((pBall->iXPos == iScreenW) &&
/* G-247 L-112 B1 | */ (pBall->iYPos == iScreenH))
/* G-248 L-113 B1 | */ {
/* G-249 L-114 B-2 | */ return;
/* G-250 L-115 B1 | */ }
/* G-251 L-116 | */
/* G-252 L-117 B1 | */ textcolor (iColor);
/* G-253 L-118 B1 | */ gotoxy (pBall->iXPos, pBall->iYPos);
/* G-254 L-119 B1 | */ putch ('*');
#endif
/* G-256 L-121 | */}
/* =============================================================================
Sourcefile...........: utils.c
Total number of lines: 48
Empty lines..........: 3 (6%)
Commentlines.........: 3 (6%)
Lines with code......: 42 (87%)
Functions............: 3
Blocks of comment....: 3 */
#include "example.h"
/* G-258 L-2 | */
/* G-259 L-3 | */void GetScrSize ( int *piScrW, int *piScrH )
/* G-260 L-4 Comment | *//* Fetch out current width and height of screen */
/*
List of callers of 'GetScrSize ()':
InitScreen () G-95
ClientWndProc () G-325
*/
/* G-261 L-5 | */{
#ifdef GUI
#ifdef OS2
/* G-264 L-8 B1 | */ RECTL Rect;
/* G-265 L-9 B1 | */ WinQueryWindowRect (hWndClient, &Rect);
/* G-266 L-10 B1 | */ *piScrW = Rect.xRight;
/* G-267 L-11 B1 | */ *piScrH = Rect.yTop;
#else
/* G-269 L-13 B1 | */ *piScrW = getmaxx ();
/* G-270 L-14 B1 | */ *piScrH = getmaxy ();
#endif
#else
/* G-273 L-17 B1 | */ struct text_info ti;
/* G-274 L-18 B1 | */ gettextinfo (&ti);
/* G-275 L-19 B1 | */ *piScrW = ti.screenwidth;
/* G-276 L-20 B1 | */ *piScrH = ti.screenheight;
#endif
/* G-278 L-22 | */}
/* G-279 L-23 | */
/* G-280 L-24 | */void ClrScr ( void )
/* G-281 L-25 Comment | *//* Clear the screen */
/*
List of callers of 'ClrScr ()':
RestoreScreen () G-29
InitScreen () G-95
ClientWndProc () G-325
*/
/* G-282 L-26 | */{
#ifdef GUI
#ifdef OS2
/* G-285 L-29 B1 | */ RECTL Rect;
/* G-286 L-30 B1 | */ WinQueryWindowRect (hWndClient, &Rect);
/* G-287 L-31 B1 | */ WinFillRect (hPS, &Rect, CLR_BLACK);
#else
/* G-289 L-33 B1 | */ cleardevice ();
#endif
#else
/* G-292 L-36 B1 | */ clrscr ();
#endif
/* G-294 L-38 | */}
/* G-295 L-39 | */
/* G-296 L-40 | */void Pause ( int iMilliSeconds )
/* G-297 L-41 Comment | *//* Sleep specified number of milliseconds */
/*
List of callers of 'Pause ()':
Run () G-139
*/
/* G-298 L-42 | */{
#ifdef OS2
/* G-300 L-44 B1 | */ DosSleep (iMilliSeconds);
#else
/* G-302 L-46 B1 | */ delay (iMilliSeconds);
#endif
/* G-304 L-48 | */}
/* =============================================================================
Sourcefile...........: vars.c
Total number of lines: 17
Empty lines..........: 2 (11%)
Commentlines.........: 0 (0%)
Lines with code......: 15 (88%)
Functions............: 0
Blocks of comment....: 2 */
#include "example.h"
/* G-306 L-2 | */
/* G-307 L-3 | */int iScreenW; /* Width of screen */
/* G-308 L-4 | */int iScreenH; /* Height of screen */
/* G-309 L-5 | */BALLS Balls;
/* G-310 L-6 | */
#if defined (OS2) && defined (GUI)
/* G-312 L-8 | */HAB hAB;
/* G-313 L-9 | */HMQ hMQ;
/* G-314 L-10 | */HPS hPS;
/* G-315 L-11 | */HDC hDC;
/* G-316 L-12 | */QMSG QMsg;
/* G-317 L-13 | */HWND hWndFrame;
/* G-318 L-14 | */HWND hWndClient;
/* G-319 L-15 | */ULONG ulFrameFlags = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER |
/* G-320 L-16 | */ FCF_MINMAX | FCF_SHELLPOSITION | FCF_TASKLIST | FCF_ICON;
#endif
/* =============================================================================
Sourcefile...........: wndproc.c
Total number of lines: 42
Empty lines..........: 7 (16%)
Commentlines.........: 1 (2%)
Lines with code......: 34 (80%)
Functions............: 1
Blocks of comment....: 1 */
#include "example.h"
/* G-323 L-2 | */
#if defined (OS2) && defined (GUI)
/* G-325 L-4 | */MRESULT EXPENTRY ClientWndProc ( HWND hWnd, ULONG ulMsg,
/* G-326 L-5 | */ MPARAM mp1, MPARAM mp2 )
/* G-327 L-6 Comment | *//* Handle OS2 PM messages. */
/*
List of callers of 'ClientWndProc ()':
No caller
*/
/* G-328 L-7 | */{
/* G-329 L-8 B1 | */ int iC1;
/* G-330 L-9 B1 | */ HPS hPS;
/* G-331 L-10 | */
/* G-332 L-11 B1 | */ switch (ulMsg)
/* G-333 L-12 B1 | */ {
/* G-334 L-13 B-2 | */ case WM_TIMER:
/* G-335 L-14 B-2 | */ RunBalls (&Balls);
/* G-336 L-15 B-2 | */ break;
/* G-337 L-16 | */
/* G-338 L-17 B-2 | */ case WM_SIZE:
/* G-339 L-18 B-2 | */ GetScrSize (&iScreenW, &iScreenH);
/* G-340 L-19 B-2 | */ break;
/* G-341 L-20 | */
/* G-342 L-21 B-2 | */ case WM_PAINT:
/* G-343 L-22 B-2 | */ hPS = WinBeginPaint (hWnd, 0, 0);
/* G-344 L-23 B-2 | */ for (iC1 = 0;
/* G-345 L-24 B-2 | */ iC1 < Balls.iNr;
/* G-346 L-25 B-2 | */ iC1++)
/* G-347 L-26 B-2 | */ {
/* G-348 L-27 B--3 | */ PaintBall (&Balls.Ball[iC1], Balls.Ball[iC1].iColor);
/* G-349 L-28 B-2 | */ }
/* G-350 L-29 B-2 | */ WinEndPaint (hPS);
/* G-351 L-30 B-2 | */ break;
/* G-352 L-31 | */
/* G-353 L-32 B-2 | */ case WM_ERASEBACKGROUND:
/* G-354 L-33 B-2 | */ ClrScr ();
/* G-355 L-34 B-2 | */ break;
/* G-356 L-35 | */
/* G-357 L-36 B-2 | */ default:
/* G-358 L-37 B-2 | */ return WinDefWindowProc (hWnd, ulMsg, mp1, mp2);
/* G-359 L-38 B1 | */ }
/* G-360 L-39 | */
/* G-361 L-40 B1 | */ return MRFROMLONG (FALSE);
/* G-362 L-41 | */}
#endif