Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jan 2001 13:18:03 -0000
From:      "Michael Carlson" <mcarlson@Legato.COM>
To:        "The Utz Family" <utz@serv.net>
Cc:        <freebsd-multimedia@freebsd.org>
Subject:   Re: Glide3 ported to freebsd?
Message-ID:  <027a01c08b88$3e21a7a0$50294589@legato.com>
References:  <Pine.BSF.4.02.10101311243440.38078-100000@itchy.serv.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Well its all greek to me in there, Im not much of a programmer, but I will
show you the fxos.c file and maybe you can spot it.


# more fxos.c

/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** $Revision: 1.4 $
** $Date: 2000/10/03 18:31:53 $
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef WIN32
#include <windows.h>
#include <fxos.h>

void sleep(int secs)
{
    GdiFlush();
    Sleep(secs * 1000);
}

int fxGethostname(char *name, int n)
{
    return (int)GetComputerName((LPTSTR)name,(LPDWORD)&n);
}
#else
#include <fxos.h>
#endif
#if !macintosh
/* return current time in seconds (floating point)      */
float fxTime(void)
{
#if defined ( __sparc__ ) || defined ( __DJGPP__ )
/* times returns 0 in BSD Unix, so we use ftime instead */
#   include <sys/types.h>
#   include <sys/timeb.h>
    struct timeb tb;
    static time_t once;                 // saves first time value

    ftime(&tb);
    if (once == 0)                      // stash away first call
        once = tb.time;                 // as float is not big enough
    return (tb.time - once) + tb.millitm * .001;

#else
#if defined ( WIN32 ) || ( __DOS__ )
#   include <time.h>
#   define times(a) clock()
#   define HZ   CLOCKS_PER_SEC
#else
#   include <sys/types.h>
#   include <sys/times.h>
#   include <sys/param.h>
    struct tms foo;
#endif
    return times(&foo)/(float)HZ;
#endif
}

/* returns elapsed time in seconds */
float timer(int flag)
{
    static float starttime,endtime;

    if (flag == 0)
        starttime = endtime = fxTime();
    else
        endtime = fxTime();
    return endtime - starttime;
}
#endif

//----------------------------------------------------------------------
// open a file thru a search path, first search in the current directory
// and then go thru the semicolon separated search path
// returns the file handle and the path prefix that was used (if one)
//----------------------------------------------------------------------
FILE *fxFopenPath(const char *filename, const char *mode, const char *path,
const char **pprefix)
{
    char *psemi;
    FILE *file;

    // first try and open up the file in the current directory
    if (pprefix) *pprefix = NULL;
    if ((file = fopen(filename,mode)))
        return file;
    if (path == NULL)
        return NULL;

    while (*path) {             // for each chunk of the search path
        char nameWithPath[1024];
        psemi = strchr(path,';');               // find the next semicolon
        if (psemi) {                            // if one, copy up to it
            strncpy(nameWithPath,path,psemi-path);
            nameWithPath[psemi-path] = '\0';
        }
        else                                    // else copy entire path
            strcpy(nameWithPath,path);
        strcat(nameWithPath,"/");               // add directory separator
        strcat(nameWithPath,filename);          // add filename
        if (pprefix) *pprefix = path;           // save the prefix
        if ((file = fopen(nameWithPath,mode)))
            return file;
        path = psemi;                           // advance to next path
element
        if (path)
            path++;                             // if one, then skip
semicolon
        else
            break;                              // else all done
    }
    return file;
}

As always, any help is appreciated.

Mike C

----- Original Message -----
From: "The Utz Family" <utz@serv.net>
To: "Michael Carlson" <mcarlson@legato.com>
Cc: <freebsd-multimedia@freebsd.org>
Sent: Wednesday, January 31, 2001 9:04 PM
Subject: Re: Glide3 ported to freebsd?


> the HZ error is one that comes up in trying to build linux specific code
> on FreeBSD.
>
> i cant recall what i did to fix it when i have bumped into it ( and i have
> bumped into it 2 or 3 times ), but the 'fixes' have been really hacky.
> usually involving editing the code every where the error shows up.
>
> so in this case the spot in fxos.c needs to be altered. grep for HZ in the
> freebsd include directoies and replace HZ in fxos.c with whatever you find
> after the '#define HZ' in whatever header it's in.
>
> #define HZ  <stuff here !!!>
>
>
> i'd love to know a clean, singlepoint solution . i suspect that it has to
> do with #ifdef'ing in the correct header, ie systime.h or time.h, but i
> really cant recall.
>
> On Wed, 31 Jan 2001, Michael Carlson wrote:
>
> > I have a voodoo 5 and I was wondering if there was a port in the making
of Glide3? I have been trying for the past wekk or so to get it to compile
on freebsd 4.2, but there seems to be an error in the fxos.c:
> >
> > icarus# ./build.3dfx
> >
> > Filesystem 1K-blocks Used Avail Capacity Mounted on
> >
> > /dev/ad0s1a 248047 99760 128444 44% /
> >
> > Making all in swlibs
> >
> > gmake[1]: Entering directory `/root/Glide3/swlibs'
> >
> > Making all in fxmisc
> >
> > gmake[2]: Entering directory `/root/Glide3/swlibs/fxmisc'
> >
> > /bin/sh ../../libtool --mode=compile
gcc -DX11 -fomit-frame-pointer -funroll-loops -fexpensive-optimizations -ffa
st-math -DBIG_OPT -
> >
> >
Wall -I../../h5/glide3/src -I../../h5/incsrc -I../../h5/incsrc -I../../h5/mi
nihwc -I. -I../../swlibs/fxmemmap -I../../
> >
> >
swlibs/fxmisc -I../../swlibs/newpci/pcilib -I../../swlibs/texus2/lib -O6 -m4
86 -c fxos.c
> >
> > rm -f .libs/fxos.lo
> >
> >
gcc -DX11 -fomit-frame-pointer -funroll-loops -fexpensive-optimizations -ffa
st-math -DBIG_OPT -Wall -I../../h5/glide3/src -I../../h5
> >
> >
/incsrc -I../../h5/incsrc -I../../h5/minihwc -I. -I../../swlibs/fxmemmap -I.
./../swlibs/fxmisc -I../../swlibs/newpci/pcilib -I../../
> >
> > swlibs/texus2/lib -O6 -m486 -Wp,-MD,.deps/fxos.pp -c
fxos.c -fPIC -DPIC -o .libs/fxos.lo
> >
> > fxos.c: In function `fxTime':
> >
> > fxos.c:72: `HZ' undeclared (first use in this function)
> >
> > fxos.c:72: (Each undeclared identifier is reported only once
> >
> fxos.c:72: for each function it appears in.)
> >
> > fxos.c:74: warning: control reaches end of non-void function
> >
> > gmake[2]: *** [fxos.lo] Error 1
> >
> > gmake[2]: Leaving directory `/root/Glide3/swlibs/fxmisc'
> >
> > gmake[1]: *** [all-recursive] Error 1
> >
> > gmake[1]: Leaving directory `/root/Glide3/swlibs'
> >
> > gmake: *** [all-recursive] Error 1
> >
> > Filesystem 1K-blocks Used Avail Capacity Mounted on
> >
> > /dev/ad0s1a 248047 99760 128444 44% /
> >
> > Time Elapsed: 0 Years, 0 Days, 0 Hours, 0 Minutes, 1 Seconds
> >
> > Disk usage: 0.0 Mb
> >
> > I am not much of a programmer or scripter so I was wondering if anyone
had a bit more info on this, I've read all I can find on
glide.sourceforge.net but I have progressed little.
> >
> > Thanks,
> >
> > Mike Carlson
> >
> > mcarlson@m87-blackhole.org
> >
> >
> >
> >
>
>
>



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?027a01c08b88$3e21a7a0$50294589>