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

  1. #include "microlib.h"
  2. #include "ibmpc.h"
  3.  
  4. #ifdef __TURBOC__
  5.     extern unsigned _stklen = 10000; /* Provide enough stack. */
  6. #endif
  7.  
  8. #include "messages.c"
  9. #include "files.c"
  10.  
  11. #define NORMAL_MODE             2
  12.  
  13. /* Global variables definitions.                                        */
  14. int     custom[26];                     /* Customization.               */
  15. int     srow[40];                       /* Screen coordinates  - row    */
  16. int     scol[40];                       /*                     - column */
  17. int     set_confirm;                    /* Confirmation on g4read().    */
  18. char    chksn[44];                      /* S/N                          */
  19. char    space_line[80] = "                                                                                ";
  20. char    codename[7+1];
  21. char    user[7];                        /* User ID.                     */
  22. char    privileges[10];                 /* User Privileges.             */
  23. char    wordprocessor[50];              /* Word Processor's Name.       */
  24. char    viewer[50];                     /* Viewer's Name.               */
  25. char    iepdrive[3];
  26. char    ieppath[50];
  27. int     doccreate;
  28. char    docdrive[3];
  29. char    docpath[50];
  30. H4FILE  net;
  31. char    pattern[13];
  32. char    search_code[7+1];
  33. int     wordproccounter;
  34. int     maxsubdirlen;
  35. char    comm_drive[3];
  36. char    comm_path[50];
  37. char    comm_program[50];
  38. int     filtdoc_flag = 0;
  39. char    helpline_save[150];
  40. char    statusline_save[150];
  41.  
  42. X4FILTER gl_filter;
  43. D4DATA  *gl_dbfile;
  44.  
  45. C4CODE  set;                            /* Code Base Settings structure. */
  46.  
  47. static int menu_char_entry();
  48.  
  49. VIDEOSTATUS vs;
  50.  
  51. main(argc, argv)
  52. int argc;
  53. char *argv[];
  54. {
  55.     int quit();
  56.     int go_system();
  57.     int persons();
  58.     int institut();
  59.     int topics();
  60.     int professions();
  61.     int newform();
  62.     int iep_wref;
  63.     int main_mref, basicfiles_mref, utilities_mref;
  64.     int search_mref;
  65.     int client_mref, opponent_mref, backup_mref;
  66.     int office_mref, pr_basic_mref;
  67.     int multiuser_mref;
  68.     int documents_mref, case_mref;
  69.     int filtcase_mref, filtdoc_mref;
  70.     int main_wref;
  71.     int count;
  72.     int ret_val;
  73.  
  74.     int filt_kw_doc();
  75.     int filt_kw_case();
  76.     int pfiltcas();
  77.     int backup();
  78.     int restore();
  79.  
  80.     d4init(&set);
  81.     /* Initial settings for Code Base 4.5 */
  82.     set.auto_open = 1;
  83.     set.safety = 0;
  84.  
  85.     set.wait = TRUE;
  86.     set.read_lock = FALSE;
  87.  
  88.     set_confirm = TRUE;
  89.  
  90.     /* Read settings from .INI file */
  91.     read_default_values();
  92.     strcpy(search_code, "       ");
  93.     strcpy(codename,    "       ");
  94.  
  95.     vioInit();
  96.  
  97.     if(argc > 1) {
  98.         memcpy(codename, argv[1], strlen(argv[1]));
  99.  
  100.         if( ! check_password(codename, argv[2])) {
  101.             d4close_all(&set);
  102.             w4clear(-1);
  103.             w4exit(1);
  104.             }
  105.         else {
  106.             wordproccounter = 0;
  107.             strcpy(search_code, argv[3]);
  108.             }
  109.         }
  110.     else {
  111.         wordproccounter = 100;
  112.         }
  113.  
  114.     /* Main Window definition */
  115.     main_wref = w4define(0, 0, 24, 79);
  116.     w4attribute(custom[MAIN_N]);
  117.     w4activate(main_wref);
  118.     w4clear(0);
  119.  
  120.     w4num_att(0, 0, "  ¡º╟╤╖ñ ¿╢╢¬╕¡╡╛╤ ╞╛╢¡¡╨¡╧╖╛╤                         (c) 1993 MicroLand Ltd.  ", 80, custom[STAT_N]);
  121.     w4num_att(1, 0, "                                                                                ", 80, custom[STAT_N]);
  122.  
  123.     for(count = 2; count <= 24; count ++)
  124.         w4num_att(count, 0, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░", 80, custom[MAIN_N]);
  125.  
  126.     if(argc <= 1) {
  127.         iep_wref = w4define(12, 1, 22, 78);
  128.         w4border(SINGLE, custom[MAIN_N]);
  129.         w4popup();
  130.         w4memory();
  131.         w4attribute(custom[MAIN_N]);
  132.         w4activate(iep_wref);
  133.         w4cursor(-1, -1);
  134.         if (screen_file(screens(SCR_SOLICITOR), 8, 78))      /* Microland Logo */
  135.             w4exit(1);
  136.  
  137.         //if(! login()) {
  138.         //    w4deactivate(iep_wref);
  139.         //    w4close(iep_wref);
  140.         //    w4deactivate(main_wref);
  141.         //    w4close(main_wref);
  142.         //    w4clear(-1);
  143.         //    w4exit(0);
  144.         //    }
  145.         w4deactivate(iep_wref);
  146.         w4close(iep_wref);
  147.         }
  148.  
  149.  
  150.     statline(mes[MS+2]);
  151.     helpline(mes[MH+3]);
  152. /*
  153. #ifndef IEP_DEMO
  154.     w4num_att(0, 60, "s/n: ", 5, custom[STAT_N]);
  155.     w4num_att(0, 65, chksn  ,14, custom[STAT_N]);
  156. #endif
  157. */
  158.  
  159. /* Calculate maximum sub-directory length. */
  160. /* maxsubdirlen = 127 - (codename + password + employee code +
  161.                                     len(wordprocessor) + filename + loadername) */
  162.     maxsubdirlen = 127 - (45 + strlen(wordprocessor));
  163.  
  164. /* Main Pulldown menu definition */
  165.     main_mref = w4define( 1, 0, 1, 79);
  166.     w4attribute(custom[MENU_N]);
  167. #ifdef __TURBOC__
  168.     n4attribute(custom[MENU_N], custom[MENU_S], custom[MENU_F]);
  169. #else
  170.     n4attribute(custom[MENU_N], custom[MENU_S]);
  171. #endif
  172.     n4("ñδ⌠▐ƒ╓ ▐≤╓δµΘ╪₧φ ");
  173.         n4reaction(n4sub_menu);
  174.         n4ptr_save(&basicfiles_mref);
  175.     n4("╥óδµ▐φ      ");
  176.         n4reaction(n4sub_menu);
  177.         n4ptr_save(&search_mref);
  178.     n4("¿δ╪╓∞ƒ▐φ ");
  179.         n4reaction(n4sub_menu);
  180.         n4ptr_save(&utilities_mref);
  181.  
  182.     basicfiles_mref = w4define(-1, -1, -1, -1);
  183.     w4attribute(custom[PULL_N]);
  184. #ifdef __TURBOC__
  185.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  186. #else
  187.     n4attribute(custom[PULL_N], custom[PULL_S]);
  188. #endif
  189.     w4border(SINGLE, custom[PULL_B]);
  190.     n4("╞δó∞·Ω╓               ");
  191.         n4key('P', 0, 19);
  192.         n4action( persons );
  193.     n4("¡▌δúµ╓ε╓ - ╛δ╪╓τπ∞µΘƒ ");
  194.         n4key('I', 0, 0);
  195.         n4action( institut );
  196.     n4skip_over( n4("──────────────────────"), 1);
  197.     n4("¿Ω╓╪╪¥σµ╓ε╓           ");
  198.         n4key('E', 0, 0);
  199.         n4action( professions );
  200.     n4("¿Σ▌ßσ²∞▐πφ            ");
  201.         n4key('k', 0, 0);
  202.         //n4action( employee );
  203.     n4("╧≥µµ▐εΘ⌠¥φ            ");
  204.         n4key('k', 0, 0);
  205.         //n4action( employee );
  206.     n4("¼¥µ╓ε╓                ");
  207.         n4key('A', 0, 0);
  208.         n4action( topics );
  209.     n4skip_over( n4("──────────────────────"), 1);
  210.     n4("╞δΘ∞·δπτ₧ ¥ΦΘ▌Θφ      ");
  211.         n4key('R', 0, 1);
  212.         n4action( go_system );
  213.     n4("╨¥σΘφ ΩδΘ╪δ¢µµ╓εΘφ    ");
  214.         n4key('T', 0, 0);
  215.         n4action( quit );
  216.  
  217.     search_mref = w4define(-1, -1, -1, -1);
  218.     w4attribute(custom[PULL_N]);
  219. #ifdef __TURBOC__
  220.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  221. #else
  222.     n4attribute(custom[PULL_N], custom[PULL_S]);
  223. #endif
  224.     w4border(SINGLE, custom[PULL_B]);
  225.     n4("╧⌠▐▌ƒ╓∞ß...      ");
  226.         n4key('º', 0, 0);
  227.         n4action( newform );
  228.     n4("╖▐ε╓╫Θσ₧...      ");
  229.         n4key('╖', 0, 19);
  230.         //n4action( add_user );
  231.     n4("¿ΣεúΩ·∞ß...      ");
  232.         n4key('¿', 0, 19);
  233.         //n4action( add_user );
  234.  
  235.  
  236.     utilities_mref = w4define(-1, -1, -1, -1);
  237.     w4attribute(custom[PULL_N]);
  238. #ifdef __TURBOC__
  239.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  240. #else
  241.     n4attribute(custom[PULL_N], custom[PULL_S]);
  242. #endif
  243.     w4border(SINGLE, custom[PULL_B]);
  244.     n4("ñτ╓▌πΘδ╪¢τ·∞ß ñδ⌠▐ƒ·τ      ");
  245.         n4key('A', 0, 0);
  246.         //n4action( pack );
  247.     n4skip_over( n4("───────────────────────────"), 1);
  248.     n4("¿π∞╓╪·╪₧ ∞εΘπ⌠▐ƒ·τ ⌠δ₧∞εß  ");
  249.         n4key('X', 0, 19);
  250.         //n4action( add_user );
  251.     n4skip_over( n4("───────────────────────────"), 1);
  252.     n4("ñτεƒ╪δ╓≤╓ ╓∞≤╓σ▐ƒ╓φ...     ");
  253.         n4key('S', 0, 11);
  254.         n4action(n4sub_menu);
  255.         n4ptr_save(&backup_mref);
  256.  
  257.     backup_mref = w4define(-1, -1, -1, -1);
  258.     w4attribute(custom[PULL_N]);
  259. #ifdef __TURBOC__
  260.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  261. #else
  262.     n4attribute(custom[PULL_N], custom[PULL_S]);
  263. #endif
  264.     w4border(SINGLE, custom[PULL_B]);
  265.     n4("ñτεπ╪δ╓≤₧ ╓δ⌠▐ƒ·τ (Backup)  ");
  266.         n4key('A', 0, 0);
  267.         //n4action( backup );
  268.     n4("¿Ω╓τ╓≤Θδ¢ ╓δ⌠▐ƒ·τ (Restore) ");
  269.         n4key('E', 0, 0);
  270.         //n4action( restore );
  271.  
  272.     multiuser_mref = w4define(-1, -1, -1, -1);
  273.     w4attribute(custom[PULL_N]);
  274. #ifdef __TURBOC__
  275.     n4attribute(custom[PULL_N], custom[PULL_S], custom[PULL_F]);
  276. #else
  277.     n4attribute(custom[PULL_N], custom[PULL_S]);
  278. #endif
  279.     w4border(SINGLE, custom[PULL_B]);
  280.     n4("¿π∞╓╪·╪₧ ∞εΘπ⌠▐ƒ·τ ⌠δ₧∞εß ");
  281.         n4key('X', 0, 14);
  282.         //n4action( add_user );
  283.     n4("ñσσ╓╪₧ ∞≥τΓßµ╓επΣ²τ       ");
  284.         n4key('S', 0, 7);
  285.         //n4action( (ACTION *) 0);
  286.     n4("╡╓ΓΘδπ∞µóφ ▌πΣ╓π·µ¢ε·τ    ");
  287.         n4key('D', 0, 11);
  288.         //n4action( (ACTION *) 0);
  289.  
  290.  
  291.  
  292.     w4cursor(-1,-1);
  293.     n4pulldown( main_mref );
  294.     n4char_routine( menu_char_entry );
  295.     while(TRUE) {
  296.         ret_val = n4activate( main_mref );
  297.  
  298.         if( ret_val == ESC ) {
  299.             if(warning(mes[MH+15]))
  300.                 quit();
  301.             }
  302.         }
  303.     }
  304.  
  305. int quit()
  306. {
  307.     h4close(&net);
  308.     w4clear(-1);
  309.     w4exit(0);
  310.     }
  311.  
  312. int go_system()
  313. {
  314.     int system_wref;
  315.     system_wref = w4define(0, 0, 24, 79);
  316.     w4attribute(custom[MAIN_N]);
  317.     w4popup();
  318.     w4memory();
  319.     w4activate(system_wref);
  320.  
  321.     w4select(0);
  322.     w4attribute(custom[MAIN_N]);
  323.     w4cursor(24, 1);
  324.     system( "command.com" );
  325.     w4select(system_wref);
  326.     w4cursor(-1, -1);
  327.     w4select(system_wref);
  328.     w4deactivate(system_wref);
  329.     w4close(system_wref);
  330.     return(1);
  331.     }
  332.  
  333.  
  334. load_logo_screen()
  335. {
  336.     int iep_wref;
  337.  
  338.     /* Logo Window definition */
  339.     iep_wref = w4define(7, 9, 15, 70);
  340.     w4attribute(112);
  341.     w4border(DOUBLE, 112);
  342.     w4popup();
  343.     w4memory();
  344.     w4activate(iep_wref);
  345.     w4cursor(-1, -1);
  346. #ifdef IEP_DEMO
  347.     w4(1, 2, "I E P  Demo Version");
  348. #else
  349.     w4(1, 2, "I E P  ver. 1.0");
  350.  
  351.     /* Display Serial Number. */
  352.     w4(5, 2, "Serial Number:");
  353.     w4num(5, 2+15, chksn, 14);
  354. #endif
  355.     w4(2, 2, "Copyright 1992 by Microland Ltd.");
  356.     w4(3, 2, "Created by Emmanuel J. Tzevelekakis");
  357.  
  358.     g4char();
  359.  
  360.     w4deactivate(iep_wref);
  361.     w4close(iep_wref);
  362.     }
  363.  
  364. int menu_char_entry()
  365. {
  366.     int rc;
  367.  
  368.     if(wordproccounter <= 4 && search_code[0] == 'Z') {
  369.         wordproccounter ++;
  370.         if(wordproccounter == 1) return(RIGHT);
  371.         if(wordproccounter == 2) return(RIGHT);
  372.         if(wordproccounter == 3) return(RETURN);
  373.         if(wordproccounter == 4) return(RETURN);
  374.         }
  375.  
  376.     rc = g4char();
  377.  
  378.     if(rc == F1) {
  379.         help("MAIN_MENU");
  380.         return(0);
  381.         }
  382.  
  383.     if(rc == ALT_F10) {
  384.         load_logo_screen();
  385.         return(0);
  386.         }
  387.  
  388.     return(grtolat(rc));
  389.     }
  390.  
  391.