home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / doslynx / src / main.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  1.4 KB  |  47 lines

  1. //    Copyright (c) 1993, University of Kansas, All Rights Reserved
  2. #include"tdoslynx.h"
  3. #include"globals.h"
  4. #include"memstrat.h"
  5. #include<stdlib.h>
  6.  
  7. extern int main(int i_argc, char **cpp_argv)    {
  8. //    Purpose:    Program entry, execution, exit
  9. //    Arguments:    argc    number of command line arguments
  10. //            argv    the command line arguments
  11. //    Return Value:    int    errorlevel returned to dos
  12. //    Remarks/Portability/Dependencies/Restrictions:
  13. //        Options can be specified on the command line.
  14. //    Revision History:
  15. //        12-09-93    created
  16.  
  17.     //    Here, override the default DOS memory allocation routine to
  18.     //    do what we want.  Save the value and restore it upon return
  19.     //    to DOS.
  20.     StrategyType ST_old = getMemoryAllocationStrategy();
  21.     setMemoryAllocationStrategy(firstFit);
  22.  
  23.     //    Fill up the really safe pool with memory.
  24.     for(register signed short int ssi_counter = 0; ssi_counter < RSP_NUM;
  25.         ssi_counter++)
  26.     {
  27.         really_safe_pool[ssi_counter] = (char *)malloc(RSP_SIZE);
  28.     }
  29.  
  30.     //    Create our one and only application object.
  31.     TDosLynx TDL(i_argc, cpp_argv);
  32.  
  33.     //    Execute the body of the program then retrun to dos.
  34.     TDL.run();
  35.  
  36.     //    Free up any parts of our really safe pool not already
  37.     //    deallocated.
  38.     for(ssi_counter = 0; ssi_counter < RSP_NUM; ssi_counter++)    {
  39.         if(really_safe_pool[ssi_counter] != NULL)    {
  40.             free(really_safe_pool[ssi_counter]);
  41.         }
  42.     }
  43.  
  44.     //    Back to dos.
  45.     setMemoryAllocationStrategy(ST_old);
  46.     return(0);
  47. }