home *** CD-ROM | disk | FTP | other *** search
/ Games 1995 to 2000 / Games.iso / SexTetris / SOL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-16  |  11.5 KB  |  457 lines

  1. #include "microlib.h"
  2.  
  3. #ifdef __TURBOC__
  4.     extern unsigned _stklen = 10000; /* Provide enough stack. */
  5. #endif
  6.  
  7. #include "messages.c"
  8. #include "files.c"
  9.  
  10. #define NORMAL_MODE                1
  11.  
  12. /* Global variables definitions.                                                */
  13. int    custom[26];                        /* Customization.                        */
  14. int    srow[40];                  /* Screen coordinates  - row        */
  15. int    scol[40];                  /*                     - column    */
  16. int   set_confirm;                    /* Confirmation on g4read().        */
  17. char  chksn[44];                        /* S/N                           */
  18. char    space_line[80] = "                                                                                ";
  19. char  codename[7+1];
  20. char    user[7];                            /* User ID.                                */
  21. char  privileges[10];                /* User Privileges.              */
  22. char  wordprocessor[50];         /* Word Processor's Name.        */
  23. char  viewer[50];                     /* Viewer's Name.                */
  24. char  soldrive[3];
  25. char  solpath[50];
  26. int    doccreate;
  27. char  docdrive[3];
  28. char  docpath[50];
  29. H4FILE net;
  30. char  pattern[13];
  31. char    search_code[7+1];
  32. int    wordproccounter;
  33. int    maxsubdirlen;
  34. char    comm_drive[3];
  35. char  comm_path[50];
  36. char  comm_program[50];
  37. int   filtdoc_flag = 0;
  38. char  helpline_save[150];
  39. char  statusline_save[150];
  40.  
  41. X4FILTER gl_filter;
  42. D4DATA *gl_dbfile;
  43.  
  44. C4CODE    set;                            /* Code Base Settings structure. */
  45.  
  46. static int menu_char_entry();
  47.  
  48. main(argc, argv)
  49. int argc;
  50. char *argv[];
  51. {
  52.     int quit();
  53.     int go_system();
  54.     int sol_wref;
  55.     int main_mref, basicfiles_mref, utilities_mref;
  56.     int client_mref, opponent_mref, backup_mref;
  57.     int office_mref, pr_basic_mref;
  58.     int multiuser_mref;
  59.     int documents_mref, case_mref;
  60.     int filtcase_mref, filtdoc_mref;
  61.     int main_wref;
  62.     int count;
  63.     int ret_val;
  64.  
  65.     int filt_kw_doc();
  66.     int filt_kw_case();
  67.     int pfiltcas();
  68.     int backup();
  69.     int restore();
  70.  
  71.     d4init(&set);
  72.     /* Initial settings for Code Base 4.5 */
  73.     set.auto_open = 1;
  74.     set.safety = 0;
  75.  
  76.     set.wait = TRUE;
  77.     set.read_lock = FALSE;
  78.  
  79.     set_confirm = TRUE;
  80.  
  81.     /* Read settings from .INI file */
  82.     read_default_values();
  83.     strcpy(search_code, "       ");
  84.     strcpy(codename,    "       ");
  85.  
  86.  
  87.     if(argc > 1) {
  88.         memcpy(codename, argv[1], strlen(argv[1]));
  89.  
  90.         if( ! check_password(codename, argv[2])) {
  91.             d4close_all(&set);
  92.             w4clear(-1);
  93.             w4exit(1);
  94.             }
  95.         else {
  96.             wordproccounter = 0;
  97.             strcpy(search_code, argv[3]);
  98. #ifndef SOL_DEMO
  99.             check_sn(! NORMAL_MODE);
  100. #endif
  101.             }
  102.         }
  103.     else {
  104.         wordproccounter = 100;
  105.         }
  106.  
  107.     /* Main Window definition */
  108.     main_wref = w4define(0, 0, 24, 79);
  109.     w4attribute(custom[MAIN_N]);
  110.     w4activate(main_wref);
  111.     w4clear(0);
  112. #ifdef SOL_DEMO
  113.     w4num_att(0, 0, "  Solicitor DEMO version (c)1992 Microland Ltd.                                 ", 80, custom[STAT_N]);
  114. #else
  115.     w4num_att(0, 0, "  Solicitor v.1.0 (c)1992 Microland Ltd.                                        ", 80, custom[STAT_N]);
  116. #endif
  117.     for(count = 1; count <= 24; count ++)
  118.         w4num_att(count, 0, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░", 80, custom[MAIN_N]);
  119.  
  120.     if(argc <= 1) {
  121.         sol_wref = w4define(12, 1, 22, 78);
  122.         w4border(SINGLE, custom[MAIN_N]);
  123.         w4popup();
  124.         w4memory();
  125.         w4attribute(custom[MAIN_N]);
  126.         w4activate(sol_wref);
  127.         w4cursor(-1, -1);
  128.         if(screen_file(screens(12), 8, 78))      /* Microland Logo */
  129.             w4exit(1);
  130.         if(! login()) {
  131.             w4deactivate(sol_wref);
  132.             w4close(sol_wref);
  133.             w4deactivate(main_wref);
  134.             w4close(main_wref);
  135.             w4clear(-1);
  136.             w4exit(0);
  137.             }
  138.         w4deactivate(sol_wref);
  139.         w4close(sol_wref);
  140.  
  141. #ifndef SOL_DEMO
  142.     check_sn(NORMAL_MODE);
  143. #endif
  144.         }
  145.  
  146.  
  147.     statline(mes[MS+2]);
  148.     helpline(mes[MH+3]);
  149.  
  150. #ifndef SOL_DEMO
  151.     w4num_att(0, 60, "s/n: ", 5, custom[STAT_N]);
  152.     w4num_att(0, 65, chksn  ,14, custom[STAT_N]);
  153. #endif
  154.  
  155. /* Calculate maximum sub-directory length. */
  156. /* maxsubdirlen = 127 - (codename + password + employee code +
  157.                                     len(wordprocessor) + filename + loadername) */
  158.     maxsubdirlen = 127 - (45 + strlen(wordprocessor));
  159.  
  160. /* Main Pulldown menu definition */
  161.     main_mref = w4define( 1, 0, 1, 79);
  162.     w4attribute(custom[MENU_N]);
  163.     n4attribute(custom[MENU_N], custom[MENU_S], custom[MENU_F]);
  164.     n4("üÿ⌐áíß Ç¿«£σÿ ");
  165.         n4reaction(n4sub_menu);
  166.         n4ptr_save(&basicfiles_mref);
  167.     n4("Äúÿ¢ªºªáπ⌐£á¬/äí½¼ºΘ⌐£á¬ ");
  168.         n4reaction(n4sub_menu);
  169.         n4ptr_save(&pr_basic_mref);
  170.     n4("âáÿ«£σ¿á⌐₧ é¿ÿ¡£σª¼  ");
  171.         n4reaction(n4sub_menu);
  172.         n4ptr_save(&office_mref);
  173.     n4("ä¿Üÿ⌐󣬠");
  174.         n4reaction(n4sub_menu);
  175.         n4ptr_save(&utilities_mref);
  176.  
  177.     basicfiles_mref = w4define(-1, -1, -1, -1);
  178.     w4attribute(custom[PULL_N]);
  179.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  180.     w4border(SINGLE, custom[PULL_B]);
  181.     n4("ôºªƒΓ⌐£á¬...        ");
  182.         n4key('Y', 0, 0);
  183.         n4action(n4sub_menu);
  184.         n4ptr_save(&case_mref);
  185.     n4skip_over( n4("────────────────────"), 1);
  186.     n4("æ¼ñ£¿Üß½£¬          ");
  187.         n4key('S', 0, 0);
  188.         n4action( employee );
  189.     n4("Å£óß½£¬...          ");
  190.         n4key('P', 0, 0);
  191.         n4action(n4sub_menu);
  192.         n4ptr_save(&client_mref);
  193.     n4("Çñ½σ¢áíªá...        ");
  194.         n4key('A', 0, 0);
  195.         n4action(n4sub_menu);
  196.         n4ptr_save(&opponent_mref);
  197.     n4("âáíÿ⌐½Γ¬            ");
  198.         n4key('K', 0, 2);
  199.         n4action( judge );
  200.     n4("âáí₧ܵ¿ªá Çñ½á¢σíαñ ");
  201.         n4key('G', 0, 4);
  202.         n4action( o_lawyer );
  203.     n4skip_over( n4("────────────────────"), 1);
  204.     n4("Å¿ª⌐α¿áñπ äѪ¢ª¬    ");
  205.         n4key('R', 0, 1);
  206.         n4action( go_system );
  207.     n4("ÆΓ󪬠ſªÜ¿ßúúÿ½ª¬  ");
  208.         n4key('T', 0, 0);
  209.         n4action( quit );
  210.  
  211.  
  212.  
  213.     utilities_mref = w4define(-1, -1, -1, -1);
  214.     w4attribute(custom[PULL_N]);
  215.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  216.     w4border(SINGLE, custom[PULL_B]);
  217.     n4("Çñÿ¢áª¿Üßñα⌐₧ Ç¿«£σαñ      ");
  218.         n4key('A', 0, 0);
  219.         n4action( pack );
  220.     n4skip_over( n4("───────────────────────────"), 1);
  221.     n4("äá⌐ÿÜαÜπ ⌐½ªá«£σαñ «¿π⌐½₧  ");
  222.         n4key('X', 0, 19);
  223.         n4action( add_user );
  224.     n4skip_over( n4("───────────────────────────"), 1);
  225.     n4("Çñ½σÜ¿ÿ¡ÿ Ç⌐¡ÿó£σÿ¬...     ");
  226.         n4key('S', 0, 11);
  227.         n4action(n4sub_menu);
  228.         n4ptr_save(&backup_mref);
  229.  
  230.     backup_mref = w4define(-1, -1, -1, -1);
  231.     w4attribute(custom[PULL_N]);
  232.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  233.     w4border(SINGLE, custom[PULL_B]);
  234.     n4("Çñ½áÜ¿ÿ¡π ÿ¿«£σαñ (Backup)  ");
  235.         n4key('A', 0, 0);
  236.         n4action( backup );
  237.     n4("äºÿñÿ¡ª¿ß ÿ¿«£σαñ (Restore) ");
  238.         n4key('E', 0, 0);
  239.         n4action( restore );
  240. /*
  241.     multiuser_mref = w4define(-1, -1, -1, -1);
  242.     w4attribute(custom[PULL_N]);
  243.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  244.     w4border(SINGLE, custom[PULL_B]);
  245.     n4("äá⌐ÿÜαÜπ æ½ªá«£σαñ ò¿π⌐½₧ ");
  246.         n4key('X', 0, 14);
  247.         n4action( add_user );
  248.     n4("ÇóóÿÜπ æ¼ñƒ₧úÿ½áíΘñ       ");
  249.         n4key('S', 0, 7);
  250.         n4action( (ACTION *) 0);
  251.     n4("ëÿƒª¿á⌐úµ¬ âáíÿáαúß½αñ    ");
  252.         n4key('D', 0, 11);
  253.         n4action( (ACTION *) 0);
  254. */
  255.  
  256.  
  257.     client_mref = w4define(-1, -1, -1, -1);
  258.     w4attribute(custom[PULL_N]);
  259.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  260.     w4border(SINGLE, custom[PULL_B]);
  261.     n4("ö¼⌐áíß Å¿µ⌐αºÿ      ");
  262.         n4key('F', 0, 0);
  263.         n4action( pclient );
  264.     n4("îªúáíß Å¿µ⌐αºÿ      ");
  265.         n4key('N', 0, 0);
  266.         n4action( cclient );
  267.  
  268.     case_mref = w4define(-1, -1, -1, -1);
  269.     w4attribute(custom[PULL_N]);
  270.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  271.     w4border(SINGLE, custom[PULL_B]);
  272.     n4("潪᫣σÿ ôºµƒ£⌐₧¬       ");
  273.         n4key('S', 0, 0);
  274.         n4action( thecase );
  275.     n4("Çñÿ¥π½₧⌐₧ ôºªƒΓ⌐£αñ...  ");
  276.         n4key('A', 0, 0);
  277.         n4action(n4sub_menu);
  278.         n4ptr_save(&filtcase_mref);
  279.  
  280.     filtcase_mref = w4define(-1, -1, -1, -1);
  281.     w4attribute(custom[PULL_N]);
  282.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  283.     w4border(SINGLE, custom[PULL_B]);
  284.     n4("¢áß¡ª¿ÿ í¿á½π¿áÿ     ");
  285.         n4key('K', 0, 11);
  286.         n4action( &filtcase );
  287.     n4("óΓѣᬠíó£á¢áß       ");
  288.         n4key('L', 0, 3);
  289.         n4action( filt_kw_case );
  290.  
  291.     opponent_mref = w4define(-1, -1, -1, -1);
  292.     w4attribute(custom[PULL_N]);
  293.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  294.     w4border(SINGLE, custom[PULL_B]);
  295.     n4("ö¼⌐áíß Å¿µ⌐αºÿ      ");
  296.         n4key('F', 0, 0);
  297.         n4action( popponent );
  298.     n4("îªúáíß Å¿µ⌐αºÿ      ");
  299.         n4key('N', 0, 0);
  300.         n4action( copponent );
  301.  
  302.     office_mref = w4define(-1, -1, -1, -1);
  303.     w4attribute(custom[PULL_N]);
  304.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  305.     w4border(SINGLE, custom[PULL_B]);
  306.     n4("äÜÜ¿ÿ¡ÿ...                      ");
  307.         n4key('E', 0, 0);
  308.         n4action(n4sub_menu);
  309.         n4ptr_save(&documents_mref);
  310.     n4("äºáíªáñαñσÿ ú£ üß⌐£á¬ â£¢ªúΓñαñ ");
  311.         n4key('P', 0, 1);
  312.         n4action( commun );
  313.  
  314.     documents_mref = w4define(-1, -1, -1, -1);
  315.     w4attribute(custom[PULL_N]);
  316.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  317.     w4border(SINGLE, custom[PULL_B]);
  318.     n4("潪᫣σÿ äÜܿߡª¼      ");
  319.         n4key('S', 0, 0);
  320.         n4action( document );
  321.     n4("Çñÿ¥π½₧⌐₧ äÜܿߡαñ...  ");
  322.         n4key('A', 0, 0);
  323.         n4action(n4sub_menu);
  324.         n4ptr_save(&filtdoc_mref);
  325.  
  326.     filtdoc_mref = w4define(-1, -1, -1, -1);
  327.     w4attribute(custom[PULL_N]);
  328.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  329.     w4border(SINGLE, custom[PULL_B]);
  330.     n4("¢áß¡ª¿ÿ í¿á½π¿áÿ     ");
  331.         n4key('K', 0, 11);
  332.         n4action( filtdoc );
  333.     n4("óΓѣᬠíó£á¢áß       ");
  334.         n4key('L', 0, 3);
  335.         n4action( filt_kw_doc );
  336.  
  337.     pr_basic_mref = w4define(-1, -1, -1, -1);
  338.     w4attribute(custom[PULL_N]);
  339.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  340.     w4border(SINGLE, custom[PULL_B]);
  341.     n4("äí½τºα⌐₧ ôºªƒΓ⌐£αñ               ");
  342.         n4key('Y', 0, 9);
  343.         n4action( pfiltcas );
  344.     n4skip_over( n4("─────────────────────────────────"), 1);
  345.     n4("äí½τºα⌐₧ Å£óÿ½Θñ                 ");
  346.         n4key('P', 0, 9);
  347.         n4action( filtclient );
  348.     n4("äí½τºα⌐₧ Çñ½á¢σíαñ               ");
  349.         n4key('A', 0, 9);
  350.         n4action( filtopponent );
  351.     n4("äí½τºα⌐₧ âáíÿ⌐½Θñ                ");
  352.         n4key('K', 0, 11);
  353.         n4action( filtjudge );
  354.     n4("äí½τºα⌐₧ âáí₧ܵ¿αñ Çñ½á¢σíª¼     ");
  355.         n4key('G', 0, 13);
  356.         n4action( filto_lawyer );
  357.  
  358.     w4cursor(-1,-1);
  359.     n4pulldown( main_mref );
  360.     n4char_routine( menu_char_entry );
  361.     while(TRUE) {
  362.         ret_val = n4activate( main_mref );
  363.  
  364.         if( ret_val == ESC ) {
  365.             if(warning(mes[MH+15]))
  366.                 quit();
  367.             }
  368.         }
  369.     }
  370.  
  371. int quit()
  372. {
  373.     h4close(&net);
  374.     w4clear(-1);
  375.     w4exit(0);
  376.     }
  377.  
  378. int go_system()
  379. {
  380.     int system_wref;
  381.     system_wref = w4define(0, 0, 24, 79);
  382.     w4attribute(custom[MAIN_N]);
  383.     w4popup();
  384.     w4memory();
  385.     w4activate(system_wref);
  386.  
  387.     w4select(0);
  388.     w4attribute(custom[MAIN_N]);
  389.     w4cursor(24, 1);
  390.     system( "command.com" );
  391.     w4select(system_wref);
  392.     w4cursor(-1, -1);
  393.     w4select(system_wref);
  394.     w4deactivate(system_wref);
  395.     w4close(system_wref);
  396.     return(1);
  397.     }
  398.  
  399.  
  400. load_logo_screen()
  401. {
  402.     int sol_wref;
  403.  
  404.     /* Logo Window definition */
  405.     sol_wref = w4define(7, 9, 15, 70);
  406.     w4attribute(112);
  407.     w4border(DOUBLE, 112);
  408.     w4popup();
  409.     w4memory();
  410.     w4activate(sol_wref);
  411.     w4cursor(-1, -1);
  412. #ifdef SOL_DEMO
  413.     w4(1, 2, "S o l i c i t o r  Demo Version");
  414. #else
  415.     w4(1, 2, "S o l i c i t o r  ver. 1.0");
  416.  
  417.     /* Display Serial Number. */
  418.     w4(5, 2, "Serial Number:");
  419.     w4num(5, 2+15, chksn, 14);
  420. #endif
  421.     w4(2, 2, "Copyright 1992 by Microland Ltd.");
  422.     w4(3, 2, "Created by Emmanuel J. Tzevelekakis");
  423.  
  424.     g4char();
  425.  
  426.     w4deactivate(sol_wref);
  427.     w4close(sol_wref);
  428.     }
  429.  
  430. int menu_char_entry()
  431. {
  432.     int    rc;
  433.  
  434.     if(wordproccounter <= 4 && search_code[0] == 'Z') {
  435.         wordproccounter ++;
  436.         if(wordproccounter == 1) return(RIGHT);
  437.         if(wordproccounter == 2) return(RIGHT);
  438.         if(wordproccounter == 3) return(RETURN);
  439.         if(wordproccounter == 4) return(RETURN);
  440.         }
  441.  
  442.     rc = g4char();
  443.  
  444.     if(rc == F1) {
  445.         help("MAIN_MENU");
  446.         return(0);
  447.         }
  448.  
  449.     if(rc == ALT_F10) {
  450.         load_logo_screen();
  451.         return(0);
  452.         }
  453.  
  454.     return(grtolat(rc));
  455.     }
  456.  
  457.