Пример #1
0
/*
 * obtain partition information
 */
LOCAL ER readPart( DISKCB *dcb )
{
	DiskBlock0	buf;
	W		i, pno;
	ER		err;

	dcb->boot = 0;

        /* if an unexpected disk block size is seen, raise an error */
	if ( dcb->blksz != sizeof(buf) ) return E_NOSPT;

        /* read master boot record */
	err = (*dcb->rwdisk)(dcb, 0, 1, &buf, FALSE);
	if ( err < E_OK ) return err;

        /* check the signature in the boot block */
	if ( GMH(&buf.signature) != 0xaa55 ) return E_OK; /* no partition */

        /* obtain partition information */
	for ( i = 0; i < MAX_PARTITION; i++ ) {
		pno = i + 1;
		dcb->part[pno].sblk = GMW(buf.part[i].StartBlock);
		dcb->part[pno].nblk = GMW(buf.part[i].BlockCnt);

		if ( buf.part[i].BootInd == 0x80
		  && dcb->part[pno].nblk > 0
		  && dcb->boot == 0 ) dcb->boot = pno;
	}

	return E_OK;
}
Пример #2
0
int main (void)
{
	int n;
	double tol = 1e-14;
	double **A, *b;

	for (n = 1; n <= 15; n++)
	{
		A = GMH (n);
		b = GV1 (n, A);

		gauss (n, A, b, tol);
		trisup (n, A, b, tol);

		printf ("%3d:\t%.30le\n", n, Norm (n, b)-1);

		FM (A, n, n);
		FV (b, n);
	}

	return 0;
}