Force gnu assembler to invoke the preprocessor

14 views
Skip to first unread message

Marcel Müller

unread,
Jun 19, 2011, 6:28:25 AM6/19/11
to
When i invoke as from gcc 3.3.5 to compile files from libmpg123, e.g.
dct36_3dnow.S, the preprocessor is not used. The documentation says that
as invoke the preprocessor if the file extension is an uppercase S. Most
likely this is broken because OS/2 does not care about the case of file
names.

Is there any option to force the preprocessor to run?

Currently I patched the make file and invoke the C compiler first, but
this has several disadvantages.

.S.o:
gcc -I$(TOPDIR) -DASSEMBLER -E $< -o $<.e
$(GAS) $(GAFLAGS) $<.e -o $@


Marcel

A.D. Fundum

unread,
Jun 19, 2011, 9:42:14 AM6/19/11
to
> invoke the preprocessor if the file extension is an uppercase S.
> Most likely this is broken because OS/2 does not care about the
> case of file names.

So it's not broken, because OS/2 cares by preserving the case of file
names. The information isn't lost, albeit it's ignored in some cases
(like DEL *.S). One should be able to detect the case of the S, at
least with HPFS and JFS.


--

/* Kees.CMD */

CALL Lineout 'FOO.s',''
CALL LineOut 'FOO.s'
CALL Lineout 'BAR.S',''
CALL LineOut 'BAR.S'
CALL RxFuncAdd 'SysFileTree','RexxUtil','SysFileTree'
CALL SysFileTree '*.S','file.','FO'
DO i=1 TO file.0
IF Right(file.i,2)=='.S' THEN SAY 'Preprocessing' file.i
IF Right(file.i,2)=='.s' THEN SAY 'Skipping' file.i
END i
'@DEL BAR.S > NUL'
'@DEL FOO.S > NUL'
EXIT

Dave Yeo

unread,
Jun 19, 2011, 2:24:01 PM6/19/11
to

This has usually worked here, using a case preserving filesystem. Only
problem I've run into has been when there are 2 files, foo.s and foo.S.
Dave

A.D. Fundum

unread,
Jul 3, 2011, 10:46:01 AM7/3/11
to
> One should be able to detect the case of the S, at
> least with HPFS and JFS.

As an aside: is there an API or function which consistenly returns the
case of a directory as-is, with or without the drive letter?

Directory (full path: "D:\Download\Database\Europe\CAC40) with both
_getcwd and the DosQueryCurrentDir API:

[D:\download\database\europe\cac40]c:printdir
D:\download\database\europe\cac40


But after those steps:

D:
CD \
CD Download

The output (and eCS' $p$g-prompt) then isn't "D:\download" but
"D:\Download"...


--

Andreas Schnellbacher

unread,
Jul 3, 2011, 6:44:40 PM7/3/11
to
A.D. Fundum wrote:

A combination of DosQueryPathInfo with DosFind* works for me.
(DosFindNext returns the correct case, so SysFileTree may work as well
for REXX.)

--
Andreas Schnellbacher

A.D. Fundum

unread,
Jul 4, 2011, 5:09:28 AM7/4/11
to
>> As an aside: is there an API or function which consistenly returns
>> the case of a directory as-is, with or without the drive letter?

> A combination of DosQueryPathInfo with DosFind* works for me.


> (DosFindNext returns the correct case, so SysFileTree may work
> as well for REXX.)

Thanks, so a combination may be required indeed. In an earlier example
in this (c.o.o.p.t.-) thread I used SysFileTree, which a.o. uses
DosFind*, to distinguish between *.S and *.s file extensions, i.e. not
the full path name.

BTW, I mean required for a good look, i.e. always preserving whatever
the user entered explicitly.

Too bad trying another possibility also demonstrated a bug when e.g.
an &eacute; was used as a final character. (MCD "x" is a combination
of MD "x" and CD "x", which will also fail individually, with and
without quotes). The Caf�-subdirectory didn't exist before trying
this:


[D:\Database]mcd Caf�

[D:\Database\Caf�]dir

The volume label in drive D is TEST.
The Volume Serial Number is A9C5:E150.
Directory of D:\Database

4-07-11 10:48 <DIR> 0 ---- .
4-07-11 10:48 <DIR> 0 ---- ..
4-07-11 10:50 <DIR> 0 ---- Caf�
3 file(s) 0 bytes used

--

A.D. Fundum

unread,
Jul 21, 2011, 4:54:00 PM7/21/11
to
>>> As an aside: is there an API or function which consistenly
returns
>>> the case of a directory as-is, with or without the drive letter?

>> A combination of DosQueryPathInfo with DosFind* works for me.
>> (DosFindNext returns the correct case, so SysFileTree may work
>> as well for REXX.)

> [D:\Database\Caf‚]dir

> Directory of D:\Database
> 4-07-11 10:50 <DIR> 0 ---- Caf‚

FTR: this seems to work. It prints the current directory of a drive,
recursivly using DosFind* in the final stage to preserve, or rather
respect, the original case.

Together with e.g. Sergey Yevtushenko's CLIP.CPP this already has some
use, possibly while installing software and creating WPS program
objects. It's basicly the CMD.EXE-equivalent of a RMB on a WPS folder
object to copy the full path of a directory to the eCS clipboard:
"PRINTDIR | CLIP".

I haven't embedded the clipboard funcionality, so PRINTDIR isn't
DIR2CLIP. For one because the .subject-EA of a file downloaded with
FF/SM also is a possible candidate to be copied to the clipboard, and
I don't really want an *.EXE for each silly idea, with RFC #1 being a
version which optionally adds quotes to the full path. Hey, write your
own Rexx 2Clip-frontend! ;-)

--


/* ICC PRINTDIR.C, Q&D Worked At Least Once For Me Amateur Alert */

#define INCL_DOSFILEMGR

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

int main(int argc, char* argv[])
{
APIRET rc;
char *buffer,buffer2[CCHMAXPATH],path[CCHMAXPATH],path2[CCHMAXPATH];
FILEFINDBUF3 filebuf={0};
HDIR hdir=HDIR_SYSTEM;
int drive=0,length,position;
ULONG filebuflen=sizeof(FILEFINDBUF3),searchlimit=1;

if (argc>2)
{
printf("Usage: PRINTDIR.EXE [drive]\n");
return 1;
}
if (argc==2)
{
if (strlen(argv[1])!=2)
{
printf("Usage: PRINTDIR.EXE [drive]\n");
return 1;
}
if (argv[1][1]!=':')
{
printf("Usage: PRINTDIR.EXE [drive]\n");
return 1;
}
if (argv[1][0]>90)
argv[1][0]-=32;
if (argv[1][0]<'A')
{
printf("Usage: PRINTDIR.EXE [drive]\n");
return 1;
}
if (argv[1][0]>'Z')
{
printf("Usage: PRINTDIR.EXE [drive]\n");
return 1;
}
drive=argv[1][0]-64;
}

if (drive)
buffer=_getdcwd(drive,buffer2,CCHMAXPATH);
else
buffer=_getcwd(buffer2,CCHMAXPATH);
if (NULL==buffer)
{
fprintf(stderr,"SYS0021: The drive is not ready.\n");
return 1;
}

/* No root directory? DosFindFirst() each involved (sub-)directory */
if (strlen(buffer)>3)
{
while (strlen(buffer)>3)
{
rc=DosFindFirst(buffer,&hdir,FILE_DIRECTORY,&filebuf,filebuflen
&searchlimit,FIL_STANDARD);
if (rc)
{
fprintf(stderr,"DosFindFirst() error: rc=%u\n",rc);
return 1;
}
length=strlen(buffer);
position=length;
while (buffer[position]!='\\'&&position>3)
--position;
buffer[position]='\0';
if (strlen(path))
sprintf(path2,"%s\\%s",filebuf.achName,path);
else
sprintf(path2,"%s",filebuf.achName);
sprintf(path,"%s",path2);
rc=DosFindClose(hdir);
if (rc)
{
fprintf(stderr,"DosFindClose() error: rc=%u\n",rc);
return 1;
}
}
strcat(buffer,path);
}

if (strlen(buffer)<3)
{
fprintf(stderr,
"Error: unexpected number of characters (%u) in %s\n",
strlen(buffer),buffer);
return 1;
}

printf("%s\n",buffer);

return 0;
}

A.D. Fundum

unread,
Jul 24, 2011, 6:23:55 AM7/24/11
to
>> (DosFindNext returns the correct case, so SysFileTree may
>> work as well for REXX.)

Rexx version, if needed also with more than a single underlying
DosFind*-call:

--

/* PrintDir.CMD */

CALL RxFuncAdd 'SysDriveMap','RexxUtil','SysDriveMap'


CALL RxFuncAdd 'SysFileTree','RexxUtil','SysFileTree'

ARG argv

IF Left(argv,1)='"' THEN PARSE VAR argv '"' argv '"' .

here=Directory()
drive=Left(Directory(),2)

IF Arg()>1 THEN DO
SAY "Usage: PrintDir.CMD [optional, drive, e.g. C:]"
EXIT 1
END

IF Arg()=1 THEN DO
IF Length(argv)<>2 THEN DO
SAY "Usage: PrintDir.CMD [optional, drive, e.g. C:]"
EXIT 1
END

IF argv<'A:' | argv>'Z:' | Right(argv,1)<>':' THEN DO
SAY "Usage: PrintDir.CMD [optional, drive, e.g. C:]"
EXIT 1
END
drive=argv
END

IF Pos(drive,SysDriveMap('A:'),1)=0 THEN DO
SAY 'SYS0021: The drive is not ready.'
RETURN 1
EXIT
END

fullpath=Directory(drive)
CALL Directory here
IF Length(fullpath)>3 THEN DO
count=0
DO i=1 TO CountStr('\',fullpath)+1
PARSE VAR fullpath part.i '\' fullpath
count=count+1
END i
fullpath=part.1
DO i=2 TO count
rc=SysFileTree(fullpath||'\'||part.i,'DIRS.','DO')
IF rc=2 THEN DO
SAY 'SysFileTree() error: rc='||rc
EXIT 1
END
IF dirs.0<>1 THEN DO
SAY 'Error: directory' part.i 'not found'
EXIT 1
END
fullpath=fullpath||'\'||FileSpec('N',dirs.1)
END i
END

IF Length(fullpath)<3 THEN DO
SAY "Error: unexpected number of characters ("||Length(fullpath),
||") in" fullpath
EXIT 1
END

SAY fullpath

EXIT

A.D. Fundum

unread,
Jul 24, 2011, 6:32:51 AM7/24/11
to
> Together with e.g. Sergey Yevtushenko's CLIP.CPP this already has
> some use: "PRINTDIR | CLIP"

> I haven't embedded the clipboard funcionality, so PRINTDIR isn't
> DIR2CLIP. For one because the .subject-EA of a file downloaded
> with FF/SM also is a possible candidate to be copied to the
> clipboard

> Hey, write your own Rexx 2Clip-frontend! ;-)

[D:\database\paris\cac40]PRINTSEA d:\bbox\q1.zip
http://hobbes.mnsu.edu/download/private/hq/meetings/q12011.zip

--


/* PrintsEA.CMD, Print s(ubject) EA of a file */

CALL RxFuncAdd 'SysGetEA','RexxUtil','SysGetEA'

PARSE ARG file

IF arg()<>1 THEN DO
SAY 'Usage: PrintsEA <file>'
EXIT 1
END

file=Strip(file)
IF Left(file,1)='"' THEN PARSE VAR file '"' file '"' .

IF Stream(file,'C','QUERY EXISTS')='' THEN DO
SAY 'Error: file' file 'not found'
EXIT 1
END

rc=SysGetEA(file,'.subject','URL')

IF url='' THEN DO
SAY 'Error: no ".subject" extended attribute found'
EXIT 1
END

PARSE VAR url 1 . 5 url
IF Pos('://',url,1)<2 THEN DO
SAY 'Error: no URL found in the ".subject" extended attribute'
EXIT 1
END

SAY url

EXIT

Reply all
Reply to author
Forward
0 new messages