Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-07-2005, 08:13 PM   #1 (permalink)
zyrxfz
Registered User
 
Join Date: Jun 2005
Posts: 7
zyrxfz is on a distinguished road
'old-skool' server code enhancement

hello guys! um dealing with ancient code which has been coded 10 years ago..some of the parameters were obsolete and yet, dunno how to fix it ..2 b honest, i only learnt c++ but not c, and um just an undergraduate student,having practical training rite now, struggling my way to convert this OS2 base coding, so that it can be run in windows base. i have loaded all the header file needed from the mainframe to my PC,but then, these errors occured..with my limited knowledge of c,can you guys help me out? thanks!

>>here's the errors<<

c:\program files\microsoft visual studio\vc98\include\dos.h(165) : error C4226: nonstandard extension used : 'near' is an obsolete keyword

c:\program files\microsoft visual studio\vc98\include\dos.h(165) : warning C4229: anachronism used : modifiers on data are ignored

c:\program files\microsoft visual studio\vc98\include\dos.h(203) : error C4226: nonstandard extension used : 'far' is an obsolete keyword

c:\program files\microsoft visual studio\vc98\include\dos.h(203) : error C2143: syntax error : missing ')' before '*'

c:\program files\microsoft visual studio\vc98\include\dos.h(203) : warning C4229: anachronism used : modifiers on data are ignored

c:\program files\microsoft visual studio\vc98\include\dos.h(203) : error C2182: 'interrupt' : illegal use of type 'void'

c:\program files\microsoft visual studio\vc98\include\dos.h(203) : error C2091:
function returns function

c:\program files\microsoft visual studio\vc98\include\dos.h(203) : error C2059:
syntax error : ')'

c:\program files\microsoft visual studio\vc98\include\twindow.h(118) : warning C4031: second formal parameter list longer than the first list

c:\program files\microsoft visual studio\vc98\include\twindow.h(118) : warning C4028: formal parameter 1 different from declaration

c:\program files\microsoft visual studio\vc98\include\twindow.h(118) : warning C4028: formal parameter 2 different from declaration

c:\program files\microsoft visual studio\vc98\include\twindow.h(118) : error C2371: 'wprintf' : redefinition; different basic types

c:\program files\microsoft visual studio\vc98\include\stdio.h(386) : see declaration of 'wprintf'

D:\maybank\eisaudit.c(77) : warning C4013: 'clrscreen' undefined; assuming extern returning int

D:\maybank\eisaudit.c(78) : warning C4013: 'WriteString' undefined; assuming extern returning int

D:\maybank\eisaudit.c(200) : warning C4013: 'fileattr' undefined; assuming extern returning int

D:\maybank\eisaudit.c(201) : warning C4013: 'findfile' undefined; assuming extern returning int

D:\maybank\eisaudit.c(219) : warning C4013: 'stripstr' undefined; assuming extern returning int

D:\maybank\eisaudit.c(260) : warning C4013: 'getmonth' undefined; assuming extern returning int

D:\maybank\eisaudit.c(274) : warning C4018: '<' : signed/unsigned mismatch

D:\maybank\eisaudit.c(366) : warning C4033: 'Extract_Frame' must return a value

D:\maybank\eisaudit.c(396) : warning C4033: 'ExtractAppl' must return a value

D:\maybank\eisaudit.c(429) : warning C4033: 'ConvertAppl' must return a value

D:\maybank\eisaudit.c(556) : warning C4033: 'BreakLine' must return a value

D:\maybank\eisaudit.c(569) : warning C4013: 'CenterString' undefined; assuming
extern returning int

D:\maybank\eisaudit.c(603) : warning C4033: 'ProcessAuditFile' must return a value

D:\maybank\eisaudit.c(651) : warning C4033: 'ProcessAudit' must return a value

D:\maybank\eisaudit.c(986) : warning C4013: 'MakeDirectory' undefined; assuming extern returning int

D:\maybank\eisaudit.c(990) : warning C4013: 'DeleteFile' undefined; assuming extern returning int

<<end of errors>>

hurm...what seems to be the problem?

the code is quite long,have to admit it's the longest code i've eva deal with..
oh ya, actually the errors came from the header file,so um just gonna post the problematic header file.. ..really need ur help guys! thanks!





>>the dos.h code<<
/***
*dos.h - definitions for MS-DOS interface routines
*
* Copyright (c) 1985-1988, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the structs and unions used for the direct DOS interface
* routines; includes macros to access the segment and offset
* values of far pointers, so that they may be used by the routines; and
* provides function prototypes for direct DOS interface functions.
*
****/


#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#define _NEAR near
#else /* extensions not enabled */
#define _CDECL
#define _NEAR
#endif /* NO_EXT_KEYS */

#ifndef _REGS_DEFINED

/* word registers */

struct WORDREGS {
unsigned int ax;
unsigned int bx;
unsigned int cx;
unsigned int dx;
unsigned int si;
unsigned int di;
unsigned int cflag;
};

/* byte registers */

struct BYTEREGS {
unsigned char al, ah;
unsigned char bl, bh;
unsigned char cl, ch;
unsigned char dl, dh;
};

/* general purpose registers union -
* overlays the corresponding word and byte registers.
*/

union REGS {
struct WORDREGS x;
struct BYTEREGS h;
};

/* segment registers */

struct SREGS {
unsigned int es;
unsigned int cs;
unsigned int ss;
unsigned int ds;
};

#define _REGS_DEFINED

#endif

/* dosexterror structure */

#ifndef _DOSERROR_DEFINED

struct DOSERROR {
int exterror;
char class;
char action;
char locus;
};

#define _DOSERROR_DEFINED

#endif

/* _dos_findfirst structure */

#ifndef _FIND_T_DEFINED

struct find_t {
char reserved[21];
char attrib;
unsigned wr_time;
unsigned wr_date;
long size;
char name[13];
};

#define _FIND_T_DEFINED

#endif

/* _dos_getdate/_dossetdate and _dos_gettime/_dos_settime structures */

#ifndef _DATETIME_T_DEFINED

struct dosdate_t {
unsigned char day; /* 1-31 */
unsigned char month; /* 1-12 */
unsigned int year; /* 1980-2099 */
unsigned char dayofweek; /* 0-6, 0=Sunday */
};

struct dostime_t {
unsigned char hour; /* 0-23 */
unsigned char minute; /* 0-59 */
unsigned char second; /* 0-59 */
unsigned char hsecond; /* 0-99 */
};

#define _DATETIME_T_DEFINED

#endif

/* _dos_getdiskfree structure */

#ifndef _DISKFREE_T_DEFINED

struct diskfree_t {
unsigned total_clusters;
unsigned avail_clusters;
unsigned sectors_per_cluster;
unsigned bytes_per_sector;
};

#define _DISKFREE_T_DEFINED

#endif

/* manifest constants for _hardresume result parameter */

#define _HARDERR_IGNORE 0 /* Ignore the error */
#define _HARDERR_RETRY 1 /* Retry the operation */
#define _HARDERR_ABORT 2 /* Abort program issuing Interrupt 23h */
#define _HARDERR_FAIL 3 /* Fail the system call in progress */
/* _HARDERR_FAIL is not supported on DOS 2.x */

/* File attribute constants */

#define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
#define _A_RDONLY 0x01 /* Read only file */
#define _A_HIDDEN 0x02 /* Hidden file */
#define _A_SYSTEM 0x04 /* System file */
#define _A_VOLID 0x08 /* Volume ID file */
#define _A_SUBDIR 0x10 /* Subdirectory */
#define _A_ARCH 0x20 /* Archive file */

/* macros to break MS C "far" pointers into their segment and offset
* components
*/

#define FP_SEG(fp) (*((unsigned *)&(fp) + 1))
#define FP_OFF(fp) (*((unsigned *)&(fp)))


/* external variable declarations */

extern unsigned int NEAR_R(); _CDECL _osversion;


/* function prototypes */

int _CDECL bdos(int, unsigned int, unsigned int);
void _CDECL _disable(void);
unsigned _CDECL _dos_allocmem(unsigned, unsigned *);
unsigned _CDECL _dos_close(int);
unsigned _CDECL _dos_creat(char *, unsigned, int *);
unsigned _CDECL _dos_creatnew(char *, unsigned, int *);
unsigned _CDECL _dos_findfirst(char *, unsigned, struct find_t *);
unsigned _CDECL _dos_findnext(struct find_t *);
unsigned _CDECL _dos_freemem(unsigned);
void _CDECL _dos_getdate(struct dosdate_t *);
void _CDECL _dos_getdrive(unsigned *);
unsigned _CDECL _dos_getdiskfree(unsigned, struct diskfree_t *);
unsigned _CDECL _dos_getfileattr(char *, unsigned *);
unsigned _CDECL _dos_getftime(int, unsigned *, unsigned *);
void _CDECL _dos_gettime(struct dostime_t *);
void _CDECL _dos_keep(unsigned, unsigned);
unsigned _CDECL _dos_open(char *, unsigned, int *);
unsigned _CDECL _dos_setblock(unsigned, unsigned, unsigned *);
unsigned _CDECL _dos_setdate(struct dosdate_t *);
void _CDECL _dos_setdrive(unsigned, unsigned *);
unsigned _CDECL _dos_setfileattr(char *, unsigned);
unsigned _CDECL _dos_setftime(int, unsigned, unsigned);
unsigned _CDECL _dos_settime(struct dostime_t *);
int _CDECL dosexterr(struct DOSERROR *);
void _CDECL _enable(void);
void _CDECL _hardresume(int);
void _CDECL _hardretn(int);
int _CDECL intdos(union REGS *, union REGS *);
int _CDECL intdosx(union REGS *, union REGS *, struct SREGS *);
int _CDECL int86(int, union REGS *, union REGS *);
int _CDECL int86x(int, union REGS *, union REGS *, struct SREGS *);

#ifndef NO_EXT_KEYS /* extensions enabled */
void _CDECL _chain_intr(void (_CDECL interrupt far_r *)());
void (_CDECL interrupt far * _CDECL _dos_getvect(unsigned)()); ..
unsigned _CDECL _dos_read(int, void far *, unsigned, unsigned *);
void _CDECL _dos_setvect(unsigned, void (_CDECL interrupt far *)());
unsigned _CDECL _dos_write(int, void far *, unsigned, unsigned *);
void _CDECL _harderr(void (far *)());
#endif /* NO_EXT_KEYS */

void _CDECL segread(struct SREGS *);


<<end of dos.h>>
zyrxfz is offline   Reply With Quote
Old 06-07-2005, 11:10 PM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,711
redhead is on a distinguished road
This is a dos specific include file, it comes with the compiler, you can't expect your "new" compiler to accept it, since the definitions in a header file is pointing to something which is accessible by linking to some library which the compiler provides.

What you need to do, is show us the code you want to have working with your "new" compiler, that way we can tell you what header files provided by your "new" compiler will provide you with the needed functions which the code is using.
Or provide you with information on how to exchange those functions with others that are pressent on your new system.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 06-08-2005, 12:02 AM   #3 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,711
redhead is on a distinguished road
Quote:
this code cost me 40 pages, dat's why i feel bad to post it here..guess um just worrying too much ,rite?
If it's that big a deal, you could have PM me the code (can't remember if PM accepts that large a meessage or not)
I'll read through your code, to see if theres something which needs to be changed..
The one thing that worries me first off, is the included header aadefs.inc, since it is named .inc, it could hold anything, that beeing just your usual header informations or alot of regular code.
But given the name it gives me the idear, that it is some deffinitions required by the program.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 06-08-2005, 12:40 AM   #4 (permalink)
zyrxfz
Registered User
 
Join Date: Jun 2005
Posts: 7
zyrxfz is on a distinguished road
continue from previous post

yup! actually, um posting the code with the aadefs.h include file as well, but then, i've exceed the post's limits..=P it shouldn't be able to display anything, somehow i managed to send it half...i'll try to PM you, redhead..thanx ya!
zyrxfz is offline   Reply With Quote
Old 06-08-2005, 12:42 AM   #5 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,711
redhead is on a distinguished road
After a quick read, heres what isn't too conforming with the ANSI/ISO standard:
Code:
In general:
   savescreen()      -> Need definition
   restscreen()      -> Need definition
   clrscreen()       -> Need definition
   findfile()        -> Need definition
   DeleteFile()      -> Need definition
   WriteString()     -> Need definition
   DOSFINDFIRST()    -> Need definition
   DOSFINDNEXT()     -> Need definition
   DOSFINDCLOSE()    -> Need definition


In message(), Process() and ExecuteProcess():
    DOSGETDATETIME() -> Since this takes a struct DateTime
                     I dont kow how that is used, but for
		     starters it can be exchanged with 
		     localtime() found in time.h which takes
		     a struct tm*
		      struct tm
                      {
                          int     tm_sec;         /* seconds */
                          int     tm_min;         /* minutes */
                          int     tm_hour;        /* hours */
                          int     tm_mday;        /* day of the month */
                          int     tm_mon;         /* month */
                          int     tm_year;        /* year */
                          int     tm_wday;        /* day of the week */
                          int     tm_yday;        /* day in the year */
                          int     tm_isdst;       /* daylight saving time */
                       };

In ProcessDailyList() and ExecuteProcess():
    WaitingForTime() -> Can be exchanged with sleep()

In Process():
   ExecuteEXE()      -> Need definition ( Could be exchanged by execv() or execvp() )
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 06-08-2005, 01:03 AM   #6 (permalink)
zyrxfz
Registered User
 
Join Date: Jun 2005
Posts: 7
zyrxfz is on a distinguished road
it's such a long code, rite?sorry for the mess,ya? to be frank, um quite shame putting the whole code here,but guess, i have no choice, since i've neva go deep studying the header file before,and i would be very very glad if u guys could give me some tips in manipulating the header file..thanx for helping me through it guys! =) truly appreciate it!

Last edited by zyrxfz; 06-08-2005 at 01:44 AM. Reason: making the code private
zyrxfz is offline   Reply With Quote
Old 06-08-2005, 01:06 AM   #7 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,711
redhead is on a distinguished road
One other thing I've noticed about your code, there are some of the comments, where the "comment end" instruction is illformed ie:
Code:
/*================================================*  /
/* Defines the maximum  branches  throughout  the */
/* country                                        */
/*================================================*  /
As opposed to:
Code:
/*================================================*/
/* Defines the maximum  branches  throughout  the */
/* country                                        */
/*================================================*/
Not fixing this, will introduce abnormaly errors, where it's hard to tell why they appear.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 06-08-2005, 01:53 AM   #8 (permalink)
zyrxfz
Registered User
 
Join Date: Jun 2005
Posts: 7
zyrxfz is on a distinguished road
emm..actually, um aware of the comment tags..it must have fall off during the copy n paste just now..thanx niwey! =)

the error that i've got is rite after i read the whole code..with comment tags perfectly matched..

i'll double checked on the comments tags..thanx! =P
zyrxfz is offline   Reply With Quote
Old 06-08-2005, 03:18 AM   #9 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,711
redhead is on a distinguished road
To sum it all up, Heres what I have left, which isn't exactly giving any clear definition, and thus I assume it is declared in the system dependant header files.
Code:
In general:
   savescreen()      -> Need definition
   restscreen()      -> Need definition
   clrscreen()       -> Need definition
   findfile()        -> Need definition
   DeleteFile()      -> Need definition
   WriteString()     -> Need definition
   CenterString()    -> Need definition
   DOSFINDFIRST()    -> Need definition
   DOSFINDNEXT()     -> Need definition
   DOSFINDCLOSE()    -> Need definition
   getmonth()        -> Need definition
   DOSBEEP()         -> Need definition


In message(), Process(), ExecuteProcess(), Scr2_ESSCMD(), 
   Scr3_ESSCMD(), Scr4_ESSCMD(), Scr5_ESSCMD(), main() in mcm10100:
    DOSGETDATETIME() -> Since this takes a struct DateTime
                     I dont kow how that is used, but for
		     starters it can be exchanged with 
		     localtime() found in time.h which takes
		     a struct tm*
		      struct tm
                      {
                          int     tm_sec;         /* seconds */
                          int     tm_min;         /* minutes */
                          int     tm_hour;        /* hours */
                          int     tm_mday;        /* day of the month */
                          int     tm_mon;         /* month */
                          int     tm_year;        /* year */
                          int     tm_wday;        /* day of the week */
                          int     tm_yday;        /* day in the year */
                          int     tm_isdst;       /* daylight saving time */
                       };

In ProcessDailyList() and ExecuteProcess():
   WaitingForTime() -> Can be exchanged with sleep()

In ExecuteEXE():
   DOSEXECPGM()      -> Need definition ( Could be exchanged by execv() or execvp() )

For aadefs.h:
   #include <io.h>
   #include <conio.h>  These are OS dependant, 
   #include <fcntl.h>  and might not be pressent on your
   #include <dos.h>    new compiler environment.
   #include <doscall.h>
   #include <signal.h>
   #include <twindow.h>
   #include <process.h>
Apart from these things, theres also some structures used, but since I first realised them after reading your 9.th post or so, I didn't bother to go back through it all, searching for references..
Once it starts to partly compile, when all the header files issues are solved, it is time to check for things like those.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 06-08-2005, 11:38 PM   #10 (permalink)
zyrxfz
Registered User
 
Join Date: Jun 2005
Posts: 7
zyrxfz is on a distinguished road
Quote:
Once it starts to partly compile, when all the header files issues are solved, it is time to check for things like those.
um so sorry, i can't really get wut u mean by this..can u help me a bit? thanx!
zyrxfz is offline   Reply With Quote
Old 06-09-2005, 01:15 AM   #11 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,711
redhead is on a distinguished road
The errors you were getting was in the precompile stage, where it checks if every headerfile is pressent and if the definitions mentioned in the code is valid.
It wasn't even at the stage, where it did the parse checking, to see if you had correct
<type> <variabel> <operator> <value>
befor it gets to compile the code.
Your errors were produced in the very first runthrough of your code, and smart compilers makes atleast 3 runs.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 06-14-2005, 05:17 AM   #12 (permalink)
zyrxfz
Registered User
 
Join Date: Jun 2005
Posts: 7
zyrxfz is on a distinguished road
erm..ic! thanx for the crystal clear information! but still um working on those include and header file,which i has never learn before...do you guys have any idea on where can i have material on manipulating those stuff? um afraid the reference book that i used only teach about it very brief..hurm~!
zyrxfz is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how the servlet will integrate the LDAP code j.gohel Java 19 04-16-2005 12:55 AM
Send csv to server and start processing? Wysocki PHP 10 02-09-2005 05:22 PM
Cisco Code breaking sde Code Newbie News 0 05-21-2004 07:10 AM


All times are GMT -8. The time now is 07:38 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting