Home » Archimedes archive » Acorn User » AU 1996-03 B.adf » Features » Vocabulary/Source/ins_del

Vocabulary/Source/ins_del

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1996-03 B.adf » Features
Filename: Vocabulary/Source/ins_del
Read OK:
File size: 08D8 bytes
Load address: 0000
Exec address: 0000
File contents
#include "inc.h"

extern dbox edit;
extern dbox wrong;
extern char german[170][40];
extern char english[170][40];
extern char wrong_word_english[170][40];
extern char wrong_word_german[170][40];
extern int addon1;
extern int addon2;
extern char title[70];
extern char subtitle[70];
extern char language[70];
extern int ins;
extern int dn;
extern char temp_ins[50];
extern char temp_dn[50];

extern int wn;
extern redraw_edit(void);
extern redraw_wrong(void);
extern void get_new_n(void);
extern int n;


  void edit_insert(void)
  {
  int j;
  int t = 148;

  ins=atoi(temp_ins);

    if (ins<1 || ins>150)
    {
    werr(0,"You can't DO THAT");
    return;
    }

    ins--;

    if (strcmp(german[149],"")!=0 && strcmp(english[149],"")!=0)
    {
    j=dboxquery("If you insert a word, the word at the end of the list (number 150) will be erased. Are you sure you want to insert?");
      
      if (j==1)
      { 

         while(t>=ins)
         {
         strcpy(german[t+1],german[t]);
         t--;
         }
      strcpy(german[ins],"");


      t = 148;
   
         while(t>=ins)
         {
         strcpy(english[t+1],english[t]);
         t--;
         }
      strcpy(english[ins],"");
      n++;
      get_new_n();
      }
     }
      else
      {
       while(t>=ins)
        {
        strcpy(german[t+1],german[t]);
        t--;
        }
      strcpy(german[ins],"");


     t = 148;
        while(t>=ins)
        {
        strcpy(english[t+1],english[t]);
        t--;
        }
   strcpy(english[ins],"");
   n++;
get_new_n();
}
}



void edit_delete(void)
{


dn=atoi(temp_dn);

if (dn<1 || dn>150)
{
werr(0,"You can't DO THAT");
return;
}

/*dn--;*/

if (dn == 150)
{
strcpy(german[150],"");
strcpy(english[150],"");
}

while (dn < 150)
{
strcpy(german[dn-1],german[dn]);
strcpy(english[dn-1],english[dn]);
dn++;
}
get_new_n();

redraw_edit();
}


void wrong_delete(void)
{
dn=atoi(temp_dn);

if (dn<1 || dn>150)
{
werr(0,"You can't DO THAT");
return;
}

/*dn--;
dn--;*/

if (dn == 150)
{
strcpy(wrong_word_german[150],"");
strcpy(wrong_word_english[150],"");
}

while (dn < 150)
{
strcpy(wrong_word_german[dn-1],wrong_word_german[dn]);
strcpy(wrong_word_english[dn-1],wrong_word_english[dn]);
dn++;
}
wn--;
get_new_n();
redraw_wrong();
}



00000000  23 69 6e 63 6c 75 64 65  20 22 69 6e 63 2e 68 22  |#include "inc.h"|
00000010  0a 0a 65 78 74 65 72 6e  20 64 62 6f 78 20 65 64  |..extern dbox ed|
00000020  69 74 3b 0a 65 78 74 65  72 6e 20 64 62 6f 78 20  |it;.extern dbox |
00000030  77 72 6f 6e 67 3b 0a 65  78 74 65 72 6e 20 63 68  |wrong;.extern ch|
00000040  61 72 20 67 65 72 6d 61  6e 5b 31 37 30 5d 5b 34  |ar german[170][4|
00000050  30 5d 3b 0a 65 78 74 65  72 6e 20 63 68 61 72 20  |0];.extern char |
00000060  65 6e 67 6c 69 73 68 5b  31 37 30 5d 5b 34 30 5d  |english[170][40]|
00000070  3b 0a 65 78 74 65 72 6e  20 63 68 61 72 20 77 72  |;.extern char wr|
00000080  6f 6e 67 5f 77 6f 72 64  5f 65 6e 67 6c 69 73 68  |ong_word_english|
00000090  5b 31 37 30 5d 5b 34 30  5d 3b 0a 65 78 74 65 72  |[170][40];.exter|
000000a0  6e 20 63 68 61 72 20 77  72 6f 6e 67 5f 77 6f 72  |n char wrong_wor|
000000b0  64 5f 67 65 72 6d 61 6e  5b 31 37 30 5d 5b 34 30  |d_german[170][40|
000000c0  5d 3b 0a 65 78 74 65 72  6e 20 69 6e 74 20 61 64  |];.extern int ad|
000000d0  64 6f 6e 31 3b 0a 65 78  74 65 72 6e 20 69 6e 74  |don1;.extern int|
000000e0  20 61 64 64 6f 6e 32 3b  0a 65 78 74 65 72 6e 20  | addon2;.extern |
000000f0  63 68 61 72 20 74 69 74  6c 65 5b 37 30 5d 3b 0a  |char title[70];.|
00000100  65 78 74 65 72 6e 20 63  68 61 72 20 73 75 62 74  |extern char subt|
00000110  69 74 6c 65 5b 37 30 5d  3b 0a 65 78 74 65 72 6e  |itle[70];.extern|
00000120  20 63 68 61 72 20 6c 61  6e 67 75 61 67 65 5b 37  | char language[7|
00000130  30 5d 3b 0a 65 78 74 65  72 6e 20 69 6e 74 20 69  |0];.extern int i|
00000140  6e 73 3b 0a 65 78 74 65  72 6e 20 69 6e 74 20 64  |ns;.extern int d|
00000150  6e 3b 0a 65 78 74 65 72  6e 20 63 68 61 72 20 74  |n;.extern char t|
00000160  65 6d 70 5f 69 6e 73 5b  35 30 5d 3b 0a 65 78 74  |emp_ins[50];.ext|
00000170  65 72 6e 20 63 68 61 72  20 74 65 6d 70 5f 64 6e  |ern char temp_dn|
00000180  5b 35 30 5d 3b 0a 0a 65  78 74 65 72 6e 20 69 6e  |[50];..extern in|
00000190  74 20 77 6e 3b 0a 65 78  74 65 72 6e 20 72 65 64  |t wn;.extern red|
000001a0  72 61 77 5f 65 64 69 74  28 76 6f 69 64 29 3b 0a  |raw_edit(void);.|
000001b0  65 78 74 65 72 6e 20 72  65 64 72 61 77 5f 77 72  |extern redraw_wr|
000001c0  6f 6e 67 28 76 6f 69 64  29 3b 0a 65 78 74 65 72  |ong(void);.exter|
000001d0  6e 20 76 6f 69 64 20 67  65 74 5f 6e 65 77 5f 6e  |n void get_new_n|
000001e0  28 76 6f 69 64 29 3b 0a  65 78 74 65 72 6e 20 69  |(void);.extern i|
000001f0  6e 74 20 6e 3b 0a 0a 0a  20 20 76 6f 69 64 20 65  |nt n;...  void e|
00000200  64 69 74 5f 69 6e 73 65  72 74 28 76 6f 69 64 29  |dit_insert(void)|
00000210  0a 20 20 7b 0a 20 20 69  6e 74 20 6a 3b 0a 20 20  |.  {.  int j;.  |
00000220  69 6e 74 20 74 20 3d 20  31 34 38 3b 0a 0a 20 20  |int t = 148;..  |
00000230  69 6e 73 3d 61 74 6f 69  28 74 65 6d 70 5f 69 6e  |ins=atoi(temp_in|
00000240  73 29 3b 0a 0a 20 20 20  20 69 66 20 28 69 6e 73  |s);..    if (ins|
00000250  3c 31 20 7c 7c 20 69 6e  73 3e 31 35 30 29 0a 20  |<1 || ins>150). |
00000260  20 20 20 7b 0a 20 20 20  20 77 65 72 72 28 30 2c  |   {.    werr(0,|
00000270  22 59 6f 75 20 63 61 6e  27 74 20 44 4f 20 54 48  |"You can't DO TH|
00000280  41 54 22 29 3b 0a 20 20  20 20 72 65 74 75 72 6e  |AT");.    return|
00000290  3b 0a 20 20 20 20 7d 0a  0a 20 20 20 20 69 6e 73  |;.    }..    ins|
000002a0  2d 2d 3b 0a 0a 20 20 20  20 69 66 20 28 73 74 72  |--;..    if (str|
000002b0  63 6d 70 28 67 65 72 6d  61 6e 5b 31 34 39 5d 2c  |cmp(german[149],|
000002c0  22 22 29 21 3d 30 20 26  26 20 73 74 72 63 6d 70  |"")!=0 && strcmp|
000002d0  28 65 6e 67 6c 69 73 68  5b 31 34 39 5d 2c 22 22  |(english[149],""|
000002e0  29 21 3d 30 29 0a 20 20  20 20 7b 0a 20 20 20 20  |)!=0).    {.    |
000002f0  6a 3d 64 62 6f 78 71 75  65 72 79 28 22 49 66 20  |j=dboxquery("If |
00000300  79 6f 75 20 69 6e 73 65  72 74 20 61 20 77 6f 72  |you insert a wor|
00000310  64 2c 20 74 68 65 20 77  6f 72 64 20 61 74 20 74  |d, the word at t|
00000320  68 65 20 65 6e 64 20 6f  66 20 74 68 65 20 6c 69  |he end of the li|
00000330  73 74 20 28 6e 75 6d 62  65 72 20 31 35 30 29 20  |st (number 150) |
00000340  77 69 6c 6c 20 62 65 20  65 72 61 73 65 64 2e 20  |will be erased. |
00000350  41 72 65 20 79 6f 75 20  73 75 72 65 20 79 6f 75  |Are you sure you|
00000360  20 77 61 6e 74 20 74 6f  20 69 6e 73 65 72 74 3f  | want to insert?|
00000370  22 29 3b 0a 20 20 20 20  20 20 0a 20 20 20 20 20  |");.      .     |
00000380  20 69 66 20 28 6a 3d 3d  31 29 0a 20 20 20 20 20  | if (j==1).     |
00000390  20 7b 20 0a 0a 20 20 20  20 20 20 20 20 20 77 68  | { ..         wh|
000003a0  69 6c 65 28 74 3e 3d 69  6e 73 29 0a 20 20 20 20  |ile(t>=ins).    |
000003b0  20 20 20 20 20 7b 0a 20  20 20 20 20 20 20 20 20  |     {.         |
000003c0  73 74 72 63 70 79 28 67  65 72 6d 61 6e 5b 74 2b  |strcpy(german[t+|
000003d0  31 5d 2c 67 65 72 6d 61  6e 5b 74 5d 29 3b 0a 20  |1],german[t]);. |
000003e0  20 20 20 20 20 20 20 20  74 2d 2d 3b 0a 20 20 20  |        t--;.   |
000003f0  20 20 20 20 20 20 7d 0a  20 20 20 20 20 20 73 74  |      }.      st|
00000400  72 63 70 79 28 67 65 72  6d 61 6e 5b 69 6e 73 5d  |rcpy(german[ins]|
00000410  2c 22 22 29 3b 0a 0a 0a  20 20 20 20 20 20 74 20  |,"");...      t |
00000420  3d 20 31 34 38 3b 0a 20  20 20 0a 20 20 20 20 20  |= 148;.   .     |
00000430  20 20 20 20 77 68 69 6c  65 28 74 3e 3d 69 6e 73  |    while(t>=ins|
00000440  29 0a 20 20 20 20 20 20  20 20 20 7b 0a 20 20 20  |).         {.   |
00000450  20 20 20 20 20 20 73 74  72 63 70 79 28 65 6e 67  |      strcpy(eng|
00000460  6c 69 73 68 5b 74 2b 31  5d 2c 65 6e 67 6c 69 73  |lish[t+1],englis|
00000470  68 5b 74 5d 29 3b 0a 20  20 20 20 20 20 20 20 20  |h[t]);.         |
00000480  74 2d 2d 3b 0a 20 20 20  20 20 20 20 20 20 7d 0a  |t--;.         }.|
00000490  20 20 20 20 20 20 73 74  72 63 70 79 28 65 6e 67  |      strcpy(eng|
000004a0  6c 69 73 68 5b 69 6e 73  5d 2c 22 22 29 3b 0a 20  |lish[ins],"");. |
000004b0  20 20 20 20 20 6e 2b 2b  3b 0a 20 20 20 20 20 20  |     n++;.      |
000004c0  67 65 74 5f 6e 65 77 5f  6e 28 29 3b 0a 20 20 20  |get_new_n();.   |
000004d0  20 20 20 7d 0a 20 20 20  20 20 7d 0a 20 20 20 20  |   }.     }.    |
000004e0  20 20 65 6c 73 65 0a 20  20 20 20 20 20 7b 0a 20  |  else.      {. |
000004f0  20 20 20 20 20 20 77 68  69 6c 65 28 74 3e 3d 69  |      while(t>=i|
00000500  6e 73 29 0a 20 20 20 20  20 20 20 20 7b 0a 20 20  |ns).        {.  |
00000510  20 20 20 20 20 20 73 74  72 63 70 79 28 67 65 72  |      strcpy(ger|
00000520  6d 61 6e 5b 74 2b 31 5d  2c 67 65 72 6d 61 6e 5b  |man[t+1],german[|
00000530  74 5d 29 3b 0a 20 20 20  20 20 20 20 20 74 2d 2d  |t]);.        t--|
00000540  3b 0a 20 20 20 20 20 20  20 20 7d 0a 20 20 20 20  |;.        }.    |
00000550  20 20 73 74 72 63 70 79  28 67 65 72 6d 61 6e 5b  |  strcpy(german[|
00000560  69 6e 73 5d 2c 22 22 29  3b 0a 0a 0a 20 20 20 20  |ins],"");...    |
00000570  20 74 20 3d 20 31 34 38  3b 0a 20 20 20 20 20 20  | t = 148;.      |
00000580  20 20 77 68 69 6c 65 28  74 3e 3d 69 6e 73 29 0a  |  while(t>=ins).|
00000590  20 20 20 20 20 20 20 20  7b 0a 20 20 20 20 20 20  |        {.      |
000005a0  20 20 73 74 72 63 70 79  28 65 6e 67 6c 69 73 68  |  strcpy(english|
000005b0  5b 74 2b 31 5d 2c 65 6e  67 6c 69 73 68 5b 74 5d  |[t+1],english[t]|
000005c0  29 3b 0a 20 20 20 20 20  20 20 20 74 2d 2d 3b 0a  |);.        t--;.|
000005d0  20 20 20 20 20 20 20 20  7d 0a 20 20 20 73 74 72  |        }.   str|
000005e0  63 70 79 28 65 6e 67 6c  69 73 68 5b 69 6e 73 5d  |cpy(english[ins]|
000005f0  2c 22 22 29 3b 0a 20 20  20 6e 2b 2b 3b 0a 67 65  |,"");.   n++;.ge|
00000600  74 5f 6e 65 77 5f 6e 28  29 3b 0a 7d 0a 7d 0a 0a  |t_new_n();.}.}..|
00000610  0a 0a 76 6f 69 64 20 65  64 69 74 5f 64 65 6c 65  |..void edit_dele|
00000620  74 65 28 76 6f 69 64 29  0a 7b 0a 0a 0a 64 6e 3d  |te(void).{...dn=|
00000630  61 74 6f 69 28 74 65 6d  70 5f 64 6e 29 3b 0a 0a  |atoi(temp_dn);..|
00000640  69 66 20 28 64 6e 3c 31  20 7c 7c 20 64 6e 3e 31  |if (dn<1 || dn>1|
00000650  35 30 29 0a 7b 0a 77 65  72 72 28 30 2c 22 59 6f  |50).{.werr(0,"Yo|
00000660  75 20 63 61 6e 27 74 20  44 4f 20 54 48 41 54 22  |u can't DO THAT"|
00000670  29 3b 0a 72 65 74 75 72  6e 3b 0a 7d 0a 0a 2f 2a  |);.return;.}../*|
00000680  64 6e 2d 2d 3b 2a 2f 0a  0a 69 66 20 28 64 6e 20  |dn--;*/..if (dn |
00000690  3d 3d 20 31 35 30 29 0a  7b 0a 73 74 72 63 70 79  |== 150).{.strcpy|
000006a0  28 67 65 72 6d 61 6e 5b  31 35 30 5d 2c 22 22 29  |(german[150],"")|
000006b0  3b 0a 73 74 72 63 70 79  28 65 6e 67 6c 69 73 68  |;.strcpy(english|
000006c0  5b 31 35 30 5d 2c 22 22  29 3b 0a 7d 0a 0a 77 68  |[150],"");.}..wh|
000006d0  69 6c 65 20 28 64 6e 20  3c 20 31 35 30 29 0a 7b  |ile (dn < 150).{|
000006e0  0a 73 74 72 63 70 79 28  67 65 72 6d 61 6e 5b 64  |.strcpy(german[d|
000006f0  6e 2d 31 5d 2c 67 65 72  6d 61 6e 5b 64 6e 5d 29  |n-1],german[dn])|
00000700  3b 0a 73 74 72 63 70 79  28 65 6e 67 6c 69 73 68  |;.strcpy(english|
00000710  5b 64 6e 2d 31 5d 2c 65  6e 67 6c 69 73 68 5b 64  |[dn-1],english[d|
00000720  6e 5d 29 3b 0a 64 6e 2b  2b 3b 0a 7d 0a 67 65 74  |n]);.dn++;.}.get|
00000730  5f 6e 65 77 5f 6e 28 29  3b 0a 0a 72 65 64 72 61  |_new_n();..redra|
00000740  77 5f 65 64 69 74 28 29  3b 0a 7d 0a 0a 0a 76 6f  |w_edit();.}...vo|
00000750  69 64 20 77 72 6f 6e 67  5f 64 65 6c 65 74 65 28  |id wrong_delete(|
00000760  76 6f 69 64 29 0a 7b 0a  64 6e 3d 61 74 6f 69 28  |void).{.dn=atoi(|
00000770  74 65 6d 70 5f 64 6e 29  3b 0a 0a 69 66 20 28 64  |temp_dn);..if (d|
00000780  6e 3c 31 20 7c 7c 20 64  6e 3e 31 35 30 29 0a 7b  |n<1 || dn>150).{|
00000790  0a 77 65 72 72 28 30 2c  22 59 6f 75 20 63 61 6e  |.werr(0,"You can|
000007a0  27 74 20 44 4f 20 54 48  41 54 22 29 3b 0a 72 65  |'t DO THAT");.re|
000007b0  74 75 72 6e 3b 0a 7d 0a  0a 2f 2a 64 6e 2d 2d 3b  |turn;.}../*dn--;|
000007c0  0a 64 6e 2d 2d 3b 2a 2f  0a 0a 69 66 20 28 64 6e  |.dn--;*/..if (dn|
000007d0  20 3d 3d 20 31 35 30 29  0a 7b 0a 73 74 72 63 70  | == 150).{.strcp|
000007e0  79 28 77 72 6f 6e 67 5f  77 6f 72 64 5f 67 65 72  |y(wrong_word_ger|
000007f0  6d 61 6e 5b 31 35 30 5d  2c 22 22 29 3b 0a 73 74  |man[150],"");.st|
00000800  72 63 70 79 28 77 72 6f  6e 67 5f 77 6f 72 64 5f  |rcpy(wrong_word_|
00000810  65 6e 67 6c 69 73 68 5b  31 35 30 5d 2c 22 22 29  |english[150],"")|
00000820  3b 0a 7d 0a 0a 77 68 69  6c 65 20 28 64 6e 20 3c  |;.}..while (dn <|
00000830  20 31 35 30 29 0a 7b 0a  73 74 72 63 70 79 28 77  | 150).{.strcpy(w|
00000840  72 6f 6e 67 5f 77 6f 72  64 5f 67 65 72 6d 61 6e  |rong_word_german|
00000850  5b 64 6e 2d 31 5d 2c 77  72 6f 6e 67 5f 77 6f 72  |[dn-1],wrong_wor|
00000860  64 5f 67 65 72 6d 61 6e  5b 64 6e 5d 29 3b 0a 73  |d_german[dn]);.s|
00000870  74 72 63 70 79 28 77 72  6f 6e 67 5f 77 6f 72 64  |trcpy(wrong_word|
00000880  5f 65 6e 67 6c 69 73 68  5b 64 6e 2d 31 5d 2c 77  |_english[dn-1],w|
00000890  72 6f 6e 67 5f 77 6f 72  64 5f 65 6e 67 6c 69 73  |rong_word_englis|
000008a0  68 5b 64 6e 5d 29 3b 0a  64 6e 2b 2b 3b 0a 7d 0a  |h[dn]);.dn++;.}.|
000008b0  77 6e 2d 2d 3b 0a 67 65  74 5f 6e 65 77 5f 6e 28  |wn--;.get_new_n(|
000008c0  29 3b 0a 72 65 64 72 61  77 5f 77 72 6f 6e 67 28  |);.redraw_wrong(|
000008d0  29 3b 0a 7d 0a 0a 0a 0a                           |);.}....|
000008d8