示例#1
0
Bool InitializeAlphabet(int16_t CountryCode)
{
    uchar w[ABCSIZE + 1];
    int16_t h;

    if ((h = TBOPEN( 6, language, BO_READ_TEXT, S_IREAD )) < 0) {
        vocs_NOK |= 1 << 6;
        return FALSE;
    }

    if (TGGETS( h, (char*)w, sizeof(w)) == (char*) w) {
        ABCSize = atoi((char*) w);
    }

    if (TGGETS( h, (char*)memset( w, 0, sizeof(w)), sizeof(w)) == (char*) w) {
        memcpy(alphabet[0], w, ABCSIZE);
    }

    if (TGGETS( h, (char*)memset( w, 0, sizeof(w)), sizeof(w)) == (char*) w) {
        memcpy(alphabet[1], w, ABCSIZE);
    }

    if (TGGETS( h, (char*)memset( w, 0, sizeof(w)), sizeof(w)) == (char*) w) {
        memcpy(alphabet[2], w, ABCSIZE);
    }

    else {
        TGCLOSE(h);
        return FALSE;
    }

    /* 01-15-94 10:10pm, Mike     */
    /*  if ( !setUpAcsGrps(h) ) { */
    /*    TGCLOSE(h);             */
    /*    return FALSE;           */
    /*  }                         */
    TGCLOSE(h);

    if ((strlen((char*) alphabet[0]) != (uint16_t) ABCSize) || (strlen(
                                                                    (char*) alphabet[1]) != (uint16_t) ABCSize)) {
        return FALSE;
    }

    dectable_init();
    std_init();
    initcode();
    initstdn();
    init_tab_alpha(alphabet[0], alphabet[1], ABCSize);
    CountryCode = 0;
    return TRUE;
}
示例#2
0
void read_rec_file(int16_t fileno, puchar pool, puchar * end) {
	uint32_t l;
	int16_t h;

	h = TBOPEN(fileno, -1, (int16_t) (O_RDONLY | O_BINARY), 0);

	if (h == -1)
		ErrorExit(RLING_ERROR_CANT_OPEN_TABLE);

	l = TGREAD(h, pool, 0x100000);
	TGCLOSE(h);
	l = (l + 15) & -16;
	*end = pool + l;
}
示例#3
0
Bool loadArtBase (int16_t CountryCode)
{
	int16_t h;
	TabFH f;
	int16_t   i;

	// 08-13-93 09:44pm, Mike
	// Load *.tab file.
	if (vocs_NOK)
		return FALSE;

	h = TBOPEN( (int16_t)9, (int16_t)language, (int16_t)(O_RDONLY|O_BINARY), (int16_t)S_IREAD );
	if ( h == -1)
	{
		vocs_NOK |= 1<<9;
		return FALSE;
	}
	if ( TGREAD(h, (char *) (&f), sizeof (f))!= sizeof(f))
	{
		TGCLOSE(h);
		return FALSE;
	}
	if (strcmp (f.id, TABFILE_ID))
	{
		TGCLOSE(h);
		return FALSE;
	}

	if ( !AlreadyLoaded )
	{
		for ( i = 1; i <MAX_ARTS; i++)
		{
			if ( !artbase[i].sr1 )
			{
				break;
			}
		}
		AlreadyLoaded = 1;
		Built_inSize  = i;
	}
	else
	{
		i = Built_inSize;
	}

	if (MAX_ARTS -i < f.rep_no)
	{
		TGCLOSE(h);
		return FALSE;
	}

	//memset( artbase+i, 0, sizeof(ARTS)*(MAX_ARTS-i) ); // Bound
	memset( &artbase[i], 0, (&artbase[MAX_ARTS] - &artbase[i]) ); // Bound

	if ( TGREAD( h, (char *) (artbase+i), sizeof(ARTS)*f.rep_no ) != (int32_t)(sizeof(ARTS)*f.rep_no) )
	{
		TGCLOSE(h);
		return FALSE;
	}

	max_art = i +f.rep_no -1;
	TGCLOSE(h);

	CountryCode=0;
	return TRUE;
}