Index: trunk/src/action.h =================================================================== --- trunk/src/action.h (revision 1330) +++ trunk/src/action.h (revision 1331) @@ -55,7 +55,7 @@ #include "action_funchash.h" -#define ARG(n) (argc > (n) ? argv[n] : NULL) +#define ACTION_ARG(n) (argc > (n) ? argv[n] : NULL) int get_style_size(int funcid, Coord * out, int type, int size_id); Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 1330) +++ trunk/src/buffer.c (revision 1331) @@ -492,9 +492,9 @@ int LoadFootprint(int argc, char **argv, Coord x, Coord y) { - char *name = ARG(0); - char *refdes = ARG(1); - char *value = ARG(2); + char *name = ACTION_ARG(0); + char *refdes = ACTION_ARG(1); + char *value = ACTION_ARG(2); ElementTypePtr e; if (!name) @@ -1400,10 +1400,10 @@ x = y = 0; } else if (argc == 3 || argc == 4) { - x = GetValue(ARG(1), ARG(3), &absolute); + x = GetValue(ACTION_ARG(1), ACTION_ARG(3), &absolute); if (!absolute) x += oldx; - y = GetValue(ARG(2), ARG(3), &absolute); + y = GetValue(ACTION_ARG(2), ACTION_ARG(3), &absolute); if (!absolute) y += oldy; } Index: trunk/src/change_act.c =================================================================== --- trunk/src/change_act.c (revision 1330) +++ trunk/src/change_act.c (revision 1331) @@ -68,9 +68,9 @@ static int ActionChangeClearSize(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *delta = ARG(1); - char *units = ARG(2); + char *function = ACTION_ARG(0); + char *delta = ACTION_ARG(1); + char *units = ACTION_ARG(2); bool absolute; Coord value; int type; @@ -153,8 +153,8 @@ static int ActionChangeFlag(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *flag = ARG(1); + char *function = ACTION_ARG(0); + char *flag = ACTION_ARG(1); int value = argc > 2 ? atoi(argv[2]) : -1; if (value != 0 && value != 1) AFAIL(changeflag); @@ -260,7 +260,7 @@ static int ActionChangeHole(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { case F_ToggleObject: @@ -302,7 +302,7 @@ static int ActionChangePaste(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { case F_ToggleObject: @@ -380,9 +380,9 @@ static int ActionChangeSize(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *delta = ARG(1); - char *units = ARG(2); + char *function = ACTION_ARG(0); + char *delta = ACTION_ARG(1); + char *units = ACTION_ARG(2); bool absolute; /* indicates if absolute size is given */ Coord value; int type, tostyle = 0; @@ -482,9 +482,9 @@ static int ActionChange2ndSize(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *delta = ARG(1); - char *units = ARG(2); + char *function = ACTION_ARG(0); + char *delta = ACTION_ARG(1); + char *units = ACTION_ARG(2); int type; void *ptr1, *ptr2, *ptr3; @@ -643,8 +643,8 @@ int ActionChangeName(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *pinnums = ARG(1); + char *function = ACTION_ARG(0); + char *pinnums = ACTION_ARG(1); char *name; int pinnum; @@ -724,7 +724,7 @@ static int ActionChangeJoin(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { case F_ToggleObject: @@ -777,7 +777,7 @@ static int ActionChangeNonetlist(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { case F_ToggleObject: @@ -823,7 +823,7 @@ static int ActionChangeSquare(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { case F_ToggleObject: @@ -885,7 +885,7 @@ static int ActionSetSquare(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function && *function) { switch (GetFunctionID(function)) { case F_ToggleObject: @@ -937,7 +937,7 @@ static int ActionClearSquare(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function && *function) { switch (GetFunctionID(function)) { case F_ToggleObject: @@ -988,7 +988,7 @@ static int ActionChangeOctagon(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { case F_ToggleObject: @@ -1043,7 +1043,7 @@ static int ActionSetOctagon(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { case F_ToggleObject: @@ -1099,7 +1099,7 @@ static int ActionClearOctagon(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { case F_ToggleObject: @@ -1172,8 +1172,8 @@ static int ActionSetThermal(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *style = ARG(1); + char *function = ACTION_ARG(0); + char *style = ACTION_ARG(1); void *ptr1, *ptr2, *ptr3; int type, kind; int err = 0; @@ -1238,8 +1238,8 @@ static int ActionSetFlag(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *flag = ARG(1); + char *function = ACTION_ARG(0); + char *flag = ACTION_ARG(1); ChangeFlag(function, flag, 1, "SetFlag"); return 0; } @@ -1267,8 +1267,8 @@ static int ActionClrFlag(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *flag = ARG(1); + char *function = ACTION_ARG(0); + char *flag = ACTION_ARG(1); ChangeFlag(function, flag, 0, "ClrFlag"); return 0; } @@ -1307,9 +1307,9 @@ static int ActionSetValue(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *val = ARG(1); - char *units = ARG(2); + char *function = ACTION_ARG(0); + char *val = ACTION_ARG(1); + char *units = ACTION_ARG(2); bool absolute; /* flag for 'absolute' value */ double value; int err = 0; Index: trunk/src/file_act.c =================================================================== --- trunk/src/file_act.c (revision 1330) +++ trunk/src/file_act.c (revision 1331) @@ -63,7 +63,7 @@ AFAIL(execcommand); } - command = ARG(0); + command = ACTION_ARG(0); if (system(command)) return 1; @@ -171,7 +171,7 @@ static int ActionNew(int argc, char **argv, Coord x, Coord y) { - char *name = ARG(0); + char *name = ACTION_ARG(0); if (!PCB->Changed || gui->confirm_dialog(_("OK to clear layout data?"), 0)) { if (name) @@ -353,7 +353,7 @@ static int ActionQuit(int argc, char **argv, Coord x, Coord y) { - char *force = ARG(0); + char *force = ACTION_ARG(0); if (force && strcasecmp(force, "force") == 0) { PCB->Changed = 0; exit(0); Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 1330) +++ trunk/src/gui_act.c (revision 1331) @@ -209,8 +209,8 @@ int id; int err = 0; - function = ARG(0); - str_dir = ARG(1); + function = ACTION_ARG(0); + str_dir = ACTION_ARG(1); if (function && (!str_dir || !*str_dir)) { switch (id = GetFunctionID(function)) { @@ -590,7 +590,7 @@ static int ActionMode(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { Note.X = Crosshair.X; @@ -890,7 +890,7 @@ static int ActionToggleHideName(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function && PCB->ElementOn) { switch (GetFunctionID(function)) { case F_Object: @@ -957,7 +957,7 @@ static int ActionMarkCrosshair(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (!function || !*function) { if (Marked.status) { notify_mark_change(false); @@ -995,7 +995,7 @@ static int ActionRouteStyle(int argc, char **argv, Coord x, Coord y) { - char *str = ARG(0); + char *str = ACTION_ARG(0); RouteStyleType *rts; int number; Index: trunk/src/netlist.c =================================================================== --- trunk/src/netlist.c (revision 1330) +++ trunk/src/netlist.c (revision 1331) @@ -376,8 +376,6 @@ %end-doc */ -#define NL_ARG(n) (argc > (n) ? argv[n] : 0) - static int Netlist(int argc, char **argv, Coord x, Coord y) { NFunc func; @@ -424,7 +422,7 @@ return netlist_swap(); else if (strcasecmp(argv[0], "add") == 0) { /* Add is different, because the net/pin won't already exist. */ - return netlist_add(NL_ARG(1), NL_ARG(2)); + return netlist_add(ACTION_ARG(1), ACTION_ARG(2)); } else if (strcasecmp(argv[0], "sort") == 0) { sort_netlist(); @@ -508,7 +506,7 @@ pin = 0; if (func == (void *) netlist_style) { - netlist_style(net, NL_ARG(2)); + netlist_style(net, ACTION_ARG(2)); } else if (argc > 2) { int l = strlen(argv[2]); Index: trunk/src/object_act.c =================================================================== --- trunk/src/object_act.c (revision 1330) +++ trunk/src/object_act.c (revision 1331) @@ -103,8 +103,8 @@ static int ActionAttributes(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *layername = ARG(1); + char *function = ACTION_ARG(0); + char *layername = ACTION_ARG(1); char *buf; if (!function) @@ -211,7 +211,7 @@ static int ActionDisperseElements(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); Coord minx = GAP, miny = GAP, maxy = GAP, dx, dy; int all = 0, bad = 0; @@ -322,7 +322,7 @@ static int ActionFlip(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); ElementTypePtr element; void *ptrtmp; int err = 0; @@ -369,9 +369,9 @@ static int ActionMoveObject(int argc, char **argv, Coord x, Coord y) { - char *x_str = ARG(0); - char *y_str = ARG(1); - char *units = ARG(2); + char *x_str = ACTION_ARG(0); + char *y_str = ACTION_ARG(1); + char *units = ACTION_ARG(2); Coord nx, ny; bool absolute1, absolute2; void *ptr1, *ptr2, *ptr3; @@ -415,7 +415,7 @@ static int ActionMoveToCurrentLayer(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { case F_Object: @@ -528,9 +528,9 @@ argc--; argv++; - refdes = ARG(0); - footprint = ARG(1); - value = ARG(2); + refdes = ACTION_ARG(0); + footprint = ACTION_ARG(1); + value = ACTION_ARG(2); args[0] = footprint; args[1] = refdes; @@ -667,7 +667,7 @@ refdes = argv[0]; name = argv[1]; - value = ARG(2); + value = ACTION_ARG(2); ELEMENT_LOOP(PCB->Data); { @@ -726,7 +726,7 @@ static int ActionRipUp(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); bool changed = false; if (function) { @@ -830,9 +830,9 @@ static int ActionMinMaskGap(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *delta = ARG(1); - char *units = ARG(2); + char *function = ACTION_ARG(0); + char *delta = ACTION_ARG(1); + char *units = ACTION_ARG(2); bool absolute; Coord value; int flags; @@ -904,9 +904,9 @@ static int ActionMinClearGap(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); - char *delta = ARG(1); - char *units = ARG(2); + char *function = ACTION_ARG(0); + char *delta = ACTION_ARG(1); + char *units = ACTION_ARG(2); bool absolute; Coord value; int flags; Index: trunk/src/polygon_act.c =================================================================== --- trunk/src/polygon_act.c (revision 1330) +++ trunk/src/polygon_act.c (revision 1331) @@ -55,7 +55,7 @@ static int ActionMorphPolygon(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { case F_Object: @@ -113,7 +113,7 @@ static int ActionPolygon(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function && Settings.Mode == POLYGON_MODE) { notify_crosshair_change(false); switch (GetFunctionID(function)) { Index: trunk/src/rats_act.c =================================================================== --- trunk/src/rats_act.c (revision 1330) +++ trunk/src/rats_act.c (revision 1331) @@ -66,7 +66,7 @@ static int ActionAddRats(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); RatTypePtr shorty; float len, small; @@ -141,7 +141,7 @@ static int ActionConnection(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { case F_Find: @@ -190,7 +190,7 @@ static int ActionDeleteRats(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { if (Settings.RatWarn) ClearWarnings(); Index: trunk/src/remove_act.c =================================================================== --- trunk/src/remove_act.c (revision 1330) +++ trunk/src/remove_act.c (revision 1331) @@ -46,7 +46,7 @@ static int ActionDelete(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); int id = GetFunctionID(function); Note.X = Crosshair.X; Index: trunk/src/select_act.c =================================================================== --- trunk/src/select_act.c (revision 1330) +++ trunk/src/select_act.c (revision 1331) @@ -116,7 +116,7 @@ static int ActionSelect(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { #if defined(HAVE_REGCOMP) || defined(HAVE_RE_COMP) @@ -146,13 +146,13 @@ commonByName: { - char *pattern = ARG(1); + char *pattern = ACTION_ARG(1); search_method_t method; if (pattern || (pattern = gui_get_pat(&method)) != NULL) { if (SelectObjectByName(type, pattern, true, method)) SetChangedFlag(true); - if (ARG(1) == NULL) + if (ACTION_ARG(1) == NULL) free(pattern); } break; @@ -287,7 +287,7 @@ static int ActionUnselect(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (function) { switch (GetFunctionID(function)) { #if defined(HAVE_REGCOMP) || defined(HAVE_RE_COMP) @@ -317,13 +317,13 @@ commonByName: { - char *pattern = ARG(1); + char *pattern = ACTION_ARG(1); search_method_t method; if (pattern || (pattern = gui_get_pat(&method)) != NULL) { if (SelectObjectByName(type, pattern, false, method)) SetChangedFlag(true); - if (ARG(1) == NULL) + if (ACTION_ARG(1) == NULL) free(pattern); } break; Index: trunk/src/undo_act.c =================================================================== --- trunk/src/undo_act.c (revision 1330) +++ trunk/src/undo_act.c (revision 1331) @@ -125,7 +125,7 @@ int ActionUndo(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); if (!function || !*function) { /* don't allow undo in the middle of an operation */ if (Settings.Mode != POLYGONHOLE_MODE && Crosshair.AttachedObject.State != STATE_FIRST) Index: trunk/src_plugins/autoroute/action.c =================================================================== --- trunk/src_plugins/autoroute/action.c (revision 1330) +++ trunk/src_plugins/autoroute/action.c (revision 1331) @@ -28,6 +28,7 @@ #include "config.h" #include "global.h" #include "autoroute.h" +#include "action.h" #include "plugins.h" #include "set.h" @@ -61,12 +62,9 @@ %end-doc */ -#warning TODO: make this central -#define ARG(n) (argc > (n) ? argv[n] : NULL) - static int ActionAutoRoute(int argc, char **argv, Coord x, Coord y) { - char *function = ARG(0); + char *function = ACTION_ARG(0); hid_action("Busy"); if (function) { /* one parameter */ if (strcmp(function, "AllRats") == 0) { Index: trunk/src_plugins/import_sch/import_sch.c =================================================================== --- trunk/src_plugins/import_sch/import_sch.c (revision 1330) +++ trunk/src_plugins/import_sch/import_sch.c (revision 1331) @@ -165,14 +165,14 @@ printf("ActionImport: =========== Entering ActionImport ============\n"); #endif - mode = ARG(0); + mode = ACTION_ARG(0); if (mode && strcasecmp(mode, "setdisperse") == 0) { char *ds, *units; char buf[50]; - ds = ARG(1); - units = ARG(2); + ds = ACTION_ARG(1); + units = ACTION_ARG(2); if (!ds) { const char *as = AttributeGet(PCB, "import::disperse"); ds = gui->prompt_for(_("Enter dispersion:"), as ? as : "0"); @@ -183,7 +183,7 @@ } else AttributePut(PCB, "import::disperse", ds); - if (ARG(1) == NULL) + if (ACTION_ARG(1) == NULL) free(ds); return 0; } @@ -193,9 +193,9 @@ Coord x, y; char buf[50]; - xs = ARG(1); - ys = ARG(2); - units = ARG(3); + xs = ACTION_ARG(1); + ys = ACTION_ARG(2); + units = ACTION_ARG(3); if (!xs) { gui->get_coords(_("Click on a location"), &x, &y);