| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 | 
							- /* StarPU --- Runtime system for heterogeneous multicore architectures.
 
-  *
 
-  * Copyright (C) 2011-2012                                Inria
 
-  * Copyright (C) 2012,2015,2017                           CNRS
 
-  *
 
-  * StarPU is free software; you can redistribute it and/or modify
 
-  * it under the terms of the GNU Lesser General Public License as published by
 
-  * the Free Software Foundation; either version 2.1 of the License, or (at
 
-  * your option) any later version.
 
-  *
 
-  * StarPU is distributed in the hope that it will be useful, but
 
-  * WITHOUT ANY WARRANTY; without even the implied warranty of
 
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
-  *
 
-  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
 
-  */
 
- virtual context
 
- virtual org
 
- virtual patch
 
- virtual report
 
- //
 
- // General stuff for org and report modes.
 
- //
 
- @initialize:python depends on report || org@
 
- d = { 'abort':'STARPU_ABORT', 'assert':'STARPU_ASSERT'}
 
- msg = "Please use %s rather than %s."
 
- from re import sub
 
- orgmsg = sub(r'(%[a-z])', r'=\1=', msg)
 
- @r@
 
- identifier f =~ "abort|assert";
 
- position p;
 
- @@
 
- f@p(...);
 
- @min@
 
- expression E1,E2;
 
- identifier i;
 
- position p;
 
- @@
 
- (
 
- return@p E1<E2?E1:E2;
 
- |
 
- i =@p  E1<E2?E1:E2
 
- )
 
- @max@
 
- expression E1, E2;
 
- identifier i;
 
- position p;
 
- @@
 
- (
 
- return@p E1>E2?E1:E2;
 
- |
 
- i =@p E1>E2?E1:E2
 
- )
 
- //
 
- // Context mode.
 
- //
 
- @depends on context@
 
- @@
 
- *	abort();
 
- @depends on context@
 
- @@
 
- *	assert(...);
 
- @depends on context@
 
- identifier i;
 
- expression E1, E2;
 
- @@
 
- (
 
- * 	return E1<E2?E1:E2;
 
- |
 
- *	i =  E1<E2?E1:E2            // No semi-colon at the end, so that it
 
- |
 
- *	return E1>E2?E1:E2;
 
- |
 
- *	i = E1>E2?E1:E2             // No semi-colon at the end, so that it
 
- )
 
- //
 
- // Org mode.
 
- //
 
- @script:python depends on r && org@
 
- p << r.p;
 
- f << r.f;
 
- @@
 
- coccilib.org.print_todo(p[0], orgmsg % (d[str(f)], f))
 
- @script:python depends on min && org@
 
- p << min.p;
 
- @@
 
- coccilib.org.print_todo(p[0], "Please use STARPU_MIN")
 
- @script:python depends on max && org@
 
- p << max.p;
 
- @@
 
- coccilib.org.print_todo(p[0], "Please use STARPU_MAX")
 
- //
 
- // Patch mode.
 
- //
 
- @depends on patch@
 
- @@
 
- -	abort();
 
- +	STARPU_ABORT();
 
- @depends on patch@
 
- @@
 
- -	assert(
 
- +	STARPU_ASSERT(
 
- ...)
 
- @depends on patch@
 
- identifier i;
 
- expression E1, E2;
 
- @@
 
- (
 
- - 	return E1<E2?E1:E2;
 
- + 	return STARPU_MIN(E1, E2);
 
- |
 
- -	i =  E1<E2?E1:E2            // No semi-colon at the end, so that it
 
- +	i = STARPU_MIN(E1, E2)      // matches both "i = ..." and "t i = ..."
 
- |
 
- -	return E1>E2?E1:E2;
 
- +	return STAPU_MAX(E1, E2);
 
- |
 
- -	i = E1>E2?E1:E2             // No semi-colon at the end, so that it
 
- +	i = STARPU_MAX(E1, E2)      // matches both "i = ..." and "t i = ..."
 
- )
 
- //
 
- // Report mode.
 
- //
 
- @script:python depends on r && report@
 
- p << r.p;
 
- f << r.f;
 
- @@
 
- coccilib.report.print_report(p[0], msg % (d[str(f)], f))
 
- @script:python depends on min && report@
 
- p << min.p;
 
- @@
 
- coccilib.report.print_report(p[0], "Please use STARPU_MIN")
 
- @script:python depends on max && report@
 
- p << max.p;
 
- @@
 
- coccilib.report.print_report(p[0], "Please use STARPU_MAX")
 
 
  |