Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
tef
May 30, 2004

-> some l-system crap ->
Also,

[code]
str = (char *)calloc(strlen(visitIdent(_p_->u.stm_.ident_))+2, sizeof(char));

Should be:
str = malloc(strlen(visitIdent(_p_->u.stm_.ident_))+2);
[code]

As sizeof(char) is always 1.

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

TurtleBoy posted:

What is the best way to implement this?

Do not distribute your game.

tef
May 30, 2004

-> some l-system crap ->

Adiabatic posted:

Nope. Right now the ability to store the information then recall it in an array is easy, it's the last part, printing only what was rated with the other info thats catching me up.

Try doing a practice run on paper with some data to see how you would store and retrieve it.

If you know how to retrieve all the data and print it -- it shouldn't be too hard to think about how to retireve all the data, and print the ones that meet a condition.
code:
for each element in array:
   print array

for each element in array:
   if element is one we want to print:
      print array
The forum isn't the best place to get this sort of interactive help -- someone may take pity on you and walk you through this on irc (irc.synirc.net/#cobol).

tef
May 30, 2004

-> some l-system crap ->

clockwork automaton posted:

Haha, thank you! A simple sudo solved all my problems.

If you are doing this, you want to look at dropping priviledges after binding to the socket.

Edit: although you'll need root priviledges to fork off login shells for incoming connections.

OpenSSH handles this by having a small, trusted root process and a locked down network process

http://www.citi.umich.edu/u/provos/ssh/privsep.html

tef fucked around with this message at 12:51 on May 13, 2008

tef
May 30, 2004

-> some l-system crap ->

Vanadium posted:

It is not browser specific, the forums do the substitution. You can tell by looking at the source. :ssh:

Except I see &pi in Opera in the posts above, not π

tef
May 30, 2004

-> some l-system crap ->

Alan Greenspan posted:

Does anybody know of a C++ parser framework that can load BNF grammar files and generate a parser for them on the fly?

As mentioned on irc - it sounds like you're after a DSL for parsing, but you would be better off sticking to well known languages rather than inventing your own.

For your problem I would suggest using an api to allow the end-users to write their own parsers, and perhaps some sample ANTLR code for well known assembly.

If you do end up going down the dsl route, I would suggest PEGs or OMeta to look at, but when speed is your main concern it will be easier to get the end user to write a fast parser than to write a just in time grammar compiler.

tef
May 30, 2004

-> some l-system crap ->

TSDK posted:

I also seem to remember that there are calls you can make to detach a child so that this doesn't happen.

I think you can also fork twice if you want to detach from the parent.

Edit: that said, if you kill the parent the child should be adopted by init. Something is going wrong here,

tef fucked around with this message at 14:06 on Aug 21, 2008

tef
May 30, 2004

-> some l-system crap ->
I think you might want the .NET thread, http://forums.somethingawful.com/showthread.php?threadid=2262300

tef
May 30, 2004

-> some l-system crap ->
http://merd.sourceforge.net/pixel/language-study/syntax-across-languages/Mthmt.html#MthmtPwr

this is pretty useful.

^ Awk, Dylan, Eiffel, Lua, Mathematica, Matlab, Pliant, Yorick

** Ada, Classic REXX, E, F#, Fortran, Io, merd, OCaml, Perl, Perl6, PL/I, Prolog, Python, Rebol, Ruby, Tcl8.5

tef
May 30, 2004

-> some l-system crap ->

hexadecimal posted:

What I got from this is that it's pretty much hardware dependent? If so, how would I make a program to detect specific system being used at 1) compile time, 2) run-time?

HAKMEN posted:

ITEM 154 (Gosper):
The myth that any given programming language is machine independent is easily exploded by computing the sum of powers of 2.
  • If the result loops with period = 1 with sign +, you are on a sign-magnitude machine.
  • If the result loops with period = 1 at -1, you are on a twos-complement machine.
  • If the result loops with period > 1, including the beginning, you are on a ones-complement machine.
  • If the result loops with period > 1, not including the beginning, your machine isn't binary -- the pattern should tell you the base.
  • If you run out of memory, you are on a string or Bignum system.
  • If arithmetic overflow is a fatal error, some fascist pig with a read-only mind is trying to enforce machine independence. But the very ability to trap overflow is machine dependent.
By this strategy, consider the universe, or, more precisely, algebra:

let X = the sum of many powers of two = ...111111
now add X to itself; X + X = ...111110
thus, 2X = X - 1 so X = -1
therefore algebra is run on a machine (the universe) which is twos-complement.

tef
May 30, 2004

-> some l-system crap ->
(that is if you leave out little implementation details like call/cc)

tef
May 30, 2004

-> some l-system crap ->

froobly posted:

Is that really that hard to read? Do you find it error-prone?

I think the point is not about what you are doing, but what you are avoiding: turning on warnings.

tef
May 30, 2004

-> some l-system crap ->

Sweeper posted:

Does anyone have any good resources on Hash Tables and implementing them in C?

Wikipedia gives a good description of how a hash table works, and K&R is a good guide to programming in C.


Although I would recommend using a library over writing your own

tef
May 30, 2004

-> some l-system crap ->

RussianManiac posted:

:words:

http://en.wikipedia.org/wiki/Rope_(computer_science)

If you have large strings you may find ropes to be a useful representation of them


quote:

Am I better off implementing my own immutable string class?

Signs point to no.

tef fucked around with this message at 16:12 on Nov 1, 2009

tef
May 30, 2004

-> some l-system crap ->
The international version doesn't have a dragon :(

http://www.amazon.co.uk/Compilers-Principles-Techniques-Alfred-Aho/dp/0321491696/

tef
May 30, 2004

-> some l-system crap ->
I hear nice things about lemon, (used in sqlite)

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

shrughes posted:

Edit: er, I meant this post to be an edit.

It's impossible to be generic over tuples with respect to the size of a tuple. Each tuple type is completely independent.

What about dependent typed languges :3:

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply