+static struct {
+ enum oid_value value;
+ const char *name;
+} IrTcl_recordSyntaxTab[] = {
+{ VAL_UNIMARC, "UNIMARC" },
+{ VAL_INTERMARC, "INTERMARC" },
+{ VAL_CCF, "CCF" },
+{ VAL_USMARC, "USMARC" },
+{ VAL_UKMARC, "UKMARC" },
+{ VAL_NORMARC, "NORMARC" },
+{ VAL_LIBRISMARC, "LIBRISMARC" },
+{ VAL_DANMARC, "DANMARC" },
+{ VAL_FINMARC, "FINMARC" },
+{ VAL_MAB, "MAB" },
+{ VAL_CANMARC, "CANMARC" },
+{ VAL_SBN, "SBN" },
+{ VAL_PICAMARC, "PICAMARC" },
+{ VAL_AUSMARC, "AUSMARC" },
+{ VAL_IBERMARC, "IBERMARC" },
+{ VAL_SUTRS, "SUTRS" },
+{ 0, NULL }
+};
+
+/*
+ * IrTcl_eval
+ */
+int IrTcl_eval (Tcl_Interp *interp, const char *command)
+{
+ char *tmp = malloc (strlen(command)+1);
+ int r;
+
+ if (!tmp)
+ {
+ logf (LOG_FATAL, "Out of memory in IrTcl_eval");
+ exit (1);
+ }
+ strcpy (tmp, command);
+ r = Tcl_Eval (interp, tmp);
+ if (r == TCL_ERROR)
+ logf (LOG_WARN, "Tcl error in line %d: %s", interp->errorLine,
+ interp->result);
+ Tcl_FreeResult (interp);
+ free (tmp);
+ return r;
+}
+
+/*
+ * IrTcl_getRecordSyntaxStr: Return record syntax name of object id
+ */
+static const char *IrTcl_getRecordSyntaxStr (enum oid_value value)
+{
+ int i;
+ for (i = 0; IrTcl_recordSyntaxTab[i].name; i++)
+ if (IrTcl_recordSyntaxTab[i].value == value)
+ return IrTcl_recordSyntaxTab[i].name;
+ return "USMARC";
+}
+
+/*
+ * IrTcl_getRecordSyntaxVal: Return record syntax value of string
+ */
+static enum oid_value IrTcl_getRecordSyntaxVal (const char *name)
+{
+ int i;
+ for (i = 0; IrTcl_recordSyntaxTab[i].name; i++)
+ if (!strcmp (IrTcl_recordSyntaxTab[i].name, name))
+ return IrTcl_recordSyntaxTab[i].value;
+ return 0;
+}
+