void mclvSprintf ( mcxTing* scr , mclv* vec , int valdigits , mcxbits modes ) { dim j ; mcxTingEmpty(scr, 0) ; valdigits = get_interchange_digits(valdigits) ; if (modes & 1) { mcxTingPrintAfter(scr, "%ld", (long) vec->vid) ; if (modes & 2) mcxTingPrintAfter(scr, ":%.*g", valdigits, (double) vec->val) ; } for (j=0;j<vec->n_ivps;j++) { mcxTingPrintAfter(scr, " %ld", (long) vec->ivps[j].idx) ; if (modes & 2) mcxTingPrintAfter(scr, ":%.*g", valdigits, (double) vec->ivps[j].val) ; } if (modes & 4) mcxTingAppend(scr, " $") ; }
int main ( int argc , const char* argv[] ) { int a = 0 ; mcxTing* argtxt = mcxTingEmpty(NULL, 10) ; if (0) mclxIOsetQMode("MCLXIOVERBOSITY", MCL_APP_VB_NO) ; opInitialize() /* symtable etc */ ; globInitialize() /* hdltable etc */ ; if (argc == 1) { mcxTing* ops = mcxTingEmpty(NULL, 20) ; mcxIO *xfin = mcxIOnew("-", "r") ; mcxIOopen(xfin, EXIT_ON_FAIL) ; fprintf ( stdout , "At your service: " "'[/<op>] help', '[/<str>] grep', 'ops', 'info', and 'quit'.\n" ) ; while (1) { int ok ; mcxTing* line = mcxTingEmpty(NULL, 30) ; fprintf(stdout, "> ") ; fflush(stdout) ; if (STATUS_OK != mcxIOreadLine(xfin, line, MCX_READLINE_BSC)) { fprintf(stdout, "curtains!\n") ; mcxTingFree(&line) ; break ; } mcxTingAppend(ops, line->str) ; mcxTingFree(&line) ; ok = zsDoSequence(ops->str) ; if (ok && (v_g & V_STACK)) zsList(0) ; mcxTingEmpty(ops, 20) ; } } else { for (a=1;a<argc;a++) { mcxTingWrite(argtxt, argv[a]) ; if (!zgUser(argtxt->str)) mcxExit(1) ; } } mcxTingFree(&argtxt) ; return 0 ; }
mcxstatus mcxIOappendName ( mcxIO* xf , const char* suffix ) { if (xf->fp && !xf->stdio) mcxErr ( "mcxIOappendName PBD" , "stream open while request for name change from <%s> to <%s>" , xf->fn->str , suffix ) ; else if (!mcxTingAppend(xf->fn, suffix)) return STATUS_FAIL ; xf->stdio = begets_stdio(xf->fn->str, "-") ; return STATUS_OK ; }