+^[ \t]*requires[ \t]+[0-9]+\.[0-9]+\.[0-9]+[\t ]*$ {
+ int maj = 0,min = 0,pl = 0;
+ int rmaj = 0,rmin = 0,rpl = 0;
+ int effective_maj = 0;
+ int effective_rmaj = 0;
+ char *p;
+
+ sscanf(VERSION,"%d.%d.%d",&rmaj,&rmin,&rpl);
+ effective_rmaj = rmaj;
+ if (rmin >= 90)
+ effective_rmaj = rmaj + 1;
+
+ p = strchr(yytext,'r');
+ g_assert(p); /* we MUST have found it */
+ sscanf(p,"requires %d.%d.%d",&maj,&min,&pl);
+ effective_maj = maj;
+ if (min >= 90)
+ effective_maj = maj + 1;
+
+ if(rmaj < maj ||
+ (rmaj == maj && rmin < min) ||
+ (rmaj == maj && rmin == min && rpl < pl)) {
+ error_printf(GOB_ERROR, line_no,
+ "GOB version at least %d.%d.%d required "
+ "(this is %s)\n"
+ "To upgrade your gob, see: "
+ "http://www.5z.com/jirka/gob.html",
+ maj, min, pl, VERSION);
+ }
+
+ if(effective_rmaj != effective_maj) {
+ error_printf(GOB_ERROR, line_no,
+ "GOB major version %d required "
+ "(this is %s)\n"
+ "To upgrade your gob, see: "
+ "http://www.5z.com/jirka/gob.html",
+ maj, VERSION);
+ }
+ }
+