Skip to content

Commit

Permalink
rid register
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulBoersma committed Aug 5, 2018
1 parent 50670b9 commit 4f5ff55
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 67 deletions.
6 changes: 3 additions & 3 deletions LPC/Sound_and_LPC_robust.cpp
Expand Up @@ -229,9 +229,9 @@ autoLPC LPC_Sound_to_LPC_robust (LPC thee, Sound me, double analysisWidth, doubl

iter += struct_huber.iter;

if ( (i % 10) == 1) {
Melder_progress ((double) i / numberOfFrames, U"LPC analysis of frame ", i, U" out of ", numberOfFrames, U".");
}
if (i % 10 == 1)
Melder_progress ((double) i / numberOfFrames,
U"LPC analysis of frame ", i, U" out of ", numberOfFrames, U".");
}

if (frameErrorCount) Melder_warning (U"Results of ", frameErrorCount,
Expand Down
3 changes: 2 additions & 1 deletion artsynth/Art_Speaker.cpp
Expand Up @@ -82,7 +82,8 @@ void Art_Speaker_toVocalTract (Art _art, Speaker speaker,

/* Tongue root. */

jaw.x = -75.0 * f, jaw.y = 53.0 * f; // position of the condyle
jaw.x = -75.0 * f; // position of the condyle
jaw.y = 53.0 * f;
jaw.da = art [(int) kArt_muscle::MASSETER] * 0.15
- art [(int) kArt_muscle::MYLOHYOID] * 0.20;
body.x = jaw.x + 81.0 * f * cos (-0.60 + jaw.da)
Expand Down
10 changes: 7 additions & 3 deletions artsynth/Art_Speaker_Delta.cpp
Expand Up @@ -22,7 +22,7 @@
void Art_Speaker_intoDelta (Art art, Speaker speaker, Delta delta)
{
double f = speaker -> relativeSize * 1e-3;
double xe [30], ye [30], xi [30], yi [30], xmm [30], ymm [30], dx, dy;
double xe [30], ye [30], xi [30], yi [30], xmm [30], ymm [30];

/* Lungs. */

Expand Down Expand Up @@ -64,8 +64,12 @@ void Art_Speaker_intoDelta (Art art, Speaker speaker, Delta delta)
for (integer itube = 38; itube <= 64; itube ++) {
Delta_Tube t = delta -> tube + itube;
integer i = itube - 37;
t -> Dxeq = sqrt (( dx = xmm [i] - xmm [i + 1], dx * dx ) + ( dy = ymm [i] - ymm [i + 1], dy * dy ));
t -> Dyeq = sqrt (( dx = xe [i] - xi [i], dx * dx ) + ( dy = ye [i] - yi [i], dy * dy ));
double dx = xmm [i] - xmm [i + 1];
double dy = ymm [i] - ymm [i + 1];
t -> Dxeq = sqrt (dx * dx + dy * dy);
dx = xe [i] - xi [i];
dy = ye [i] - yi [i];
t -> Dyeq = sqrt (dx * dx + dy * dy);
if (closed [i]) t -> Dyeq = - t -> Dyeq;
}
delta -> tube [65]. Dxeq = delta -> tube [51]. Dxeq = delta -> tube [50]. Dxeq;
Expand Down
6 changes: 3 additions & 3 deletions dwsys/NUMf2c.cpp
Expand Up @@ -98,7 +98,7 @@ void s_cat (char *lp, const char *rpp[], integer rnp[], integer *np, integer ll)

/* compare two strings */
integer s_cmp (const char *a0, const char *b0, integer la, integer lb) {
register unsigned char *a, *aend, *b, *bend;
unsigned char *a, *aend, *b, *bend;
a = (unsigned char *) a0;
b = (unsigned char *) b0;
aend = a + la;
Expand Down Expand Up @@ -139,8 +139,8 @@ integer s_cmp (const char *a0, const char *b0, integer la, integer lb) {
return (0);
}

void s_copy (register char *a, register char *b, integer la, integer lb) {
register char *aend, *bend;
void s_copy (char *a, register char *b, integer la, integer lb) {
char *aend, *bend;

aend = a + la;

Expand Down
3 changes: 2 additions & 1 deletion fon/FunctionEditor.cpp
Expand Up @@ -1574,7 +1574,8 @@ void FunctionEditor_drawRangeMark (FunctionEditor me, double yWC, conststring32
Graphics_setColour (my graphics.get(), Graphics_BLUE);
Graphics_line (my graphics.get(), my endWindow, yWC, my endWindow + textWidth, yWC);
Graphics_setTextAlignment (my graphics.get(), Graphics_LEFT, verticalAlignment);
if (verticalAlignment == Graphics_BOTTOM) yWC -= Graphics_dyMMtoWC (my graphics.get(), 0.5);
if (verticalAlignment == Graphics_BOTTOM)
yWC -= Graphics_dyMMtoWC (my graphics.get(), 0.5);
Graphics_text (my graphics.get(), my endWindow, yWC, text.string);
}

Expand Down
23 changes: 16 additions & 7 deletions fon/ManipulationEditor.cpp
Expand Up @@ -978,9 +978,12 @@ static bool clickPitch (ManipulationEditor me, double xWC, double yWC, bool shif
Graphics_getMouseLocation (my graphics.get(), & xWC_new, & yWC_new);
if (xWC_new != xWC || yWC_new != yWC) {
drawWhileDragging (me, xWC, yWC, ifirstSelected, ilastSelected, dt, df);
if (dragHorizontal) dt += xWC_new - xWC;
if (dragVertical) df += yWC_new - yWC;
xWC = xWC_new, yWC = yWC_new;
if (dragHorizontal)
dt += xWC_new - xWC;
if (dragVertical)
df += yWC_new - yWC;
xWC = xWC_new;
yWC = yWC_new;
drawWhileDragging (me, xWC, yWC, ifirstSelected, ilastSelected, dt, df);
}
}
Expand All @@ -989,7 +992,8 @@ static bool clickPitch (ManipulationEditor me, double xWC, double yWC, bool shif
/*
* Dragged inside window?
*/
if (xWC < my startWindow || xWC > my endWindow) return 1;
if (xWC < my startWindow || xWC > my endWindow)
return 1;

/*
* Points not dragged past neighbours?
Expand All @@ -1012,15 +1016,20 @@ static bool clickPitch (ManipulationEditor me, double xWC, double yWC, bool shif
RealPoint point = pitch -> points.at [i];
point -> number += dt;
point -> value = YLININV (YLIN (point -> value) + df);
if (point -> value < 50.0) point -> value = 50.0;
if (point -> value > YLININV (my p_pitch_maximum)) point -> value = YLININV (my p_pitch_maximum);
if (point -> value < 50.0)
point -> value = 50.0;
if (point -> value > YLININV (my p_pitch_maximum))
point -> value = YLININV (my p_pitch_maximum);
}

/*
* Make sure that the same pitch points are still selected (a problem with Undo...).
*/

if (draggingSelection) my startSelection += dt, my endSelection += dt;
if (draggingSelection) {
my startSelection += dt;
my endSelection += dt;
}
if (my startSelection == my endSelection) {
RealPoint point = pitch -> points.at [ifirstSelected];
my startSelection = my endSelection = point -> number;
Expand Down
6 changes: 3 additions & 3 deletions generate/Unicode/UCD_features_generated_h.praat
@@ -1,5 +1,5 @@
# UCD_features_generated_h.praat
# Paul Boersma 20180411
# Paul Boersma 20180805

Text writing preferences: "UTF-8"

Expand All @@ -8,7 +8,7 @@ numberOfRows = Get number of rows

stopwatch
outfile$ = "../../kar/UCD_features_generated.h"
writeFileLine: outfile$, "/* This file was generated automatically by generate/Unicode/UCS_features_generated_h.praat */"
writeFileLine: outfile$, "/* This file was generated automatically by generate/Unicode/UCD_features_generated_h.praat */"

previousLineCodePoint = -1
for irow from 1 to numberOfRows
Expand Down Expand Up @@ -137,7 +137,7 @@ for irow from 1 to numberOfRows
categoryFeature$ += " | mUCD_NULL"
elsif lineCodePoint = 9 ; tab
categoryFeature$ += " | mUCD_BREAKING_SPACE"
elsif lineCodePoint >= 10 and lineCodePoint <= 13 or lineCodePoint = 0x0085 ; line feed, vertical tab, form feed, carriage return, next line
elsif (lineCodePoint >= 10 and lineCodePoint <= 13) or lineCodePoint = 0x0085 ; line feed, vertical tab, form feed, carriage return, next line
categoryFeature$ += " | mUCD_LINE_SEPARATOR"
endif
elsif minorCategoryCode$ = "f"
Expand Down
2 changes: 1 addition & 1 deletion kar/UCD_features_generated.h
@@ -1,4 +1,4 @@
/* This file was generated automatically by generate/Unicode/UCS_features_generated_h.praat */
/* This file was generated automatically by generate/Unicode/UCD_features_generated_h.praat */
/* 0000 <control> (NULL) */
{ mUCD_CONTROL | mUCD_NULL, 0x0000, 0x0000, 0x0000, '\0', '\0' },
/* 0001 <control> (START OF HEADING) */
Expand Down
43 changes: 26 additions & 17 deletions num/NUMarrays.cpp
Expand Up @@ -26,15 +26,19 @@ integer NUM_getTotalNumberOfArrays () { return theTotalNumberOfArrays; }

byte * NUMvector_generic (integer elementSize, integer lo, integer hi, bool initializeToZero) {
try {
if (hi < lo) return nullptr; // not an error
const int64 numberOfCells = hi - lo + 1;
if (numberOfCells <= 0)
return nullptr; // not an error
byte *result;
Melder_assert (sizeof (char) == 1); // some say that this is true by definition
for (;;) { // not very infinite: 99.999 % of the time once, 0.001 % twice
result = initializeToZero ?
reinterpret_cast<byte*> (_Melder_calloc (hi - lo + 1, elementSize)) :
reinterpret_cast<byte*> (_Melder_malloc ((hi - lo + 1) * elementSize));
if (result -= lo * elementSize) break; // this will normally succeed at the first try
(void) Melder_realloc_f (result + lo * elementSize, 1); // make "sure" that the second try will succeed (not *very* sure, because realloc might move memory even if it shrinks)
reinterpret_cast <byte *> (_Melder_calloc (numberOfCells, elementSize)) :
reinterpret_cast <byte *> (_Melder_malloc (numberOfCells * elementSize));
const int64 offset = (int64) lo * elementSize;
result -= offset;
if (result != nullptr) // it would be quite a coincidence if this failed
break; // this will normally succeed at the first try
(void) Melder_realloc_f (result + offset, 1); // make "sure" that the second try will succeed (not *very* sure, because realloc might move memory even if it shrinks)
}
theTotalNumberOfArrays += 1;
return result;
Expand All @@ -44,15 +48,17 @@ byte * NUMvector_generic (integer elementSize, integer lo, integer hi, bool init
}

void NUMvector_free_generic (integer elementSize, byte *vector, integer lo) noexcept {
if (! vector) return; // no error
if (! vector)
return; // not an error
byte *cells = & vector [lo * elementSize];
Melder_free (cells);
theTotalNumberOfArrays -= 1;
}

byte * NUMvector_copy_generic (integer elementSize, byte *vector, integer lo, integer hi) {
try {
if (! vector) return nullptr;
if (! vector)
return nullptr;
byte *result = NUMvector_generic (elementSize, lo, hi, false);
byte *p_cells = & vector [lo * elementSize];
byte *p_resultCells = & result [lo * elementSize];
Expand Down Expand Up @@ -90,7 +96,8 @@ void NUMvector_append_generic (integer elementSize, byte **v, integer lo, intege
integer offset = lo * elementSize;
for (;;) { // not very infinite: 99.999 % of the time once, 0.001 % twice
result = reinterpret_cast <byte *> (Melder_realloc ((char *) *v + offset, (*hi - lo + 2) * elementSize));
if ((result -= offset) != nullptr) break; // this will normally succeed at the first try
if ((result -= offset) != nullptr) // it would be quite a coincidence if this failed
break; // this will normally succeed at the first try
(void) Melder_realloc_f (result + offset, 1); // make "sure" that the second try will succeed
}
(*hi) ++;
Expand Down Expand Up @@ -126,7 +133,7 @@ void NUMvector_insert_generic (integer elementSize, byte **v, integer lo, intege

/*** Generic memory functions for matrices. ***/

void * NUMmatrix (integer elementSize, integer row1, integer row2, integer col1, integer col2, bool initializeToZero) {
void * NUMmatrix_generic (integer elementSize, integer row1, integer row2, integer col1, integer col2, bool initializeToZero) {
try {
const int64 numberOfRows = row2 - row1 + 1;
const int64 numberOfColumns = col2 - col1 + 1;
Expand All @@ -138,7 +145,8 @@ void * NUMmatrix (integer elementSize, integer row1, integer row2, integer col1,
const int64 sizeOfRoomForRows = numberOfRows * pointerSize;
roomForRows = reinterpret_cast <byte **> (_Melder_malloc (sizeOfRoomForRows));
result = roomForRows - row1;
if (result) break; // this will normally succeed at the first try
if (result != nullptr) // it would be quite a coincidence if this failed
break; // this will normally succeed at the first try
(void) Melder_realloc_f (roomForRows, 1); // make "sure" that the second try will succeed (if this is an in-place realloc)
}
try {
Expand Down Expand Up @@ -182,7 +190,8 @@ byte *** NUMtensor3_generic (integer elementSize, integer pla1, integer pla2, in
for (;;) {
planes = reinterpret_cast <byte ***> (_Melder_malloc (numberOfPlanes * (int64) sizeof (byte **))); // assume that all pointers have the same size
result = planes - pla1;
if (result) break; // this will normally succeed at the first try
if (result != nullptr) // it would be quite a coincidence if this failed
break;
(void) Melder_realloc_f (planes, 1); // make "sure" that the second try will succeed
}
/*
Expand Down Expand Up @@ -226,7 +235,7 @@ byte *** NUMtensor3_generic (integer elementSize, integer pla1, integer pla2, in
}
}

void NUMmatrix_free_ (integer elementSize, byte **m, integer row1, integer col1) noexcept {
void NUMmatrix_free_generic (integer elementSize, byte **m, integer row1, integer col1) noexcept {
if (! m) return;
byte *cells = & m [row1] [col1 * elementSize];
Melder_free (cells);
Expand All @@ -246,10 +255,10 @@ void NUMtensor3_free_generic (integer elementSize, byte ***t, integer pla1, inte
theTotalNumberOfArrays -= 1;
}

void * NUMmatrix_copy (integer elementSize, void *m, integer row1, integer row2, integer col1, integer col2) {
void * NUMmatrix_copy_generic (integer elementSize, void *m, integer row1, integer row2, integer col1, integer col2) {
try {
if (! m) return nullptr;
char **result = reinterpret_cast <char **> (NUMmatrix (elementSize, row1, row2, col1, col2, false));
char **result = reinterpret_cast <char **> (NUMmatrix_generic (elementSize, row1, row2, col1, col2, false));
if (! result) return nullptr;
integer columnOffset = col1 * elementSize;
integer dataSize = (row2 - row1 + 1) * (col2 - col1 + 1) * elementSize;
Expand All @@ -260,14 +269,14 @@ void * NUMmatrix_copy (integer elementSize, void *m, integer row1, integer row2,
}
}

void NUMmatrix_copyElements_ (integer elementSize, char **mfrom, char **mto, integer row1, integer row2, integer col1, integer col2) {
void NUMmatrix_copyElements_generic (integer elementSize, char **mfrom, char **mto, integer row1, integer row2, integer col1, integer col2) {
Melder_assert (mfrom && mto);
integer columnOffset = col1 * elementSize;
integer dataSize = (row2 - row1 + 1) * (col2 - col1 + 1) * elementSize;
memcpy (mto [row1] + columnOffset, mfrom [row1] + columnOffset, (size_t) dataSize);
}

bool NUMmatrix_equal (integer elementSize, void *m1, void *m2, integer row1, integer row2, integer col1, integer col2) {
bool NUMmatrix_equal_generic (integer elementSize, void *m1, void *m2, integer row1, integer row2, integer col1, integer col2) {
Melder_assert (m1 && m2);
integer columnOffset = col1 * elementSize;
integer dataSize = (row2 - row1 + 1) * (col2 - col1 + 1) * elementSize;
Expand Down

0 comments on commit 4f5ff55

Please sign in to comment.