Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
purr-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Prateek Mishra
purr-data
Commits
390c6814
Commit
390c6814
authored
8 years ago
by
Jonathan Wilkes
Browse files
Options
Downloads
Patches
Plain Diff
add small javascript style guide, clean up c style guide
parent
67003cad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+39
-22
39 additions, 22 deletions
README.md
with
39 additions
and
22 deletions
README.md
+
39
−
22
View file @
390c6814
...
...
@@ -345,19 +345,25 @@ below) and uncast conversions from longer to shorter numerical formats.
The code doesn't respect "const" yet.
1.
1. Prefixes in structure elements. The names of structure elements always
have a K&R-style prefix, as in ((t_atom)x)->a_type, where the
"
a_
"
prefix
have a K&R-style prefix, as in
`
((t_atom)x)->a_type
`
, where the
`
a_
`
prefix
indicates "atom." This is intended to enhance readability (although the
convention arose from a limitation of early C compilers.) Common prefixes are
"w_" (word), "a_" (atom), "s_" (symbol), "ob_" (object), "te_" (text object),
"g_" (graphical object), and "gl_" (glist, a list of graphical objects). Also,
global symbols sometimes get prefixes, as in "s_float" (the symbol whose string
is "float). Typedefs are prefixed by "t_". Most _private_ structures, i.e.,
structures whose definitions appear in a ".c" file, are prefixed by "x_".
convention arose from a limitation of early C compilers.) Common prefixes are:
*
`w_`
(word)
*
`a_`
(atom)
*
`s_`
(symbol)
*
`ob_`
(object)
*
`te_`
(text object)
*
`g_`
(graphical object)
*
`gl_`
(glist, a list of graphical objects).
Also, global symbols sometimes get prefixes, as in
`s_float`
(the symbol whose
string is "float"). Typedefs are prefixed by
`t_`
. Most _private_ structures,
i.e., structures whose definitions appear in a ".c" file, are prefixed by
`x_`
.
1.
2. Function arguments. Many functions take as their first
argument a pointer named
"x"
, which is a pointer to a structure suggested
by the function prefix; e.g., canvas_dirty(x, n) where
"x"
points to a canvas
(t_canvas
*
x).
argument a pointer named
`x`
, which is a pointer to a structure suggested
by the function prefix; e.g.,
`
canvas_dirty(x, n)
`
where
`x`
points to a canvas
`
(t_canvas *x)
`
.
1.
3. Function Prototypes. Functions which are used in at least two different
files (besides where they originate) are prototyped in the appropriate include
...
...
@@ -402,6 +408,7 @@ char * or void * instead.
3.
2. Pd passes true single-precision floating-point arguments to methods;
Max uses double.
Typedefs are provided:
t_floatarg, t_intarg for arguments passed by the message system
t_float, t_int for the "word" union (in atoms, for example.)
...
...
@@ -423,6 +430,7 @@ to. The exceptions are:
post, error, bug (s_print.c)
which are all frequently called and which don't fit into simple categories.
Important packages are:
(pd-gui:) pdgui -- everything
(pd:) pd -- functions common to all "pd" objects
obj -- fuctions common to all "patchable" objects ala Max
...
...
@@ -434,16 +442,25 @@ Important packages are:
#### 5. Source file prefixes
5.
0. Source file prefixes.
PD:
s system interface
m message system
g graphics stuff
d DSP objects
x control objects
z other
s system interface
m message system
g graphics stuff
d DSP objects
x control objects
z other
PD-GUI:
t TK front end
gui GUI front end
#### 6. Javascript style
1.
Brackets on the same line as declaration or expression:
`if (a) {`
2.
Single line comments only:
`//`
3.
Use double-quotes for strings
4.
Use underscores to separate words of function names and variables
### GUI Messaging Specification
#### Public GUI interface
...
...
@@ -462,13 +479,13 @@ The public interface consists of the following:
gui_vmess
(
const
char
*
msg
,
const
char
*
format
,
...);
```
where const char
*
format consists of zero or more of the following:
where
`
const char *format
`
consists of zero or more of the following:
*
f - floating point value (t_float)
*
i - integer (int)
*
s - c string (char
*
)
*
f - floating point value (
`
t_float
`
)
*
i - integer (
`
int
`
)
*
s - c string (
`
char*
)
* x - hexadecimal integer value, with a precision of at least six digits.
(hex value is preceded by an 'x', like
"
x123456
"
)
(hex value is preceded by an 'x', like
`
x123456
`
)
For some of Pd's internals like array visualization, the message length may
vary. For these _special_ cases, the following functions allow the developer
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment