Previous 15994 Revisions Next

r7077 Wednesday 20th January, 2010 at 13:55:30 UTC by Miodrag Milanović
Compile fixes for initial U1 release, SDL should build also
[src]version.c
[src/mess/drivers]pv1000.c
[src/mess/machine]scsibus.c scsibus.h
[src/mess/osd/sdl]glob.c sdlmess.c w32util.c
[src/osd/sdl]sdlmain.c
[src/osd/windows]main.c
[src/osd/winui]treeview.h

src/osd/sdl/sdlmain.c
r7076r7077
6464//============================================================
6565
6666#ifdef MESS
67#include <unistd.h>
6768static char cwd[512];
6869#endif
6970
src/osd/windows/main.c
r7076r7077
22//
33//  main.c - Win32 main program
44//
5//  Copyright Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
5//============================================================
76//
7//  Copyright Aaron Giles
8//  All rights reserved.
9//
10//  Redistribution and use in source and binary forms, with or
11//  without modification, are permitted provided that the
12//  following conditions are met:
13//
14//    * Redistributions of source code must retain the above
15//      copyright notice, this list of conditions and the
16//      following disclaimer.
17//    * Redistributions in binary form must reproduce the
18//      above copyright notice, this list of conditions and
19//      the following disclaimer in the documentation and/or
20//      other materials provided with the distribution.
21//    * Neither the name 'MAME' nor the names of its
22//      contributors may be used to endorse or promote
23//      products derived from this software without specific
24//      prior written permission.
25//
26//  THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND
27//  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28//  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
29//  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
30//  EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
31//  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32//  DAMAGE (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33//  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34//  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
35//  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36//  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37//  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
38//  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39//
840//============================================================
941
1042// standard windows headers
r7076r7077
1547// MAMEOS headers
1648#include "strconv.h"
1749
18extern int utf8_main(int argc, char **argv);
50extern int utf8_main(int argc, char *argv[]);
1951
2052
2153
r7076r7077
2456//============================================================
2557
2658// undo the command-line #define that maps main to utf8_main in all other cases
27#ifndef MESSLIB
28#if !defined(WINUI) || defined(MESS)
59#ifndef WINUI
2960#undef main
3061#undef wmain
3162#endif
32#endif
3363
34#ifdef __GNUC__
35int main(int argc, char **a_argv)
36#else // !__GNUC__
37int _tmain(int argc, TCHAR **argv)
38#endif // __GNUC__
64extern "C" int _tmain(int argc, TCHAR **argv)
3965{
4066   int i, rc;
4167   char **utf8_argv;
4268
43#ifdef __GNUC__
44   TCHAR **argv;
45#ifdef UNICODE
46   // MinGW doesn't support wmain() directly, so we have to jump through some hoops
47   extern void __wgetmainargs(int *argc, wchar_t ***wargv, wchar_t ***wenviron, int expand_wildcards, int *startupinfo);
48   WCHAR **wenviron;
49   int startupinfo;
50   __wgetmainargs(&argc, &argv, &wenviron, 0, &startupinfo);
51#else // !UNICODE
52   argv = a_argv;
53#endif // UNICODE
54#endif // __GNUC__
55
56#ifdef MALLOC_DEBUG
57{
58   extern int winalloc_in_main_code;
59   winalloc_in_main_code = TRUE;
60#endif
61
6269   /* convert arguments to UTF-8 */
6370   utf8_argv = (char **) malloc(argc * sizeof(*argv));
6471   if (utf8_argv == NULL)
r7076r7077
7885      free(utf8_argv[i]);
7986   free(utf8_argv);
8087
81#ifdef MALLOC_DEBUG
82   {
83      void check_unfreed_mem(void);
84      check_unfreed_mem();
85   }
86   winalloc_in_main_code = FALSE;
87}
88#endif
89
9088   return rc;
9189}
src/osd/winui/treeview.h
r7076r7077
165165
166166typedef struct
167167{
168    char        m_szTitle[64];  // Folder Title
168    char        m_szTitle[256];  // Folder Title
169169    UINT        m_nFolderId;    // ID
170170    int         m_nParent;      // Parent Folder index in treeFolders[]
171171    DWORD       m_dwFlags;      // Flags - Customizable and Filters
src/version.c
r7076r7077
44
55    Version string source file for MAME.
66
7    Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
7    Copyright Nicola Salmoria and the MAME Team.
88    Visit http://mamedev.org for licensing and usage restrictions.
99
1010***************************************************************************/
1111
12const char build_version[] = "0.136.1 ("__DATE__")";
12extern const char build_version[];
13const char build_version[] = "0.136u1 ("__DATE__")";
src/mess/osd/sdl/glob.c
r7076r7077
158158static void    g_Ctoc __P((const Char *, char *));
159159//static int     g_lstat __P((Char *, struct stat *, glob_t *));
160160static osd_directory   *g_opendir __P((Char *, glob_t *));
161static Char   *g_strchr __P((const Char *, int));
161static Char   *g_strchr __P((Char *, int));
162162#ifdef notdef
163163static Char   *g_strcat __P((Char *, const Char *));
164164#endif
r7076r7077
176176static void    qprintf __P((const char *, Char *));
177177#endif
178178
179int
180glob(pattern, flags, errfunc, pglob)
181   const char *pattern;
182   int flags, (*errfunc) __P((const char *, int));
183   glob_t *pglob;
179int   glob (const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
184180{
185181   const u_char *patnext;
186182   int c;
r7076r7077
228224 * invoke the standard globbing routine to glob the rest of the magic
229225 * characters
230226 */
231static int globexp1(pattern, pglob)
232   const Char *pattern;
233   glob_t *pglob;
227static int globexp1(const Char *pattern, glob_t *pglob)
234228{
235   const Char* ptr = pattern;
229   const Char* ptr = (const Char *) pattern;
236230   int rv;
237231
238232   /* Protect a single {}, for find(1), like csh */
239233   if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
240234      return glob0(pattern, pglob);
241235
242   while ((ptr = (const Char *) g_strchr(ptr, LBRACE)) != NULL)
236   while ((ptr = (Char *) g_strchr((Char *) ptr, LBRACE)) != NULL)
243237      if (!globexp2(ptr, pattern, pglob, &rv))
244238         return rv;
245239
r7076r7077
252246 * If it succeeds then it invokes globexp1 with the new pattern.
253247 * If it fails then it tries to glob the rest of the pattern and returns.
254248 */
255static int globexp2(ptr, pattern, pglob, rv)
256   const Char *ptr, *pattern;
257   glob_t *pglob;
258   int *rv;
249static int globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv)
259250{
260251   int     i;
261252   Char   *lm, *ls;
r7076r7077
357348/*
358349 * expand tilde from the passwd file.
359350 */
360static const Char *
361globtilde(pattern, patbuf, patbuf_len, pglob)
362   const Char *pattern;
363   Char *patbuf;
364   size_t patbuf_len;
365   glob_t *pglob;
351static const Char *globtilde(const Char *pattern,Char *patbuf, size_t patbuf_len, glob_t *pglob)
366352{
367353   struct passwd *pwd;
368354   char *h;
r7076r7077
428414 * if things went well, nonzero if errors occurred.  It is not an error
429415 * to find no matches.
430416 */
431static int
432glob0(pattern, pglob)
433   const Char *pattern;
434   glob_t *pglob;
417static int glob0(const Char *pattern,glob_t *pglob)
435418{
436419   const Char *qpatnext;
437420   int c, err, oldpathc;
r7076r7077
513496   return(0);
514497}
515498
516static int compare(p, q)
517   const void *p, *q;
499static int compare(const void *p, const void *q)
518500{
519501   return(strcmp(*(char **)p, *(char **)q));
520502}
521503
522static int
523glob1(pattern, pglob)
524   Char *pattern;
525   glob_t *pglob;
504static int glob1(Char *pattern,glob_t *pglob)
526505{
527506   Char pathbuf[_MAX_PATH+1];
528507
r7076r7077
537516 * of recursion for each segment in the pattern that contains one or more
538517 * meta characters.
539518 */
540static int
541glob2(pathbuf, pathend, pattern, pglob)
542   Char *pathbuf, *pathend, *pattern;
543   glob_t *pglob;
519static int glob2(Char *pathbuf, Char *pathend, Char *pattern,glob_t *pglob)
544520{
545521   Char *p, *q;
546522   int anymeta;
r7076r7077
595571   /* NOTREACHED */
596572}
597573
598static int
599glob3(pathbuf, pathend, pattern, restpattern, pglob)
600   Char *pathbuf, *pathend, *pattern, *restpattern;
601   glob_t *pglob;
574static int glob3(Char *pathbuf,Char *pathend,Char *pattern,Char *restpattern,glob_t *pglob)   
602575{
603576   register const osd_directory_entry *dp;
604577   osd_directory *dirp;
r7076r7077
676649 *  Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
677650 *  gl_pathv points to (gl_offs + gl_pathc + 1) items.
678651 */
679static int
680globextend(path, pglob)
681   const Char *path;
682   glob_t *pglob;
652static int globextend(const Char *path, glob_t *pglob)
683653{
684654   register char **pathv;
685655   register int i;
r7076r7077
689659
690660   newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
691661   pathv = pglob->gl_pathv ?
692          realloc((char *)pglob->gl_pathv, newsize) :
693          malloc(newsize);
662          (char **)realloc(pglob->gl_pathv, newsize) :
663          (char **)malloc(newsize);
694664   if (pathv == NULL)
695665      return(GLOB_NOSPACE);
696666
r7076r7077
704674
705675   for (p = path; *p++;)
706676      continue;
707   if ((copy = malloc(p - path)) != NULL) {
677   if ((copy = (char *)malloc(p - path)) != NULL) {
708678      g_Ctoc(path, copy);
709679      pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
710680   }
r7076r7077
716686 * pattern matching function for filenames.  Each occurrence of the *
717687 * pattern causes a recursion level.
718688 */
719static int
720match(name, pat, patend)
721   register Char *name, *pat, *patend;
689static int match(register Char *name, register Char *pat, register Char *patend)
722690{
723691   int ok, negate_range;
724692   Char c, k;
r7076r7077
764732}
765733
766734/* Free allocated data belonging to a glob_t structure. */
767void
768globfree(pglob)
769   glob_t *pglob;
735void globfree(glob_t *pglob)
770736{
771737   register int i;
772738   register char **pp;
r7076r7077
780746   }
781747}
782748
783static osd_directory *
784g_opendir(str, pglob)
785   register Char *str;
786   glob_t *pglob;
749static osd_directory *g_opendir(register Char *str,glob_t *pglob)   
787750{
788751   char buf[_MAX_PATH];
789752
r7076r7077
793756      g_Ctoc(str, buf);
794757
795758   if (pglob->gl_flags & GLOB_ALTDIRFUNC)
796      return((*pglob->gl_opendir)(buf));
759      return((osd_directory *)(*pglob->gl_opendir)(buf));
797760
798761   return osd_opendir(buf);
799762}
800#if 0
801static int
802g_lstat(fn, sb, pglob)
803   register Char *fn;
804   struct stat *sb;
805   glob_t *pglob;
806{
807   char buf[_MAX_PATH];
808763
809   g_Ctoc(fn, buf);
810   if (pglob->gl_flags & GLOB_ALTDIRFUNC)
811      return((*pglob->gl_lstat)(buf, sb));
812   return (lstat(buf, sb));
813}
814
815static int
816g_stat(fn, sb, pglob)
817   register Char *fn;
818   struct stat *sb;
819   glob_t *pglob;
764static Char *g_strchr(Char *str,int ch)   
820765{
821   char buf[_MAX_PATH];
822
823   g_Ctoc(fn, buf);
824   if (pglob->gl_flags & GLOB_ALTDIRFUNC)
825      return((*pglob->gl_stat)(buf, sb));
826   return(stat(buf, sb));
827}
828#endif
829static Char *
830g_strchr(str, ch)
831   const Char *str;
832   int ch;
833{
834766   do {
835767      if (*str == ch)
836         return ((Char *)str);
768         return (str);
837769   } while (*str++);
838770   return (NULL);
839771}
r7076r7077
856788}
857789#endif
858790
859static void
860g_Ctoc(str, buf)
861   register const Char *str;
862   char *buf;
791static void g_Ctoc(register const Char *str, char *buf)
863792{
864793   register char *dc;
865794
src/mess/osd/sdl/w32util.c
r7076r7077
3434}
3535
3636//============================================================
37//  wstring_from_utf8
38//============================================================
39
40WCHAR *wstring_from_utf8(const char *utf8string)
41{
42   int char_count;
43   WCHAR *result;
44
45   // convert MAME string (UTF-8) to UTF-16
46   char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, NULL, 0);
47   result = (WCHAR *)malloc(char_count * sizeof(*result));
48   if (result != NULL)
49      MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, result, char_count);
50
51   return result;
52}
53
54//============================================================
3755//  win_attributes_to_entry_type
3856//============================================================
3957
src/mess/osd/sdl/sdlmess.c
r7076r7077
130130      return NULL;
131131
132132   // allocate space for it
133   dirname = malloc(strlen(filename) + 1);
133   dirname = (char*)malloc(strlen(filename) + 1);
134134   if (!dirname)
135135      return NULL;
136136
src/mess/machine/scsibus.c
r7076r7077
77     
88*/
99 
10#include "emu.h"
1011#include "machine/scsi.h"
1112#include "machine/scsibus.h"
1213 
r7076r7077
516517 
517518static TIMER_CALLBACK(req_timer_callback)
518519{
519    scsi_out_line_change_now(ptr, SCSI_LINE_REQ, param);
520    scsi_out_line_change_now((const device_config *)ptr, SCSI_LINE_REQ, param);
520521}
521522 
522523static TIMER_CALLBACK(ack_timer_callback)
523524{
524    set_scsi_line_now(ptr, SCSI_LINE_ACK, param);
525    set_scsi_line_now((const device_config *)ptr, SCSI_LINE_ACK, param);
525526}
526527 
527528 
r7076r7077
653654    scsibus_t               *bus = get_token(device);
654655     
655656   assert(device->static_config != NULL);
656    bus->interface = device->static_config;
657    bus->interface = (const SCSIBus_interface*)device->static_config;
657658     
658659   memset(bus->devices, 0, sizeof(bus->devices));
659660     
src/mess/machine/scsibus.h
r7076r7077
1010#ifndef _SCSIBUS_H_
1111#define _SCSIBUS_H_
1212 
13#include "emu.h"
1314#include "machine/scsidev.h"
14#include "devcb.h"
15#include "driver.h"
1615 
16 
1717/***************************************************************************
1818    MACROS
1919***************************************************************************/
src/mess/drivers/pv1000.c
r7076r7077
44
55***************************************************************************/
66
7#include "driver.h"
7#include "emu.h"
88#include "cpu/z80/z80.h"
99#include "devices/cartslot.h"
1010

Previous 15994 Revisions Next


© 1998-2018 The MESS Team