Skip to content

Conversation

felipesanches
Copy link
Contributor

No description provided.

@cuavas
Copy link
Member

cuavas commented May 16, 2015

The header changes are OK but the changes to the source are dubious at best. Also please stop mixing tab and space indentation.

@felipesanches
Copy link
Contributor Author

The enumeration fix results in the replicator1 driver printing the unimplemented warning thousands of times. The patch provided here makes sure that the unimplemented warning shows up, but only once.

Also, it disables other timer #5 related log messages, since these are there only for debugging purposes and should not be enabled by default.

@felipesanches
Copy link
Contributor Author

what does MAME use as a default for indentation: tabs or spaces? If it is spaces, then how many spaces per indentation level?

@balr0g
Copy link
Contributor

balr0g commented May 16, 2015

I'm not sure if there are particular guidelines but generally MAME code is periodically run through srcclean (one of the tools built with make TOOLS=1), which cleans up spaces/tabs and such.
It probably would be worthwhile to write up a document describing what srcclean does.

@felipesanches
Copy link
Contributor Author

it would be really good to specify a default tab/spaces style for everybody to use always. Letting scripts cleanup the whole codebase will probably messup with git blame, for instance. I'd rather preffer to setup my code editor with one good setting and make sure none of my commits mess up with indentation any more.

@cuavas
Copy link
Member

cuavas commented May 16, 2015

MAME code generally uses tabs for initial indents only and spacing for other alignment. View the code with four spaces per tab if you want to see it aligned properly. You can work this out by opening pretty much any driver source file.
Disabling the logging for timer 5 by default (changing the #define to 0 rather than 1) may be acceptable, but using a static variable to suppress logging like that is most definitely unacceptable. The solution is to implement the missing modes. Otherwise leave it as is.

@felipesanches
Copy link
Contributor Author

I'm curious to understand the rationale behind the idea of it being considered "most definitely unacceptable" to you. What are the bad consequences of it? Isn't it actually doing what it is designed to do? What are the drawbacks that make it so bad in your eyes?

I'm just asking because it sounds a bit harsh when someone calls something unnaceptable, so I'd expect to learn more about your reasoning. After all... it is just a simple "unimplemented" log message. Can't be that harmfull at all... :-)

@balr0g
Copy link
Contributor

balr0g commented May 17, 2015

@cuavas: IMHO the very basic, most important things about source code formatting (such as that) should be in the top-level readme, in a section labeled "Contributing". I'm not sure what they are or I'd add them.

@felipesanches: other than it being rather ugly (at least to me), I'm not sure. That missing mode probably should be implemented, but I'll let @cuavas answer your question.

@etabeta78
Copy link
Contributor

On Sun, May 17, 2015 at 1:19 AM, Felipe Corrêa da Silva Sanches <
notifications@github.com> wrote:

I'm curious to understand the rationale behind the idea of it being
considered "most definitely unacceptable" to you. What are the bad
consequences of it? Isn't it actually doing what it is designed to do? What
are the drawbacks that make it so bad in your eyes?

it's not bad in his eyes, it's against the direction MAME and MESS have
been moving in the past 4 years.
if you go back looking to the core changes made when adding the driver
states first, and the driver classes later (when passing to C++), and the
device-ification of various components, you will see that we have kept
removing static variables in favor of class variables.
the reason is that we aim to reach the point of being able to run multiple
MAME sessions on a single machine (e.g. to connect two arcade cabinet or
two consoles) and static variables risk to make this kind of scenario
unreliable.

@cuavas
Copy link
Member

cuavas commented May 17, 2015

I don't see what you're problem with the word "unacceptable" is. The code will not be accepted by MAMEdev in its current form -- it is by definition "unacceptable". This is basic English. If you expect everyone to go out of my way not to say anything negative, you’re coming to the wrong place. It's my job to ensure contributions don't lower standards; ensuring fragile egos aren't bruised is not my job.

First of all, if you're thinking of using a function static variable, you're probably doing it wrong. It introduces inaccessible state within a function. It won't handle multiple instances, and it won't even handle multiple runs within the same process.

But putting that aside, you've completely changed what the statement does. The statement is there to log each time the software tries to use an unimplemented timer mode, and what the mode is each time. You've changed it to only log the first unimplemented timer mode used. That's far less useful as with your change one can no longer take the output, pass it through a text filter and get a list of all unimplemented timer modes used by a system. Your change doesn't bring the code any closer to a working state, and just attempts to put brokenness out of sight and out of mind. It doesn't help in any way. It might be OK to change it from a printf to osd_printf_error, but simply suppressing it like that is not a useful change, even ignoring the unacceptable implementation.

If you don't want to cooperate, I'll just close this pull request. It's less work for me than writing long-winded explanations, anyway.

@felipesanches
Copy link
Contributor Author

Thanks for providing a clearer reasoning. I think it makes sense and I can (and will) adapt the code in this pull request accordingly.

More specifically, the consideration presented by @etabeta78 was something I wasn't aware of yet.

Finally, I'd like to make it clear that I want indeed to collaborate. My only concern was that it was not clear exactly what the criticism was. Now I understand it. Thanks.

* minor fix to indentation levels
* propper handling of error logging
@felipesanches felipesanches force-pushed the fix_enumeration_of_avr8_registers branch from d8920f5 to 90fed9e Compare May 17, 2015 20:21
@felipesanches
Copy link
Contributor Author

I've just updated the commit, removing the static variable.
I also took the opportunity to fix the indentation levels in that area of the code.

Please review and merge if considered appropriate.

cheers,
Felipe

@cuavas
Copy link
Member

cuavas commented May 17, 2015

The changes to indentation are not good:

  • You are using mixed spaces and tabs for indentation - initial indent should just use tabs.
  • Case labels by themselves do not introduce a scope level and therefore shouldn't cause indentation.

Switch statements should look like this:

switch (expr)
{
case val1:
case val2:
    unscoped;
    break;
case val3:
    {
        scoped;
    }
    break;
}

The switch statement itself and the compound statement inside it introduce scope. Case labels by themselves do not.

@balr0g
Copy link
Contributor

balr0g commented May 17, 2015

@cuavas has updated the README to mention indentation standards (which should make it easier for contributors). Generally it's best to not muck too much with indentation; I usually do a git diff after making changes to ensure this is the case.

As for this? I'd just do the register enumeration and that's all.

@felipesanches
Copy link
Contributor Author

I have just updated the commit to include exclusivelly the registers indexing fixes and the minor handling of debug messaging to avoid flooding the terminal. Log messages will only show up if a developer turn it on by setting the appropriate logging #define.

All fixes to broken indentation were now intentionally left aside, so that we can move on to merge this tiny avr8 bugfix.

@felipesanches
Copy link
Contributor Author

Nevermind... I just noticed that the registers fixes were already merged into master. The log flood issue still remains, though. So I opened a new pull request specifically for that:

#186

@cuavas
Copy link
Member

cuavas commented May 18, 2015

You'll be credited with the register fixes.

@felipesanches
Copy link
Contributor Author

Thanks :-)
Sorry if I perhaps ended up sounding a bit harsh/arrogant in this thread. It was not my intention and I appologize.

Happy hacking!

ICEknigh7 added a commit to ICEknigh7/mame that referenced this pull request Jun 8, 2022
- Balalín (type-in, MicroHobby mamedev#125) [Ignacio Prini]
- Magnus Zone (type-in, MicroHobby mamedev#126) [Ignacio Prini]
- Oráculo Egipcio (type-in, MicroHobby mamedev#127) [Ignacio Prini]
- Demolition (type-in, MicroHobby mamedev#128) [Ignacio Prini]
- Basket Trainer (type-in, MicroHobby mamedev#129) [Ignacio Prini]
- Galaxy Fun (type-in, MicroHobby mamedev#130) [Ignacio Prini]
- Micro Draw (type-in, MicroHobby mamedev#131, mamedev#132) [Ignacio Prini]
- El Alambrista (type-in, MicroHobby mamedev#133) [Ignacio Prini]
- Ranamirez (type-in, MicroHobby mamedev#134) [Ignacio Prini]
- Fórmula Suicida (type-in, MicroHobby mamedev#135) [Ignacio Prini]
- Phantasmas (type-in, MicroHobby mamedev#136) [Ignacio Prini]
- Dardos (type-in, MicroHobby mamedev#137) [Ignacio Prini]
- S.E.M.I.S.I.S. (type-in, MicroHobby mamedev#138, mamedev#139) [Ignacio Prini]
- Alley's Gun (type-in, MicroHobby mamedev#140) [Ignacio Prini]
- Kleingeld (type-in, MicroHobby mamedev#141, mamedev#142) [Ignacio Prini]
- Caribe’s Day (type-in, MicroHobby mamedev#143) [Ignacio Prini]
- Rally (type-in, MicroHobby mamedev#144) [Ignacio Prini]
- La Profecía (type-in, MicroHobby mamedev#145) [Ignacio Prini]
- Mine Alert (type-in, MicroHobby mamedev#146, mamedev#147) [Ignacio Prini]
- Freddy (type-in, MicroHobby mamedev#148) [Ignacio Prini]
- Russian's Attack (type-in, MicroHobby mamedev#149, mamedev#150) [Ignacio Prini]
- En Ruta (type-in, MicroHobby mamedev#151) [Ignacio Prini]
- Zinco (type-in, MicroHobby mamedev#152) [Ignacio Prini]
- Ruffo’s Dream (type-in, MicroHobby mamedev#153) [Ignacio Prini]
- Crozet (type-in, MicroHobby mamedev#154) [Ignacio Prini]
- Rock Animation (type-in, MicroHobby mamedev#155) [Ignacio Prini]
- Bunker (type-in, MicroHobby mamedev#156) [Ignacio Prini]
- Telepuzzle (type-in, MicroHobby mamedev#157) [Ignacio Prini]
- Golfo Pérsico (type-in, MicroHobby mamedev#158) [Ignacio Prini]
- Mad Drivers (type-in, MicroHobby mamedev#159) [Ignacio Prini]
- Bowling Star (type-in, MicroHobby mamedev#160) [Ignacio Prini]
- Gas-Car (type-in, MicroHobby mamedev#161) [Ignacio Prini]
- Ghost Like (type-in, MicroHobby mamedev#162) [Ignacio Prini]
- Sky Invaders (type-in, MicroHobby mamedev#163) [Ignacio Prini]
- Perico Jones (type-in, MicroHobby mamedev#164) [Ignacio Prini]
- Brad Zotes (type-in, MicroHobby mamedev#165) [Ignacio Prini]
- Striker (type-in, MicroHobby mamedev#166) [Ignacio Prini]
- Indy (type-in, MicroHobby mamedev#167) [Ignacio Prini]
- Topin (type-in, MicroHobby mamedev#168) [Ignacio Prini]
- Starlike (type-in, MicroHobby mamedev#169) [Ignacio Prini]
- Tres en Raya (type-in, MicroHobby mamedev#170) [Ignacio Prini]
- Goteras (type-in, MicroHobby mamedev#171) [Ignacio Prini]
- Parvision (type-in, MicroHobby mamedev#172) [Ignacio Prini]
- Furax (type-in, MicroHobby mamedev#173) [Ignacio Prini]
- Duck Shooting (type-in, MicroHobby mamedev#174) [Ignacio Prini]
- Nomen Rosae (type-in, MicroHobby mamedev#175) [Ignacio Prini]
- PunkyMan (type-in, MicroHobby mamedev#176) [Ignacio Prini]
- El Retorno del Yedi (type-in, MicroHobby mamedev#177) [Ignacio Prini]
- Sky Warrior (type-in, MicroHobby mamedev#178) [Ignacio Prini]
- Reptkon (type-in, MicroHobby mamedev#179) [Ignacio Prini]
- Intro (type-in, MicroHobby mamedev#180) [Ignacio Prini]
- Keops (type-in, MicroHobby mamedev#181) [Ignacio Prini]
- Sir Gawain (type-in, MicroHobby mamedev#182) [Ignacio Prini]
- Snake (type-in, MicroHobby mamedev#183) [Ignacio Prini]
- Microbowl (type-in, MicroHobby mamedev#184) [Ignacio Prini]
- God Save the Punk (type-in, MicroHobby mamedev#185) [Ignacio Prini]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants