⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 options.c

📁 占星术4.0源码
💻 C
📖 第 1 页 / 共 4 页
字号:
      SwapReal(&azialt[j], &azialt[j+1]);
      j--;
    }
  }

  /* Finally display the list showing each event and when it occurs. */

  for (i = 0; i < occurcount; i++) {
    SetSave(Mon, Day, Yea,
      DegToDec((real)time[i] / 60.0), Zon, Lon, Lat);
    j = DayOfWeek(Mon, Day, Yea);
    AnsiColor(rainbowansi[j + 1]);
    fprintf(S, "(%c%c%c) ", DAYNAM(j));
    AnsiColor(DEFAULT);
    s1 = time[i]/60;
    s2 = time[i]-s1*60;
    fprintf(S, "%s %s ", CharDate(Mon, Day, Yea, FALSE), CharTime(s1, s2));
    AnsiColor(objectansi[source[i]]);
    fprintf(S, "%7.7s ", objectname[source[i]]);
    AnsiColor(signansi(sign[i]));
    fprintf(S, "%c%c%c%c%c ",
      isret[i] > 0 ? '(' : (isret[i] < 0 ? '[' : '<'), SIGNAM(sign[i]),
      isret[i] > 0 ? ')' : (isret[i] < 0 ? ']' : '>'));
    AnsiColor(elemansi[type[i]-1]);
    if (type[i] == 1)
      fprintf(S, "rises  ");
    else if (type[i] == 2)
      fprintf(S, "zeniths");
    else if (type[i] == 3)
      fprintf(S, "sets   ");
    else
      fprintf(S, "nadirs ");
    AnsiColor(DEFAULT);
    fprintf(S, " at ");
    if (type[i] & 1) {
      j = (int) (FRACT(azialt[i])*60.0);
      fprintf(S, "%3d%c%02d'", (int) azialt[i], DEGR1, j);

      /* For rising and setting events, we'll also display a direction  */
      /* vector to make the 360 degree azimuth value thought of easier. */

      azi1 = cos(DTOR(azialt[i])); alt1 = sin(DTOR(azialt[i]));
      if (dabs(azi1) < dabs(alt1)) {
        azi2 = dabs(azi1 / alt1); alt2 = 1.0;
      } else {
        alt2 = dabs(alt1 / azi1); azi2 = 1.0;
      }
      fprintf(S, " (%.2f%c %.2f%c)",
        alt2, alt1 < 0.0 ? 's' : 'n', azi2, azi1 > 0.0 ? 'e' : 'w');
    } else
      PrintAltitude(azialt[i]);
    printl();
  }
}


/* Print out an ephemeris - the positions of the planets (at the time in the */
/* current chart) each day during a specified month, as done with the -E     */
/* switch. Display the ephemeris for the whole year if -Ey is in effect.     */

void DisplayEphemeris()
{
  int M0, M1, M2, daysiz, i, j, k, s, d, m;

  /* If -Ey is in effect, then loop through all months in the whole year. */

  if (exdisplay & DASHEy) {
    M1 = 1; M2 = 12;
  } else
    M1 = M2 = Mon;

  /* Loop through the month or months in question, printing each ephemeris. */

  for (M0 = M1; M0 <= M2; M0++) {
    daysiz = DayInMonth(M0, Yea);
    printf(eurodate ? "Dy/Mo/Yr" : "Mo/Dy/Yr");
    for (k = 0, j = 1; j <= total; j++) {
      if (!ignore[j] && IsThing(j)) {
        fprintf(S, "  %c%c%c%c ", OBJNAM(j), objectname[j][3] != 0 ?
          objectname[j][3] : ' ');
        k++;
        if (column80 && k >= 10)
          j = total;
      }
    }
    printl();
    for (i = 1; i <= daysiz; i++) {

      /* Loop through each day in the month, casting a chart for that day. */

      SetCore(M0, i, Yea, Tim, Zon, Lon, Lat);
      CastChart(TRUE);
      fprintf(S, "%s ", CharDate(M0, i, Yea, -1));
      for (k = 0, j = 1; j <= total; j++)
        if (!ignore[j] && IsThing(j)) {
          AnsiColor(objectansi[j]);
          s = ZTOS(planet[j]);
          d = (int) planet[j] - (s-1)*30;
          m = (int) (FRACT(planet[j])*60.0);
          fprintf(S, "%2d%s%02d%c", d, signabbrev[s], m,
            ret[j] >= 0.0 ? ' ' : '.');
          k++;
          if (column80 && k >= 10)
            j = total;
        }
      printl();
      AnsiColor(DEFAULT);
    }
    if (M0 < M2)
      printl();
  }
}


/* Display a calendar for the given month in the chart, as specified with  */
/* with the -K switch. When color is on, the title is white, weekends are  */
/* highlighted in red, and the specific day in the chart is colored green. */

void DisplayCalendarMonth()
{
  int i, j, k;

  AnsiColor(WHITE);
  PrintTab(' ', 16-StringLen(monthname[Mon]) >> 1);
  fprintf(S, "%s%5d\n", monthname[Mon], Yea);
  for (i = 0; i < 7; i++)
    fprintf(S, "%c%c%c", dayname[i][0], dayname[i][1], i < 6 ? ' ' : '\n');
  j = DayOfWeek(Mon, 1, Yea);
  AnsiColor(DEFAULT);
  for (i = 0; i < j; i++) {
    if (i == 0)
      AnsiColor(RED);
    fprintf(S, "-- ");
    if (i == 0)
      AnsiColor(DEFAULT);
  }
  k = DayInMonth(Mon, Yea);
  for (i = 1; i <= k; i++) {
    if (i == (int)Day)
      AnsiColor(GREEN);
    else if (j == 0 || j == 6)
      AnsiColor(RED);
    fprintf(S, "%2d", i);
    if (j == 0 || j == 6 || i == Day)
      AnsiColor(DEFAULT);
    if (j < 6) {
      j++;
      printc(' ');
    } else {
      j = 0;
      printl();
    }
  }
  while (j > 0 && j < 7) {
    if (j == 6)
      AnsiColor(RED);
    j++;
    fprintf(S, "--%c", j < 7 ? ' ' : '\n');
  }
  AnsiColor(DEFAULT);
}


/* Display a calendar for the entire year given in the chart, as specified */
/* with the -Ky switch. This is just like twelve of the individual month   */
/* calendars above displayed together, with same color highlights and all. */

void DisplayCalendarYear()
{
  int r, w, c, m, d, dy, p[3], l[3], n[3];

  dy = DayOfWeek(1, 1, Yea);
  for (r = 0; r < 4; r++) {    /* Loop over one set of three months */
    AnsiColor(WHITE);
    for (c = 0; c < 3; c++) {
      m = r*3+c+1;
      PrintTab(' ', 16-StringLen(monthname[m]) >> 1);
      fprintf(S, "%s%5d", monthname[m], Yea);
      if (c < 2)
        PrintTab(' ', 20 + MONTHSPACE -
          (16-StringLen(monthname[m]) >> 1) - StringLen(monthname[m]) - 5);
    }
    printl();
    for (c = 0; c < 3; c++) {
      for (d = 0; d < 7; d++)
        fprintf(S, "%c%c%c", dayname[d][0], dayname[d][1],
          d < 6 || c < 2 ? ' ' : '\n');
      if (c < 2)
        PrintTab(' ', MONTHSPACE-1);
      m = r*3+c+1;
      p[c] = dy % 7;
      l[c] = DayInMonth(m, Yea);
      n[c] = 0;
      dy += l[c];
    }
    for (w = 0; w < 6; w++) {      /* Loop over one set of week rows */
      for (c = 0; c < 3; c++) {    /* Loop over one week in a month  */
        m = r*3+c+1;
        d = 0;
        if (w == 0)
          while (d < p[c]) {
            if (d == 0)
              AnsiColor(RED);
            fprintf(S, "-- ");
            if (d == 0)
              AnsiColor(DEFAULT);
            d++;
          }
        AnsiColor(DEFAULT);
        while (d < 7 && n[c] < l[c]) {
          n[c]++;
          if (n[c] == Day && m == Mon)
            AnsiColor(GREEN);
          else if (d == 0 || d == 6)
            AnsiColor(RED);
          fprintf(S, "%2d%c", n[c], d < 6 || c < 2 ? ' ' : '\n');
          if (d == 0 || d == 6 || (n[c] == Day && m == Mon))
            AnsiColor(DEFAULT);
          d++;
        }
        while (d < 7) {
          if (d == 0 || d == 6)
            AnsiColor(RED);
          fprintf(S, "--%c", d < 6 || c < 2 ? ' ' : '\n');
          if (d == 0)
            AnsiColor(DEFAULT);
          d++;
        }
        if (c < 2)
          PrintTab(' ', MONTHSPACE-1);
      }
    }
    if (r < 3)
      printl();
  }
  AnsiColor(DEFAULT);
}


/* Display either a biorhythm chart or the time difference in various units */
/* between two charts, i.e. two types of relationship "charts" that aren't  */
/* related in any way to planetary positions, as specified by either the    */
/* -rb or -rd switches, respectively.                                       */

void DisplayRelation()
{
#ifdef BIORHYTHM
  int i, j;
  real k, l;
#endif

  /* If we are calculating the difference between two dates, then display */
  /* the value and return, as with the -rd switch.                        */

  if (relation == DASHrd) {
    fprintf(S, "Differences between the dates in the two charts:\n");
    AnsiColor(rainbowansi[1]); fprintf(S, "Years  : %.0f\n", JD/365.25);
    AnsiColor(rainbowansi[2]); fprintf(S, "Months : %.0f\n", JD/(365.25/12));
    AnsiColor(rainbowansi[3]); fprintf(S, "Weeks  : %.0f\n", JD/7.0);
    AnsiColor(rainbowansi[4]); fprintf(S, "Days   : %.0f\n", JD);
    AnsiColor(rainbowansi[5]); fprintf(S, "Hours  : %.0f\n", JD*24.0);
    AnsiColor(rainbowansi[6]); fprintf(S, "Minutes: %.0f\n", JD*24.0*60.0);
    AnsiColor(rainbowansi[7]); fprintf(S, "Seconds: %.0f\n", JD*24.0*3600.0);
    AnsiColor(DEFAULT);
    return;
  }

#ifdef BIORHYTHM
  /* If we are doing a biorhythm (-rb switch), then we'll calculate it for */
  /* someone born on the older date, at the time of the younger date. Loop */
  /* through the week preceeding and following the date in question.       */

  JD = floor(JD + ROUND);
  for (JD -= 7.0, i = -7; i <= 7; i++, JD += 1.0) {
    if (i == 0)
      AnsiColor(WHITE);
    else if (i == 1)
      AnsiColor(DEFAULT);
    fprintf(S, "T%c%d Day%c:",
      i < 0 ? '-' : '+', abs(i), abs(i) != 1 ? 's' : ' ');
    for (j = 1; j <= 3; j++) {
      printc(' ');
      switch (j) {
      case 1: k = _PHY; AnsiColor(RED);   fprintf(S, "Physical");     break;
      case 2: k = _EMO; AnsiColor(BLUE);  fprintf(S, "Emotional");    break;
      case 3: k = _INT; AnsiColor(GREEN); fprintf(S, "Intellectual"); break;
      }
      AnsiColor(i ? DEFAULT : WHITE);

      /* The biorhythm calculation is below. */

      l = Biorhythm(JD, k);
      fprintf(S, " at %c%3.0f%%", l < 0.0 ? '-' : '+', dabs(l));

      /* Print smiley face, medium face, or sad face based on current cycle. */

      AnsiColor(PURPLE);
      fprintf(S, " :%c", l > 50.0 ? ')' : (l < -50.0 ? '(' : '|'));
      AnsiColor(i ? DEFAULT : WHITE);
      if (j < 3)
        printc(',');
    }
    printl();
  }
#endif /* BIORHYTHM */
}


/* Another important procedure: Display any of the types of (text) charts    */
/* that the user specified they wanted, by calling the appropriate routines. */

void PrintChart(prog)
{
  if (todisplay == 0)          /* Assume the -v chart if user */
    todisplay |= DASHv;        /* didn't indicate anything.   */
  if (todisplay & DASHv) {
    if (relation < DASHrd)
      ChartLocation();
    else

      /* If the -rb or -rd relationship charts are in effect, then instead  */
      /* of doing the standard -v chart, print either of these chart types. */

      DisplayRelation();
    if (todisplay - (todisplay & DASHv*2-1))
      printl2();
  }
  if (todisplay & DASHw) {
    ChartWheel();
    if (todisplay - (todisplay & DASHw*2-1))
      printl2();
  }
  if (todisplay & DASHg) {
    if (relation > DASHr0) {
      CreateGrid(FALSE);
      ChartGrid();
      if (exdisplay & DASHg0) {    /* If -g0 switch in effect, then  */
        printl();                  /* display aspect configurations. */
        DisplayGrands();
      }
    } else {

      /* Do a relationship aspect grid between two charts if -r0 in effect. */

      CreateGridRelation((exdisplay & DASHg0) > 0);
      DisplayGridRelation();
    }
    if (todisplay - (todisplay & DASHg*2-1))
      printl2();
  }
  if (todisplay & DASHm) {
    if (!(todisplay & DASHg) || relation <= DASHr0)
      CreateGrid(FALSE);
    if (relation > DASHr0) {
      if (exdisplay & DASHm0)
        ChartAspect();
      else
        ChartMidpoint();
      if (todisplay - (todisplay & DASHm*2-1))
        printl2();
    } else {
      CreateGridRelation((exdisplay & DASHm0) == 0);
      if (exdisplay & DASHm0)
        DisplayAspectRelation();
      else
        DisplayMidpointRelation();
    }
  }
  if (todisplay & DASHZ) {
    if (exdisplay & DASHZd)
      DisplayInDayHorizon();
    else
      ChartHorizon();
    if (todisplay - (todisplay & DASHZ*2-1))
      printl2();
  }
  if (todisplay & DASHS) {
    ChartSpace();
    if (todisplay - (todisplay & DASHS*2-1))
      printl2();
  }
  if (todisplay & DASHj) {
    ChartInfluence();
    if (todisplay - (todisplay & DASHj*2-1))
      printl2();
  }
  if (todisplay & DASHL) {
    ChartAstroGraph();
    if (todisplay - (todisplay & DASHL*2-1))
      printl2();
  }
  if (todisplay & DASHK) {
    if (exdisplay & DASHKy)
      DisplayCalendarYear();
    else
      DisplayCalendarMonth();
    if (todisplay - (todisplay & DASHK*2-1))
      printl2();
  }
  if (todisplay & DASHd) {
    DisplayInDaySearch(prog);
    if (todisplay - (todisplay & DASHd*2-1))
      printl2();
  }
  if (todisplay & DASHD) {
    DisplayInDayInfluence();
    if (todisplay - (todisplay & DASHD*2-1))
      printl2();
  }
  if (todisplay & DASHE) {
    DisplayEphemeris();
    if (todisplay - (todisplay & DASHE*2-1))
      printl2();
  }
  if (todisplay & DASHt) {
    DisplayTransitSearch(prog);
    if (todisplay - (todisplay & DASHt*2-1))
      printl2();
  }
  if (todisplay & DASHT)
    DisplayTransitInfluence(prog);
}

/* options.c */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -