コード例 #1
0
ファイル: uptext.c プロジェクト: texlive/texlive-source
Static void textTranslate(Char *uptext, Char *font)
{
  short k;
  Char STR1[256], STR2[256], STR3[256], STR4[256];
  short FORLIM;

  if (*uptext == '\0')
    return;
  do {
    k = pos1('%', uptext);
    if (k > 0) {
      sprintf(STR4, "%s{\\mtxFlat}%s",
	      substr_(STR1, uptext, 1, k - 1),
	      substr_(STR3, uptext, k + 1, strlen(uptext) - k));
      strcpy(uptext, STR4);
    }
  } while (k != 0);
  do {
    k = pos1('#', uptext);
    if (k > 0) {
      sprintf(STR2, "%s{\\mtxSharp}%s",
	      substr_(STR1, uptext, 1, k - 1),
	      substr_(STR4, uptext, k + 1, strlen(uptext) - k));
      strcpy(uptext, STR2);
    }
  } while (k != 0);
  switch (uptext[0]) {

  case '<':
    if (!strcmp(uptext, "<"))
      strcpy(uptext, "\\mtxIcresc");
    else if (!strcmp(uptext, "<."))
      strcpy(uptext, "\\mtxTcresc");
    else {
      predelete(uptext, 1);
      sprintf(uptext, "\\mtxCresc{%s}", strcpy(STR4, uptext));
    }
    break;

  case '>':
    if (!strcmp(uptext, ">"))
      strcpy(uptext, "\\mtxIdecresc");
    else if (!strcmp(uptext, ">."))
      strcpy(uptext, "\\mtxTdecresc");
    else {
      predelete(uptext, 1);
      sprintf(uptext, "\\mtxDecresc{%s}", strcpy(STR1, uptext));
    }
    break;

  default:
    FORLIM = strlen(uptext);
    for (k = 0; k <= FORLIM - 1; k++) {
      if (pos1(uptext[k], "mpfzrs~") == 0)
	return;
    }
    break;
  }
  strcpy(font, "\\mtxPF");
}
コード例 #2
0
ファイル: mtx.c プロジェクト: clerkma/texlive-mobile
Local void countIt(struct LOC_scanMusic *LINK)
{
  struct LOC_countIt V;

  V.LINK = LINK;
  if (LINK->ngrace > 0) {
    LINK->ngrace--;
    return;
  }
  if (LINK->nmulti > 0) {
    decmulti(LINK);
    return;
  }
  if (LINK->count % 3 != 0 &&
      (LINK->note[0] != rest && note_attrib[LINK->voice-1]['d' - 'a'] ||
       LINK->note[0] == rest && rest_attrib[LINK->voice-1]['d' - 'a']))
    LINK->count += LINK->count / 2;
/* p2c: mtx.pas, line 150:
 * Note: Using % for possibly-negative arguments [317] */
  incbar(LINK->count, &V);
  LINK->l = pos1(multi_group, LINK->note);
  if (LINK->l <= 0)
    return;
  predelete(LINK->note, LINK->l);
  getNum(LINK->note, &LINK->nmulti);
  decmulti(LINK);
}
コード例 #3
0
ファイル: prepmx.c プロジェクト: MiKTeX/miktex
Local void outChord(struct LOC_addChords *LINK)
{
  short k;
  Char STR2[256];
  short FORLIM;

  if (*LINK->nt == '\0')
    return;
  LINK->tieme = (LINK->nt[0] == '{');
  if (LINK->tieme)
    predelete(LINK->nt, 1);
  if (*LINK->nt == '\0' || LINK->nt[0] < 'a' || LINK->nt[0] > 'g') {
    sprintf(STR2, "Must have a note name at the start of \"%s\", not \"%c\"",
	    LINK->nt, LINK->nt[0]);
    error(STR2, print);
  }
  renewChordPitch(LINK->LINK->voice, LINK->nt);
  sprintf(LINK->LINK->chords + strlen(LINK->LINK->chords), " z%s", LINK->nt);
  *LINK->nt = '\0';
  FORLIM = strlen(LINK->labels);
  for (k = 0; k <= FORLIM - 1; k++) {
    if (chordPitch(LINK->LINK->voice) == LINK->pitches[k]) {
      sprintf(LINK->LINK->chords + strlen(LINK->LINK->chords), " s%ct",
	      LINK->labels[k]);
      LINK->labels[k] = ' ';
    }
  }
  if (LINK->tieme) {
    chordTie(LINK->LINK->voice, &LINK->lab);
    sprintf(LINK->LINK->chords + strlen(LINK->LINK->chords), " s%ct",
	    LINK->lab);
  }
}
コード例 #4
0
ファイル: preamble.c プロジェクト: texlive/texlive-source
void augmentPreamble(boolean control_para)
{
  paragraph_index i;
  line_type l;
  short s[5];
  paragraph_index FORLIM;

  if (!thisCase())
    return;
  for (l = unknown; l <= plain_line; l = (line_type)((long)l + 1))
    s[(long)l] = 0;
  FORLIM = para_len;
  for (i = 0; i <= FORLIM - 1; i++) {
    line_no = orig_line_no[i];
    l = doCommand(P[i]);
    s[(long)l]++;
    if (l == comment_line && P[i][1] == comment) {
      predelete(P[i], 2);
      putLine(P[i]);
    }
    if (!control_para && l == unknown)
      error("Unidentifiable line", print);
  }
  if (!control_para && s[(long)command_line] > 0 && s[(long)plain_line] > 0)
    error("Mixture of preamble commands and music", !print);
}
コード例 #5
0
ファイル: prepmx.c プロジェクト: MiKTeX/miktex
Local void addChords(struct LOC_processLine *LINK)
{
  struct LOC_addChords V;
  Char w[256];
  short j = 1;
  short mus_line;
  paragraph_index0 chord_line;
  boolean arpeggio;
  Char STR1[256];
  short FORLIM;

  V.LINK = LINK;
  saveStatus(LINK->voice);
  getChordTies(LINK->voice, V.pitches, V.labels);
  *LINK->chords = '\0';
  chord_line = chordLineNo(LINK->voice);
  if (chord_line == 0)
    LINK->no_chords = true;
  if (LINK->no_chords)
    return;
  GetNextWord(w, P[chord_line-1], blank, dummy);
  sprintf(STR1, "%c", barsym);
  if (!strcmp(w, STR1) || *w == '\0')
    LINK->no_chords = true;
  sprintf(STR1, "%c", tilde);
  if (!strcmp(w, STR1) || LINK->no_chords)
    return;
  mus_line = line_no;
  line_no = orig_line_no[chord_line-1];
  arpeggio = (w[0] == '?');
  if (arpeggio) {
    strcpy(LINK->chords, " ?");
    predelete(w, 1);
  }
  *V.nt = '\0';
  while (j <= strlen(w)) {
    if (w[j-1] == '{' || strcmp(V.nt, "{") && w[j-1] >= 'a' && w[j-1] <= 'g')
      outChord(&V);
    else if (w[j-1] == chord_flat)
      w[j-1] = 'f';
    else if (w[j-1] == chord_left)
      w[j-1] = 'e';
    sprintf(V.nt + strlen(V.nt), "%c", w[j-1]);
    j++;
  }
  if (*V.nt != '\0')
    outChord(&V);
  if (arpeggio)
    strcat(LINK->chords, " ?");
  strcat(LINK->note, LINK->chords);
  FORLIM = strlen(V.labels);
  for (j = 0; j <= FORLIM - 1; j++) {
    if (V.labels[j] != ' ')
      error("Tie on chord note started but not finished", print);
  }
  line_no = mus_line;
}
コード例 #6
0
ファイル: utility.c プロジェクト: texlive/texlive-source
void trim(Char *s)
{
  short k;

  k = posNot(blank, s);
  if (k > 1)
    predelete(s, k - 1);
  else if (k == 0)
    *s = '\0';
}
コード例 #7
0
ファイル: mtx.c プロジェクト: clerkma/texlive-mobile
Local short identifyMacro(Char *s_, struct LOC_scanMusic *LINK)
{
  Char s[256];
  short k;

  strcpy(s, s_);
  predelete(s, 2);
  for (k = 1; k <= 20; k++) {
    if (!strcmp(s, macro_ID[k-1]))
      return k;
  }
  return 0;
}
コード例 #8
0
ファイル: prepmx.c プロジェクト: MiKTeX/miktex
Local void putPMXlines(struct LOC_musicParagraph *LINK)
{
  paragraph_index i, FORLIM;

  FORLIM = para_len;
  for (i = 0; i <= FORLIM - 1; i++) {
    if (startsWith(P[i], double_comment)) {
      predelete(P[i], 2);
      putLine(P[i]);
      strcpy(P[i], "%");
    }
  }
}
コード例 #9
0
ファイル: utility.c プロジェクト: texlive/texlive-source
boolean endsWith(Char *s1_, Char *s2)
{
  Char s1[256];
  short l1, l2;

  strcpy(s1, s1_);
  l1 = strlen(s1);
  l2 = strlen(s2);
  if (l1 < l2)
    return false;
  predelete(s1, l1 - l2);
  return (strcmp(s1, s2) == 0);
}
コード例 #10
0
ファイル: prepmx.c プロジェクト: MiKTeX/miktex
Local void processMBR(struct LOC_musicParagraph *LINK)
{
  short s, bars_of_rest;
  Char mbr[256];
  short FORLIM;
  Char STR1[256];
  Char STR3[256];

  strcpy(mbr, multi_bar_rest);
  predelete(mbr, 2);
  getNum(mbr, &bars_of_rest);
  bar_no += bars_of_rest;
  FORLIM = nstaves;
  for (s = 1; s <= FORLIM; s++) {
    if (pickup > 0)
      put(rests(STR1, pickup, meterdenom, visible), nospace);
    sprintf(STR3, "rm%s /", toString(STR1, bars_of_rest));
    putLine(STR3);
  }
  putLine("");
}
コード例 #11
0
ファイル: analyze.c プロジェクト: MiKTeX/miktex
Local void maybeChords(short i, struct LOC_paragraphSetup *LINK)
{
  if (!doChords())
    return;
  if (strlen(LINK->w) == 1 && *LINK->voice == 0 && pedanticWarnings())
    warning("Chord line above top voice should be labelled", print);
  if (strlen(LINK->w) == 1) {   /**  Standard chord line ------ */
    LINK->k = *LINK->voice;
    if (LINK->k == 0)
      LINK->k = 1;
    setChordLineNo(LINK->k, i);
    /**  Labelled chord line  ---- */
    return;
  }
  predelete(LINK->w, 1);
  LINK->k = findVoice(LINK->w);
  if (LINK->k == 0)
    error("Chord line belongs to unknown voice", print);
  else
    setChordLineNo(LINK->k, i);
}
コード例 #12
0
ファイル: utility.c プロジェクト: texlive/texlive-source
Char *GetNextWord(Char *Result, Char *s, Char Delim, Char Term)
{
  /* A delimiter is a character that separates words, but forms no part
     of them.  A terminator is a character that appears at the end of
     a word. */
  short n = 1;
  short start, last;

  last = strlen(s);
  while (n <= last && s[n-1] == Delim)
    n++;
  start = n;
  while (n <= last && s[n-1] != Term && s[n-1] != Delim)
    n++;
  if (n <= last && s[n-1] == Term)
    n++;
  substr_(Result, s, start, n - start);
  while (n <= last && s[n-1] == Delim)
    n++;
  predelete(s, n - 1);
  return Result;
}
コード例 #13
0
ファイル: analyze.c プロジェクト: MiKTeX/miktex
Local void maybeUptext(short i, struct LOC_paragraphSetup *LINK)
{
  if (!doUptext())
    return;
  if (strlen(LINK->w) == 1) {
    if (*LINK->voice == nvoices)
      warning("Uptext line below bottom voice should be labelled", print);
  }
  if (strlen(LINK->w) == 1) {   /**  Standard chord line ------ */
    LINK->k = *LINK->voice + 1;
    if (LINK->k > nvoices)
      LINK->k--;
    setUptextLineNo(LINK->k, i);
    /**  Labelled chord line  ---- */
    return;
  }
  predelete(LINK->w, 1);
  LINK->k = findVoice(LINK->w);
  if (LINK->k == 0)
    error("Uptext line belongs to unknown voice", print);
  else
    setUptextLineNo(LINK->k, i);
}
コード例 #14
0
ファイル: prepmx.c プロジェクト: MiKTeX/miktex
Local Char *processOther(Char *Result, Char *note_,
			 struct LOC_processLine *LINK)
{
  Char note[256];

  strcpy(note, note_);
  switch (thisNote(LINK->voice)) {

  case other:
    if (note[0] == grace_group) {
      if (strlen(note) == 1)
	LINK->ngrace = 1;
      else
	LINK->ngrace = pos1(note[1], digits);
      if (LINK->ngrace > 0)
	LINK->ngrace--;
    }
    break;

  /* For a zword, take note of pitch but do not change the contents */
  /* Add spurious duration because repitch expects duration to be present */
  case zword:
    strcpy(LINK->cutnote, note);
    predelete(LINK->cutnote, 1);
    insertChar('4', LINK->cutnote, 2);
    checkOctave(LINK->voice, LINK->cutnote);
    renewPitch(LINK->voice, LINK->cutnote);
    break;

  case lyrtag:
    extractLyrtag(LINK->voice, note);
    break;

  case rbrac:
    endBeam(LINK->voice);
    break;

  case rparen:
  case rlparen:
    endSlur(LINK->voice, note);
    break;

  case lbrac:
    beginBeam(LINK->voice, note);
    break;

  case lparen:
    maybeDotted(note, LINK);
    beginSlur(LINK->voice, note);
    break;

  case mword:
    error3(LINK->voice, "Meter change must be the first word of its bar");
    break;

  case atword:
    lyricsAdjust(LINK->voice, note);
    break;
  }
  return strcpy(Result, note);
}
コード例 #15
0
ファイル: analyze.c プロジェクト: MiKTeX/miktex
Local void analyzeParagraph(struct LOC_paragraphSetup *LINK)
{
  paragraph_index i, FORLIM;

  *LINK->voice = 0;
  bottom = 0;
  top = nvoices + 1;
  clearLabels();
  clearTags();
  clearUptext();
  FORLIM = para_len;
  for (i = 1; i <= FORLIM; i++)
  {   /* ----- Paragraph analysis main loop ----- */
    if (*P[i-1] != '\0' && P[i-1][0] != comment) {
      NextWord(LINK->w, P[i-1], blank, colon);
      line_no = orig_line_no[i-1];
      LINK->l = strlen(LINK->w);
      LINK->is_labelled = (LINK->w[LINK->l-1] == colon &&
			   LINK->w[LINK->l-2] != barsym);
      if (LINK->is_labelled) {
	strcpy(LINK->P_keep, P[i-1]);
	predelete(P[i-1], LINK->l);
	shorten(LINK->w, LINK->l - 1);
	LINK->k = findVoice(LINK->w);   /* First look for a voice label */
	if (LINK->k > 0) {
	  *LINK->voice = LINK->k;
	  setMusicLineNo(*LINK->voice, i);
	} else if (LINK->w[0] == 'L')
	  maybeLyrics(*LINK->voice, i, LINK->w);
	else if (LINK->w[0] == 'C')
	  maybeChords(i, LINK);
	else if (LINK->w[0] == 'U')
	  maybeUptext(i, LINK);
	else {
	  if (startsWithIgnoreCase(LINK->w, "SPACE")) {
	    setSpace(P[i-1]);
	    must_respace = true;
	  } else {
	    if (startsWithIgnoreCase(LINK->w, "VOICES")) {
	      selectVoices(P[i-1]);
	      must_restyle = true;
	    } else {
	      strcpy(P[i-1], LINK->P_keep);
	      LINK->is_labelled = false;
	      if (!isNoteOrRest(LINK->w)) {
		error("Unknown line label", print);
		/** ------------ Maybe Space command ------------ */
		/** ------------ Maybe Voices command ------------ */
		/** Could be sticky attribute **/
	      }
	    }
	  }
	}
      }
      if (!LINK->is_labelled) {
	(*LINK->voice)++;
	setMusicLineNo(*LINK->voice, i);
      }
      if (*LINK->voice > bottom)
	bottom = *LINK->voice;
      if (*LINK->voice > 0 && *LINK->voice < top)
	top = *LINK->voice;
    }
  }
}