Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: third_party/yasm/patched-yasm/modules/preprocs/nasm/genversion.c

Issue 11364046: Update Yasm to 1.2.0 (Yasm Part 1/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* $Id: genversion.c 2082 2008-05-09 06:46:02Z peter $ 1 /*
2 * 2 *
3 * Generate version.mac 3 * Generate version.mac
4 * 4 *
5 * Copyright (C) 2006-2007 Peter Johnson 5 * Copyright (C) 2006-2007 Peter Johnson
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
(...skipping 17 matching lines...) Expand all
29 29
30 #include <stdio.h> 30 #include <stdio.h>
31 #include <stdlib.h> 31 #include <stdlib.h>
32 #include <string.h> 32 #include <string.h>
33 #include <ctype.h> 33 #include <ctype.h>
34 34
35 int 35 int
36 main(int argc, char *argv[]) 36 main(int argc, char *argv[])
37 { 37 {
38 FILE *out; 38 FILE *out;
39 int major, minor, subminor; 39 int major, minor, subminor, patchlevel, matched;
40 40
41 if (argc != 2) { 41 if (argc != 2) {
42 fprintf(stderr, "Usage: %s <outfile>\n", argv[0]); 42 fprintf(stderr, "Usage: %s <outfile>\n", argv[0]);
43 return EXIT_FAILURE; 43 return EXIT_FAILURE;
44 } 44 }
45 45
46 if (sscanf(PACKAGE_INTVER, "%d.%d.%d", &major, &minor, &subminor) != 3) { 46 matched = sscanf(PACKAGE_VERSION, "%d.%d.%d.%d", &major, &minor, &subminor,
47 &patchlevel);
48
49 if (matched == 3)
50 patchlevel = 0;
51 else if (matched != 4) {
47 fprintf(stderr, "Version tokenizing error\n"); 52 fprintf(stderr, "Version tokenizing error\n");
48 return EXIT_FAILURE; 53 return EXIT_FAILURE;
49 } 54 }
50 55
51 out = fopen(argv[1], "wt"); 56 out = fopen(argv[1], "wt");
52 57
53 if (!out) { 58 if (!out) {
54 fprintf(stderr, "Could not open `%s'.\n", argv[1]); 59 fprintf(stderr, "Could not open `%s'.\n", argv[1]);
55 return EXIT_FAILURE; 60 return EXIT_FAILURE;
56 } 61 }
57 62
58 fprintf(out, "; This file auto-generated by genversion.c" 63 fprintf(out, "; This file auto-generated by genversion.c"
59 " - don't edit it\n"); 64 " - don't edit it\n");
60 65
61 fprintf(out, "%%define __YASM_MAJOR__ %d\n", major); 66 fprintf(out, "%%define __YASM_MAJOR__ %d\n", major);
62 fprintf(out, "%%define __YASM_MINOR__ %d\n", minor); 67 fprintf(out, "%%define __YASM_MINOR__ %d\n", minor);
63 fprintf(out, "%%define __YASM_SUBMINOR__ %d\n", subminor); 68 fprintf(out, "%%define __YASM_SUBMINOR__ %d\n", subminor);
64 if (!isdigit(PACKAGE_BUILD[0])) 69 fprintf(out, "%%define __YASM_BUILD__ %d\n", patchlevel);
65 fprintf(out, "%%define __YASM_BUILD__ 0\n"); 70 fprintf(out, "%%define __YASM_PATCHLEVEL__ %d\n", patchlevel);
66 else
67 fprintf(out, "%%define __YASM_BUILD__ %d\n", atoi(PACKAGE_BUILD));
68 71
69 /* Version id (hex number) */ 72 /* Version id (hex number) */
70 fprintf(out, "%%define __YASM_VERSION_ID__ 0%02x%02x%02x00h\n", major, 73 fprintf(out, "%%define __YASM_VERSION_ID__ 0%02x%02x%02x%02xh\n", major,
71 minor, subminor); 74 minor, subminor, patchlevel);
72 75
73 /* Version string - version sans build */ 76 /* Version string */
74 fprintf(out, "%%define __YASM_VER__ \"%s\"\n", PACKAGE_INTVER); 77 fprintf(out, "%%define __YASM_VER__ \"%s\"\n", PACKAGE_VERSION);
75 fclose(out); 78 fclose(out);
76 79
77 return EXIT_SUCCESS; 80 return EXIT_SUCCESS;
78 } 81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698