anchor.diff:  #!/usr/bin/python
  -#    This is 'comp', a tool to write HAL boilerplate
  +#    This is 'instcomp', a tool to write instantiated components for
  +#    Machinekit
  +#
  +#    Based upon comp from Linuxcnc
   #    Copyright 2006 Jeff Epler <jepler@unpythonic.net>
  +#
  +#    Adapted and rewritten for instantiatable components
  +#    ArcEye 2015 <arceyeATmgwareDOTcoDOTuk>
   #
   #    This program is free software; you can redistribute it and/or modify
   #    it under the terms of the GNU General Public License as published by
  
positive.code: #
  ###########################  export_halobjs()  ######################################################
  
      print >>f, "static int export_halobjs(struct inst_data *ip, int owner_id, const char *name)\n{"
  
      print >>f, "    char buf[HAL_NAME_LEN + 1];"
      print >>f, "    int r = 0;"
  
negative.code: 
  ###########################  instantiate() ###############################################################
  
      print >>f, "\n// constructor - init all HAL pins, funct etc here"
      print >>f, "static int instantiate(const char *name, const int argc, const char**argv)\n{"
      print >>f, "struct inst_data *ip;"
      print >>f, "int r;"
      if options.get("extra_inst_setup"):
          print >>f, "int k;"
      print >>f, "\n// allocate a named instance, and some HAL memory for the instance data"
      print >>f, "int inst_id = hal_inst_create(name, comp_id, sizeof(struct inst_data), (void **)&ip);\n"
      print >>f, "    if (inst_id < 0)\n        return -1;\n"
  
      print >>f, "// here ip is guaranteed to point to a blob of HAL memory of size sizeof(struct inst_data)."
      print >>f, "    hal_print_msg(RTAPI_MSG_DBG,\"%s inst=%s argc=%d\",__FUNCTION__, name, argc);\n"
      print >>f, "// Debug print of params and values"
  
  
      for name, mptype, doc, value in instanceparams:
          if (mptype == 'int'):
              strg = "    hal_print_msg(RTAPI_MSG_DBG,\"%s: int instance param: %s=%d\",__FUNCTION__,"
              strg += "\"%s\", %s);" % (to_c(name), to_c(name))
              print >>f, strg
  
      if have_count:
          for name, mptype, doc, value in instanceparams:
              if name == 'pincount':
                  if value != None:
                      print >>f, "//  if pincount=NN is passed, set local variable here, if not set to default"
  