www.digitalmars.com         C & C++   DMDScript  

c++.idde - Wrong options set in projects created with SC 7.51,7.21

reply sgutnikov by.byelex.com writes:
Hi Everybody,

I am a new owner of DMD CD v8.29 and I am also have a lot of code created in SC
7.21/7.51. If I understand correct, the actual version of IDDE is unable to
convert options of projects created in SC (set "Executable" for static
libraries, loses defines and so on). 

I think in my case the best idea is to create some utility to decide this
problem.

Is there any documentation about format of .opt files?

Thanks in advance,

Sergey Gutnikov

*********************************
Sergey Gutnikov
sgutnikov by.byelex.com
http://www.multimedia.byelex.com/
Aug 29 2002
parent reply Jan Knepper <jan smartsoft.cc> writes:
<g>
I think (I am pretty sure) all you have to do is check the beginning of an SC
IDDE
7.51 .opn file and a DM IDDE .opn file. I think there is a signature at the
beginning that you can replace. That should be all there is to it.

Jan



sgutnikov by.byelex.com wrote:

 Hi Everybody,

 I am a new owner of DMD CD v8.29 and I am also have a lot of code created in SC
 7.21/7.51. If I understand correct, the actual version of IDDE is unable to
 convert options of projects created in SC (set "Executable" for static
 libraries, loses defines and so on).

 I think in my case the best idea is to create some utility to decide this
 problem.

 Is there any documentation about format of .opt files?

 Thanks in advance,

 Sergey Gutnikov

 *********************************
 Sergey Gutnikov
 sgutnikov by.byelex.com
 http://www.multimedia.byelex.com/

Aug 29 2002
next sibling parent Sergey Gutnikov <Sergey_member pathlink.com> writes:
You are absolutly rights! I have checked - is works.
Thanks.

Sergey


In article <3D6E8BC8.6E7C42C9 smartsoft.cc>, Jan Knepper says...
<g>
I think (I am pretty sure) all you have to do is check the beginning of an SC
IDDE
7.51 .opn file and a DM IDDE .opn file. I think there is a signature at the
beginning that you can replace. That should be all there is to it.

Jan



sgutnikov by.byelex.com wrote:

 Hi Everybody,

 I am a new owner of DMD CD v8.29 and I am also have a lot of code created in SC
 7.21/7.51. If I understand correct, the actual version of IDDE is unable to
 convert options of projects created in SC (set "Executable" for static
 libraries, loses defines and so on).

 I think in my case the best idea is to create some utility to decide this
 problem.

 Is there any documentation about format of .opt files?

 Thanks in advance,

 Sergey Gutnikov

 *********************************
 Sergey Gutnikov
 sgutnikov by.byelex.com
 http://www.multimedia.byelex.com/


********************************* Sergey Gutnikov sgutnikov by.byelex.com http://www.multimedia.byelex.com/
Aug 29 2002
prev sibling parent reply Sergey Gutnikov <Sergey_member pathlink.com> writes:
I think, this incompatibility can be added to DMC bug list, because all
project files on DMC CD v8.29 have wrong signature in .opn files (and it is very
boring to reenter all necessary flags...). 

I have created a small utility to replace a signature. It is for everybody who
need it.

<begin of file sc2dmc.c>
/* sc2dmc.c
Written by Sergey Gutnikov, idea by Jan Knepper
------------------------------------------------------------------------
Replace signature in .opn files created with Symantec C++ 7.2/7.5 to
Digital Mars C/C++ signature.
------------------------------------------------------------------------
This program have been tested in N memory model only. It was compiled by
SC 7.5 with following flags:
sc -mn -Nc -6 -o+all sc2dmc.c
------------------------------------------------------------------------
To use:
- go to the folder where SC 7.2+ projects are
- enter a command:
 dir /s/b *.opn | sc2dmc.exe

I think it is a good idea to go to the DMC folder and convert all existing projects (RTL, MFC 4.2, samples) */ #include <io.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define __BUF_SIZE (FILENAME_MAX+3) #define __SIG_SIZE (24) const char sig_old[__SIG_SIZE] = "Symantec 7.0 Option File"; const char sig_new[__SIG_SIZE] = "Digital Mars Option File"; static unsigned long n_total = 0; static unsigned long n_converted = 0; void do_file( const char * fname ) { FILE * f; char buf[__SIG_SIZE]; n_total++; f = fopen( fname, "r+b" ); if ( f == NULL ) { perror( fname ); return; } if ( fread( buf, 1, __SIG_SIZE, f )!= __SIG_SIZE ) { printf( "%s: file read error\n", fname ); fclose( f ); return; } if ( memcmp( buf, sig_old, __SIG_SIZE )== 0 ) { if ( fseek( f, 0L, SEEK_SET )!= 0 || fwrite( sig_new, 1, __SIG_SIZE, f )!= __SIG_SIZE ) { printf( "%s: file write error\n", fname ); } else { n_converted++; } } fclose( f ); } int main( int argc, char *argv[] ) { char fname[__BUF_SIZE], *s; if ( ! _isatty( fileno( stdin ))) { /* List of files at the input example: dir /s/b *.opn | sc2dmc.exe */ while ( fgets( fname, __BUF_SIZE, stdin ) != NULL ) { s = strchr( fname, '\n' ); if ( s != NULL ) { *s = '\0'; } if ( strlen( fname )) { do_file( fname ); } } } else { /* A filename passed in command line */ if ( argc != 2 ) { fputs( "Syntax: SC2DMC file\n", stderr ); return 1; } do_file( argv[1] ); } printf( "Files checked: %ld, converted: %d\n", n_total, n_converted ); return 0; } <end of file sc2dmc.c> In article <3D6E8BC8.6E7C42C9 smartsoft.cc>, Jan Knepper says...
<g>
I think (I am pretty sure) all you have to do is check the beginning of an SC
IDDE
7.51 .opn file and a DM IDDE .opn file. I think there is a signature at the
beginning that you can replace. That should be all there is to it.

Jan



sgutnikov by.byelex.com wrote:

 Hi Everybody,

 I am a new owner of DMD CD v8.29 and I am also have a lot of code created in SC
 7.21/7.51. If I understand correct, the actual version of IDDE is unable to
 convert options of projects created in SC (set "Executable" for static
 libraries, loses defines and so on).

 I think in my case the best idea is to create some utility to decide this
 problem.

 Is there any documentation about format of .opt files?

 Thanks in advance,

 Sergey Gutnikov

 *********************************
 Sergey Gutnikov
 sgutnikov by.byelex.com
 http://www.multimedia.byelex.com/


********************************* Sergey Gutnikov sgutnikov by.byelex.com http://www.multimedia.byelex.com/
Aug 30 2002
parent Jan Knepper <jan smartsoft.cc> writes:
It was intended to be resolved in the IDDE. However... so far I have not been
able to
rebuild the IDDE to executables that do not crash.

Jan



Sergey Gutnikov wrote:

 I think, this incompatibility can be added to DMC bug list, because all
 project files on DMC CD v8.29 have wrong signature in .opn files (and it is
very
 boring to reenter all necessary flags...).

 I have created a small utility to replace a signature. It is for everybody who
 need it.

 <begin of file sc2dmc.c>
 /* sc2dmc.c
 Written by Sergey Gutnikov, idea by Jan Knepper
 ------------------------------------------------------------------------
 Replace signature in .opn files created with Symantec C++ 7.2/7.5 to
 Digital Mars C/C++ signature.
 ------------------------------------------------------------------------
 This program have been tested in N memory model only. It was compiled by
 SC 7.5 with following flags:
 sc -mn -Nc -6 -o+all sc2dmc.c
 ------------------------------------------------------------------------
 To use:
 - go to the folder where SC 7.2+ projects are
 - enter a command:
 dir /s/b *.opn | sc2dmc.exe

I think it is a good idea to go to the DMC folder and convert all existing projects (RTL, MFC 4.2, samples) */ #include <io.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define __BUF_SIZE (FILENAME_MAX+3) #define __SIG_SIZE (24) const char sig_old[__SIG_SIZE] = "Symantec 7.0 Option File"; const char sig_new[__SIG_SIZE] = "Digital Mars Option File"; static unsigned long n_total = 0; static unsigned long n_converted = 0; void do_file( const char * fname ) { FILE * f; char buf[__SIG_SIZE]; n_total++; f = fopen( fname, "r+b" ); if ( f == NULL ) { perror( fname ); return; } if ( fread( buf, 1, __SIG_SIZE, f )!= __SIG_SIZE ) { printf( "%s: file read error\n", fname ); fclose( f ); return; } if ( memcmp( buf, sig_old, __SIG_SIZE )== 0 ) { if ( fseek( f, 0L, SEEK_SET )!= 0 || fwrite( sig_new, 1, __SIG_SIZE, f )!= __SIG_SIZE ) { printf( "%s: file write error\n", fname ); } else { n_converted++; } } fclose( f ); } int main( int argc, char *argv[] ) { char fname[__BUF_SIZE], *s; if ( ! _isatty( fileno( stdin ))) { /* List of files at the input example: dir /s/b *.opn | sc2dmc.exe */ while ( fgets( fname, __BUF_SIZE, stdin ) != NULL ) { s = strchr( fname, '\n' ); if ( s != NULL ) { *s = '\0'; } if ( strlen( fname )) { do_file( fname ); } } } else { /* A filename passed in command line */ if ( argc != 2 ) { fputs( "Syntax: SC2DMC file\n", stderr ); return 1; } do_file( argv[1] ); } printf( "Files checked: %ld, converted: %d\n", n_total, n_converted ); return 0; } <end of file sc2dmc.c> In article <3D6E8BC8.6E7C42C9 smartsoft.cc>, Jan Knepper says...
<g>
I think (I am pretty sure) all you have to do is check the beginning of an SC
IDDE
7.51 .opn file and a DM IDDE .opn file. I think there is a signature at the
beginning that you can replace. That should be all there is to it.

Jan



sgutnikov by.byelex.com wrote:

 Hi Everybody,

 I am a new owner of DMD CD v8.29 and I am also have a lot of code created in SC
 7.21/7.51. If I understand correct, the actual version of IDDE is unable to
 convert options of projects created in SC (set "Executable" for static
 libraries, loses defines and so on).

 I think in my case the best idea is to create some utility to decide this
 problem.

 Is there any documentation about format of .opt files?

 Thanks in advance,

 Sergey Gutnikov

 *********************************
 Sergey Gutnikov
 sgutnikov by.byelex.com
 http://www.multimedia.byelex.com/


********************************* Sergey Gutnikov sgutnikov by.byelex.com http://www.multimedia.byelex.com/

Aug 30 2002